Project import generated by Copybara. GitOrigin-RevId: 834d795adbe6b5a76eac8f4ccaa09ecba5694558
diff --git a/wlan_sd8987/BUILD.bazel b/wlan_sd8987/BUILD.bazel new file mode 100644 index 0000000..4d9eb5b --- /dev/null +++ b/wlan_sd8987/BUILD.bazel
@@ -0,0 +1,17 @@ +# NXP driver is a Wi-Fi driver used for ATV products. +load("//build/kernel/kleaf:kernel.bzl", "kernel_module") + +kernel_module( + name = "nxp-driver", + srcs = glob([ + "**/*.c", + "**/*.h", + ]), + outs = [ + "moal.ko", + "mlan.ko", + ], + kernel_build = "//common:amlogic", + visibility = ["//visibility:public"], +) +
diff --git a/wlan_sd8987/Makefile b/wlan_sd8987/Makefile index c92175c..69a199b 100755 --- a/wlan_sd8987/Makefile +++ b/wlan_sd8987/Makefile
@@ -15,7 +15,6 @@ # ARE EXPRESSLY DISCLAIMED. The License provides additional details about # this warranty disclaimer. # - CONFIG_COMPATDIR=n ifeq ($(CONFIG_COMPATDIR), y) COMPATDIR=/lib/modules/$(KERNELVERSION_X86)/build/compat-wireless-3.2-rc1-1/include @@ -23,12 +22,10 @@ else CC ?= $(CROSS_COMPILE)gcc endif - LD ?= $(CROSS_COMPILE)ld STRIP ?= $(CROSS_COMPILE)strip BACKUP= /root/backup YMD= `date +%Y%m%d%H%M` - ############################################################################# # Configuration Options ############################################################################# @@ -50,42 +47,28 @@ CONFIG_SD9098=n CONFIG_USB9098=n CONFIG_PCIE9098=n - - # Debug Option # DEBUG LEVEL n/1/2: # n: NO DEBUG # 1: Only PRINTM(MMSG,...), PRINTM(MFATAL,...), ... # 2: All PRINTM() CONFIG_DEBUG=1 - # Enable STA mode support CONFIG_STA_SUPPORT=y - # Enable uAP mode support CONFIG_UAP_SUPPORT=y - # Enable WIFIDIRECT support CONFIG_WIFI_DIRECT_SUPPORT=y - # Enable Wi-Fi Latency mode setting support CONFIG_WIFI_SET_LATENCY_MODE=y - # Re-association in driver CONFIG_REASSOCIATION=y - - # Manufacturing firmware support CONFIG_MFG_CMD_SUPPORT=y - # OpenWrt support CONFIG_OPENWRT_SUPPORT=n - # Big-endian platform CONFIG_BIG_ENDIAN=n - - - ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y) CONFIG_EMBEDDED_SUPP_AUTH=y else @@ -93,39 +76,24 @@ CONFIG_EMBEDDED_SUPP_AUTH=y endif endif - #ifdef SDIO_MMC # SDIO suspend/resume CONFIG_SDIO_SUSPEND_RESUME=y #endif - # DFS testing support CONFIG_DFS_TESTING_SUPPORT=y - - - - # Use static link for app build export CONFIG_STATIC_LINK=y CONFIG_ANDROID_KERNEL=y - #32bit app over 64bit kernel support CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=y - - ############################################################################# # Select Platform Tools ############################################################################# - MODEXT = ko ccflags-y += -Wno-unknown-warning-option -Wno-typedef-redefinition -Wno-pointer-bool-conversion -Wno-self-assign -Wno-parentheses-equality ccflags-y += -I$(PWD)/mlan ccflags-y += -DLINUX - - - - - ARCH ?= arm64 CONFIG_IMX_SUPPORT=n ifeq ($(CONFIG_IMX_SUPPORT),y) @@ -133,34 +101,25 @@ endif KERNELDIR ?= $(KERNEL_SRC) CROSS_COMPILE ?= /usr/local/arm/androidQ_toolchain/aarch64-linux-android-4.9/bin/aarch64-linux-android- - LD += -S - BINDIR = ../bin_wlan APPDIR= $(shell if test -d "mapp"; then echo mapp; fi) - ############################################################################# # Compiler Flags ############################################################################# - ccflags-y += -I$(KERNELDIR)/include - ccflags-y += -DFPNUM='"92"' - ifeq ($(CONFIG_DEBUG),1) ccflags-y += -DDEBUG_LEVEL1 endif - ifeq ($(CONFIG_DEBUG),2) ccflags-y += -DDEBUG_LEVEL1 ccflags-y += -DDEBUG_LEVEL2 DBG= -dbg endif - ifeq ($(CONFIG_64BIT), y) ccflags-y += -DMLAN_64BIT endif - ifeq ($(CONFIG_STA_SUPPORT),y) ccflags-y += -DSTA_SUPPORT ifeq ($(CONFIG_REASSOCIATION),y) @@ -171,7 +130,6 @@ CONFIG_STA_WEXT=n CONFIG_STA_CFG80211=n endif - ifeq ($(CONFIG_UAP_SUPPORT),y) ccflags-y += -DUAP_SUPPORT else @@ -179,54 +137,41 @@ CONFIG_UAP_WEXT=n CONFIG_UAP_CFG80211=n endif - ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y) ccflags-y += -DWIFI_DIRECT_SUPPORT endif - # Enables setting WiFi low-latency mode feature. ifeq ($(CONFIG_WIFI_SET_LATENCY_MODE), y) ccflags-y += -DWIFI_LATENCY_MODE_SUPPORT endif - ifeq ($(CONFIG_MFG_CMD_SUPPORT),y) ccflags-y += -DMFG_CMD_SUPPORT endif - ifeq ($(CONFIG_BIG_ENDIAN),y) ccflags-y += -DBIG_ENDIAN_SUPPORT endif - ifeq ($(CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT),y) ccflags-y += -DUSERSPACE_32BIT_OVER_KERNEL_64BIT endif - #ifdef SDIO_MMC ifeq ($(CONFIG_SDIO_SUSPEND_RESUME),y) ccflags-y += -DSDIO_SUSPEND_RESUME endif #endif - - ifeq ($(CONFIG_DFS_TESTING_SUPPORT),y) ccflags-y += -DDFS_TESTING_SUPPORT endif - - ifeq ($(CONFIG_ANDROID_KERNEL), y) ccflags-y += -DANDROID_KERNEL endif - ifeq ($(CONFIG_OPENWRT_SUPPORT), y) ccflags-y += -DOPENWRT endif - ifeq ($(CONFIG_T50), y) ccflags-y += -DT50 ccflags-y += -DT40 ccflags-y += -DT3T endif - ifeq ($(CONFIG_SD8887),y) CONFIG_SDIO=y ccflags-y += -DSD8887 @@ -305,7 +250,6 @@ ifeq ($(CONFIG_PCIE),y) ccflags-y += -DPCIE endif - ifeq ($(CONFIG_MAC80211_SUPPORT),y) ccflags-y += -DMAC80211_SUPPORT endif @@ -315,7 +259,6 @@ ifeq ($(CONFIG_MAC80211_SUPPORT_MESH),y) ccflags-y += -DMAC80211_SUPPORT_MESH endif - # add -Wno-packed-bitfield-compat when GCC version greater than 4.4 GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc ) ifeq ($(GCC_VERSION),1) @@ -334,9 +277,7 @@ ############################################################################# # Make Targets ############################################################################# - ifneq ($(KERNELRELEASE),) - ifeq ($(CONFIG_WIRELESS_EXT),y) ifeq ($(CONFIG_WEXT_PRIV),y) # Enable WEXT for STA @@ -350,7 +291,6 @@ CONFIG_UAP_WEXT=n endif endif - # Enable CFG80211 for STA ifeq ($(CONFIG_CFG80211),y) CONFIG_STA_CFG80211=y @@ -361,7 +301,6 @@ CONFIG_STA_CFG80211=n endif endif - # OpenWrt ifeq ($(CONFIG_OPENWRT_SUPPORT), y) ifeq ($(CPTCFG_CFG80211),y) @@ -374,7 +313,6 @@ endif endif endif - # Enable CFG80211 for uAP ifeq ($(CONFIG_CFG80211),y) CONFIG_UAP_CFG80211=y @@ -385,7 +323,6 @@ CONFIG_UAP_CFG80211=n endif endif - # OpenWrt ifeq ($(CONFIG_OPENWRT_SUPPORT), y) ifeq ($(CPTCFG_CFG80211),y) @@ -398,19 +335,16 @@ endif endif endif - ifneq ($(CONFIG_STA_SUPPORT),y) CONFIG_WIFI_DIRECT_SUPPORT=n CONFIG_STA_WEXT=n CONFIG_STA_CFG80211=n endif - ifneq ($(CONFIG_UAP_SUPPORT),y) CONFIG_WIFI_DIRECT_SUPPORT=n CONFIG_UAP_WEXT=n CONFIG_UAP_CFG80211=n endif - ifeq ($(CONFIG_STA_SUPPORT),y) ifeq ($(CONFIG_STA_WEXT),y) ccflags-y += -DSTA_WEXT @@ -427,7 +361,6 @@ ccflags-y += -DUAP_CFG80211 endif endif - print: ifeq ($(CONFIG_STA_SUPPORT),y) ifeq ($(CONFIG_STA_WEXT),n) @@ -445,23 +378,16 @@ endif endif endif - - - - - MOALOBJS = mlinux/moal_main.o \ mlinux/moal_ioctl.o \ mlinux/moal_shim.o \ mlinux/moal_eth_ioctl.o \ mlinux/moal_init.o - MLANOBJS = mlan/mlan_shim.o mlan/mlan_init.o \ mlan/mlan_txrx.o \ mlan/mlan_cmdevt.o mlan/mlan_misc.o \ mlan/mlan_cfp.o \ mlan/mlan_module.o - MLANOBJS += mlan/mlan_wmm.o ifeq ($(CONFIG_MUSB),y) MLANOBJS += mlan/mlan_usb.o @@ -514,26 +440,16 @@ MOALOBJS += mlinux/moal_cfg80211_util.o MOALOBJS += mlinux/moal_uap_cfg80211.o endif - ifdef CONFIG_PROC_FS MOALOBJS += mlinux/moal_proc.o MOALOBJS += mlinux/moal_debug.o endif - ifeq ($(CONFIG_MAC80211_SUPPORT),y) MOALOBJS += mlinux/moal_mac80211.o MLANOBJS += mlan/mlan_mac80211.o endif - - - - - - - obj-m := mlan.o mlan-objs := $(MLANOBJS) - ifeq ($(CONFIG_MUSB),y) MOALOBJS += mlinux/moal_usb.o endif @@ -545,53 +461,39 @@ endif obj-m += moal.o moal-objs := $(MOALOBJS) - # Otherwise we were called directly from the command line; invoke the kernel build system. else - +EXTRA_SYMBOLS += ${OUT_DIR}/../nxp-driver/wlan_sd8987/Module.symvers default: - $(MAKE) -C $(KERNELDIR) M=$(M) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules - + $(MAKE) -C $(KERNELDIR) M=$(M) ARCH=$(ARCH) KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules modules_install: $(MAKE) INSTALL_MOD_STRIP=1 M=$(M) -C $(KERNELDIR) modules_install mkdir -p ${OUT_DIR}/../vendor_lib/modules cd ${OUT_DIR}/$(M)/; find -name mlan.ko -exec cp {} ${OUT_DIR}/../vendor_lib/modules/mlan.ko \; cd ${OUT_DIR}/$(M)/; find -name moal.ko -exec cp {} ${OUT_DIR}/../vendor_lib/modules/moal.ko \; - endif - ############################################################### - export CC LD ccflags-y KERNELDIR - .PHONY: mapp/mlanconfig mapp/mlanutl clean distclean @echo "Finished Making NXP Wlan Linux Driver" - mapp/mlanconfig: $(MAKE) -C $@ mapp/mlanutl: $(MAKE) -C $@ - echo: - build: echo default - @if [ ! -d $(BINDIR) ]; then \ mkdir $(BINDIR); \ fi - cp -f mlan.$(MODEXT) $(BINDIR)/mlan$(DBG).$(MODEXT) - cp -f moal.$(MODEXT) $(BINDIR)/moal$(DBG).$(MODEXT) cp -rpf script/load $(BINDIR)/ cp -rpf script/unload $(BINDIR)/ - cp -f README_MLAN $(BINDIR) ifneq ($(APPDIR),) $(MAKE) -C mapp/mlanconfig $@ INSTALLDIR=$(BINDIR) $(MAKE) -C mapp/mlanutl $@ INSTALLDIR=$(BINDIR) endif - clean: -find . -name "*.o" -exec rm {} \; -find . -name "*.ko" -exec rm {} \; @@ -609,14 +511,11 @@ endif #ifdef SDIO #endif // SDIO - install: default - cp -f mlan.$(MODEXT) $(INSTALLDIR)/mlan$(DBG).$(MODEXT) cp -f moal.$(MODEXT) $(INSTALLDIR)/moal$(DBG).$(MODEXT) echo $(INSTALLDIR) echo "MX Driver Installed" - distclean: -find . -name "*.o" -exec rm {} \; -find . -name "*.orig" -exec rm {} \; @@ -637,5 +536,4 @@ $(MAKE) -C mapp/mlanconfig $@ $(MAKE) -C mapp/mlanutl $@ endif - # End of file
diff --git a/wlan_sd8987/README_MLAN b/wlan_sd8987/README_MLAN index d629987..3a347f3 100755 --- a/wlan_sd8987/README_MLAN +++ b/wlan_sd8987/README_MLAN
@@ -1,7 +1,7 @@ =============================================================================== U S E R M A N U A L - Copyright 2008-2021 NXP + Copyright 2008-2022 NXP 1) FOR DRIVER BUILD @@ -9,7 +9,7 @@ Goto source code directory wlan_src/. make [clean] build The driver and utility binaries can be found in ../bin_xxxx directory. - The driver code supports Linux kernel from 2.6.32 to 5.8.0. + The driver code supports Linux kernel from 2.6.32 to 6.0.0. 2) FOR DRIVER INSTALL @@ -23,7 +23,7 @@ max_sta_bss: Maximum number of STA BSS (default 1, max 1) sta_name: Name of the STA interface (default: "mlan") - max_uap_bss: Maximum number of uAP BSS (default 1, max 1) + max_uap_bss: Maximum number of uAP BSS (default 1, max 2) uap_name: Name of the uAP interface (default: "uap") max_wfd_bss: Maximum number of WIFIDIRECT BSS (default 1, max 1) wfd_name: Name of the WIFIDIRECT interface (default: "wfd") @@ -44,12 +44,20 @@ To load driver with MFG firmware file, use mfg_mode=1 when insmod WLAN driver and specify MFG firmware name if needed. + To load driver with rf_test firmware file, use rf_test_mode=1 when insmod WLAN driver. + This parameter only used for 9177(FC) + There are some other parameters for debugging purpose etc. Use modinfo to check details. drvdbg=<bit mask of driver debug message control> dev_cap_mask=<Bit mask of the device capability> mac_addr=xx:xx:xx:xx:xx:xx <override the MAC address (in hex)> auto_ds=0|1|2 <use MLAN default | enable auto deepsleep | disable auto deepsleep> + ext_scan=0|1|2 <use MLAN default | Enable Extended Scan| Enable Enhanced Extended Scan> + net_rx=0|1 <use netif_rx_ni in rx | use netif_receive_skb in rx> + amsdu_deaggr=0|1 <default | Try avoid buf copy in amsud deaggregation> + ps_mode=0|1|2 <use MLAN default | enable IEEE PS mode | disable IEEE PS mode> + sched_scan=0|1 <disable sched_scan | enable sched_scan default> max_tx_buf=2048|4096|8192 <maximum AMSDU Tx buffer size> pm_keep_power=1|0 <PM keep power in suspend (default) | PM no power in suspend> shutdown_hs=1|0 <Enable HS when shutdown | No HS when shutdown (default)> @@ -57,10 +65,13 @@ dts_enable=0|1 <Disable DTS | Enable DTS (default)> fw_name = <FW file name> e.g. copy pcieuart9098_combo_v1.bin to firmware directory, fw_name=nxp/pcieuart9098_combo_v1.bin + hw_name = <hardware name> + reg_work=0|1 <Disable register work queue| Enable register work queue> hw_test=0|1 <Disable hardware test (default) | Enable hardware test> fw_serial=0|1 <support parallel download FW | support serial download FW (default)> req_fw_nowait=0|1 <use request_firmware API (default) | use request_firmware_nowait API> dfs53cfg=0|1|2 <use Fw Default | New W53 | Old W53> + mcs32=0|1 <disable HT MCS32 support | enable HT MCS32 (default)> SD8887: antcfg=0|1|2|0xffff <default | Tx/Rx antenna 1 | Tx/Rx antenna 2 | enable antenna diversity> SD8897/SD8997: antcfg=0x11|0x13|0x33 <Bit0:Rx Path A, Bit1:Rx Path B, Bit 4:Tx Path A, Bit 5:Tx Path B> slew_rate: Slew Rate Control value = 0|1|2|3 (0 is the slowest slew rate and 03 has the highest slew rate (default)) @@ -87,6 +98,7 @@ Bit 1: uAP WEXT Bit 2: STA CFG80211 Bit 3: uAP CFG80211 + cfg80211_drcs=1|0 <Enable DRCS support (default) | Disable DRCS support> reg_alpha2=<Regulatory alpha2 (default NULL)> skip_fwdnld=0|1 <enable FW download support (default) | disable FW download support> wq_sched_prio: Priority for work queue @@ -98,6 +110,7 @@ rx_work=0|1|2 <default | Enable rx_work_queue | Disable rx_work_queue> pcie_int_mode=0|1|2 <Legacy mode, MSI mode (default), MSI-X mode> pcie_int_mode=0|1 <Legacy mode, MSI mode (default)> + ring_size=32|64|128|256|512 <adma ring size for 9097/9098> aggrctrl=1|0 <enable Tx aggr | disable Tx aggr> usb_aggr=0|1|2 <use MLAN default (disabled) | enable USB aggr | disable USB aggr> low_power_mode_enable=0|1 <disable low power mode (default)| enable low power mode> @@ -117,11 +130,22 @@ GoAgeoutTime=0|x <use default ageout time (default) | set Go age out time xTU(TU 100ms)> multi_dtim=0|x <use default DTIM interval(default) | set x*beacon_period as DTIM interval> inact_tmo=0|x <use default IEEE ps inactivity timout value (default) | use IEEE ps inactivity timeout value x ms> + drcs_chantime_mode=0|x <channel time and mode for DRCS, use default value (default) | use setting value> + Bit31~Bit24:Channel time for channel index0; + Bit23~Bit16:mode for channel index0; 0|1 <PM1 | Null2Self> + Bit15~Bit8:Channel time for channel index1; + Bit7~Bit0:mode for channel index1; 0|1 <PM1 | Null2Self> + roamoffload_in_hs=0|1 <always enable fw roaming (default) | enable fw roaming only when host suspend> uap_max_sta: Maximum number of STA for UAP/GO (default 0, max 64) - host_mlme=0|1 <Disable Host MLME support (default)| Enable Host MLME support> + host_mlme=0|1 <Operate in non-host_mlme mode | Operate in host_mlme mode (default)> + for supplicant/authenticator running on host side, WPA3 support is available only in host_mlme mode country_ie_ignore=0|1 <Follow countryIE from AP and beacon hint enable (default) | Ignore countryIE from AP and beacon hint disable> beacon_hints=0|1 <enable beacon hints(default) | disable beacon hints> + chan_track=0|1 <restore channel tracking parameters(default) | set channel tracking new parameters> for 9098 only + keep_previous_scan=0|1, <Flush previous scan result before start scan | Keep previous scan result(default)> + + Note: On some platforms (e.g. PXA910/920) double quotation marks ("") need to used for module parameters. insmod sdxxx.ko "<para1> <para2> ..." @@ -153,10 +177,10 @@ num_rx_pkts_err = <number of Rx packets failed to receive from device> carrier "on" | "off" tx queue "stopped" | "started" - tkip_mic_failures = 0 // Only for uAP + tkip_mic_failures = 0 // Only for uAP (use of WEP/TKIP is not recommended anymore) ccmp_decrypt_errors = 0 // Only for uAP - wep_undecryptable_count = 0 // Only for uAP - wep_icv_error_count = 0 // Only for uAP + wep_undecryptable_count = 0 // Only for uAP (use of WEP/TKIP is not recommended anymore) + wep_icv_error_count = 0 // Only for uAP (use of WEP/TKIP is not recommended anymore) decrypt_failure_count = 0 // Only for uAP mcast_tx_count = 0 // Only for uAP failed_count = 0 // Only for uAP @@ -170,7 +194,7 @@ mcast_rx_frame_count = 0 // Only for uAP fcs_error_count = 0 // Only for uAP tx_frame_count = 0 // Only for uAP - rsna_tkip_cm_invoked = 0 // Only for uAP + rsna_tkip_cm_invoked = 0 // Only for uAP (use of WEP/TKIP is not recommended anymore) rsna_4way_hshk_failures = 0 // Only for uAP The following debug info are provided in /proc/net/mwlan/adapterX/mlanY|uapY|wfdY/debug, @@ -276,6 +300,10 @@ Examples: echo "debug_dump" > /proc/mwlan/adapterX/config # dump driver internal debug status. + To obtain fw dump or driver dump, use command: + cat /proc/mwlan/adapter0/drv_dump > file_drv_dump #save the drv dump to file_drv_dump + cat /proc/mwlan/adapter0/fw_dump > file_fw_dump #save the fw dump to file_fw_dump + cat /proc/mwlan/adapter1/drv_dump > file_drv_dump_2 #save the adapter1 drv dump to file_drv_dump_2 Use dmesg or cat /var/log/debug to check driver debug messages. @@ -355,6 +383,14 @@ Path ID (0: PathA, 1:PathB, 2:PathA+B) echo "tx_power=16 2 0" > /proc/mwlan/adapterX/config + Set MFG HE TB Tx to configure Trigger based TX reponse + Enable Tx (0:disable, 1:enable) + Q num (0-7 : TCQs 0-7, 17-20: AXQs 0-3) + AID (Association ID as applicable) + AXQ MU Timer(to set the MU EDCA Timer for the Queue) + Tx Power (-11 to 9 dBm) + echo "he_tb_tx=1 1 5 400 10" > /proc/mwlan/adapterX/config + Set Tx Continuous Mode Start (0:disable, 1:enable) Continuous Wave Mode (0:disable, 1:enable) @@ -391,6 +427,13 @@ Beamforming (0:disable, 1:enable) GreenField Mode (0:disable, 1:enable) STBC (0:disable, 1:enable) + NumPkt (Set to default value -1) + MaxPktExt (Set to default value -1) + BeamChange (Set to default value -1) + DCM (Set to default value -1) + Doppler (Set to default value -1) + MidamblePeriod (Set to default value -1) + QNum (Set to default value 1) BSSID (xx:xx:xx:xx:xx:xx) Example: To start Tx frame with duty cycle, first stop any ongoing Tx @@ -398,6 +441,94 @@ echo "tx_frame=0" > /proc/mwlan/adapterX/config echo "tx_frame=1 7 0xAAA 0x100 1 20 0 0 0 0 0 0 0 05:43:3f:c4:51" > /proc/mwlan/adapterX/config + Configure Trigger Frame + Example: To configure Trigger frame: + echo "trigger_frame=1 0 1 2 5484 0 256 0 0 2 1 0 0 0 1 60 1 0 65535 0 511 5 0 67 0 0 0 0 90 0 0 0 0" > /proc/mwlan/adapter0/config + + Example: To disable configuration of Trigger frame: + echo "trigger_frame=0" > /proc/mwlan/adapter0/config + + For more information about trigger frame configuration as per supported BW(80MHz, 40MHz and 20MHz), + Please refer : config/trigger_frame_cfg.conf + + Example : To start trigger frame transmission : + echo "rf_test_mode=1" > /proc/mwlan/adapter0/config + echo "band=1" > /proc/mwlan/adapter0/config + echo "bw=0" > /proc/mwlan/adapter0/config + echo "channel=36" > /proc/mwlan/adapter0/config + echo "trigger_frame=1 0 1 2 5484 0 256 0 0 0 1 0 0 0 1 60 1 0 65535 0 511 5 0 61 0 0 0 0 90 0 0 0 0" > /proc/mwlan/adapter0/config + echo "tx_frame=1 0x1102 0xabababab 200" >/proc/mwlan/adapter0/config + +6) Set host sleep parameters + + hssetpara + This command is used to set host sleep parameters. + Example: + echo "hssetpara=2 0xff 0xc8 3 400" > /proc/mwlan/adapter0/config + echo "hssetpara=2 1 0xc8 3 400 " > /proc/mwlan/adapter0/config + +7) For Antenna Diversity Command + + antcfg + This command is used to set/get the mode of Tx/Rx path. + + GET Command Format: cat /proc/mwlan/adapter0/config + SET Command Format: echo "antcfg=[m] [n] [o] [p]" > /proc/mwlan/adapter0/config + + For chip which support STREAM_2X2 + where value of m is: + Bit 0 -- Tx Path A or Tx/Rx Path A if [n] is not provided + Bit 1 -- Tx Path B or Tx/Rx Path B if [n] is not provided + Bit 0-1 -- Tx Path A+B or Tx/Rx Path A+B if [n] is not provided + For 9097/9098/IW62X, LOW BYTE for 2G setting + Bit 8 -- Tx Path A or Tx/Rx Path A if [n] is not provided + Bit 9 -- Tx Path B or Tx/Rx Path B if [n] is not provided + Bit 8-9 -- Tx Path A+B or Tx/Rx Path A+B if [n] is not provided + For 9097/9098/IW62X, HIGH BYTE for 5G setting + where value of n is: + Bit 0 -- Rx Path A + Bit 1 -- Rx Path B + Bit 0-1 -- Rx Path A+B + For 9097/9098/IW62X, LOW BYTE for 2G setting + Bit 8 -- Rx Path A + Bit 8 -- Rx Path B + Bit 8-9 -- Rx Path A+B + For 9097/9098/IW62X, HIGH BYTE for 5G setting + The Tx path setting (m) is used for both Tx and Rx if Rx path (n) is not provided. + + Examples: + cat /proc/mwlan/adapter0/config : Get Tx and Rx path + echo "antcfg=3" > /proc/mwlan/adapter0/config : Set Tx and Rx path to A+B + echo "antcfg=1 3" > /proc/mwlan/adapter0/config : Set Tx path to A and Rx path to A+B + + echo "antcfg=0x103" > /proc/mwlan/adapter0/config : Set Tx and Rx path to A+B on 2G and Tx and Rx path to A on 5G + echo "antcfg=0x103 0x103" > /proc/mwlan/adapter0/config : Set Tx path to A+B and Rx path to A+B on 2G, and Tx and Rx path to A on 5G + + echo "antcfg=0x202" > /proc/mwlan/adapter0/config : Use 5GHz path B pin for 5G TX/RX and 2GHz path B pin for 2G TX/RX + + On RD board connection is as follows : + 5GHz path A pin -> AntA + 5GHz path B pin -> AntB + 2GHz path A pin -> AntB + 2GHz path B pin -> AntA + + For chip which support SAD + where value of m is: + Bit 0 -- Tx/Rx antenna 1 + Bit 1 -- Tx/Rx antenna 2 + ... + 0xFFFF -- Tx/Rx antenna diversity + + where value of n is: + SAD evaluate time interval, only be provided when m = 0xFFFF, default value is 6s(0x1770) + + Examples: + cat /proc/mwlan/adapter0/config : Get Tx/Rx antenna mode + echo "antcfg=1" > /proc/mwlan/adapter0/config : Set Tx/Rx antenna 1 + echo "antcfg=0xFFFF" > /proc/mwlan/adapter0/config : Set Tx/Rx antenna diversity + echo "antcfg=0xFFFF 0x1770" > /proc/mwlan/adapter0/config : Set antenna evaluate time interval to 6s + + =============================================================================== U S E R M A N U A L F O R MLANUTL @@ -412,6 +543,7 @@ mlanutl mlanX verext mlanutl mlanX version mlanutl mlanX hostcmd <conf> generate_raw <raw_data_file> + mlanutl mlanX hostcmd <send_om.conf> send_om_set mlanutl mlanX getdatarate mlanutl uapX getdatarate mlanutl mlanX drvdbg [n] @@ -436,6 +568,262 @@ mlanutl mlanX 11axcmd <subcmd> <value> mlanutl mlanX txratecfg [l] [m] [n] [o] mlanutl uapX txratecfg [l] [m] [n] [o] + mlanutl mlanX txwatchdog [l] + mlanutl uapX txwatchdog [l] + mlanutl mlanX hssetpara condition [GPIO# [gap]] [ind_GPIO# [level]] + mlanutl mlanX mefcfg <mef.conf> + mlanutl mlanX cloud_keep_alive <keep_alive.conf> <start/stop/reset> + mlanutl mlanX min_ba_threshold <n> + mlanutl mlanX 11dcfg + mlanutl mlanX 11dclrtbl + mlanutl mlanX addts <filename.conf> <section# of tspec> <timeout in ms> + mlanutl mlanX amsduaggrctrl <n> + mlanutl mlanX antcfg [m] [n] + mlanutl mlanX/uapX mimoswitch [tx_antmode] [rx_antmode] + mlanutl mlanX arpfilter <arpfilter.conf> + mlanutl mlanX assocctrl <j> [k] [l] [m] [n] + mlanutl mlanX assocessid <"[essid]"> + mlanutl mlanX assocessid_bssid <"[bssid] [essid]"> + mlanutl mlanX associate "<bssid> <ssid>" + mlanutl mlanX get_chnrgpwr [save_region_channel_power_data_file] + mlanutl mlanX comparergpwr <uncompressed file> [target_file] + mlanutl mlanX comparetrpc <target_file> <src_file> [display] + mlanutl mlanX getcfgchanlist + mlanutl mlanX authtype [n] + mlanutl mlanX autotdls [n] + mlanutl mlanX tdls_idle_time [n] + mlanutl uapX dfs_offload [n] + mlanutl mlanX bandcfg [l] [m] [n] + mlanutl mlanX bcninterval [n] + mlanutl wfdX bssrole [l] + mlanutl mlanX cfgdata <register type> [<conf file>] + mlanutl mlanX cfpcode [m] [n] + mlanutl mlanX changraph [<load | anpi | anpiload> <loops>] + mlanutl mlanX coex_rx_winsize [m] + mlanutl mlanX countrycode [l] + + mlanutl mlanX cfpinfo + mlanutl uapX cfpinfo + + mlanutl mlanX customie [[[<index>] <mask>] <IEBuffer>] + mlanutl mlanX deauth [l] + mlanutl uapX deauth [l] + mlanutl mlanX deepsleep [l] [m] + mlanutl mlanX delba <l> [<m> <n>] + mlanutl uapX delba <l> [<m> <n>] + mlanutl mlanX delts <filename.conf> <section# of tspec> + mlanutl mlanX dfstesting [<user_cac_pd> <user_nop_pd> <no_chan_change> <fixed_chan_num><cac_restart>] + mlanutl uapX clear_nop + mlanutl uapX nop_list + mlanutl uapX fake_radar + mlanutl uapX getchload <duration> [<cca_threshold>] + mlanutl uapX getchload <duration> + mlanutl dfsX dfs_cac <channel> [<bw> <cac-period>] + mlanutl dfsX autodfs <stop | start> [conf_file] + mlanutl mlanX dfs_repeater [n] + mlanutl mlanX dfs53cfg [n] + mlanutl uapX dfs_mode [n] + mlanutl mlanX esuppmode [l] [m] [n] + mlanutl mlanX extcapcfg [<ext_cap>] + mlanutl mlanX fwmacaddr [mac_addr] + mlanutl mlanX getkey + mlanutl mlanX getscantable [ARGS] + mlanutl uapX getstalist + mlanutl uapX channel_switch <switch mode> <oper class> <new channel> <switch count> <bandwidth/num_pkts> + mlanutl uapX channel_switch <switch mode> <oper class> <new channel> <switch count> <bandwidth> + mlanutl mlanX hostcmd <11n_2040coex.conf> 2040coex + mlanutl mlanX hostcmd <auto_tx.conf> auto_tx_get + mlanutl mlanX hostcmd <auto_tx.conf> auto_tx_unreg + mlanutl mlanX hostcmd <bg_scan.conf> bgscfg + + mlanutl mlanX hostcmd <pkt_coalescing.conf> coalesce_cfg + mlanutl mlanX hostcmd <ed_mac_ctrl.conf> ed_mac_ctrl + mlanutl mlanX hostcmd <crypto_test.conf> crypto_test + mlanutl mlanX hostcmd <auto_tx.conf> nat_keep_alive + mlanutl mlanX hostcmd <pad_cfg.conf> pad_cfg_get + mlanutl mlanX hostcmd <pad_cfg.conf> pad_cfg_set + mlanutl mlanX hostcmd <requesttpc.conf> requesttpc + mlanutl mlanX hostcmd <robust_btc.conf> mode_get + mlanutl mlanX hostcmd <robust_btc.conf> mode_timeshare + mlanutl mlanX hostcmd <robust_btc.conf> mode_spatial + mlanutl mlanX hostcmd <robust_btc.conf> mode_none + mlanutl mlanX hostcmd <robust_btc.conf> mode_bca + mlanutl mlanX hostcmd <robust_btc.conf> gpio_cfg + mlanutl mlanX hostcmd <robust_btc.conf> external_coex_config + mlanutl mlanX hostcmd <robust_btc.conf> external_coex_pta_config + mlanutl mlanX hostcmd <robust_btc.conf> external_coex_uart_config + mlanutl mlanX hostcmd <robust_btc.conf> generictime + mlanutl mlanX hostcmd <robust_btc.conf> a2dptime + mlanutl mlanX hostcmd <robust_btc.conf> inquirytim + mlanutl mlanX hostcmd <robust_btc.conf> ap_generictime + mlanutl mlanX hostcmd <robust_btc.conf> ap_a2dptime + mlanutl mlanX hostcmd <robust_btc.conf> ap_inquirytime + mlanutl mlanX hostcmd <coex_int_api.conf> get_bca_arb_config + mlanutl mlanX hostcmd <coex_int_api.conf> set_en_bca_arb_config + mlanutl mlanX hostcmd <coex_int_api.conf> set_dis_bca_arb_config + mlanutl mlanX hostcmd <coex_int_api.conf> set_wlan_traffic_priority + mlanutl mlanX hostcmd <coex_int_api.conf> get_wlan_traffic_priority + mlanutl mlanX hostcmd <coex_int_api.conf> get_wlan_stats + mlanutl mlanX hostcmd <coex_int_api.conf> get_15_4_stats + mlanutl mlanX hostcmd <coex_int_api.conf> get_bt_stats + mlanutl mlanX hostcmd <coex_int_api.conf> get_ble_stats + mlanutl mlanX hostcmd <sdio_pulldown.conf> sdio_pulldown_disable + mlanutl mlanX hostcmd <sdio_pulldown.conf> sdio_pulldown_get + mlanutl mlanX hostcmd <sdio_pulldown.conf> sdio_pulldown_set + mlanutl mlanX hostcmd <subevent.conf> subevent_get + mlanutl mlanX hostcmd <subevent.conf> subevent_set + mlanutl mlanX hostcmd <txpwrlimit_cfg.conf> txpwrlimit_2g_cfg_set + mlanutl mlanX hostcmd <txpwrlimit_cfg.conf> txpwrlimit_5g_cfg_set + mlanutl mlanX hostcmd <txpwrlimit_cfg.conf> txpwrlimit_cfg_get + mlanutl mlanX hostcmd <txrate_cfg.conf> txrate_cfg_get + mlanutl mlanX hostcmd <txrate_cfg.conf> txrate_cfg_set_bg + mlanutl mlanX hostcmd <txrate_cfg.conf> txrate_cfg_set_bgn + mlanutl mlanX hostcmd <conf> generate_raw <raw_data_file> + mlanutl mlanX hostcmd <fwdump.conf> fwdump + + mlanutl mlanX hostcmd <debug.conf> stop_su + mlanutl mlanX hostcmd <debug.conf> start_su + + mlanutl mlanX hotspotcfg [<bitmap>] + mlanutl mlanX hscfg [condition [[GPIO# [gap]]]] [ind_GPIO# [level]] + mlanutl mlanX mgmtfilter <mgmtfilter.conf> + mlanutl mlanX auto_arp [n] + mlanutl mlanX htstreamcfg [n] + mlanutl mlanX httxbfcap [cap] + mlanutl mlanX httxbfcfg "<action>[;GlobalData/tsData/interval/txPeerData/snrData]" + mlanutl mlanX inactivityto <n> <m> <l> [k] + mlanutl mlanX ipaddr ["<op>;<ipaddr>"] + mlanutl mlanX linkstats + mlanutl mlanX listeninterval [l] + mlanutl mlanX macctrl [n] + mlanutl uapX macctrl [n] + mlanutl mlanX memrdwr <address> [value] + mlanutl mlanX miracastcfg [l] [m] [n] + mlanutl mlanX mgmtframectrl [<mask>] + mlanutl uapX mgmtframectrl [<mask>] + mlanutl mlanX mgmtframetx <mgmt_frame.conf> + mlanutl mlanX mpactrl [tx_ena] [rx_ena] [tx_size] [rx_size] [tx_ports] [rx_ports] + mlanutl mlanX netmon [<act> [<filter> <band> <chan> <opt>]] + mlanutl mlanX offchannel [<l> <m> <n> <bandwidth>] + mlanutl mlanX otpuserdata <l> + mlanutl mlanX passphrase [l] + mlanutl mlanX pb_bypass [data_1, data_2, ... data_n] + mlanutl mlanX pcieregrw <offset> [value] + mlanutl mlanX pciebar0regrw <offset> [value] + mlanutl mlanX pmfcfg <mfpc> <mfpr> + mlanutl mlanX port_ctrl [n] + mlanutl mlanX powercons [n] + mlanutl mlanX pscfg [k] [d] [l] ... + mlanutl mlanX bcntimeoutcfg [l] [m] [o] [p] + mlanutl mlanX psmode [l] + + mlanutl <interface> robustcoex <gpiocfg> [Enable/Disable] [gpionum] [gpiopolarity] + mlanutl mlanX qconfig def [Queue Id: 0-3] + mlanutl mlanX qconfig get [Queue Id: 0-3] + mlanutl mlanX qconfig set msdu <lifetime in TUs> [Queue Id: 0-3] + mlanutl mlanX qoscfg + mlanutl mlanX qstatus + mlanutl mlanX radioctrl [n] + mlanutl mlanX rdeeprom <offset> <length> + mlanutl mlanX reassoctrl [n] + mlanutl mlanX regioncode [n] + mlanutl mlanX regrdwr <type> <offset> [value] + mlanutl mlanX rejectaddbareq [conditions] + mlanutl uapX rejectaddbareq [conditions] + mlanutl mlanX scancfg [t] [m] [p] [s] [a] [b] [c] [ext] [gap] + mlanutl mlanX sdcmd52rw <FN no.> <address> [data] + mlanutl mlanX sdcmd53rw <FN no.> <address> <mode> <blksize> <blknum> [data1] ... [dataN] + mlanutl mlanX sdioclock <n> + mlanutl mlanX setuserscan [ARGS] + mlanutl mlanX cancelscan + mlanutl mlanX sleepparams [<p1> <p2> <p3> <p4> <p5> <p6>] + mlanutl mlanX sleeppd [n] + mlanutl mlanX sysclock [clk1] [clk2] [clk3] [clk4] + mlanutl mlanX tcpackenh [l] [m] + mlanutl mlanX tdls_channel_switch <tdls.conf> + mlanutl mlanX tdls_config <0/1> + mlanutl mlanX tdls_cs_params <tdls.conf> + mlanutl mlanX tdls_debug "allow_weak_security" <0/1> + mlanutl mlanX tdls_debug "cs_im_return" <0/1> + mlanutl mlanX tdls_debug "fail_setup_confirm" <0/1> + mlanutl mlanX tdls_debug "higher_lower_mac" <0/1> + mlanutl mlanX tdls_debug "ignore_key_expiry" <0/1> + mlanutl mlanX tdls_debug "setup_existing_link" <0/1> + mlanutl mlanX tdls_debug "setup_with_prohibited" <0/1> + mlanutl mlanX tdls_debug "stop_rx" <0/1> + mlanutl mlanX tdls_debug "wrong_bss" <0/1> + mlanutl mlanX tdls_disable_cs <0/1> + mlanutl mlanX tdls_discovery <tdls.conf> + mlanutl mlanX tdls_link_status + mlanutl mlanX tdls_powermode <tdls.conf> + mlanutl mlanX tdls_setinfo <tdls.conf> + mlanutl mlanX tdls_setup <tdls.conf> + mlanutl mlanX tdls_stop_channel_switch <tdls.conf> + mlanutl mlanX tdls_teardown <tdls.conf> + mlanutl mlanX thermal + mlanutl mlanX ts_status + mlanutl mlanX tsf + mlanutl mlanX txaggrctrl [m] + mlanutl mlanX txbufcfg + mlanutl mlanX aggrctrl [l] + mlanutl mlanX usbaggrctrl [l] [m] [n] [o] [p] [q] [r] [s] + mlanutl mlanX usbresume + mlanutl mlanX usbsuspend + mlanutl <interface> per_pkt_cfg [tx_rx_control] [type_num] [ether_type1 ether_type2 ...] [tx_rx_control] [type_num] [ether_type1 ether_type2 ...] + mlanutl <interface> dot11_txrx <send/recv> <options> + mlanutl mlanX txrxhistogram [action] [tx_rx_statics] + mlanutl uapX txrxhistogram [action] [tx_rx_statics] + mlanutl mlanX wakeupreason + mlanutl uapX wakeupreason + mlanutl mlanX warmreset + mlanutl mlanX wpssession [n] + mlanutl mlanX wmmcfg [n] + mlanutl mlanX wmmparamcfg [AC_BE AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_BK AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_VI AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_VO AIFSN ECW_MAX ECW_MIN TX_OP] + mlanutl mlanX wwscfg [m] + mlanutl mlanX mc_cfg [n] + mlanutl mlanX mc_policy [n] + mlanutl mlanX mc_cfg_ext [c] [s] [u] [m] <a> <b> <d> <e> + mlanutl p2pX cfg_noa [h] [i] [j] [k] [l] + mlanutl p2pX cfg_opp_ps [m] [n] + mlanutl mlanX get_sensor_temp + mlanutl <inteface> indrstcfg <ir_mode> [gpio_pin] + + + mlanutl uapX ctrldeauth <n> + + mlanutl mlanX/uapX bootsleep <1/0> + + mlanutl mlanX ssu [mode] [ssu file] + + mlanutl mlanX csi <disable/enable (config file)> + + mlanutl mlanX arb [mode] + + mlanutl mlanX dmcs <subcmd> [value] + + mlanutl mlanX/uapX range_ext [mode] + mlanutl mlanX twt_setup [config/twt.conf] + mlanutl mlanX twt_teardown [config/twt.conf] + mlanutl <interface> rx_abort_cfg [enable] [rssi_threshold] + mlanutl <interface> rx_abort_cfg_ext [enable] [margin ceil_thresh] + mlanutl <interface> tx_ampdu_prot_mode [mode] + mlanutl <interface> rate_adapt_cfg [low_thresh high_thresh timer_interval] + mlanutl <interface> cck_desense_cfg [mode] [margin ceil_thresh] [num_on_intervals num_off_intervals] + mlanutl mlanX/uapX lpm [mode] + mlanutl <interface> dot11mc_unassoc_ftm_cfg [enable] + mlanutl mlanX tp_state [mode] [drop_point] + mlanutl mlanX/uapX clocksync [j][k] [l] [m] [n] + mlanutl mlanX/uapX gettsfinfo [j] + mlanutl uapX backupchan [j] + mlanutl uapX targetchan [j] + mlanutl mlanX ips_cfg [1/0] + mlanutl mlanX/uapX mcast_aggr_group [action] [mcast_addr] + mlanutl mlanX/uapX mc_aggr_cfg [i][j] + mlanutl uapX mcast_tx <mcast_tx.conf> + mlanutl <interface> getuuid DESCRIPTION Those commands are used to send additional commands to the NXP MLAN @@ -510,6 +898,12 @@ Usage: mlanutl mlanX hostcmd <conf_file> generate_raw <raw_data_file> +hostcmd send_om_set + This command is used to configure the STAUT to include OM control subfield + + Usage: + mlanutl mlanX hostcmd <send_om.conf> send_om_set + getdatarate This command is used to get the data rate being used in last Tx packet and last Rx packet. @@ -545,7 +939,7 @@ dot11TransmittedFrameCount Increments for each successfully transmitted MSDU - dot11WeplcvErrCnt Increment when WEP decryption error for key index 0.3 + dot11WeplcvErrCnt Increment when WEP (use of WEP/TKIP is not recommended anymore)decryption error for key index 0.3 beaconReceivedCnt Increments when received beacon @@ -588,9 +982,9 @@ dot11RSNAStatsRobustMgmtCCMPReplays Increments when a robust management frame discarded by CCMP replay error - dot11RSNAStatsTKIPICVErrors Increments when a MPDU discarded by TKIP ICV error + dot11RSNAStatsTKIPICVErrors Increments when a MPDU discarded by TKIP ICV error //(use of WEP/TKIP is not recommended anymore) - dot11RSNAStatsTKIPReplays Increments when a MPDU discarded by TKIP replay error + dot11RSNAStatsTKIPReplays Increments when a MPDU discarded by TKIP replay error //(use of WEP/TKIP is not recommended anymore) dot11RSNAStatsCCMPDecryptErrors Increments when a MPDU discarded by CCMP decryption error @@ -631,6 +1025,31 @@ dot11AMPDUDelimiterCRCErrorCount Increments when an MPDU delimiter has a CRC error when this is the first CRC error in the received A-MPDU or when the previous delimiter has been decoded correctly + Cmd Usage: mlanutl mlanX getlog ext + The above command is used with the argument "ext" to display the following error statistics:- + + rxStuckIssueCount-1 + rxStuckIssueCount-2 + rxStuckRecoveryCount + rxStuckTsf-1 + rxStuckTsf-2 + txWatchdogRecoveryCount + txWatchdogTsf-1 + txWatchdogTsf-2 + channelSwitchAnnouncementSent + channelSwitchState + registerClass + channelNumber + channelSwitchMode + RxResetRecoveryCount + RxIsr2NotDoneCnt + gdmaAbortCnt + gResetRxMacCnt + gOwnrshpCtlErrCnt + gOwnrshpBcnErrCnt + gOwnrshpMgtErrCnt + gOwnrshpDatErrCnt + getsignal This command gets the last and average value of RSSI, SNR and NF of Beacon and Data. @@ -722,9 +1141,10 @@ 0: Get 2.4G txpwrlimit table 0x10: Get 5G sub0 txpwrlimit table 0x11: Get 5G sub1 txpwrlimit table - 0x12 Get 5G sub2 txpwrlimit table - 0x1f Get all 5G txpwrlimit table - 0xff Get both 2G and 5G txpwrlimit table + 0x12: Get 5G sub2 txpwrlimit table + 0x13: Get 5G sub3 txpwrlimit table + 0x1f: Get all 5G txpwrlimit table + 0xff: Get both 2G and 5G txpwrlimit table <raw_data_file> driver will save fw raw data to this file. Examples: @@ -1091,15 +1511,44 @@ This command is used to config 11ax HE capability using command. Usage: - mlanutl <mlanX|uapX> 11axcmd <subcmd> [value_1] [value_2] + mlanutl <mlanX|uapX> 11axcmd <subcmd> [value_1] [value_2] [value_3] + <subcmd = obss_pd_offset > : spatial reuse configuration + set obss_pd offset, [value_1] = NON_SRG_OffSET, [value_2] = SRG_OFFSET + + <subcmd = enable_sr > : spatial reuse configuration + control SR, [value_1]= 1 is enable SR, [value_1] = 0 is disable SR + + <subcmd = beam_change > : enable/disable beam change + enable beam_change when [value_1 = 0] + disable beam_change when [value_1 = 1] + + <subcmd = enable_htc > : enable/disable HTC transmission + enable transmission of HTC when [value_1 = 1] + disable transmission of HTC when [value_1 = 0] + + <subcmd = txop_rts > : set/get RTS threshold + This subcmd applies to uapX only. uAP uses it to manage the RTS/CTS used by associated non-AP HE STA + set TXOP duration RTS Threshold when [value_1 = <threshold>]. If <threshold> = 1023, disable TXOP duration RTS + get TXOP duration RTS Threshold without value_1 and value_2 + Where <threshold> is: + Bit 0-9: TXOP RTS Threshold <subcmd = tx_omi > : set/get omi value used for OMI transmission in MAC header HTC+ field, please see 11ax spec for OMI definition - set OMI when [value_1 = <omi>], where <omi> is defined as: - Bit 0-2: Rx NSS - Bit 3-4: Channel Width - Bit 6 : Tx NSTS (applies to client mode only) - All other bits are not supported currently. - get OMI without value_1 and value_2 + set OMI: [value_1 = <omi>] [value_2 = <tx_option>] [value_3 = <num_data_packeets>] + where + <omi> is defined as: + Bit 0-2: Rx NSS + Bit 3-4: Channel Width + Bit 6 : Tx NSTS (applies to client mode only) + All other bits are not supported currently. + <tx_option> is defined as: + 0: OMI is transmitted in QoS NULL frame; + 1: OMI is transmitted in QoS data frame; + 0xFF: OMI is transmitted in both QoS NULL and QoS data frame. + <num_data_packeets> is applied only if OMI is sent in QoS data frame. + It specifies the number of consecutive data frames containing the OMI. + + get OMI without any value <subcmd = obssnbru_toltime> : set/get OBSS narrow band RU tolerance time value in seconds set tolerance time when [value_1 = <time>], where <time> indicates: @@ -1109,6 +1558,13 @@ valid value range [1..3600] in seconds. Any value more than 3600 will disable this feature. By default this feature is currently disabled. Example : + mlanutl mlan0 11axcmd obss_pd_offset 2 3 : set obss_pd offset of spatial reuse, NON_SRG_OffSET = 2, SRG_OFFSET = 3 + mlanutl mlan0 11axcmd obss_pd_offset : get obss_pd offset of spatial reuse + mlanutl mlan0 11axcmd enable_sr 1 : enable spatial reuse + mlanutl mlan0 11axcmd beam_change 0 : enable beam change + mlanutl mlan0 11axcmd enable_htc 1 : enable transmission of HTC + mlanutl uap0 11axcmd txop_rts 0x34 : set RTS threshold value to 0x34 + mlanutl uap0 11axcmd txop_rts : get RTS threshold value mlanutl mlan0 11axcmd tx_omi 0x41 : set omi value to 0x41 mlanutl mlan0 11axcmd tx_omi : get omi value mlanutl mlan0 11axcmd obssnbru_toltime 1800 : set OBSSNBRU tolerance time to 1800 seconds @@ -1281,3 +1737,3473 @@ STBC is 1, DMC is 0, Coding is 1, maxPE is 2. mlanutl mlan0 txratecfg 0xff : Disable fixed rate and uses auto rate +hssetpara + This command is used to set host sleep parameters. + + Usage: + mlanutl mlanX hssetpara condition [GPIO# [gap]] (optional)[type ind_GPIO# [level]] (optional)[type event_force_ignore event_use_ext_gap ext_gap [gpio_wave]] (optional)[type hs_wakeup_interval] (optional)[type min_wake_holdoff] + + This command takes one (condition), two (condition and GPIO#) or three + (condition, GPIO# and gap).If more than three parameters, it can set different or multiple features indicating by type. + + If type=1, it will set indication gpio and its level. And the parameter format will be (condition, GPIO#,gap and type,ind_GPIO#) or + (condition, GPIO#, gap, type, ind_GPIO# and level). + + If type=2, it will set extend host sleep wakup method. And the parameter format will be (condition, GPIO#, gap, type, force_ignore, + use_ext_gap, ext_gap [gpio_wave]). gpio_wave parameter is optional and default value is 0(falling edge). Each bit of + event_force_ignore and event_use_ext_gap will be defined to one same event, and set one same event(same bit) in those two + parameters is not allowed. Set bit(s) in event_force_ignore means the event(s) will be forced ignore in firmware silently. + Set bit(s) in event_use_ext_gap mean the event(s) will use extend gap to inform host. Not set means not handle. + + If type=3, it will set hs_wakeup_interval. + + If no parameter provided, get is performed. + + where Condition is: + bit 0 = 1 -- broadcast data + bit 1 = 1 -- unicast data + bit 2 = 1 -- mac event + bit 3 = 1 -- multicast data + bit 6 = 1 -- Wakeup when mgmt frame received. + Bit 31 = 1 -- Don't wakeup when IPV6 packet received. + + The host sleep mode will be canceled if condition is set to -1. The default is 0x7. + + where GPIO is the pin number of GPIO used to wakeup the host. It could be any valid + GPIO pin# (e.g. 0-7) or 0xff (interface, e.g. SDIO will be used instead). + The default is 0xff. + + where Gap is the gap in milliseconds between wakeup signal and wakeup event or 0xff + for special setting (host acknowledge required) when GPIO is used to wakeup host. + The default is 200. + + The host sleep set except for cancellation will be blocked if host sleep is + already activated. + + where ind_GPIO# is the pin number of GPIO used to indicate wakeup source. The level on + this GPIO will indicate normal wakeup source or abnormal wakeup source. + + where level is used to set level(0/1) on ind_GPIO# pin for indication normal wakeup source. + The opposite level will indicate abnormal wakeup source. The default value is 0. + + where event_force_ignore is a bitmap,each bit represent one wakeup reason event. Set the bit means this + wakeup reason should be force ignored in firmware. Reset the bit means do not handle this reason. + + where event_use_ext_gap is a bitmap, each bit represent one wakeup reason event. Set the bit means this + wakeup reason should use ext_gap to indicate host. Reset the bit means do not handle this reason. + + where event_force_ignore and event_use_ext_gap have the same wakeup reason event definition of each bit: + bit 0 = 1 --Disconnect + bit 1 = 1 --GTK/iGTK rekey failure + bit 2 = 1 --Eapol + other bits --Reserved + They should not set both for one same wakeup reason. + + where ext_gap is the extend gap based on third parameter Gap. Only valid when use_ext_gap is used. + The total gap is (Gap + (x+1)*ext_gap). x means the bit number(start from 0) of this reason in use_ext_gap. + + where gpio_wave is used to set GPIO wave level for host sleep extend. 0 means falling edge, 1 means rising edge. + This parameter is optional and default value is 0. + + where hs_wakeup_interval is used to set host sleep wakeup interval and the type must set to 3 to indicate + this feature. And the value will round to the nearest multiple dtim*beacon_interval in fw. The unit is milliseconds. + + where min_wake_holdoff is minimum delay between HsActive and HostWake and the type must set to 4 to indicate + this feature. The unit is milliseconds. + + Examples: + mlanutl mlan0 hssetpara -1 : Cancel host sleep mode + mlanutl mlan0 hssetpara 3 : Broadcast and unicast data + Use GPIO and gap set previously + mlanutl mlan0 hssetpara 2 3 : Unicast data + Use GPIO 3 and gap set previously + mlanutl mlan0 hssetpara 2 1 0xa0 : Unicast data + Use GPIO 1 and gap 160 ms + mlanutl mlan0 hssetpara 2 0xff : Unicast data + Use interface (e.g. SDIO) + Use gap set previously + mlanutl mlan0 hssetpara 4 3 0xff : MAC event + Use GPIO 3 + Special host sleep mode + mlanutl mlan0 hssetpara 1 0xff 0xff : Broadcast data + + mlanutl mlan0 hssetpara 2 1 0xa0 1 5 1 : Unicast data + Use GPIO 1 + Gap 160 ms + type=1 to set indication GPIO feature + Use GPIO 5 to indicate wakeup source + High level on GPIO 5 means this is a normal wakeup + mlanutl mlan0 hssetpara 2 1 0xa0 1 5 : Unicast data + Use GPIO 1 + Gap 160 ms + type=1 to set indication GPIO feature + Use GPIO 5 to indicate wakeup source + Use level set previously. + + mlanutl mlan0 hssetpara 2 1 0xa0 2 0 0x1 10 1: Unicast data + Use GPIO 1 + Gap 160 ms + type=2 to set extend host sleep feature + Force_ignore not used + Disconnect will use extend gap to indicate host + Use gap 170. + Rising edge + mlanutl mlan0 hssetpara 2 1 0xa0 2 0x1 0 0 0: Unicast data + Use GPIO 1 + Gap 160 ms + type=2 to set extend host sleep feature + Falling edge + Force ignore Disconnect + Extend gap not used + Not used. + Falling edge + mlanutl mlan0 hssetpara 2 1 0xa0 3 400: Unicast data + Use GPIO 1 + Gap 160 ms + type=3 to set hs_wakeup_interval feature + hs_wakeup_interval set to 400ms + + mlanutl mlan0 hssetpara 2 1 0xa0 4 800: Unicase data + Use GPIO 1 + Gap 160ms + type=4 to set min_wake_holdoff feature + min_wake_holdoff set to 800ms + + Note: The parameters will be saved in the driver and be used when host suspends. + The ind_GPIO# and level parameters only work with specific board and firmware. +mefcfg + This command is used to set MEF settings. + + Usage: + mlanutl mlanX mefcfg <mef.conf> + + Where the parameter is: + mef.conf : The configuration file specifying the MEF settings. + + Example: + mlanutl mlan0 mefcfg config/mef.conf +cloud_keep_alive + This command is used to start/stop send keep alive packet which set from host.And reset TCP connection. + + Usage: + mlanutl mlanX cloud_keep_alive <keep_alive.conf> <start/stop/reset> + + where <start/stop/reset> + start means set cloud keep alive packet and paramters to firmware. stop means stop firmware from sending keep alive packet.reset will stop and reset TCP connection when host resume. + + Examples: + mlanutl mlan0 cloud_keep_alive keep_alive.conf start + mlanutl mlan0 cloud_keep_alive keep_alive.conf stop + mlanutl mlan0 cloud_keep_alive keep_alive.conf reset +min_ba_threshold + This command is to set minimum Tx BA setup threshold + + Usage: + mlanutl mlanX min_ba_threshold <n> + + where the parameters are: + <n>: minimum BA Threshold :0-16 (default is 16) + Example: + mlanutl mlan0 min_ba_threshold : get min_ba_threshold value + mlanutl mlan0 min_ba_threshold 10 : set minimum BA threshold to 10 + +11dcfg + This command is used to control 11D. No argument is used to get. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 11dcfg 1 : Enable 11D + mlanutl mlan0 11dcfg : Get 11D status + +11dclrtbl + This command is used to clear the 11D channel table. + + Usage: + mlanutl mlanX 11dclrtbl + +addts + Send an ADDTS command to the associated AP. + + Process a given conf file for a specific TSPEC data block. Send the + TSPEC along with any other IEs to the driver/firmware for transmission + in an ADDTS request to the associated AP. + + Return the execution status of the command as well as the ADDTS response + from the AP if any. + + Usage: + mlanutl mlanX addts <filename.conf> <section# of tspec> <timeout(ms)> + +amsduaggrctrl + This command could be used to enable/disable a feature where firmware gives feedback to driver + regarding the optimal AMSDU buffer size to use with the current rate. Firmware will use the + current rate to decide the buffer size we could transmit. The max buffer size will still be + limited by buffer size provided in txbufcfg. (i.e. if the txbufcfg is 4K, then we could only transmit + 4K/2K AMSDU packets, if the txbufcfg is 8K then we could transmit 8k/4k/2k based on current rate) + + If enabled AMSDU buffer size at various rates will be as follows + + 1. Legacy B/G rate. + No AMSDU aggregation. + + 2. BW20 HT Rate: + When TX rate goes down, + MCS 7, 6, 5, 4: + a 8K aggregation size (if TX buffer size is 8K) + b 4K aggregation size (if TX buffer size is 4K) + c 2K aggregation size (if TX buffer size is 2K) + + MCS 3, 2: + a 4K aggregation size (if TX buffer size is 8K/4K) + b 2K aggregation size (if TX buffer size is 2K) + + MCS 1, 0: + a No aggregation + + When TX rate goes up, + MCS 7, 6, 5: + a 8K aggregation size (if TX buffer size is 8K) + b 4K aggregation size (if TX buffer size is 4K) + c 2K aggregation size (if TX buffer size is 2K) + + MCS 4, 3: + a 4K aggregation size (if TX buffer size is 8K/4K) + b 2K aggregation size (if TX buffer size is 2K) + + MCS 2, 1, 0: + a No aggregation + + 3. BW40 HT Rate: + When TX rate goes down, + MCS 7, 6, 5, 4, 3, 2, 1: + a 8K aggregation size (if TX buffer size is 8K) + b 4K aggregation size (if TX buffer size is 4K) + c 2K aggregation size (if TX buffer size is 2K) + + MCS 0: + a No aggregation + + When TX rate goes up, + MCS 7, 6, 5, 4, 3: + a 8K aggregation size (if TX buffer size is 8K) + b 4K aggregation size (if TX buffer size is 4K) + c 2K aggregation size (if TX buffer size is 2K) + + MCS 2, 1, 0: + a No aggregation + + where <n> is 0/1 (for disable/enable) + + eg: + mlanutl mlan0 amsduaggrctrl 1 - Enable this feature + mlanutl mlan0 amsduaggrctrl 0 - Disable this feature + mlanutl mlan0 amsduaggrctrl - This will get the enable/disable flag + and the current AMSDU buffer size). The AMSDU buffer size returned is only + valid after association as before association there is no rate info. + + Note:- This command to enable/disable could be given anytime (before/after + association). This feature is enabled by default by the driver during + initialization. + +antcfg + This command is used to set/get the mode of Tx/Rx path. + + For chip which support STREAM_2X2 + where value of m is: + Bit 0 -- Tx Path A or Tx/Rx Path A if [n] is not provided + Bit 1 -- Tx Path B or Tx/Rx Path B if [n] is not provided + Bit 0-1 -- Tx Path A+B or Tx/Rx Path A+B if [n] is not provided + For 9097/9098/NW62X, LOW BYTE for 2G setting + Bit 8 -- Tx Path A or Tx/Rx Path A if [n] is not provided + Bit 9 -- Tx Path B or Tx/Rx Path B if [n] is not provided + Bit 8-9 -- Tx Path A+B or Tx/Rx Path A+B if [n] is not provided + For 9097/9098/NW62X, HIGH BYTE for 5G setting + where value of n is: + Bit 0 -- Rx Path A + Bit 1 -- Rx Path B + Bit 0-1 -- Rx Path A+B + For 9097/9098/NW62X, LOW BYTE for 2G setting + Bit 8 -- Rx Path A + Bit 8 -- Rx Path B + Bit 8-9 -- Rx Path A+B + For 9097/9098/NW62X, HIGH BYTE for 5G setting + The Tx path setting (m) is used for both Tx and Rx if Rx path (n) is not provided. + + Examples: + mlanutl mlan0 antcfg : Get Tx and Rx path + mlanutl mlan0 antcfg 3 : Set Tx and Rx path to A+B + mlanutl mlan0 antcfg 1 3 : Set Tx path to A and Rx path to A+B + mlanutl mlan0 antcfg 0x103 : Set Tx and Rx path to A+B on 2G and Tx and Rx path to A on 5G + mlanutl mlan0 antcfg 0x103 0x103 : Set Tx path to A+B and Rx path to A+B on 2G, and Tx and Rx path to A on 5G + + mlanutl mlan0 antcfg 0x202 : Use 5GHz path B pin for 5G TX/RX and 2GHz path B pin for 2G TX/RX + mlanutl mmlan0 antcfg 0x202 : Use 5GHz path B pin for 5G TX/RX and 2GHz path B pin for 2G TX/RX + + On RD board connection is as follows : + 5GHz path A pin -> AntA + 5GHz path B pin -> AntB + 2GHz path A pin -> AntB + 2GHz path B pin -> AntA + + For chip which support SAD + where value of m is: + Bit 0 -- Tx/Rx antenna 1 + Bit 1 -- Tx/Rx antenna 2 + ... + 0xFFFF -- Tx/Rx antenna diversity + + where value of n is: + SAD evaluate time interval, only be provided when m = 0xFFFF, default value is 6s(0x1770) + + Examples: + mlanutl mlan0 antcfg : Get Tx/Rx antenna mode + mlanutl mlan0 antcfg 1 : Set Tx/Rx antenna 1 + mlanutl mlan0 antcfg 0xFFFF : Set Tx/Rx antenna diversity + mlanutl mlan0 antcfg 0xFFFF 0x1770 : Set antenna evaluate time interval to 6s +mimoswitch + This command is used to do MIMO switch for 11n and 11ac mode and is available for all interfaces. + mlanutl mlanX/uapX mimoswitch [tx_antmode] [rx_antmode] + + This command takes 2 conditions. + The supported options are: + tx_antmode: 1 - ANTENNA A + 2 - ANTENNA B + 3 - ANTENNA AB + rx_antmode: 1 - ANTENNA A + 2 - ANTENNA B + 3 - ANTENNA AB + Examples: + mlanutl mlan0/uap0 mimoswitch 1 1 : set Tx and Rx path to ANTENNA A + mlanutl mlna0/uap0 mimoswitch 2 2 : set Tx and Rx path to ANTENNA B + mlanutl mlan0/uap0 mimoswitch 3 3 : set Tx and Rx path to ANTENNA A+B + mlnautl mlan0/uap0 mimoswitch 1 3 : set Tx path to ANTENNA A and Rx path to ANTENNA A+B + +arpfilter + This command is used to configure the ARP filtering parameters. + + Usage: + mlanutl mlanX arpfilter <arpfilter.conf> + + Where the parameter is: + arpfilter.conf : The configuration file specifying ARP filtering parameters. + + Example: + mlanutl mlan0 arpfilter config/arpfilter.conf + +assocctrl + This command is used to set/get the driver auto assoc, driver auto re-connect + and FW auto re-connect configurations. + + Usage: + mlanutl mlanX assocctrl <j> [k] [l] [m] [n] + + Where the parameters are: + <j>: type : 1/2/3 driver auto assoc/driver auto re-connect/FW auto re-connect + auto assoc takes effect in new connection (e.g. iwconfig essid), + driver will auto retry if association failed; + auto re-connect takes effect when link lost, driver/FW will try + to connect to the same AP + [k]: enable : 1/0 on/off + [l]: retry count : 0x1-0xff The value 0xff means retry forever (default 0xff) + [m]: interval : 0x0-0xff Time gap in seconds (default 10) + [n]: flag : Bit 0: + Set to 1: Firmware should report link-loss to host if AP rejects + authentication/association while reconnecting + Set to 0: Default behavior: Firmware does not report link-loss + to host on AP rejection and continues internally + Bit 1-15: Reserved + The parameter flag is only used for FW auto re-connect + + Examples: + mlanutl mlan0 assocctrl 1 : Get driver auto assoc settings + mlanutl mlan0 assocctrl 2 : Get driver auto re-connect settings + mlanutl mlan0 assocctrl 3 : Get FW auto re-connect settings + mlanutl mlan0 assocctrl 1 1 20 8 : Enable and set driver auto assoc + mlanutl mlan0 assocctrl 2 1 30 10 : Enable and set driver auto re-connect + mlanutl mlan0 assocctrl 3 1 10 10 1 : Enable and set FW auto re-connect + mlanutl mlan0 assocctrl 1 0 : Disable driver auto assoc + mlanutl mlan0 assocctrl 2 0 : Disable driver auto re-connect + mlanutl mlan0 assocctrl 3 0 : Disable FW auto re-connect + +assocessid + This command is used to assoc essid with asynced mode, + and driver will auto retry if driver auto assoc enabled. + + Usage: + mlanutl mlanX assocessid <"[essid]"> + + Where + <"[essid]"> is the essid which need to be associated with asynced mode. + + Examples: + mlanutl mlan0 assocessid "NXP Micro AP" : Associate to the ESSID "NXP Micro AP" + +assocessid_bssid + This command is used to assoc AP by ssid/bssid pair with asynced mode, + and driver will auto retry if driver auto assoc enabled. + + Usage: + mlanutl mlanX assocessid_bssid <"[bssid] [essid]"> + + Where + <"[bssid]"> is the bssid which need to be associated with asynced mode. + <"[essid]"> is the essid which need to be associated with asynced mode. + + Examples: + mlanutl mlan0 assocessid_bssid "xx:xx:xx:xx:xx:xx NXP Micro AP" : Associate to the AP which ssid = "NXP Micro AP", bssid = "xx:xx:xx:xx:xx:xx" + +associate + Request an association to a given SSID/BSSID pair. This the only accurate + way to pick a specific AP and ESS for an association. The entry must + already exist in the scan table for the association to be attempted. + + mlanutl mlanX associate "xx:xx:xx:xx:xx:xx SSID" + +get_chnrgpwr + This command is used to get the txpwrlimit table in FW +Usage: + mlanutl mlanX get_chnrgpwr [save_region_channel_power_data_file] + <save_region_channel_power_data_file> driver will save fw raw data to this file. + + Examples: + mlanutl mlan0 get_chnrgpwr fw_region_pwr.bin : Get region channel power table and save to file fw_region_pwr.bin + +comparergpwr + This command is used to compare two regionpower tables and output differences. + + Usage : + mlanutl mlanX comparergpwr <uncompressed file> [target_file] + where: + <target_file> : raw data file save from get_chnrgpwr command. + <uncompressed file> : uncompressed raw data file generated by powerutil from the excel input region power file + + Example : + mlanutl mlan0 comparergpwr uncompressed.bin fw_region_pwr.bin : Show power table comparison in text format + mlanutl mlan0 comparergpwr uncompressed.bin : Show power table of uncompressed file in text format +comparetrpc + This command is used to compare two txpower tables and output differences. + + Usage : + mlanutl mlanX comparetrpc <target_file> <src_file> [display] + where: + <target_file> : raw data file save from get_txpwrlimit command. + <src_file> : raw data file used by driver load parameter "txpwrlimit_cfg" which will be download to FW during driver init. + <display> : display comparison output + : 1 - text format + : 2 - table format + + Example : + mlanutl mlan0 comparetrpc txpwrlimit.bin txpwrlimit_init.bin 1 : Show power table comparison in text format + mlanutl mlan0 comparetrpc txpwrlimit.bin txpwrlimit_init.bin 2 : Show power table comparison in table format +getcfgchanlist + This command is used to get the channel list used by cfg80211 stack + + Example: + mlanutl mlan0 getcfgchanlist + + +authtype + This command is used to set/get authentication type. + + Usage: + mlanutl mlanX authtype [n] + + where <n> + 0: 802.11 open system authentication + 1: 802.11 shared key authentication + 3: 802.11 WPA3 SAE authentication + 4: 802.11 OWE authentication + 255: allow open system or shared key authentication (default) + + Examples: + mlanutl mlan0 authtype 0 : use open system authentication + mlanutl mlan0 authtype 1 : use shared key authentication + mlanutl mlan0 authtype 255 : allow WEP open system or shared key authentication, embedded supplicant WPA2/WPA3 roaming + mlanutl mlan0 authtype : get current setting + +autotdls + This command is used to enable/disable auto TDLS. + + Usage: + mlanutl mlanX autotdls [n] + + where <n> + 0: Disable auto tdls + 1: Enable auto tdls + + Examples: + mlanutl mlan0 autotdls 1 : enable auto TDLS + mlanutl mlan0 autotdls 0 : disable auto TDLS + mlanutl mlan0 autotdls : get current setting + +tdls_idle_time + This command is used to set/get TDLS idle timeout. The valid value is between 0-0xffff. When set to 0, the tdls_idle_time will use default value(60). + + Usage: + mlanutl mlanX tdls_idle_time [n] + + where <n> + TDLS idle timeout value + + Examples: + mlanutl mlan0 tdls_idle_time 30 : set tdls_idle_time value to 30 + mlanutl mlan0 tdls_idle_time 0 : use default tdls_idle_time value(60) + mlanutl mlan0 tdls_idle_time : get current setting + +dfs_offload + This command is used to enable/disable DFS offload. The valid value is 0/1. + Note: The parameters can be set only in disconnected state. + + Usage: + mlanutl uapX dfs_offload [n] + + where <n> + Enable/disable + + Examples: + mlanutl uap0 dfs_offload 1 : enable DFS offload + mlanutl uap0 dfs_offload 0 : disable DFS offload + +bandcfg + This command is used to set/get infra/ad-hoc band. + Note: This command is only available in disconnected state. + + Usage: + mlanutl mlanX bandcfg [l] [m] [n] + + where the parameters: + [l]: Infrastructure band + bit 0: B + bit 1: G + bit 2: A + bit 3: GN + bit 4: AN + + bit 5: AC 2.4G + bit 6: AC 5G + bit 8: AX 2.4G + bit 9: AX 5G + [m]: Ad-hoc start band + bit 0: B + bit 1: G + bit 2: A + [n]: Ad-hoc start channel + Examples: + mlanutl mlan0 bandcfg : Get infra/ad-hoc band and ad-hoc + start channel configurations + mlanutl mlan0 bandcfg 1 : Set infra band to B only + mlanutl mlan0 bandcfg 3 2 6 : Set infra band to B/G, ad-hoc start band + to G and ad-hoc start channel to 6 + +bcninterval + This command is used to set/get the beacon interval in ad-hoc mode. + The valid beacon interval is between 20 - 1000, default beacon + interval is 100. + + Where <n> + Beacon interval in TU (Time Unit: 1024 us). + + Examples: + mlanutl mlan0 bcninterval 200 : Set ad-hoc beacon interval to 200 + mlanutl mlan0 bcninterval : Get ad-hoc beacon interval + +bssrole + This command is used to set/get the BSS role. + + Where + [l] is <bss_role> + <bss_role> - This parameter specifies the BSS role to set. + 0 : STA + 1 : uAP + + Examples: + mlanutl wfd0 bssrole : Get the current BSS role + mlanutl wfd0 bssrole 1 : Set the current BSS role to uAP + +cfgdata + This command is used to set/get the configuration data to/from firmware. + + Usage: + mlanutl mlanX cfgdata <type> [<.conf file name>] + + Where the parameters are: + type : + 2 -- CAL data download and <.conf file name> is cal_data.conf + .conf file name : The configuration file used to set/get the configuration data. + + Examples: + mlanutl mlan0 cfgdata 2 + : This command is used to get and display the CAL data from firmware. + +cfpcode + This command is used to set/get the Channel-Frequency-Power table codes. + The region table can be selected through region code. + The current configuration is returned if no parameter provided. + + where the parameters are, + [m]: code of the CFP table for 2.4GHz (0: unchanged) + [n]: code of the CFP table for 5GHz (0 or not provided: unchanged) + + Examples: + mlanutl mlan0 cfpcode : Get current configuration + mlanutl mlan0 cfpcode 0x30 : Set 2.4GHz CFP table code 0x30 (EU), + keep 5GHz table unchanged + mlanutl mlan0 cfpcode 0x10 5 : Set 2.4GHz CFP table code 0x10 (USA) + and 5GHz table code 5 + +changraph + Displays 2-dimensional graph, plotting channel number along x-axis and + anpi or channel-load along y-axis, depending on whether it is an anpi graph + or a channel load graph. + + Usage: + mlanutl mlanX changraph [<load | anpi | anpiload> <loops>] + where: + load: Only channel vs channel-load graph is displayed + anpi: Only channel vs Average Noise Power Indicator(ANPI) + graph is displayed + anpiload: Both the graphs for anpi and for the load are displayed + loops: This is used to calculate the number of times + the graph [load or anpi or both] will be printed + +coex_rx_winsize + This command is used to set/get control to coex RX window size + + where value of m is: + 0 -- Disable COEX RX winsize (default) + 1 -- Enable COEX RX winsize + + Examples: + mlanutl mlan0 coex_rx_winsize : Get COEX RX winsize + mlanutl mlan0 coex_rx_winsize 1 : Enable COEX RX winsize + +countrycode + This command is used to set and get the country code. + + Where + [l] is Country code + + Examples: + mlanutl mlan0 countrycode : Get current countrycode + mlanutl mlan0 countrycode CN : Set countrycode as China (CN) + +cfpinfo + This command is used to get region, country, environment codes, + channel and power table information from the FW. + + Examples: + mlanutl mlan0 cfpinfo : Display cfp tables + mlanutl uap0 cfpinfo + +customie + This command is used to set or get custom IEs for management frames. + + Usage: + mlanutl mlanX customie [[[<index>] <mask>] <IEBuffer>] + + Where the parameter is: + empty - Get all IE settings + <index> : 0 - Get/Set IE index 0 setting + 1 - Get/Set IE index 1 setting + 2 - Get/Set IE index 2 setting + MAX IE Index depends on device memory. + -1 - Append/Delete IE automatically + Delete will delete the IE from the matching IE buffer + Append will append the IE to the buffer with the same mask + <mask> : Management subtype mask value as per bit definitions + : Bit 0 - Association request + : Bit 1 - Association response + : Bit 2 - Reassociation request + : Bit 3 - Reassociation response + : Bit 4 - Probe request + : Bit 5 - Probe response + : Bit 8 - Beacon + <mask> : mask = 0 to clear the mask and the IE buffer + <IEBuffer> : IE Buffer in hex (max 256 bytes) + The Buffer should not be space separated. + + Examples: + mlanutl mlan0 customie + : Get IE buffer, subtype mask settings for all indices. + + mlanutl mlan0 customie 1 + : Get IE buffer and subtype mask for the Index = 1. + + mlanutl mlan0 customie 2 0 + : Clear IE buffer and mask value for Index = 2. + + mlanutl mlan0 customie 3 0x101 0xdd051234567890 + : Set IE buffer and mask value for Index = 3. + + mlanutl mlan0 customie -1 0x101 0xdd051234567890 + : Append the specified IEBuffer at index with mask value of 0x101. + + mlanutl mlan0 customie -1 0 0xdd051234567890 + : Delete the specified IEBuffer from all the IEs. + + mlanutl mlan0 customie 2 0 0xdd051234567890 + : Delete the specified IEBuffer from the IEs at index 2. + +deauth + This command is used to send a de-authentication to an arbitrary AP. + If [l] is omitted, the driver will deauth the associated AP. + If in ad-hoc mode this command is used to stop beacon transmission + from the station and go into idle state. + + When <l> is supplied as a MAC address, the driver will deauth the + specified AP. If the AP address matches the driver's associated AP, + the driver will disconnect. Otherwise, the driver remains connected. + + When this command is executed on AP interface, it is used to send + a de-authentication to associated station. + +deepsleep + This command is used to set/get auto deep sleep mode. + + Usage: + mlanutl mlanX deepsleep [l] [m] + + where the parameters are: + [l]: Enable/disable auto deep sleep mode (1/0) + [m]: Idle time in milliseconds after which firmware will put the device + in deep sleep mode. Default value is 100 ms. + + Examples: + mlanutl mlan0 deepsleep : Display auto deep sleep mode + mlanutl mlan0 deepsleep 1 : Enable auto deep sleep mode, idle time unchanged + mlanutl mlan0 deepsleep 0 : Disable auto deep sleep mode + mlanutl mlan0 deepsleep 1 500 : Enable auto deep sleep mode with idle time 500 ms + Note: + Deepsleep must be disabled before changing idle time. + +delba + This command is used to delete either all Tx BA or all Rx BA or a specific BA stream + based on direction, TID and peer address. + + where <l> [<m> <n>] + <l> - This is the direction of BA stream, Tx (bit 0), Rx (bit 1). + <m> - This is the TID (0-7, 0xff for all) of BA stream. + <n> - This is the peer MAC addres of BA stream. + + eg: + mlanutl mlanX delba 2 - This command will delete all the Rx BA streams. + mlanutl mlanX delba 3 - This command will delete all the Tx and Rx BA streams. + mlanutl mlanX delba 1 0 - This command will delete all the Tx streams with TID 0. + mlanutl mlanX delba 2 0xff "00:11:22:33:44:55" - This command will delete all the Rx BA streams + with specified peer MAC address + mlanutl mlanX delba 1 3 "00:11:22:33:44:55" - This command will delete the Tx BA stream with + TID 3 and specified peer MAC address. + +delts + Send a DELTS command to the associated AP. + + Process a given conf file for a specific TSPEC data block. Send the + TSPEC along with any other IEs to the driver/firmware for transmission + in a DELTS request to the associated AP. + + Return the execution status of the command. There is no response to a + DELTS from the AP. + + Usage: + mlanutl mlanX delts <filename.conf> <section# of tspec> + +dfstesting + This command is used to set/get settings for DFS testing. + + Usage: + mlanutl mlanX dfstesting [<user_cac_pd> <user_nop_pd> <no_chan_change> <fixed_chan_num><cac_restart>] + + where <user_cac_pd> is user-configured Channel Availability Check in sec + 0 = disable, use default period (60 seconds) + 1-1800 = enable with that period + where <user_nop_pd> is user-configured Non-Occupancy Period in sec + 0 = disable, use default period (1800) + 1-65535 = enable with that period + where <no_chan_change> is enable/disable no channel change on radar + 0 = disable, 1 = enable (overrides below) + where <fixed_chan_num> is user-configured channel to change to on radar + 0 = disable, 1-255 = enable with that channel + (channel validity for region, etc. is not checked) + (only takes effect if no_chan_change = 0) + where <cac_restart> after CAC success, driver auto restart CAC again + + Examples: + mlanutl mlan0 dfstesting : Get current dfstesting settings + mlanutl mlan0 dfstesting 60 0 0 0 0 : user_cac=60sec, others disabled/default + mlanutl mlan0 dfstesting 0 0 1 0 0 : only no_chan_change enabled + mlanutl mlan0 dfstesting 0 120 0 64 0 : user_nop=2min, force chan 64 on radar + mlanutl mlan0 dfstesting 60 0 0 0 1 : user_cac=60sec, restart cac after success + +clear_nop + This command clear NOP status +Usage: + mlanutl uapX clear_nop + + Examples: + mlanutl uap0 clear_nop : clear channel NOP status + +nop_list + This command get NOP channel list +Usage: + mlanutl uapX nop_list + + Examples: + mlanutl uap0 nop_list : get nop channel list + +fake_radar + This command was the DFS test command to trigger fake radar event. +Usage: + mlanutl uapX fake_radar + + Examples: + mlanutl uap0 fake_radar : trigger fake rader event + +getchload + This command gets the current channel load (in %), noise floor value (in dbm) and rx_quality (in %, higher % indicates better rx quality) + This command also sets cca threhold value when provided and enables OFDM desense (Only for IW416) +Usage: + mlanutl uapX getchload <duration> [<cca_threshold>] + <duration> can be within 1-10(specifying 10ms to 100ms), default duration will be 100ms + [<cca_threshold>] can be within 1 to 120 and also sets OFDM desense (Only for IW416) + + Examples: + mlanutl uap0 getchload : gets channel load (in %), noise floor (in dbm) and rx_quality (in %) for 100ms duration + mlanutl uap0 getchload 1 : gets channel load (in %), noise floor (in dbm) and rx_quality (in %) for 10ms duration + mlanutl uap0 getchload 6 : gets channel load (in %), noise floor (in dbm) and rx_quality (in %) for 60ms duration + mlanutl uap0 getchload 4 70 : gets channel load (in %), noise floor (in dbm) and rx_quality (in %) for 40ms duration + and sets cca threshold as -70dBm setting OFDM desense (Only for IW416) + +dfs_repeater + This command is used to get/set DFS Repeater mode. + + Usage: + mlanutl mlan0 dfs_repeater <n> + + where the parameter is <n> : + null: to get current setting + 1: to enable dfs_repeater mode + 0: to disable dfs_repeater mode + + eg., + mlanutl mlan0 dfs_repeater :get current setting + mlanutl mlan0 dfs_repeater 1 :enable dfs repeater mode + mlanutl mlan0 dfs_repeater 0 :disable dfs repeater mode + +dfs_cac + This command is used to perform radar monitoring on a given channel using dfsX interface + + Usage: + mlanutl dfs0 dfs_cac <channel> [<bw> <cac-period>] + + where the parameters are: + <channel> 5G DFS channel to monitor for radar, when channel=0, stop CAC. + <bw> channel band-width (default 20MHZ) + 0 - Bandwidth 20MHz + 1 - Bandwidth 40MHz above + 3 - Bandwidth 40MHz below + 4 - Bandwidth 80MHz + <cac-period> seconds, default value 60 seconds. + after cac-period, driver will report channel report event and continue monitor the radar signal on this channel. + + Examples: + mlanutl dfs0 dfs_cac 52 1 :do CAC on channel 52, 40MHz above, default cac-duration of 60sec : + mlanutl dfs0 dfs_cac 52 1 120 :do CAC on channel 52, 40MHz above, default cac-duration of 120sec + mlanutl dfs0 dfs_cac 0 :stop CAC +autodfs + This command is used to start/stop auto zero DFS + + Usage: + mlanutl dfs0 autodfs 0 + mlanutl dfs0 autodfs 1 [conf_file] + Examples: + mlanutl dfs0 autodfs 0 : stop Auto Zero DFS + mlanutl dfs0 autodfs 1 config/autodfs.conf : start Auto Zero DFS + +dfs53cfg + This command is used to set/get settings for DFS W53 configuration for JP-DFS. + + Usage: + mlanutl mlanX dfs53cfg [n] + + where the parameters are: + <n> user-configured value for DFS W53 configuration for JP-DFS + 0 - Fw default value + 1 - New W53 Rules/Standars + 2 - New W53 Rules/Standars + Examples: + mlanutl uap0 dfs53cfg : get dfs w53 configuration + mlanutl uap0 dfs53cfg 1 : set dfs w53 configuration to New W53 Rules/Standards + +dfs_mode + This command is used to set/get dfs_mode used in driver. + + Usage: + mlanutl mlanX dfs_mode [n] + + where the parameters are: + <n> user-configured value for DFS mode in driver + 0 - driver default DFS mode + 1 - driver disable DFS master when AP and STA operate in same DFS channel + + Examples: + mlanutl uap0 dfs_mode : get DFS mode configuration + mlanutl uap0 dfs_mode 1 : set DFS mode to 1 + mlanutl uap0 dfs_mode 0 : set DFS mode to 0 + +esuppmode + This command is used to set/get the e-supplicant mode configurations/status. + + Note: The configurations can be set only before association. + For get, the configurations will be returned before association + and the current status will be returned after association. + + Where + [l] is <rsn_mode> + <rsn_mode> - This parameter specifies the RSN mode configuration + Bit 0 : No RSN + Bit 1-2 : RFU + Bit 3 : WPA // use of WPA/TKIP is not recommended anymore + Bit 4 : WPA-NONE + Bit 5 : WPA2 + Bit 6-15 : RFU + [m] is <pairwise_cipher> + <pairwise_cipher> - This parameter specifies the pairwise cipher + Bit 0 : RFU + Bit 1 : RFU + Bit 2 : TKIP //use of WEP/TKIP is not recommended anymore + Bit 3 : AES + Bit 4-7 : RFU + [n] is <group_cipher> + <group_cipher> - This parameter specifies the group cipher + Bit 0 : RFU + Bit 1 : RFU + Bit 2 : TKIP //use of WEP/TKIP is not recommended anymore + Bit 3 : AES + Bit 4-7 : RFU + Note that: the RFU bits cannot be SET. + + Examples: + mlanutl mlan0 esuppmode : Get RSN mode and pairwise/group cipher + mlanutl mlan0 esuppmode 8 4 4 : Set RSN mode yo WPA, active pairwise and // use of WPA/TKIP is not recommended anymore + group ciphers to TKIP //use of WEP/TKIP is not recommended anymore + +extcapcfg + This command is used to set/get extended capabilities. + + Usage: + mlanutl mlanX extcapcfg [<ext_cap>] + + where <ext_cap> : Extended capabilities in hex (max 9 bytes) + The Buffer should not be space separated. + + Examples: + mlanutl mlan0 extcapcfg 0x0000008020 : Set TDLS support and Interworking bits. + +fwmacaddr + This command is used to set/get FW side MAC address but host side address will remain as earlier. + + Usage: + mlanutl mlanX fwmacaddr [mac_addr] + + where <mac_addr> is desired MAC address + + Examples: + mlanutl mlan0 fwmacaddr : Get current FW MAC address + mlanutl mlan0 fwmacaddr 00:50:43:20:bc:44 : Set FW side MAC address + +getkey + This command is used to get PTK/GTK + mlanutl mlanX getkey + +per_pkt_cfg +-------------- + mlanutl <interface> per_pkt_cfg [tx_rx_control] [type_num] [ether_type1 ether_type2...] [tx_rx_control] [type_num] [ether_type1 ether_type2 ...] + This command is used to set tx/rx per packet Txctl and Rxinfo configuration. + + The supported options are: + tx_rx_control : + 0 - disable Tx and Rx per packet control + 1 - enable Tx per packet control + 2 - enable Rx Per packet control + 3 - enable Tx and Rx Per packet control + + type_num : Number of ether_types which support per packet control, the Max is 8. + ether_type : Array of ether_types for which need to do per-packet Tx control or get per-packet Rx info. + + Examples: + mlanutl mlan0/uap0 per_pkt_cfg : get the configuration of per-packet control + mlanutl mlan0/uap0 per_pkt_cfg 0 : disable per-packet control + mlanutl mlan0/uap0 per_pkt_cfg 3 1 0x88dc : set the Tx and Rx per-packet control configuration + +dot11_txrx + This command is used to send or receive packets. + + Usage: + mlanutl <interface> dot11_txrx <send/recv> <options> + interface : mlanX or uapX + options send : <conf_file> + conf_file : config file name + options recv : <protocol> [ verbose_mode ] + protocol : packet protocol type + verbose_mode : v -- enter verbose mode + + Example: + mlanutl mlan0 dot11_txrx send config/tx_ctrl.conf : To send packets + mlanutl mlan0 dot11_txrx recv 0x88dc : To receive packets of type 0x88dc + mlanutl mlan0 dot11_txrx recv 0x88dc v : To receive packets of type 0x88dc and + enter verbose mode + +txrxhistogram +-------------- + mlanutl mlanX/uapX txrxhistogram [action] [tx_rx_statics] + This command is used to get tx/rx statics from firmware. + + This command takes 2 conditions. + The supported options are: + action : 0 - disable Tx/Rx statics + 1 - enable Tx/Rx statics + 2 - get Tx/Rx statics + tx_rx_statics: 1 - enable/disable/get Tx statics + 2 - enable/disable/get Rx statics + 3 - enable/disable/get Tx and Rx statics + Examples: + mlanutl mlan0/uap0 txrxhistogram 1 3 : enable Tx and Rx statics + mlanutl mlna0/uap0 txrxhistogram 0 3 : disable Tx and Rx statics + mlanutl mlan0/uap0 txrxhistogram 2 2 : Get only Rx statics + mlnautl mlan0/uap0 txrxhistogram 2 1 : Get only Tx statics + mlnautl mlan0/uap0 txrxhistogram 2 3 : Get both Tx/Rx statics + +getscantable + Display the current contents of the driver scan table + + Usage: + mlanutl mlanX getscantable + mlanutl mlanX getscantable [#] + mlanutl mlanX getscantable tsf + mlanutl mlanX getscantable ch + mlanutl mlanX getscantable help + + 1) Without argument, the entire scantable is displayed in terms of channel (ch), signal strength (ss), BSS id (bssid), capability (cap), and SSID, + where each column in the capability is described as follows: + column 1 indicates the IBSS capability: A (Adhoc), I (Infra) + column 2 indicates the encryption capability: P (WEP :use of WEP/TKIP is not recommended anymore), W (WPA: use of WPA/TKIP is not recommended anymore), 2 (WPA2) + column 3 indicates the 11D capability: D (11D) + column 4 indicates the WMM capability: W (WMM), C (CAC) + column 5 indicates the 11K capability: K (11K) + column 6 indicates the 11R capability: R (11R) + column 7 indicates the WPS capability: S (WPS) + column 8 indicates the 11N/11AC capability: N (11N), A (11AC) + + 2) Specifying a # will display detailed information about a specific scan + table entry. '0' displays driver cached information regarding the + current association (if any). + 3) The tsf argument will display the entire scan table with the recorded + TSF timestamp for the entry. + 4) The ch argument will display the entire scan table sorted by channel + number in the ascending order. If this argument is not specified, + scan table is sorted by signal strength in the descending order. + 6) The help argument will display the legend for the capability field. + +getstalist + This command is used to get list of associated stations to the AP. + + Example: + mlanutl uap0 getstalist + +channel_switch <switch mode> <oper class> <new channel> <switch count> <bandwidth/num_pkts> +channel_switch <switch mode> <oper class> <new channel> <switch count> <bandwidth> + This command is used to do channel switch according to spec. + + Where the paramters are: + switch mode : 0 -- no need to block traffic, 1 -- need block traffic + oper class : operating class according to IEEE std802.11 spec, when 0 is used, only CSA IE will be used + new channel : the channel will switch to + switch count: channel switch time to send ECSA ie + (when set to 0, CSA/ECSA action frame will be send out) + switch count: channel switch time to send CSA ie + + bandwidth : channel width switch to(optional),only for 5G channels. + Support value 1 -- 40M above, 3 -- 40M below, 4 -- 80M, 5 -- 160M + num_pkts : send number of CSA/ECSA action frame + + Example: + mlanutl uap0 channel_switch 1 115 36 10 :switch to channel 36, oper class 115 + mlanutl uap0 channel_switch 1 81 6 10 :switch to channel 6, oper class 81 + mlanutl uap0 channel_switch 1 0 6 10 :switch to channel 6 + mlanutl uap0 channel_switch 1 0 36 10 1 :switch to channel 36, bandwidth 40MHz above + mlanutl uap0 channel_switch 1 0 36 0 3 :switch to channel 36, and send 3 broadcast CSA action frame + mlanutl uap0 channel_switch 1 115 36 0 3 :switch to channel 36, and send 3 broadcast ECSA action frame + (Only IW61X supports sending CSA/ECSA action frames) + +hostcmd 2040coex + This command is used to send the 11n 20/40 Coex command to firmware. + Firmware will send 11n 20/40 Coex management action frame to AP. + + Usage: + mlanutl mlanX hostcmd config/11n_2040coex.conf 2040coex + +hostcmd auto_tx_get +hostcmd auto_tx_unreg + This command is used to configures the Frame Auto Transmission parameters. + auto_tx_get: get auto_tx parameters + auto_tx_unreg: unregister to firmware auto_tx + + Usage: + mlanutl mlanX hostcmd config/auto_tx.conf auto_tx_get + mlanutl mlanX hostcmd config/auto_tx.conf auto_tx_unreg + +hostcmd bgscfg + This command is used to configure the various parameters for PPS/UAPSD + or normal background scan. + + Usage: + mlanutl mlanX hostcmd config/bg_scan.conf bgscfg + +hostcmd <pkt_coalescing.conf> coalesce_cfg + This command is used to set/clear rules to filter and buffer + broadcast/multicast packet which reduce unwanted patcket or interrupt to + host. + + Usage: + mlanutl mlanX hostcmd <pkt_coalescing.conf> coalesce_cfg + +hostcmd <ed_mac_ctrl.conf> ed_mac_ctrl + This command is used to control ED MAC. + + Usage: + mlanutl mlanX hostcmd <ed_mac_ctrl.conf> ed_mac_ctrl + +hostcmd crypto_test + This command is used to test the encryption/decryption API of the firmware. + + Usage: + mlanutl mlanX hostcmd config/crypto_test.conf crypto_test + +hostcmd nat_keep_alive + This command is used to configures the Frame Auto Transmission parameters. + nat_keep_alive: register to firmware for sending NAT Keep Alive packet + + Usage: + mlanutl mlanX hostcmd config/auto_tx.conf nat_keep_alive + +hostcmd pad_cfg_get +hostcmd pad_cfg_set + This command is used to set/get the configuration data for PAD OR. + + Usage: + mlanutl mlanX hostcmd config/pad_cfg.conf pad_cfg_get + mlanutl mlanX hostcmd config/pad_cfg.conf pad_cfg_set + +hostcmd requesttpc + This command is used to request 802.11H TPC info. + + Usage: + mlanutl mlanX hostcmd config/requesttpc.conf requesttpc + +hostcmd mode_get +hostcmd mode_timeshare +hostcmd mode_spatial +hostcmd mode_none +hostcmd mode_bca + This command is used to get/set Robust BT Coex. + mode_get: get the current mode + mode_timeshare: set Robust BT Coex to timeshare mode (default on 1x1 chips) + mode_spatial: set Robust BT Coex to spatial mode (only for, and default on 2x2 chips) + mode_none: set Robust BT Coex to mode none (only for, and default on 2x2_3Antenna chips) + mode_bca: set Robust BT Coex to bca mode (HW BCA based WLAN and BT traffic arbitration) + + Usage: + mlanutl mlanX hostcmd config/robust_btc.conf mode_get + mlanutl mlanX hostcmd config/robust_btc.conf mode_timeshare + mlanutl mlanX hostcmd config/robust_btc.conf mode_spatial + mlanutl mlanX hostcmd config/robust_btc.conf mode_none + mlanutl mlanX hostcmd config/robust_btc.conf mode_bca + +hostcmd gpio_cfg + This command is used to enable/disable GPIO cfg. + gpio_cfg: enable/disable GPIO cfg for external bt request (default is enable with High Polarity) + + Usage: + mlanutl mlanX hostcmd config/robust_btc.conf gpio_cfg + +hostcmd external_coex_uart_config + This command is used to enable/disable Loopback mode. + external_coex_uart_config: enable/disable loopback of received data (default is disable) + + Usage: + mlanutl mlanX hostcmd config/robust_btc.conf external_coex_uart_config + +hostcmd external_coex_pta_config + This command is used to configure external coex interface/WCI-2 interface + external_coex_pta_config: Configure either PTA interface or WCI-2 interface (default is configured for PTA interface). + Usage: + mlanutl mlanX hostcmd <robust_btc.conf> external_coex_pta_config + +hostcmd generictime +hostcmd a2dptime +hostcmd inquirytime +hostcmd ap_generictime +hostcmd ap_a2dptime +hostcmd ap_inquirytime + This command is used to configure the time slice of COEX (only works in timeshare mode) + generictime: configure the Bttime and Wlantime in Station Generic case + a2dptime: configure the Bttime and Wlantime in Station A2DP case + inquirytime: configure the Bttime and Wlantime in Station Inquiry case + ap_generictime: configure the Bttime and Wlantime in Ap Generic case + ap_a2dptime: configure the Bttime and Wlantime in Ap A2DP case + ap_inquirytime: configure the Bttime and Wlantime in Ap Inquiry case + + Usage: + mlanutl mlanX hostcmd config/robust_btc.conf generictime + mlanutl mlanX hostcmd config/robust_btc.conf a2dptime + mlanutl mlanX hostcmd config/robust_btc.conf inquirytim + mlanutl mlanX hostcmd config/robust_btc.conf ap_generictime + mlanutl mlanX hostcmd config/robust_btc.conf ap_a2dptime + mlanutl mlanX hostcmd config/robust_btc.conf ap_inquirytime + +hostcmd get_bca_arb_config +hostcmd set_en_bca_arb_config +hostcmd set_dis_bca_arb_config + This command is used to get/set Arbitration status for BCA, WLAN, 15.4, BT/BLE and Ext. radio. + get_bca_arb_config: get arbitration status for BCA, WLAN, 15.4, BT/BLE and, Tx and Rx of Ext. radio + set_en_bca_arb_config: set arbitration status for BCA, WLAN, 15.4, BT/BLE and, Tx and Rx of Ext. radio to Enable + set_dis_bca_arb_config: set arbitration status for BCA, WLAN, 15.4, BT/BLE and, Tx and Rx of Ext. radio to Disable + + Usage: + mlanutl mlanX hostcmd config/coex_int_api.conf get_bca_arb_config + mlanutl mlanX hostcmd config/coex_int_api.conf set_en_bca_arb_config + mlanutl mlanX hostcmd config/coex_int_api.conf set_dis_bca_arb_config + +hostcmd get_wlan_stats +hostcmd get_15_4_stats +hostcmd get_bt_stats +hostcmd get_ble_stats + This command is used to get statistics values for WLAN, 15.4, BT and BLE. + get_wlan_stats: get statistics for WLAN + get_15_4_stats: get statistics for 15.4 + get_bt_stats: get statistics for BT + get_ble_stats: get statistics for BLE + + Usage: + mlanutl mlanX hostcmd config/coex_int_api.conf get_wlan_stats + mlanutl mlanX hostcmd config/coex_int_api.conf get_15_4_stats + mlanutl mlanX hostcmd config/coex_int_api.conf get_bt_stats + mlanutl mlanX hostcmd config/coex_int_api.conf get_ble_stats + +hostcmd sdio_pulldown_get +hostcmd sdio_pulldown_set +hostcmd sdio_pulldown_disable + This command is used to set/get the settings of pulling up and + pulling down of SDIO lines. + + Usage: + mlanutl mlanX hostcmd config/sdio_pulldown.conf sdio_pulldown_get + mlanutl mlanX hostcmd config/sdio_pulldown.conf sdio_pulldown_set + mlanutl mlanX hostcmd config/sdio_pulldown.conf sdio_pulldown_disable + +hostcmd subevent_get +hostcmd subevent_set + This command is used to get/set the configurations for event descriptor + interface command. + subsvent_get: get subscribed event parameters + subsvent_set: set subscribed event parameters + + Usage: + mlanutl mlanX hostcmd config/subevent.conf subevent_get + mlanutl mlanX hostcmd config/subevent.conf subevent_set + +hostcmd txpwrlimit_2g_cfg_set +hostcmd txpwrlimit_5g_cfg_set +hostcmd txpwrlimit_cfg_get + This command is used to set/get the configuration data of Tx power limitation. + Note: The configuration set should be issued when STA is disconnected. + + Usage: + mlanutl mlanX hostcmd config/txpwrlimit_cfg.conf txpwrlimit_cfg_get + mlanutl mlanX hostcmd config/txpwrlimit_cfg.conf txpwrlimit_2g_cfg_set + mlanutl mlanX hostcmd config/txpwrlimit_cfg.conf txpwrlimit_5g_cfg_set + +hostcmd txrate_cfg_get +hostcmd txrate_cfg_set_bg +hostcmd txrate_cfg_set_bgn + This command is used to set/get the transmit data rate. + + Usage: + mlanutl mlanX hostcmd config/txrate_cfg.conf txrate_cfg_get + mlanutl mlanX hostcmd config/txrate_cfg.conf txrate_cfg_set_bg + mlanutl mlanX hostcmd config/txrate_cfg.conf txrate_cfg_set_bgn + +hostcmd fwdump + This command is used to trigger firmware dump + + Usage: + mlanutl mlanX hostcmd <fwdump.conf> fwdump + +hostcmd stop_su +hostcmd start_su + This command is used to set/get 11ax related setting + stop_su: stop su + start_su: resume su + stop_forceRTS: stop force Tx RTS + start_forceRTS: start force Tx RTS + Usage: + mlanutl mlanX hostcmd config/debug.conf stop_su + mlanutl mlanX hostcmd config/debug.conf start_su + mlanutl mlanX hostcmd config/debug.conf stop_forceRTS + mlanutl mlanX hostcmd config/debug.conf start_forceRTS + +hotspotcfg + This command is used to get/set the HotSpot configuration. + + Usage: + mlanutl mlanX hotspotcfg [<bitmap>] + + Where the parameter is: + <bitmap> : configuration bitset + : Bit 31-10 - Reserved set to 0 + : Bit 9 - TDLS support indication enable/disable + : Bit 8 - Interworking indication enable/disable + : Bit 7-1 - Reserved set to 0 + : Bit 0 - HotSpot feature enable/disable + + Examples: + mlanutl mlan0 hotspotcfg : Get present remote address mode + mlanutl mlan0 hotspotcfg 0x301 : Turn on HotSpot2.0 and enable TDLS support and interworking indication + mlanutl mlan0 hotspotcfg 0 : Turn off HotSpot2.0 and disable TDLS support and interworking indication + +hscfg + This command is used to configure the host sleep parameters. + Please note hssetpara and usbsuspend/usbresume commands should be used for USB + host sleep related tests. + + Usage: + mlanutl mlanX hscfg [condition [[GPIO# [gap]]]] (optional)[type ind_GPIO# [level]] (optional)[type event_force_ignore event_use_ext_gap ext_gap [gpio_wave]] + + This command takes one (condition), two (condition and GPIO#) or three + (condition, GPIO# and gap). If more than three parameters, it can set different or multiple features indicating by type(this is optional): + + If type=1, it will set indication gpio and its level. And the parameter format will be (condition, GPIO#,gap and type,ind_GPIO#) or + (condition, GPIO#, gap, type, ind_GPIO# and level). + + If type=2, it will set extend hscfg wakup method. And the parameter format will be (condition, GPIO#, gap, type, force_ignore, + use_ext_gap, ext_gap [gpio_wave]). gpio_wave parameter is optional and default value is 0(falling edge). Each bit of + event_force_ignore and event_use_ext_gap will be defined to one same event, and set one same event(same bit) in those two + parameters is not allowed. Set bit(s) in event_force_ignore means the event(s) will be forced ignore in firmware silently. + Set bit(s) in event_use_ext_gap mean the event(s) will use extend gap to inform host. Not set means not handle. + + If type=3, it will set hs_wakeup_interval. + + If type=4, it will set min_wake_holdoff. + + If no parameter provided, get is performed. + + The usages of parameters for "hscfg" are the same as that for "hssetpara" command. + +mgmtfilter + This command is used to set management frame to wake up host when host suspend. + + Usage: + mlanutl mlanX mgmtfilter <mgmtfilter.conf> + + where <mgmtfilter.conf> + This conf file will set management frame catagory, action and frame mask. + + Examples: + mlanutl mlan0 mgmtfilter mgmtfilter.conf + +auto_arp + This command is used to enable/disable auto arp response in host sleep mode. + No argument is used to get. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 auto_arp 0 : Disable auto arp response from FW + mlanutl mlan0 auto_arp : Get auto arp configuration status + +htstreamcfg + This command is used to set/get HT stream configuration. + The setting only takes effect in next association. + + Usage: + mlanutl mlanX htstreamcfg [n] + + where <n> + 0x11: HT stream 1x1 mode + 0x22: HT stream 2x2 mode + + Examples: + mlanutl mlan0 htstreamcfg : Get current setting + mlanutl mlan0 htstreamcfg 0x11 : Set HT stream 1x1 mode + mlanutl mlan0 htstreamcfg 0x22 : Set HT stream 2x2 mode + +httxbfcap + This command is used to set/get the TX beamforming capabilities. + + Usage: + mlanutl mlanX httxbfcap [cap] + + where the parameters are, + cap: TX beamforming capabilities + Bit 0 : Implicit TX BF receiving capable + Bit 1 : RX staggered sounding capable + Bit 2 : TX staggered sounding capable + Bit 3 : RX NDP capable + Bit 4 : TX NDP capable + Bit 5 : Implicit TX BF capable + Bit 6-7 : Calibration + 0: - not supported + 1: - STA can respond to a calibration request using + the CSI Report, but cannot initiate calibration + 2: - reserved + 3: - STA can both initiate and respond to a calibration request + Bit 8 : Explicit CSI TX BF capable + Bit 9 : Explicit non-compressed steering capable + Bit 10 : Explicit compressed steering capable + Bit 11-12: Explicit TX BF CSI feedback + 0: - not supported + 1: - delayed feedback + 2: - immediate feedback + 3: - delayed and immediate feedback + Bit 13-14: Explicit non-compressed BF feedback capable + 0: - not supported + 1: - delayed feedback + 2: - immediate feedback + 3: - delayed and immediate feedback + Bit 15-16: Explicit compressed BF feedback capable + 0: - not supported + 1: - delayed feedback + 2: - immediate feedback + 3: - delayed and immediate feedback + Bit 17-18: Minimal grouping + 0: - no grouping (STA supports groups of 1) + 1: - groups of 1, 2 + 2: - groups of 1, 4 + 3: - groups of 1, 2, 4 + Bit 19-20: CSI number of beamformer antennas supported + 0: - single TX antenna sounding + 1: - 2 TX antenna sounding + 2: - 3 TX antenna sounding + 3: - 4 TX antenna sounding + Bit 21-22: Non-compressed steering number of beamformer antennas supported + 0: - single TX antenna sounding + 1: - 2 TX antenna sounding + 2: - 3 TX antenna sounding + 3: - 4 TX antenna sounding + Bit 23-24: Compressed steering number of beamformer antennas supported + 0: - single TX antenna sounding + 1: - 2 TX antenna sounding + 2: - 3 TX antenna sounding + 3: - 4 TX antenna sounding + Bit 25-26: CSI max number of rows beamformer supported + 0: - single row of CSI + 1: - 2 rows of CSI + 2: - 3 rows of CSI + 3: - 4 rows of CSI + Bit 27-28: Channel estimation capability + 0: - 1 space time stream + 1: - 2 space time streams + 2: - 3 space time streams + 3: - 4 space time streams + Bit 29-31: Reserved + + Examples: + mlanutl mlan0 httxbfcap : Get the current TX BF capabilities + mlanutl mlan0 httxbfcap 0x0000001F : Set the TX BF capabilities of the + Implicit TX BF receiving capable, + RX staggered sounding capable, + TX staggered sounding capable, + RX NDP capable and TX NDP capable + +httxbfcfg + This command is used to configure the TX beamforming options. + Note: Any new subcommand should be inserted in the second + argument and each argument of the sub command should be + separated by semicolon. For global configuration, the + arguments should be separated by space. + + Usage: + mlanutl mlanX httxbfcfg "<action>[;GlobalData/tsData/interval/txPeerData/snrData/txSounding]" + + where the parameters are, + action: TX beamforming action + 0: Control global parameters for beamforming + 1: Performs NDP Sounding for PEER + 2: TX BF interval in milliseconds + 3: Enable/Disable beamforming/sounding for a particular peer + 4: TX BF SNR Threshold for peer + .. <for new subcommand> + GlobalData: Global parameter arguments. + It contains beamforming enable, sounding enable, FB type, snr_threshold + sounding interval, Beamformig mode values seperated by space. + Syntax: + mlanutl mlanX httxbfcfg <action>;<beamforming enable> <sounding enable> <FB type> + <snr_threshold> <sounding interval> <Beamforming mode> + tsData: Trigger sounding for PEER specific arguments, + it contains PEER MAC and status + interval: TX BF interval in milliseconds + txPeerData: Enable/Disable beamforming/sounding for the indicated peer, + it contains PEER MAC, sounding, beamfoming options and FB type; + snrData: TX BF SNR Threshold for peer, it contains PEER MAC and SNR + + Examples: + mlanutl mlan0 httxbfcfg "0" : Get current global configuration parameter + mlanutl mlan0 httxbfcfg "2;00:50:43:20:BF:64" : Get the TX BF periodicity for a given peer + mlanutl mlan0 httxbfcfg "3" : Get the list of MAC addresses that have + beamforming and/or sounding enabled + mlanutl mlan0 httxbfcfg "4" : Get the list of PEER MAC, SNR tuples + programmed into the firmware. + mlanutl mlan0 httxbfcfg "0;0 0 3 10 500 5" : Disable beamforming, sounding, set FB type + to 3, snr threshold to 10, sounding interval + to 500 ms and beamforming mode to 5 + mlanutl mlan0 httxbfcfg "1;00:50:43:20:BF:64" : Perform NDP Trigger sounding to peer + 00:50:43:20:BF:64 + mlanutl mlan0 httxbfcfg "2;00:50:43:20:BF:64;500" : Set TX BF periodicity for peer 00:50:43:20:BF:64 + to 500 milliseconds + mlanutl mlan0 httxbfcfg "3;00:50:43:20:BF:43;1;0;3" : Enable beamforming, disable sounding and set + FB type to 3 for peer 00:50:43:20:BF:43 + mlanutl mlan0 httxbfcfg "4;00:50:43:20:BF:24;43" : Set TX BF SNR threshold to peer + 00:50:43:20:BF:24 with SNR 43 + +inactivityto + This command is used to set/get the inactivity timeout value, which specifies + when WLAN device is put to sleep. + + Usage: + mlanutl mlanX inactivityto <n> <m> <l> [k] + + where the parameter are: + <n>: timeout unit in microseconds. + <m>: Inactivity timeout for unicast data. + <l>: Inactivity timeout for multicast data. + [k]: Inactivity timeout for new Rx traffic after PS notification to AP. + + Examples: + mlanutl mlan0 inactivityto : Get the timeout value + mlanutl mlan0 inactivityto 1000 2 3 : Set timeout unit to 1000 us (1 ms), + inactivity timeout for unicast data is 2 ms, + inactivity timeout for multicast data is 3 ms + +ipaddr + This command is used to set/get IP address. + + Usage: + mlanutl mlanX ipaddr ["<op>;<ipaddr>"] + + where <op> + 0: Remove the IP address + bit 0: Set IP address for broadcast ARP filter, which will be auto enabled + in next host sleep configuration + bit 1: Set IP address for auto broadcast ARP response + + Examples: + mlanutl mlan0 ipaddr : Get current settings + mlanutl mlan0 ipaddr "0" : Remove IP address + mlanutl mlan0 ipaddr "1;192.168.0.5" : Set IP address for ARP filter + mlanutl mlan0 ipaddr "3;192.168.0.6" : Set IP address for ARP filter + : and auto ARP response + +linkstats + This command is used to get the link statistics from the firmware. + + Usage: + mlanutl mlanX linkstats + +listeninterval + This command is used to set/get listen interval in assoc request. + + Usage: + mlanutl mlanX listeninterval [l] + + where the parameter: + [l]: Value of listen interval [Default 10] + + Examples: + mlanutl mlan0 listeninterval : Display Listen interval + mlanutl mlan0 listeninterval 1 : Set Listen interval to 1. + +macctrl + This command is used to set/get MAC control. + It's recommended to read the current setting first to avoid override issue. + + Usage: + mlanutl mlanX macctrl [n] + + where <n> + bit 0: Rx enabled + bit 1: Directed Filter enabled + bit 2: LoopBack enabled + bit 3: WEP enabled (use of WEP/TKIP is not recommended anymore) + bit 4: EthernetII enabled + bit 5: MultiCast enabled + bit 6: BroadCast enabled + bit 7: Promiscuous enabled + bit 8: All MultiCast enabled + bit 9: RTS/CTS enabled (0: CTS to self) + bit 10: Enforce Protection enabled + bit 11: Force 11N Protection enabled + bit 12: Rx 802.11 Packets enabled + bit 13: Ad-hoc g Protection enabled + bit 14: Reserved + bit 15: WEP Type (use of WEP/TKIP is not recommended anymore) + bit 16: BandWidth Indication in RTS enabled + bit 17: Dynamic BandWidth Indication Mode in RTS enabled + bit 18-31: Reserved + + Examples: + mlanutl mlan0 macctrl : Get current MAC control + mlanutl mlan0 macctrl 0x13 : Set Rx enabled and Directed Filter enabled and EthernetII enabled + mlanutl mlan0 macctrl 0x813 : Set Rx enabled and Directed Filter enabled and EthernetII enabled + Force 11N Protection enabled + +memrdwr + This command is used to read/write the adapter memory. + + Usage: + mlanutl mlanX memrdwr <address> [value] + + where the parameters are, + <address>: memory address + [value]: value to be written + + Examples: + mlanutl mlan0 memrdwr 0x4cf70 : Read memory address 0x4cf70 + mlanutl mlan0 memrdwr 0x80000000 0xffffffff + : Write 0xffffffff to memory address 0x80000000 + +miracastcfg + This command is used to set/get the miracast configuration. + + Usage: + mlanutl mlanX miracastcfg [l] [m] [n] + + where the parameters are, + [l]: miracast mode + 0: Disable + 1: Source + 2: Sink + [m]: scan time per channel, in ms + [n]: gap during two scans, in ms + + Examples: + mlanutl mlan0 miracastcfg : Get miracast configuration + mlanutl mlan0 miracastcfg 0 : Disable miracast configuration + mlanutl mlan0 miracastcfg 1 20 40 : Set miracast mode as source, with scan time + 20ms per channel and gap during two scans 40ms + +mgmtframectrl + This command is used to set/get registered frame type to passthrough. + + Usage: + mlanutl mlanX mgmtframectrl [<mask>] + mlanutl uapX mgmtframectrl [<mask>] + + Where the parameter is: + <mask> : the bit mask of management frame reception. + : Bit 0 - Association Request + : Bit 1 - Association Response + : Bit 2 - Re-Association Request + : Bit 3 - Re-Association Response + : Bit 4 - Probe Request + : Bit 5 - Probe Response + : Bit 8 - Beacon Frames + : Bit 13 - Action Frames + + Examples: + mlanutl mlan0 mgmtframectrl : Get present mask + mlanutl mlan0 mgmtframectrl 0x0020 : Bit 5 is set, Forward probe response frames to application layer + +mgmtframetx + This command is used to send management frame. + + Usage: + mlanutl mlanX mgmtframetx <mgmt_frame.conf> + + Where the parameter is: + mgmt_frame.conf : The configuration file contains the management frame. + + Examples: + mlanutl mlan0 mgmtframetx config/mgmt_frame.conf + +mpactrl + This command is used to set/get the Tx, Rx SDIO aggregation parameters. + Note: The parameters can be set only in disconnected state. + + Usage: + mlanutl mlanX mpactrl [tx_ena] [rx_ena] [tx_size] [rx_size] [tx_ports] [rx_ports] + + where the parameter are: + [tx_ena]: Enable/disable (1/0) Tx MP-A + [rx_ena]: Enable/disable (1/0) Rx MP-A + [tx_size]: Size of Tx MP-A buffer + [rx_size]: Size of Rx MP-A buffer + [tx_ports]: Max ports (1-16) for Tx MP-A + [rx_ports]: Max ports (1-16) for Rx MP-A + default values are 1 1 16384 32768 16 16 + The MP-A may be disabled by default at build time if the MMC driver byte mode patch + is not available in kernel. + + Examples: + mlanutl mlan0 mpactrl : Get MP aggregation parameters + mlanutl mlan0 mpactrl 0 0 + : Disable MP aggregation for Tx, Rx respectively + mlanutl mlan0 mpactrl 1 1 8192 8192 8 8 + : Enable MP aggregation for Tx, Rx + : Set Tx, Rx buffer size to 8192 bytes + : Set maximum Tx, Rx ports to 8 + +netmon + This command is used to set/get network monitor configuration. + Note: For channel specified mode, the configuration should be issued when + STA/AP is disconnected. For in-channel sniffer mode, the configuration + can be issued irrespective of the STA/AP connected state, and requires + specification of only action and filter parameters. If any of the STA/AP + connection is active, the in-channel sniffer mode will inherently work + on the active band and channel configuration. + + Usage: + mlanutl <interface> netmon [<act> [<filter> <band> <chan> <opt>]] + + Where the parameters are: + <interface> : mlanX + <act> : (0) disable any network monitor activity + : (1) enable channel specified sniffer mode activity + <filter> : network monitor fitler flag + bit 0: (1/0) enable/disable management frame + bit 1: (1/0) enable/disable control frame + bit 2: (1/0) enable/disable data frame + <band> : 802.11 band + bit 0: B + bit 1: G + bit 2: A + bit 3: GN + bit 4: AN + bit 5: AC 2.4G + bit 6: AC 5G + <chan> : channel to monitor + <opt> : [offset] + [offset] : secondary channel bandwidth + 0 - Bandwidth 20Mhz + 1 - HT Bandwidth 40Mhz sec channel above + 3 - HT Bandwidth 40Mhz sec channel below + 4 - VHT Bandwidth 80Mhz + + Examples: + mlanutl mlan0 netmon : Get the current network monitor configuration + mlanutl mlan0 netmon 0 : Disable network monitor activity + mlanutl mlan0 netmon 1 4 11 6 : Enable channel specified sniffer activity, set filter + data frame, band B/G/GN and channel 6 + mlanutl mlan0 netmon 1 7 20 64 1 : Enable channel specified sniffer activity, set filter + management, control and data frame, band A/AN, + channel 64 and secondary channel above + +offchannel + This command is used to set/cancel the offchannel configuration. + Note: This command only can be used when cfg80211 is enabled during load time. + + Usage: + mlanutl mlanX offchannel [<l> <m> <n> <bandwidth>] + + where + <l> + 0 : Cancel the offchannel configuration + 1 : Set the offchannel configuration + <m> + The channel to configure + <n> + The duration for which to configure + <bandwidth> : channel bandwidth + 0 - Bandwidth 20Mhz + 1 - HT Bandwidth 40Mhz sec channel above + 3 - HT Bandwidth 40Mhz sec channel below + 4 - VHT Bandwidth 80Mhz + + Examples: + mlanutl mlan0 offchannel : Get current offchannel status. + mlanutl mlan0 offchannel 0 : Cancel the offchannel configuration. + mlanutl mlan0 offchannel 1 3 5 : Configure channel 3 for 5 milliseconds. + mlanutl mlan0 offchannel 1 36 5000 : Configure channel 36 for 5000 milliseconds. + mlanutl mlan0 offchannel 1 64 500 4 : Configure channel 64 in 80MHz for 500 milliseconds. + +otpuserdata + This command is used to get the OTP user data. + + Where + <l> is <user_data_length> + <user_data_length> - This parameter specifies the length of OTP user data to be read + + Examples: + mlanutl mlan0 otpuserdata 10 : Get the 10-byte OTP user data + +passphrase + This command is used to set/get passphrase for WPA-PSK/WPA2-PSK/WPA3-SAE mode.// use of WPA/TKIP is not recommended anymore + + Where <l> + ASCII string for ssid/passphrase/psk/sae_password. + + Setting psk for WPA3 SAE protocol is not possible, as new psk gets generated + everytime in protocol flow. + + 1) "0;<ssid=valid ssid>" - This will get the passphrase, AKMP + for specified ssid, if none specified then it will get all. + + Example: + mlanutl mlan0 passphrase "0;ssid=nxp" + + 2) "1;<psk=64 byte hexpsk>;<passphrase=1-63 byte passphare> + <ssid=valid ssid>" - Passphrase and psk cannot be provided for the same SSID. + This command takes only one SSID at a time, If ssid= is present it should contain + a passphrase or psk. If no arguments are provided then AKMP=802.1x, and passphrase + should be provided after association. + End of each parameter should be followed by a ';'(except for the last parameter) + as the delimiter. If ';' or '/' has to be used in an SSID then a '/' should be preceded + to ';' or '/' as a escape. + + Examples: + mlanutl mlan0 passphrase "1;ssid=nxpAP;passphrase=abcdefgd" + mlanutl mlan0 passphrase "1;ssid=nxp AP;psk=<64 bytes hexpsk>" + + If user wants to input the ssid as "nxp; AP" then command has to be + mlanutl mlan0 passphrase "1;ssid=nxp/; AP;passphrase=abcdefgh" + + If user wants to input the ssid as "//;" then command has to be + mlanutl mlan0 passphrase "1;ssid=/////;;passphrase=abcdefgh" + + 3) "2;<ssid=valid ssid>" - This will clear the passphrase + for specified ssid, if none specified then it will clear all. + + Examples: + mlanutl mlan0 passphrase "2;ssid=nxp" + mlanutl mlan0 passphrase "2" : Clear all profiles and disable embedded supplicant + + 4)"1;ssid=<ssid>;sae_password=<password>" This will set WPA3 SAE ssid & password. sae_password should be within the range of 8 to 255 char. + Examples: + mlanutl mlan0 passphrase "1;ssid=nxp;sae_password=1234567890" + +pb_bypass + This command is used to get the By-passed TX packet from upper layer. + + Usage: + + mlanutl mlanX pb_bypass [data_1, data_2, ... data_n] + + where value of data_1, data_2, ... data_n isBypass TX Data + +pcieregrw + This command is used to read/write PCIE register. + + Usage: + mlanutl mlanX pcieregrw <offset> [value] + + where the parameters are, + <offset>: The offset of PCIE register + [value]: The value to write + + Examples: + mlanutl mlan0 pcieregrw 0x48 : Read PCIE register 0x48 + mlanutl mlan0 pcieregrw 0x44 8 : Write 8 to PCIE register 0x44 + +pciebar0regrw + This command is used to read/write PCIE register/memory from BAR0. + + Usage: + mlanutl mlanX pciebar0regrw <offset> [value] + + where the parameters are, + <offset>: The offset of PCIE register + [value]: The value to write + + Examples: + mlanutl mlan0 pciebar0regrw 0x48 : Read PCIE register 0x48 + mlanutl mlan0 pciebar0regrw 0x44 8 : Write 8 to PCIE register 0x44 + +pmfcfg + This command is used to set/get management frame protection parameters. + + Usage: + mlanutl mlanX pmfcfg <m> <n> + + where + <m>: Management Frame Protection Capable (MFPC) + 1: Management Frame Protection Capable + 0: Management Frame Protection not Capable + <n>: Management Frame Protection Required (MFPR) + 1: Management Frame Protection Required + 0: Management Frame Protection Optional + Default setting is PMF not capable. + m = 0, n = 1 is an invalid combination + + Examples: + mlanutl mlan0 pmfcfg : Get PMF parameters + mlanutl mlan0 pmfcfg 1 0 : Set MFPC and make MFPR optional + +port_ctrl + This command is used to Set/Get Port Control mode. No argument is used to get. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 port_ctrl 1 : Enable Port Control mode + mlanutl mlan0 port_ctrl : Get Port Control mode status + +powercons + This command is used to set the local transmit power constraint. + Value is in dbm unit. This command is only used for ad-hoc start. + + Usage: + mlanutl mlanX powercons [n] + + Examples: + mlanutl mlanX powercons : get the current setting + mlanutl mlanX powercons 12 : set local power constraint to 12 dbm + +pscfg + This command is used to set/get PS configuration parameters. + + Usage: + mlanutl mlanX pscfg [k] [d] [l] ... + + Where the parameters: + [k]: Keep alive null packet interval (0: Unchanged, -1: Disable, n: Interval in seconds) + [d]: DTIM interval ( 0: Unchanged, + 1-5: Value, + 65534: DTIM will be ignored, listen interval will be used, + 65533: Closest DTIM to the listen interval period will be used ) + [l]: Local listen interval ( 0: Unchanged, + -1: Disable, + 1-49: Value in beacon intervals, + >= 50: Value in TUs ) + [b]: Beacon miss timeout (0: Unchanged, 1-50: Value in milliseconds, 65535: Disable) + [p]: Delay to PS (0-65535: Value in milliseconds, default 1000ms) + [m]: PS mode (0: Unchanged, 1: Auto mode, 2: PS-Poll mode, 3: PS Null mode) + No change if parameters are not provided. + + Examples: + mlanutl mlan0 pscfg : Get all the current PS configuration settings + mlanutl mlan0 pscfg 3 4 : Set PS keep alive null packet interval to 3 seconds + and DTIM interval to 4, all the other configurations + are unchanged + mlanutl mlan0 pscfg 0 0 0 0 50 2 : Set delay to PS to 50 ms and PS mode to PS-Poll mode, + keep the others unchanged + +bcntimeoutcfg + This command is used to set Beacon timeout parameters. + + Usage: + mlanutl mlanX bcntimeoutcfg [l] [m] [o] [p] + + Where the parameters: + [l]: Beacon miss timeout period Rx window (in ms) + [m]: Beacon miss timeout period (unit in beacon interval) + [o]: Beacon reacquire timeout period Rx window (unit in beacon interval) + [p]: Beacon reacquire timeout period (unit in beacon interval) + Please note that it would be better [m]+[p] not exceed 64. + Examples: + mlanutl mlan0 bcntimeoutcfg 10 30 2 30 : Set beacon timeout configure to + Beacon miss timeout period Rx window : 10 (ms) + Beacon miss timeout period : 30 (Beacon Interval) + Beacon reacquire timeout period Rx window : 2 (Beacon Interval) + Beacon reacquire timeout period : 30 (Beacon Interval) + +psmode + This command is used to set/get the IEEE PS mode configuration. + + Usage: + mlanutl mlanX psmode [l] + + where the parameter: + [l] + 0 : Disable IEEE PS mode + 1 : Enable IEEE PS mode + <none>: Get IEEE PS mode + + Examples: + mlanutl mlan0 psmode : Get IEEE PS mode. + mlanutl mlan0 psmode 1 : Enable IEEE PS mode. + +qconfig + Send a WMM AC Queue configuration command to get/set/default params + + Configure or get the parameters of a WMM AC queue. The command takes + an optional Queue Id as a last parameter. Without the queue id, all + queues will be acted upon. + + Usage: + mlanutl mlanX qconfig def [Queue Id: 0-3] + mlanutl mlanX qconfig get [Queue Id: 0-3] + mlanutl mlanX qconfig set msdu <lifetime in TUs> [Queue Id: 0-3] + +qoscfg + This command sets WMM IE QOS info when an argument is given, and gets current WMM + IE QOS info when no argument is given. + + Examples: + mlanutl mlanX qoscfg 0x0f : Set WMM IE QOS info to 0x0f + mlanutl mlanX qoscfg : Get WMM IE QOS info + +qstatus + This command retrieves the current status of the WMM queues. If WMM + is enabled then it displays the information for each AC in a table. + + Usage: + mlanutl mlanX qstatus + +radioctrl + This command is used to turn on/off the radio. + Note: The radio can be disabled only in disconnected state. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 radioctrl 1 : Turn the radio on + mlanutl mlan0 radioctrl : Get radio status + +rdeeprom + This command is used to read the EEPROM contents of the card. + + Usage: + mlanutl mlanX rdeeprom <offset> <length> + + where the parameters are, + <offset>: multiples of 4 + <length>: 4-20, multiples of 4 + + Example: + mlanutl mlan0 rdeeprom 0 20 : Read 20 bytes of EEPROM data from offset 0 + +reassoctrl + This command is used to turn on/off re-association in driver. + + Usage: + mlanutl mlanX reassoctrl [n] + + Where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 reassoctrl : Get re-association status + mlanutl mlan0 reassoctrl 1 : Turn re-association on + +regioncode + This command is used to set/get the region code in the station. + Note: This command should be issued at beginning before band/channel selection + and association. + + where value is 'region code' for various regions like + USA FCC, Canada IC, Europe ETSI, Japan ... + The special code (0xff) is used for Japan to support channel 1-14 in B/G/N mode. + + Examples: + mlanutl mlan0 regioncode : Get region code + mlanutl mlan0 regioncode 0x10 : Set region code to USA (0x10) + Note : in some case regioncode will be 0 after updated countycode or 80211d + i.e. mlanutl mlanX countrycode (CA, JP, CN, DE, ES AT, BR, RU) + or uaputl.exe sys_cfg_80211d state 1 country (CA, JP, CN, DE, ES AT, BR, RU) + Please use cfp instead of it. + +regrdwr + This command is used to read/write the adapter register. + + Usage: + mlanutl mlanX regrdwr <type> <offset> [value] + + where the parameters are, + <type>: 1:MAC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA, 8:CIU, 0x81:MAC2, 0x82:BBP2, 0x83: RF2, 0x87: BCA2 + <type>: 1:MAC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA, 8:CIU + <type>: 1:MAC/SOC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA + <offset>: offset of register + [value]: value to be written + Note: + BBP reg (type 2) 0xXZZZ: + X: 0=BBUD, 8=BBUA. + ZZZ: offset (0-0xFFF). + RF reg (type 3) 0xXYZZ: + + For 8887/8897/8777 + 1. If Y == 0, access RFU BASE Register. + X = Path ID (0=Path_A, 1=Path_B), ZZ = offset (0-0xFF). + 2. If Y != 0, access RFU XCVR Register on Path Y (1=Path_A, 2=Path_B). + X = Page # (0=Page_1, 1=Page_2, 2=Page_3 if chip support), ZZ: offset (0-0xFF). + For 8977/8997/8987 + X = Path ID (0-1) + Y = Page Number (0-6) in selected Path + ZZ = Register offset in selected path/page + + Examples: + mlanutl mlan0 regrdwr 1 0x60 : Read the MAC register + mlanutl mlan0 regrdwr 1 0x794 0x80000000 : Write 0x80000000 to MAC register + mlanutl mlan0 regrdwr 0x81 0x60 :Read MAC2 register + +rejectaddbareq + This command is used to set/get the conditions of rejecting addba request. + + Usage: + mlanutl mlanX rejectaddbareq [conditions] + mlanutl uapX rejectaddbareq [conditions] + + Where conditions are: + bit 0 = 1 -- reject the addba request when host sleep activated + bit 1 = 1 -- reject the addba request when FW auto re-connect enabled + this bit is only used with STA BSS + others -- reserved + + Examples: + mlanutl mlan0 rejectaddbareq : Get the reject addba request conditions + mlanutl mlan0 rejectaddbareq 0x1 : Reject the addba request + when host sleep activated + mlanutl mlan0 rejectaddbareq 0x2 : Reject the addba request + when FW auto re-connect enabled + mlanutl mlan0 rejectaddbareq 0x3 : Reject the addba request when + host sleep activated or + FW auto re-connect enabled + mlanutl uap0 rejectaddbareq 0x1 : Reject the addba request + when host sleep activated + +scancfg + This command is used to set/get scan configuration parameters. + + Usage: + mlanutl mlanX scancfg [t] [m] [p] [s] [a] [b] [c] [ext] [gap] + + where the parameters: + [t]: Scan Type (0: Unchanged, 1: Active, 2: Passive, default Active) + [m]: Scan Mode (0: Unchanged, 1: BSS, 2: IBSS, 3: Any, default Any) + [p]: Scan Probes (0: Unchanged, 1-5: Number of probes per channel, default 4) + [s]: Specific Scan Time (0: Unchanged, n: Value in ms, default 110 ms, max 500 ms) + [a]: Active Scan Time (0: Unchanged, n: Value in ms, default 200 ms, max 500 ms) + [b]: Passive Scan Time (0: Unchanged, n: Value in ms, default 200 ms, max 2000 ms) + [c]: Passive to Active Scan (0: Unchanged, 1: Enable, 2: Disable, default Enable) + [ext]: Extended scan (0: Unchanged, 1: Legacy scan, 2: Extended scan, 3: Extended scan enhance) + [gap]: Time gap between two scans in milliseconds (max value 500ms) + No change if the parameter is 0 or the parameter is not provided. + + Examples: + mlanutl mlan0 scancfg : Get all the current scan configuration settings + mlanutl mlan0 scancfg 1 3 : Set scan type to active and scan mode to any, + all the other scan configurations are unchanged + mlanutl mlan0 scancfg 0 1 2 200 : Set scan mode to BSS, number of probes to 2 and + specific scan time to 200 ms, all the other scan + configurations are unchanged + mlanutl mlan0 scancfg 0 0 0 0 0 0 1 : Set Passive to Active Scan to enable, all the + other scan configurations are unchanged + mlanutl mlan0 scancfg 2 0 0 0 0 0 2 : Set scan type to passive, Passive to Active + Scan to disable, all the other scan configurations + are unchanged + +sdcmd52rw + This command is used to read/write a controller register in + Secure Digital I/O Interfaces. + + Usage: + mlanutl mlanX sdcmd52rw <function number> <register address> [value] + + For SDIO MMC driver, only function 0 and 1 access is allowed. And there + is a limitation for function 0 write, only vendor specific CCCR registers + (0xf0 -0xff) are permiited. + + Examples: + mlanutl mlan0 sdcmd52rw 1 3 : Read SDIO function 1 register 3 + mlanutl mlan0 sdcmd52rw 1 1 0x3f : Write 0x3f to SDIO function 1 register 1 + +sdcmd53rw + This command is used to issue a CMD53 read/write data in + Secure Digital I/O Interfaces. + + Usage: + mlanutl mlanX sdcmd53rw <func> <address> <mode> <blksize> <blknum> [data1] ... [dataN] + + where the parameters are, + <func>: function number (0/1/2/..) + <address>: data address + <mode>: byte mode/block mode (0/1) + <blksize>: block size (32/64/../512, NA for byte mode) + <blknum>: block number or byte number + <data1> ... <dataN>: data for write + + Note: The total data length is block size * block number for block mode + or byte number for byte mode. The max data length is 2000-byte. + For write the data pattern will be duplicated to data buffer. + + Examples: + mlanutl mlan0 sdcmd53rw 0 0x8000 1 0x40 2 + mlanutl mlan0 sdcmd53rw 1 0x10000 0 1 5 0x0a 0x0b 0x0c 0x0d 0x0e + +sdioclock + Turn On(1) or Off(0) the SDIO clock. + + Usage: + mlanutl mlanX sdioclock 1 (on) + mlanutl mlanX sdioclock 0 (off) + mlanutl mlanX sdioclock (get the current clock state) + + +setuserscan + Initiate a customized scan and retrieve the results + + Usage: + mlanutl mlanX setuserscan [ARGS] + + Where [ARGS]: + ssid="[SSID]" specify a SSID filter for the scan + group=<group mask> specify the channel group(s) to scan + chan=[chan#][band][mode] where band is [a,b,g,e] and mode is + blank for unchange, or 'c' for active or 'p' for passive + bssid=xx:xx:xx:xx:xx:xx specify a BSSID filter for the scan + wc="[WILDCARD SSID]" specify a UNIX pattern matching filter (using * + and ?) for SSIDs found in a broadcast probe + keep=[0 or 1] keep the previous scan results (1), discard (0) + dur=[scan time] time to scan for each channel in milliseconds + gap=[gap time] Time gap between two scans in milliseconds + probes=[#] number of probe requests to send on each chan + for each broadcast probe required and each SSID + specific probe required (1-5) + bss_type=[1,2,3] BSS type: 1 (Infra), 2(Adhoc), 3(Any) + sort_by_ch Sort by channel number in ascending order. + Default mode: Sort by Signal Strength in descending order. + scan_type=[0,1] ext scan type (0-1) 0: legacy, 1: enhance scan + + Any combination of the above arguments can be supplied on the command line. + If the chan token is absent, a full channel scan will be completed by driver. + If the dur or probes tokens are absent, the driver default setting will be + used. The bssid and ssid fields, if blank, will produce an unfiltered scan. + It's allowed to input multiple ssid/wc entries, the max entry number is 10. + The type field will default to 3 (Any) and the keep field will default to 0 + (Discard). + + Examples: + 1) Perform an active scan on channels 1, 6, and 11 in the 'g' band: + setuserscan chan=1g,6g,11g + + 2) Perform a passive scan on channel 11 for 20 ms: + setuserscan chan=11gp dur=20 + + 3) Perform an active scan on channels 1, 6, and 11; and a passive scan on + channel 36 in the 'a' band: + setuserscan chan=1g,6g,11g,36ap + + 4) Perform an active scan on channel 6 and 36 for specific SSID: + setuserscan chan=6g,36a ssid=TestAP1 ssid=TestAP2 + + 5) Scan all available channels (B/G/N, A bands) for a specific BSSID, keep + the current scan table intact, update existing or append new scan data: + setuserscan bssid=00:50:43:20:12:82 keep=1 + + 6) Scan channel 6, for all infrastructure networks, sending two probe + requests. Keep the previous scan table intact. Update any duplicate + BSSID/SSID matches with the new scan data: + setuserscan chan=6g bss_type=1 probes=2 keep=1 + + 7) Scan channel 1 and 6, for all networks matching the NXP*AP + or AP*NXP? patterns and for NXPTst SSID. Generate 3 broadcast + probes for the patterns and 3 SSID specific probes for NXPTst on + both channel 1 and channel 6. + setuserscan chan=1g,6g probes=3 wc="NXP*AP" wc="AP*NXP?" ssid="NXPTst" + + 8) Scan all the channels for specified band. + setuserscan chan=0g + 9) Perform active scan for a list of specific BSSIDs + setuserscan bssid=00:50:43:20:12:82 bssid=48:e2:44:3f:ec:76 + + 9) Scan channel 1 and 6, send 3 probe requests, scan each channel for 40 ms + with time gap of 50ms between 2 scans + setuserscan chan=1g,6g probes=3 dur=40 gap=50 + + 10) Perform an enhance scan + setuserscan scan_type=1 + + All entries in the scan table (not just the new scan data when keep=1) + will be displayed upon completion by use of the getscantable ioctl. +cancelscan + This command is used to cancel scan + Usage: + mlanutl mlanX cancelscan +sleepparams + This command is used to set the sleepclock configurations + + Usage: + mlanutl mlanX sleepparams [<p1> <p2> <p3> <p4> <p5> <p6>] + + where: + p1 is Sleep clock error in ppm (0-65535) + p2 is Wakeup offset in usec (0-65535) + p3 is Clock stabilization time in usec (0-65535) + p4 is Control periodic calibration (0-2) + p5 is Control the use of external sleep clock (0-2) + p6 is reserved for debug (0-65535) + + Examples: + mlanutl mlan0 sleepparams : Get current sleepclock configuration + mlanutl mlan0 sleepparams 10 1000 2000 1 0 128 : Set sleepclock configuration + +sleeppd + This command is used to configure the sleep period of the WLAN device. + + Usage: + mlanutl mlanX sleeppd [<period>] + + Where the parameter is: + period: sleep period in milliseconds. Range 10~60. 0 for disable. + + Examples: + mlanutl mlan0 sleeppd : Get sleep period configuration + mlanutl mlan0 sleeppd 10 : Set sleep period to 10 ms + +sysclock + This command is used to set/get system clocks in MHz. + The current system clock, configurable system clocks and all of the + supported system clocks will be returned if no parameter provided. + + Examples: + mlanutl mlan0 sysclock : Get system clocks + 80 80 128 128 128 5 11 16 20 22 32 40 44 64 80 106 128 160 ... + (The current system clock is 80 MHz. + The configurable system clocks of non-security, security, non-security + A-MPDU and security A-MPDU are 80 MHz, 128 MHz, 128 MHz and 128 MHz. + The supported system clocks are 5 MHz, 11 MHz, ..., 160 MHz, 182 MHz, + 213 MHz, 256 MHz, 320 Mhz, 366 MHz , ... . the Max system clocks is different + for different chips, you could use this command to get the supported system clock) + + mlanutl mlanX sysclock 80 : Set system clock in non-security mode + to 80 MHz, no change for others + mlanutl mlanX sysclock 0 0 128 : Set system clock in non-security A-MPDU + mode to 128 MHz, no changes for others + +tcpackenh + This command is used to set/get TCP ACK enhancement mode. + + Usage: + mlanutl mlanX tcpackenh [l] [m] + + where + [l] is a control to set TCP ACK enhancement mode + 1 -- Enable TCP ACK enhancement (default) + 0 -- Disable TCP ACK enhancement + [m] is to configure TCP ACK max hold number + default value is 9, which means driver could hold up to 9 TCP ACK and + only send the last one to peer. + + Examples: + mlanutl mlan0 tcpackenh : Display TCP ACK enhancement + mlanutl mlan0 tcpackenh 1 : Enable TCP ACK enhancement + mlanutl mlan0 tcpackenh 0 : Disable TCP ACK enhancement + mlanutl mlan0 tcpackenh 1 1 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 50% + mlanutl mlan0 tcpackenh 1 2 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 67% + mlanutl mlan0 tcpackenh 1 3 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 75% + mlanutl mlan0 tcpackenh 1 4 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 80% + mlanutl mlan0 tcpackenh 1 5 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 83% + mlanutl mlan0 tcpackenh 1 6 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 85% + mlanutl mlan0 tcpackenh 1 7 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 87.5% + mlanutl mlan0 tcpackenh 1 8 : Enable TCP ACK enhancement and + configure TCP ACK drop percentage to 88.8% + +host_tdls_config + This command is used to support channel switch and uapsd for host based tdls + + Usage: + mlanutl mlanX host_tdls_config <host_tdls.conf> + + + Where the parameter is: + host_tdls.conf: The configuration file specifying to enable/disable uapsd/cs and related parameters. + + Examples: + mlanutl mlan0 host_tdls_config config/host_tdls.conf + : enable or disable uapsd/cs, config the channel related ie, based on the configuration file. +tdls_channel_switch + This command is used to send TDLS channel switch request. + + Usage: + mlanutl mlanX tdls_channel_switch <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file for sending TDLS channel switch command. + + Examples: + mlanutl mlan0 tdls_channel_switch config/tdls.conf + : Send TDLS channel switch command, based on the configuration file. + +tdls_config + This command is used to enable/disable TDLS on device. + + Usage: + mlanutl mlanX tdls_config <0/1> + + Where the parameter is: + 0: Enable TDLS. + 1: Disable TDLS. + + Examples: + mlanutl mlan0 tdls_config 0 : Disable TDLS + mlanutl mlan0 tdls_config 1 : Enable TDLS + +tdls_cs_params + This command is used to set TDLS channel switch params + + Usage: + mlanutl mlanX tdls_cs_params <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file specifying the TDLS channel switch params. + + Examples: + mlanutl mlan0 tdls_cs_params config/tdls.conf + : Set TDLS channel switch params, based on the configuration file. + +tdls_debug + This command is used for FW debug functionality and tests. + +tdls_disable_cs + This command is used to disable TDLS channel switch + + Usage: + mlanutl mlanX tdls_disable_cs <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file to disable TDLS channel switch. + + Examples: + mlanutl mlan0 tdls_disable_cs config/tdls.conf + : Disable TDLS channel switch, based on the configuration file. + +tdls_discovery + This command is used to request TDLS discovery. + + Usage: + mlanutl mlanX tdls_discovery <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file to request TDLS discovery. + + Examples: + mlanutl mlan0 tdls_discovery config/tdls.conf + : Request TDLS discovery based on the configuration file. + +tdls_link_status [peer_mac_address] + This command is used to get link information about TDLS links or + a TDLS link correponding to peer mac address. + + Usage: + mlanutl mlanX tdls_link_status <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file to send TDLS command to get current link status. + + Examples: + mlanutl mlan0 tdls_link_status config/tdls.conf + : Send TDLS command to get current link status based on the configuration file. + +tdls_powermode + This command is used to send TDLS powermode request. + + Usage: + mlanutl mlanX tdls_powermode <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file for sending TDLS powermode command. + + Examples: + mlanutl mlan0 tdls_powermode config/tdls.conf + : Send TDLS powermode (either 0:Active, 1:PowerSave) command, based on the configuration file. + +tdls_setinfo + This command is used for setting the capabilities of the TDLS station. + + Usage: + mlanutl mlanX tdls_setinfo <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file specifying the capabilities of the TDLS station. + + Examples: + mlanutl mlan0 tdls_setinfo config/tdls.conf + : Set capabilities of the TDLS station, based on the configuration file. + +tdls_setup + This command is used to send TDLS setup request. + + Usage: + mlanutl mlanX tdls_setup <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file for sending TDLS setup request. + + Examples: + mlanutl mlan0 tdls_setup config/tdls.conf + : Send TDLS setup request, based on the configuration file. + +tdls_stop_channel_switch + This command is used to send stop TDLS channel switch request. + + Usage: + mlanutl mlanX tdls_stop_channel_switch <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file for sending stop TDLS channel switch command. + + Examples: + mlanutl mlan0 tdls_stop_channel_switch config/tdls.conf + : Send stop TDLS channel switch command, based on the configuration file. + +tdls_teardown + This command is used to send TDLS teardown request. + + Usage: + mlanutl mlanX tdls_teardown <tdls.conf> + + Where the parameter is: + tdls.conf: The configuration file for requesting teardown of TDLS link. + + Examples: + mlanutl mlan0 tdls_teardown config/tdls.conf + : Request teardown of TDLS link, based on the configuration file. + +hal_phy_cfg + This command is used to set the hal/phy related config parameters + + Usage: + mlanutl mlanX/uapX hal_phy_cfg <hal_phy_cfg.conf> + + Where the parameter is: + hal_phy_cfg.conf: The configuration file specifying to the values of hal/phy related config parameters + + Examples: + mlanutl mlan0 hal_phy_cfg config/hal_phy_cfg.conf + : to enable or disable 11b_psd_mask the file would contain following paramters + hal_phy_cfg{ + 11b_psd_mask_cfg=1 # 1: 11b_psd_mask_enable, 0: 11b_psd_mask_disable + } + +thermal + This command is used to get the current thermal reading. + + Examples: + mlanutl mlan0 thermal : Get thermal reading + +ts_status + This command queries the FW for the status of TSIDs 0 through 7 + configured via call admission control and displays the results in a + table. + + Usage: + mlanutl mlanX ts_status + +tsf + Set/Get the TSF timer value for the station. Station maintains a TSF timer with + modulus 2^64 counting in increments of microseconds. + + Usage: + mlanutl mlanX/uapX tsf [t] + + where, + [t] : 64bit timestamp value in microseconds + + Examples: + mlanutl mlan0 tsf : Get timestamp + mlanutl uap0 tsf 669468581993 : Set timestamp + +txaggrctrl + This command is used to enable/disable TX AMPDU on infra link when TDLS link is established + + Usage: + mlanutl mlanX txaggrctrl [m] + + Where: + [m]: 1 to enable TX AMPDU on infra link; 0 to disable TX AMPDU on infra link + + Examples: + mlanutl mlan0 txaggrctrl : Get current TX AMPDU status on infra link + mlanutl mlan0 txaggrctrl 0 : Disable TX AMPDU on infra link + mlanutl mlan0 txaggrctrl 1 : Enable TX AMPDU on infra link + + Note: + The set command only works when TDLS link is established. + +txbufcfg + This command can be used to get current buffer size. + + eg: + mlanutl mlanX txbufcfg - This will display the current buffer size. + + Note:- The actual tx buf size will depends on AP's capability and max transmit buffer size. + +aggrctrl + This command is used to set/get aggregation parameters. + + Usage: + mlanutl mlanX aggrctrl [l] + + where the parameter: + [l]: Enable (1) or disable (0) Tx aggregation + + Examples: + mlanutl mlan0 aggrctrl : Display aggregation configurations + mlanutl mlan0 aggrctrl 0 : Disable Tx aggregation + mlanutl mlan0 aggrctrl 1 : Enable Tx aggregation + +usbaggrctrl + This command is used to set/get USB aggregation parameters. + + Usage: + mlanutl mlanX usbaggrctrl [l] [m] [n] [o] [p] [q] [r] [s] + + where the parameter: + [l]: Enable (1) or disable (0) Tx aggregation + [m]: Enable (1) or disable (0) Rx aggregation + [n]: Tx aggregation max size/number + For number based aggregation, the values supported are + - 2, 4, 8, 16 + For size based aggregation, the number supported are + - 4096, 8192, 16384, 32768 + [o]: Rx aggregation max size/number + For number based deaggregation, the values supported are + - 2, 4, 8, 16 + For size based deaggregation, the number supported are + - 4096, 8192, 16384, 32768 + [p]: Tx aggregation alignment + The value must be 2048, 4096, 8192 etc. + [q]: Rx aggregation alignment + The value must be 512, 1024, 2048, 4096, 8192 etc. + [r]: Tx aggregation timeout + Timeout value in us, 0 for disabled, 0xFFFF for dynamic timeout + and 1-10000 are valid timeout value + [s]: Rx aggregation timeout + Timeout value in us, 0 for disabled + + Examples: + mlanutl mlan0 usbaggrctrl : Display USB aggregation configurations + mlanutl mlan0 usbaggrctrl 0 0 : Disable both Tx and Rx aggregation + mlanutl mlan0 usbaggrctrl 1 1 4 8 2048 512 1000 200 : Enable both Tx and Rx aggregation + +usbresume + This command is used to resume the device from suspend mode. + Note: It's only valid on kernel 2.6.24 or later. + +usbsuspend + This command is used to put device to suspend mode. + Note: It's only valid on kernel 2.6.24 or later. + +opermodecfg + This command is used to set and get 11ac Operating Mode Notification configuration. + + where <m> is <bw> + <bw> - This is the channel width setting for the opermodecfg + 1: 20MHz + 2: 40MHz + 3: 80MHz + 4: 160MHz or 80+80MHz + + where <n> is <nss> + <nss> - This parameter specifies the nss that the STA can receive. + 1: NSS1 + 2: NSS2 + 3: NSS3 + 4: NSS4 + 5: NSS5 + 6: NSS6 + 7: NSS7 + 8: NSS8 + +wakeupreason + This command is used to get the host sleep wakeup reason. + + Usage: + mlanutl mlanX wakeupreason + mlanutl uapX wakeupreason + Examples: + mlanutl mlan0 wakeupreason : Get the host sleep wakeup reason + mlanutl uap0 wakeupreason : Get the host sleep wakeup reason + 0: unknown + 1: Broadcast data matched + 2: Multicast data matched + 3: Unicast data matched + 4: Maskable event matched + 5. Non-maskable event matched + 6: Non-maskable condition matched (EAPoL rekey) + 7: Magic pattern matched + 8: Control frame matched + 9: Management frame matched + Others: reserved. (0) + +warmreset + This command is used for warm reset of the interface. + + Usage: + mlanutl mlanX warmreset + +wpssession + This command is used to control wps session. No argument is used to get. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 wpssession 1 : Enable wpssession + mlanutl mlan0 wpssession : Get wpssession status + +wmmcfg + This command is used to control WMM. No argument is used to get. + + where value of n is: + 0 -- Disable + 1 -- Enable + + Examples: + mlanutl mlan0 wmmcfg 1 : Enable WMM + mlanutl mlan0 wmmcfg : Get WMM status + +wmmparamcfg + This command is used to configure WMM paramameters. + + Usage: + mlanutl mlanX wmmparamcfg [AC_BE AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_BK AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_VI AIFSN ECW_MAX ECW_MIN TX_OP] + [AC_VO AIFSN ECW_MAX ECW_MIN TX_OP] + + The supported option are: + AC_BE: 0 + AC_BK: 1 + AC_VI: 2 + AC_V0: 3 + AIFSN: AIFSN value + ECW_MAX: ECW max + ECW_MIN: ECW min + TX_OP: TXOP Limit + empty - Get current WMM parameters + + Example: + mlanutl mlanX wmmparamcfg 0 3 10 4 0 + Set AC_BE with AIFSN 3, ECW_MAX 10, ECW_MIN 4 and TXOP 0 + + mlanutl mlanX wmmparamcfg 1 7 10 4 0 + Set AC_BK with AIFSN 7, ECW_MAX 10, ECW_MIN 4 and TXOP 0 + + mlanutl mlanX wmmparamcfg 2 2 4 3 94 + Set AC_VI with AIFSN 2, ECW_MAX 4, ECW_MIN 3 and TXOP 94 + + mlanutl mlanX wmmparamcfg 3 2 3 2 47 + Set AC_VO with AIFSN 2, ECW_MAX 3, ECW_MIN 2 and TXOP 47 + + mlanutl mlanX wmmparamcfg + Get current WMM parameters + + mlanutl mlanX wmmparamcfg 0 3 10 4 0 1 7 10 4 0 2 2 4 3 94 3 2 3 2 47 + Set AC_BE with AIFSN 3, ECW_MAX 10, ECW_MIN 4 and TXOP 0 + Set AC_BK with AIFSN 7, ECW_MAX 10, ECW_MIN 4 and TXOP 0 + Set AC_VI with AIFSN 2, ECW_MAX 4, ECW_MIN 3 and TXOP 94 + Set AC_VO with AIFSN 2, ECW_MAX 3, ECW_MIN 2 and TXOP 47 + +wwscfg + This command is used to set/get the WWS (World Wide Safe) mode. + + where value of m is: + 0 -- Disable WWS mode (default) + 1 -- Enable WWS mode + + Examples: + mlanutl mlan0 wwscfg : Get WWS mode + mlanutl mlan0 wwscfg 1 : Enable WWS mode + mlanutl mlan0 wwscfg 0 : Disable WWS mode + +mc_cfg + This command is used to set/get the channel time. + + Usage: + mlanutl mlanX mc_cfg [n] + + where <n> : Channel time in microseconds. + + Examples: + mlanutl mlanX mc_cfg : Get Channel time and buffer weight. + mlanutl mlanX mc_cfg 10000 : Set Channel time to 10000us. + +mc_policy + This command is used to set/get the multi-channel policy. + Note: This is a device specific command. Hence, setting on one interface is + reflected on all other interfaces. + + Usage: + mlanutl mlanX mc_policy [n] + + where <n> : Multi-channel policy + + Examples: + mlanutl mlanX mc_policy : Get multi-channel policy setting. + mlanutl mlanX mc_policy 1 : Set multi-channel policy to 1. + mlanutl mlanX mc_policy 0 : Disable multi-channel policy + +mc_cfg_ext + This command is used to set/get the drcs parameters. + + Usage: + mlanutl mlanX mc_cfg_ext [c] [s] [u] [m] <a> <b> <d> <e> + + where: + channel index0: + [c] : chantime(in TU) + [s] : switchtime(in TU) + [u] : undozetime(in TU) + [m] : mode :0x0 --- PM1(default) + 0x1 --- Null2Self + channel index1: + <a> : chantime(in TU) + <b> : switchtime(in TU) + <d> : undozetime(in TU) + <e> : mode :0x0 --- PM1(default) + 0x1 --- Null2Self + Note: + channel index0: the first channel + channel index1: the second channel + undozetime should be less than other channel's switchtime + If want to set two channels the same parameters, just ignore the last four parameters and + use [c] [s] [u] [m] to set. + Examples: + mlanutl mlanX mc_cfg_ext : Get the drcs parameters for two channels. + mlanutl mlanX mc_cfg_ext 15 10 5 0 : Set two channels:channeltime 15TU, switchtime 10TU, undozetime 5TU, mode PM1 + mlanutl mlanX mc_cfg_ext 15 10 5 0 25 15 9 0 : Set channel index0: channeltime 17TU, switchtime 10TU, undozetime 5TU, mode PM1; + set channel index1: channeltime 25TU, switchtime 15TU, undozetime 9TU, mode PM1. + +cfg_noa + This is used to get/set P2P NoA (Notice of Absence) parameters only for P2P GO. + + Usage: + mlanutl p2pX cfg_noa [h] [i] [j] [k] [l] + + where: + [h] : noa_enable : 1/0 Set to 1 to enable NoA, 0 to disable NoA. + [i] : index : 0 - 255 Identifies an instance of NoA timing. + [j] : count : 1 - 255 Indicates the number of absence intervals. + 255 means a continuous schedule. + [k] : duration : Indicates the maximum duration in units of microseconds + that P2P GO can remain absent following the start of + a NoA interval. + [l] : interval : Indicates the length of the NoA interval in units of + microseconds. + + Examples: + mlanutl p2pX cfg_noa : Get noa configuration. + mlanutl p2pX cfg_noa 1 1 255 50 100 : Set noa configuration. + +cfg_opp_ps + This is used to get/set P2P OPP-PS parameters only for P2P GO. + + Usage: + mlanutl p2pX cfg_opp_ps [m] [n] + + where: + [m] : ps_enable : 1/0 Set to 1 to indicate P2P GO is using opportunistic + power save. Set to 0 if opportunistic power save is disabled. + [n] : ct_window : A period of time in TU after a TBTT during which P2P GO + is present. 0 indicates that there shall be no + CTWindow (Client Traffic Window). + + Examples: + mlanutl p2pX cfg_opp_ps : Get noa configuration. + mlanutl p2pX cfg_opp_ps 1 7 : Set noa configuration. + +get_sensor_temp + This command is used to get SOC temperature + Usage: + mlanutl mlanX get_sensor_temp + +indrstcfg + This command is used to set/ get independent reset mode configuration + + Usage : + mlanutl <interface> indrstcfg <ir_mode> [gpio_pin] + + interface : mlanX, uapX + ir_mode : 0 -- Disable + 1 -- Enable out band reset, disable in band + 2 -- Enable in band, disable out band + gpio_pin : 255 -- Default pin for reset + any other number for changing the gpio for reset. + + Example : + mlanutl mlan0 indrstcfg 1 255 : Set default pin on interface mlan0 as reset pin + mlanutl mlan0 indrstcfg 0 : Disable the gpio 17 as reset pin on interface mlan0 + mlanutl mlan0 indrstcfg : Get the status and the pin used for reset pin + mlanutl mlan0 indrstcfg 2 : Enable in band reset mode + +ctrldeauth + This command is used to set/get firmware ctrldeauth setting + Usage : + mlanutl uapX ctrldeauth <n> + + Where value of n is : + 0 -- Firmware will use default behavior + 1 -- Firmware will not send deauth packet when uap move to another channel. + + Example : + mlanutl uap0 ctrldeauth : Get current setting + mlanutl uap0 ctrldeauth : Firmware will not send deauth packet when uap move to different channel. + +robustcoex + This command is used to set robust coex. + + Usage : + mlanutl <interface> robustcoex <gpiocfg> [Enable/Disable] [gpionum] [gpiopolarity] + Enable/Disable : 0 -- Disable ; 1 -- Enable + gpionum : Number of gpio + gpiopolarity : polarity of gpio + + Example : + mlanutl mlan0 robustcoex gpiocfg 1 4 1 : Enable robustcoex gpio, set gpionum to 4 and gpiopolarity to 1 + mlanutl mlan0 robustcoex gpiocfg 0 : Disable robustcoex gpio + +cwmode + This command is used to set Cont. Tx/Wave mode. + + Usage: + mlanutl <interface> cwmode config/cwmode.conf + interface: mlanX + cwmode.conf: This config file specifies whether to enable/disable Cont Tx/Wave mode. + User can specify parameters like Channel, datarate, BW, Channel Offset, Band. + Detailed information about parameters is mentioned in the conf file. + Example: + mlanutl mlan0 cwmode config/cwmode.conf : Enable/Disable Cont Tx/Wave mode. + mlanutl mlan0 cwmode : Get current Tx mode + +bootsleep + This command is used to set and get boot sleep configure. + + Usage : + mlanutl mlanX/uapX bootsleep <enable> + <enable> : enable boot sleep + : 0 - disable boot sleep + : 1 - enable boot sleep + + Example : + mlanutl mlan0/uap0 bootsleep 1 : Enable boot sleep + mlanutl mlan0/uap0 bootsleep : Get boot sleep configure + +ssu + Collect spectral analysis data and save them into /data/ssudump.txt + + Usage : + mlanutl mlanX ssu [mode] [ssu file] + + mode : 2 -- Enable ssu and use FW default ssu parameter + ssu file : file to config ssu parameter + + Example : + mlanutl mlan0 ssu :Enable SSU and use driver default ssu parameter + mlanutl mlan0 ssu config/ssu.conf :Enable SSU and use ssu parameter from ssu.conf + mlanutl mlan0 ssu 2 :Enable SSU and use FW default ssu parameter + +csi + Enable/disable channel state information collection + + Usage : + mlanutl mlanX csi <disable/enable (config file)> + disable : 0 + enable : config file with csi filters + + Example : + mlanutl mlan0 csi config/csi.conf : Enable CSI + mlanutl mlan0 csi 0 : Disable CSI + +arb + Set HW ARB mode + The command needs to be issued before association. + + Usage: + mlanutl mlanX arb [mode] + + where the parameter is: + [mode]: + 0: arb mode 0 (default) + 1: arb mode 1 + 2: arb mode 2 + 3: arb mode 3 (Improve TX throughput) + 4: arb mode 4 (Improve RX throughput) + + Example : + mlanutl mlan0 arb 1 : Set HW ARB mode 1 + +dmcs + This command is used to config DMCS or get DMCS status. + + Usage: + mlanutl mlanX dmcs <subcmd> [value] + + <subcmd = 0> : config mapping policy + disable dynamic mapping when [value = 0] + enable dynamic mapping when [value = 1] + <subcmd = 1> : get DMCS status + + Example : + mlanutl mlan0 dmcs 0 1 : Enable dynamic mapping + mlanutl mlan0 dmcs 0 0 : Disable dynamic mapping + mlanutl mlan0 dmcs 1 : Get DMCS status + +range_ext + This command is used to config range extension mode. + + Usage: + mlanutl mlanX/uapX range_ext [mode] + + where the parameter is: + [mode]: + 0: Default Mode(Auto Rate) + 1: HE ER+DCM Mode + 2: Legacy Mode(1 Mbps Rate) + + Example: + mlanutl mlan0 range_ext : get range extension mode + mlanutl mlan0 range_ext 1 : set range extension mode to HE ER+DCM mode + +twt_setup + This command is used to config TWT setup parameters using conf file. + + Usage: + mlanutl mlanX twt_setup [conf file] + + Example: + mlanutl mlan0 twt_setup config/twt.conf + +twt_teardown + This command is used to config TWT teardown parameters using conf file. + + Usage: + mlanutl mlanX twt_teardown [conf file] + + Example: + mlanutl mlan0 twt_teardown config/twt.conf + +rx_abort_cfg + This command is used to set/get static rx abort config for pkt having + weaker RSSI than threshold. This threshold will be overwritten on starting + dynamic rx abort cfg ext. + + Usage: + mlanutl <interface> rx_abort_cfg [enable] [rssi_threshold] + + Where the parameters are: + <interface> : mlanX, + uapX + [enable] : 0 - Disable Rx abort + 1 - Enable Rx abort of pkt having weak RSSI + [rssi_threshold] : weak RSSI pkt threshold in dBm (absolute value) + (default = 70) + + Examples: + mlanutl mlan0 rx_abort_cfg + - Display current rx abort configuration + mlanutl uap0 rx_abort_cfg 1 60 + - Enable rx abort and set weak RSSI Threshold to -60 dBm + mlanutl mlan0 rx_abort_cfg 1 40 + - Enable rx abort and set weak RSSI Threshold to -40 dBm + mlanutl mlan0 rx_abort_cfg 0 + - Disable rx abort + +rx_abort_cfg_ext + This command is used to set/get dynamic rx abort config. This will set + threshold based on minimum of ceiling rssi threshold and the weakest + RSSI among all connected peers. Margin can be specified as an offset to + this threshold. Default margin is set to -10 dBm. Ceiling rssi threshold + can be changed by specifying. Default ceil is set to -70 dBm. + This will be disabled on enabling fixed rx abort (rx_abort_cfg) + + Note: This dynamic rx abort mode is enabled by default. + + Usage: + mlanutl <interface> rx_abort_cfg_ext [enable] [margin ceil_thresh] + + Where the parameters are: + <interface> : mlanX, + uapX + [enable] : 0 - Disable Rx abort + 1 - Enable Rx abort of pkt having weak RSSI + [margin] : rssi margin in dBm (absolute val) + (default = 10) + [ceil_thresh] : ceiling weak RSSI pkt threshold in dBm + (absolute value) (default = 70) + + Examples: + mlanutl mlan0 rx_abort_cfg_ext + - Display current rx abort configuration + mlanutl uap0 rx_abort_cfg_ext 1 10 60 + - Enable dynamic rx abort, set margin to -10 dBm and set ceil + RSSI Threshold to -60 dBm + mlanutl mlan0 rx_abort_cfg_ext 1 5 50 + - Enable dynamic rx abort, set margin to -5 dBm and set ceil + RSSI Threshold to -50 dBm + mlanutl mlan0 rx_abort_cfg_ext 0 + - Disable dynamic rx abort + +tx_ampdu_prot_mode + This command is used to set either RTS/CTS or CTS2SELF protection mechanism + in MAC, for aggregated Tx QoS data frames. RTS/CTS is enabled by default. + + Usage: + mlanutl <interface> tx_ampdu_prot_mode [mode] + + Where the parameters are: + <interface> : mlanX, + uapX + [mode] : 0 - Set RTS/CTS mode + 1 - Set CTS2SELF mode + 2 - Disable Protection mode + 3 - Set Dynamic RTS/CTS mode + + Examples: + mlanutl mlan0 tx_ampdu_prot_mode + - Get currently set protection mode for Tx AMPDU + mlanutl mlan0 tx_ampdu_prot_mode 1 + - Set protection mode for Tx AMPDU to CTS2SELF + +rate_adapt_cfg + This command is used to switch between SR rateadapt and Legacy rateadapt. + FW default Algorithm is Legacy rateadapt + when SR rateadapt is enabled then it is used to set static threshold based + or dynamic noise based rate adaptation and set the timer interval to evaluate + sw rate adaptation.For static mode, low and high thresholds for Tx aggregated + pkt success rate should be configured. The Tx rate will decrease if success rate + goes lower than LOW_THRESH, will increase if it goes beyond HIGH_THRESH, and will + remain the same when success rate is between these thresholds.To set dynamic mode, + specify 0xff for both low and high thresh. + + Note: config can be set only before associating with an external AP + when in STA mode, or before starting bss when in uAP mode + + Usage: + mlanutl <interface> rate_adapt_cfg + [sr_rateadapt low_thresh high_thresh timer_interval] + + Where the parameters are: + <interface> : mlanX, + uapX + [sr_rateadapt] : SR Rateadapt or Legacy Rateadapt + [low_thresh] : lower tx success rate threshold + [high_thresh] : higher tx success rate threshold + [timer_interval] : interval to evaluate tx rate in sw in multiples + of 10 (ms) + + Examples: + mlanutl mlan0 rate_adapt_cfg + - Display SR rateadapt or Legacy rateadapt enabled + - Display current rate adapt configuration if SR rateadapt is enabled. + mlanutl uap0 rate_adapt_cfg 1 60 80 10 + - set lower Tx success rate threshold to 60%, higher to 80% + and evaluate tx rate every 100 ms (i.e 10 * 10 = 100 ms) + when SR Rateadapt is enabled. + mlanutl mlan0 rateadapt_cfg 0 + - switch to Legacy rateadapt. + mlanutl mlan0 rateadapt_cfg 1 + - switch to SR rateadapt. + Fw default is dynamic Success threshold enabled + with 100 ms linkadapt timer. + mlanutl mlan0 rate_adapt_cfg 1 50 70 50 + - set lower Tx success rate threshold to 50%, higher to 70% + and evaluate tx rate every 500 ms (i.e 50 * 10 = 500 ms) + when SR Rateadapt is enabled. + mlanutl mlan0 rate_adapt_cfg 1 0xff 0xff 10 + - set dynamic environment noise based mode and evaluate tx rate + every 100 ms (i.e 10 * 10 = 100 ms) + when SR Rateadapt is enabled. + +cck_desense_cfg + This command is used to configure CCK (802.11b) Desensitization RSSI + threshold. All CCK traffic beyond this threshold will be ignored, resulting + in higher Tx throughput. Threshold value is in absolute value of rssi in + dBm. In dynamic and enhanced modes, cck desense will be turned on only in + presence of an active connection and the effective CCK desense RSSI + threshold will be updated every rateadapt interval, based on: + min{ceil_thresh, [min RSSI among all connected peers] - margin} + + Further, for dynamic enhanced mode, CCK desense will be turned on/off based + on environment noise condition and ongoing Tx traffic rate. In this mode, + CCK desense will also be turned off periodically in order to allow 802.11b + Rx frames from Ext-AP, if rx rssi becomes weaker than the current threshold + or when in uAP mode, frames from clients which attempt to connect with the + uAP, but have weaker RSSI than the set threshold. + Turn on and off intervals are specified in terms of rateadapt intervals. + Please note that in this mode, if dynamic Rx Abort is enabled, then it + will turn on/off in sync with cck desense. + + Usage: + mlanutl <interface> cck_desense_cfg [mode] [margin ceil_thresh] + [num_on_intervals num_off_intervals] + + Where the parameters are: + <interface> : mlanX, + uapX + [mode] : 0 - Disable cck desense + 1 - Enable dynamic cck desense mode + 2 - Enable dynamic enhanced cck desense mode + [margin] : rssi margin in dBm (absolute val) + (default = 10) + [ceil_thresh] : ceiling weak RSSI pkt threshold in dBm + (absolute value) (default = 70) + [num_on_intervals] : number of rateadapt intervals to keep cck + desense "on" [for mode 2 only] (default = 20) + [num_off_intervals]: number of rateadapt intervals to keep cck + desense "off" [for mode 2 only] (default = 3) + + Examples: + mlanutl mlan0 cck_desense_cfg + - Display current cck desense configuration + mlanutl uap0 cck_desense_cfg 1 10 70 + - Set dynamic mode, margin to -10 dBm and ceil RSSI Threshold to + -70 dBm + mlanutl uap0 cck_desense_cfg 2 10 60 30 5 + - Set dynamic enhanced mode, margin to -10 dBm, ceil RSSI Threshold + to -60 dBm, num on intervals to 30 and num off intervals to 5. + mlanutl mlan0 cck_desense_cfg 1 10 50 + - Set dynamic mode, margin to -10 dBm and ceil RSSI Threshold to + -50 dBm + mlanutl mlan0 cck_desense_cfg 2 5 60 + - Set dynamic enhanced mode, set margin to -5 dBm, set ceil RSSI + Threshold to -60 dBm, and retain previous num on/off intervals + setting. + mlanutl mlan0 cck_desense_cfg 0 + - Disable cck desense + +lpm + This command is used to configure low power mode. + + Usage: + mlanutl mlanX/uapX lpm [mode] + + Where the paramter is: + [mode] : low power mode 0, 1, 2, 3 + + Examples: + mlanutl mlan0 lpm Get low power mode + mlanutl mlan0 lpm 1 Set low power mode to 1 + +dot11mc_unassoc_ftm_cfg + This command is used to enable or disable the configuration for + DOT11MC FTM frames exchanges in un-associated state for STA or uAP + + Usage: + mlanutl <interface> dot11mc_unassoc_ftm_cfg [enable] + + Where the parameters are: + <interface> : mlanX, + uapX + [enable] : 0 - Disable unassociated state FTM + 1 - Enable unassociated state FTM + + Examples: + mlanutl mlan0 dot11mc_unassoc_ftm_cfg + - Get current state of unassociated state FTM cfg + mlanutl mlan0 dot11mc_unassoc_ftm_cfg 1 + - Set the unassociated state FTM cfg to Enabled + +tp_state + This command is used to collect throughput result at different + drop points. + + Usage: + mlanutl mlanX tp_state [mode] [drop_point] + + Where the parameter is: + [mode] : enable/disable tp_state collecting + 0 - Disable 1 - Enable + [drop_point] : Request driver to drop tx packets at this point + 0 - Reserved for Tx + 1 - Kernel sends packets with .ndo_start_xmit + 2 - Before adding tx packets into queues + 3 - After main process handles tx packets + 4 - Before attaching pkts to bus + 5 - Rx PCIE interrupt Recv Data before enqueue to list + 6 - Rx after dequeue from list + 7 - Rx before de-amsdu + 8 - Rx before send to kernel + 9 - Reserved for Rx + Examples: + mlanutl mlan0 tp_state 1 1 Collect throughput result and drop tx pkts at point 1. + mlanutl mlan0 tp_state Get throughput results (only works with enable mode). + mlanutl mlan0 tp_state 0 Disable throughput accounting. + mlanutl mlan0 tp_state 1 0xff Just for reading TX/RX accounting, no pkts drop + +clocksync + This command is used to set and get WIFI TSF based clock sync setting + + Usage: + mlanutl mlanX/uapX clocksync [j][k] [l] [m] [n] + + where + [j] mode + <mode> - This parameter use to configure GPIO TSF latch mode + 0: GPIO level + 1: GPIO toggle + 2: GPIO toggle on Next Beacon. + [k] role + <role> + 0: when mode set to 0 or 1 + 1: AP + 2: STA + [l] gpio pin number + [m] GPIO Level/Toggle + mode = 0 + 0: low 1: high + mode = 1 or 2 + 0: low to high + 1: high to low + [n] GPIO pulse width + mode = 0, reserved, set to 0 + mode 1 or 2 + 0: GPIO remain on toggle level (high or low) + Non-0: GPIO pulse width in microseconds (min 1 us) + + If no parameter provided, get is performed. + + Examples: + mlanutl mlan0 clocksync 0 0 5 0 0 + mlanutl mlan0 clocksync 1 0 10 1 500 + mlanutl mlan0 clocksync 1 0 5 0 0 + mlanutl mlan0 clocksync 2 1 10 1 500 + mlanutl mlan0 clocksync 2 2 3 0 0 + mlanutl mlan0 clocksync + +gettsfinfo + This command is used to get TSF info + + Usage: + mlanutl mlanX gettsfinfo [j] + where + [j] format + 0: Report GPIO assert TSF + 1: Report Beacon TSF and Offset (valid if CONFIG Mode 2) + + Examples: + mlanutl mlan0 gettsfinfo Get GPIO assert TSF + mlanutl mlan0 gettsfinfo 1 Get Beacon TSP and Offset (valid if CONFIG mode 2) + +targetchan + This command is used to get/set target channel for UAP + + Usage: + mlanutl uaX targetchan [j] + where + [j] target channel + + Examples: + mlanutl uap0 targetchan Get current target channel + mlanutl uap0 targetchan 52 Set target channel to 52 +backuptchan + This command is used to get/set backup channel for UAP + + Usage: + mlanutl uaX backupchan [j] + where + [j] backup channel + + Examples: + mlanutl uap0 backupchan Get current backup channel + mlanutl uap0 backupchan 52 Set backup channel to 52 + +ips_cfg + This command is used to get/set IPS + + Usage: + mlanutl mlanX ips_cfg [1/0] + + Examples: + mlanutl mlan0 ips_cfg Get current IPS config + mlanutl mlan0 ips_cfg 1 Enable IPS + +mcast_aggr_group + This command is used to add/remove multicast address to mcast_aggr_group. + Also, while the address is set, stats for each of these addresses will be auto-logged. (Refer 'stats' command for more info) + + Usage: + mlanutl mlanX/uapX mcast_aggr_group [action] [mcast_addr] + where + [action] : add/remove multicast mac address to mcast_aggr_group + 0 - remove 1 - add + [mcast_addr] : mcast address + + Examples: + mlanutl uap0 mcast_aggr_group 1 01:00:5e:00:00:42 Add 01:00:5e:00:00:42 to mcast_aggr_group + mlanutl uap0 mcast_aggr_group 0 01:00:5e:00:00:43 Remove 01:00:5e:00:00:43 from mcast_aggr_group + mlanutl uap0 mcast_aggr_group List current mcast_aggr_group + +mc_aggr_cfg + This command gets or sets the configuration of multicast packet aggregation. + + Usage: + mlanutl mlanX/uapX mc_aggr_cfg [i][j] + where + [i]: Enable Bitmap , 1-Enable, 0-Disable + Valid if corresponding mask bit is 1 + Bit 0: MC aggregation + Bit 1: Packet expiry + Bit 2: CTS2Self + Bit 3: CTS2Sef duration offset + [j]: Mask Bitmap, 1-valid, 0-invalid + Bit 0: MC aggregation + Bit 1: Packet expiry + Bit 2: CTS2Self + + Examples: + mlanutl uap0 mc_aggr_cfg 1 1 Enable MC aggregation + mlanutl uap0 mc_aggr_cfg 7 7 Enable MC aggregation,Packet expiry,CTS2Self feature + mlanutl uap0 mc_aggr_cfg Query current MC aggregation configuration. + +mcast_tx + This command is used to transmit multicast packets as per the mcast_tx conf file. + + Usage: + mlanutl <interface> mcast_tx <mcast_tx.conf> + where + <interface> : wifi interface name i.e. uap0 + <mcast_tx.conf> : multicast tx conf file + +stats + This command is used to get/reset Tx-Rx stats for unicast/multicast address. + Usage: + ./mlanutl uapx stats [action] + Where + [action] : get/reset all stats for unicast and multicast addresses. + all: get all stats collection + reset: reset all stats collection + mcast_timeout: get all multicast timeout stats collection + + Examples: + mlanutl uap0 stats all Get all stats for mac address configured using mcast_aggr_group command + mlanutl uap0 stats reset Reset all stats for mac address configured using mcast_aggr_group command + mlanutl uap0 stats mcast_timeout Get all multicast timeout stats for mac address configured using mcast_aggr_group command + +getuuid + This command is used to read 16 byte uuid for a given interface and uuid remains same for + <sta, uap, wfd> + Usage: + ./mlanutl <interface> getuuid + + Examples: + i/p: mlanutl uap0 getuuid + o/p: uuid: a0b0c0d0d0c0b0a0a0b0c0d0d0c0b0a0 + +=============================================================================== +=============================================================================== + U S E R M A N U A L F O R Enable Scan GAP + +Following commands can be used to enable gap between scans. + +mlanutl mlanX scancfg [t] [m] [p] [s] [a] [b] [c] [ext] [gap] +mlanutl mlanX setuserscan [ARGS] + +For detail information, please refer the command description. +===============================================================================
diff --git a/wlan_sd8987/mlan/mlan.h b/wlan_sd8987/mlan/mlan.h index 566ad50..4d48ce8 100755 --- a/wlan_sd8987/mlan/mlan.h +++ b/wlan_sd8987/mlan/mlan.h
@@ -4,7 +4,7 @@ * It also defines the data structures used for APIs between MLAN and MOAL. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_11ac.c b/wlan_sd8987/mlan/mlan_11ac.c index 0478688..6ced102 100755 --- a/wlan_sd8987/mlan/mlan_11ac.c +++ b/wlan_sd8987/mlan/mlan_11ac.c
@@ -54,9 +54,8 @@ * @return channel center frequency center, if found; O, otherwise */ -t_u8 -wlan_get_center_freq_idx(mlan_private *pmpriv, t_u16 band, - t_u32 pri_chan, t_u8 chan_bw) +t_u8 wlan_get_center_freq_idx(mlan_private *pmpriv, t_u16 band, t_u32 pri_chan, + t_u8 chan_bw) { t_u8 center_freq_idx = 0; @@ -140,7 +139,7 @@ break; } /* fall through */ - default: /* error. go to the default */ + default: /* error. go to the default */ center_freq_idx = 42; } } @@ -154,8 +153,7 @@ * * @return The bitmap of supported nss */ -static t_u8 -wlan_get_nss_vht_mcs(t_u16 mcs_map_set) +static t_u8 wlan_get_nss_vht_mcs(t_u16 mcs_map_set) { t_u8 nss, nss_map = 0; for (nss = 1; nss <= 8; nss++) { @@ -173,8 +171,7 @@ * * @return The bitmap of supported nss */ -static t_u8 -wlan_get_nss_num_vht_mcs(t_u16 mcs_map_set) +static t_u8 wlan_get_nss_num_vht_mcs(t_u16 mcs_map_set) { t_u8 nss, nss_num = 0; for (nss = 1; nss <= 8; nss++) { @@ -194,8 +191,8 @@ * * @return N/A */ -static void -wlan_fill_cap_info(mlan_private *priv, VHT_capa_t *vht_cap, t_u8 bands) +static void wlan_fill_cap_info(mlan_private *priv, VHT_capa_t *vht_cap, + t_u16 bands) { t_u32 usr_dot_11ac_dev_cap; ENTER(); @@ -219,8 +216,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -230,7 +227,9 @@ t_u32 cfg_value = 0; t_u32 hw_value = 0; t_u8 nss = 0; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) t_u16 rx_nss = 0; t_u16 tx_nss = 0; #endif @@ -263,8 +262,8 @@ } /** set bit fileds */ usr_vht_cap_info = VHT_CAP_INFO_BIT_FIELDS & - cfg->param.vht_cfg.vht_cap_info & - pmadapter->hw_dot_11ac_dev_cap; + cfg->param.vht_cfg.vht_cap_info & + pmadapter->hw_dot_11ac_dev_cap; /** set MAX MPDU LEN field (bit 0 - bit 1) */ cfg_value = GET_VHTCAP_MAXMPDULEN(cfg->param.vht_cfg.vht_cap_info); @@ -292,12 +291,10 @@ hw_value = GET_VHTCAP_NUMSNDDM(pmadapter->hw_dot_11ac_dev_cap); SET_VHTCAP_NUMSNDDM(usr_vht_cap_info, MIN(cfg_value, hw_value)); /** set Number of Max AMPDU Length Exponent (bit 23 - bit 25) */ - cfg_value = - GET_VHTCAP_MAXAMPDULENEXP(cfg->param.vht_cfg. - vht_cap_info); - hw_value = - GET_VHTCAP_MAXAMPDULENEXP(pmadapter-> - hw_dot_11ac_dev_cap); + cfg_value = GET_VHTCAP_MAXAMPDULENEXP( + cfg->param.vht_cfg.vht_cap_info); + hw_value = GET_VHTCAP_MAXAMPDULENEXP( + pmadapter->hw_dot_11ac_dev_cap); SET_VHTCAP_MAXAMPDULENEXP(usr_vht_cap_info, MIN(cfg_value, hw_value)); /** set VHT Link Adaptation Capable (bit 26 - bit 27) */ @@ -314,95 +311,96 @@ /** update the RX MCS map */ if (cfg->param.vht_cfg.txrx & MLAN_RADIO_RX) { -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { if (cfg->param.vht_cfg.band == BAND_SELECT_A) { - rx_nss = GET_RXMCSSUPP(pmadapter-> - user_htstream >> - 8); - tx_nss = GET_TXMCSSUPP(pmadapter-> - user_htstream >> - 8) & 0x0f; + rx_nss = GET_RXMCSSUPP( + pmadapter->user_htstream >> 8); + tx_nss = + GET_TXMCSSUPP( + pmadapter->user_htstream >> + 8) & + 0x0f; } else { - rx_nss = GET_RXMCSSUPP(pmadapter-> - user_htstream); - tx_nss = GET_TXMCSSUPP(pmadapter-> - user_htstream) & + rx_nss = GET_RXMCSSUPP( + pmadapter->user_htstream); + tx_nss = + GET_TXMCSSUPP( + pmadapter->user_htstream) & 0x0f; } } #endif /* use the previous user value */ if (cfg->param.vht_cfg.vht_rx_mcs == 0xffffffff) - cfg->param.vht_cfg.vht_rx_mcs = - GET_VHTMCS(pmpriv-> - usr_dot_11ac_mcs_support); + cfg->param.vht_cfg.vht_rx_mcs = GET_VHTMCS( + pmpriv->usr_dot_11ac_mcs_support); for (nss = 1; nss <= 8; nss++) { - cfg_value = - GET_VHTNSSMCS(cfg->param.vht_cfg. - vht_rx_mcs, nss); - hw_value = - GET_DEVNSSRXMCS(pmadapter-> - hw_dot_11ac_mcs_support, - nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) + cfg_value = GET_VHTNSSMCS( + cfg->param.vht_cfg.vht_rx_mcs, nss); + hw_value = GET_DEVNSSRXMCS( + pmadapter->hw_dot_11ac_mcs_support, + nss); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) - SET_VHTNSSMCS(cfg->param.vht_cfg. - vht_rx_mcs, nss, - NO_NSS_SUPPORT); + SET_VHTNSSMCS( + cfg->param.vht_cfg.vht_rx_mcs, + nss, NO_NSS_SUPPORT); else - SET_VHTNSSMCS(cfg->param.vht_cfg. - vht_rx_mcs, nss, - MIN(cfg_value, hw_value)); + SET_VHTNSSMCS( + cfg->param.vht_cfg.vht_rx_mcs, + nss, MIN(cfg_value, hw_value)); } PRINTM(MINFO, "Set: vht rx mcs set 0x%08x\n", cfg->param.vht_cfg.vht_rx_mcs); /* use the previous user value */ if (cfg->param.vht_cfg.vht_tx_mcs == 0xffffffff) - cfg->param.vht_cfg.vht_tx_mcs = - GET_VHTMCS(pmpriv-> - usr_dot_11ac_mcs_support >> - 16); + cfg->param.vht_cfg.vht_tx_mcs = GET_VHTMCS( + pmpriv->usr_dot_11ac_mcs_support >> 16); for (nss = 1; nss <= 8; nss++) { - cfg_value = - GET_VHTNSSMCS(cfg->param.vht_cfg. - vht_tx_mcs, nss); - hw_value = - GET_DEVNSSTXMCS(pmadapter-> - hw_dot_11ac_mcs_support, - nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) + cfg_value = GET_VHTNSSMCS( + cfg->param.vht_cfg.vht_tx_mcs, nss); + hw_value = GET_DEVNSSTXMCS( + pmadapter->hw_dot_11ac_mcs_support, + nss); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) - SET_VHTNSSMCS(cfg->param.vht_cfg. - vht_tx_mcs, nss, - NO_NSS_SUPPORT); + SET_VHTNSSMCS( + cfg->param.vht_cfg.vht_tx_mcs, + nss, NO_NSS_SUPPORT); else - SET_VHTNSSMCS(cfg->param.vht_cfg. - vht_tx_mcs, nss, - MIN(cfg_value, hw_value)); + SET_VHTNSSMCS( + cfg->param.vht_cfg.vht_tx_mcs, + nss, MIN(cfg_value, hw_value)); } PRINTM(MINFO, "Set: vht tx mcs set 0x%08x\n", cfg->param.vht_cfg.vht_tx_mcs); if (!cfg->param.vht_cfg.skip_usr_11ac_mcs_cfg) { - RESET_DEVRXMCSMAP(pmpriv-> - usr_dot_11ac_mcs_support); + RESET_DEVRXMCSMAP( + pmpriv->usr_dot_11ac_mcs_support); + pmpriv->usr_dot_11ac_mcs_support |= GET_VHTMCS( + cfg->param.vht_cfg.vht_rx_mcs); + RESET_DEVTXMCSMAP( + pmpriv->usr_dot_11ac_mcs_support); pmpriv->usr_dot_11ac_mcs_support |= - GET_VHTMCS(cfg->param.vht_cfg. - vht_rx_mcs); - RESET_DEVTXMCSMAP(pmpriv-> - usr_dot_11ac_mcs_support); - pmpriv->usr_dot_11ac_mcs_support |= - (GET_VHTMCS - (cfg->param.vht_cfg.vht_tx_mcs) + (GET_VHTMCS( + cfg->param.vht_cfg.vht_tx_mcs) << 16); PRINTM(MINFO, "Set: vht mcs set 0x%08x\n", pmpriv->usr_dot_11ac_mcs_support); @@ -457,32 +455,18 @@ } cfg->param.vht_cfg.bwcfg = pmpriv->usr_dot_11ac_bw; - cfg->param.vht_cfg.vht_rx_mcs = - GET_DEVRXMCSMAP(pmpriv-> - usr_dot_11ac_mcs_support); - cfg->param.vht_cfg.vht_tx_mcs = - GET_DEVTXMCSMAP(pmpriv-> - usr_dot_11ac_mcs_support); + cfg->param.vht_cfg.vht_rx_mcs = GET_DEVRXMCSMAP( + pmpriv->usr_dot_11ac_mcs_support); + cfg->param.vht_cfg.vht_tx_mcs = GET_DEVTXMCSMAP( + pmpriv->usr_dot_11ac_mcs_support); cfg->param.vht_cfg.vht_rx_max_rate = - wlan_convert_mcsmap_to_maxrate(pmpriv, - cfg-> - param. - vht_cfg. - band, - cfg-> - param. - vht_cfg. - vht_rx_mcs); + wlan_convert_mcsmap_to_maxrate( + pmpriv, cfg->param.vht_cfg.band, + cfg->param.vht_cfg.vht_rx_mcs); cfg->param.vht_cfg.vht_tx_max_rate = - wlan_convert_mcsmap_to_maxrate(pmpriv, - cfg-> - param. - vht_cfg. - band, - cfg-> - param. - vht_cfg. - vht_tx_mcs); + wlan_convert_mcsmap_to_maxrate( + pmpriv, cfg->param.vht_cfg.band, + cfg->param.vht_cfg.vht_tx_mcs); } LEAVE(); return ret; @@ -513,8 +497,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11ac_ioctl_opermodecfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11ac_ioctl_opermodecfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_11ac_cfg *cfg = MNULL; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -530,10 +514,8 @@ } else if (pioctl_req->action == MLAN_ACT_SET) { hw_bw_160or8080 = GET_VHTCAP_CHWDSET(pmadapter->hw_dot_11ac_dev_cap); - hw_rx_nss = - wlan_get_nss_num_vht_mcs(GET_DEVRXMCSMAP - (pmadapter-> - hw_dot_11ac_mcs_support)); + hw_rx_nss = wlan_get_nss_num_vht_mcs( + GET_DEVRXMCSMAP(pmadapter->hw_dot_11ac_mcs_support)); if ((((cfg->param.opermode_cfg.bw - 1) > BW_80MHZ) && !hw_bw_160or8080) || (cfg->param.opermode_cfg.nss > hw_rx_nss)) { @@ -559,13 +541,12 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11ac_ioctl_supported_mcs_set(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11ac_ioctl_supported_mcs_set(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { - /*mlan_ds_11ac_cfg *cfg= MNULL; */ - /*int rx_mcs_supp; */ - /*t_u8 mcs_set[NUM_MCS_SUPP]; */ + /*mlan_ds_11ac_cfg *cfg= MNULL;*/ + /*int rx_mcs_supp;*/ + /*t_u8 mcs_set[NUM_MCS_SUPP];*/ ENTER(); #if 0 @@ -577,15 +558,15 @@ } rx_mcs_supp = GET_11ACRXMCSSUPP(pmadapter->usr_dot_11ac_mcs_support); /* Set MCS */ - memset(pmadapter, (t_u8 *)mcs_set, 0xff, rx_mcs_supp); + memset(pmadapter, (t_u8 *) mcs_set, 0xff, rx_mcs_supp); /* Clear all the other values */ - memset(pmadapter, (t_u8 *)&mcs_set[rx_mcs_supp], 0, - NUM_MCS_FIELD - rx_mcs_supp); + memset(pmadapter, (t_u8 *) &mcs_set[rx_mcs_supp], 0, + NUM_MCS_FIELD - rx_mcs_supp); /* Set MCS32 with 40MHz support */ if (ISSUPP_CHANWIDTH80(pmadapter->usr_dot_11ac_dev_cap_bg) - || ISSUPP_CHANWIDTH80(pmadapter->usr_dot_11ac_dev_cap_a) - ) - SETHT_MCS32(mcs_set); + || ISSUPP_CHANWIDTH80(pmadapter->usr_dot_11ac_dev_cap_a) + ) + SETHT_MCS32(mcs_set); cfg = (mlan_ds_11ac_cfg *)pioctl_req->pbuf; memcpy_ext(pmadapter, cfg->param.supported_mcs_set, mcs_set, @@ -608,8 +589,7 @@ * * @return N/A */ -void -wlan_show_dot11acdevcap(pmlan_adapter pmadapter, t_u32 cap) +void wlan_show_dot11acdevcap(pmlan_adapter pmadapter, t_u32 cap) { ENTER(); @@ -637,10 +617,10 @@ (ISSUPP_11ACVHTTXOPPS(cap) ? "supported" : "not supported")); PRINTM(MINFO, "GET_HW_SPEC: MU RX beamformee %s\n", (ISSUPP_11ACMURXBEAMFORMEE(cap) ? "supported" : - "not supported")); + "not supported")); PRINTM(MINFO, "GET_HW_SPEC: MU TX beamformee %s\n", (ISSUPP_11ACMUTXBEAMFORMEE(cap) ? "supported" : - "not supported")); + "not supported")); PRINTM(MINFO, "GET_HW_SPEC: SU RX Beamformee %s\n", (ISSUPP_11ACSUBEAMFORMEE(cap) ? "supported" : "not supported")); PRINTM(MINFO, "GET_HW_SPEC: SU TX Beamformer %s\n", @@ -672,8 +652,7 @@ * * @return N/A */ -void -wlan_show_dot11acmcssupport(pmlan_adapter pmadapter, t_u32 support) +void wlan_show_dot11acmcssupport(pmlan_adapter pmadapter, t_u32 support) { ENTER(); @@ -694,8 +673,8 @@ * * @return the max data rate for long GI */ -t_u16 -wlan_convert_mcsmap_to_maxrate(mlan_private *priv, t_u16 bands, t_u16 mcs_map) +t_u16 wlan_convert_mcsmap_to_maxrate(mlan_private *priv, t_u16 bands, + t_u16 mcs_map) { t_u8 i; t_u8 nss; @@ -707,46 +686,46 @@ /* tables of the MCS map to the highest data rate (in Mbps) * supported for long GI */ t_u16 max_rate_lgi_20MHZ[8][3] = { - {0x41, 0x4E, 0x0}, /* NSS = 1 */ - {0x82, 0x9C, 0x0}, /* NSS = 2 */ - {0xC3, 0xEA, 0x104}, /* NSS = 3 */ - {0x104, 0x138, 0x0}, /* NSS = 4 */ - {0x145, 0x186, 0x0}, /* NSS = 5 */ - {0x186, 0x1D4, 0x208}, /* NSS = 6 */ - {0x1C7, 0x222, 0x0}, /* NSS = 7 */ - {0x208, 0x270, 0x0} /* NSS = 8 */ + {0x41, 0x4E, 0x0}, /* NSS = 1 */ + {0x82, 0x9C, 0x0}, /* NSS = 2 */ + {0xC3, 0xEA, 0x104}, /* NSS = 3 */ + {0x104, 0x138, 0x0}, /* NSS = 4 */ + {0x145, 0x186, 0x0}, /* NSS = 5 */ + {0x186, 0x1D4, 0x208}, /* NSS = 6 */ + {0x1C7, 0x222, 0x0}, /* NSS = 7 */ + {0x208, 0x270, 0x0} /* NSS = 8 */ }; t_u16 max_rate_lgi_40MHZ[8][3] = { - {0x87, 0xA2, 0xB4}, /* NSS = 1 */ - {0x10E, 0x144, 0x168}, /* NSS = 2 */ - {0x195, 0x1E6, 0x21C}, /* NSS = 3 */ - {0x21C, 0x288, 0x2D0}, /* NSS = 4 */ - {0x2A3, 0x32A, 0x384}, /* NSS = 5 */ - {0x32A, 0x3CC, 0x438}, /* NSS = 6 */ - {0x3B1, 0x46E, 0x4EC}, /* NSS = 7 */ - {0x438, 0x510, 0x5A0} /* NSS = 8 */ + {0x87, 0xA2, 0xB4}, /* NSS = 1 */ + {0x10E, 0x144, 0x168}, /* NSS = 2 */ + {0x195, 0x1E6, 0x21C}, /* NSS = 3 */ + {0x21C, 0x288, 0x2D0}, /* NSS = 4 */ + {0x2A3, 0x32A, 0x384}, /* NSS = 5 */ + {0x32A, 0x3CC, 0x438}, /* NSS = 6 */ + {0x3B1, 0x46E, 0x4EC}, /* NSS = 7 */ + {0x438, 0x510, 0x5A0} /* NSS = 8 */ }; t_u16 max_rate_lgi_80MHZ[8][3] = { - {0x124, 0x15F, 0x186}, /* NSS = 1 */ - {0x249, 0x2BE, 0x30C}, /* NSS = 2 */ - {0x36D, 0x41D, 0x492}, /* NSS = 3 */ - {0x492, 0x57C, 0x618}, /* NSS = 4 */ - {0x5B6, 0x6DB, 0x79E}, /* NSS = 5 */ - {0x6DB, 0x83A, 0x0}, /* NSS = 6 */ - {0x7FF, 0x999, 0xAAA}, /* NSS = 7 */ - {0x924, 0xAF8, 0xC30} /* NSS = 8 */ + {0x124, 0x15F, 0x186}, /* NSS = 1 */ + {0x249, 0x2BE, 0x30C}, /* NSS = 2 */ + {0x36D, 0x41D, 0x492}, /* NSS = 3 */ + {0x492, 0x57C, 0x618}, /* NSS = 4 */ + {0x5B6, 0x6DB, 0x79E}, /* NSS = 5 */ + {0x6DB, 0x83A, 0x0}, /* NSS = 6 */ + {0x7FF, 0x999, 0xAAA}, /* NSS = 7 */ + {0x924, 0xAF8, 0xC30} /* NSS = 8 */ }; t_u16 max_rate_lgi_160MHZ[8][3] = { - {0x249, 0x2BE, 0x30C}, /* NSS = 1 */ - {0x492, 0x57C, 0x618}, /* NSS = 2 */ - {0x6DB, 0x83A, 0x0}, /* NSS = 3 */ - {0x924, 0xAF8, 0xC30}, /* NSS = 4 */ - {0xB6D, 0xDB6, 0xF3C}, /* NSS = 5 */ - {0xDB6, 0x1074, 0x1248}, /* NSS = 6 */ - {0xFFF, 0x1332, 0x1554}, /* NSS = 7 */ - {0x1248, 0x15F0, 0x1860} /* NSS = 8 */ + {0x249, 0x2BE, 0x30C}, /* NSS = 1 */ + {0x492, 0x57C, 0x618}, /* NSS = 2 */ + {0x6DB, 0x83A, 0x0}, /* NSS = 3 */ + {0x924, 0xAF8, 0xC30}, /* NSS = 4 */ + {0xB6D, 0xDB6, 0xF3C}, /* NSS = 5 */ + {0xDB6, 0x1074, 0x1248}, /* NSS = 6 */ + {0xFFF, 0x1332, 0x1554}, /* NSS = 7 */ + {0x1248, 0x15F0, 0x1860} /* NSS = 8 */ }; if (bands & BAND_AAC) { @@ -766,7 +745,7 @@ } max_mcs = (mcs_map >> (2 * nss)) & 0x3; - /* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9 */ + /* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9*/ if (max_mcs >= 3) max_mcs = 2; @@ -790,8 +769,9 @@ max_rate = max_rate_lgi_20MHZ[nss][max_mcs]; /* MCS9 is not supported in NSS1/2/4/5/7/8 */ if (max_mcs >= 1 && max_rate == 0) - max_rate = max_rate_lgi_20MHZ[nss] - [max_mcs - 1]; + max_rate = + max_rate_lgi_20MHZ[nss] + [max_mcs - 1]; } } } @@ -810,9 +790,8 @@ * @param bw_80p80 TRUE -- enable 80p80 * @return N/A */ -void -wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, - t_u16 bands, t_u8 flag, t_u8 bw_80p80) +void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, + t_u16 bands, t_u8 flag, t_u8 bw_80p80) { t_u16 mcs_map_user = 0; t_u16 mcs_map_resp = 0; @@ -820,7 +799,9 @@ t_u16 mcs_user = 0; t_u16 mcs_resp = 0; t_u16 nss; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) t_u16 rx_nss = 0, tx_nss = 0; #endif ENTER(); @@ -834,24 +815,28 @@ wlan_cpu_to_le32(pvht_cap->vht_cap.vht_cap_info); /* Fill VHT MCS Set */ - /* rx MCS Set, find the minimum of the user rx mcs and ap rx mcs */ + /* rx MCS Set, find the minimum of the user rx mcs and ap rx mcs*/ mcs_map_resp = mcs_map_user = GET_DEVRXMCSMAP(priv->usr_dot_11ac_mcs_support); if (flag) mcs_map_resp = wlan_le16_to_cpu(pvht_cap->vht_cap.mcs_sets.rx_mcs_map); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(priv->adapter->card_type) || + IS_CARDNW62X(priv->adapter->card_type) || IS_CARD9097(priv->adapter->card_type)) { if (bands & BAND_A) { rx_nss = GET_RXMCSSUPP(priv->adapter->user_htstream >> 8); tx_nss = GET_TXMCSSUPP(priv->adapter->user_htstream >> - 8) & 0x0f; + 8) & + 0x0f; } else { rx_nss = GET_RXMCSSUPP(priv->adapter->user_htstream); tx_nss = GET_TXMCSSUPP(priv->adapter->user_htstream) & - 0x0f; + 0x0f; } /** force 1x1 when enable 80P80 */ if (bw_80p80) @@ -862,7 +847,9 @@ for (nss = 1; nss <= 8; nss++) { mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((rx_nss != 0) && (nss > rx_nss)) mcs_user = NO_NSS_SUPPORT; #endif @@ -893,7 +880,9 @@ for (nss = 1; nss <= 8; nss++) { mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((tx_nss != 0) && (nss > tx_nss)) mcs_user = NO_NSS_SUPPORT; #endif @@ -927,9 +916,8 @@ * * @return N/A */ -void -wlan_fill_vht_cap_ie(mlan_private *priv, IEEEtypes_VHTCap_t *pvht_cap, - t_u16 bands) +void wlan_fill_vht_cap_ie(mlan_private *priv, IEEEtypes_VHTCap_t *pvht_cap, + t_u16 bands) { ENTER(); @@ -944,19 +932,15 @@ GET_DEVRXMCSMAP(priv->usr_dot_11ac_mcs_support); /* rx highest rate */ - pvht_cap->vht_cap.mcs_sets.rx_max_rate = - wlan_convert_mcsmap_to_maxrate(priv, bands, - pvht_cap->vht_cap.mcs_sets. - rx_mcs_map); + pvht_cap->vht_cap.mcs_sets.rx_max_rate = wlan_convert_mcsmap_to_maxrate( + priv, bands, pvht_cap->vht_cap.mcs_sets.rx_mcs_map); /* tx MCS map */ pvht_cap->vht_cap.mcs_sets.tx_mcs_map = GET_DEVTXMCSMAP(priv->usr_dot_11ac_mcs_support); /* tx highest rate */ - pvht_cap->vht_cap.mcs_sets.tx_max_rate = - wlan_convert_mcsmap_to_maxrate(priv, bands, - pvht_cap->vht_cap.mcs_sets. - tx_mcs_map); + pvht_cap->vht_cap.mcs_sets.tx_max_rate = wlan_convert_mcsmap_to_maxrate( + priv, bands, pvht_cap->vht_cap.mcs_sets.tx_mcs_map); LEAVE(); return; @@ -969,8 +953,7 @@ * * @return MTRUE/MFALSE */ -t_u8 -wlan_is_ap_in_11ac_mode(mlan_private *priv) +t_u8 wlan_is_ap_in_11ac_mode(mlan_private *priv) { BSSDescriptor_t *pbss_desc; IEEEtypes_VHTOprat_t *vht_oprat = MNULL; @@ -996,9 +979,9 @@ * * @return N/A */ -void -wlan_fill_tdls_vht_oprat_ie(mlan_private *priv, - IEEEtypes_VHTOprat_t *vht_oprat, sta_node *sta_ptr) +void wlan_fill_tdls_vht_oprat_ie(mlan_private *priv, + IEEEtypes_VHTOprat_t *vht_oprat, + sta_node *sta_ptr) { t_u8 supp_chwd_set; t_u8 peer_supp_chwd_set; @@ -1025,8 +1008,8 @@ PRINTM(MMSG, "No Peer's Ext_cap info\n"); return; } - if (!ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH - (sta_ptr->ExtCap.ext_cap)) { + if (!ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH( + sta_ptr->ExtCap.ext_cap)) { PRINTM(MMSG, "Peer don't support Wider Bandwitch in Ext_cap\n"); return; @@ -1069,7 +1052,7 @@ } /* Fill BASIC VHT MCS and NSS Set */ - /* rx MCS Set, find the minimum of the user rx mcs and peer rx mcs */ + /* rx MCS Set, find the minimum of the user rx mcs and peer rx mcs*/ mcs_map_user = GET_DEVRXMCSMAP(priv->usr_dot_11ac_mcs_support); mcs_map_resp = pvht_cap->vht_cap.mcs_sets.rx_mcs_map; mcs_map_result = 0; @@ -1096,9 +1079,8 @@ chan_bw = CHANNEL_BW_80MHZ; break; } - vht_oprat->chan_center_freq_1 = - wlan_get_center_freq_idx(priv, BAND_AAC, pbss_desc->channel, - chan_bw); + vht_oprat->chan_center_freq_1 = wlan_get_center_freq_idx( + priv, BAND_AAC, pbss_desc->channel, chan_bw); LEAVE(); return; @@ -1112,11 +1094,12 @@ * * @return ret suport 80+80Mhz or not */ -t_u8 -wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) +t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) { t_u8 ret = MFALSE; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) t_u16 rx_nss = 0, tx_nss = 0; IEEEtypes_VHTCap_t *pvht_cap = pbss_desc->pvht_cap; MrvlIEtypes_He_cap_t *phecap = MNULL; @@ -1125,8 +1108,11 @@ ENTER(); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (!IS_CARD9098(pmpriv->adapter->card_type) && + !IS_CARDNW62X(pmpriv->adapter->card_type) && !IS_CARD9097(pmpriv->adapter->card_type)) return ret; /** check band A */ @@ -1145,8 +1131,8 @@ ret = MTRUE; /** check if AP support AX 80P80 */ if (pbss_desc->phe_cap) { - pBsshecap = (IEEEtypes_HECap_t *) pbss_desc->phe_cap; - phecap = (MrvlIEtypes_He_cap_t *) pmpriv->user_he_cap; + pBsshecap = (IEEEtypes_HECap_t *)pbss_desc->phe_cap; + phecap = (MrvlIEtypes_He_cap_t *)pmpriv->user_he_cap; if (ret && (phecap->he_phy_cap[0] & MBIT(4)) && (pBsshecap->he_phy_cap[0] & MBIT(4))) ret = MTRUE; @@ -1167,9 +1153,8 @@ * * @return bytes added to the buffer */ -int -wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, - t_u8 **ppbuffer) +int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **ppbuffer) { pmlan_adapter pmadapter = pmpriv->adapter; MrvlIETypes_VHTCap_t *pvht_cap; @@ -1178,7 +1163,9 @@ t_u16 nss; int ret_len = 0; t_u8 bw_80p80 = MFALSE; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) t_u16 rx_nss = 0; #endif @@ -1196,8 +1183,8 @@ /* VHT Capabilities IE */ if (pbss_desc->pvht_cap && - wlan_get_nss_vht_mcs(pbss_desc->pvht_cap->vht_cap.mcs_sets. - rx_mcs_map)) { + wlan_get_nss_vht_mcs( + pbss_desc->pvht_cap->vht_cap.mcs_sets.rx_mcs_map)) { pvht_cap = (MrvlIETypes_VHTCap_t *)*ppbuffer; memset(pmadapter, pvht_cap, 0, sizeof(MrvlIETypes_VHTCap_t)); pvht_cap->header.type = wlan_cpu_to_le16(VHT_CAPABILITY); @@ -1205,11 +1192,11 @@ memcpy_ext(pmadapter, (t_u8 *)pvht_cap + sizeof(MrvlIEtypesHeader_t), (t_u8 *)pbss_desc->pvht_cap + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pvht_cap->header.len, sizeof(VHT_capa_t)); bw_80p80 = wlan_is_80_80_support(pmpriv, pbss_desc); wlan_fill_vht_cap_tlv(pmpriv, pvht_cap, pbss_desc->bss_band, - MTRUE, bw_80p80); + MFALSE, bw_80p80); HEXDUMP("VHT_CAPABILITIES IE", (t_u8 *)pvht_cap, sizeof(MrvlIETypes_VHTCap_t)); @@ -1238,33 +1225,39 @@ if (!(IS_OPER_MODE_20M(pmrvl_oper_mode->oper_mode))) { if (pbss_desc->pht_cap->ht_cap.ht_cap_info & MBIT(1)) - SET_OPER_MODE_40M(pmrvl_oper_mode-> - oper_mode); + SET_OPER_MODE_40M( + pmrvl_oper_mode->oper_mode); else - SET_OPER_MODE_20M(pmrvl_oper_mode-> - oper_mode); + SET_OPER_MODE_20M( + pmrvl_oper_mode->oper_mode); } } } else { /** set default bandwidth:80M*/ SET_OPER_MODE_80M(pmrvl_oper_mode->oper_mode); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { if (pbss_desc->bss_band & BAND_A) - rx_nss = GET_RXMCSSUPP(pmadapter-> - user_htstream >> 8); + rx_nss = GET_RXMCSSUPP( + pmadapter->user_htstream >> 8); else - rx_nss = GET_RXMCSSUPP(pmadapter-> - user_htstream); + rx_nss = + GET_RXMCSSUPP(pmadapter->user_htstream); } #endif mcs_map_user = GET_DEVRXMCSMAP(pmpriv->usr_dot_11ac_mcs_support); nss = wlan_get_nss_num_vht_mcs(mcs_map_user); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { PRINTM(MCMND, "rx_nss=%d nss=%d\n", rx_nss, nss); nss = MIN(rx_nss, nss); @@ -1304,8 +1297,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11ac_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11ac_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11ac_cfg *cfg = MNULL; @@ -1350,9 +1343,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11ac_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_11AC_CFG *vhtcfg = &cmd->params.vhtcfg; @@ -1391,9 +1383,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11ac_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; mlan_ds_11ac_cfg *cfg = MNULL; @@ -1424,22 +1415,19 @@ cfg->param.vht_cfg.vht_tx_mcs = wlan_le32_to_cpu(cfg->param.vht_cfg.vht_tx_mcs); cfg->param.vht_cfg.vht_rx_max_rate = - wlan_convert_mcsmap_to_maxrate(pmpriv, - cfg->param.vht_cfg.band, - cfg->param.vht_cfg. - vht_rx_mcs); + wlan_convert_mcsmap_to_maxrate( + pmpriv, cfg->param.vht_cfg.band, + cfg->param.vht_cfg.vht_rx_mcs); cfg->param.vht_cfg.vht_tx_max_rate = - wlan_convert_mcsmap_to_maxrate(pmpriv, - cfg->param.vht_cfg.band, - cfg->param.vht_cfg. - vht_tx_mcs); + wlan_convert_mcsmap_to_maxrate( + pmpriv, cfg->param.vht_cfg.band, + cfg->param.vht_cfg.vht_tx_mcs); } LEAVE(); return MLAN_STATUS_SUCCESS; } -void -wlan_update_11ac_cap(mlan_private *pmpriv) +void wlan_update_11ac_cap(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; @@ -1461,8 +1449,7 @@ * * @return 0--not allowed, other value allowed */ -t_u8 -wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) +t_u8 wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) { if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { if (bss_band & BAND_G)
diff --git a/wlan_sd8987/mlan/mlan_11ac.h b/wlan_sd8987/mlan/mlan_11ac.h index d143aeb..9db5f9c 100755 --- a/wlan_sd8987/mlan/mlan_11ac.h +++ b/wlan_sd8987/mlan/mlan_11ac.h
@@ -47,12 +47,10 @@ t_u8 wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band); t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc); -mlan_status wlan_cmd_11ac_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); +mlan_status wlan_cmd_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_11ac_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #endif /* _MLAN_11AC_H_ */
diff --git a/wlan_sd8987/mlan/mlan_11ax.c b/wlan_sd8987/mlan/mlan_11ax.c index cb4bbfb..38b903d 100755 --- a/wlan_sd8987/mlan/mlan_11ax.c +++ b/wlan_sd8987/mlan/mlan_11ax.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for 11ax related features. * * - * Copyright 2018-2021 NXP + * Copyright 2018-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -56,8 +56,7 @@ * * @return N/A */ -static void -wlan_show_dot11axmaccap(pmlan_adapter pmadapter, t_u32 cap) +static void wlan_show_dot11axmaccap(pmlan_adapter pmadapter, t_u32 cap) { ENTER(); @@ -73,12 +72,11 @@ * * @return MTRUE/MFALSE */ -static t_u8 -wlan_check_ap_11ax_twt_supported(BSSDescriptor_t *pbss_desc) +static t_u8 wlan_check_ap_11ax_twt_supported(BSSDescriptor_t *pbss_desc) { if (!pbss_desc->phe_cap) return MFALSE; - if (!(pbss_desc->phe_cap->he_mac_cap[0] & HE_MAC_CAP_TWT_REQ_SUPPORT)) + if (!(pbss_desc->phe_cap->he_mac_cap[0] & HE_MAC_CAP_TWT_RESP_SUPPORT)) return MFALSE; if (!pbss_desc->pext_cap) return MFALSE; @@ -94,27 +92,29 @@ * * @return MTRUE/MFALSE */ -t_u8 -wlan_check_11ax_twt_supported(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) +t_u8 wlan_check_11ax_twt_supported(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { MrvlIEtypes_He_cap_t *phecap = - (MrvlIEtypes_He_cap_t *) & pmpriv->user_he_cap; - MrvlIEtypes_He_cap_t *hw_he_cap = (MrvlIEtypes_He_cap_t *) - & pmpriv->adapter->hw_he_cap; + (MrvlIEtypes_He_cap_t *)&pmpriv->user_he_cap; + MrvlIEtypes_He_cap_t *hw_he_cap = + (MrvlIEtypes_He_cap_t *)&pmpriv->adapter->hw_he_cap; + t_u16 band_selected = BAND_A; + if (pbss_desc && !wlan_check_ap_11ax_twt_supported(pbss_desc)) { PRINTM(MINFO, "AP don't support twt feature\n"); return MFALSE; } if (pbss_desc) { - if (pbss_desc->bss_band & BAND_A) { - hw_he_cap = (MrvlIEtypes_He_cap_t *) - & pmpriv->adapter->hw_he_cap; - phecap = (MrvlIEtypes_He_cap_t *) & pmpriv->user_he_cap; + if (pbss_desc->bss_band & band_selected) { + hw_he_cap = (MrvlIEtypes_He_cap_t *)&pmpriv->adapter + ->hw_he_cap; + phecap = (MrvlIEtypes_He_cap_t *)&pmpriv->user_he_cap; } else { - hw_he_cap = (MrvlIEtypes_He_cap_t *) - & pmpriv->adapter->hw_2g_he_cap; - phecap = (MrvlIEtypes_He_cap_t *) - & pmpriv->user_2g_he_cap; + hw_he_cap = (MrvlIEtypes_He_cap_t *)&pmpriv->adapter + ->hw_2g_he_cap; + phecap = + (MrvlIEtypes_He_cap_t *)&pmpriv->user_2g_he_cap; } } if (!(hw_he_cap->he_mac_cap[0] & HE_MAC_CAP_TWT_REQ_SUPPORT)) { @@ -136,8 +136,7 @@ * * @return N/A */ -static void -wlan_show_dot11axphycap(pmlan_adapter pmadapter, t_u32 support) +static void wlan_show_dot11axphycap(pmlan_adapter pmadapter, t_u32 support) { ENTER(); @@ -145,6 +144,141 @@ return; } #endif + +/** + * @brief This function fills the HE CAP IE w/ output format LE, not CPU + * + * @param priv A pointer to mlan_private structure + * @param hecap_ie A pointer to IEEEtypes_HECap_t structure + * @param band BAND_A (5G), otherwise, 2.4G + * + * @return bytes added to the phe_cap + */ +t_u8 wlan_fill_he_cap_ie(mlan_private *pmpriv, IEEEtypes_HECap_t *hecap_ie, + t_u16 band) +{ + pmlan_adapter pmadapter = pmpriv->adapter; + MrvlIEtypes_He_cap_t *user_hecap_tlv = MNULL; + MrvlIEtypes_He_cap_t *hw_hecap_tlv = MNULL; + IEEEtypes_HeMcsNss_t *he_mcsnss = MNULL; + t_u8 nss = 0; + t_u16 cfg_value = 0; + t_u16 hw_value = 0; + + if (band & BAND_A) { + user_hecap_tlv = (MrvlIEtypes_He_cap_t *)(pmpriv->user_he_cap); + hw_hecap_tlv = (MrvlIEtypes_He_cap_t *)pmadapter->hw_he_cap; + } else { + user_hecap_tlv = + (MrvlIEtypes_He_cap_t *)(pmpriv->user_2g_he_cap); + hw_hecap_tlv = (MrvlIEtypes_He_cap_t *)pmadapter->hw_2g_he_cap; + } + + // include PPE threshold + memcpy_ext(pmadapter, (t_u8 *)hecap_ie + sizeof(IEEEtypes_Header_t), + (t_u8 *)user_hecap_tlv + sizeof(MrvlIEtypesHeader_t), + user_hecap_tlv->len, + sizeof(IEEEtypes_HECap_t) - sizeof(IEEEtypes_Header_t)); + + hecap_ie->ieee_hdr.element_id = EXTENSION; + hecap_ie->ieee_hdr.len = + MIN(user_hecap_tlv->len, + sizeof(IEEEtypes_HECap_t) - sizeof(IEEEtypes_Header_t)); + hecap_ie->ext_id = HE_CAPABILITY; + + he_mcsnss = (IEEEtypes_HeMcsNss_t *)hecap_ie->he_txrx_mcs_support; + + for (nss = 1; nss <= 8; nss++) { + cfg_value = GET_HE_NSSMCS(user_hecap_tlv->rx_mcs_80, nss); + hw_value = GET_HE_NSSMCS(hw_hecap_tlv->rx_mcs_80, nss); + if ((hw_value == NO_NSS_SUPPORT) || + (cfg_value == NO_NSS_SUPPORT)) { + SET_HE_NSSMCS(he_mcsnss->rx_mcs, nss, NO_NSS_SUPPORT); + } else { + SET_HE_NSSMCS(he_mcsnss->rx_mcs, nss, + MIN(cfg_value, hw_value)); + } + } + + for (nss = 1; nss <= 8; nss++) { + cfg_value = GET_HE_NSSMCS(user_hecap_tlv->tx_mcs_80, nss); + hw_value = GET_HE_NSSMCS(hw_hecap_tlv->tx_mcs_80, nss); + + if ((hw_value == NO_NSS_SUPPORT) || + (cfg_value == NO_NSS_SUPPORT)) { + SET_HE_NSSMCS(he_mcsnss->tx_mcs, nss, NO_NSS_SUPPORT); + } else { + SET_HE_NSSMCS(he_mcsnss->tx_mcs, nss, + MIN(cfg_value, hw_value)); + } + } + PRINTM(MCMND, + "fill_11ax_ie: HE rx mcs_80 = 0x%08x tx mcs 80 = 0x%08x\n", + he_mcsnss->rx_mcs, he_mcsnss->tx_mcs); + + DBG_HEXDUMP(MCMD_D, "fill_11ax_ie", (t_u8 *)hecap_ie, + hecap_ie->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); + return hecap_ie->ieee_hdr.len; +} + +/** + * @brief This function fills the HE cap tlv out put format is LE, not CPU + * + * @param priv A pointer to mlan_private structure + * @param phe_cap A pointer to IEEEtypes_HECap_t structure + * @param band BAND_A (5G), otherwise, 2.4G + * + * @return bytes added to the phe_cap + */ +t_u8 wlan_fill_he_op_ie(mlan_private *pmpriv, IEEEtypes_HeOp_t *heop_ie) +{ + pmlan_adapter pmadapter = pmpriv->adapter; + BSSDescriptor_t *pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + IEEEtypes_HeOp_t *bss_heop_ie = MNULL; + + memset(pmadapter, (void *)heop_ie, 0, sizeof(IEEEtypes_HeOp_t)); + + heop_ie->ieee_hdr.element_id = EXTENSION; + heop_ie->ieee_hdr.len = sizeof(IEEEtypes_HeOp_t) - + sizeof(IEEEtypes_Header_t) - + sizeof(heop_ie->option); + heop_ie->ext_id = HE_OPERATION; + + // HE Operation Parameters + heop_ie->he_op_param.default_pe_dur = 7; + heop_ie->he_op_param.twt_req = 0; + heop_ie->he_op_param.txop_dur_rts_threshold = 12; + heop_ie->he_op_param.vht_op_info_present = 0; + heop_ie->he_op_param.co_located_bss = 0; + heop_ie->he_op_param.er_su_disable = 0; + // HE BSS Color Information (following the AP) + if (pbss_desc->phe_oprat) { + bss_heop_ie = (IEEEtypes_HeOp_t *)(pbss_desc->phe_oprat); + heop_ie->bss_color_info.bss_color = + bss_heop_ie->bss_color_info.bss_color; + } else { + // default color + heop_ie->bss_color_info.bss_color = 1; + } + heop_ie->bss_color_info.partial_bss_color = 0; + heop_ie->bss_color_info.bss_color_disabled = 0; + // Rx HE MCS MAP + heop_ie->basic_he_mcs_nss.max_mcs_1ss = 0; +#if defined(SD9177) + heop_ie->basic_he_mcs_nss.max_mcs_2ss = 3; +#else + heop_ie->basic_he_mcs_nss.max_mcs_2ss = 0; +#endif + heop_ie->basic_he_mcs_nss.max_mcs_3ss = 3; + heop_ie->basic_he_mcs_nss.max_mcs_4ss = 3; + heop_ie->basic_he_mcs_nss.max_mcs_5ss = 3; + heop_ie->basic_he_mcs_nss.max_mcs_6ss = 3; + heop_ie->basic_he_mcs_nss.max_mcs_7ss = 3; + heop_ie->basic_he_mcs_nss.max_mcs_8ss = 3; + + return heop_ie->ieee_hdr.len; +} + /** * @brief This function fills the HE cap tlv out put format is LE, not CPU * @@ -156,13 +290,14 @@ * * @return bytes added to the phe_cap */ -t_u16 -wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u8 band, - MrvlIEtypes_Extension_t * phe_cap, t_u8 flag) +t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, + MrvlIEtypes_Extension_t *phe_cap, t_u8 flag) { pmlan_adapter pmadapter = pmpriv->adapter; t_u16 len = 0; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) t_u16 rx_nss = 0, tx_nss = 0; #endif MrvlIEtypes_He_cap_t *phecap = MNULL; @@ -175,41 +310,46 @@ LEAVE(); return 0; } - if (band & BAND_A) { + if (band & BAND_AAX) { memcpy_ext(pmadapter, (t_u8 *)phe_cap, pmpriv->user_he_cap, pmpriv->user_hecap_len, sizeof(MrvlIEtypes_He_cap_t)); len = pmpriv->user_hecap_len; - phw_hecap = (MrvlIEtypes_He_cap_t *) pmadapter->hw_he_cap; + phw_hecap = (MrvlIEtypes_He_cap_t *)pmadapter->hw_he_cap; } else { memcpy_ext(pmadapter, (t_u8 *)phe_cap, pmpriv->user_2g_he_cap, pmpriv->user_2g_hecap_len, sizeof(MrvlIEtypes_He_cap_t)); len = pmpriv->user_2g_hecap_len; - phw_hecap = (MrvlIEtypes_He_cap_t *) pmadapter->hw_2g_he_cap; + phw_hecap = (MrvlIEtypes_He_cap_t *)pmadapter->hw_2g_he_cap; } phe_cap->type = wlan_cpu_to_le16(phe_cap->type); phe_cap->len = wlan_cpu_to_le16(phe_cap->len); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type)) { - if (band & BAND_A) { + if (band & BAND_AAX) { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream >> 8); tx_nss = GET_TXMCSSUPP(pmpriv->adapter->user_htstream >> - 8) & 0x0f; + 8) & + 0x0f; } else { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream); tx_nss = GET_TXMCSSUPP(pmpriv->adapter->user_htstream) & - 0x0f; + 0x0f; } } #endif - phecap = (MrvlIEtypes_He_cap_t *) phe_cap; + phecap = (MrvlIEtypes_He_cap_t *)phe_cap; for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->rx_mcs_80, nss); hw_value = GET_HE_NSSMCS(phw_hecap->rx_mcs_80, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -217,13 +357,15 @@ (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->rx_mcs_80, nss, NO_NSS_SUPPORT); else - SET_HE_NSSMCS(phecap->rx_mcs_80, - nss, MIN(cfg_value, hw_value)); + SET_HE_NSSMCS(phecap->rx_mcs_80, nss, + MIN(cfg_value, hw_value)); } for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->tx_mcs_80, nss); hw_value = GET_HE_NSSMCS(phw_hecap->tx_mcs_80, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -231,8 +373,8 @@ (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->tx_mcs_80, nss, NO_NSS_SUPPORT); else - SET_HE_NSSMCS(phecap->tx_mcs_80, - nss, MIN(cfg_value, hw_value)); + SET_HE_NSSMCS(phecap->tx_mcs_80, nss, + MIN(cfg_value, hw_value)); } PRINTM(MCMND, "Set: HE rx mcs set 0x%08x tx mcs set 0x%08x\n", phecap->rx_mcs_80, phecap->tx_mcs_80); @@ -251,21 +393,23 @@ * * @return bytes added to the buffer */ -int -wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, - t_u8 **ppbuffer) +int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **ppbuffer) { pmlan_adapter pmadapter = pmpriv->adapter; MrvlIEtypes_He_cap_t *phecap = MNULL; int len = 0; t_u8 bw_80p80 = MFALSE; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) t_u16 rx_nss = 0, tx_nss = 0; #endif t_u8 nss = 0; t_u16 cfg_value = 0; t_u16 hw_value = 0; MrvlIEtypes_He_cap_t *phw_hecap = MNULL; + t_u16 band_selected = BAND_A; ENTER(); @@ -284,35 +428,39 @@ return 0; } bw_80p80 = wlan_is_80_80_support(pmpriv, pbss_desc); - phecap = (MrvlIEtypes_He_cap_t *) * ppbuffer; - if (pbss_desc->bss_band & BAND_A) { + phecap = (MrvlIEtypes_He_cap_t *)*ppbuffer; + if (pbss_desc->bss_band & band_selected) { memcpy_ext(pmadapter, *ppbuffer, pmpriv->user_he_cap, pmpriv->user_hecap_len, pmpriv->user_hecap_len); *ppbuffer += pmpriv->user_hecap_len; len = pmpriv->user_hecap_len; - phw_hecap = (MrvlIEtypes_He_cap_t *) pmadapter->hw_he_cap; + phw_hecap = (MrvlIEtypes_He_cap_t *)pmadapter->hw_he_cap; } else { memcpy_ext(pmadapter, *ppbuffer, pmpriv->user_2g_he_cap, pmpriv->user_2g_hecap_len, pmpriv->user_2g_hecap_len); *ppbuffer += pmpriv->user_2g_hecap_len; len = pmpriv->user_2g_hecap_len; - phw_hecap = (MrvlIEtypes_He_cap_t *) pmadapter->hw_2g_he_cap; + phw_hecap = (MrvlIEtypes_He_cap_t *)pmadapter->hw_2g_he_cap; } phecap->type = wlan_cpu_to_le16(phecap->type); phecap->len = wlan_cpu_to_le16(phecap->len); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmpriv->adapter->card_type) || + IS_CARDNW62X(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type)) { - if (pbss_desc->bss_band & BAND_A) { + if (pbss_desc->bss_band & band_selected) { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream >> 8); tx_nss = GET_TXMCSSUPP(pmpriv->adapter->user_htstream >> - 8) & 0x0f; + 8) & + 0x0f; } else { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream); tx_nss = GET_TXMCSSUPP(pmpriv->adapter->user_htstream) & - 0x0f; + 0x0f; } /** force 1x1 when enable 80P80 */ if (bw_80p80) @@ -322,7 +470,9 @@ for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->rx_mcs_80, nss); hw_value = GET_HE_NSSMCS(phw_hecap->rx_mcs_80, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -330,13 +480,15 @@ (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->rx_mcs_80, nss, NO_NSS_SUPPORT); else - SET_HE_NSSMCS(phecap->rx_mcs_80, - nss, MIN(cfg_value, hw_value)); + SET_HE_NSSMCS(phecap->rx_mcs_80, nss, + MIN(cfg_value, hw_value)); } for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->tx_mcs_80, nss); hw_value = GET_HE_NSSMCS(phw_hecap->tx_mcs_80, nss); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -344,8 +496,8 @@ (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->tx_mcs_80, nss, NO_NSS_SUPPORT); else - SET_HE_NSSMCS(phecap->tx_mcs_80, - nss, MIN(cfg_value, hw_value)); + SET_HE_NSSMCS(phecap->tx_mcs_80, nss, + MIN(cfg_value, hw_value)); } PRINTM(MCMND, "Set: HE rx mcs set 0x%08x tx mcs set 0x%08x\n", phecap->rx_mcs_80, phecap->tx_mcs_80); @@ -368,13 +520,13 @@ * * @return N/A */ -void -wlan_update_11ax_cap(mlan_adapter *pmadapter, - MrvlIEtypes_Extension_t * hw_he_cap) +void wlan_update_11ax_cap(mlan_adapter *pmadapter, + MrvlIEtypes_Extension_t *hw_he_cap) { MrvlIEtypes_He_cap_t *phe_cap = MNULL; t_u8 i = 0; t_u8 he_cap_2g = 0; + MrvlIEtypes_He_cap_t *user_he_cap_tlv = MNULL; ENTER(); if ((hw_he_cap->len + sizeof(MrvlIEtypesHeader_t)) > @@ -383,7 +535,7 @@ LEAVE(); return; } - phe_cap = (MrvlIEtypes_He_cap_t *) hw_he_cap; + phe_cap = (MrvlIEtypes_He_cap_t *)hw_he_cap; if (phe_cap->he_phy_cap[0] & (AX_2G_40MHZ_SUPPORT | AX_2G_20MHZ_SUPPORT)) { pmadapter->hw_2g_hecap_len = @@ -422,17 +574,39 @@ pmadapter->hw_2g_he_cap, pmadapter->hw_2g_hecap_len, sizeof(pmadapter->priv[i] - ->user_2g_he_cap)); + ->user_2g_he_cap)); } else { pmadapter->priv[i]->user_hecap_len = pmadapter->hw_hecap_len; - memcpy_ext(pmadapter, - pmadapter->priv[i]->user_he_cap, - pmadapter->hw_he_cap, - pmadapter->hw_hecap_len, - sizeof(pmadapter->priv[i]-> - user_he_cap)); + memcpy_ext( + pmadapter, + pmadapter->priv[i]->user_he_cap, + pmadapter->hw_he_cap, + pmadapter->hw_hecap_len, + sizeof(pmadapter->priv[i]->user_he_cap)); } + /** + * Clear TWT bits in he_mac_cap by bss role + * STA mode should clear TWT responder bit + * UAP mode should clear TWT request bit + */ + if (he_cap_2g) + user_he_cap_tlv = + (MrvlIEtypes_He_cap_t *)&pmadapter + ->priv[i] + ->user_2g_he_cap; + else + user_he_cap_tlv = + (MrvlIEtypes_He_cap_t *)&pmadapter + ->priv[i] + ->user_he_cap; + + if (pmadapter->priv[i]->bss_role == MLAN_BSS_ROLE_STA) + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_RESP_SUPPORT; + else + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_REQ_SUPPORT; } } LEAVE(); @@ -443,14 +617,15 @@ * @brief This function check if 11AX is allowed in bandcfg * * @param pmpriv A pointer to mlan_private structure - * @param bss_band bss band + * @param pbss_desc A pointer to BSSDescriptor_t * * @return 0--not allowed, other value allowed */ -t_u16 -wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) +t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { - if (!IS_FW_SUPPORT_11AX(pmpriv->adapter)) + t_u16 bss_band = pbss_desc->bss_band; + if (pbss_desc->disable_11n) return MFALSE; if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { if (bss_band & BAND_G) @@ -474,8 +649,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11ax_ioctl_hecfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11ax_ioctl_hecfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -484,16 +659,7 @@ ENTER(); - if (pioctl_req->buf_len < sizeof(mlan_ds_11ax_cfg)) { - PRINTM(MINFO, "MLAN bss IOCTL length is too short.\n"); - pioctl_req->data_read_written = 0; - pioctl_req->buf_len_needed = sizeof(mlan_ds_11ax_cfg); - pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; - LEAVE(); - return MLAN_STATUS_RESOURCE; - } - - cfg = (mlan_ds_11ax_cfg *) pioctl_req->pbuf; + cfg = (mlan_ds_11ax_cfg *)pioctl_req->pbuf; if ((cfg->param.he_cfg.band & MBIT(0)) && !(pmadapter->fw_bands & BAND_GAX)) { @@ -529,15 +695,15 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11ax_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11ax_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11ax_cfg *cfg = MNULL; ENTER(); - cfg = (mlan_ds_11ax_cfg *) pioctl_req->pbuf; + cfg = (mlan_ds_11ax_cfg *)pioctl_req->pbuf; switch (cfg->sub_command) { case MLAN_OID_11AX_HE_CFG: status = wlan_11ax_ioctl_hecfg(pmadapter, pioctl_req); @@ -566,13 +732,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11ax_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_11AX_CFG *axcfg = &cmd->params.axcfg; - mlan_ds_11ax_he_cfg *hecfg = (mlan_ds_11ax_he_cfg *) pdata_buf; + mlan_ds_11ax_he_cfg *hecfg = (mlan_ds_11ax_he_cfg *)pdata_buf; MrvlIEtypes_Extension_t *tlv = MNULL; t_u8 *pos = MNULL; @@ -586,7 +751,7 @@ pos = (t_u8 *)axcfg->val; /**HE Capability */ if (hecfg->he_cap.len && (hecfg->he_cap.ext_id == HE_CAPABILITY)) { - tlv = (MrvlIEtypes_Extension_t *) pos; + tlv = (MrvlIEtypes_Extension_t *)pos; tlv->type = wlan_cpu_to_le16(hecfg->he_cap.id); tlv->len = wlan_cpu_to_le16(hecfg->he_cap.len); memcpy_ext(pmadapter, &tlv->ext_id, &hecfg->he_cap.ext_id, @@ -595,13 +760,11 @@ cmd->size += hecfg->he_cap.len + sizeof(MrvlIEtypesHeader_t); pos += hecfg->he_cap.len + sizeof(MrvlIEtypesHeader_t); } - cmd->size = wlan_cpu_to_le16(cmd->size); LEAVE(); return MLAN_STATUS_SUCCESS; } - /** * @brief This function handles the command response of 11axcfg * @@ -611,9 +774,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11ax_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; mlan_ds_11ax_cfg *cfg = MNULL; @@ -627,13 +789,13 @@ if (pioctl_buf == MNULL) goto done; - cfg = (mlan_ds_11ax_cfg *) pioctl_buf->pbuf; + cfg = (mlan_ds_11ax_cfg *)pioctl_buf->pbuf; cfg->param.he_cfg.band = axcfg->band_config; - hecap = (mlan_ds_11ax_he_capa *) & cfg->param.he_cfg.he_cap; + hecap = (mlan_ds_11ax_he_capa *)&cfg->param.he_cfg.he_cap; /* TLV parse */ left_len = resp->size - sizeof(HostCmd_DS_11AX_CFG) - S_DS_GEN; - tlv = (MrvlIEtypes_Extension_t *) axcfg->val; + tlv = (MrvlIEtypes_Extension_t *)axcfg->val; while (left_len > sizeof(MrvlIEtypesHeader_t)) { tlv_type = wlan_le16_to_cpu(tlv->type); @@ -646,35 +808,33 @@ memcpy_ext(pmadapter, (t_u8 *)&hecap->ext_id, (t_u8 *)&tlv->ext_id, tlv_len, sizeof(mlan_ds_11ax_he_capa) - - sizeof(MrvlIEtypesHeader_t)); + sizeof(MrvlIEtypesHeader_t)); if (cfg->param.he_cfg.band & MBIT(1)) { - memcpy_ext(pmadapter, - (t_u8 *)&pmpriv->user_he_cap, - (t_u8 *)tlv, - tlv_len + - sizeof(MrvlIEtypesHeader_t), - sizeof(pmpriv->user_he_cap)); - pmpriv->user_hecap_len = MIN(tlv_len + - sizeof - (MrvlIEtypesHeader_t), - sizeof - (pmpriv-> - user_he_cap)); + memcpy_ext( + pmadapter, + (t_u8 *)&pmpriv->user_he_cap, + (t_u8 *)tlv, + tlv_len + + sizeof(MrvlIEtypesHeader_t), + sizeof(pmpriv->user_he_cap)); + pmpriv->user_hecap_len = MIN( + tlv_len + + sizeof(MrvlIEtypesHeader_t), + sizeof(pmpriv->user_he_cap)); PRINTM(MCMND, "user_hecap_len=%d\n", pmpriv->user_hecap_len); } else { - memcpy_ext(pmadapter, - (t_u8 *)&pmpriv-> - user_2g_he_cap, (t_u8 *)tlv, - tlv_len + - sizeof(MrvlIEtypesHeader_t), - sizeof(pmpriv-> - user_2g_he_cap)); - pmpriv->user_2g_hecap_len = - MIN(tlv_len + - sizeof(MrvlIEtypesHeader_t), - sizeof(pmpriv-> - user_2g_he_cap)); + memcpy_ext( + pmadapter, + (t_u8 *)&pmpriv->user_2g_he_cap, + (t_u8 *)tlv, + tlv_len + + sizeof(MrvlIEtypesHeader_t), + sizeof(pmpriv->user_2g_he_cap)); + pmpriv->user_2g_hecap_len = MIN( + tlv_len + + sizeof(MrvlIEtypesHeader_t), + sizeof(pmpriv->user_2g_he_cap)); PRINTM(MCMND, "user_2g_hecap_len=%d\n", pmpriv->user_2g_hecap_len); } @@ -685,8 +845,8 @@ } left_len -= (sizeof(MrvlIEtypesHeader_t) + tlv_len); - tlv = (MrvlIEtypes_Extension_t *) ((t_u8 *)tlv + tlv_len + - sizeof(MrvlIEtypesHeader_t)); + tlv = (MrvlIEtypes_Extension_t *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } done: @@ -702,8 +862,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11ax_cmd_cfg *cfg = MNULL; @@ -720,7 +880,7 @@ LEAVE(); return MLAN_STATUS_RESOURCE; } - cfg = (mlan_ds_11ax_cmd_cfg *) pioctl_req->pbuf; + cfg = (mlan_ds_11ax_cmd_cfg *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; @@ -746,25 +906,24 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11ax_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_11AX_CMD_CFG *axcmd = &cmd->params.axcmd; - mlan_ds_11ax_cmd_cfg *ds_11ax_cmd = (mlan_ds_11ax_cmd_cfg *) pdata_buf; + mlan_ds_11ax_cmd_cfg *ds_11ax_cmd = (mlan_ds_11ax_cmd_cfg *)pdata_buf; mlan_ds_11ax_sr_cmd *sr_cmd = - (mlan_ds_11ax_sr_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_sr_cmd *)&ds_11ax_cmd->param; mlan_ds_11ax_beam_cmd *beam_cmd = - (mlan_ds_11ax_beam_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_beam_cmd *)&ds_11ax_cmd->param; mlan_ds_11ax_htc_cmd *htc_cmd = - (mlan_ds_11ax_htc_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_htc_cmd *)&ds_11ax_cmd->param; mlan_ds_11ax_txop_cmd *txop_cmd = - (mlan_ds_11ax_txop_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_txop_cmd *)&ds_11ax_cmd->param; mlan_ds_11ax_txomi_cmd *txomi_cmd = - (mlan_ds_11ax_txomi_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_txomi_cmd *)&ds_11ax_cmd->param; mlan_ds_11ax_toltime_cmd *toltime_cmd = - (mlan_ds_11ax_toltime_cmd *) & ds_11ax_cmd->param; + (mlan_ds_11ax_toltime_cmd *)&ds_11ax_cmd->param; MrvlIEtypes_Data_t *tlv = MNULL; ENTER(); @@ -798,8 +957,9 @@ break; case MLAN_11AXCMD_TXOMI_SUBID: memcpy_ext(pmadapter, axcmd->val, &txomi_cmd->omi, - sizeof(t_u16), sizeof(t_u16)); - cmd->size += sizeof(t_u16); + sizeof(mlan_ds_11ax_txomi_cmd), + sizeof(mlan_ds_11ax_txomi_cmd)); + cmd->size += sizeof(mlan_ds_11ax_txomi_cmd); break; case MLAN_11AXCMD_OBSS_TOLTIME_SUBID: memcpy_ext(pmadapter, axcmd->val, &toltime_cmd->tol_time, @@ -826,9 +986,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11ax_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; mlan_ds_11ax_cmd_cfg *cfg = MNULL; @@ -842,7 +1001,7 @@ if (pioctl_buf == MNULL) goto done; - cfg = (mlan_ds_11ax_cmd_cfg *) pioctl_buf->pbuf; + cfg = (mlan_ds_11ax_cmd_cfg *)pioctl_buf->pbuf; cfg->sub_id = wlan_le16_to_cpu(axcmd->sub_id); switch (axcmd->sub_id) { @@ -854,13 +1013,14 @@ tlv = (MrvlIEtypes_Data_t *)axcmd->val; while (left_len > (t_s16)sizeof(MrvlIEtypesHeader_t)) { tlv_len = wlan_le16_to_cpu(tlv->header.len); - memcpy_ext(pmadapter, - cfg->param.sr_cfg.param.obss_pd_offset. - offset, tlv->data, tlv_len, tlv_len); + memcpy_ext( + pmadapter, + cfg->param.sr_cfg.param.obss_pd_offset.offset, + tlv->data, tlv_len, tlv_len); left_len -= (sizeof(MrvlIEtypesHeader_t) + tlv_len); tlv = (MrvlIEtypes_Data_t - *)((t_u8 *)tlv + tlv_len + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } break; case MLAN_11AXCMD_BEAM_SUBID: @@ -875,7 +1035,8 @@ break; case MLAN_11AXCMD_TXOMI_SUBID: memcpy_ext(pmadapter, &cfg->param.txomi_cfg.omi, axcmd->val, - sizeof(t_u16), sizeof(t_u16)); + sizeof(mlan_ds_11ax_txomi_cmd), + sizeof(mlan_ds_11ax_txomi_cmd)); break; case MLAN_11AXCMD_OBSS_TOLTIME_SUBID: memcpy_ext(pmadapter, &cfg->param.toltime_cfg.tol_time, @@ -901,14 +1062,13 @@ * @param pdata_buf A pointer to data buffer * @return Status returned */ -mlan_status -wlan_cmd_twt_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_TWT_CFG *hostcmd_twtcfg = - (HostCmd_DS_TWT_CFG *) & cmd->params.twtcfg; - mlan_ds_twtcfg *ds_twtcfg = (mlan_ds_twtcfg *) pdata_buf; + (HostCmd_DS_TWT_CFG *)&cmd->params.twtcfg; + mlan_ds_twtcfg *ds_twtcfg = (mlan_ds_twtcfg *)pdata_buf; hostcmd_twt_setup *twt_setup_params = MNULL; hostcmd_twt_teardown *twt_teardown_params = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -920,7 +1080,7 @@ hostcmd_twtcfg->sub_id = wlan_cpu_to_le16(ds_twtcfg->sub_id); cmd->size = S_DS_GEN + sizeof(hostcmd_twtcfg->action) + - sizeof(hostcmd_twtcfg->sub_id); + sizeof(hostcmd_twtcfg->sub_id); switch (hostcmd_twtcfg->sub_id) { case MLAN_11AX_TWT_SETUP_SUBID: @@ -945,9 +1105,8 @@ ds_twtcfg->param.twt_setup.hard_constraint; twt_setup_params->twt_exponent = ds_twtcfg->param.twt_setup.twt_exponent; - twt_setup_params->twt_mantissa = - wlan_cpu_to_le16(ds_twtcfg->param.twt_setup. - twt_mantissa); + twt_setup_params->twt_mantissa = wlan_cpu_to_le16( + ds_twtcfg->param.twt_setup.twt_mantissa); twt_setup_params->twt_request = ds_twtcfg->param.twt_setup.twt_request; cmd->size += sizeof(hostcmd_twtcfg->param.twt_setup); @@ -984,8 +1143,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11ax_ioctl_twtcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11ax_ioctl_twtcfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1003,7 +1162,7 @@ return MLAN_STATUS_RESOURCE; } - cfg = (mlan_ds_twtcfg *) pioctl_req->pbuf; + cfg = (mlan_ds_twtcfg *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET;
diff --git a/wlan_sd8987/mlan/mlan_11ax.h b/wlan_sd8987/mlan/mlan_11ax.h index 4c16a70..3125551 100755 --- a/wlan_sd8987/mlan/mlan_11ax.h +++ b/wlan_sd8987/mlan/mlan_11ax.h
@@ -3,7 +3,7 @@ * @brief This file contains the functions for station ioctl. * * - * Copyright 2018-2020 NXP + * Copyright 2018-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -42,32 +42,32 @@ BSSDescriptor_t *pbss_desc); mlan_status wlan_11ax_ioctl_twtcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); -t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u8 band, - MrvlIEtypes_Extension_t * phe_cap, t_u8 flag); +mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +t_u8 wlan_fill_he_cap_ie(mlan_private *pmpriv, IEEEtypes_HECap_t *hecap_ie, + t_u16 band); +t_u8 wlan_fill_he_op_ie(mlan_private *pmpriv, IEEEtypes_HeOp_t *heop_ie); +t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, + MrvlIEtypes_Extension_t *phe_cap, t_u8 flag); void wlan_update_11ax_cap(mlan_adapter *pmadapter, - MrvlIEtypes_Extension_t * hw_he_cap); + MrvlIEtypes_Extension_t *hw_he_cap); + int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer); -t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band); +t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc); mlan_status wlan_11ax_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_11ax_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); -mlan_status wlan_ret_11ax_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_cmd_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_11ax_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); -mlan_status wlan_ret_11ax_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_cmd_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #endif /* _MLAN_11AX_H_ */
diff --git a/wlan_sd8987/mlan/mlan_11d.c b/wlan_sd8987/mlan/mlan_11d.c index 445d84f..947d146 100755 --- a/wlan_sd8987/mlan/mlan_11d.c +++ b/wlan_sd8987/mlan/mlan_11d.c
@@ -3,7 +3,7 @@ * @brief This file contains functions for 802.11D. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -46,19 +46,19 @@ /** Region code mapping table */ static region_code_mapping_t region_code_mapping[] = { - {"US ", 0x10}, /* US FCC */ - {"CA ", 0x20}, /* IC Canada */ - {"SG ", 0x10}, /* Singapore */ - {"EU ", 0x30}, /* ETSI */ - {"AU ", 0x30}, /* Australia */ - {"KR ", 0x30}, /* Republic Of Korea */ - {"FR ", 0x32}, /* France */ - {"JP ", 0x40}, /* Japan */ - {"JP ", 0x41}, /* Japan */ - {"CN ", 0x50}, /* China */ - {"JP ", 0xFE}, /* Japan */ - {"JP ", 0xFF}, /* Japan special */ - {"NE ", 0x30}, /* New Zeland */ + {"US ", 0x10}, /* US FCC */ + {"CA ", 0x20}, /* IC Canada */ + {"SG ", 0x10}, /* Singapore */ + {"EU ", 0x30}, /* ETSI */ + {"AU ", 0x30}, /* Australia */ + {"KR ", 0x30}, /* Republic Of Korea */ + {"FR ", 0x32}, /* France */ + {"JP ", 0x40}, /* Japan */ + {"JP ", 0x41}, /* Japan */ + {"CN ", 0x50}, /* China */ + {"JP ", 0xFE}, /* Japan */ + {"JP ", 0xFF}, /* Japan special */ + {"NE ", 0x30}, /* New Zeland */ }; /** Universal region code */ @@ -119,14 +119,16 @@ {153, 5765, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} + {165, 5825, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, + {169, 5845, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, + {173, 5865, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, + {177, 5885, TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} /* {240, 4920, TX_PWR_DEFAULT}, - {244, 4940, TX_PWR_DEFAULT}, - {248, 4960, TX_PWR_DEFAULT}, - {252, 4980, TX_PWR_DEFAULT}, - channels for 11J JP 10M channel gap */ + {244, 4940, TX_PWR_DEFAULT}, + {248, 4960, TX_PWR_DEFAULT}, + {252, 4980, TX_PWR_DEFAULT}, + channels for 11J JP 10M channel gap */ }; - /******************************************************** Global Variables ********************************************************/ @@ -143,8 +145,7 @@ * * @return Region string */ -static t_u8 * -wlan_11d_code_2_region(pmlan_adapter pmadapter, t_u8 code) +static t_u8 *wlan_11d_code_2_region(pmlan_adapter pmadapter, t_u8 code) { t_u8 i; @@ -173,9 +174,9 @@ * * @return MTRUE or MFALSE */ -static t_u8 -wlan_11d_channel_known(pmlan_adapter pmadapter, t_u8 band, - t_u8 chan, parsed_region_chan_11d_t *parsed_region_chan) +static t_u8 wlan_11d_channel_known(pmlan_adapter pmadapter, t_u16 band, + t_u8 chan, + parsed_region_chan_11d_t *parsed_region_chan) { chan_power_11d_t *pchan_pwr = parsed_region_chan->chan_pwr; t_u8 no_of_chan = parsed_region_chan->no_of_chan; @@ -200,9 +201,8 @@ * AP on it */ pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_STA); - if (pmpriv && - wlan_11h_radar_detect_required(pmpriv, - chan)) { + if (pmpriv && wlan_11h_radar_detect_required( + pmpriv, chan)) { PRINTM(MINFO, "11H: DFS channel %d, and ap_seen=%d\n", chan, pchan_pwr[i].ap_seen); @@ -230,11 +230,9 @@ * * @return N/A */ -static t_void -wlan_11d_generate_parsed_region_chan(pmlan_adapter pmadapter, - region_chan_t *region_chan, - parsed_region_chan_11d_t - *parsed_region_chan) +static t_void wlan_11d_generate_parsed_region_chan( + pmlan_adapter pmadapter, region_chan_t *region_chan, + parsed_region_chan_11d_t *parsed_region_chan) { chan_freq_power_t *cfp; t_u8 i; @@ -298,6 +296,8 @@ /* Should be only place that clear domain_reg (besides init) */ memset(pmadapter, domain_info, 0, sizeof(wlan_802_11d_domain_reg_t)); + domain_info->dfs_region = NXP_DFS_UNKNOWN; + /* Set country code */ memcpy_ext(pmadapter, domain_info->country_code, wlan_11d_code_2_region(pmadapter, @@ -351,7 +351,7 @@ domain_info->no_of_sub_band); HEXDUMP("11D: domain_info", (t_u8 *)domain_info, COUNTRY_CODE_LEN + 1 + - sizeof(IEEEtypes_SubbandSet_t) * no_of_sub_band); + sizeof(IEEEtypes_SubbandSet_t) * no_of_sub_band); LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -365,8 +365,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_11d_update_chan_pwr_table(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) +static mlan_status wlan_11d_update_chan_pwr_table(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { mlan_adapter *pmadapter = pmpriv->adapter; parsed_region_chan_11d_t *parsed_region_chan = @@ -379,7 +379,8 @@ chan = pbss_desc->phy_param_set.ds_param_set.current_chan; - tx_power = wlan_get_txpwr_of_chan_from_cfp(pmpriv, chan); + tx_power = wlan_get_txpwr_of_chan_from_cfp(pmpriv, pbss_desc->bss_band, + chan); if (!tx_power) { PRINTM(MMSG, "11D: Invalid channel\n"); @@ -394,12 +395,11 @@ i++) { if (parsed_region_chan->chan_pwr[i].chan == chan && parsed_region_chan->chan_pwr[i].band == - pbss_desc->bss_band) { + pbss_desc->bss_band) { /* Channel already exists, use minimum of existing and tx_power */ - parsed_region_chan->chan_pwr[i].pwr = - MIN(parsed_region_chan->chan_pwr[i].pwr, - tx_power); + parsed_region_chan->chan_pwr[i].pwr = MIN( + parsed_region_chan->chan_pwr[i].pwr, tx_power); parsed_region_chan->chan_pwr[i].ap_seen = MTRUE; break; } @@ -409,8 +409,7 @@ /* Channel not found. Update the channel in the channel-power table */ parsed_region_chan->chan_pwr[i].chan = chan; - parsed_region_chan->chan_pwr[i].band = - (t_u8)pbss_desc->bss_band; + parsed_region_chan->chan_pwr[i].band = pbss_desc->bss_band; parsed_region_chan->chan_pwr[i].pwr = tx_power; parsed_region_chan->chan_pwr[i].ap_seen = MTRUE; parsed_region_chan->no_of_chan++; @@ -431,9 +430,8 @@ * * @return MTRUE or MFALSE */ -static t_u8 -wlan_11d_get_chan(pmlan_adapter pmadapter, t_u8 band, - t_u8 first_chan, t_u8 no_of_chan, t_u8 *chan) +static t_u8 wlan_11d_get_chan(pmlan_adapter pmadapter, t_u16 band, + t_u8 first_chan, t_u8 no_of_chan, t_u8 *chan) { chan_freq_power_t *cfp = MNULL; t_u8 i; @@ -481,8 +479,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_11d_process_country_info(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) +static mlan_status wlan_11d_process_country_info(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { mlan_adapter *pmadapter = pmpriv->adapter; parsed_region_chan_11d_t region_chan; @@ -496,7 +494,7 @@ /* Parse 11D country info */ if (wlan_11d_parse_domain_info(pmadapter, &pbss_desc->country_info, - (t_u8)pbss_desc->bss_band, + pbss_desc->bss_band, ®ion_chan) != MLAN_STATUS_SUCCESS) { LEAVE(); return MLAN_STATUS_FAILURE; @@ -510,18 +508,19 @@ for (i = 0; (i < region_chan.no_of_chan && i < MAX_NO_OF_CHAN); i++) { for (j = 0; (j < parsed_region_chan->no_of_chan && - j < MAX_NO_OF_CHAN); j++) { + j < MAX_NO_OF_CHAN); + j++) { /* * Channel already exists, update the tx power * with new tx power, since country IE is valid * here. */ if (region_chan.chan_pwr[i].chan == - parsed_region_chan->chan_pwr[j] - .chan && + parsed_region_chan->chan_pwr[j] + .chan && region_chan.chan_pwr[i].band == - parsed_region_chan->chan_pwr[j] - .band) { + parsed_region_chan->chan_pwr[j] + .band) { parsed_region_chan->chan_pwr[j].pwr = region_chan.chan_pwr[i].pwr; break; @@ -535,21 +534,25 @@ * table, update this new chan and tx_power * to the channel power table */ - parsed_region_chan-> - chan_pwr[parsed_region_chan-> - no_of_chan + num_chan_added] + parsed_region_chan + ->chan_pwr[parsed_region_chan + ->no_of_chan + + num_chan_added] .chan = region_chan.chan_pwr[i].chan; - parsed_region_chan-> - chan_pwr[parsed_region_chan-> - no_of_chan + num_chan_added] + parsed_region_chan + ->chan_pwr[parsed_region_chan + ->no_of_chan + + num_chan_added] .band = region_chan.chan_pwr[i].band; - parsed_region_chan-> - chan_pwr[parsed_region_chan-> - no_of_chan + num_chan_added] + parsed_region_chan + ->chan_pwr[parsed_region_chan + ->no_of_chan + + num_chan_added] .pwr = region_chan.chan_pwr[i].pwr; - parsed_region_chan-> - chan_pwr[parsed_region_chan-> - no_of_chan + num_chan_added] + parsed_region_chan + ->chan_pwr[parsed_region_chan + ->no_of_chan + + num_chan_added] .ap_seen = MFALSE; num_chan_added++; } @@ -574,8 +577,8 @@ * * @return N/A */ -static t_void -wlan_11d_copy_chan_power(chan_power_11d_t *chan_dst, chan_power_11d_t *chan_src) +static t_void wlan_11d_copy_chan_power(chan_power_11d_t *chan_dst, + chan_power_11d_t *chan_src) { ENTER(); @@ -634,8 +637,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_11d_send_domain_info(mlan_private *pmpriv, t_void *pioctl_buf) +static mlan_status wlan_11d_send_domain_info(mlan_private *pmpriv, + t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -660,13 +663,14 @@ * @param country_code Intended country code * @param num_sub_band Count of tuples in list below * @param sub_band_list List of sub_band tuples + * @param dfs_region 0-unset,1-fcc,2-etsi,3-JP, 0xff-unknown * * @return MLAN_STATUS_SUCCESS */ static mlan_status -wlan_11d_set_domain_info(mlan_private *pmpriv, t_u8 band, +wlan_11d_set_domain_info(mlan_private *pmpriv, t_u16 band, t_u8 country_code[COUNTRY_CODE_LEN], t_u8 num_sub_band, - IEEEtypes_SubbandSet_t *sub_band_list) + IEEEtypes_SubbandSet_t *sub_band_list, t_u8 dfs_region) { mlan_adapter *pmadapter = pmpriv->adapter; wlan_802_11d_domain_reg_t *pdomain = &pmadapter->domain_reg; @@ -675,6 +679,7 @@ ENTER(); memset(pmadapter, pdomain, 0, sizeof(wlan_802_11d_domain_reg_t)); + pdomain->dfs_region = dfs_region; memcpy_ext(pmadapter, pdomain->country_code, country_code, COUNTRY_CODE_LEN, COUNTRY_CODE_LEN); pdomain->band = band; @@ -698,8 +703,7 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_is_station(mlan_private *pmpriv) +t_bool wlan_is_station(mlan_private *pmpriv) { ENTER(); LEAVE(); @@ -713,14 +717,14 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_11d_is_enabled(mlan_private *pmpriv) +t_bool wlan_11d_is_enabled(mlan_private *pmpriv) { ENTER(); LEAVE(); return (pmpriv->state_11d.enable_11d == ENABLE_11D && pmpriv->state_11d.user_enable_11d == ENABLE_11D) ? - MTRUE : MFALSE; + MTRUE : + MFALSE; } /** @@ -730,8 +734,7 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_fw_11d_is_enabled(mlan_private *pmpriv) +t_bool wlan_fw_11d_is_enabled(mlan_private *pmpriv) { ENTER(); LEAVE(); @@ -745,8 +748,7 @@ * * @return N/A */ -t_void -wlan_11d_priv_init(mlan_private *pmpriv) +t_void wlan_11d_priv_init(mlan_private *pmpriv) { wlan_802_11d_state_t *state = &pmpriv->state_11d; @@ -759,7 +761,8 @@ else state->user_enable_11d = (pmpriv->adapter->init_para.cfg_11d == MLAN_INIT_PARA_DISABLED) ? - DISABLE_11D : ENABLE_11D; + DISABLE_11D : + ENABLE_11D; LEAVE(); return; @@ -772,8 +775,7 @@ * * @return N/A */ -t_void -wlan_11d_init(mlan_adapter *pmadapter) +t_void wlan_11d_init(mlan_adapter *pmadapter) { ENTER(); @@ -799,8 +801,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_enable(mlan_private *pmpriv, t_void *pioctl_buf, state_11d_t flag) +mlan_status wlan_11d_enable(mlan_private *pmpriv, t_void *pioctl_buf, + state_11d_t flag) { #ifdef STA_SUPPORT mlan_adapter *pmadapter = pmpriv->adapter; @@ -841,22 +843,24 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11d_domain_info(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action) +mlan_status wlan_cmd_802_11d_domain_info(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action) { mlan_adapter *pmadapter = pmpriv->adapter; HostCmd_DS_802_11D_DOMAIN_INFO *pdomain_info = &pcmd->params.domain_info; MrvlIEtypes_DomainParamSet_t *domain = &pdomain_info->domain; t_u8 no_of_sub_band = pmadapter->domain_reg.no_of_sub_band; + MrvlIEtypes_Rgn_dom_code_t *rgn = MNULL; t_u8 i; ENTER(); - PRINTM(MCMND, "11D:Country=%c%c band=%d sub-band=5d\n", + PRINTM(MCMND, "11D:Country=%c%c band=%d sub-band=%d dfs_region=%d\n", pmadapter->domain_reg.country_code[0], pmadapter->domain_reg.country_code[1], - pmadapter->domain_reg.band, no_of_sub_band); + pmadapter->domain_reg.band, no_of_sub_band, + pmadapter->domain_reg.dfs_region); for (i = 0; i < no_of_sub_band; i++) { PRINTM(MCMND, "11D: first chan=%d no_of_chan=%d, max_tx_pwr=%d\n", @@ -892,19 +896,27 @@ pmadapter->domain_reg.sub_band, no_of_sub_band * sizeof(IEEEtypes_SubbandSet_t), MRVDRV_MAX_SUBBAND_802_11D * - sizeof(IEEEtypes_SubbandSet_t)); + sizeof(IEEEtypes_SubbandSet_t)); - pcmd->size = - wlan_cpu_to_le16(sizeof(pdomain_info->action) + - domain->header.len + - sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN); + pcmd->size = sizeof(pdomain_info->action) + domain->header.len + + sizeof(MrvlIEtypesHeader_t) + S_DS_GEN; + + if (pmadapter->domain_reg.dfs_region != NXP_DFS_UNKNOWN) { + rgn = (MrvlIEtypes_Rgn_dom_code_t + *)((t_u8 *)&pdomain_info->domain + + domain->header.len + + sizeof(MrvlIEtypesHeader_t)); + rgn->header.type = + wlan_cpu_to_le16(TLV_TYPE_REGION_DOMAIN_CODE); + rgn->header.len = 2; + rgn->domain_code = pmadapter->domain_reg.dfs_region; + pcmd->size += sizeof(MrvlIEtypes_Rgn_dom_code_t); + } } else { - pcmd->size = wlan_cpu_to_le16(sizeof(pdomain_info->action) + - S_DS_GEN); + pcmd->size = sizeof(pdomain_info->action) + S_DS_GEN; } domain->header.len = wlan_cpu_to_le16(domain->header.len); - + pcmd->size = wlan_cpu_to_le16(pcmd->size); HEXDUMP("11D: 802_11D_DOMAIN_INFO", (t_u8 *)pcmd, wlan_le16_to_cpu(pcmd->size)); @@ -920,8 +932,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11d_domain_info(mlan_private *pmpriv, HostCmd_DS_COMMAND *resp) +mlan_status wlan_ret_802_11d_domain_info(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_802_11D_DOMAIN_INFO_RSP *domain_info = @@ -950,7 +962,7 @@ } switch (action) { - case HostCmd_ACT_GEN_SET: /* Proc Set Action */ + case HostCmd_ACT_GEN_SET: /* Proc Set Action */ break; case HostCmd_ACT_GEN_GET: break; @@ -973,8 +985,7 @@ * * @return Channel frequency */ -t_u32 -wlan_11d_chan_2_freq(pmlan_adapter pmadapter, t_u8 chan, t_u8 band) +t_u32 wlan_11d_chan_2_freq(pmlan_adapter pmadapter, t_u8 chan, t_u16 band) { chan_freq_power_t *cf; t_u16 cnt; @@ -983,15 +994,19 @@ ENTER(); - /* Get channel-frequency-power trios */ - if (band & (BAND_A | BAND_AN | BAND_AAC)) { - cf = channel_freq_power_UN_AJ; - cnt = NELEMENTS(channel_freq_power_UN_AJ); - } else { + if (band & (BAND_B | BAND_G | BAND_GN | BAND_GAC)) { cf = channel_freq_power_UN_BG; cnt = NELEMENTS(channel_freq_power_UN_BG); } - + /* Get channel-frequency-power trios */ + else if (band & (BAND_A | BAND_AN | BAND_AAC)) { + cf = channel_freq_power_UN_AJ; + cnt = NELEMENTS(channel_freq_power_UN_AJ); + } else { + PRINTM(MERROR, "11D: Wrong Band [%d]\n", band); + LEAVE(); + return 0; + } /* Locate channel and return corresponding frequency */ for (i = 0; i < cnt; i++) { if (chan == cf[i].channel) @@ -1013,11 +1028,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_parse_domain_info(pmlan_adapter pmadapter, - IEEEtypes_CountryInfoFullSet_t *country_info, - t_u8 band, - parsed_region_chan_11d_t *parsed_region_chan) +mlan_status wlan_11d_parse_domain_info( + pmlan_adapter pmadapter, IEEEtypes_CountryInfoFullSet_t *country_info, + t_u16 band, parsed_region_chan_11d_t *parsed_region_chan) { t_u8 no_of_sub_band, no_of_chan; t_u8 last_chan, first_chan, cur_chan = 0; @@ -1047,7 +1060,7 @@ } no_of_sub_band = (country_info->len - COUNTRY_CODE_LEN) / - sizeof(IEEEtypes_SubbandSet_t); + sizeof(IEEEtypes_SubbandSet_t); for (j = 0, last_chan = 0; j < no_of_sub_band; j++) { if (country_info->sub_band[j].first_chan <= last_chan) { @@ -1105,8 +1118,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_11d_set_universaltable(mlan_private *pmpriv, t_u8 band) +mlan_status wlan_11d_set_universaltable(mlan_private *pmpriv, t_u16 band) { mlan_adapter *pmadapter = pmpriv->adapter; t_u16 i = 0; @@ -1117,7 +1129,7 @@ sizeof(pmadapter->universal_channel)); if (band & (BAND_B | BAND_G | BAND_GN)) - /* If band B, G or N */ + /* If band B, G or N */ { /* Set channel-frequency-power */ pmadapter->universal_channel[i].num_cfp = @@ -1176,9 +1188,8 @@ * @return PASSIVE if chan is unknown; ACTIVE * if chan is known */ -t_u8 -wlan_11d_get_scan_type(pmlan_adapter pmadapter, t_u8 band, t_u8 chan, - parsed_region_chan_11d_t *parsed_region_chan) +t_u8 wlan_11d_get_scan_type(pmlan_adapter pmadapter, t_u16 band, t_u8 chan, + parsed_region_chan_11d_t *parsed_region_chan) { t_u8 scan_type = MLAN_SCAN_TYPE_PASSIVE; @@ -1203,8 +1214,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_clear_parsedtable(mlan_private *pmpriv) +mlan_status wlan_11d_clear_parsedtable(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1230,8 +1240,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_create_dnld_countryinfo(mlan_private *pmpriv, t_u8 band) +mlan_status wlan_11d_create_dnld_countryinfo(mlan_private *pmpriv, t_u16 band) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -1328,9 +1337,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_parse_dnld_countryinfo(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc) +mlan_status wlan_11d_parse_dnld_countryinfo(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -1354,21 +1362,20 @@ if (pbss_desc) { /* Parse domain info if available */ - ret = wlan_11d_parse_domain_info(pmadapter, - &pbss_desc-> - country_info, - (t_u8)pbss_desc-> - bss_band, - &bssdesc_region_chan); + ret = wlan_11d_parse_domain_info( + pmadapter, &pbss_desc->country_info, + pbss_desc->bss_band, &bssdesc_region_chan); if (ret == MLAN_STATUS_SUCCESS) { /* Update the channel-power table */ for (i = 0; ((i < bssdesc_region_chan.no_of_chan) && - (i < MAX_NO_OF_CHAN)); i++) { + (i < MAX_NO_OF_CHAN)); + i++) { for (j = 0; ((j < region_chan.no_of_chan) && - (j < MAX_NO_OF_CHAN)); j++) { + (j < MAX_NO_OF_CHAN)); + j++) { /* * Channel already exists, use * minimum of existing tx power @@ -1377,23 +1384,23 @@ * AP */ if (region_chan.chan_pwr[i] - .chan == - bssdesc_region_chan. - chan_pwr[j] - .chan && + .chan == + bssdesc_region_chan + .chan_pwr[j] + .chan && region_chan.chan_pwr[i] - .band == - bssdesc_region_chan. - chan_pwr[j] - .band) { + .band == + bssdesc_region_chan + .chan_pwr[j] + .band) { region_chan.chan_pwr[j] - .pwr = - MIN(region_chan. - chan_pwr[j] - .pwr, - bssdesc_region_chan. - chan_pwr[i] - .pwr); + .pwr = MIN( + region_chan + .chan_pwr[j] + .pwr, + bssdesc_region_chan + .chan_pwr[i] + .pwr); break; } } @@ -1424,8 +1431,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_prepare_dnld_domain_info_cmd(mlan_private *pmpriv) +mlan_status wlan_11d_prepare_dnld_domain_info_cmd(mlan_private *pmpriv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -1440,30 +1446,26 @@ pcountry_full = &pmadapter->pscan_table[idx].country_info; - ret = wlan_11d_update_chan_pwr_table(pmpriv, - &pmadapter-> - pscan_table[idx]); + ret = wlan_11d_update_chan_pwr_table( + pmpriv, &pmadapter->pscan_table[idx]); if (*(pcountry_full->country_code) != 0 && (pcountry_full->len > COUNTRY_CODE_LEN)) { /* Country info found in the BSS Descriptor */ - ret = wlan_11d_process_country_info(pmpriv, - &pmadapter-> - pscan_table - [idx]); + ret = wlan_11d_process_country_info( + pmpriv, &pmadapter->pscan_table[idx]); } } /* Sort parsed_region_chan in ascending channel number */ - wlan_11d_sort_parsed_region_chan(&pmadapter-> - parsed_region_chan); + wlan_11d_sort_parsed_region_chan( + &pmadapter->parsed_region_chan); /* Check if connected */ if (pmpriv->media_connected == MTRUE) { - ret = wlan_11d_parse_dnld_countryinfo(pmpriv, - &pmpriv-> - curr_bss_params. - bss_descriptor); + ret = wlan_11d_parse_dnld_countryinfo( + pmpriv, + &pmpriv->curr_bss_params.bss_descriptor); } else { ret = wlan_11d_parse_dnld_countryinfo(pmpriv, MNULL); } @@ -1482,8 +1484,8 @@ * * @return Pointer to the mapped country code string */ -static t_u8 * -wlan_11d_map_country_code(pmlan_adapter pmadapter, t_u8 *pcountry_code) +static t_u8 *wlan_11d_map_country_code(pmlan_adapter pmadapter, + t_u8 *pcountry_code) { /* Since firmware can only recognize EU as ETSI domain and there is no * memory left for some devices to convert it in firmware, driver need @@ -1504,8 +1506,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_cfg_domain_info(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +mlan_status wlan_11d_cfg_domain_info(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1521,29 +1523,31 @@ ret = MLAN_STATUS_FAILURE; goto done; } - if (!wlan_fw_11d_is_enabled(pmpriv)) - wlan_11d_enable(pmpriv, MNULL, ENABLE_11D); + if (!wlan_fw_11d_is_enabled(pmpriv)) { + ret = wlan_11d_enable(pmpriv, MNULL, ENABLE_11D); + if (ret) + PRINTM(MERROR, "Enabling 11D in FW failed\n"); + } cfg_11d = (mlan_ds_11d_cfg *)pioctl_req->pbuf; domain_info = &cfg_11d->param.domain_info; memcpy_ext(pmadapter, pmadapter->country_code, domain_info->country_code, COUNTRY_CODE_LEN, COUNTRY_CODE_LEN); - wlan_11d_set_domain_info(pmpriv, domain_info->band, - wlan_11d_map_country_code(pmadapter, - domain_info-> - country_code), - domain_info->no_of_sub_band, - (IEEEtypes_SubbandSet_t *)domain_info-> - sub_band); + wlan_11d_set_domain_info( + pmpriv, domain_info->band, + wlan_11d_map_country_code(pmadapter, domain_info->country_code), + domain_info->no_of_sub_band, + (IEEEtypes_SubbandSet_t *)domain_info->sub_band, + domain_info->dfs_region); ret = wlan_11d_send_domain_info(pmpriv, pioctl_req); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; /* Update region code and table based on country code */ - if (wlan_misc_country_2_cfp_table_code - (pmadapter, domain_info->country_code, &cfp_bg, &cfp_a)) { + if (wlan_misc_country_2_cfp_table_code( + pmadapter, domain_info->country_code, &cfp_bg, &cfp_a)) { PRINTM(MIOCTL, "Country code %c%c not found!\n", domain_info->country_code[0], domain_info->country_code[1]); @@ -1559,7 +1563,7 @@ pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, pmadapter->region_code, pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->adhoc_start_band)) { PRINTM(MIOCTL, "Fail to set regiontabl\n"); goto done; } @@ -1580,13 +1584,14 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u8 band, - t_u8 *domain_tlv, t_void *pioctl_buf) +mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, + t_u8 *domain_tlv, + t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; - MrvlIEtypes_DomainParamSet_t *pdomain_tlv; + MrvlIEtypes_DomainParamSet_t *pdomain_tlv = MNULL; + MrvlIEtypes_Rgn_dom_code_t *pregdomain_tlv = MNULL; t_u8 num_sub_band = 0; t_u8 cfp_bg = 0, cfp_a = 0; @@ -1594,10 +1599,16 @@ pdomain_tlv = (MrvlIEtypes_DomainParamSet_t *)domain_tlv; + if (pdomain_tlv->header.type == TLV_TYPE_DOMAIN) { + pregdomain_tlv = + (MrvlIEtypes_Rgn_dom_code_t + *)(domain_tlv + sizeof(MrvlIEtypesHeader_t) + + pdomain_tlv->header.len); + } /* update region code & table based on country string */ - if (wlan_misc_country_2_cfp_table_code - (pmadapter, pdomain_tlv->country_code, &cfp_bg, - &cfp_a) == MLAN_STATUS_SUCCESS) { + if (wlan_misc_country_2_cfp_table_code( + pmadapter, pdomain_tlv->country_code, &cfp_bg, &cfp_a) == + MLAN_STATUS_SUCCESS) { pmadapter->cfp_code_bg = cfp_bg; pmadapter->cfp_code_a = cfp_a; if (cfp_a) @@ -1608,7 +1619,7 @@ pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, pmadapter->region_code, pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->adhoc_start_band)) { ret = MLAN_STATUS_FAILURE; goto done; } @@ -1623,8 +1634,18 @@ /* TODO: don't just clobber pmadapter->domain_reg. * Add some checking or merging between STA & UAP domain_info */ - wlan_11d_set_domain_info(pmpriv, band, pdomain_tlv->country_code, - num_sub_band, pdomain_tlv->sub_band); + if (pregdomain_tlv && + (pregdomain_tlv->header.type == TLV_TYPE_REGION_DOMAIN_CODE)) { + wlan_11d_set_domain_info(pmpriv, band, + pdomain_tlv->country_code, + num_sub_band, pdomain_tlv->sub_band, + pregdomain_tlv->domain_code); + } else + wlan_11d_set_domain_info(pmpriv, band, + pdomain_tlv->country_code, + num_sub_band, pdomain_tlv->sub_band, + NXP_DFS_UNKNOWN); + ret = wlan_11d_send_domain_info(pmpriv, pioctl_buf); done:
diff --git a/wlan_sd8987/mlan/mlan_11h.c b/wlan_sd8987/mlan/mlan_11h.c index 838ece1..ce3b024 100755 --- a/wlan_sd8987/mlan/mlan_11h.c +++ b/wlan_sd8987/mlan/mlan_11h.c
@@ -54,25 +54,25 @@ #define WLAN_11H_TPC_POWERCAPABILITY_MAX 20 /** Regulatory requirement for the duration of a channel availability check */ -#define WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION 60000 /* in ms */ +#define WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION 60000 /* in ms */ /** Starting Frequency for 11A band */ -#define START_FREQ_11A_BAND 5000 /* in MHz */ +#define START_FREQ_11A_BAND 5000 /* in MHz */ /** DFS Channel Move Time */ -#define DFS_CHAN_MOVE_TIME 10 /* in sec */ +#define DFS_CHAN_MOVE_TIME 10 /* in sec */ /** Regulatory requirement for the duration of a non-occupancy period */ -#define WLAN_11H_NON_OCCUPANCY_PERIOD 1800 /* in sec (30mins) */ +#define WLAN_11H_NON_OCCUPANCY_PERIOD 1800 /* in sec (30mins) */ /** Maximum allowable age (seconds) on DFS report data */ -#define MAX_DFS_REPORT_USABLE_AGE_SEC (120) /* 2 minutes */ +#define MAX_DFS_REPORT_USABLE_AGE_SEC (120) /* 2 minutes */ /** Minimum delay for CHAN_SW IE to broadcast by FW */ -#define MIN_RDH_CHAN_SW_IE_PERIOD_MSEC (400) /* 4 beacons @ 100ms */ +#define MIN_RDH_CHAN_SW_IE_PERIOD_MSEC (400) /* 4 beacons @ 100ms */ /** Maximum delay for CHAN_SW IE to broadcast by FW */ -#define MAX_RDH_CHAN_SW_IE_PERIOD_MSEC (3000) /* 5 beacons @ 600ms */ +#define MAX_RDH_CHAN_SW_IE_PERIOD_MSEC (3000) /* 5 beacons @ 600ms */ /** Maximum retries on selecting new random channel */ #define MAX_RANDOM_CHANNEL_RETRIES (20) @@ -84,54 +84,42 @@ #define RDH_STAGE_FIRST_ENTRY_PRIV_IDX (0xff) /** Region codes 0x10, 0x20: channels 1 thru 11 supported */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_FCC = { 1, - 11 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_FCC = {1, 11}; /** Region codes 0x30, 0x32, 0x41, 0x50: channels 1 thru 13 supported */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_EU = { 1, - 13 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_EU = {1, 13}; /** Region code 0x40: only channel 14 supported */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_JPN40 = { 14, - 1 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_2_4G_region_JPN40 = {14, + 1}; /** JPN sub-band config : Start Channel = 8, NumChans = 3 */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_JPN_bottom_band = { 8, - 3 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_JPN_bottom_band = {8, 3}; /** U-NII sub-band config : Start Channel = 36, NumChans = 4 */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_lower_band = { 36, - 4 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_lower_band = {36, 4}; /** U-NII sub-band config : Start Channel = 52, NumChans = 4 */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_middle_band = { 52, - 4 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_middle_band = {52, + 4}; /** U-NII sub-band config : Start Channel = 100, NumChans = 11 */ static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_mid_upper_band = { - 100, 11 -}; + 100, 11}; /** U-NII sub-band config : Start Channel = 100, NumChans = 5 */ static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_mid_upper_band_0 = { - 100, 5 -}; + 100, 5}; /** U-NII sub-band config : Start Channel = 132, NumChans = 3 */ static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_mid_upper_band_1 = { - 132, 3 -}; + 132, 3}; /** U-NII sub-band config : Start Channel = 149, NumChans = 5 */ -static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_upper_band = { 149, - 5 -}; +static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_upper_band = {149, + 5}; +/** U-NII sub-band config : Start Channel = 169, NumChans = 3 */ +static const IEEEtypes_SupportChan_Subband_t wlan_11h_unii_4_band = {169, 3}; /** Internally passed structure used to send a CMD_802_11_TPC_INFO command */ typedef struct { @@ -154,8 +142,7 @@ * @param pmadapter Pointer to mlan_adapter * @return random integer */ -static t_u32 -wlan_11h_get_random_num(pmlan_adapter pmadapter) +static t_u32 wlan_11h_get_random_num(pmlan_adapter pmadapter) { t_u32 sec, usec; @@ -179,9 +166,9 @@ * * @return Number of bytes output to pout_buf parameter return */ -static t_u32 -wlan_11h_convert_ieee_to_mrvl_ie(mlan_adapter *pmadapter, - t_u8 *pout_buf, const t_u8 *pin_ie) +static t_u32 wlan_11h_convert_ieee_to_mrvl_ie(mlan_adapter *pmadapter, + t_u8 *pout_buf, + const t_u8 *pin_ie) { MrvlIEtypesHeader_t mrvl_ie_hdr; t_u8 *ptmp_buf = pout_buf; @@ -213,6 +200,92 @@ return sizeof(mrvl_ie_hdr) + pin_ie[1]; } +/** + * @brief find all bonded channel. + * + * @param pri_chan primary channel + * @param bw channel bandwidth + * @param chan_list buffer to return channel list. + * + * @return number of channel + */ +static t_u8 woal_get_bonded_channels(t_u8 pri_chan, t_u8 bw, t_u8 *chan_list) +{ + t_u8 ht40_plus[] = {52, 60, 100, 108, 116, 124, 132, 140}; + t_u8 ht40_minus[] = {56, 64, 104, 112, 120, 128, 136, 144}; + t_u8 vht80_dfs[4][4] = {{52, 56, 60, 64}, + {100, 104, 108, 112}, + {116, 120, 124, 128}, + {132, 136, 140, 144}}; + t_u8 find = MFALSE; + int j; + int i; + t_u8 sec_chan = 0; + t_u8 n_chan = 1; + ENTER(); + + if (bw == CHAN_BW_20MHZ) { + chan_list[0] = pri_chan; + } else if (bw == CHAN_BW_40MHZ) { + chan_list[0] = pri_chan; + for (i = 0; i < sizeof(ht40_minus); i++) { + if (pri_chan == (t_u8)ht40_plus[i]) { + sec_chan = pri_chan + 4; + n_chan = 2; + break; + } + } + for (i = 0; i < sizeof(ht40_minus); i++) { + if (pri_chan == (t_u8)ht40_minus[i]) { + sec_chan = pri_chan - 4; + n_chan = 2; + break; + } + } + chan_list[1] = sec_chan; + } else if (bw == CHAN_BW_80MHZ) { + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + if (pri_chan == (t_u8)vht80_dfs[i][j]) { + find = MTRUE; + break; + } + } + if (find) + break; + } + if (find) { + n_chan = 4; + for (j = 0; j < n_chan; j++) { + chan_list[j] = (t_u8)vht80_dfs[i][j]; + } + } + } + LEAVE(); + return n_chan; +} + +/** + * @brief Set channel's dfs state + * + * @param priv Private driver information structure + * @param chan primary channel + * @param bw channel bandwidth + * @param dfs_state dfs state + * + * @return N/A + */ +t_void wlan_11h_set_chan_dfs_state(mlan_private *priv, t_u8 chan, t_u8 bw, + dfs_state_t dfs_state) +{ + t_u8 n_chan; + t_u8 chan_list[4]; + t_u8 i; + n_chan = woal_get_bonded_channels(chan, bw, chan_list); + for (i = 0; i < n_chan; i++) + wlan_set_chan_dfs_state(priv, BAND_A, chan_list[i], dfs_state); +} + #ifdef STA_SUPPORT /** * @brief Setup the IBSS DFS element passed to the firmware in adhoc start @@ -234,8 +307,8 @@ * - Length of the returned element in pdfs output parameter * - 0 if returned element is not setup */ -static t_u32 -wlan_11h_set_ibss_dfs_ie(mlan_private *priv, IEEEtypes_IBSS_DFS_t *pdfs) +static t_u32 wlan_11h_set_ibss_dfs_ie(mlan_private *priv, + IEEEtypes_IBSS_DFS_t *pdfs) { t_u8 num_chans = 0; MeasRptBasicMap_t initial_map; @@ -259,7 +332,8 @@ pdfs->dfs_recovery_interval = WLAN_11H_DEFAULT_DFS_RECOVERY_INTERVAL; for (; (num_chans < adapter->parsed_region_chan.no_of_chan) && - (num_chans < WLAN_11H_MAX_IBSS_DFS_CHANNELS); num_chans++) { + (num_chans < WLAN_11H_MAX_IBSS_DFS_CHANNELS); + num_chans++) { pdfs->channel_map[num_chans].channel_number = adapter->parsed_region_chan.chan_pwr[num_chans].chan; @@ -312,7 +386,7 @@ * - 0 if returned element is not setup */ static t_u16 -wlan_11h_set_supp_channels_ie(mlan_private *priv, t_u8 band, +wlan_11h_set_supp_channels_ie(mlan_private *priv, t_u16 band, IEEEtypes_SupportedChannels_t *psup_chan) { t_u16 num_subbands = 0; @@ -335,23 +409,23 @@ * Channels are contiguous in 2.4GHz, usually only one subband. */ switch (cfp_bg) { - case 0x10: /* USA FCC */ - case 0x20: /* Canada IC */ + case 0x10: /* USA FCC */ + case 0x20: /* Canada IC */ default: psup_chan->subband[num_subbands++] = wlan_11h_2_4G_region_FCC; break; - case 0x30: /* Europe ETSI */ - case 0x41: /* Japan */ - case 0x50: /* China */ + case 0x30: /* Europe ETSI */ + case 0x41: /* Japan */ + case 0x50: /* China */ psup_chan->subband[num_subbands++] = wlan_11h_2_4G_region_EU; break; - case 0x40: /* Japan */ + case 0x40: /* Japan */ psup_chan->subband[num_subbands++] = wlan_11h_2_4G_region_JPN40; break; - case 0xff: /* Japan special */ + case 0xff: /* Japan special */ psup_chan->subband[num_subbands++] = wlan_11h_2_4G_region_EU; psup_chan->subband[num_subbands++] = @@ -365,9 +439,20 @@ * element. */ switch (cfp_a) { - case 0x10: /* USA FCC */ - case 0x20: /* Canada IC */ - case 0x30: /* Europe ETSI */ + case 0x10: /* USA FCC */ + psup_chan->subband[num_subbands++] = + wlan_11h_unii_lower_band; + psup_chan->subband[num_subbands++] = + wlan_11h_unii_middle_band; + psup_chan->subband[num_subbands++] = + wlan_11h_unii_mid_upper_band; + psup_chan->subband[num_subbands++] = + wlan_11h_unii_upper_band; + psup_chan->subband[num_subbands++] = + wlan_11h_unii_4_band; + break; + case 0x20: /* Canada IC */ + case 0x30: /* Europe ETSI */ default: psup_chan->subband[num_subbands++] = wlan_11h_unii_lower_band; @@ -378,7 +463,7 @@ psup_chan->subband[num_subbands++] = wlan_11h_unii_upper_band; break; - case 0x50: /* China */ + case 0x50: /* China */ psup_chan->subband[num_subbands++] = wlan_11h_unii_lower_band; psup_chan->subband[num_subbands++] = @@ -386,9 +471,9 @@ psup_chan->subband[num_subbands++] = wlan_11h_unii_upper_band; break; - case 0x40: /* Japan */ - case 0x41: /* Japan */ - case 0xff: /* Japan special */ + case 0x40: /* Japan */ + case 0x41: /* Japan */ + case 0xff: /* Japan special */ psup_chan->subband[num_subbands++] = wlan_11h_JPN_bottom_band; psup_chan->subband[num_subbands++] = @@ -398,32 +483,32 @@ psup_chan->subband[num_subbands++] = wlan_11h_unii_mid_upper_band; break; - case 0x1: /* Low band (5150-5250 MHz) channels */ + case 0x1: /* Low band (5150-5250 MHz) channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_lower_band; break; - case 0x2: /* Lower middle band (5250-5350 MHz) channels */ + case 0x2: /* Lower middle band (5250-5350 MHz) channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_middle_band; break; - case 0x3: /* Upper middle band (5470-5725 MHz) channels */ + case 0x3: /* Upper middle band (5470-5725 MHz) channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_mid_upper_band; break; - case 0x4: /* High band (5725-5850 MHz) channels */ + case 0x4: /* High band (5725-5850 MHz) channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_upper_band; break; - case 0x5: /* Low band (5150-5250 MHz) and High band (5725-5850 - MHz) channels */ + case 0x5: /* Low band (5150-5250 MHz) and High band (5725-5850 + MHz) channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_lower_band; psup_chan->subband[num_subbands++] = wlan_11h_unii_upper_band; break; - case 0x6: /* Low band (5150-5250 MHz) and Lower middle band - (5250-5350 MHz) and High band (5725-5850 MHz) - channels */ + case 0x6: /* Low band (5150-5250 MHz) and Lower middle band + (5250-5350 MHz) and High band (5725-5850 MHz) + channels */ psup_chan->subband[num_subbands++] = wlan_11h_unii_lower_band; psup_chan->subband[num_subbands++] = @@ -480,9 +565,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_11h_cmd_tpc_request(mlan_private *priv, - HostCmd_DS_COMMAND *pcmd_ptr, const t_void *pinfo_buf) +static mlan_status wlan_11h_cmd_tpc_request(mlan_private *priv, + HostCmd_DS_COMMAND *pcmd_ptr, + const t_void *pinfo_buf) { ENTER(); @@ -513,9 +598,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_11h_cmd_tpc_info(mlan_private *priv, - HostCmd_DS_COMMAND *pcmd_ptr, const t_void *pinfo_buf) +static mlan_status wlan_11h_cmd_tpc_info(mlan_private *priv, + HostCmd_DS_COMMAND *pcmd_ptr, + const t_void *pinfo_buf) { HostCmd_DS_802_11_TPC_INFO *ptpc_info = &pcmd_ptr->params.tpc_info; MrvlIEtypes_LocalPowerConstraint_t *pconstraint = @@ -557,9 +642,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_11h_cmd_chan_sw_ann(mlan_private *priv, - HostCmd_DS_COMMAND *pcmd_ptr, const t_void *pinfo_buf) +static mlan_status wlan_11h_cmd_chan_sw_ann(mlan_private *priv, + HostCmd_DS_COMMAND *pcmd_ptr, + const t_void *pinfo_buf) { const HostCmd_DS_802_11_CHAN_SW_ANN *pch_sw_ann = (HostCmd_DS_802_11_CHAN_SW_ANN *)pinfo_buf; @@ -594,15 +679,16 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING */ -static mlan_status -wlan_11h_cmd_chan_rpt_req(mlan_private *priv, - HostCmd_DS_COMMAND *pcmd_ptr, const t_void *pinfo_buf) +static mlan_status wlan_11h_cmd_chan_rpt_req(mlan_private *priv, + HostCmd_DS_COMMAND *pcmd_ptr, + const t_void *pinfo_buf) { HostCmd_DS_CHAN_RPT_REQ *pchan_rpt_req = (HostCmd_DS_CHAN_RPT_REQ *)pinfo_buf; wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; MrvlIEtypes_ChanRpt11hBasic_t *ptlv_basic; t_bool is_cancel_req = MFALSE; + MrvlIEtypes_ZeroDfsOperation_t *ptlv_zero_dfs; t_u8 dfs53cfg = priv->adapter->dfs53cfg; MrvlIEtypes_DfsW53Cfg_t *ptlv_dfs53cfg; @@ -615,7 +701,8 @@ if (pchan_rpt_req->millisec_dwell_time == 0) is_cancel_req = MTRUE; - if (pstate_dfs->dfs_check_pending && !is_cancel_req) { + if (pstate_dfs->dfs_check_pending && !is_cancel_req && + priv->bss_type != MLAN_BSS_TYPE_DFS) { PRINTM(MERROR, "11h: ChanRptReq - previous CMD_CHAN_REPORT_REQUEST has" " not returned its result yet (as EVENT_CHANNEL_READY)." @@ -636,9 +723,8 @@ wlan_cpu_to_le32(pchan_rpt_req->millisec_dwell_time); /* if DFS channel, add BASIC report TLV, and set radar bit */ - if (!is_cancel_req && - wlan_11h_radar_detect_required(priv, - pchan_rpt_req->chan_desc.chanNum)) { + if (!is_cancel_req && wlan_11h_radar_detect_required( + priv, pchan_rpt_req->chan_desc.chanNum)) { ptlv_basic = (MrvlIEtypes_ChanRpt11hBasic_t *)(((t_u8 *)(pcmd_ptr)) + pcmd_ptr->size); @@ -656,8 +742,8 @@ priv->adapter->region_code == COUNTRY_CODE_JP_FF) && (dfs53cfg != DFS_W53_DEFAULT_FW)) { ptlv_dfs53cfg = - (MrvlIEtypes_DfsW53Cfg_t *) (((t_u8 *)(pcmd_ptr)) + - pcmd_ptr->size); + (MrvlIEtypes_DfsW53Cfg_t *)(((t_u8 *)(pcmd_ptr)) + + pcmd_ptr->size); ptlv_dfs53cfg->Header.type = wlan_cpu_to_le16(TLV_TYPE_DFS_W53_CFG); ptlv_dfs53cfg->Header.len = wlan_cpu_to_le16(sizeof(t_u8)); @@ -665,17 +751,41 @@ pcmd_ptr->size += sizeof(MrvlIEtypes_DfsW53Cfg_t); } - pcmd_ptr->size = wlan_cpu_to_le16(pcmd_ptr->size); + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { + memcpy_ext(priv->adapter, &priv->chan_rep_req, pchan_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(priv->chan_rep_req)); + ptlv_zero_dfs = + (MrvlIEtypes_ZeroDfsOperation_t *)(((t_u8 *)(pcmd_ptr)) + + pcmd_ptr->size); + ptlv_zero_dfs->Header.type = + wlan_cpu_to_le16(TLV_TYPE_ZERO_DFS_OPERATION); + ptlv_zero_dfs->Header.len = wlan_cpu_to_le16(sizeof(t_u8)); + if (!is_cancel_req) { + ptlv_zero_dfs->zero_dfs_enbl = MTRUE; + PRINTM(MCMND, "DFS: START: chan=%d bw=%d\n", + pchan_rpt_req->chan_desc.chanNum, + pchan_rpt_req->chan_desc.bandcfg.chanWidth); + } else { + ptlv_zero_dfs->zero_dfs_enbl = MFALSE; + PRINTM(MCMND, "DFS: STOP\n"); + } + pcmd_ptr->size += sizeof(MrvlIEtypes_ZeroDfsOperation_t); + LEAVE(); + return MLAN_STATUS_SUCCESS; + } /* update dfs sturcture. * dfs_check_pending is set when we receive CMD_RESP == SUCCESS */ pstate_dfs->dfs_check_pending = MFALSE; pstate_dfs->dfs_radar_found = MFALSE; pstate_dfs->dfs_check_priv = MNULL; - - if (!is_cancel_req) + if (!is_cancel_req) { pstate_dfs->dfs_check_channel = pchan_rpt_req->chan_desc.chanNum; + pstate_dfs->dfs_check_bandwidth = + pchan_rpt_req->chan_desc.bandcfg.chanWidth; + } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -692,11 +802,9 @@ * * @return The len increased */ -static t_u32 -wlan_11h_set_local_power_constraint_tlv(t_u8 **ppbuffer, t_u8 channel, - t_u8 power_constraint, - t_u8 min_tx_power_capability, - t_u8 max_tx_power_capability) +static t_u32 wlan_11h_set_local_power_constraint_tlv( + t_u8 **ppbuffer, t_u8 channel, t_u8 power_constraint, + t_u8 min_tx_power_capability, t_u8 max_tx_power_capability) { MrvlIEtypes_PowerCapability_t *pcap; MrvlIEtypes_LocalPowerConstraint_t *pconstraint; @@ -749,10 +857,9 @@ * @return Integer number of bytes appended to the TLV output * buffer (ppbuffer) */ -static t_u32 -wlan_11h_process_infra_join(mlan_private *priv, t_u8 **ppbuffer, - t_u8 band, t_u32 channel, - wlan_11h_bss_info_t *p11h_bss_info) +static t_u32 wlan_11h_process_infra_join(mlan_private *priv, t_u8 **ppbuffer, + t_u16 band, t_u32 channel, + wlan_11h_bss_info_t *p11h_bss_info) { MrvlIEtypesHeader_t ie_header; IEEEtypes_SupportedChannels_t sup_chan_ie; @@ -767,17 +874,11 @@ return 0; } - ret_len += - wlan_11h_set_local_power_constraint_tlv(ppbuffer, (t_u8)channel, - (t_u8)p11h_bss_info-> - power_constraint. - local_constraint, - (t_u8)priv->adapter-> - state_11h. - min_tx_power_capability, - (t_u8)priv->adapter-> - state_11h. - max_tx_power_capability); + ret_len += wlan_11h_set_local_power_constraint_tlv( + ppbuffer, (t_u8)channel, + (t_u8)p11h_bss_info->power_constraint.local_constraint, + (t_u8)priv->adapter->state_11h.min_tx_power_capability, + (t_u8)priv->adapter->state_11h.max_tx_power_capability); /* Setup the Supported Channels IE */ sup_chan_len = wlan_11h_set_supp_channels_ie(priv, band, &sup_chan_ie); @@ -833,9 +934,9 @@ * @return Integer number of bytes appended to the TLV output * buffer (ppbuffer) */ -static t_u32 -wlan_11h_process_adhoc(mlan_private *priv, t_u8 **ppbuffer, - t_u32 channel, wlan_11h_bss_info_t *p11h_bss_info) +static t_u32 wlan_11h_process_adhoc(mlan_private *priv, t_u8 **ppbuffer, + t_u32 channel, + wlan_11h_bss_info_t *p11h_bss_info) { IEEEtypes_IBSS_DFS_t dfs_elem; t_u32 size_appended; @@ -864,9 +965,8 @@ } /* Append the dfs element to the TLV buffer */ - size_appended = - wlan_11h_convert_ieee_to_mrvl_ie(adapter, (t_u8 *)*ppbuffer, - (t_u8 *)&dfs_elem); + size_appended = wlan_11h_convert_ieee_to_mrvl_ie( + adapter, (t_u8 *)*ppbuffer, (t_u8 *)&dfs_elem); HEXDUMP("11h: IBSS-DFS", (t_u8 *)*ppbuffer, size_appended); *ppbuffer += size_appended; @@ -882,13 +982,9 @@ * adhoc join command */ if (p11h_bss_info->quiet.element_id == QUIET) { - size_appended = - wlan_11h_convert_ieee_to_mrvl_ie(adapter, - (t_u8 *) - *ppbuffer, - (t_u8 *) - &p11h_bss_info-> - quiet); + size_appended = wlan_11h_convert_ieee_to_mrvl_ie( + adapter, (t_u8 *)*ppbuffer, + (t_u8 *)&p11h_bss_info->quiet); HEXDUMP("11h: Quiet", (t_u8 *)*ppbuffer, size_appended); *ppbuffer += size_appended; ret_len += size_appended; @@ -902,14 +998,9 @@ * If we are the adhoc starter, we can add a quiet element */ if (adapter->state_11h.quiet_ie.quiet_period) { - size_appended = - wlan_11h_convert_ieee_to_mrvl_ie(adapter, - (t_u8 *) - *ppbuffer, - (t_u8 *) - &adapter-> - state_11h. - quiet_ie); + size_appended = wlan_11h_convert_ieee_to_mrvl_ie( + adapter, (t_u8 *)*ppbuffer, + (t_u8 *)&adapter->state_11h.quiet_ie); HEXDUMP("11h: Quiet", (t_u8 *)*ppbuffer, size_appended); *ppbuffer += size_appended; ret_len += size_appended; @@ -920,15 +1011,10 @@ PRINTM(MINFO, "WEILIE 1: ppbuffer = %p\n", *ppbuffer); - ret_len += - wlan_11h_set_local_power_constraint_tlv(ppbuffer, (t_u8)channel, - (t_u8)local_constraint, - (t_u8)priv->adapter-> - state_11h. - min_tx_power_capability, - (t_u8)priv->adapter-> - state_11h. - max_tx_power_capability); + ret_len += wlan_11h_set_local_power_constraint_tlv( + ppbuffer, (t_u8)channel, (t_u8)local_constraint, + (t_u8)priv->adapter->state_11h.min_tx_power_capability, + (t_u8)priv->adapter->state_11h.max_tx_power_capability); PRINTM(MINFO, "WEILIE 2: ppbuffer = %p\n", *ppbuffer); LEAVE(); @@ -947,8 +1033,7 @@ * - MTRUE if 11h is enabled * - MFALSE otherwise */ -static t_bool -wlan_11h_is_enabled(mlan_private *priv) +static t_bool wlan_11h_is_enabled(mlan_private *priv) { ENTER(); LEAVE(); @@ -964,14 +1049,12 @@ * - MTRUE if slave radar detection is enabled in firmware * - MFALSE otherwise */ -static t_bool -wlan_11h_is_slave_radar_det_active(mlan_private *priv) +static t_bool wlan_11h_is_slave_radar_det_active(mlan_private *priv) { ENTER(); LEAVE(); return priv->adapter->state_11h.is_slave_radar_det_active; } - /** * @brief Return whether the slave interface is active, and on DFS channel. * priv is assumed to already be a dfs slave interface, doesn't check this. @@ -982,17 +1065,15 @@ * - MTRUE if priv is slave, and meets both conditions * - MFALSE otherwise */ -static t_bool -wlan_11h_is_slave_active_on_dfs_chan(mlan_private *priv) +static t_bool wlan_11h_is_slave_active_on_dfs_chan(mlan_private *priv) { t_bool ret = MFALSE; ENTER(); if ((priv->media_connected == MTRUE) && (priv->curr_bss_params.band & BAND_A) && - wlan_11h_radar_detect_required(priv, - priv->curr_bss_params.bss_descriptor. - channel)) + wlan_11h_radar_detect_required( + priv, priv->curr_bss_params.bss_descriptor.channel)) ret = MTRUE; LEAVE(); @@ -1000,6 +1081,34 @@ } /** + * @brief Check if the current input channel is on radar channel + * + * + * @param priv Private driver information structure + * @param channel Channel to determine radar detection requirements + * + * @return + * - MTRUE if radar detection is required + * - MFALSE otherwise + */ +t_bool wlan_11h_is_radar_channel(mlan_private *priv, t_u8 channel) +{ + t_bool required = MFALSE; + + ENTER(); + + /* + * No checks for 11h or measurement code being enabled is placed here + * since regulatory requirements exist whether we support them or not. + */ + + required = wlan_get_cfp_radar_detect(priv, channel); + + LEAVE(); + return required; +} + +/** * @brief Return whether the master interface is active, and on DFS channel. * priv is assumed to already be a dfs master interface, doesn't check this. * @@ -1009,8 +1118,7 @@ * - MTRUE if priv is master, and meets both conditions * - MFALSE otherwise */ -static t_bool -wlan_11h_is_master_active_on_dfs_chan(mlan_private *priv) +static t_bool wlan_11h_is_master_active_on_dfs_chan(mlan_private *priv) { t_bool ret = MFALSE; @@ -1027,9 +1135,8 @@ #ifdef UAP_SUPPORT if ((priv->uap_bss_started == MTRUE) && (priv->uap_state_chan_cb.bandcfg.chanBand == BAND_5GHZ) && - wlan_11h_radar_detect_required(priv, - priv->uap_state_chan_cb. - channel)) + wlan_11h_radar_detect_required( + priv, priv->uap_state_chan_cb.channel)) ret = MTRUE; #endif } @@ -1044,8 +1151,7 @@ * * @return MTRUE or MFALSE */ -static t_bool -wlan_11h_is_dfs_master(mlan_private *priv) +static t_bool wlan_11h_is_dfs_master(mlan_private *priv) { t_bool ret = MFALSE; @@ -1075,8 +1181,7 @@ * @return MTRUE or MFALSE */ -static t_bool -wlan_11h_is_dfs_slave(mlan_private *priv) +static t_bool wlan_11h_is_dfs_slave(mlan_private *priv) { t_bool ret = MFALSE; ENTER(); @@ -1092,8 +1197,7 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_is_intf_active(mlan_private *pmpriv) +t_bool wlan_is_intf_active(mlan_private *pmpriv) { t_bool ret = MFALSE; ENTER(); @@ -1108,7 +1212,7 @@ ret = pmpriv->uap_bss_started; else #endif - if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) + if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) ret = pmpriv->media_connected; LEAVE(); @@ -1122,8 +1226,7 @@ * * @return 11H MIB setting for radar detect */ -static t_u32 -wlan_11h_get_current_radar_detect_flags(mlan_adapter *pmadapter) +static t_u32 wlan_11h_get_current_radar_detect_flags(mlan_adapter *pmadapter) { t_u32 radar_det_flags = 0; @@ -1148,8 +1251,8 @@ * * @return MTRUE (need update) or MFALSE (no change in flags) */ -static t_bool -wlan_11h_check_radar_det_state(mlan_adapter *pmadapter, t_u32 *pnew_state) +static t_bool wlan_11h_check_radar_det_state(mlan_adapter *pmadapter, + t_u32 *pnew_state) { t_u32 radar_det_state_new = 0; t_bool ret; @@ -1178,7 +1281,9 @@ /* now compare flags with current state */ ret = (wlan_11h_get_current_radar_detect_flags(pmadapter) != - radar_det_state_new) ? MTRUE : MFALSE; + radar_det_state_new) ? + MTRUE : + MFALSE; if (ret) *pnew_state = radar_det_state_new; @@ -1193,11 +1298,10 @@ * * @return frenquency index */ -static t_u8 -wlan_11h_get_channel_freq_idx(t_u8 channel_num) +static t_u8 wlan_11h_get_channel_freq_idx(t_u8 channel_num) { t_u8 index; - t_u8 center_freq[] = { 42, 58, 106, 122, 138, 155 }; + t_u8 center_freq[] = {42, 58, 106, 122, 138, 155}; t_u8 chan_idx, ret = 0; chan_idx = channel_num - 100; @@ -1251,11 +1355,10 @@ /* allocate buffer for mlan_ioctl_req and mlan_ds_misc_cfg */ /* FYI - will be freed as part of cmd_response handler */ - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - sizeof(mlan_ioctl_req) + - sizeof(mlan_ds_misc_cfg), - MLAN_MEM_DEF, - (t_u8 **)&pioctl_req); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, + sizeof(mlan_ioctl_req) + sizeof(mlan_ds_misc_cfg), MLAN_MEM_DEF, + (t_u8 **)&pioctl_req); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, "%s(): Could not allocate ioctl req\n", __func__); @@ -1281,18 +1384,20 @@ /* configure custom_ie api settings */ pcust_chansw_ie = (custom_ie *)&pds_misc_cfg->param.cust_ie.ie_data_list[0]; - pcust_chansw_ie->ie_index = 0xffff; /* Auto index */ + pcust_chansw_ie->ie_index = 0xffff; /* Auto index */ pcust_chansw_ie->ie_length = sizeof(IEEEtypes_ChanSwitchAnn_t); - pcust_chansw_ie->mgmt_subtype_mask = (is_adding_ie) ? MBIT(8) | MBIT(5) /* add IE for BEACON | - PROBE_RSP */ - : 0; /* remove IE */ + pcust_chansw_ie->mgmt_subtype_mask = + (is_adding_ie) ? MBIT(8) | MBIT(5) /* add IE for BEACON | + PROBE_RSP */ + : + 0; /* remove IE */ /* prepare CHAN_SW IE inside ioctl */ pchansw_ie = (IEEEtypes_ChanSwitchAnn_t *)pcust_chansw_ie->ie_buffer; pchansw_ie->element_id = CHANNEL_SWITCH_ANN; pchansw_ie->len = sizeof(IEEEtypes_ChanSwitchAnn_t) - sizeof(IEEEtypes_Header_t); - pchansw_ie->chan_switch_mode = 1; /* STA should not transmit */ + pchansw_ie->chan_switch_mode = 1; /* STA should not transmit */ pchansw_ie->new_channel_num = pmadapter->state_rdh.new_channel; pchansw_ie->chan_switch_count = pmadapter->dfs_cs_count; @@ -1301,47 +1406,48 @@ for (index = 0; index < pmadapter->state_rdh.priv_list_count; index++) { pmpriv = pmadapter->state_rdh.priv_list[index]; - /*find the first AP interface */ + /*find the first AP interface*/ if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { if (pmpriv->is_11ac_enabled) { pChanSwWrap_ie = (IEEEtypes_Header_t - *)((t_u8 *)pchansw_ie + - sizeof(IEEEtypes_ChanSwitchAnn_t)); + *)((t_u8 *)pchansw_ie + + sizeof(IEEEtypes_ChanSwitchAnn_t)); pChanSwWrap_ie->element_id = EXT_POWER_CONSTR; - /*will have multiple sub IEs */ + /*will have multiple sub IEs*/ pChanSwWrap_ie->len = 0; /* prepare the Wide Bandwidth Channel Switch IE * Channel Switch IE */ pbwchansw_ie = (IEEEtypes_WideBWChanSwitch_t - *)((t_u8 *)pChanSwWrap_ie + - sizeof(IEEEtypes_Header_t)); + *)((t_u8 *)pChanSwWrap_ie + + sizeof(IEEEtypes_Header_t)); pbwchansw_ie->ieee_hdr.element_id = BW_CHANNEL_SWITCH; pbwchansw_ie->ieee_hdr.len = sizeof(IEEEtypes_WideBWChanSwitch_t) - sizeof(IEEEtypes_Header_t); - /*fix 80MHZ now */ + /*fix 80MHZ now*/ pbwchansw_ie->new_channel_width = VHT_OPER_CHWD_80MHZ; pbwchansw_ie->new_channel_center_freq0 = - wlan_11h_get_channel_freq_idx - (pmadapter->state_rdh.new_channel); + wlan_11h_get_channel_freq_idx( + pmadapter->state_rdh + .new_channel); pbwchansw_ie->new_channel_center_freq1 = - wlan_11h_get_channel_freq_idx - (pmadapter->state_rdh.new_channel); + wlan_11h_get_channel_freq_idx( + pmadapter->state_rdh + .new_channel); pChanSwWrap_ie->len += sizeof(IEEEtypes_WideBWChanSwitch_t); - /*prepare the VHT Transmit Power Envelope IE */ + /*prepare the VHT Transmit Power Envelope IE*/ pvhttpcEnv_ie = (IEEEtypes_VhtTpcEnvelope_t - *)((t_u8 *)pChanSwWrap_ie + - sizeof(IEEEtypes_Header_t) + - sizeof - (IEEEtypes_WideBWChanSwitch_t)); + *)((t_u8 *)pChanSwWrap_ie + + sizeof(IEEEtypes_Header_t) + + sizeof(IEEEtypes_WideBWChanSwitch_t)); pvhttpcEnv_ie->ieee_hdr.element_id = VHT_TX_POWER_ENV; pvhttpcEnv_ie->ieee_hdr.len = @@ -1392,14 +1498,15 @@ * * @return MFALSE if the channel is not allowed in given band */ -static t_bool -wlan_11h_is_band_valid(mlan_private *priv, t_u8 start_chn, - Band_Config_t uap_band_cfg) +static t_bool wlan_11h_is_band_valid(mlan_private *priv, t_u8 start_chn, + Band_Config_t uap_band_cfg) { /* if band width is not 20MHZ (either 40 or 80MHz) * return MFALSE, 165 is not allowed in bands other than 20MHZ */ if (start_chn == 165) { + if (priv->adapter->region_code == COUNTRY_CODE_US) + return MTRUE; if (uap_band_cfg.chanWidth != CHAN_BW_20MHZ) return MFALSE; } @@ -1417,8 +1524,8 @@ * * @return Starting channel */ -static t_u8 -wlan_11h_get_uap_start_channel(mlan_private *priv, Band_Config_t uap_band_cfg) +static t_u8 wlan_11h_get_uap_start_channel(mlan_private *priv, + Band_Config_t uap_band_cfg) { t_u8 start_chn; mlan_adapter *adapter = priv->adapter; @@ -1475,38 +1582,38 @@ * in the table between 0 and the number * of channels in the table (NumCFP). */ - rand_entry = - wlan_11h_get_random_num(adapter) - % chn_tbl->num_cfp; + rand_entry = wlan_11h_get_random_num( + adapter) % + chn_tbl->num_cfp; start_chn = (t_u8)chn_tbl->pcfp[rand_entry] - .channel; + .channel; /* Loop until a non-dfs channel is found * with compatible band bounded by * chn_tbl->num_cfp entries in the * channel table */ while (((chn_tbl->pcfp[rand_entry] - .dynamic.flags & + .dynamic.flags & NXP_CHANNEL_DISABLED) || - (wlan_11h_is_channel_under_nop - (adapter, start_chn) || + (wlan_11h_is_channel_under_nop( + adapter, start_chn) || ((adapter->state_rdh.stage == RDH_GET_INFO_CHANNEL) && - wlan_11h_radar_detect_required - (priv, start_chn)) || - !(wlan_11h_is_band_valid - (priv, start_chn, - uap_band_cfg)))) && + wlan_11h_radar_detect_required( + priv, start_chn)) || + !(wlan_11h_is_band_valid( + priv, start_chn, + uap_band_cfg)))) && (++rand_tries < chn_tbl->num_cfp)) { rand_entry++; rand_entry = rand_entry % - chn_tbl->num_cfp; + chn_tbl->num_cfp; start_chn = - (t_u8)chn_tbl-> - pcfp[rand_entry] - .channel; + (t_u8)chn_tbl + ->pcfp[rand_entry] + .channel; PRINTM(MINFO, "start chan=%d rand_entry=%d\n", start_chn, rand_entry); @@ -1529,7 +1636,7 @@ #endif /* UAP_SUPPORT */ #ifdef DEBUG_LEVEL1 -static const char *DFS_TS_REPR_STRINGS[] = { "", "NOP_start", "CAC_completed" }; +static const char *DFS_TS_REPR_STRINGS[] = {"", "NOP_start", "CAC_completed"}; #endif /** @@ -1548,18 +1655,18 @@ wlan_dfs_timestamp_t *pts = MNULL, *pts_found = MNULL; ENTER(); - pts = (wlan_dfs_timestamp_t *)util_peek_list(pmadapter->pmoal_handle, - &pmadapter->state_dfs. - dfs_ts_head, MNULL, MNULL); + pts = (wlan_dfs_timestamp_t *)util_peek_list( + pmadapter->pmoal_handle, &pmadapter->state_dfs.dfs_ts_head, + MNULL, MNULL); - while (pts && - pts != - (wlan_dfs_timestamp_t *)&pmadapter->state_dfs.dfs_ts_head) { + while (pts && pts != (wlan_dfs_timestamp_t *)&pmadapter->state_dfs + .dfs_ts_head) { PRINTM(MINFO, "dfs_timestamp(@ %p) - chan=%d, repr=%d(%s)," - " time(sec.usec)=%lu.%06lu\n", pts, pts->channel, - pts->represents, DFS_TS_REPR_STRINGS[pts->represents], - pts->ts_sec, pts->ts_usec); + " time(sec.usec)=%lu.%06lu\n", + pts, pts->channel, pts->represents, + DFS_TS_REPR_STRINGS[pts->represents], pts->ts_sec, + pts->ts_usec); if (pts->channel == channel) { pts_found = pts; @@ -1578,9 +1685,8 @@ * @param pmadapter Pointer to mlan_adapter * @param pdfs_ts Pointer to dfs_timestamp to remove */ -static t_void -wlan_11h_remove_dfs_timestamp(mlan_adapter *pmadapter, - wlan_dfs_timestamp_t *pdfs_ts) +static t_void wlan_11h_remove_dfs_timestamp(mlan_adapter *pmadapter, + wlan_dfs_timestamp_t *pdfs_ts) { ENTER(); /* dequeue and delete timestamp */ @@ -1604,8 +1710,8 @@ * * @return Pointer to timestamp if found, or MNULL */ -static mlan_status -wlan_11h_add_dfs_timestamp(mlan_adapter *pmadapter, t_u8 repr, t_u8 channel) +static mlan_status wlan_11h_add_dfs_timestamp(mlan_adapter *pmadapter, + t_u8 repr, t_u8 channel) { wlan_dfs_timestamp_t *pdfs_ts = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1615,11 +1721,9 @@ if (!pdfs_ts) { /* need to allocate new timestamp */ - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - sizeof - (wlan_dfs_timestamp_t), - MLAN_MEM_DEF, - (t_u8 **)&pdfs_ts); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, sizeof(wlan_dfs_timestamp_t), + MLAN_MEM_DEF, (t_u8 **)&pdfs_ts); if ((ret != MLAN_STATUS_SUCCESS) || !pdfs_ts) { PRINTM(MERROR, "%s(): Could not allocate dfs_ts\n", __func__); @@ -1639,9 +1743,8 @@ /* (else, use existing timestamp for channel; see assumptions above) */ /* update params */ - pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, - &pdfs_ts->ts_sec, - &pdfs_ts->ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pdfs_ts->ts_sec, &pdfs_ts->ts_usec); pdfs_ts->represents = repr; PRINTM(MCMD_D, @@ -1655,6 +1758,27 @@ return ret; } +/** + * @brief Add all bonded channel's dfs timestamp to the list + * + * @param pmadapter Pointer to mlan_adapter + * @param repr Timestamp 'represents' value (see _dfs_timestamp_repr_e) + * @param channel Channel number + * @param bandwidth Channel bandwidth + * + * @return Pointer to timestamp if found, or MNULL + */ +static void wlan_11h_add_all_dfs_timestamp(mlan_adapter *pmadapter, t_u8 repr, + t_u8 channel, t_u8 bandwidth) +{ + t_u8 n_chan; + t_u8 chan_list[4]; + t_u8 i; + n_chan = woal_get_bonded_channels(channel, bandwidth, chan_list); + for (i = 0; i < n_chan; i++) + wlan_11h_add_dfs_timestamp(pmadapter, repr, chan_list[i]); +} + /******************************************************** Global functions ********************************************************/ @@ -1668,8 +1792,7 @@ * - MTRUE if master radar detection is enabled in firmware * - MFALSE otherwise */ -t_bool -wlan_11h_is_master_radar_det_active(mlan_private *priv) +t_bool wlan_11h_is_master_radar_det_active(mlan_private *priv) { ENTER(); LEAVE(); @@ -1688,8 +1811,7 @@ * * @sa wlan_11h_check_update_radar_det_state */ -mlan_status -wlan_11h_config_master_radar_det(mlan_private *priv, t_bool enable) +mlan_status wlan_11h_config_master_radar_det(mlan_private *priv, t_bool enable) { mlan_status ret = MLAN_STATUS_FAILURE; @@ -1721,8 +1843,7 @@ * * @sa wlan_11h_check_update_radar_det_state */ -mlan_status -wlan_11h_config_slave_radar_det(mlan_private *priv, t_bool enable) +mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv, t_bool enable) { mlan_status ret = MLAN_STATUS_FAILURE; @@ -1741,6 +1862,217 @@ return ret; } +#ifdef UAP_SUPPORT +/** + * @brief Return whether the slave interface is on DFS channel. + * priv is assumed to already be a dfs slave interface, doesn't check this. + * + * @param priv Private driver information structure + * + * @return + * - MTRUE if priv is slave, and meets both conditions + * - MFALSE otherwise + */ +static t_bool wlan_11h_is_slave_on_dfs_chan(mlan_private *priv) +{ + t_bool ret = MFALSE; + + ENTER(); + if ((priv->media_connected == MTRUE) && + (priv->curr_bss_params.band & BAND_A) && + wlan_11h_is_radar_channel( + priv, priv->curr_bss_params.bss_descriptor.channel)) + ret = MTRUE; + + LEAVE(); + return ret; +} + +/** + * @brief check if dfs_master and dfs_slave are in same channel + * + * @param pmadapter Pointer to mlan_adapter structure + * + * @return MTRUE-dfs_master and dfs_slave interface on same DFS channel + * + */ +t_u8 static wlan_11h_check_dfs_channel(mlan_adapter *pmadapter) +{ + mlan_private *priv_master = MNULL; + mlan_private *priv_slave = MNULL; + mlan_private *priv_list[MLAN_MAX_BSS_NUM] = {MNULL}; + + if (wlan_get_privs_by_two_cond( + pmadapter, wlan_11h_is_master_active_on_dfs_chan, + wlan_11h_is_dfs_master, MTRUE, priv_list)) { + priv_master = priv_list[0]; + PRINTM(MINFO, "%s: found dfs_master priv=%p\n", __func__, + priv_master); + } + if (wlan_get_privs_by_two_cond(pmadapter, wlan_11h_is_slave_on_dfs_chan, + wlan_11h_is_dfs_slave, MTRUE, + priv_list)) { + priv_slave = priv_list[0]; + PRINTM(MINFO, "%s: found dfs_slave priv=%p\n", __func__, + priv_slave); + } + if (!priv_slave || !priv_master) + return MFALSE; + if (priv_master->uap_state_chan_cb.channel != + priv_slave->curr_bss_params.bss_descriptor.channel) + return MFALSE; + return MTRUE; +} + +/** + * @brief disable 11h and DFS function + * + * @param priv Private driver information structure + * @param pioctl_buf A pointer to MLAN IOCTL Request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status static wlan_11h_disable_dfs(mlan_private *priv, t_void *pioctl_buf) +{ + t_u32 enable = 0; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + /* + * Send cmd to FW to enable/disable 11h function in firmware + */ + ret = wlan_prepare_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB, + HostCmd_ACT_GEN_SET, Dot11H_i, + (t_void *)pioctl_buf, &enable); + if (ret) + ret = MLAN_STATUS_FAILURE; + else + /* Set boolean flag in driver 11h state */ + priv->intf_state_11h.is_11h_active = MFALSE; + + PRINTM(MINFO, "11h: DFS %s\n", "Deactivate"); + + LEAVE(); + return ret; +} + +/** + * @brief check if we need enable dfs_master + * + * @param priv Pointer to mlan_private structure + * priv should be UAP priv + * + * @return N/A + * + */ +void wlan_11h_update_dfs_master_state_by_uap(mlan_private *pmpriv) +{ + mlan_adapter *pmadapter = pmpriv->adapter; + mlan_status ret = MLAN_STATUS_SUCCESS; + if (pmadapter->dfs_mode && wlan_11h_check_dfs_channel(pmadapter)) { + PRINTM(MCMND, + "11h: disable DFS master when AP+STA on same DFS channel\n"); + ret = wlan_11h_disable_dfs(pmpriv, MNULL); + return; + } + if (!wlan_11h_is_active(pmpriv)) { + /* active 11h extention in Fw */ + PRINTM(MCMND, + "11h: Enable DFS master after AP up or chan_switch\n"); + ret = wlan_11h_activate(pmpriv, MNULL, MTRUE); + ret = wlan_11h_config_master_radar_det(pmpriv, MTRUE); + ret = wlan_11h_check_update_radar_det_state(pmpriv); + } + if (pmpriv->uap_host_based && !pmpriv->adapter->init_para.dfs_offload) + pmpriv->intf_state_11h.is_11h_host = MTRUE; + wlan_11h_set_dfs_check_chan(pmpriv, pmpriv->uap_channel, + pmpriv->uap_bandwidth); + return; +} + +/** + * @brief check if dfs_master and dfs_slave are in same channel + * + * @param pmadapter Pointer to mlan_adapter structure + * + * @return MTRUE-dfs_master and dfs_slave interface on same DFS channel + * + */ +void wlan_11h_update_dfs_master_state_by_sta(mlan_private *pmpriv) +{ + mlan_private *priv_master = MNULL; + mlan_private *priv_slave = MNULL; + mlan_private *priv_list[MLAN_MAX_BSS_NUM] = {MNULL}; + mlan_adapter *pmadapter = pmpriv->adapter; + mlan_status ret = MLAN_STATUS_SUCCESS; + + if (wlan_get_privs_by_two_cond( + pmadapter, wlan_11h_is_master_active_on_dfs_chan, + wlan_11h_is_dfs_master, MTRUE, priv_list)) { + priv_master = priv_list[0]; + PRINTM(MINFO, "%s: found dfs_master priv=%p\n", __func__, + priv_master); + } + if (wlan_get_privs_by_two_cond(pmadapter, wlan_11h_is_slave_on_dfs_chan, + wlan_11h_is_dfs_slave, MTRUE, + priv_list)) { + priv_slave = priv_list[0]; + PRINTM(MINFO, "%s: found dfs_slave priv=%p\n", __func__, + priv_slave); + } + if (!priv_slave || !priv_master) + return; + if (priv_master->uap_state_chan_cb.channel == + priv_slave->curr_bss_params.bss_descriptor.channel) { + PRINTM(MCMND, + "11h: disable DFS master when AP+STA on same DFS channel\n"); + ret = wlan_11h_disable_dfs(priv_master, MNULL); + } + return; +} + +/** + * @brief update the dfs master state on station disconnect + * + * @param priv Pointer to mlan_private structure + * priv should be UAP priv + * + * @return N/A + * + */ +void wlan_11h_update_dfs_master_state_on_disconect(mlan_private *priv) +{ + mlan_private *priv_master = MNULL; + mlan_private *priv_list[MLAN_MAX_BSS_NUM] = {MNULL}; + mlan_adapter *pmadapter = priv->adapter; + mlan_status ret = MLAN_STATUS_SUCCESS; + if (wlan_get_privs_by_two_cond( + pmadapter, wlan_11h_is_master_active_on_dfs_chan, + wlan_11h_is_dfs_master, MTRUE, priv_list)) { + priv_master = priv_list[0]; + PRINTM(MINFO, "%s: found dfs_master priv=%p\n", __func__, + priv_master); + } + if (!priv_master) { + wlan_11h_check_update_radar_det_state(priv); + return; + } + if (!wlan_11h_is_active(priv_master)) { + PRINTM(MCMND, "11h: Enable DFS master after STA disconnect\n"); + /* active 11h extention in Fw */ + ret = wlan_11h_activate(priv_master, MNULL, MTRUE); + ret = wlan_11h_config_master_radar_det(priv_master, MTRUE); + ret = wlan_11h_check_update_radar_det_state(priv_master); + } + if (priv_master->uap_host_based && !pmadapter->init_para.dfs_offload) + priv_master->intf_state_11h.is_11h_host = MTRUE; + wlan_11h_set_dfs_check_chan(priv_master, priv_master->uap_channel, + priv_master->uap_bandwidth); + return; +} +#endif + /** * @brief Checks all interfaces and determines if radar_detect flag states * have/should be changed. If so, sends SNMP_MIB 11H command to FW. @@ -1753,8 +2085,7 @@ * * @sa wlan_11h_check_radar_det_state */ -mlan_status -wlan_11h_check_update_radar_det_state(mlan_private *pmpriv) +mlan_status wlan_11h_check_update_radar_det_state(mlan_private *pmpriv) { t_u32 new_radar_det_state = 0; t_u32 mib_11h = 0; @@ -1801,8 +2132,7 @@ * * @sa wlan_11h_activate */ -t_bool -wlan_11h_is_active(mlan_private *priv) +t_bool wlan_11h_is_active(mlan_private *priv) { ENTER(); LEAVE(); @@ -1816,8 +2146,7 @@ * * @return N/A */ -t_void -wlan_11h_tx_enable(mlan_private *priv) +t_void wlan_11h_tx_enable(mlan_private *priv) { ENTER(); if (priv->intf_state_11h.tx_disabled) { @@ -1836,8 +2165,7 @@ * * @return N/A */ -t_void -wlan_11h_tx_disable(mlan_private *priv) +t_void wlan_11h_tx_disable(mlan_private *priv) { ENTER(); if (!priv->intf_state_11h.tx_disabled) { @@ -1858,8 +2186,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_activate(mlan_private *priv, t_void *pioctl_buf, t_bool flag) +mlan_status wlan_11h_activate(mlan_private *priv, t_void *pioctl_buf, + t_bool flag) { t_u32 enable = flag & ENABLE_11H_MASK; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1901,8 +2229,7 @@ * * @return N/A */ -t_void -wlan_11h_init(mlan_adapter *adapter) +t_void wlan_11h_init(mlan_adapter *adapter) { wlan_11h_device_state_t *pstate_11h = &adapter->state_11h; IEEEtypes_Quiet_t *pquiet = &adapter->state_11h.quiet_ie; @@ -1923,7 +2250,7 @@ pstate_11h->is_master_radar_det_active = MFALSE; pstate_11h->is_slave_radar_det_active = MFALSE; - /*Initialize quiet_ie */ + /*Initialize quiet_ie*/ memset(adapter, pquiet, 0, sizeof(IEEEtypes_Quiet_t)); pquiet->element_id = QUIET; pquiet->len = @@ -1972,8 +2299,7 @@ * * @return N/A */ -t_void -wlan_11h_cleanup(mlan_adapter *adapter) +t_void wlan_11h_cleanup(mlan_adapter *adapter) { wlan_dfs_device_state_t *pstate_dfs = &adapter->state_dfs; wlan_dfs_timestamp_t *pdfs_ts; @@ -1981,10 +2307,8 @@ ENTER(); /* cleanup dfs_timestamp list */ - pdfs_ts = - (wlan_dfs_timestamp_t *)util_peek_list(adapter->pmoal_handle, - &pstate_dfs->dfs_ts_head, - MNULL, MNULL); + pdfs_ts = (wlan_dfs_timestamp_t *)util_peek_list( + adapter->pmoal_handle, &pstate_dfs->dfs_ts_head, MNULL, MNULL); while (pdfs_ts) { util_unlink_list(adapter->pmoal_handle, &pstate_dfs->dfs_ts_head, @@ -1992,14 +2316,10 @@ adapter->callbacks.moal_mfree(adapter->pmoal_handle, (t_u8 *)pdfs_ts); - pdfs_ts = - (wlan_dfs_timestamp_t *)util_peek_list(adapter-> - pmoal_handle, - &pstate_dfs-> - dfs_ts_head, - MNULL, MNULL); + pdfs_ts = (wlan_dfs_timestamp_t *)util_peek_list( + adapter->pmoal_handle, &pstate_dfs->dfs_ts_head, MNULL, + MNULL); } - LEAVE(); } @@ -2010,8 +2330,7 @@ * * @return N/A */ -t_void -wlan_11h_priv_init(mlan_private *pmpriv) +t_void wlan_11h_priv_init(mlan_private *pmpriv) { wlan_11h_interface_state_t *pistate_11h = &pmpriv->intf_state_11h; @@ -2038,8 +2357,7 @@ * * @return Starting channel */ -t_u8 -wlan_11h_get_adhoc_start_channel(mlan_private *priv) +t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv) { t_u8 start_chn; mlan_adapter *adapter = priv->adapter; @@ -2059,8 +2377,7 @@ /* * Check that we are looking for a channel in the A Band */ - if ((adapter->adhoc_start_band & BAND_A) - ) { + if ((adapter->adhoc_start_band & BAND_A)) { /* * Set default to the A Band default. * Used if random selection fails @@ -2093,21 +2410,22 @@ */ do { rand_entry = - wlan_11h_get_random_num - (adapter) % + wlan_11h_get_random_num( + adapter) % chn_tbl->num_cfp; start_chn = - (t_u8)chn_tbl-> - pcfp[rand_entry] - .channel; - } while ((wlan_11h_is_channel_under_nop - (adapter, start_chn) || - ((adapter->state_rdh.stage == - RDH_GET_INFO_CHANNEL) && - wlan_11h_radar_detect_required - (priv, start_chn))) && - (++rand_tries < - MAX_RANDOM_CHANNEL_RETRIES)); + (t_u8)chn_tbl + ->pcfp[rand_entry] + .channel; + } while ( + (wlan_11h_is_channel_under_nop( + adapter, start_chn) || + ((adapter->state_rdh.stage == + RDH_GET_INFO_CHANNEL) && + wlan_11h_radar_detect_required( + priv, start_chn))) && + (++rand_tries < + MAX_RANDOM_CHANNEL_RETRIES)); } } } @@ -2131,8 +2449,7 @@ * * @return Closed channel, else 0 */ -t_u8 -wlan_11h_get_csa_closed_channel(mlan_private *priv) +t_u8 wlan_11h_get_csa_closed_channel(mlan_private *priv) { t_u32 sec, usec; @@ -2144,9 +2461,8 @@ } /* have csa channel, check if expired or not */ - priv->adapter->callbacks.moal_get_system_time(priv->adapter-> - pmoal_handle, &sec, - &usec); + priv->adapter->callbacks.moal_get_system_time( + priv->adapter->pmoal_handle, &sec, &usec); if (sec > priv->intf_state_11h.dfs_slave_csa_expire_at_sec) { /* expired: remove channel from blacklist table, and clear vars */ @@ -2179,8 +2495,7 @@ */ /** @sa wlan_11h_issue_radar_detect */ -t_bool -wlan_11h_radar_detect_required(mlan_private *priv, t_u8 channel) +t_bool wlan_11h_radar_detect_required(mlan_private *priv, t_u8 channel) { t_bool required = MFALSE; @@ -2198,8 +2513,7 @@ "11h: Radar detection in CFP code BG:%#x " ", A:%#x " "is %srequired for channel %d\n", - priv->adapter->cfp_code_bg, - priv->adapter->cfp_code_a, + priv->adapter->cfp_code_bg, priv->adapter->cfp_code_a, (required ? "" : "not "), channel); } else PRINTM(MINFO, @@ -2213,22 +2527,21 @@ required = MFALSE; PRINTM(MINFO, "11h: Radar detection not required. " - "Already operating on the channel\n"); + "Already operating on the channel\n"); } LEAVE(); return required; } -t_s32 -wlan_11h_cancel_radar_detect(mlan_private *priv) +t_s32 wlan_11h_cancel_radar_detect(mlan_private *priv) { t_s32 ret; HostCmd_DS_CHAN_RPT_REQ chan_rpt_req; memset(priv->adapter, &chan_rpt_req, 0x00, sizeof(chan_rpt_req)); ret = wlan_prepare_cmd(priv, HostCmd_CMD_CHAN_REPORT_REQUEST, - HostCmd_ACT_GEN_SET, 0, - (t_void *)MNULL, (t_void *)&chan_rpt_req); + HostCmd_ACT_GEN_SET, 0, (t_void *)MNULL, + (t_void *)&chan_rpt_req); return ret; } @@ -2254,10 +2567,9 @@ * * @sa wlan_11h_radar_detect_required */ -t_s32 -wlan_11h_issue_radar_detect(mlan_private *priv, - pmlan_ioctl_req pioctl_req, t_u8 channel, - Band_Config_t bandcfg) +t_s32 wlan_11h_issue_radar_detect(mlan_private *priv, + pmlan_ioctl_req pioctl_req, t_u8 channel, + Band_Config_t bandcfg) { t_s32 ret; HostCmd_DS_CHAN_RPT_REQ chan_rpt_req; @@ -2287,15 +2599,15 @@ /* ETSI new requirement for ch 120, 124 and 128 */ if (wlan_is_etsi_country(pmadapter, pmadapter->country_code)) { - if (channel == 120 || channel == 124 || channel == 128) { + if (channel == 120 || channel == 124 || + channel == 128) { chan_rpt_req.millisec_dwell_time = WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION * 10; } if (channel == 116 && - ((bandcfg.chanWidth == CHAN_BW_40MHZ) - || (bandcfg.chanWidth == CHAN_BW_80MHZ) - )) { + ((bandcfg.chanWidth == CHAN_BW_40MHZ) || + (bandcfg.chanWidth == CHAN_BW_80MHZ))) { chan_rpt_req.millisec_dwell_time = WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION * 10; @@ -2306,8 +2618,8 @@ if (pioctl_req) { ds_11hcfg = (mlan_ds_11h_cfg *)pioctl_req->pbuf; if (!ds_11hcfg->param.chan_rpt_req.host_based) { - ds_11hcfg->param.chan_rpt_req. - millisec_dwell_time = + ds_11hcfg->param.chan_rpt_req + .millisec_dwell_time = chan_rpt_req.millisec_dwell_time; } } @@ -2315,31 +2627,31 @@ if (priv->adapter->dfs_test_params.user_cac_period_msec) { PRINTM(MCMD_D, "dfs_testing - user CAC period=%d (msec)\n", - priv->adapter->dfs_test_params. - user_cac_period_msec); + priv->adapter->dfs_test_params + .user_cac_period_msec); chan_rpt_req.millisec_dwell_time = - priv->adapter->dfs_test_params. - user_cac_period_msec; + priv->adapter->dfs_test_params + .user_cac_period_msec; } if (priv->adapter->dfs_test_params.cac_restart) { priv->adapter->dfs_test_params.chan = chan_rpt_req.chan_desc.chanNum; if (chan_rpt_req.millisec_dwell_time) - priv->adapter->dfs_test_params. - millisec_dwell_time = + priv->adapter->dfs_test_params + .millisec_dwell_time = chan_rpt_req.millisec_dwell_time; else - chan_rpt_req.millisec_dwell_time - = - priv->adapter->dfs_test_params. - millisec_dwell_time; + chan_rpt_req.millisec_dwell_time = + priv->adapter->dfs_test_params + .millisec_dwell_time; memcpy_ext(priv->adapter, &priv->adapter->dfs_test_params.bandcfg, &bandcfg, sizeof(bandcfg), sizeof(bandcfg)); } PRINTM(MMSG, "11h: issuing DFS Radar check for channel=%d." - " Please wait for response...\n", channel); + " Please wait for response...\n", + channel); ret = wlan_prepare_cmd(priv, HostCmd_CMD_CHAN_REPORT_REQUEST, HostCmd_ACT_GEN_SET, 0, @@ -2368,8 +2680,7 @@ * @sa wlan_11h_issue_radar_detect * @sa wlan_11h_process_start */ -mlan_status -wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan) +mlan_status wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan) { mlan_status ret = MLAN_STATUS_SUCCESS; wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; @@ -2378,9 +2689,8 @@ ENTER(); /* check report we hold is valid or not */ - priv->adapter->callbacks.moal_get_system_time(priv->adapter-> - pmoal_handle, &sec, - &usec); + priv->adapter->callbacks.moal_get_system_time( + priv->adapter->pmoal_handle, &sec, &usec); PRINTM(MINFO, "11h: %s()\n", __func__); PRINTM(MINFO, "- sec_now=%d, sec_report=%d.\n", sec, @@ -2435,27 +2745,27 @@ * - Integer number of bytes appended to the TLV output buffer (ppbuffer) * - < 0 for error (e.g. radar detected on channel) */ -t_s32 -wlan_11h_process_start(mlan_private *priv, t_u8 **ppbuffer, - IEEEtypes_CapInfo_t *pcap_info, t_u32 channel, - wlan_11h_bss_info_t *p11h_bss_info) +t_s32 wlan_11h_process_start(mlan_private *priv, t_u8 **ppbuffer, + IEEEtypes_CapInfo_t *pcap_info, t_u32 channel, + wlan_11h_bss_info_t *p11h_bss_info) { mlan_adapter *adapter = priv->adapter; t_s32 ret = MLAN_STATUS_SUCCESS; t_bool is_dfs_chan = MFALSE; ENTER(); - if (wlan_11h_is_enabled(priv) - && ((adapter->adhoc_start_band & BAND_A) - ) - ) { + if (wlan_11h_is_enabled(priv) && + ((adapter->adhoc_start_band & BAND_A))) { if (!wlan_fw_11d_is_enabled(priv)) { /* No use having 11h enabled without 11d enabled */ - wlan_11d_enable(priv, MNULL, ENABLE_11D); + if (wlan_11d_enable(priv, MNULL, ENABLE_11D)) { + ret = MLAN_STATUS_FAILURE; + LEAVE(); + return ret; + } #ifdef STA_SUPPORT - wlan_11d_create_dnld_countryinfo(priv, - adapter-> - adhoc_start_band); + wlan_11d_create_dnld_countryinfo( + priv, adapter->adhoc_start_band); #endif } @@ -2524,13 +2834,11 @@ * network that was parsed out of the scan response. * * @return Integer number of bytes appended to the TLV output - * buffer (ppbuffer), MLAN_STATUS_FAILURE (-1), - * or MLAN_STATUS_SUCCESS (0) + * buffer (ppbuffer) */ -t_s32 -wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, - IEEEtypes_CapInfo_t *pcap_info, t_u8 band, - t_u32 channel, wlan_11h_bss_info_t *p11h_bss_info) +t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, + IEEEtypes_CapInfo_t *pcap_info, t_u16 band, + t_u32 channel, wlan_11h_bss_info_t *p11h_bss_info) { t_s32 ret = 0; @@ -2543,11 +2851,12 @@ * long as the current & next APs have the same spectrum * mgmt capability bit setting */ - ret = MLAN_STATUS_SUCCESS; - + PRINTM(MINFO, + "Assume DFS parameters are the same for roaming\n"); } else { /* No support for roaming between DFS/non-DFS yet */ - ret = MLAN_STATUS_FAILURE; + PRINTM(MINFO, + "No support for roaming between DFS/non-DFS yet\n"); } LEAVE(); @@ -2557,11 +2866,14 @@ if (p11h_bss_info->sensed_11h) { if (!wlan_fw_11d_is_enabled(priv)) { /* No use having 11h enabled without 11d enabled */ - wlan_11d_enable(priv, MNULL, ENABLE_11D); + if (wlan_11d_enable(priv, MNULL, ENABLE_11D)) { + PRINTM(MERROR, "Fail to enable 11D\n"); + LEAVE(); + return ret; + } #ifdef STA_SUPPORT - wlan_11d_parse_dnld_countryinfo(priv, - priv-> - pattempted_bss_desc); + wlan_11d_parse_dnld_countryinfo( + priv, priv->pattempted_bss_desc); #endif } /* @@ -2585,15 +2897,16 @@ p11h_bss_info); } else { PRINTM(MINFO, "11h: Infra join: Sensed\n"); - ret = wlan_11h_process_infra_join(priv, ppbuffer, band, - channel, - p11h_bss_info); + ret = wlan_11h_process_infra_join( + priv, ppbuffer, band, channel, p11h_bss_info); } } else { - /* Deactivate 11h functions in the firmware */ - wlan_11h_activate(priv, MNULL, MFALSE); - pcap_info->spectrum_mgmt = MFALSE; - wlan_11h_check_update_radar_det_state(priv); + if (pcap_info->ibss) { + /* Deactivate 11h functions in the firmware */ + wlan_11h_activate(priv, MNULL, MFALSE); + pcap_info->spectrum_mgmt = MFALSE; + wlan_11h_check_update_radar_det_state(priv); + } } LEAVE(); @@ -2629,9 +2942,9 @@ */ /** @sa wlan_11h_cmd_chan_report_req */ -mlan_status -wlan_11h_cmd_process(mlan_private *priv, - HostCmd_DS_COMMAND *pcmd_ptr, const t_void *pinfo_buf) +mlan_status wlan_11h_cmd_process(mlan_private *priv, + HostCmd_DS_COMMAND *pcmd_ptr, + const t_void *pinfo_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2679,8 +2992,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_cmdresp_process(mlan_private *priv, const HostCmd_DS_COMMAND *resp) +mlan_status wlan_11h_cmdresp_process(mlan_private *priv, + const HostCmd_DS_COMMAND *resp) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2706,6 +3019,8 @@ break; case HostCmd_CMD_CHAN_REPORT_REQUEST: + if (priv->bss_type == MLAN_BSS_TYPE_DFS) + break; priv->adapter->state_dfs.dfs_check_priv = priv; priv->adapter->state_dfs.dfs_check_pending = MTRUE; @@ -2742,10 +3057,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_process_bss_elem(mlan_adapter *pmadapter, - wlan_11h_bss_info_t *p11h_bss_info, - const t_u8 *pelement) +mlan_status wlan_11h_process_bss_elem(mlan_adapter *pmadapter, + wlan_11h_bss_info_t *p11h_bss_info, + const t_u8 *pelement) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 element_len = *((t_u8 *)pelement + 1); @@ -2841,8 +3155,7 @@ * * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_FAILURE or MLAN_STATUS_PENDING */ -mlan_status -wlan_11h_handle_event_chanswann(mlan_private *priv) +mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef STA_SUPPORT @@ -2858,8 +3171,12 @@ ENTER(); #ifdef UAP_SUPPORT - if (priv->adapter->state_11h.is_master_radar_det_active) { - for (i = 0; i < MIN(pmadapter->priv_num, MLAN_MAX_BSS_NUM); i++) { + /** No need handle AP if mc_policy is disabled, FW will move the AP to + * client's new channel */ + if (pmadapter->mc_policy && + priv->adapter->state_11h.is_master_radar_det_active) { + for (i = 0; i < MIN(pmadapter->priv_num, MLAN_MAX_BSS_NUM); + i++) { if (pmadapter->priv[i] && (pmadapter->priv[i]->bss_role == MLAN_BSS_ROLE_UAP) && @@ -2879,50 +3196,52 @@ if (pmadapter->state_rdh.stage == RDH_OFF) { pmadapter->state_rdh.stage = RDH_CHK_INTFS; - wlan_11h_radar_detected_handling - (pmadapter, pmpriv); + wlan_11h_radar_detected_handling( + pmadapter, pmpriv); if (pmpriv->uap_host_based) - wlan_recv_event(pmpriv, - MLAN_EVENT_ID_FW_RADAR_DETECTED, - MNULL); + wlan_recv_event( + pmpriv, + MLAN_EVENT_ID_FW_RADAR_DETECTED, + MNULL); } else { PRINTM(MEVENT, "Ignore Event Radar Detected - handling already in progress.\n"); } } else { - if (pmpriv->adapter->dfs_test_params. - no_channel_change_on_radar || - pmpriv->adapter->dfs_test_params. - fixed_new_channel_on_radar) { + if (pmpriv->adapter->dfs_test_params + .no_channel_change_on_radar || + pmpriv->adapter->dfs_test_params + .fixed_new_channel_on_radar) { if (pmadapter->state_rdh.stage == - RDH_OFF || + RDH_OFF || pmadapter->state_rdh.stage == - RDH_SET_CUSTOM_IE) { + RDH_SET_CUSTOM_IE) { pmadapter->state_rdh.stage = RDH_CHK_INTFS; - wlan_11h_radar_detected_handling - (pmadapter, pmpriv); + wlan_11h_radar_detected_handling( + pmadapter, pmpriv); } else PRINTM(MEVENT, "Ignore Event Radar Detected - handling already in progress.\n"); } else { pmpriv->intf_state_11h.tx_disabled = MTRUE; - wlan_recv_event(pmpriv, - MLAN_EVENT_ID_FW_RADAR_DETECTED, - MNULL); + wlan_recv_event( + pmpriv, + MLAN_EVENT_ID_FW_RADAR_DETECTED, + MNULL); } } } } - if (pmadapter->ecsa_enable) { - t_u8 stop_tx = *(t_u8 *)pmadapter->event_body; +#endif /* UAP_SUPPORT */ + if (priv->adapter->ecsa_enable) { + t_u8 stop_tx = *(t_u8 *)priv->adapter->event_body; if (stop_tx) - pmadapter->state_rdh.tx_block = MTRUE; + priv->adapter->state_rdh.tx_block = MTRUE; LEAVE(); return ret; } -#endif priv->adapter->state_11h.recvd_chanswann_event = MTRUE; /* unlikely: clean up previous csa if still on-going */ @@ -2935,9 +3254,8 @@ /* record channel and time of occurence */ priv->intf_state_11h.dfs_slave_csa_chan = priv->curr_bss_params.bss_descriptor.channel; - priv->adapter->callbacks.moal_get_system_time(priv->adapter-> - pmoal_handle, &sec, - &usec); + priv->adapter->callbacks.moal_get_system_time( + priv->adapter->pmoal_handle, &sec, &usec); priv->intf_state_11h.dfs_slave_csa_expire_at_sec = sec + DFS_CHAN_MOVE_TIME; @@ -2960,7 +3278,7 @@ "11h: handle_event_chanswann() - scan blacklist csa channel\n"); wlan_set_chan_blacklist(priv, BAND_A, priv->intf_state_11h.dfs_slave_csa_chan, MTRUE); -#endif +#endif /* STA_SUPPORT */ priv->adapter->state_11h.recvd_chanswann_event = MFALSE; LEAVE(); @@ -2975,8 +3293,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_11h_cfg *ds_11hcfg = MNULL; mlan_ds_11h_dfs_testing *dfs_test = MNULL; @@ -3015,7 +3333,54 @@ } /** - * @brief 802.11h IOCTL to handle channel NOP status check + * @brief 802.11h IOCTL to get nop channel list + * + * @param pmadapter Pointer to mlan_adapter + * @param pioctl_req Pointer to mlan_ioctl_req + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_11h_ioctl_nop_channel_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_ds_11h_cfg *ds_11hcfg = MNULL; + int i, j; + chan_freq_power_t *pcfp = MNULL; + t_u8 num_chan = 0; + ENTER(); + + ds_11hcfg = (mlan_ds_11h_cfg *)pioctl_req->pbuf; + /*get the cfp table first */ + for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { + if (pmadapter->region_channel[i].band == BAND_A) { + pcfp = pmadapter->region_channel[i].pcfp; + break; + } + } + if (!pcfp) { + /* This means operation in BAND-A is not support, we can + * just return false here, it's harmless + */ + goto done; + } + /*get the radar detection requirements according to chan num */ + for (j = 0; j < pmadapter->region_channel[i].num_cfp; j++) { + if (pcfp[j].passive_scan_or_radar_detect) { + if (wlan_11h_is_channel_under_nop(pmadapter, + pcfp[j].channel)) { + ds_11hcfg->param.nop_chan_list + .chan_list[num_chan] = pcfp[j].channel; + num_chan++; + } + } + } +done: + ds_11hcfg->param.nop_chan_list.num_chan = num_chan; + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief 802.11h IOCTL to handle channel NOP status check/clear * @brief If given channel is under NOP, return a new non-dfs * @brief channel * @@ -3024,9 +3389,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_ioctl_get_channel_nop_info(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_11h_ioctl_channel_nop_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_ds_11h_cfg *ds_11hcfg = MNULL; @@ -3042,32 +3406,30 @@ if (pioctl_req->action == MLAN_ACT_GET) { ch_nop_info->chan_under_nop = - wlan_11h_is_channel_under_nop(pmadapter, - ch_nop_info-> - curr_chan); - if (ch_nop_info->chan_under_nop) { - wlan_11h_switch_non_dfs_chan(pmpriv, - &ch_nop_info-> - new_chan.channel); + wlan_11h_is_channel_under_nop( + pmadapter, ch_nop_info->curr_chan); + if (ch_nop_info->chan_under_nop && + ch_nop_info->check_new_chan) { + wlan_11h_switch_non_dfs_chan( + pmpriv, &ch_nop_info->new_chan.channel); if (ch_nop_info->chan_width == CHAN_BW_80MHZ || ch_nop_info->chan_width == CHAN_BW_40MHZ) - wlan_11h_update_bandcfg(pmpriv, - &ch_nop_info-> - new_chan. - bandcfg, - ch_nop_info-> - new_chan. - channel); + wlan_11h_update_bandcfg( + pmpriv, + &ch_nop_info->new_chan.bandcfg, + ch_nop_info->new_chan.channel); if (ch_nop_info->chan_width == CHAN_BW_80MHZ) ch_nop_info->new_chan.center_chan = - wlan_get_center_freq_idx(pmpriv, - BAND_AAC, - ch_nop_info-> - new_chan. - channel, - ch_nop_info-> - chan_width); + wlan_get_center_freq_idx( + pmpriv, BAND_AAC, + ch_nop_info->new_chan + .channel, + ch_nop_info->chan_width); } + } else if (pioctl_req->action == MLAN_ACT_CLEAR) { + wlan_11h_cleanup(pmadapter); + wlan_reset_all_chan_dfs_state(pmpriv, BAND_A, + DFS_USABLE); } ret = MLAN_STATUS_SUCCESS; } @@ -3084,9 +3446,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_11h_cfg *ds_11hcfg = MNULL; t_s32 ret = MLAN_STATUS_FAILURE; @@ -3109,6 +3470,55 @@ } /** + * @brief Get/Set 802.11h channel dfs state + * + * @param pmadapter Pointer to mlan_adapter + * @param pioctl_req Pointer to mlan_ioctl_req + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_11h_ioctl_chan_dfs_state(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_ds_11h_cfg *ds_11hcfg = MNULL; + t_s32 ret = MLAN_STATUS_FAILURE; + pmlan_private priv = MNULL; + + ENTER(); + + if (pioctl_req) { + ds_11hcfg = (mlan_ds_11h_cfg *)pioctl_req->pbuf; + priv = pmadapter->priv[pioctl_req->bss_index]; + + if (pioctl_req->action == MLAN_ACT_GET) { + if (MFALSE == + wlan_11h_is_channel_under_nop( + pmadapter, + ds_11hcfg->param.ch_dfs_state.channel)) + PRINTM(MINFO, "Channel is not in NOP\n"); + ds_11hcfg->param.ch_dfs_state.dfs_required = + wlan_11h_radar_detect_required( + priv, + ds_11hcfg->param.ch_dfs_state.channel); + if (ds_11hcfg->param.ch_dfs_state.dfs_required) + ds_11hcfg->param.ch_dfs_state + .dfs_state = wlan_get_chan_dfs_state( + priv, BAND_A, + ds_11hcfg->param.ch_dfs_state.channel); + } else { + wlan_set_chan_dfs_state( + priv, BAND_A, + ds_11hcfg->param.ch_dfs_state.channel, + ds_11hcfg->param.ch_dfs_state.dfs_state); + } + ret = MLAN_STATUS_SUCCESS; + } + + LEAVE(); + return ret; +} + +/** * @brief 802.11h DFS chan report * * @param priv Pointer to mlan_private @@ -3116,8 +3526,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_ioctl_dfs_chan_report(mlan_private *priv, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11h_ioctl_dfs_chan_report(mlan_private *priv, + pmlan_ioctl_req pioctl_req) { mlan_ds_11h_cfg *ds_11hcfg = MNULL; HostCmd_DS_CHAN_RPT_REQ *chan_rpt_req = MNULL; @@ -3140,7 +3550,6 @@ LEAVE(); return ret; } - /** * @brief Check if channel is under NOP (Non-Occupancy Period) * If so, the channel should not be used until the period expires. @@ -3150,21 +3559,20 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter, t_u8 channel) +t_bool wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter, t_u8 channel) { wlan_dfs_timestamp_t *pdfs_ts = MNULL; t_u32 now_sec, now_usec; t_bool ret = MFALSE; + mlan_private *priv; ENTER(); pdfs_ts = wlan_11h_find_dfs_timestamp(pmadapter, channel); if (pdfs_ts && (pdfs_ts->channel == channel) && (pdfs_ts->represents == DFS_TS_REPR_NOP_START)) { /* found NOP_start timestamp entry on channel */ - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &now_sec, &now_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &now_sec, &now_usec); if (pmadapter->dfs_test_params.user_nop_period_sec) { PRINTM(MCMD_D, "dfs_testing - user NOP period=%d (sec)\n", @@ -3182,6 +3590,10 @@ /* if entry is expired, remove it */ if (!ret) { wlan_11h_remove_dfs_timestamp(pmadapter, pdfs_ts); + priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); + if (priv) + wlan_set_chan_dfs_state(priv, BAND_A, channel, + DFS_USABLE); } else PRINTM(MMSG, "11h: channel %d is under NOP - can't use.\n", @@ -3198,12 +3610,15 @@ * * @param priv Pointer to mlan_private * @param pevent Pointer to mlan_event + * @param radar_chan Pointer to radar channel + * @param bandwidth Pointer to band width * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, - mlan_event *pevent, t_u8 *radar_chan) +mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, + mlan_event *pevent, + t_u8 *radar_chan, + t_u8 *bandwidth) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_CHAN_RPT_RSP *pchan_rpt_rsp; @@ -3216,18 +3631,25 @@ wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; t_u8 dfs_radar_found = MFALSE; t_u8 dfs_check_channel = pstate_dfs->dfs_check_channel; + t_u8 dfs_check_bandwidth = pstate_dfs->dfs_check_bandwidth; + MrvlIEtypes_channel_band_t *tlv; ENTER(); pchan_rpt_rsp = (HostCmd_DS_CHAN_RPT_RSP *)&pevent->event_buf; DBG_HEXDUMP(MCMD_D, "11h: Event ChanRptReady (HostCmd_DS_CHAN_RPT_RSP)", (t_u8 *)pchan_rpt_rsp, pevent->event_len); + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { + dfs_check_channel = priv->chan_rep_req.chanNum; + dfs_check_bandwidth = priv->chan_rep_req.bandcfg.chanWidth; + } + if (wlan_le32_to_cpu(pchan_rpt_rsp->cmd_result) == MLAN_CMD_RESULT_SUCCESS) { pbuffer = (t_u8 *)&pchan_rpt_rsp->tlv_buffer; evt_len = pevent->event_len; evt_len -= sizeof(HostCmd_DS_CHAN_RPT_RSP) - - sizeof(pchan_rpt_rsp->tlv_buffer); + sizeof(pchan_rpt_rsp->tlv_buffer); while (evt_len >= (t_s32)sizeof(MrvlIEtypesHeader_t)) { ptlv = (MrvlIEtypes_Data_t *)pbuffer; @@ -3240,6 +3662,11 @@ if (pmeas_rpt_basic->radar) dfs_radar_found = MTRUE; break; + case TLV_TYPE_CHANNELBANDLIST: + tlv = (MrvlIEtypes_channel_band_t *)ptlv; + dfs_check_channel = tlv->channel; + dfs_check_bandwidth = tlv->bandcfg.chanWidth; + break; default: break; } @@ -3252,18 +3679,27 @@ ret = MLAN_STATUS_FAILURE; } if (dfs_radar_found) { - PRINTM(MMSG, "RADAR Detected on channel %d!\n", - dfs_check_channel); + PRINTM(MMSG, "RADAR Detected on channel %d bw=%d !\n", + dfs_check_channel, dfs_check_bandwidth); /* add channel to NOP list */ - wlan_11h_add_dfs_timestamp(priv->adapter, DFS_TS_REPR_NOP_START, - dfs_check_channel); + wlan_11h_add_all_dfs_timestamp(priv->adapter, + DFS_TS_REPR_NOP_START, + dfs_check_channel, + dfs_check_bandwidth); } *radar_chan = dfs_check_channel; + *bandwidth = dfs_check_bandwidth; + if (dfs_radar_found) + wlan_11h_set_chan_dfs_state(priv, dfs_check_channel, + dfs_check_bandwidth, + DFS_UNAVAILABLE); + else + wlan_11h_set_chan_dfs_state(priv, dfs_check_channel, + dfs_check_bandwidth, DFS_AVAILABLE); pstate_dfs->dfs_radar_found = dfs_radar_found; /* Update DFS structure. */ - priv->adapter->callbacks.moal_get_system_time(priv->adapter-> - pmoal_handle, &sec, - &usec); + priv->adapter->callbacks.moal_get_system_time( + priv->adapter->pmoal_handle, &sec, &usec); pstate_dfs->dfs_report_time_sec = sec; pstate_dfs->dfs_check_pending = MFALSE; @@ -3278,16 +3714,38 @@ * @param priv Pointer to mlan_private * @param pevent Pointer to mlan_event * @param radar_chan Pointer to radar channel + * @param bandwidth Pointer to band width * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_print_event_radar_detected(mlan_private *priv, - mlan_event *pevent, t_u8 *radar_chan) +mlan_status wlan_11h_print_event_radar_detected(mlan_private *priv, + mlan_event *pevent, + t_u8 *radar_chan, + t_u8 *bandwidth) { wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; + t_u8 dfs_check_bandwidth = pstate_dfs->dfs_check_bandwidth; + MrvlIEtypes_channel_band_t *tlv; ENTER(); *radar_chan = pstate_dfs->dfs_check_channel; + if (pevent->event_len >= sizeof(MrvlIEtypes_channel_band_t)) { + tlv = (MrvlIEtypes_channel_band_t *)&pevent->event_buf; + *radar_chan = tlv->channel; + dfs_check_bandwidth = tlv->bandcfg.chanWidth; + } else { + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { + *radar_chan = priv->chan_rep_req.chanNum; + dfs_check_bandwidth = + priv->chan_rep_req.bandcfg.chanWidth; + } + } + *bandwidth = dfs_check_bandwidth; + wlan_11h_add_all_dfs_timestamp(priv->adapter, DFS_TS_REPR_NOP_START, + *radar_chan, dfs_check_bandwidth); + wlan_11h_set_chan_dfs_state(priv, *radar_chan, dfs_check_bandwidth, + DFS_UNAVAILABLE); + PRINTM(MEVENT, "DFS: Radar detected on %d bw=%d\n", *radar_chan, + dfs_check_bandwidth); LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -3299,8 +3757,7 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_11h_radar_detected_tx_blocked(mlan_adapter *pmadapter) +t_bool wlan_11h_radar_detected_tx_blocked(mlan_adapter *pmadapter) { if (pmadapter->state_rdh.tx_block) return MTRUE; @@ -3320,13 +3777,12 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_radar_detected_callback(t_void *priv) +mlan_status wlan_11h_radar_detected_callback(t_void *priv) { mlan_status ret; ENTER(); - ret = wlan_11h_radar_detected_handling(((mlan_private *)(priv))-> - adapter, (mlan_private *)priv); + ret = wlan_11h_radar_detected_handling( + ((mlan_private *)(priv))->adapter, (mlan_private *)priv); LEAVE(); return ret; } @@ -3339,8 +3795,7 @@ * * @return NONE */ -void -wlan_dfs_rep_disconnect(mlan_adapter *pmadapter) +void wlan_dfs_rep_disconnect(mlan_adapter *pmadapter) { mlan_private *priv_list[MLAN_MAX_BSS_NUM]; mlan_private *pmpriv = MNULL; @@ -3359,8 +3814,13 @@ if (wlan_11h_radar_detect_required(pmpriv, pmadapter->dfsr_channel)) { - wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); + mlan_status ret = MLAN_STATUS_SUCCESS; + ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_STOP, + HostCmd_ACT_GEN_SET, 0, MNULL, + MNULL); + if (ret) { + PRINTM(MMSG, "Error sending message to FW\n"); + } } } } @@ -3372,12 +3832,12 @@ * * @return NONE */ -void -wlan_dfs_rep_bw_change(mlan_adapter *pmadapter) +void wlan_dfs_rep_bw_change(mlan_adapter *pmadapter) { mlan_private *priv_list[MLAN_MAX_BSS_NUM]; mlan_private *pmpriv = MNULL; t_u8 pcount, i; + mlan_status ret = MLAN_STATUS_SUCCESS; memset(pmadapter, priv_list, 0x00, sizeof(priv_list)); pcount = wlan_get_privs_by_cond(pmadapter, wlan_is_intf_active, @@ -3400,12 +3860,16 @@ /* Check if uAPs running on non-dfs channel. If they do * then there is no need to restart the uAPs */ - if (!wlan_11h_radar_detect_required - (pmpriv, pmadapter->dfsr_channel)) + if (!wlan_11h_radar_detect_required( + pmpriv, pmadapter->dfsr_channel)) return; - wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); + ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_STOP, + HostCmd_ACT_GEN_SET, 0, MNULL, + MNULL); + if (ret) { + PRINTM(MERROR, "Error sending message to FW\n"); + } } } @@ -3414,8 +3878,12 @@ pmpriv = priv_list[i]; if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { - wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_START, - HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); + ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_START, + HostCmd_ACT_GEN_SET, 0, MNULL, + MNULL); + if (ret) { + PRINTM(MERROR, "Error sending message to FW\n"); + } } } } @@ -3429,9 +3897,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or MLAN_STATUS_PENDING */ -void -wlan_11h_update_bandcfg(mlan_private *pmpriv, Band_Config_t *uap_band_cfg, - t_u8 new_channel) +void wlan_11h_update_bandcfg(mlan_private *pmpriv, Band_Config_t *uap_band_cfg, + t_u8 new_channel) { t_u8 chan_offset; ENTER(); @@ -3443,13 +3910,14 @@ chan_offset = wlan_get_second_channel_offset(pmpriv, new_channel); uap_band_cfg->chan2Offset = chan_offset; - if (!chan_offset) { /* 40MHz/80MHz */ + if (!chan_offset) { /* 40MHz/80MHz */ PRINTM(MCMD_D, "20MHz channel, clear channel bandwidth\n"); uap_band_cfg->chanWidth = CHAN_BW_20MHZ; } LEAVE(); } +#ifdef UAP_SUPPORT /** * @brief Get priv current index -- this is used to enter correct rdh_state * during radar handling @@ -3468,7 +3936,8 @@ PRINTM(MINFO, "%s:pmpriv =%p\n", __func__, pmpriv); while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { - if (pmpriv == pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]) { + if (pmpriv == + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]) { PRINTM(MINFO, "found matching priv: priv_idx=%d\n", pstate_rdh->priv_curr_idx); found = MTRUE; @@ -3477,6 +3946,7 @@ } return (found == MTRUE) ? MLAN_STATUS_SUCCESS : MLAN_STATUS_FAILURE; } +#endif /** * @brief Driver handling for remove customeie @@ -3486,8 +3956,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or MLAN_STATUS_PENDING */ -mlan_status -wlan_11h_remove_custom_ie(mlan_adapter *pmadapter, mlan_private *pmpriv) +mlan_status wlan_11h_remove_custom_ie(mlan_adapter *pmadapter, + mlan_private *pmpriv) { mlan_status ret = MLAN_STATUS_SUCCESS; wlan_radar_det_hndlg_state_t *pstate_rdh = &pmadapter->state_rdh; @@ -3499,13 +3969,12 @@ PRINTM(MMSG, "Removing CHAN_SW IE from interfaces.\n"); while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; if (!wlan_11h_is_dfs_master(pmpriv)) continue; - ret = wlan_11h_prepare_custom_ie_chansw(pmadapter, - &pioctl_req, - MFALSE); + ret = wlan_11h_prepare_custom_ie_chansw( + pmadapter, &pioctl_req, MFALSE); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, "%s(): Error in preparing CHAN_SW IE.\n", @@ -3514,9 +3983,8 @@ } pioctl_req->bss_index = pmpriv->bss_index; - ret = wlan_misc_ioctl_custom_ie_list(pmadapter, - pioctl_req, - MFALSE); + ret = wlan_misc_ioctl_custom_ie_list( + pmadapter, pioctl_req, MFALSE); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, @@ -3543,22 +4011,21 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or MLAN_STATUS_PENDING */ -mlan_status -wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, mlan_private *pmpriv) +mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, + mlan_private *pmpriv) { #ifdef DEBUG_LEVEL1 - const char *rdh_stage_str[] = { "RDH_OFF", - "RDH_CHK_INTFS", - "RDH_STOP_TRAFFIC", - "RDH_GET_INFO_CHANNEL", - "RDH_GET_INFO_BEACON_DTIM", - "RDH_SET_CUSTOM_IE", - "RDH_REM_CUSTOM_IE", - "RDH_STOP_INTFS", - "RDH_SET_NEW_CHANNEL", - "RDH_RESTART_INTFS", - "RDH_RESTART_TRAFFIC" - }; + const char *rdh_stage_str[] = {"RDH_OFF", + "RDH_CHK_INTFS", + "RDH_STOP_TRAFFIC", + "RDH_GET_INFO_CHANNEL", + "RDH_GET_INFO_BEACON_DTIM", + "RDH_SET_CUSTOM_IE", + "RDH_REM_CUSTOM_IE", + "RDH_STOP_INTFS", + "RDH_SET_NEW_CHANNEL", + "RDH_RESTART_INTFS", + "RDH_RESTART_TRAFFIC"}; #endif mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3581,9 +4048,8 @@ /* get active interfaces */ memset(pmadapter, pstate_rdh->priv_list, 0x00, sizeof(pstate_rdh->priv_list)); - pstate_rdh->priv_list_count = - wlan_get_privs_by_cond(pmadapter, wlan_is_intf_active, - pstate_rdh->priv_list); + pstate_rdh->priv_list_count = wlan_get_privs_by_cond( + pmadapter, wlan_is_intf_active, pstate_rdh->priv_list); PRINTM(MCMD_D, "%s(): priv_list_count = %d\n", __func__, pstate_rdh->priv_list_count); for (i = 0; i < pstate_rdh->priv_list_count; i++) @@ -3593,12 +4059,12 @@ if (pstate_rdh->priv_list_count == 0) { /* no interfaces active... nothing to do */ PRINTM(MMSG, "11h: Radar Detected - no active priv's," - " skip event handling.\n"); + " skip event handling.\n"); pstate_rdh->stage = RDH_OFF; PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", __func__, pstate_rdh->stage, rdh_stage_str[pstate_rdh->stage]); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } /* else: start handling */ @@ -3630,7 +4096,8 @@ pstate_rdh->priv_curr_idx); /* here, prefer STA info over UAP info - one less CMD to send */ - if (pstate_rdh->priv_curr_idx == RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { + if (pstate_rdh->priv_curr_idx == + RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { ret = wlan_11h_get_priv_curr_idx(pmpriv, @@ -3638,7 +4105,7 @@ if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Unable to locate pmpriv in current active priv_list\n"); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } /* send cmd to get first UAP's info */ @@ -3647,7 +4114,7 @@ pmpriv->uap_state_chan_cb.get_chan_callback = wlan_11h_radar_detected_callback; ret = wlan_uap_get_channel(pmpriv); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } else #endif { @@ -3663,8 +4130,8 @@ } /* STA info kept in driver, just copy */ pstate_rdh->curr_channel = - pmpriv->curr_bss_params.bss_descriptor. - channel; + pmpriv->curr_bss_params.bss_descriptor + .channel; } } #ifdef UAP_SUPPORT @@ -3691,19 +4158,21 @@ #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) pstate_rdh->new_channel = - wlan_11h_get_uap_start_channel(pmpriv, - pmpriv-> - uap_state_chan_cb. - bandcfg); + wlan_11h_get_uap_start_channel( + pmpriv, + pmpriv->uap_state_chan_cb.bandcfg); else #endif pstate_rdh->new_channel = wlan_11h_get_adhoc_start_channel(pmpriv); - if (!pstate_rdh->new_channel || (pstate_rdh->new_channel == pstate_rdh->curr_channel)) { /* report error */ + if (!pstate_rdh->new_channel || + (pstate_rdh->new_channel == + pstate_rdh->curr_channel)) { /* report error */ PRINTM(MERROR, "%s(): ERROR - Failed to choose new_chan" - " (!= curr_chan) !!\n", __func__); + " (!= curr_chan) !!\n", + __func__); #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { ret = wlan_prepare_cmd(pmpriv, @@ -3713,18 +4182,18 @@ PRINTM(MERROR, "STOP UAP and exit radar handling...\n"); pstate_rdh->stage = RDH_OFF; - break; /* leads to exit case */ + break; /* leads to exit case */ } #endif } if (!pmadapter->dfs_test_params.no_channel_change_on_radar && pmadapter->dfs_test_params.fixed_new_channel_on_radar) { PRINTM(MCMD_D, "dfs_testing - user fixed new_chan=%d\n", - pmadapter->dfs_test_params. - fixed_new_channel_on_radar); + pmadapter->dfs_test_params + .fixed_new_channel_on_radar); pstate_rdh->new_channel = - pmadapter->dfs_test_params. - fixed_new_channel_on_radar; + pmadapter->dfs_test_params + .fixed_new_channel_on_radar; } /* applies to DFS with ECSA support */ if (pmadapter->dfs_test_params.no_channel_change_on_radar) { @@ -3747,8 +4216,8 @@ /* UAP intf callback returning with info */ if (pstate_rdh->priv_curr_idx < pstate_rdh->priv_list_count) { t_u16 bcn_dtim_msec; - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; PRINTM(MCMD_D, "%s(): uap.bcn_pd=%d, uap.dtim_pd=%d\n", __func__, pmpriv->uap_state_chan_cb.beacon_period, @@ -3763,9 +4232,10 @@ /* check next intf */ while ((++pstate_rdh->priv_curr_idx) < - pstate_rdh->priv_list_count) { - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pstate_rdh->priv_list_count && + (pstate_rdh->priv_curr_idx < MLAN_MAX_BSS_NUM)) { + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { @@ -3774,10 +4244,10 @@ pmpriv->uap_state_chan_cb.get_chan_callback = wlan_11h_radar_detected_callback; ret = wlan_uap_get_beacon_dtim(pmpriv); - break; /* leads to exit case */ + break; /* leads to exit case */ } else #endif - { /* get STA info from driver and compare here */ + { /* get STA info from driver and compare here */ t_u16 bcn_pd_msec = 100; t_u16 dtim_pd_msec = 1; t_u16 bcn_dtim_msec; @@ -3786,9 +4256,9 @@ if (wlan_11h_is_dfs_master(pmpriv)) { bcn_pd_msec = pmpriv->beacon_period; } else { - bcn_pd_msec = - pmpriv->curr_bss_params. - bss_descriptor.beacon_period; + bcn_pd_msec = pmpriv->curr_bss_params + .bss_descriptor + .beacon_period; /* if (priv->bss_mode != * MLAN_BSS_MODE_IBSS) */ /* TODO: mlan_scan.c needs to parse TLV @@ -3805,7 +4275,7 @@ } if (pstate_rdh->priv_curr_idx < pstate_rdh->priv_list_count) - break; /* EXIT CASE (for UAP) */ + break; /* EXIT CASE (for UAP) */ /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_SET_CUSTOM_IE; @@ -3817,29 +4287,30 @@ pstate_rdh->priv_curr_idx); /* add CHAN_SW IE - Need apply on each interface */ - if (pstate_rdh->priv_curr_idx == RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { + if (pstate_rdh->priv_curr_idx == + RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { mlan_ioctl_req *pioctl_req = MNULL; PRINTM(MMSG, "11h: Radar Detected - adding CHAN_SW IE to interfaces.\n"); while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { pmpriv = pstate_rdh->priv_list - [pstate_rdh->priv_curr_idx]; + [pstate_rdh->priv_curr_idx]; if (!wlan_11h_is_dfs_master(pmpriv)) continue; - ret = wlan_11h_prepare_custom_ie_chansw - (pmadapter, &pioctl_req, MTRUE); - if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { + ret = wlan_11h_prepare_custom_ie_chansw( + pmadapter, &pioctl_req, MTRUE); + if ((ret != MLAN_STATUS_SUCCESS) || + !pioctl_req) { PRINTM(MERROR, "%s(): Error in preparing CHAN_SW IE.\n", __func__); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } pioctl_req->bss_index = pmpriv->bss_index; - ret = wlan_misc_ioctl_custom_ie_list(pmadapter, - pioctl_req, - MFALSE); + ret = wlan_misc_ioctl_custom_ie_list( + pmadapter, pioctl_req, MFALSE); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, @@ -3850,12 +4321,11 @@ * ignore & continue? */ } /* free ioctl buffer memory before we leave */ - pmadapter->callbacks.moal_mfree(pmadapter-> - pmoal_handle, - (t_u8 *) - pioctl_req); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pioctl_req); } - break; /* EXIT CASE */ + break; /* EXIT CASE */ } /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; @@ -3868,7 +4338,8 @@ pstate_rdh->priv_curr_idx); /* remove CHAN_SW IE - Need apply on each interface */ - if (pstate_rdh->priv_curr_idx == RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { + if (pstate_rdh->priv_curr_idx == + RDH_STAGE_FIRST_ENTRY_PRIV_IDX) { mlan_ioctl_req *pioctl_req = MNULL; /* * first entry to this stage, do delay @@ -3876,13 +4347,14 @@ * hear this IE. Use delay: 5 beacons <= * (BCN_DTIM_MSEC*5) <= 3 seconds). */ - t_u16 delay_ms = MAX(MIN_RDH_CHAN_SW_IE_PERIOD_MSEC, - MIN((4 * - pstate_rdh->max_bcn_dtim_ms), - MAX_RDH_CHAN_SW_IE_PERIOD_MSEC)); + t_u16 delay_ms = + MAX(MIN_RDH_CHAN_SW_IE_PERIOD_MSEC, + MIN((4 * pstate_rdh->max_bcn_dtim_ms), + MAX_RDH_CHAN_SW_IE_PERIOD_MSEC)); PRINTM(MMSG, "11h: Radar Detected - delay %d ms for FW to" - " broadcast CHAN_SW IE.\n", delay_ms); + " broadcast CHAN_SW IE.\n", + delay_ms); wlan_mdelay(pmadapter, delay_ms); PRINTM(MMSG, "11h: Radar Detected - delay over, removing" @@ -3890,22 +4362,22 @@ while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { pmpriv = pstate_rdh->priv_list - [pstate_rdh->priv_curr_idx]; + [pstate_rdh->priv_curr_idx]; if (!wlan_11h_is_dfs_master(pmpriv)) continue; - ret = wlan_11h_prepare_custom_ie_chansw - (pmadapter, &pioctl_req, MFALSE); - if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { + ret = wlan_11h_prepare_custom_ie_chansw( + pmadapter, &pioctl_req, MFALSE); + if ((ret != MLAN_STATUS_SUCCESS) || + !pioctl_req) { PRINTM(MERROR, "%s(): Error in preparing CHAN_SW IE.\n", __func__); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } pioctl_req->bss_index = pmpriv->bss_index; - ret = wlan_misc_ioctl_custom_ie_list(pmadapter, - pioctl_req, - MFALSE); + ret = wlan_misc_ioctl_custom_ie_list( + pmadapter, pioctl_req, MFALSE); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, @@ -3916,12 +4388,11 @@ * case?? ignore & continue? */ } /* free ioctl buffer memory before we leave */ - pmadapter->callbacks.moal_mfree(pmadapter-> - pmoal_handle, - (t_u8 *) - pioctl_req); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pioctl_req); } - break; /* EXIT CASE */ + break; /* EXIT CASE */ } /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; @@ -3936,15 +4407,15 @@ /* issues one cmd (DEAUTH/ADHOC_STOP/BSS_STOP) to each intf */ while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_STOP, HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); - break; /* leads to exit case */ + break; /* leads to exit case */ } #endif #ifdef STA_SUPPORT @@ -3957,7 +4428,7 @@ } if (pmpriv->media_connected == MTRUE) { wlan_disconnect(pmpriv, MNULL, MNULL); - break; /* leads to exit case */ + break; /* leads to exit case */ } } #endif @@ -3965,7 +4436,7 @@ if (pstate_rdh->priv_curr_idx < pstate_rdh->priv_list_count || ret == MLAN_STATUS_FAILURE) - break; /* EXIT CASE */ + break; /* EXIT CASE */ /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_SET_NEW_CHANNEL; @@ -3978,7 +4449,7 @@ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_RESTART_INTFS; - goto rdh_restart_intfs; /* skip next stage */ + goto rdh_restart_intfs; /* skip next stage */ } /* fall through */ @@ -3990,8 +4461,8 @@ /* only set new channel for UAP intfs */ while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { pmpriv->uap_state_chan_cb.pioctl_req_curr = @@ -4000,36 +4471,32 @@ wlan_11h_radar_detected_callback; /* DFS only in 5GHz */ - wlan_11h_update_bandcfg(pmpriv, - &pstate_rdh-> - uap_band_cfg, - pstate_rdh-> - new_channel); + wlan_11h_update_bandcfg( + pmpriv, &pstate_rdh->uap_band_cfg, + pstate_rdh->new_channel); PRINTM(MCMD_D, "RDH_SET_NEW_CHANNEL: uAP band config = 0x%x channel=%d\n", pstate_rdh->uap_band_cfg, pstate_rdh->new_channel); - ret = wlan_uap_set_channel(pmpriv, - pstate_rdh-> - uap_band_cfg, - pstate_rdh-> - new_channel); - break; /* leads to exit case */ + ret = wlan_uap_set_channel( + pmpriv, pstate_rdh->uap_band_cfg, + pstate_rdh->new_channel); + break; /* leads to exit case */ } #endif } if (pstate_rdh->priv_curr_idx < pstate_rdh->priv_list_count || ret == MLAN_STATUS_FAILURE) - break; /* EXIT CASE (for UAP) */ + break; /* EXIT CASE (for UAP) */ /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_RESTART_INTFS; /* fall through */ case RDH_RESTART_INTFS: -rdh_restart_intfs: + rdh_restart_intfs: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", __func__, pstate_rdh->stage, rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); @@ -4037,26 +4504,27 @@ /* can only restart master intfs */ while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { - pmpriv = pstate_rdh->priv_list[pstate_rdh-> - priv_curr_idx]; + pmpriv = + pstate_rdh->priv_list[pstate_rdh->priv_curr_idx]; #ifdef UAP_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { - if (wlan_11h_radar_detect_required - (pmpriv, pstate_rdh->new_channel)) { + if (wlan_11h_radar_detect_required( + pmpriv, pstate_rdh->new_channel)) { /* Radar detection is required for this channel, make sure 11h is activated in the firmware */ ret = wlan_11h_activate(pmpriv, MNULL, MTRUE); - ret = wlan_11h_config_master_radar_det - (pmpriv, MTRUE); - ret = wlan_11h_check_update_radar_det_state(pmpriv); + ret = wlan_11h_config_master_radar_det( + pmpriv, MTRUE); + ret = wlan_11h_check_update_radar_det_state( + pmpriv); } ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_BSS_START, HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); - break; /* leads to exit case */ + break; /* leads to exit case */ } #endif #ifdef STA_SUPPORT @@ -4073,31 +4541,32 @@ /* set new adhoc channel here */ pmpriv->adhoc_channel = pstate_rdh->new_channel; - if (wlan_11h_radar_detect_required - (pmpriv, pstate_rdh->new_channel)) { + if (wlan_11h_radar_detect_required( + pmpriv, + pstate_rdh->new_channel)) { /* Radar detection is required for this channel, make sure 11h is activated in the firmware */ - ret = wlan_11h_activate(pmpriv, - MNULL, - MTRUE); + ret = wlan_11h_activate( + pmpriv, MNULL, MTRUE); if (ret) break; - ret = wlan_11h_config_master_radar_det(pmpriv, MTRUE); + ret = wlan_11h_config_master_radar_det( + pmpriv, MTRUE); if (ret) break; - ret = wlan_11h_check_update_radar_det_state(pmpriv); + ret = wlan_11h_check_update_radar_det_state( + pmpriv); if (ret) break; } - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_AD_HOC_START, - HostCmd_ACT_GEN_SET, - 0, MNULL, - &pmpriv-> - adhoc_last_start_ssid); - break; /* leads to exit case */ + ret = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_802_11_AD_HOC_START, + HostCmd_ACT_GEN_SET, 0, MNULL, + &pmpriv->adhoc_last_start_ssid); + break; /* leads to exit case */ } /* NOTE: DON'T reconnect slave STA intfs - @@ -4114,7 +4583,7 @@ if (pstate_rdh->priv_curr_idx < pstate_rdh->priv_list_count || ret == MLAN_STATUS_FAILURE) - break; /* EXIT CASE (for UAP) */ + break; /* EXIT CASE (for UAP) */ /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_RESTART_TRAFFIC; @@ -4131,23 +4600,23 @@ while ((++pstate_rdh->priv_curr_idx) < pstate_rdh->priv_list_count) { pmpriv = pstate_rdh->priv_list - [pstate_rdh->priv_curr_idx]; + [pstate_rdh->priv_curr_idx]; if (!wlan_11h_is_dfs_master(pmpriv)) continue; - ret = wlan_11h_prepare_custom_ie_chansw - (pmadapter, &pioctl_req, MFALSE); - if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { + ret = wlan_11h_prepare_custom_ie_chansw( + pmadapter, &pioctl_req, MFALSE); + if ((ret != MLAN_STATUS_SUCCESS) || + !pioctl_req) { PRINTM(MERROR, "%s(): Error in preparing CHAN_SW IE.\n", __func__); - break; /* EXIT CASE */ + break; /* EXIT CASE */ } pioctl_req->bss_index = pmpriv->bss_index; - ret = wlan_misc_ioctl_custom_ie_list(pmadapter, - pioctl_req, - MFALSE); + ret = wlan_misc_ioctl_custom_ie_list( + pmadapter, pioctl_req, MFALSE); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, @@ -4158,10 +4627,9 @@ * case?? ignore & continue? */ } /* free ioctl buffer memory before we leave */ - pmadapter->callbacks.moal_mfree(pmadapter-> - pmoal_handle, - (t_u8 *) - pioctl_req); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pioctl_req); } } /* continue traffic for reactivated interfaces */ @@ -4170,15 +4638,15 @@ for (i = 0; i < pstate_rdh->priv_list_count; i++) wlan_11h_tx_enable(pstate_rdh->priv_list[i]); - pstate_rdh->stage = RDH_OFF; /* DONE! */ + pstate_rdh->stage = RDH_OFF; /* DONE! */ PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", __func__, pstate_rdh->stage, rdh_stage_str[pstate_rdh->stage]); break; default: - pstate_rdh->stage = RDH_OFF; /* cancel RDH to unblock Tx packets - */ + pstate_rdh->stage = RDH_OFF; /* cancel RDH to unblock Tx packets + */ break; } @@ -4199,34 +4667,33 @@ * @return MLAN_STATUS_SUCCESS (update successful) * or MLAN_STATUS_FAILURE (no change) */ -mlan_status -wlan_11h_dfs_event_preprocessing(mlan_adapter *pmadapter) +mlan_status wlan_11h_dfs_event_preprocessing(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_private *pmpriv = MNULL; - mlan_private *priv_list[MLAN_MAX_BSS_NUM] = { MNULL }; + mlan_private *priv_list[MLAN_MAX_BSS_NUM] = {MNULL}; ENTER(); switch (pmadapter->event_cause & EVENT_ID_MASK) { case EVENT_RADAR_DETECTED: /* find active intf: prefer dfs_master over dfs_slave */ - if (wlan_get_privs_by_two_cond - (pmadapter, wlan_11h_is_master_active_on_dfs_chan, - wlan_11h_is_dfs_master, MTRUE, priv_list)) { + if (wlan_get_privs_by_two_cond( + pmadapter, wlan_11h_is_master_active_on_dfs_chan, + wlan_11h_is_dfs_master, MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_master priv=%p\n", __func__, pmpriv); - } else if (wlan_get_privs_by_two_cond(pmadapter, - wlan_11h_is_slave_active_on_dfs_chan, - wlan_11h_is_dfs_slave, - MTRUE, priv_list)) { + } else if (wlan_get_privs_by_two_cond( + pmadapter, + wlan_11h_is_slave_active_on_dfs_chan, + wlan_11h_is_dfs_slave, MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_slave priv=%p\n", __func__, pmpriv); } else if (pmadapter->state_dfs.dfs_check_pending || pmadapter->state_dfs.dfs_check_channel) { - pmpriv = (mlan_private *)(pmadapter->state_dfs. - dfs_check_priv); + pmpriv = (mlan_private *)(pmadapter->state_dfs + .dfs_check_priv); PRINTM(MINFO, "%s: found dfs priv=%p\n", __func__, pmpriv); } @@ -4267,8 +4734,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or MLAN_STATUS_PENDING */ -mlan_status -wlan_11h_switch_non_dfs_chan(mlan_private *priv, t_u8 *chan) +mlan_status wlan_11h_switch_non_dfs_chan(mlan_private *priv, t_u8 *chan) { mlan_status ret = MLAN_STATUS_FAILURE; t_u32 i; @@ -4290,7 +4756,7 @@ return MLAN_STATUS_SUCCESS; } - /*get the channel table first */ + /*get the channel table first*/ for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { if (pmadapter->region_channel[i].band == BAND_A && pmadapter->region_channel[i].valid) { @@ -4309,16 +4775,17 @@ rand_tries++; } while ((wlan_11h_is_channel_under_nop(pmadapter, def_chan) || chn_tbl->pcfp[rand_entry].passive_scan_or_radar_detect == - MTRUE) && (rand_tries < MAX_SWITCH_CHANNEL_RETRIES)); + MTRUE) && + (rand_tries < MAX_SWITCH_CHANNEL_RETRIES)); /* meet max retries, use the lowest non-dfs channel */ if (rand_tries == MAX_SWITCH_CHANNEL_RETRIES) { for (i = 0; i < chn_tbl->num_cfp; i++) { if (chn_tbl->pcfp[i].passive_scan_or_radar_detect == - MFALSE && - !wlan_11h_is_channel_under_nop(pmadapter, - (t_u8)chn_tbl-> - pcfp[i].channel)) { + MFALSE && + !wlan_11h_is_channel_under_nop( + pmadapter, + (t_u8)chn_tbl->pcfp[i].channel)) { def_chan = (t_u8)chn_tbl->pcfp[i].channel; break; } @@ -4340,15 +4807,16 @@ * @param priv Void pointer to mlan_private * * @param chan pointer to channel + * @param bandwidth band width * * @return N/A */ -void -wlan_11h_set_dfs_check_chan(mlan_private *priv, t_u8 chan) +void wlan_11h_set_dfs_check_chan(mlan_private *priv, t_u8 chan, t_u8 bandwidth) { wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; ENTER(); pstate_dfs->dfs_check_channel = chan; + pstate_dfs->dfs_check_bandwidth = bandwidth; PRINTM(MCMND, "Set dfs_check_channel=%d\n", chan); LEAVE(); } @@ -4361,8 +4829,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_11h_ioctl_dfs_w53_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11h_ioctl_dfs_w53_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_11h_cfg *ds_11hcfg = MNULL; mlan_ds_11h_dfs_w53_cfg *dfs_w53_cfg = MNULL; @@ -4382,3 +4850,29 @@ return MLAN_STATUS_SUCCESS; } + +/** + * @brief 802.11h DFS mode configuration + * + * @param pmadapter Pointer to mlan_adapter + * @param pioctl_req Pointer to mlan_ioctl_req + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_11h_ioctl_dfs_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_ds_11h_cfg *ds_11hcfg = MNULL; + + ENTER(); + + ds_11hcfg = (mlan_ds_11h_cfg *)pioctl_req->pbuf; + + if (pioctl_req->action == MLAN_ACT_GET) { + ds_11hcfg->param.dfs_mode = pmadapter->dfs_mode; + } else { + pmadapter->dfs_mode = ds_11hcfg->param.dfs_mode; + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +}
diff --git a/wlan_sd8987/mlan/mlan_11h.h b/wlan_sd8987/mlan/mlan_11h.h index c49d324..4d0f563 100755 --- a/wlan_sd8987/mlan/mlan_11h.h +++ b/wlan_sd8987/mlan/mlan_11h.h
@@ -4,7 +4,7 @@ * function declarations of 802.11h * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -63,6 +63,14 @@ /** Checks all interfaces and updates radar detect flags if necessary */ extern mlan_status wlan_11h_check_update_radar_det_state(mlan_private *pmpriv); +#ifdef UAP_SUPPORT +/** update dfs master state from uap interface */ +void wlan_11h_update_dfs_master_state_by_uap(mlan_private *pmpriv); +/** update dfs master when station disconnected */ +void wlan_11h_update_dfs_master_state_on_disconect(mlan_private *priv); +/** update dfs master state from STA interface */ +void wlan_11h_update_dfs_master_state_by_sta(mlan_private *pmpriv); +#endif /** Return 1 if 11h is active in the firmware, 0 if it is inactive */ extern t_bool wlan_11h_is_active(mlan_private *priv); @@ -111,7 +119,7 @@ /** Add any 11h TLVs necessary to complete a join command (adhoc or infra) */ extern t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, - IEEEtypes_CapInfo_t *pcap_info, t_u8 band, + IEEEtypes_CapInfo_t *pcap_info, t_u16 band, t_u32 channel, wlan_11h_bss_info_t *p11h_bss_info); @@ -135,31 +143,40 @@ /** Handler for EVENT_CHANNEL_REPORT_RDY */ extern mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, mlan_event *pevent, - t_u8 *radar_chan); + t_u8 *radar_chan, + t_u8 *bandwidth); /** Debug output for EVENT_RADAR_DETECTED */ mlan_status wlan_11h_print_event_radar_detected(mlan_private *priv, mlan_event *pevent, - t_u8 *radar_chan); + t_u8 *radar_chan, + t_u8 *bandwidth); t_s32 wlan_11h_cancel_radar_detect(mlan_private *priv); /** Handler for DFS_TESTING IOCTL */ extern mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -extern mlan_status +extern mlan_status wlan_11h_ioctl_channel_nop_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); +extern mlan_status wlan_11h_ioctl_nop_channel_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); -wlan_11h_ioctl_get_channel_nop_info(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req); - -extern mlan_status - wlan_11h_ioctl_dfs_chan_report(mlan_private *priv, pmlan_ioctl_req pioctl_req); +extern mlan_status wlan_11h_ioctl_dfs_chan_report(mlan_private *priv, + pmlan_ioctl_req pioctl_req); extern mlan_status wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +/** get/set channel dfs state */ +mlan_status wlan_11h_ioctl_chan_dfs_state(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); + /** get/set dfs w53 cfg */ mlan_status wlan_11h_ioctl_dfs_w53_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +/** get/set dfs mode */ +mlan_status wlan_11h_ioctl_dfs_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); /** Check if channel is under a NOP duration (should not be used) */ extern t_bool wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter, t_u8 channel); @@ -170,7 +187,7 @@ /** Callback for RADAR_DETECTED (for UAP cmdresp) */ extern mlan_status wlan_11h_radar_detected_callback(t_void *priv); /** set dfs check channel */ -void wlan_11h_set_dfs_check_chan(mlan_private *priv, t_u8 chan); +void wlan_11h_set_dfs_check_chan(mlan_private *priv, t_u8 chan, t_u8 bandwidth); #ifdef UAP_SUPPORT /** BW_change event Handler for dfs_repeater */
diff --git a/wlan_sd8987/mlan/mlan_11n.c b/wlan_sd8987/mlan/mlan_11n.c index d773af0..3af2069 100755 --- a/wlan_sd8987/mlan/mlan_11n.c +++ b/wlan_sd8987/mlan/mlan_11n.c
@@ -56,15 +56,29 @@ * @return MLAN_STATUS_SUCCESS --success, otherwise * fail */ -static mlan_status -wlan_11n_ioctl_max_tx_buf_size(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_max_tx_buf_size(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_11n_cfg *cfg = MNULL; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; ENTER(); cfg = (mlan_ds_11n_cfg *)pioctl_req->pbuf; + if (pioctl_req->action == MLAN_ACT_SET) { + if (cfg->param.tx_buf_size == 0xffff) { + PRINTM(MIOCTL, "Send reconfigure tx buf to FW\n"); + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_RECONFIGURE_TX_BUFF, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_req, + &cfg->param.tx_buf_size); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + LEAVE(); + return ret; + } + } cfg->param.tx_buf_size = (t_u32)pmadapter->max_tx_buf_size; pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; @@ -81,8 +95,8 @@ * @return MLAN_STATUS_SUCCESS --success, otherwise * fail */ -static mlan_status -wlan_11n_ioctl_htusrcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_htusrcfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -158,9 +172,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_amsdu_aggr_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_amsdu_aggr_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -194,8 +207,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_httxcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_httxcfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -229,8 +242,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_11n_ioctl_tx_bf_cap(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_tx_bf_cap(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -256,8 +269,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_tx_bf_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_tx_bf_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -291,8 +304,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_stream_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_stream_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_11n_cfg *cfg = MNULL; @@ -306,7 +319,8 @@ } else if (pioctl_req->action == MLAN_ACT_SET) { switch (cfg->param.stream_cfg) { case HT_STREAM_MODE_2X2: - if (pmadapter->hw_dev_mcs_support == HT_STREAM_MODE_1X1) { + if (pmadapter->hw_dev_mcs_support == + HT_STREAM_MODE_1X1) { PRINTM(MERROR, "HW does not support this mode\n"); ret = MLAN_STATUS_FAILURE; @@ -337,9 +351,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_coex_rx_winsize(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_coex_rx_winsize(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_11n_cfg *cfg = MNULL; @@ -365,8 +378,7 @@ * * @return N/A */ -void -wlan_11n_send_delba_to_peer(mlan_private *priv, t_u8 *ra) +void wlan_11n_send_delba_to_peer(mlan_private *priv, t_u8 *ra) { TxBAStreamTbl *ptx_tbl; @@ -406,8 +418,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_txaggrctrl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_txaggrctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_11n_cfg *cfg = MNULL; @@ -424,9 +436,9 @@ if (pmpriv->media_connected == MTRUE) { if (pioctl_req->action == MLAN_ACT_SET && !pmpriv->txaggrctrl && pmpriv->adapter->tdls_status != TDLS_NOT_SETUP) - wlan_11n_send_delba_to_peer(pmpriv, - pmpriv->curr_bss_params. - bss_descriptor.mac_address); + wlan_11n_send_delba_to_peer( + pmpriv, pmpriv->curr_bss_params.bss_descriptor + .mac_address); } LEAVE(); return ret; @@ -440,8 +452,7 @@ * * @return N/A */ -static void -wlan_11n_update_addba_request(mlan_private *priv) +static void wlan_11n_update_addba_request(mlan_private *priv) { TxBAStreamTbl *ptx_tbl; @@ -476,8 +487,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_11n_ioctl_addba_param(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_addba_param(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -521,20 +532,16 @@ * @param tid tid * @return N/A */ -void -wlan_11n_delba(mlan_private *priv, int tid) +void wlan_11n_delba(mlan_private *priv, int tid) { RxReorderTbl *rx_reor_tbl_ptr; ENTER(); - rx_reor_tbl_ptr = - (RxReorderTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + rx_reor_tbl_ptr = (RxReorderTbl *)util_peek_list( + priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!rx_reor_tbl_ptr) { LEAVE(); return; @@ -564,8 +571,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_addba_reject(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_addba_reject(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { int i = 0; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -621,9 +628,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_ibss_ampdu_param(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_ibss_ampdu_param(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { int i = 0; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -643,7 +649,7 @@ } } else { for (i = 0; i < MAX_NUM_TID; i++) { - /* For AMPDU RX */ + /* For AMPDU RX*/ if (cfg->param.ibss_ampdu.addba_reject[i] > ADDBA_RSP_STATUS_REJECT) { pioctl_req->status_code = @@ -653,7 +659,7 @@ } pmpriv->ibss_addba_reject[i] = cfg->param.ibss_ampdu.addba_reject[i]; - /* For AMPDU TX */ + /* For AMPDU TX*/ if ((cfg->param.ibss_ampdu.ampdu[i] > HIGH_PRIO_TID) && (cfg->param.ibss_ampdu.ampdu[i] != BA_STREAM_NOT_ALLOWED)) { @@ -720,15 +726,13 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING */ -static mlan_status -wlan_send_delba_to_entry_in_txbastream_tbl(pmlan_private priv, - pmlan_ioctl_req pioctl_req, t_u8 tid, - t_u8 *peer_address, - TxBAStreamTbl *last_tx_ba_to_delete) +static mlan_status wlan_send_delba_to_entry_in_txbastream_tbl( + pmlan_private priv, pmlan_ioctl_req pioctl_req, t_u8 tid, + t_u8 *peer_address, TxBAStreamTbl *last_tx_ba_to_delete) { pmlan_adapter pmadapter = priv->adapter; TxBAStreamTbl *tx_ba_stream_tbl_ptr; - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -746,7 +750,8 @@ while (tx_ba_stream_tbl_ptr != (TxBAStreamTbl *)&priv->tx_ba_stream_tbl_ptr) { - if (tx_ba_stream_tbl_ptr->ba_status == BA_STREAM_SETUP_COMPLETE) { + if (tx_ba_stream_tbl_ptr->ba_status == + BA_STREAM_SETUP_COMPLETE) { if (((tid == DELBA_ALL_TIDS) || (tid == tx_ba_stream_tbl_ptr->tid)) && (!memcmp(pmadapter, peer_address, zero_mac, @@ -757,17 +762,15 @@ if (last_tx_ba_to_delete && (tx_ba_stream_tbl_ptr == last_tx_ba_to_delete)) - ret = wlan_send_delba(priv, pioctl_req, - tx_ba_stream_tbl_ptr-> - tid, - tx_ba_stream_tbl_ptr-> - ra, 1); + ret = wlan_send_delba( + priv, pioctl_req, + tx_ba_stream_tbl_ptr->tid, + tx_ba_stream_tbl_ptr->ra, 1); else - ret = wlan_send_delba(priv, MNULL, - tx_ba_stream_tbl_ptr-> - tid, - tx_ba_stream_tbl_ptr-> - ra, 1); + ret = wlan_send_delba( + priv, MNULL, + tx_ba_stream_tbl_ptr->tid, + tx_ba_stream_tbl_ptr->ra, 1); } } tx_ba_stream_tbl_ptr = tx_ba_stream_tbl_ptr->pnext; @@ -790,26 +793,21 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING */ -static mlan_status -wlan_send_delba_to_entry_in_reorder_tbl(pmlan_private priv, - pmlan_ioctl_req pioctl_req, t_u8 tid, - t_u8 *peer_address, - RxReorderTbl *last_rx_ba_to_delete) +static mlan_status wlan_send_delba_to_entry_in_reorder_tbl( + pmlan_private priv, pmlan_ioctl_req pioctl_req, t_u8 tid, + t_u8 *peer_address, RxReorderTbl *last_rx_ba_to_delete) { pmlan_adapter pmadapter = priv->adapter; RxReorderTbl *rx_reor_tbl_ptr; - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); - rx_reor_tbl_ptr = - (RxReorderTbl *)util_peek_list(pmadapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + rx_reor_tbl_ptr = (RxReorderTbl *)util_peek_list( + pmadapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); if (!rx_reor_tbl_ptr) { LEAVE(); return ret; @@ -826,17 +824,15 @@ MLAN_MAC_ADDR_LENGTH))) { if (last_rx_ba_to_delete && (rx_reor_tbl_ptr == last_rx_ba_to_delete)) - ret = wlan_send_delba(priv, pioctl_req, - rx_reor_tbl_ptr-> - tid, - rx_reor_tbl_ptr-> - ta, 0); + ret = wlan_send_delba( + priv, pioctl_req, + rx_reor_tbl_ptr->tid, + rx_reor_tbl_ptr->ta, 0); else - ret = wlan_send_delba(priv, MNULL, - rx_reor_tbl_ptr-> - tid, - rx_reor_tbl_ptr-> - ta, 0); + ret = wlan_send_delba( + priv, MNULL, + rx_reor_tbl_ptr->tid, + rx_reor_tbl_ptr->ta, 0); } } rx_reor_tbl_ptr = rx_reor_tbl_ptr->pnext; @@ -854,15 +850,15 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_delba(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_delba(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_11n_cfg *cfg = MNULL; TxBAStreamTbl *tx_ba_stream_tbl_ptr, *last_tx_ba_to_delete = MNULL; RxReorderTbl *rx_reor_tbl_ptr, *last_rx_ba_to_delete = MNULL; - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; t_u8 tid, *peer_address; ENTER(); @@ -875,14 +871,10 @@ cfg->param.del_ba.direction, tid, MAC2STR(peer_address)); if (cfg->param.del_ba.direction & DELBA_RX) { - rx_reor_tbl_ptr = - (RxReorderTbl *)util_peek_list(pmadapter->pmoal_handle, - &pmpriv-> - rx_reorder_tbl_ptr, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + rx_reor_tbl_ptr = (RxReorderTbl *)util_peek_list( + pmadapter->pmoal_handle, &pmpriv->rx_reorder_tbl_ptr, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); if (rx_reor_tbl_ptr) { while (rx_reor_tbl_ptr != @@ -910,11 +902,9 @@ if ((last_rx_ba_to_delete == MNULL) && (cfg->param.del_ba.direction & DELBA_TX)) { wlan_request_ralist_lock(pmpriv); - tx_ba_stream_tbl_ptr = - (TxBAStreamTbl *)util_peek_list(pmadapter->pmoal_handle, - &pmpriv-> - tx_ba_stream_tbl_ptr, - MNULL, MNULL); + tx_ba_stream_tbl_ptr = (TxBAStreamTbl *)util_peek_list( + pmadapter->pmoal_handle, &pmpriv->tx_ba_stream_tbl_ptr, + MNULL, MNULL); if (tx_ba_stream_tbl_ptr) { while (tx_ba_stream_tbl_ptr != @@ -944,23 +934,17 @@ if (cfg->param.del_ba.direction & DELBA_TX) { if (last_rx_ba_to_delete) - ret = wlan_send_delba_to_entry_in_txbastream_tbl(pmpriv, - MNULL, - tid, - peer_address, - MNULL); + ret = wlan_send_delba_to_entry_in_txbastream_tbl( + pmpriv, MNULL, tid, peer_address, MNULL); else - ret = wlan_send_delba_to_entry_in_txbastream_tbl(pmpriv, - pioctl_req, - tid, - peer_address, - last_tx_ba_to_delete); + ret = wlan_send_delba_to_entry_in_txbastream_tbl( + pmpriv, pioctl_req, tid, peer_address, + last_tx_ba_to_delete); } if (last_rx_ba_to_delete) { - ret = wlan_send_delba_to_entry_in_reorder_tbl(pmpriv, - pioctl_req, tid, - peer_address, - last_rx_ba_to_delete); + ret = wlan_send_delba_to_entry_in_reorder_tbl( + pmpriv, pioctl_req, tid, peer_address, + last_rx_ba_to_delete); } LEAVE(); @@ -975,9 +959,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_rejectaddbareq(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_rejectaddbareq(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1013,8 +996,7 @@ * * @return N/A */ -static void -wlan_send_delba_txbastream_tbl(pmlan_private priv, t_u8 tid) +static void wlan_send_delba_txbastream_tbl(pmlan_private priv, t_u8 tid) { pmlan_adapter pmadapter = priv->adapter; TxBAStreamTbl *tx_ba_stream_tbl_ptr; @@ -1034,7 +1016,8 @@ while (tx_ba_stream_tbl_ptr != (TxBAStreamTbl *)&priv->tx_ba_stream_tbl_ptr) { - if (tx_ba_stream_tbl_ptr->ba_status == BA_STREAM_SETUP_COMPLETE) { + if (tx_ba_stream_tbl_ptr->ba_status == + BA_STREAM_SETUP_COMPLETE) { if (tid == tx_ba_stream_tbl_ptr->tid) { PRINTM(MIOCTL, "Tx:Send delba to tid=%d, " MACSTR "\n", @@ -1063,8 +1046,7 @@ * * @return N/A */ -static void -wlan_update_all_stations_ampdu(mlan_private *priv) +static void wlan_update_all_stations_ampdu(mlan_private *priv) { sta_node *sta_ptr; mlan_adapter *pmadapter = priv->adapter; @@ -1076,15 +1058,14 @@ sta_ptr = (sta_node *)util_peek_list(pmadapter->pmoal_handle, &priv->sta_list, MNULL, MNULL); if (!sta_ptr) { - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); LEAVE(); return; } while (sta_ptr != (sta_node *)&priv->sta_list) { for (i = 0; i < MAX_NUM_TID; i++) { - if (sta_ptr->is_11n_enabled) + if (sta_ptr->is_11n_enabled || sta_ptr->is_11ax_enabled) sta_ptr->ampdu_sta[i] = priv->aggr_prio_tbl[i].ampdu_user; } @@ -1104,9 +1085,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_aggr_prio_tbl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_aggr_prio_tbl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { int i = 0; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1128,7 +1108,7 @@ for (i = 0; i < MAX_NUM_TID; i++) { /* For AMPDU */ if ((cfg->param.aggr_prio_tbl.ampdu[i] > - HIGH_PRIO_TID)&& + HIGH_PRIO_TID) && (cfg->param.aggr_prio_tbl.ampdu[i] != BA_STREAM_NOT_ALLOWED)) { pioctl_req->status_code = @@ -1139,13 +1119,13 @@ pmpriv->aggr_prio_tbl[i].ampdu_ap = pmpriv->aggr_prio_tbl[i].ampdu_user = - cfg->param.aggr_prio_tbl.ampdu[i]; + cfg->param.aggr_prio_tbl.ampdu[i]; /* For AMSDU */ if ((cfg->param.aggr_prio_tbl.amsdu[i] > - HIGH_PRIO_TID && + HIGH_PRIO_TID && cfg->param.aggr_prio_tbl.amsdu[i] != - BA_STREAM_NOT_ALLOWED)) { + BA_STREAM_NOT_ALLOWED)) { pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; @@ -1185,8 +1165,7 @@ * * @return N/A */ -void -wlan_update_ampdu_txwinsize(pmlan_adapter pmadapter) +void wlan_update_ampdu_txwinsize(pmlan_adapter pmadapter) { t_u8 i; t_u32 tx_win_size = 0; @@ -1221,11 +1200,12 @@ if (tx_win_size != priv->add_ba_param.tx_win_size) { if (priv->media_connected == MTRUE) { for (i = 0; i < MAX_NUM_TID; i++) - wlan_send_delba_txbastream_tbl - (priv, i); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_send_delba_txbastream_tbl( + priv, i); + wlan_recv_event( + priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } } } @@ -1242,9 +1222,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_11n_ioctl_supported_mcs_set(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11n_ioctl_supported_mcs_set(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_11n_cfg *cfg = MNULL; int rx_mcs_supp; @@ -1260,17 +1239,17 @@ return MLAN_STATUS_FAILURE; } rx_mcs_supp = GET_RXMCSSUPP(pmpriv->usr_dev_mcs_support); - /* Set MCS for 1x1/2x2 */ + /* Set MCS for 1x1/2x2*/ memset(pmadapter, (t_u8 *)mcs_set, 0xff, rx_mcs_supp); /* Clear all the other values */ memset(pmadapter, (t_u8 *)&mcs_set[rx_mcs_supp], 0, NUM_MCS_FIELD - rx_mcs_supp); /* Set MCS32 with 40MHz support */ - if ((ISSUPP_CHANWIDTH40(pmpriv->usr_dot_11n_dev_cap_bg) - || ISSUPP_CHANWIDTH40(pmpriv->usr_dot_11n_dev_cap_a) - ) && + if ((ISSUPP_CHANWIDTH40(pmpriv->usr_dot_11n_dev_cap_bg) || + ISSUPP_CHANWIDTH40(pmpriv->usr_dot_11n_dev_cap_a)) && !(pmpriv->curr_chan_flags & CHAN_FLAGS_NO_HT40PLUS && - pmpriv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS)) + pmpriv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS) && + pmadapter->init_para.mcs32 == 1) SETHT_MCS32(mcs_set); cfg = (mlan_ds_11n_cfg *)pioctl_req->pbuf; @@ -1290,8 +1269,8 @@ * * @return MTRUE or MFALSE */ -static int -wlan_is_txbastreamptr_valid(mlan_private *priv, TxBAStreamTbl *ptxtblptr) +static int wlan_is_txbastreamptr_valid(mlan_private *priv, + TxBAStreamTbl *ptxtblptr) { TxBAStreamTbl *ptx_tbl; @@ -1326,8 +1305,8 @@ * @return A pointer to first entry matching status in BA stream * NULL if not found */ -static TxBAStreamTbl * -wlan_11n_get_txbastream_status(mlan_private *priv, baStatus_e ba_status) +static TxBAStreamTbl *wlan_11n_get_txbastream_status(mlan_private *priv, + baStatus_e ba_status) { TxBAStreamTbl *ptx_tbl; @@ -1367,8 +1346,7 @@ * * @return N/A */ -static void -wlan_fill_cap_info(mlan_private *priv, HTCap_t *ht_cap, t_u8 bands) +static void wlan_fill_cap_info(mlan_private *priv, HTCap_t *ht_cap, t_u16 bands) { t_u32 usr_dot_11n_dev_cap; @@ -1434,12 +1412,15 @@ RESETHT_MAXAMSDU(ht_cap->ht_cap_info); /* SM power save */ - RESETHT_SM_POWERSAVE(ht_cap->ht_cap_info); /* Clear to HT SMPS static mode */ + RESETHT_SM_POWERSAVE(ht_cap->ht_cap_info); /* Clear to HT SMPS static + mode*/ if (ISSUPP_MIMOPS(usr_dot_11n_dev_cap)) { if (ISSUPP_SMPS_DYNAMIC_MODE(usr_dot_11n_dev_cap)) - SETHT_SMPS_DYNAMIC(ht_cap->ht_cap_info); /* Set to HT SMPS dynamic mode */ + SETHT_SMPS_DYNAMIC(ht_cap->ht_cap_info); /* Set to HT + SMPS dynamic + mode */ } else { - SETHT_SMPS_DISABLE(ht_cap->ht_cap_info); /* Disable HT SMPS */ + SETHT_SMPS_DISABLE(ht_cap->ht_cap_info); /* Disable HT SMPS */ } LEAVE(); @@ -1454,8 +1435,8 @@ * * @return N/A */ -static void -wlan_reset_cap_info(mlan_private *priv, HTCap_t *ht_cap, t_u8 bands) +static void wlan_reset_cap_info(mlan_private *priv, HTCap_t *ht_cap, + t_u16 bands) { t_u32 usr_dot_11n_dev_cap; @@ -1505,7 +1486,7 @@ RESETHT_MAXAMSDU(ht_cap->ht_cap_info); /* SM power save */ if (!ISSUPP_MIMOPS(usr_dot_11n_dev_cap)) - SETHT_SMPS_DISABLE(ht_cap->ht_cap_info); /* Disable HT SMPS */ + SETHT_SMPS_DISABLE(ht_cap->ht_cap_info); /* Disable HT SMPS */ LEAVE(); } @@ -1520,9 +1501,8 @@ * * @return N/A */ -void -wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, - t_u16 bands, t_u8 fill) +void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, + t_u16 bands, t_u8 fill) { mlan_adapter *pmadapter = priv->adapter; int rx_mcs_supp; @@ -1549,13 +1529,16 @@ SETAMPDU_SPACING(pht_cap->ht_cap.ampdu_param, 0); rx_mcs_supp = GET_RXMCSSUPP(priv->usr_dev_mcs_support); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { if (bands & BAND_A) - rx_mcs_supp = MIN(rx_mcs_supp, - GET_RXMCSSUPP(pmadapter-> - user_htstream >> 8)); + rx_mcs_supp = MIN( + rx_mcs_supp, + GET_RXMCSSUPP(pmadapter->user_htstream >> 8)); else rx_mcs_supp = MIN(rx_mcs_supp, @@ -1574,7 +1557,8 @@ * supprot*/ if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && !(priv->curr_chan_flags & CHAN_FLAGS_NO_HT40PLUS && - priv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS)) + priv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS) && + pmadapter->init_para.mcs32 == 1) SETHT_MCS32(pht_cap->ht_cap.supported_mcs_set); /* Clear RD responder bit */ @@ -1598,8 +1582,8 @@ * * @return N/A */ -void -wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap, t_u16 bands) +void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap, + t_u16 bands) { mlan_adapter *pmadapter = priv->adapter; int rx_mcs_supp; @@ -1622,13 +1606,16 @@ SETAMPDU_SPACING(pht_cap->ht_cap.ampdu_param, 0); rx_mcs_supp = GET_RXMCSSUPP(priv->usr_dev_mcs_support); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { if (bands & BAND_A) - rx_mcs_supp = MIN(rx_mcs_supp, - GET_RXMCSSUPP(pmadapter-> - user_htstream >> 8)); + rx_mcs_supp = MIN( + rx_mcs_supp, + GET_RXMCSSUPP(pmadapter->user_htstream >> 8)); else rx_mcs_supp = MIN(rx_mcs_supp, @@ -1647,7 +1634,8 @@ * supprot*/ if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && !(priv->curr_chan_flags & CHAN_FLAGS_NO_HT40PLUS && - priv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS)) + priv->curr_chan_flags & CHAN_FLAGS_NO_HT40MINUS) && + pmadapter->init_para.mcs32 == 1) SETHT_MCS32(pht_cap->ht_cap.supported_mcs_set); /* Clear RD responder bit */ @@ -1669,8 +1657,7 @@ * * @return N/A */ -void -wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap) +void wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap) { ENTER(); @@ -1733,8 +1720,7 @@ * * @return N/A */ -void -wlan_show_devmcssupport(pmlan_adapter pmadapter, t_u8 support) +void wlan_show_devmcssupport(pmlan_adapter pmadapter, t_u8 support) { ENTER(); @@ -1754,8 +1740,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *resp) +mlan_status wlan_ret_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *resp) { int tid; TxBAStreamTbl *ptx_ba_tbl; @@ -1769,42 +1754,34 @@ tid = pdel_ba->del_ba_param_set >> DELBA_TID_POS; if (pdel_ba->del_result == BA_RESULT_SUCCESS) { - mlan_11n_delete_bastream_tbl(priv, tid, pdel_ba->peer_mac_addr, - TYPE_DELBA_SENT, - INITIATOR_BIT(pdel_ba-> - del_ba_param_set), - 0); + mlan_11n_delete_bastream_tbl( + priv, tid, pdel_ba->peer_mac_addr, TYPE_DELBA_SENT, + INITIATOR_BIT(pdel_ba->del_ba_param_set), 0); wlan_request_ralist_lock(priv); - ptx_ba_tbl = - wlan_11n_get_txbastream_status(priv, - BA_STREAM_SETUP_INPROGRESS); + ptx_ba_tbl = wlan_11n_get_txbastream_status( + priv, BA_STREAM_SETUP_INPROGRESS); wlan_release_ralist_lock(priv); if (ptx_ba_tbl) wlan_send_addba(priv, ptx_ba_tbl->tid, ptx_ba_tbl->ra); - } else { /* - * In case of failure, recreate - * the deleted stream in case - * we initiated the ADDBA - */ + } else { /* + * In case of failure, recreate + * the deleted stream in case + * we initiated the ADDBA + */ if (INITIATOR_BIT(pdel_ba->del_ba_param_set)) { wlan_request_ralist_lock(priv); - if (!wlan_11n_get_txbastream_tbl - (priv, tid, pdel_ba->peer_mac_addr, MFALSE)) - wlan_11n_create_txbastream_tbl(priv, - pdel_ba-> - peer_mac_addr, - tid, - BA_STREAM_SETUP_INPROGRESS); - ptx_ba_tbl = - wlan_11n_get_txbastream_status(priv, - BA_STREAM_SETUP_INPROGRESS); + if (!wlan_11n_get_txbastream_tbl( + priv, tid, pdel_ba->peer_mac_addr, MFALSE)) + wlan_11n_create_txbastream_tbl( + priv, pdel_ba->peer_mac_addr, tid, + BA_STREAM_SETUP_INPROGRESS); + ptx_ba_tbl = wlan_11n_get_txbastream_status( + priv, BA_STREAM_SETUP_INPROGRESS); wlan_release_ralist_lock(priv); if (ptx_ba_tbl) { - mlan_11n_delete_bastream_tbl(priv, - ptx_ba_tbl->tid, - ptx_ba_tbl->ra, - TYPE_DELBA_SENT, - MTRUE, 0); + mlan_11n_delete_bastream_tbl( + priv, ptx_ba_tbl->tid, ptx_ba_tbl->ra, + TYPE_DELBA_SENT, MTRUE, 0); } } } @@ -1822,8 +1799,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *resp) +mlan_status wlan_ret_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *resp) { t_u8 tid; HostCmd_DS_11N_ADDBA_RSP *padd_ba_rsp = @@ -1842,15 +1818,13 @@ padd_ba_rsp->status_code = wlan_le16_to_cpu(padd_ba_rsp->status_code); tid = (padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_TID_MASK) >> - BLOCKACKPARAM_TID_POS; + BLOCKACKPARAM_TID_POS; tid_down = wlan_get_wmm_tid_down(priv, tid); ra_list = wlan_wmm_get_ralist_node(priv, tid_down, padd_ba_rsp->peer_mac_addr); if (padd_ba_rsp->status_code == BA_RESULT_SUCCESS) { - ptx_ba_tbl = - wlan_11n_get_txbastream_tbl(priv, tid, - padd_ba_rsp->peer_mac_addr, - MTRUE); + ptx_ba_tbl = wlan_11n_get_txbastream_tbl( + priv, tid, padd_ba_rsp->peer_mac_addr, MTRUE); if (ptx_ba_tbl) { PRINTM(MCMND, "ADDBA REQ: " MACSTR @@ -1861,7 +1835,7 @@ BLOCKACKPARAM_WINSIZE_MASK) >> BLOCKACKPARAM_WINSIZE_POS), padd_ba_rsp->block_ack_param_set & - BLOCKACKPARAM_AMSDU_SUPP_MASK); + BLOCKACKPARAM_AMSDU_SUPP_MASK); ptx_ba_tbl->ba_status = BA_STREAM_SETUP_COMPLETE; if ((padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_AMSDU_SUPP_MASK) && @@ -1889,14 +1863,12 @@ if (padd_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT) { #ifdef UAP_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) - disable_station_ampdu(priv, tid, - padd_ba_rsp-> - peer_mac_addr); + disable_station_ampdu( + priv, tid, padd_ba_rsp->peer_mac_addr); #endif /* UAP_SUPPORT */ if (ra_list && ra_list->is_tdls_link) - disable_station_ampdu(priv, tid, - padd_ba_rsp-> - peer_mac_addr); + disable_station_ampdu( + priv, tid, padd_ba_rsp->peer_mac_addr); priv->aggr_prio_tbl[tid].ampdu_ap = BA_STREAM_NOT_ALLOWED; @@ -1904,8 +1876,8 @@ if (ra_list) { ra_list->packet_count = 0; ra_list->ba_packet_threshold = - wlan_get_random_ba_threshold(priv-> - adapter); + wlan_get_random_ba_threshold( + priv->adapter); } } } @@ -1922,8 +1894,7 @@ * * @return N/A */ -void -wlan_set_tx_pause_flag(mlan_private *priv, t_u8 flag) +void wlan_set_tx_pause_flag(mlan_private *priv, t_u8 flag) { mlan_private *pmpriv = MNULL; t_u8 i; @@ -1944,9 +1915,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_recfg_tx_buf(mlan_private *priv, HostCmd_DS_COMMAND *cmd, - int cmd_action, void *pdata_buf) +mlan_status wlan_cmd_recfg_tx_buf(mlan_private *priv, HostCmd_DS_COMMAND *cmd, + int cmd_action, void *pdata_buf) { HostCmd_DS_TXBUF_CFG *ptx_buf = &cmd->params.tx_buf; t_u16 action = (t_u16)cmd_action; @@ -1982,10 +1952,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_amsdu_aggr_ctrl(mlan_private *priv, - HostCmd_DS_COMMAND *cmd, int cmd_action, - void *pdata_buf) +mlan_status wlan_cmd_amsdu_aggr_ctrl(mlan_private *priv, + HostCmd_DS_COMMAND *cmd, int cmd_action, + void *pdata_buf) { HostCmd_DS_AMSDU_AGGR_CTRL *pamsdu_ctrl = &cmd->params.amsdu_aggr_ctrl; t_u16 action = (t_u16)cmd_action; @@ -2021,9 +1990,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_amsdu_aggr_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_amsdu_aggr_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_11n_cfg *cfg = MNULL; HostCmd_DS_AMSDU_AGGR_CTRL *amsdu_ctrl = &resp->params.amsdu_aggr_ctrl; @@ -2050,9 +2019,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11n_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_11N_CFG *htcfg = &cmd->params.htcfg; mlan_ds_11n_tx_cfg *txcfg = (mlan_ds_11n_tx_cfg *)pdata_buf; @@ -2077,9 +2045,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11n_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_11n_cfg *cfg = MNULL; HostCmd_DS_11N_CFG *htcfg = &resp->params.htcfg; @@ -2107,10 +2074,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_reject_addba_req(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_reject_addba_req(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = &cmd->params.rejectaddbareq; @@ -2137,9 +2103,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_reject_addba_req(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_reject_addba_req(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_11n_cfg *cfg = MNULL; HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = @@ -2165,9 +2131,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_tx_bf_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_TX_BF_CFG *txbfcfg = &cmd->params.tx_bf_cfg; @@ -2197,8 +2162,8 @@ txbfcfg->body.bf_global_cfg.snr_threshold = txbf->body.bf_global_cfg.snr_threshold; txbfcfg->body.bf_global_cfg.sounding_interval = - wlan_cpu_to_le16(txbf->body.bf_global_cfg. - sounding_interval); + wlan_cpu_to_le16(txbf->body.bf_global_cfg + .sounding_interval); txbfcfg->body.bf_global_cfg.bf_mode = txbf->body.bf_global_cfg.bf_mode; break; @@ -2210,8 +2175,8 @@ break; case SET_GET_BF_PERIODICITY: txbfcfg->body.bf_periodicity.interval = - wlan_cpu_to_le16(txbf->body.bf_periodicity-> - interval); + wlan_cpu_to_le16( + txbf->body.bf_periodicity->interval); break; case TX_BF_FOR_PEER_ENBL: memcpy_ext(pmadapter, txbfcfg->body.tx_bf_peer.peer_mac, @@ -2250,9 +2215,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_tx_bf_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_TX_BF_CFG *txbfcfg = &resp->params.tx_bf_cfg; @@ -2279,8 +2243,8 @@ txbf->body.bf_global_cfg.snr_threshold = txbfcfg->body.bf_global_cfg.snr_threshold; txbf->body.bf_global_cfg.sounding_interval = - wlan_le16_to_cpu(txbfcfg->body.bf_global_cfg. - sounding_interval); + wlan_le16_to_cpu(txbfcfg->body.bf_global_cfg + .sounding_interval); txbf->body.bf_global_cfg.bf_mode = txbfcfg->body.bf_global_cfg.bf_mode; break; @@ -2296,9 +2260,8 @@ txbf->body.bf_periodicity->peer_mac, txbfcfg->body.bf_periodicity.peer_mac, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - txbf->body.bf_periodicity->interval = - wlan_le16_to_cpu(txbfcfg->body.bf_periodicity. - interval); + txbf->body.bf_periodicity->interval = wlan_le16_to_cpu( + txbfcfg->body.bf_periodicity.interval); break; case TX_BF_FOR_PEER_ENBL: txbf->no_of_peers = *(t_u8 *)&txbfcfg->body; @@ -2349,13 +2312,12 @@ * @param chan channel num * @return second channel offset */ -t_u8 -wlan_get_second_channel_offset(mlan_private *priv, int chan) +t_u8 wlan_get_second_channel_offset(mlan_private *priv, int chan) { t_u8 chan2Offset = SEC_CHAN_NONE; /* Special Case: 20Mhz-only Channel */ - if (chan == 165) + if (priv->adapter->region_code != COUNTRY_CODE_US && chan == 165) return chan2Offset; switch (chan) { @@ -2371,6 +2333,8 @@ case 140: case 149: case 157: + case 165: + case 173: chan2Offset = SEC_CHAN_ABOVE; break; case 40: @@ -2385,6 +2349,8 @@ case 144: case 153: case 161: + case 169: + case 177: chan2Offset = SEC_CHAN_BELOW; break; } @@ -2403,9 +2369,8 @@ * @return channel offset (NO_SEC_CHANNEL, SEC_CHANNEL_ABOVE, * SEC_CHANNEL_BELOW) */ -t_u8 -wlan_validate_chan_offset(mlan_private *pmpriv, t_u16 band, - t_u32 chan, t_u8 chan_bw) +t_u8 wlan_validate_chan_offset(mlan_private *pmpriv, t_u16 band, t_u32 chan, + t_u8 chan_bw) { t_u8 chan_offset; pmlan_adapter pmadapter = pmpriv->adapter; @@ -2447,9 +2412,8 @@ * * @return MTRUE/MFALSE */ -static int -wlan_check_chan_width_ht40_by_region(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc) +static int wlan_check_chan_width_ht40_by_region(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { pmlan_adapter pmadapter = pmpriv->adapter; int i = 0; @@ -2527,9 +2491,8 @@ * * @return bytes added to the buffer */ -int -wlan_cmd_append_11n_tlv(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer) +int wlan_cmd_append_11n_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **ppbuffer) { pmlan_adapter pmadapter = pmpriv->adapter; MrvlIETypes_HTCap_t *pht_cap; @@ -2583,7 +2546,7 @@ memcpy_ext(pmadapter, (t_u8 *)pht_cap + sizeof(MrvlIEtypesHeader_t), (t_u8 *)pbss_desc->pht_cap + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pht_cap->header.len, pht_cap->header.len); pht_cap->ht_cap.ht_cap_info = @@ -2609,7 +2572,6 @@ } if (pbss_desc->pht_info) { - pchan_list = (MrvlIEtypes_ChanListParamSet_t *)*ppbuffer; memset(pmadapter, pchan_list, 0, sizeof(MrvlIEtypes_ChanListParamSet_t)); @@ -2620,7 +2582,7 @@ pchan_list->chan_scan_param[0].chan_number = pbss_desc->pht_info->ht_info.pri_chan; pchan_list->chan_scan_param[0].bandcfg.chanBand = - wlan_band_to_radio_type((t_u8)pbss_desc->bss_band); + wlan_band_to_radio_type(pbss_desc->bss_band); /* support the VHT if the network to be join has the VHT * operation */ if (ISSUPP_11ACENABLED(pmadapter->fw_cap_info) && @@ -2632,17 +2594,17 @@ pchan_list->chan_scan_param[0].bandcfg.chanWidth = CHAN_BW_80MHZ; pchan_list->chan_scan_param[0].bandcfg.chan2Offset = - GET_SECONDARYCHAN(pbss_desc->pht_info->ht_info. - field2); + GET_SECONDARYCHAN( + pbss_desc->pht_info->ht_info.field2); pbss_desc->curr_bandwidth = BW_80MHZ; } else if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && - ISALLOWED_CHANWIDTH40(pbss_desc->pht_info->ht_info. - field2) && + ISALLOWED_CHANWIDTH40( + pbss_desc->pht_info->ht_info.field2) && wlan_check_chan_width_ht40_by_region(pmpriv, pbss_desc)) { pchan_list->chan_scan_param[0].bandcfg.chan2Offset = - GET_SECONDARYCHAN(pbss_desc->pht_info->ht_info. - field2); + GET_SECONDARYCHAN( + pbss_desc->pht_info->ht_info.field2); pbss_desc->curr_bandwidth = BW_40MHZ; pchan_list->chan_scan_param[0].bandcfg.chanWidth = CHAN_BW_40MHZ; @@ -2669,7 +2631,7 @@ memcpy_ext(pmadapter, (t_u8 *)p2040_bss_co + sizeof(MrvlIEtypesHeader_t), (t_u8 *)pbss_desc->pbss_co_2040 + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), p2040_bss_co->header.len, p2040_bss_co->header.len); HEXDUMP("20/40 BSS Coexistence IE", (t_u8 *)p2040_bss_co, @@ -2703,8 +2665,7 @@ ret_len += sizeof(MrvlIETypes_ExtCap_t); pext_cap->header.len = wlan_cpu_to_le16(pext_cap->header.len); } else if (wlan_is_ext_capa_support(pmpriv) || - (pmpriv->config_bands & BAND_AAC) - ) { + (pmpriv->config_bands & BAND_AAC)) { wlan_add_ext_capa_info_ie(pmpriv, pbss_desc, ppbuffer); ret_len += sizeof(MrvlIETypes_ExtCap_t); } @@ -2726,8 +2687,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11n_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_11n_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11n_cfg *cfg = MNULL; @@ -2772,8 +2733,8 @@ status = wlan_11n_ioctl_amsdu_aggr_ctrl(pmadapter, pioctl_req); break; case MLAN_OID_11N_CFG_SUPPORTED_MCS_SET: - status = wlan_11n_ioctl_supported_mcs_set(pmadapter, - pioctl_req); + status = + wlan_11n_ioctl_supported_mcs_set(pmadapter, pioctl_req); break; case MLAN_OID_11N_CFG_TX_BF_CAP: status = wlan_11n_ioctl_tx_bf_cap(pmadapter, pioctl_req); @@ -2814,8 +2775,8 @@ * * @return N/A */ -void -wlan_11n_delete_txbastream_tbl_entry(mlan_private *priv, TxBAStreamTbl *ptx_tbl) +void wlan_11n_delete_txbastream_tbl_entry(mlan_private *priv, + TxBAStreamTbl *ptx_tbl) { pmlan_adapter pmadapter = priv->adapter; @@ -2839,8 +2800,7 @@ * * @return N/A */ -void -wlan_11n_deleteall_txbastream_tbl(mlan_private *priv) +void wlan_11n_deleteall_txbastream_tbl(mlan_private *priv) { int i; TxBAStreamTbl *del_tbl_ptr = MNULL; @@ -2848,10 +2808,9 @@ ENTER(); wlan_request_ralist_lock(priv); - while ((del_tbl_ptr = - (TxBAStreamTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->tx_ba_stream_tbl_ptr, - MNULL, MNULL))) { + while ((del_tbl_ptr = (TxBAStreamTbl *)util_peek_list( + priv->adapter->pmoal_handle, + &priv->tx_ba_stream_tbl_ptr, MNULL, MNULL))) { wlan_11n_delete_txbastream_tbl_entry(priv, del_tbl_ptr); } @@ -2877,8 +2836,8 @@ * @return A pointer to first entry matching RA/TID in BA stream * NULL if not found */ -TxBAStreamTbl * -wlan_11n_get_txbastream_tbl(mlan_private *priv, int tid, t_u8 *ra, int lock) +TxBAStreamTbl *wlan_11n_get_txbastream_tbl(mlan_private *priv, int tid, + t_u8 *ra, int lock) { TxBAStreamTbl *ptx_tbl; pmlan_adapter pmadapter = priv->adapter; @@ -2902,7 +2861,8 @@ DBG_HEXDUMP(MDAT_D, "RA", ptx_tbl->ra, MLAN_MAC_ADDR_LENGTH); if ((!memcmp(pmadapter, ptx_tbl->ra, ra, - MLAN_MAC_ADDR_LENGTH)) && (ptx_tbl->tid == tid)) { + MLAN_MAC_ADDR_LENGTH)) && + (ptx_tbl->tid == tid)) { if (lock) wlan_release_ralist_lock(priv); LEAVE(); @@ -2928,9 +2888,8 @@ * * @return N/A */ -void -wlan_11n_create_txbastream_tbl(mlan_private *priv, t_u8 *ra, int tid, - baStatus_e ba_status) +void wlan_11n_create_txbastream_tbl(mlan_private *priv, t_u8 *ra, int tid, + baStatus_e ba_status) { TxBAStreamTbl *new_node = MNULL; pmlan_adapter pmadapter = priv->adapter; @@ -2942,9 +2901,9 @@ PRINTM(MDAT_D, "create_txbastream_tbl TID %d\n", tid); DBG_HEXDUMP(MDAT_D, "RA", ra, MLAN_MAC_ADDR_LENGTH); - if (pmadapter->callbacks. - moal_malloc(pmadapter->pmoal_handle, sizeof(TxBAStreamTbl), - MLAN_MEM_DEF, (t_u8 **)&new_node)) { + if (pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, sizeof(TxBAStreamTbl), + MLAN_MEM_DEF | MLAN_MEM_FLAG_ATOMIC, (t_u8 **)&new_node)) { PRINTM(MERROR, "wlan_11n_create_txbastream_tbl Failed to allocate new_node\n"); LEAVE(); @@ -2979,8 +2938,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -int -wlan_send_addba(mlan_private *priv, int tid, t_u8 *peer_mac) +int wlan_send_addba(mlan_private *priv, int tid, t_u8 *peer_mac) { HostCmd_DS_11N_ADDBA_REQ add_ba_req; static t_u8 dialog_tok; @@ -2991,11 +2949,11 @@ PRINTM(MCMND, "Send addba: TID %d\n", tid); DBG_HEXDUMP(MCMD_D, "Send addba RA", peer_mac, MLAN_MAC_ADDR_LENGTH); - add_ba_req.block_ack_param_set = (t_u16)((tid << BLOCKACKPARAM_TID_POS) - | (priv->add_ba_param. - tx_win_size << - BLOCKACKPARAM_WINSIZE_POS) | - IMMEDIATE_BLOCK_ACK); + add_ba_req.block_ack_param_set = + (t_u16)((tid << BLOCKACKPARAM_TID_POS) | + (priv->add_ba_param.tx_win_size + << BLOCKACKPARAM_WINSIZE_POS) | + IMMEDIATE_BLOCK_ACK); /** enable AMSDU inside AMPDU */ if (priv->add_ba_param.tx_amsdu && (priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)) @@ -3030,9 +2988,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -int -wlan_send_delba(mlan_private *priv, pmlan_ioctl_req pioctl_req, int tid, - t_u8 *peer_mac, int initiator) +int wlan_send_delba(mlan_private *priv, pmlan_ioctl_req pioctl_req, int tid, + t_u8 *peer_mac, int initiator) { HostCmd_DS_11N_DELBA delba; mlan_status ret; @@ -3069,8 +3026,7 @@ * * @return N/A */ -void -wlan_11n_delete_bastream(mlan_private *priv, t_u8 *del_ba) +void wlan_11n_delete_bastream(mlan_private *priv, t_u8 *del_ba) { HostCmd_DS_11N_DELBA *pdel_ba = (HostCmd_DS_11N_DELBA *)del_ba; int tid; @@ -3098,8 +3054,7 @@ * @param buf A pointer to rx_reorder_tbl structure * @return number of rx reorder table entry */ -int -wlan_get_rxreorder_tbl(mlan_private *priv, rx_reorder_tbl *buf) +int wlan_get_rxreorder_tbl(mlan_private *priv, rx_reorder_tbl *buf) { int i; rx_reorder_tbl *ptbl = buf; @@ -3113,15 +3068,14 @@ &priv->rx_reorder_tbl_ptr, MNULL, MNULL); if (!rx_reorder_tbl_ptr) { - priv->adapter->callbacks.moal_spin_unlock(priv->adapter-> - pmoal_handle, - priv-> - rx_reorder_tbl_ptr. - plock); + priv->adapter->callbacks.moal_spin_unlock( + priv->adapter->pmoal_handle, + priv->rx_reorder_tbl_ptr.plock); LEAVE(); return count; } - while (rx_reorder_tbl_ptr != (RxReorderTbl *)&priv->rx_reorder_tbl_ptr) { + while (rx_reorder_tbl_ptr != + (RxReorderTbl *)&priv->rx_reorder_tbl_ptr) { ptbl->tid = (t_u16)rx_reorder_tbl_ptr->tid; memcpy_ext(priv->adapter, ptbl->ta, rx_reorder_tbl_ptr->ta, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); @@ -3141,9 +3095,8 @@ if (count >= MLAN_MAX_RX_BASTREAM_SUPPORTED) break; } - priv->adapter->callbacks.moal_spin_unlock(priv->adapter->pmoal_handle, - priv->rx_reorder_tbl_ptr. - plock); + priv->adapter->callbacks.moal_spin_unlock( + priv->adapter->pmoal_handle, priv->rx_reorder_tbl_ptr.plock); LEAVE(); return count; } @@ -3155,8 +3108,7 @@ * @param buf A pointer to tx_ba_stream_tbl structure * @return number of ba stream table entry */ -int -wlan_get_txbastream_tbl(mlan_private *priv, tx_ba_stream_tbl *buf) +int wlan_get_txbastream_tbl(mlan_private *priv, tx_ba_stream_tbl *buf) { TxBAStreamTbl *ptxtbl; tx_ba_stream_tbl *ptbl = buf; @@ -3203,8 +3155,7 @@ * * @return 0--not allowed, other value allowed */ -t_u8 -wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band) +t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) { if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { if (bss_band & BAND_G) @@ -3227,8 +3178,7 @@ * @param ra RA to find in txbastream_tbl * @return N/A */ -void -wlan_11n_cleanup_txbastream_tbl(mlan_private *priv, t_u8 *ra) +void wlan_11n_cleanup_txbastream_tbl(mlan_private *priv, t_u8 *ra) { TxBAStreamTbl *ptx_tbl = MNULL; t_u8 i; @@ -3245,8 +3195,7 @@ return; } -void -wlan_update_11n_cap(mlan_private *pmpriv) +void wlan_update_11n_cap(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter;
diff --git a/wlan_sd8987/mlan/mlan_11n.h b/wlan_sd8987/mlan/mlan_11n.h index 601baa4..0a2a990 100755 --- a/wlan_sd8987/mlan/mlan_11n.h +++ b/wlan_sd8987/mlan/mlan_11n.h
@@ -6,7 +6,7 @@ * implemented in mlan_11n.c. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -45,34 +45,30 @@ mlan_status wlan_ret_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *resp); /** Handle the command response of 11ncfg command */ -mlan_status wlan_ret_11n_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); /** Prepare 11ncfg command */ -mlan_status wlan_cmd_11n_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); +mlan_status wlan_cmd_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); /** Prepare reject addba requst command */ mlan_status wlan_cmd_reject_addba_req(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); /** Handle the command response of rejecting addba request */ mlan_status wlan_ret_reject_addba_req(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); /** Prepare TX BF configuration command */ -mlan_status wlan_cmd_tx_bf_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); +mlan_status wlan_cmd_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); /** Handle the command response TX BF configuration */ -mlan_status wlan_ret_tx_bf_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #ifdef STA_SUPPORT -t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band); +t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band); /** Append the 802_11N tlv */ -int wlan_cmd_append_11n_tlv(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer); +int wlan_cmd_append_11n_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **ppbuffer); /** wlan fill HT cap tlv */ void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, t_u16 band, t_u8 fill); @@ -124,8 +120,8 @@ HostCmd_DS_COMMAND *cmd, int cmd_action, void *pdata_buf); -t_u8 wlan_validate_chan_offset(mlan_private *pmpriv, t_u16 band, - t_u32 chan, t_u8 chan_bw); +t_u8 wlan_validate_chan_offset(mlan_private *pmpriv, t_u16 band, t_u32 chan, + t_u8 chan_bw); /** get channel offset */ t_u8 wlan_get_second_channel_offset(mlan_private *priv, int chan); @@ -140,8 +136,7 @@ * @param mac station mac address * @return MTRUE or MFALSE */ -static INLINE t_u8 -is_station_11n_enabled(mlan_private *priv, t_u8 *mac) +static INLINE t_u8 is_station_11n_enabled(mlan_private *priv, t_u8 *mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); @@ -157,8 +152,7 @@ * @param mac station mac address * @return max amsdu size statio supported */ -static INLINE t_u16 -get_station_max_amsdu_size(mlan_private *priv, t_u8 *mac) +static INLINE t_u16 get_station_max_amsdu_size(mlan_private *priv, t_u8 *mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); @@ -175,8 +169,8 @@ * @param tid TID value for ptr * @return MTRUE or MFALSE */ -static INLINE t_u8 -is_station_ampdu_allowed(mlan_private *priv, raListTbl *ptr, int tid) +static INLINE t_u8 is_station_ampdu_allowed(mlan_private *priv, raListTbl *ptr, + int tid) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ptr->ra); @@ -187,7 +181,8 @@ return MFALSE; } return (sta_ptr->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ? - MTRUE : MFALSE; + MTRUE : + MFALSE; } return MFALSE; } @@ -200,8 +195,7 @@ * @param ra station mac address * @return N/A */ -static INLINE void -disable_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra) +static INLINE void disable_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ra); @@ -218,8 +212,7 @@ * @param ra station mac address * @return N/A */ -static INLINE void -reset_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra) +static INLINE void reset_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ra); @@ -238,8 +231,8 @@ * * @return MTRUE or MFALSE */ -static INLINE t_u8 -wlan_is_ampdu_allowed(mlan_private *priv, raListTbl *ptr, int tid) +static INLINE t_u8 wlan_is_ampdu_allowed(mlan_private *priv, raListTbl *ptr, + int tid) { if (ptr->is_tdls_link) return is_station_ampdu_allowed(priv, ptr, tid); @@ -254,14 +247,15 @@ #endif /* UAP_SUPPORT */ if (priv->sec_info.wapi_enabled && !priv->sec_info.wapi_key_on) return MFALSE; - return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED)? - MTRUE : MFALSE; + return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) ? + MTRUE : + MFALSE; } #define BA_RSSI_HIGH_THRESHOLD -70 -static INLINE void -wlan_update_station_del_ba_count(mlan_private *priv, raListTbl *ptr) +static INLINE void wlan_update_station_del_ba_count(mlan_private *priv, + raListTbl *ptr) { sta_node *sta_ptr = MNULL; t_s8 rssi; @@ -274,16 +268,9 @@ return; } -static INLINE void -wlan_update_del_ba_count(mlan_private *priv, raListTbl *ptr) +static INLINE void wlan_update_del_ba_count(mlan_private *priv, raListTbl *ptr) { t_s8 rssi; -#ifdef UAP_802_11N -#ifdef UAP_SUPPORT - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) - return wlan_update_station_del_ba_count(priv, ptr); -#endif /* UAP_SUPPORT */ -#endif /* UAP_802_11N */ if (ptr->is_tdls_link) return wlan_update_station_del_ba_count(priv, ptr); rssi = priv->snr - priv->nf; @@ -300,8 +287,8 @@ * * @return MTRUE or MFALSE */ -static INLINE t_u8 -wlan_is_amsdu_allowed(mlan_private *priv, raListTbl *ptr, int tid) +static INLINE t_u8 wlan_is_amsdu_allowed(mlan_private *priv, raListTbl *ptr, + int tid) { #ifdef UAP_SUPPORT sta_node *sta_ptr = MNULL; @@ -320,12 +307,16 @@ #endif /* UAP_SUPPORT */ if (ptr->is_tdls_link) return (priv->aggr_prio_tbl[tid].amsdu != - BA_STREAM_NOT_ALLOWED)? MTRUE : MFALSE; + BA_STREAM_NOT_ALLOWED) ? + MTRUE : + MFALSE; #define TXRATE_BITMAP_INDEX_MCS0_7 2 - return ((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)&& + return ((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED) && ((priv->is_data_rate_auto) || !(((priv->bitmap_rates[TXRATE_BITMAP_INDEX_MCS0_7]) & 0x03) || - IS_BG_RATE))) ? MTRUE : MFALSE; + IS_BG_RATE))) ? + MTRUE : + MFALSE; } /** @@ -335,8 +326,7 @@ * * @return MTRUE or MFALSE */ -static INLINE t_u8 -wlan_is_bastream_avail(mlan_private *priv) +static INLINE t_u8 wlan_is_bastream_avail(mlan_private *priv) { mlan_private *pmpriv = MNULL; t_u8 i = 0; @@ -345,9 +335,8 @@ for (i = 0; i < priv->adapter->priv_num; i++) { pmpriv = priv->adapter->priv[i]; if (pmpriv) - bastream_num += wlan_wmm_list_len((pmlan_list_head) - &pmpriv-> - tx_ba_stream_tbl_ptr); + bastream_num += wlan_wmm_list_len( + (pmlan_list_head)&pmpriv->tx_ba_stream_tbl_ptr); } bastream_max = ISSUPP_GETTXBASTREAM(priv->adapter->hw_dot_11n_dev_cap); if (bastream_max == 0) @@ -366,9 +355,9 @@ * * @return MTRUE or MFALSE */ -static INLINE t_u8 -wlan_find_stream_to_delete(mlan_private *priv, - raListTbl *ptr, int ptr_tid, int *ptid, t_u8 *ra) +static INLINE t_u8 wlan_find_stream_to_delete(mlan_private *priv, + raListTbl *ptr, int ptr_tid, + int *ptid, t_u8 *ra) { int tid; t_u8 ret = MFALSE; @@ -409,8 +398,7 @@ * * @return MTRUE or MFALSE */ -static INLINE int -wlan_is_11n_enabled(mlan_private *priv, t_u8 *ra) +static INLINE int wlan_is_11n_enabled(mlan_private *priv, t_u8 *ra) { int ret = MFALSE; ENTER();
diff --git a/wlan_sd8987/mlan/mlan_11n_aggr.c b/wlan_sd8987/mlan/mlan_11n_aggr.c index 2bfdace..53e8543 100755 --- a/wlan_sd8987/mlan/mlan_11n_aggr.c +++ b/wlan_sd8987/mlan/mlan_11n_aggr.c
@@ -56,28 +56,27 @@ * * @return Final packet size */ -static int -wlan_11n_form_amsdu_pkt(pmlan_adapter pmadapter, t_u8 *amsdu_buf, - t_u8 *data, int pkt_len, int *pad) +static int wlan_11n_form_amsdu_pkt(pmlan_adapter pmadapter, t_u8 *amsdu_buf, + t_u8 *data, int pkt_len, int *pad) { int dt_offset, amsdu_buf_offset; Rfc1042Hdr_t snap = { - 0xaa, /* LLC DSAP */ - 0xaa, /* LLC SSAP */ - 0x03, /* LLC CTRL */ - {0x00, 0x00, 0x00}, /* SNAP OUI */ - 0x0000 /* SNAP type */ - /* - * This field will be overwritten - * later with ethertype - */ + 0xaa, /* LLC DSAP */ + 0xaa, /* LLC SSAP */ + 0x03, /* LLC CTRL */ + {0x00, 0x00, 0x00}, /* SNAP OUI */ + 0x0000 /* SNAP type */ + /* + * This field will be overwritten + * later with ethertype + */ }; ENTER(); - memcpy_ext(pmadapter, amsdu_buf, data, (MLAN_MAC_ADDR_LENGTH) * 2, - (MLAN_MAC_ADDR_LENGTH) * 2); - dt_offset = amsdu_buf_offset = (MLAN_MAC_ADDR_LENGTH) * 2; + memcpy_ext(pmadapter, amsdu_buf, data, (MLAN_MAC_ADDR_LENGTH)*2, + (MLAN_MAC_ADDR_LENGTH)*2); + dt_offset = amsdu_buf_offset = (MLAN_MAC_ADDR_LENGTH)*2; snap.snap_type = *(t_u16 *)(data + dt_offset); dt_offset += sizeof(t_u16); @@ -92,7 +91,8 @@ memcpy_ext(pmadapter, amsdu_buf + amsdu_buf_offset, data + dt_offset, pkt_len - dt_offset, pkt_len - dt_offset); *pad = (((pkt_len + LLC_SNAP_LEN) & 3)) ? - (4 - (((pkt_len + LLC_SNAP_LEN)) & 3)) : 0; + (4 - (((pkt_len + LLC_SNAP_LEN)) & 3)) : + 0; LEAVE(); return pkt_len + LLC_SNAP_LEN + *pad; @@ -106,8 +106,7 @@ * * @return N/A */ -static void -wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf) +static void wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf) { TxPD *ptx_pd; mlan_adapter *pmadapter = priv->adapter; @@ -148,8 +147,8 @@ * * @return N/A */ -static INLINE void -wlan_11n_update_pktlen_amsdu_txpd(mlan_private *priv, pmlan_buffer mbuf) +static INLINE void wlan_11n_update_pktlen_amsdu_txpd(mlan_private *priv, + pmlan_buffer mbuf) { TxPD *ptx_pd; ENTER(); @@ -177,8 +176,7 @@ * * @return Number of packets */ -static int -wlan_11n_get_num_aggrpkts(t_u8 *data, int total_pkt_len) +static int wlan_11n_get_num_aggrpkts(t_u8 *data, int total_pkt_len) { int pkt_count = 0, pkt_len, pad; t_u8 hdr_len = sizeof(Eth803Hdr_t); @@ -186,15 +184,16 @@ ENTER(); while (total_pkt_len >= hdr_len) { /* Length will be in network format, change it to host */ - pkt_len = mlan_ntohs((*(t_u16 *) - (data + (2 * MLAN_MAC_ADDR_LENGTH)))); + pkt_len = mlan_ntohs( + (*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH)))); if (pkt_len > total_pkt_len) { PRINTM(MERROR, "Error in packet length.\n"); break; } pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ? - (4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : 0; + (4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : + 0; data += pkt_len + pad + sizeof(Eth803Hdr_t); total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t); ++pkt_count; @@ -215,8 +214,7 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf) +mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf) { t_u16 pkt_len; int total_pkt_len; @@ -227,12 +225,11 @@ mlan_status ret = MLAN_STATUS_FAILURE; RxPacketHdr_t *prx_pkt; mlan_buffer *daggr_mbuf = MNULL; - t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = { 0xaa, 0xaa, 0x03, - 0x00, 0x00, 0x00 - }; + t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03, + 0x00, 0x00, 0x00}; t_u8 hdr_len = sizeof(Eth803Hdr_t); - t_u8 eapol_type[2] = { 0x88, 0x8e }; - t_u8 tdls_action_type[2] = { 0x89, 0x0d }; + t_u8 eapol_type[2] = {0x88, 0x8e}; + t_u8 tdls_action_type[2] = {0x89, 0x0d}; t_u32 in_ts_sec, in_ts_usec; t_u32 out_ts_sec, out_ts_usec; t_u32 in_copy_ts_sec, in_copy_ts_usec; @@ -255,8 +252,8 @@ MLAN_USB_AGGR_MODE_NUM) { max_rx_data_size *= MAX(MLAN_USB_MAX_PKT_SIZE, - pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_align); + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align); max_rx_data_size = MAX(max_rx_data_size, MLAN_RX_DATA_BUF_SIZE); } @@ -265,36 +262,30 @@ if (total_pkt_len > (int)max_rx_data_size) { PRINTM(MERROR, "Total packet length greater than tx buffer" - " size %d\n", total_pkt_len); + " size %d\n", + total_pkt_len); goto done; } if (pmadapter->tp_state_on) - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &in_ts_sec, - &in_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &in_ts_sec, &in_ts_usec); pmbuf->use_count = wlan_11n_get_num_aggrpkts(data, total_pkt_len); - //rx_trace 7 + // rx_trace 7 if (pmadapter->tp_state_on) { - pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle, - pmbuf, - 7 /*RX_DROP_P3 */ ); - pmadapter->callbacks.moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, - 4, - pmbuf-> - use_count); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf, 7 /*RX_DROP_P3*/); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 4, pmbuf->use_count); } - if (pmadapter->tp_state_drop_point == 7 /*RX_DROP_P3 */ ) + if (pmadapter->tp_state_drop_point == 7 /*RX_DROP_P3*/) goto done; prx_pkt = (RxPacketHdr_t *)data; if (pmbuf->pdesc && !memcmp(pmadapter, prx_pkt->eth803_hdr.dest_addr, priv->curr_addr, MLAN_MAC_ADDR_LENGTH)) { if (pmadapter->callbacks.moal_recv_amsdu_packet) { - ret = pmadapter->callbacks. - moal_recv_amsdu_packet(pmadapter->pmoal_handle, - pmbuf); + ret = pmadapter->callbacks.moal_recv_amsdu_packet( + pmadapter->pmoal_handle, pmbuf); if (ret == MLAN_STATUS_PENDING) { priv->msdu_in_rx_amsdu_cnt += pmbuf->use_count; priv->amsdu_rx_cnt++; @@ -306,8 +297,8 @@ while (total_pkt_len >= hdr_len) { prx_pkt = (RxPacketHdr_t *)data; /* Length will be in network format, change it to host */ - pkt_len = mlan_ntohs((*(t_u16 *) - (data + (2 * MLAN_MAC_ADDR_LENGTH)))); + pkt_len = mlan_ntohs( + (*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH)))); if (pkt_len > total_pkt_len) { PRINTM(MERROR, "Error in packet length: total_pkt_len = %d, pkt_len = %d\n", @@ -317,7 +308,8 @@ } pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ? - (4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : 0; + (4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : + 0; total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t); @@ -351,21 +343,19 @@ daggr_mbuf->pparent = pmbuf; daggr_mbuf->priority = pmbuf->priority; if (pmadapter->tp_state_on) - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &in_copy_ts_sec, - &in_copy_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &in_copy_ts_sec, + &in_copy_ts_usec); memcpy_ext(pmadapter, daggr_mbuf->pbuf + daggr_mbuf->data_offset, data, pkt_len, daggr_mbuf->data_len); if (pmadapter->tp_state_on) { - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &out_copy_ts_sec, - &out_copy_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &out_copy_ts_sec, + &out_copy_ts_usec); copy_delay += - (t_s32)(out_copy_ts_sec - - in_copy_ts_sec) * 1000000; + (t_s32)(out_copy_ts_sec - in_copy_ts_sec) * + 1000000; copy_delay += (t_s32)(out_copy_ts_usec - in_copy_ts_usec); } @@ -378,16 +368,17 @@ if (priv->sec_info.ewpa_enabled && (!memcmp(pmadapter, daggr_mbuf->pbuf + - daggr_mbuf->data_offset + - MLAN_ETHER_PKT_TYPE_OFFSET, + daggr_mbuf->data_offset + + MLAN_ETHER_PKT_TYPE_OFFSET, eapol_type, sizeof(eapol_type)))) { - ret = wlan_prepare_cmd(priv, - HostCmd_CMD_802_11_EAPOL_PKT, - 0, 0, MNULL, daggr_mbuf); + ret = wlan_prepare_cmd( + priv, HostCmd_CMD_802_11_EAPOL_PKT, 0, + 0, MNULL, daggr_mbuf); if (ret == MLAN_STATUS_SUCCESS) - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); wlan_free_mlan_buffer(pmadapter, daggr_mbuf); data += pkt_len + pad; continue; @@ -395,23 +386,20 @@ /**process tdls packet*/ if (!memcmp(pmadapter, daggr_mbuf->pbuf + daggr_mbuf->data_offset + - MLAN_ETHER_PKT_TYPE_OFFSET, + MLAN_ETHER_PKT_TYPE_OFFSET, tdls_action_type, sizeof(tdls_action_type))) { PRINTM(MEVENT, "Recevie AMSDU TDLS action frame\n"); - wlan_process_tdls_action_frame(priv, - daggr_mbuf-> - pbuf + - daggr_mbuf-> - data_offset, - daggr_mbuf-> - data_len); + wlan_process_tdls_action_frame( + priv, + daggr_mbuf->pbuf + + daggr_mbuf->data_offset, + daggr_mbuf->data_len); } - ret = pmadapter->callbacks.moal_recv_packet(pmadapter-> - pmoal_handle, - daggr_mbuf); + ret = pmadapter->callbacks.moal_recv_packet( + pmadapter->pmoal_handle, daggr_mbuf); #ifdef UAP_SUPPORT } #endif /* UAP_SUPPORT */ @@ -432,16 +420,12 @@ data += pkt_len + pad; } if (pmadapter->tp_state_on) { - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &out_ts_sec, - &out_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &out_ts_sec, &out_ts_usec); delay += (t_s32)(out_ts_sec - in_ts_sec) * 1000000; delay += (t_s32)(out_ts_usec - in_ts_usec); - pmadapter->callbacks.moal_amsdu_tp_accounting(pmadapter-> - pmoal_handle, - delay, - copy_delay); + pmadapter->callbacks.moal_amsdu_tp_accounting( + pmadapter->pmoal_handle, delay, copy_delay); } done: @@ -465,9 +449,8 @@ * * @return Final packet size or MLAN_STATUS_FAILURE */ -int -wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, - int headroom, int ptrindex) +int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, + int headroom, int ptrindex) { int pkt_size = 0; pmlan_adapter pmadapter = priv->adapter; @@ -488,19 +471,17 @@ PRINTM(MDAT_D, "Handling Aggr packet\n"); - pmbuf_src = - (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, - &pra_list->buf_head, MNULL, MNULL); + pmbuf_src = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, &pra_list->buf_head, MNULL, MNULL); if (pmbuf_src) { - pmbuf_aggr = wlan_alloc_mlan_buffer(pmadapter, - pmadapter->tx_buf_size, 0, - MOAL_MALLOC_BUFFER); + pmbuf_aggr = wlan_alloc_mlan_buffer( + pmadapter, pmadapter->tx_buf_size, 0, + MOAL_MALLOC_BUFFER | MOAL_MEM_FLAG_ATOMIC); if (!pmbuf_aggr) { PRINTM(MERROR, "Error allocating mlan_buffer\n"); - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -527,9 +508,8 @@ #endif priv->msdu_in_tx_amsdu_cnt++; } else { - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); goto exit; } @@ -541,10 +521,8 @@ MNULL, MNULL); /* Collects TP statistics */ if (pmadapter->tp_state_on && (pkt_size > sizeof(TxPD))) - pmadapter->callbacks.moal_tp_accounting(pmadapter-> - pmoal_handle, - pmbuf_src-> - pdesc, 3); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf_src->pdesc, 3); pra_list->total_pkts--; /* decrement for every PDU taken from the list */ @@ -552,18 +530,14 @@ util_scalar_decrement(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); if (pmbuf_src) { - pkt_size += - wlan_11n_form_amsdu_pkt(pmadapter, - (data + pkt_size), - pmbuf_src->pbuf + - pmbuf_src->data_offset, - pmbuf_src->data_len, - &pad); + pkt_size += wlan_11n_form_amsdu_pkt( + pmadapter, (data + pkt_size), + pmbuf_src->pbuf + pmbuf_src->data_offset, + pmbuf_src->data_len, &pad); DBG_HEXDUMP(MDAT_D, "pmbuf_src", pmbuf_src, sizeof(mlan_buffer)); @@ -575,10 +549,9 @@ priv->wmm.ra_list_spinlock); if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) { - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -606,10 +579,8 @@ if (pmadapter->tp_state_on) { pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle, pmbuf_aggr, 4); - pmadapter->callbacks.moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, - 5, - msdu_in_tx_amsdu_cnt); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 5, msdu_in_tx_amsdu_cnt); } /* Drop Tx packets at drop point 4 */ @@ -630,10 +601,9 @@ priv->wmm.ra_list_spinlock); if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) { - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID; wlan_write_data_complete(pmadapter, pmbuf_aggr, MLAN_STATUS_FAILURE); @@ -662,9 +632,8 @@ util_scalar_increment(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); pmbuf_aggr->flags |= MLAN_BUF_FLAG_REQUEUED_PKT; - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n"); pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID; break; @@ -690,10 +659,9 @@ } pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur = pmadapter->bssprio_tbl[priv->bss_priority] - .bssprio_cur->pnext; - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + .bssprio_cur->pnext; + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); } PRINTM_GET_SYS_TIME(MDATA, &sec, &usec); PRINTM_NETINTF(MDATA, priv);
diff --git a/wlan_sd8987/mlan/mlan_11n_aggr.h b/wlan_sd8987/mlan/mlan_11n_aggr.h index b7aca6b..922d4a8 100755 --- a/wlan_sd8987/mlan/mlan_11n_aggr.h +++ b/wlan_sd8987/mlan/mlan_11n_aggr.h
@@ -4,7 +4,7 @@ * of 11n aggregation functionalities * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_11n_rxreorder.c b/wlan_sd8987/mlan/mlan_11n_rxreorder.c index 441270f..27b94bf 100755 --- a/wlan_sd8987/mlan/mlan_11n_rxreorder.c +++ b/wlan_sd8987/mlan/mlan_11n_rxreorder.c
@@ -55,8 +55,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_11n_dispatch_amsdu_pkt(mlan_private *priv, pmlan_buffer pmbuf) +static mlan_status wlan_11n_dispatch_amsdu_pkt(mlan_private *priv, + pmlan_buffer pmbuf) { RxPD *prx_pd; prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset); @@ -83,9 +83,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_11n_dispatch_pkt(t_void *priv, t_void *payload, - RxReorderTbl *rx_reor_tbl_ptr) +static mlan_status wlan_11n_dispatch_pkt(t_void *priv, t_void *payload, + RxReorderTbl *rx_reor_tbl_ptr) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef STA_SUPPORT @@ -132,9 +131,8 @@ * * @return N/A */ -static void -mlan_11n_rxreorder_timer_restart(pmlan_adapter pmadapter, - RxReorderTbl *rx_reor_tbl_ptr) +static void mlan_11n_rxreorder_timer_restart(pmlan_adapter pmadapter, + RxReorderTbl *rx_reor_tbl_ptr) { t_u16 min_flush_time = 0; ENTER(); @@ -145,15 +143,13 @@ min_flush_time = MIN_FLUSH_TIMER_MS; if (rx_reor_tbl_ptr->timer_context.timer_is_set) - pmadapter->callbacks.moal_stop_timer(pmadapter->pmoal_handle, - rx_reor_tbl_ptr-> - timer_context.timer); + pmadapter->callbacks.moal_stop_timer( + pmadapter->pmoal_handle, + rx_reor_tbl_ptr->timer_context.timer); - pmadapter->callbacks.moal_start_timer(pmadapter->pmoal_handle, - rx_reor_tbl_ptr->timer_context. - timer, MFALSE, - (rx_reor_tbl_ptr->win_size * - min_flush_time)); + pmadapter->callbacks.moal_start_timer( + pmadapter->pmoal_handle, rx_reor_tbl_ptr->timer_context.timer, + MFALSE, (rx_reor_tbl_ptr->win_size * min_flush_time)); rx_reor_tbl_ptr->timer_context.timer_is_set = MTRUE; LEAVE(); @@ -169,10 +165,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_11n_dispatch_pkt_until_start_win(t_void *priv, - RxReorderTbl *rx_reor_tbl_ptr, - int start_win) +static mlan_status wlan_11n_dispatch_pkt_until_start_win( + t_void *priv, RxReorderTbl *rx_reor_tbl_ptr, int start_win) { int no_pkt_to_send, i, xchg; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -182,22 +176,20 @@ ENTER(); no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ? - MIN((start_win - rx_reor_tbl_ptr->start_win), - rx_reor_tbl_ptr->win_size) : rx_reor_tbl_ptr->win_size; + MIN((start_win - rx_reor_tbl_ptr->start_win), + rx_reor_tbl_ptr->win_size) : + rx_reor_tbl_ptr->win_size; for (i = 0; i < no_pkt_to_send; ++i) { - pmpriv->adapter->callbacks.moal_spin_lock(pmpriv->adapter-> - pmoal_handle, - pmpriv->rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_lock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); rx_tmp_ptr = MNULL; if (rx_reor_tbl_ptr->rx_reorder_ptr[i]) { rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i]; rx_reor_tbl_ptr->rx_reorder_ptr[i] = MNULL; } - pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter-> - pmoal_handle, - pmpriv-> - rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_unlock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); if (rx_tmp_ptr) wlan_11n_dispatch_pkt(priv, rx_tmp_ptr, rx_reor_tbl_ptr); @@ -217,9 +209,8 @@ } rx_reor_tbl_ptr->start_win = start_win; - pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter-> - pmoal_handle, - pmpriv->rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_unlock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); LEAVE(); return ret; @@ -233,8 +224,8 @@ * * @return N/A */ -static t_void -wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, RxReorderTbl *rx_reor_tbl_ptr) +static t_void wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, + RxReorderTbl *rx_reor_tbl_ptr) { ENTER(); @@ -254,8 +245,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_11n_scan_and_dispatch(t_void *priv, RxReorderTbl *rx_reor_tbl_ptr) +static mlan_status wlan_11n_scan_and_dispatch(t_void *priv, + RxReorderTbl *rx_reor_tbl_ptr) { int i, j, xchg; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -265,23 +256,18 @@ ENTER(); for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) { - pmpriv->adapter->callbacks.moal_spin_lock(pmpriv->adapter-> - pmoal_handle, - pmpriv->rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_lock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); if (!rx_reor_tbl_ptr->rx_reorder_ptr[i]) { - pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv-> - adapter-> - pmoal_handle, - pmpriv-> - rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_unlock( + pmpriv->adapter->pmoal_handle, + pmpriv->rx_pkt_lock); break; } rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i]; rx_reor_tbl_ptr->rx_reorder_ptr[i] = MNULL; - pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter-> - pmoal_handle, - pmpriv-> - rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_unlock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); wlan_11n_dispatch_pkt(priv, rx_tmp_ptr, rx_reor_tbl_ptr); } @@ -303,9 +289,8 @@ rx_reor_tbl_ptr->start_win = (rx_reor_tbl_ptr->start_win + i) & (MAX_TID_VALUE - 1); - pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter-> - pmoal_handle, - pmpriv->rx_pkt_lock); + pmpriv->adapter->callbacks.moal_spin_unlock( + pmpriv->adapter->pmoal_handle, pmpriv->rx_pkt_lock); LEAVE(); return ret; } @@ -319,9 +304,8 @@ * * @return N/A */ -static t_void -wlan_11n_delete_rxreorder_tbl_entry(mlan_private *priv, - RxReorderTbl *rx_reor_tbl_ptr) +static t_void wlan_11n_delete_rxreorder_tbl_entry(mlan_private *priv, + RxReorderTbl *rx_reor_tbl_ptr) { pmlan_adapter pmadapter = priv->adapter; @@ -333,24 +317,21 @@ } mlan_block_rx_process(pmadapter, MTRUE); - wlan_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr, - (rx_reor_tbl_ptr->start_win + - rx_reor_tbl_ptr-> - win_size) & (MAX_TID_VALUE - 1)); + wlan_11n_dispatch_pkt_until_start_win( + priv, rx_reor_tbl_ptr, + (rx_reor_tbl_ptr->start_win + rx_reor_tbl_ptr->win_size) & + (MAX_TID_VALUE - 1)); if (rx_reor_tbl_ptr->timer_context.timer) { if (rx_reor_tbl_ptr->timer_context.timer_is_set) { - priv->adapter->callbacks.moal_stop_timer(pmadapter-> - pmoal_handle, - rx_reor_tbl_ptr-> - timer_context. - timer); + priv->adapter->callbacks.moal_stop_timer( + pmadapter->pmoal_handle, + rx_reor_tbl_ptr->timer_context.timer); rx_reor_tbl_ptr->timer_context.timer_is_set = MFALSE; } - priv->adapter->callbacks.moal_free_timer(pmadapter-> - pmoal_handle, - rx_reor_tbl_ptr-> - timer_context.timer); + priv->adapter->callbacks.moal_free_timer( + pmadapter->pmoal_handle, + rx_reor_tbl_ptr->timer_context.timer); rx_reor_tbl_ptr->timer_context.timer = MNULL; } @@ -360,9 +341,9 @@ pmadapter->callbacks.moal_spin_lock, pmadapter->callbacks.moal_spin_unlock); - pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle, - (t_u8 *)rx_reor_tbl_ptr-> - rx_reorder_ptr); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)rx_reor_tbl_ptr->rx_reorder_ptr); pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle, (t_u8 *)rx_reor_tbl_ptr); mlan_block_rx_process(pmadapter, MFALSE); @@ -377,8 +358,7 @@ * * @return Last used sequence number */ -static int -wlan_11n_find_last_seqnum(RxReorderTbl *rx_reorder_tbl_ptr) +static int wlan_11n_find_last_seqnum(RxReorderTbl *rx_reorder_tbl_ptr) { int i; @@ -401,8 +381,8 @@ * * @return N/A */ -static t_void -wlan_start_flush_data(mlan_private *priv, RxReorderTbl *rx_reor_tbl_ptr) +static t_void wlan_start_flush_data(mlan_private *priv, + RxReorderTbl *rx_reor_tbl_ptr) { int startWin; @@ -412,11 +392,10 @@ startWin = wlan_11n_find_last_seqnum(rx_reor_tbl_ptr); if (startWin >= 0) { PRINTM(MINFO, "Flush data %d\n", startWin); - wlan_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr, - ((rx_reor_tbl_ptr-> - start_win + startWin + - 1) & (MAX_TID_VALUE - - 1))); + wlan_11n_dispatch_pkt_until_start_win( + priv, rx_reor_tbl_ptr, + ((rx_reor_tbl_ptr->start_win + startWin + 1) & + (MAX_TID_VALUE - 1))); } wlan_11n_display_tbl_ptr(priv->adapter, rx_reor_tbl_ptr); LEAVE(); @@ -429,8 +408,7 @@ * * @return N/A */ -static t_void -wlan_flush_data(t_void *context) +static t_void wlan_flush_data(t_void *context) { reorder_tmr_cnxt_t *reorder_cnxt = (reorder_tmr_cnxt_t *)context; ENTER(); @@ -455,9 +433,8 @@ * * @return N/A */ -static t_void -wlan_11n_create_rxreorder_tbl(mlan_private *priv, t_u8 *ta, - int tid, int win_size, int seq_num) +static t_void wlan_11n_create_rxreorder_tbl(mlan_private *priv, t_u8 *ta, + int tid, int win_size, int seq_num) { int i; pmlan_adapter pmadapter = priv->adapter; @@ -491,11 +468,11 @@ } util_init_list((pmlan_linked_list)new_node); - if (pmadapter->callbacks. - moal_malloc(pmadapter->pmoal_handle, - sizeof(pmlan_buffer) * win_size, MLAN_MEM_DEF, - (t_u8 **)&new_node->rx_reorder_ptr)) { - PRINTM(MERROR, "Rx reorder table memory allocation" "failed\n"); + if (pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, sizeof(pmlan_buffer) * win_size, + MLAN_MEM_DEF, (t_u8 **)&new_node->rx_reorder_ptr)) { + PRINTM(MERROR, "Rx reorder table memory allocation" + "failed\n"); pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle, (t_u8 *)new_node); mlan_block_rx_process(pmadapter, MFALSE); @@ -562,8 +539,7 @@ * * @return A pointer to structure RxReorderTbl */ -RxReorderTbl * -wlan_11n_get_rxreorder_tbl(mlan_private *priv, int tid, t_u8 *ta) +RxReorderTbl *wlan_11n_get_rxreorder_tbl(mlan_private *priv, int tid, t_u8 *ta) { RxReorderTbl *rx_reor_tbl_ptr; @@ -603,9 +579,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *cmd, - t_void *pdata_buf) +mlan_status wlan_cmd_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_DS_11N_ADDBA_REQ *padd_ba_req = (HostCmd_DS_11N_ADDBA_REQ *)&cmd->params.add_ba_req; @@ -637,14 +612,16 @@ * * @return MTRUE/MFALSE */ -static t_u8 -wlan_is_addba_reject(mlan_private *priv, t_u8 tid) +static t_u8 wlan_is_addba_reject(mlan_private *priv, t_u8 tid) { + if (tid >= MAX_NUM_TID) { + PRINTM(MERROR, "Wrong TID =%d", tid); + return ADDBA_RSP_STATUS_REJECT; + } #ifdef STA_SUPPORT #endif return priv->addba_reject[tid]; } - /** * @brief This function prepares command for adding a block ack * response. @@ -655,9 +632,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11n_addba_rspgen(mlan_private *priv, - HostCmd_DS_COMMAND *cmd, void *pdata_buf) +mlan_status wlan_cmd_11n_addba_rspgen(mlan_private *priv, + HostCmd_DS_COMMAND *cmd, void *pdata_buf) { HostCmd_DS_11N_ADDBA_RSP *padd_ba_rsp = (HostCmd_DS_11N_ADDBA_RSP *)&cmd->params.add_ba_rsp; @@ -689,7 +665,7 @@ padd_ba_rsp->block_ack_param_set = pevt_addba_req->block_ack_param_set; tid = (padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_TID_MASK) >> - BLOCKACKPARAM_TID_POS; + BLOCKACKPARAM_TID_POS; if (wlan_is_addba_reject(priv, tid) #ifdef STA_SUPPORT || ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) && @@ -703,7 +679,7 @@ priv->adapter->callbacks.moal_spin_unlock) > RX_LOW_THRESHOLD)) #endif - ) + ) padd_ba_rsp->status_code = wlan_cpu_to_le16(ADDBA_RSP_STATUS_DECLINED); else @@ -718,7 +694,8 @@ padd_ba_rsp->block_ack_param_set |= (priv->add_ba_param.rx_win_size << BLOCKACKPARAM_WINSIZE_POS); win_size = (padd_ba_rsp->block_ack_param_set & - BLOCKACKPARAM_WINSIZE_MASK) >> BLOCKACKPARAM_WINSIZE_POS; + BLOCKACKPARAM_WINSIZE_MASK) >> + BLOCKACKPARAM_WINSIZE_POS; if (win_size == 0) padd_ba_rsp->status_code = @@ -747,8 +724,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *cmd, void *pdata_buf) +mlan_status wlan_cmd_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *cmd, + void *pdata_buf) { HostCmd_DS_11N_DELBA *pdel_ba = (HostCmd_DS_11N_DELBA *)&cmd->params.del_ba; @@ -781,9 +758,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -mlan_11n_rxreorder_pkt(void *priv, t_u16 seq_num, t_u16 tid, - t_u8 *ta, t_u8 pkt_type, void *payload) +mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seq_num, t_u16 tid, + t_u8 *ta, t_u8 pkt_type, void *payload) { RxReorderTbl *rx_reor_tbl_ptr; int prev_start_win, start_win, end_win, win_size; @@ -833,9 +809,9 @@ rx_reor_tbl_ptr->last_seq = seq_num; if (pkt_type != PKT_TYPE_BAR) - wlan_11n_dispatch_pkt - (priv, payload, - rx_reor_tbl_ptr); + wlan_11n_dispatch_pkt( + priv, payload, + rx_reor_tbl_ptr); } LEAVE(); return ret; @@ -846,7 +822,8 @@ DEFAULT_SEQ_NUM)) { end_win = (rx_reor_tbl_ptr->start_win + rx_reor_tbl_ptr->win_size - - 1) & (MAX_TID_VALUE - 1); + 1) & + (MAX_TID_VALUE - 1); if (((end_win > rx_reor_tbl_ptr->start_win) && (rx_reor_tbl_ptr->last_seq >= @@ -861,40 +838,38 @@ end_win)))) { PRINTM(MDAT_D, "Update start_win: last_seq=%d, start_win=%d seq_num=%d\n", - rx_reor_tbl_ptr-> - last_seq, - rx_reor_tbl_ptr-> - start_win, seq_num); + rx_reor_tbl_ptr->last_seq, + rx_reor_tbl_ptr + ->start_win, + seq_num); rx_reor_tbl_ptr->start_win = - rx_reor_tbl_ptr-> - last_seq + 1; + rx_reor_tbl_ptr + ->last_seq + + 1; } else if ((seq_num < - rx_reor_tbl_ptr->start_win) - && (seq_num > - rx_reor_tbl_ptr-> - last_seq)) { + rx_reor_tbl_ptr->start_win) && + (seq_num > + rx_reor_tbl_ptr->last_seq)) { PRINTM(MDAT_D, "Update start_win: last_seq=%d, start_win=%d seq_num=%d\n", - rx_reor_tbl_ptr-> - last_seq, - rx_reor_tbl_ptr-> - start_win, seq_num); + rx_reor_tbl_ptr->last_seq, + rx_reor_tbl_ptr + ->start_win, + seq_num); rx_reor_tbl_ptr->start_win = - rx_reor_tbl_ptr-> - last_seq + 1; + rx_reor_tbl_ptr + ->last_seq + + 1; } } } } if (rx_reor_tbl_ptr->force_no_drop) { - wlan_11n_dispatch_pkt_until_start_win(priv, - rx_reor_tbl_ptr, - (rx_reor_tbl_ptr-> - start_win + - rx_reor_tbl_ptr-> - win_size) & - (MAX_TID_VALUE - - 1)); + wlan_11n_dispatch_pkt_until_start_win( + priv, rx_reor_tbl_ptr, + (rx_reor_tbl_ptr->start_win + + rx_reor_tbl_ptr->win_size) & + (MAX_TID_VALUE - 1)); if (pkt_type != PKT_TYPE_BAR) rx_reor_tbl_ptr->start_win = seq_num; mlan_11n_rxreorder_timer_restart(pmadapter, @@ -947,7 +922,7 @@ */ if (pkt_type == PKT_TYPE_BAR) seq_num = ((seq_num + win_size) - 1) & - (MAX_TID_VALUE - 1); + (MAX_TID_VALUE - 1); PRINTM(MDAT_D, "2:seq_num %d start_win %d win_size %d end_win %d\n", @@ -964,42 +939,40 @@ start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1; - ret = wlan_11n_dispatch_pkt_until_start_win(priv, - rx_reor_tbl_ptr, - start_win); + ret = wlan_11n_dispatch_pkt_until_start_win( + priv, rx_reor_tbl_ptr, start_win); if (ret) goto done; } PRINTM(MDAT_D, "3:seq_num %d start_win %d win_size %d" - " end_win %d\n", seq_num, start_win, win_size, end_win); + " end_win %d\n", + seq_num, start_win, win_size, end_win); if (pkt_type != PKT_TYPE_BAR) { if (seq_num >= start_win) { if (rx_reor_tbl_ptr->rx_reorder_ptr[seq_num - - start_win]) - { + start_win]) { PRINTM(MDAT_D, "Drop Duplicate Pkt\n"); ret = MLAN_STATUS_FAILURE; goto done; } - rx_reor_tbl_ptr->rx_reorder_ptr[seq_num - - start_win] = + rx_reor_tbl_ptr + ->rx_reorder_ptr[seq_num - start_win] = payload; - } else { /* Wrap condition */ - if (rx_reor_tbl_ptr->rx_reorder_ptr[(seq_num + - (MAX_TID_VALUE)) - - - start_win]) - { + } else { /* Wrap condition */ + if (rx_reor_tbl_ptr + ->rx_reorder_ptr[(seq_num + + (MAX_TID_VALUE)) - + start_win]) { PRINTM(MDAT_D, "Drop Duplicate Pkt\n"); ret = MLAN_STATUS_FAILURE; goto done; } - rx_reor_tbl_ptr->rx_reorder_ptr[(seq_num + - (MAX_TID_VALUE)) - - start_win] = - payload; + rx_reor_tbl_ptr + ->rx_reorder_ptr[(seq_num + + (MAX_TID_VALUE)) - + start_win] = payload; } } @@ -1037,9 +1010,8 @@ * * @return N/A */ -void -mlan_11n_delete_bastream_tbl(mlan_private *priv, int tid, t_u8 *peer_mac, - t_u8 type, int initiator, t_u16 reason_code) +void mlan_11n_delete_bastream_tbl(mlan_private *priv, int tid, t_u8 *peer_mac, + t_u8 type, int initiator, t_u16 reason_code) { RxReorderTbl *rx_reor_tbl_ptr; TxBAStreamTbl *ptxtbl; @@ -1095,8 +1067,8 @@ #define MIN_BA_SETUP_PACKET_REQIRED 1024 ra_list->ba_packet_threshold = MIN_BA_SETUP_PACKET_REQIRED + - wlan_get_random_ba_threshold(priv-> - adapter); + wlan_get_random_ba_threshold( + priv->adapter); } } } @@ -1113,8 +1085,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_11n_addba_resp(mlan_private *priv, HostCmd_DS_COMMAND *resp) +mlan_status wlan_ret_11n_addba_resp(mlan_private *priv, + HostCmd_DS_COMMAND *resp) { HostCmd_DS_11N_ADDBA_RSP *padd_ba_rsp = (HostCmd_DS_11N_ADDBA_RSP *)&resp->params.add_ba_rsp; @@ -1131,7 +1103,7 @@ padd_ba_rsp->ssn = wlan_le16_to_cpu(padd_ba_rsp->ssn); tid = (padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_TID_MASK) >> - BLOCKACKPARAM_TID_POS; + BLOCKACKPARAM_TID_POS; /* Check if we had rejected the ADDBA, if yes then do not create the * stream */ @@ -1145,11 +1117,10 @@ BLOCKACKPARAM_WINSIZE_MASK) >> BLOCKACKPARAM_WINSIZE_POS), padd_ba_rsp->block_ack_param_set & - BLOCKACKPARAM_AMSDU_SUPP_MASK); + BLOCKACKPARAM_AMSDU_SUPP_MASK); - rx_reor_tbl_ptr = - wlan_11n_get_rxreorder_tbl(priv, tid, - padd_ba_rsp->peer_mac_addr); + rx_reor_tbl_ptr = wlan_11n_get_rxreorder_tbl( + priv, tid, padd_ba_rsp->peer_mac_addr); if (rx_reor_tbl_ptr) { rx_reor_tbl_ptr->ba_status = BA_STREAM_SETUP_COMPLETE; if ((padd_ba_rsp->block_ack_param_set & @@ -1162,9 +1133,8 @@ } else { PRINTM(MCMND, "ADDBA RSP: Failed(" MACSTR " tid=%d)\n", MAC2STR(padd_ba_rsp->peer_mac_addr), tid); - rx_reor_tbl_ptr = - wlan_11n_get_rxreorder_tbl(priv, tid, - padd_ba_rsp->peer_mac_addr); + rx_reor_tbl_ptr = wlan_11n_get_rxreorder_tbl( + priv, tid, padd_ba_rsp->peer_mac_addr); if (rx_reor_tbl_ptr) wlan_11n_delete_rxreorder_tbl_entry(priv, rx_reor_tbl_ptr); @@ -1182,10 +1152,11 @@ * * @return N/A */ -void -wlan_11n_ba_stream_timeout(mlan_private *priv, HostCmd_DS_11N_BATIMEOUT *event) +void wlan_11n_ba_stream_timeout(mlan_private *priv, + HostCmd_DS_11N_BATIMEOUT *event) { HostCmd_DS_11N_DELBA delba; + mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -1197,9 +1168,12 @@ delba.del_ba_param_set |= (t_u16)event->tid << DELBA_TID_POS; delba.del_ba_param_set |= (t_u16)event->origninator - << DELBA_INITIATOR_POS; + << DELBA_INITIATOR_POS; delba.reason_code = REASON_CODE_STA_TIMEOUT; - wlan_prepare_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, MNULL, &delba); + ret = wlan_prepare_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, MNULL, + &delba); + if (ret) + PRINTM(MERROR, "Failed to send cmd to FW\n"); LEAVE(); return; @@ -1212,20 +1186,16 @@ * * @return N/A */ -void -wlan_11n_cleanup_reorder_tbl(mlan_private *priv) +void wlan_11n_cleanup_reorder_tbl(mlan_private *priv) { RxReorderTbl *del_tbl_ptr; ENTER(); - while ((del_tbl_ptr = - (RxReorderTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock))) { + while ((del_tbl_ptr = (RxReorderTbl *)util_peek_list( + priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock))) { wlan_11n_delete_rxreorder_tbl_entry(priv, del_tbl_ptr); } @@ -1243,8 +1213,7 @@ * @param len event_buf length * @return N/A */ -void -wlan_11n_rxba_sync_event(mlan_private *priv, t_u8 *event_buf, t_u16 len) +void wlan_11n_rxba_sync_event(mlan_private *priv, t_u8 *event_buf, t_u16 len) { MrvlIEtypes_RxBaSync_t *tlv_rxba = (MrvlIEtypes_RxBaSync_t *)event_buf; t_u16 tlv_type, tlv_len; @@ -1267,9 +1236,8 @@ PRINTM(MEVENT, MACSTR " tid=%d seq_num=%d bitmap_len=%d\n", MAC2STR(tlv_rxba->mac), tlv_rxba->tid, tlv_rxba->seq_num, tlv_rxba->bitmap_len); - rx_reor_tbl_ptr = - wlan_11n_get_rxreorder_tbl(priv, tlv_rxba->tid, - tlv_rxba->mac); + rx_reor_tbl_ptr = wlan_11n_get_rxreorder_tbl( + priv, tlv_rxba->tid, tlv_rxba->mac); if (!rx_reor_tbl_ptr) { PRINTM(MEVENT, "Can not find rx_reorder_tbl\n"); goto done; @@ -1282,21 +1250,20 @@ for (j = 0; j < 8; j++) { if (tlv_rxba->bitmap[i] & (1 << j)) { seq_num = (tlv_rxba->seq_num + i * 8 + - j) & (MAX_TID_VALUE - 1); + j) & + (MAX_TID_VALUE - 1); PRINTM(MEVENT, "Fw dropped packet, seq=%d start_win=%d, win_size=%d\n", seq_num, rx_reor_tbl_ptr->start_win, rx_reor_tbl_ptr->win_size); if (MLAN_STATUS_SUCCESS != - mlan_11n_rxreorder_pkt(priv, - seq_num, - tlv_rxba-> - tid, - tlv_rxba-> - mac, 0, - (t_void *) - RX_PKT_DROPPED_IN_FW)) { + mlan_11n_rxreorder_pkt( + priv, seq_num, + tlv_rxba->tid, + tlv_rxba->mac, 0, + (t_void *) + RX_PKT_DROPPED_IN_FW)) { PRINTM(MERROR, "Fail to handle dropped packet, seq=%d\n", seq_num); @@ -1321,8 +1288,7 @@ * @param ta ta to find in reordering table * @return N/A */ -void -wlan_cleanup_reorder_tbl(mlan_private *priv, t_u8 *ta) +void wlan_cleanup_reorder_tbl(mlan_private *priv, t_u8 *ta) { RxReorderTbl *rx_reor_tbl_ptr = MNULL; t_u8 i; @@ -1345,20 +1311,16 @@ * * @return N/A */ -static void -wlan_set_rxreorder_tbl_no_drop_flag(mlan_private *priv, t_u8 flag) +static void wlan_set_rxreorder_tbl_no_drop_flag(mlan_private *priv, t_u8 flag) { RxReorderTbl *rx_reor_tbl_ptr; ENTER(); - rx_reor_tbl_ptr = - (RxReorderTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + rx_reor_tbl_ptr = (RxReorderTbl *)util_peek_list( + priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!rx_reor_tbl_ptr) { LEAVE(); return; @@ -1380,8 +1342,7 @@ * @param flag MTRUE/MFALSE * @return N/A */ -void -wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag) +void wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag) { t_u8 i; pmlan_private priv = MNULL; @@ -1402,20 +1363,16 @@ * * @return N/A */ -static void -wlan_flush_priv_rxreorder_tbl(mlan_private *priv) +static void wlan_flush_priv_rxreorder_tbl(mlan_private *priv) { RxReorderTbl *rx_reor_tbl_ptr; ENTER(); - rx_reor_tbl_ptr = - (RxReorderTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + rx_reor_tbl_ptr = (RxReorderTbl *)util_peek_list( + priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!rx_reor_tbl_ptr) { LEAVE(); return; @@ -1439,8 +1396,7 @@ * @param pmadapter A pointer to mlan_adapter * @return N/A */ -void -wlan_flush_rxreorder_tbl(pmlan_adapter pmadapter) +void wlan_flush_rxreorder_tbl(pmlan_adapter pmadapter) { t_u8 i; pmlan_private priv = MNULL; @@ -1461,10 +1417,10 @@ * * @return N/A */ -static void -wlan_update_ampdu_rxwinsize(pmlan_adapter pmadapter, t_u8 coex_flag) +static void wlan_update_ampdu_rxwinsize(pmlan_adapter pmadapter, t_u8 coex_flag) { t_u8 i; + t_u8 j; t_u32 rx_win_size = 0; pmlan_private priv = MNULL; @@ -1494,7 +1450,9 @@ priv->add_ba_param.rx_win_size = MLAN_UAP_COEX_AMPDU_DEF_RXWINSIZE; #endif - + priv->add_ba_param.rx_win_size = + MIN(priv->add_ba_param.rx_win_size, + priv->user_rxwinsize); } else { priv->add_ba_param.rx_win_size = priv->user_rxwinsize; @@ -1505,11 +1463,12 @@ pmadapter->coex_rx_win_size; if (rx_win_size != priv->add_ba_param.rx_win_size) { if (priv->media_connected == MTRUE) { - for (i = 0; i < MAX_NUM_TID; i++) - wlan_11n_delba(priv, i); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + for (j = 0; j < MAX_NUM_TID; j++) + wlan_11n_delba(priv, j); + wlan_recv_event( + priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } } } @@ -1525,8 +1484,7 @@ * * @return N/A */ -void -wlan_coex_ampdu_rxwinsize(pmlan_adapter pmadapter) +void wlan_coex_ampdu_rxwinsize(pmlan_adapter pmadapter) { t_u8 i; pmlan_private priv = MNULL;
diff --git a/wlan_sd8987/mlan/mlan_11n_rxreorder.h b/wlan_sd8987/mlan/mlan_11n_rxreorder.h index 2aae43e..d409e85 100755 --- a/wlan_sd8987/mlan/mlan_11n_rxreorder.h +++ b/wlan_sd8987/mlan/mlan_11n_rxreorder.h
@@ -4,7 +4,7 @@ * of 11n RxReordering functionalities * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_cfp.c b/wlan_sd8987/mlan/mlan_cfp.c index 702d610..899df13 100755 --- a/wlan_sd8987/mlan/mlan_cfp.c +++ b/wlan_sd8987/mlan/mlan_cfp.c
@@ -5,7 +5,7 @@ * related code * * - * Copyright 2009-2021 NXP + * Copyright 2009-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -73,30 +73,35 @@ /** Region code mapping table */ static country_code_mapping_t country_code_mapping[] = { - {"WW", 0x00, 0x00}, /* World */ - {"US", 0x10, 0x10}, /* US FCC */ - {"CA", 0x10, 0x20}, /* IC Canada */ - {"SG", 0x10, 0x10}, /* Singapore */ - {"EU", 0x30, 0x30}, /* ETSI */ - {"AU", 0x30, 0x30}, /* Australia */ - {"KR", 0x30, 0x30}, /* Republic Of Korea */ - {"JP", 0xFF, 0x40}, /* Japan */ - {"CN", 0x30, 0x50}, /* China */ - {"BR", 0x01, 0x09}, /* Brazil */ - {"RU", 0x30, 0x0f}, /* Russia */ - {"IN", 0x10, 0x06}, /* India */ - {"MY", 0x30, 0x06}, /* Malaysia */ - {"NZ", 0x30, 0x30}, /* New Zeland */ - {"MX", 0x10, 0x07}, /* Mexico */ + {"WW", 0x00, 0x00}, /* World */ + {"US", 0x10, 0x10}, /* US FCC */ + {"CA", 0x10, 0x20}, /* IC Canada */ + {"SG", 0x10, 0x10}, /* Singapore */ + {"EU", 0x30, 0x30}, /* ETSI */ + {"AU", 0x30, 0x30}, /* Australia */ + {"KR", 0x30, 0x30}, /* Republic Of Korea */ + {"JP", 0xFF, 0x40}, /* Japan */ + {"CN", 0x30, 0x50}, /* China */ + {"BR", 0x01, 0x09}, /* Brazil */ + {"RU", 0x30, 0x0f}, /* Russia */ + {"IN", 0x10, 0x06}, /* India */ + {"MY", 0x30, 0x06}, /* Malaysia */ + {"NZ", 0x30, 0x30}, /* New Zeland */ + {"MX", 0x10, 0x07}, /* Mexico */ }; /** Country code for ETSI */ static t_u8 eu_country_code_table[][COUNTRY_CODE_LEN] = { - "AL", "AD", "AT", "AU", "BY", "BE", "BA", "BG", "HR", "CY", "CZ", "DK", - "EE", "FI", "FR", "MK", "DE", "GR", "HU", "IS", "IE", "IT", "KR", "LV", - "LI", "LT", "LU", "MT", "MD", "MC", "ME", "NL", "NO", "PL", "RO", "RU", - "SM", "RS", "SI", "SK", "ES", "SE", "CH", "TR", "UA", "UK", "GB", "NZ" -}; + "AL", "AD", "AT", "AU", "BE", "BA", "BG", "HR", "CY", "CZ", "DK", "EE", + "FI", "FR", "MK", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", + "LU", "MT", "MD", "MC", "ME", "NL", "NO", "PL", "RO", "SM", "RS", "SI", + "SK", "ES", "SE", "CH", "TR", "UA", "UK", "GB", "NZ", "DZ", "AO", "AM", + "AW", "BH", "BD", "BT", "BO", "BQ", "BW", "VG", "BF", "BI", "KH", "CL", + "KM", "CG", "CD", "CW", "EG", "FO", "GF", "PF", "GE", "GI", "GP", "HK", + "IN", "ID", "IM", "IL", "JE", "KE", "XK", "KW", "LA", "LR", "MW", "MV", + "MQ", "MR", "YT", "MA", "MZ", "MM", "NA", "NC", "NE", "NG", "OM", "PS", + "PT", "QA", "RW", "RE", "BL", "MF", "VC", "SA", "SC", "ZA", "SZ", "SY", + "TZ", "TG", "TN", "AE", "VA", "EH", "YE", "ZM", "ZW"}; /** * The structure for Channel-Frequency-Power table @@ -125,9 +130,7 @@ {10, 2457, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x1c, 0, 0}}, {12, 2467, WLAN_TX_PWR_00_DEFAULT, MTRUE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_00_DEFAULT, MTRUE, {0x1d, 0, 0}} -}; - + {13, 2472, WLAN_TX_PWR_00_DEFAULT, MTRUE, {0x1d, 0, 0}}}; /* Format { Channel, Frequency (MHz), MaxTxPower } */ /** Band: 'B/G', Region: USA FCC/Canada IC */ static chan_freq_power_t channel_freq_power_US_BG[] = { @@ -141,8 +144,7 @@ {8, 2447, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x1c, 0, 0}}, {9, 2452, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x1c, 0, 0}}, {10, 2457, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x1c, 0, 0}}, - {11, 2462, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x1c, 0, 0}} -}; + {11, 2462, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x1c, 0, 0}}}; /** Band: 'B/G', Region: Europe ETSI/China */ static chan_freq_power_t channel_freq_power_EU_BG[] = { @@ -157,9 +159,8 @@ {9, 2452, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1c, 0, 0}}, {10, 2457, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1c, 0, 0}}, - {12, 2467, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1d, 0, 0}} -}; + {12, 2467, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1c, 0, 0}}, + {13, 2472, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x1c, 0, 0}}}; /** Band: 'B/G', Region: Japan */ static chan_freq_power_t channel_freq_power_JPN41_BG[] = { @@ -174,14 +175,12 @@ {9, 2452, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {10, 2457, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, - {12, 2467, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}} -}; + {12, 2467, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, + {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}}; /** Band: 'B/G', Region: Japan */ static chan_freq_power_t channel_freq_power_JPN40_BG[] = { - {14, 2484, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}} -}; + {14, 2484, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}}}; /** Band: 'B/G', Region: Japan */ static chan_freq_power_t channel_freq_power_JPNFE_BG[] = { @@ -197,8 +196,7 @@ {10, 2457, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {12, 2467, WLAN_TX_PWR_JP_BG_DEFAULT, MTRUE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MTRUE, {0x1d, 0, 0}} -}; + {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MTRUE, {0x1d, 0, 0}}}; /** Band : 'B/G', Region: Brazil */ static chan_freq_power_t channel_freq_power_BR_BG[] = { @@ -213,9 +211,8 @@ {9, 2452, WLAN_TX_PWR_1000MW, MFALSE, {0x1c, 0, 0}}, {10, 2457, WLAN_TX_PWR_1000MW, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_1000MW, MFALSE, {0x1c, 0, 0}}, - {12, 2467, WLAN_TX_PWR_1000MW, MFALSE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_1000MW, MFALSE, {0x1d, 0, 0}} -}; + {12, 2467, WLAN_TX_PWR_1000MW, MFALSE, {0x1c, 0, 0}}, + {13, 2472, WLAN_TX_PWR_1000MW, MFALSE, {0x1c, 0, 0}}}; /** Band : 'B/G', Region: Special */ static chan_freq_power_t channel_freq_power_SPECIAL_BG[] = { @@ -230,65 +227,64 @@ {9, 2452, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {10, 2457, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, {11, 2462, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, - {12, 2467, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}}, - {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}}, - {14, 2484, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1d, 0, 0}} -}; + {12, 2467, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, + {13, 2472, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}, + {14, 2484, WLAN_TX_PWR_JP_BG_DEFAULT, MFALSE, {0x1c, 0, 0}}}; /** * The 2.4GHz CFP tables */ static cfp_table_t cfp_table_BG[] = { { - 0x01, /* Brazil */ - channel_freq_power_BR_BG, - NELEMENTS(channel_freq_power_BR_BG), - }, + 0x01, /* Brazil */ + channel_freq_power_BR_BG, + NELEMENTS(channel_freq_power_BR_BG), + }, { - 0x00, /* World FCC */ - channel_freq_power_00_BG, - NELEMENTS(channel_freq_power_00_BG), - }, + 0x00, /* World FCC */ + channel_freq_power_00_BG, + NELEMENTS(channel_freq_power_00_BG), + }, { - 0x10, /* US FCC */ - channel_freq_power_US_BG, - NELEMENTS(channel_freq_power_US_BG), - }, + 0x10, /* US FCC */ + channel_freq_power_US_BG, + NELEMENTS(channel_freq_power_US_BG), + }, { - 0x20, /* CANADA IC */ - channel_freq_power_US_BG, - NELEMENTS(channel_freq_power_US_BG), - }, + 0x20, /* CANADA IC */ + channel_freq_power_US_BG, + NELEMENTS(channel_freq_power_US_BG), + }, { - 0x30, /* EU */ - channel_freq_power_EU_BG, - NELEMENTS(channel_freq_power_EU_BG), - }, + 0x30, /* EU */ + channel_freq_power_EU_BG, + NELEMENTS(channel_freq_power_EU_BG), + }, { - 0x40, /* JAPAN */ - channel_freq_power_JPN40_BG, - NELEMENTS(channel_freq_power_JPN40_BG), - }, + 0x40, /* JAPAN */ + channel_freq_power_JPN40_BG, + NELEMENTS(channel_freq_power_JPN40_BG), + }, { - 0x41, /* JAPAN */ - channel_freq_power_JPN41_BG, - NELEMENTS(channel_freq_power_JPN41_BG), - }, + 0x41, /* JAPAN */ + channel_freq_power_JPN41_BG, + NELEMENTS(channel_freq_power_JPN41_BG), + }, { - 0x50, /* China */ - channel_freq_power_EU_BG, - NELEMENTS(channel_freq_power_EU_BG), - }, + 0x50, /* China */ + channel_freq_power_EU_BG, + NELEMENTS(channel_freq_power_EU_BG), + }, { - 0xfe, /* JAPAN */ - channel_freq_power_JPNFE_BG, - NELEMENTS(channel_freq_power_JPNFE_BG), - }, + 0xfe, /* JAPAN */ + channel_freq_power_JPNFE_BG, + NELEMENTS(channel_freq_power_JPNFE_BG), + }, { - 0xff, /* Special */ - channel_freq_power_SPECIAL_BG, - NELEMENTS(channel_freq_power_SPECIAL_BG), - }, + 0xff, /* Special */ + channel_freq_power_SPECIAL_BG, + NELEMENTS(channel_freq_power_SPECIAL_BG), + }, /* Add new region here */ }; @@ -322,9 +318,7 @@ {153, 5765, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x10, 0, 0}} -}; - + {165, 5825, WLAN_TX_PWR_00_DEFAULT, MFALSE, {0x10, 0, 0}}}; /* Format { Channel, Frequency (MHz), MaxTxPower, DFS } */ /** Band: 'A', Region: USA FCC */ static chan_freq_power_t channel_freq_power_A[] = { @@ -352,8 +346,10 @@ {153, 5765, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, + {169, 5845, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, + {173, 5865, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, + {177, 5885, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Region: Canada IC */ static chan_freq_power_t channel_freq_power_CAN_A[] = { @@ -378,8 +374,7 @@ {153, 5765, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_US_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Region: Europe ETSI */ static chan_freq_power_t channel_freq_power_EU_A[] = { @@ -406,8 +401,7 @@ {153, 5765, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Region: Japan */ static chan_freq_power_t channel_freq_power_JPN_A[] = { @@ -430,8 +424,7 @@ {132, 5660, WLAN_TX_PWR_JP_A_DEFAULT, MTRUE, {0x13, 0, 0}}, {136, 5680, WLAN_TX_PWR_JP_A_DEFAULT, MTRUE, {0x13, 0, 0}}, {140, 5700, WLAN_TX_PWR_JP_A_DEFAULT, MTRUE, {0x13, 0, 0}}, - {144, 5720, WLAN_TX_PWR_JP_A_DEFAULT, MTRUE, {0x13, 0, 0}} -}; + {144, 5720, WLAN_TX_PWR_JP_A_DEFAULT, MTRUE, {0x13, 0, 0}}}; /** Band: 'A', Region: China */ static chan_freq_power_t channel_freq_power_CN_A[] = { @@ -447,11 +440,10 @@ {153, 5765, WLAN_TX_PWR_CN_2000MW, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_CN_2000MW, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_CN_2000MW, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_CN_2000MW, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_CN_2000MW, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', NULL */ -static chan_freq_power_t channel_freq_power_NULL_A[] = { }; +static chan_freq_power_t channel_freq_power_NULL_A[] = {}; /** Band: 'A', Region: Spain/Austria/Brazil */ static chan_freq_power_t channel_freq_power_SPN2_A[] = { @@ -462,8 +454,7 @@ {52, 5260, WLAN_TX_PWR_200MW, MTRUE, {0x13, 0, 0}}, {56, 5280, WLAN_TX_PWR_200MW, MTRUE, {0x13, 0, 0}}, {60, 5300, WLAN_TX_PWR_200MW, MTRUE, {0x13, 0, 0}}, - {64, 5320, WLAN_TX_PWR_200MW, MTRUE, {0x13, 0, 0}} -}; + {64, 5320, WLAN_TX_PWR_200MW, MTRUE, {0x13, 0, 0}}}; /** Band: 'A', Region: Brazil */ static chan_freq_power_t channel_freq_power_BR1_A[] = { @@ -477,8 +468,7 @@ {128, 5640, WLAN_TX_PWR_250MW, MTRUE, {0x13, 0, 0}}, {132, 5660, WLAN_TX_PWR_250MW, MTRUE, {0x13, 0, 0}}, {136, 5680, WLAN_TX_PWR_250MW, MTRUE, {0x13, 0, 0}}, - {140, 5700, WLAN_TX_PWR_250MW, MTRUE, {0x13, 0, 0}} -}; + {140, 5700, WLAN_TX_PWR_250MW, MTRUE, {0x13, 0, 0}}}; /** Band: 'A', Region: Brazil */ static chan_freq_power_t channel_freq_power_BR2_A[] = { @@ -486,8 +476,7 @@ {153, 5765, WLAN_TX_PWR_1000MW, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_1000MW, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_1000MW, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_1000MW, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_1000MW, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Region: Russia */ static chan_freq_power_t channel_freq_power_RU_A[] = { @@ -505,8 +494,7 @@ {149, 5745, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {153, 5765, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {161, 5805, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {161, 5805, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Region: Mexico */ static chan_freq_power_t channel_freq_power_MX_A[] = { @@ -530,24 +518,21 @@ {153, 5765, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_EMEA_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Code: 1, Low band (5150-5250 MHz) channels */ static chan_freq_power_t channel_freq_power_low_band[] = { {36, 5180, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {40, 5200, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {44, 5220, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {48, 5240, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {48, 5240, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Code: 2, Lower middle band (5250-5350 MHz) channels */ static chan_freq_power_t channel_freq_power_lower_middle_band[] = { {52, 5260, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, {56, 5280, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, {60, 5300, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, - {64, 5320, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}} -}; + {64, 5320, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}}; /** Band: 'A', Code: 3, Upper middle band (5470-5725 MHz) channels */ static chan_freq_power_t channel_freq_power_upper_middle_band[] = { @@ -561,8 +546,7 @@ {128, 5640, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, {132, 5660, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, {136, 5680, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}, - {140, 5700, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}} -}; + {140, 5700, WLAN_TX_PWR_DEFAULT, MTRUE, {0x13, 0, 0}}}; /** Band: 'A', Code: 4, High band (5725-5850 MHz) channels */ static chan_freq_power_t channel_freq_power_high_band[] = { @@ -570,8 +554,7 @@ {153, 5765, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Code: 5, Low band (5150-5250 MHz) and * High band (5725-5850 MHz) channels @@ -585,8 +568,7 @@ {153, 5765, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** Band: 'A', Code: 6, Low band (5150-5250 MHz) and * mid low (5260-5320) and High band (5725-5850 MHz) channels @@ -604,149 +586,147 @@ {153, 5765, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {157, 5785, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, {161, 5805, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}, - {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}} -}; + {165, 5825, WLAN_TX_PWR_DEFAULT, MFALSE, {0x10, 0, 0}}}; /** * The 5GHz CFP tables */ static cfp_table_t cfp_table_A[] = { - {0x1, /* Low band (5150-5250 MHz) channels */ + {0x1, /* Low band (5150-5250 MHz) channels */ channel_freq_power_low_band, NELEMENTS(channel_freq_power_low_band)}, - {0x2, /* Lower middle band (5250-5350 MHz) channels */ + {0x2, /* Lower middle band (5250-5350 MHz) channels */ channel_freq_power_lower_middle_band, NELEMENTS(channel_freq_power_lower_middle_band)}, - {0x3, /* Upper middle band (5470-5725 MHz) channels */ + {0x3, /* Upper middle band (5470-5725 MHz) channels */ channel_freq_power_upper_middle_band, NELEMENTS(channel_freq_power_upper_middle_band)}, - {0x4, /* High band (5725-5850 MHz) channels */ + {0x4, /* High band (5725-5850 MHz) channels */ channel_freq_power_high_band, NELEMENTS(channel_freq_power_high_band)}, - {0x5, /* Low band (5150-5250 MHz) and - * High band (5725-5850 MHz) channels - */ + {0x5, /* Low band (5150-5250 MHz) and + * High band (5725-5850 MHz) channels + */ channel_freq_power_low_high_band, NELEMENTS(channel_freq_power_low_high_band)}, - {0x6, /* Low band (5150-5250 MHz) - * Mid band (5260-5320) and - * High band (5725-5850 MHz) channels - */ + {0x6, /* Low band (5150-5250 MHz) + * Mid band (5260-5320) and + * High band (5725-5850 MHz) channels + */ channel_freq_power_low_middle_high_band, NELEMENTS(channel_freq_power_low_middle_high_band)}, { - 0x07, /* Mexico */ - channel_freq_power_MX_A, - NELEMENTS(channel_freq_power_MX_A), - }, + 0x07, /* Mexico */ + channel_freq_power_MX_A, + NELEMENTS(channel_freq_power_MX_A), + }, { - 0x09, /* SPAIN/Austria/Brazil */ - channel_freq_power_SPN2_A, - NELEMENTS(channel_freq_power_SPN2_A), - }, + 0x09, /* SPAIN/Austria/Brazil */ + channel_freq_power_SPN2_A, + NELEMENTS(channel_freq_power_SPN2_A), + }, { - 0x0c, /* Brazil */ - channel_freq_power_BR1_A, - NELEMENTS(channel_freq_power_BR1_A), - }, + 0x0c, /* Brazil */ + channel_freq_power_BR1_A, + NELEMENTS(channel_freq_power_BR1_A), + }, { - 0x0e, /* Brazil */ - channel_freq_power_BR2_A, - NELEMENTS(channel_freq_power_BR2_A), - }, + 0x0e, /* Brazil */ + channel_freq_power_BR2_A, + NELEMENTS(channel_freq_power_BR2_A), + }, { - 0x0f, /* Russia */ - channel_freq_power_RU_A, - NELEMENTS(channel_freq_power_RU_A), - }, + 0x0f, /* Russia */ + channel_freq_power_RU_A, + NELEMENTS(channel_freq_power_RU_A), + }, { - 0x00, /* World */ - channel_freq_power_00_A, - NELEMENTS(channel_freq_power_00_A), - }, + 0x00, /* World */ + channel_freq_power_00_A, + NELEMENTS(channel_freq_power_00_A), + }, { - 0x10, /* US FCC */ - channel_freq_power_A, - NELEMENTS(channel_freq_power_A), - }, + 0x10, /* US FCC */ + channel_freq_power_A, + NELEMENTS(channel_freq_power_A), + }, { - 0x20, /* CANADA IC */ - channel_freq_power_CAN_A, - NELEMENTS(channel_freq_power_CAN_A), - }, + 0x20, /* CANADA IC */ + channel_freq_power_CAN_A, + NELEMENTS(channel_freq_power_CAN_A), + }, { - 0x30, /* EU */ - channel_freq_power_EU_A, - NELEMENTS(channel_freq_power_EU_A), - }, + 0x30, /* EU */ + channel_freq_power_EU_A, + NELEMENTS(channel_freq_power_EU_A), + }, { - 0x40, /* JAPAN */ - channel_freq_power_JPN_A, - NELEMENTS(channel_freq_power_JPN_A), - }, + 0x40, /* JAPAN */ + channel_freq_power_JPN_A, + NELEMENTS(channel_freq_power_JPN_A), + }, { - 0x41, /* JAPAN */ - channel_freq_power_JPN_A, - NELEMENTS(channel_freq_power_JPN_A), - }, + 0x41, /* JAPAN */ + channel_freq_power_JPN_A, + NELEMENTS(channel_freq_power_JPN_A), + }, { - 0x50, /* China */ - channel_freq_power_CN_A, - NELEMENTS(channel_freq_power_CN_A), - }, + 0x50, /* China */ + channel_freq_power_CN_A, + NELEMENTS(channel_freq_power_CN_A), + }, { - 0xfe, /* JAPAN */ - channel_freq_power_NULL_A, - NELEMENTS(channel_freq_power_NULL_A), - }, + 0xfe, /* JAPAN */ + channel_freq_power_NULL_A, + NELEMENTS(channel_freq_power_NULL_A), + }, { - 0xff, /* Special */ - channel_freq_power_JPN_A, - NELEMENTS(channel_freq_power_JPN_A), - }, + 0xff, /* Special */ + channel_freq_power_JPN_A, + NELEMENTS(channel_freq_power_JPN_A), + }, /* Add new region here */ }; - /** Number of the CFP tables for 5GHz */ #define MLAN_CFP_TABLE_SIZE_A (NELEMENTS(cfp_table_A)) enum { - RATEID_DBPSK1Mbps, //(0) - RATEID_DQPSK2Mbps, //(1) - RATEID_CCK5_5Mbps, //(2) - RATEID_CCK11Mbps, //(3) - RATEID_CCK22Mbps, //(4) - RATEID_OFDM6Mbps, //(5) - RATEID_OFDM9Mbps, //(6) - RATEID_OFDM12Mbps, //(7) - RATEID_OFDM18Mbps, //(8) - RATEID_OFDM24Mbps, //(9) - RATEID_OFDM36Mbps, //(10) - RATEID_OFDM48Mbps, //(11) - RATEID_OFDM54Mbps, //(12) - RATEID_OFDM72Mbps, //(13) + RATEID_DBPSK1Mbps, //(0) + RATEID_DQPSK2Mbps, //(1) + RATEID_CCK5_5Mbps, //(2) + RATEID_CCK11Mbps, //(3) + RATEID_CCK22Mbps, //(4) + RATEID_OFDM6Mbps, //(5) + RATEID_OFDM9Mbps, //(6) + RATEID_OFDM12Mbps, //(7) + RATEID_OFDM18Mbps, //(8) + RATEID_OFDM24Mbps, //(9) + RATEID_OFDM36Mbps, //(10) + RATEID_OFDM48Mbps, //(11) + RATEID_OFDM54Mbps, //(12) + RATEID_OFDM72Mbps, //(13) }; static const t_u8 rateUnit_500Kbps[] = { - (10 / 5), /* 1Mbps */ - (20 / 5), /* 2Mbps */ + (10 / 5), /* 1Mbps */ + (20 / 5), /* 2Mbps */ - (55 / 5), /* 5.5Mbps */ - (110 / 5), /* 11Mbps */ - (10 / 5), /* 22Mbps, intentionally set to 1Mbps - * because it's not available - */ + (55 / 5), /* 5.5Mbps */ + (110 / 5), /* 11Mbps */ + (10 / 5), /* 22Mbps, intentionally set to 1Mbps + * because it's not available + */ - (60 / 5), /* 6Mbps */ - (90 / 5), /* 9Mbps */ - (120 / 5), /* 12Mbps */ - (180 / 5), /* 18Mbps */ - (240 / 5), /* 24Mbps */ - (360 / 5), /* 36Mbps */ - (480 / 5), /* 48Mbps */ - (540 / 5), /* 54Mbps */ - (60 / 5), /* 72Mbps, intentionally set to 6Mbps - * because it's not available - */ + (60 / 5), /* 6Mbps */ + (90 / 5), /* 9Mbps */ + (120 / 5), /* 12Mbps */ + (180 / 5), /* 18Mbps */ + (240 / 5), /* 24Mbps */ + (360 / 5), /* 36Mbps */ + (480 / 5), /* 48Mbps */ + (540 / 5), /* 54Mbps */ + (60 / 5), /* 72Mbps, intentionally set to 6Mbps + * because it's not available + */ }; typedef struct _rate_map { @@ -763,137 +743,137 @@ */ static const rate_map rate_map_table_2x2[] = { /* LG <--> Mrvl rate idx */ - {2, 0, 0}, // RATEID_DBPSK1Mbps - {4, 1, 0}, // RATEID_DQPSK2Mbps - {11, 2, 0}, // RATEID_CCK5_5Mbps - {22, 3, 0}, // RATEID_CCK11Mbps - {44, 4, 0}, // RATEID_CCK22Mbps - {12, 5, 0}, // RATEID_OFDM6Mbps - {18, 6, 0}, // RATEID_OFDM9Mbps - {24, 7, 0}, // RATEID_OFDM12Mbps - {36, 8, 0}, // RATEID_OFDM18Mbps - {48, 9, 0}, // RATEID_OFDM24Mbps - {72, 10, 0}, // RATEID_OFDM36Mbps - {96, 11, 0}, // RATEID_OFDM48Mbps - {108, 12, 0}, // RATEID_OFDM54Mbps - {144, 13, 0}, // RATEID_OFDM72Mbps + {2, 0, 0}, // RATEID_DBPSK1Mbps + {4, 1, 0}, // RATEID_DQPSK2Mbps + {11, 2, 0}, // RATEID_CCK5_5Mbps + {22, 3, 0}, // RATEID_CCK11Mbps + {44, 4, 0}, // RATEID_CCK22Mbps + {12, 5, 0}, // RATEID_OFDM6Mbps + {18, 6, 0}, // RATEID_OFDM9Mbps + {24, 7, 0}, // RATEID_OFDM12Mbps + {36, 8, 0}, // RATEID_OFDM18Mbps + {48, 9, 0}, // RATEID_OFDM24Mbps + {72, 10, 0}, // RATEID_OFDM36Mbps + {96, 11, 0}, // RATEID_OFDM48Mbps + {108, 12, 0}, // RATEID_OFDM54Mbps + {144, 13, 0}, // RATEID_OFDM72Mbps /* HT bw20 <--> Mrvl rate idx - nss2 */ - {26, 22, 1}, // RATEID_MCS8_13Mbps - {52, 23, 1}, // RATEID_MCS9_26Mbps - {78, 24, 1}, // RATEID_MCS10_39Mbps - {104, 25, 1}, // RATEID_MCS11_52Mbps - {156, 26, 1}, // RATEID_MCS12_78Mbps - {208, 27, 1}, // RATEID_MCS13_104Mbps - {234, 28, 1}, // RATEID_MCS14_117Mbps - {260, 29, 1}, // RATEID_MCS15_130Mbps + {26, 22, 1}, // RATEID_MCS8_13Mbps + {52, 23, 1}, // RATEID_MCS9_26Mbps + {78, 24, 1}, // RATEID_MCS10_39Mbps + {104, 25, 1}, // RATEID_MCS11_52Mbps + {156, 26, 1}, // RATEID_MCS12_78Mbps + {208, 27, 1}, // RATEID_MCS13_104Mbps + {234, 28, 1}, // RATEID_MCS14_117Mbps + {260, 29, 1}, // RATEID_MCS15_130Mbps /* HT bw20 <--> Mrvl rate idx - nss1 */ - {13, 14, 0}, // RATEID_MCS0_6d5Mbps - {26, 15, 0}, // RATEID_MCS1_13Mbps - {39, 16, 0}, // RATEID_MCS2_19d5Mbps - {52, 17, 0}, // RATEID_MCS3_26Mbps - {78, 18, 0}, // RATEID_MCS4_39Mbps - {104, 19, 0}, // RATEID_MCS5_52Mbps - {117, 20, 0}, // RATEID_MCS6_58d5Mbps - {130, 21, 0}, // RATEID_MCS7_65Mbps + {13, 14, 0}, // RATEID_MCS0_6d5Mbps + {26, 15, 0}, // RATEID_MCS1_13Mbps + {39, 16, 0}, // RATEID_MCS2_19d5Mbps + {52, 17, 0}, // RATEID_MCS3_26Mbps + {78, 18, 0}, // RATEID_MCS4_39Mbps + {104, 19, 0}, // RATEID_MCS5_52Mbps + {117, 20, 0}, // RATEID_MCS6_58d5Mbps + {130, 21, 0}, // RATEID_MCS7_65Mbps /* HT bw40<--> Mrvl rate idx - nss2 */ - {54, 39, 1}, // RATEID_MCS8BW40_27Mbps - {108, 40, 1}, // RATEID_MCS9BW40_54Mbps - {162, 41, 1}, // RATEID_MCS10BW40_81Mbps - {216, 42, 1}, // RATEID_MCS11BW40_108Mbps - {324, 43, 1}, // RATEID_MCS12BW40_162Mbps - {432, 44, 1}, // RATEID_MCS13BW40_216Mbps - {486, 45, 1}, // RATEID_MCS14BW40_243Mbps - {540, 46, 1}, // RATEID_MCS15BW40_270Mbps + {54, 39, 1}, // RATEID_MCS8BW40_27Mbps + {108, 40, 1}, // RATEID_MCS9BW40_54Mbps + {162, 41, 1}, // RATEID_MCS10BW40_81Mbps + {216, 42, 1}, // RATEID_MCS11BW40_108Mbps + {324, 43, 1}, // RATEID_MCS12BW40_162Mbps + {432, 44, 1}, // RATEID_MCS13BW40_216Mbps + {486, 45, 1}, // RATEID_MCS14BW40_243Mbps + {540, 46, 1}, // RATEID_MCS15BW40_270Mbps /* HT bw40<--> Mrvl rate idx - nss1 */ - {12, 30, 0}, // RATEID_MCS32BW40_6Mbps - {27, 31, 0}, // RATEID_MCS0BW40_13d5Mbps - {54, 32, 0}, // RATEID_MCS1BW40_27Mbps - {81, 33, 0}, // RATEID_MCS2BW40_40d5Mbps - {108, 34, 0}, // RATEID_MCS3BW40_54Mbps - {162, 35, 0}, // RATEID_MCS4BW40_81Mbps - {216, 36, 0}, // RATEID_MCS5BW40_108Mbps - {243, 37, 0}, // RATEID_MCS6BW40_121d5Mbps - {270, 38, 0}, // RATEID_MCS7BW40_135Mbps + {12, 30, 0}, // RATEID_MCS32BW40_6Mbps + {27, 31, 0}, // RATEID_MCS0BW40_13d5Mbps + {54, 32, 0}, // RATEID_MCS1BW40_27Mbps + {81, 33, 0}, // RATEID_MCS2BW40_40d5Mbps + {108, 34, 0}, // RATEID_MCS3BW40_54Mbps + {162, 35, 0}, // RATEID_MCS4BW40_81Mbps + {216, 36, 0}, // RATEID_MCS5BW40_108Mbps + {243, 37, 0}, // RATEID_MCS6BW40_121d5Mbps + {270, 38, 0}, // RATEID_MCS7BW40_135Mbps /* VHT bw20<--> Mrvl rate idx - nss2 */ - {26, 57, 1}, // RATEID_VHT_MCS0_2SS_BW20 13 Mbps - {52, 58, 1}, // RATEID_VHT_MCS1_2SS_BW20 26 Mbps - {78, 59, 1}, // RATEID_VHT_MCS2_2SS_BW20 39 Mbps - {104, 60, 1}, // RATEID_VHT_MCS3_2SS_BW20 52 Mbps - {156, 61, 1}, // RATEID_VHT_MCS4_2SS_BW20 78 Mbps - {208, 62, 1}, // RATEID_VHT_MCS5_2SS_BW20 104 Mbps - {234, 63, 1}, // RATEID_VHT_MCS6_2SS_BW20 117 Mbps - {260, 64, 1}, // RATEID_VHT_MCS7_2SS_BW20 130 Mbps - {312, 65, 1}, // RATEID_VHT_MCS8_2SS_BW20 156 Mbps - {0, 66, 1}, // RATEID_VHT_MCS9_2SS_BW20 173.3 Mbps(INVALID) + {26, 57, 1}, // RATEID_VHT_MCS0_2SS_BW20 13 Mbps + {52, 58, 1}, // RATEID_VHT_MCS1_2SS_BW20 26 Mbps + {78, 59, 1}, // RATEID_VHT_MCS2_2SS_BW20 39 Mbps + {104, 60, 1}, // RATEID_VHT_MCS3_2SS_BW20 52 Mbps + {156, 61, 1}, // RATEID_VHT_MCS4_2SS_BW20 78 Mbps + {208, 62, 1}, // RATEID_VHT_MCS5_2SS_BW20 104 Mbps + {234, 63, 1}, // RATEID_VHT_MCS6_2SS_BW20 117 Mbps + {260, 64, 1}, // RATEID_VHT_MCS7_2SS_BW20 130 Mbps + {312, 65, 1}, // RATEID_VHT_MCS8_2SS_BW20 156 Mbps + {0, 66, 1}, // RATEID_VHT_MCS9_2SS_BW20 173.3 Mbps(INVALID) /* VHT bw20<--> Mrvl rate idx - nss1 */ - {13, 47, 0}, // RATEID_VHT_MCS0_1SS_BW20 6.5 Mbps - {26, 48, 0}, // RATEID_VHT_MCS1_1SS_BW20 13 Mbps - {39, 49, 0}, // RATEID_VHT_MCS2_1SS_BW20 19.5 Mbps - {52, 50, 0}, // RATEID_VHT_MCS3_1SS_BW20 26 Mbps - {78, 51, 0}, // RATEID_VHT_MCS4_1SS_BW20 39 Mbps - {104, 52, 0}, // RATEID_VHT_MCS5_1SS_BW20 52 Mbps - {117, 53, 0}, // RATEID_VHT_MCS6_1SS_BW20 58.5 Mbps - {130, 54, 0}, // RATEID_VHT_MCS7_1SS_BW20 65 Mbps - {156, 55, 0}, // RATEID_VHT_MCS8_1SS_BW20 78 Mbps - {0, 56, 0}, // RATEID_VHT_MCS9_1SS_BW20 86.7 Mbps(INVALID) + {13, 47, 0}, // RATEID_VHT_MCS0_1SS_BW20 6.5 Mbps + {26, 48, 0}, // RATEID_VHT_MCS1_1SS_BW20 13 Mbps + {39, 49, 0}, // RATEID_VHT_MCS2_1SS_BW20 19.5 Mbps + {52, 50, 0}, // RATEID_VHT_MCS3_1SS_BW20 26 Mbps + {78, 51, 0}, // RATEID_VHT_MCS4_1SS_BW20 39 Mbps + {104, 52, 0}, // RATEID_VHT_MCS5_1SS_BW20 52 Mbps + {117, 53, 0}, // RATEID_VHT_MCS6_1SS_BW20 58.5 Mbps + {130, 54, 0}, // RATEID_VHT_MCS7_1SS_BW20 65 Mbps + {156, 55, 0}, // RATEID_VHT_MCS8_1SS_BW20 78 Mbps + {0, 56, 0}, // RATEID_VHT_MCS9_1SS_BW20 86.7 Mbps(INVALID) /* VHT bw40<--> Mrvl rate idx - nss2 */ - {54, 77, 1}, // RATEID_VHT_MCS0_2SS_BW40 27 Mbps - {108, 78, 1}, // RATEID_VHT_MCS1_2SS_BW40 54 Mbps - {162, 79, 1}, // RATEID_VHT_MCS2_2SS_BW40 81 Mbps - {216, 80, 1}, // RATEID_VHT_MCS3_2SS_BW40 108 Mbps - {324, 81, 1}, // RATEID_VHT_MCS4_2SS_BW40 162 Mbps - {432, 82, 1}, // RATEID_VHT_MCS5_2SS_BW40 216 Mbps - {486, 83, 1}, // RATEID_VHT_MCS6_2SS_BW40 243 Mbps - {540, 84, 1}, // RATEID_VHT_MCS7_2SS_BW40 270 Mbps - {648, 85, 1}, // RATEID_VHT_MCS8_2SS_BW40 324 Mbps - {720, 86, 1}, // RATEID_VHT_MCS9_2SS_BW40 360 Mbps + {54, 77, 1}, // RATEID_VHT_MCS0_2SS_BW40 27 Mbps + {108, 78, 1}, // RATEID_VHT_MCS1_2SS_BW40 54 Mbps + {162, 79, 1}, // RATEID_VHT_MCS2_2SS_BW40 81 Mbps + {216, 80, 1}, // RATEID_VHT_MCS3_2SS_BW40 108 Mbps + {324, 81, 1}, // RATEID_VHT_MCS4_2SS_BW40 162 Mbps + {432, 82, 1}, // RATEID_VHT_MCS5_2SS_BW40 216 Mbps + {486, 83, 1}, // RATEID_VHT_MCS6_2SS_BW40 243 Mbps + {540, 84, 1}, // RATEID_VHT_MCS7_2SS_BW40 270 Mbps + {648, 85, 1}, // RATEID_VHT_MCS8_2SS_BW40 324 Mbps + {720, 86, 1}, // RATEID_VHT_MCS9_2SS_BW40 360 Mbps /* VHT bw40<--> Mrvl rate idx - nss1 */ - {27, 67, 0}, // RATEID_VHT_MCS0_1SS_BW40 13.5 Mbps - {54, 68, 0}, // RATEID_VHT_MCS1_1SS_BW40 27 Mbps - {81, 69, 0}, // RATEID_VHT_MCS2_1SS_BW40 40.5 Mbps - {108, 70, 0}, // RATEID_VHT_MCS3_1SS_BW40 54 Mbps - {162, 71, 0}, // RATEID_VHT_MCS4_1SS_BW40 81 Mbps - {216, 72, 0}, // RATEID_VHT_MCS5_1SS_BW40 108 Mbps - {243, 73, 0}, // RATEID_VHT_MCS6_1SS_BW40 121.5 Mbps - {270, 74, 0}, // RATEID_VHT_MCS7_1SS_BW40 135 Mbps - {324, 75, 0}, // RATEID_VHT_MCS8_1SS_BW40 162 Mbps - {360, 76, 0}, // RATEID_VHT_MCS9_1SS_BW40 180 Mbps + {27, 67, 0}, // RATEID_VHT_MCS0_1SS_BW40 13.5 Mbps + {54, 68, 0}, // RATEID_VHT_MCS1_1SS_BW40 27 Mbps + {81, 69, 0}, // RATEID_VHT_MCS2_1SS_BW40 40.5 Mbps + {108, 70, 0}, // RATEID_VHT_MCS3_1SS_BW40 54 Mbps + {162, 71, 0}, // RATEID_VHT_MCS4_1SS_BW40 81 Mbps + {216, 72, 0}, // RATEID_VHT_MCS5_1SS_BW40 108 Mbps + {243, 73, 0}, // RATEID_VHT_MCS6_1SS_BW40 121.5 Mbps + {270, 74, 0}, // RATEID_VHT_MCS7_1SS_BW40 135 Mbps + {324, 75, 0}, // RATEID_VHT_MCS8_1SS_BW40 162 Mbps + {360, 76, 0}, // RATEID_VHT_MCS9_1SS_BW40 180 Mbps /* VHT bw80<--> Mrvl rate idx - nss2 */ - {117, 97, 1}, // RATEID_VHT_MCS0_2SS_BW80 58.5 Mbps - {234, 98, 1}, // RATEID_VHT_MCS1_2SS_BW80 117 Mbps - {350, 99, 1}, // RATEID_VHT_MCS2_2SS_BW80 175 Mbps - {468, 100, 1}, // RATEID_VHT_MCS3_2SS_BW80 234 Mbps - {702, 101, 1}, // RATEID_VHT_MCS4_2SS_BW80 351 Mbps - {936, 102, 1}, // RATEID_VHT_MCS5_2SS_BW80 468 Mbps - {1053, 103, 1}, // RATEID_VHT_MCS6_2SS_BW80 526.5 Mbps - {1170, 104, 1}, // RATEID_VHT_MCS7_2SS_BW80 585 Mbps - {1404, 105, 1}, // RATEID_VHT_MCS8_2SS_BW80 702 Mbps - {1560, 106, 1}, // RATEID_VHT_MCS9_2SS_BW80 780 Mbps + {117, 97, 1}, // RATEID_VHT_MCS0_2SS_BW80 58.5 Mbps + {234, 98, 1}, // RATEID_VHT_MCS1_2SS_BW80 117 Mbps + {350, 99, 1}, // RATEID_VHT_MCS2_2SS_BW80 175 Mbps + {468, 100, 1}, // RATEID_VHT_MCS3_2SS_BW80 234 Mbps + {702, 101, 1}, // RATEID_VHT_MCS4_2SS_BW80 351 Mbps + {936, 102, 1}, // RATEID_VHT_MCS5_2SS_BW80 468 Mbps + {1053, 103, 1}, // RATEID_VHT_MCS6_2SS_BW80 526.5 Mbps + {1170, 104, 1}, // RATEID_VHT_MCS7_2SS_BW80 585 Mbps + {1404, 105, 1}, // RATEID_VHT_MCS8_2SS_BW80 702 Mbps + {1560, 106, 1}, // RATEID_VHT_MCS9_2SS_BW80 780 Mbps /* VHT bw80<--> Mrvl rate idx - nss1 */ - {58, 87, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could - // correspond to 58 - {59, 87, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3*2 could - // correspond to 59 too - {117, 88, 0}, // RATEID_VHT_MCS1_1SS_BW80 58.5 Mbps - {175, 89, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could - // correspond to 175 - {176, 89, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could - // correspond to 176 too - {234, 90, 0}, // RATEID_VHT_MCS3_1SS_BW80 117 Mbps - {351, 91, 0}, // RATEID_VHT_MCS4_1SS_BW80 175.5 Mbps - {468, 92, 0}, // RATEID_VHT_MCS5_1SS_BW80 234 Mbps - {526, 93, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could - // correspond to 526 - {527, 93, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could - // correspond to 527 too - {585, 94, 0}, // RATEID_VHT_MCS7_1SS_BW80 292.5 Mbps - {702, 95, 0}, // RATEID_VHT_MCS8_1SS_BW80 351 Mbps - {780, 96, 0}, // RATEID_VHT_MCS9_1SS_BW80 390 Mbps + {58, 87, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could + // correspond to 58 + {59, 87, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3*2 could + // correspond to 59 too + {117, 88, 0}, // RATEID_VHT_MCS1_1SS_BW80 58.5 Mbps + {175, 89, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could + // correspond to 175 + {176, 89, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could + // correspond to 176 too + {234, 90, 0}, // RATEID_VHT_MCS3_1SS_BW80 117 Mbps + {351, 91, 0}, // RATEID_VHT_MCS4_1SS_BW80 175.5 Mbps + {468, 92, 0}, // RATEID_VHT_MCS5_1SS_BW80 234 Mbps + {526, 93, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could + // correspond to 526 + {527, 93, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could + // correspond to 527 too + {585, 94, 0}, // RATEID_VHT_MCS7_1SS_BW80 292.5 Mbps + {702, 95, 0}, // RATEID_VHT_MCS8_1SS_BW80 351 Mbps + {780, 96, 0}, // RATEID_VHT_MCS9_1SS_BW80 390 Mbps }; /** rate_map_table_1x1 is based on rate_map_table_2x2 and remove nss2 part. @@ -902,86 +882,86 @@ */ static const rate_map rate_map_table_1x1[] = { /* LG <--> Mrvl rate idx */ - {2, 0, 0}, // RATEID_DBPSK1Mbps - {4, 1, 0}, // RATEID_DQPSK2Mbps - {11, 2, 0}, // RATEID_CCK5_5Mbps - {22, 3, 0}, // RATEID_CCK11Mbps - {44, 4, 0}, // RATEID_CCK22Mbps - {12, 5, 0}, // RATEID_OFDM6Mbps - {18, 6, 0}, // RATEID_OFDM9Mbps - {24, 7, 0}, // RATEID_OFDM12Mbps - {36, 8, 0}, // RATEID_OFDM18Mbps - {48, 9, 0}, // RATEID_OFDM24Mbps - {72, 10, 0}, // RATEID_OFDM36Mbps - {96, 11, 0}, // RATEID_OFDM48Mbps - {108, 12, 0}, // RATEID_OFDM54Mbps - {144, 13, 0}, // RATEID_OFDM72Mbps + {2, 0, 0}, // RATEID_DBPSK1Mbps + {4, 1, 0}, // RATEID_DQPSK2Mbps + {11, 2, 0}, // RATEID_CCK5_5Mbps + {22, 3, 0}, // RATEID_CCK11Mbps + {44, 4, 0}, // RATEID_CCK22Mbps + {12, 5, 0}, // RATEID_OFDM6Mbps + {18, 6, 0}, // RATEID_OFDM9Mbps + {24, 7, 0}, // RATEID_OFDM12Mbps + {36, 8, 0}, // RATEID_OFDM18Mbps + {48, 9, 0}, // RATEID_OFDM24Mbps + {72, 10, 0}, // RATEID_OFDM36Mbps + {96, 11, 0}, // RATEID_OFDM48Mbps + {108, 12, 0}, // RATEID_OFDM54Mbps + {144, 13, 0}, // RATEID_OFDM72Mbps /* HT bw20 <--> Mrvl rate idx */ - {13, 14, 0}, // RATEID_MCS0_6d5Mbps - {26, 15, 0}, // RATEID_MCS1_13Mbps - {39, 16, 0}, // RATEID_MCS2_19d5Mbps - {52, 17, 0}, // RATEID_MCS3_26Mbps - {78, 18, 0}, // RATEID_MCS4_39Mbps - {104, 19, 0}, // RATEID_MCS5_52Mbps - {117, 20, 0}, // RATEID_MCS6_58d5Mbps - {130, 21, 0}, // RATEID_MCS7_65Mbps + {13, 14, 0}, // RATEID_MCS0_6d5Mbps + {26, 15, 0}, // RATEID_MCS1_13Mbps + {39, 16, 0}, // RATEID_MCS2_19d5Mbps + {52, 17, 0}, // RATEID_MCS3_26Mbps + {78, 18, 0}, // RATEID_MCS4_39Mbps + {104, 19, 0}, // RATEID_MCS5_52Mbps + {117, 20, 0}, // RATEID_MCS6_58d5Mbps + {130, 21, 0}, // RATEID_MCS7_65Mbps /* HT bw40<--> Mrvl rate idx */ - {12, 22, 0}, // RATEID_MCS32BW40_6Mbps, for 1x1 start from 22 - {27, 23, 0}, // RATEID_MCS0BW40_13d5Mbps - {54, 24, 0}, // RATEID_MCS1BW40_27Mbps - {81, 25, 0}, // RATEID_MCS2BW40_40d5Mbps - {108, 26, 0}, // RATEID_MCS3BW40_54Mbps - {162, 27, 0}, // RATEID_MCS4BW40_81Mbps - {216, 28, 0}, // RATEID_MCS5BW40_108Mbps - {243, 29, 0}, // RATEID_MCS6BW40_121d5Mbps - {270, 30, 0}, // RATEID_MCS7BW40_135Mbps + {12, 22, 0}, // RATEID_MCS32BW40_6Mbps, for 1x1 start from 22 + {27, 23, 0}, // RATEID_MCS0BW40_13d5Mbps + {54, 24, 0}, // RATEID_MCS1BW40_27Mbps + {81, 25, 0}, // RATEID_MCS2BW40_40d5Mbps + {108, 26, 0}, // RATEID_MCS3BW40_54Mbps + {162, 27, 0}, // RATEID_MCS4BW40_81Mbps + {216, 28, 0}, // RATEID_MCS5BW40_108Mbps + {243, 29, 0}, // RATEID_MCS6BW40_121d5Mbps + {270, 30, 0}, // RATEID_MCS7BW40_135Mbps /* VHT bw20<--> Mrvl rate idx */ - {13, 31, 0}, // RATEID_VHT_MCS0_1SS_BW20 6.5 Mbps - {26, 32, 0}, // RATEID_VHT_MCS1_1SS_BW20 13 Mbps - {39, 33, 0}, // RATEID_VHT_MCS2_1SS_BW20 19.5 Mbps - {52, 34, 0}, // RATEID_VHT_MCS3_1SS_BW20 26 Mbps - {78, 35, 0}, // RATEID_VHT_MCS4_1SS_BW20 39 Mbps - {104, 36, 0}, // RATEID_VHT_MCS5_1SS_BW20 52 Mbps - {117, 37, 0}, // RATEID_VHT_MCS6_1SS_BW20 58.5 Mbps - {130, 38, 0}, // RATEID_VHT_MCS7_1SS_BW20 65 Mbps - {156, 39, 0}, // RATEID_VHT_MCS8_1SS_BW20 78 Mbps - {0, 40, 0}, // RATEID_VHT_MCS9_1SS_BW20 86.7 Mbps(INVALID) + {13, 31, 0}, // RATEID_VHT_MCS0_1SS_BW20 6.5 Mbps + {26, 32, 0}, // RATEID_VHT_MCS1_1SS_BW20 13 Mbps + {39, 33, 0}, // RATEID_VHT_MCS2_1SS_BW20 19.5 Mbps + {52, 34, 0}, // RATEID_VHT_MCS3_1SS_BW20 26 Mbps + {78, 35, 0}, // RATEID_VHT_MCS4_1SS_BW20 39 Mbps + {104, 36, 0}, // RATEID_VHT_MCS5_1SS_BW20 52 Mbps + {117, 37, 0}, // RATEID_VHT_MCS6_1SS_BW20 58.5 Mbps + {130, 38, 0}, // RATEID_VHT_MCS7_1SS_BW20 65 Mbps + {156, 39, 0}, // RATEID_VHT_MCS8_1SS_BW20 78 Mbps + {0, 40, 0}, // RATEID_VHT_MCS9_1SS_BW20 86.7 Mbps(INVALID) /* VHT bw40<--> Mrvl rate idx */ - {27, 41, 0}, // RATEID_VHT_MCS0_1SS_BW40 13.5 Mbps - {54, 42, 0}, // RATEID_VHT_MCS1_1SS_BW40 27 Mbps - {81, 43, 0}, // RATEID_VHT_MCS2_1SS_BW40 40.5 Mbps - {108, 44, 0}, // RATEID_VHT_MCS3_1SS_BW40 54 Mbps - {162, 45, 0}, // RATEID_VHT_MCS4_1SS_BW40 81 Mbps - {216, 46, 0}, // RATEID_VHT_MCS5_1SS_BW40 108 Mbps - {243, 47, 0}, // RATEID_VHT_MCS6_1SS_BW40 121.5 Mbps - {270, 48, 0}, // RATEID_VHT_MCS7_1SS_BW40 135 Mbps - {324, 49, 0}, // RATEID_VHT_MCS8_1SS_BW40 162 Mbps - {360, 50, 0}, // RATEID_VHT_MCS9_1SS_BW40 180 Mbps + {27, 41, 0}, // RATEID_VHT_MCS0_1SS_BW40 13.5 Mbps + {54, 42, 0}, // RATEID_VHT_MCS1_1SS_BW40 27 Mbps + {81, 43, 0}, // RATEID_VHT_MCS2_1SS_BW40 40.5 Mbps + {108, 44, 0}, // RATEID_VHT_MCS3_1SS_BW40 54 Mbps + {162, 45, 0}, // RATEID_VHT_MCS4_1SS_BW40 81 Mbps + {216, 46, 0}, // RATEID_VHT_MCS5_1SS_BW40 108 Mbps + {243, 47, 0}, // RATEID_VHT_MCS6_1SS_BW40 121.5 Mbps + {270, 48, 0}, // RATEID_VHT_MCS7_1SS_BW40 135 Mbps + {324, 49, 0}, // RATEID_VHT_MCS8_1SS_BW40 162 Mbps + {360, 50, 0}, // RATEID_VHT_MCS9_1SS_BW40 180 Mbps /* VHT bw80<--> Mrvl rate idx */ - {58, 51, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could - // correspond to 58 - {59, 51, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could - // correspond to 59 too - {117, 52, 0}, // RATEID_VHT_MCS1_1SS_BW80 58.5 Mbps - {175, 53, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could - // correspond to 175 - {176, 53, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could - // correspond to 176 too - {234, 54, 0}, // RATEID_VHT_MCS3_1SS_BW80 117 Mbps - {351, 55, 0}, // RATEID_VHT_MCS4_1SS_BW80 175.5 Mbps - {468, 56, 0}, // RATEID_VHT_MCS5_1SS_BW80 234 Mbps - {526, 57, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could - // correspond to 526 - {527, 57, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could - // correspond to 527 too - {585, 58, 0}, // RATEID_VHT_MCS7_1SS_BW80 292.5 Mbps - {702, 59, 0}, // RATEID_VHT_MCS8_1SS_BW80 351 Mbps - {780, 60, 0}, // RATEID_VHT_MCS9_1SS_BW80 390 Mbps + {58, 51, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could + // correspond to 58 + {59, 51, 0}, // RATEID_VHT_MCS0_1SS_BW80 29.3 Mbps, 29.3x2 could + // correspond to 59 too + {117, 52, 0}, // RATEID_VHT_MCS1_1SS_BW80 58.5 Mbps + {175, 53, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could + // correspond to 175 + {176, 53, 0}, // RATEID_VHT_MCS2_1SS_BW80 87.8 Mbps, 87.8x2 could + // correspond to 176 too + {234, 54, 0}, // RATEID_VHT_MCS3_1SS_BW80 117 Mbps + {351, 55, 0}, // RATEID_VHT_MCS4_1SS_BW80 175.5 Mbps + {468, 56, 0}, // RATEID_VHT_MCS5_1SS_BW80 234 Mbps + {526, 57, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could + // correspond to 526 + {527, 57, 0}, // RATEID_VHT_MCS6_1SS_BW80 263.3 Mbps, 263.3x2 could + // correspond to 527 too + {585, 58, 0}, // RATEID_VHT_MCS7_1SS_BW80 292.5 Mbps + {702, 59, 0}, // RATEID_VHT_MCS8_1SS_BW80 351 Mbps + {780, 60, 0}, // RATEID_VHT_MCS9_1SS_BW80 390 Mbps }; /******************************************************** @@ -991,188 +971,176 @@ * The table to keep region code */ -t_u16 region_code_index[MRVDRV_MAX_REGION_CODE] = - { 0x00, 0x10, 0x20, 0x30, 0x40, - 0x41, 0x50, 0xfe, 0xff -}; - -/** The table to keep CFP code for BG */ -t_u16 cfp_code_index_bg[MRVDRV_MAX_CFP_CODE_BG] = { }; +t_u16 region_code_index[MRVDRV_MAX_REGION_CODE] = {0x00, 0x10, 0x20, 0x30, 0x40, + 0x41, 0x50, 0xfe, 0xff}; /** The table to keep CFP code for A */ -t_u16 cfp_code_index_a[MRVDRV_MAX_CFP_CODE_A] = { 0x1, 0x2, 0x3, 0x4, 0x5 }; +t_u16 cfp_code_index_a[MRVDRV_MAX_CFP_CODE_A] = {0x1, 0x2, 0x3, 0x4, 0x5}; /** * The rates supported for ad-hoc B mode */ -t_u8 AdhocRates_B[B_SUPPORTED_RATES] = { 0x82, 0x84, 0x8b, 0x96, 0 }; +t_u8 AdhocRates_B[B_SUPPORTED_RATES] = {0x82, 0x84, 0x8b, 0x96, 0}; /** * The rates supported for ad-hoc G mode */ -t_u8 AdhocRates_G[G_SUPPORTED_RATES] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00 -}; +t_u8 AdhocRates_G[G_SUPPORTED_RATES] = {0x8c, 0x12, 0x98, 0x24, 0xb0, + 0x48, 0x60, 0x6c, 0x00}; /** * The rates supported for ad-hoc BG mode */ -t_u8 AdhocRates_BG[BG_SUPPORTED_RATES] = { 0x82, 0x84, 0x8b, 0x96, 0x0c, - 0x12, 0x18, 0x24, 0x30, 0x48, - 0x60, 0x6c, 0x00 -}; +t_u8 AdhocRates_BG[BG_SUPPORTED_RATES] = {0x82, 0x84, 0x8b, 0x96, 0x0c, + 0x12, 0x18, 0x24, 0x30, 0x48, + 0x60, 0x6c, 0x00}; /** * The rates supported in A mode for ad-hoc */ -t_u8 AdhocRates_A[A_SUPPORTED_RATES] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00 -}; +t_u8 AdhocRates_A[A_SUPPORTED_RATES] = {0x8c, 0x12, 0x98, 0x24, 0xb0, + 0x48, 0x60, 0x6c, 0x00}; /** * The rates supported in A mode (used for BAND_A) */ -t_u8 SupportedRates_A[A_SUPPORTED_RATES] = { 0x0c, 0x12, 0x18, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00 -}; +t_u8 SupportedRates_A[A_SUPPORTED_RATES] = {0x0c, 0x12, 0x18, 0x24, 0xb0, + 0x48, 0x60, 0x6c, 0x00}; /** * The rates supported by the card */ static t_u16 WlanDataRates[WLAN_SUPPORTED_RATES_EXT] = { - 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, - 0x60, 0x6C, 0x90, 0x0D, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, - 0x0C, 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, 0x10E, 0x00 -}; + 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, + 0x60, 0x6C, 0x90, 0x0D, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, + 0x0C, 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, 0x10E, 0x00}; /** * The rates supported in B mode */ -t_u8 SupportedRates_B[B_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x16, 0x00 }; +t_u8 SupportedRates_B[B_SUPPORTED_RATES] = {0x02, 0x04, 0x0b, 0x16, 0x00}; /** * The rates supported in G mode (BAND_G, BAND_G|BAND_GN) */ -t_u8 SupportedRates_G[G_SUPPORTED_RATES] = { 0x0c, 0x12, 0x18, 0x24, 0x30, - 0x48, 0x60, 0x6c, 0x00 -}; +t_u8 SupportedRates_G[G_SUPPORTED_RATES] = {0x0c, 0x12, 0x18, 0x24, 0x30, + 0x48, 0x60, 0x6c, 0x00}; /** * The rates supported in BG mode (BAND_B|BAND_G, BAND_B|BAND_G|BAND_GN) */ -t_u8 SupportedRates_BG[BG_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x0c, 0x12, - 0x16, 0x18, 0x24, 0x30, 0x48, - 0x60, 0x6c, 0x00 -}; +t_u8 SupportedRates_BG[BG_SUPPORTED_RATES] = {0x02, 0x04, 0x0b, 0x0c, 0x12, + 0x16, 0x18, 0x24, 0x30, 0x48, + 0x60, 0x6c, 0x00}; /** * The rates supported in N mode */ -t_u8 SupportedRates_N[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 }; +t_u8 SupportedRates_N[N_SUPPORTED_RATES] = {0x02, 0x04, 0}; #define MCS_NUM_AX 12 // for MCS0/MCS1/MCS3/MCS4 have 4 additional DCM=1 value // note: the value in the table is 2 multiplier of the actual rate static t_u16 ax_mcs_rate_nss1[12][MCS_NUM_AX + 4] = { {0x90, 0x48, 0x120, 0x90, 0x1B0, 0x240, 0x120, 0x360, 0x1B0, 0x481, - 0x511, 0x5A1, 0x6C1, 0x781, 0x871, 0x962}, /*SG 160M */ + 0x511, 0x5A1, 0x6C1, 0x781, 0x871, 0x962}, /*SG 160M*/ {0x88, 0x44, 0x110, 0x88, 0x198, 0x220, 0x110, 0x330, 0x198, 0x440, - 0x4C9, 0x551, 0x661, 0x716, 0x7F9, 0x8DC}, /*MG 160M */ + 0x4C9, 0x551, 0x661, 0x716, 0x7F9, 0x8DC}, /*MG 160M*/ {0x7A, 0x3D, 0xF5, 0x7A, 0x16F, 0x1EA, 0xF5, 0x2DF, 0x16F, 0x3D4, 0x44E, - 0x4C9, 0x5BE, 0x661, 0x72D, 0x7F9}, /*LG 160M */ + 0x4C9, 0x5BE, 0x661, 0x72D, 0x7F9}, /*LG 160M*/ {0x48, 0x24, 0x90, 0x48, 0xD8, 0x120, 0x90, 0x1B0, 0xD8, 0x240, 0x288, - 0x2D0, 0x360, 0x3C0, 0x438, 0x4B0}, /*SG 80M */ + 0x2D0, 0x360, 0x3C0, 0x438, 0x4B0}, /*SG 80M*/ {0x44, 0x22, 0x88, 0x44, 0xCC, 0x110, 0x88, 0x198, 0xCC, 0x220, 0x264, - 0x2A8, 0x330, 0x38B, 0x3FC, 0x46E}, /*MG 80M */ + 0x2A8, 0x330, 0x38B, 0x3FC, 0x46E}, /*MG 80M*/ {0x3D, 0x1E, 0x7A, 0x3D, 0xB7, 0xF5, 0x7A, 0x16F, 0xB7, 0x1EA, 0x227, - 0x264, 0x2DF, 0x330, 0x396, 0x3FC}, /*LG 80M */ + 0x264, 0x2DF, 0x330, 0x396, 0x3FC}, /*LG 80M*/ {0x22, 0x11, 0x44, 0x22, 0x67, 0x89, 0x44, 0xCE, 0x67, 0x113, 0x135, - 0x158, 0x19D, 0x1CA, 0x204, 0x23D}, /*SG 40M */ + 0x158, 0x19D, 0x1CA, 0x204, 0x23D}, /*SG 40M*/ {0x20, 0x10, 0x41, 0x20, 0x61, 0x82, 0x41, 0xC3, 0x61, 0x104, 0x124, - 0x145, 0x186, 0x1B1, 0x1E7, 0x21D}, /*MG 40M */ + 0x145, 0x186, 0x1B1, 0x1E7, 0x21D}, /*MG 40M*/ {0x1D, 0xE, 0x3A, 0x1D, 0x57, 0x75, 0x3A, 0xAF, 0x57, 0xEA, 0x107, - 0x124, 0x15F, 0x186, 0x1B6, 0x1E7}, /*LG 40M */ + 0x124, 0x15F, 0x186, 0x1B6, 0x1E7}, /*LG 40M*/ {0x11, 0x8, 0x22, 0x11, 0x33, 0x44, 0x22, 0x67, 0x33, 0x89, 0x9A, 0xAC, - 0xCE, 0xE5, 0x102, 0x11E}, /*SG 20M */ + 0xCE, 0xE5, 0x102, 0x11E}, /*SG 20M*/ {0x10, 0x8, 0x20, 0x10, 0x30, 0x41, 0x20, 0x61, 0x30, 0x82, 0x92, 0xA2, - 0xC3, 0xD8, 0xF3, 0x10E}, /*MG 20M */ + 0xC3, 0xD8, 0xF3, 0x10E}, /*MG 20M*/ {0xE, 0x7, 0x1D, 0xE, 0x2B, 0x3A, 0x1D, 0x57, 0x2B, 0x75, 0x83, 0x92, - 0xAF, 0xC3, 0xDB, 0xF3} /*LG 20M */ + 0xAF, 0xC3, 0xDB, 0xF3} /*LG 20M*/ }; #if 0 // note: the value in the table is 2 multiplier of the actual rate t_u16 ax_tone_ru_rate_nss1[9][MCS_NUM_AX + 4] = { {0x8, 0x4, 0xF, 0x8, 0x17, 0x1E, 0xF, 0x2D, 0x17, 0x3C, 0x44, 0x4B, - 0x5A, 0x64, 0x71, 0x7D}, /*SG 106-tone */ + 0x5A, 0x64, 0x71, 0x7D}, /*SG 106-tone*/ {0x7, 0x4, 0xF, 0x7, 0x16, 0x1D, 0xF, 0x2B, 0x16, 0x39, 0x40, 0x47, - 0x55, 0x5F, 0x6B, 0x76}, /*MG 106-tone */ + 0x55, 0x5F, 0x6B, 0x76}, /*MG 106-tone*/ {0x7, 0x3, 0xD, 0x6, 0x14, 0x1A, 0xD, 0x27, 0x14, 0x33, 0x3A, 0x40, - 0x4D, 0x55, 0x60, 0x6B}, /*LG 106-tone */ + 0x4D, 0x55, 0x60, 0x6B}, /*LG 106-tone*/ {0x4, 0x2, 0x7, 0x4, 0xB, 0xF, 0x7, 0x16, 0xB, 0x1D, 0x20, 0x22, 0x2B, - 0x2F, 0x35, 0x3B}, /*SG 52-tone */ + 0x2F, 0x35, 0x3B}, /*SG 52-tone*/ {0x4, 0x2, 0x7, 0x4, 0xA, 0xE, 0x7, 0x14, 0xA, 0x1B, 0x1E, 0x22, 0x28, - 0x2D, 0x32, 0x38}, /*MG 52-tone */ + 0x2D, 0x32, 0x38}, /*MG 52-tone*/ {0x3, 0x2, 0x6, 0x3, 0x9, 0xC, 0x6, 0x12, 0x9, 0x18, 0x1B, 0x1E, 0x24, - 0x28, 0x2D, 0x32}, /*LG 52-tone */ + 0x28, 0x2D, 0x32}, /*LG 52-tone*/ {0x2, 0x1, 0x4, 0x2, 0x6, 0x7, 0x4, 0xB, 0x5, 0xE, 0x10, 0x12, 0x15, - 0x18, 0x1A, 0x1D}, /*SG 26-tone */ + 0x18, 0x1A, 0x1D}, /*SG 26-tone*/ {0x2, 0x1, 0x4, 0x2, 0x5, 0x6, 0x4, 0xA, 0x5, 0xD, 0xF, 0x11, 0x14, - 0x16, 0x19, 0x1C}, /*MG 26-tone */ + 0x16, 0x19, 0x1C}, /*MG 26-tone*/ {0x2, 0x1, 0x3, 0x2, 0x5, 0x6, 0x3, 0x9, 0x4, 0xC, 0xE, 0xF, 0x12, 0x14, - 0x17, 0x19} /*LG 26-tone */ + 0x17, 0x19} /*LG 26-tone*/ }; #endif // note: the value in the table is 2 multiplier of the actual rate static t_u16 ax_mcs_rate_nss2[12][MCS_NUM_AX + 4] = { {0x120, 0x90, 0x240, 0x120, 0x360, 0x481, 0x240, 0x61C, 0x360, 0x901, - 0xA22, 0xB42, 0xD82, 0xF03, 0x10E3, 0x12C3}, /*SG 160M */ + 0xA22, 0xB42, 0xD82, 0xF03, 0x10E3, 0x12C3}, /*SG 160M*/ {0x110, 0x88, 0x220, 0x110, 0x330, 0x440, 0x220, 0x661, 0x330, 0x881, - 0x992, 0xAA2, 0xCAC, 0xE2D, 0xFF3, 0x11B9}, /*MG 160M */ + 0x992, 0xAA2, 0xCAC, 0xE2D, 0xFF3, 0x11B9}, /*MG 160M*/ {0xF5, 0x7A, 0x1EA, 0xF5, 0x2DF, 0x3D4, 0x1EA, 0x5BE, 0x2DF, 0x7A8, - 0x1134, 0x992, 0xB7C, 0xCC2, 0xE5B, 0xFF3}, /*LG 160M */ + 0x1134, 0x992, 0xB7C, 0xCC2, 0xE5B, 0xFF3}, /*LG 160M*/ {0x90, 0x48, 0x120, 0x90, 0x1B0, 0x240, 0x120, 0x360, 0x1B0, 0x481, - 0x511, 0x5A1, 0x6C1, 0x781, 0x871, 0x962}, /*SG 80M */ + 0x511, 0x5A1, 0x6C1, 0x781, 0x871, 0x962}, /*SG 80M*/ {0x88, 0x44, 0x110, 0x88, 0x198, 0x220, 0x110, 0x330, 0x198, 0x440, - 0x4C9, 0x551, 0x661, 0x716, 0x7F9, 0x8DC}, /*MG 80M */ + 0x4C9, 0x551, 0x661, 0x716, 0x7F9, 0x8DC}, /*MG 80M*/ {0x7A, 0x3D, 0xF5, 0x7A, 0x16F, 0x1EA, 0xF5, 0x2DF, 0x16F, 0x3D4, 0x44E, - 0x4C9, 0x5BE, 0x661, 0x72D, 0x7F9}, /*LG 80M */ + 0x4C9, 0x5BE, 0x661, 0x72D, 0x7F9}, /*LG 80M*/ {0x44, 0x22, 0x89, 0x44, 0xCE, 0x113, 0x89, 0x19D, 0xCE, 0x226, 0x26B, - 0x2B0, 0x339, 0x395, 0x408, 0x47B}, /*SG 40M */ + 0x2B0, 0x339, 0x395, 0x408, 0x47B}, /*SG 40M*/ {0x41, 0x20, 0x82, 0x41, 0xC3, 0x104, 0x82, 0x186, 0xC3, 0x208, 0x249, - 0x28A, 0x30C, 0x362, 0x3CE, 0x43B}, /*MG 40M */ + 0x28A, 0x30C, 0x362, 0x3CE, 0x43B}, /*MG 40M*/ {0x3A, 0x1D, 0x75, 0x3A, 0xAF, 0xEA, 0x75, 0x15F, 0xAF, 0x1D4, 0x20E, - 0x249, 0x2BE, 0x30C, 0x36D, 0x3CF}, /*LG 40M */ + 0x249, 0x2BE, 0x30C, 0x36D, 0x3CF}, /*LG 40M*/ {0x22, 0x11, 0x44, 0x22, 0x67, 0x89, 0x44, 0xCE, 0x67, 0x113, 0x135, - 0x158, 0x19D, 0x1CA, 0x204, 0x23D}, /*SG 20M */ + 0x158, 0x19D, 0x1CA, 0x204, 0x23D}, /*SG 20M*/ {0x20, 0x10, 0x41, 0x20, 0x61, 0x82, 0x41, 0xC3, 0x61, 0x104, 0x124, - 0x145, 0x186, 0x1B1, 0x1E7, 0x21D}, /*MG 20M */ + 0x145, 0x186, 0x1B1, 0x1E7, 0x21D}, /*MG 20M*/ {0x1D, 0xE, 0x3A, 0x1D, 0x57, 0x75, 0x3A, 0xAF, 0x57, 0xEA, 0x107, - 0x124, 0x15F, 0x186, 0x1B6, 0x1E7} /*LG 20M */ + 0x124, 0x15F, 0x186, 0x1B6, 0x1E7} /*LG 20M*/ }; #if 0 // note: the value in the table is 2 multiplier of the actual rate t_u16 ax_tone_ru_rate_nss2[9][MCS_NUM_AX + 4] = { {0xF, 0x8, 0x1E, 0xF, 0x2D, 0x3C, 0x1E, 0x5A, 0x2D, 0x78, 0x87, 0x96, - 0xB4, 0xC8, 0xE1, 0xFA}, /*SG 106-tone */ + 0xB4, 0xC8, 0xE1, 0xFA}, /*SG 106-tone*/ {0xE, 0x7, 0x1D, 0xE, 0x2B, 0x39, 0x1D, 0x55, 0x2B, 0x72, 0x80, 0x8E, - 0xAA, 0xBD, 0xD5, 0xED}, /*MG 106-tone */ + 0xAA, 0xBD, 0xD5, 0xED}, /*MG 106-tone*/ {0xD, 0x7, 0x1A, 0xD, 0x27, 0x33, 0x1A, 0x4D, 0x27, 0x66, 0x73, 0x80, - 0x99, 0xAA, 0xC0, 0xD5}, /*LG 106-tone */ + 0x99, 0xAA, 0xC0, 0xD5}, /*LG 106-tone*/ {0x7, 0x4, 0xF, 0x7, 0x16, 0x1D, 0xF, 0x2A, 0x16, 0x39, 0x40, 0x47, - 0x55, 0x5F, 0x6A, 0x76}, /*SG 52-tone */ + 0x55, 0x5F, 0x6A, 0x76}, /*SG 52-tone*/ {0x7, 0x4, 0xE, 0x7, 0x14, 0x1B, 0xE, 0x28, 0x14, 0x36, 0x3C, 0x43, - 0x50, 0x59, 0x64, 0x70}, /*MG 52-tone */ + 0x50, 0x59, 0x64, 0x70}, /*MG 52-tone*/ {0x6, 0x3, 0xC, 0x6, 0x12, 0x18, 0xC, 0x24, 0x12, 0x30, 0x36, 0x3C, - 0x48, 0x50, 0x5A, 0x64}, /*LG 52-tone */ + 0x48, 0x50, 0x5A, 0x64}, /*LG 52-tone*/ {0x4, 0x2, 0x7, 0x4, 0xB, 0xF, 0x7, 0x16, 0xB, 0x1D, 0x20, 0x22, 0x2B, - 0x2F, 0x35, 0x3B}, /*SG 26-tone */ + 0x2F, 0x35, 0x3B}, /*SG 26-tone*/ {0x4, 0x2, 0x7, 0x4, 0xA, 0xE, 0x7, 0x14, 0xA, 0x1B, 0x1E, 0x22, 0x28, - 0x2D, 0x32, 0x38}, /*MG 26-tone */ + 0x2D, 0x32, 0x38}, /*MG 26-tone*/ {0x3, 0x2, 0x6, 0x3, 0x9, 0xC, 0x6, 0x12, 0x9, 0x18, 0x1B, 0x1E, 0x24, - 0x28, 0x2D, 0x32} /*LG 26-tone */ + 0x28, 0x2D, 0x32} /*LG 26-tone*/ }; #endif @@ -1190,8 +1158,7 @@ * @return A pointer to the first occurrence of c in string, or MNULL if * c is not found. */ -static void * -wlan_memchr(pmlan_adapter pmadapter, void *s, int c, int n) +static void *wlan_memchr(pmlan_adapter pmadapter, void *s, int c, int n) { const t_u8 *p = (t_u8 *)s; @@ -1219,9 +1186,9 @@ * * @return A pointer to CFP */ -static chan_freq_power_t * -wlan_get_region_cfp_table(pmlan_adapter pmadapter, - t_u8 region, t_u8 band, int *cfp_no) +static chan_freq_power_t *wlan_get_region_cfp_table(pmlan_adapter pmadapter, + t_u8 region, t_u16 band, + int *cfp_no) { t_u32 i; t_u8 cfp_bg, cfp_a; @@ -1285,7 +1252,6 @@ } } } - if (!region) PRINTM(MERROR, "Error Band[0x%x] or code[BG:%#x, A:%#x]\n", band, cfp_bg, cfp_a); @@ -1307,10 +1273,10 @@ * @param cfp_src Source table * @param num_cfp_src Number of elements in source table */ -static t_void -wlan_cfp_copy_dynamic(pmlan_adapter pmadapter, - chan_freq_power_t *cfp, t_u8 num_cfp, - chan_freq_power_t *cfp_src, t_u8 num_cfp_src) +static t_void wlan_cfp_copy_dynamic(pmlan_adapter pmadapter, + chan_freq_power_t *cfp, t_u8 num_cfp, + chan_freq_power_t *cfp_src, + t_u8 num_cfp_src) { int i, j; @@ -1325,6 +1291,7 @@ /* do not clear the flags */ for (i = 0; i < num_cfp; i++) { cfp[i].dynamic.blacklist = MFALSE; + cfp[i].dynamic.dfs_state = DFS_USABLE; } /* copy dynamic blacklisted entries from source where channels match */ @@ -1334,6 +1301,8 @@ if (cfp[i].channel == cfp_src[j].channel) { cfp[i].dynamic.blacklist = cfp_src[j].dynamic.blacklist; + cfp[i].dynamic.dfs_state = + cfp_src[j].dynamic.dfs_state; break; } } @@ -1354,10 +1323,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_country_2_cfp_table_code(pmlan_adapter pmadapter, - t_u8 *country_code, t_u8 *cfp_bg, - t_u8 *cfp_a) +mlan_status wlan_misc_country_2_cfp_table_code(pmlan_adapter pmadapter, + t_u8 *country_code, t_u8 *cfp_bg, + t_u8 *cfp_a) { t_u8 i; @@ -1408,8 +1376,7 @@ * * @return MTRUE or MFALSE */ -t_bool -wlan_is_etsi_country(pmlan_adapter pmadapter, t_u8 *country_code) +t_bool wlan_is_etsi_country(pmlan_adapter pmadapter, t_u8 *country_code) { t_u8 i; @@ -1439,8 +1406,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -t_u8 -wlan_adjust_antenna(pmlan_private priv, RxPD *prx_pd) +t_u8 wlan_adjust_antenna(pmlan_private priv, RxPD *prx_pd) { t_u8 antenna = prx_pd->antenna; #if defined(SD8887) || defined(SD8987) @@ -1456,6 +1422,7 @@ else if (antenna & MBIT(0)) antenna = 0; } + #if defined(SD8887) || defined(SD8987) #define ANTENNA_OFFSET 2 if (MFALSE @@ -1465,7 +1432,7 @@ #ifdef SD8987 || IS_SD8987(priv->adapter->card_type) #endif - ) { + ) { if ((priv->adapter->antinfo & ANT_DIVERSITY_2G) && (priv->adapter->antinfo & ANT_DIVERSITY_5G)) { #define MAX_2G_CHAN 14 @@ -1486,8 +1453,7 @@ * @param rate_info rate info * @return rate index */ -t_u16 -wlan_adjust_data_rate(mlan_private *priv, t_u8 rx_rate, t_u8 rate_info) +t_u16 wlan_adjust_data_rate(mlan_private *priv, t_u8 rx_rate, t_u8 rate_info) { t_u16 rate_index = 0; t_u8 bw = 0; @@ -1503,26 +1469,26 @@ sgi_enable = (rate_info & 0x10) >> 4; if ((rate_info & 0x3) == 0) { rate_index = (rx_rate > MLAN_RATE_INDEX_OFDM0) ? rx_rate - 1 : - rx_rate; + rx_rate; } else if ((rate_info & 0x03) == 1) { rate_index = RATE_INDEX_MCS0 + - MAX_MCS_NUM_SUPP * 2 * sgi_enable + - MAX_MCS_NUM_SUPP * bw + rx_rate; + MAX_MCS_NUM_SUPP * 2 * sgi_enable + + MAX_MCS_NUM_SUPP * bw + rx_rate; } else if ((rate_info & 0x3) == 2) { if (IS_STREAM_2X2(priv->adapter->feature_control)) - nss = rx_rate >> 4; // 0:NSS1, 1:NSS2 + nss = rx_rate >> 4; // 0:NSS1, 1:NSS2 rate_index = RATE_INDEX_MCS0 + MAX_MCS_NUM_SUPP * 4 + - MAX_MCS_NUM_AC * 6 * sgi_enable + - MAX_MCS_NUM_AC * 2 * bw + MAX_MCS_NUM_AC * nss + - (rx_rate & 0x0f); + MAX_MCS_NUM_AC * 6 * sgi_enable + + MAX_MCS_NUM_AC * 2 * bw + MAX_MCS_NUM_AC * nss + + (rx_rate & 0x0f); } else if ((rate_info & 0x3) == 3) { gi = (rate_info & 0x10) >> 4 | (rate_info & 0x80) >> 6; if (IS_STREAM_2X2(priv->adapter->feature_control)) - nss = rx_rate >> 4; // 0:NSS1, 1:NSS2 + nss = rx_rate >> 4; // 0:NSS1, 1:NSS2 rate_index = RATE_INDEX_MCS0 + MAX_MCS_NUM_SUPP * 4 + - MAX_MCS_NUM_AC * 12 + MAX_MCS_NUM_AX * 6 * gi + - MAX_MCS_NUM_AX * 2 * bw + MAX_MCS_NUM_AX * nss + - (rx_rate & 0x0f); + MAX_MCS_NUM_AC * 12 + MAX_MCS_NUM_AX * 6 * gi + + MAX_MCS_NUM_AX * 2 * bw + MAX_MCS_NUM_AX * nss + + (rx_rate & 0x0f); } return rate_index; } @@ -1537,8 +1503,7 @@ * * @return v15+ rate info */ -t_u8 -wlan_convert_v14_tx_rate_info(pmlan_private pmpriv, t_u8 v14_rate_info) +t_u8 wlan_convert_v14_tx_rate_info(pmlan_private pmpriv, t_u8 v14_rate_info) { t_u8 rate_info = 0; @@ -1563,8 +1528,7 @@ * * @return v15+ rate info */ -t_u8 -wlan_convert_v14_rx_rate_info(pmlan_private pmpriv, t_u8 v14_rate_info) +t_u8 wlan_convert_v14_rx_rate_info(pmlan_private pmpriv, t_u8 v14_rate_info) { t_u8 rate_info = 0; t_u8 mode = 0; @@ -1596,21 +1560,19 @@ * * @return Data rate or 0 */ -t_u32 -wlan_index_to_data_rate(pmlan_adapter pmadapter, t_u8 index, - t_u8 tx_rate_info, t_u8 ext_rate_info) +t_u32 wlan_index_to_data_rate(pmlan_adapter pmadapter, t_u8 index, + t_u8 tx_rate_info, t_u8 ext_rate_info) { #define MCS_NUM_SUPP 16 t_u16 mcs_rate[4][MCS_NUM_SUPP] = { {0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e, 0x36, 0x6c, - 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c}, /*LG 40M */ + 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c}, /*LG 40M*/ {0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c, 0x3c, 0x78, - 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258}, /*SG 40M */ + 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258}, /*SG 40M */ {0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82, 0x1a, 0x34, - 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104}, /*LG 20M */ + 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104}, /*LG 20M */ {0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, 0x1c, 0x39, - 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120} - }; /*SG 20M */ + 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120}}; /*SG 20M */ #define MCS_NUM_AC 10 /* NSS 1. note: the value in the table is 2 multiplier of the actual @@ -1618,49 +1580,49 @@ */ t_u16 ac_mcs_rate_nss1[8][MCS_NUM_AC] = { {0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, 0x492, 0x57C, - 0x618}, /* LG 160M */ + 0x618}, /* LG 160M*/ {0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, 0x514, 0x618, - 0x6C6}, /* SG 160M */ + 0x6C6}, /* SG 160M*/ {0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F, 0x249, 0x2BE, - 0x30C}, /* LG 80M */ + 0x30C}, /* LG 80M */ {0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249, 0x28A, 0x30C, - 0x363}, /* SG 80M */ + 0x363}, /* SG 80M */ {0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, 0x10E, 0x144, - 0x168}, /* LG 40M */ + 0x168}, /* LG 40M */ {0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E, 0x12C, 0x168, - 0x190}, /* SG 40M */ + 0x190}, /* SG 40M */ {0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, - 0x00}, /* LG 20M */ + 0x00}, /* LG 20M */ {0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, - 0x00}, /* SG 20M */ + 0x00}, /* SG 20M */ }; /* NSS 2. note: the value in the table is 2 multiplier of the actual * rate */ t_u16 ac_mcs_rate_nss2[8][MCS_NUM_AC] = { {0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A, 0x924, 0xAF8, - 0xC30}, /*LG 160M */ + 0xC30}, /*LG 160M*/ {0x104, 0x208, 0x30C, 0x410, 0x618, 0x820, 0x924, 0xA28, 0xC30, - 0xD8B}, /*SG 160M */ + 0xD8B}, /*SG 160M*/ {0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, 0x492, 0x57C, - 0x618}, /*LG 80M */ + 0x618}, /*LG 80M*/ {0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, 0x514, 0x618, - 0x6C6}, /*SG 80M */ + 0x6C6}, /*SG 80M*/ {0x36, 0x6C, 0xA2, 0xD8, 0x144, 0x1B0, 0x1E6, 0x21C, 0x288, - 0x2D0}, /*LG 40M */ + 0x2D0}, /*LG 40M*/ {0x3C, 0x78, 0xB4, 0xF0, 0x168, 0x1E0, 0x21C, 0x258, 0x2D0, - 0x320}, /*SG 40M */ + 0x320}, /*SG 40M*/ {0x1A, 0x34, 0x4A, 0x68, 0x9C, 0xD0, 0xEA, 0x104, 0x138, - 0x00}, /*LG 20M */ + 0x00}, /*LG 20M*/ {0x1D, 0x3A, 0x57, 0x74, 0xAE, 0xE6, 0x104, 0x121, 0x15B, - 0x00}, /*SG 20M */ + 0x00}, /*SG 20M*/ }; t_u32 rate = 0; t_u8 mcs_index = 0; t_u8 he_dcm = 0; -// t_u8 he_tone = 0; + // t_u8 he_tone = 0; t_u8 stbc = 0; t_u8 bw = 0; @@ -1689,7 +1651,8 @@ /* NSS = 1 */ rate = ac_mcs_rate_nss1[2 * (3 - bw) + gi][mcs_index]; } else - if ((tx_rate_info & 0x3) == MLAN_RATE_FORMAT_HE) { + + if ((tx_rate_info & 0x3) == MLAN_RATE_FORMAT_HE) { /* VHT rate */ mcs_index = index & 0xF; he_dcm = ext_rate_info & MBIT(0); @@ -1703,7 +1666,7 @@ * 0.8us */ gi = (tx_rate_info & MBIT(4)) >> 4 | - (tx_rate_info & MBIT(7)) >> 6; + (tx_rate_info & MBIT(7)) >> 6; /* STBC: BIT5 in tx rate info */ stbc = (tx_rate_info & MBIT(5)) >> 5; @@ -1717,99 +1680,115 @@ stbc = 0; he_dcm = 0; } - /* map to gi 0:0.8us,1:1.6us 2:3.2us */ + /* map to gi 0:0.8us,1:1.6us 2:3.2us*/ if (gi > 0) gi = gi - 1; -//#ifdef ENABLE_802_11AX + //#ifdef ENABLE_802_11AX // TODO: hardcode he_tone here, wait for FW value ready. -// he_tone = 4; + // he_tone = 4; - //he_tone = (ext_rate_info & 0xE) >> 1; -//#endif + // he_tone = (ext_rate_info & 0xE) >> 1; + //#endif if ((index >> 4) == 1) { switch (mcs_index) { case 0: case 1: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2 + he_dcm]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2 + //+ he_dcm]; + // } else { + // #endif rate = ax_mcs_rate_nss2[3 * (3 - bw) + gi] - [mcs_index * 2 + he_dcm]; + [mcs_index * 2 + he_dcm]; break; case 2: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2]; + // } else { + // #endif rate = ax_mcs_rate_nss2[3 * (3 - bw) + gi] - [mcs_index * 2]; + [mcs_index * 2]; break; case 3: case 4: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2 - 1 + he_dcm]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index*2 + //- 1 + he_dcm]; + // } else { + // #endif rate = ax_mcs_rate_nss2[3 * (3 - bw) + gi] - [mcs_index * 2 - 1 + he_dcm]; + [mcs_index * 2 - 1 + + he_dcm]; break; default: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index + 4]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss2[3*(2-he_tone)+gi][mcs_index + //+ 4]; + // } else { + // #endif rate = ax_mcs_rate_nss2[3 * (3 - bw) + gi] - [mcs_index + 4]; + [mcs_index + 4]; break; } } else { switch (mcs_index) { case 0: case 1: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2 + he_dcm]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2 + //+ he_dcm]; + // } else { + // #endif rate = ax_mcs_rate_nss1[3 * (3 - bw) + gi] - [mcs_index * 2 + he_dcm]; + [mcs_index * 2 + he_dcm]; break; case 2: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2]; + // } else { + // #endif rate = ax_mcs_rate_nss1[3 * (3 - bw) + gi] - [mcs_index * 2]; + [mcs_index * 2]; break; case 3: case 4: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2 - 1 + he_dcm]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index*2 + //- 1 + he_dcm]; + // } else { + // #endif rate = ax_mcs_rate_nss1[3 * (3 - bw) + gi] - [mcs_index * 2 - 1 + he_dcm]; + [mcs_index * 2 - 1 + + he_dcm]; break; default: -// #if 0 -// if (he_tone < 3) { -// rate = ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index + 4]; -// } else { -// #endif + // #if 0 + // if (he_tone < 3) { + // rate = + //ax_tone_ru_rate_nss1[3*(2-he_tone)+gi][mcs_index + //+ 4]; + // } else { + // #endif rate = ax_mcs_rate_nss1[3 * (3 - bw) + gi] - [mcs_index + 4]; + [mcs_index + 4]; break; } } @@ -1821,9 +1800,9 @@ gi = (tx_rate_info & 0x10) >> 4; if (index == MLAN_RATE_BITMAP_MCS0) { if (gi == 1) - rate = 0x0D; /* MCS 32 SGI rate */ + rate = 0x0D; /* MCS 32 SGI rate */ else - rate = 0x0C; /* MCS 32 LGI rate */ + rate = 0x0C; /* MCS 32 LGI rate */ } else if (index < MCS_NUM_SUPP) { if (bw <= 1) rate = mcs_rate[2 * (1 - bw) + gi][index]; @@ -1849,8 +1828,7 @@ * * @return Index or 0 */ -t_u8 -wlan_data_rate_to_index(pmlan_adapter pmadapter, t_u32 rate) +t_u8 wlan_data_rate_to_index(pmlan_adapter pmadapter, t_u32 rate) { t_u16 *ptr; @@ -1877,9 +1855,8 @@ * * @return The number of Rates */ -t_u32 -wlan_get_active_data_rates(mlan_private *pmpriv, t_u32 bss_mode, - t_u16 config_bands, WLAN_802_11_RATES rates) +t_u32 wlan_get_active_data_rates(mlan_private *pmpriv, t_u32 bss_mode, + t_u16 config_bands, WLAN_802_11_RATES rates) { t_u32 k; @@ -1905,12 +1882,13 @@ * present in all the regions. * * @param pmpriv A pointer to mlan_private structure + * @param band band. * @param channel Channel number. * * @return The Tx power */ -t_u8 -wlan_get_txpwr_of_chan_from_cfp(mlan_private *pmpriv, t_u8 channel) +t_u8 wlan_get_txpwr_of_chan_from_cfp(mlan_private *pmpriv, t_u16 band, + t_u8 channel) { t_u8 i = 0; t_u8 j = 0; @@ -1922,38 +1900,46 @@ ENTER(); - for (i = 0; i < MLAN_CFP_TABLE_SIZE_BG; i++) { - /* Get CFP */ - cfp = cfp_table_BG[i].cfp; - cfp_no = cfp_table_BG[i].cfp_no; - /* Find matching channel and get Tx power */ - for (j = 0; j < cfp_no; j++) { - if ((cfp + j)->channel == channel) { - if (tx_power != 0) - tx_power = MIN(tx_power, - (cfp + j)->max_tx_power); - else - tx_power = - (t_u8)(cfp + j)->max_tx_power; - break; + if (band & (BAND_B | BAND_G)) { + for (i = 0; i < MLAN_CFP_TABLE_SIZE_BG; i++) { + /* Get CFP */ + cfp = cfp_table_BG[i].cfp; + cfp_no = cfp_table_BG[i].cfp_no; + /* Find matching channel and get Tx power */ + for (j = 0; j < cfp_no; j++) { + if ((cfp + j)->channel == channel) { + if (tx_power != 0) + tx_power = MIN( + tx_power, + (cfp + j)->max_tx_power); + else + tx_power = + (t_u8)(cfp + j) + ->max_tx_power; + break; + } } } } - for (i = 0; i < MLAN_CFP_TABLE_SIZE_A; i++) { - /* Get CFP */ - cfp_a = cfp_table_A[i].cfp; - cfp_no_a = cfp_table_A[i].cfp_no; - for (j = 0; j < cfp_no_a; j++) { - if ((cfp_a + j)->channel == channel) { - if (tx_power != 0) - tx_power = - MIN(tx_power, - (cfp_a + j)->max_tx_power); - else - tx_power = (t_u8)((cfp_a + - j)->max_tx_power); - break; + if (band & BAND_A) { + for (i = 0; i < MLAN_CFP_TABLE_SIZE_A; i++) { + /* Get CFP */ + cfp_a = cfp_table_A[i].cfp; + cfp_no_a = cfp_table_A[i].cfp_no; + for (j = 0; j < cfp_no_a; j++) { + if ((cfp_a + j)->channel == channel) { + if (tx_power != 0) + tx_power = MIN( + tx_power, + (cfp_a + j) + ->max_tx_power); + else + tx_power = + (t_u8)((cfp_a + j) + ->max_tx_power); + break; + } } } } @@ -1975,7 +1961,7 @@ */ chan_freq_power_t * -wlan_get_cfp_by_band_and_channel(pmlan_adapter pmadapter, t_u8 band, +wlan_get_cfp_by_band_and_channel(pmlan_adapter pmadapter, t_u16 band, t_u16 channel, region_chan_t *region_channel) { region_chan_t *rc; @@ -1995,8 +1981,8 @@ case BAND_AN: case BAND_A | BAND_AN: case BAND_A | BAND_AN | BAND_AAC: - /* Fall Through */ - case BAND_A: /* Matching BAND_A */ + /* Fall Through */ + case BAND_A: /* Matching BAND_A */ break; default: @@ -2013,11 +1999,11 @@ case BAND_B | BAND_G | BAND_GN | BAND_GAC: case BAND_G | BAND_GN | BAND_GAC: case BAND_B | BAND_G: - /* Fall Through */ - case BAND_B: /* Matching BAND_B/G */ - /* Fall Through */ + /* Fall Through */ + case BAND_B: /* Matching BAND_B/G */ + /* Fall Through */ case BAND_G: - /* Fall Through */ + /* Fall Through */ case 0: break; default: @@ -2040,8 +2026,7 @@ } if (!cfp && channel) - PRINTM(MCMND, - "%s: can not find cfp by band %d & channel %d\n", + PRINTM(MCMND, "%s: can not find cfp by band %d & channel %d\n", __func__, band, channel); LEAVE(); @@ -2058,9 +2043,8 @@ * @return A pointer to chan_freq_power_t structure or MNULL if not * found. */ -chan_freq_power_t * -wlan_find_cfp_by_band_and_channel(mlan_adapter *pmadapter, - t_u8 band, t_u16 channel) +chan_freq_power_t *wlan_find_cfp_by_band_and_channel(mlan_adapter *pmadapter, + t_u16 band, t_u16 channel) { chan_freq_power_t *cfp = MNULL; @@ -2069,13 +2053,11 @@ /* Any station(s) with 11D enabled */ if (wlan_count_priv_cond(pmadapter, wlan_11d_is_enabled, wlan_is_station) > 0) - cfp = wlan_get_cfp_by_band_and_channel(pmadapter, band, channel, - pmadapter-> - universal_channel); + cfp = wlan_get_cfp_by_band_and_channel( + pmadapter, band, channel, pmadapter->universal_channel); else - cfp = wlan_get_cfp_by_band_and_channel(pmadapter, band, channel, - pmadapter-> - region_channel); + cfp = wlan_get_cfp_by_band_and_channel( + pmadapter, band, channel, pmadapter->region_channel); LEAVE(); return cfp; @@ -2090,8 +2072,8 @@ * * @return Pointer to chan_freq_power_t structure; MNULL if not found */ -chan_freq_power_t * -wlan_find_cfp_by_band_and_freq(mlan_adapter *pmadapter, t_u8 band, t_u32 freq) +chan_freq_power_t *wlan_find_cfp_by_band_and_freq(mlan_adapter *pmadapter, + t_u16 band, t_u32 freq) { chan_freq_power_t *cfp = MNULL; region_chan_t *rc; @@ -2115,8 +2097,8 @@ case BAND_AN: case BAND_A | BAND_AN: case BAND_A | BAND_AN | BAND_AAC: - /* Fall Through */ - case BAND_A: /* Matching BAND_A */ + /* Fall Through */ + case BAND_A: /* Matching BAND_A */ break; default: continue; @@ -2132,11 +2114,11 @@ case BAND_B | BAND_G | BAND_GN | BAND_GAC: case BAND_G | BAND_GN | BAND_GAC: case BAND_B | BAND_G: - /* Fall Through */ + /* Fall Through */ case BAND_B: - /* Fall Through */ + /* Fall Through */ case BAND_G: - /* Fall Through */ + /* Fall Through */ case 0: break; default: @@ -2155,9 +2137,8 @@ } if (!cfp && freq) - PRINTM(MERROR, - "%s: cannot find cfp by band %d & freq %d\n", __func__, - band, freq); + PRINTM(MERROR, "%s: cannot find cfp by band %d & freq %d\n", + __func__, band, freq); LEAVE(); return cfp; @@ -2171,8 +2152,7 @@ * * @return MTRUE or MFALSE */ -t_u8 -wlan_is_rate_auto(mlan_private *pmpriv) +t_u8 wlan_is_rate_auto(mlan_private *pmpriv) { t_u32 i; int rate_num = 0; @@ -2199,8 +2179,7 @@ * * @return Rate index */ -int -wlan_get_rate_index(pmlan_adapter pmadapter, t_u16 *rate_bitmap, int size) +int wlan_get_rate_index(pmlan_adapter pmadapter, t_u16 *rate_bitmap, int size) { int i; @@ -2218,6 +2197,27 @@ } /** + * @brief Convert config_bands to B/G/A band + * + * @param config_bands The specified band configuration + * + * @return BAND_B|BAND_G|BAND_A + */ +t_u16 wlan_convert_config_bands(t_u16 config_bands) +{ + t_u16 bands = 0; + if (config_bands & BAND_B) + bands |= BAND_B; + if (config_bands & BAND_G || config_bands & BAND_GN || + config_bands & BAND_GAC || config_bands & BAND_GAX) + bands |= BAND_G; + if (config_bands & BAND_A || config_bands & BAND_AN || + config_bands & BAND_AAC || config_bands & BAND_AAX) + bands |= BAND_A; + return bands; +} + +/** * @brief Get supported data rates * * @param pmpriv A pointer to mlan_private structure @@ -2227,112 +2227,68 @@ * * @return The number of Rates */ -t_u32 -wlan_get_supported_rates(mlan_private *pmpriv, t_u32 bss_mode, - t_u16 config_bands, WLAN_802_11_RATES rates) +t_u32 wlan_get_supported_rates(mlan_private *pmpriv, t_u32 bss_mode, + t_u16 config_bands, WLAN_802_11_RATES rates) { t_u32 k = 0; + t_u16 bands = 0; ENTER(); + bands = wlan_convert_config_bands(config_bands); if (bss_mode == MLAN_BSS_MODE_INFRA) { /* Infra. mode */ - switch (config_bands) { - case (t_u8)BAND_B: - PRINTM(MINFO, "Infra Band=%d SupportedRates_B\n", - config_bands); + if (bands == BAND_B) { + /* B only */ + PRINTM(MINFO, "Band: Infra B\n"); k = wlan_copy_rates(rates, k, SupportedRates_B, sizeof(SupportedRates_B)); - break; - case (t_u8)BAND_G: - case BAND_G | BAND_GN: - case BAND_G | BAND_GN | BAND_GAC: - case BAND_G | BAND_GN | BAND_GAC | BAND_GAX: - PRINTM(MINFO, "Infra band=%d SupportedRates_G\n", - config_bands); + } else if (bands == BAND_G) { + /* G only */ + PRINTM(MINFO, "Band: Infra G\n"); k = wlan_copy_rates(rates, k, SupportedRates_G, sizeof(SupportedRates_G)); - break; - case BAND_B | BAND_G: - case BAND_A | BAND_B | BAND_G: - case BAND_A | BAND_B: - case BAND_A | BAND_B | BAND_G | BAND_GN: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC | BAND_GAC: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC | BAND_AAX: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC | BAND_GAC | BAND_AAX | BAND_GAX: - case BAND_B | BAND_G | BAND_GN: - case BAND_B | BAND_G | BAND_GN | BAND_GAC: - case BAND_B | BAND_G | BAND_GN | BAND_GAC | BAND_GAX: - PRINTM(MINFO, "Infra band=%d SupportedRates_BG\n", - config_bands); + + } else if (bands & (BAND_B | BAND_G)) { + /* BG only */ + PRINTM(MINFO, "Band: Infra BG\n"); #ifdef WIFI_DIRECT_SUPPORT if (pmpriv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) k = wlan_copy_rates(rates, k, SupportedRates_G, sizeof(SupportedRates_G)); else +#endif k = wlan_copy_rates(rates, k, SupportedRates_BG, sizeof(SupportedRates_BG)); -#else - k = wlan_copy_rates(rates, k, SupportedRates_BG, - sizeof(SupportedRates_BG)); -#endif - break; - case BAND_A: - case BAND_A | BAND_G: - PRINTM(MINFO, "Infra band=%d SupportedRates_A\n", - config_bands); + } else if (bands & BAND_A) { + /* support A */ + PRINTM(MINFO, "Band: Infra A\n"); k = wlan_copy_rates(rates, k, SupportedRates_A, sizeof(SupportedRates_A)); - break; - case BAND_AN: - case BAND_A | BAND_AN: - case BAND_A | BAND_G | BAND_AN | BAND_GN: - case BAND_A | BAND_AN | BAND_AAC: - case BAND_A | BAND_G | BAND_AN | BAND_GN | BAND_AAC: - case BAND_A | BAND_AN | BAND_AAC | BAND_AAX: - case BAND_A | BAND_G | BAND_AN | BAND_GN | BAND_AAC | BAND_AAX: - PRINTM(MINFO, "Infra band=%d SupportedRates_A\n", - config_bands); - k = wlan_copy_rates(rates, k, SupportedRates_A, - sizeof(SupportedRates_A)); - break; - case BAND_GN: - case BAND_GN | BAND_GAC: - case BAND_GN | BAND_GAC | BAND_GAX: - PRINTM(MINFO, "Infra band=%d SupportedRates_N\n", - config_bands); - k = wlan_copy_rates(rates, k, SupportedRates_N, - sizeof(SupportedRates_N)); - break; } } else { - /* Ad-hoc mode */ - switch (config_bands) { - case (t_u8)BAND_B: + /* Adhoc. mode */ + if (bands == BAND_B) { + /* B only */ PRINTM(MINFO, "Band: Adhoc B\n"); k = wlan_copy_rates(rates, k, AdhocRates_B, sizeof(AdhocRates_B)); - break; - case (t_u8)BAND_G: - PRINTM(MINFO, "Band: Adhoc G only\n"); + } else if (bands == BAND_G) { + /* G only */ + PRINTM(MINFO, "Band: Adhoc G\n"); k = wlan_copy_rates(rates, k, AdhocRates_G, sizeof(AdhocRates_G)); - break; - case BAND_B | BAND_G: - PRINTM(MINFO, "Band: Adhoc BG\n"); - k = wlan_copy_rates(rates, k, AdhocRates_BG, - sizeof(AdhocRates_BG)); - break; - case BAND_A: - case BAND_A | BAND_AN | BAND_AAC: - case BAND_A | BAND_AN | BAND_AAC | BAND_AAX: + } else if (bands & BAND_A) { + /* support A */ PRINTM(MINFO, "Band: Adhoc A\n"); k = wlan_copy_rates(rates, k, AdhocRates_A, sizeof(AdhocRates_A)); - break; + + } else { + PRINTM(MINFO, "Band: Adhoc BG\n"); + k = wlan_copy_rates(rates, k, AdhocRates_BG, + sizeof(AdhocRates_BG)); } } @@ -2345,13 +2301,13 @@ #define COUNTRY_ID_CN 2 #define COUNTRY_ID_EU 3 typedef struct _oper_bw_chan { - /*non-global operating class */ + /*non-global operating class*/ t_u8 oper_class; - /*global operating class */ + /*global operating class*/ t_u8 global_oper_class; - /*bandwidth 0-20M 1-40M 2-80M 3-160M */ + /*bandwidth 0-20M 1-40M 2-80M 3-160M*/ t_u8 bandwidth; - /*channel list */ + /*channel list*/ t_u8 channel_list[13]; } oper_bw_chan; @@ -2383,7 +2339,6 @@ {129, 129, 3, {50, 114}}, {130, 130, 2, {42, 58, 106, 122, 138, 155}}, }; - /** oper class table for EU*/ static oper_bw_chan oper_bw_chan_eu[] = { /** non-global oper class,global oper class, bandwidth, channel list*/ @@ -2404,7 +2359,6 @@ {129, 129, 3, {50, 114}}, {130, 130, 2, {42, 58, 106, 122, 138, 155}}, }; - /** oper class table for Japan*/ static oper_bw_chan oper_bw_chan_jp[] = { /** non-Global oper class,global oper class, bandwidth, channel list*/ @@ -2432,7 +2386,6 @@ {129, 129, 3, {50, 114}}, {130, 130, 2, {42, 58, 106, 122, 138, 155}}, }; - /** oper class table for China*/ static oper_bw_chan oper_bw_chan_cn[] = { /** non-Global oper class,global oper class, bandwidth, channel list*/ @@ -2458,10 +2411,10 @@ * * @return A pointer to oper_bw_chan */ -static oper_bw_chan * -wlan_get_nonglobal_operclass_table(mlan_private *pmpriv, int *arraysize) +static oper_bw_chan *wlan_get_nonglobal_operclass_table(mlan_private *pmpriv, + int *arraysize) { - t_u8 country_code[][COUNTRY_CODE_LEN] = { "US", "JP", "CN" }; + t_u8 country_code[][COUNTRY_CODE_LEN] = {"US", "JP", "CN"}; int country_id = 0; oper_bw_chan *poper_bw_chan = MNULL; @@ -2472,7 +2425,7 @@ country_code[country_id], COUNTRY_CODE_LEN - 1)) break; if (country_id >= 3) - country_id = COUNTRY_ID_US; /*Set default to US */ + country_id = COUNTRY_ID_US; /*Set default to US*/ if (wlan_is_etsi_country(pmpriv->adapter, pmpriv->adapter->country_code)) country_id = COUNTRY_ID_EU; /** Country in EU */ @@ -2494,9 +2447,6 @@ poper_bw_chan = oper_bw_chan_eu; *arraysize = sizeof(oper_bw_chan_eu); break; - default: - PRINTM(MERROR, "Country not support!\n"); - break; } LEAVE(); @@ -2512,14 +2462,13 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_check_operclass_validation(mlan_private *pmpriv, t_u8 channel, - t_u8 oper_class) +mlan_status wlan_check_operclass_validation(mlan_private *pmpriv, t_u8 channel, + t_u8 oper_class) { int arraysize = 0, i = 0, channum = 0; oper_bw_chan *poper_bw_chan = MNULL; t_u8 center_freq_idx = 0; - t_u8 center_freqs[] = { 42, 50, 58, 106, 114, 122, 138, 155 }; + t_u8 center_freqs[] = {42, 50, 58, 106, 114, 122, 138, 155}; ENTER(); @@ -2536,9 +2485,8 @@ return MLAN_STATUS_FAILURE; } if (oper_class >= 128) { - center_freq_idx = - wlan_get_center_freq_idx(pmpriv, BAND_AAC, channel, - CHANNEL_BW_80MHZ); + center_freq_idx = wlan_get_center_freq_idx( + pmpriv, BAND_AAC, channel, CHANNEL_BW_80MHZ); channel = center_freq_idx; } poper_bw_chan = wlan_get_nonglobal_operclass_table(pmpriv, &arraysize); @@ -2558,7 +2506,7 @@ channum++) { if (poper_bw_chan[i].channel_list[channum] && poper_bw_chan[i].channel_list[channum] == - channel) { + channel) { LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -2582,13 +2530,12 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_get_curr_oper_class(mlan_private *pmpriv, t_u8 channel, - t_u8 bw, t_u8 *oper_class) +mlan_status wlan_get_curr_oper_class(mlan_private *pmpriv, t_u8 channel, + t_u8 bw, t_u8 *oper_class) { oper_bw_chan *poper_bw_chan = MNULL; t_u8 center_freq_idx = 0; - t_u8 center_freqs[] = { 42, 50, 58, 106, 114, 122, 138, 155 }; + t_u8 center_freqs[] = {42, 50, 58, 106, 114, 122, 138, 155}; int i = 0, arraysize = 0, channum = 0; ENTER(); @@ -2608,9 +2555,8 @@ } } if (bw == BW_80MHZ) { - center_freq_idx = - wlan_get_center_freq_idx(pmpriv, BAND_AAC, channel, - CHANNEL_BW_80MHZ); + center_freq_idx = wlan_get_center_freq_idx( + pmpriv, BAND_AAC, channel, CHANNEL_BW_80MHZ); channel = center_freq_idx; } @@ -2622,7 +2568,7 @@ channum++) { if (poper_bw_chan[i].channel_list[channum] && poper_bw_chan[i].channel_list[channum] == - channel) { + channel) { *oper_class = poper_bw_chan[i].oper_class; return MLAN_STATUS_SUCCESS; @@ -2631,7 +2577,7 @@ } } - PRINTM(MCMND, "Operating class not find!\n"); + PRINTM(MCMND, "Operating class not found!\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -2645,87 +2591,18 @@ * * @return Length */ -int -wlan_add_supported_oper_class_ie(mlan_private *pmpriv, - t_u8 **pptlv_out, t_u8 curr_oper_class) +int wlan_add_supported_oper_class_ie(mlan_private *pmpriv, t_u8 **pptlv_out, + t_u8 curr_oper_class) { - t_u8 oper_class_us[] = { 1, - 2, - 3, - 4, - 5, - 12, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 128, - 129, - 130 - }; - t_u8 oper_class_eu[] = { 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 17, - 128, - 129, - 130 - }; - t_u8 oper_class_jp[] = { 1, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 58, - 128, - 129, - 130 - }; - t_u8 oper_class_cn[] = { 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 128, - 129, - 130 - }; - t_u8 country_code[][COUNTRY_CODE_LEN] = { "US", "JP", "CN" }; + t_u8 oper_class_us[] = {1, 2, 3, 4, 5, 12, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 128, 129, 130}; + t_u8 oper_class_eu[] = {1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 17, 128, 129, 130}; + t_u8 oper_class_jp[] = {1, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, + 45, 56, 57, 58, 128, 129, 130}; + t_u8 oper_class_cn[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 129, 130}; + t_u8 country_code[][COUNTRY_CODE_LEN] = {"US", "JP", "CN"}; int country_id = 0, ret = 0; MrvlIETypes_SuppOperClass_t *poper_class = MNULL; @@ -2736,11 +2613,11 @@ country_code[country_id], COUNTRY_CODE_LEN - 1)) break; if (country_id >= 3) - country_id = COUNTRY_ID_US; /*Set default to US */ + country_id = COUNTRY_ID_US; /*Set default to US*/ if (wlan_is_etsi_country(pmpriv->adapter, pmpriv->adapter->country_code)) country_id = COUNTRY_ID_EU; /** Country in EU */ - poper_class = (MrvlIETypes_SuppOperClass_t *) * pptlv_out; + poper_class = (MrvlIETypes_SuppOperClass_t *)*pptlv_out; memset(pmpriv->adapter, poper_class, 0, sizeof(MrvlIETypes_SuppOperClass_t)); poper_class->header.type = wlan_cpu_to_le16(REGULATORY_CLASS); @@ -2786,8 +2663,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_set_regiontable(mlan_private *pmpriv, t_u8 region, t_u8 band) +mlan_status wlan_set_regiontable(mlan_private *pmpriv, t_u8 region, t_u16 band) { mlan_adapter *pmadapter = pmpriv->adapter; int i = 0, j; @@ -2844,7 +2720,7 @@ i++; } if (band & (BAND_A | BAND_AN | BAND_AAC)) { - if (pmadapter->cfp_code_bg) + if (pmadapter->cfp_code_a) cfp_code_a = pmadapter->cfp_code_a; PRINTM(MCMND, "%s: 5G 0x%x\n", __func__, cfp_code_a); cfp = wlan_get_region_cfp_table(pmadapter, cfp_code_a, BAND_A, @@ -2873,6 +2749,7 @@ } else if (cfp) { wlan_cfp_copy_dynamic(pmadapter, cfp, cfp_no, MNULL, 0); } + i++; } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -2888,8 +2765,7 @@ * - MTRUE if radar detection is required * - MFALSE otherwise */ -t_bool -wlan_get_cfp_radar_detect(mlan_private *priv, t_u8 chnl) +t_bool wlan_get_cfp_radar_detect(mlan_private *priv, t_u8 chnl) { int i, j; t_bool required = MFALSE; @@ -2897,7 +2773,7 @@ ENTER(); - /*get the cfp table first */ + /*get the cfp table first*/ for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { if (priv->adapter->region_channel[i].band == BAND_A) { pcfp = priv->adapter->region_channel[i].pcfp; @@ -2912,7 +2788,7 @@ goto done; } - /*get the radar detection requirements according to chan num */ + /*get the radar detection requirements according to chan num*/ for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { if (pcfp[j].channel == chnl) { required = pcfp[j].passive_scan_or_radar_detect; @@ -2935,9 +2811,7 @@ * - MTRUE if scan type is passive * - MFALSE otherwise */ - -t_bool -wlan_bg_scan_type_is_passive(mlan_private *priv, t_u8 chnl) +t_bool wlan_bg_scan_type_is_passive(mlan_private *priv, t_u8 chnl) { int i, j; t_bool passive = MFALSE; @@ -2945,7 +2819,7 @@ ENTER(); - /*get the cfp table first */ + /*get the cfp table first*/ for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { if (priv->adapter->region_channel[i].band & (BAND_B | BAND_G)) { pcfp = priv->adapter->region_channel[i].pcfp; @@ -2960,7 +2834,7 @@ goto done; } - /*get the bg scan type according to chan num */ + /*get the bg scan type according to chan num*/ for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { if (pcfp[j].channel == chnl) { passive = pcfp[j].passive_scan_or_radar_detect; @@ -2985,8 +2859,7 @@ * - MFALSE otherwise */ -t_bool -wlan_is_chan_passive(mlan_private *priv, t_u8 band, t_u8 chan) +t_bool wlan_is_chan_passive(mlan_private *priv, t_u16 band, t_u8 chan) { int i, j; t_bool passive = MFALSE; @@ -3029,8 +2902,7 @@ * - MFALSE otherwise */ -t_bool -wlan_is_chan_disabled(mlan_private *priv, t_u8 band, t_u8 chan) +t_bool wlan_is_chan_disabled(mlan_private *priv, t_u16 band, t_u8 chan) { int i, j; t_bool disabled = MFALSE; @@ -3074,8 +2946,7 @@ * - MFALSE otherwise */ -t_bool -wlan_is_chan_blacklisted(mlan_private *priv, t_u8 band, t_u8 chan) +t_bool wlan_is_chan_blacklisted(mlan_private *priv, t_u16 band, t_u8 chan) { int i, j; t_bool blacklist = MFALSE; @@ -3083,7 +2954,7 @@ ENTER(); - /*get the cfp table first */ + /*get the cfp table first*/ for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { if (priv->adapter->region_channel[i].band & band) { pcfp = priv->adapter->region_channel[i].pcfp; @@ -3092,7 +2963,7 @@ } if (pcfp) { - /*check table according to chan num */ + /*check table according to chan num*/ for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { if (pcfp[j].channel == chan) { blacklist = pcfp[j].dynamic.blacklist; @@ -3118,8 +2989,8 @@ * - MFALSE otherwise */ -t_bool -wlan_set_chan_blacklist(mlan_private *priv, t_u8 band, t_u8 chan, t_bool bl) +t_bool wlan_set_chan_blacklist(mlan_private *priv, t_u16 band, t_u8 chan, + t_bool bl) { int i, j; t_bool set_bl = MFALSE; @@ -3127,7 +2998,7 @@ ENTER(); - /*get the cfp table first */ + /*get the cfp table first*/ for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { if (priv->adapter->region_channel[i].band & band) { pcfp = priv->adapter->region_channel[i].pcfp; @@ -3136,7 +3007,7 @@ } if (pcfp) { - /*check table according to chan num */ + /*check table according to chan num*/ for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { if (pcfp[j].channel == chan) { pcfp[j].dynamic.blacklist = bl; @@ -3151,6 +3022,119 @@ } /** + * @brief Set channel's dfs state + * + * @param priv Private driver information structure + * @param band Band to check + * @param chan Channel to check + * @param dfs_state dfs state + * + * @return N/A + */ +t_void wlan_set_chan_dfs_state(mlan_private *priv, t_u16 band, t_u8 chan, + dfs_state_t dfs_state) +{ + int i, j; + chan_freq_power_t *pcfp = MNULL; + + ENTER(); + + /*get the cfp table first*/ + for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { + if (priv->adapter->region_channel[i].band & band) { + pcfp = priv->adapter->region_channel[i].pcfp; + break; + } + } + + if (pcfp) { + /*check table according to chan num*/ + for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { + if (pcfp[j].channel == chan) { + pcfp[j].dynamic.dfs_state = dfs_state; + break; + } + } + } + + LEAVE(); +} + +/** + * @brief get channel's dfs state + * + * @param priv Private driver information structure + * @param band Band to check + * @param chan Channel to check + * + * @return channel's dfs state + */ +dfs_state_t wlan_get_chan_dfs_state(mlan_private *priv, t_u16 band, t_u8 chan) +{ + int i, j; + chan_freq_power_t *pcfp = MNULL; + dfs_state_t dfs_state = DFS_USABLE; + + ENTER(); + + /*get the cfp table first*/ + for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { + if (priv->adapter->region_channel[i].band & band) { + pcfp = priv->adapter->region_channel[i].pcfp; + break; + } + } + + if (pcfp) { + /*check table according to chan num*/ + for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { + if (pcfp[j].channel == chan) { + dfs_state = pcfp[j].dynamic.dfs_state; + break; + } + } + } + + LEAVE(); + return dfs_state; +} + +/** + * @brief reset all channel's dfs state + * + * @param priv Private driver information structure + * @param band Band to check + * @param dfs_state dfs state + * + * @return N/A + */ +t_void wlan_reset_all_chan_dfs_state(mlan_private *priv, t_u16 band, + dfs_state_t dfs_state) +{ + int i, j; + chan_freq_power_t *pcfp = MNULL; + + ENTER(); + + /*get the cfp table first*/ + for (i = 0; i < MAX_REGION_CHANNEL_NUM; i++) { + if (priv->adapter->region_channel[i].band & band) { + pcfp = priv->adapter->region_channel[i].pcfp; + break; + } + } + + if (pcfp) { + /*check table according to chan num*/ + for (j = 0; j < priv->adapter->region_channel[i].num_cfp; j++) { + pcfp[j].dynamic.dfs_state = dfs_state; + } + } + + LEAVE(); +} + +/** * @brief Convert rateid in IEEE format to MRVL format * * @param priv Private driver information structure @@ -3160,9 +3144,8 @@ * @return * Rate ID in terms of MRVL format */ -t_u8 -wlan_ieee_rateid_to_mrvl_rateid(mlan_private *priv, t_u16 IeeeMacRate, - t_u8 *dst_mac) +t_u8 wlan_ieee_rateid_to_mrvl_rateid(mlan_private *priv, t_u16 IeeeMacRate, + t_u8 *dst_mac) { /* Set default rate ID to RATEID_DBPSK1Mbps */ t_u8 mrvlRATEID = 0; @@ -3182,19 +3165,17 @@ rate_tbl = rate_map_table_2x2; cnt = sizeof(rate_map_table_2x2) / sizeof(rate_map); } + #ifdef UAP_SUPPORT if (priv->bss_role == MLAN_BSS_ROLE_UAP) { if (!dst_mac) { LEAVE(); return mrvlRATEID; } - sta_ptr = - (sta_node *)util_peek_list(priv->adapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + sta_ptr = (sta_node *)util_peek_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!sta_ptr) { LEAVE(); return mrvlRATEID; @@ -3239,8 +3220,7 @@ * @return * Rate ID in terms of IEEE format */ -t_u8 -wlan_mrvl_rateid_to_ieee_rateid(t_u8 rate) +t_u8 wlan_mrvl_rateid_to_ieee_rateid(t_u8 rate) { return rateUnit_500Kbps[rate]; } @@ -3253,8 +3233,7 @@ * @return * None */ -static void -wlan_sort_cfp_otp_table(mlan_adapter *pmadapter) +static void wlan_sort_cfp_otp_table(mlan_adapter *pmadapter) { t_u8 c, d; chan_freq_power_t *ch1; @@ -3294,8 +3273,7 @@ * @return * None */ -void -wlan_add_fw_cfp_tables(pmlan_private pmpriv, t_u8 *buf, t_u16 buf_left) +void wlan_add_fw_cfp_tables(pmlan_private pmpriv, t_u8 *buf, t_u16 buf_left) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -3373,7 +3351,7 @@ if (cfp_table_BG[i].code == pmadapter->otp_region->region_code) { max_tx_pwr_bg = (cfp_table_BG[i].cfp) - ->max_tx_power; + ->max_tx_power; break; } } @@ -3381,7 +3359,7 @@ if (cfp_table_A[i].code == pmadapter->otp_region->region_code) { max_tx_pwr_a = (cfp_table_A[i].cfp) - ->max_tx_power; + ->max_tx_power; break; } } @@ -3400,10 +3378,12 @@ pmadapter->domain_reg.country_code[1] = pmadapter->otp_region->country_code[1]; pmadapter->domain_reg.country_code[2] = '\0'; - PRINTM(MCMND, "OTP region: region_code=%d %c%c\n", + PRINTM(MCMND, + "OTP region: region_code=%d %c%c dfs_region=%d\n", pmadapter->otp_region->region_code, pmadapter->country_code[0], - pmadapter->country_code[1]); + pmadapter->country_code[1], + pmadapter->otp_region->dfs_region); pmadapter->cfp_code_bg = pmadapter->otp_region->region_code; pmadapter->cfp_code_a = @@ -3419,12 +3399,11 @@ break; } - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - pmadapter-> - tx_power_table_bg_rows * - sizeof(chan_freq_power_t), - MLAN_MEM_DEF, - (t_u8 **)&pmadapter->cfp_otp_bg); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + pmadapter->tx_power_table_bg_rows * + sizeof(chan_freq_power_t), + MLAN_MEM_DEF, (t_u8 **)&pmadapter->cfp_otp_bg); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->cfp_otp_bg) { PRINTM(MERROR, @@ -3435,7 +3414,8 @@ * cfp bg table and set frequency and max_tx_power * values */ - for (i = 0; i < pmadapter->tx_power_table_bg_rows; i++) { + for (i = 0; i < pmadapter->tx_power_table_bg_rows; + i++) { (pmadapter->cfp_otp_bg + i)->channel = *data; if (*data == 14) (pmadapter->cfp_otp_bg + i)->freq = @@ -3455,17 +3435,17 @@ PRINTM(MCMD_D, "OTP Region (BG): chan=%d flags=0x%x\n", (pmadapter->cfp_otp_bg + i)->channel, - (pmadapter->cfp_otp_bg + - i)->dynamic.flags); + (pmadapter->cfp_otp_bg + i) + ->dynamic.flags); data++; } - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - pmadapter-> - tx_power_table_a_rows * - sizeof(chan_freq_power_t), - MLAN_MEM_DEF, - (t_u8 **)&pmadapter->cfp_otp_a); - if (ret != MLAN_STATUS_SUCCESS || !pmadapter->cfp_otp_a) { + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + pmadapter->tx_power_table_a_rows * + sizeof(chan_freq_power_t), + MLAN_MEM_DEF, (t_u8 **)&pmadapter->cfp_otp_a); + if (ret != MLAN_STATUS_SUCCESS || + !pmadapter->cfp_otp_a) { PRINTM(MERROR, "Memory allocation for storing otp a table data failed!\n"); break; @@ -3488,6 +3468,8 @@ data++; (pmadapter->cfp_otp_a + i)->dynamic.flags = *data; + (pmadapter->cfp_otp_a + i)->dynamic.dfs_state = + DFS_USABLE; if (*data & NXP_CHANNEL_DFS) (pmadapter->cfp_otp_a + i) ->passive_scan_or_radar_detect = @@ -3495,8 +3477,8 @@ PRINTM(MCMD_D, "OTP Region (A): chan=%d flags=0x%x\n", (pmadapter->cfp_otp_a + i)->channel, - (pmadapter->cfp_otp_a + - i)->dynamic.flags); + (pmadapter->cfp_otp_a + i) + ->dynamic.flags); data++; } @@ -3519,16 +3501,16 @@ i = 0; while ((i < pmadapter->tx_power_table_bg_rows * - pmadapter->tx_power_table_bg_cols) && - (i < tlv_buf_len) && (*tmp != 36)) { + pmadapter->tx_power_table_bg_cols) && + (i < tlv_buf_len)) { i++; tmp++; } if (!pmadapter->tx_power_table_bg) { - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - i, MLAN_MEM_DEF, - (t_u8 **)&pmadapter-> - tx_power_table_bg); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, i, + MLAN_MEM_DEF, + (t_u8 **)&pmadapter->tx_power_table_bg); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->tx_power_table_bg) { PRINTM(MERROR, @@ -3542,16 +3524,16 @@ data += i; i = 0; while ((i < pmadapter->tx_power_table_a_rows * - pmadapter->tx_power_table_a_cols) && + pmadapter->tx_power_table_a_cols) && (i < (tlv_buf_len - pmadapter->tx_power_table_bg_size))) { i++; } if (!pmadapter->tx_power_table_a) { - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - i, MLAN_MEM_DEF, - (t_u8 **)&pmadapter-> - tx_power_table_a); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, i, + MLAN_MEM_DEF, + (t_u8 **)&pmadapter->tx_power_table_a); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->tx_power_table_a) { PRINTM(MERROR, @@ -3565,16 +3547,19 @@ break; case TLV_TYPE_POWER_TABLE_ATTR: pmadapter->tx_power_table_bg_rows = - ((power_table_attr_t *) data)->rows_2g; + ((power_table_attr_t *)data)->rows_2g; pmadapter->tx_power_table_bg_cols = - ((power_table_attr_t *) data)->cols_2g; + ((power_table_attr_t *)data)->cols_2g; pmadapter->tx_power_table_a_rows = - ((power_table_attr_t *) data)->rows_5g; + ((power_table_attr_t *)data)->rows_5g; pmadapter->tx_power_table_a_cols = - ((power_table_attr_t *) data)->cols_5g; - PRINTM(MCMD_D, "OTP region: bg_row=%d, a_row=%d\n", + ((power_table_attr_t *)data)->cols_5g; + PRINTM(MCMD_D, + "OTP region: bg_row=%d,bg_cols=%d a_row=%d, a_cols=%d\n", pmadapter->tx_power_table_bg_rows, - pmadapter->tx_power_table_a_rows); + pmadapter->tx_power_table_bg_cols, + pmadapter->tx_power_table_a_rows, + pmadapter->tx_power_table_a_cols); break; default: break; @@ -3616,8 +3601,7 @@ * * @param pmadapter A pointer to mlan_adapter structure */ -void -wlan_free_fw_cfp_tables(mlan_adapter *pmadapter) +void wlan_free_fw_cfp_tables(mlan_adapter *pmadapter) { pmlan_callbacks pcb; @@ -3657,8 +3641,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_get_cfp_table(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_cfp_table(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_misc_cfg *ds_misc_cfg = MNULL; mlan_status ret = MLAN_STATUS_FAILURE; @@ -3669,10 +3653,9 @@ if (pioctl_req) { ds_misc_cfg = (mlan_ds_misc_cfg *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_GET) { - cfp = wlan_get_region_cfp_table(pmadapter, - pmadapter->region_code, - ds_misc_cfg->param.cfp. - band, &cfp_no); + cfp = wlan_get_region_cfp_table( + pmadapter, pmadapter->region_code, + ds_misc_cfg->param.cfp.band, &cfp_no); if (cfp) { ds_misc_cfg->param.cfp.num_chan = cfp_no; memcpy_ext(pmadapter, @@ -3697,8 +3680,8 @@ * @return success, otherwise fail * */ -mlan_status -wlan_get_cfpinfo(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_cfpinfo(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { chan_freq_power_t *cfp_bg = MNULL; t_u32 cfp_no_bg = 0; @@ -3732,8 +3715,8 @@ size += cfp_no_bg * sizeof(chan_freq_power_t); if (pmadapter->cfp_code_a) cfp_code_a = pmadapter->cfp_code_a; - cfp_a = wlan_get_region_cfp_table(pmadapter, cfp_code_a, - BAND_A, &cfp_no_a); + cfp_a = wlan_get_region_cfp_table(pmadapter, cfp_code_a, BAND_A, + &cfp_no_a); size += cfp_no_a * sizeof(chan_freq_power_t); if (pmadapter->otp_region) size += sizeof(pmadapter->otp_region->environment); @@ -3814,7 +3797,7 @@ /* No. of cols */ size = pmadapter->tx_power_table_bg_size / - pmadapter->tx_power_table_bg_rows; + pmadapter->tx_power_table_bg_rows; memcpy_ext(pmadapter, req_buf + len, tmp, sizeof(size), sizeof(size)); len += sizeof(size); memcpy_ext(pmadapter, req_buf + len, pmadapter->tx_power_table_bg, @@ -3834,7 +3817,7 @@ /* No. of cols */ size = pmadapter->tx_power_table_a_size / - pmadapter->tx_power_table_a_rows; + pmadapter->tx_power_table_a_rows; memcpy_ext(pmadapter, req_buf + len, tmp, sizeof(size), sizeof(size)); len += sizeof(size); memcpy_ext(pmadapter, req_buf + len, pmadapter->tx_power_table_a,
diff --git a/wlan_sd8987/mlan/mlan_cmdevt.c b/wlan_sd8987/mlan/mlan_cmdevt.c index 61fdf5c..062bb35 100755 --- a/wlan_sd8987/mlan/mlan_cmdevt.c +++ b/wlan_sd8987/mlan/mlan_cmdevt.c
@@ -4,7 +4,7 @@ * @brief This file contains the handling of CMD/EVENT in MLAN * * - * Copyright 2009-2021 NXP + * Copyright 2009-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -58,14 +58,28 @@ ********************************************************/ #ifdef STA_SUPPORT /** + * @brief This function check if the command was cancel scan command + * + * @param pcmd A pointer to HostCmd_DS_COMMAND structure + * @return N/A + */ +static t_u8 wlan_is_cancel_scan_cmd(HostCmd_DS_COMMAND *pcmd) +{ + HostCmd_DS_802_11_SCAN_EXT *pext_scan_cmd = &pcmd->params.ext_scan; + if (pext_scan_cmd->ext_scan_type == EXT_SCAN_CANCEL) + return MTRUE; + else + return MFALSE; +} +/** * @brief This function inserts scan command node to scan_pending_q. * * @param pmpriv A pointer to mlan_private structure * @param pcmd_node A pointer to cmd_ctrl_node structure * @return N/A */ -static t_void -wlan_queue_scan_cmd(mlan_private *pmpriv, cmd_ctrl_node *pcmd_node) +static t_void wlan_queue_scan_cmd(mlan_private *pmpriv, + cmd_ctrl_node *pcmd_node) { mlan_adapter *pmadapter = pmpriv->adapter; @@ -91,8 +105,7 @@ * * @return MTRUE/MFALSE */ -static t_u8 -wlan_is_cmd_allowed_during_scan(t_u16 cmd_id) +static t_u8 wlan_is_cmd_allowed_during_scan(t_u16 cmd_id) { t_u8 ret = MTRUE; ENTER(); @@ -121,6 +134,7 @@ case HOST_CMD_APCMD_BSS_STOP: case HOST_CMD_APCMD_STA_DEAUTH: #endif + case HostCmd_CMD_802_11_BG_SCAN_CONFIG: case HostCMD_APCMD_ACS_SCAN: ret = MFALSE; break; @@ -132,27 +146,25 @@ } /** - * @brief This function move the cmd from scan_pending_q to + * @brief This function move the cmd from ext_cmd_pending_q to * cmd_pending_q * * @param cmd_id cmd id * * @return MTRUE/MFALSE */ -t_void -wlan_move_cmd_to_cmd_pending_q(pmlan_adapter pmadapter) +t_void wlan_move_cmd_to_cmd_pending_q(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; ENTER(); wlan_request_cmd_lock(pmadapter); - while ((pcmd_node = - (cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, - &pmadapter->scan_pending_q, - MNULL, MNULL))) { + while ((pcmd_node = (cmd_ctrl_node *)util_peek_list( + pmadapter->pmoal_handle, &pmadapter->ext_cmd_pending_q, + MNULL, MNULL))) { util_unlink_list(pmadapter->pmoal_handle, - &pmadapter->scan_pending_q, + &pmadapter->ext_cmd_pending_q, (pmlan_linked_list)pcmd_node, MNULL, MNULL); wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, MTRUE); } @@ -161,6 +173,71 @@ } /** + * @brief This function inserts scan command node to scan_cmd_pending_q. + * + * @param pmpriv A pointer to mlan_private structure + * @param pcmd_node A pointer to cmd_ctrl_node structure + * @return N/A + */ +static t_void wlan_queue_cmd_to_ext_cmd_pending_queue(mlan_private *pmpriv, + cmd_ctrl_node *pcmd_node) +{ + mlan_adapter *pmadapter = pmpriv->adapter; + + ENTER(); + + if (pcmd_node == MNULL) + goto done; + + util_enqueue_list_tail(pmadapter->pmoal_handle, + &pmadapter->ext_cmd_pending_q, + (pmlan_linked_list)pcmd_node, MNULL, MNULL); + +done: + LEAVE(); +} + +/** + * @brief Internal function used to flush the scan cmd pending queue + * + * @param pmadapter A pointer to mlan_adapter structure + * + * @return N/A + */ +t_void wlan_flush_ext_cmd_pending_queue(pmlan_adapter pmadapter) +{ + cmd_ctrl_node *pcmd_node = MNULL; + HostCmd_DS_COMMAND *pcmd = MNULL; + mlan_ioctl_req *pioctl_buf = MNULL; + pmlan_callbacks pcb = &pmadapter->callbacks; + ENTER(); + + wlan_request_cmd_lock(pmadapter); + while ((pcmd_node = (cmd_ctrl_node *)util_peek_list( + pmadapter->pmoal_handle, &pmadapter->ext_cmd_pending_q, + MNULL, MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, + &pmadapter->ext_cmd_pending_q, + (pmlan_linked_list)pcmd_node, MNULL, MNULL); + pcmd = (HostCmd_DS_COMMAND *)(pcmd_node->cmdbuf->pbuf + + pcmd_node->cmdbuf->data_offset); + PRINTM(MCMND, "flush ext_cmd_pending_queue: cmd 0x%02x\n", + wlan_le16_to_cpu(pcmd->command)); + if (pcmd_node->pioctl_buf) { + pioctl_buf = (mlan_ioctl_req *)pcmd_node->pioctl_buf; + pcmd_node->pioctl_buf = MNULL; + pioctl_buf->status_code = MLAN_ERROR_CMD_CANCEL; + pcb->moal_ioctl_complete(pmadapter->pmoal_handle, + pioctl_buf, + MLAN_STATUS_FAILURE); + } + wlan_insert_cmd_to_free_q(pmadapter, pcmd_node); + } + wlan_release_cmd_lock(pmadapter); + LEAVE(); +} + +/** * @brief This function inserts command node to scan_pending_q or * cmd_pending_q * @@ -169,16 +246,17 @@ * @return N/A */ -static t_void -wlan_queue_cmd(mlan_private *pmpriv, cmd_ctrl_node *pcmd_node, t_u16 cmd_no) +static t_void wlan_queue_cmd(mlan_private *pmpriv, cmd_ctrl_node *pcmd_node, + t_u16 cmd_no) { ENTER(); if (pmpriv->adapter->scan_processing && pmpriv->adapter->ext_scan_type == EXT_SCAN_ENHANCE) { if (MFALSE == wlan_is_cmd_allowed_during_scan(cmd_no)) { - PRINTM(MCMND, "QUEUE_CMD: cmd=0x%x scan_pending_q\n", + PRINTM(MCMND, "QUEUE_CMD: cmd=0x%x ext_cmd_pending_q\n", cmd_no); - wlan_queue_scan_cmd(pmpriv, pcmd_node); + wlan_queue_cmd_to_ext_cmd_pending_queue(pmpriv, + pcmd_node); return; } } @@ -193,8 +271,7 @@ * * @return N/A */ -static void -wlan_check_scan_queue(pmlan_adapter pmadapter) +static void wlan_check_scan_queue(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; t_u16 num = 0; @@ -221,8 +298,7 @@ * * @return N/A */ -static void -wlan_dump_pending_commands(pmlan_adapter pmadapter) +static void wlan_dump_pending_commands(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; HostCmd_DS_COMMAND *pcmd; @@ -261,8 +337,7 @@ * * @return N/A */ -static t_void -wlan_dump_info(mlan_adapter *pmadapter, t_u8 reason) +static t_void wlan_dump_info(mlan_adapter *pmadapter, t_u8 reason) { cmd_ctrl_node *pcmd_node = MNULL; #ifdef DEBUG_LEVEL1 @@ -314,19 +389,20 @@ } else { pcmd_node = pmadapter->curr_cmd; cmd_id = pmadapter->dbg.last_cmd_id - [pmadapter->dbg.last_cmd_index]; + [pmadapter->dbg.last_cmd_index]; cmd_act = pmadapter->dbg.last_cmd_act - [pmadapter->dbg.last_cmd_index]; + [pmadapter->dbg.last_cmd_index]; PRINTM_GET_SYS_TIME(MERROR, &sec, &usec); PRINTM(MERROR, "Current cmd id (%lu.%06lu) = 0x%x, act = 0x%x\n", sec, usec, cmd_id, cmd_act); #if defined(SDIO) || defined(PCIE) - if (!IS_USB(pmadapter->card_type) && pcmd_node->cmdbuf) { + if (!IS_USB(pmadapter->card_type) && + pcmd_node->cmdbuf) { t_u8 *pcmd_buf; pcmd_buf = pcmd_node->cmdbuf->pbuf + - pcmd_node->cmdbuf->data_offset + - pmadapter->ops.intf_header_len; + pcmd_node->cmdbuf->data_offset + + pmadapter->ops.intf_header_len; for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); PRINTM(MERROR, "\n"); @@ -425,6 +501,7 @@ pmadapter->pps_uapsd_mode, pmadapter->sleep_period.period); PRINTM(MERROR, "tx_lock_flag = %d\n", pmadapter->tx_lock_flag); PRINTM(MERROR, "scan_processing = %d\n", pmadapter->scan_processing); + PRINTM(MERROR, "scan_state = 0x%x\n", pmadapter->scan_state); PRINTM(MERROR, "bypass_pkt_count=%d\n", pmadapter->bypass_pkt_count); #ifdef SDIO if (IS_SD(pmadapter->card_type)) { @@ -455,7 +532,7 @@ for (j = 0; j < mp_aggr_pkt_limit; j++) { PRINTM(MERROR, "0x%02x ", pmadapter->pcard_sd->last_mp_wr_info - [i * mp_aggr_pkt_limit + j]); + [i * mp_aggr_pkt_limit + j]); } PRINTM(MERROR, "\n"); } @@ -474,7 +551,7 @@ pmadapter->pcard_pcie->evtbd_wrptr); PRINTM(MERROR, "last_wr_index:%d\n", pmadapter->pcard_pcie->txbd_wrptr & - (pmadapter->pcard_pcie->txrx_bd_size - 1)); + (pmadapter->pcard_pcie->txrx_bd_size - 1)); PRINTM(MERROR, " txrx_bd_size = %d\n", pmadapter->pcard_pcie->txrx_bd_size); PRINTM(MERROR, "Tx pkt size:\n"); @@ -491,11 +568,10 @@ wlan_dump_ralist(pmadapter->priv[i]); } if (reason != REASON_CODE_CMD_TIMEOUT) { - if ((pmadapter->dbg.num_no_cmd_node >= 5) - || (pmadapter->pm_wakeup_card_req && - pmadapter->pm_wakeup_fw_try) - || (reason == REASON_CODE_EXT_SCAN_TIMEOUT) - ) { + if ((pmadapter->dbg.num_no_cmd_node >= 5) || + (pmadapter->pm_wakeup_card_req && + pmadapter->pm_wakeup_fw_try) || + (reason == REASON_CODE_EXT_SCAN_TIMEOUT)) { if (pmpriv) wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DBG_DUMP, @@ -504,9 +580,10 @@ pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); if (pmpriv) - wlan_recv_event(pmpriv, - MLAN_EVENT_ID_DRV_DBG_DUMP, - MNULL); + wlan_recv_event( + pmpriv, + MLAN_EVENT_ID_DRV_DBG_DUMP, + MNULL); } } } @@ -522,8 +599,7 @@ * * @return The converted hex if chr is a valid hex, else 0 */ -static t_u32 -wlan_hexval(t_u8 chr) +static t_u32 wlan_hexval(t_u8 chr) { if (chr >= '0' && chr <= '9') return chr - '0'; @@ -543,8 +619,7 @@ * @return The converted hex value if param a is a valid hex, else * 0 */ -static int -wlan_atox(t_u8 *a) +static int wlan_atox(t_u8 *a) { int i = 0; @@ -566,8 +641,7 @@ * * @return The parsed hex data length */ -static t_u32 -wlan_parse_cal_cfg(t_u8 *src, t_size len, t_u8 *dst) +static t_u32 wlan_parse_cal_cfg(t_u8 *src, t_size len, t_u8 *dst) { t_u8 *ptr; t_u8 *dptr; @@ -602,8 +676,7 @@ * @return Location of the first occurrence of the char * if found, else NULL */ -static t_u8 * -wlan_strchr(t_u8 *s, int c) +static t_u8 *wlan_strchr(t_u8 *s, int c) { t_u8 *pos = s; while (*pos != '\0') { @@ -626,9 +699,8 @@ * @param size data length * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -wlan_process_hostcmd_cfg(pmlan_private pmpriv, - t_u16 cfg_type, t_u8 *data, t_size size) +static t_u32 wlan_process_hostcmd_cfg(pmlan_private pmpriv, t_u16 cfg_type, + t_u8 *data, t_size size) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 *pos = data; @@ -665,7 +737,7 @@ while ((pos - data) < size) { while (*pos == ' ' || *pos == '\t') pos++; - if (*pos == '#') { /* Line comment */ + if (*pos == '#') { /* Line comment */ while (*pos != '\n') pos++; pos++; @@ -673,7 +745,7 @@ if ((*pos == '\r' && *(pos + 1) == '\n') || *pos == '\n' || *pos == '\0') { pos++; - continue; /* Needn't process this line */ + continue; /* Needn't process this line */ } if (*pos == '}') { @@ -684,15 +756,13 @@ wlan_cpu_to_le16(HostCmd_CMD_CFG_DATA); pcmd->size = wlan_cpu_to_le16(hostcmd->len); pcfg_cmd = (HostCmd_DS_802_11_CFG_DATA - *)((t_u8 *)pcmd + S_DS_GEN); + *)((t_u8 *)pcmd + S_DS_GEN); pcfg_cmd->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); pcfg_cmd->type = wlan_cpu_to_le16(OID_TYPE_DPD); - pcfg_cmd->data_len = - wlan_cpu_to_le16(hostcmd->len - - S_DS_GEN - - sizeof - (HostCmd_DS_802_11_CFG_DATA)); + pcfg_cmd->data_len = wlan_cpu_to_le16( + hostcmd->len - S_DS_GEN - + sizeof(HostCmd_DS_802_11_CFG_DATA)); pcmd = MNULL; pcfg_cmd = MNULL; } else { @@ -726,8 +796,7 @@ !hostcmd_flag) { pcmd = (HostCmd_DS_GEN *)ptr; ptr += S_DS_GEN + - sizeof - (HostCmd_DS_802_11_CFG_DATA); + sizeof(HostCmd_DS_802_11_CFG_DATA); } continue; } @@ -762,10 +831,9 @@ * * @return N/A */ -static void -wlan_init_cmd_node(pmlan_private pmpriv, - cmd_ctrl_node *pcmd_node, t_u32 cmd_no, - t_void *pioctl_buf, t_void *pdata_buf) +static void wlan_init_cmd_node(pmlan_private pmpriv, cmd_ctrl_node *pcmd_node, + t_u32 cmd_no, t_void *pioctl_buf, + t_void *pdata_buf) { mlan_adapter *pmadapter = pmpriv->adapter; @@ -826,8 +894,7 @@ * * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or MNULL */ -static cmd_ctrl_node * -wlan_get_cmd_node(mlan_adapter *pmadapter) +static cmd_ctrl_node *wlan_get_cmd_node(mlan_adapter *pmadapter) { cmd_ctrl_node *pcmd_node; @@ -840,12 +907,9 @@ wlan_request_cmd_lock(pmadapter); if (util_peek_list(pmadapter->pmoal_handle, &pmadapter->cmd_free_q, MNULL, MNULL)) { - pcmd_node = - (cmd_ctrl_node *)util_dequeue_list(pmadapter-> - pmoal_handle, - &pmadapter-> - cmd_free_q, MNULL, - MNULL); + pcmd_node = (cmd_ctrl_node *)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->cmd_free_q, MNULL, + MNULL); } else { PRINTM(MERROR, "GET_CMD_NODE: cmd_ctrl_node is not available\n"); @@ -864,8 +928,8 @@ * * @return N/A */ -static t_void -wlan_clean_cmd_node(pmlan_adapter pmadapter, cmd_ctrl_node *pcmd_node) +static t_void wlan_clean_cmd_node(pmlan_adapter pmadapter, + cmd_ctrl_node *pcmd_node) { ENTER(); @@ -904,8 +968,7 @@ * * @return A pointer to first entry match pioctl_req */ -static cmd_ctrl_node * -wlan_get_pending_scan_cmd(pmlan_adapter pmadapter) +static cmd_ctrl_node *wlan_get_pending_scan_cmd(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; @@ -939,8 +1002,8 @@ * * @return A pointer to first entry match pioctl_req */ -static cmd_ctrl_node * -wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static cmd_ctrl_node *wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { cmd_ctrl_node *pcmd_node = MNULL; @@ -974,8 +1037,8 @@ * * @return A pointer to first entry match pioctl_req */ -static cmd_ctrl_node * -wlan_get_bss_pending_ioctl_cmd(pmlan_adapter pmadapter, t_u32 bss_index) +static cmd_ctrl_node *wlan_get_bss_pending_ioctl_cmd(pmlan_adapter pmadapter, + t_u32 bss_index) { cmd_ctrl_node *pcmd_node = MNULL; mlan_ioctl_req *pioctl_buf = MNULL; @@ -1011,9 +1074,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_host_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_host_cmd(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc; t_u16 size = wlan_le16_to_cpu(resp->size); @@ -1042,9 +1105,9 @@ * @param cmd_no A pointer to cmd_no * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_host_cmd(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf, t_u16 *cmd_no) +static mlan_status wlan_cmd_host_cmd(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_void *pdata_buf, + t_u16 *cmd_no) { mlan_ds_misc_cmd *pcmd_ptr = (mlan_ds_misc_cmd *)pdata_buf; @@ -1067,10 +1130,9 @@ * * @return timeout value for this command */ -static t_u16 -wlan_get_cmd_timeout(t_u16 cmd_id) +static t_u32 wlan_get_cmd_timeout(t_u16 cmd_id) { - t_u16 timeout; + t_u32 timeout; ENTER(); switch (cmd_id) { case HostCmd_CMD_802_11_SCAN: @@ -1106,12 +1168,14 @@ default: #ifdef IMX_SUPPORT /* - * During the roaming test and the 5AP connection test, cmd timeout are observed - * for commands like 0x5e, 0x16, 0xd1. Observed that response has come just after - * default timeout of 2 seconds for these commands. This random timeout is not + * During the roaming test and the 5AP connection test, cmd + * timeout are observed for commands like 0x5e, 0x16, 0xd1. + * Observed that response has come just after default timeout of + * 2 seconds for these commands. This random timeout is not * observed when the default timeout is increased to 5 seconds - * (As an work around, Increase the default timeout to 5 seconds. - * Need to further debug exact reason for delay in cmd responses) + * (As an work around, Increase the default timeout to 5 + * seconds. Need to further debug exact reason for delay in cmd + * responses) * */ timeout = MRVDRV_TIMER_1S * 5; @@ -1132,8 +1196,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_dnld_cmd_to_fw(mlan_private *pmpriv, cmd_ctrl_node *pcmd_node) +static mlan_status wlan_dnld_cmd_to_fw(mlan_private *pmpriv, + cmd_ctrl_node *pcmd_node) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -1149,7 +1213,7 @@ #ifdef DEBUG_LEVEL1 t_u32 sec = 0, usec = 0; #endif - t_u16 timeout = 0; + t_u32 timeout = 0; ENTER(); @@ -1182,10 +1246,9 @@ /* Set command sequence number */ pmadapter->seq_num++; - pcmd->seq_num = - wlan_cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO - (pmadapter->seq_num, pcmd_node->priv->bss_num, - pcmd_node->priv->bss_type)); + pcmd->seq_num = wlan_cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO( + pmadapter->seq_num, pcmd_node->priv->bss_num, + pcmd_node->priv->bss_type)); cmd_code = wlan_le16_to_cpu(pcmd->command); pcmd_node->cmd_no = cmd_code; timeout = wlan_get_cmd_timeout(cmd_code); @@ -1237,6 +1300,9 @@ } #endif + if (pcmd->command == HostCmd_CMD_802_11_SCAN_EXT) + pmadapter->scan_state |= wlan_get_ext_scan_state(pcmd); + PRINTM_GET_SYS_TIME(MCMND, &sec, &usec); PRINTM_NETINTF(MCMND, pmpriv); PRINTM(MCMND, @@ -1289,8 +1355,8 @@ cmd_code &= HostCmd_CMD_ID_MASK; /* For the command who has no command response, we should return here */ - if (cmd_code == HostCmd_CMD_FW_DUMP_EVENT - || cmd_code == HostCmd_CMD_SOFT_RESET) { + if (cmd_code == HostCmd_CMD_FW_DUMP_EVENT || + cmd_code == HostCmd_CMD_SOFT_RESET) { if (pcmd_node->pioctl_buf) { PRINTM(MMSG, "CMD(0x%x) has no cmd resp: free curr_cmd and do ioctl_complete\n", @@ -1325,8 +1391,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_dnld_sleep_confirm_cmd(mlan_adapter *pmadapter) +static mlan_status wlan_dnld_sleep_confirm_cmd(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; static t_u32 i; @@ -1335,8 +1400,7 @@ #endif opt_sleep_confirm_buffer *sleep_cfm_buf = (opt_sleep_confirm_buffer *)(pmadapter->psleep_cfm->pbuf + - pmadapter->psleep_cfm-> - data_offset); + pmadapter->psleep_cfm->data_offset); mlan_buffer *pmbuf = MNULL; mlan_private *pmpriv = MNULL; @@ -1355,9 +1419,8 @@ #endif pmadapter->seq_num++; sleep_cfm_buf->ps_cfm_sleep.seq_num = - wlan_cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO - (pmadapter->seq_num, pmpriv->bss_num, - pmpriv->bss_type)); + wlan_cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO( + pmadapter->seq_num, pmpriv->bss_num, pmpriv->bss_type)); DBG_HEXDUMP(MCMD_D, "SLEEP_CFM", &sleep_cfm_buf->ps_cfm_sleep, sizeof(OPT_Confirm_Sleep)); @@ -1378,7 +1441,7 @@ pmbuf->data_len = pmadapter->psleep_cfm->data_len; memcpy_ext(pmadapter, pmbuf->pbuf + pmbuf->data_offset, pmadapter->psleep_cfm->pbuf + - pmadapter->psleep_cfm->data_offset, + pmadapter->psleep_cfm->data_offset, pmadapter->psleep_cfm->data_len, pmbuf->data_len); } #endif /* USB */ @@ -1418,10 +1481,10 @@ (pmadapter->is_hs_configured && !pmadapter->sleep_period.period)) { pmadapter->pm_wakeup_card_req = MTRUE; - wlan_host_sleep_activated_event(wlan_get_priv - (pmadapter, - MLAN_BSS_ROLE_STA), - MTRUE); + wlan_host_sleep_activated_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_STA), + MTRUE); } } #endif /* STA_SUPPORT */ @@ -1446,8 +1509,7 @@ * * @return bitmap rate index */ -static t_u16 -wlan_get_bitmap_index(MrvlRateScope_t *rate_scope) +static t_u16 wlan_get_bitmap_index(MrvlRateScope_t *rate_scope) { t_u16 index = 0; @@ -1472,8 +1534,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_recv_event(pmlan_private priv, mlan_event_id event_id, t_void *pmevent) +mlan_status wlan_recv_event(pmlan_private priv, mlan_event_id event_id, + t_void *pmevent) { pmlan_callbacks pcb = MNULL; @@ -1512,8 +1574,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_alloc_cmd_buffer(mlan_adapter *pmadapter) +mlan_status wlan_alloc_cmd_buffer(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -1542,10 +1603,9 @@ if (!IS_USB(pmadapter->card_type)) { /* Allocate and initialize command buffers */ for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { - pcmd_array[i].pmbuf = - wlan_alloc_mlan_buffer(pmadapter, - MRVDRV_SIZE_OF_CMD_BUFFER, - 0, MOAL_MALLOC_BUFFER); + pcmd_array[i].pmbuf = wlan_alloc_mlan_buffer( + pmadapter, MRVDRV_SIZE_OF_CMD_BUFFER, 0, + MOAL_MALLOC_BUFFER); if (!pcmd_array[i].pmbuf) { PRINTM(MERROR, "ALLOC_CMD_BUF: Failed to allocate command buffer\n"); @@ -1572,8 +1632,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_free_cmd_buffer(mlan_adapter *pmadapter) +mlan_status wlan_free_cmd_buffer(mlan_adapter *pmadapter) { mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; cmd_ctrl_node *pcmd_array; @@ -1608,13 +1667,11 @@ if (pcmd_array[i].respbuf) { #ifdef USB if (IS_USB(pmadapter->card_type)) - pmadapter->callbacks. - moal_recv_complete(pmadapter-> - pmoal_handle, - pcmd_array[i]. - respbuf, - pmadapter->rx_cmd_ep, - MLAN_STATUS_SUCCESS); + pmadapter->callbacks.moal_recv_complete( + pmadapter->pmoal_handle, + pcmd_array[i].respbuf, + pmadapter->rx_cmd_ep, + MLAN_STATUS_SUCCESS); #endif #if defined(SDIO) || defined(PCIE) if (!IS_USB(pmadapter->card_type)) @@ -1644,8 +1701,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_event(pmlan_adapter pmadapter) +mlan_status wlan_process_event(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); @@ -1663,23 +1719,28 @@ (t_u16)eventcause; if ((eventcause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) { - if (wlan_11h_dfs_event_preprocessing(pmadapter) == - MLAN_STATUS_SUCCESS) { - memcpy_ext(pmadapter, (t_u8 *)&eventcause, - pmbuf->pbuf + pmbuf->data_offset, - sizeof(eventcause), sizeof(eventcause)); - } else { - priv = wlan_get_priv_by_id(pmadapter, - EVENT_GET_BSS_NUM - (eventcause), - EVENT_GET_BSS_TYPE - (eventcause)); - if (priv) - PRINTM_NETINTF(MEVENT, priv); - PRINTM(MERROR, - "Error processing DFS Event: 0x%x\n", - eventcause); - goto done; + priv = wlan_get_priv_by_id(pmadapter, + EVENT_GET_BSS_NUM(eventcause), + EVENT_GET_BSS_TYPE(eventcause)); + if (priv && priv->bss_type != MLAN_BSS_TYPE_DFS) { + if (wlan_11h_dfs_event_preprocessing(pmadapter) == + MLAN_STATUS_SUCCESS) { + memcpy_ext(pmadapter, (t_u8 *)&eventcause, + pmbuf->pbuf + pmbuf->data_offset, + sizeof(eventcause), + sizeof(eventcause)); + } else { + priv = wlan_get_priv_by_id( + pmadapter, + EVENT_GET_BSS_NUM(eventcause), + EVENT_GET_BSS_TYPE(eventcause)); + if (priv) + PRINTM_NETINTF(MEVENT, priv); + PRINTM(MERROR, + "Error processing DFS Event: 0x%x\n", + eventcause); + goto done; + } } } /* Get BSS number and corresponding priv */ @@ -1703,8 +1764,8 @@ sizeof(eventcause)); } - if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE - && eventcause != EVENT_FW_DUMP_INFO) { + if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE && + eventcause != EVENT_FW_DUMP_INFO) { PRINTM_GET_SYS_TIME(MEVENT, &in_ts_sec, &in_ts_usec); PRINTM_NETINTF(MEVENT, priv); PRINTM(MEVENT, "%lu.%06lu : Event: 0x%x\n", in_ts_sec, @@ -1730,8 +1791,7 @@ * * @return N/A */ -t_void -wlan_request_cmd_lock(mlan_adapter *pmadapter) +t_void wlan_request_cmd_lock(mlan_adapter *pmadapter) { mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -1751,8 +1811,7 @@ * * @return N/A */ -t_void -wlan_release_cmd_lock(mlan_adapter *pmadapter) +t_void wlan_release_cmd_lock(mlan_adapter *pmadapter) { mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -1778,10 +1837,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_prepare_cmd(mlan_private *pmpriv, t_u16 cmd_no, - t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, t_void *pdata_buf) +mlan_status wlan_prepare_cmd(mlan_private *pmpriv, t_u16 cmd_no, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pioctl_buf, t_void *pdata_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = MNULL; @@ -1811,7 +1869,7 @@ #ifdef PCIE && (cmd_no != HostCmd_CMD_PCIE_HOST_BUF_DETAILS) #endif - ) { + ) { PRINTM(MERROR, "PREP_CMD: FW is in reset state\n"); if (pioctl_req) pioctl_req->status_code = @@ -1878,14 +1936,16 @@ wlan_request_cmd_lock(pmadapter); /* Send command */ #ifdef STA_SUPPORT - if (cmd_no == HostCmd_CMD_802_11_SCAN - || cmd_no == HostCmd_CMD_802_11_SCAN_EXT) { + if (cmd_no == HostCmd_CMD_802_11_SCAN || + cmd_no == HostCmd_CMD_802_11_SCAN_EXT) { if (cmd_no == HostCmd_CMD_802_11_SCAN_EXT && pmadapter->ext_scan && pmadapter->ext_scan_enh && - pmadapter->ext_scan_type == EXT_SCAN_ENHANCE) { + pmadapter->ext_scan_type == EXT_SCAN_ENHANCE && + wlan_is_cancel_scan_cmd(cmd_ptr)) { wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, - MTRUE); + MFALSE); } else + wlan_queue_scan_cmd(pmpriv, pcmd_node); } else { #endif @@ -1914,8 +1974,8 @@ * * @return N/A */ -t_void -wlan_insert_cmd_to_free_q(mlan_adapter *pmadapter, cmd_ctrl_node *pcmd_node) +t_void wlan_insert_cmd_to_free_q(mlan_adapter *pmadapter, + cmd_ctrl_node *pcmd_node) { mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; mlan_ioctl_req *pioctl_req = MNULL; @@ -1954,9 +2014,8 @@ * * @return N/A */ -t_void -wlan_insert_cmd_to_pending_q(mlan_adapter *pmadapter, - cmd_ctrl_node *pcmd_node, t_u32 add_tail) +t_void wlan_insert_cmd_to_pending_q(mlan_adapter *pmadapter, + cmd_ctrl_node *pcmd_node, t_u32 add_tail) { HostCmd_DS_COMMAND *pcmd = MNULL; t_u16 command; @@ -2011,8 +2070,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_exec_next_cmd(mlan_adapter *pmadapter) +mlan_status wlan_exec_next_cmd(mlan_adapter *pmadapter) { mlan_private *priv = MNULL; cmd_ctrl_node *pcmd_node = MNULL; @@ -2087,8 +2145,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_cmdresp(mlan_adapter *pmadapter) +mlan_status wlan_process_cmdresp(mlan_adapter *pmadapter) { HostCmd_DS_COMMAND *resp = MNULL; mlan_private *pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); @@ -2109,7 +2166,7 @@ if (pmadapter->curr_cmd) if (pmadapter->curr_cmd->pioctl_buf != MNULL) { pioctl_buf = (mlan_ioctl_req *) - pmadapter->curr_cmd->pioctl_buf; + pmadapter->curr_cmd->pioctl_buf; } if (!pmadapter->curr_cmd || !pmadapter->curr_cmd->respbuf) { @@ -2124,12 +2181,11 @@ DBG_HEXDUMP(MCMD_D, "CMD_RESP", pmadapter->curr_cmd->respbuf->pbuf + - pmadapter->curr_cmd->respbuf->data_offset, + pmadapter->curr_cmd->respbuf->data_offset, pmadapter->curr_cmd->respbuf->data_len); resp = (HostCmd_DS_COMMAND *)(pmadapter->curr_cmd->respbuf->pbuf + - pmadapter->curr_cmd->respbuf-> - data_offset); + pmadapter->curr_cmd->respbuf->data_offset); orig_cmdresp_no = wlan_le16_to_cpu(resp->command); cmdresp_no = (orig_cmdresp_no & HostCmd_CMD_ID_MASK); if (pmadapter->curr_cmd->cmd_no != cmdresp_no) { @@ -2215,9 +2271,8 @@ if (pmadapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { pmadapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; - if ((cmdresp_result == HostCmd_RESULT_OK) - && (cmdresp_no == HostCmd_CMD_802_11_HS_CFG_ENH) - ) + if ((cmdresp_result == HostCmd_RESULT_OK) && + (cmdresp_no == HostCmd_CMD_802_11_HS_CFG_ENH)) ret = wlan_ret_802_11_hs_cfg(pmpriv, resp, pioctl_buf); } else { /* handle response */ @@ -2229,16 +2284,16 @@ if (pmadapter->hw_status == WlanHardwareStatusInitializing || pmadapter->hw_status == WlanHardwareStatusGetHwSpec) { if (ret == MLAN_STATUS_FAILURE) { -#ifdef STA_SUPPORT +#if 0 + //ignore command error for WARM RESET if (pmadapter->pwarm_reset_ioctl_req) { /* warm reset failure */ pmadapter->pwarm_reset_ioctl_req->status_code = MLAN_ERROR_CMD_RESP_FAIL; - pcb->moal_ioctl_complete(pmadapter-> - pmoal_handle, - pmadapter-> - pwarm_reset_ioctl_req, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + pmadapter->pwarm_reset_ioctl_req, + MLAN_STATUS_FAILURE); pmadapter->pwarm_reset_ioctl_req = MNULL; goto done; } @@ -2255,7 +2310,7 @@ if (IS_PCIE(pmadapter->card_type) && cmdresp_no == HostCmd_CMD_FUNC_SHUTDOWN && pmadapter->pwarm_reset_ioctl_req) { -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) #endif wlan_pcie_init_fw(pmadapter); @@ -2285,19 +2340,28 @@ i = pmpriv->bss_index + 1; while (i < pmadapter->priv_num && (!(pmpriv_next = pmadapter->priv[i]) || - pmpriv_next->bss_virtual)) + pmpriv_next->bss_virtual || + pmpriv_next->bss_type == MLAN_BSS_TYPE_DFS)) i++; if (!pmpriv_next || i >= pmadapter->priv_num) { #ifdef STA_SUPPORT if (pmadapter->pwarm_reset_ioctl_req) { + for (i = 0; i < pmadapter->priv_num; i++) { + if (pmadapter->priv[i]->curr_addr[0] == + 0xff) + memmove(pmadapter, + pmadapter->priv[i] + ->curr_addr, + pmadapter->permanent_addr, + MLAN_MAC_ADDR_LENGTH); + } /* warm reset complete */ PRINTM(MMSG, "wlan: warm reset complete\n"); pmadapter->hw_status = WlanHardwareStatusReady; - pcb->moal_ioctl_complete(pmadapter-> - pmoal_handle, - pmadapter-> - pwarm_reset_ioctl_req, - MLAN_STATUS_SUCCESS); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + pmadapter->pwarm_reset_ioctl_req, + MLAN_STATUS_SUCCESS); pmadapter->pwarm_reset_ioctl_req = MNULL; goto done; } @@ -2323,8 +2387,7 @@ * @param function_context A pointer to function_context * @return N/A */ -t_void -wlan_cmd_timeout_func(t_void *function_context) +t_void wlan_cmd_timeout_func(t_void *function_context) { mlan_adapter *pmadapter = (mlan_adapter *)function_context; cmd_ctrl_node *pcmd_node = MNULL; @@ -2370,8 +2433,8 @@ if (!IS_USB(pmadapter->card_type) && pcmd_node->cmdbuf) { t_u8 *pcmd_buf; pcmd_buf = pcmd_node->cmdbuf->pbuf + - pcmd_node->cmdbuf->data_offset + - pmadapter->ops.intf_header_len; + pcmd_node->cmdbuf->data_offset + + pmadapter->ops.intf_header_len; for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); PRINTM(MERROR, "\n"); @@ -2415,8 +2478,7 @@ * * @return N/A */ -t_void -wlan_flush_scan_queue(pmlan_adapter pmadapter) +t_void wlan_flush_scan_queue(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; mlan_ioctl_req *pioctl_buf = MNULL; @@ -2426,10 +2488,9 @@ ENTER(); wlan_request_cmd_lock(pmadapter); - while ((pcmd_node = - (cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, - &pmadapter->scan_pending_q, - MNULL, MNULL))) { + while ((pcmd_node = (cmd_ctrl_node *)util_peek_list( + pmadapter->pmoal_handle, &pmadapter->scan_pending_q, + MNULL, MNULL))) { util_unlink_list(pmadapter->pmoal_handle, &pmadapter->scan_pending_q, (pmlan_linked_list)pcmd_node, MNULL, MNULL); @@ -2438,8 +2499,8 @@ cmd_no = wlan_le16_to_cpu(pcmd->command); PRINTM(MCMND, "flush scan queue: cmd 0x%02x\n", cmd_no); if (pcmd_node->pioctl_buf && - cmd_no != HostCmd_CMD_802_11_SCAN - && cmd_no != HostCmd_CMD_802_11_SCAN_EXT) { + cmd_no != HostCmd_CMD_802_11_SCAN && + cmd_no != HostCmd_CMD_802_11_SCAN_EXT) { pioctl_buf = (mlan_ioctl_req *)pcmd_node->pioctl_buf; pcmd_node->pioctl_buf = MNULL; pioctl_buf->status_code = MLAN_ERROR_CMD_CANCEL; @@ -2464,9 +2525,8 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING */ -mlan_status -wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_callbacks pcb = &pmadapter->callbacks; cmd_ctrl_node *pcmd_node = MNULL; @@ -2517,15 +2577,15 @@ wlan_prepare_cmd(priv, HostCmd_CMD_802_11_SCAN_EXT, HostCmd_ACT_GEN_SET, 0, pioctl_req, MNULL)) { - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); status = MLAN_STATUS_PENDING; } } - } else - /* Cancel all pending scan command */ - wlan_flush_scan_queue(pmadapter); + } + /* Cancel all pending scan command */ + wlan_flush_scan_queue(pmadapter); LEAVE(); return status; } @@ -2539,8 +2599,7 @@ * * @return N/A */ -t_void -wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter, t_u8 flag) +t_void wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter, t_u8 flag) { cmd_ctrl_node *pcmd_node = MNULL; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2580,10 +2639,9 @@ } /* Cancel all pending command */ - while ((pcmd_node = - (cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, - &pmadapter->cmd_pending_q, - MNULL, MNULL))) { + while ((pcmd_node = (cmd_ctrl_node *)util_peek_list( + pmadapter->pmoal_handle, &pmadapter->cmd_pending_q, + MNULL, MNULL))) { util_unlink_list(pmadapter->pmoal_handle, &pmadapter->cmd_pending_q, (pmlan_linked_list)pcmd_node, MNULL, MNULL); @@ -2600,6 +2658,8 @@ wlan_release_cmd_lock(pmadapter); /* Cancel all pending scan command */ wlan_flush_scan_queue(pmadapter); + /* Cancel all pending command in scan_cmd_pending_q command */ + wlan_flush_ext_cmd_pending_queue(pmadapter); LEAVE(); } @@ -2611,8 +2671,7 @@ * * @return N/A */ -t_void -wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) +t_void wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) { pmlan_callbacks pcb = &pmadapter->callbacks; cmd_ctrl_node *pcmd_node = MNULL; @@ -2657,9 +2716,8 @@ MLAN_STATUS_FAILURE); } } - while ((pcmd_node = - wlan_get_bss_pending_ioctl_cmd(pmadapter, - bss_index)) != MNULL) { + while ((pcmd_node = wlan_get_bss_pending_ioctl_cmd( + pmadapter, bss_index)) != MNULL) { util_unlink_list(pmadapter->pmoal_handle, &pmadapter->cmd_pending_q, (pmlan_linked_list)pcmd_node, MNULL, MNULL); @@ -2681,19 +2739,19 @@ pmadapter->ext_scan_type == EXT_SCAN_ENHANCE) { if (priv) { if (MLAN_STATUS_FAILURE == - wlan_prepare_cmd(priv, - HostCmd_CMD_802_11_SCAN_EXT, - HostCmd_ACT_GEN_SET, 0, - MNULL, MNULL)) + wlan_prepare_cmd( + priv, HostCmd_CMD_802_11_SCAN_EXT, + HostCmd_ACT_GEN_SET, 0, MNULL, + MNULL)) PRINTM(MERROR, "failed to prepare command"); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } - } else - /* Cancel all pending scan command */ - wlan_flush_scan_queue(pmadapter); + } + /* Cancel all pending scan command */ + wlan_flush_scan_queue(pmadapter); } #endif LEAVE(); @@ -2708,8 +2766,8 @@ * * @return N/A */ -t_void -wlan_cancel_pending_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +t_void wlan_cancel_pending_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_callbacks pcb = &pmadapter->callbacks; cmd_ctrl_node *pcmd_node = MNULL; @@ -2758,19 +2816,19 @@ pmadapter->ext_scan_type == EXT_SCAN_ENHANCE) { if (priv) { if (MLAN_STATUS_FAILURE == - wlan_prepare_cmd(priv, - HostCmd_CMD_802_11_SCAN_EXT, - HostCmd_ACT_GEN_SET, 0, - MNULL, MNULL)) + wlan_prepare_cmd( + priv, HostCmd_CMD_802_11_SCAN_EXT, + HostCmd_ACT_GEN_SET, 0, MNULL, + MNULL)) PRINTM(MERROR, "Failed to prepare command"); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } - } else - /* Cancel all pending scan command */ - wlan_flush_scan_queue(pmadapter); + } + /* Cancel all pending scan command */ + wlan_flush_scan_queue(pmadapter); } #endif if (find) { @@ -2792,9 +2850,8 @@ * * @return N/A */ -t_void -wlan_fill_hal_wifi_rate(pmlan_private pmpriv, - mlan_wifi_rate * pmlan_rate, wifi_rate * prate) +t_void wlan_fill_hal_wifi_rate(pmlan_private pmpriv, mlan_wifi_rate *pmlan_rate, + wifi_rate *prate) { t_u8 index = 0; t_u8 rate_info = 0; @@ -2827,7 +2884,8 @@ else prate->bitrate = wlan_index_to_data_rate(pmpriv->adapter, index, - rate_info, 0) * 5; + rate_info, 0) * + 5; PRINTM(MCMND, "bitrate(in 100kbps)=%d\n", prate->bitrate); } @@ -2843,9 +2901,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_ver_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_ver_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_VERSION_EXT *ver_ext = &resp->params.verext; mlan_ds_get_info *info; @@ -2870,18 +2927,16 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_rx_mgmt_ind(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_rx_mgmt_ind(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; ENTER(); if (pioctl_buf) { misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - misc->param.mgmt_subtype_mask = - wlan_le32_to_cpu(resp->params.rx_mgmt_ind. - mgmt_subtype_mask); + misc->param.mgmt_subtype_mask = wlan_le32_to_cpu( + resp->params.rx_mgmt_ind.mgmt_subtype_mask); } LEAVE(); @@ -2896,8 +2951,7 @@ * * @return N/A */ -t_void -wlan_check_ps_cond(mlan_adapter *pmadapter) +t_void wlan_check_ps_cond(mlan_adapter *pmadapter) { ENTER(); @@ -2924,8 +2978,7 @@ * * @return N/A */ -t_void -wlan_host_sleep_activated_event(pmlan_private priv, t_u8 activated) +t_void wlan_host_sleep_activated_event(pmlan_private priv, t_u8 activated) { ENTER(); @@ -2960,8 +3013,7 @@ * * @return N/A */ -t_void -wlan_host_sleep_wakeup_event(pmlan_private priv) +t_void wlan_host_sleep_wakeup_event(pmlan_private priv) { ENTER(); @@ -2982,9 +3034,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_802_11_hs_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_hs_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_802_11_HS_CFG_ENH *phs_cfg = &resp->params.opt_hs_cfg; @@ -3037,8 +3089,7 @@ * @param pmadapter A pointer to the adapter structure * @return N/A */ -t_void -wlan_process_hs_config(pmlan_adapter pmadapter) +t_void wlan_process_hs_config(pmlan_adapter pmadapter) { ENTER(); PRINTM(MINFO, "Recevie interrupt/data in HS mode\n"); @@ -3056,9 +3107,8 @@ * @param upld_len Command response buffer length * @return N/A */ -void -wlan_process_sleep_confirm_resp(pmlan_adapter pmadapter, t_u8 *pbuf, - t_u32 upld_len) +void wlan_process_sleep_confirm_resp(pmlan_adapter pmadapter, t_u8 *pbuf, + t_u32 upld_len) { HostCmd_DS_COMMAND *cmd; pmlan_private pmpriv; @@ -3075,9 +3125,9 @@ cmd->command = wlan_le16_to_cpu(cmd->command); cmd->seq_num = wlan_le16_to_cpu(cmd->seq_num); - pmpriv = wlan_get_priv_by_id(pmadapter, - HostCmd_GET_BSS_NO(cmd->seq_num), - HostCmd_GET_BSS_TYPE(cmd->seq_num)); + pmpriv = + wlan_get_priv_by_id(pmadapter, HostCmd_GET_BSS_NO(cmd->seq_num), + HostCmd_GET_BSS_TYPE(cmd->seq_num)); /* Update sequence number */ cmd->seq_num = HostCmd_GET_SEQ_NO(cmd->seq_num); /* Clear RET_BIT from HostCmd */ @@ -3103,9 +3153,8 @@ pmadapter->pm_wakeup_card_req = MTRUE; if (pmadapter->is_hs_configured) { - wlan_host_sleep_activated_event(wlan_get_priv - (pmadapter, MLAN_BSS_ROLE_ANY), - MTRUE); + wlan_host_sleep_activated_event( + wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), MTRUE); } pmadapter->ps_state = PS_STATE_SLEEP; LEAVE(); @@ -3121,10 +3170,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_enh_power_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 ps_bitmap, t_void *pdata_buf) +mlan_status wlan_cmd_enh_power_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_u16 ps_bitmap, t_void *pdata_buf) { HostCmd_DS_802_11_PS_MODE_ENH *psmode_enh = &cmd->params.psmode_enh; t_u8 *tlv = MNULL; @@ -3157,9 +3205,9 @@ ps_param *ps_mode = &ps_tlv->param; ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_PS_PARAM); - ps_tlv->header.len = - wlan_cpu_to_le16(sizeof(MrvlIEtypes_ps_param_t) - - sizeof(MrvlIEtypesHeader_t)); + ps_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_ps_param_t) - + sizeof(MrvlIEtypesHeader_t)); cmd_size += sizeof(MrvlIEtypes_ps_param_t); tlv += sizeof(MrvlIEtypes_ps_param_t); ps_mode->null_pkt_interval = @@ -3168,9 +3216,8 @@ wlan_cpu_to_le16(pmadapter->multiple_dtim); ps_mode->bcn_miss_timeout = wlan_cpu_to_le16(pmadapter->bcn_miss_time_out); - ps_mode->local_listen_interval = - wlan_cpu_to_le16(pmadapter-> - local_listen_interval); + ps_mode->local_listen_interval = wlan_cpu_to_le16( + pmadapter->local_listen_interval); ps_mode->delay_to_ps = wlan_cpu_to_le16(pmadapter->delay_to_ps); ps_mode->mode = @@ -3178,15 +3225,14 @@ } if (ps_bitmap & BITMAP_BCN_TMO) { MrvlIEtypes_bcn_timeout_t *bcn_tmo_tlv = - (MrvlIEtypes_bcn_timeout_t *) tlv; + (MrvlIEtypes_bcn_timeout_t *)tlv; mlan_ds_bcn_timeout *bcn_tmo = - (mlan_ds_bcn_timeout *) pdata_buf; + (mlan_ds_bcn_timeout *)pdata_buf; bcn_tmo_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_BCN_TIMEOUT); - bcn_tmo_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_bcn_timeout_t) - - sizeof(MrvlIEtypesHeader_t)); + bcn_tmo_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_bcn_timeout_t) - + sizeof(MrvlIEtypesHeader_t)); bcn_tmo_tlv->bcn_miss_tmo_window = wlan_cpu_to_le16(bcn_tmo->bcn_miss_tmo_window); bcn_tmo_tlv->bcn_miss_tmo_period = @@ -3198,7 +3244,9 @@ cmd_size += sizeof(MrvlIEtypes_bcn_timeout_t); tlv += sizeof(MrvlIEtypes_bcn_timeout_t); - psmode_enh->params.auto_ps.ps_bitmap = wlan_cpu_to_le16((ps_bitmap & (~BITMAP_BCN_TMO)) | BITMAP_STA_PS); + psmode_enh->params.auto_ps.ps_bitmap = wlan_cpu_to_le16( + (ps_bitmap & (~BITMAP_BCN_TMO)) | + BITMAP_STA_PS); } if (ps_bitmap & BITMAP_AUTO_DS) { MrvlIEtypes_auto_ds_param_t *auto_ps_tlv = @@ -3207,16 +3255,14 @@ t_u16 idletime = 0; auto_ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_AUTO_DS_PARAM); - auto_ps_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_auto_ds_param_t) - - sizeof(MrvlIEtypesHeader_t)); + auto_ps_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_auto_ds_param_t) - + sizeof(MrvlIEtypesHeader_t)); cmd_size += sizeof(MrvlIEtypes_auto_ds_param_t); tlv += sizeof(MrvlIEtypes_auto_ds_param_t); if (pdata_buf) idletime = - ((mlan_ds_auto_ds *)pdata_buf)-> - idletime; + ((mlan_ds_auto_ds *)pdata_buf)->idletime; auto_ds->deep_sleep_timeout = wlan_cpu_to_le16(idletime); } @@ -3228,48 +3274,34 @@ MrvlIEtypes_inact_sleep_param_t *inact_tlv = MNULL; if (ps_mgmt->flags & PS_FLAG_SLEEP_PARAM) { sleep_tlv = (MrvlIEtypes_sleep_param_t *)tlv; - sleep_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_AP_SLEEP_PARAM); - sleep_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_sleep_param_t) - - - sizeof - (MrvlIEtypesHeader_t)); - sleep_tlv->ctrl_bitmap = - wlan_cpu_to_le32(ps_mgmt->sleep_param. - ctrl_bitmap); - sleep_tlv->min_sleep = - wlan_cpu_to_le32(ps_mgmt->sleep_param. - min_sleep); - sleep_tlv->max_sleep = - wlan_cpu_to_le32(ps_mgmt->sleep_param. - max_sleep); + sleep_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_AP_SLEEP_PARAM); + sleep_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_sleep_param_t) - + sizeof(MrvlIEtypesHeader_t)); + sleep_tlv->ctrl_bitmap = wlan_cpu_to_le32( + ps_mgmt->sleep_param.ctrl_bitmap); + sleep_tlv->min_sleep = wlan_cpu_to_le32( + ps_mgmt->sleep_param.min_sleep); + sleep_tlv->max_sleep = wlan_cpu_to_le32( + ps_mgmt->sleep_param.max_sleep); cmd_size += sizeof(MrvlIEtypes_sleep_param_t); tlv += sizeof(MrvlIEtypes_sleep_param_t); } if (ps_mgmt->flags & PS_FLAG_INACT_SLEEP_PARAM) { inact_tlv = (MrvlIEtypes_inact_sleep_param_t *)tlv; - inact_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_AP_INACT_SLEEP_PARAM); - inact_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_inact_sleep_param_t) - - - sizeof - (MrvlIEtypesHeader_t)); - inact_tlv->inactivity_to = - wlan_cpu_to_le32(ps_mgmt->inact_param. - inactivity_to); - inact_tlv->min_awake = - wlan_cpu_to_le32(ps_mgmt->inact_param. - min_awake); - inact_tlv->max_awake = - wlan_cpu_to_le32(ps_mgmt->inact_param. - max_awake); + inact_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_AP_INACT_SLEEP_PARAM); + inact_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_inact_sleep_param_t) - + sizeof(MrvlIEtypesHeader_t)); + inact_tlv->inactivity_to = wlan_cpu_to_le32( + ps_mgmt->inact_param.inactivity_to); + inact_tlv->min_awake = wlan_cpu_to_le32( + ps_mgmt->inact_param.min_awake); + inact_tlv->max_awake = wlan_cpu_to_le32( + ps_mgmt->inact_param.max_awake); cmd_size += sizeof(MrvlIEtypes_inact_sleep_param_t); tlv += sizeof(MrvlIEtypes_inact_sleep_param_t); @@ -3292,9 +3324,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_enh_power_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_enh_power_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; MrvlIEtypesHeader_t *mrvl_tlv = MNULL; @@ -3318,14 +3350,14 @@ TLV_TYPE_AUTO_DS_PARAM) { mrvl_tlv = (MrvlIEtypesHeader_t - *)((t_u8 *)mrvl_tlv + - wlan_le16_to_cpu(mrvl_tlv->len) + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)mrvl_tlv + + wlan_le16_to_cpu( + mrvl_tlv->len) + + sizeof(MrvlIEtypesHeader_t)); } auto_ds_tlv = (MrvlIEtypes_auto_ds_param_t *)mrvl_tlv; - pmpriv->adapter->idle_time = - wlan_le16_to_cpu(auto_ds_tlv->param. - deep_sleep_timeout); + pmpriv->adapter->idle_time = wlan_le16_to_cpu( + auto_ds_tlv->param.deep_sleep_timeout); } if (ps_mode->params.auto_ps.ps_bitmap & BITMAP_STA_PS) { PRINTM(MCMND, "Enabled STA power save\n"); @@ -3404,7 +3436,7 @@ pm_cfg->param.ps_mgmt.ps_mode = PS_MODE_DISABLE; tlv_buf_left = resp->size - - (S_DS_GEN + AUTO_PS_FIX_SIZE); + (S_DS_GEN + AUTO_PS_FIX_SIZE); tlv = (MrvlIEtypesHeader_t *)((t_u8 *)ps_mode + AUTO_PS_FIX_SIZE); while (tlv_buf_left >= @@ -3415,53 +3447,49 @@ case TLV_TYPE_AP_SLEEP_PARAM: sleep_tlv = (MrvlIEtypes_sleep_param_t - *)tlv; + *)tlv; pm_cfg->param.ps_mgmt.flags |= PS_FLAG_SLEEP_PARAM; - pm_cfg->param.ps_mgmt. - sleep_param. - ctrl_bitmap = - wlan_le32_to_cpu - (sleep_tlv-> - ctrl_bitmap); - pm_cfg->param.ps_mgmt. - sleep_param.min_sleep = - wlan_le32_to_cpu - (sleep_tlv->min_sleep); - pm_cfg->param.ps_mgmt. - sleep_param.max_sleep = - wlan_le32_to_cpu - (sleep_tlv->max_sleep); + pm_cfg->param.ps_mgmt + .sleep_param + .ctrl_bitmap = wlan_le32_to_cpu( + sleep_tlv->ctrl_bitmap); + pm_cfg->param.ps_mgmt + .sleep_param + .min_sleep = wlan_le32_to_cpu( + sleep_tlv->min_sleep); + pm_cfg->param.ps_mgmt + .sleep_param + .max_sleep = wlan_le32_to_cpu( + sleep_tlv->max_sleep); break; case TLV_TYPE_AP_INACT_SLEEP_PARAM: inact_tlv = (MrvlIEtypes_inact_sleep_param_t - *)tlv; + *)tlv; pm_cfg->param.ps_mgmt.flags |= PS_FLAG_INACT_SLEEP_PARAM; - pm_cfg->param.ps_mgmt. - inact_param. - inactivity_to = - wlan_le32_to_cpu - (inact_tlv-> - inactivity_to); - pm_cfg->param.ps_mgmt. - inact_param.min_awake = - wlan_le32_to_cpu - (inact_tlv->min_awake); - pm_cfg->param.ps_mgmt. - inact_param.max_awake = - wlan_le32_to_cpu - (inact_tlv->max_awake); + pm_cfg->param.ps_mgmt + .inact_param + .inactivity_to = wlan_le32_to_cpu( + inact_tlv->inactivity_to); + pm_cfg->param.ps_mgmt + .inact_param + .min_awake = wlan_le32_to_cpu( + inact_tlv->min_awake); + pm_cfg->param.ps_mgmt + .inact_param + .max_awake = wlan_le32_to_cpu( + inact_tlv->max_awake); break; } tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); tlv = (MrvlIEtypesHeader_t - *)((t_u8 *)tlv + - tlv_len + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } } #endif @@ -3481,10 +3509,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_802_11_tx_rate_query(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_tx_rate_query(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_ds_rate *rate = MNULL; @@ -3493,9 +3520,8 @@ pmpriv->tx_rate = resp->params.tx_rate.tx_rate; pmpriv->tx_rate_info = resp->params.tx_rate.tx_rate_info; if (pmpriv->adapter->pcard_info->v14_fw_api) { - pmpriv->tx_rate_info = - wlan_convert_v14_tx_rate_info(pmpriv, - pmpriv->tx_rate_info); + pmpriv->tx_rate_info = wlan_convert_v14_tx_rate_info( + pmpriv, pmpriv->tx_rate_info); PRINTM(MINFO, "%s: v14_fw_api=%d tx_rate=%d tx_rate_info=0x%x->0x%x\n", __func__, pmpriv->adapter->pcard_info->v14_fw_api, @@ -3520,10 +3546,9 @@ if (rate->sub_command == MLAN_OID_RATE_CFG) { if (rate->param.rate_cfg.rate_type == MLAN_RATE_INDEX) { if ((pmpriv->tx_rate_info & 0x3) == - MLAN_RATE_FORMAT_VHT - || ((pmpriv->tx_rate_info & 0x3) == - MLAN_RATE_FORMAT_HE) - ) + MLAN_RATE_FORMAT_VHT || + ((pmpriv->tx_rate_info & 0x3) == + MLAN_RATE_FORMAT_HE)) /* VHT rate */ rate->param.rate_cfg.rate = @@ -3543,24 +3568,22 @@ rate->param.rate_cfg.rate = (pmpriv->tx_rate > MLAN_RATE_INDEX_OFDM0) ? - pmpriv->tx_rate - 1 : - pmpriv->tx_rate; + pmpriv->tx_rate - 1 : + pmpriv->tx_rate; } else { /* rate_type = MLAN_RATE_VALUE */ rate->param.rate_cfg.rate = - wlan_index_to_data_rate(pmadapter, - pmpriv->tx_rate, - pmpriv-> - tx_rate_info, - pmpriv-> - ext_tx_rate_info); + wlan_index_to_data_rate( + pmadapter, pmpriv->tx_rate, + pmpriv->tx_rate_info, + pmpriv->ext_tx_rate_info); } } else if (rate->sub_command == MLAN_OID_GET_DATA_RATE) { /* Tx rate info */ - if ((pmpriv->tx_rate_info & 0x3) == MLAN_RATE_FORMAT_VHT - || + if ((pmpriv->tx_rate_info & 0x3) == + MLAN_RATE_FORMAT_VHT || (pmpriv->tx_rate_info & 0x3) == - MLAN_RATE_FORMAT_HE) { + MLAN_RATE_FORMAT_HE) { /* AX/VHT rate */ rate->param.data_rate.tx_rate_format = pmpriv->tx_rate_info & 0x3; @@ -3570,9 +3593,9 @@ MLAN_RATE_FORMAT_HE) rate->param.data_rate.tx_ht_gi = (pmpriv->tx_rate_info & 0x10) >> - 4 | + 4 | (pmpriv->tx_rate_info & 0x80) >> - 6; + 6; else rate->param.data_rate.tx_ht_gi = (pmpriv->tx_rate_info & 0x10) >> @@ -3582,14 +3605,15 @@ rate->param.data_rate.tx_mcs_index = (pmpriv->tx_rate) & 0xF; if ((pmpriv->tx_rate_info & 0x3) == - MLAN_RATE_FORMAT_VHT - || (pmpriv->tx_rate_info & 0x3) == - MLAN_RATE_FORMAT_HE) + MLAN_RATE_FORMAT_VHT || + (pmpriv->tx_rate_info & 0x3) == + MLAN_RATE_FORMAT_HE) rate->param.data_rate.tx_data_rate = - wlan_index_to_data_rate - (pmadapter, pmpriv->tx_rate, - pmpriv->tx_rate_info, - pmpriv->ext_tx_rate_info); + wlan_index_to_data_rate( + pmadapter, + pmpriv->tx_rate, + pmpriv->tx_rate_info, + pmpriv->ext_tx_rate_info); } else if ((pmpriv->tx_rate_info & 0x3) == MLAN_RATE_FORMAT_HT) { /* HT rate */ @@ -3603,12 +3627,10 @@ rate->param.data_rate.tx_mcs_index = pmpriv->tx_rate; rate->param.data_rate.tx_data_rate = - wlan_index_to_data_rate(pmadapter, - pmpriv->tx_rate, - pmpriv-> - tx_rate_info, - pmpriv-> - ext_tx_rate_info); + wlan_index_to_data_rate( + pmadapter, pmpriv->tx_rate, + pmpriv->tx_rate_info, + pmpriv->ext_tx_rate_info); } else { /* LG rate */ rate->param.data_rate.tx_rate_format = @@ -3620,14 +3642,15 @@ rate->param.data_rate.tx_data_rate = (pmpriv->tx_rate > MLAN_RATE_INDEX_OFDM0) ? - pmpriv->tx_rate - 1 : pmpriv->tx_rate; + pmpriv->tx_rate - 1 : + pmpriv->tx_rate; } /* Rx rate info */ if ((pmpriv->rxpd_rate_info & 0x3) == - MLAN_RATE_FORMAT_VHT - || (pmpriv->rxpd_rate_info & 0x3) == - MLAN_RATE_FORMAT_HE) { + MLAN_RATE_FORMAT_VHT || + (pmpriv->rxpd_rate_info & 0x3) == + MLAN_RATE_FORMAT_HE) { /* VHT rate */ rate->param.data_rate.rx_rate_format = pmpriv->rxpd_rate_info & 0x3; @@ -3638,26 +3661,29 @@ rate->param.data_rate.rx_ht_gi = (pmpriv->rxpd_rate_info & 0x10) >> - 4 | + 4 | (pmpriv->rxpd_rate_info & - 0x80) >> 6; + 0x80) >> + 6; else rate->param.data_rate.rx_ht_gi = (pmpriv->rxpd_rate_info & - 0x10) >> 4; + 0x10) >> + 4; rate->param.data_rate.rx_nss = ((pmpriv->rxpd_rate) >> 4) & 0x3; rate->param.data_rate.rx_mcs_index = (pmpriv->rxpd_rate) & 0xF; if ((pmpriv->rxpd_rate_info & 0x3) == - MLAN_RATE_FORMAT_VHT - || (pmpriv->rxpd_rate_info & 0x3) == - MLAN_RATE_FORMAT_HE) + MLAN_RATE_FORMAT_VHT || + (pmpriv->rxpd_rate_info & 0x3) == + MLAN_RATE_FORMAT_HE) rate->param.data_rate.rx_data_rate = - wlan_index_to_data_rate - (pmadapter, pmpriv->rxpd_rate, - pmpriv->rxpd_rate_info, - pmpriv->rxpd_rx_info); + wlan_index_to_data_rate( + pmadapter, + pmpriv->rxpd_rate, + pmpriv->rxpd_rate_info, + pmpriv->rxpd_rx_info); } else if ((pmpriv->rxpd_rate_info & 0x3) == MLAN_RATE_FORMAT_HT) { /* HT rate */ @@ -3670,12 +3696,9 @@ rate->param.data_rate.rx_mcs_index = pmpriv->rxpd_rate; rate->param.data_rate.rx_data_rate = - wlan_index_to_data_rate(pmadapter, - pmpriv-> - rxpd_rate, - pmpriv-> - rxpd_rate_info, - 0); + wlan_index_to_data_rate( + pmadapter, pmpriv->rxpd_rate, + pmpriv->rxpd_rate_info, 0); } else { /* LG rate */ rate->param.data_rate.rx_rate_format = @@ -3687,8 +3710,8 @@ rate->param.data_rate.rx_data_rate = (pmpriv->rxpd_rate > MLAN_RATE_INDEX_OFDM0) ? - pmpriv->rxpd_rate - 1 : - pmpriv->rxpd_rate; + pmpriv->rxpd_rate - 1 : + pmpriv->rxpd_rate; } } pioctl_buf->data_read_written = @@ -3708,14 +3731,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_robustcoex(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_u16 *pdata_buf) +mlan_status wlan_cmd_robustcoex(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) { HostCmd_DS_802_11_ROBUSTCOEX *rbstcx = &cmd->params.robustcoexparams; mlan_ds_misc_robustcoex_params *robustcoex_params = MNULL; MrvlIEtypes_RobustcoexSourceGPIO_t *tlv = - (MrvlIEtypes_RobustcoexSourceGPIO_t *) (rbstcx->tlv_buf); + (MrvlIEtypes_RobustcoexSourceGPIO_t *)(rbstcx->tlv_buf); ENTER(); @@ -3724,16 +3746,14 @@ rbstcx->action = wlan_cpu_to_le16(cmd_action); switch (cmd_action) { case HostCmd_ACT_GEN_SET: - robustcoex_params = - (mlan_ds_misc_robustcoex_params *) pdata_buf; + robustcoex_params = (mlan_ds_misc_robustcoex_params *)pdata_buf; if (robustcoex_params->method == ROBUSTCOEX_GPIO_CFG) { cmd->size += sizeof(MrvlIEtypes_RobustcoexSourceGPIO_t); tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_ROBUSTCOEX); - tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_RobustcoexSourceGPIO_t) - - sizeof(MrvlIEtypesHeader_t)); + tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_RobustcoexSourceGPIO_t) - + sizeof(MrvlIEtypesHeader_t)); tlv->enable = (t_u8)robustcoex_params->enable; tlv->gpio_num = (t_u8)robustcoex_params->gpio_num; tlv->gpio_polarity = @@ -3760,9 +3780,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_ssu(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) +mlan_status wlan_cmd_ssu(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) { HostCmd_DS_SSU_CFG *ssu_cfg_cmd = &cmd->params.ssu_params; mlan_ds_ssu_params *ssu_params = MNULL; @@ -3777,7 +3796,7 @@ switch (cmd_action) { case HostCmd_ACT_GEN_SET: case HostCmd_ACT_GEN_SET_DEFAULT: - ssu_params = (mlan_ds_ssu_params *) pdata_buf; + ssu_params = (mlan_ds_ssu_params *)pdata_buf; ssu_cfg_cmd->nskip = wlan_cpu_to_le32(ssu_params->nskip); ssu_cfg_cmd->nsel = wlan_cpu_to_le32(ssu_params->nsel); ssu_cfg_cmd->adcdownsample = @@ -3802,12 +3821,8 @@ } ssu_cfg_cmd->buffer_base_addr[0] = wlan_cpu_to_le32((t_u32)pmadapter->ssu_buf->buf_pa); - ssu_cfg_cmd->buffer_base_addr[1] = wlan_cpu_to_le32((t_u32) - ((t_u64) - (pmadapter-> - ssu_buf-> - buf_pa >> - 32))); + ssu_cfg_cmd->buffer_base_addr[1] = wlan_cpu_to_le32( + (t_u32)((t_u64)(pmadapter->ssu_buf->buf_pa >> 32))); ssu_cfg_cmd->buffer_pool_size = wlan_cpu_to_le32(MLAN_SSU_BUF_SIZE); break; @@ -3831,10 +3846,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_dmcs_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_dmcs_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_DMCS_CFG *dmcs = &cmd->params.dmcs; mlan_ds_misc_mapping_policy *dmcs_params = MNULL; @@ -3845,7 +3858,7 @@ cmd->command = wlan_cpu_to_le16(HostCmd_CMD_DMCS_CONFIG); cmd->size = sizeof(HostCmd_DS_DMCS_CFG) + S_DS_GEN; dmcs->action = wlan_cpu_to_le16(cmd_action); - dmcs_params = (mlan_ds_misc_mapping_policy *) pdata_buf; + dmcs_params = (mlan_ds_misc_mapping_policy *)pdata_buf; dmcs->subcmd = wlan_cpu_to_le16(dmcs_params->subcmd); switch (dmcs->subcmd) { case 0: @@ -3870,9 +3883,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_dmcs_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_dmcs_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_DMCS_CFG *dmcs = &resp->params.dmcs; @@ -3902,20 +3914,20 @@ } switch (tlv_type) { case TLV_TYPE_DMCS_STATUS: - dmcs_status = (MrvlIEtypes_DmcsStatus_t *) tlv; + dmcs_status = (MrvlIEtypes_DmcsStatus_t *)tlv; cfg->param.dmcs_status.mapping_policy = dmcs_status->mapping_policy; memset(pmpriv->adapter, &cfg->param.dmcs_status.radio_status, 0, sizeof(dmcsStatus_t)); for (i = 0; i < MAX_NUM_MAC; i++) { - memcpy_ext(pmpriv->adapter, - &cfg->param.dmcs_status. - radio_status[i], - &dmcs_status-> - radio_status[i], - sizeof(dmcsStatus_t), - sizeof(dmcsStatus_t)); + memcpy_ext( + pmpriv->adapter, + &cfg->param.dmcs_status + .radio_status[i], + &dmcs_status->radio_status[i], + sizeof(dmcsStatus_t), + sizeof(dmcsStatus_t)); } break; default: @@ -3923,8 +3935,8 @@ } tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); tlv = (MrvlIEtypesHeader_t - *)((t_u8 *)tlv + tlv_len + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } pioctl_buf->data_read_written = sizeof(mlan_ds_misc_dmcs_status); @@ -3944,11 +3956,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_TX_RATE_CFG *rate_cfg = (HostCmd_DS_TX_RATE_CFG *)&(cmd->params.tx_rate_cfg); @@ -3980,27 +3990,26 @@ rate_scope->ht_mcs_rate_bitmap[i] = wlan_cpu_to_le16(pbitmap_rates[2 + i]); for (i = 0; i < NELEMENTS(rate_scope->vht_mcs_rate_bitmap); i++) - rate_scope->vht_mcs_rate_bitmap[i] = - wlan_cpu_to_le16(pbitmap_rates - [2 + - NELEMENTS(rate_scope-> - ht_mcs_rate_bitmap) - + i]); + rate_scope->vht_mcs_rate_bitmap[i] = wlan_cpu_to_le16( + pbitmap_rates + [2 + + NELEMENTS( + rate_scope->ht_mcs_rate_bitmap) + + i]); if (IS_FW_SUPPORT_11AX(pmpriv->adapter)) { for (i = 0; i < NELEMENTS(rate_scope->he_mcs_rate_bitmap); i++) rate_scope->he_mcs_rate_bitmap - [i] = wlan_cpu_to_le16(pbitmap_rates - [2 + - wlan_get_bitmap_index - (rate_scope) - + i]); + [i] = wlan_cpu_to_le16( + pbitmap_rates[2 + + wlan_get_bitmap_index( + rate_scope) + + i]); } else { - rate_scope->length = - wlan_cpu_to_le16(sizeof(MrvlRateScope_t) - - sizeof(rate_scope-> - he_mcs_rate_bitmap) - - sizeof(MrvlIEtypesHeader_t)); + rate_scope->length = wlan_cpu_to_le16( + sizeof(MrvlRateScope_t) - + sizeof(rate_scope->he_mcs_rate_bitmap) - + sizeof(MrvlIEtypesHeader_t)); } } else { rate_scope->hr_dsss_rate_bitmap = @@ -4011,30 +4020,28 @@ rate_scope->ht_mcs_rate_bitmap[i] = wlan_cpu_to_le16(pmpriv->bitmap_rates[2 + i]); for (i = 0; i < NELEMENTS(rate_scope->vht_mcs_rate_bitmap); i++) - rate_scope->vht_mcs_rate_bitmap[i] = - wlan_cpu_to_le16(pmpriv-> - bitmap_rates[2 + - NELEMENTS - (rate_scope-> - ht_mcs_rate_bitmap) - + i]); + rate_scope->vht_mcs_rate_bitmap[i] = wlan_cpu_to_le16( + pmpriv->bitmap_rates + [2 + + NELEMENTS( + rate_scope->ht_mcs_rate_bitmap) + + i]); if (IS_FW_SUPPORT_11AX(pmpriv->adapter)) { for (i = 0; i < NELEMENTS(rate_scope->vht_mcs_rate_bitmap); i++) - rate_scope->he_mcs_rate_bitmap - [i] = - wlan_cpu_to_le16(pmpriv-> - bitmap_rates[2 + - wlan_get_bitmap_index - (rate_scope) - + i]); + rate_scope->he_mcs_rate_bitmap[i] = + wlan_cpu_to_le16( + pmpriv->bitmap_rates + [2 + + wlan_get_bitmap_index( + rate_scope) + + i]); } else { - rate_scope->length = - wlan_cpu_to_le16(sizeof(MrvlRateScope_t) - - sizeof(rate_scope-> - he_mcs_rate_bitmap) - - sizeof(MrvlIEtypesHeader_t)); + rate_scope->length = wlan_cpu_to_le16( + sizeof(MrvlRateScope_t) - + sizeof(rate_scope->he_mcs_rate_bitmap) - + sizeof(MrvlIEtypesHeader_t)); } } @@ -4046,32 +4053,29 @@ rate_drop->length = wlan_cpu_to_le16(sizeof(rate_drop->rate_drop_mode)); rate_drop->rate_drop_mode = 0; - cmd->size = - wlan_cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_TX_RATE_CFG) + - rate_scope->length + - sizeof(MrvlIEtypesHeader_t) + - sizeof(MrvlRateDropPattern_t)); + cmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_TX_RATE_CFG) + + wlan_le16_to_cpu(rate_scope->length) + + sizeof(MrvlIEtypesHeader_t) + + sizeof(MrvlRateDropPattern_t)); if (pioctl_buf && pmpriv->adapter->pcard_info->v17_fw_api) { ds_rate = (mlan_ds_rate *)pioctl_buf->pbuf; rate_setting_tlv = (MrvlIETypes_rate_setting_t - *) ((t_u8 *)rate_drop + - sizeof(MrvlRateDropPattern_t)); + *)((t_u8 *)rate_drop + + sizeof(MrvlRateDropPattern_t)); rate_setting_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_TX_RATE_CFG); - rate_setting_tlv->header.len = - wlan_cpu_to_le16(sizeof - (rate_setting_tlv->rate_setting)); + rate_setting_tlv->header.len = wlan_cpu_to_le16( + sizeof(rate_setting_tlv->rate_setting)); rate_setting_tlv->rate_setting = wlan_cpu_to_le16(ds_rate->param.rate_cfg.rate_setting); PRINTM(MCMND, "he rate setting = %d\n", rate_setting_tlv->rate_setting); - cmd->size = - wlan_cpu_to_le16(S_DS_GEN + - sizeof(HostCmd_DS_TX_RATE_CFG) + - rate_scope->length + - sizeof(MrvlIEtypesHeader_t) + - sizeof(MrvlRateDropPattern_t) + - sizeof(MrvlIETypes_rate_setting_t)); + cmd->size = wlan_cpu_to_le16( + S_DS_GEN + sizeof(HostCmd_DS_TX_RATE_CFG) + + wlan_le16_to_cpu(rate_scope->length) + + sizeof(MrvlIEtypesHeader_t) + + sizeof(MrvlRateDropPattern_t) + + sizeof(MrvlIETypes_rate_setting_t)); } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -4086,9 +4090,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_tx_rate_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_ds_rate *ds_rate = MNULL; @@ -4112,11 +4115,7 @@ prate_cfg = (HostCmd_DS_TX_RATE_CFG *)&(resp->params.tx_rate_cfg); tlv_buf = (t_u8 *)prate_cfg->tlv_buf; - if (tlv_buf) { - tlv_buf_len = resp->size - - (sizeof(HostCmd_DS_TX_RATE_CFG) + S_DS_GEN); - tlv_buf_len = wlan_le16_to_cpu(tlv_buf_len); - } + tlv_buf_len = resp->size - (sizeof(HostCmd_DS_TX_RATE_CFG) + S_DS_GEN); while (tlv_buf && tlv_buf_len > 0) { tlv = (*tlv_buf); @@ -4125,27 +4124,26 @@ switch (tlv) { case TLV_TYPE_RATE_SCOPE: prate_scope = (MrvlRateScope_t *)tlv_buf; - pmpriv->bitmap_rates[0] = - wlan_le16_to_cpu(prate_scope-> - hr_dsss_rate_bitmap); + pmpriv->bitmap_rates[0] = wlan_le16_to_cpu( + prate_scope->hr_dsss_rate_bitmap); pmpriv->bitmap_rates[1] = wlan_le16_to_cpu(prate_scope->ofdm_rate_bitmap); for (i = 0; i < NELEMENTS(prate_scope->ht_mcs_rate_bitmap); i++) - pmpriv->bitmap_rates[2 + i] = - wlan_le16_to_cpu(prate_scope-> - ht_mcs_rate_bitmap[i]); + pmpriv->bitmap_rates[2 + i] = wlan_le16_to_cpu( + prate_scope->ht_mcs_rate_bitmap[i]); for (i = 0; i < NELEMENTS(prate_scope->vht_mcs_rate_bitmap); i++) - pmpriv->bitmap_rates[2 + - sizeof(prate_scope-> - ht_mcs_rate_bitmap) - / sizeof(t_u16) + i] = - wlan_le16_to_cpu(prate_scope-> - vht_mcs_rate_bitmap - [i]); + pmpriv->bitmap_rates + [2 + + sizeof(prate_scope->ht_mcs_rate_bitmap) / + sizeof(t_u16) + + i] = + wlan_le16_to_cpu( + prate_scope + ->vht_mcs_rate_bitmap[i]); if (IS_FW_SUPPORT_11AX(pmadapter)) { for (i = 0; i < @@ -4153,20 +4151,22 @@ i++) pmpriv->bitmap_rates [2 + - sizeof(prate_scope-> - ht_mcs_rate_bitmap) / - sizeof(t_u16) + - sizeof(prate_scope-> - vht_mcs_rate_bitmap) - / sizeof(t_u16) + i] = - wlan_le16_to_cpu(prate_scope-> - he_mcs_rate_bitmap - [i]); + sizeof(prate_scope + ->ht_mcs_rate_bitmap) / + sizeof(t_u16) + + sizeof(prate_scope + ->vht_mcs_rate_bitmap) / + sizeof(t_u16) + + i] = + wlan_le16_to_cpu( + prate_scope + ->he_mcs_rate_bitmap + [i]); } break; case TLV_TYPE_TX_RATE_CFG: rate_setting_tlv = - (MrvlIETypes_rate_setting_t *) tlv_buf; + (MrvlIETypes_rate_setting_t *)tlv_buf; rate_setting = rate_setting_tlv->rate_setting; break; /* Add RATE_DROP tlv here */ @@ -4201,9 +4201,8 @@ } else { ds_rate->param.rate_cfg.is_rate_auto = MFALSE; /* check the LG rate */ - index = wlan_get_rate_index(pmadapter, - &pmpriv->bitmap_rates[0], - 4); + index = wlan_get_rate_index( + pmadapter, &pmpriv->bitmap_rates[0], 4); if (index != -1) { if ((index >= MLAN_RATE_BITMAP_OFDM0) && (index <= MLAN_RATE_BITMAP_OFDM7)) @@ -4214,18 +4213,16 @@ ds_rate->param.rate_cfg.rate = index; } /* check the HT rate */ - index = wlan_get_rate_index(pmadapter, - &pmpriv->bitmap_rates[2], - 16); + index = wlan_get_rate_index( + pmadapter, &pmpriv->bitmap_rates[2], 16); if (index != -1) { ds_rate->param.rate_cfg.rate_format = MLAN_RATE_FORMAT_HT; ds_rate->param.rate_cfg.rate = index; } /* check the VHT rate */ - index = wlan_get_rate_index(pmadapter, - &pmpriv->bitmap_rates[10], - 16); + index = wlan_get_rate_index( + pmadapter, &pmpriv->bitmap_rates[10], 16); if (index != -1) { ds_rate->param.rate_cfg.rate_format = MLAN_RATE_FORMAT_VHT; @@ -4235,10 +4232,9 @@ } /* check the HE rate */ if (IS_FW_SUPPORT_11AX(pmadapter)) { - index = wlan_get_rate_index(pmadapter, - &pmpriv-> - bitmap_rates[18], - 16); + index = wlan_get_rate_index( + pmadapter, &pmpriv->bitmap_rates[18], + 16); if (index != -1) { ds_rate->param.rate_cfg.rate_format = MLAN_RATE_FORMAT_HE; @@ -4272,11 +4268,12 @@ * * @return MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -mlan_status -wlan_adapter_get_hw_spec(pmlan_adapter pmadapter) +mlan_status wlan_adapter_get_hw_spec(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); + + ENTER(); #if defined(SDIO) /* * This should be issued in the very first to config @@ -4378,8 +4375,7 @@ * * @return MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -mlan_status -wlan_adapter_init_cmd(pmlan_adapter pmadapter) +mlan_status wlan_adapter_init_cmd(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = MNULL; @@ -4405,8 +4401,10 @@ ret = MLAN_STATUS_FAILURE; goto done; } + #if defined(STA_SUPPORT) - if (pmpriv_sta && (pmpriv_sta->state_11d.user_enable_11d == ENABLE_11D)) { + if (pmpriv_sta && + (pmpriv_sta->state_11d.user_enable_11d == ENABLE_11D)) { /* Send command to FW to enable 11d */ ret = wlan_prepare_cmd(pmpriv_sta, HostCmd_CMD_802_11_SNMP_MIB, HostCmd_ACT_GEN_SET, Dot11D_i, MNULL, @@ -4442,6 +4440,7 @@ goto done; } } + #define DEF_AUTO_NULL_PKT_PERIOD 30 if (pmpriv_sta) { t_u32 value = DEF_AUTO_NULL_PKT_PERIOD; @@ -4478,6 +4477,32 @@ goto done; } } + if (pmadapter->init_para.drcs_chantime_mode) { + mlan_ds_drcs_cfg drcs_init_cfg[2]; + drcs_init_cfg[0].chan_idx = 0x1; + drcs_init_cfg[0].chantime = + (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 8); + /* switchtime use default value in fw*/ + drcs_init_cfg[0].switchtime = 10; + drcs_init_cfg[0].undozetime = 5; + drcs_init_cfg[0].mode = + (t_u8)(pmadapter->init_para.drcs_chantime_mode); + drcs_init_cfg[1].chan_idx = 0x2; + drcs_init_cfg[1].chantime = + (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 24); + /* switchtime use default value in fw*/ + drcs_init_cfg[1].switchtime = 10; + drcs_init_cfg[1].undozetime = 5; + drcs_init_cfg[1].mode = + (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 16); + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_DRCS_CONFIG, + HostCmd_ACT_GEN_SET, 0, MNULL, + (t_void *)drcs_init_cfg); + if (ret) { + ret = MLAN_STATUS_FAILURE; + goto done; + } + } /* Send request to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_RF_ANTENNA, HostCmd_ACT_GEN_GET, 0, MNULL, MNULL); @@ -4491,79 +4516,6 @@ return ret; } -#ifdef RX_PACKET_COALESCE -mlan_status -wlan_cmd_rx_pkt_coalesce_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) -{ - mlan_ds_misc_rx_packet_coalesce *rx_pkt_cfg = - (mlan_ds_misc_rx_packet_coalesce *)pdata_buf; - HostCmd_DS_RX_PKT_COAL_CFG *prx_coal_cfg = - (HostCmd_DS_RX_PKT_COAL_CFG *)&cmd->params.rx_pkt_coal_cfg; - - ENTER(); - - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_RX_PKT_COALESCE_CFG); - prx_coal_cfg->action = wlan_cpu_to_le16(cmd_action); - - if (cmd_action == HostCmd_ACT_GEN_SET) { - prx_coal_cfg->packet_threshold = - wlan_cpu_to_le32(rx_pkt_cfg->packet_threshold); - prx_coal_cfg->delay = wlan_cpu_to_le16(rx_pkt_cfg->delay); - PRINTM(MCMND, - "Set RX coal config: packet threshold=%d delay=%d\n", - rx_pkt_cfg->packet_threshold, rx_pkt_cfg->delay); - cmd->size = - wlan_cpu_to_le16(S_DS_GEN + - sizeof(HostCmd_DS_RX_PKT_COAL_CFG)); - } else { - cmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(cmd_action)); - } - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief This function handles the command response of RX_PACKET_COAL_CFG - * - * @param pmpriv A pointer to mlan_private structure - * @param resp A pointer to HostCmd_DS_COMMAND - * @param pioctl_buf A pointer to mlan_ioctl_req structure - * - * @return MLAN_STATUS_SUCCESS - */ -mlan_status -wlan_ret_rx_pkt_coalesce_cfg(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) -{ - mlan_ds_misc_cfg *pcfg = MNULL; - const HostCmd_DS_RX_PKT_COAL_CFG *presp_cfg = - &resp->params.rx_pkt_coal_cfg; - - ENTER(); - - if (pioctl_buf) { - pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - pcfg->param.rx_coalesce.packet_threshold = - wlan_le32_to_cpu(presp_cfg->packet_threshold); - pcfg->param.rx_coalesce.delay = - wlan_le16_to_cpu(presp_cfg->delay); - PRINTM(MCMND, - "Get rx pkt coalesce info: packet threshold=%d delay=%d\n", - pcfg->param.rx_coalesce.packet_threshold, - pcfg->param.rx_coalesce.delay); - pioctl_buf->buf_len = sizeof(mlan_ds_misc_rx_packet_coalesce); - } - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - -#endif - /** * @brief This function download the vdll block. * @@ -4573,8 +4525,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_download_vdll_block(mlan_adapter *pmadapter, t_u8 *block, t_u16 block_len) +mlan_status wlan_download_vdll_block(mlan_adapter *pmadapter, t_u8 *block, + t_u16 block_len) { mlan_status status = MLAN_STATUS_FAILURE; mlan_status ret = MLAN_STATUS_PENDING; @@ -4621,7 +4573,7 @@ pmadapter->callbacks.moal_memcpy_ext(pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset + - sizeof(HostCmd_DS_GEN), + sizeof(HostCmd_DS_GEN), block, block_len, block_len); pmbuf->data_len = msg_len; @@ -4668,8 +4620,7 @@ * @return MLAN_STATUS_SUCCESS * */ -static mlan_status -wlan_get_vdll_image(pmlan_adapter pmadapter, t_u32 vdll_len) +static mlan_status wlan_get_vdll_image(pmlan_adapter pmadapter, t_u32 vdll_len) { mlan_status status = MLAN_STATUS_SUCCESS; vdll_dnld_ctrl *ctrl = &pmadapter->vdll_ctrl; @@ -4678,10 +4629,19 @@ ENTER(); if (ctrl->vdll_mem) { - PRINTM(MCMND, "VDLL mem is not empty: %p len=%d\n", - ctrl->vdll_mem, ctrl->vdll_len); - goto done; + PRINTM(MCMND, + "VDLL mem is not empty: %p old_len=%d new_len=%d\n", + ctrl->vdll_mem, ctrl->vdll_len, vdll_len); + if (pcb->moal_vmalloc && pcb->moal_vfree) + pcb->moal_vfree(pmadapter->pmoal_handle, + (t_u8 *)ctrl->vdll_mem); + else + pcb->moal_mfree(pmadapter->pmoal_handle, + (t_u8 *)ctrl->vdll_mem); + ctrl->vdll_mem = MNULL; + ctrl->vdll_len = 0; } + if (pcb->moal_vmalloc && pcb->moal_vfree) status = pcb->moal_vmalloc(pmadapter->pmoal_handle, vdll_len, (t_u8 **)&ctrl->vdll_mem); @@ -4710,7 +4670,7 @@ ctrl->vdll_len = 0; goto done; } - /*allocate a memory to store all VDLL images */ + /*allocate a memory to store all VDLL images*/ ctrl->vdll_len = vdll_len; PRINTM(MMSG, "VDLL image: len=%d\n", ctrl->vdll_len); done: @@ -4726,8 +4686,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_process_vdll_event(pmlan_private pmpriv, pmlan_buffer pevent) +mlan_status wlan_process_vdll_event(pmlan_private pmpriv, pmlan_buffer pevent) { mlan_status status = MLAN_STATUS_SUCCESS; vdll_ind *ind = MNULL; @@ -4737,8 +4696,8 @@ vdll_dnld_ctrl *ctrl = &pmadapter->vdll_ctrl; ENTER(); - ind = (vdll_ind *) (pevent->pbuf + pevent->data_offset + - sizeof(mlan_event_id)); + ind = (vdll_ind *)(pevent->pbuf + pevent->data_offset + + sizeof(mlan_event_id)); switch (wlan_le16_to_cpu(ind->type)) { case VDLL_IND_TYPE_REQ: offset = wlan_le32_to_cpu(ind->offset); @@ -4748,11 +4707,9 @@ if (offset <= ctrl->vdll_len) { block_len = MIN(block_len, ctrl->vdll_len - offset); if (!pmadapter->cmd_sent) { - status = wlan_download_vdll_block(pmadapter, - ctrl-> - vdll_mem + - offset, - block_len); + status = wlan_download_vdll_block( + pmadapter, ctrl->vdll_mem + offset, + block_len); if (status) PRINTM(MERROR, "Fail to download VDLL block\n"); @@ -4789,6 +4746,511 @@ } /** + * @brief This function handle the csi event + * + * @param pmpriv A pointer to mlan_private structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_process_csi_event(pmlan_private pmpriv) +{ + pmlan_adapter pmadapter = pmpriv->adapter; + mlan_status status; + t_u32 eventcause = pmadapter->event_cause; + t_u8 *evt_buf = MNULL; + pmlan_buffer pmbuf = pmadapter->pmlan_buffer_event; + pmlan_callbacks pcb = &pmadapter->callbacks; + pmlan_event pevent; + + ENTER(); + + /* Allocate memory for event buffer */ + status = pcb->moal_malloc(pmadapter->pmoal_handle, MAX_EVENT_SIZE, + MLAN_MEM_DEF, &evt_buf); + if ((status == MLAN_STATUS_SUCCESS) && evt_buf) { + t_u16 csi_sig; + pcsi_record_ds csi_record = + (pcsi_record_ds)(pmbuf->pbuf + pmbuf->data_offset + + sizeof(eventcause)); + /* Check CSI signature */ + csi_sig = csi_record->CSI_Sign; + if (csi_sig != CSI_SIGNATURE) { + PRINTM(MERROR, + "Wrong CSI signature 0x%04x. Should be 0x%04x", + csi_sig, CSI_SIGNATURE); + status = MLAN_STATUS_FAILURE; + } else { + /* Send event to moal */ + pevent = (pmlan_event)evt_buf; + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_CSI; + /* Event length is the CSI record length in byte */ + pevent->event_len = csi_record->Len * 4; + if (pevent->event_len > + pmbuf->data_len - sizeof(eventcause)) + pevent->event_len = + pmbuf->data_len - sizeof(eventcause); + memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, + csi_record, pevent->event_len, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); + } + pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf); + } + + LEAVE(); + return status; +} + +/** + * @brief This function handle the multi_chan info event + * + * @param pmpriv A pointer to mlan_private structure + * @param pevent A pointer to event buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_handle_event_multi_chan_info(pmlan_private pmpriv, + pmlan_buffer pevent) +{ + pmlan_adapter pmadapter = pmpriv->adapter; + t_u32 interfaces = 0; + MrvlIEtypes_multi_chan_info_t *pmulti_chan_info = MNULL; + MrvlIEtypes_multi_chan_group_info_t *pmulti_chan_grp_info = MNULL; + int tlv_buf_left = pevent->data_len - sizeof(mlan_event_id); + t_u16 tlv_type, tlv_len; + mlan_status ret = MLAN_STATUS_SUCCESS; + pmlan_private intf_priv = MNULL; + int num_intf = 0, bss_type = 0, bss_num = 0; + MrvlIEtypesHeader_t *tlv = MNULL; + + ENTER(); + + PRINTM(MEVENT, "multi channel event\n"); + pmulti_chan_info = + (MrvlIEtypes_multi_chan_info_t *)(pevent->pbuf + + pevent->data_offset + + sizeof(mlan_event_id)); + if (tlv_buf_left < (int)(sizeof(MrvlIEtypes_multi_chan_info_t)) || + wlan_le16_to_cpu(pmulti_chan_info->header.type) != + TLV_TYPE_MULTI_CHAN_INFO) { + PRINTM(MERROR, "Invalid multi channel event\n"); + goto done; + } + + pmadapter->mc_status = wlan_le16_to_cpu(pmulti_chan_info->status); + PRINTM(MEVENT, "mc_status=%d\n", pmadapter->mc_status); + tlv_buf_left -= sizeof(MrvlIEtypes_multi_chan_info_t); + tlv = (MrvlIEtypesHeader_t *)pmulti_chan_info->tlv_buffer; + + while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) { + tlv_type = wlan_le16_to_cpu(tlv->type); + tlv_len = wlan_le16_to_cpu(tlv->len); + if ((sizeof(MrvlIEtypesHeader_t) + tlv_len) > + (unsigned int)tlv_buf_left) { + PRINTM(MERROR, "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", + tlv_len, tlv_buf_left); + break; + } + if (tlv_type != TLV_TYPE_MULTI_CHAN_GROUP_INFO_TLV_ID) { + PRINTM(MERROR, "wrong tlv type:0x%x\n", tlv_type); + break; + } + pmulti_chan_grp_info = + (MrvlIEtypes_multi_chan_group_info_t *)tlv; + PRINTM(MEVENT, "mc_info: groupid=%d chan=%d, numintf=%d\n", + pmulti_chan_grp_info->chan_group_id, + pmulti_chan_grp_info->chan_band_info.chan_num, + pmulti_chan_grp_info->num_intf); + num_intf = pmulti_chan_grp_info->num_intf; + for (interfaces = 0; interfaces < (t_u32)num_intf; + interfaces++) { + bss_type = pmulti_chan_grp_info + ->bss_type_numlist[interfaces] >> + 4; + bss_num = pmulti_chan_grp_info + ->bss_type_numlist[interfaces] & + BSS_NUM_MASK; + PRINTM(MEVENT, "intf%d: bss_type=%d bss_num=%d\n", + interfaces, bss_type, bss_num); + intf_priv = wlan_get_priv_by_id(pmadapter, bss_num, + bss_type); + if (intf_priv) { +#ifdef USB + if (IS_USB(pmadapter->card_type)) { + if (pmulti_chan_grp_info->hid_num + .usb_epnum == + MLAN_USB_EP_DATA || + pmulti_chan_grp_info->hid_num + .usb_epnum == + MLAN_USB_EP_DATA_CH2 || + pmulti_chan_grp_info->hid_num + .usb_epnum == + MLAN_USB_EP_DATA_IF2 || + pmulti_chan_grp_info->hid_num + .usb_epnum == + MLAN_USB_EP_DATA_CH2_IF2) { + intf_priv->port = + pmulti_chan_grp_info + ->hid_num + .usb_epnum; + intf_priv->port_index = + wlan_get_port_index( + pmadapter, + intf_priv->port); + PRINTM(MEVENT, + "intf%d: bss_type=%d bss_num=%d port=%d index=%d\n", + interfaces, bss_type, + bss_num, intf_priv->port, + intf_priv->port_index); + + } else + PRINTM(MERROR, + "Invalid Endpoint num in multi_channel event\n"); + } +#endif + } else { + PRINTM(MERROR, + "Invalid bss_type, bss_num in multi_channel event\n"); + } + } + + tlv_buf_left -= (sizeof(MrvlIEtypesHeader_t) + tlv_len); + tlv = (MrvlIEtypesHeader_t *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); + } + +#ifdef USB + if (IS_USB(pmadapter->card_type)) { + wlan_resync_usb_port(pmadapter); + } +#endif + +done: + LEAVE(); + return ret; +} + +/** + * @brief This function prepares the command MULTI_CHAN_CFG + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action Command action: GET or SET + * @param pdata_buf A pointer to new setting buf + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_multi_chan_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) +{ + mlan_ds_multi_chan_cfg *multi_chan_cfg = + (mlan_ds_multi_chan_cfg *)pdata_buf; + HostCmd_DS_MULTI_CHAN_CFG *pmchan_cfg = + (HostCmd_DS_MULTI_CHAN_CFG *)&cmd->params.multi_chan_cfg; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MULTI_CHAN_CONFIG); + pmchan_cfg->action = wlan_cpu_to_le16(cmd_action); + + if (cmd_action == HostCmd_ACT_GEN_SET) { + pmchan_cfg->buffer_weight = multi_chan_cfg->buffer_weight; + pmchan_cfg->channel_time = + wlan_cpu_to_le32(multi_chan_cfg->channel_time); + PRINTM(MCMND, + "Set multi-channel: buffer_weight=%d channel_time=%d\n", + multi_chan_cfg->buffer_weight, + multi_chan_cfg->channel_time); + cmd->size = wlan_cpu_to_le16(S_DS_GEN + + sizeof(HostCmd_DS_MULTI_CHAN_CFG)); + } else { + cmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(cmd_action)); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of MULTI_CHAN_CFG + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_multi_chan_cfg(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *pcfg = MNULL; + const HostCmd_DS_MULTI_CHAN_CFG *presp_cfg = + &resp->params.multi_chan_cfg; + + ENTER(); + + if (pioctl_buf) { + pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + pcfg->param.multi_chan_cfg.channel_time = + wlan_le32_to_cpu(presp_cfg->channel_time); + pcfg->param.multi_chan_cfg.buffer_weight = + presp_cfg->buffer_weight; + pcfg->param.multi_chan_cfg.tlv_len = + resp->size - (sizeof(HostCmd_DS_GEN) + + sizeof(HostCmd_DS_MULTI_CHAN_CFG)); + PRINTM(MCMND, + "Get multi-channel: buffer_weight=%d channel_time=%d tlv_len=%d\n", + pcfg->param.multi_chan_cfg.buffer_weight, + pcfg->param.multi_chan_cfg.channel_time, + pcfg->param.multi_chan_cfg.tlv_len); + memcpy_ext(pmpriv->adapter, pcfg->param.multi_chan_cfg.tlv_buf, + presp_cfg->tlv_buf, + pcfg->param.multi_chan_cfg.tlv_len, + pcfg->param.multi_chan_cfg.tlv_len); + pioctl_buf->buf_len = sizeof(mlan_ds_multi_chan_cfg) + + pcfg->param.multi_chan_cfg.tlv_len; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function prepares the command MULTI_CHAN_POLICY + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action Command action: GET or SET + * @param pdata_buf A pointer to new setting buf + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_multi_chan_policy(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + t_u16 policy = 0; + HostCmd_DS_MULTI_CHAN_POLICY *pmulti_chan_policy = + (HostCmd_DS_MULTI_CHAN_POLICY *)&cmd->params.multi_chan_policy; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MULTI_CHAN_POLICY); + pmulti_chan_policy->action = wlan_cpu_to_le16(cmd_action); + cmd->size = wlan_cpu_to_le16(S_DS_GEN + + sizeof(HostCmd_DS_MULTI_CHAN_POLICY)); + if (cmd_action == HostCmd_ACT_GEN_SET) { + policy = *((t_u16 *)pdata_buf); + pmulti_chan_policy->policy = wlan_cpu_to_le16(policy); + PRINTM(MCMND, "Set multi-channel policy: %d\n", policy); + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of MULTI_CHAN_POLICY + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_multi_chan_policy(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *pcfg = MNULL; + const HostCmd_DS_MULTI_CHAN_POLICY *presp_cfg = + &resp->params.multi_chan_policy; + + ENTER(); + + if (pioctl_buf) { + pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + pcfg->param.multi_chan_policy = + wlan_le16_to_cpu(presp_cfg->policy); + + if (pioctl_buf->action == HostCmd_ACT_GEN_SET) { + if (pcfg->param.multi_chan_policy) + pmpriv->adapter->mc_policy = MTRUE; + else + pmpriv->adapter->mc_policy = MFALSE; + } + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function prepares the command DRCD_CFG + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action Command action: GET or SET + * @param pdata_buf A pointer to new setting buf + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_drcs_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + mlan_ds_drcs_cfg *drcs_cfg = (mlan_ds_drcs_cfg *)pdata_buf; + HostCmd_DS_DRCS_CFG *pdrcs_cfg = + (HostCmd_DS_DRCS_CFG *)&cmd->params.drcs_cfg; + MrvlTypes_DrcsTimeSlice_t *channel_time_slicing = + &pdrcs_cfg->time_slicing; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_DRCS_CONFIG); + pdrcs_cfg->action = wlan_cpu_to_le16(cmd_action); + + if (cmd_action == HostCmd_ACT_GEN_SET) { + channel_time_slicing->header.type = + wlan_cpu_to_le16(MRVL_DRCS_TIME_SLICE_TLV_ID); + channel_time_slicing->header.len = + wlan_cpu_to_le16(sizeof(MrvlTypes_DrcsTimeSlice_t) - + sizeof(MrvlIEtypesHeader_t)); + channel_time_slicing->chan_idx = + wlan_cpu_to_le16(drcs_cfg->chan_idx); + channel_time_slicing->chantime = drcs_cfg->chantime; + channel_time_slicing->switchtime = drcs_cfg->switchtime; + channel_time_slicing->undozetime = drcs_cfg->undozetime; + channel_time_slicing->mode = drcs_cfg->mode; + PRINTM(MCMND, + "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + channel_time_slicing->chan_idx, + channel_time_slicing->chantime, + channel_time_slicing->switchtime, + channel_time_slicing->undozetime, + channel_time_slicing->mode); + cmd->size = wlan_cpu_to_le16(S_DS_GEN + + sizeof(HostCmd_DS_DRCS_CFG)); + /* Set two channels different parameters */ + if (0x3 != channel_time_slicing->chan_idx) { + drcs_cfg++; + channel_time_slicing = pdrcs_cfg->drcs_buf; + channel_time_slicing->header.type = + wlan_cpu_to_le16(MRVL_DRCS_TIME_SLICE_TLV_ID); + channel_time_slicing->header.len = wlan_cpu_to_le16( + sizeof(MrvlTypes_DrcsTimeSlice_t) - + sizeof(MrvlIEtypesHeader_t)); + channel_time_slicing->chan_idx = + wlan_cpu_to_le16(drcs_cfg->chan_idx); + channel_time_slicing->chantime = drcs_cfg->chantime; + channel_time_slicing->switchtime = drcs_cfg->switchtime; + channel_time_slicing->undozetime = drcs_cfg->undozetime; + channel_time_slicing->mode = drcs_cfg->mode; + PRINTM(MCMND, + "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + channel_time_slicing->chan_idx, + channel_time_slicing->chantime, + channel_time_slicing->switchtime, + channel_time_slicing->undozetime, + channel_time_slicing->mode); + cmd->size += wlan_cpu_to_le16( + sizeof(MrvlTypes_DrcsTimeSlice_t)); + } + } else { + cmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(cmd_action)); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of DRCS_CFG + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_drcs_cfg(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *pcfg = MNULL; + const HostCmd_DS_DRCS_CFG *presp_cfg = &resp->params.drcs_cfg; + const MrvlTypes_DrcsTimeSlice_t *channel_time_slicing = + &presp_cfg->time_slicing; + const MrvlTypes_DrcsTimeSlice_t *channel_time_slicing1 = MNULL; + mlan_ds_drcs_cfg *drcs_cfg1 = MNULL; + + ENTER(); + + if (pioctl_buf) { + pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + if (wlan_le16_to_cpu(channel_time_slicing->header.type) != + MRVL_DRCS_TIME_SLICE_TLV_ID || + wlan_le16_to_cpu(channel_time_slicing->header.len) != + sizeof(MrvlTypes_DrcsTimeSlice_t) - + sizeof(MrvlIEtypesHeader_t)) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + pcfg->param.drcs_cfg[0].chan_idx = + wlan_le16_to_cpu(channel_time_slicing->chan_idx); + pcfg->param.drcs_cfg[0].chantime = + channel_time_slicing->chantime; + pcfg->param.drcs_cfg[0].switchtime = + channel_time_slicing->switchtime; + pcfg->param.drcs_cfg[0].undozetime = + channel_time_slicing->undozetime; + pcfg->param.drcs_cfg[0].mode = channel_time_slicing->mode; + PRINTM(MCMND, + "multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + pcfg->param.drcs_cfg[0].chan_idx, + channel_time_slicing->chantime, + channel_time_slicing->switchtime, + channel_time_slicing->undozetime, + channel_time_slicing->mode); + pioctl_buf->buf_len = sizeof(mlan_ds_drcs_cfg); + /*Channel for chan_idx 1 and 2 have different parameters*/ + if (0x3 != pcfg->param.drcs_cfg[0].chan_idx) { + channel_time_slicing1 = presp_cfg->drcs_buf; + if (wlan_le16_to_cpu( + channel_time_slicing1->header.type) != + MRVL_DRCS_TIME_SLICE_TLV_ID || + wlan_le16_to_cpu( + channel_time_slicing1->header.len) != + sizeof(MrvlTypes_DrcsTimeSlice_t) - + sizeof(MrvlIEtypesHeader_t)) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + drcs_cfg1 = + (mlan_ds_drcs_cfg *)&pcfg->param.drcs_cfg[1]; + drcs_cfg1->chan_idx = wlan_le16_to_cpu( + channel_time_slicing1->chan_idx); + drcs_cfg1->chantime = channel_time_slicing1->chantime; + drcs_cfg1->switchtime = + channel_time_slicing1->switchtime; + drcs_cfg1->undozetime = + channel_time_slicing1->undozetime; + drcs_cfg1->mode = channel_time_slicing1->mode; + PRINTM(MCMND, + "multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + drcs_cfg1->chan_idx, drcs_cfg1->chantime, + drcs_cfg1->switchtime, drcs_cfg1->undozetime, + drcs_cfg1->mode); + pioctl_buf->buf_len += sizeof(mlan_ds_drcs_cfg); + } + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares command of get_hw_spec. * * @param pmpriv A pointer to mlan_private structure @@ -4796,8 +5258,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd) +mlan_status wlan_cmd_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd) { HostCmd_DS_GET_HW_SPEC *hw_spec = &pcmd->params.hw_spec; @@ -4823,9 +5284,8 @@ * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_sdio_rx_aggr_cfg(HostCmd_DS_COMMAND *pcmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_sdio_rx_aggr_cfg(HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_SDIO_SP_RX_AGGR_CFG *cfg = &pcmd->params.sdio_rx_aggr; @@ -4846,8 +5306,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_sdio_rx_aggr_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp) +mlan_status wlan_ret_sdio_rx_aggr_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp) { mlan_adapter *pmadapter = pmpriv->adapter; HostCmd_DS_SDIO_SP_RX_AGGR_CFG *cfg = &resp->params.sdio_rx_aggr; @@ -4877,10 +5337,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_cfg_data(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, - t_u32 cmd_oid, t_void *pdata_buf) +mlan_status wlan_cmd_cfg_data(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pdata_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_802_11_CFG_DATA *pcfg_data = &(pcmd->params.cfg_data); @@ -4927,13 +5386,13 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_cfg_data(IN pmlan_private pmpriv, - IN HostCmd_DS_COMMAND *resp, IN t_void *pioctl_buf) +mlan_status wlan_ret_cfg_data(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND *resp, + IN t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 event_buf[100]; - mlan_cmdresp_event *pevent = (mlan_cmdresp_event *) event_buf; + mlan_cmdresp_event *pevent = (mlan_cmdresp_event *)event_buf; mlan_adapter *pmadapter = pmpriv->adapter; HostCmd_DS_802_11_CFG_DATA *pcfg_data = &resp->params.cfg_data; t_u16 action; @@ -4947,8 +5406,8 @@ } if (!pmadapter->pdpd_data && - (pmadapter->dpd_data_len == UNKNOW_DPD_LENGTH) - && pmadapter->hw_status == WlanHardwareStatusGetHwSpec) { + (pmadapter->dpd_data_len == UNKNOW_DPD_LENGTH) && + pmadapter->hw_status == WlanHardwareStatusGetHwSpec) { action = wlan_le16_to_cpu(pcfg_data->action); type = wlan_le16_to_cpu(pcfg_data->type); if (action == HostCmd_ACT_GEN_GET && (type == OID_TYPE_DPD)) { @@ -4978,10 +5437,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_mac_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_MAC_CONTROL *pmac = &pcmd->params.mac_ctrl; t_u32 action = *((t_u32 *)pdata_buf); @@ -5012,9 +5469,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_mac_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { ENTER(); LEAVE(); @@ -5030,9 +5486,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_get_hw_spec(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) +mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf) { HostCmd_DS_GET_HW_SPEC *hw_spec = &resp->params.hw_spec; mlan_adapter *pmadapter = pmpriv->adapter; @@ -5049,6 +5504,8 @@ MrvlIEtypes_Extension_t *ext_tlv = MNULL; MrvlIEtypes_fw_cap_info_t *fw_cap_tlv = MNULL; + MrvlIEtypes_Secure_Boot_Uuid_t *sb_uuid_tlv = MNULL; + ENTER(); pmadapter->fw_cap_info = wlan_le32_to_cpu(hw_spec->fw_cap_info); @@ -5142,7 +5599,9 @@ wlan_show_dot11ndevcap(pmadapter, pmadapter->hw_dot_11n_dev_cap); wlan_show_devmcssupport(pmadapter, pmadapter->hw_dev_mcs_support); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) pmadapter->user_htstream = pmadapter->hw_dev_mcs_support; /** separate stream config for 2.4G and 5G, will be changed according to * antenna cfg*/ @@ -5156,8 +5615,8 @@ for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i]) pmadapter->priv[i]->tx_bf_cap = - pmadapter->pcard_info-> - default_11n_tx_bf_cap; + pmadapter->pcard_info + ->default_11n_tx_bf_cap; } } pmadapter->hw_dot_11ac_dev_cap = @@ -5276,7 +5735,7 @@ tlv_len = wlan_le16_to_cpu(tlv->len); switch (tlv_type) { case TLV_TYPE_FW_VER_INFO: - api_rev = (MrvlIEtypes_fw_ver_info_t *) tlv; + api_rev = (MrvlIEtypes_fw_ver_info_t *)tlv; api_id = wlan_le16_to_cpu(api_rev->api_id); switch (api_id) { case FW_API_VER_ID: @@ -5306,7 +5765,7 @@ } break; case TLV_TYPE_MAX_CONN: - tlv_max_conn = (MrvlIEtypes_Max_Conn_t *) tlv; + tlv_max_conn = (MrvlIEtypes_Max_Conn_t *)tlv; PRINTM(MMSG, "max_p2p_conn = %d, max_sta_conn = %d\n", tlv_max_conn->max_p2p_conn, tlv_max_conn->max_sta_conn); @@ -5325,18 +5784,17 @@ pmadapter->max_sta_conn = 0; break; case TLV_TYPE_EXTENSION_ID: - ext_tlv = (MrvlIEtypes_Extension_t *) tlv; + ext_tlv = (MrvlIEtypes_Extension_t *)tlv; if (ext_tlv->ext_id == HE_CAPABILITY) { ext_tlv->type = tlv_type; ext_tlv->len = tlv_len; - wlan_update_11ax_cap(pmadapter, - (MrvlIEtypes_Extension_t *) - ext_tlv); + wlan_update_11ax_cap( + pmadapter, + (MrvlIEtypes_Extension_t *)ext_tlv); } - break; case TLV_TYPE_FW_CAP_INFO: - fw_cap_tlv = (MrvlIEtypes_fw_cap_info_t *) tlv; + fw_cap_tlv = (MrvlIEtypes_fw_cap_info_t *)tlv; pmadapter->fw_cap_info = wlan_le32_to_cpu(fw_cap_tlv->fw_cap_info); pmadapter->fw_cap_ext = @@ -5344,6 +5802,13 @@ PRINTM(MCMND, "fw_cap_info=0x%x fw_cap_ext=0x%x\n", pmadapter->fw_cap_info, pmadapter->fw_cap_ext); break; + case TLV_TYPE_SECURE_BOOT_UUID: + sb_uuid_tlv = (MrvlIEtypes_Secure_Boot_Uuid_t *)tlv; + pmadapter->uuid_lo = sb_uuid_tlv->uuid_lo; + pmadapter->uuid_hi = sb_uuid_tlv->uuid_hi; + PRINTM(MMSG, "uuid: %016llx%016llx\n", + pmadapter->uuid_lo, pmadapter->uuid_hi); + break; default: break; } @@ -5366,13 +5831,12 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_radio_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_radio_control(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_802_11_RADIO_CONTROL *pradio_control = &cmd->params.radio; - t_u32 radio_ctl; + t_u32 radio_ctl = 0; ENTER(); cmd->size = wlan_cpu_to_le16((sizeof(HostCmd_DS_802_11_RADIO_CONTROL)) + S_DS_GEN); @@ -5394,10 +5858,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_802_11_radio_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_radio_control(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RADIO_CONTROL *pradio_ctrl = (HostCmd_DS_802_11_RADIO_CONTROL *)&resp->params.radio; @@ -5425,10 +5888,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_remain_on_channel(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_remain_on_channel(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_REMAIN_ON_CHANNEL *remain_channel = &cmd->params.remain_on_chan; @@ -5463,9 +5925,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_remain_on_channel(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_remain_on_channel(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_REMAIN_ON_CHANNEL *remain_channel = &resp->params.remain_on_chan; @@ -5496,10 +5958,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wifi_direct_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_wifi_direct_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_WIFI_DIRECT_MODE *wfd_mode = &cmd->params.wifi_direct_mode; t_u16 mode = *((t_u16 *)pdata_buf); @@ -5524,9 +5985,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wifi_direct_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wifi_direct_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_WIFI_DIRECT_MODE *wfd_mode = &resp->params.wifi_direct_mode; mlan_ds_bss *bss = MNULL; @@ -5551,10 +6012,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_p2p_params_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_p2p_params_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG *p2p_config = &cmd->params.p2p_params_config; @@ -5574,10 +6034,9 @@ pnoa_tlv = (MrvlIEtypes_NoA_setting_t *)tlv; pnoa_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_NOA); - pnoa_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_NoA_setting_t) - - sizeof(MrvlIEtypesHeader_t)); + pnoa_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_NoA_setting_t) - + sizeof(MrvlIEtypesHeader_t)); pnoa_tlv->enable = cfg->noa_enable; pnoa_tlv->index = wlan_cpu_to_le16(cfg->index); pnoa_tlv->noa_count = cfg->noa_count; @@ -5596,10 +6055,9 @@ popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *)tlv; popp_ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_OPP_PS); - popp_ps_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_OPP_PS_setting_t) - - sizeof(MrvlIEtypesHeader_t)); + popp_ps_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_OPP_PS_setting_t) - + sizeof(MrvlIEtypesHeader_t)); popp_ps_tlv->enable = cfg->ct_window; popp_ps_tlv->enable |= cfg->opp_ps_enable << 7; @@ -5613,10 +6071,9 @@ pnoa_tlv = (MrvlIEtypes_NoA_setting_t *)tlv; pnoa_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_NOA); - pnoa_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_NoA_setting_t) - - sizeof(MrvlIEtypesHeader_t)); + pnoa_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_NoA_setting_t) - + sizeof(MrvlIEtypesHeader_t)); cmd->size += sizeof(MrvlIEtypes_NoA_setting_t); tlv += sizeof(MrvlIEtypes_NoA_setting_t); } @@ -5625,10 +6082,9 @@ popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *)tlv; popp_ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_OPP_PS); - popp_ps_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_OPP_PS_setting_t) - - sizeof(MrvlIEtypesHeader_t)); + popp_ps_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_OPP_PS_setting_t) - + sizeof(MrvlIEtypesHeader_t)); cmd->size += sizeof(MrvlIEtypes_OPP_PS_setting_t); } } @@ -5646,9 +6102,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_p2p_params_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_p2p_params_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG *p2p_config = &resp->params.p2p_params_config; @@ -5687,30 +6143,30 @@ cfg->param.p2p_config.noa_enable = pnoa_tlv->enable; cfg->param.p2p_config.index = - wlan_le16_to_cpu(pnoa_tlv-> - index); + wlan_le16_to_cpu( + pnoa_tlv->index); cfg->param.p2p_config.noa_count = pnoa_tlv->noa_count; cfg->param.p2p_config.noa_duration = - wlan_le32_to_cpu(pnoa_tlv-> - noa_duration); + wlan_le32_to_cpu( + pnoa_tlv->noa_duration); cfg->param.p2p_config.noa_interval = - wlan_le32_to_cpu(pnoa_tlv-> - noa_interval); + wlan_le32_to_cpu( + pnoa_tlv->noa_interval); PRINTM(MCMND, "Get NOA: enable=%d index=%d, count=%d, duration=%d interval=%d\n", cfg->param.p2p_config.noa_enable, cfg->param.p2p_config.index, cfg->param.p2p_config.noa_count, - (int)cfg->param.p2p_config. - noa_duration, - (int)cfg->param.p2p_config. - noa_interval); + (int)cfg->param.p2p_config + .noa_duration, + (int)cfg->param.p2p_config + .noa_interval); break; case TLV_TYPE_WIFI_DIRECT_OPP_PS: popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *) - tlv; + tlv; cfg->param.p2p_config.flags |= WIFI_DIRECT_OPP_PS; cfg->param.p2p_config.opp_ps_enable = @@ -5720,8 +6176,8 @@ popp_ps_tlv->enable & 0x7f; PRINTM(MCMND, "Get OPP_PS: enable=%d ct_win=%d\n", - cfg->param.p2p_config. - opp_ps_enable, + cfg->param.p2p_config + .opp_ps_enable, cfg->param.p2p_config.ct_window); break; default: @@ -5730,8 +6186,8 @@ tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); tlv = (MrvlIEtypesHeader_t - *)((t_u8 *)tlv + tlv_len + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } pioctl_buf->data_read_written = sizeof(mlan_ds_wifi_direct_config); @@ -5753,18 +6209,17 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_gpio_tsf_latch(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, - mlan_ioctl_req *pioctl_buf, t_void *pdata_buf) +mlan_status wlan_cmd_gpio_tsf_latch(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + mlan_ioctl_req *pioctl_buf, + t_void *pdata_buf) { HostCmd_DS_GPIO_TSF_LATCH_PARAM_CONFIG *gpio_tsf_config = &cmd->params.gpio_tsf_latch; - mlan_ds_gpio_tsf_latch *cfg = (mlan_ds_gpio_tsf_latch *) pdata_buf; + mlan_ds_gpio_tsf_latch *cfg = (mlan_ds_gpio_tsf_latch *)pdata_buf; mlan_ds_misc_cfg *misc_cfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - mlan_ds_tsf_info *tsf_info = (mlan_ds_tsf_info *) pdata_buf; + mlan_ds_tsf_info *tsf_info = (mlan_ds_tsf_info *)pdata_buf; MrvlIEtypes_GPIO_TSF_LATCH_CONFIG *gpio_tsf_latch_config = MNULL; MrvlIEtypes_GPIO_TSF_LATCH_REPORT *gpio_tsf_latch_report = MNULL; t_u8 *tlv = MNULL; @@ -5777,14 +6232,12 @@ tlv = (t_u8 *)gpio_tsf_config->tlv_buf; if (misc_cfg->sub_command == MLAN_OID_MISC_GPIO_TSF_LATCH) { gpio_tsf_latch_config = - (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG *) tlv; - gpio_tsf_latch_config->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_GPIO_TSF_LATCH_CONFIG); - gpio_tsf_latch_config->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG) - - sizeof(MrvlIEtypesHeader_t)); + (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG *)tlv; + gpio_tsf_latch_config->header.type = wlan_cpu_to_le16( + TLV_TYPE_GPIO_TSF_LATCH_CONFIG); + gpio_tsf_latch_config->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG) - + sizeof(MrvlIEtypesHeader_t)); gpio_tsf_latch_config->clock_sync_mode = cfg->clock_sync_mode; gpio_tsf_latch_config->clock_sync_Role = @@ -5794,8 +6247,8 @@ gpio_tsf_latch_config->clock_sync_gpio_level_toggle = cfg->clock_sync_gpio_level_toggle; gpio_tsf_latch_config->clock_sync_gpio_pulse_width = - wlan_cpu_to_le16(cfg-> - clock_sync_gpio_pulse_width); + wlan_cpu_to_le16( + cfg->clock_sync_gpio_pulse_width); cmd->size += sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG); tlv += sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG); PRINTM(MCMND, @@ -5809,28 +6262,24 @@ tlv = (t_u8 *)gpio_tsf_config->tlv_buf; if (misc_cfg->sub_command == MLAN_OID_MISC_GPIO_TSF_LATCH) { gpio_tsf_latch_config = - (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG *) tlv; - gpio_tsf_latch_config->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_GPIO_TSF_LATCH_CONFIG); - gpio_tsf_latch_config->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG) - - sizeof(MrvlIEtypesHeader_t)); + (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG *)tlv; + gpio_tsf_latch_config->header.type = wlan_cpu_to_le16( + TLV_TYPE_GPIO_TSF_LATCH_CONFIG); + gpio_tsf_latch_config->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG) - + sizeof(MrvlIEtypesHeader_t)); cmd->size += sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG); tlv += sizeof(MrvlIEtypes_GPIO_TSF_LATCH_CONFIG); } if (misc_cfg->sub_command == MLAN_OID_MISC_GET_TSF_INFO) { gpio_tsf_latch_report = - (MrvlIEtypes_GPIO_TSF_LATCH_REPORT *) tlv; - gpio_tsf_latch_report->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_GPIO_TSF_LATCH_REPORT); - gpio_tsf_latch_report->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_GPIO_TSF_LATCH_REPORT) - - sizeof(MrvlIEtypesHeader_t)); + (MrvlIEtypes_GPIO_TSF_LATCH_REPORT *)tlv; + gpio_tsf_latch_report->header.type = wlan_cpu_to_le16( + TLV_TYPE_GPIO_TSF_LATCH_REPORT); + gpio_tsf_latch_report->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_GPIO_TSF_LATCH_REPORT) - + sizeof(MrvlIEtypesHeader_t)); gpio_tsf_latch_report->tsf_format = wlan_cpu_to_le16(tsf_info->tsf_format); PRINTM(MCMND, "Get TSF info: format=%d\n", @@ -5852,9 +6301,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_gpio_tsf_latch(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_gpio_tsf_latch(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_GPIO_TSF_LATCH_PARAM_CONFIG *gpio_tsf_config = &resp->params.gpio_tsf_latch; @@ -5873,8 +6322,8 @@ tlv = (MrvlIEtypesHeader_t *)(gpio_tsf_config->tlv_buf); tlv_buf_left = resp->size - - (sizeof(HostCmd_DS_GPIO_TSF_LATCH_PARAM_CONFIG) - + S_DS_GEN); + (sizeof(HostCmd_DS_GPIO_TSF_LATCH_PARAM_CONFIG) + + S_DS_GEN); while (tlv_buf_left >= sizeof(MrvlIEtypesHeader_t)) { tlv_type = wlan_le16_to_cpu(tlv->type); tlv_len = wlan_le16_to_cpu(tlv->len); @@ -5890,53 +6339,45 @@ MLAN_OID_MISC_GPIO_TSF_LATCH) { gpio_tsf_latch_config = (MrvlIEtypes_GPIO_TSF_LATCH_CONFIG - *) tlv; - cfg->param. - gpio_tsf_latch_config. - clock_sync_mode = - gpio_tsf_latch_config-> - clock_sync_mode; - cfg->param. - gpio_tsf_latch_config. - clock_sync_Role = - gpio_tsf_latch_config-> - clock_sync_Role; - cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_pin_number - = - gpio_tsf_latch_config-> - clock_sync_gpio_pin_number; - cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_level_toggle - = - gpio_tsf_latch_config-> - clock_sync_gpio_level_toggle; - cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_pulse_width - = - wlan_le16_to_cpu - (gpio_tsf_latch_config-> - clock_sync_gpio_pulse_width); + *)tlv; + cfg->param.gpio_tsf_latch_config + .clock_sync_mode = + gpio_tsf_latch_config + ->clock_sync_mode; + cfg->param.gpio_tsf_latch_config + .clock_sync_Role = + gpio_tsf_latch_config + ->clock_sync_Role; + cfg->param.gpio_tsf_latch_config + .clock_sync_gpio_pin_number = + gpio_tsf_latch_config + ->clock_sync_gpio_pin_number; + cfg->param.gpio_tsf_latch_config + .clock_sync_gpio_level_toggle = + gpio_tsf_latch_config + ->clock_sync_gpio_level_toggle; + cfg->param.gpio_tsf_latch_config + .clock_sync_gpio_pulse_width = + wlan_le16_to_cpu( + gpio_tsf_latch_config + ->clock_sync_gpio_pulse_width); PRINTM(MCMND, "Get GPIO TSF latch config: Mode=%d Role=%d, GPIO Pin Number=%d, GPIO level/toggle=%d GPIO pulse width=%d\n", - cfg->param. - gpio_tsf_latch_config. - clock_sync_mode, - cfg->param. - gpio_tsf_latch_config. - clock_sync_Role, - cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_pin_number, - cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_level_toggle, - (int)cfg->param. - gpio_tsf_latch_config. - clock_sync_gpio_pulse_width); + cfg->param + .gpio_tsf_latch_config + .clock_sync_mode, + cfg->param + .gpio_tsf_latch_config + .clock_sync_Role, + cfg->param + .gpio_tsf_latch_config + .clock_sync_gpio_pin_number, + cfg->param + .gpio_tsf_latch_config + .clock_sync_gpio_level_toggle, + (int)cfg->param + .gpio_tsf_latch_config + .clock_sync_gpio_pulse_width); } break; case TLV_TYPE_GPIO_TSF_LATCH_REPORT: @@ -5944,32 +6385,32 @@ MLAN_OID_MISC_GET_TSF_INFO) { gpio_tsf_latch_report = (MrvlIEtypes_GPIO_TSF_LATCH_REPORT - *) tlv; - cfg->param.tsf_info.tsf_format = - wlan_le16_to_cpu - (gpio_tsf_latch_report-> - tsf_format); - cfg->param.tsf_info.tsf_info = - wlan_le16_to_cpu - (gpio_tsf_latch_report-> - tsf_info); - cfg->param.tsf_info.tsf = - wlan_le64_to_cpu - (gpio_tsf_latch_report-> - tsf); - cfg->param.tsf_info.tsf_offset = - wlan_le16_to_cpu - (gpio_tsf_latch_report-> - tsf_offset); + *)tlv; + cfg->param.tsf_info + .tsf_format = wlan_le16_to_cpu( + gpio_tsf_latch_report + ->tsf_format); + cfg->param.tsf_info + .tsf_info = wlan_le16_to_cpu( + gpio_tsf_latch_report + ->tsf_info); + cfg->param.tsf_info + .tsf = wlan_le64_to_cpu( + gpio_tsf_latch_report + ->tsf); + cfg->param.tsf_info + .tsf_offset = wlan_le16_to_cpu( + gpio_tsf_latch_report + ->tsf_offset); PRINTM(MCMND, "Get GPIO TSF latch report : format=%d\n info=%d tsf=%llu offset=%d", - cfg->param.tsf_info. - tsf_format, - cfg->param.tsf_info. - tsf_info, + cfg->param.tsf_info + .tsf_format, + cfg->param.tsf_info + .tsf_info, cfg->param.tsf_info.tsf, - cfg->param.tsf_info. - tsf_offset); + cfg->param.tsf_info + .tsf_offset); } break; default: @@ -5978,8 +6419,8 @@ tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); tlv = (MrvlIEtypesHeader_t - *)((t_u8 *)tlv + tlv_len + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); } if (cfg->sub_command == MLAN_OID_MISC_GPIO_TSF_LATCH) pioctl_buf->data_read_written = @@ -5987,7 +6428,6 @@ else if (cfg->sub_command == MLAN_OID_MISC_GET_TSF_INFO) pioctl_buf->data_read_written = sizeof(mlan_ds_tsf_info); - } } LEAVE(); @@ -6002,12 +6442,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_mimo_switch(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_mimo_switch(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_DS_MIMO_SWITCH *mimo_switch_cmd = &cmd->params.mimo_switch; - mlan_ds_mimo_switch *pmimo_switch = (mlan_ds_mimo_switch *) pdata_buf; + mlan_ds_mimo_switch *pmimo_switch = (mlan_ds_mimo_switch *)pdata_buf; ENTER(); @@ -6029,9 +6469,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_hs_wakeup_reason(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_hs_wakeup_reason(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { ENTER(); @@ -6053,9 +6493,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_hs_wakeup_reason(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_hs_wakeup_reason(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_HS_WAKEUP_REASON *hs_wakeup_reason = (HostCmd_DS_HS_WAKEUP_REASON *)&resp->params.hs_wakeup_reason; @@ -6081,15 +6521,15 @@ * @param pdata_buf A pointer to information buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_tx_rx_pkt_stats(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - pmlan_ioctl_req pioctl_buf, t_void *pdata_buf) +mlan_status wlan_cmd_tx_rx_pkt_stats(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + pmlan_ioctl_req pioctl_buf, + t_void *pdata_buf) { HostCmd_DS_TX_RX_HISTOGRAM *ptx_rx_histogram = &cmd->params.tx_rx_histogram; mlan_ds_misc_tx_rx_histogram *ptx_rx_pkt_stats = - (mlan_ds_misc_tx_rx_histogram *) pdata_buf; + (mlan_ds_misc_tx_rx_histogram *)pdata_buf; mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -6108,7 +6548,6 @@ LEAVE(); return ret; } - /** * @brief This function handles the command response of tx_rx_pkt_stats * @@ -6118,9 +6557,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_tx_rx_pkt_stats(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_tx_rx_pkt_stats(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_TX_RX_HISTOGRAM *ptx_rx_histogram = &resp->params.tx_rx_histogram; @@ -6134,14 +6573,14 @@ ptx_rx_histogram->action = wlan_le16_to_cpu(ptx_rx_histogram->action); info = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - length = cmdsize - S_DS_GEN - - sizeof(HostCmd_DS_TX_RX_HISTOGRAM); + length = + cmdsize - S_DS_GEN - sizeof(HostCmd_DS_TX_RX_HISTOGRAM); if (length > 0) { info->param.tx_rx_histogram.size = length; memcpy_ext(pmpriv->adapter, info->param.tx_rx_histogram.value, (t_u8 *)ptx_rx_histogram + - sizeof(HostCmd_DS_TX_RX_HISTOGRAM), + sizeof(HostCmd_DS_TX_RX_HISTOGRAM), length, info->param.tx_rx_histogram.size); pos = (t_u32 *)info->param.tx_rx_histogram.value; while (length - 4 * count) { @@ -6166,13 +6605,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CW_MODE_CTRL *cwmode_ctrl = &cmd->params.cwmode; - mlan_ds_cw_mode_ctrl *cw_mode = (mlan_ds_cw_mode_ctrl *) pdata_buf; + mlan_ds_cw_mode_ctrl *cw_mode = (mlan_ds_cw_mode_ctrl *)pdata_buf; ENTER(); cmd->size = wlan_cpu_to_le16((sizeof(HostCmd_DS_CW_MODE_CTRL)) + S_DS_GEN); @@ -6200,9 +6637,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_cw_mode_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_cw_mode_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CW_MODE_CTRL *cwmode_resp = &resp->params.cwmode; mlan_ds_misc_cfg *misc = MNULL; @@ -6237,10 +6674,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_rf_antenna(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_rf_antenna(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_802_11_RF_ANTENNA *pantenna = &cmd->params.antenna; mlan_ds_ant_cfg *ant_cfg = (mlan_ds_ant_cfg *)pdata_buf; @@ -6256,19 +6692,16 @@ } HostCmd_DS_802_11_RF_ANTENNA_1X1; HostCmd_DS_802_11_RF_ANTENNA_1X1 *pantenna_1x1 = (HostCmd_DS_802_11_RF_ANTENNA_1X1 *)&cmd->params.antenna; - mlan_ds_ant_cfg_1x1 *ant_cfg_1x1 = (mlan_ds_ant_cfg_1x1 *) pdata_buf; + mlan_ds_ant_cfg_1x1 *ant_cfg_1x1 = (mlan_ds_ant_cfg_1x1 *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_RF_ANTENNA); if (!IS_STREAM_2X2(pmpriv->adapter->feature_control)) - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_802_11_RF_ANTENNA_1X1) + - S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_RF_ANTENNA_1X1) + S_DS_GEN); else - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_RF_ANTENNA) + - S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_RF_ANTENNA) + S_DS_GEN); if (cmd_action == HostCmd_ACT_GEN_SET) { if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) { @@ -6285,9 +6718,8 @@ wlan_cpu_to_le16(HostCmd_ACT_SET_BOTH); pantenna_1x1->antenna_mode = wlan_cpu_to_le16((t_u16)ant_cfg_1x1->antenna); - pantenna_1x1->evaluate_time = wlan_cpu_to_le16((t_u16) - ant_cfg_1x1-> - evaluate_time); + pantenna_1x1->evaluate_time = wlan_cpu_to_le16( + (t_u16)ant_cfg_1x1->evaluate_time); } } else { if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) { @@ -6313,14 +6745,16 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RF_ANTENNA *pantenna = &resp->params.antenna; t_u16 tx_ant_mode = wlan_le16_to_cpu(pantenna->tx_antenna_mode); t_u16 rx_ant_mode = wlan_le16_to_cpu(pantenna->rx_antenna_mode); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) mlan_adapter *pmadapter = pmpriv->adapter; #endif typedef struct _HostCmd_DS_802_11_RF_ANTENNA_1X1 { @@ -6348,8 +6782,11 @@ " Rx action = 0x%x, Rx Mode = 0x%04x\n", wlan_le16_to_cpu(pantenna->action_tx), tx_ant_mode, wlan_le16_to_cpu(pantenna->action_rx), rx_ant_mode); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type)) { tx_ant_mode &= 0x0303; rx_ant_mode &= 0x0303; @@ -6415,13 +6852,13 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_reg_access(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf) +mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { mlan_ds_reg_rw *reg_rw; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) MrvlIEtypes_Reg_type_t *tlv; mlan_adapter *pmadapter = pmpriv->adapter; #endif @@ -6430,201 +6867,172 @@ reg_rw = (mlan_ds_reg_rw *)pdata_buf; switch (cmd->command) { - case HostCmd_CMD_MAC_REG_ACCESS:{ - HostCmd_DS_MAC_REG_ACCESS *mac_reg; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_MAC_REG_ACCESS) + - S_DS_GEN); - mac_reg = - (HostCmd_DS_MAC_REG_ACCESS *)&cmd->params. - mac_reg; - mac_reg->action = wlan_cpu_to_le16(cmd_action); - mac_reg->offset = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - mac_reg->value = wlan_cpu_to_le32(reg_rw->value); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) - if ((reg_rw->type == MLAN_REG_MAC2) && - (IS_CARD9098(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type))) { - tlv = (MrvlIEtypes_Reg_type_t - *) ((t_u8 *)cmd + - sizeof(HostCmd_DS_MAC_REG_ACCESS) + - S_DS_GEN); - tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_REG_ACCESS_CTRL); - tlv->header.len = - wlan_cpu_to_le16(sizeof(t_u8)); - tlv->type = MLAN_REG_MAC2; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_MAC_REG_ACCESS) - + S_DS_GEN + - sizeof - (MrvlIEtypes_Reg_type_t)); - } + case HostCmd_CMD_MAC_REG_ACCESS: { + HostCmd_DS_MAC_REG_ACCESS *mac_reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_MAC_REG_ACCESS) + + S_DS_GEN); + mac_reg = (HostCmd_DS_MAC_REG_ACCESS *)&cmd->params.mac_reg; + mac_reg->action = wlan_cpu_to_le16(cmd_action); + mac_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + mac_reg->value = wlan_cpu_to_le32(reg_rw->value); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) + if ((reg_rw->type == MLAN_REG_MAC2) && + (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || + IS_CARD9097(pmadapter->card_type))) { + tlv = (MrvlIEtypes_Reg_type_t + *)((t_u8 *)cmd + + sizeof(HostCmd_DS_MAC_REG_ACCESS) + + S_DS_GEN); + tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_REG_ACCESS_CTRL); + tlv->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + tlv->type = MLAN_REG_MAC2; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_MAC_REG_ACCESS) + S_DS_GEN + + sizeof(MrvlIEtypes_Reg_type_t)); + } #endif - break; + break; + } + case HostCmd_CMD_REG_ACCESS: { + HostCmd_DS_REG_ACCESS *reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_REG_ACCESS) + + S_DS_GEN); + reg = (HostCmd_DS_REG_ACCESS *)&cmd->params.reg; + reg->action = wlan_cpu_to_le16(cmd_action); + reg->reg_type = wlan_cpu_to_le16((t_u16)reg_rw->type); + reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + reg->value = wlan_cpu_to_le32(reg_rw->value); + break; + } + case HostCmd_CMD_BBP_REG_ACCESS: { + HostCmd_DS_BBP_REG_ACCESS *bbp_reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_BBP_REG_ACCESS) + + S_DS_GEN); + bbp_reg = (HostCmd_DS_BBP_REG_ACCESS *)&cmd->params.bbp_reg; + bbp_reg->action = wlan_cpu_to_le16(cmd_action); + bbp_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + bbp_reg->value = (t_u8)reg_rw->value; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) + if ((reg_rw->type == MLAN_REG_BBP2) && + (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || + IS_CARD9097(pmadapter->card_type))) { + tlv = (MrvlIEtypes_Reg_type_t + *)((t_u8 *)cmd + + sizeof(HostCmd_DS_BBP_REG_ACCESS) + + S_DS_GEN); + tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_REG_ACCESS_CTRL); + tlv->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + tlv->type = MLAN_REG_BBP2; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_BBP_REG_ACCESS) + S_DS_GEN + + sizeof(MrvlIEtypes_Reg_type_t)); } - case HostCmd_CMD_BBP_REG_ACCESS:{ - HostCmd_DS_BBP_REG_ACCESS *bbp_reg; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_BBP_REG_ACCESS) + - S_DS_GEN); - bbp_reg = - (HostCmd_DS_BBP_REG_ACCESS *)&cmd->params. - bbp_reg; - bbp_reg->action = wlan_cpu_to_le16(cmd_action); - bbp_reg->offset = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - bbp_reg->value = (t_u8)reg_rw->value; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) - if ((reg_rw->type == MLAN_REG_BBP2) && - (IS_CARD9098(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type))) { - tlv = (MrvlIEtypes_Reg_type_t - *) ((t_u8 *)cmd + - sizeof(HostCmd_DS_BBP_REG_ACCESS) + - S_DS_GEN); - tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_REG_ACCESS_CTRL); - tlv->header.len = - wlan_cpu_to_le16(sizeof(t_u8)); - tlv->type = MLAN_REG_BBP2; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_BBP_REG_ACCESS) - + S_DS_GEN + - sizeof - (MrvlIEtypes_Reg_type_t)); - } #endif - break; + break; + } + case HostCmd_CMD_RF_REG_ACCESS: { + HostCmd_DS_RF_REG_ACCESS *rf_reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_RF_REG_ACCESS) + + S_DS_GEN); + rf_reg = (HostCmd_DS_RF_REG_ACCESS *)&cmd->params.rf_reg; + rf_reg->action = wlan_cpu_to_le16(cmd_action); + rf_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + rf_reg->value = (t_u8)reg_rw->value; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) + if ((reg_rw->type == MLAN_REG_RF2) && + (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || + IS_CARD9097(pmadapter->card_type))) { + tlv = (MrvlIEtypes_Reg_type_t + *)((t_u8 *)cmd + + sizeof(HostCmd_DS_RF_REG_ACCESS) + + S_DS_GEN); + tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_REG_ACCESS_CTRL); + tlv->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + tlv->type = MLAN_REG_RF2; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_RF_REG_ACCESS) + S_DS_GEN + + sizeof(MrvlIEtypes_Reg_type_t)); } - case HostCmd_CMD_RF_REG_ACCESS:{ - HostCmd_DS_RF_REG_ACCESS *rf_reg; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_RF_REG_ACCESS) + - S_DS_GEN); - rf_reg = (HostCmd_DS_RF_REG_ACCESS *)&cmd->params. - rf_reg; - rf_reg->action = wlan_cpu_to_le16(cmd_action); - rf_reg->offset = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - rf_reg->value = (t_u8)reg_rw->value; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) - if ((reg_rw->type == MLAN_REG_RF2) && - (IS_CARD9098(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type))) { - tlv = (MrvlIEtypes_Reg_type_t - *) ((t_u8 *)cmd + - sizeof(HostCmd_DS_RF_REG_ACCESS) + - S_DS_GEN); - tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_REG_ACCESS_CTRL); - tlv->header.len = - wlan_cpu_to_le16(sizeof(t_u8)); - tlv->type = MLAN_REG_RF2; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_RF_REG_ACCESS) - + S_DS_GEN + - sizeof - (MrvlIEtypes_Reg_type_t)); - } #endif - break; + break; + } + case HostCmd_CMD_CAU_REG_ACCESS: { + HostCmd_DS_RF_REG_ACCESS *cau_reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_RF_REG_ACCESS) + + S_DS_GEN); + cau_reg = (HostCmd_DS_RF_REG_ACCESS *)&cmd->params.rf_reg; + cau_reg->action = wlan_cpu_to_le16(cmd_action); + cau_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + cau_reg->value = (t_u8)reg_rw->value; + break; + } + case HostCmd_CMD_TARGET_ACCESS: { + HostCmd_DS_TARGET_ACCESS *target; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_TARGET_ACCESS) + + S_DS_GEN); + target = (HostCmd_DS_TARGET_ACCESS *)&cmd->params.target; + target->action = wlan_cpu_to_le16(cmd_action); + target->csu_target = wlan_cpu_to_le16(MLAN_CSU_TARGET_PSU); + target->address = wlan_cpu_to_le16((t_u16)reg_rw->offset); + target->data = (t_u8)reg_rw->value; + break; + } + case HostCmd_CMD_802_11_EEPROM_ACCESS: { + mlan_ds_read_eeprom *rd_eeprom = + (mlan_ds_read_eeprom *)pdata_buf; + HostCmd_DS_802_11_EEPROM_ACCESS *cmd_eeprom = + (HostCmd_DS_802_11_EEPROM_ACCESS *)&cmd->params.eeprom; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_EEPROM_ACCESS) + S_DS_GEN); + cmd_eeprom->action = wlan_cpu_to_le16(cmd_action); + cmd_eeprom->offset = wlan_cpu_to_le16(rd_eeprom->offset); + cmd_eeprom->byte_count = + wlan_cpu_to_le16(rd_eeprom->byte_count); + cmd_eeprom->value = 0; + break; + } + case HostCmd_CMD_BCA_REG_ACCESS: { + HostCmd_DS_BCA_REG_ACCESS *bca_reg; + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_BCA_REG_ACCESS) + + S_DS_GEN); + bca_reg = (HostCmd_DS_BCA_REG_ACCESS *)&cmd->params.bca_reg; + bca_reg->action = wlan_cpu_to_le16(cmd_action); + bca_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); + bca_reg->value = wlan_cpu_to_le32(reg_rw->value); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) + if ((reg_rw->type == MLAN_REG_BCA2) && + (IS_CARD9098(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type) || + IS_CARD9097(pmadapter->card_type))) { + tlv = (MrvlIEtypes_Reg_type_t + *)((t_u8 *)cmd + + sizeof(HostCmd_DS_BCA_REG_ACCESS) + + S_DS_GEN); + tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_REG_ACCESS_CTRL); + tlv->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + tlv->type = MLAN_REG_BCA2; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_BCA_REG_ACCESS) + S_DS_GEN + + sizeof(MrvlIEtypes_Reg_type_t)); } - case HostCmd_CMD_CAU_REG_ACCESS:{ - HostCmd_DS_RF_REG_ACCESS *cau_reg; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_RF_REG_ACCESS) + - S_DS_GEN); - cau_reg = - (HostCmd_DS_RF_REG_ACCESS *)&cmd->params.rf_reg; - cau_reg->action = wlan_cpu_to_le16(cmd_action); - cau_reg->offset = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - cau_reg->value = (t_u8)reg_rw->value; - break; - } - case HostCmd_CMD_TARGET_ACCESS:{ - HostCmd_DS_TARGET_ACCESS *target; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_TARGET_ACCESS) + - S_DS_GEN); - target = (HostCmd_DS_TARGET_ACCESS *)&cmd->params. - target; - target->action = wlan_cpu_to_le16(cmd_action); - target->csu_target = - wlan_cpu_to_le16(MLAN_CSU_TARGET_PSU); - target->address = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - target->data = (t_u8)reg_rw->value; - break; - } - case HostCmd_CMD_802_11_EEPROM_ACCESS:{ - mlan_ds_read_eeprom *rd_eeprom = - (mlan_ds_read_eeprom *)pdata_buf; - HostCmd_DS_802_11_EEPROM_ACCESS *cmd_eeprom = - (HostCmd_DS_802_11_EEPROM_ACCESS *)&cmd->params. - eeprom; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_802_11_EEPROM_ACCESS) - + S_DS_GEN); - cmd_eeprom->action = wlan_cpu_to_le16(cmd_action); - cmd_eeprom->offset = - wlan_cpu_to_le16(rd_eeprom->offset); - cmd_eeprom->byte_count = - wlan_cpu_to_le16(rd_eeprom->byte_count); - cmd_eeprom->value = 0; - break; - } - case HostCmd_CMD_BCA_REG_ACCESS:{ - HostCmd_DS_BCA_REG_ACCESS *bca_reg; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_BCA_REG_ACCESS) + - S_DS_GEN); - bca_reg = - (HostCmd_DS_BCA_REG_ACCESS *) & cmd->params. - bca_reg; - bca_reg->action = wlan_cpu_to_le16(cmd_action); - bca_reg->offset = - wlan_cpu_to_le16((t_u16)reg_rw->offset); - bca_reg->value = wlan_cpu_to_le32(reg_rw->value); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) - if ((reg_rw->type == MLAN_REG_BCA2) && - (IS_CARD9098(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type))) { - tlv = (MrvlIEtypes_Reg_type_t - *) ((t_u8 *)cmd + - sizeof(HostCmd_DS_BCA_REG_ACCESS) + - S_DS_GEN); - tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_REG_ACCESS_CTRL); - tlv->header.len = - wlan_cpu_to_le16(sizeof(t_u8)); - tlv->type = MLAN_REG_BCA2; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_BCA_REG_ACCESS) - + S_DS_GEN + - sizeof - (MrvlIEtypes_Reg_type_t)); - } #endif - break; - } + break; + } default: LEAVE(); return MLAN_STATUS_FAILURE; @@ -6645,9 +7053,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_reg_access(mlan_adapter *pmadapter, t_u16 type, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_reg_access(mlan_adapter *pmadapter, t_u16 type, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_reg_mem *reg_mem = MNULL; mlan_ds_reg_rw *reg_rw = MNULL; @@ -6658,96 +7066,86 @@ reg_mem = (mlan_ds_reg_mem *)pioctl_buf->pbuf; reg_rw = ®_mem->param.reg_rw; switch (type) { - case HostCmd_CMD_MAC_REG_ACCESS:{ - HostCmd_DS_MAC_REG_ACCESS *reg; - reg = (HostCmd_DS_MAC_REG_ACCESS *)&resp-> - params.mac_reg; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->offset); - reg_rw->value = wlan_le32_to_cpu(reg->value); - break; - } - case HostCmd_CMD_BBP_REG_ACCESS:{ - HostCmd_DS_BBP_REG_ACCESS *reg; - reg = (HostCmd_DS_BBP_REG_ACCESS *)&resp-> - params.bbp_reg; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->offset); - reg_rw->value = (t_u32)reg->value; - break; - } + case HostCmd_CMD_MAC_REG_ACCESS: { + HostCmd_DS_MAC_REG_ACCESS *reg; + reg = (HostCmd_DS_MAC_REG_ACCESS *)&resp->params.mac_reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = wlan_le32_to_cpu(reg->value); + break; + } + case HostCmd_CMD_REG_ACCESS: { + HostCmd_DS_REG_ACCESS *reg; + reg = (HostCmd_DS_REG_ACCESS *)&resp->params.reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = wlan_le32_to_cpu(reg->value); + break; + } + case HostCmd_CMD_BBP_REG_ACCESS: { + HostCmd_DS_BBP_REG_ACCESS *reg; + reg = (HostCmd_DS_BBP_REG_ACCESS *)&resp->params.bbp_reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = (t_u32)reg->value; + break; + } - case HostCmd_CMD_RF_REG_ACCESS:{ - HostCmd_DS_RF_REG_ACCESS *reg; - reg = (HostCmd_DS_RF_REG_ACCESS *)&resp->params. - rf_reg; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->offset); - reg_rw->value = (t_u32)reg->value; - break; + case HostCmd_CMD_RF_REG_ACCESS: { + HostCmd_DS_RF_REG_ACCESS *reg; + reg = (HostCmd_DS_RF_REG_ACCESS *)&resp->params.rf_reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = (t_u32)reg->value; + break; + } + case HostCmd_CMD_CAU_REG_ACCESS: { + HostCmd_DS_RF_REG_ACCESS *reg; + reg = (HostCmd_DS_RF_REG_ACCESS *)&resp->params.rf_reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = (t_u32)reg->value; + break; + } + case HostCmd_CMD_TARGET_ACCESS: { + HostCmd_DS_TARGET_ACCESS *reg; + reg = (HostCmd_DS_TARGET_ACCESS *)&resp->params.target; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->address); + reg_rw->value = (t_u32)reg->data; + break; + } + case HostCmd_CMD_802_11_EEPROM_ACCESS: { + mlan_ds_read_eeprom *eeprom = ®_mem->param.rd_eeprom; + HostCmd_DS_802_11_EEPROM_ACCESS *cmd_eeprom = + (HostCmd_DS_802_11_EEPROM_ACCESS *)&resp->params + .eeprom; + cmd_eeprom->byte_count = + wlan_le16_to_cpu(cmd_eeprom->byte_count); + PRINTM(MINFO, "EEPROM read len=%x\n", + cmd_eeprom->byte_count); + if (eeprom->byte_count < cmd_eeprom->byte_count) { + eeprom->byte_count = 0; + PRINTM(MINFO, + "EEPROM read return length is too big\n"); + pioctl_buf->status_code = + MLAN_ERROR_CMD_RESP_FAIL; + LEAVE(); + return MLAN_STATUS_FAILURE; } - case HostCmd_CMD_CAU_REG_ACCESS:{ - HostCmd_DS_RF_REG_ACCESS *reg; - reg = (HostCmd_DS_RF_REG_ACCESS *)&resp->params. - rf_reg; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->offset); - reg_rw->value = (t_u32)reg->value; - break; + eeprom->offset = wlan_le16_to_cpu(cmd_eeprom->offset); + eeprom->byte_count = cmd_eeprom->byte_count; + if (eeprom->byte_count > 0) { + memcpy_ext(pmadapter, &eeprom->value, + &cmd_eeprom->value, + eeprom->byte_count, MAX_EEPROM_DATA); + HEXDUMP("EEPROM", (char *)&eeprom->value, + MIN(MAX_EEPROM_DATA, + eeprom->byte_count)); } - case HostCmd_CMD_TARGET_ACCESS:{ - HostCmd_DS_TARGET_ACCESS *reg; - reg = (HostCmd_DS_TARGET_ACCESS *)&resp->params. - target; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->address); - reg_rw->value = (t_u32)reg->data; - break; - } - case HostCmd_CMD_802_11_EEPROM_ACCESS:{ - mlan_ds_read_eeprom *eeprom = - ®_mem->param.rd_eeprom; - HostCmd_DS_802_11_EEPROM_ACCESS *cmd_eeprom = - (HostCmd_DS_802_11_EEPROM_ACCESS *) - &resp->params.eeprom; - cmd_eeprom->byte_count = - wlan_le16_to_cpu(cmd_eeprom-> - byte_count); - PRINTM(MINFO, "EEPROM read len=%x\n", - cmd_eeprom->byte_count); - if (eeprom->byte_count < cmd_eeprom->byte_count) { - eeprom->byte_count = 0; - PRINTM(MINFO, - "EEPROM read return length is too big\n"); - pioctl_buf->status_code = - MLAN_ERROR_CMD_RESP_FAIL; - LEAVE(); - return MLAN_STATUS_FAILURE; - } - eeprom->offset = - wlan_le16_to_cpu(cmd_eeprom->offset); - eeprom->byte_count = cmd_eeprom->byte_count; - if (eeprom->byte_count > 0) { - memcpy_ext(pmadapter, &eeprom->value, - &cmd_eeprom->value, - eeprom->byte_count, - MAX_EEPROM_DATA); - HEXDUMP("EEPROM", - (char *)&eeprom->value, - MIN(MAX_EEPROM_DATA, - eeprom->byte_count)); - } - break; - } - case HostCmd_CMD_BCA_REG_ACCESS:{ - HostCmd_DS_BCA_REG_ACCESS *reg; - reg = (HostCmd_DS_BCA_REG_ACCESS *) & resp-> - params.bca_reg; - reg_rw->offset = - (t_u32)wlan_le16_to_cpu(reg->offset); - reg_rw->value = wlan_le32_to_cpu(reg->value); - break; - } + break; + } + case HostCmd_CMD_BCA_REG_ACCESS: { + HostCmd_DS_BCA_REG_ACCESS *reg; + reg = (HostCmd_DS_BCA_REG_ACCESS *)&resp->params.bca_reg; + reg_rw->offset = (t_u32)wlan_le16_to_cpu(reg->offset); + reg_rw->value = wlan_le32_to_cpu(reg->value); + break; + } default: pioctl_buf->status_code = MLAN_ERROR_CMD_RESP_FAIL; LEAVE(); @@ -6767,9 +7165,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_mem_access(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf) +mlan_status wlan_cmd_mem_access(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { mlan_ds_mem_rw *mem_rw = (mlan_ds_mem_rw *)pdata_buf; HostCmd_DS_MEM_ACCESS *mem_access = @@ -6797,9 +7194,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_mem_access(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_mem_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_reg_mem *reg_mem = MNULL; mlan_ds_mem_rw *mem_rw = MNULL; @@ -6828,8 +7224,8 @@ * * @return N/A */ -void -wlan_bt_coex_wlan_param_update_event(pmlan_private priv, pmlan_buffer pevent) +void wlan_bt_coex_wlan_param_update_event(pmlan_private priv, + pmlan_buffer pevent) { pmlan_adapter pmadapter = priv->adapter; MrvlIEtypesHeader_t *tlv = MNULL; @@ -6849,7 +7245,7 @@ break; switch (tlv_type) { case TLV_BTCOEX_WL_AGGR_WINSIZE: - pCoexWinsize = (MrvlIETypes_BtCoexAggrWinSize_t *) tlv; + pCoexWinsize = (MrvlIETypes_BtCoexAggrWinSize_t *)tlv; pmadapter->coex_win_size = pCoexWinsize->coex_win_size; pmadapter->coex_tx_win_size = pCoexWinsize->tx_win_size; pmadapter->coex_rx_win_size = pCoexWinsize->rx_win_size; @@ -6857,7 +7253,7 @@ wlan_update_ampdu_txwinsize(pmadapter); break; case TLV_BTCOEX_WL_SCANTIME: - pScantlv = (MrvlIEtypes_BtCoexScanTime_t *) tlv; + pScantlv = (MrvlIEtypes_BtCoexScanTime_t *)tlv; pmadapter->coex_scan = pScantlv->coex_scan; pmadapter->coex_min_scan_time = wlan_le16_to_cpu(pScantlv->min_scan_time); @@ -6889,10 +7285,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_802_11_supplicant_pmk(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_supplicant_pmk(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { MrvlIEtypes_PMK_t *ppmk_tlv = MNULL; MrvlIEtypes_Passphrase_t *ppassphrase_tlv = MNULL; @@ -6904,38 +7299,67 @@ t_u8 *ptlv_buffer = (t_u8 *)pesupplicant_psk->tlv_buffer; mlan_ds_sec_cfg *sec = (mlan_ds_sec_cfg *)pdata_buf; mlan_ds_passphrase *psk = MNULL; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u8 ssid_flag = 0, bssid_flag = 0, pmk_flag = 0, passphrase_flag = 0; t_u8 sae_password_flag = 0; + t_u8 zero[MLAN_MAX_KEY_LENGTH] = {0}; + MrvlIEtypes_fw_roam_enable_t *proam_tlv = MNULL; + MrvlIEtypes_keyParams_t *key_tlv = MNULL; + int length = 0; + t_u8 userset_passphrase = 0; ENTER(); - psk = (mlan_ds_passphrase *)&sec->param.passphrase; + if (sec->multi_passphrase) + psk = (mlan_ds_passphrase *)&sec->param + .roam_passphrase[userset_passphrase]; + else + psk = (mlan_ds_passphrase *)&sec->param.passphrase; + if (cmd_action == HostCmd_ACT_GEN_REMOVE) { + cmd->size = + sizeof(HostCmd_DS_802_11_SUPPLICANT_PMK) + S_DS_GEN - 1; + proam_tlv = (MrvlIEtypes_fw_roam_enable_t *)ptlv_buffer; + proam_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_ROAM); + proam_tlv->header.len = sizeof(MrvlIEtypes_fw_roam_enable_t) - + sizeof(MrvlIEtypesHeader_t); + proam_tlv->roam_enable = MTRUE; + ptlv_buffer += + (proam_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); + cmd->size += + (proam_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); + proam_tlv->header.len = wlan_cpu_to_le16(proam_tlv->header.len); - /* - * Parse the rest of the buf here - * 1) <ssid="valid ssid"> - This will get the passphrase, AKMP - * for specified ssid, if none specified then it will get all. - * Eg: iwpriv <mlanX> passphrase 0:ssid=nxp - * 2) <psk="psk">:<passphrase="passphare">:<bssid="00:50:43:ef:23:f3"> - * <ssid="valid ssid"> - passphrase and psk cannot be provided to - * the same SSID, Takes one SSID at a time, If ssid= is present - * the it should contain a passphrase or psk. If no arguments are - * provided then AKMP=802.1x, and passphrase should be provided - * after association. - * End of each parameter should be followed by a ':'(except for the - * last parameter) as the delimiter. If ':' has to be used in - * an SSID then a '/' should be preceded to ':' as a escape. - * Eg:iwpriv <mlanX> passphrase - * "1:ssid=mrvl AP:psk=abcdefgh:bssid=00:50:43:ef:23:f3" - * iwpriv <mlanX> passphrase - * "1:ssid=nxp/: AP:psk=abcdefgd:bssid=00:50:43:ef:23:f3" - * iwpriv <mlanX> passphrase "1:ssid=mrvlAP:psk=abcdefgd" - * 3) <ssid="valid ssid"> - This will clear the passphrase - * for specified ssid, if none specified then it will clear all. - * Eg: iwpriv <mlanX> passphrase 2:ssid=nxp - */ + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_SUPPLICANT_PMK); + pesupplicant_psk->action = wlan_cpu_to_le16(cmd_action); + pesupplicant_psk->cache_result = 0; + cmd->size = wlan_cpu_to_le16(cmd->size); + LEAVE(); + return MLAN_STATUS_SUCCESS; + } - /* -1 is for t_u8 TlvBuffer[1] as this should not be included */ + // Parse the rest of the buf here + // 1) <ssid="valid ssid"> - This will get the passphrase, AKMP + // for specified ssid, if none specified then it will get all. + // Eg: iwpriv <mlanX> passphrase 0:ssid=nxp + // 2) <psk="psk">:<passphrase="passphare">:<bssid="00:50:43:ef:23:f3"> + // <ssid="valid ssid"> - passphrase and psk cannot be provided to + // the same SSID, Takes one SSID at a time, If ssid= is present + // the it should contain a passphrase or psk. If no arguments are + // provided then AKMP=802.1x, and passphrase should be provided + // after association. + // End of each parameter should be followed by a ':'(except for the + // last parameter) as the delimiter. If ':' has to be used in + // an SSID then a '/' should be preceded to ':' as a escape. + // Eg:iwpriv <mlanX> passphrase + // "1:ssid=mrvl AP:psk=abcdefgh:bssid=00:50:43:ef:23:f3" + // iwpriv <mlanX> passphrase + // "1:ssid=nxp/: AP:psk=abcdefgd:bssid=00:50:43:ef:23:f3" + // iwpriv <mlanX> passphrase "1:ssid=mrvlAP:psk=abcdefgd" + // 3) <ssid="valid ssid"> - This will clear the passphrase + // for specified ssid, if none specified then it will clear all. + // Eg: iwpriv <mlanX> passphrase 2:ssid=nxp + // + // + // -1 is for t_u8 TlvBuffer[1] as this should not be included */ cmd->size = sizeof(HostCmd_DS_802_11_SUPPLICANT_PMK) + S_DS_GEN - 1; if (psk && memcmp(pmpriv->adapter, (t_u8 *)&psk->bssid, zero_mac, sizeof(zero_mac))) { @@ -6965,66 +7389,136 @@ (ppmk_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); ppmk_tlv->header.len = wlan_cpu_to_le16(ppmk_tlv->header.len); pmk_flag = 1; + if (memcmp(pmpriv->adapter, psk->psk.pmk.pmk_r0, zero, + MLAN_MAX_KEY_LENGTH)) { + ppmk_tlv = (MrvlIEtypes_PMK_t *)ptlv_buffer; + ppmk_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_PMK_R0); + ppmk_tlv->header.len = MLAN_MAX_KEY_LENGTH; + memcpy_ext(pmpriv->adapter, ppmk_tlv->pmk, + psk->psk.pmk.pmk_r0, MLAN_MAX_KEY_LENGTH, + MLAN_MAX_KEY_LENGTH); + ptlv_buffer += (ppmk_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + cmd->size += (ppmk_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + ppmk_tlv->header.len = + wlan_cpu_to_le16(ppmk_tlv->header.len); + } + if (memcmp(pmpriv->adapter, psk->psk.pmk.pmk_r0_name, zero, + MLAN_MAX_PMKR0_NAME_LENGTH)) { + ppmk_tlv = (MrvlIEtypes_PMK_t *)ptlv_buffer; + ppmk_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_PMK_R0_NAME); + ppmk_tlv->header.len = MLAN_MAX_PMKR0_NAME_LENGTH; + memcpy_ext(pmpriv->adapter, ppmk_tlv->pmk, + psk->psk.pmk.pmk_r0_name, + MLAN_MAX_PMKR0_NAME_LENGTH, + MLAN_MAX_PMKR0_NAME_LENGTH); + ptlv_buffer += (ppmk_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + cmd->size += (ppmk_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + ppmk_tlv->header.len = + wlan_cpu_to_le16(ppmk_tlv->header.len); + } } - if (psk->ssid.ssid_len) { - pssid_tlv = (MrvlIEtypes_SsIdParamSet_t *)ptlv_buffer; - pssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_SSID); - pssid_tlv->header.len = (t_u16)MIN(MLAN_MAX_SSID_LENGTH, - psk->ssid.ssid_len); - memcpy_ext(pmpriv->adapter, (t_u8 *)pssid_tlv->ssid, - (t_u8 *)psk->ssid.ssid, psk->ssid.ssid_len, - MLAN_MAX_SSID_LENGTH); - ptlv_buffer += (pssid_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); - cmd->size += (pssid_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); - pssid_tlv->header.len = wlan_cpu_to_le16(pssid_tlv->header.len); - ssid_flag = 1; - } - if (psk->psk_type == MLAN_PSK_PASSPHRASE) { - ppassphrase_tlv = (MrvlIEtypes_Passphrase_t *)ptlv_buffer; - ppassphrase_tlv->header.type = - wlan_cpu_to_le16(TLV_TYPE_PASSPHRASE); - ppassphrase_tlv->header.len = - (t_u16)MIN(MLAN_MAX_PASSPHRASE_LENGTH, - psk->psk.passphrase.passphrase_len); - memcpy_ext(pmpriv->adapter, ppassphrase_tlv->passphrase, - psk->psk.passphrase.passphrase, - psk->psk.passphrase.passphrase_len, - MLAN_MAX_PASSPHRASE_LENGTH); - ptlv_buffer += (ppassphrase_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); - cmd->size += (ppassphrase_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); - ppassphrase_tlv->header.len = - wlan_cpu_to_le16(ppassphrase_tlv->header.len); - passphrase_flag = 1; - } - if (psk->psk_type == MLAN_PSK_SAE_PASSWORD) { - psae_password_tlv = (MrvlIEtypes_SAE_Password_t *) ptlv_buffer; - psae_password_tlv->header.type = - wlan_cpu_to_le16(TLV_TYPE_SAE_PASSWORD); - psae_password_tlv->header.len = - (t_u16)MIN(MLAN_MAX_SAE_PASSWORD_LENGTH, - psk->psk.sae_password.sae_password_len); - memcpy_ext(pmpriv->adapter, psae_password_tlv->sae_password, - psk->psk.sae_password.sae_password, - psk->psk.sae_password.sae_password_len, - MLAN_MAX_SAE_PASSWORD_LENGTH); + if (pmpriv->adapter->fw_roaming && + (pmpriv->adapter->userset_passphrase || + (psk && psk->psk_type == MLAN_PSK_PMK))) { + proam_tlv = (MrvlIEtypes_fw_roam_enable_t *)ptlv_buffer; + proam_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_ROAM); + proam_tlv->header.len = sizeof(MrvlIEtypes_fw_roam_enable_t) - + sizeof(MrvlIEtypesHeader_t); + proam_tlv->roam_enable = MTRUE; + proam_tlv->userset_passphrase = + pmpriv->adapter->userset_passphrase; ptlv_buffer += - (psae_password_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); + (proam_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); cmd->size += - (psae_password_tlv->header.len + - sizeof(MrvlIEtypesHeader_t)); - psae_password_tlv->header.len = - wlan_cpu_to_le16(psae_password_tlv->header.len); - sae_password_flag = 1; + (proam_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); + proam_tlv->header.len = wlan_cpu_to_le16(proam_tlv->header.len); } + do { + if (pmpriv->adapter->userset_passphrase && + sec->multi_passphrase) { + key_tlv = (MrvlIEtypes_keyParams_t *)ptlv_buffer; + key_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_ROAM_OFFLOAD_USER_SET_PMK); + ptlv_buffer += sizeof(MrvlIEtypesHeader_t); + cmd->size += sizeof(MrvlIEtypesHeader_t); + length = cmd->size; + } + if (psk->ssid.ssid_len) { + pssid_tlv = (MrvlIEtypes_SsIdParamSet_t *)ptlv_buffer; + pssid_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_SSID); + pssid_tlv->header.len = (t_u16)MIN(MLAN_MAX_SSID_LENGTH, + psk->ssid.ssid_len); + memcpy_ext(pmpriv->adapter, (t_u8 *)pssid_tlv->ssid, + (t_u8 *)psk->ssid.ssid, psk->ssid.ssid_len, + MLAN_MAX_SSID_LENGTH); + ptlv_buffer += (pssid_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + cmd->size += (pssid_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + pssid_tlv->header.len = + wlan_cpu_to_le16(pssid_tlv->header.len); + ssid_flag = 1; + } + if (psk->psk_type == MLAN_PSK_PASSPHRASE) { + ppassphrase_tlv = + (MrvlIEtypes_Passphrase_t *)ptlv_buffer; + ppassphrase_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_PASSPHRASE); + ppassphrase_tlv->header.len = + (t_u16)MIN(MLAN_MAX_PASSPHRASE_LENGTH, + psk->psk.passphrase.passphrase_len); + memcpy_ext(pmpriv->adapter, ppassphrase_tlv->passphrase, + psk->psk.passphrase.passphrase, + psk->psk.passphrase.passphrase_len, + MLAN_MAX_PASSPHRASE_LENGTH); + ptlv_buffer += (ppassphrase_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + cmd->size += (ppassphrase_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + ppassphrase_tlv->header.len = + wlan_cpu_to_le16(ppassphrase_tlv->header.len); + passphrase_flag = 1; + } + if (psk->psk_type == MLAN_PSK_SAE_PASSWORD) { + psae_password_tlv = + (MrvlIEtypes_SAE_Password_t *)ptlv_buffer; + psae_password_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_SAE_PASSWORD); + psae_password_tlv->header.len = (t_u16)MIN( + MLAN_MAX_SAE_PASSWORD_LENGTH, + psk->psk.sae_password.sae_password_len); + memcpy_ext(pmpriv->adapter, + psae_password_tlv->sae_password, + psk->psk.sae_password.sae_password, + psk->psk.sae_password.sae_password_len, + MLAN_MAX_SAE_PASSWORD_LENGTH); + ptlv_buffer += (psae_password_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + cmd->size += (psae_password_tlv->header.len + + sizeof(MrvlIEtypesHeader_t)); + psae_password_tlv->header.len = + wlan_cpu_to_le16(psae_password_tlv->header.len); + sae_password_flag = 1; + } + if (key_tlv) + key_tlv->header.len = + wlan_cpu_to_le16(cmd->size - length); + userset_passphrase++; + psk = (mlan_ds_passphrase *)&sec->param + .roam_passphrase[userset_passphrase]; + } while (psk && sec->multi_passphrase && + userset_passphrase < pmpriv->adapter->userset_passphrase); + pmpriv->adapter->userset_passphrase = 0; if ((cmd_action == HostCmd_ACT_GEN_SET) && - ((ssid_flag || bssid_flag) && (!pmk_flag && !passphrase_flag) - && (!pmk_flag && !sae_password_flag) - )) { + ((ssid_flag || bssid_flag) && (!pmk_flag && !passphrase_flag) && + (!pmk_flag && !sae_password_flag))) { PRINTM(MERROR, "Invalid case,ssid/bssid present without pmk, passphrase or sae password\n"); LEAVE(); @@ -7047,10 +7541,9 @@ * * @return MLAN_STATUS_SUCCESS MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_supplicant_pmk(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_supplicant_pmk(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_SUPPLICANT_PMK *supplicant_pmk_resp = &resp->params.esupplicant_psk; @@ -7071,7 +7564,7 @@ ENTER(); tlv_buf_len = resp->size - - (sizeof(HostCmd_DS_802_11_SUPPLICANT_PMK) + S_DS_GEN - 1); + (sizeof(HostCmd_DS_802_11_SUPPLICANT_PMK) + S_DS_GEN - 1); if (pioctl_buf) { if (((mlan_ds_bss *)pioctl_buf->pbuf)->sub_command == @@ -7094,29 +7587,28 @@ if ((tlv != TLV_TYPE_SSID) && (tlv != TLV_TYPE_BSSID) && (tlv != TLV_TYPE_PASSPHRASE) && - (tlv != TLV_TYPE_PMK) - && (tlv != TLV_TYPE_SAE_PASSWORD) - ) + (tlv != TLV_TYPE_PMK) && + (tlv != TLV_TYPE_SAE_PASSWORD)) break; switch (tlv) { case TLV_TYPE_SSID: pssid_tlv = (MrvlIEtypes_SsIdParamSet_t *) - tlv_buf; + tlv_buf; pssid_tlv->header.len = - wlan_le16_to_cpu(pssid_tlv-> - header.len); - memcpy_ext(pmpriv->adapter, - sec->param.passphrase.ssid. - ssid, pssid_tlv->ssid, - pssid_tlv->header.len, - MLAN_MAX_SSID_LENGTH); + wlan_le16_to_cpu( + pssid_tlv->header.len); + memcpy_ext( + pmpriv->adapter, + sec->param.passphrase.ssid.ssid, + pssid_tlv->ssid, + pssid_tlv->header.len, + MLAN_MAX_SSID_LENGTH); sec->param.passphrase.ssid.ssid_len = MIN(MLAN_MAX_SSID_LENGTH, pssid_tlv->header.len); - tlv_buf += - pssid_tlv->header.len + - sizeof(MrvlIEtypesHeader_t); + tlv_buf += pssid_tlv->header.len + + sizeof(MrvlIEtypesHeader_t); tlv_buf_len -= (pssid_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); @@ -7125,16 +7617,15 @@ pbssid_tlv = (MrvlIEtypes_Bssid_t *)tlv_buf; pbssid_tlv->header.len = - wlan_le16_to_cpu(pbssid_tlv-> - header.len); + wlan_le16_to_cpu( + pbssid_tlv->header.len); memcpy_ext(pmpriv->adapter, &sec->param.passphrase.bssid, pbssid_tlv->bssid, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - tlv_buf += - pbssid_tlv->header.len + - sizeof(MrvlIEtypesHeader_t); + tlv_buf += pbssid_tlv->header.len + + sizeof(MrvlIEtypesHeader_t); tlv_buf_len -= (pbssid_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); @@ -7142,24 +7633,24 @@ case TLV_TYPE_PASSPHRASE: passphrase_tlv = (MrvlIEtypes_Passphrase_t *) - tlv_buf; - passphrase_tlv->header.len = - wlan_le16_to_cpu - (passphrase_tlv->header.len); + tlv_buf; + passphrase_tlv->header + .len = wlan_le16_to_cpu( + passphrase_tlv->header.len); sec->param.passphrase.psk_type = MLAN_PSK_PASSPHRASE; - sec->param.passphrase.psk.passphrase. - passphrase_len = + sec->param.passphrase.psk.passphrase + .passphrase_len = passphrase_tlv->header.len; - memcpy_ext(pmpriv->adapter, - sec->param.passphrase.psk. - passphrase.passphrase, - passphrase_tlv->passphrase, - passphrase_tlv->header.len, - MLAN_MAX_PASSPHRASE_LENGTH); - tlv_buf += - passphrase_tlv->header.len + - sizeof(MrvlIEtypesHeader_t); + memcpy_ext( + pmpriv->adapter, + sec->param.passphrase.psk + .passphrase.passphrase, + passphrase_tlv->passphrase, + passphrase_tlv->header.len, + MLAN_MAX_PASSPHRASE_LENGTH); + tlv_buf += passphrase_tlv->header.len + + sizeof(MrvlIEtypesHeader_t); tlv_buf_len -= (passphrase_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); @@ -7167,23 +7658,23 @@ case TLV_TYPE_SAE_PASSWORD: psae_password_tlv = (MrvlIEtypes_SAE_Password_t *) - tlv_buf; - psae_password_tlv->header.len = - wlan_le16_to_cpu - (psae_password_tlv->header.len); + tlv_buf; + psae_password_tlv->header + .len = wlan_le16_to_cpu( + psae_password_tlv->header.len); sec->param.passphrase.psk_type = MLAN_PSK_SAE_PASSWORD; - sec->param.passphrase.psk.sae_password. - sae_password_len = + sec->param.passphrase.psk.sae_password + .sae_password_len = psae_password_tlv->header.len; - memcpy_ext(pmpriv->adapter, - sec->param.passphrase.psk. - sae_password.sae_password, - psae_password_tlv-> - sae_password, - psae_password_tlv->header. - len, - MLAN_MAX_SAE_PASSWORD_LENGTH); + memcpy_ext( + pmpriv->adapter, + sec->param.passphrase.psk + .sae_password + .sae_password, + psae_password_tlv->sae_password, + psae_password_tlv->header.len, + MLAN_MAX_SAE_PASSWORD_LENGTH); tlv_buf += psae_password_tlv->header.len + sizeof(MrvlIEtypesHeader_t); @@ -7193,19 +7684,18 @@ break; case TLV_TYPE_PMK: ppmk_tlv = (MrvlIEtypes_PMK_t *)tlv_buf; - ppmk_tlv->header.len = - wlan_le16_to_cpu(ppmk_tlv-> - header.len); + ppmk_tlv->header.len = wlan_le16_to_cpu( + ppmk_tlv->header.len); sec->param.passphrase.psk_type = MLAN_PSK_PMK; memcpy_ext(pmpriv->adapter, - sec->param.passphrase.psk. - pmk.pmk, ppmk_tlv->pmk, + sec->param.passphrase.psk.pmk + .pmk, + ppmk_tlv->pmk, ppmk_tlv->header.len, MLAN_MAX_KEY_LENGTH); - tlv_buf += - ppmk_tlv->header.len + - sizeof(MrvlIEtypesHeader_t); + tlv_buf += ppmk_tlv->header.len + + sizeof(MrvlIEtypesHeader_t); tlv_buf_len -= (ppmk_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); @@ -7215,7 +7705,7 @@ #ifdef STA_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA && ((mlan_ds_bss *)pioctl_buf->pbuf)->sub_command == - MLAN_OID_BSS_FIND_BSS) { + MLAN_OID_BSS_FIND_BSS) { wlan_set_ewpa_mode(pmpriv, &sec->param.passphrase); ret = wlan_find_bss(pmpriv, pioctl_buf); @@ -7243,13 +7733,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_ind_rst_cfg(HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_ind_rst_cfg(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { - mlan_ds_ind_rst_cfg *pdata_ind_rst = (mlan_ds_ind_rst_cfg *) pdata_buf; + mlan_ds_ind_rst_cfg *pdata_ind_rst = (mlan_ds_ind_rst_cfg *)pdata_buf; HostCmd_DS_INDEPENDENT_RESET_CFG *ind_rst_cfg = - (HostCmd_DS_INDEPENDENT_RESET_CFG *) & cmd->params.ind_rst_cfg; + (HostCmd_DS_INDEPENDENT_RESET_CFG *)&cmd->params.ind_rst_cfg; ENTER(); @@ -7276,13 +7765,12 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_ind_rst_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_ind_rst_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; const HostCmd_DS_INDEPENDENT_RESET_CFG *ind_rst_cfg = - (HostCmd_DS_INDEPENDENT_RESET_CFG *) & resp->params.ind_rst_cfg; + (HostCmd_DS_INDEPENDENT_RESET_CFG *)&resp->params.ind_rst_cfg; ENTER(); @@ -7310,23 +7798,21 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_ps_inactivity_timeout(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_ps_inactivity_timeout(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { t_u16 timeout = *((t_u16 *)pdata_buf); HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT *ps_inact_tmo = - (HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT *) - & cmd->params.ps_inact_tmo; + (HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT *)&cmd->params + .ps_inact_tmo; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_PS_INACTIVITY_TIMEOUT); - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT) - + S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT) + S_DS_GEN); ps_inact_tmo->action = wlan_cpu_to_le16(cmd_action); if (cmd_action == HostCmd_ACT_GEN_SET) @@ -7344,9 +7830,8 @@ * @param cmd_action The action: GET * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_get_tsf(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action) +mlan_status wlan_cmd_get_tsf(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action) { ENTER(); @@ -7366,12 +7851,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_get_tsf(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_get_tsf(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc_cfg = MNULL; - HostCmd_DS_TSF *tsf_pointer = (HostCmd_DS_TSF *) & resp->params.tsf; + HostCmd_DS_TSF *tsf_pointer = (HostCmd_DS_TSF *)&resp->params.tsf; ENTER(); if (pioctl_buf) { @@ -7392,9 +7876,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_chan_region_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_chan_region_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; t_u16 action; @@ -7407,7 +7891,7 @@ ENTER(); - reg = (HostCmd_DS_CHAN_REGION_CFG *) & resp->params.reg_cfg; + reg = (HostCmd_DS_CHAN_REGION_CFG *)&resp->params.reg_cfg; if (!reg) { ret = MLAN_STATUS_FAILURE; goto done; @@ -7425,9 +7909,12 @@ /* Add FW cfp tables and region info */ wlan_add_fw_cfp_tables(pmpriv, tlv_buf, tlv_buf_left); if (pmadapter->otp_region) { - wlan_set_regiontable(pmpriv, - (t_u8)pmadapter->region_code, - pmadapter->fw_bands); + if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, + pmadapter->fw_bands)) { + PRINTM(MERROR, + "Set region table failure!! region_code = 0x%X, fw_bands = 0x%X\n", + pmadapter->region_code, pmadapter->fw_bands); + } } if (!pioctl_buf) goto done; @@ -7440,8 +7927,8 @@ misc_cfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; if (misc_cfg->sub_command == MLAN_OID_MISC_GET_REGIONPWR_CFG) { - cfg = (mlan_ds_misc_chnrgpwr_cfg *) & (misc_cfg->param. - rgchnpwr_cfg); + cfg = (mlan_ds_misc_chnrgpwr_cfg *)&( + misc_cfg->param.rgchnpwr_cfg); cfg->length = wlan_le16_to_cpu(resp->size); memcpy_ext(pmpriv->adapter, cfg->chnrgpwr_buf, (t_u8 *)resp, cfg->length, sizeof(cfg->chnrgpwr_buf)); @@ -7458,26 +7945,27 @@ misc_cfg->param.custom_reg_domain.num_bg_chan = pmadapter->tx_power_table_bg_rows; memcpy_ext(pmpriv->adapter, - (t_u8 *)misc_cfg->param.custom_reg_domain. - cfp_tbl, (t_u8 *)pmadapter->cfp_otp_bg, + (t_u8 *)misc_cfg->param.custom_reg_domain + .cfp_tbl, + (t_u8 *)pmadapter->cfp_otp_bg, pmadapter->tx_power_table_bg_rows * - sizeof(chan_freq_power_t), + sizeof(chan_freq_power_t), pmadapter->tx_power_table_bg_rows * - sizeof(chan_freq_power_t)); + sizeof(chan_freq_power_t)); } if (pmadapter->cfp_otp_a) { misc_cfg->param.custom_reg_domain.num_a_chan = pmadapter->tx_power_table_a_rows; memcpy_ext(pmpriv->adapter, - (t_u8 *)misc_cfg->param.custom_reg_domain. - cfp_tbl + - pmadapter->tx_power_table_bg_rows * - sizeof(chan_freq_power_t), + (t_u8 *)misc_cfg->param.custom_reg_domain + .cfp_tbl + + pmadapter->tx_power_table_bg_rows * + sizeof(chan_freq_power_t), (t_u8 *)pmadapter->cfp_otp_a, pmadapter->tx_power_table_a_rows * - sizeof(chan_freq_power_t), + sizeof(chan_freq_power_t), pmadapter->tx_power_table_a_rows * - sizeof(chan_freq_power_t)); + sizeof(chan_freq_power_t)); } } done: @@ -7494,13 +7982,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_packet_aggr_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_packet_aggr_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_PACKET_AGGR_CTRL *aggr_ctrl = &cmd->params.aggr_ctrl; - mlan_ds_misc_aggr_ctrl *aggr = (mlan_ds_misc_aggr_ctrl *) pdata_buf; + mlan_ds_misc_aggr_ctrl *aggr = (mlan_ds_misc_aggr_ctrl *)pdata_buf; ENTER(); @@ -7528,9 +8015,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_packet_aggr_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_packet_aggr_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; HostCmd_DS_PACKET_AGGR_CTRL *aggr_ctrl = &resp->params.aggr_ctrl; @@ -7557,7 +8044,7 @@ if (IS_USB(pmadapter->card_type)) { if (aggr_ctrl->aggr_enable & MBIT(0)) { if (!pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.enable) { + .aggr_ctrl.enable) { pmadapter->pcard_usb->usb_tx_aggr[0] .aggr_ctrl.enable = MTRUE; change = MTRUE; @@ -7565,7 +8052,7 @@ } else { if (pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.enable) { + .aggr_ctrl.enable) { pmadapter->pcard_usb->usb_tx_aggr[0] .aggr_ctrl.enable = MFALSE; change = MTRUE; @@ -7584,18 +8071,17 @@ for (i = 0; i < pmadapter->priv_num; ++i) { if (pmadapter->priv[i]) { pusb_tx_aggr = - wlan_get_usb_tx_aggr_params - (pmadapter, pmadapter->priv[i] - ->port); + wlan_get_usb_tx_aggr_params( + pmadapter, + pmadapter->priv[i] + ->port); if (pusb_tx_aggr && pusb_tx_aggr->aggr_ctrl.aggr_mode == - MLAN_USB_AGGR_MODE_LEN_V2) - pmadapter->priv[i]-> - intf_hr_len = + MLAN_USB_AGGR_MODE_LEN_V2) + pmadapter->priv[i]->intf_hr_len = MLAN_USB_TX_AGGR_HEADER; else - pmadapter->priv[i]-> - intf_hr_len = + pmadapter->priv[i]->intf_hr_len = USB_INTF_HEADER_LEN; } } @@ -7604,7 +8090,7 @@ #endif if (pioctl_buf) { misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - aggr = (mlan_ds_misc_aggr_ctrl *) & (misc->param.aggr_params); + aggr = (mlan_ds_misc_aggr_ctrl *)&(misc->param.aggr_params); if (aggr_ctrl->aggr_enable & MBIT(0)) aggr->tx.enable = MTRUE; else @@ -7615,7 +8101,7 @@ #if defined(USB) if (IS_USB(pmadapter->card_type)) aggr->tx.aggr_tmo = pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.aggr_tmo; + .aggr_ctrl.aggr_tmo; #endif } LEAVE(); @@ -7631,10 +8117,9 @@ * @param pdata_buf A void pointer to information buffer * @return N/A */ -mlan_status -wlan_cmd_fw_dump_event(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_fw_dump_event(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { ENTER(); @@ -7657,10 +8142,10 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE * */ -mlan_status -wlan_cmd_802_11_link_statistic(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_cmd_802_11_link_statistic(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + mlan_ioctl_req *pioctl_buf) { mlan_ds_get_info *info = (mlan_ds_get_info *)(pioctl_buf->pbuf); HostCmd_DS_802_11_LINK_STATISTIC *ll_stat = @@ -7677,12 +8162,11 @@ switch (cmd_action) { case HostCmd_ACT_GEN_SET: ll_params = - (wifi_link_layer_params *) info->param.link_statistic; + (wifi_link_layer_params *)info->param.link_statistic; ll_stat->mpdu_size_threshold = wlan_cpu_to_le32(ll_params->mpdu_size_threshold); - ll_stat->aggressive_statistics_gathering = - wlan_cpu_to_le32(ll_params-> - aggressive_statistics_gathering); + ll_stat->aggressive_statistics_gathering = wlan_cpu_to_le32( + ll_params->aggressive_statistics_gathering); break; case HostCmd_ACT_GEN_GET: /** ll_stat->stat_type = wlan_cpu_to_le16(stat_type); */ @@ -7698,18 +8182,17 @@ /** * @brief This function fill link layer statistic from firmware * - * @param priv A pointer to mlan_private - * structure + * @param priv A pointer to + * mlan_private structure * @param link_statistic_ioctl_buf, A pointer to fill ioctl buffer * @param resp A pointer to * HostCmd_DS_COMMAND * * @return MLAN_STATUS_SUCCESS */ -static void -wlan_fill_link_statistic(mlan_private *priv, - char *link_statistic_ioctl_buf, - HostCmd_DS_COMMAND *resp) +static void wlan_fill_link_statistic(mlan_private *priv, + char *link_statistic_ioctl_buf, + HostCmd_DS_COMMAND *resp) { char *link_statistic = link_statistic_ioctl_buf; wifi_radio_stat *radio_stat = MNULL; @@ -7721,12 +8204,14 @@ t_u16 left_len = 0, tlv_type = 0, tlv_len = 0; MrvlIEtypesHeader_t *tlv = MNULL; HostCmd_DS_802_11_LINK_STATISTIC *plink_stat = - (HostCmd_DS_802_11_LINK_STATISTIC *) & resp->params. - get_link_statistic; + (HostCmd_DS_802_11_LINK_STATISTIC *)&resp->params + .get_link_statistic; /* TLV parse */ - left_len = resp->size - sizeof(HostCmd_DS_802_11_LINK_STATISTIC) - - S_DS_GEN; + if (resp->size > (sizeof(HostCmd_DS_802_11_LINK_STATISTIC) - S_DS_GEN)) + left_len = resp->size - + sizeof(HostCmd_DS_802_11_LINK_STATISTIC) - S_DS_GEN; + tlv = (MrvlIEtypesHeader_t *)(plink_stat->value); DBG_HEXDUMP(MDAT_D, "tlv:", (void *)tlv, 1024); while (left_len > sizeof(MrvlIEtypesHeader_t)) { @@ -7735,13 +8220,13 @@ switch (tlv_type) { case TLV_TYPE_LL_STAT_IFACE: fw_ifaceStat = (mlan_wifi_iface_stat - *) ((t_u8 *)tlv + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + + sizeof(MrvlIEtypesHeader_t)); break; case TLV_TYPE_LL_STAT_RADIO: fw_radioStat = (mlan_wifi_radio_stat - *) ((t_u8 *)tlv + - sizeof(MrvlIEtypesHeader_t)); + *)((t_u8 *)tlv + + sizeof(MrvlIEtypesHeader_t)); num_radio = MAX_RADIO; break; default: @@ -7760,9 +8245,9 @@ *((t_u32 *)link_statistic) = num_radio; link_statistic += sizeof(num_radio); - /* Fill radio stats array */ + /* Fill radio stats array*/ for (i = 0; i < num_radio; i++) { - radio_stat = (wifi_radio_stat *) link_statistic; + radio_stat = (wifi_radio_stat *)link_statistic; link_statistic += sizeof(wifi_radio_stat); radio_stat->radio = wlan_le32_to_cpu(fw_radioStat[i].radio); @@ -7799,34 +8284,33 @@ } radio_stat->channels[chan_idx].channel.width = wlan_le32_to_cpu(fw_radioStat[i] - .channels[chan_idx] - .channel.width); + .channels[chan_idx] + .channel.width); radio_stat->channels[chan_idx].channel.center_freq = wlan_le32_to_cpu(fw_radioStat[i] - .channels[chan_idx] - .channel.center_freq); + .channels[chan_idx] + .channel.center_freq); radio_stat->channels[chan_idx].channel.center_freq0 = wlan_le32_to_cpu(fw_radioStat[i] - .channels[chan_idx] - .channel.center_freq0); + .channels[chan_idx] + .channel.center_freq0); radio_stat->channels[chan_idx].channel.center_freq1 = wlan_le32_to_cpu(fw_radioStat[i] - .channels[chan_idx] - .channel.center_freq1); + .channels[chan_idx] + .channel.center_freq1); radio_stat->channels[chan_idx] - .on_time = - wlan_le32_to_cpu(fw_radioStat[i]. - channels[chan_idx].on_time); + .on_time = wlan_le32_to_cpu( + fw_radioStat[i].channels[chan_idx].on_time); radio_stat->channels[chan_idx].cca_busy_time = wlan_le32_to_cpu(fw_radioStat[i] - .channels[chan_idx] - .cca_busy_time); + .channels[chan_idx] + .cca_busy_time); } } - /* Fill iface stats */ - iface_stat = (wifi_iface_stat *) link_statistic; + /* Fill iface stats*/ + iface_stat = (wifi_iface_stat *)link_statistic; /* get wifi_interface_link_layer_info in driver, not in firmware */ if (priv->bss_role == MLAN_BSS_ROLE_STA) { @@ -7899,21 +8383,17 @@ wlan_le32_to_cpu(fw_ifaceStat->ac[i].retries_short); iface_stat->ac[i].retries_long = wlan_le32_to_cpu(fw_ifaceStat->ac[i].retries_long); - iface_stat->ac[i].contention_time_min = - wlan_le32_to_cpu(fw_ifaceStat->ac[i]. - contention_time_min); - iface_stat->ac[i].contention_time_max = - wlan_le32_to_cpu(fw_ifaceStat->ac[i]. - contention_time_max); - iface_stat->ac[i].contention_time_avg = - wlan_le32_to_cpu(fw_ifaceStat->ac[i]. - contention_time_avg); - iface_stat->ac[i].contention_num_samples = - wlan_le32_to_cpu(fw_ifaceStat->ac[i]. - contention_num_samples); + iface_stat->ac[i].contention_time_min = wlan_le32_to_cpu( + fw_ifaceStat->ac[i].contention_time_min); + iface_stat->ac[i].contention_time_max = wlan_le32_to_cpu( + fw_ifaceStat->ac[i].contention_time_max); + iface_stat->ac[i].contention_time_avg = wlan_le32_to_cpu( + fw_ifaceStat->ac[i].contention_time_avg); + iface_stat->ac[i].contention_num_samples = wlan_le32_to_cpu( + fw_ifaceStat->ac[i].contention_num_samples); } - /* LL_STAT V3: STA-solution: support maxium 1 peers for AP */ + /* LL_STAT V3: STA-solution: support maxium 1 peers for AP*/ iface_stat->num_peers = wlan_le32_to_cpu(fw_ifaceStat->num_peers); for (peerIdx = 0; peerIdx < iface_stat->num_peers; peerIdx++) { iface_stat->peer_info[peerIdx].type = @@ -7922,12 +8402,10 @@ iface_stat->peer_info[peerIdx].peer_mac_address, fw_ifaceStat->peer_info[peerIdx].peer_mac_address, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - iface_stat->peer_info[peerIdx].capabilities = - wlan_le32_to_cpu(fw_ifaceStat->peer_info[peerIdx]. - capabilities); - iface_stat->peer_info[peerIdx].num_rate = - wlan_le32_to_cpu(fw_ifaceStat->peer_info[peerIdx]. - num_rate); + iface_stat->peer_info[peerIdx].capabilities = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx].capabilities); + iface_stat->peer_info[peerIdx].num_rate = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx].num_rate); PRINTM(MINFO, "bitrate tx_mpdu rx_mpdu mpdu_lost retries retries_short retries_long\n"); @@ -7935,73 +8413,73 @@ rate_idx < iface_stat->peer_info[peerIdx].num_rate; rate_idx++) { wlan_fill_hal_wifi_rate(priv, - &fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .rate, + &fw_ifaceStat + ->peer_info[peerIdx] + .rate_stats[rate_idx] + .rate, &iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .rate); + .rate_stats[rate_idx] + .rate); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .tx_mpdu = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .tx_mpdu); + .tx_mpdu = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .tx_mpdu); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .rx_mpdu = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .rx_mpdu); + .rx_mpdu = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .rx_mpdu); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .mpdu_lost = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .mpdu_lost); + .mpdu_lost = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .mpdu_lost); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .retries = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .retries); + .retries = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .retries_short = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .retries_short); + .retries_short = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries_short); iface_stat->peer_info[peerIdx] .rate_stats[rate_idx] - .retries_long = - wlan_le32_to_cpu(fw_ifaceStat-> - peer_info[peerIdx] - .rate_stats[rate_idx] - .retries_long); + .retries_long = wlan_le32_to_cpu( + fw_ifaceStat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries_long); PRINTM(MDAT_D, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .rate.bitrate, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .tx_mpdu, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .rx_mpdu, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .mpdu_lost, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .retries, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .retries_short, iface_stat->peer_info[peerIdx] - .rate_stats[rate_idx] - .retries_long); + .rate_stats[rate_idx] + .rate.bitrate, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .tx_mpdu, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .rx_mpdu, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .mpdu_lost, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries_short, + iface_stat->peer_info[peerIdx] + .rate_stats[rate_idx] + .retries_long); } } } @@ -8015,10 +8493,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_get_link_statistic(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_get_link_statistic(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_get_info *info; t_u8 *link_statistic = MNULL; @@ -8059,10 +8536,8 @@ * @param pdata_buf A void pointer to information buffer * @return MLAN_STATUS_SUCCESS/ MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_boot_sleep(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf) +mlan_status wlan_cmd_boot_sleep(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_BOOT_SLEEP *boot_sleep = MNULL; t_u16 enable = *(t_u16 *)pdata_buf; @@ -8089,9 +8564,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_boot_sleep(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_boot_sleep(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_BOOT_SLEEP *boot_sleep = &resp->params.boot_sleep; mlan_ds_misc_cfg *cfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; @@ -8117,12 +8591,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_crypto(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) +mlan_status wlan_cmd_crypto(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) { HostCmd_DS_CRYPTO *cry_cmd = &cmd->params.crypto_cmd; - mlan_ds_sup_cfg *cfg = (mlan_ds_sup_cfg *) pdata_buf; + mlan_ds_sup_cfg *cfg = (mlan_ds_sup_cfg *)pdata_buf; #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) subcmd_prf_hmac_sha1_t *prf_hmac_sha1 = MNULL; subcmd_hmac_sha1_t *hmac_sha1 = MNULL; @@ -8147,10 +8620,10 @@ #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) case HostCmd_CMD_CRYPTO_SUBCMD_PRF_HMAC_SHA1: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_PREFIX | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_PREFIX | + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - prf_hmac_sha1 = (subcmd_prf_hmac_sha1_t *) cry_cmd->subCmd; + prf_hmac_sha1 = (subcmd_prf_hmac_sha1_t *)cry_cmd->subCmd; prf_hmac_sha1->output_len = cfg->output_len; /* set tlv start */ ptlv = prf_hmac_sha1->tlv; @@ -8158,9 +8631,9 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_HMAC_SHA1: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - hmac_sha1 = (subcmd_hmac_sha1_t *) cry_cmd->subCmd; + hmac_sha1 = (subcmd_hmac_sha1_t *)cry_cmd->subCmd; hmac_sha1->output_len = cfg->output_len; hmac_sha1->data_blks_nr = cfg->data_blks_nr; /* set tlv start */ @@ -8169,9 +8642,9 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_HMAC_SHA256: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - hmac_sha256 = (subcmd_hmac_sha256_t *) cry_cmd->subCmd; + hmac_sha256 = (subcmd_hmac_sha256_t *)cry_cmd->subCmd; hmac_sha256->output_len = cfg->output_len; hmac_sha256->data_blks_nr = cfg->data_blks_nr; /* set tlv start */ @@ -8181,7 +8654,7 @@ case HostCmd_CMD_CRYPTO_SUBCMD_SHA256: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - sha256 = (subcmd_sha256_t *) cry_cmd->subCmd; + sha256 = (subcmd_sha256_t *)cry_cmd->subCmd; sha256->output_len = cfg->output_len; sha256->data_blks_nr = cfg->data_blks_nr; /* set tlv start */ @@ -8190,9 +8663,9 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_RIJNDAEL: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - rijndael = (subcmd_rijndael_t *) cry_cmd->subCmd; + rijndael = (subcmd_rijndael_t *)cry_cmd->subCmd; rijndael->sub_action_code = cfg->sub_action_code; rijndael->output_len = cfg->output_len; /* set tlv start */ @@ -8201,10 +8674,10 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_RC4: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_IV | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_IV | + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - rc4 = (subcmd_rc4_t *) cry_cmd->subCmd; + rc4 = (subcmd_rc4_t *)cry_cmd->subCmd; rc4->skip_bytes = cfg->skip_bytes; rc4->output_len = cfg->output_len; /* set tlv start */ @@ -8213,9 +8686,9 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_MD5: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - md5 = (subcmd_md5_t *) cry_cmd->subCmd; + md5 = (subcmd_md5_t *)cry_cmd->subCmd; md5->output_len = cfg->output_len; /* set tlv start */ ptlv = md5->tlv; @@ -8223,9 +8696,9 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_MRVL_F: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - mrvl_f = (subcmd_mrvl_f_t *) cry_cmd->subCmd; + mrvl_f = (subcmd_mrvl_f_t *)cry_cmd->subCmd; mrvl_f->iterations = cfg->iteration; mrvl_f->count = cfg->count; mrvl_f->output_len = cfg->output_len; @@ -8235,10 +8708,10 @@ break; case HostCmd_CMD_CRYPTO_SUBCMD_SHA256_KDF: tlv_bitmap = BIT_TLV_TYPE_CRYPTO_KEY | - BIT_TLV_TYPE_CRYPTO_KEY_PREFIX | - BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; + BIT_TLV_TYPE_CRYPTO_KEY_PREFIX | + BIT_TLV_TYPE_CRYPTO_KEY_DATA_BLK; /* set subcmd start */ - sha256_kdf = (subcmd_sha256_kdf_t *) cry_cmd->subCmd; + sha256_kdf = (subcmd_sha256_kdf_t *)cry_cmd->subCmd; sha256_kdf->output_len = cfg->output_len; /* set tlv start */ ptlv = sha256_kdf->tlv; @@ -8319,15 +8792,14 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_crypto(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_crypto(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CRYPTO *crypto_cmd = &resp->params.crypto_cmd; #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (pmlan_callbacks)&pmadapter->callbacks; - mlan_ds_sup_cfg *cfg = (mlan_ds_sup_cfg *) pioctl_buf->pbuf; + mlan_ds_sup_cfg *cfg = (mlan_ds_sup_cfg *)pioctl_buf->pbuf; #endif ENTER(); @@ -8340,7 +8812,7 @@ /* copy the result */ memcpy_ext(pmpriv->adapter, cfg->output, (t_u8 *)crypto_cmd + sizeof(HostCmd_DS_CRYPTO) + - sizeof(cfg->output_len), + sizeof(cfg->output_len), cfg->output_len, cfg->output_len); } @@ -8367,9 +8839,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_mac_address(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action) +mlan_status wlan_cmd_802_11_mac_address(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action) { ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_MAC_ADDRESS); @@ -8398,10 +8870,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_802_11_mac_address(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_mac_address(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_MAC_ADDRESS *pmac_addr = &resp->params.mac_addr; mlan_ds_bss *bss = MNULL; @@ -8433,15 +8904,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_rxabortcfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf) +mlan_status wlan_cmd_rxabortcfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CMD_RX_ABORT_CFG *cfg_cmd = - (HostCmd_DS_CMD_RX_ABORT_CFG *) & cmd->params.rx_abort_cfg; - mlan_ds_misc_rx_abort_cfg *cfg = - (mlan_ds_misc_rx_abort_cfg *) pdata_buf; + (HostCmd_DS_CMD_RX_ABORT_CFG *)&cmd->params.rx_abort_cfg; + mlan_ds_misc_rx_abort_cfg *cfg = (mlan_ds_misc_rx_abort_cfg *)pdata_buf; ENTER(); @@ -8468,12 +8936,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_rxabortcfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_rxabortcfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_RX_ABORT_CFG *cfg_cmd = - (HostCmd_DS_CMD_RX_ABORT_CFG *) & resp->params.rx_abort_cfg; + (HostCmd_DS_CMD_RX_ABORT_CFG *)&resp->params.rx_abort_cfg; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8497,16 +8964,14 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_rxabortcfg_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_rxabortcfg_ext(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_CMD_RX_ABORT_CFG_EXT *cfg_cmd = - (HostCmd_DS_CMD_RX_ABORT_CFG_EXT *) & cmd->params. - rx_abort_cfg_ext; + (HostCmd_DS_CMD_RX_ABORT_CFG_EXT *)&cmd->params.rx_abort_cfg_ext; mlan_ds_misc_rx_abort_cfg_ext *cfg = - (mlan_ds_misc_rx_abort_cfg_ext *) pdata_buf; + (mlan_ds_misc_rx_abort_cfg_ext *)pdata_buf; ENTER(); @@ -8534,13 +8999,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_rxabortcfg_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_rxabortcfg_ext(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_RX_ABORT_CFG_EXT *cfg_cmd = - (HostCmd_DS_CMD_RX_ABORT_CFG_EXT *) & resp->params. - rx_abort_cfg_ext; + (HostCmd_DS_CMD_RX_ABORT_CFG_EXT *)&resp->params + .rx_abort_cfg_ext; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8567,10 +9032,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_hal_phy_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) +mlan_status wlan_cmd_hal_phy_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) { HostCmd_DS_HAL_PHY_CFG *hal_phy_cfg_cmd = &cmd->params.hal_phy_cfg_params; @@ -8581,7 +9044,7 @@ cmd->command = wlan_cpu_to_le16(HostCmd_CMD_HAL_PHY_CFG); cmd->size = sizeof(HostCmd_DS_HAL_PHY_CFG) + S_DS_GEN; hal_phy_cfg_cmd->action = wlan_cpu_to_le16(cmd_action); - hal_phy_cfg_params = (mlan_ds_hal_phy_cfg_params *) pdata_buf; + hal_phy_cfg_params = (mlan_ds_hal_phy_cfg_params *)pdata_buf; hal_phy_cfg_cmd->dot11b_psd_mask_cfg = hal_phy_cfg_params->dot11b_psd_mask_cfg; cmd->size = wlan_cpu_to_le16(cmd->size); @@ -8598,12 +9061,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_hal_phy_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_hal_phy_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_HAL_PHY_CFG *cfg_cmd = - (HostCmd_DS_HAL_PHY_CFG *) & resp->params.hal_phy_cfg_params; + (HostCmd_DS_HAL_PHY_CFG *)&resp->params.hal_phy_cfg_params; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8617,6 +9079,29 @@ return MLAN_STATUS_SUCCESS; } +mlan_status wlan_cmd_ips_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_IPS_CONFIG *ips_cfg = MNULL; + t_u32 enable = *(t_u32 *)pdata_buf; + + ENTER(); + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_IPS_CONFIG); + ips_cfg = &cmd->params.ips_cfg; + ips_cfg->enable = wlan_cpu_to_le32(enable); + cmd->size = S_DS_GEN + sizeof(HostCmd_DS_IPS_CONFIG); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +mlan_status wlan_ret_ips_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + ENTER(); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function prepares command of Dot11mc unassoc ftm cfg * @@ -8626,23 +9111,22 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_dot11mc_unassoc_ftm_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_dot11mc_unassoc_ftm_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *cfg_cmd = - (HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *) & cmd->params. - dot11mc_unassoc_ftm_cfg; + (HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *)&cmd->params + .dot11mc_unassoc_ftm_cfg; mlan_ds_misc_dot11mc_unassoc_ftm_cfg *cfg = - (mlan_ds_misc_dot11mc_unassoc_ftm_cfg *) pdata_buf; + (mlan_ds_misc_dot11mc_unassoc_ftm_cfg *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_DOT11MC_UNASSOC_FTM_CFG); - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG) - + S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG) + S_DS_GEN); cfg_cmd->action = wlan_cpu_to_le16(cmd_action); if (cmd_action == HostCmd_ACT_GEN_SET) { @@ -8662,14 +9146,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_dot11mc_unassoc_ftm_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_dot11mc_unassoc_ftm_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *cfg_cmd = - (HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *) & resp->params. - dot11mc_unassoc_ftm_cfg; + (HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG *)&resp->params + .dot11mc_unassoc_ftm_cfg; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8692,16 +9175,15 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_tx_ampdu_prot_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_tx_ampdu_prot_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *cfg_cmd = - (HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *) & cmd->params. - tx_ampdu_prot_mode; + (HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *)&cmd->params + .tx_ampdu_prot_mode; mlan_ds_misc_tx_ampdu_prot_mode *cfg = - (mlan_ds_misc_tx_ampdu_prot_mode *) pdata_buf; + (mlan_ds_misc_tx_ampdu_prot_mode *)pdata_buf; ENTER(); @@ -8727,14 +9209,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_tx_ampdu_prot_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_tx_ampdu_prot_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *cfg_cmd = - (HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *) & resp->params. - tx_ampdu_prot_mode; + (HostCmd_DS_CMD_TX_AMPDU_PROT_MODE *)&resp->params + .tx_ampdu_prot_mode; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8757,15 +9238,14 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_rate_adapt_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_rate_adapt_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_CMD_RATE_ADAPT_CFG *cfg_cmd = - (HostCmd_DS_CMD_RATE_ADAPT_CFG *) & cmd->params.rate_adapt_cfg; + (HostCmd_DS_CMD_RATE_ADAPT_CFG *)&cmd->params.rate_adapt_cfg; mlan_ds_misc_rate_adapt_cfg *cfg = - (mlan_ds_misc_rate_adapt_cfg *) pdata_buf; + (mlan_ds_misc_rate_adapt_cfg *)pdata_buf; ENTER(); @@ -8794,12 +9274,12 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_rate_adapt_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_rate_adapt_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_RATE_ADAPT_CFG *cfg_cmd = - (HostCmd_DS_CMD_RATE_ADAPT_CFG *) & resp->params.rate_adapt_cfg; + (HostCmd_DS_CMD_RATE_ADAPT_CFG *)&resp->params.rate_adapt_cfg; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8828,16 +9308,14 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_cck_desense_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_cck_desense_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_CMD_CCK_DESENSE_CFG *cfg_cmd = - (HostCmd_DS_CMD_CCK_DESENSE_CFG *) & cmd->params. - cck_desense_cfg; + (HostCmd_DS_CMD_CCK_DESENSE_CFG *)&cmd->params.cck_desense_cfg; mlan_ds_misc_cck_desense_cfg *cfg = - (mlan_ds_misc_cck_desense_cfg *) pdata_buf; + (mlan_ds_misc_cck_desense_cfg *)pdata_buf; ENTER(); @@ -8867,13 +9345,12 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_cck_desense_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_cck_desense_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_CCK_DESENSE_CFG *cfg_cmd = - (HostCmd_DS_CMD_CCK_DESENSE_CFG *) & resp->params. - cck_desense_cfg; + (HostCmd_DS_CMD_CCK_DESENSE_CFG *)&resp->params.cck_desense_cfg; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -8903,10 +9380,9 @@ * @param pdata_buf A void pointer to information buffer * @return N/A */ -mlan_status -wlan_cmd_config_dyn_bw(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_config_dyn_bw(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_DYN_BW *dyn_bw_cmd = &cmd->params.dyn_bw; @@ -8931,9 +9407,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_dyn_bw(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_dyn_bw(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *cfg = MNULL; HostCmd_DS_DYN_BW *dyn_bw = &resp->params.dyn_bw; @@ -8959,14 +9434,13 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_get_chan_trpc_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_get_chan_trpc_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CHANNEL_TRPC_CONFIG *trpc_cfg = &cmd->params.ch_trpc_config; mlan_ds_misc_chan_trpc_cfg *cfg = - (mlan_ds_misc_chan_trpc_cfg *) pdata_buf; + (mlan_ds_misc_chan_trpc_cfg *)pdata_buf; ENTER(); @@ -8978,7 +9452,6 @@ LEAVE(); return MLAN_STATUS_SUCCESS; } - /** * @brief This function prepares command of LOW_POWER_MODE_CFG * @@ -8988,10 +9461,10 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_set_get_low_power_mode_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_set_get_low_power_mode_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_LOW_POWER_MODE_CFG *lpm_cfg = &cmd->params.lpm_cfg; t_u16 lpm = *(t_u16 *)pdata_buf; @@ -9020,10 +9493,9 @@ * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_set_get_low_power_mode_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_set_get_low_power_mode_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_power_cfg *cfg = MNULL; HostCmd_DS_LOW_POWER_MODE_CFG *lpm_cfg = &resp->params.lpm_cfg; @@ -9040,7 +9512,6 @@ LEAVE(); return MLAN_STATUS_SUCCESS; } - /** * @brief This function handles the command response of * packet aggregation @@ -9051,10 +9522,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_get_chan_trpc_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_get_chan_trpc_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; HostCmd_DS_CHANNEL_TRPC_CONFIG *trpc_cfg = &resp->params.ch_trpc_config; @@ -9064,7 +9534,7 @@ ENTER(); if (pioctl_buf) { misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - cfg = (mlan_ds_misc_chan_trpc_cfg *) & (misc->param.trpc_cfg); + cfg = (mlan_ds_misc_chan_trpc_cfg *)&(misc->param.trpc_cfg); cfg->sub_band = wlan_le16_to_cpu(trpc_cfg->sub_band); cfg->length = wlan_le16_to_cpu(resp->size); memcpy_ext(pmadapter, cfg->trpc_buf, (t_u8 *)resp, cfg->length, @@ -9075,6 +9545,113 @@ } /** + * @brief This function prepares command of mc_aggr_cfg + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_mc_aggr_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_MC_AGGR_CFG *cfg_cmd = + (HostCmd_DS_MC_AGGR_CFG *)&cmd->params.mc_aggr_cfg; + mlan_ds_mc_aggr_cfg *cfg = (mlan_ds_mc_aggr_cfg *)pdata_buf; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MC_AGGR_CFG); + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_MC_AGGR_CFG) + S_DS_GEN); + cfg_cmd->action = wlan_cpu_to_le16(cmd_action); + + cfg_cmd->enable_bitmap = (t_u8)cfg->enable_bitmap; + cfg_cmd->mask_bitmap = (t_u8)cfg->mask_bitmap; + cfg_cmd->cts2self_offset = wlan_cpu_to_le16(cfg->cts2self_offset); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of mc_aggr_cfg + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_mc_aggr_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + HostCmd_DS_MC_AGGR_CFG *cfg_cmd = + (HostCmd_DS_MC_AGGR_CFG *)&resp->params.mc_aggr_cfg; + mlan_ds_misc_cfg *misc_cfg = MNULL; + + ENTER(); + + if (pioctl_buf) { + misc_cfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + misc_cfg->param.mc_aggr_cfg.enable_bitmap = + (t_u8)cfg_cmd->enable_bitmap; + misc_cfg->param.mc_aggr_cfg.mask_bitmap = + (t_u8)cfg_cmd->mask_bitmap; + misc_cfg->param.mc_aggr_cfg.cts2self_offset = + (t_u8)cfg_cmd->cts2self_offset; + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function prepares command of ch_load + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_get_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_GET_CH_LOAD *cfg_cmd = + (HostCmd_DS_GET_CH_LOAD *)&cmd->params.ch_load; + mlan_ds_ch_load *cfg = (mlan_ds_ch_load *)pdata_buf; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_GET_CH_LOAD); + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_GET_CH_LOAD) + S_DS_GEN); + cfg_cmd->action = wlan_cpu_to_le16(cmd_action); + cfg_cmd->ch_load = wlan_cpu_to_le16(cfg->ch_load_param); + cfg_cmd->noise = wlan_cpu_to_le16(cfg->noise); + cfg_cmd->rx_quality = wlan_cpu_to_le16(cfg->rx_quality); + cfg_cmd->duration = wlan_cpu_to_le16(cfg->duration); + cfg_cmd->cca_th = wlan_cpu_to_le16(cfg->cca_th); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of ch_load + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + ENTER(); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares command of RANGE_EXT * * @param pmpriv A pointer to mlan_private structure @@ -9083,9 +9660,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_range_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_range_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_RANGE_EXT *range_ext = &cmd->params.range_ext; t_u8 mode = *(t_u8 *)pdata_buf; @@ -9112,9 +9688,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_range_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_range_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc_cfg = MNULL; HostCmd_DS_RANGE_EXT *range_ext = &resp->params.range_ext; @@ -9132,3 +9707,59 @@ LEAVE(); return MLAN_STATUS_SUCCESS; } + +/** + * @brief This function prepares command of get_sensor_temp + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_get_sensor_temp(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action) +{ + ENTER(); + + if (cmd_action != HostCmd_ACT_GEN_GET) { + PRINTM(MERROR, "wlan_cmd_get_sensor_temp: support GET only.\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + cmd->command = wlan_cpu_to_le16(HostCmd_DS_GET_SENSOR_TEMP); + cmd->size = wlan_cpu_to_le16(S_DS_GEN + 4); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} +/** + * @brief This function handles the command response of get_sensor_temp + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_get_sensor_temp(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *pcfg = MNULL; + const HostCmd_DS_SENSOR_TEMP *pSensorT = &resp->params.temp_sensor; + + ENTER(); + + if (pioctl_buf) { + pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + pcfg->param.sensor_temp.temperature = + wlan_le32_to_cpu(pSensorT->temperature); + PRINTM(MCMND, "get SOC temperature %u C \n", + pSensorT->temperature); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +}
diff --git a/wlan_sd8987/mlan/mlan_decl.h b/wlan_sd8987/mlan/mlan_decl.h index 8ae44dc..3f43ae7 100755 --- a/wlan_sd8987/mlan/mlan_decl.h +++ b/wlan_sd8987/mlan/mlan_decl.h
@@ -3,7 +3,7 @@ * @brief This file declares the generic data structures and APIs. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "292.p15" +#define MLAN_RELEASE_VERSION "368.p3" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -98,6 +98,8 @@ /** MLAN FALSE */ #define MFALSE (0) +#define CHANNEL_SPEC_SNIFFER_MODE 1 + #ifndef MACSTR /** MAC address security format */ #define MACSTR "%02x:XX:XX:XX:%02x:%02x" @@ -127,13 +129,8 @@ /** Return aligned offset */ #define OFFSET_ALIGN_ADDR(p, a) (t_u32)(ALIGN_ADDR(p, a) - (t_ptr)p) -#if defined(WIFI_DIRECT_SUPPORT) /** Maximum BSS numbers */ #define MLAN_MAX_BSS_NUM (16) -#else -/** Maximum BSS numbers */ -#define MLAN_MAX_BSS_NUM (2) -#endif /** NET IP alignment */ #define MLAN_NET_IP_ALIGN 2 @@ -269,7 +266,7 @@ /** pcie card reset */ #define FW_RELOAD_PCIE_RESET 4 #endif -#define FW_RELOAD_SDIO_HW_RESET 5 +#define FW_RELOAD_SDIO_HW_RESET 5 #ifdef USB #define MLAN_USB_BLOCK_SIZE (512) @@ -295,10 +292,11 @@ #define MLAN_USB_TX_AGGR_TIMEOUT_MSEC MLAN_USB_TX_MIN_AGGR_TIMEOUT #define MLAN_USB_TX_AGGR_TIMEOUT_DYN (0xFFFF) #endif /*USB*/ + /** MLAN MAC Address Length */ #define MLAN_MAC_ADDR_LENGTH (6) /** MLAN 802.11 MAC Address */ - typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; +typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** MLAN Maximum SSID Length */ #define MLAN_MAX_SSID_LENGTH (32) @@ -374,6 +372,8 @@ #define CARD_TYPE_9177 0x09 /** 8801 card type */ #define CARD_TYPE_8801 0x0a +/** OWL card type */ +#define CARD_TYPE_NW62X 0x0b /** 9098 A0 reverion num */ #define CHIP_9098_REV_A0 1 @@ -405,6 +405,8 @@ #define CARD_TYPE_SD9177 (CARD_TYPE_9177 | (INTF_SD << 8)) /** SD8801 card type */ #define CARD_TYPE_SD8801 (CARD_TYPE_8801 | (INTF_SD << 8)) +/** SD_NW62X card type */ +#define CARD_TYPE_SDNW62X (CARD_TYPE_NW62X | (INTF_SD << 8)) #define IS_SD8887(ct) (CARD_TYPE_SD8887 == (ct)) #define IS_SD8897(ct) (CARD_TYPE_SD8897 == (ct)) @@ -416,6 +418,7 @@ #define IS_SD9098(ct) (CARD_TYPE_SD9098 == (ct)) #define IS_SD9177(ct) (CARD_TYPE_SD9177 == (ct)) #define IS_SD8801(ct) (CARD_TYPE_SD8801 == (ct)) +#define IS_SDNW62X(ct) (CARD_TYPE_SDNW62X == (ct)) /** SD8887 Card */ #define CARD_SD8887 "SD8887" @@ -424,21 +427,21 @@ /** SD8977 Card */ #define CARD_SD8977 "SD8977" /** SD8978 Card */ -#define CARD_SD8978 "SD8978" +#define CARD_SD8978 "SDIW416" /** SD8997 Card */ #define CARD_SD8997 "SD8997" /** SD8987 Card */ #define CARD_SD8987 "SD8987" /** SD9097 Card */ -#define CARD_SD9097 "SD9097" -/** SDIW620 Card */ -#define CARD_SDIW620 "SDIW620" +#define CARD_SD9097 "SDIW620" /** SD9098 Card */ #define CARD_SD9098 "SD9098" /** SD9177 Card */ -#define CARD_SD9177 "SD9177" +#define CARD_SD9177 "SDIW612" /** SD8801 Card */ #define CARD_SD8801 "SD8801" +/** SDNW62X Card */ +#define CARD_SDNW62X "SDNW62X" #endif #ifdef PCIE @@ -450,31 +453,36 @@ #define CARD_TYPE_PCIE9097 (CARD_TYPE_9097 | (INTF_PCIE << 8)) /** PCIE9098 card type */ #define CARD_TYPE_PCIE9098 (CARD_TYPE_9098 | (INTF_PCIE << 8)) +/** PCIENW62X card type */ +#define CARD_TYPE_PCIENW62X (CARD_TYPE_NW62X | (INTF_PCIE << 8)) #define IS_PCIE8897(ct) (CARD_TYPE_PCIE8897 == (ct)) #define IS_PCIE8997(ct) (CARD_TYPE_PCIE8997 == (ct)) #define IS_PCIE9097(ct) (CARD_TYPE_PCIE9097 == (ct)) #define IS_PCIE9098(ct) (CARD_TYPE_PCIE9098 == (ct)) +#define IS_PCIENW62X(ct) (CARD_TYPE_PCIENW62X == (ct)) /** PCIE8897 Card */ #define CARD_PCIE8897 "PCIE8897" /** PCIE8997 Card */ #define CARD_PCIE8997 "PCIE8997" /** PCIE9097 Card */ -#define CARD_PCIE9097 "PCIE9097" -/** PCIEIW620 Card */ -#define CARD_PCIEIW620 "PCIEIW620" +#define CARD_PCIE9097 "PCIEIW620" /** PCIE9000S Card */ #define CARD_PCIE9000S "PCIE9000S" /** PCIE9098 Card */ #define CARD_PCIE9098 "PCIE9098" /** PCIEAW690 Card */ #define CARD_PCIEAW690 "PCIEAW690" +/** PCIENW62X Card */ +#define CARD_PCIENW62X "PCIENW62X" +/** PCIEIW629 Card */ +#define CARD_PCIEIW629 "PCIEIW629" #endif #ifdef USB /** USB8801 card type */ -#define CARD_TYPE_USB8801 (CARD_TYPE_8801 | (INTF_USB << 8)) +#define CARD_TYPE_USB8801 (CARD_TYPE_8801 | (INTF_USB << 8)) /** USB8897 card type */ #define CARD_TYPE_USB8897 (CARD_TYPE_8897 | (INTF_USB << 8)) /** USB8997 card type */ @@ -485,6 +493,8 @@ #define CARD_TYPE_USB9098 (CARD_TYPE_9098 | (INTF_USB << 8)) /** USB9097 card type */ #define CARD_TYPE_USB9097 (CARD_TYPE_9097 | (INTF_USB << 8)) +/** USBNW62X card type */ +#define CARD_TYPE_USBNW62X (CARD_TYPE_NW62X | (INTF_USB << 8)) #define IS_USB8801(ct) (CARD_TYPE_USB8801 == (ct)) #define IS_USB8897(ct) (CARD_TYPE_USB8897 == (ct)) @@ -492,24 +502,25 @@ #define IS_USB8978(ct) (CARD_TYPE_USB8978 == (ct)) #define IS_USB9098(ct) (CARD_TYPE_USB9098 == (ct)) #define IS_USB9097(ct) (CARD_TYPE_USB9097 == (ct)) +#define IS_USBNW62X(ct) (CARD_TYPE_USBNW62X == (ct)) /** USB8801 Card */ -#define CARD_USB8801 "USB8801" +#define CARD_USB8801 "USB8801" /** USB8897 Card */ #define CARD_USB8897 "USB8897" /** USB8997 Card */ #define CARD_USB8997 "USB8997" /** USB8978 Card */ -#define CARD_USB8978 "USB8978" +#define CARD_USB8978 "USBIW416" /** USB9098 Card */ #define CARD_USB9098 "USB9098" /** USB9097 Card */ -#define CARD_USB9097 "USB9097" -/** USBIW620 Card */ -#define CARD_USBIW620 "USBIW620" +#define CARD_USB9097 "USBIW620" +/** USBNW62X Card */ +#define CARD_USBNW62X "USBNW62X" #endif -#define IS_CARD8801(ct) (CARD_TYPE_8801 == ((ct) & 0xf)) +#define IS_CARD8801(ct) (CARD_TYPE_8801 == ((ct)&0xf)) #define IS_CARD8887(ct) (CARD_TYPE_8887 == ((ct)&0xf)) #define IS_CARD8897(ct) (CARD_TYPE_8897 == ((ct)&0xf)) #define IS_CARD8977(ct) (CARD_TYPE_8977 == ((ct)&0xf)) @@ -518,6 +529,7 @@ #define IS_CARD9098(ct) (CARD_TYPE_9098 == ((ct)&0xf)) #define IS_CARD9097(ct) (CARD_TYPE_9097 == ((ct)&0xf)) #define IS_CARD9177(ct) (CARD_TYPE_9177 == ((ct)&0xf)) +#define IS_CARDNW62X(ct) (CARD_TYPE_NW62X == ((ct)&0xf)) typedef struct _card_type_entry { t_u16 card_type; @@ -577,6 +589,9 @@ /** Buffer flag for TX_STATUS */ #define MLAN_BUF_FLAG_TX_STATUS MBIT(10) +/** Buffer flag for NET_MONITOR */ +#define MLAN_BUF_FLAG_NET_MONITOR MBIT(11) + /** Buffer flag for NULL data packet */ #define MLAN_BUF_FLAG_NULL_PKT MBIT(12) /** Buffer flag for Diag pkt */ @@ -584,6 +599,8 @@ #define MLAN_BUF_FLAG_TX_CTRL MBIT(14) +#define MLAN_BUF_FLAG_MC_AGGR_PKT MBIT(17) + #ifdef DEBUG_LEVEL1 /** Debug level bit definition */ #define MMSG MBIT(0) @@ -612,6 +629,8 @@ /** Memory allocation type: DMA */ #define MLAN_MEM_DMA MBIT(0) +/** Memory allocation flag: ATOMIC */ +#define MLAN_MEM_FLAG_ATOMIC MBIT(1) /** Default memory allocation flag */ #define MLAN_MEM_DEF 0 @@ -670,6 +689,18 @@ #endif } mlan_buf_type; +#define SCAN_STATE_SCAN_START MBIT(0) +#define SCAN_STATE_EXT_SCAN MBIT(1) +#define SCAN_STATE_EXT_SCAN_ENH MBIT(2) +#define SCAN_STATE_EXT_SCAN_CANCEL MBIT(3) +#define SCAN_STATE_EXT_SCAN_CMDRESP MBIT(4) +#define SCAN_STATE_EXT_SCAN_ENH_CMDRESP MBIT(5) +#define SCAN_STATE_EXT_SCAN_CANCEL_CMDRESP MBIT(6) +#define SCAN_STATE_EXT_SCAN_RESULT MBIT(7) +#define SCAN_STATE_LAST_EXT_SCAN_RESULT MBIT(8) +#define SCAN_STATE_EXT_SCAN_STATUS MBIT(9) +#define SCAN_STATE_SCAN_COMPLETE MBIT(10) + #ifdef USB /** mlan_usb_ep */ typedef enum _mlan_usb_ep { @@ -693,6 +724,7 @@ #ifdef WIFI_DIRECT_SUPPORT MLAN_BSS_TYPE_WIFIDIRECT = 2, #endif + MLAN_BSS_TYPE_DFS = 8, MLAN_BSS_TYPE_ANY = 0xff, } mlan_bss_type; @@ -766,6 +798,7 @@ #if defined(PCIE) MLAN_EVENT_ID_SSU_DUMP_FILE = 0x00000039, #endif /* SSU_SUPPORT */ + MLAN_EVENT_ID_CSI = 0x00000040, /* Event generated by MLAN driver (MSB=1) */ MLAN_EVENT_ID_DRV_CONNECTED = 0x80000001, MLAN_EVENT_ID_DRV_DEFER_HANDLING = 0x80000002, @@ -788,6 +821,7 @@ #ifdef UAP_SUPPORT MLAN_EVENT_ID_DRV_UAP_CHAN_INFO = 0x80000020, #endif + MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT = 0x80000023, MLAN_EVENT_ID_DRV_ASSOC_FAILURE_LOGGER = 0x80000026, MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER = 0x80000027, MLAN_EVENT_ID_DRV_DISCONNECT_LOGGER = 0x80000028, @@ -842,7 +876,7 @@ #define OID_TYPE_CAL 0x2 #define OID_TYPE_DPD 0xa -#define UNKNOW_DPD_LENGTH 0xffffffff +#define UNKNOW_DPD_LENGTH 0xffffffff /** Custom data structure */ typedef struct _mlan_init_param { @@ -871,27 +905,32 @@ }; /** channel band */ -enum { BAND_2GHZ = 0, +enum { + BAND_2GHZ = 0, BAND_5GHZ = 1, - BAND_4GHZ = 2, + BAND_6GHZ = 2, + BAND_4GHZ = 3, }; /** channel offset */ -enum { SEC_CHAN_NONE = 0, +enum { + SEC_CHAN_NONE = 0, SEC_CHAN_ABOVE = 1, SEC_CHAN_5MHZ = 2, SEC_CHAN_BELOW = 3 }; /** channel bandwidth */ -enum { CHAN_BW_20MHZ = 0, +enum { + CHAN_BW_20MHZ = 0, CHAN_BW_10MHZ, CHAN_BW_40MHZ, CHAN_BW_80MHZ, }; /** scan mode */ -enum { SCAN_MODE_MANUAL = 0, +enum { + SCAN_MODE_MANUAL = 0, SCAN_MODE_ACS, SCAN_MODE_USER, }; @@ -923,26 +962,34 @@ DFS_W53_OLD = 2 } dfs_w53_cfg_t; +typedef enum _dfs_moe_t { + /** driver default DFS behavior */ + DFS_MODE_DEFAULT = 0, + /* disable DFS master when uap and station operate in same DFS channel + */ + DFS_MODE_ENH = 1, +} dfs_mode_t; + /** Band_Config_t */ typedef MLAN_PACK_START struct _Band_Config_t { #ifdef BIG_ENDIAN_SUPPORT /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=user*/ - t_u8 scanMode:2; + t_u8 scanMode : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ - t_u8 chan2Offset:2; + t_u8 chan2Offset : 2; /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth:2; + t_u8 chanWidth : 2; /** Band Info - (00)=2.4GHz, (01)=5GHz */ - t_u8 chanBand:2; + t_u8 chanBand : 2; #else /** Band Info - (00)=2.4GHz, (01)=5GHz */ - t_u8 chanBand:2; + t_u8 chanBand : 2; /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth:2; + t_u8 chanWidth : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ - t_u8 chan2Offset:2; + t_u8 chan2Offset : 2; /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=Adoption mode*/ - t_u8 scanMode:2; + t_u8 scanMode : 2; #endif } MLAN_PACK_END Band_Config_t; @@ -1022,17 +1069,56 @@ /** mlan_cmdresp_event data structure */ typedef struct _mlan_cmdresp_event { - /** BSS index number for multiple BSS support */ + /** BSS index number for multiple BSS support */ t_u32 bss_index; - /** Event ID */ + /** Event ID */ mlan_event_id event_id; - /** Event length */ + /** Event length */ t_u32 event_len; - /** resp buffer pointer */ + /** resp buffer pointer */ t_u8 *resp; } mlan_cmdresp_event, *pmlan_cmdresp_event; /** csi event data structure */ +typedef MLAN_PACK_START struct _csi_record_ds { + /** Length in DWORDS, including header */ + t_u16 Len; + /** CSI signature. 0xABCD fixed */ + t_u16 CSI_Sign; + /** User defined HeaderID */ + t_u32 CSI_HeaderID; + /** Packet info field */ + t_u16 PKT_info; + /** Frame control field for the received packet*/ + t_u16 FCF; + /** Timestamp when packet received */ + t_u64 TSF; + /** Received Packet Destination MAC Address */ + t_u8 Dst_MAC[6]; + /** Received Packet Source MAC Address */ + t_u8 Src_MAC[6]; + /** RSSI for antenna A */ + t_u8 Rx_RSSI_A; + /** RSSI for antenna B */ + t_u8 Rx_RSSI_B; + /** Noise floor for antenna A */ + t_u8 Rx_NF_A; + /** Noise floor for antenna A */ + t_u8 Rx_NF_B; + /** Rx signal strength above noise floor */ + t_u8 Rx_SINR; + /** Channel */ + t_u8 channel; + /** user defined Chip ID */ + t_u16 chip_id; + /** Reserved */ + t_u32 rsvd; + /** CSI data length in DWORDs */ + t_u32 CSI_Data_Length; + /** Start of CSI data */ + t_u8 CSI_Data[0]; + /** At the end of CSI raw data, user defined TailID of 4 bytes*/ +} MLAN_PACK_END csi_record_ds, *pcsi_record_ds; /** mlan_ioctl_req data structure */ typedef struct _mlan_ioctl_req { @@ -1060,26 +1146,70 @@ t_ptr reserved_1; } mlan_ioctl_req, *pmlan_ioctl_req; +typedef MLAN_PACK_START struct _mix_rate_info { + /** bit0: LGI: gi=0, SGI: gi= 1 */ + /** bit1-2: 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ + /** bit3-4: LG: format=0, HT: format=1, VHT: format=2 */ + /** bit5: LDPC: 0-not support, 1-support */ + /** bit6-7:reserved */ + t_u8 rate_info; + /** MCS index */ + t_u8 mcs_index; + /** bitrate, in 500Kbps */ + t_u16 bitrate; +} MLAN_PACK_END mix_rate_info, *pmix_rate_info; + +typedef MLAN_PACK_START struct _rxpd_extra_info { + /** flags */ + t_u8 flags; + /** channel.flags */ + t_u16 channel_flags; + /** mcs.known */ + t_u8 mcs_known; + /** mcs.flags */ + t_u8 mcs_flags; + /** vht sig1 */ + t_u32 vht_sig1; + /** vht sig2 */ + t_u32 vht_sig2; +} MLAN_PACK_END rxpd_extra_info, *prxpd_extra_info; + +typedef MLAN_PACK_START struct _radiotap_info { + /** Rate Info */ + mix_rate_info rate_info; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** band config */ + t_u8 band_config; + /** chan number */ + t_u8 chan_num; + t_u8 antenna; + /** extra rxpd info from FW */ + rxpd_extra_info extra_info; +} MLAN_PACK_END radiotap_info, *pradiotap_info; + /** txpower structure */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT /** Host tx power ctrl: 0x0: use fw setting for TX power 0x1: value specified in bit[6] and bit[5:0] are valid */ - t_u8 hostctl:1; + t_u8 hostctl : 1; /** Sign of the power specified in bit[5:0] */ - t_u8 sign:1; + t_u8 sign : 1; /** Power to be used for transmission(in dBm) */ - t_u8 abs_val:6; + t_u8 abs_val : 6; #else /** Power to be used for transmission(in dBm) */ - t_u8 abs_val:6; + t_u8 abs_val : 6; /** Sign of the power specified in bit[5:0] */ - t_u8 sign:1; + t_u8 sign : 1; /** Host tx power ctrl: 0x0: use fw setting for TX power 0x1: value specified in bit[6] and bit[5:0] are valid */ - t_u8 hostctl:1; + t_u8 hostctl : 1; #endif } MLAN_PACK_END tx_power_t; /* pkt_txctrl */ @@ -1111,6 +1241,25 @@ t_u8 rssi; } MLAN_PACK_END pkt_rxinfo, *ppkt_rxinfo; +#define MC_FLAG_RETRY MBIT(0) +#define MC_FLAG_START_CYCLE MBIT(1) +#define MC_FLAG_END_CYCLE MBIT(2) +#define MC_FLAG_START_AMPDU MBIT(3) +#define MC_FLAG_END_AMPDU MBIT(4) +/* mc pkt txcontrol */ +typedef MLAN_PACK_START struct _mc_txcontrol { + /** Data rate in mcs index, 0-7 */ + t_u8 mcs_index; + /** band width 0-20Mhz, 1-40Mhz */ + t_u8 bandwidth; + /** seq_num */ + t_u16 seq_num; + /** packet expiry time */ + t_u32 pkt_expiry; + /** mc_pkt_flags */ + t_u8 mc_pkt_flags; +} MLAN_PACK_END mc_txcontrol, *pmc_txcontrol; + /** mlan_buffer data structure */ typedef struct _mlan_buffer { /** Pointer to previous mlan_buffer */ @@ -1152,7 +1301,7 @@ t_u32 out_ts_usec; /** tx_seq_num */ t_u32 tx_seq_num; - /** Time stamp when packet is deque from rx_q(seconds) */ + /** Time stamp when packet is deque from rx_q(seconds) */ t_u32 extra_ts_sec; /** Time stamp when packet is dequed from rx_q(micro seconds) */ t_u32 extra_ts_usec; @@ -1162,6 +1311,7 @@ /** Use count for this buffer */ t_u32 use_count; union { + mc_txcontrol mc_tx_info; pkt_txctrl tx_info; pkt_rxinfo rx_info; } u; @@ -1228,8 +1378,8 @@ MLAN_WMM_STATS_ACTION_START = 0, MLAN_WMM_STATS_ACTION_STOP = 1, MLAN_WMM_STATS_ACTION_GET_CLR = 2, - MLAN_WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */ - MLAN_WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */ + MLAN_WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */ + MLAN_WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */ MLAN_WMM_STATS_ACTION_MAX } MLAN_PACK_END mlan_wmm_queue_stats_action_e; @@ -1255,7 +1405,7 @@ } MLAN_PACK_END wlan_ioctl_wmm_ts_status_t, /** Type definition of mlan_ds_wmm_ts_status for MLAN_OID_WMM_CFG_TS_STATUS */ -mlan_ds_wmm_ts_status, *pmlan_ds_wmm_ts_status; + mlan_ds_wmm_ts_status, *pmlan_ds_wmm_ts_status; /** Max Ie length */ #define MAX_IE_SIZE 256 @@ -1572,17 +1722,17 @@ /** wifi rate */ typedef struct { /** 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */ - t_u32 preamble:3; + t_u32 preamble : 3; /** 0:1x1, 1:2x2, 3:3x3, 4:4x4 */ - t_u32 nss:2; + t_u32 nss : 2; /** 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */ - t_u32 bw:3; + t_u32 bw : 3; /** OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps */ /** HT/VHT it would be mcs index */ - t_u32 rateMcsIdx:8; + t_u32 rateMcsIdx : 8; /** reserved */ - t_u32 reserved:16; + t_u32 reserved : 16; /** units of 100 Kbps */ t_u32 bitrate; } wifi_rate; @@ -1602,6 +1752,15 @@ t_u32 time_usec; } wifi_timeval; +#define timeval_to_msec(timeval) \ + (t_u64)((t_u64)(timeval.time_sec) * 1000 + \ + (t_u64)(timeval.time_usec) / 1000) +#define timeval_to_usec(timeval) \ + (t_u64)((t_u64)(timeval.time_sec) * 1000 * 1000 + \ + (t_u64)(timeval.time_usec)) +#define is_zero_timeval(timeval) \ + ((timeval.time_sec == 0) && (timeval.time_usec == 0)) + #define MAX_NUM_RATE 32 #define MAX_RADIO 2 #define MAX_NUM_CHAN 1 @@ -1683,15 +1842,6 @@ t_u32 cca_busy_time; } wifi_channel_stat; -#define timeval_to_msec(timeval) \ - (t_u64)((t_u64)(timeval.time_sec) * 1000 + \ - (t_u64)(timeval.time_usec) / 1000) -#define timeval_to_usec(timeval) \ - (t_u64)((t_u64)(timeval.time_sec) * 1000 * 1000 + \ - (t_u64)(timeval.time_usec)) -#define is_zero_timeval(timeval) \ - ((timeval.time_sec == 0) && (timeval.time_usec == 0)) - /** radio statistics */ typedef struct { /** wifi radio (if multiple radio supported) */ @@ -1705,7 +1855,7 @@ t_u32 reserved0; /** TBD: tx_time_per_levels: pointer to an array of radio transmit per * power levels in msecs accured over time */ - /* t_u32 *reserved1; */ + /* t_u32 *reserved1;*/ /** msecs the radio is in active receive (32 bits number accruing over * time) */ t_u32 rx_time; @@ -1815,7 +1965,7 @@ /** interface statistics */ typedef struct { /** wifi interface */ - /* wifi_interface_handle iface; */ + /* wifi_interface_handle iface;*/ /** current state of the interface */ mlan_interface_link_layer_info info; /** access point beacon received count from connected AP */ @@ -1887,7 +2037,16 @@ /** station stats */ typedef struct _sta_stats { + /** last_rx_in_msec */ t_u64 last_rx_in_msec; + /** rx_packets */ + t_u32 rx_packets; + /** tx packets */ + t_u32 tx_packets; + /** rx bytes */ + t_u32 rx_bytes; + /** tx bytes */ + t_u32 tx_bytes; } sta_stats; #ifdef PRAGMA_PACK @@ -1897,171 +2056,156 @@ /** mlan_callbacks data structure */ typedef struct _mlan_callbacks { /** moal_get_fw_data */ - mlan_status (*moal_get_fw_data) (t_void *pmoal, - t_u32 offset, t_u32 len, t_u8 *pbuf); - mlan_status (*moal_get_vdll_data) (t_void *pmoal, t_u32 len, - t_u8 *pbuf); + mlan_status (*moal_get_fw_data)(t_void *pmoal, t_u32 offset, t_u32 len, + t_u8 *pbuf); + mlan_status (*moal_get_vdll_data)(t_void *pmoal, t_u32 len, t_u8 *pbuf); /** moal_get_hw_spec_complete */ - mlan_status (*moal_get_hw_spec_complete) (t_void *pmoal, - mlan_status status, - pmlan_hw_info phw, - pmlan_bss_tbl ptbl); + mlan_status (*moal_get_hw_spec_complete)(t_void *pmoal, + mlan_status status, + pmlan_hw_info phw, + pmlan_bss_tbl ptbl); /** moal_init_fw_complete */ - mlan_status (*moal_init_fw_complete) (t_void *pmoal, - mlan_status status); + mlan_status (*moal_init_fw_complete)(t_void *pmoal, mlan_status status); /** moal_shutdown_fw_complete */ - mlan_status (*moal_shutdown_fw_complete) (t_void *pmoal, - mlan_status status); + mlan_status (*moal_shutdown_fw_complete)(t_void *pmoal, + mlan_status status); /** moal_send_packet_complete */ - mlan_status (*moal_send_packet_complete) (t_void *pmoal, - pmlan_buffer pmbuf, - mlan_status status); + mlan_status (*moal_send_packet_complete)(t_void *pmoal, + pmlan_buffer pmbuf, + mlan_status status); /** moal_recv_complete */ - mlan_status (*moal_recv_complete) (t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port, - mlan_status status); + mlan_status (*moal_recv_complete)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port, mlan_status status); /** moal_recv_packet */ - mlan_status (*moal_recv_packet) (t_void *pmoal, pmlan_buffer pmbuf); - /** moal_recv_amsdu_packet */ - mlan_status (*moal_recv_amsdu_packet) (t_void *pmoal, - pmlan_buffer pmbuf); + mlan_status (*moal_recv_packet)(t_void *pmoal, pmlan_buffer pmbuf); + /** moal_recv_amsdu_packet */ + mlan_status (*moal_recv_amsdu_packet)(t_void *pmoal, + pmlan_buffer pmbuf); /** moal_recv_event */ - mlan_status (*moal_recv_event) (t_void *pmoal, pmlan_event pmevent); + mlan_status (*moal_recv_event)(t_void *pmoal, pmlan_event pmevent); /** moal_ioctl_complete */ - mlan_status (*moal_ioctl_complete) (t_void *pmoal, - pmlan_ioctl_req pioctl_req, - mlan_status status); + mlan_status (*moal_ioctl_complete)(t_void *pmoal, + pmlan_ioctl_req pioctl_req, + mlan_status status); /** moal_alloc_mlan_buffer */ - mlan_status (*moal_alloc_mlan_buffer) (t_void *pmoal, - t_u32 size, ppmlan_buffer pmbuf); + mlan_status (*moal_alloc_mlan_buffer)(t_void *pmoal, t_u32 size, + ppmlan_buffer pmbuf); /** moal_free_mlan_buffer */ - mlan_status (*moal_free_mlan_buffer) (t_void *pmoal, - pmlan_buffer pmbuf); + mlan_status (*moal_free_mlan_buffer)(t_void *pmoal, pmlan_buffer pmbuf); #ifdef USB /** moal_write_data_async */ - mlan_status (*moal_write_data_async) (t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port); -#endif /* USB */ + mlan_status (*moal_write_data_async)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port); +#endif /* USB */ #if defined(SDIO) || defined(PCIE) /** moal_write_reg */ - mlan_status (*moal_write_reg) (t_void *pmoal, t_u32 reg, t_u32 data); + mlan_status (*moal_write_reg)(t_void *pmoal, t_u32 reg, t_u32 data); /** moal_read_reg */ - mlan_status (*moal_read_reg) (t_void *pmoal, t_u32 reg, t_u32 *data); -#endif /* SDIO || PCIE */ + mlan_status (*moal_read_reg)(t_void *pmoal, t_u32 reg, t_u32 *data); +#endif /* SDIO || PCIE */ /** moal_write_data_sync */ - mlan_status (*moal_write_data_sync) (t_void *pmoal, - pmlan_buffer pmbuf, - t_u32 port, t_u32 timeout); - /** moal_read_data_sync */ - mlan_status (*moal_read_data_sync) (t_void *pmoal, - pmlan_buffer pmbuf, + mlan_status (*moal_write_data_sync)(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, t_u32 timeout); + /** moal_read_data_sync */ + mlan_status (*moal_read_data_sync)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port, t_u32 timeout); /** moal_malloc */ - mlan_status (*moal_malloc) (t_void *pmoal, t_u32 size, - t_u32 flag, t_u8 **ppbuf); + mlan_status (*moal_malloc)(t_void *pmoal, t_u32 size, t_u32 flag, + t_u8 **ppbuf); /** moal_mfree */ - mlan_status (*moal_mfree) (t_void *pmoal, t_u8 *pbuf); + mlan_status (*moal_mfree)(t_void *pmoal, t_u8 *pbuf); /** moal_vmalloc */ - mlan_status (*moal_vmalloc) (t_void *pmoal, t_u32 size, t_u8 **ppbuf); + mlan_status (*moal_vmalloc)(t_void *pmoal, t_u32 size, t_u8 **ppbuf); /** moal_vfree */ - mlan_status (*moal_vfree) (t_void *pmoal, t_u8 *pbuf); + mlan_status (*moal_vfree)(t_void *pmoal, t_u8 *pbuf); #ifdef PCIE /** moal_malloc_consistent */ - mlan_status (*moal_malloc_consistent) (t_void *pmoal, - t_u32 size, t_u8 **ppbuf, - t_u64 *pbuf_pa); + mlan_status (*moal_malloc_consistent)(t_void *pmoal, t_u32 size, + t_u8 **ppbuf, t_u64 *pbuf_pa); /** moal_mfree_consistent */ - mlan_status (*moal_mfree_consistent) (t_void *pmoal, - t_u32 size, t_u8 *pbuf, - t_u64 buf_pa); + mlan_status (*moal_mfree_consistent)(t_void *pmoal, t_u32 size, + t_u8 *pbuf, t_u64 buf_pa); /** moal_map_memory */ - mlan_status (*moal_map_memory) (t_void *pmoal, t_u8 *pbuf, - t_u64 *pbuf_pa, t_u32 size, t_u32 flag); + mlan_status (*moal_map_memory)(t_void *pmoal, t_u8 *pbuf, + t_u64 *pbuf_pa, t_u32 size, t_u32 flag); /** moal_unmap_memory */ - mlan_status (*moal_unmap_memory) (t_void *pmoal, t_u8 *pbuf, - t_u64 buf_pa, t_u32 size, t_u32 flag); -#endif /* PCIE */ + mlan_status (*moal_unmap_memory)(t_void *pmoal, t_u8 *pbuf, + t_u64 buf_pa, t_u32 size, t_u32 flag); +#endif /* PCIE */ /** moal_memset */ - t_void *(*moal_memset) (t_void *pmoal, t_void *pmem, - t_u8 byte, t_u32 num); + t_void *(*moal_memset)(t_void *pmoal, t_void *pmem, t_u8 byte, + t_u32 num); /** moal_memcpy */ - t_void *(*moal_memcpy) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); + t_void *(*moal_memcpy)(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num); /** moal_memcpy_ext */ - t_void *(*moal_memcpy_ext) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num, - t_u32 dest_size); + t_void *(*moal_memcpy_ext)(t_void *pmoal, t_void *pdest, + const t_void *psrc, t_u32 num, + t_u32 dest_size); /** moal_memmove */ - t_void *(*moal_memmove) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); + t_void *(*moal_memmove)(t_void *pmoal, t_void *pdest, + const t_void *psrc, t_u32 num); /** moal_memcmp */ - t_s32 (*moal_memcmp) (t_void *pmoal, const t_void *pmem1, - const t_void *pmem2, t_u32 num); + t_s32 (*moal_memcmp)(t_void *pmoal, const t_void *pmem1, + const t_void *pmem2, t_u32 num); /** moal_udelay */ - t_void (*moal_udelay) (t_void *pmoal, t_u32 udelay); + t_void (*moal_udelay)(t_void *pmoal, t_u32 udelay); /** moal_usleep_range */ - t_void (*moal_usleep_range) (t_void *pmoal, - t_u32 min_delay, t_u32 max_delay); + t_void (*moal_usleep_range)(t_void *pmoal, t_u32 min_delay, + t_u32 max_delay); /** moal_get_boot_ktime */ - mlan_status (*moal_get_boot_ktime) (t_void *pmoal, t_u64 *pnsec); + mlan_status (*moal_get_boot_ktime)(t_void *pmoal, t_u64 *pnsec); /** moal_get_system_time */ - mlan_status (*moal_get_system_time) (t_void *pmoal, - t_u32 *psec, t_u32 *pusec); + mlan_status (*moal_get_system_time)(t_void *pmoal, t_u32 *psec, + t_u32 *pusec); /** moal_init_timer*/ - mlan_status (*moal_init_timer) (t_void *pmoal, - t_void **pptimer, - IN t_void (*callback) (t_void - *pcontext), - t_void *pcontext); + mlan_status (*moal_init_timer)(t_void *pmoal, t_void **pptimer, + IN t_void (*callback)(t_void *pcontext), + t_void *pcontext); /** moal_free_timer */ - mlan_status (*moal_free_timer) (t_void *pmoal, t_void *ptimer); + mlan_status (*moal_free_timer)(t_void *pmoal, t_void *ptimer); /** moal_start_timer*/ - mlan_status (*moal_start_timer) (t_void *pmoal, - t_void *ptimer, t_u8 periodic, - t_u32 msec); + mlan_status (*moal_start_timer)(t_void *pmoal, t_void *ptimer, + t_u8 periodic, t_u32 msec); /** moal_stop_timer*/ - mlan_status (*moal_stop_timer) (t_void *pmoal, t_void *ptimer); + mlan_status (*moal_stop_timer)(t_void *pmoal, t_void *ptimer); /** moal_init_lock */ - mlan_status (*moal_init_lock) (t_void *pmoal, t_void **pplock); + mlan_status (*moal_init_lock)(t_void *pmoal, t_void **pplock); /** moal_free_lock */ - mlan_status (*moal_free_lock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_free_lock)(t_void *pmoal, t_void *plock); /** moal_spin_lock */ - mlan_status (*moal_spin_lock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_spin_lock)(t_void *pmoal, t_void *plock); /** moal_spin_unlock */ - mlan_status (*moal_spin_unlock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_spin_unlock)(t_void *pmoal, t_void *plock); /** moal_print */ - t_void (*moal_print) (t_void *pmoal, t_u32 level, - char *pformat, IN ...); + t_void (*moal_print)(t_void *pmoal, t_u32 level, char *pformat, IN...); /** moal_print_netintf */ - t_void (*moal_print_netintf) (t_void *pmoal, - t_u32 bss_index, t_u32 level); + t_void (*moal_print_netintf)(t_void *pmoal, t_u32 bss_index, + t_u32 level); /** moal_assert */ - t_void (*moal_assert) (t_void *pmoal, t_u32 cond); + t_void (*moal_assert)(t_void *pmoal, t_u32 cond); /** moal_hist_data_add */ - t_void (*moal_hist_data_add) (t_void *pmoal, - t_u32 bss_index, t_u16 rx_rate, - t_s8 snr, t_s8 nflr, t_u8 antenna); - t_void (*moal_updata_peer_signal) (t_void *pmoal, - t_u32 bss_index, - t_u8 *peer_addr, t_s8 snr, - t_s8 nflr); - t_u64 (*moal_do_div) (t_u64 num, t_u32 base); + t_void (*moal_hist_data_add)(t_void *pmoal, t_u32 bss_index, + t_u16 rx_rate, t_s8 snr, t_s8 nflr, + t_u8 antenna); + t_void (*moal_updata_peer_signal)(t_void *pmoal, t_u32 bss_index, + t_u8 *peer_addr, t_s8 snr, t_s8 nflr); + t_u64 (*moal_do_div)(t_u64 num, t_u32 base); #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) - mlan_status (*moal_wait_hostcmd_complete) (t_void *pmoal, - t_u32 bss_index); - mlan_status (*moal_notify_hostcmd_complete) (t_void *pmoal, - t_u32 bss_index); + mlan_status (*moal_wait_hostcmd_complete)(t_void *pmoal, + t_u32 bss_index); + mlan_status (*moal_notify_hostcmd_complete)(t_void *pmoal, + t_u32 bss_index); #endif - void (*moal_tp_accounting) (t_void *pmoal, - t_void *buf, t_u32 drop_point); - void (*moal_tp_accounting_rx_param) (t_void *pmoal, - unsigned int type, - unsigned int rsvd1); - void (*moal_amsdu_tp_accounting) (t_void *pmoal, t_s32 delay, - t_s32 copy_delay); + void (*moal_tp_accounting)(t_void *pmoal, t_void *buf, + t_u32 drop_point); + void (*moal_tp_accounting_rx_param)(t_void *pmoal, unsigned int type, + unsigned int rsvd1); + void (*moal_amsdu_tp_accounting)(t_void *pmoal, t_s32 delay, + t_s32 copy_delay); } mlan_callbacks, *pmlan_callbacks; /** Parameter unchanged, use MLAN default setting */ @@ -2183,6 +2327,8 @@ t_u8 indication_gpio; /** Dynamic MIMO-SISO switch for hscfg*/ t_u8 hs_mimo_switch; + /** channel time and mode for DRCS*/ + t_u32 drcs_chantime_mode; #ifdef USB /** Tx CMD endpoint address */ t_u8 tx_cmd_ep; @@ -2193,6 +2339,8 @@ t_u8 rx_data_ep; /** Tx data endpoint address */ t_u8 tx_data_ep; + /** Tx data second endpoint address */ + t_u8 tx_data2_ep; #endif /** passive to active scan */ t_u8 passive_to_active_scan; @@ -2202,8 +2350,12 @@ t_u32 drv_mode; /** dfs w53 cfg */ t_u8 dfs53cfg; - /** extend enhance scan */ + /** dfs_offload */ + t_u8 dfs_offload; + /** extend enhance scan */ t_u8 ext_scan; + /* mcs32 setting */ + t_u8 mcs32; } mlan_device, *pmlan_device; /** MLAN API function prototype */ @@ -2285,4 +2437,6 @@ /** mlan unmask host interrupt */ MLAN_API mlan_status mlan_enable_host_int(t_void *padapter); +#define CSI_SIGNATURE 0xABCD + #endif /* !_MLAN_DECL_H_ */
diff --git a/wlan_sd8987/mlan/mlan_fw.h b/wlan_sd8987/mlan/mlan_fw.h index f3cc13e..ccb2204 100755 --- a/wlan_sd8987/mlan/mlan_fw.h +++ b/wlan_sd8987/mlan/mlan_fw.h
@@ -5,7 +5,7 @@ * in MLAN module. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -94,6 +94,9 @@ /** Setup the number of rates passed in the driver/firmware API */ #define A_SUPPORTED_RATES 9 +/** IEEEtypes Data Frame Subtype of QoS pkt */ +#define QOS_DATA 8 + /** CapInfo Short Slot Time Disabled */ /* #define SHORT_SLOT_TIME_DISABLED(CapInfo) * ((IEEEtypes_CapInfo_t)(CapInfo).short_slot_time = 0) */ @@ -245,7 +248,7 @@ #define MRVDRV_SNAP_HEADER_LEN 8 /** The number of times to try when polling for status bits */ -#define MAX_POLL_TRIES 100 +#define MAX_POLL_TRIES 300 /** The number of times to try when waiting for downloaded firmware to become active when multiple interface is present */ @@ -332,165 +335,199 @@ #define TLV_TYPE_HOST_MLME (PROPRIETARY_TLV_BASE_ID + 307) /** TLV type : AP wacp mode */ -#define TLV_TYPE_UAP_WACP_MODE (PROPRIETARY_TLV_BASE_ID + 0x147) /* 0x0247 */ +#define TLV_TYPE_UAP_WACP_MODE (PROPRIETARY_TLV_BASE_ID + 0x147) /* 0x0247 */ /** TLV type : Vendor Specific IE */ #define TLV_TYPE_VENDOR_SPECIFIC_IE 0x00dd /** TLV type : Key material */ -#define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0x00) /* 0x0100 */ +#define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0x00) /* 0x0100 */ /** TLV type : Channel list */ -#define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 0x01) /* 0x0101 */ +#define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 0x01) /* 0x0101 */ /** TLV type : Number of probes */ -#define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 0x02) /* 0x0102 */ +#define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 0x02) /* 0x0102 */ /** TLV type : Beacon RSSI low */ -#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 0x04) /* 0x0104 */ +#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 0x04) /* 0x0104 */ /** TLV type : Beacon SNR low */ -#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 0x05) /* 0x0105 */ +#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 0x05) /* 0x0105 */ /** TLV type : Fail count */ -#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 0x06) /* 0x0106 */ +#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 0x06) /* 0x0106 */ /** TLV type : BCN miss */ -#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x07) /* 0x0107 */ +#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x07) /* 0x0107 */ /** TLV type : LED behavior */ -#define TLV_TYPE_LEDBEHAVIOR (PROPRIETARY_TLV_BASE_ID + 0x09) /* 0x0109 */ +#define TLV_TYPE_LEDBEHAVIOR (PROPRIETARY_TLV_BASE_ID + 0x09) /* 0x0109 */ /** TLV type : Passthrough */ -#define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 0x0a) /* 0x010a */ +#define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 0x0a) /* 0x010a */ /** TLV type : Power TBL 2.4 Ghz */ -#define TLV_TYPE_POWER_TBL_2_4GHZ (PROPRIETARY_TLV_BASE_ID + 0x0c) /* 0x010c \ - */ +#define TLV_TYPE_POWER_TBL_2_4GHZ \ + (PROPRIETARY_TLV_BASE_ID + 0x0c) /* 0x010c \ + */ /** TLV type : Power TBL 5 GHz */ -#define TLV_TYPE_POWER_TBL_5GHZ (PROPRIETARY_TLV_BASE_ID + 0x0d) /* 0x010d */ +#define TLV_TYPE_POWER_TBL_5GHZ (PROPRIETARY_TLV_BASE_ID + 0x0d) /* 0x010d */ /** TLV type : WMM queue status */ -#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 0x10) /* 0x0110 */ +#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 0x10) /* 0x0110 */ /** TLV type : Wildcard SSID */ -#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 0x12) /* 0x0112 */ +#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 0x12) /* 0x0112 */ /** TLV type : TSF timestamp */ -#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 0x13) /* 0x0113 */ +#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 0x13) /* 0x0113 */ /** TLV type : ARP filter */ -#define TLV_TYPE_ARP_FILTER (PROPRIETARY_TLV_BASE_ID + 0x15) /* 0x0115 */ +#define TLV_TYPE_ARP_FILTER (PROPRIETARY_TLV_BASE_ID + 0x15) /* 0x0115 */ /** TLV type : Beacon RSSI high */ -#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 0x16) /* 0x0116 */ +#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 0x16) /* 0x0116 */ /** TLV type : Beacon SNR high */ -#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 0x17) /* 0x0117 */ +#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 0x17) /* 0x0117 */ /** TLV type : Start BG scan later */ -#define TLV_TYPE_STARTBGSCANLATER (PROPRIETARY_TLV_BASE_ID + 0x1e) /* 0x011e \ - */ +#define TLV_TYPE_STARTBGSCANLATER \ + (PROPRIETARY_TLV_BASE_ID + 0x1e) /* 0x011e \ + */ /** TLV type: BG scan repeat count */ -#define TLV_TYPE_REPEAT_COUNT (PROPRIETARY_TLV_BASE_ID + 0xb0) /* 0x01b0 */ +#define TLV_TYPE_REPEAT_COUNT (PROPRIETARY_TLV_BASE_ID + 0xb0) /* 0x01b0 */ /** TLV type : Authentication type */ -#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 0x1f) /* 0x011f */ +#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 0x1f) /* 0x011f */ /** TLV type : BSSID */ -#define TLV_TYPE_BSSID (PROPRIETARY_TLV_BASE_ID + 0x23) /* 0x0123 */ +#define TLV_TYPE_BSSID (PROPRIETARY_TLV_BASE_ID + 0x23) /* 0x0123 */ /** TLV type : Link Quality */ -#define TLV_TYPE_LINK_QUALITY (PROPRIETARY_TLV_BASE_ID + 0x24) /* 0x0124 */ +#define TLV_TYPE_LINK_QUALITY (PROPRIETARY_TLV_BASE_ID + 0x24) /* 0x0124 */ /** TLV type : Data RSSI low */ -#define TLV_TYPE_RSSI_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x26) /* 0x0126 */ +#define TLV_TYPE_RSSI_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x26) /* 0x0126 */ /** TLV type : Data SNR low */ -#define TLV_TYPE_SNR_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x27) /* 0x0127 */ +#define TLV_TYPE_SNR_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x27) /* 0x0127 */ /** TLV type : Data RSSI high */ -#define TLV_TYPE_RSSI_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x28) /* 0x0128 */ +#define TLV_TYPE_RSSI_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x28) /* 0x0128 */ /** TLV type : Data SNR high */ -#define TLV_TYPE_SNR_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x29) /* 0x0129 */ +#define TLV_TYPE_SNR_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x29) /* 0x0129 */ /** TLV type : Channel band list */ -#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ +#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ /** TLV type : Security Cfg */ -#define TLV_TYPE_SECURITY_CFG (PROPRIETARY_TLV_BASE_ID + 0x3a) /* 0x013a */ +#define TLV_TYPE_SECURITY_CFG (PROPRIETARY_TLV_BASE_ID + 0x3a) /* 0x013a */ /** TLV type : Passphrase */ -#define TLV_TYPE_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ +#define TLV_TYPE_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ /** TLV type : SAE Password */ -#define TLV_TYPE_SAE_PASSWORD (PROPRIETARY_TLV_BASE_ID + 0x141) /* 0x0241 */ +#define TLV_TYPE_SAE_PASSWORD (PROPRIETARY_TLV_BASE_ID + 0x141) /* 0x0241 */ /** TLV type : SAE PWE Derivation Mode */ -#define TLV_TYPE_WPA3_SAE_PWE_DERIVATION_MODE (PROPRIETARY_TLV_BASE_ID + 339) /* 0x0100 + 0x153 */ +#define TLV_TYPE_WPA3_SAE_PWE_DERIVATION_MODE \ + (PROPRIETARY_TLV_BASE_ID + 339) /* 0x0100 + 0x153 */ /** TLV type : Encryption Protocol TLV */ -#define TLV_TYPE_ENCRYPTION_PROTO (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 \ - */ +#define TLV_TYPE_ENCRYPTION_PROTO \ + (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 \ + */ /** TLV type : Cipher TLV */ -#define TLV_TYPE_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x42) /* 0x0142 */ +#define TLV_TYPE_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x42) /* 0x0142 */ /** TLV type : PMK */ -#define TLV_TYPE_PMK (PROPRIETARY_TLV_BASE_ID + 0x44) /* 0x0144 */ +#define TLV_TYPE_PMK (PROPRIETARY_TLV_BASE_ID + 0x44) /* 0x0144 */ /** TLV type : BCN miss */ -#define TLV_TYPE_PRE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x49) /* 0x0149 */ +#define TLV_TYPE_PRE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x49) /* 0x0149 */ + +/** TLV type : ENABLE ROAM IE */ +#define TLV_TYPE_ROAM (PROPRIETARY_TLV_BASE_ID + 245) +/** TLV type : AP LIST IE */ +#define TLV_TYPE_APLIST (PROPRIETARY_TLV_BASE_ID + 246) +/** TLV type : PMK */ +#define TLV_TYPE_PMK_R0 (PROPRIETARY_TLV_BASE_ID + 247) +/** TLV type : PMK */ +#define TLV_TYPE_PMK_R0_NAME (PROPRIETARY_TLV_BASE_ID + 248) +/** TLV type : TRIGGER CONDITION*/ +#define TLV_TYPE_ROM_TRIGGER (PROPRIETARY_TLV_BASE_ID + 264) +/** TLV type : RETRY_COUNT*/ +#define TLV_TYPE_ROM_RETRY_COUNT (PROPRIETARY_TLV_BASE_ID + 265) +/** TLV type : BGSCAN SETTING*/ +#define TLV_TYPE_ROM_BGSCAN (PROPRIETARY_TLV_BASE_ID + 266) +/** TLV type : PARA RSSI*/ +#define TLV_TYPE_ROM_PARA_RSSI (PROPRIETARY_TLV_BASE_ID + 267) +/** TLV type : BSSID blacklist*/ +#define TLV_TYPE_BLACKLIST_BSSID (PROPRIETARY_TLV_BASE_ID + 0x11d) +/** TLV type : BAND & RSSI*/ +#define TLV_TYPE_BAND_RSSI (PROPRIETARY_TLV_BASE_ID + 0x11e) +/** TLV type : ESS scan*/ +#define TLV_TYPE_ENERGYEFFICIENTSCAN (PROPRIETARY_TLV_BASE_ID + 0xda) +/** TLV type : KEY params*/ +#define TLV_TYPE_ROAM_OFFLOAD_USER_SET_PMK (PROPRIETARY_TLV_BASE_ID + 291) /** TLV type: WAPI IE */ -#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 0x5e) /* 0x015e */ +#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 0x5e) /* 0x015e */ /** TLV type: MGMT IE */ -#define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 0x69) /* 0x0169 */ +#define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 0x69) /* 0x0169 */ /** TLV type: MAX_MGMT_IE */ -#define TLV_TYPE_MAX_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 0xaa) /* 0x01aa */ +#define TLV_TYPE_MAX_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 0xaa) /* 0x01aa */ + +/** TLV : Region Domain Code */ +#define TLV_TYPE_REGION_DOMAIN_CODE \ + (PROPRIETARY_TLV_BASE_ID + 0xab) /* 0x01ab */ /** TLV type: key param v2 */ -#define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 0x9C) /* 0x019C */ +#define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 0x9C) /* 0x019C */ /** TLV type: ps params in hs */ -#define TLV_TYPE_PS_PARAMS_IN_HS (PROPRIETARY_TLV_BASE_ID + 0xB5) /* 0x01b5 */ +#define TLV_TYPE_PS_PARAMS_IN_HS (PROPRIETARY_TLV_BASE_ID + 0xB5) /* 0x01b5 */ /** TLV type: hs wake hold off */ -#define TLV_TYPE_HS_WAKE_HOLDOFF (PROPRIETARY_TLV_BASE_ID + 0xB6) /* 0x01b6 */ +#define TLV_TYPE_HS_WAKE_HOLDOFF (PROPRIETARY_TLV_BASE_ID + 0xB6) /* 0x01b6 */ /** TLV type: wake up source */ #define TLV_TYPE_HS_WAKEUP_SOURCE_GPIO \ - (PROPRIETARY_TLV_BASE_ID + 0x105) /* 0x0205 */ + (PROPRIETARY_TLV_BASE_ID + 0x105) /* 0x0205 */ /** TLV type: management filter */ #define TLV_TYPE_MGMT_FRAME_WAKEUP \ - (PROPRIETARY_TLV_BASE_ID + 0x116) /* 0x0216 */ + (PROPRIETARY_TLV_BASE_ID + 0x116) /* 0x0216 */ /** TLV type: extend wakeup source */ -#define TLV_TYPE_WAKEUP_EXTEND (PROPRIETARY_TLV_BASE_ID + 0x118) /* 0x0218 */ +#define TLV_TYPE_WAKEUP_EXTEND (PROPRIETARY_TLV_BASE_ID + 0x118) /* 0x0218 */ /** TLV type: HS antenna mode */ -#define TLV_TYPE_HS_ANTMODE (PROPRIETARY_TLV_BASE_ID + 0x119) /* 0x0219 */ +#define TLV_TYPE_HS_ANTMODE (PROPRIETARY_TLV_BASE_ID + 0x119) /* 0x0219 */ /** TLV type: robustcoex mode */ -#define TLV_TYPE_ROBUSTCOEX (PROPRIETARY_TLV_BASE_ID + 0x11B) /* 0x021B */ +#define TLV_TYPE_ROBUSTCOEX (PROPRIETARY_TLV_BASE_ID + 0x11B) /* 0x021B */ -#define TLV_TYPE_DMCS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x13A) /* 0x023A */ +#define TLV_TYPE_DMCS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x13A) /* 0x023A */ /** TLV type : TDLS IDLE TIMEOUT */ -#define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0xC2) /* 0x01C2 \ - */ +#define TLV_TYPE_TDLS_IDLE_TIMEOUT \ + (PROPRIETARY_TLV_BASE_ID + 0xC2) /* 0x01C2 \ + */ /** TLV type : HT Capabilities */ -#define TLV_TYPE_HT_CAP (PROPRIETARY_TLV_BASE_ID + 0x4a) /* 0x014a */ +#define TLV_TYPE_HT_CAP (PROPRIETARY_TLV_BASE_ID + 0x4a) /* 0x014a */ /** TLV type : HT Information */ -#define TLV_TYPE_HT_INFO (PROPRIETARY_TLV_BASE_ID + 0x4b) /* 0x014b */ +#define TLV_TYPE_HT_INFO (PROPRIETARY_TLV_BASE_ID + 0x4b) /* 0x014b */ /** TLV type : Secondary Channel Offset */ #define TLV_SECONDARY_CHANNEL_OFFSET \ - (PROPRIETARY_TLV_BASE_ID + 0x4c) /* 0x014c */ + (PROPRIETARY_TLV_BASE_ID + 0x4c) /* 0x014c */ /** TLV type : 20/40 BSS Coexistence */ #define TLV_TYPE_2040BSS_COEXISTENCE \ - (PROPRIETARY_TLV_BASE_ID + 0x4d) /* 0x014d */ + (PROPRIETARY_TLV_BASE_ID + 0x4d) /* 0x014d */ /** TLV type : Overlapping BSS Scan Parameters */ #define TLV_TYPE_OVERLAP_BSS_SCAN_PARAM \ - (PROPRIETARY_TLV_BASE_ID + 0x4e) /* 0x014e */ + (PROPRIETARY_TLV_BASE_ID + 0x4e) /* 0x014e */ /** TLV type : Extended capabilities */ -#define TLV_TYPE_EXTCAP (PROPRIETARY_TLV_BASE_ID + 0x4f) /* 0x014f */ +#define TLV_TYPE_EXTCAP (PROPRIETARY_TLV_BASE_ID + 0x4f) /* 0x014f */ /** TLV type : Set of MCS values that STA desires to use within the BSS */ #define TLV_TYPE_HT_OPERATIONAL_MCS_SET \ - (PROPRIETARY_TLV_BASE_ID + 0x50) /* 0x0150 */ + (PROPRIETARY_TLV_BASE_ID + 0x50) /* 0x0150 */ /** TLV ID : Management Frame */ -#define TLV_TYPE_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 */ +#define TLV_TYPE_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 */ /** TLV type : RXBA_SYNC */ -#define TLV_TYPE_RXBA_SYNC (PROPRIETARY_TLV_BASE_ID + 0x99) /* 0x0199 */ +#define TLV_TYPE_RXBA_SYNC (PROPRIETARY_TLV_BASE_ID + 0x99) /* 0x0199 */ #ifdef WIFI_DIRECT_SUPPORT /** TLV type : AP PSK */ -#define TLV_TYPE_UAP_PSK (PROPRIETARY_TLV_BASE_ID + 0xa8) /* 0x01a8 */ +#define TLV_TYPE_UAP_PSK (PROPRIETARY_TLV_BASE_ID + 0xa8) /* 0x01a8 */ /** TLV type : p2p NOA */ #define TLV_TYPE_WIFI_DIRECT_NOA (PROPRIETARY_TLV_BASE_ID + 0x83) /** TLV type : p2p opp ps */ #define TLV_TYPE_WIFI_DIRECT_OPP_PS (PROPRIETARY_TLV_BASE_ID + 0x84) #endif /* WIFI_DIRECT_SUPPORT */ /** TLV type : GPIO TSF LATCH CONFIG */ -#define TLV_TYPE_GPIO_TSF_LATCH_CONFIG (PROPRIETARY_TLV_BASE_ID + 0x153) +#define TLV_TYPE_GPIO_TSF_LATCH_CONFIG (PROPRIETARY_TLV_BASE_ID + 0x154) /** TLV type : GPIO TSF LATCH REPORT*/ -#define TLV_TYPE_GPIO_TSF_LATCH_REPORT (PROPRIETARY_TLV_BASE_ID + 0x154) +#define TLV_TYPE_GPIO_TSF_LATCH_REPORT (PROPRIETARY_TLV_BASE_ID + 0x155) /** TLV : 20/40 coex config */ #define TLV_TYPE_2040_BSS_COEX_CONTROL \ - (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 */ + (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 */ /** TLV type : aggr win size */ #define TLV_BTCOEX_WL_AGGR_WINSIZE (PROPRIETARY_TLV_BASE_ID + 0xca) @@ -512,6 +549,9 @@ /** TLV type: fw cap info */ #define TLV_TYPE_FW_CAP_INFO (PROPRIETARY_TLV_BASE_ID + 318) +/** TLV type: secure boot uuid */ +#define TLV_TYPE_SECURE_BOOT_UUID (PROPRIETARY_TLV_BASE_ID + 348) + /** ADDBA TID mask */ #define ADDBA_TID_MASK (MBIT(2) | MBIT(3) | MBIT(4) | MBIT(5)) /** DELBA TID mask */ @@ -586,8 +626,9 @@ (HWSPEC_SHORTGI20_SUPP | HWSPEC_RXSTBC_SUPP | HWSPEC_LDPC_SUPP) /** Default 11n capability mask for 5GHz */ #define DEFAULT_11N_CAP_MASK_A \ - (HWSPEC_CHANBW40_SUPP | HWSPEC_SHORTGI20_SUPP|HWSPEC_MAX_AMSDU_SUPP | \ - HWSPEC_SHORTGI40_SUPP | HWSPEC_RXSTBC_SUPP | HWSPEC_LDPC_SUPP) + (HWSPEC_CHANBW40_SUPP | HWSPEC_SHORTGI20_SUPP | \ + HWSPEC_MAX_AMSDU_SUPP | HWSPEC_SHORTGI40_SUPP | HWSPEC_RXSTBC_SUPP | \ + HWSPEC_LDPC_SUPP) /** Default 11n TX BF capability 2X2 chip **/ #define DEFAULT_11N_TX_BF_CAP_2X2 0x19E74618 @@ -595,7 +636,8 @@ #define DEFAULT_11N_TX_BF_CAP_1X1 0x19E74608 /** Bits to ignore in hw_dev_cap as these bits are set in get_hw_spec */ -#define IGN_HW_DEV_CAP (CAPINFO_40MHZ_INTOLARENT | (CAPINFO_SMPS_ENABLE | CAPINFO_SMPS_MODE)) +#define IGN_HW_DEV_CAP \ + (CAPINFO_40MHZ_INTOLARENT | (CAPINFO_SMPS_ENABLE | CAPINFO_SMPS_MODE)) /** HW_SPEC FwCapInfo : If FW support RSN Replay Detection */ #define ISSUPP_RSN_REPLAY_DETECTION(FwCapInfo) (FwCapInfo & MBIT(28)) @@ -1013,16 +1055,18 @@ #define RESET_DEVRXMCSMAP(DevMCSMap) (DevMCSMap &= 0xFFFF0000) /** TLV type : Rate scope */ -#define TLV_TYPE_RATE_DROP_PATTERN (PROPRIETARY_TLV_BASE_ID + 0x51) /* 0x0151 \ - */ +#define TLV_TYPE_RATE_DROP_PATTERN \ + (PROPRIETARY_TLV_BASE_ID + 0x51) /* 0x0151 \ + */ /** TLV type : Rate drop pattern */ -#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 0x52) /* 0x0152 \ - */ +#define TLV_TYPE_RATE_DROP_CONTROL \ + (PROPRIETARY_TLV_BASE_ID + 0x52) /* 0x0152 \ + */ /** TLV type : Rate scope */ -#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 0x53) /* 0x0153 */ +#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 0x53) /* 0x0153 */ /** TLV type : Power group */ -#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 0x54) /* 0x0154 */ +#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 0x54) /* 0x0154 */ /** Modulation class for DSSS Rates */ #define MOD_CLASS_HR_DSSS 0x03 @@ -1041,39 +1085,44 @@ /** TLV type : TX RATE CFG, rename from TLV_TYPE_GI_LTF_SIZE to include CMD and * HE ER SU settings to this tlv */ -#define TLV_TYPE_TX_RATE_CFG (PROPRIETARY_TLV_BASE_ID + 319) /* 0x023f */ +#define TLV_TYPE_TX_RATE_CFG (PROPRIETARY_TLV_BASE_ID + 319) /* 0x023f */ /** TLV type : Scan Response */ -#define TLV_TYPE_BSS_SCAN_RSP (PROPRIETARY_TLV_BASE_ID + 0x56) /* 0x0156 */ +#define TLV_TYPE_BSS_SCAN_RSP (PROPRIETARY_TLV_BASE_ID + 0x56) /* 0x0156 */ /** TLV type : Scan Response Stats */ -#define TLV_TYPE_BSS_SCAN_INFO (PROPRIETARY_TLV_BASE_ID + 0x57) /* 0x0157 */ +#define TLV_TYPE_BSS_SCAN_INFO (PROPRIETARY_TLV_BASE_ID + 0x57) /* 0x0157 */ /** TLV type : 11h Basic Rpt */ -#define TLV_TYPE_CHANRPT_11H_BASIC (PROPRIETARY_TLV_BASE_ID + 0x5b) /* 0x015b \ - */ +#define TLV_TYPE_CHANRPT_11H_BASIC \ + (PROPRIETARY_TLV_BASE_ID + 0x5b) /* 0x015b \ + */ +/** TLV type : ZERO DFS Operation */ +#define TLV_TYPE_ZERO_DFS_OPERATION (PROPRIETARY_TLV_BASE_ID + 0x13b) // + 315 /** TLV type : DFS W53 Configuration */ -#define TLV_TYPE_DFS_W53_CFG (PROPRIETARY_TLV_BASE_ID + 0x145) // + 325 +#define TLV_TYPE_DFS_W53_CFG (PROPRIETARY_TLV_BASE_ID + 0x145) // + 325 #ifdef OPCHAN /** TLV type : OpChannel control */ #define TLV_TYPE_OPCHAN_CONTROL_DESC \ - (PROPRIETARY_TLV_BASE_ID + 0x79) /* 0x0179 */ + (PROPRIETARY_TLV_BASE_ID + 0x79) /* 0x0179 */ /** TLV type : OpChannel channel group control */ #define TLV_TYPE_OPCHAN_CHANGRP_CTRL \ - (PROPRIETARY_TLV_BASE_ID + 0x7a) /* 0x017a */ + (PROPRIETARY_TLV_BASE_ID + 0x7a) /* 0x017a */ #endif /** TLV type : Action frame */ -#define TLV_TYPE_IEEE_ACTION_FRAME (PROPRIETARY_TLV_BASE_ID + 0x8c) /* 0x018c \ - */ +#define TLV_TYPE_IEEE_ACTION_FRAME \ + (PROPRIETARY_TLV_BASE_ID + 0x8c) /* 0x018c \ + */ /** TLV type : SCAN channel gap */ -#define TLV_TYPE_SCAN_CHANNEL_GAP (PROPRIETARY_TLV_BASE_ID + 0xc5) /* 0x01c5 \ - */ +#define TLV_TYPE_SCAN_CHANNEL_GAP \ + (PROPRIETARY_TLV_BASE_ID + 0xc5) /* 0x01c5 \ + */ /** TLV type : Channel statistics */ -#define TLV_TYPE_CHANNEL_STATS (PROPRIETARY_TLV_BASE_ID + 0xc6) /* 0x01c6 */ +#define TLV_TYPE_CHANNEL_STATS (PROPRIETARY_TLV_BASE_ID + 0xc6) /* 0x01c6 */ /** TLV type : BSS_MODE */ -#define TLV_TYPE_BSS_MODE (PROPRIETARY_TLV_BASE_ID + 0xce) /* 0x01ce */ +#define TLV_TYPE_BSS_MODE (PROPRIETARY_TLV_BASE_ID + 0xce) /* 0x01ce */ /** Firmware Host Command ID Constants */ /** Host Command ID : Get hardware specifications */ @@ -1249,11 +1298,21 @@ /** Host Command ID : 802.11 RSSI INFO EXT*/ #define HostCmd_CMD_RSSI_INFO_EXT 0x0237 +/** Host Command ID : ROAMING OFFLOAD TO FW*/ +#define HostCmd_CMD_ROAM_OFFLOAD 0x0245 -#ifdef RX_PACKET_COALESCE -/** TLV ID for RX pkt coalesce config */ -#define TLV_TYPE_RX_PKT_COAL_CONFIG (PROPRIETARY_TLV_BASE_ID + 0xC9) -#endif +/** Host Command ID: Multi chan config */ +#define HostCmd_CMD_MULTI_CHAN_CONFIG 0x011e +/** Host Command ID: Multi chan policy */ +#define HostCmd_CMD_MULTI_CHAN_POLICY 0x0121 +/** TLV ID for multi chan info */ +#define TLV_TYPE_MULTI_CHAN_INFO (PROPRIETARY_TLV_BASE_ID + 0xb7) +/** TLV ID for multi chan group info */ +#define TLV_TYPE_MULTI_CHAN_GROUP_INFO_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0xb8) +/** TLV ID for DRCS TimeSlice */ +#define MRVL_DRCS_TIME_SLICE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 263) +/** Host Command ID: DRCS config */ +#define HostCmd_CMD_DRCS_CONFIG 0x024a #define TLV_TYPE_PREV_BSSID (PROPRIETARY_TLV_BASE_ID + 330) @@ -1304,6 +1363,10 @@ #define HostCmd_CMD_MGMT_IE_LIST 0x00f2 #define HostCmd_CMD_802_11_BAND_STEERING 0x026f +/*** Host Command ID " MC_AGGR_CFG */ +#define HostCmd_CMD_MC_AGGR_CFG 0x027a +#define HostCmd_CMD_802_11_STATS 0x0014 +#define HostCmd_CMD_GET_CH_LOAD 0x027b /** Host Command ID : TDLS configuration */ #define HostCmd_CMD_TDLS_CONFIG 0x0100 @@ -1331,6 +1394,9 @@ /** fw_cap_info bit23 for embedded authenticator support*/ #define FW_CAPINFO_AUTH_SUPPORT MBIT(22) +/** fw_cap_info bit23 for firmware roaming*/ +#define FW_ROAMING_SUPPORT MBIT(23) + /** fw_cap_info bit25 for adhoc support*/ #define FW_CAPINFO_ADHOC_SUPPORT MBIT(25) /** Check if adhoc is supported by firmware */ @@ -1367,6 +1433,14 @@ #define FW_CAPINFO_EXT_MULTI_BSSID MBIT(9) /** FW cap info bit 10: Beacon Protection Support */ #define FW_CAPINFO_EXT_BEACON_PROT MBIT(10) +/** FW cap info bit 11: OTP cal data */ +#define FW_CAPINFO_EXT_OTP_CALDATA MBIT(11) +/** FW cap info bit 12: RTT Support */ +#define FW_CAPINFO_EXT_RTT MBIT(12) +/** FW cap info bit 13: Channel Tracking Support */ +#define FW_CAPINFO_EXT_CHAN_TRACK MBIT(13) +/** FW cap info bit 14: 6G Support */ +#define FW_CAPINFO_EXT_6G MBIT(14) /** Check if 5G 1x1 only is supported by firmware */ #define IS_FW_SUPPORT_5G_1X1_ONLY(_adapter) \ @@ -1396,8 +1470,15 @@ #define IS_FW_SUPPORT_MULTIBSSID(_adapter) \ (_adapter->fw_cap_ext & FW_CAPINFO_EXT_MULTI_BSSID) /** Check if Beacon Protection supported by firmware */ -#define IS_FW_SUPPORT_BEACON_PROT(_adapter) \ +#define IS_FW_SUPPORT_BEACON_PROT(_adapter) \ (_adapter->fw_cap_ext & FW_CAPINFO_EXT_BEACON_PROT) +/** Check if RTT supported by firmware */ +#define IS_FW_SUPPORT_RTT(_adapter) (_adapter->fw_cap_ext & FW_CAPINFO_EXT_RTT) +/** Check if Channel Tracking supported by firmware */ +#define IS_FW_SUPPORT_CHAN_TRACK(_adapter) \ + (_adapter->fw_cap_ext & FW_CAPINFO_EXT_CHAN_TRACK) +/** Check if 6G supported by firmware */ +#define IS_FW_SUPPORT_6G(_adapter) (_adapter->fw_cap_ext & FW_CAPINFO_EXT_6G) /** MrvlIEtypes_PrevBssid_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_PrevBssid_t { @@ -1449,26 +1530,45 @@ t_u8 he_mac_cap[6]; /** he phy capability info */ t_u8 he_phy_cap[11]; - /** rx mcs for 80 */ + /** rx mcs for 80 */ t_u16 rx_mcs_80; - /** tx mcs for 80 */ + /** tx mcs for 80 */ t_u16 tx_mcs_80; - /** rx mcs for bw 160 */ + /** rx mcs for bw 160 */ t_u16 rx_mcs_160; - /** tx mcs for bw 160 */ + /** tx mcs for bw 160 */ t_u16 tx_mcs_160; - /** rx mcs for bw 80+80 */ + /** rx mcs for bw 80+80 */ t_u16 rx_mcs_80p80; - /** tx mcs for bw 80+80 */ + /** tx mcs for bw 80+80 */ t_u16 tx_mcs_80p80; /** PPE Thresholds (optional) */ t_u8 val[20]; } MLAN_PACK_END MrvlIEtypes_He_cap_t, *pMrvlIEtypes_he_cap_t; -#ifdef RX_PACKET_COALESCE -/** Host Command ID : Rx packet coalescing configuration */ -#define HostCmd_CMD_RX_PKT_COALESCE_CFG 0x012c -#endif +typedef MLAN_PACK_START struct _MrvlIEtypes_He_Op_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Element id extension */ + t_u8 ext_id; + /** HE Operation Parameters */ + t_u16 he_op_param1; + /** HE Operation Parameters */ + t_u8 he_op_param2; + /** BSS Color Info */ + t_u8 bss_color_info; + /** Basic HE-MCS and NSS Set */ + t_u16 basic_he_mcs_nss; + /** Optional Field, including VHT Operation Info Max Co-Hosted BSSID + * Indicator, and 6Ghz Operation Info */ + t_u8 option[9]; +} MLAN_PACK_END MrvlIEtypes_He_Op_t; + +/** fw_cap_info bit30 for Embedded OWE Support*/ +#define FW_CAPINFO_EMBEDDED_OWE_SUPPORT MBIT(30) +/** Check if Embedded OWE is supported by firmware */ +#define IS_FW_SUPPORT_EMBEDDED_OWE(_adapter) \ + (_adapter->fw_cap_info & FW_CAPINFO_EMBEDDED_OWE_SUPPORT) /** Host Command ID : Extended scan support */ #define HostCmd_CMD_802_11_SCAN_EXT 0x0107 @@ -1509,6 +1609,9 @@ /** Host Command id: PMIC CONFIGURE*/ #define HOST_CMD_PMIC_CONFIGURE 0x23E +/** Host Command ID: 802.11 Network Monitor */ +#define HostCmd_CMD_802_11_NET_MONITOR 0x0102 + /** Host Command ID: Tx data pause */ #define HostCmd_CMD_CFG_TX_DATA_PAUSE 0x0103 @@ -1532,6 +1635,9 @@ /** Host Command ID : OTP user data */ #define HostCmd_CMD_OTP_READ_USER_DATA 0x0114 +/** Host Command ID: fw auto reconnect */ +#define HostCmd_CMD_FW_AUTO_RECONNECT 0x0115 + /** Host Command ID: HS wakeup reason */ #define HostCmd_CMD_HS_WAKEUP_REASON 0x0116 @@ -1547,6 +1653,8 @@ /** Host Command ID: BCA device access */ #define HostCmd_CMD_BCA_REG_ACCESS 0x0272 +/** Host Command ID: register device access */ +#define HostCmd_CMD_REG_ACCESS 0x027C /** Host Command ID: DFS repeater mode */ #define HostCmd_DFS_REPEATER_MODE 0x012b @@ -1570,9 +1678,11 @@ /** Host Command ID : GPIO independent reset configure */ #define HostCmd_CMD_INDEPENDENT_RESET_CFG 0x0243 -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) /* TLV type: reg type */ -#define TLV_TYPE_REG_ACCESS_CTRL (PROPRIETARY_TLV_BASE_ID + 0x13C) /* 0x023c */ +#define TLV_TYPE_REG_ACCESS_CTRL (PROPRIETARY_TLV_BASE_ID + 0x13C) /* 0x023c*/ /** MrvlIEtypes_Reg_type_t*/ typedef MLAN_PACK_START struct _MrvlIEtypes_Reg_type_t { /** Header */ @@ -1580,7 +1690,6 @@ /** type: 0x81/0x82/0x83 */ t_u8 type; } MLAN_PACK_END MrvlIEtypes_Reg_type_t; - #endif /** use to query chan region cfg setting in firmware */ #define HostCmd_CMD_CHAN_REGION_CFG 0x0242 @@ -1589,38 +1698,38 @@ /* mod_grp */ typedef enum _mod_grp { - MOD_CCK, // 0 - MOD_OFDM_PSK, // 1 - MOD_OFDM_QAM16, // 2 - MOD_OFDM_QAM64, // 3 - MOD_HT_20_PSK, // 4 - MOD_HT_20_QAM16, // 5 - MOD_HT_20_QAM64, // 6 - MOD_HT_40_PSK, // 7 - MOD_HT_40_QAM16, // 8 - MOD_HT_40_QAM64, // 9 + MOD_CCK, // 0 + MOD_OFDM_PSK, // 1 + MOD_OFDM_QAM16, // 2 + MOD_OFDM_QAM64, // 3 + MOD_HT_20_PSK, // 4 + MOD_HT_20_QAM16, // 5 + MOD_HT_20_QAM64, // 6 + MOD_HT_40_PSK, // 7 + MOD_HT_40_QAM16, // 8 + MOD_HT_40_QAM64, // 9 #ifdef STREAM_2x2 - MOD_HT2_20_PSK, // 10 - MOD_HT2_20_QAM16, // 11 - MOD_HT2_20_QAM64, // 12 - MOD_HT2_40_PSK, // 13 - MOD_HT2_40_QAM16, // 14 - MOD_HT2_40_QAM64, // 15 + MOD_HT2_20_PSK, // 10 + MOD_HT2_20_QAM16, // 11 + MOD_HT2_20_QAM64, // 12 + MOD_HT2_40_PSK, // 13 + MOD_HT2_40_QAM16, // 14 + MOD_HT2_40_QAM64, // 15 #endif - MOD_VHT_20_QAM256, // 16 - MOD_VHT_40_QAM256, // 17 - MOD_VHT_80_PSK, // 18 - MOD_VHT_80_QAM16, // 19 - MOD_VHT_80_QAM64, // 20 - MOD_VHT_80_QAM256, // 21 + MOD_VHT_20_QAM256, // 16 + MOD_VHT_40_QAM256, // 17 + MOD_VHT_80_PSK, // 18 + MOD_VHT_80_QAM16, // 19 + MOD_VHT_80_QAM64, // 20 + MOD_VHT_80_QAM256, // 21 #ifdef STREAM_2x2 - MOD_VHT2_20_QAM256, // 22 - MOD_VHT2_40_QAM256, // 23 - MOD_VHT2_80_PSK, // 24 - MOD_VHT2_80_QAM16, // 25 - MOD_VHT2_80_QAM64, // 26 - MOD_VHT2_80_QAM256, // 27 + MOD_VHT2_20_QAM256, // 22 + MOD_VHT2_40_QAM256, // 23 + MOD_VHT2_80_PSK, // 24 + MOD_VHT2_80_QAM16, // 25 + MOD_VHT2_80_QAM64, // 26 + MOD_VHT2_80_QAM256, // 27 #endif } mod_grp; @@ -1651,6 +1760,9 @@ #if defined(PCIE) #define HostCmd_CMD_SSU 0x0259 #endif +#define HostCmd_CMD_CSI 0x025b +#define CSI_CMD_ENABLE 0x0001 +#define CSI_CMD_DISABLE 0x0002 #define HostCmd_CMD_DMCS_CONFIG 0x0260 @@ -1664,11 +1776,18 @@ #define HostCmd_CMD_TWT_CFG 0x0270 #define HostCmd_CMD_LOW_POWER_MODE_CFG 0x026e -#define HostCmd_CMD_UAP_BEACON_STUCK_CFG 0x0271 +#define HostCmd_CMD_UAP_BEACON_STUCK_CFG 0x0271 #define HostCmd_CMD_ARB_CONFIG 0x0273 #define HostCmd_CMD_DOT11MC_UNASSOC_FTM_CFG 0x0275 #define HostCmd_CMD_HAL_PHY_CFG 0x0276 +/** Host Command ID : IPS Config */ +#define HostCmd_CMD_IPS_CONFIG 0x0279 + +typedef MLAN_PACK_START struct { + t_u32 enable; +} MLAN_PACK_END HostCmd_DS_IPS_CONFIG; + /** Enhanced PS modes */ typedef enum _ENH_PS_MODES { GET_PS = 0, @@ -1797,6 +1916,7 @@ /** Get BSS type from Host Command (bit 15:12) */ #define HostCmd_GET_BSS_TYPE(seq) (((seq)&HostCmd_BSS_TYPE_MASK) >> 12) +/* EVENT ID*/ /** Card Event definition : Dummy host wakeup signal */ #define EVENT_DUMMY_HOST_WAKEUP_SIGNAL 0x00000001 /** Card Event definition : Link lost */ @@ -1875,10 +1995,26 @@ /** Card Event definition : Port release event */ #define EVENT_PORT_RELEASE 0x0000002b +#ifdef UAP_SUPPORT +/** Event ID: STA deauth */ +#define EVENT_MICRO_AP_STA_DEAUTH 0x0000002c +/** Event ID: STA assoicated */ +#define EVENT_MICRO_AP_STA_ASSOC 0x0000002d +/** Event ID: BSS started */ +#define EVENT_MICRO_AP_BSS_START 0x0000002e +/** Event ID: BSS idle event */ +#define EVENT_MICRO_AP_BSS_IDLE 0x00000043 +/** Event ID: BSS active event */ +#define EVENT_MICRO_AP_BSS_ACTIVE 0x00000044 + +/** Event ID: MIC countermeasures event */ +#define EVENT_MICRO_AP_MIC_COUNTERMEASURES 0x0000004c +#endif /* UAP_SUPPORT */ + /** Card Event definition : Pre-Beacon Lost */ #define EVENT_PRE_BEACON_LOST 0x00000031 -#define EVENT_WATCHDOG_TMOUT 0x00000032 +#define EVENT_WATCHDOG_TMOUT 0x00000032 /** Card Event definition : Add BA event */ #define EVENT_ADDBA 0x00000033 @@ -1927,51 +2063,45 @@ /** Enhance ext scan done event */ #define EVENT_EXT_SCAN_STATUS_REPORT 0x0000007f -/** Event definition : FW debug information */ -#define EVENT_FW_DEBUG_INFO 0x00000063 - /** Event definition: RXBA_SYNC */ #define EVENT_RXBA_SYNC 0x00000059 -#ifdef UAP_SUPPORT -/** Event ID: STA deauth */ -#define EVENT_MICRO_AP_STA_DEAUTH 0x0000002c -/** Event ID: STA assoicated */ -#define EVENT_MICRO_AP_STA_ASSOC 0x0000002d -/** Event ID: BSS started */ -#define EVENT_MICRO_AP_BSS_START 0x0000002e -/** Event ID: BSS idle event */ -#define EVENT_MICRO_AP_BSS_IDLE 0x00000043 -/** Event ID: BSS active event */ -#define EVENT_MICRO_AP_BSS_ACTIVE 0x00000044 - -/** Event ID: MIC countermeasures event */ -#define EVENT_MICRO_AP_MIC_COUNTERMEASURES 0x0000004c -#endif /* UAP_SUPPORT */ - /** Event ID: TX data pause event */ #define EVENT_TX_DATA_PAUSE 0x00000055 +/** Event definition : FW debug information */ +#define EVENT_FW_DEBUG_INFO 0x00000063 + /** Event ID: SAD Report */ #define EVENT_SAD_REPORT 0x00000066 +/** Event ID: Multi Chan Info*/ +#define EVENT_MULTI_CHAN_INFO 0x0000006a + +#define EVENT_FW_DUMP_INFO 0x00000073 /** Event ID: Tx status */ #define EVENT_TX_STATUS_REPORT 0x00000074 #define EVENT_BT_COEX_WLAN_PARA_CHANGE 0x00000076 +#define EVENT_VDLL_IND 0x00000081 + +#define EVENT_ROAM_OFFLOAD 0x00000083 + +#define EVENT_EXCEED_MAX_P2P_CONN 0x00000089 + #if defined(PCIE) #define EVENT_SSU_DUMP_DMA 0x0000008C #endif -#define EVENT_VDLL_IND 0x00000081 -#define EVENT_EXCEED_MAX_P2P_CONN 0x00000089 - +#define EVENT_CSI 0x0000008D +#define EVENT_FW_HANG_REPORT 0x0000008F /** Card Event definition : RESET PN */ -#define EVENT_FW_HANG_REPORT 0x0000008F +#define EVENT_ASSOC_REQ_IE 0x00000095 -#define EVENT_FW_DUMP_INFO 0x00000073 +#define CHAN_LOAD_EVENT 0x00000099 + /** Event ID mask */ #define EVENT_ID_MASK 0xffff @@ -2054,6 +2184,10 @@ TDLS_PEER_STA_UNREACHABLE = 25, } tdls_error_code_e; +#define RXPD_FLAG_EXTRA_HEADER (1 << 1) + +#define RXPD_FLAG_UCAST_PKT (1 << 3) + /** Event_WEP_ICV_ERR structure */ typedef MLAN_PACK_START struct _Event_WEP_ICV_ERR { /** Reason code */ @@ -2103,6 +2237,10 @@ #define PAIRWISE_CIPHER_SUITE_LEN 4 /** AKM Suite length */ #define AKM_SUITE_LEN 4 +/** PMKID length */ +#define PMKID_LEN 16 +/** Group mgmt Cipher Suite length */ +#define GROUP_MGMT_CIPHER_SUITE_LEN 4 /** MFPC bit in RSN capability */ #define MFPC_BIT 7 /** MFPR bit in RSN capability */ @@ -2131,6 +2269,8 @@ /** Packet type: debugging */ #define PKT_TYPE_DEBUG 0xEF +#define PKT_TYPE_802DOT11_MC_AGGR 11 + /** channel number at bit 5-13 */ #define RXPD_CHAN_MASK 0x3FE0 /** Rate control mask 15-23 */ @@ -2146,6 +2286,89 @@ /** enable retry limit in TxPD */ #define TXPD_RETRY_ENABLE MBIT(12) +/** tx_control*/ +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _tx_ctrl { + /** reserved */ + t_u32 reserved : 3; + /** mc retry packet */ + t_u32 mc_pkt_retry : 1; + /** end of mc AMPDU */ + t_u32 mc_ampdu_end : 1; + /** start of mc AMPDU */ + t_u32 mc_ampdu_start : 1; + /** End of mc cycle */ + t_u32 mc_cycle_end : 1; + /** start of mc cycle */ + t_u32 mc_cycle_start : 1; + /** bw 0-20MHz, 1-40MHz */ + t_u32 bw : 3; + /** Rate used for transmission MCS0-7*/ + t_u32 tx_rate : 5; + /** Control the use of txRate. 0 - use FW setting, 1 - use the specified + * txRate;*/ + t_u32 host_txrate_ctrl : 1; + /** 0/1 - use FW setting, 2 - ACK_IMMD, 3 - NO_ACK.*/ + t_u32 ack_policy : 2; + /** Control the use of retryLimit. 0 - use FW setting, 1 - use the + * specified retryLimit.*/ + t_u32 host_retry_ctrl : 1; + /** retry limit */ + t_u32 retry_limit : 4; + /** Control the use of txPower. 0 - use FW power setting, 1 - use the + * specified txPower.*/ + t_u32 host_tx_powerctrl : 1; + /** Sign of the txPower, 0 - positive_sign(+), 1 - negative_sign(-). */ + t_u32 tx_power_sign : 1; + /** Power used for transmission(in dBm); */ + t_u32 tx_power : 6; +} MLAN_PACK_END tx_ctrl; +#else +typedef MLAN_PACK_START struct _tx_ctrl { + /** Power used for transmission(in dBm); */ + t_u32 tx_power : 6; + /** Sign of the txPower, 0 - positive_sign(+), 1 - negative_sign(-). */ + t_u32 tx_power_sign : 1; + /** Control the use of txPower. 0 - use FW power setting, 1 - use the + * specified txPower.*/ + t_u32 host_tx_powerctrl : 1; + /** retry limit */ + t_u32 retry_limit : 4; + /** Control the use of retryLimit. 0 - use FW setting, 1 - use the + * specified retryLimit.*/ + t_u32 host_retry_ctrl : 1; + /** 0/1 - use FW setting, 2 - ACK_IMMD, 3 - NO_ACK.*/ + t_u32 ack_policy : 2; + /** Control the use of txRate. 0 - use FW setting, 1 - use the specified + * txRate;*/ + t_u32 host_txrate_ctrl : 1; + /** Rate used for transmission MCS0-7*/ + t_u32 tx_rate : 5; + /** bw 0-20MHz 1-40MHz*/ + t_u32 bw : 3; + /** start of mc cycle */ + t_u32 mc_cycle_start : 1; + /** End of mc cycle */ + t_u32 mc_cycle_end : 1; + /** start of mc AMPDU */ + t_u32 mc_ampdu_start : 1; + /** end of mc AMPDU */ + t_u32 mc_ampdu_end : 1; + /** mc retry packet */ + t_u32 mc_pkt_retry : 1; + /** reserved */ + t_u32 reserved : 3; +} MLAN_PACK_END tx_ctrl; +#endif + +/** mc tx ctrl */ +typedef MLAN_PACK_START struct _mc_tx_ctrl { + /** mc seq */ + t_u16 mc_seq; + /** abs_tsf_expirytime*/ + t_u32 abs_tsf_expirytime; +} MLAN_PACK_END mc_tx_ctrl; + /** TxPD descriptor */ typedef MLAN_PACK_START struct _TxPD { /** BSS type */ @@ -2214,61 +2437,60 @@ /** rx info */ t_u32 rx_info; - /** Reserved */ + /** Reserved */ t_u8 reserved3[8]; - } MLAN_PACK_END RxPD, *PRxPD; /** IEEEtypes_FrameCtl_t*/ #ifdef BIG_ENDIAN_SUPPORT typedef MLAN_PACK_START struct _IEEEtypes_FrameCtl_t { /** Order */ - t_u8 order:1; + t_u8 order : 1; /** Wep */ - t_u8 wep:1; + t_u8 wep : 1; /** More Data */ - t_u8 more_data:1; + t_u8 more_data : 1; /** Power Mgmt */ - t_u8 pwr_mgmt:1; + t_u8 pwr_mgmt : 1; /** Retry */ - t_u8 retry:1; + t_u8 retry : 1; /** More Frag */ - t_u8 more_frag:1; + t_u8 more_frag : 1; /** From DS */ - t_u8 from_ds:1; + t_u8 from_ds : 1; /** To DS */ - t_u8 to_ds:1; + t_u8 to_ds : 1; /** Sub Type */ - t_u8 sub_type:4; + t_u8 sub_type : 4; /** Type */ - t_u8 type:2; + t_u8 type : 2; /** Protocol Version */ - t_u8 protocol_version:2; + t_u8 protocol_version : 2; } MLAN_PACK_END IEEEtypes_FrameCtl_t; #else typedef MLAN_PACK_START struct _IEEEtypes_FrameCtl_t { /** Protocol Version */ - t_u8 protocol_version:2; + t_u8 protocol_version : 2; /** Type */ - t_u8 type:2; + t_u8 type : 2; /** Sub Type */ - t_u8 sub_type:4; + t_u8 sub_type : 4; /** To DS */ - t_u8 to_ds:1; + t_u8 to_ds : 1; /** From DS */ - t_u8 from_ds:1; + t_u8 from_ds : 1; /** More Frag */ - t_u8 more_frag:1; + t_u8 more_frag : 1; /** Retry */ - t_u8 retry:1; + t_u8 retry : 1; /** Power Mgmt */ - t_u8 pwr_mgmt:1; + t_u8 pwr_mgmt : 1; /** More Data */ - t_u8 more_data:1; + t_u8 more_data : 1; /** Wep */ - t_u8 wep:1; + t_u8 wep : 1; /** Order */ - t_u8 order:1; + t_u8 order : 1; } MLAN_PACK_END IEEEtypes_FrameCtl_t; #endif @@ -2363,7 +2585,7 @@ /** 11D channel */ t_u8 chan; /** Band for channel */ - t_u8 band; + t_u16 band; /** 11D channel power */ t_u8 pwr; /** AP seen on channel */ @@ -2383,38 +2605,38 @@ typedef MLAN_PACK_START struct _ChanScanMode_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved_7:1; + t_u8 reserved_7 : 1; /** First passive scan then active scan */ - t_u8 passive_to_active_scan:1; + t_u8 passive_to_active_scan : 1; /** First channel in scan */ - t_u8 first_chan:1; + t_u8 first_chan : 1; /** Enable hidden ssid report */ - t_u8 hidden_ssid_report:1; + t_u8 hidden_ssid_report : 1; /** Enable probe response timeout */ - t_u8 rsp_timeout_en:1; + t_u8 rsp_timeout_en : 1; /** Multidomain scan mode */ - t_u8 multidomain_scan:1; + t_u8 multidomain_scan : 1; /** Disble channel filtering flag */ - t_u8 disable_chan_filt:1; + t_u8 disable_chan_filt : 1; /** Channel scan mode passive flag */ - t_u8 passive_scan:1; + t_u8 passive_scan : 1; #else /** Channel scan mode passive flag */ - t_u8 passive_scan:1; + t_u8 passive_scan : 1; /** Disble channel filtering flag */ - t_u8 disable_chan_filt:1; + t_u8 disable_chan_filt : 1; /** Multidomain scan mode */ - t_u8 multidomain_scan:1; + t_u8 multidomain_scan : 1; /** Enable probe response timeout */ - t_u8 rsp_timeout_en:1; + t_u8 rsp_timeout_en : 1; /** Enable hidden ssid report */ - t_u8 hidden_ssid_report:1; + t_u8 hidden_ssid_report : 1; /** First channel in scan */ - t_u8 first_chan:1; + t_u8 first_chan : 1; /** First passive scan then active scan */ - t_u8 passive_to_active_scan:1; + t_u8 passive_to_active_scan : 1; /** Reserved */ - t_u8 reserved_7:1; + t_u8 reserved_7 : 1; #endif } MLAN_PACK_END ChanScanMode_t; @@ -2704,11 +2926,13 @@ /** Host Command ID : _HostCmd_DS_BEACON_STUCK_CFG */ typedef MLAN_PACK_START struct _HostCmd_DS_BEACON_STUCK_CFG { - /** ACT_GET/ACT_SET */ + /** ACT_GET/ACT_SET */ t_u8 action; - /** No of beacon interval after which firmware will check if beacon Tx is going fine */ + /** No of beacon interval after which firmware will check if beacon Tx + * is going fine */ t_u8 beacon_stuck_detect_count; - /** Upon performing MAC reset, no of beacon interval after which firmware will check if recovery was successful */ + /** Upon performing MAC reset, no of beacon interval after which + * firmware will check if recovery was successful */ t_u8 recovery_confirm_count; } MLAN_PACK_END HostCmd_DS_BEACON_STUCK_CFG; @@ -2872,57 +3096,57 @@ typedef MLAN_PACK_START struct _WmmQosInfo_t { #ifdef BIG_ENDIAN_SUPPORT /** QoS UAPSD */ - t_u8 qos_uapsd:1; + t_u8 qos_uapsd : 1; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; #else /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** QoS UAPSD */ - t_u8 qos_uapsd:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 qos_uapsd : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END WmmQosInfo_t, *pWmmQosInfo_t; /** Data structure of WMM ECW */ typedef MLAN_PACK_START struct _WmmEcw_t { #ifdef BIG_ENDIAN_SUPPORT /** Maximum Ecw */ - t_u8 ecw_max:4; + t_u8 ecw_max : 4; /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; #else /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; /** Maximum Ecw */ - t_u8 ecw_max:4; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 ecw_max : 4; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END WmmEcw_t, *pWmmEcw_t; /** Data structure of WMM Aci/Aifsn */ typedef MLAN_PACK_START struct _WmmAciAifsn_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:1; + t_u8 reserved : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; #else /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Reserved */ - t_u8 reserved:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END WmmAciAifsn_t, *pWmmAciAifsn_t; /** Data structure of WMM AC parameters */ @@ -2968,7 +3192,8 @@ /** Result */ t_u16 result; } MLAN_PACK_END HostCmd_DS_GEN -; + + ; /** Size of HostCmd_DS_GEN */ #define S_DS_GEN sizeof(HostCmd_DS_GEN) @@ -3002,7 +3227,7 @@ /** 0/1/2/3 */ t_u16 sub_band; /** chan TRPC config */ - //MrvlIETypes_ChanTRPCConfig_t tlv[]; + // MrvlIETypes_ChanTRPCConfig_t tlv[]; } MLAN_PACK_END HostCmd_DS_CHANNEL_TRPC_CONFIG; /** Address type: broadcast */ @@ -3074,6 +3299,14 @@ t_u8 val[MAX_NUM_BYTE_SEQ + 1]; } MLAN_PACK_END mef_op; +/** Structure definition for low power mode cfg command */ +typedef MLAN_PACK_START struct _HostCmd_DS_LOW_POWER_MODE_CFG { + /** Action */ + t_u16 action; + /** Low power mode */ + t_u16 lpm; +} MLAN_PACK_END HostCmd_DS_LOW_POWER_MODE_CFG; + /* HostCmd_DS_802_11_SLEEP_PERIOD */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_SLEEP_PERIOD { /** ACT_GET/ACT_SET */ @@ -3164,11 +3397,11 @@ #define AUTO_PS_FIX_SIZE 4 /** TLV type : auto ds param */ -#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 0x71) /* 0x0171 */ +#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 0x71) /* 0x0171 */ /** TLV type : ps param */ -#define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 0x72) /* 0x0172 */ +#define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 0x72) /* 0x0172 */ /** TLV type : beacon timeout */ -#define TLV_TYPE_BCN_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x11F) /* 0x011F */ +#define TLV_TYPE_BCN_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x11F) /* 0x011F */ /** MrvlIEtypes_auto_ds_param_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_auto_ds_param_t { @@ -3200,14 +3433,6 @@ t_u16 bcn_rq_tmo_period; } MLAN_PACK_END MrvlIEtypes_bcn_timeout_t; -/** Structure definition for low power mode cfg command */ -typedef MLAN_PACK_START struct _HostCmd_DS_LOW_POWER_MODE_CFG { - /** Action */ - t_u16 action; - /** Low power mode */ - t_u16 lpm; -} MLAN_PACK_END HostCmd_DS_LOW_POWER_MODE_CFG; - /** Structure definition for new power save command */ typedef MLAN_PACK_START struct _HostCmd_DS_PS_MODE_ENH { /** Action */ @@ -3222,7 +3447,7 @@ * UINT16 adhocawakeperiod */ /* For auto deep sleep */ - /* UINT16 Deep sleep inactivity timeout */ + /* UINT16 Deep sleep inactivity timeout*/ /* For PS sleep confirm * UINT16 responeCtrl - 0x00 - reponse from fw not needed, 0x01 - @@ -3243,7 +3468,7 @@ } MLAN_PACK_END HostCmd_DS_802_11_PS_MODE_ENH; /** FW VERSION tlv */ -#define TLV_TYPE_FW_VER_INFO (PROPRIETARY_TLV_BASE_ID + 0xC7) /* 0x1C7 */ +#define TLV_TYPE_FW_VER_INFO (PROPRIETARY_TLV_BASE_ID + 0xC7) /* 0x1C7 */ /** MrvlIEtypes_fw_ver_info_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_fw_ver_info_t { @@ -3361,7 +3586,7 @@ } MLAN_PACK_END HostCmd_DS_802_11_RSSI_INFO_EXT; /** TLV rssi info */ -#define TLV_TYPE_RSSI_INFO (PROPRIETARY_TLV_BASE_ID + 0xe5) /* 0x01E5 */ +#define TLV_TYPE_RSSI_INFO (PROPRIETARY_TLV_BASE_ID + 0xe5) /* 0x01E5 */ /** MrvlIEtypes_eapol_pkt_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_RSSI_EXT_t { @@ -3392,6 +3617,58 @@ t_s16 bcn_nf_avg; } MLAN_PACK_END MrvlIEtypes_RSSI_EXT_t; +/** HostCmd_DS_CMD_MC_AGGR_CFG */ +typedef MLAN_PACK_START struct _HostCmd_DS_MC_AGGR_CFG { + /** Action */ + t_u16 action; + /** Reserved field 1 */ + t_u16 reserved_1; + /* 1 enable, 0 disable + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 enable_bitmap; + /* 1 valid, 0 invalid + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 mask_bitmap; + /** CTS2Self duration offset */ + t_u16 cts2self_offset; +} MLAN_PACK_END HostCmd_DS_MC_AGGR_CFG; + +/** Stats_Cfg_Params_TLV */ +typedef struct MLAN_PACK_START _Stats_Cfg_Params_TLV { + /** tlvHeader */ + MrvlIEtypesHeader_t tlvHeader; + /** op */ + t_u8 op; + /** reserved */ + t_u8 reserved; + /** mac */ + mlan_802_11_mac_addr mac; +} MLAN_PACK_END Stats_Cfg_Params_TLV_t; + +/** HostCmd_DS_STATS */ +typedef MLAN_PACK_START struct _HostCmd_DS_STATS { + /** Action */ + t_u16 action; + /** TLV buffer */ + t_u8 tlv_buffer[1]; +} MLAN_PACK_END HostCmd_DS_STATS; + +typedef MLAN_PACK_START struct _HostCmd_DS_GET_CH_LOAD { + /** Action */ + t_u16 action; + t_u16 ch_load; + t_s16 noise; + t_u16 rx_quality; + t_u16 duration; + t_u16 cca_th; +} MLAN_PACK_END HostCmd_DS_GET_CH_LOAD; + /** HostCmd_DS_CMD_802_11_RSSI_INFO */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_RSSI_INFO { /** Action */ @@ -3448,6 +3725,18 @@ t_u32 action; } MLAN_PACK_END HostCmd_DS_MAC_CONTROL; +/** HostCmd_DS_802_11_NET_MONITOR */ +typedef MLAN_PACK_START struct _HostCmd_802_11_DS_NET_MONITOR { + /** Action */ + t_u16 action; + /** Enable/disable net monitor */ + t_u16 enable_net_mon; + /** set net monitor filer flag */ + t_u16 filter_flag; + /** Channel to monitor */ + MrvlIEtypes_ChanBandListParamSet_t monitor_chan; +} MLAN_PACK_END HostCmd_DS_802_11_NET_MONITOR; + /** HostCmd_DS_CMD_TX_DATA_PAUSE */ typedef MLAN_PACK_START struct _HostCmd_DS_CMD_TX_DATA_PAUSE { /** Action */ @@ -3459,7 +3748,7 @@ } MLAN_PACK_END HostCmd_DS_CMD_TX_DATA_PAUSE; /** TLV type : TX pause TLV */ -#define TLV_TYPE_TX_PAUSE (PROPRIETARY_TLV_BASE_ID + 0x94) /* 0x0194 */ +#define TLV_TYPE_TX_PAUSE (PROPRIETARY_TLV_BASE_ID + 0x94) /* 0x0194 */ /** MrvlIEtypes_SsIdParamSet_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_tx_pause_t { /** Header */ @@ -3735,53 +4024,53 @@ t_u64 rx_octets_in_ampdu_cnt; /** ampdu delimiter CRC error count */ t_u32 ampdu_delimiter_crc_error_cnt; - /** Rx Stuck Related Info*/ - /** Rx Stuck Issue count */ + /** Rx Stuck Related Info*/ + /** Rx Stuck Issue count */ t_u32 rx_stuck_issue_cnt[2]; - /** Rx Stuck Recovery count */ + /** Rx Stuck Recovery count */ t_u32 rx_stuck_recovery_cnt; - /** Rx Stuck TSF */ + /** Rx Stuck TSF */ t_u64 rx_stuck_tsf[2]; - /** Tx Watchdog Recovery Related Info */ - /** Tx Watchdog Recovery count */ + /** Tx Watchdog Recovery Related Info */ + /** Tx Watchdog Recovery count */ t_u32 tx_watchdog_recovery_cnt; - /** Tx Watchdog TSF */ + /** Tx Watchdog TSF */ t_u64 tx_watchdog_tsf[2]; - /** Channel Switch Related Info */ - /** Channel Switch Announcement Sent */ + /** Channel Switch Related Info */ + /** Channel Switch Announcement Sent */ t_u32 channel_switch_ann_sent; - /** Channel Switch State */ + /** Channel Switch State */ t_u32 channel_switch_state; - /** Register Class */ + /** Register Class */ t_u32 reg_class; - /** Channel Number */ + /** Channel Number */ t_u32 channel_number; - /** Channel Switch Mode */ + /** Channel Switch Mode */ t_u32 channel_switch_mode; - /** Reset Rx Mac Count */ + /** Reset Rx Mac Count */ t_u32 rx_reset_mac_recovery_cnt; - /** ISR2 Not Done Count*/ + /** ISR2 Not Done Count*/ t_u32 rx_Isr2_NotDone_Cnt; - /** GDMA Abort Count */ + /** GDMA Abort Count */ t_u32 gdma_abort_cnt; - /** Rx Reset MAC Count */ + /** Rx Reset MAC Count */ t_u32 g_reset_rx_mac_cnt; - //Ownership error counters - /*Error Ownership error count */ + // Ownership error counters + /*Error Ownership error count*/ t_u32 dwCtlErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwBcnErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwMgtErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwDatErrCnt; - /*BIGTK MME good count */ + /*BIGTK MME good count*/ t_u32 bigtk_mmeGoodCnt; - /*BIGTK Replay error count */ + /*BIGTK Replay error count*/ t_u32 bigtk_replayErrCnt; - /*BIGTK MIC error count */ + /*BIGTK MIC error count*/ t_u32 bigtk_micErrCnt; - /*BIGTK MME not included count */ + /*BIGTK MME not included count*/ t_u32 bigtk_mmeNotFoundCnt; } MLAN_PACK_END HostCmd_DS_802_11_GET_LOG; @@ -3854,8 +4143,8 @@ /** number of channels */ t_u32 num_channels; /** channel statistics */ - mlan_wifi_channel_stat channels[MAX_NUM_CHAN]; // support only 1 - // channel, so keep it. + mlan_wifi_channel_stat channels[MAX_NUM_CHAN]; // support only 1 + // channel, so keep it. } MLAN_PACK_END mlan_wifi_radio_stat; /** per rate statistics */ @@ -4016,10 +4305,10 @@ typedef MLAN_PACK_START struct _HostCmd_TX_RATE_QUERY { /** Tx rate */ t_u8 tx_rate; - /** V14 FW: Ht Info - * [Bit 0] RxRate format: LG=0, HT=1 - * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1 - * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1 */ + /** V14 FW: Ht Info + * [Bit 0] RxRate format: LG=0, HT=1 + * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1 + * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1 */ /** Tx Rate Info: * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2 * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3 @@ -4141,6 +4430,22 @@ } MLAN_PACK_END HostCmd_DS_SSU_CFG; #endif +/** HostCmd_CMD_CSI_START */ +typedef MLAN_PACK_START struct _HostCmd_DS_CSI_CFG { + /** Action */ + t_u16 action; + /** Header ID*/ + t_u32 head_id; + /** Tail ID */ + t_u32 tail_id; + /** Number of CSI filters */ + t_u8 csi_filter_cnt; + /** Chip ID */ + t_u8 chip_id; + /** CSI filters */ + mlan_csi_filter_t csi_filter[CSI_FILTER_MAX]; +} MLAN_PACK_END HostCmd_DS_CSI_CFG; + typedef MLAN_PACK_START struct _HostCmd_DS_HAL_PHY_CFG { /** Action */ t_u16 action; @@ -4166,6 +4471,8 @@ SignalextEnable_i = 41, ECSAEnable_i = 42, StopDeauth_i = 44, + Dot11H_fakeRadar = 45, + ChanTrackParam_i = 46, } SNMP_MIB_INDEX; /** max SNMP buf size */ @@ -4244,8 +4551,8 @@ typedef MLAN_PACK_START struct _HostCmd_DS_TX_RATE_CFG { /** Action */ t_u16 action; - /** V14 FW: cfg_index */ - /** V15+ FW: reserved_1 */ + /** V14 FW: cfg_index */ + /** V15+ FW: reserved_1 */ t_u16 cfg_index; /* MrvlRateScope_t RateScope; * MrvlRateDropPattern_t RateDrop; */ @@ -4289,7 +4596,7 @@ t_u16 cfg_index; /** Power group configuration mode */ t_u32 mode; - /* MrvlTypes_Power_Group_t PowerGrpCfg[] */ + /* MrvlTypes_Power_Group_t PowerGrpCfg[]*/ t_u8 tlv_buf[]; } MLAN_PACK_END HostCmd_DS_TXPWR_CFG; @@ -4425,7 +4732,8 @@ t_u16 tsf_info; /**tsf */ t_u64 tsf; - /**Positive or negative offset in microsecond from Beacon TSF to GPIO toggle TSF */ + /**Positive or negative offset in microsecond from Beacon TSF to GPIO + * toggle TSF */ t_s32 tsf_offset; } MLAN_PACK_END MrvlIEtypes_GPIO_TSF_LATCH_REPORT; @@ -4463,7 +4771,7 @@ } MLAN_PACK_END HostCmd_DS_COALESCE_CONFIG; /** TLV type : FW support max connection TLV */ -#define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 0x117) /* 0x0217 */ +#define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 0x117) /* 0x0217 */ /** MrvlIEtypes_Max_Conn_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_Max_Conn_t { /** Header */ @@ -4526,7 +4834,7 @@ * TLV_TYPE_CHANLIST, MrvlIEtypes_ChanListParamSet_t * TLV_TYPE_SSID, MrvlIEtypes_SsIdParamSet_t */ - t_u8 tlv_buf[1]; /* SSID TLV(s) and ChanList TLVs are stored here */ + t_u8 tlv_buf[1]; /* SSID TLV(s) and ChanList TLVs are stored here */ } MLAN_PACK_END wlan_scan_cmd_config; /** @@ -4956,7 +5264,7 @@ t_u8 twt_exponent; /** TWT Mantissa Range: [0-sizeof(UINT16)] */ t_u16 twt_mantissa; - /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ + /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ t_u8 twt_request; /** TWT Setup State. Set to 0 by driver, filled by FW in response*/ t_u8 twt_setup_state; @@ -5118,16 +5426,16 @@ typedef MLAN_PACK_START struct { mlan_wmm_queue_stats_action_e action; /**< Start, Stop, or Get */ #ifdef BIG_ENDIAN_SUPPORT - t_u8 select_bin:7; /**< WMM_AC_BK(0) to WMM_AC_VO(3), or TID */ - t_u8 select_is_userpri:1; /**< Set if select_bin is UP, Clear for AC + t_u8 select_bin : 7; /**< WMM_AC_BK(0) to WMM_AC_VO(3), or TID */ + t_u8 select_is_userpri : 1; /**< Set if select_bin is UP, Clear for AC */ #else - t_u8 select_is_userpri:1; /**< Set if select_bin is UP, Clear for AC + t_u8 select_is_userpri : 1; /**< Set if select_bin is UP, Clear for AC */ - t_u8 select_bin:7; /**< WMM_AC_BK(0) to WMM_AC_VO(3), or TID */ + t_u8 select_bin : 7; /**< WMM_AC_BK(0) to WMM_AC_VO(3), or TID */ #endif t_u16 pkt_count; /**< Number of successful packets transmitted */ - t_u16 pkt_loss; /**< Packets lost; not included in pktCount */ + t_u16 pkt_loss; /**< Packets lost; not included in pktCount */ t_u32 avg_queue_delay; /**< Average Queue delay in microsec */ t_u32 avg_tx_delay; /**< Average Transmission delay in microsec */ t_u16 used_time; /**< Calc used time - units of 32 microsec */ @@ -5408,7 +5716,7 @@ typedef MLAN_PACK_START struct _HostCmd_DS_TX_BF_CFG { /* Beamforming action */ t_u16 bf_action; - /* action - SET/GET */ + /* action - SET/GET*/ t_u16 action; MLAN_PACK_START union { @@ -5582,10 +5890,10 @@ #ifdef STA_SUPPORT /** Reserved */ t_u8 reserved_1[32]; -#else /* STA_SUPPORT */ +#else /* STA_SUPPORT */ /** List of channels */ t_u8 channel_list[32]; -#endif /* !STA_SUPPORT */ +#endif /* !STA_SUPPORT */ } MLAN_PACK_END HostCmd_DS_802_11_RF_CHANNEL; /** HostCmd_DS_VERSION_EXT */ @@ -5752,6 +6060,20 @@ t_u32 value; } MLAN_PACK_END HostCmd_DS_MEM_ACCESS; +/** HostCmd_CMD_REG_ACCESS */ +typedef MLAN_PACK_START struct _HostCmd_DS_REG_ACCESS { + /** Action */ + t_u16 action; + /** reg type */ + t_u16 reg_type; + /** reserved */ + t_u16 reserved; + /** register offset */ + t_u16 offset; + /** register value */ + t_u32 value; +} MLAN_PACK_END HostCmd_DS_REG_ACCESS; + /** HostCmd_DS_TARGET_ACCESS */ typedef MLAN_PACK_START struct _HostCmd_DS_TARGET_ACCESS { /** Action */ @@ -5784,6 +6106,25 @@ t_u8 user_data[1]; } MLAN_PACK_END HostCmd_DS_OTP_USER_DATA; +/** HostCmd_DS_FW_AUTO_RECONNECT */ +typedef MLAN_PACK_START struct _HostCmd_DS_FW_AUTO_RECONNECT { + /** ACT_GET/ACT_SET */ + t_u16 action; + /** reconnect counter: + * [0x0]: Do not attempt auto reconnect i.e. disable auto-reconnect + * [0x1-0xFE]: Number of times reconnection needs to be attempted + * [0xFF]: Attempt auto-reconnection forever */ + t_u8 reconnect_counter; + /** reconnect interval */ + t_u8 reconnect_interval; + /** flags: + * [Bit 0]: Set to 1: Firmware should report link-loss to host if AP + * rejects authentication/association while reconnecting Set to 0: + * Default behavior: Firmware does not report link-loss to host on AP + * rejection and continues internally [Bit 1-15]: Reserved */ + t_u16 flags; +} MLAN_PACK_END HostCmd_DS_FW_AUTO_RECONNECT; + /** HostCmd_CMD_HS_WAKEUP_REASON */ typedef MLAN_PACK_START struct _HostCmd_DS_HS_WAKEUP_REASON { /** wakeupReason: @@ -5897,7 +6238,7 @@ t_u8 gpio_wave; } MLAN_PACK_END MrvlIEtypes_WakeupExtend_t; -#define EVENT_MANAGEMENT_FRAME_WAKEUP 136 +#define EVENT_MANAGEMENT_FRAME_WAKEUP 0x00000088 typedef MLAN_PACK_START struct _mgmt_frame_filter { /** action - bitmap ** On matching rx'd pkt and filter during NON_HOSTSLEEP mode: @@ -5987,9 +6328,9 @@ } MLAN_PACK_END HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT; /** TLV type : STA Mac address */ -#define TLV_TYPE_STA_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x20) /* 0x0120 */ +#define TLV_TYPE_STA_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x20) /* 0x0120 */ -#define TLV_TYPE_RANDOM_MAC (PROPRIETARY_TLV_BASE_ID + 0xEC) /*0x01EC */ +#define TLV_TYPE_RANDOM_MAC (PROPRIETARY_TLV_BASE_ID + 0xEC) /*0x01EC*/ /** MrvlIEtypes_MacAddr_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_MacAddr_t { @@ -6019,99 +6360,107 @@ #ifdef UAP_SUPPORT /** TLV type : AP Channel band Config */ #define TLV_TYPE_UAP_CHAN_BAND_CONFIG \ - (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ + (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ /** TLV type : AP Mac address */ -#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b */ +#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b */ /** TLV type : AP Beacon period */ -#define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c \ - */ +#define TLV_TYPE_UAP_BEACON_PERIOD \ + (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c \ + */ /** TLV type : AP DTIM period */ -#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d */ +#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d */ /** TLV type : AP Tx power */ -#define TLV_TYPE_UAP_TX_POWER (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f */ +#define TLV_TYPE_UAP_TX_POWER (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f */ /** TLV type : AP SSID broadcast control */ #define TLV_TYPE_UAP_BCAST_SSID_CTL \ - (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 */ + (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 */ /** TLV type : AP Preamble control */ -#define TLV_TYPE_UAP_PREAMBLE_CTL (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 \ - */ +#define TLV_TYPE_UAP_PREAMBLE_CTL \ + (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 \ + */ /** TLV type : AP Antenna control */ -#define TLV_TYPE_UAP_ANTENNA_CTL (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 */ +#define TLV_TYPE_UAP_ANTENNA_CTL (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 */ /** TLV type : AP RTS threshold */ -#define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 \ - */ +#define TLV_TYPE_UAP_RTS_THRESHOLD \ + (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 \ + */ /** TLV type : AP Tx data rate */ -#define TLV_TYPE_UAP_TX_DATA_RATE (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 \ - */ +#define TLV_TYPE_UAP_TX_DATA_RATE \ + (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 \ + */ /** TLV type: AP Packet forwarding control */ -#define TLV_TYPE_UAP_PKT_FWD_CTL (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 */ +#define TLV_TYPE_UAP_PKT_FWD_CTL (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 */ /** TLV type: STA information */ -#define TLV_TYPE_UAP_STA_INFO (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 */ +#define TLV_TYPE_UAP_STA_INFO (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 */ /** TLV type: AP STA MAC address filter */ #define TLV_TYPE_UAP_STA_MAC_ADDR_FILTER \ - (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 */ + (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 */ /** TLV type: AP STA ageout timer */ #define TLV_TYPE_UAP_STA_AGEOUT_TIMER \ - (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 */ + (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 */ /** TLV type: AP WEP keys */ -#define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b */ +#define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b */ /** TLV type: AP WPA passphrase */ #define TLV_TYPE_UAP_WPA_PASSPHRASE \ - (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ + (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ /** TLV type: AP protocol */ #define TLV_TYPE_UAP_ENCRYPT_PROTOCOL \ - (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 */ + (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 */ /** TLV type: AP AKMP */ -#define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 */ +#define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 */ /** TLV type: AP Fragment threshold */ #define TLV_TYPE_UAP_FRAG_THRESHOLD \ - (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 */ + (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 */ /** TLV type: AP Group rekey timer */ #define TLV_TYPE_UAP_GRP_REKEY_TIME \ - (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 */ + (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 */ /**TLV type : AP Max Station number */ -#define TLV_TYPE_UAP_MAX_STA_CNT (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 */ +#define TLV_TYPE_UAP_MAX_STA_CNT (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 */ /**TLV type : AP Max Station number per chip */ #define TLV_TYPE_UAP_MAX_STA_CNT_PER_CHIP \ - (PROPRIETARY_TLV_BASE_ID + 0x140) /* 0x0240 */ + (PROPRIETARY_TLV_BASE_ID + 0x140) /* 0x0240 */ /**TLV type : AP Retry limit */ -#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d */ +#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d */ /** TLV type : AP MCBC data rate */ #define TLV_TYPE_UAP_MCBC_DATA_RATE \ - (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 */ + (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 */ /**TLV type: AP RSN replay protection */ #define TLV_TYPE_UAP_RSN_REPLAY_PROTECT \ - (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 */ + (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 */ /**TLV type: AP mgmt IE passthru mask */ #define TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK \ - (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 */ + (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 */ /**TLV type: AP pairwise handshake timeout */ #define TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT \ - (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 */ + (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 */ /**TLV type: AP pairwise handshake retries */ #define TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES \ - (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 */ + (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 */ /**TLV type: AP groupwise handshake timeout */ #define TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT \ - (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 */ + (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 */ /**TLV type: AP groupwise handshake retries */ #define TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES \ - (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 */ + (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 */ /** TLV type: AP PS STA ageout timer */ #define TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER \ - (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b */ + (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b */ /** TLV type : Pairwise Cipher */ -#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 */ +#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 */ /** TLV type : Group Cipher */ -#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 */ +#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 */ /** TLV type : BSS Status */ -#define TLV_TYPE_BSS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 */ +#define TLV_TYPE_BSS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 */ /** TLV type : AP WMM params */ -#define TLV_TYPE_AP_WMM_PARAM (PROPRIETARY_TLV_BASE_ID + 0xd0) /* 0x01d0 */ +#define TLV_TYPE_AP_WMM_PARAM (PROPRIETARY_TLV_BASE_ID + 0xd0) /* 0x01d0 */ /** TLV type : AP Tx beacon rate */ -#define TLV_TYPE_UAP_TX_BEACON_RATE (PROPRIETARY_TLV_BASE_ID + 288) /* 0x0220 \ - */ +#define TLV_TYPE_UAP_TX_BEACON_RATE (PROPRIETARY_TLV_BASE_ID + 288) /* 0x0220 \ + */ +#define NXP_802_11_PER_PEER_STATS_CFG_TLV_ID \ + (PROPRIETARY_TLV_BASE_ID + 346) /* 0x025A */ +#define NXP_802_11_PER_PEER_STATS_ENTRY_TLV_ID \ + (PROPRIETARY_TLV_BASE_ID + 347) /* 0x025B */ /** MrvlIEtypes_beacon_period_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_beacon_period_t { @@ -6195,15 +6544,19 @@ t_u16 uap_max_sta; } MLAN_PACK_END MrvlIEtypes_uap_max_sta_cnt_t; -#define MRVL_ACTION_CHAN_SWITCH_ANNOUNCE (PROPRIETARY_TLV_BASE_ID + 0x341) +#define MRVL_ACTION_CHAN_SWITCH_ANNOUNCE (PROPRIETARY_TLV_BASE_ID + 342) /** MrvlIEtypes_uap_chan_switch */ typedef MLAN_PACK_START struct _MrvlIEtypes_action_chan_switch_t { /** Header */ MrvlIEtypesHeader_t header; /* 0 send broadcast CSA action frame, 1 send unicast CSA action frame */ - t_u32 mode; - /**ie buf*/ + t_u8 mode; + /* number of frame */ + t_u8 num_pkt; + /** reserved */ + t_u16 reserved; + /**ie buf*/ t_u8 ie_buf[]; } MLAN_PACK_END MrvlIEtypes_action_chan_switch_t; @@ -6297,6 +6650,10 @@ MrvlIEtypesHeader_t header; /** Authentication type */ t_u8 auth_type; + /** PWE derivation */ + t_u8 PWE_derivation; + /** transition disable */ + t_u8 transition_disable; } MLAN_PACK_END MrvlIEtypes_auth_type_t; /** MrvlIEtypes_encrypt_protocol_t */ @@ -6401,9 +6758,9 @@ /** MrvlIEtypes_wacp_mode_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_wacp_mode_t { - /** Header */ + /** Header */ MrvlIEtypesHeader_t header; - /** wacp_mode */ + /** wacp_mode */ t_u8 wacp_mode; } MLAN_PACK_END MrvlIEtypes_wacp_mode_t; @@ -6481,10 +6838,10 @@ /** Host Command id: POWER_MGMT */ #define HOST_CMD_POWER_MGMT_EXT 0x00ef /** TLV type: AP Sleep param */ -#define TLV_TYPE_AP_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a */ +#define TLV_TYPE_AP_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a */ /** TLV type: AP Inactivity Sleep param */ #define TLV_TYPE_AP_INACT_SLEEP_PARAM \ - (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b */ + (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b */ /** MrvlIEtypes_sleep_param_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_sleep_param_t { @@ -6550,7 +6907,7 @@ } MLAN_PACK_END HostCmd_DS_STA_LIST; /** TLV ID : WAPI Information */ -#define TLV_TYPE_AP_WAPI_INFO (PROPRIETARY_TLV_BASE_ID + 0x67) /* 0x0167 */ +#define TLV_TYPE_AP_WAPI_INFO (PROPRIETARY_TLV_BASE_ID + 0x67) /* 0x0167 */ /** MrvlIEtypes_sta_info_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_wapi_info_t { @@ -6629,16 +6986,196 @@ t_u8 rxpath_antmode; } MLAN_PACK_END HostCmd_DS_MIMO_SWITCH; -#ifdef RX_PACKET_COALESCE -typedef MLAN_PACK_START struct _HostCmd_DS_RX_PKT_COAL_CFG { +typedef MLAN_PACK_START struct _MrvlTypes_DrcsTimeSlice_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Channel Index*/ + t_u16 chan_idx; + /** Channel time (in TU) for chan_idx*/ + t_u8 chantime; + /** Channel swith time (in TU) for chan_idx*/ + t_u8 switchtime; + /** Undoze time (in TU) for chan_idx*/ + t_u8 undozetime; + /** Rx traffic control scheme when channel switch*/ + /** only valid for GC/STA interface*/ + t_u8 mode; +} MLAN_PACK_END MrvlTypes_DrcsTimeSlice_t; +typedef MLAN_PACK_START struct _HostCmd_DS_MULTI_CHAN_CFG { /** Action */ t_u16 action; - /** Packet threshold */ - t_u32 packet_threshold; - /** Timeout */ - t_u16 delay; -} MLAN_PACK_END HostCmd_DS_RX_PKT_COAL_CFG; -#endif + /** Channel time */ + t_u32 channel_time; + /** Buffer weight */ + t_u8 buffer_weight; + /** TLV buffer */ + t_u8 tlv_buf[]; + /* t_u8 *tlv_buf; */ +} MLAN_PACK_END HostCmd_DS_MULTI_CHAN_CFG; + +typedef MLAN_PACK_START struct _HostCmd_DS_DRCS_CFG { + /** Action */ + t_u16 action; + /** TLV buffer */ + MrvlTypes_DrcsTimeSlice_t time_slicing; + /** TLV buffer */ + MrvlTypes_DrcsTimeSlice_t drcs_buf[]; + /* t_u8 *tlv_buf; */ +} MLAN_PACK_END HostCmd_DS_DRCS_CFG; + +typedef MLAN_PACK_START struct _HostCmd_DS_MULTI_CHAN_POLICY { + /** Action */ + t_u16 action; + /** Multi-channel Policy */ + t_u16 policy; +} MLAN_PACK_END HostCmd_DS_MULTI_CHAN_POLICY; + +/** Channel band info */ +typedef MLAN_PACK_START struct _ChannelBandInfo { + /* band config */ + Band_Config_t bandcfg; + /** channel num for specificed band */ + t_u8 chan_num; +} MLAN_PACK_END ChannelBandInfo; + +/** MrvlIETypes_mutli_chan_group_info_t */ +typedef MLAN_PACK_START struct _MrvlIETypes_mutli_chan_group_info_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** channel group id */ + t_u8 chan_group_id; + /** buffer weight for this channel group */ + t_u8 chan_buff_weight; + /** channel number and band information */ + ChannelBandInfo chan_band_info; + /** Max channel time (us) */ + t_u32 channel_time; + /** Reserved */ + t_u32 reserved; + MLAN_PACK_START union { + t_u8 sdio_func_num; + t_u8 usb_epnum; + } MLAN_PACK_END hid_num; + /** interface number in this group */ + t_u8 num_intf; + /** bss_type list */ + t_u8 bss_type_numlist[]; +} MLAN_PACK_END MrvlIEtypes_multi_chan_group_info_t; + +/** MrvlIEtypes_multi_chan_info_t */ +typedef MLAN_PACK_START struct _MrvlIETypes_mutli_chan_info_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** multi channel operation status */ + t_u16 status; + /** Tlv buffer */ + t_u8 tlv_buffer[]; +} MLAN_PACK_END MrvlIEtypes_multi_chan_info_t; + +/** TLV buffer : firmware roam keys */ +typedef MLAN_PACK_START struct _MrvlIEtypes_keyParams_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Tlv buffer */ + t_u8 tlv_buffer[]; +} MLAN_PACK_END MrvlIEtypes_keyParams_t; + +/** TLV buffer : firmware roam enable */ +typedef MLAN_PACK_START struct _MrvlIEtypes_fw_roam_enable_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Enable */ + t_u8 roam_enable; + /** User set passphrase*/ + t_u8 userset_passphrase; +} MLAN_PACK_END MrvlIEtypes_fw_roam_enable_t; +/** HostCmd_DS_ROAM_OFFLOAD */ +typedef MLAN_PACK_START struct _HostCmd_DS_ROAM_OFFLOAD { + /** Action */ + t_u16 action; + /** tlv */ + t_u8 tlv[]; +} MLAN_PACK_END HostCmd_DS_ROAM_OFFLOAD; +/** HostCmd_DS_ROAM_OFFLOAD_APLIST */ +typedef MLAN_PACK_START struct _MrvlIEtypes_roam_aplist_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** AP mac addrs**/ + t_u8 ap_mac[][MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END MrvlIEtypes_roam_aplist_t; +/** MrvlIEtypes_fw_roam_trigger_condition_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_fw_roam_trigger_condition_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Roam offload trigger condition**/ + t_u16 trigger_condition; +} MLAN_PACK_END MrvlIEtypes_fw_roam_trigger_condition_t; +/** MrvlIEtypes_fw_roam_retry_count_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_fw_roam_retry_count_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Roam offload retry count**/ + t_u16 retry_count; +} MLAN_PACK_END MrvlIEtypes_fw_roam_retry_count_t; +/** MrvlIEtypes_fw_roam_bgscan_setting_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_fw_roam_bgscan_setting_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Bss type of BG scan during fw roam**/ + t_u8 bss_type; + /** Number of channels scanned during each scan**/ + t_u8 channels_perscan; + /** Interval between consecutive scans**/ + t_u32 scan_interval; + /** Condition to trigger report to host**/ + t_u32 report_condition; +} MLAN_PACK_END MrvlIEtypes_fw_roam_bgscan_setting_t; +/** MrvlIEtypes_para_rssi_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_para_rssi_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** Max value of RSSI threshold**/ + t_u8 max_rssi; + /** Min value of RSSI threshold**/ + t_u8 min_rssi; + /** Adjusting step value of RSSI threshold**/ + t_u8 step_rssi; +} MLAN_PACK_END MrvlIEtypes_para_rssi_t; +/** MrvlIEtypes_band_rssi_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_band_rssi_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** BAND and RSSI gap*/ + mlan_ds_misc_band_rssi band_rssi; +} MLAN_PACK_END MrvlIEtypes_band_rssi_t; +/** MrvlIEtypes_ees_param_set_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_ees_param_set_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** ees params*/ + mlan_ds_misc_ees_cfg ees_cfg; +} MLAN_PACK_END MrvlIEtypes_ees_param_set_t; +/** MrvlIEtypes_roam_blacklist_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_roam_blacklist_t { + /** Header */ + MrvlIEtypesHeader_t header; + /* Black list(BSSID list)*/ + mlan_ds_misc_roam_offload_aplist blacklist; +} MLAN_PACK_END MrvlIEtypes_roam_blacklist_t; +/** MrvlIEtypes_beacon_miss_threshold_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_beacon_miss_threshold_t { + /** Header */ + MrvlIEtypesHeader_t header; + /* Beacon miss threshold*/ + t_u8 bcn_miss_threshold; +} MLAN_PACK_END MrvlIEtypes_beacon_miss_threshold_t; +/** MrvlIEtypes_pre_beacon_miss_threshold_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_pre_beacon_miss_threshold_t { + /** Header */ + MrvlIEtypesHeader_t header; + /* Pre-Beacon miss threshold*/ + t_u8 pre_bcn_miss_threshold; +} MLAN_PACK_END MrvlIEtypes_pre_beacon_miss_threshold_t; /** HostCmd_DS_DYN_BW */ typedef MLAN_PACK_START struct _HostCmd_DS_DYN_BW { @@ -6670,8 +7207,9 @@ #define HostCmd_CMD_PACKET_AGGR_OVER_HOST_INTERFACE 0x0117 /** TLV ID : USB Aggregation parameters */ -#define MRVL_USB_AGGR_PARAM_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0xB1) /* 0x1B1 \ - */ +#define MRVL_USB_AGGR_PARAM_TLV_ID \ + (PROPRIETARY_TLV_BASE_ID + 0xB1) /* 0x1B1 \ + */ /** TLV size : USB Aggregation parameters, except header */ #define MRVL_USB_AGGR_PARAM_TLV_LEN (14) @@ -6794,7 +7332,7 @@ * Union of the TPC request and response */ typedef MLAN_PACK_START union { - HostCmd_TpcRequest req; /**< Request struct sent to firmware */ + HostCmd_TpcRequest req; /**< Request struct sent to firmware */ HostCmd_TpcResponse resp; /**< Response struct received from firmware */ } MLAN_PACK_END HostCmd_DS_802_11_TPC_ADAPT_REQ; @@ -6823,31 +7361,31 @@ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT /**< Reserved */ - t_u8 rsvd5_7:3; + t_u8 rsvd5_7 : 3; /**< 11k: duration spec. for meas. is mandatory */ - t_u8 duration_mandatory:1; + t_u8 duration_mandatory : 1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 report:1; + t_u8 report : 1; /**< 11h: en/disable requests of specified type */ - t_u8 request:1; + t_u8 request : 1; /**< 11h: enable report/request bits */ - t_u8 enable:1; + t_u8 enable : 1; /**< 11k: series or parallel with previous meas */ - t_u8 parallel:1; + t_u8 parallel : 1; #else /**< 11k: series or parallel with previous meas */ - t_u8 parallel:1; + t_u8 parallel : 1; /**< 11h: enable report/request bits */ - t_u8 enable:1; + t_u8 enable : 1; /**< 11h: en/disable requests of specified type */ - t_u8 request:1; + t_u8 request : 1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 report:1; + t_u8 report : 1; /**< 11k: duration spec. for meas. is mandatory */ - t_u8 duration_mandatory:1; + t_u8 duration_mandatory : 1; /**< Reserved */ - t_u8 rsvd5_7:3; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 rsvd5_7 : 3; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasReqMode_t; @@ -6858,7 +7396,7 @@ t_u8 channel; /**< Channel to measure */ t_u64 start_time; /**< TSF Start time of measurement (0 for immediate) */ - t_u16 duration; /**< TU duration of the measurement */ + t_u16 duration; /**< TU duration of the measurement */ } MLAN_PACK_END MeasReqCommonFormat_t; @@ -6893,16 +7431,16 @@ */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd3_7:5; /**< Reserved */ - t_u8 refused:1; /**< Measurement refused */ - t_u8 incapable:1; /**< Incapable of performing measurement */ - t_u8 late:1; /**< Start TSF time missed for measurement */ + t_u8 rsvd3_7 : 5; /**< Reserved */ + t_u8 refused : 1; /**< Measurement refused */ + t_u8 incapable : 1; /**< Incapable of performing measurement */ + t_u8 late : 1; /**< Start TSF time missed for measurement */ #else - t_u8 late:1; /**< Start TSF time missed for measurement */ - t_u8 incapable:1; /**< Incapable of performing measurement */ - t_u8 refused:1; /**< Measurement refused */ - t_u8 rsvd3_7:5; /**< Reserved */ -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 late : 1; /**< Start TSF time missed for measurement */ + t_u8 incapable : 1; /**< Incapable of performing measurement */ + t_u8 refused : 1; /**< Measurement refused */ + t_u8 rsvd3_7 : 5; /**< Reserved */ +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptMode_t; @@ -6912,7 +7450,7 @@ typedef MLAN_PACK_START struct { t_u8 channel; /**< Channel to measured */ t_u64 start_time; /**< Start time (TSF) of measurement */ - t_u16 duration; /**< Duration of measurement in TUs */ + t_u16 duration; /**< Duration of measurement in TUs */ MeasRptBasicMap_t map; /**< Basic measurement report */ } MLAN_PACK_END MeasRptBasic_t; @@ -6923,7 +7461,7 @@ typedef MLAN_PACK_START struct { t_u8 channel; /**< Channel to measured */ t_u64 start_time; /**< Start time (TSF) of measurement */ - t_u16 duration; /**< Duration of measurement in TUs */ + t_u16 duration; /**< Duration of measurement in TUs */ t_u8 busy_fraction; /**< Fractional duration CCA indicated chan busy */ } MLAN_PACK_END MeasRptCCA_t; @@ -6934,7 +7472,7 @@ typedef MLAN_PACK_START struct { t_u8 channel; /**< Channel to measured */ t_u64 start_time; /**< Start time (TSF) of measurement */ - t_u16 duration; /**< Duration of measurement in TUs */ + t_u16 duration; /**< Duration of measurement in TUs */ t_u8 density[8]; /**< RPI Density histogram report */ } MLAN_PACK_END MeasRptRPI_t; @@ -6956,7 +7494,7 @@ typedef MLAN_PACK_START struct { t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Reporting STA address */ t_u8 dialog_token; /**< Measurement dialog toke */ - MeasReqMode_t req_mode; /**< Report mode */ + MeasReqMode_t req_mode; /**< Report mode */ MeasType_t meas_type; /**< Measurement type */ MeasRequest_t req; /**< Measurement request data */ @@ -6970,7 +7508,7 @@ typedef MLAN_PACK_START struct { t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Reporting STA address */ t_u8 dialog_token; /**< Measurement dialog token */ - MeasRptMode_t rpt_mode; /**< Report mode */ + MeasRptMode_t rpt_mode; /**< Report mode */ MeasType_t meas_type; /**< Measurement type */ MeasReport_t rpt; /**< Measurement report data */ @@ -7034,6 +7572,15 @@ MeasRptBasicMap_t map; /**< IEEE 802.11h basic meas report */ } MLAN_PACK_END MrvlIEtypes_ChanRpt11hBasic_t; +/* MrvlIEtypes_ZeroDfsOperation_t */ +typedef MLAN_PACK_START struct { + /* header */ + MrvlIEtypesHeader_t Header; + /**< 0-DFS Enable/Disable> */ + t_u8 zero_dfs_enbl; + +} MLAN_PACK_END MrvlIEtypes_ZeroDfsOperation_t; + /* MrvlIEtypes_DfsW53Cfg_t*/ typedef MLAN_PACK_START struct { /* header */ @@ -7042,6 +7589,16 @@ t_u8 dfs53cfg; } MLAN_PACK_END MrvlIEtypes_DfsW53Cfg_t; +/* MrvlIEtypes_Rgn_dom_code_t*/ +typedef MLAN_PACK_START struct { + /* header */ + MrvlIEtypesHeader_t header; + /** Domain Code */ + t_u8 domain_code; + /** Reserved field */ + t_u8 reserved; +} MLAN_PACK_END MrvlIEtypes_Rgn_dom_code_t; + typedef MLAN_PACK_START struct { MrvlChannelDesc_t chan_desc; /**< Channel band, number */ t_u32 millisec_dwell_time; /**< Channel dwell time in milliseconds */ @@ -7050,7 +7607,7 @@ typedef MLAN_PACK_START struct { t_u32 cmd_result; /**< Rpt request command result (0 == SUCCESS) */ t_u64 start_tsf; /**< TSF Measurement started */ - t_u32 duration; /**< Duration of measurement in microsecs */ + t_u32 duration; /**< Duration of measurement in microsecs */ t_u8 tlv_buffer[1]; /**< TLV Buffer */ } MLAN_PACK_END HostCmd_DS_CHAN_RPT_RSP; @@ -7192,10 +7749,10 @@ } MLAN_PACK_END HostCmd_DS_AUTO_TX; #define OID_CLOUD_KEEP_ALIVE 0 -#define EVENT_CLOUD_KEEP_ALIVE_RETRY_FAIL 133 +#define EVENT_CLOUD_KEEP_ALIVE_RETRY_FAIL 0x00000085 /** TLV for cloud keep alive control info */ #define TLV_TYPE_CLOUD_KEEP_ALIVE \ - (PROPRIETARY_TLV_BASE_ID + 0x102) /* 0x0100 + 258 */ + (PROPRIETARY_TLV_BASE_ID + 0x102) /* 0x0100 + 258 */ typedef MLAN_PACK_START struct _MrvlIEtypes_Cloud_Keep_Alive_t { /** Header */ MrvlIEtypesHeader_t header; @@ -7209,7 +7766,7 @@ /** TLV for cloud keep alive control info */ #define TLV_TYPE_KEEP_ALIVE_CTRL \ - (PROPRIETARY_TLV_BASE_ID + 0x103) /* 0x0100 + 259 */ + (PROPRIETARY_TLV_BASE_ID + 0x103) /* 0x0100 + 259 */ typedef MLAN_PACK_START struct _MrvlIEtypes_Keep_Alive_Ctrl_t { /** Header */ MrvlIEtypesHeader_t header; @@ -7223,7 +7780,7 @@ /** TLV for cloud keep alive packet */ #define TLV_TYPE_KEEP_ALIVE_PKT \ - (PROPRIETARY_TLV_BASE_ID + 0x104) /* 0x0100 + 260 */ + (PROPRIETARY_TLV_BASE_ID + 0x104) /* 0x0100 + 260 */ typedef MLAN_PACK_START struct _MrvlIEtypes_Keep_Alive_Pkt_t { /** Header */ MrvlIEtypesHeader_t header; @@ -7234,7 +7791,7 @@ } MLAN_PACK_END MrvlIEtypes_Keep_Alive_Pkt_t; /** TLV to indicate firmware only keep probe response while scan */ -#define TLV_TYPE_ONLYPROBERESP (PROPRIETARY_TLV_BASE_ID + 0xE9) /* 0x01E9 */ +#define TLV_TYPE_ONLYPROBERESP (PROPRIETARY_TLV_BASE_ID + 0xE9) /* 0x01E9 */ typedef MLAN_PACK_START struct _MrvlIEtypes_OnlyProberesp_t { /** Header */ MrvlIEtypesHeader_t header; @@ -7624,6 +8181,8 @@ HostCmd_DS_TARGET_ACCESS target; /** BCA register access */ HostCmd_DS_BCA_REG_ACCESS bca_reg; + /** register access */ + HostCmd_DS_REG_ACCESS reg; /** Inactivity timeout extend */ HostCmd_DS_INACTIVITY_TIMEOUT_EXT inactivity_to; #ifdef UAP_SUPPORT @@ -7634,7 +8193,7 @@ HostCmd_DS_POWER_MGMT_EXT pm_cfg; HostCmd_DS_REPORT_MIC report_mic; HostCmd_DS_UAP_OPER_CTRL uap_oper_ctrl; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ HostCmd_DS_TX_RX_HISTOGRAM tx_rx_histogram; /** Sleep period command */ @@ -7648,6 +8207,7 @@ HostCmd_DS_SDIO_PULL_CTRL sdio_pull_ctl; #endif HostCmd_DS_SET_BSS_MODE bss_mode; + HostCmd_DS_802_11_NET_MONITOR net_mon; HostCmd_DS_CMD_TX_DATA_PAUSE tx_data_pause; #if defined(PCIE) #if defined(PCIE8997) || defined(PCIE8897) @@ -7661,17 +8221,18 @@ #endif HostCmd_DS_GPIO_TSF_LATCH_PARAM_CONFIG gpio_tsf_latch; HostCmd_DS_COALESCE_CONFIG coalesce_config; + HostCmd_DS_FW_AUTO_RECONNECT fw_auto_reconnect_cmd; HostCmd_DS_HS_WAKEUP_REASON hs_wakeup_reason; HostCmd_DS_PACKET_AGGR_CTRL aggr_ctrl; #ifdef USB HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE packet_aggr; #endif + HostCmd_DS_MULTI_CHAN_CFG multi_chan_cfg; + HostCmd_DS_MULTI_CHAN_POLICY multi_chan_policy; + HostCmd_DS_DRCS_CFG drcs_cfg; HostCmd_CONFIG_LOW_PWR_MODE low_pwr_mode_cfg; HostCmd_DS_TSF tsf; HostCmd_DS_DFS_REPEATER_MODE dfs_repeater; -#ifdef RX_PACKET_COALESCE - HostCmd_DS_RX_PKT_COAL_CFG rx_pkt_coal_cfg; -#endif HostCmd_DS_EAPOL_PKT eapol_pkt; HostCmd_DS_SENSOR_TEMP temp_sensor; HostCMD_DS_APCMD_ACS_SCAN acs_scan; @@ -7683,6 +8244,7 @@ /** GPIO Independent reset configure */ HostCmd_DS_INDEPENDENT_RESET_CFG ind_rst_cfg; HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT ps_inact_tmo; + HostCmd_DS_ROAM_OFFLOAD roam_offload; HostCmd_DS_CHAN_REGION_CFG reg_cfg; HostCmd_DS_AUTO_TX auto_tx; HostCmd_DS_DYN_BW dyn_bw; @@ -7691,6 +8253,7 @@ #if defined(PCIE) HostCmd_DS_SSU_CFG ssu_params; #endif + HostCmd_DS_CSI_CFG csi_params; /** boot sleep configure */ HostCmd_DS_BOOT_SLEEP boot_sleep; #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) @@ -7723,9 +8286,14 @@ struct mfg_cmd_tx_cont mfg_tx_cont; struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; HostCmd_DS_CMD_ARB_CONFIG arb_cfg; HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG dot11mc_unassoc_ftm_cfg; HostCmd_DS_HAL_PHY_CFG hal_phy_cfg_params; + HostCmd_DS_IPS_CONFIG ips_cfg; + HostCmd_DS_MC_AGGR_CFG mc_aggr_cfg; + HostCmd_DS_STATS stats; + HostCmd_DS_GET_CH_LOAD ch_load; } params; } MLAN_PACK_END HostCmd_DS_COMMAND, *pHostCmd_DS_COMMAND; @@ -7753,6 +8321,15 @@ OPT_Confirm_Sleep ps_cfm_sleep; } MLAN_PACK_END opt_sleep_confirm_buffer; +typedef MLAN_PACK_START struct _MrvlIEtypes_Secure_Boot_Uuid_t { + /** Header */ + MrvlIEtypesHeader_t header; + + /** Secure boot uuid lower and higher 8 bytes */ + t_u64 uuid_lo; + t_u64 uuid_hi; +} MLAN_PACK_END MrvlIEtypes_Secure_Boot_Uuid_t; + /** req host side download vdll block */ #define VDLL_IND_TYPE_REQ 0 /** notify vdll start offset in firmware image */ @@ -7764,13 +8341,13 @@ /** vdll indicate event structure */ typedef MLAN_PACK_START struct _vdll_ind { - /*VDLL ind type */ + /*VDLL ind type*/ t_u16 type; - /*reserved */ + /*reserved*/ t_u16 reserved; - /*indicate the offset downloaded so far */ + /*indicate the offset downloaded so far*/ t_u32 offset; - /*VDLL block size */ + /*VDLL block size*/ t_u16 block_len; } MLAN_PACK_END vdll_ind, *pvdll_ind; #ifdef PRAGMA_PACK
diff --git a/wlan_sd8987/mlan/mlan_ieee.h b/wlan_sd8987/mlan/mlan_ieee.h index aec54d5..cf2ef85 100755 --- a/wlan_sd8987/mlan/mlan_ieee.h +++ b/wlan_sd8987/mlan/mlan_ieee.h
@@ -4,7 +4,7 @@ * definitions used in MLAN and MOAL module. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -42,7 +42,7 @@ typedef enum _WLAN_802_11_NETWORK_TYPE { Wlan802_11FH, Wlan802_11DS, - /* Defined as upper bound */ + /* Defined as upper bound*/ Wlan802_11NetworkTypeMax } WLAN_802_11_NETWORK_TYPE; @@ -67,7 +67,8 @@ typedef enum _IEEEtypes_Ext_ElementId_e { HE_CAPABILITY = 35, - HE_OPERATION = 36 + HE_OPERATION = 36, + HE_6G_CAPABILITY = 59 } IEEEtypes_Ext_ElementId_e; /** IEEE Type definitions */ @@ -101,7 +102,7 @@ MBSSID_INDEX = 85, EXT_CAPABILITY = 127, LINK_ID = 101, - /*IEEE802.11r */ + /*IEEE802.11r*/ MOBILITY_DOMAIN = 54, FAST_BSS_TRANSITION = 55, TIMEOUT_INTERVAL = 56, @@ -180,18 +181,18 @@ typedef MLAN_PACK_START struct _IEEEtypes_FtCapPolicy_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:6; + t_u8 reserved : 6; /** RIC support */ - t_u8 ric:1; + t_u8 ric : 1; /** FT over the DS capable */ - t_u8 ft_over_ds:1; + t_u8 ft_over_ds : 1; #else /** FT over the DS capable */ - t_u8 ft_over_ds:1; + t_u8 ft_over_ds : 1; /** RIC support */ - t_u8 ric:1; + t_u8 ric : 1; /** Reserved */ - t_u8 reserved:6; + t_u8 reserved : 6; #endif } MLAN_PACK_END IEEEtypes_FtCapPolicy_t; @@ -327,54 +328,54 @@ /** Capability Bit Map*/ #ifdef BIG_ENDIAN_SUPPORT typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { - t_u8 rsrvd1:2; - t_u8 dsss_ofdm:1; - t_u8 radio_measurement:1; - t_u8 rsvrd2:1; - t_u8 short_slot_time:1; - t_u8 rsrvd3:1; - t_u8 spectrum_mgmt:1; - t_u8 chan_agility:1; - t_u8 pbcc:1; - t_u8 short_preamble:1; - t_u8 privacy:1; - t_u8 cf_poll_rqst:1; - t_u8 cf_pollable:1; - t_u8 ibss:1; - t_u8 ess:1; + t_u8 rsrvd1 : 2; + t_u8 dsss_ofdm : 1; + t_u8 radio_measurement : 1; + t_u8 rsvrd2 : 1; + t_u8 short_slot_time : 1; + t_u8 rsrvd3 : 1; + t_u8 spectrum_mgmt : 1; + t_u8 chan_agility : 1; + t_u8 pbcc : 1; + t_u8 short_preamble : 1; + t_u8 privacy : 1; + t_u8 cf_poll_rqst : 1; + t_u8 cf_pollable : 1; + t_u8 ibss : 1; + t_u8 ess : 1; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #else typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { /** Capability Bit Map : ESS */ - t_u8 ess:1; + t_u8 ess : 1; /** Capability Bit Map : IBSS */ - t_u8 ibss:1; + t_u8 ibss : 1; /** Capability Bit Map : CF pollable */ - t_u8 cf_pollable:1; + t_u8 cf_pollable : 1; /** Capability Bit Map : CF poll request */ - t_u8 cf_poll_rqst:1; + t_u8 cf_poll_rqst : 1; /** Capability Bit Map : privacy */ - t_u8 privacy:1; + t_u8 privacy : 1; /** Capability Bit Map : Short preamble */ - t_u8 short_preamble:1; + t_u8 short_preamble : 1; /** Capability Bit Map : PBCC */ - t_u8 pbcc:1; + t_u8 pbcc : 1; /** Capability Bit Map : Channel agility */ - t_u8 chan_agility:1; + t_u8 chan_agility : 1; /** Capability Bit Map : Spectrum management */ - t_u8 spectrum_mgmt:1; + t_u8 spectrum_mgmt : 1; /** Capability Bit Map : Reserved */ - t_u8 rsrvd3:1; + t_u8 rsrvd3 : 1; /** Capability Bit Map : Short slot time */ - t_u8 short_slot_time:1; + t_u8 short_slot_time : 1; /** Capability Bit Map : APSD */ - t_u8 Apsd:1; + t_u8 Apsd : 1; /** Capability Bit Map : Reserved */ - t_u8 rsvrd2:1; + t_u8 rsvrd2 : 1; /** Capability Bit Map : DSS OFDM */ - t_u8 dsss_ofdm:1; + t_u8 dsss_ofdm : 1; /** Capability Bit Map : Reserved */ - t_u8 rsrvd1:2; + t_u8 rsrvd1 : 2; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #endif /* BIG_ENDIAN_SUPPORT */ @@ -478,9 +479,9 @@ /** IEEEtypes_SeqCtl_t */ typedef MLAN_PACK_START struct _IEEEtypes_SeqCtl_t { /** Fragment Number */ - t_u16 FragNum:4; + t_u16 FragNum : 4; /** Sequence Number */ - t_u16 SeqNum:12; + t_u16 SeqNum : 12; } MLAN_PACK_END IEEEtypes_SeqCtl_t; /** IEEEtypes_MgmtHdr_t */ @@ -593,63 +594,63 @@ typedef MLAN_PACK_START struct _IEEEtypes_WmmQosInfo_t { #ifdef BIG_ENDIAN_SUPPORT /** QoS UAPSD */ - t_u8 qos_uapsd:1; + t_u8 qos_uapsd : 1; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; #else /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** QoS UAPSD */ - t_u8 qos_uapsd:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 qos_uapsd : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmQosInfo_t, *pIEEEtypes_WmmQosInfo_t; /** Data structure of WMM Aci/Aifsn */ typedef MLAN_PACK_START struct _IEEEtypes_WmmAciAifsn_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:1; + t_u8 reserved : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; #else /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Reserved */ - t_u8 reserved:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmAciAifsn_t, *pIEEEtypes_WmmAciAifsn_t; /** Data structure of WMM ECW */ typedef MLAN_PACK_START struct _IEEEtypes_WmmEcw_t { #ifdef BIG_ENDIAN_SUPPORT /** Maximum Ecw */ - t_u8 ecw_max:4; + t_u8 ecw_max : 4; /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; #else /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; /** Maximum Ecw */ - t_u8 ecw_max:4; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 ecw_max : 4; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmEcw_t, *pIEEEtypes_WmmEcw_t; /** Data structure of WMM AC parameters */ typedef MLAN_PACK_START struct _IEEEtypes_WmmAcParameters_t { IEEEtypes_WmmAciAifsn_t aci_aifsn; /**< AciAifSn */ - IEEEtypes_WmmEcw_t ecw; /**< Ecw */ + IEEEtypes_WmmEcw_t ecw; /**< Ecw */ t_u16 tx_op_limit; /**< Tx op limit */ } MLAN_PACK_END IEEEtypes_WmmAcParameters_t, *pIEEEtypes_WmmAcParameters_t; @@ -732,57 +733,59 @@ /** Data structure of WMM TSPEC information */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 Reserved17_23:7; /* ! Reserved */ - t_u8 Schedule:1; - IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy:2; - t_u8 UserPri:3; /* ! 802.1d User Priority */ - //IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* !Legacy/Trigg*/ - t_u8 PowerSaveBehavior:1; - t_u8 Aggregation:1; /* ! Reserved */ - t_u8 AccessPolicy2:1; /* ! */ - t_u8 AccessPolicy1:1; /* ! */ - IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction:2; - t_u8 TID:4; /* ! Unique identifier */ - //IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; - t_u8 TrafficType:1; + t_u8 Reserved17_23 : 7; /* ! Reserved */ + t_u8 Schedule : 1; + IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy : 2; + t_u8 UserPri : 3; /* ! 802.1d User Priority */ + // IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* + // !Legacy/Trigg*/ + t_u8 PowerSaveBehavior : 1; + t_u8 Aggregation : 1; /* ! Reserved */ + t_u8 AccessPolicy2 : 1; /* ! */ + t_u8 AccessPolicy1 : 1; /* ! */ + IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction : 2; + t_u8 TID : 4; /* ! Unique identifier */ + // IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; + t_u8 TrafficType : 1; #else - //IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; - t_u8 TrafficType:1; - t_u8 TID:4; /* ! Unique identifier */ - IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction:2; - t_u8 AccessPolicy1:1; /* ! */ - t_u8 AccessPolicy2:1; /* ! */ - t_u8 Aggregation:1; /* ! Reserved */ - //IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* ! Legacy/Trigg*/ - t_u8 PowerSaveBehavior:1; - t_u8 UserPri:3; /* ! 802.1d User Priority */ - IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy:2; - t_u8 Schedule:1; - t_u8 Reserved17_23:7; /* ! Reserved */ + // IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; + t_u8 TrafficType : 1; + t_u8 TID : 4; /* ! Unique identifier */ + IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction : 2; + t_u8 AccessPolicy1 : 1; /* ! */ + t_u8 AccessPolicy2 : 1; /* ! */ + t_u8 Aggregation : 1; /* ! Reserved */ + // IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* ! + // Legacy/Trigg*/ + t_u8 PowerSaveBehavior : 1; + t_u8 UserPri : 3; /* ! 802.1d User Priority */ + IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy : 2; + t_u8 Schedule : 1; + t_u8 Reserved17_23 : 7; /* ! Reserved */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_TS_Info_t; /** Data structure of WMM TSPEC Nominal Size */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u16 Fixed:1; /* ! 1: Fixed size given in Size, 0: Var, size is - nominal */ - t_u16 Size:15; /* ! Nominal size in octets */ + t_u16 Fixed : 1; /* ! 1: Fixed size given in Size, 0: Var, size is + nominal */ + t_u16 Size : 15; /* ! Nominal size in octets */ #else - t_u16 Size:15; /* ! Nominal size in octets */ - t_u16 Fixed:1; /* ! 1: Fixed size given in Size, 0: Var, size is - nominal */ + t_u16 Size : 15; /* ! Nominal size in octets */ + t_u16 Fixed : 1; /* ! 1: Fixed size given in Size, 0: Var, size is + nominal */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_NomMSDUSize_t; /** Data structure of WMM TSPEC SBWA */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u16 Whole:3; /* ! Whole portion */ - t_u16 Fractional:13; /* ! Fractional portion */ + t_u16 Whole : 3; /* ! Whole portion */ + t_u16 Fractional : 13; /* ! Fractional portion */ #else - t_u16 Fractional:13; /* ! Fractional portion */ - t_u16 Whole:3; /* ! Whole portion */ + t_u16 Fractional : 13; /* ! Fractional portion */ + t_u16 Whole : 3; /* ! Whole portion */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_SBWA; @@ -810,8 +813,8 @@ typedef MLAN_PACK_START struct { t_u8 ElementId; t_u8 Len; - t_u8 OuiType[4]; /* 00:50:f2:02 */ - t_u8 OuiSubType; /* 01 */ + t_u8 OuiType[4]; /* 00:50:f2:02 */ + t_u8 OuiSubType; /* 01 */ t_u8 Version; IEEEtypes_WMM_TSPEC_Body_t TspecBody; @@ -834,6 +837,7 @@ IEEE_MGMT_ACTION_CATEGORY_UNPROTECT_WNM = 11, IEEE_MGMT_ACTION_CATEGORY_WMM_TSPEC = 17 + } MLAN_PACK_END IEEEtypes_ActionCategory_e; /** WMM TSPEC operations */ @@ -994,7 +998,7 @@ typedef struct MLAN_PACK_START _DSCP_Exception_t { /* DSCP value 0 to 63 or ff */ t_u8 dscp_value; - /* user priority 0-7 */ + /* user priority 0-7*/ t_u8 user_priority; } MLAN_PACK_END DSCP_Exception_t, *pDSCP_Exception_t; @@ -1115,53 +1119,53 @@ /** VHT MCS rate set field, refer to 802.11ac */ typedef MLAN_PACK_START struct _VHT_MCS_set { t_u16 rx_mcs_map; - t_u16 rx_max_rate; /* bit 29-31 reserved */ + t_u16 rx_max_rate; /* bit 29-31 reserved */ t_u16 tx_mcs_map; - t_u16 tx_max_rate; /* bit 61-63 reserved */ + t_u16 tx_max_rate; /* bit 61-63 reserved */ } MLAN_PACK_END VHT_MCS_set_t, *pVHT_MCS_set_t; /** VHT Capabilities info field, reference 802.11ac D1.4 p89 */ typedef MLAN_PACK_START struct _VHT_capa { #if 0 #ifdef BIG_ENDIAN_SUPPORT - t_u8 mpdu_max_len:2; - t_u8 chan_width:2; - t_u8 rx_LDPC:1; - t_u8 sgi_80:1; - t_u8 sgi_160:1; - t_u8 tx_STBC:1; - t_u8 rx_STBC:3; - t_u8 SU_beamformer_capa:1; - t_u8 SU_beamformee_capa:1; - t_u8 beamformer_ante_num:3; - t_u8 sounding_dim_num:3; - t_u8 MU_beamformer_capa:1; - t_u8 MU_beamformee_capa:1; - t_u8 VHT_TXOP_ps:1; - t_u8 HTC_VHT_capa:1; - t_u8 max_ampdu_len:3; - t_u8 link_apapt_capa:2; - t_u8 reserved_1:4; + t_u8 mpdu_max_len:2; + t_u8 chan_width:2; + t_u8 rx_LDPC:1; + t_u8 sgi_80:1; + t_u8 sgi_160:1; + t_u8 tx_STBC:1; + t_u8 rx_STBC:3; + t_u8 SU_beamformer_capa:1; + t_u8 SU_beamformee_capa:1; + t_u8 beamformer_ante_num:3; + t_u8 sounding_dim_num:3; + t_u8 MU_beamformer_capa:1; + t_u8 MU_beamformee_capa:1; + t_u8 VHT_TXOP_ps:1; + t_u8 HTC_VHT_capa:1; + t_u8 max_ampdu_len:3; + t_u8 link_apapt_capa:2; + t_u8 reserved_1:4; #else - t_u8 reserved_1:4; - t_u8 link_apapt_capa:2; - t_u8 max_ampdu_len:3; - t_u8 HTC_VHT_capa:1; - t_u8 VHT_TXOP_ps:1; - t_u8 MU_beamformee_capa:1; - t_u8 MU_beamformer_capa:1; - t_u8 sounding_dim_num:3; - t_u8 beamformer_ante_num:3; - t_u8 SU_beamformee_capa:1; - t_u8 SU_beamformer_capa:1; - t_u8 rx_STBC:3; - t_u8 tx_STBC:1; - t_u8 sgi_160:1; - t_u8 sgi_80:1; - t_u8 rx_LDPC:1; - t_u8 chan_width:2; - t_u8 mpdu_max_len:2; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved_1:4; + t_u8 link_apapt_capa:2; + t_u8 max_ampdu_len:3; + t_u8 HTC_VHT_capa:1; + t_u8 VHT_TXOP_ps:1; + t_u8 MU_beamformee_capa:1; + t_u8 MU_beamformer_capa:1; + t_u8 sounding_dim_num:3; + t_u8 beamformer_ante_num:3; + t_u8 SU_beamformee_capa:1; + t_u8 SU_beamformer_capa:1; + t_u8 rx_STBC:3; + t_u8 tx_STBC:1; + t_u8 sgi_160:1; + t_u8 sgi_80:1; + t_u8 rx_LDPC:1; + t_u8 chan_width:2; + t_u8 mpdu_max_len:2; +#endif /* BIG_ENDIAN_SUPPORT */ #endif t_u32 vht_cap_info; VHT_MCS_set_t mcs_sets; @@ -1269,6 +1273,51 @@ t_u8 data[]; } MLAN_PACK_END IEEEtypes_Extension_t, *pIEEEtypes_Extension_t; +typedef MLAN_PACK_START struct _IEEEtypes_HeMcsMap_t { +#ifdef BIG_ENDIAN_SUPPORT + /** Max HE-MAC for 8 SS */ + t_u8 max_mcs_8ss : 2; + /** Max HE-MAC for 7 SS */ + t_u8 max_mcs_7ss : 2; + /** Max HE-MAC for 6 SS */ + t_u8 max_mcs_6ss : 2; + /** Max HE-MAC for 5 SS */ + t_u8 max_mcs_5ss : 2; + /** Max HE-MAC for 4 SS */ + t_u8 max_mcs_4ss : 2; + /** Max HE-MAC for 3 SS */ + t_u8 max_mcs_3ss : 2; + /** Max HE-MAC for 2 SS */ + t_u8 max_mcs_2ss : 2; + /** Max HE-MAC for 1 SS */ + t_u8 max_mcs_1ss : 2; +#else + /** Max HE-MAC for 1 SS */ + t_u8 max_mcs_1ss : 2; + /** Max HE-MAC for 2 SS */ + t_u8 max_mcs_2ss : 2; + /** Max HE-MAC for 3 SS */ + t_u8 max_mcs_3ss : 2; + /** Max HE-MAC for 4 SS */ + t_u8 max_mcs_4ss : 2; + /** Max HE-MAC for 5 SS */ + t_u8 max_mcs_5ss : 2; + /** Max HE-MAC for 6 SS */ + t_u8 max_mcs_6ss : 2; + /** Max HE-MAC for 7 SS */ + t_u8 max_mcs_7ss : 2; + /** Max HE-MAC for 8 SS */ + t_u8 max_mcs_8ss : 2; +#endif +} MLAN_PACK_END IEEEtypes_HeMcsMap_t, *pIEEEtypes_HeMcsMap_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeMcsNss_t { + /** HE Rx MCS and NSS Set */ + t_u16 rx_mcs; + /** HE Tx MCS and NSS Set*/ + t_u16 tx_mcs; +} MLAN_PACK_END IEEEtypes_HeMcsNss_t, *pIEEEtypes_HeMcsNss_t; + typedef MLAN_PACK_START struct _IEEEtypes_HECap_t { /** Generic IE header */ IEEEtypes_Header_t ieee_hdr; @@ -1278,11 +1327,85 @@ t_u8 he_mac_cap[6]; /** he phy capability info */ t_u8 he_phy_cap[11]; - /** he txrx mcs support , size would be 4 or 8 or 12 */ + /** he txrx mcs support (for 80 MHz) */ t_u8 he_txrx_mcs_support[4]; - /** PPE Thresholds (optional) */ + /** Optional Field, including he_txrx_mcs_support for 160 and 80+80 MHz, + * and PPE Thresholds */ + t_u8 option[28]; } MLAN_PACK_END IEEEtypes_HECap_t, *pIEEEtypes_HECap_t; +typedef MLAN_PACK_START struct _IEEEtypes_HeOpParam_t { +#ifdef BIG_ENDIAN_SUPPORT + /** Reserved, including 6G Operation Info Pressent (bit17) */ + t_u8 reserved : 6; /* bit 18-23 */ + /* 6g operation info present */ + t_u8 he_6g_op_info_present : 1; /* bit 17 */ + /** ER SU Disable */ + t_u8 er_su_disable : 1; /* bit 16 */ + /** Co-Hosted BSS */ + t_u16 co_located_bss : 1; /* bit 15 */ + /** VHT Operation Info Present */ + t_u16 vht_op_info_present : 1; /* bit 14 */ + /** TXOP Duration RTS Threshold */ + t_u16 txop_dur_rts_threshold : 10; /* bit 4-13 */ + /** TWT Required */ + t_u16 twt_req : 1; /* bit 3 */ + /** Default PE Duration */ + t_u16 default_pe_dur : 3; /* bit 0-2 */ +#else + /** Default PE Duration */ + t_u16 default_pe_dur : 3; /* bit 0-2 */ + /** TWT Required */ + t_u16 twt_req : 1; /* bit 3 */ + /** TXOP Duration RTS Threshold */ + t_u16 txop_dur_rts_threshold : 10; /* bit 4-13 */ + /** VHT Operation Info Present */ + t_u16 vht_op_info_present : 1; /* bit 14 */ + /** Co-Hosted BSS */ + t_u16 co_located_bss : 1; /* bit 15 */ + /** ER SU Disable */ + t_u8 er_su_disable : 1; /* bit 16 */ + /* 6g operation info present */ + t_u8 he_6g_op_info_present : 1; /* bit 17 */ + /** Reserved bit 18-23 */ + t_u8 reserved : 6; /* bit 18-23 */ +#endif +} MLAN_PACK_END IEEEtypes_HeOpParam_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeBssColorInfo_t { +#ifdef BIG_ENDIAN_SUPPORT + /** BSS Color Disabled */ + t_u8 bss_color_disabled : 1; /* bit 7 */ + /** Partial BSS Color */ + t_u8 partial_bss_color : 1; /* bit 6 */ + /** BSS Color */ + t_u8 bss_color : 6; /* bit 0-5 */ +#else + /** BSS Color */ + t_u8 bss_color : 6; /* bit 0-5 */ + /** Partial BSS Color */ + t_u8 partial_bss_color : 1; /* bit 6 */ + /** BSS Color Disabled */ + t_u8 bss_color_disabled : 1; /* bit 7 */ +#endif +} MLAN_PACK_END IEEEtypes_HeBssColorInfo_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeOp_t { + /** Generic IE header */ + IEEEtypes_Header_t ieee_hdr; + /** Element id extension */ + t_u8 ext_id; + /** HE Operation Parameters */ + IEEEtypes_HeOpParam_t he_op_param; + /** BSS Color Info */ + IEEEtypes_HeBssColorInfo_t bss_color_info; + /** Basic HE-MCS and NSS Set */ + IEEEtypes_HeMcsMap_t basic_he_mcs_nss; + /** Optional Field, including VHT Operation Info Max Co-Hosted BSSID + * Indicator, and 6Ghz Operation Info */ + t_u8 option[9]; +} MLAN_PACK_END IEEEtypes_HeOp_t; + /** default channel switch count */ #define DEF_CHAN_SWITCH_COUNT 5 @@ -1297,7 +1420,7 @@ t_u8 len; /**< Element length after id and len */ t_u8 chan_switch_mode; /**< STA should not transmit any frames if 1 */ t_u8 new_channel_num; /**< Channel # that AP/IBSS is moving to */ - t_u8 chan_switch_count; /**< # of TBTTs before channel switch */ + t_u8 chan_switch_count; /**< # of TBTTs before channel switch */ } MLAN_PACK_END IEEEtypes_ChanSwitchAnn_t; @@ -1318,7 +1441,7 @@ } MLAN_PACK_END IEEEtypes_ExtChanSwitchAnn_t; /** Maximum number of subbands in the IEEEtypes_SupportedChannels_t structure */ -#define WLAN_11H_MAX_SUBBANDS 5 +#define WLAN_11H_MAX_SUBBANDS 6 /** Maximum number of DFS channels configured in IEEEtypes_IBSS_DFS_t */ #define WLAN_11H_MAX_IBSS_DFS_CHANNELS 25 @@ -1353,7 +1476,7 @@ */ typedef MLAN_PACK_START struct { t_u8 start_chan; /**< Starting channel in the subband */ - t_u8 num_chans; /**< Number of channels in the subband */ + t_u8 num_chans; /**< Number of channels in the subband */ } MLAN_PACK_END IEEEtypes_SupportChan_Subband_t; @@ -1399,7 +1522,8 @@ t_u8 local_max_tp_20mhz; /**< Local Maximum Transmit Power for 20 MHZ>*/ t_u8 local_max_tp_40mhz; /**< Local Maximum Transmit Power for 40 MHZ>*/ t_u8 local_max_tp_80mhz; /**< Local Maximum Transmit Power for 80 MHZ>*/ - t_u8 local_max_tp_160mhz_80_80mhz; /**< Local Maximum Transmit Power for 160/80+80 MHZ>*/ + t_u8 local_max_tp_160mhz_80_80mhz; /**< Local Maximum Transmit Power for + 160/80+80 MHZ>*/ } MLAN_PACK_END IEEEtypes_VhtTpcEnvelope_t; /* IEEE Quiet Period Element (7.3.2.23) */ @@ -1427,31 +1551,31 @@ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT /**< Reserved */ - t_u8 rsvd5_7:3; + t_u8 rsvd5_7 : 3; /**< Channel is unmeasured */ - t_u8 unmeasured:1; + t_u8 unmeasured : 1; /**< Radar detected on channel */ - t_u8 radar:1; + t_u8 radar : 1; /**< Unidentified signal found on channel */ - t_u8 unidentified_sig:1; + t_u8 unidentified_sig : 1; /**< OFDM preamble detected on channel */ - t_u8 ofdm_preamble:1; + t_u8 ofdm_preamble : 1; /**< At least one valid MPDU received on channel */ - t_u8 bss:1; + t_u8 bss : 1; #else /**< At least one valid MPDU received on channel */ - t_u8 bss:1; + t_u8 bss : 1; /**< OFDM preamble detected on channel */ - t_u8 ofdm_preamble:1; + t_u8 ofdm_preamble : 1; /**< Unidentified signal found on channel */ - t_u8 unidentified_sig:1; + t_u8 unidentified_sig : 1; /**< Radar detected on channel */ - t_u8 radar:1; + t_u8 radar : 1; /**< Channel is unmeasured */ - t_u8 unmeasured:1; + t_u8 unmeasured : 1; /**< Reserved */ - t_u8 rsvd5_7:3; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 rsvd5_7 : 3; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1511,9 +1635,9 @@ /*802.11z TDLS action frame type and strcuct */ typedef MLAN_PACK_START struct { - /*link indentifier ie =101 */ + /*link indentifier ie =101*/ t_u8 element_id; - /*len = 18 */ + /*len = 18*/ t_u8 len; /** bssid */ t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; @@ -1687,6 +1811,8 @@ t_u8 bssid_num; /** BSSID filter list used in the to limit the scan results */ mlan_802_11_mac_addr bssid_list[MAX_BSSID_FILTER_LIST]; + /** use scan setting from scan_cfg only */ + t_u8 scan_cfg_only; } MLAN_PACK_END wlan_user_scan_cfg; /** Default scan interval in millisecond*/ @@ -1709,7 +1835,10 @@ /**wait for all channel scan to complete to report scan result*/ #define BG_SCAN_WAIT_ALL_CHAN_DONE 0x80000000 /** Maximum number of channels that can be sent in bg scan config */ -#define WLAN_BG_SCAN_CHAN_MAX 38 +#define CHAN_MAX_24G 14 +#define CHAN_MAX_5G 24 +#define CHAN_MAX_UNII4 3 +#define WLAN_BG_SCAN_CHAN_MAX (CHAN_MAX_24G + CHAN_MAX_5G + CHAN_MAX_UNII4) /** Enumeration definition */ /** EES MODE */ @@ -1810,6 +1939,11 @@ } MLAN_PACK_END wlan_bgscan_cfg; #endif /* STA_SUPPORT */ +/** The open AP in OWE transmition Mode */ +#define OWE_TRANS_MODE_OPEN 1 +/** The security AP in OWE trsnsition Mode */ +#define OWE_TRANS_MODE_OWE 2 + #ifdef PRAGMA_PACK #pragma pack(pop) #endif @@ -1824,6 +1958,15 @@ /** SSID */ mlan_802_11_ssid ssid; + /** Transition MAC address */ + mlan_802_11_mac_addr trans_mac_address; + + /** Transition SSID */ + mlan_802_11_ssid trans_ssid; + + /** OWE Transition mode */ + t_u8 owe_transition_mode; + /** WEP encryption requirement */ t_u32 privacy; @@ -1961,7 +2104,7 @@ #ifdef STA_SUPPORT /** Country information set */ IEEEtypes_CountryInfoFullSet_t country_info; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** WPA IE */ IEEEtypes_VendorSpecific_t *pwpa_ie; @@ -1981,7 +2124,7 @@ /** WAPI IE offset in the beacon buffer */ t_u16 wapi_offset; #endif - /* Hotspot 2.0 OSEN AKM IE */ + /* Hotspot 2.0 OSEN AKM IE*/ IEEEtypes_Generic_t *posen_ie; /** osen IE offset in the beacon buffer */ t_u16 osen_offset; @@ -1996,7 +2139,7 @@ t_u32 beacon_buf_size; /** Max allocated size for updated scan response */ t_u32 beacon_buf_size_max; - /** scan age in secs */ + /** scan age in secs */ t_u32 age_in_secs; } BSSDescriptor_t, *pBSSDescriptor_t;
diff --git a/wlan_sd8987/mlan/mlan_init.c b/wlan_sd8987/mlan/mlan_init.c index 6c29d90..a9fd9cd 100755 --- a/wlan_sd8987/mlan/mlan_init.c +++ b/wlan_sd8987/mlan/mlan_init.c
@@ -65,8 +65,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_add_bsspriotbl(pmlan_private priv) +static mlan_status wlan_add_bsspriotbl(pmlan_private priv) { pmlan_adapter pmadapter = priv->adapter; mlan_bssprio_node *pbssprio = MNULL; @@ -92,11 +91,12 @@ pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur = pbssprio; - util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter->bssprio_tbl[priv->bss_priority]. - bssprio_head, (pmlan_linked_list)pbssprio, - pmadapter->callbacks.moal_spin_lock, - pmadapter->callbacks.moal_spin_unlock); + util_enqueue_list_tail( + pmadapter->pmoal_handle, + &pmadapter->bssprio_tbl[priv->bss_priority].bssprio_head, + (pmlan_linked_list)pbssprio, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); LEAVE(); return status; @@ -109,13 +109,12 @@ * * @return N/A */ -static t_void -wlan_delete_bsspriotbl(pmlan_private priv) +static t_void wlan_delete_bsspriotbl(pmlan_private priv) { int i; pmlan_adapter pmadapter = priv->adapter; mlan_bssprio_node *pbssprio_node = MNULL, *ptmp_node = MNULL, - **ppcur = MNULL; + **ppcur = MNULL; pmlan_list_head phead; ENTER(); @@ -127,16 +126,10 @@ "Delete BSS priority table, index = %d, i = %d, phead = %p, pcur = %p\n", priv->bss_index, i, phead, *ppcur); if (*ppcur) { - pbssprio_node = - (mlan_bssprio_node *)util_peek_list(pmadapter-> - pmoal_handle, - phead, - pmadapter-> - callbacks. - moal_spin_lock, - pmadapter-> - callbacks. - moal_spin_unlock); + pbssprio_node = (mlan_bssprio_node *)util_peek_list( + pmadapter->pmoal_handle, phead, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); while (pbssprio_node && ((pmlan_list_head)pbssprio_node != phead)) { ptmp_node = pbssprio_node->pnext; @@ -144,19 +137,16 @@ PRINTM(MINFO, "Delete node, pnode = %p, pnext = %p\n", pbssprio_node, ptmp_node); - util_unlink_list(pmadapter-> - pmoal_handle, phead, - (pmlan_linked_list) - pbssprio_node, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); - pmadapter->callbacks. - moal_mfree(pmadapter-> - pmoal_handle, - (t_u8 *) - pbssprio_node); + util_unlink_list( + pmadapter->pmoal_handle, phead, + (pmlan_linked_list)pbssprio_node, + pmadapter->callbacks + .moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pbssprio_node); } pbssprio_node = ptmp_node; } @@ -175,8 +165,7 @@ * @return MLAN_STATUS_SUCCESS * */ -static mlan_status -vdll_init(pmlan_adapter pmadapter) +static mlan_status vdll_init(pmlan_adapter pmadapter) { mlan_status status = MLAN_STATUS_SUCCESS; vdll_dnld_ctrl *ctrl = &pmadapter->vdll_ctrl; @@ -199,7 +188,6 @@ LEAVE(); return status; } - /** * @brief The function handles VDLL deinit * @@ -208,8 +196,7 @@ * @return MLAN_STATUS_SUCCESS * */ -static t_void -vdll_deinit(pmlan_adapter pmadapter) +static t_void vdll_deinit(pmlan_adapter pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); @@ -245,20 +232,18 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_allocate_adapter(pmlan_adapter pmadapter) +mlan_status wlan_allocate_adapter(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef STA_SUPPORT t_u32 beacon_buffer_size; t_u32 buf_size; BSSDescriptor_t *ptemp_scan_table = MNULL; - t_u8 chan_2g[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - t_u8 chan_5g[] = { 12, 16, 34, 38, 42, 46, 36, 40, - 44, 48, 52, 56, 60, 64, 100, 104, - 108, 112, 116, 120, 124, 128, 132, 136, - 140, 144, 149, 153, 157, 161, 165 - }; + t_u8 chan_2g[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + t_u8 chan_5g[] = {12, 16, 34, 38, 42, 46, 36, 40, 44, + 48, 52, 56, 60, 64, 100, 104, 108, 112, + 116, 120, 124, 128, 132, 136, 140, 144, 149, + 153, 157, 161, 165, 169, 173, 177}; #endif #ifdef SDIO t_u32 max_mp_regs = 0; @@ -281,15 +266,13 @@ buf_size = sizeof(BSSDescriptor_t) * MRVDRV_MAX_BSSID_LIST; if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - ret = pmadapter->callbacks.moal_vmalloc(pmadapter->pmoal_handle, - buf_size, - (t_u8 **) - &ptemp_scan_table); + ret = pmadapter->callbacks.moal_vmalloc( + pmadapter->pmoal_handle, buf_size, + (t_u8 **)&ptemp_scan_table); else - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - buf_size, MLAN_MEM_DEF, - (t_u8 **) - &ptemp_scan_table); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, buf_size, MLAN_MEM_DEF, + (t_u8 **)&ptemp_scan_table); if (ret != MLAN_STATUS_SUCCESS || !ptemp_scan_table) { PRINTM(MERROR, "Failed to allocate scan table\n"); LEAVE(); @@ -303,16 +286,13 @@ beacon_buffer_size = DEFAULT_SCAN_BEACON_BUFFER; if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - ret = pmadapter->callbacks.moal_vmalloc(pmadapter->pmoal_handle, - beacon_buffer_size, - (t_u8 **)&pmadapter-> - bcn_buf); + ret = pmadapter->callbacks.moal_vmalloc( + pmadapter->pmoal_handle, beacon_buffer_size, + (t_u8 **)&pmadapter->bcn_buf); else - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - beacon_buffer_size, - MLAN_MEM_DEF, - (t_u8 **)&pmadapter-> - bcn_buf); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, beacon_buffer_size, + MLAN_MEM_DEF, (t_u8 **)&pmadapter->bcn_buf); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->bcn_buf) { PRINTM(MERROR, "Failed to allocate bcn buf\n"); LEAVE(); @@ -325,15 +305,13 @@ buf_size = sizeof(ChanStatistics_t) * pmadapter->num_in_chan_stats; if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - ret = pmadapter->callbacks.moal_vmalloc(pmadapter->pmoal_handle, - buf_size, - (t_u8 **)&pmadapter-> - pchan_stats); + ret = pmadapter->callbacks.moal_vmalloc( + pmadapter->pmoal_handle, buf_size, + (t_u8 **)&pmadapter->pchan_stats); else - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - buf_size, MLAN_MEM_DEF, - (t_u8 **)&pmadapter-> - pchan_stats); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, buf_size, MLAN_MEM_DEF, + (t_u8 **)&pmadapter->pchan_stats); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pchan_stats) { PRINTM(MERROR, "Failed to allocate channel statistics\n"); LEAVE(); @@ -348,31 +326,26 @@ LEAVE(); return MLAN_STATUS_FAILURE; } + #ifdef SDIO if (IS_SD(pmadapter->card_type)) { - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - max_mp_regs + - DMA_ALIGNMENT, - MLAN_MEM_DEF | - MLAN_MEM_DMA, - (t_u8 **)&pmadapter-> - pcard_sd->mp_regs_buf); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, max_mp_regs + DMA_ALIGNMENT, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->mp_regs_buf); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->mp_regs_buf) { PRINTM(MERROR, "Failed to allocate mp_regs_buf\n"); LEAVE(); return MLAN_STATUS_FAILURE; } - pmadapter->pcard_sd->mp_regs = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->mp_regs_buf, - DMA_ALIGNMENT); + pmadapter->pcard_sd->mp_regs = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->mp_regs_buf, DMA_ALIGNMENT); - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - MAX_SUPPORT_AMSDU_SIZE, - MLAN_MEM_DEF | - MLAN_MEM_DMA, - (t_u8 **)&pmadapter-> - pcard_sd->rx_buffer); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, MAX_SUPPORT_AMSDU_SIZE, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->rx_buffer); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->rx_buffer) { @@ -380,15 +353,13 @@ LEAVE(); return MLAN_STATUS_FAILURE; } - pmadapter->pcard_sd->rx_buf = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->rx_buffer, - DMA_ALIGNMENT); + pmadapter->pcard_sd->rx_buf = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->rx_buffer, DMA_ALIGNMENT); pmadapter->pcard_sd->max_sp_tx_size = MAX_SUPPORT_AMSDU_SIZE; pmadapter->pcard_sd->max_sp_rx_size = MAX_SUPPORT_AMSDU_SIZE; - ret = wlan_alloc_sdio_mpa_buffers(pmadapter, - mp_tx_aggr_buf_size, - mp_rx_aggr_buf_size); + ret = wlan_alloc_sdio_mpa_buffers( + pmadapter, mp_tx_aggr_buf_size, mp_rx_aggr_buf_size); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Failed to allocate sdio mp-a buffers\n"); @@ -403,19 +374,16 @@ MLAN_SDIO_BLOCK_SIZE; if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - ret = pmadapter->callbacks. - moal_vmalloc(pmadapter->pmoal_handle, - pmadapter->pcard_sd-> - mpa_buf_size, - (t_u8 **)&pmadapter-> - pcard_sd->mpa_buf); + ret = pmadapter->callbacks.moal_vmalloc( + pmadapter->pmoal_handle, + pmadapter->pcard_sd->mpa_buf_size, + (t_u8 **)&pmadapter->pcard_sd->mpa_buf); else - ret = pmadapter->callbacks. - moal_malloc(pmadapter->pmoal_handle, - pmadapter->pcard_sd-> - mpa_buf_size, MLAN_MEM_DEF, - (t_u8 **)&pmadapter-> - pcard_sd->mpa_buf); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, + pmadapter->pcard_sd->mpa_buf_size, + MLAN_MEM_DEF, + (t_u8 **)&pmadapter->pcard_sd->mpa_buf); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->mpa_buf) { PRINTM(MERROR, "Failed to allocate mpa buf\n"); @@ -458,8 +426,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_init_priv(pmlan_private priv) +mlan_status wlan_init_priv(pmlan_private priv) { t_u32 i; pmlan_adapter pmadapter = priv->adapter; @@ -476,7 +443,7 @@ #ifdef STA_SUPPORT priv->pkt_tx_ctrl = 0; priv->bss_mode = MLAN_BSS_MODE_INFRA; - priv->data_rate = 0; /* Initially indicate the rate as auto */ + priv->data_rate = 0; /* Initially indicate the rate as auto */ priv->is_data_rate_auto = MTRUE; priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR; priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR; @@ -488,11 +455,10 @@ memset(pmadapter, &priv->wep_key[i], 0, sizeof(mrvl_wep_key_t)); priv->wep_key_curr_index = 0; priv->ewpa_query = MFALSE; - priv->curr_pkt_filter = - HostCmd_ACT_MAC_STATIC_DYNAMIC_BW_ENABLE | - HostCmd_ACT_MAC_RTS_CTS_ENABLE | - HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON | - HostCmd_ACT_MAC_ETHERNETII_ENABLE; + priv->curr_pkt_filter = HostCmd_ACT_MAC_STATIC_DYNAMIC_BW_ENABLE | + HostCmd_ACT_MAC_RTS_CTS_ENABLE | + HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON | + HostCmd_ACT_MAC_ETHERNETII_ENABLE; priv->beacon_period = MLAN_BEACON_INTERVAL; priv->pattempted_bss_desc = MNULL; @@ -626,7 +592,7 @@ priv->add_ba_param.rx_win_size = MLAN_UAP_AMPDU_DEF_RXWINSIZE; priv->aggr_prio_tbl[6].ampdu_user = priv->aggr_prio_tbl[7].ampdu_user = - BA_STREAM_NOT_ALLOWED; + BA_STREAM_NOT_ALLOWED; } #endif priv->user_rxwinsize = priv->add_ba_param.rx_win_size; @@ -638,15 +604,17 @@ priv->hotspot_cfg = 0; priv->intf_hr_len = pmadapter->ops.intf_header_len; + memset(pmadapter, &priv->chan_rep_req, 0, sizeof(priv->chan_rep_req)); #ifdef USB if (IS_USB(pmadapter->card_type)) { pusb_tx_aggr = wlan_get_usb_tx_aggr_params(pmadapter, priv->port); if (pusb_tx_aggr && pusb_tx_aggr->aggr_ctrl.aggr_mode == - MLAN_USB_AGGR_MODE_LEN_V2) { + MLAN_USB_AGGR_MODE_LEN_V2) { priv->intf_hr_len = MLAN_USB_TX_AGGR_HEADER; } priv->port = pmadapter->tx_data_ep; + priv->port_index = 0; } #endif ret = wlan_add_bsspriotbl(priv); @@ -666,8 +634,7 @@ * * @return N/A */ -t_void -wlan_init_adapter(pmlan_adapter pmadapter) +t_void wlan_init_adapter(pmlan_adapter pmadapter) { opt_sleep_confirm_buffer *sleep_cfm_buf = MNULL; #ifdef USB @@ -677,8 +644,8 @@ if (pmadapter->psleep_cfm) { sleep_cfm_buf = (opt_sleep_confirm_buffer - *)(pmadapter->psleep_cfm->pbuf + - pmadapter->psleep_cfm->data_offset); + *)(pmadapter->psleep_cfm->pbuf + + pmadapter->psleep_cfm->data_offset); } #ifdef MFG_CMD_SUPPORT if (pmadapter->init_para.mfg_mode == MLAN_INIT_PARA_DISABLED) @@ -758,6 +725,8 @@ pmadapter->last_init_cmd = 0; pmadapter->pending_ioctl = MFALSE; pmadapter->scan_processing = MFALSE; + pmadapter->fw_roaming = MFALSE; + pmadapter->userset_passphrase = MFALSE; pmadapter->cmd_timer_is_set = MFALSE; pmadapter->dnld_cmd_in_secs = 0; @@ -817,8 +786,8 @@ if (!pmadapter->multiple_dtim) pmadapter->multiple_dtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; - pmadapter->local_listen_interval = 0; /* default value in firmware will - be used */ + pmadapter->local_listen_interval = 0; /* default value in firmware will + be used */ #endif /* STA_SUPPORT */ pmadapter->is_deep_sleep = MFALSE; @@ -834,15 +803,15 @@ pmadapter->delay_to_ps = DELAY_TO_PS_DEFAULT; pmadapter->enhanced_ps_mode = PS_MODE_AUTO; - pmadapter->gen_null_pkt = MFALSE; /* Disable NULL Pkt generation-default - */ - pmadapter->pps_uapsd_mode = MFALSE; /* Disable pps/uapsd mode -default - */ + pmadapter->gen_null_pkt = MFALSE; /* Disable NULL Pkt generation-default + */ + pmadapter->pps_uapsd_mode = MFALSE; /* Disable pps/uapsd mode -default + */ pmadapter->pm_wakeup_card_req = MFALSE; - pmadapter->pm_wakeup_timeout = 0; pmadapter->pm_wakeup_fw_try = MFALSE; + pmadapter->pm_wakeup_timeout = 0; if (!pmadapter->init_para.max_tx_buf) pmadapter->max_tx_buf_size = @@ -856,6 +825,9 @@ #ifdef USB if (IS_USB(pmadapter->card_type)) { for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { + pmadapter->pcard_usb->usb_port_status[i] = MFALSE; + } + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl.enable = MFALSE; pmadapter->pcard_usb->usb_tx_aggr[i] @@ -864,17 +836,17 @@ pmadapter->pcard_usb->usb_tx_aggr[i] .aggr_ctrl.aggr_align = MLAN_USB_TX_AGGR_V2_ALIGN; - pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl. - aggr_max = MLAN_USB_TX_AGGR_MAX_LEN; - pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl. - aggr_tmo = MLAN_USB_TX_AGGR_TIMEOUT_MSEC * 1000; + pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl.aggr_max = + MLAN_USB_TX_AGGR_MAX_LEN; + pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl.aggr_tmo = + MLAN_USB_TX_AGGR_TIMEOUT_MSEC * 1000; pmadapter->pcard_usb->usb_tx_aggr[i].pmbuf_aggr = MNULL; pmadapter->pcard_usb->usb_tx_aggr[i].aggr_len = 0; pmadapter->pcard_usb->usb_tx_aggr[i].hold_timeout_msec = MLAN_USB_TX_AGGR_TIMEOUT_MSEC; pmadapter->pcard_usb->usb_tx_aggr[i].port = - pmadapter->tx_data_ep; + pmadapter->usb_tx_ports[i]; pmadapter->pcard_usb->usb_tx_aggr[i].phandle = (t_void *)pmadapter; } @@ -978,6 +950,8 @@ pmadapter->arp_filter_size = 0; #endif /* STA_SUPPORT */ + pmadapter->mc_status = MFALSE; + #ifdef PCIE if (IS_PCIE(pmadapter->card_type)) { pmadapter->pcard_pcie->txbd_wrptr = 0; @@ -987,13 +961,13 @@ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->rxbd_wrptr = - pmadapter->pcard_pcie->reg-> - txrx_rw_ptr_rollover_ind; + pmadapter->pcard_pcie->reg + ->txrx_rw_ptr_rollover_ind; pmadapter->pcard_pcie->evtbd_wrptr = EVT_RW_PTR_ROLLOVER_IND; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->rxbd_wrptr = pmadapter->pcard_pcie->txrx_bd_size; @@ -1017,8 +991,7 @@ * otherwise MLAN_STATUS_FAILURE * */ -mlan_status -wlan_init_priv_lock_list(pmlan_adapter pmadapter, t_u8 start_index) +mlan_status wlan_init_priv_lock_list(pmlan_adapter pmadapter, t_u8 start_index) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = MNULL; @@ -1061,21 +1034,20 @@ if (pmadapter->priv[i]) { priv = pmadapter->priv[i]; for (j = 0; j < MAX_NUM_TID; ++j) { - util_init_list_head((t_void *)pmadapter-> - pmoal_handle, - &priv->wmm.tid_tbl_ptr[j]. - ra_list, MTRUE, - priv->adapter->callbacks. - moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[j].ra_list, + MTRUE, + priv->adapter->callbacks.moal_init_lock); } - util_init_list_head((t_void *)pmadapter->pmoal_handle, - &priv->tx_ba_stream_tbl_ptr, MTRUE, - pmadapter->callbacks. - moal_init_lock); - util_init_list_head((t_void *)pmadapter->pmoal_handle, - &priv->rx_reorder_tbl_ptr, MTRUE, - pmadapter->callbacks. - moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->tx_ba_stream_tbl_ptr, MTRUE, + pmadapter->callbacks.moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->rx_reorder_tbl_ptr, MTRUE, + pmadapter->callbacks.moal_init_lock); util_scalar_init((t_void *)pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, 0, priv->wmm.ra_list_spinlock, @@ -1085,20 +1057,20 @@ HIGH_PRIO_TID, priv->wmm.ra_list_spinlock, pmadapter->callbacks.moal_init_lock); - util_init_list_head((t_void *)pmadapter->pmoal_handle, - &priv->sta_list, MTRUE, - pmadapter->callbacks. - moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->sta_list, MTRUE, + pmadapter->callbacks.moal_init_lock); /* Initialize tdls_pending_txq */ - util_init_list_head((t_void *)pmadapter->pmoal_handle, - &priv->tdls_pending_txq, MTRUE, - pmadapter->callbacks. - moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->tdls_pending_txq, MTRUE, + pmadapter->callbacks.moal_init_lock); /* Initialize bypass_txq */ - util_init_list_head((t_void *)pmadapter->pmoal_handle, - &priv->bypass_txq, MTRUE, - pmadapter->callbacks. - moal_init_lock); + util_init_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->bypass_txq, MTRUE, + pmadapter->callbacks.moal_init_lock); } } error: @@ -1116,8 +1088,7 @@ * otherwise MLAN_STATUS_FAILURE * */ -mlan_status -wlan_init_lock_list(pmlan_adapter pmadapter) +mlan_status wlan_init_lock_list(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1164,9 +1135,9 @@ if (IS_USB(pmadapter->card_type)) { for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { if (pcb->moal_init_lock(pmadapter->pmoal_handle, - &pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_lock) != + &pmadapter->pcard_usb + ->usb_tx_aggr[i] + .paggr_lock) != MLAN_STATUS_SUCCESS) { ret = MLAN_STATUS_FAILURE; goto error; @@ -1193,7 +1164,10 @@ util_init_list_head((t_void *)pmadapter->pmoal_handle, &pmadapter->scan_pending_q, MTRUE, pmadapter->callbacks.moal_init_lock); - + /* Initialize ext_cmd_pending_q */ + util_init_list_head((t_void *)pmadapter->pmoal_handle, + &pmadapter->ext_cmd_pending_q, MTRUE, + pmadapter->callbacks.moal_init_lock); /* Initialize ioctl_pending_q */ util_init_list_head((t_void *)pmadapter->pmoal_handle, &pmadapter->ioctl_pending_q, MTRUE, @@ -1212,8 +1186,7 @@ * @return None * */ -t_void -wlan_free_lock_list(pmlan_adapter pmadapter) +t_void wlan_free_lock_list(pmlan_adapter pmadapter) { pmlan_private priv = MNULL; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1244,9 +1217,9 @@ for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { if (pmadapter->pcard_usb->usb_tx_aggr[i].paggr_lock) pcb->moal_free_lock(pmadapter->pmoal_handle, - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_lock); + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .paggr_lock); } } #endif @@ -1287,6 +1260,10 @@ pmadapter->callbacks.moal_free_lock); util_free_list_head((t_void *)pmadapter->pmoal_handle, + &pmadapter->ext_cmd_pending_q, + pmadapter->callbacks.moal_free_lock); + + util_free_list_head((t_void *)pmadapter->pmoal_handle, &pmadapter->ioctl_pending_q, pmadapter->callbacks.moal_free_lock); @@ -1298,43 +1275,39 @@ for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i]) { priv = pmadapter->priv[i]; - util_free_list_head((t_void *)pmadapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_free_lock); - util_free_list_head((t_void *)pmadapter->pmoal_handle, - &priv->tdls_pending_txq, - pmadapter->callbacks. - moal_free_lock); - util_free_list_head((t_void *)pmadapter->pmoal_handle, - &priv->bypass_txq, - pmadapter->callbacks. - moal_free_lock); + util_free_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->sta_list, + priv->adapter->callbacks.moal_free_lock); + util_free_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + pmadapter->callbacks.moal_free_lock); + util_free_list_head( + (t_void *)pmadapter->pmoal_handle, + &priv->bypass_txq, + pmadapter->callbacks.moal_free_lock); for (j = 0; j < MAX_NUM_TID; ++j) - util_free_list_head((t_void *)priv->adapter-> - pmoal_handle, - &priv->wmm.tid_tbl_ptr[j]. - ra_list, - priv->adapter->callbacks. - moal_free_lock); - util_free_list_head((t_void *)priv->adapter-> - pmoal_handle, - &priv->tx_ba_stream_tbl_ptr, - priv->adapter->callbacks. - moal_free_lock); - util_free_list_head((t_void *)priv->adapter-> - pmoal_handle, - &priv->rx_reorder_tbl_ptr, - priv->adapter->callbacks. - moal_free_lock); - util_scalar_free((t_void *)priv->adapter->pmoal_handle, - &priv->wmm.tx_pkts_queued, - priv->adapter->callbacks. - moal_free_lock); - util_scalar_free((t_void *)priv->adapter->pmoal_handle, - &priv->wmm.highest_queued_prio, - priv->adapter->callbacks. - moal_free_lock); + util_free_list_head( + (t_void *)priv->adapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[j].ra_list, + priv->adapter->callbacks.moal_free_lock); + util_free_list_head( + (t_void *)priv->adapter->pmoal_handle, + &priv->tx_ba_stream_tbl_ptr, + priv->adapter->callbacks.moal_free_lock); + util_free_list_head( + (t_void *)priv->adapter->pmoal_handle, + &priv->rx_reorder_tbl_ptr, + priv->adapter->callbacks.moal_free_lock); + util_scalar_free( + (t_void *)priv->adapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + priv->adapter->callbacks.moal_free_lock); + util_scalar_free( + (t_void *)priv->adapter->pmoal_handle, + &priv->wmm.highest_queued_prio, + priv->adapter->callbacks.moal_free_lock); } } @@ -1351,8 +1324,7 @@ * otherwise MLAN_STATUS_FAILURE * */ -mlan_status -wlan_init_timer(pmlan_adapter pmadapter) +mlan_status wlan_init_timer(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1361,23 +1333,21 @@ #endif ENTER(); - if (pcb-> - moal_init_timer(pmadapter->pmoal_handle, - &pmadapter->pmlan_cmd_timer, wlan_cmd_timeout_func, - pmadapter) != MLAN_STATUS_SUCCESS) { + if (pcb->moal_init_timer( + pmadapter->pmoal_handle, &pmadapter->pmlan_cmd_timer, + wlan_cmd_timeout_func, pmadapter) != MLAN_STATUS_SUCCESS) { ret = MLAN_STATUS_FAILURE; goto error; } #if defined(USB) if (IS_USB(pmadapter->card_type)) { for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { - if (pcb->moal_init_timer(pmadapter->pmoal_handle, - &pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_hold_timer, - wlan_usb_tx_aggr_timeout_func, - &pmadapter->pcard_usb-> - usb_tx_aggr[i]) != + if (pcb->moal_init_timer( + pmadapter->pmoal_handle, + &pmadapter->pcard_usb->usb_tx_aggr[i] + .paggr_hold_timer, + wlan_usb_tx_aggr_timeout_func, + &pmadapter->pcard_usb->usb_tx_aggr[i]) != MLAN_STATUS_SUCCESS) { ret = MLAN_STATUS_FAILURE; goto error; @@ -1406,8 +1376,7 @@ * @return None * */ -t_void -wlan_free_timer(pmlan_adapter pmadapter) +t_void wlan_free_timer(pmlan_adapter pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; #if defined(USB) @@ -1422,11 +1391,11 @@ if (IS_USB(pmadapter->card_type)) { for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { if (pmadapter->pcard_usb->usb_tx_aggr[i] - .paggr_hold_timer) + .paggr_hold_timer) pcb->moal_free_timer(pmadapter->pmoal_handle, - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_hold_timer); + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .paggr_hold_timer); } } #endif @@ -1447,8 +1416,7 @@ * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING or * MLAN_STATUS_FAILURE */ -mlan_status -wlan_init_fw(pmlan_adapter pmadapter) +mlan_status wlan_init_fw(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef PCIE @@ -1505,10 +1473,10 @@ * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING or * MLAN_STATUS_FAILURE */ -static void -wlan_update_hw_spec(pmlan_adapter pmadapter) +static void wlan_update_hw_spec(pmlan_adapter pmadapter) { t_u32 i; + MrvlIEtypes_He_cap_t *user_he_cap_tlv = MNULL; ENTER(); @@ -1584,8 +1552,8 @@ for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i]) pmadapter->priv[i]->tx_bf_cap = - pmadapter->pcard_info-> - default_11n_tx_bf_cap; + pmadapter->pcard_info + ->default_11n_tx_bf_cap; } } for (i = 0; i < pmadapter->priv_num; i++) { @@ -1612,15 +1580,37 @@ pmadapter->hw_2g_he_cap, pmadapter->hw_2g_hecap_len, sizeof(pmadapter->priv[i] - ->user_2g_he_cap)); + ->user_2g_he_cap)); pmadapter->priv[i]->user_hecap_len = pmadapter->hw_hecap_len; - memcpy_ext(pmadapter, - pmadapter->priv[i]->user_he_cap, - pmadapter->hw_he_cap, - pmadapter->hw_hecap_len, - sizeof(pmadapter->priv[i]-> - user_he_cap)); + memcpy_ext( + pmadapter, + pmadapter->priv[i]->user_he_cap, + pmadapter->hw_he_cap, + pmadapter->hw_hecap_len, + sizeof(pmadapter->priv[i]->user_he_cap)); + user_he_cap_tlv = + (MrvlIEtypes_He_cap_t *)&pmadapter + ->priv[i] + ->user_2g_he_cap; + if (pmadapter->priv[i]->bss_role == + MLAN_BSS_ROLE_STA) + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_RESP_SUPPORT; + else + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_REQ_SUPPORT; + user_he_cap_tlv = + (MrvlIEtypes_He_cap_t *)&pmadapter + ->priv[i] + ->user_he_cap; + if (pmadapter->priv[i]->bss_role == + MLAN_BSS_ROLE_STA) + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_RESP_SUPPORT; + else + user_he_cap_tlv->he_mac_cap[0] &= + ~HE_MAC_CAP_TWT_REQ_SUPPORT; } } } @@ -1636,8 +1626,7 @@ * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING or * MLAN_STATUS_FAILURE */ -static mlan_status -wlan_init_priv_fw(pmlan_adapter pmadapter) +static mlan_status wlan_init_priv_fw(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = MNULL; @@ -1706,8 +1695,7 @@ * * @return N/A */ -t_void -wlan_free_adapter(pmlan_adapter pmadapter) +t_void wlan_free_adapter(pmlan_adapter pmadapter) { mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; #if defined(USB) @@ -1736,12 +1724,12 @@ if (IS_USB(pmadapter->card_type)) { for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { if (pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_hold_timer_is_set) { + .aggr_hold_timer_is_set) { /* Cancel usb_tx_aggregation timeout timer */ pcb->moal_stop_timer(pmadapter->pmoal_handle, - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_hold_timer); + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .paggr_hold_timer); pmadapter->pcard_usb->usb_tx_aggr[i] .aggr_hold_timer_is_set = MFALSE; } @@ -1791,9 +1779,9 @@ #ifdef SDIO if (IS_SD(pmadapter->card_type)) { if (pmadapter->pcard_sd->mp_regs_buf) { - pcb->moal_mfree(pmadapter->pmoal_handle, - (t_u8 *)pmadapter->pcard_sd-> - mp_regs_buf); + pcb->moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pmadapter->pcard_sd->mp_regs_buf); pmadapter->pcard_sd->mp_regs_buf = MNULL; pmadapter->pcard_sd->mp_regs = MNULL; } @@ -1807,13 +1795,13 @@ #ifdef DEBUG_LEVEL1 if (pmadapter->pcard_sd->mpa_buf) { if (pcb->moal_vmalloc && pcb->moal_vfree) - pcb->moal_vfree(pmadapter->pmoal_handle, - (t_u8 *)pmadapter->pcard_sd-> - mpa_buf); + pcb->moal_vfree( + pmadapter->pmoal_handle, + (t_u8 *)pmadapter->pcard_sd->mpa_buf); else - pcb->moal_mfree(pmadapter->pmoal_handle, - (t_u8 *)pmadapter->pcard_sd-> - mpa_buf); + pcb->moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pmadapter->pcard_sd->mpa_buf); pmadapter->pcard_sd->mpa_buf = MNULL; pmadapter->pcard_sd->mpa_buf_size = 0; } @@ -1873,8 +1861,7 @@ * * @return N/A */ -t_void -wlan_free_priv(mlan_private *pmpriv) +t_void wlan_free_priv(mlan_private *pmpriv) { ENTER(); wlan_clean_txrx(pmpriv); @@ -1886,7 +1873,7 @@ #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) hostsa_cleanup(pmpriv); -#endif /*EMBEDDED AUTHENTICATOR */ +#endif /*EMBEDDED AUTHENTICATOR*/ wlan_delete_station_list(pmpriv); LEAVE(); @@ -1899,8 +1886,7 @@ * * @return N/A */ -static mlan_status -wlan_init_interface(pmlan_adapter pmadapter) +static mlan_status wlan_init_interface(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = MNULL; @@ -1916,22 +1902,16 @@ /* For valid bss_attr, allocate memory for * private structure */ if (pcb->moal_vmalloc && pcb->moal_vfree) - ret = pcb->moal_vmalloc(pmadapter-> - pmoal_handle, - sizeof - (mlan_private), - (t_u8 **) - &pmadapter-> - priv[i]); + ret = pcb->moal_vmalloc( + pmadapter->pmoal_handle, + sizeof(mlan_private), + (t_u8 **)&pmadapter->priv[i]); else - ret = pcb->moal_malloc(pmadapter-> - pmoal_handle, - sizeof - (mlan_private), - MLAN_MEM_DEF, - (t_u8 **) - &pmadapter-> - priv[i]); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + sizeof(mlan_private), + MLAN_MEM_DEF, + (t_u8 **)&pmadapter->priv[i]); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->priv[i]) { ret = MLAN_STATUS_FAILURE; @@ -1956,7 +1936,9 @@ pmadapter->priv[i]->bss_role = MLAN_BSS_ROLE_STA; else if (pmadapter->bss_attr[i].bss_type == - MLAN_BSS_TYPE_UAP) + MLAN_BSS_TYPE_UAP || + pmadapter->bss_attr[i].bss_type == + MLAN_BSS_TYPE_DFS) pmadapter->priv[i]->bss_role = MLAN_BSS_ROLE_UAP; #ifdef WIFI_DIRECT_SUPPORT @@ -1987,7 +1969,7 @@ } } } - /*wmm init */ + /*wmm init*/ wlan_wmm_init(pmadapter); /* Initialize firmware, may return PENDING */ ret = wlan_init_priv_fw(pmadapter); @@ -2005,8 +1987,7 @@ * @return MLAN_STATUS_SUCCESS * The firmware initialization callback succeeded. */ -mlan_status -wlan_get_hw_spec_complete(pmlan_adapter pmadapter) +mlan_status wlan_get_hw_spec_complete(pmlan_adapter pmadapter) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2058,8 +2039,7 @@ * @return MLAN_STATUS_SUCCESS * The firmware initialization callback succeeded. */ -mlan_status -wlan_init_fw_complete(pmlan_adapter pmadapter) +mlan_status wlan_init_fw_complete(pmlan_adapter pmadapter) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2072,14 +2052,14 @@ if (pmadapter->hw_status != WlanHardwareStatusReady) status = MLAN_STATUS_FAILURE; - /* Reconfigure wmm parameter */ + /* Reconfigure wmm parameter*/ if (status == MLAN_STATUS_SUCCESS) { pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_STA); if (pmpriv) status = wlan_prepare_cmd(pmpriv, HostCmd_CMD_WMM_PARAM_CONFIG, - HostCmd_ACT_GEN_SET, 0, - MNULL, &pmadapter->ac_params); + HostCmd_ACT_GEN_SET, 0, MNULL, + &pmadapter->ac_params); } /* Invoke callback */ ret = pcb->moal_init_fw_complete(pmadapter->pmoal_handle, status); @@ -2096,8 +2076,7 @@ * @return MLAN_STATUS_SUCCESS * The firmware shutdown callback succeeded. */ -mlan_status -wlan_shutdown_fw_complete(pmlan_adapter pmadapter) +mlan_status wlan_shutdown_fw_complete(pmlan_adapter pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; mlan_status status = MLAN_STATUS_SUCCESS;
diff --git a/wlan_sd8987/mlan/mlan_init.h b/wlan_sd8987/mlan/mlan_init.h index f8e1738..65e8259 100755 --- a/wlan_sd8987/mlan/mlan_init.h +++ b/wlan_sd8987/mlan/mlan_init.h
@@ -4,7 +4,7 @@ * structures. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_ioctl.h b/wlan_sd8987/mlan/mlan_ioctl.h index 09c11a1..7790db9 100755 --- a/wlan_sd8987/mlan/mlan_ioctl.h +++ b/wlan_sd8987/mlan/mlan_ioctl.h
@@ -3,7 +3,7 @@ * @brief This file declares the IOCTL data structures and APIs. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -110,6 +110,8 @@ MLAN_OID_SNMP_MIB_DTIM_PERIOD = 0x00040006, MLAN_OID_SNMP_MIB_SIGNALEXT_ENABLE = 0x00040007, MLAN_OID_SNMP_MIB_CTRL_DEAUTH = 0x00040008, + MLAN_OID_SNMP_MIB_DOT11H_FAKERADAR = 0x00040009, + MLAN_OID_SNMP_MIB_CHAN_TRACK = 0x0004000A, /* Status Information Group */ MLAN_IOCTL_GET_INFO = 0x00050000, @@ -232,7 +234,10 @@ MLAN_OID_11H_CHAN_REPORT_REQUEST = 0x00110004, MLAN_OID_11H_CHAN_SWITCH_COUNT = 0x00110005, MLAN_OID_11H_CHAN_NOP_INFO = 0x00110006, + MLAN_OID_11H_CHAN_DFS_STATE = 0x00110007, MLAN_OID_11H_DFS_W53_CFG = 0x00110008, + MLAN_OID_11H_DFS_MODE = 0x00110009, + MLAN_OID_11H_NOP_CHAN_LIST = 0x0011000A, /* 802.11n Configuration Group RANDYTODO for value assign */ MLAN_IOCTL_11AC_CFG = 0x00120000, @@ -262,6 +267,7 @@ MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, + MLAN_OID_MISC_NET_MONITOR = 0x00200011, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -276,6 +282,7 @@ #endif MLAN_OID_MISC_HOTSPOT_CFG = 0x0020001C, MLAN_OID_MISC_OTP_USER_DATA = 0x0020001D, + MLAN_OID_MISC_AUTO_ASSOC = 0x0020001E, #ifdef USB MLAN_OID_MISC_USB_AGGR_CTRL = 0x0020001F, #endif @@ -286,6 +293,8 @@ #if defined(STA_SUPPORT) MLAN_OID_MISC_PMFCFG = 0x00200022, #endif + MLAN_OID_MISC_MULTI_CHAN_CFG = 0x00200023, + MLAN_OID_MISC_MULTI_CHAN_POLICY = 0x00200024, #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif @@ -294,9 +303,6 @@ MLAN_OID_MISC_LOW_PWR_MODE = 0x00200029, MLAN_OID_MISC_MEF_FLT_CFG = 0x0020002A, MLAN_OID_MISC_DFS_REAPTER_MODE = 0x0020002B, -#ifdef RX_PACKET_COALESCE - MLAN_OID_MISC_RX_PACKET_COALESCE = 0x0020002C, -#endif MLAN_OID_MISC_TDLS_CS_CHANNEL = 0x0020002D, MLAN_OID_MISC_COALESCE_CFG = 0x0020002E, MLAN_OID_MISC_TDLS_IDLE_TIME = 0x0020002F, @@ -306,10 +312,13 @@ MLAN_OID_MISC_OPER_CLASS = 0x00200038, MLAN_OID_MISC_PMIC_CFG = 0x00200039, MLAN_OID_MISC_IND_RST_CFG = 0x00200040, + MLAN_OID_MISC_ROAM_OFFLOAD = 0x00200042, + MLAN_OID_MISC_ROAM_OFFLOAD_APLIST = 0x00200043, MLAN_OID_MISC_GET_TSF = 0x00200045, MLAN_OID_MISC_GET_CHAN_REGION_CFG = 0x00200046, MLAN_OID_MISC_CLOUD_KEEP_ALIVE = 0x00200048, MLAN_OID_MISC_OPER_CLASS_CHECK = 0x00200049, + MLAN_OID_MISC_DRCS_CFG = 0x00200050, MLAN_OID_MISC_CWMODE_CTRL = 0x00200051, MLAN_OID_MISC_AGGR_CTRL = 0x00200052, @@ -324,6 +333,7 @@ #if defined(PCIE) MLAN_OID_MISC_SSU = 0x00200062, #endif + MLAN_OID_MISC_CSI = 0x00200064, MLAN_OID_MISC_DMCS_CONFIG = 0x00200065, MLAN_OID_MISC_RX_ABORT_CFG = 0x00200066, MLAN_OID_MISC_RX_ABORT_CFG_EXT = 0x00200067, @@ -349,6 +359,12 @@ #endif MLAN_OID_MISC_GPIO_TSF_LATCH = 0x00200082, MLAN_OID_MISC_GET_TSF_INFO = 0x00200083, + MLAN_OID_MISC_ASSOC_REQ = 0x00200084, + MLAN_OID_MISC_IPS_CFG = 0x00200085, + MLAN_OID_MISC_MC_AGGR_CFG = 0x00200086, + MLAN_OID_MISC_CH_LOAD = 0x00200087, + MLAN_OID_MISC_STATS = 0x00200088, + MLAN_OID_MISC_CH_LOAD_RESULTS = 0x00200089, }; /** Sub command size */ @@ -390,6 +406,14 @@ MLAN_PASS_TO_ACT_SCAN_DIS }; +/** Enumeration for passive to active scan */ +enum _mlan_ext_scan { + MLAN_EXTENDED_SCAN_UNCHANGED = 0, + MLAN_LEGACY_SCAN, + MLAN_EXT_SCAN, + MLAN_EXT_SCAN_ENH +}; + /** Max number of supported rates */ #define MLAN_SUPPORTED_RATES 32 @@ -598,6 +622,8 @@ /** Maximum key length */ #define MLAN_MAX_KEY_LENGTH 32 +/** Maximum PMK R0 NAME key length */ +#define MLAN_MAX_PMKR0_NAME_LENGTH 16 /** Maximum atim window in milliseconds */ #define MLAN_MAX_ATIM_WINDOW 50 @@ -630,7 +656,7 @@ } mlan_multicast_list, *pmlan_multicast_list; /** Max channel */ -#define MLAN_MAX_CHANNEL 165 +#define MLAN_MAX_CHANNEL 177 /** Maximum number of channels in table */ #define MLAN_MAX_CHANNEL_NUM 128 @@ -692,6 +718,26 @@ t_u32 assoc_resp_len; } mlan_ds_misc_assoc_rsp, *pmlan_ds_misc_assoc_rsp; +/** Type definition of mlan_ds_misc_assoc_req for MLAN_OID_MISC_ASSOC_REQ */ +typedef struct _mlan_ds_misc_assoc_req { + /** Associate req buffer */ + t_u8 assoc_req_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_req_len; +} mlan_ds_misc_assoc_req, *pmlan_ds_misc_assoc_req; + +/** mlan_ds_assoc_info */ +typedef struct _mlan_ds_assoc_info { + /** Associate req buffer */ + t_u8 assoc_resp_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_resp_len; + /** Associate req buffer */ + t_u8 assoc_req_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_req_len; +} mlan_ds_assoc_info, *pmlan_ds_assoc_info; + /** mlan_ssid_bssid data structure for * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ @@ -720,44 +766,49 @@ t_u8 host_mlme; /** assoicate resp frame/ie from firmware */ mlan_ds_misc_assoc_rsp assoc_rsp; + t_u8 owe_transition_mode; + /** Transition SSID */ + mlan_802_11_ssid trans_ssid; + /** Transition BSSID */ + mlan_802_11_mac_addr trans_bssid; } mlan_ssid_bssid, *pmlan_ssid_bssid; /** Data structure of WMM ECW */ typedef struct _wmm_ecw_t { #ifdef BIG_ENDIAN_SUPPORT /** Maximum Ecw */ - t_u8 ecw_max:4; + t_u8 ecw_max : 4; /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; #else /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; /** Maximum Ecw */ - t_u8 ecw_max:4; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 ecw_max : 4; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_ecw_t, *pwmm_ecw_t; /** Data structure of WMM Aci/Aifsn */ typedef struct _wmm_aci_aifsn_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:1; + t_u8 reserved : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; #else /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Reserved */ - t_u8 reserved:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_aci_aifsn_t, *pwmm_aci_aifsn_t; /** Data structure of WMM AC parameters */ @@ -826,7 +877,7 @@ #define MAX_GRP_TIMER 86400 /** Maximum value of 4 byte configuration */ -#define MAX_VALID_DWORD 0x7FFFFFFF /* (1 << 31) - 1 */ +#define MAX_VALID_DWORD 0x7FFFFFFF /* (1 << 31) - 1 */ /** default UAP BAND 2.4G */ #define DEFAULT_UAP_BAND 0 @@ -865,6 +916,8 @@ #define PROTOCOL_WAPI 0x80 /** WPA3 SAE */ #define PROTOCOL_WPA3_SAE 0x100 +/** OWE */ +#define PROTOCOL_OWE 0x200 /** Key_mgmt_psk */ #define KEY_MGMT_NONE 0x04 @@ -966,19 +1019,19 @@ typedef struct _wmm_qos_info_t { #ifdef BIG_ENDIAN_SUPPORT /** QoS UAPSD */ - t_u8 qos_uapsd:1; + t_u8 qos_uapsd : 1; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; #else /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** QoS UAPSD */ - t_u8 qos_uapsd:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 qos_uapsd : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_qos_info_t, *pwmm_qos_info_t; /** Data structure of WMM parameter IE */ @@ -1064,6 +1117,10 @@ t_u8 channel; /** auth mode */ t_u16 auth_mode; + /** PWE derivation */ + t_u8 pwe_derivation; + /** transition disable */ + t_u8 transition_disable; /** encryption protocol */ t_u16 protocol; /** key managment type */ @@ -1098,7 +1155,7 @@ #ifdef WIFI_DIRECT_SUPPORT /* pre shared key */ t_u8 psk[MLAN_MAX_KEY_LENGTH]; -#endif /* WIFI_DIRECT_SUPPORT */ +#endif /* WIFI_DIRECT_SUPPORT */ /** Number of channels in scan_channel_list */ t_u32 num_of_chan; /** scan channel list in ACS mode */ @@ -1122,6 +1179,8 @@ scan_chan_list chan_list[MLAN_MAX_CHANNEL]; } mlan_uap_scan_channels; +#define MAX_NUM_PKTS 9 +#define DEF_NUM_PKTS 3 /** mlan_chan_switch_param */ typedef struct _mlan_action_chan_switch { /** mode*/ @@ -1130,9 +1189,9 @@ t_u8 chan_switch_mode; /** oper class*/ t_u8 new_oper_class; - /** new channel */ + /** new channel */ t_u8 new_channel_num; - /** chan_switch_count */ + /** chan_switch_count */ t_u8 chan_switch_count; } mlan_action_chan_switch; @@ -1249,7 +1308,7 @@ wmm_parameter_t ap_wmm_para; /** ap scan channels for MLAN_OID_UAP_SCAN_CHANNELS*/ mlan_uap_scan_channels ap_scan_channels; - /** channel switch for MLAN_OID_UAP_CHAN_SWITCH */ + /** channel switch for MLAN_OID_UAP_CHAN_SWITCH */ mlan_action_chan_switch chanswitch; /** ap channel for MLAN_OID_UAP_CHANNEL*/ chan_band_info ap_channel; @@ -1284,8 +1343,8 @@ t_u8 country_code[2]; t_u8 region_code; t_u8 environment; - t_u8 force_reg:1; - t_u8 reserved:7; + t_u8 force_reg : 1; + t_u8 reserved : 7; t_u8 dfs_region; } MLAN_PACK_END otp_region_info_t; @@ -1313,6 +1372,7 @@ BAND_AAC = 64, BAND_GAX = 256, BAND_AAX = 512, + MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME = 0x0020008C, }; @@ -1412,9 +1472,9 @@ }; #define COALESCE_MAX_RULES 8 -#define COALESCE_MAX_BYTESEQ 4 /* non-adjustable */ +#define COALESCE_MAX_BYTESEQ 4 /* non-adjustable */ #define COALESCE_MAX_FILTERS 4 -#define MAX_COALESCING_DELAY 100 /* in msecs */ +#define MAX_COALESCING_DELAY 100 /* in msecs */ #define MAX_PATTERN_LEN 20 #define MAX_OFFSET_LEN 100 @@ -1460,6 +1520,7 @@ t_u8 signalext_enable; /** Control deauth when uap switch channel */ t_u8 deauthctrl; + t_u8 chan_track; } param; } mlan_ds_snmp_mib, *pmlan_ds_snmp_mib; @@ -1631,53 +1692,53 @@ t_u64 rx_octets_in_ampdu_cnt; /** ampdu delimiter CRC error count */ t_u32 ampdu_delimiter_crc_error_cnt; - /** Rx Stuck Related Info*/ - /** Rx Stuck Issue count */ + /** Rx Stuck Related Info*/ + /** Rx Stuck Issue count */ t_u32 rx_stuck_issue_cnt[2]; - /** Rx Stuck Recovery count */ + /** Rx Stuck Recovery count */ t_u32 rx_stuck_recovery_cnt; - /** Rx Stuck TSF */ + /** Rx Stuck TSF */ t_u64 rx_stuck_tsf[2]; - /** Tx Watchdog Recovery Related Info */ - /** Tx Watchdog Recovery count */ + /** Tx Watchdog Recovery Related Info */ + /** Tx Watchdog Recovery count */ t_u32 tx_watchdog_recovery_cnt; - /** Tx Watchdog TSF */ + /** Tx Watchdog TSF */ t_u64 tx_watchdog_tsf[2]; - /** Channel Switch Related Info */ - /** Channel Switch Announcement Sent */ + /** Channel Switch Related Info */ + /** Channel Switch Announcement Sent */ t_u32 channel_switch_ann_sent; - /** Channel Switch State */ + /** Channel Switch State */ t_u32 channel_switch_state; - /** Register Class */ + /** Register Class */ t_u32 reg_class; - /** Channel Number */ + /** Channel Number */ t_u32 channel_number; - /** Channel Switch Mode */ + /** Channel Switch Mode */ t_u32 channel_switch_mode; - /** Reset Rx Mac Count */ + /** Reset Rx Mac Count */ t_u32 rx_reset_mac_recovery_cnt; - /** ISR2 Not Done Count*/ + /** ISR2 Not Done Count*/ t_u32 rx_Isr2_NotDone_Cnt; - /** GDMA Abort Count */ + /** GDMA Abort Count */ t_u32 gdma_abort_cnt; - /** Rx Reset MAC Count */ + /** Rx Reset MAC Count */ t_u32 g_reset_rx_mac_cnt; - //Ownership error counters - /*Error Ownership error count */ + // Ownership error counters + /*Error Ownership error count*/ t_u32 dwCtlErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwBcnErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwMgtErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwDatErrCnt; - /*BIGTK MME good count */ + /*BIGTK MME good count*/ t_u32 bigtk_mmeGoodCnt; - /*BIGTK Replay error count */ + /*BIGTK Replay error count*/ t_u32 bigtk_replayErrCnt; - /*BIGTK MIC error count */ + /*BIGTK MIC error count*/ t_u32 bigtk_micErrCnt; - /*BIGTK MME not included count */ + /*BIGTK MME not included count*/ t_u32 bigtk_mmeNotFoundCnt; } mlan_ds_get_stats, *pmlan_ds_get_stats; @@ -1816,6 +1877,8 @@ t_u32 fw_ver; /** Firmware Hotfix version */ t_u8 hotfix_version; + /** tx buf size */ + t_u16 tx_buf_size; /** MAC address */ mlan_802_11_mac_addr mac_addr; /** 802.11n device capabilities */ @@ -1858,15 +1921,26 @@ t_u8 antinfo; /** max AP associated sta count supported by fw */ t_u8 max_ap_assoc_sta; + /** FW support roaming offload */ + t_u8 fw_roaming_support; /** Bandwidth not support 80Mhz */ t_u8 prohibit_80mhz; /** FW support beacon protection */ t_u8 fw_beacon_prot; + + /* lower 8 bytes of uuid */ + t_u64 uuid_lo; + + /* higher 8 bytes of uuid */ + t_u64 uuid_hi; } mlan_fw_info, *pmlan_fw_info; /** Version string buffer length */ #define MLAN_MAX_VER_STR_LEN 128 +/** Maximum length of secure boot uuid */ +#define MLAN_MAX_UUID_LEN 32 + /** mlan_ver_ext data structure for MLAN_OID_GET_VER_EXT */ typedef struct _mlan_ver_ext { /** Selected version string */ @@ -1879,187 +1953,187 @@ /** Extended Capabilities Data */ typedef struct MLAN_PACK_START _ExtCap_t { /** Extended Capabilities value */ - t_u8 rsvdBit87:1; /* bit 87 */ - t_u8 rsvdBit86:1; /* bit 86 */ - t_u8 rsvdBit85:1; /* bit 85 */ - t_u8 beacon_prot:1; /* bit 84 */ - t_u8 rsvdBit83:1; /* bit 83 */ - t_u8 rsvdBit82:1; /* bit 82 */ - t_u8 rsvdBit81:1; /* bit 81 */ - t_u8 rsvdBit80:1; /* bit 80 */ - t_u8 rsvdBit79:1; /* bit 79 */ - t_u8 TWTResp:1; /* bit 78 */ - t_u8 TWTReq:1; /* bit 77 */ - t_u8 rsvdBit76:1; /* bit 76 */ - t_u8 rsvdBit75:1; /* bit 75 */ - t_u8 rsvdBit74:1; /* bit 74 */ - t_u8 rsvdBit73:1; /* bit 73 */ - t_u8 FILS:1; /* bit 72 */ - t_u8 FTMI:1; /* bit 71 */ - t_u8 FTMR:1; /* bit 70 */ - t_u8 CAQ:1; /* bit 69 */ - t_u8 rsvdBit68:1; /* bit 68 */ - t_u8 NCC:1; /* bit 67 */ - t_u8 rsvdBit66:1; /* bit 66 */ - t_u8 chanSchedMgnt:1; /* bit 65 */ - t_u8 MaxAMSDU1:1; /* bit 64 */ - t_u8 MaxAMSDU0:1; /* bit 63 */ - t_u8 OperModeNtf:1; /* bit 62 */ - t_u8 TDLSWildBandwidth:1; /* bit 61 */ - t_u8 rsvdBit60:1; /* bit 60 */ - t_u8 rsvdBit59:1; /* bit 59 */ - t_u8 rsvdBit58:1; /* bit 58 */ - t_u8 rsvdBit57:1; /* bit 57 */ - t_u8 rsvdBit56:1; /* bit 56 */ - t_u8 rsvdBit55:1; /* bit 55 */ - t_u8 rsvdBit54:1; /* bit 54 */ - t_u8 rsvdBit53:1; /* bit 53 */ - t_u8 rsvdBit52:1; /* bit 52 */ - t_u8 rsvdBit51:1; /* bit 51 */ - t_u8 rsvdBit50:1; /* bit 50 */ - t_u8 rsvdBit49:1; /* bit 49 */ - t_u8 rsvdBit48:1; /* bit 48 */ - t_u8 rsvdBit47:1; /* bit 47 */ - t_u8 rsvdBit46:1; /* bit 46 */ - t_u8 rsvdBit45:1; /* bit 45 */ - t_u8 rsvdBit44:1; /* bit 44 */ - t_u8 rsvdBit43:1; /* bit 43 */ - t_u8 rsvdBit42:1; /* bit 42 */ - t_u8 rsvdBit41:1; /* bit 41 */ - t_u8 rsvdBit40:1; /* bit 40 */ - t_u8 TDLSChlSwitchProhib:1; /* bit 39 */ - t_u8 TDLSProhibited:1; /* bit 38 */ - t_u8 TDLSSupport:1; /* bit 37 */ - t_u8 MSGCF_Capa:1; /* bit 36 */ - t_u8 Reserved35:1; /* bit 35 */ - t_u8 SSPN_Interface:1; /* bit 34 */ - t_u8 EBR:1; /* bit 33 */ - t_u8 Qos_Map:1; /* bit 32 */ - t_u8 Interworking:1; /* bit 31 */ - t_u8 TDLSChannelSwitching:1; /* bit 30 */ - t_u8 TDLSPeerPSMSupport:1; /* bit 29 */ - t_u8 TDLSPeerUAPSDSupport:1; /* bit 28 */ - t_u8 UTC:1; /* bit 27 */ - t_u8 DMS:1; /* bit 26 */ - t_u8 SSID_List:1; /* bit 25 */ - t_u8 ChannelUsage:1; /* bit 24 */ - t_u8 TimingMeasurement:1; /* bit 23 */ - t_u8 MultipleBSSID:1; /* bit 22 */ - t_u8 AC_StationCount:1; /* bit 21 */ - t_u8 QoSTrafficCap:1; /* bit 20 */ - t_u8 BSS_Transition:1; /* bit 19 */ - t_u8 TIM_Broadcast:1; /* bit 18 */ - t_u8 WNM_Sleep:1; /* bit 17 */ - t_u8 TFS:1; /* bit 16 */ - t_u8 GeospatialLocation:1; /* bit 15 */ - t_u8 CivicLocation:1; /* bit 14 */ - t_u8 CollocatedIntf:1; /* bit 13 */ - t_u8 ProxyARPService:1; /* bit 12 */ - t_u8 FMS:1; /* bit 11 */ - t_u8 LocationTracking:1; /* bit 10 */ - t_u8 MulticastDiagnostics:1; /* bit 9 */ - t_u8 Diagnostics:1; /* bit 8 */ - t_u8 Event:1; /* bit 7 */ - t_u8 SPSMP_Support:1; /* bit 6 */ - t_u8 Reserved5:1; /* bit 5 */ - t_u8 PSMP_Capable:1; /* bit 4 */ - t_u8 RejectUnadmFrame:1; /* bit 3 */ - t_u8 ExtChanSwitching:1; /* bit 2 */ - t_u8 Reserved1:1; /* bit 1 */ - t_u8 BSS_CoexistSupport:1; /* bit 0 */ + t_u8 rsvdBit87 : 1; /* bit 87 */ + t_u8 rsvdBit86 : 1; /* bit 86 */ + t_u8 rsvdBit85 : 1; /* bit 85 */ + t_u8 beacon_prot : 1; /* bit 84 */ + t_u8 rsvdBit83 : 1; /* bit 83 */ + t_u8 rsvdBit82 : 1; /* bit 82 */ + t_u8 rsvdBit81 : 1; /* bit 81 */ + t_u8 rsvdBit80 : 1; /* bit 80 */ + t_u8 rsvdBit79 : 1; /* bit 79 */ + t_u8 TWTResp : 1; /* bit 78 */ + t_u8 TWTReq : 1; /* bit 77 */ + t_u8 rsvdBit76 : 1; /* bit 76 */ + t_u8 rsvdBit75 : 1; /* bit 75 */ + t_u8 rsvdBit74 : 1; /* bit 74 */ + t_u8 rsvdBit73 : 1; /* bit 73 */ + t_u8 FILS : 1; /* bit 72 */ + t_u8 FTMI : 1; /* bit 71 */ + t_u8 FTMR : 1; /* bit 70 */ + t_u8 CAQ : 1; /* bit 69 */ + t_u8 rsvdBit68 : 1; /* bit 68 */ + t_u8 NCC : 1; /* bit 67 */ + t_u8 rsvdBit66 : 1; /* bit 66 */ + t_u8 chanSchedMgnt : 1; /* bit 65 */ + t_u8 MaxAMSDU1 : 1; /* bit 64 */ + t_u8 MaxAMSDU0 : 1; /* bit 63 */ + t_u8 OperModeNtf : 1; /* bit 62 */ + t_u8 TDLSWildBandwidth : 1; /* bit 61 */ + t_u8 rsvdBit60 : 1; /* bit 60 */ + t_u8 rsvdBit59 : 1; /* bit 59 */ + t_u8 rsvdBit58 : 1; /* bit 58 */ + t_u8 rsvdBit57 : 1; /* bit 57 */ + t_u8 rsvdBit56 : 1; /* bit 56 */ + t_u8 rsvdBit55 : 1; /* bit 55 */ + t_u8 rsvdBit54 : 1; /* bit 54 */ + t_u8 rsvdBit53 : 1; /* bit 53 */ + t_u8 rsvdBit52 : 1; /* bit 52 */ + t_u8 rsvdBit51 : 1; /* bit 51 */ + t_u8 rsvdBit50 : 1; /* bit 50 */ + t_u8 rsvdBit49 : 1; /* bit 49 */ + t_u8 rsvdBit48 : 1; /* bit 48 */ + t_u8 rsvdBit47 : 1; /* bit 47 */ + t_u8 rsvdBit46 : 1; /* bit 46 */ + t_u8 rsvdBit45 : 1; /* bit 45 */ + t_u8 rsvdBit44 : 1; /* bit 44 */ + t_u8 rsvdBit43 : 1; /* bit 43 */ + t_u8 rsvdBit42 : 1; /* bit 42 */ + t_u8 rsvdBit41 : 1; /* bit 41 */ + t_u8 rsvdBit40 : 1; /* bit 40 */ + t_u8 TDLSChlSwitchProhib : 1; /* bit 39 */ + t_u8 TDLSProhibited : 1; /* bit 38 */ + t_u8 TDLSSupport : 1; /* bit 37 */ + t_u8 MSGCF_Capa : 1; /* bit 36 */ + t_u8 Reserved35 : 1; /* bit 35 */ + t_u8 SSPN_Interface : 1; /* bit 34 */ + t_u8 EBR : 1; /* bit 33 */ + t_u8 Qos_Map : 1; /* bit 32 */ + t_u8 Interworking : 1; /* bit 31 */ + t_u8 TDLSChannelSwitching : 1; /* bit 30 */ + t_u8 TDLSPeerPSMSupport : 1; /* bit 29 */ + t_u8 TDLSPeerUAPSDSupport : 1; /* bit 28 */ + t_u8 UTC : 1; /* bit 27 */ + t_u8 DMS : 1; /* bit 26 */ + t_u8 SSID_List : 1; /* bit 25 */ + t_u8 ChannelUsage : 1; /* bit 24 */ + t_u8 TimingMeasurement : 1; /* bit 23 */ + t_u8 MultipleBSSID : 1; /* bit 22 */ + t_u8 AC_StationCount : 1; /* bit 21 */ + t_u8 QoSTrafficCap : 1; /* bit 20 */ + t_u8 BSS_Transition : 1; /* bit 19 */ + t_u8 TIM_Broadcast : 1; /* bit 18 */ + t_u8 WNM_Sleep : 1; /* bit 17 */ + t_u8 TFS : 1; /* bit 16 */ + t_u8 GeospatialLocation : 1; /* bit 15 */ + t_u8 CivicLocation : 1; /* bit 14 */ + t_u8 CollocatedIntf : 1; /* bit 13 */ + t_u8 ProxyARPService : 1; /* bit 12 */ + t_u8 FMS : 1; /* bit 11 */ + t_u8 LocationTracking : 1; /* bit 10 */ + t_u8 MulticastDiagnostics : 1; /* bit 9 */ + t_u8 Diagnostics : 1; /* bit 8 */ + t_u8 Event : 1; /* bit 7 */ + t_u8 SPSMP_Support : 1; /* bit 6 */ + t_u8 Reserved5 : 1; /* bit 5 */ + t_u8 PSMP_Capable : 1; /* bit 4 */ + t_u8 RejectUnadmFrame : 1; /* bit 3 */ + t_u8 ExtChanSwitching : 1; /* bit 2 */ + t_u8 Reserved1 : 1; /* bit 1 */ + t_u8 BSS_CoexistSupport : 1; /* bit 0 */ } MLAN_PACK_END ExtCap_t, *pExtCap_t; #else /** Extended Capabilities Data */ typedef struct MLAN_PACK_START _ExtCap_t { /** Extended Capabilities value */ - t_u8 BSS_CoexistSupport:1; /* bit 0 */ - t_u8 Reserved1:1; /* bit 1 */ - t_u8 ExtChanSwitching:1; /* bit 2 */ - t_u8 RejectUnadmFrame:1; /* bit 3 */ - t_u8 PSMP_Capable:1; /* bit 4 */ - t_u8 Reserved5:1; /* bit 5 */ - t_u8 SPSMP_Support:1; /* bit 6 */ - t_u8 Event:1; /* bit 7 */ - t_u8 Diagnostics:1; /* bit 8 */ - t_u8 MulticastDiagnostics:1; /* bit 9 */ - t_u8 LocationTracking:1; /* bit 10 */ - t_u8 FMS:1; /* bit 11 */ - t_u8 ProxyARPService:1; /* bit 12 */ - t_u8 CollocatedIntf:1; /* bit 13 */ - t_u8 CivicLocation:1; /* bit 14 */ - t_u8 GeospatialLocation:1; /* bit 15 */ - t_u8 TFS:1; /* bit 16 */ - t_u8 WNM_Sleep:1; /* bit 17 */ - t_u8 TIM_Broadcast:1; /* bit 18 */ - t_u8 BSS_Transition:1; /* bit 19 */ - t_u8 QoSTrafficCap:1; /* bit 20 */ - t_u8 AC_StationCount:1; /* bit 21 */ - t_u8 MultipleBSSID:1; /* bit 22 */ - t_u8 TimingMeasurement:1; /* bit 23 */ - t_u8 ChannelUsage:1; /* bit 24 */ - t_u8 SSID_List:1; /* bit 25 */ - t_u8 DMS:1; /* bit 26 */ - t_u8 UTC:1; /* bit 27 */ - t_u8 TDLSPeerUAPSDSupport:1; /* bit 28 */ - t_u8 TDLSPeerPSMSupport:1; /* bit 29 */ - t_u8 TDLSChannelSwitching:1; /* bit 30 */ - t_u8 Interworking:1; /* bit 31 */ - t_u8 Qos_Map:1; /* bit 32 */ - t_u8 EBR:1; /* bit 33 */ - t_u8 SSPN_Interface:1; /* bit 34 */ - t_u8 Reserved35:1; /* bit 35 */ - t_u8 MSGCF_Capa:1; /* bit 36 */ - t_u8 TDLSSupport:1; /* bit 37 */ - t_u8 TDLSProhibited:1; /* bit 38 */ - t_u8 TDLSChlSwitchProhib:1; /* bit 39 */ - t_u8 rsvdBit40:1; /* bit 40 */ - t_u8 rsvdBit41:1; /* bit 41 */ - t_u8 rsvdBit42:1; /* bit 42 */ - t_u8 rsvdBit43:1; /* bit 43 */ - t_u8 rsvdBit44:1; /* bit 44 */ - t_u8 rsvdBit45:1; /* bit 45 */ - t_u8 rsvdBit46:1; /* bit 46 */ - t_u8 rsvdBit47:1; /* bit 47 */ - t_u8 rsvdBit48:1; /* bit 48 */ - t_u8 rsvdBit49:1; /* bit 49 */ - t_u8 rsvdBit50:1; /* bit 50 */ - t_u8 rsvdBit51:1; /* bit 51 */ - t_u8 rsvdBit52:1; /* bit 52 */ - t_u8 rsvdBit53:1; /* bit 53 */ - t_u8 rsvdBit54:1; /* bit 54 */ - t_u8 rsvdBit55:1; /* bit 55 */ - t_u8 rsvdBit56:1; /* bit 56 */ - t_u8 rsvdBit57:1; /* bit 57 */ - t_u8 rsvdBit58:1; /* bit 58 */ - t_u8 rsvdBit59:1; /* bit 59 */ - t_u8 rsvdBit60:1; /* bit 60 */ - t_u8 TDLSWildBandwidth:1; /* bit 61 */ - t_u8 OperModeNtf:1; /* bit 62 */ - t_u8 MaxAMSDU0:1; /* bit 63 */ - t_u8 MaxAMSDU1:1; /* bit 64 */ - t_u8 chanSchedMgnt:1; /* bit 65 */ - t_u8 rsvdBit66:1; /* bit 66 */ - t_u8 NCC:1; /* bit 67 */ - t_u8 rsvdBit68:1; /* bit 68 */ - t_u8 CAQ:1; /* bit 69 */ - t_u8 FTMR:1; /* bit 70 */ - t_u8 FTMI:1; /* bit 71 */ - t_u8 FILS:1; /* bit 72 */ - t_u8 rsvdBit73:1; /* bit 73 */ - t_u8 rsvdBit74:1; /* bit 74 */ - t_u8 rsvdBit75:1; /* bit 75 */ - t_u8 rsvdBit76:1; /* bit 76 */ - t_u8 TWTReq:1; /* bit 77 */ - t_u8 TWTResp:1; /* bit 78 */ - t_u8 rsvdBit79:1; /* bit 79 */ - t_u8 rsvdBit80:1; /* bit 80 */ - t_u8 rsvdBit81:1; /* bit 81 */ - t_u8 rsvdBit82:1; /* bit 82 */ - t_u8 rsvdBit83:1; /* bit 83 */ - t_u8 beacon_prot:1; /* bit 84 */ - t_u8 rsvdBit85:1; /* bit 85 */ - t_u8 rsvdBit86:1; /* bit 86 */ - t_u8 rsvdBit87:1; /* bit 87 */ + t_u8 BSS_CoexistSupport : 1; /* bit 0 */ + t_u8 Reserved1 : 1; /* bit 1 */ + t_u8 ExtChanSwitching : 1; /* bit 2 */ + t_u8 RejectUnadmFrame : 1; /* bit 3 */ + t_u8 PSMP_Capable : 1; /* bit 4 */ + t_u8 Reserved5 : 1; /* bit 5 */ + t_u8 SPSMP_Support : 1; /* bit 6 */ + t_u8 Event : 1; /* bit 7 */ + t_u8 Diagnostics : 1; /* bit 8 */ + t_u8 MulticastDiagnostics : 1; /* bit 9 */ + t_u8 LocationTracking : 1; /* bit 10 */ + t_u8 FMS : 1; /* bit 11 */ + t_u8 ProxyARPService : 1; /* bit 12 */ + t_u8 CollocatedIntf : 1; /* bit 13 */ + t_u8 CivicLocation : 1; /* bit 14 */ + t_u8 GeospatialLocation : 1; /* bit 15 */ + t_u8 TFS : 1; /* bit 16 */ + t_u8 WNM_Sleep : 1; /* bit 17 */ + t_u8 TIM_Broadcast : 1; /* bit 18 */ + t_u8 BSS_Transition : 1; /* bit 19 */ + t_u8 QoSTrafficCap : 1; /* bit 20 */ + t_u8 AC_StationCount : 1; /* bit 21 */ + t_u8 MultipleBSSID : 1; /* bit 22 */ + t_u8 TimingMeasurement : 1; /* bit 23 */ + t_u8 ChannelUsage : 1; /* bit 24 */ + t_u8 SSID_List : 1; /* bit 25 */ + t_u8 DMS : 1; /* bit 26 */ + t_u8 UTC : 1; /* bit 27 */ + t_u8 TDLSPeerUAPSDSupport : 1; /* bit 28 */ + t_u8 TDLSPeerPSMSupport : 1; /* bit 29 */ + t_u8 TDLSChannelSwitching : 1; /* bit 30 */ + t_u8 Interworking : 1; /* bit 31 */ + t_u8 Qos_Map : 1; /* bit 32 */ + t_u8 EBR : 1; /* bit 33 */ + t_u8 SSPN_Interface : 1; /* bit 34 */ + t_u8 Reserved35 : 1; /* bit 35 */ + t_u8 MSGCF_Capa : 1; /* bit 36 */ + t_u8 TDLSSupport : 1; /* bit 37 */ + t_u8 TDLSProhibited : 1; /* bit 38 */ + t_u8 TDLSChlSwitchProhib : 1; /* bit 39 */ + t_u8 rsvdBit40 : 1; /* bit 40 */ + t_u8 rsvdBit41 : 1; /* bit 41 */ + t_u8 rsvdBit42 : 1; /* bit 42 */ + t_u8 rsvdBit43 : 1; /* bit 43 */ + t_u8 rsvdBit44 : 1; /* bit 44 */ + t_u8 rsvdBit45 : 1; /* bit 45 */ + t_u8 rsvdBit46 : 1; /* bit 46 */ + t_u8 rsvdBit47 : 1; /* bit 47 */ + t_u8 rsvdBit48 : 1; /* bit 48 */ + t_u8 rsvdBit49 : 1; /* bit 49 */ + t_u8 rsvdBit50 : 1; /* bit 50 */ + t_u8 rsvdBit51 : 1; /* bit 51 */ + t_u8 rsvdBit52 : 1; /* bit 52 */ + t_u8 rsvdBit53 : 1; /* bit 53 */ + t_u8 rsvdBit54 : 1; /* bit 54 */ + t_u8 rsvdBit55 : 1; /* bit 55 */ + t_u8 rsvdBit56 : 1; /* bit 56 */ + t_u8 rsvdBit57 : 1; /* bit 57 */ + t_u8 rsvdBit58 : 1; /* bit 58 */ + t_u8 rsvdBit59 : 1; /* bit 59 */ + t_u8 rsvdBit60 : 1; /* bit 60 */ + t_u8 TDLSWildBandwidth : 1; /* bit 61 */ + t_u8 OperModeNtf : 1; /* bit 62 */ + t_u8 MaxAMSDU0 : 1; /* bit 63 */ + t_u8 MaxAMSDU1 : 1; /* bit 64 */ + t_u8 chanSchedMgnt : 1; /* bit 65 */ + t_u8 rsvdBit66 : 1; /* bit 66 */ + t_u8 NCC : 1; /* bit 67 */ + t_u8 rsvdBit68 : 1; /* bit 68 */ + t_u8 CAQ : 1; /* bit 69 */ + t_u8 FTMR : 1; /* bit 70 */ + t_u8 FTMI : 1; /* bit 71 */ + t_u8 FILS : 1; /* bit 72 */ + t_u8 rsvdBit73 : 1; /* bit 73 */ + t_u8 rsvdBit74 : 1; /* bit 74 */ + t_u8 rsvdBit75 : 1; /* bit 75 */ + t_u8 rsvdBit76 : 1; /* bit 76 */ + t_u8 TWTReq : 1; /* bit 77 */ + t_u8 TWTResp : 1; /* bit 78 */ + t_u8 rsvdBit79 : 1; /* bit 79 */ + t_u8 rsvdBit80 : 1; /* bit 80 */ + t_u8 rsvdBit81 : 1; /* bit 81 */ + t_u8 rsvdBit82 : 1; /* bit 82 */ + t_u8 rsvdBit83 : 1; /* bit 83 */ + t_u8 beacon_prot : 1; /* bit 84 */ + t_u8 rsvdBit85 : 1; /* bit 85 */ + t_u8 rsvdBit86 : 1; /* bit 86 */ + t_u8 rsvdBit87 : 1; /* bit 87 */ } MLAN_PACK_END ExtCap_t, *pExtCap_t; #endif @@ -2079,7 +2153,7 @@ /** Channel */ t_u32 bss_chan; /** Band */ - t_u8 bss_band; + t_u16 bss_band; /** Region code */ t_u32 region_code; /** Connection status */ @@ -2117,7 +2191,7 @@ t_u8 peer_supp_rates[MLAN_SUPPORTED_RATES]; /** extend capability for AP */ ExtCap_t ext_cap; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Mobility Domain ID */ t_u16 mdid; /** FT Capability policy */ @@ -2187,6 +2261,8 @@ t_u8 ht_cap[IEEE_MAX_IE_SIZE]; /** VHT Capabilities IE */ t_u8 vht_cap[IEEE_MAX_IE_SIZE]; + /** HE Capabilities IE */ + t_u8 he_cap[IEEE_MAX_IE_SIZE]; } tdls_peer_info; /** max ralist num */ @@ -2269,6 +2345,8 @@ t_u32 bypass_pkt_count; /** Corresponds to scan_processing member of mlan_adapter */ t_u32 scan_processing; + /** Corresponds to scan_state member of mlan_adapter */ + t_u32 scan_state; /** Corresponds to mlan_processing member of mlan_adapter */ t_u32 mlan_processing; /** Corresponds to main_lock_flag member of mlan_adapter */ @@ -2316,9 +2394,9 @@ t_u32 mpa_sent_no_ports; /** last recv wr_bitmap */ t_u32 last_recv_wr_bitmap; - /** last recv rd_bitmap */ + /** last recv rd_bitmap */ t_u32 last_recv_rd_bitmap; - /** mp_data_port_mask */ + /** mp_data_port_mask */ t_u32 mp_data_port_mask; /** last mp_wr_bitmap */ t_u32 last_mp_wr_bitmap[SDIO_MP_DBG_NUM]; @@ -2523,6 +2601,7 @@ MLAN_AUTH_MODE_SHARED = 0x01, MLAN_AUTH_MODE_FT = 0x02, MLAN_AUTH_MODE_SAE = 0x03, + MLAN_AUTH_MODE_OWE = 0x04, MLAN_AUTH_MODE_NETWORKEAP = 0x80, MLAN_AUTH_MODE_AUTO = 0xFF, }; @@ -2535,6 +2614,7 @@ AssocAgentAuth_FastBss_Skip, AssocAgentAuth_Network_EAP, AssocAgentAuth_Wpa3Sae = 6, + AssocAgentAuth_Owe = 7, AssocAgentAuth_Auto, } AssocAgentAuthType_e; @@ -2658,6 +2738,8 @@ typedef struct _mlan_pmk_t { /** PMK */ t_u8 pmk[MLAN_MAX_KEY_LENGTH]; + t_u8 pmk_r0[MLAN_MAX_KEY_LENGTH]; + t_u8 pmk_r0_name[MLAN_MAX_PMKR0_NAME_LENGTH]; } mlan_pmk_t; /** Embedded supplicant RSN type: No RSN */ @@ -2708,10 +2790,20 @@ t_u32 act_groupcipher; } mlan_ds_esupp_mode, *pmlan_ds_esupp_mode; +/* Security SSID MAX number support by firmware*/ +#define MAX_SEC_SSID_NUM 6 + /** Type definition of mlan_ds_sec_cfg for MLAN_IOCTL_SEC_CFG */ typedef struct _mlan_ds_sec_cfg { /** Sub-command */ t_u32 sub_command; + /** Flag to extend some structures to support multiple values. + ** For example, mlan_ds_passphrase can only contain one value, + ** if need use mlan_ds_passphrase[N], just set this flag and + ** use mlan_ds_passphrase[] instead to avoid modify + ** more already exist code. + */ + t_u8 multi_passphrase; /** Security configuration parameter */ union { /** Authentication mode for MLAN_OID_SEC_CFG_AUTH_MODE */ @@ -2737,6 +2829,7 @@ #ifdef UAP_SUPPORT t_u8 sta_mac[MLAN_MAC_ADDR_LENGTH]; #endif + mlan_ds_passphrase roam_passphrase[MAX_SEC_SSID_NUM]; } param; } mlan_ds_sec_cfg, *pmlan_ds_sec_cfg; @@ -2970,15 +3063,18 @@ t_u8 max_btm_req_allowed; } mlan_ds_band_steer_cfg, *pmlan_ds_band_steer_cfg; -/** Type definition of mlan_ds_beacon_stuck_param_cfg for MLAN_IOCTL_POWER_CFG */ +/** Type definition of mlan_ds_beacon_stuck_param_cfg for MLAN_IOCTL_POWER_CFG + */ typedef struct _mlan_ds_beacon_stuck_param_cfg { - /** subcmd */ + /** subcmd */ t_u32 subcmd; - /** Set/Get */ + /** Set/Get */ t_u8 action; - /** No of beacon interval after which firmware will check if beacon Tx is going fine */ + /** No of beacon interval after which firmware will check if beacon Tx + * is going fine */ t_u8 beacon_stuck_detect_count; - /** Upon performing MAC reset, no of beacon interval after which firmware will check if recovery was successful */ + /** Upon performing MAC reset, no of beacon interval after which + * firmware will check if recovery was successful */ t_u8 recovery_confirm_count; } mlan_ds_beacon_stuck_param_cfg, *pmlan_ds_beacon_stuck_param_cfg; @@ -3048,6 +3144,8 @@ t_u8 ext_gap; /** GPIO wave level for extend hscfg*/ t_u8 gpio_wave; + /** Minimum delay between HsActive and HostWake (in msec) */ + t_u16 min_wake_holdoff; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; #define MAX_MGMT_FRAME_FILTER 2 @@ -3316,15 +3414,6 @@ } param; } mlan_ds_pm_cfg, *pmlan_ds_pm_cfg; -#ifdef RX_PACKET_COALESCE -typedef struct { - mlan_cmd_result_e cmd_result; /**< Firmware execution result */ - - t_u32 pkt_threshold; /** Packet threshold */ - t_u16 delay; /** Timeout value in milliseconds */ -} wlan_ioctl_rx_pkt_coalesce_config_t; -#endif - /*-----------------------------------------------------------------*/ /** WMM Configuration Group */ /*-----------------------------------------------------------------*/ @@ -3431,7 +3520,7 @@ /** Type definition of mlan_ds_wmm_queue_stats * for MLAN_OID_WMM_CFG_QUEUE_STATS */ -mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; + mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** * @brief IOCTL sub structure for a specific WMM AC Status @@ -3463,7 +3552,7 @@ /** Type definition of mlan_ds_wmm_queue_status * for MLAN_OID_WMM_CFG_QUEUE_STATUS */ -mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; + mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ typedef struct _mlan_ds_wmm_addts { @@ -3895,7 +3984,7 @@ /** Type definition of mlan_ds_11ax_he_cfg for MLAN_OID_11AX_HE_CFG */ typedef struct _mlan_ds_11ax_he_cfg { - /** band, BIT0:2.4G, BIT1:5G*/ + /** band, BIT0:2.4G, BIT1:5G BIT2:6G*/ t_u8 band; /** mlan_ds_11ax_he_capa */ mlan_ds_11ax_he_capa he_cap; @@ -3978,10 +4067,19 @@ } mlan_ds_11ax_txop_cmd, *pmlan_ds_11ax_txop_cmd; /** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_txomi_cmd { +typedef struct MLAN_PACK_START_mlan_ds_11ax_txomi_cmd { /* 11ax spec 9.2.4.6a.2 OM Control 12 bits. Bit 0 to bit 11 */ t_u16 omi; -} mlan_ds_11ax_txomi_cmd, *pmlan_ds_11ax_txomi_cmd; + /* tx option + * 0: send OMI in QoS NULL; 1: send OMI in QoS data; 0xFF: set OMI in + * both + */ + t_u8 tx_option; + /* if OMI is sent in QoS data, specify the number of consecutive data + * packets containing the OMI + */ + t_u8 num_data_pkts; +} MLAN_PACK_END mlan_ds_11ax_txomi_cmd, *pmlan_ds_11ax_txomi_cmd; /** Type definition of mlan_ds_11ax_toltime_cmd for MLAN_OID_11AX_CMD_CFG */ typedef struct _mlan_ds_11ax_toltime_cmd { @@ -4040,7 +4138,7 @@ t_u8 twt_exponent; /** TWT Mantissa Range: [0-sizeof(UINT16)] */ t_u16 twt_mantissa; - /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ + /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ t_u8 twt_request; } MLAN_PACK_END mlan_ds_twt_setup, *pmlan_ds_twt_setup; @@ -4090,12 +4188,19 @@ t_u8 max_tx_pwr; } mlan_ds_subband_set_t; +#define NXP_DFS_UNSET 0 +#define NXP_DFS_FCC 1 +#define NXP_DFS_ETSI 2 +#define NXP_DFS_JP 3 +#define NXP_DFS_UNKNOWN 0xFF /** Domain regulatory information */ typedef struct _mlan_ds_11d_domain_info { + /** DFS region code */ + t_u8 dfs_region; /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; /** Band that channels in sub_band belong to */ - t_u8 band; + t_u16 band; /** No. of subband in below */ t_u8 no_of_sub_band; /** Subband data to send/last sent */ @@ -4111,13 +4216,13 @@ #ifdef STA_SUPPORT /** Enable for MLAN_OID_11D_CFG_ENABLE */ t_u32 enable_11d; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Domain info for MLAN_OID_11D_DOMAIN_INFO_EXT */ mlan_ds_11d_domain_info domain_info; #ifdef UAP_SUPPORT /** tlv data for MLAN_OID_11D_DOMAIN_INFO */ t_u8 domain_tlv[MAX_IE_SIZE]; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ } param; } mlan_ds_11d_cfg, *pmlan_ds_11d_cfg; @@ -4138,7 +4243,15 @@ MLAN_REG_CAU = 5, MLAN_REG_PSU = 6, MLAN_REG_BCA = 7, -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) || \ + defined(SD9177) + MLAN_REG_CIU = 8, +#endif +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, @@ -4219,12 +4332,23 @@ t_u8 curr_chan; /** channel_width */ t_u8 chan_width; + /** check new channel flag */ + t_u8 check_new_chan; /** flag for chan under nop */ t_bool chan_under_nop; /** chan_ban_info for new channel */ chan_band_info new_chan; } mlan_ds_11h_chan_nop_info, *pmlan_ds_11h_chan_nop_info; +/** Type definition of mlan_ds_11h_nop_chan_list for MLAN_OID_11H_NOP_CHAN_LIST + */ +typedef struct _mlan_ds_11h_nop_chan_list { + /** number of nop channel */ + t_u8 num_chan; + /** chan list array */ + t_u8 chan_list[20]; +} mlan_ds_11h_nop_chan_list, *pmlan_ds_11h_nop_chan_list; + typedef struct _mlan_ds_11h_chan_rep_req { t_u16 startFreq; Band_Config_t bandcfg; @@ -4233,6 +4357,16 @@ t_u8 host_based; } mlan_ds_11h_chan_rep_req; +/** channel dfs state for MLAN_OID_11H_CHAN_DFS_STATE */ +typedef struct _mlan_ds_11h_chan_dfs_state { + /** channel */ + t_u8 channel; + /** is dfs channel */ + t_u8 dfs_required; + /** dfs state */ + dfs_state_t dfs_state; +} mlan_ds_11h_chan_dfs_state; + typedef struct _mlan_ds_11h_dfs_w53_cfg { /** dfs w53 cfg */ t_u8 dfs53cfg; @@ -4250,11 +4384,17 @@ mlan_ds_11h_dfs_testing dfs_testing; /** channel NOP information for MLAN_OID_11H_CHAN_NOP_INFO */ mlan_ds_11h_chan_nop_info ch_nop_info; + /** NOP channel list for MLAN_OID_11H_NOP_CHAN_LIST */ + mlan_ds_11h_nop_chan_list nop_chan_list; /** channel report req for MLAN_OID_11H_CHAN_REPORT_REQUEST */ mlan_ds_11h_chan_rep_req chan_rpt_req; /** channel switch count for MLAN_OID_11H_CHAN_SWITCH_COUNT*/ t_s8 cs_count; + /** channel dfs state for MLAN_OID_11H_CHAN_DFS_STATE */ + mlan_ds_11h_chan_dfs_state ch_dfs_state; mlan_ds_11h_dfs_w53_cfg dfs_w53_cfg; + /** dfs_mode for MLAN_OID_11H_DFS_MODE */ + t_u8 dfs_mode; } param; } mlan_ds_11h_cfg, *pmlan_ds_11h_cfg; @@ -4342,6 +4482,27 @@ MLAN_FUNC_SHUTDOWN, }; +/* Net monitor filters: */ +/* management frame */ +#define MLAN_NETMON_MANAGEMENT MBIT(0) +/* control frame */ +#define MLAN_NETMON_CONTROL MBIT(1) +/* data frame */ +#define MLAN_NETMON_DATA MBIT(2) + +typedef struct _mlan_ds_misc_net_monitor { + /** Enable/disable network monitor */ + t_u32 enable_net_mon; + /** Set net monitor filer flag */ + t_u32 filter_flag; + /** Radio type */ + t_u32 band; + /** Channel */ + t_u32 channel; + /** Secondary channel bandwidth */ + t_u32 chan_bandwidth; +} mlan_ds_misc_net_monitor; + /** Type definition of mlan_ds_misc_tx_datapause * for MLAN_OID_MISC_TX_DATAPAUSE */ @@ -4437,6 +4598,9 @@ #define MLAN_IPADDR_OP_ARP_FILTER MBIT(0) /** IP operation ARP response */ #define MLAN_IPADDR_OP_AUTO_ARP_RESP MBIT(1) +/** Enable opcode bit for MDNS & NS when device enter into suspend **/ +#define MLAN_OP_ADD_MDNS MBIT(2) +#define MLAN_OP_ADD_IPV6_NS MBIT(3) /** Type definition of mlan_ds_misc_ipaddr_cfg for MLAN_OID_MISC_IP_ADDR */ typedef struct _mlan_ds_misc_ipaddr_cfg { @@ -4609,7 +4773,7 @@ * N -- report only happend > N consecutive times */ t_u8 data_high_snr_freq; - /* Link SNR threshold (dB) */ + /* Link SNR threshold (dB)*/ t_u16 link_snr; /* Link SNR frequency */ t_u16 link_snr_freq; @@ -4640,6 +4804,16 @@ t_u8 user_data[MAX_OTP_USER_DATA_LEN]; } mlan_ds_misc_otp_user_data; +/** Type definition of mlan_ds_fw_reconnect for MLAN_OID_MISC_AUTO_ASSOC */ +typedef struct _mlan_ds_fw_reconnect { + /* fw auto re-connect counter */ + t_u8 fw_reconn_counter; + /* fw auto re-connect interval */ + t_u8 fw_reconn_interval; + /* fw auto re-connect flags */ + t_u16 fw_reconn_flags; +} mlan_ds_fw_reconnect; + typedef struct _aggr_ctrl_cfg { /** Enable */ t_u16 enable; @@ -4716,15 +4890,15 @@ /** Type definition of mlan_ds_gpio_tsf_latch */ typedef struct _mlan_ds_gpio_tsf_latch { - /**clock sync Mode */ + /**clock sync Mode */ t_u8 clock_sync_mode; - /**clock sync Role */ + /**clock sync Role */ t_u8 clock_sync_Role; - /**clock sync GPIO Pin Number */ + /**clock sync GPIO Pin Number */ t_u8 clock_sync_gpio_pin_number; - /**clock sync GPIO Level or Toggle */ + /**clock sync GPIO Level or Toggle */ t_u8 clock_sync_gpio_level_toggle; - /**clock sync GPIO Pulse Width */ + /**clock sync GPIO Pulse Width */ t_u16 clock_sync_gpio_pulse_width; } mlan_ds_gpio_tsf_latch; @@ -4736,7 +4910,8 @@ t_u16 tsf_info; /**tsf */ t_u64 tsf; - /**Positive or negative offset in microsecond from Beacon TSF to GPIO toggle TSF */ + /**Positive or negative offset in microsecond from Beacon TSF to GPIO + * toggle TSF */ t_s32 tsf_offset; } mlan_ds_tsf_info; @@ -4749,8 +4924,193 @@ } mlan_ds_misc_pmfcfg; #endif +typedef MLAN_PACK_START struct _mlan_ds_multi_chan_cfg { + /** Channel Time */ + t_u32 channel_time; + /** Buffer Weight */ + t_u8 buffer_weight; + /** tlv len */ + t_u16 tlv_len; + /** TLV buffer */ + t_u8 tlv_buf[]; +} MLAN_PACK_END mlan_ds_multi_chan_cfg; + +typedef MLAN_PACK_START struct _mlan_ds_drcs_cfg { + /** Channel Index*/ + t_u16 chan_idx; + /** Channel time (in TU) for chan_idx */ + t_u8 chantime; + /** Channel swith time (in TU) for chan_idx */ + t_u8 switchtime; + /** Undoze time (in TU) for chan_idx */ + t_u8 undozetime; + /** Rx traffic control scheme when channel switch*/ + /** only valid for GC/STA interface*/ + t_u8 mode; +} MLAN_PACK_END mlan_ds_drcs_cfg; + #define MAX_SSID_NUM 16 #define MAX_AP_LIST 8 +#define RETRY_UNLIMITED_TIME 0xFF + +#define FW_ROAM_ENABLE MBIT(0) +#define FW_ROAM_TRIGGER_COND MBIT(1) +#define FW_ROAM_BSSID MBIT(2) +#define FW_ROAM_SSID MBIT(3) +#define FW_ROAM_RETRY_COUNT MBIT(4) +#define FW_ROAM_RSSI_PARA MBIT(5) +#define FW_ROAM_BAND_RSSI MBIT(6) +#define FW_ROAM_BGSCAN_PARAM MBIT(7) +#define FW_ROAM_EES_PARAM MBIT(8) +#define FW_ROAM_BCN_MISS_THRESHOLD MBIT(9) +#define FW_ROAM_PRE_BCN_MISS_THRESHOLD MBIT(10) +#define FW_ROAM_BLACKLIST MBIT(11) +#define FW_ROAM_REPEAT_CNT MBIT(12) + +/*Roam offload configuration for auto reconnection when suspend and resume*/ +typedef enum _roam_offload_config_mode { + ROAM_OFFLOAD_ENABLE = 1, + ROAM_OFFLOAD_SUSPEND_CFG, + ROAM_OFFLOAD_RESUME_CFG, + ROAM_OFFLOAD_PARAM_CFG, +} roam_offload_config_mode; + +typedef enum _roam_offload_set_mode { + ROAM_OFFLOAD_DISABLE = 0, + ROAM_OFFLOAD_WITH_APLIST, + ROAM_OFFLOAD_WITHOUT_APLIST, + ROAM_OFFLOAD_WITH_BSSID, + ROAM_OFFLOAD_WITH_SSID, + AUTO_RECONNECT, +} roam_offload_set_mode; + +typedef enum _roam_offload_trigger_mode { + NO_TRIGGER = 0x00, + RSSI_LOW_TRIGGER = 0x01, + PRE_BEACON_LOST_TRIGGER = 0x02, + LINK_LOST_TRIGGER = 0x04, + DEAUTH_WITH_EXT_AP_TRIGGER = 0x08, +} roam_offload_trigger_mode; + +/** mlan_ds_misc_ees_cfg structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_ees_cfg { + /* EES mode*/ + t_u16 ees_mode; + /* EES report condition*/ + t_u16 ees_rpt_condition; + /* High scan period(milliseconds)*/ + t_u16 high_scan_period; + /* High scan count*/ + t_u16 high_scan_count; + /* Middle scan period(milliseconds)*/ + t_u16 mid_scan_period; + /* Middle scan count*/ + t_u16 mid_scan_count; + /* Low scan period(milliseconds)*/ + t_u16 low_scan_period; + /* Low scan count*/ + t_u16 low_scan_count; +} MLAN_PACK_END mlan_ds_misc_ees_cfg; + +/** mlan_ds_misc_bgscan_cfg structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_bgscan_cfg { + /* BSS Type 0x1-bss independent, 0x2-bss infrastructure, 0x3-bss any*/ + t_u8 bss_type; + /* Number of channels scanned for each scan*/ + t_u8 channels_per_scan; + /* Interval between consective scans*/ + t_u32 scan_interval; + /* Conditons to trigger report to host*/ + t_u32 bg_rpt_condition; +} MLAN_PACK_END mlan_ds_misc_bgscan_cfg; + +/** mlan_ds_misc_band_rssi structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_band_rssi { + /* RSSI hysteresis*/ + t_u8 rssi_hysteresis; + /* Preferred channel band for fw roaming + * 0:2.4G band; 1: 5G band; 2:4G band; 0xFF:band not set(invalid) + */ + t_u8 band_preferred; +} MLAN_PACK_END mlan_ds_misc_band_rssi; + +/** mlan_ds_misc_ssid_list structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_ssid_list { + /* SSID number*/ + t_u8 ssid_num; + /* SSID for fw roaming/auto_reconnect*/ + mlan_802_11_ssid ssids[MAX_SSID_NUM]; +} MLAN_PACK_END mlan_ds_misc_ssid_list; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload_aplist { + /** Number of AP**/ + t_u8 ap_num; + /** AP mac addrs**/ + t_u8 ap_mac[MAX_AP_LIST][MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END mlan_ds_misc_roam_offload_aplist; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload_para_rssi { + /** Setting flag**/ + t_u8 set_flag; + /** Max value of RSSI threshold**/ + t_u8 max_rssi; + /** Min value of RSSI threshold**/ + t_u8 min_rssi; + /** Adjusting step value of RSSI threshold**/ + t_u8 step_rssi; +} MLAN_PACK_END mlan_ds_misc_roam_offload_para_rssi; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload { + /** Enable roam offload**/ + t_u8 enable; + /** User set passphrase**/ + t_u8 userset_passphrase; + /* Condition to trigger roaming + * Bit0 : RSSI low trigger + * Bit1 : Pre-beacon lost trigger + * Bit2 : Link Lost trigger + * Bit3 : Deauth by ext-AP trigger + * Bit4 ~ Bit15 : Reserved + * value 0 : no trigger + * value 0xff : invalid + */ + t_u16 trigger_condition; + /** AP list**/ + mlan_ds_misc_roam_offload_aplist aplist; + /*Roam offload configuration mode for auto connection when suspend and + * resume*/ + roam_offload_config_mode config_mode; + /** Retry count**/ + t_u8 retry_count; + /** RSSI para**/ + mlan_ds_misc_roam_offload_para_rssi para_rssi; + /** BSSID of reconnection**/ + mlan_802_11_mac_addr bssid_reconnect; + /* SSID List(White list)*/ + mlan_ds_misc_ssid_list ssid_list; + /* Black list(BSSID list)*/ + mlan_ds_misc_roam_offload_aplist black_list; + /* BAND and RSSI_HYSTERESIS set flag*/ + t_u8 band_rssi_flag; + mlan_ds_misc_band_rssi band_rssi; + + /* BGSCAN params set flag*/ + t_u8 bgscan_set_flag; + mlan_ds_misc_bgscan_cfg bgscan_cfg; + + /* EES mode params set flag*/ + t_u8 ees_param_set_flag; + mlan_ds_misc_ees_cfg ees_cfg; + + /* Beacon miss threshold*/ + t_u8 bcn_miss_threshold; + + /* Beacon miss threshold*/ + t_u8 pre_bcn_miss_threshold; + + /* Scan repeat count*/ + t_u16 repeat_count; +} MLAN_PACK_END mlan_ds_misc_roam_offload; /**Action ID for TDLS disable link*/ #define WLAN_TDLS_DISABLE_LINK 0x00 @@ -4804,6 +5164,8 @@ #define TDLS_IE_FLAGS_QOS_INFO 0x0080 /** flag for TDLS SETUP */ #define TDLS_IE_FLAGS_SETUP 0x0100 +#define TDLS_IE_FLAGS_HECAP 0x0200 +#define TDLS_IE_FLAGS_HEOP 0x0400 /** TDLS ie buffer */ typedef struct _mlan_ds_misc_tdls_ies { @@ -4825,21 +5187,16 @@ t_u8 vht_oprat[IEEE_MAX_IE_SIZE]; /** aid Info */ t_u8 aid_info[IEEE_MAX_IE_SIZE]; + /** HE Capabilities IE */ + t_u8 he_cap[IEEE_MAX_IE_SIZE]; + /** HE Operation IE */ + t_u8 he_op[IEEE_MAX_IE_SIZE]; /** supported channels */ t_u8 supp_chan[IEEE_MAX_IE_SIZE]; /** supported regulatory class */ t_u8 regulatory_class[IEEE_MAX_IE_SIZE]; } mlan_ds_misc_tdls_ies; -#ifdef RX_PACKET_COALESCE -typedef struct _mlan_ds_misc_rx_packet_coalesce { - /** packet threshold */ - t_u32 packet_threshold; - /** timeout value */ - t_u16 delay; -} mlan_ds_misc_rx_packet_coalesce; -#endif - typedef struct _mlan_ds_misc_dfs_repeater { /** Set or Get */ t_u16 action; @@ -4980,7 +5337,7 @@ t_u8 replay_ctr[MLAN_REPLAY_CTR_LEN]; } mlan_ds_misc_gtk_rekey_data; typedef struct _mlan_ds_bw_chan_oper { - /* bandwidth 20:20M 40:40M 80:80M */ + /* bandwidth 20:20M 40:40M 80:80M*/ t_u8 bandwidth; /* channel number */ t_u8 channel; @@ -5032,9 +5389,9 @@ /** Mode of Operation 0: Disable 1: Tx Continuous Packet 2: Tx * Continuous Wave */ t_u8 mode; - /*channel */ + /*channel*/ t_u8 channel; - /* channel info */ + /* channel info*/ t_u8 chanInfo; /** Tx Power level in dBm */ t_u16 txPower; @@ -5083,6 +5440,34 @@ } mlan_ds_ssu_params; #endif +#define CSI_FILTER_MAX 16 +/** Structure of CSI filters */ +typedef MLAN_PACK_START struct _mlan_csi_filter_t { + /** Source address of the packet to receive */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Pakcet type of the interested CSI */ + t_u8 pkt_type; + /* Packet subtype of the interested CSI */ + t_u8 subtype; + /* Other filter flags */ + t_u8 flags; +} MLAN_PACK_END mlan_csi_filter_t; +/** Structure of CSI parameters */ +typedef MLAN_PACK_START struct _mlan_ds_csi_params { + /** CSI enable flag. 1: enable, 0: disable */ + t_u16 csi_enable; + /** Header ID*/ + t_u32 head_id; + /** Tail ID */ + t_u32 tail_id; + /** Number of CSI filters */ + t_u8 csi_filter_cnt; + /** Chip ID */ + t_u8 chip_id; + /** CSI filters */ + mlan_csi_filter_t csi_filter[CSI_FILTER_MAX]; +} MLAN_PACK_END mlan_ds_csi_params; + typedef MLAN_PACK_START struct _mlan_ds_hal_phy_cfg_params { /** 11b pwr spectral density mask enable/disable */ t_u8 dot11b_psd_mask_cfg; @@ -5138,19 +5523,20 @@ t_u8 trpc_buf[2048]; } mlan_ds_misc_chan_trpc_cfg; -#define MFG_CMD_SET_TEST_MODE 1 +#define MFG_CMD_SET_TEST_MODE 1 #define MFG_CMD_UNSET_TEST_MODE 0 -#define MFG_CMD_TX_ANT 0x1004 -#define MFG_CMD_RX_ANT 0x1005 -#define MFG_CMD_TX_CONT 0x1009 -#define MFG_CMD_RF_CHAN 0x100A -#define MFG_CMD_CLR_RX_ERR 0x1010 -#define MFG_CMD_TX_FRAME 0x1021 -#define MFG_CMD_RFPWR 0x1033 -#define MFG_CMD_RF_BAND_AG 0x1034 -#define MFG_CMD_RF_CHANNELBW 0x1044 -#define MFG_CMD_RADIO_MODE_CFG 0x1211 +#define MFG_CMD_TX_ANT 0x1004 +#define MFG_CMD_RX_ANT 0x1005 +#define MFG_CMD_TX_CONT 0x1009 +#define MFG_CMD_RF_CHAN 0x100A +#define MFG_CMD_CLR_RX_ERR 0x1010 +#define MFG_CMD_TX_FRAME 0x1021 +#define MFG_CMD_RFPWR 0x1033 +#define MFG_CMD_RF_BAND_AG 0x1034 +#define MFG_CMD_RF_CHANNELBW 0x1044 +#define MFG_CMD_RADIO_MODE_CFG 0x1211 #define MFG_CMD_CONFIG_MAC_HE_TB_TX 0x110A +#define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C /** MFG CMD generic cfg */ struct MLAN_PACK_START mfg_cmd_generic_cfg { /** MFG command code */ @@ -5209,19 +5595,19 @@ t_u32 stbc; /** power id */ t_u32 rsvd[2]; - /** NumPkt */ + /** NumPkt */ t_u32 NumPkt; - /** MaxPE */ + /** MaxPE */ t_u32 MaxPE; - /** BeamChange */ + /** BeamChange */ t_u32 BeamChange; - /** Dcm */ + /** Dcm */ t_u32 Dcm; - /** Doppler */ + /** Doppler */ t_u32 Doppler; - /** MidP */ + /** MidP */ t_u32 MidP; - /** QNum */ + /** QNum */ t_u32 QNum; } MLAN_PACK_END; @@ -5253,26 +5639,198 @@ } MLAN_PACK_END; struct MLAN_PACK_START mfg_Cmd_HE_TBTx_t { - /** MFG command code */ + /** MFG command code */ t_u32 mfg_cmd; - /** Action */ + /** Action */ t_u16 action; - /** Device ID */ + /** Device ID */ t_u16 device_id; - /** MFG Error code */ + /** MFG Error code */ t_u32 error; - /** Enable Tx */ + /** Enable Tx */ t_u16 enable; - /** Q num */ + /** Q num */ t_u16 qnum; - /** AID */ + /** AID */ t_u16 aid; - /** AXQ Mu Timer */ + /** AXQ Mu Timer */ t_u16 axq_mu_timer; - /** Tx Power */ - t_u16 tx_power; + /** Tx Power */ + t_s16 tx_power; } MLAN_PACK_END; +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t { + t_u64 reserved : 1; + t_u64 he_sig2 : 9; + t_u64 doppler : 1; + t_u64 spatial_reuse : 16; + t_u64 pe_disambig : 1; + t_u64 pre_fec_pad_fct : 2; + t_u64 ap_tx_pwr : 6; + + t_u64 ldpc_ess : 1; + t_u64 ul_stbc : 1; + t_u64 ltf_symbol : 3; + t_u64 ltf_mode : 1; + t_u64 ltf_type : 2; + + t_u64 ul_bw : 2; + t_u64 cs_required : 1; + t_u64 more_tf : 1; + t_u64 ul_len : 12; + t_u64 trigger_type : 4; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t { + t_u64 trigger_type : 4; + t_u64 ul_len : 12; + t_u64 more_tf : 1; + t_u64 cs_required : 1; + t_u64 ul_bw : 2; + + t_u64 ltf_type : 2; + t_u64 ltf_mode : 1; + t_u64 ltf_symbol : 3; + t_u64 ul_stbc : 1; + t_u64 ldpc_ess : 1; + + t_u64 ap_tx_pwr : 6; + t_u64 pre_fec_pad_fct : 2; + t_u64 pe_disambig : 1; + t_u64 spatial_reuse : 16; + t_u64 doppler : 1; + t_u64 he_sig2 : 9; + t_u64 reserved : 1; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t { + t_u8 reserved : 1; + t_u8 ul_target_rssi : 7; + t_u32 ss_alloc : 6; + t_u32 ul_dcm : 1; + t_u32 ul_mcs : 4; + t_u32 ul_coding_type : 1; + t_u32 ru_alloc : 7; + t_u32 ru_alloc_reg : 1; + t_u32 aid12 : 12; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t { + t_u32 aid12 : 12; + t_u32 ru_alloc_reg : 1; + t_u32 ru_alloc : 7; + t_u32 ul_coding_type : 1; + t_u32 ul_mcs : 4; + t_u32 ul_dcm : 1; + t_u32 ss_alloc : 6; + t_u8 ul_target_rssi : 7; + t_u8 reserved : 1; +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t { + t_u8 pref_ac : 2; + t_u8 ac_pl : 1; + t_u8 tid_al : 3; + t_u8 mpdu_mu_sf : 2; +} MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t { + t_u8 mpdu_mu_sf : 2; + t_u8 tid_al : 3; + t_u8 ac_pl : 1; + t_u8 pref_ac : 2; +} MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t { + /** Order */ + t_u8 order : 1; + /** Wep */ + t_u8 wep : 1; + /** More Data */ + t_u8 more_data : 1; + /** Power Mgmt */ + t_u8 pwr_mgmt : 1; + /** Retry */ + t_u8 retry : 1; + /** More Frag */ + t_u8 more_frag : 1; + /** From DS */ + t_u8 from_ds : 1; + /** To DS */ + t_u8 to_ds : 1; + /** Sub Type */ + t_u8 sub_type : 4; + /** Type */ + t_u8 type : 2; + /** Protocol Version */ + t_u8 protocol_version : 2; +} MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t { + /** Protocol Version */ + t_u8 protocol_version : 2; + /** Type */ + t_u8 type : 2; + /** Sub Type */ + t_u8 sub_type : 4; + /** To DS */ + t_u8 to_ds : 1; + /** From DS */ + t_u8 from_ds : 1; + /** More Frag */ + t_u8 more_frag : 1; + /** Retry */ + t_u8 retry : 1; + /** Power Mgmt */ + t_u8 pwr_mgmt : 1; + /** More Data */ + t_u8 more_data : 1; + /** Wep */ + t_u8 wep : 1; + /** Order */ + t_u8 order : 1; +} MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t; +#endif + +typedef MLAN_PACK_START struct _mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t { + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** enable Tx*/ + t_u32 enable_tx; + /** enable Stand Alone HE TB */ + t_u32 standalone_hetb; + /** Frame Control */ + mfg_cmd_IEEEtypes_FrameCtrl_t frmCtl; + /** Duration */ + t_u16 duration; + /** Destination MAC Address */ + t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC Address */ + t_u8 src_addr[MLAN_MAC_ADDR_LENGTH]; + /** Common Info Field **/ + mfg_cmd_IEEEtypes_HETrigComInfo_t trig_common_field; + /** User Info Field **/ + mfg_cmd_IEEEtypes_HETrigUserInfo_t trig_user_info_field; + /** Trigger Dependent User Info Field **/ + mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info; +} MLAN_PACK_END mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t; + typedef struct _mlan_ds_misc_chnrgpwr_cfg { /** length */ t_u16 length; @@ -5290,6 +5848,46 @@ chan_freq_power_t cfp_tbl[]; } mlan_ds_misc_cfp_tbl; +/** mlan_ds_mc_aggr_cfg for MLAN_OID_MISC_MC_AGGR_CFG */ +typedef struct _mlan_ds_mc_aggr_cfg { + /** action */ + t_u8 action; + /* 1 enable, 0 disable + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 enable_bitmap; + /* 1 valid, 0 invalid + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 mask_bitmap; + /** CTS2Self duration offset */ + t_u16 cts2self_offset; +} mlan_ds_mc_aggr_cfg; + +/** mlan_ds_stats */ +typedef struct _mlan_ds_stats { + /** action */ + t_u16 action; + /** tlv len */ + t_u16 tlv_len; + /** TLV buffer */ + t_u8 tlv_buf[1]; +} mlan_ds_stats; + +typedef struct _mlan_ds_ch_load { + /** action */ + t_u8 action; + t_u16 ch_load_param; + t_s16 noise; + t_u16 rx_quality; + t_u16 duration; + t_u16 cca_th; +} mlan_ds_ch_load; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -5312,6 +5910,8 @@ t_u32 wws_cfg; /** Get associate response for MLAN_OID_MISC_ASSOC_RSP */ mlan_ds_misc_assoc_rsp assoc_resp; + /** Get associate request for MLAN_OID_MISC_ASSOC_REQ */ + mlan_ds_misc_assoc_req assoc_req; /** Function init/shutdown for MLAN_OID_MISC_INIT_SHUTDOWN */ t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ @@ -5327,6 +5927,8 @@ mlan_ds_misc_tdls_ies tdls_ies; /**tdls cs off channel*/ t_u8 tdls_cs_channel; + /** Net monitor for MLAN_OID_MISC_NET_MONITOR */ + mlan_ds_misc_net_monitor net_mon; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ @@ -5357,6 +5959,8 @@ ExtCap_t ext_cap; #endif mlan_ds_misc_otp_user_data otp_user_data; + /** fw re-connect cfg param set */ + mlan_ds_fw_reconnect fw_auto_reconnect; #ifdef USB /** USB aggregation parameters for MLAN_OID_MISC_USB_AGGR_CTRL */ @@ -5368,6 +5972,13 @@ #if defined(STA_SUPPORT) mlan_ds_misc_pmfcfg pmfcfg; #endif + /** Multi-channel config for MLAN_OID_MISC_MULTI_CHAN_CFG */ + mlan_ds_multi_chan_cfg multi_chan_cfg; + /** Multi-channel policy for MLAN_OID_MISC_MULTI_CHAN_POLICY */ + t_u16 multi_chan_policy; + /** channel drcs time slicing config for MLAN_OID_MISC_DRCS_CFG + */ + mlan_ds_drcs_cfg drcs_cfg[2]; #ifdef WIFI_DIRECT_SUPPORT mlan_ds_wifi_direct_config p2p_config; #endif @@ -5378,9 +5989,6 @@ /** MEF-FLT-CONFIG for MLAN_OID_MISC_NV_FLT_CFG */ mlan_ds_misc_mef_flt_cfg mef_flt_cfg; mlan_ds_misc_dfs_repeater dfs_repeater; -#ifdef RX_PACKET_COALESCE - mlan_ds_misc_rx_packet_coalesce rx_coalesce; -#endif /** FW reload flag */ t_u8 fw_reload; mlan_ds_sensor_temp sensor_temp; @@ -5388,6 +5996,8 @@ mlan_ds_misc_gtk_rekey_data gtk_rekey; mlan_ds_bw_chan_oper bw_chan_oper; mlan_ds_ind_rst_cfg ind_rst_cfg; + /** Roam offload */ + mlan_ds_misc_roam_offload roam_offload; t_u64 misc_tsf; mlan_ds_custom_reg_domain custom_reg_domain; mlan_ds_misc_keep_alive keep_alive; @@ -5399,6 +6009,7 @@ #if defined(PCIE) mlan_ds_ssu_params ssu_params; #endif + mlan_ds_csi_params csi_params; /** boot sleep enable or disable */ t_u16 boot_sleep; /** Mapping Policy */ @@ -5418,15 +6029,20 @@ struct mfg_cmd_tx_cont mfg_tx_cont; struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; mlan_ds_misc_arb_cfg arb_cfg; mlan_ds_misc_cfp_tbl cfp; t_u8 range_ext_mode; mlan_ds_misc_dot11mc_unassoc_ftm_cfg dot11mc_unassoc_ftm_cfg; mlan_ds_misc_tp_state tp_state; mlan_ds_hal_phy_cfg_params hal_phy_cfg_params; + mlan_ds_mc_aggr_cfg mc_aggr_cfg; + mlan_ds_stats stats; #ifdef UAP_SUPPORT t_u8 wacp_mode; #endif + t_u32 ips_ctrl; + mlan_ds_ch_load ch_load; } param; } mlan_ds_misc_cfg, *pmlan_ds_misc_cfg;
diff --git a/wlan_sd8987/mlan/mlan_join.c b/wlan_sd8987/mlan/mlan_join.c index e2cde9d..3bf0539 100755 --- a/wlan_sd8987/mlan/mlan_join.c +++ b/wlan_sd8987/mlan/mlan_join.c
@@ -7,7 +7,7 @@ * to the firmware. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2023 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -69,8 +69,7 @@ * * @return bytes added to the buffer */ -static int -wlan_cmd_append_generic_ie(mlan_private *priv, t_u8 **ppbuffer) +static int wlan_cmd_append_generic_ie(mlan_private *priv, t_u8 **ppbuffer) { int ret_len = 0; MrvlIEtypesHeader_t ie_header; @@ -136,9 +135,9 @@ * * @return bytes added to the buffer */ -static int -wlan_cmd_append_pass_through_ie(mlan_private *priv, - IEEEtypes_Generic_t *ie, t_u8 **ppbuffer) +static int wlan_cmd_append_pass_through_ie(mlan_private *priv, + IEEEtypes_Generic_t *ie, + t_u8 **ppbuffer) { int ret_len = 0; MrvlIEtypesHeader_t ie_header; @@ -205,9 +204,8 @@ * * @return bytes added to the buffer */ -static int -wlan_cmd_append_tsf_tlv(mlan_private *pmriv, t_u8 **ppbuffer, - BSSDescriptor_t *pbss_desc) +static int wlan_cmd_append_tsf_tlv(mlan_private *pmriv, t_u8 **ppbuffer, + BSSDescriptor_t *pbss_desc) { MrvlIEtypes_TsfTimestamp_t tsf_tlv; t_u64 tsf_val; @@ -271,10 +269,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_get_common_rates(mlan_private *pmpriv, - t_u8 *rate1, t_u32 rate1_size, - t_u8 *rate2, t_u32 rate2_size) +static mlan_status wlan_get_common_rates(mlan_private *pmpriv, t_u8 *rate1, + t_u32 rate1_size, t_u8 *rate2, + t_u32 rate2_size) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_callbacks *pcb = (mlan_callbacks *)&pmpriv->adapter->callbacks; @@ -285,7 +282,7 @@ ENTER(); ret = pcb->moal_malloc(pmpriv->adapter->pmoal_handle, rate1_size, - MLAN_MEM_DEF, &tmp); + MLAN_MEM_DEF | MLAN_MEM_FLAG_ATOMIC, &tmp); if (ret != MLAN_STATUS_SUCCESS || !tmp) { PRINTM(MERROR, "Failed to allocate buffer\n"); ret = MLAN_STATUS_FAILURE; @@ -321,7 +318,8 @@ } PRINTM(MMSG, "Previously set fixed data rate %#x is not " - "compatible with the network\n", pmpriv->data_rate); + "compatible with the network\n", + pmpriv->data_rate); ret = MLAN_STATUS_FAILURE; goto done; @@ -348,12 +346,12 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_setup_rates_from_bssdesc(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc, - t_u8 *pout_rates, t_u32 *pout_rates_size) +static mlan_status wlan_setup_rates_from_bssdesc(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc, + t_u8 *pout_rates, + t_u32 *pout_rates_size) { - t_u8 card_rates[WLAN_SUPPORTED_RATES]; + t_u8 card_rates[WLAN_SUPPORTED_RATES] = {0}; t_u32 card_rates_size = 0; ENTER(); /* Copy AP supported rates */ @@ -363,10 +361,9 @@ if ((pmpriv->adapter->region_code == COUNTRY_CODE_JP_40 || pmpriv->adapter->region_code == COUNTRY_CODE_JP_FF) && (pbss_desc->phy_param_set.ds_param_set.current_chan == 14)) { - /* Special Case: For Japan, 11G rates on CH14 are not allowed */ - card_rates_size = - wlan_get_supported_rates(pmpriv, pmpriv->bss_mode, - BAND_B, card_rates); + /* Special Case: For Japan, 11G rates on CH14 are not allowed*/ + card_rates_size = wlan_get_supported_rates( + pmpriv, pmpriv->bss_mode, BAND_B, card_rates); } else { /* Get the STA supported rates */ card_rates_size = @@ -398,8 +395,8 @@ * * @return N/A */ -static t_void -wlan_update_tsf_timestamps(mlan_private *pmpriv, BSSDescriptor_t *pnew_bss_desc) +static t_void wlan_update_tsf_timestamps(mlan_private *pmpriv, + BSSDescriptor_t *pnew_bss_desc) { mlan_adapter *pmadapter = pmpriv->adapter; t_u32 table_idx; @@ -436,8 +433,7 @@ * * @return bytes added to the buffer */ -static int -wlan_cmd_append_wapi_ie(mlan_private *priv, t_u8 **ppbuffer) +static int wlan_cmd_append_wapi_ie(mlan_private *priv, t_u8 **ppbuffer) { int retlen = 0; MrvlIEtypesHeader_t ie_header; @@ -500,8 +496,7 @@ * * @return bytes added to the buffer */ -static int -wlan_cmd_append_osen_ie(mlan_private *priv, t_u8 **ppbuffer) +static int wlan_cmd_append_osen_ie(mlan_private *priv, t_u8 **ppbuffer) { int retlen = 0; MrvlIEtypesHeader_t ie_header; @@ -555,34 +550,53 @@ /** * @brief This function get the rsn_cap from RSN ie buffer. * - * @param pmpriv A pointer to mlan_private structure - * * @param data A pointer to rsn_ie data after IE header + * @param len Length of ie rsn_ie data after IE header * @param return rsn_cap */ -static t_u16 -wlan_get_rsn_cap(t_u8 *data) +static t_u16 wlan_get_rsn_cap(t_u8 *data, t_u8 len) { t_u16 rsn_cap = 0; t_u16 *ptr; + t_u16 *end_ptr; t_u16 pairwise_cipher_count = 0; t_u16 akm_suite_count = 0; + + if (len < 20) { + /* Version(2B)+GRP(4B)+PairwiseCnt(2B)+PairwiseList(4B)+ + akmCnt(2B)+akmList(4B)+rsnCap(2B) = 20B */ + PRINTM(MERROR, + "RSNE: IE len should not less than 20 Bytes, len=%d\n", + len); + goto done; + } /* rsn_cap = data + 2 bytes version + 4 bytes * group_cipher_suite + 2 bytes pairwise_cipher_count + * pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + 2 bytes * akm_suite_count + akm_suite_count * AKM_SUITE_LEN */ + end_ptr = (t_u16 *)(data + len); ptr = (t_u16 *)(data + sizeof(t_u16) + 4 * sizeof(t_u8)); pairwise_cipher_count = wlan_le16_to_cpu(*ptr); ptr = (t_u16 *)(data + sizeof(t_u16) + 4 * sizeof(t_u8) + sizeof(t_u16) + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN); + if ((pairwise_cipher_count == 0) || (ptr >= end_ptr)) { + PRINTM(MERROR, "RSNE: PAIRWISE_CIPHER not correct\n"); + goto done; + } akm_suite_count = wlan_le16_to_cpu(*ptr); ptr = (t_u16 *)(data + sizeof(t_u16) + 4 * sizeof(t_u8) + sizeof(t_u16) + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + sizeof(t_u16) + akm_suite_count * AKM_SUITE_LEN); + if ((akm_suite_count == 0) || (ptr > end_ptr)) { + PRINTM(MERROR, "RSNE: AKM Suite or RSNCAP not correct\n"); + goto done; + } rsn_cap = wlan_le16_to_cpu(*ptr); + +done: PRINTM(MCMND, "rsn_cap=0x%x\n", rsn_cap); return rsn_cap; } @@ -595,8 +609,7 @@ * @param BSSDescriptor_t A pointer to BSSDescriptor_t data structure * @param return MTRUE/MFALSE */ -static t_u8 -wlan_use_mfp(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) +static t_u8 wlan_use_mfp(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) { t_u16 ap_rsn_cap = 0; t_u16 sta_rsn_cap = 0; @@ -605,10 +618,12 @@ if (pmpriv->wpa_ie[0] != RSN_IE) return 0; - sta_rsn_cap = wlan_get_rsn_cap(pmpriv->wpa_ie + 2); + sta_rsn_cap = + wlan_get_rsn_cap(pmpriv->wpa_ie + 2, *(pmpriv->wpa_ie + 1)); if (!pbss_desc->prsn_ie) return 0; - ap_rsn_cap = wlan_get_rsn_cap(pbss_desc->prsn_ie->data); + ap_rsn_cap = wlan_get_rsn_cap(pbss_desc->prsn_ie->data, + pbss_desc->prsn_ie->ieee_hdr.len); ap_mfpc = ((ap_rsn_cap & (0x1 << MFPC_BIT)) == (0x1 << MFPC_BIT)); ap_mfpr = ((ap_rsn_cap & (0x1 << MFPR_BIT)) == (0x1 << MFPR_BIT)); sta_mfpc = ((sta_rsn_cap & (0x1 << MFPC_BIT)) == (0x1 << MFPC_BIT)); @@ -631,107 +646,197 @@ * * @param ptlv_rsn_ie A pointer to rsn_ie TLV */ -static int -wlan_update_rsn_ie(mlan_private *pmpriv, MrvlIEtypes_RsnParamSet_t *ptlv_rsn_ie) +static int wlan_update_rsn_ie(mlan_private *pmpriv, + MrvlIEtypes_RsnParamSet_t *ptlv_rsn_ie, + t_u16 *rsn_ie_len, t_u8 *akm_type) { t_u16 *prsn_cap; - t_u16 *ptr; - t_u16 *akm_suite_count_ptr; + t_u8 *ptr; + t_u8 *pairwise_cipher_count_ptr; + t_u8 *group_mgmt_cipher_suite_ptr = MNULL; + t_u8 *pmkid_list_ptr = MNULL; + t_u8 *end_ptr; t_u16 pmf_mask = 0x00; - t_u8 *temp; t_u16 pairwise_cipher_count = 0; t_u16 akm_suite_count = 0; - t_u16 temp_akm_suite_count = 0; - int found = 0; - t_u8 sha_256_oui[4] = { 0x00, 0x0f, 0xac, 0x06 }; - t_u8 sae_oui[4] = { 0x00, 0x0f, 0xac, 0x08 }; + t_u16 pmkid_count = 0; + t_u8 i; + +#define PREFERENCE_TKIP 1 + /* Cipher Perference Order: + (5) CIPHER_SYITE_TYPE_GCMP_256 = 9 + (4) CIPHER_SYITE_TYPE_GCMP_128 = 8 + (3) CIPHER_SYITE_TYPE_CCMP_256 = 10 + (2) CIPHER_SYITE_TYPE_CCMP_128 = 4 + (1) CIPHER_SYITE_TYPE_TKIP = 2 + (0) Skip + */ + t_u8 preference_selected; + t_u8 cipher_selected_id; +#if 0 // defined(ENABLE_GCMP_SUPPORT) + // embedded supplicant doesn't support GCMP yet + t_u8 cipher_preference[11] = {0, 0, 1, 0, 2, 0, 0, 0, 4, 5, 3}; +#else + t_u8 cipher_preference[5] = {0, 0, 1, 0, 2}; +#endif + t_u8 oui[4] = {0x00, 0x0f, 0xac, 0x00}; + + /* AKM Perference Order: + (6) AKM_SUITE_TYPE_FT_SAE = 9 //Not supported in esupp + (5) AKM_SUITE_TYPE_SAE = 8 + (4) AKM_SUITE_TYPE_OWE = 18 + (3) AKM_SUITE_TYPE_FT_PSK = 4 //Not supported in esupp + (2) AKM_SUITE_TYPE_PSK_SHA256 = 6 + (1) AKM_SUITE_TYPE_PSK = 2 + (0) Skip + */ + t_u8 akm_type_selected; + t_u8 akm_type_id = 0; + t_u8 akm_preference[19] = {0, 0, 1, 0, 0, 0, 2, 0, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 4}; mlan_adapter *pmadapter = pmpriv->adapter; int ap_mfpc = 0, ap_mfpr = 0, ret = MLAN_STATUS_SUCCESS; + if (*rsn_ie_len < 20) { + /* Version(2B)+GRP(4B)+PairwiseCnt(2B)+PairwiseList(4B)+ + akmCnt(2B)+akmList(4B)+rsnCap(2B) = 20B */ + PRINTM(MERROR, + "RSNE: IE len should not less than 20 Bytes, len=%d\n", + *rsn_ie_len); + return MLAN_STATUS_FAILURE; + } pmf_mask = (((pmpriv->pmfcfg.mfpc << MFPC_BIT) | - (pmpriv->pmfcfg.mfpr << MFPR_BIT)) | (~PMF_MASK)); + (pmpriv->pmfcfg.mfpr << MFPR_BIT)) | + (~PMF_MASK)); /* prsn_cap = prsn_ie->rsn_ie + 2 bytes version + 4 bytes * group_cipher_suite + 2 bytes pairwise_cipher_count + * pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + 2 bytes * akm_suite_count + akm_suite_count * AKM_SUITE_LEN */ - ptr = (t_u16 *)(ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8)); - pairwise_cipher_count = wlan_le16_to_cpu(*ptr); - ptr = (t_u16 *)(ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN); - temp_akm_suite_count = wlan_le16_to_cpu(*ptr); - akm_suite_count = wlan_le16_to_cpu(*ptr); - /* Save pointer to akm_suite_count in RSN IE to update it later */ - akm_suite_count_ptr = ptr; - temp = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16); - /* ptr now points to the 1st AKM suite */ - if (temp_akm_suite_count > 1) { - while (temp_akm_suite_count) { - if (pmpriv->sec_info.authentication_mode == - MLAN_AUTH_MODE_SAE) { - if (!memcmp(pmadapter, temp, sae_oui, - AKM_SUITE_LEN)) { - found = 1; + end_ptr = ptlv_rsn_ie->rsn_ie + *rsn_ie_len; + + ptr = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8); + + pairwise_cipher_count_ptr = ptr; + pairwise_cipher_count = wlan_le16_to_cpu(*(t_u16 *)ptr); + ptr += sizeof(t_u16); + + if ((pairwise_cipher_count == 0) || + (ptr + PAIRWISE_CIPHER_SUITE_LEN * pairwise_cipher_count) >= + end_ptr) { + PRINTM(MERROR, "RSNE: PAIRWISE_CIPHER not correct\n"); + return MLAN_STATUS_FAILURE; + } + + preference_selected = 0; + cipher_selected_id = 0; + for (i = 0; i < pairwise_cipher_count; i++) { + if ((ptr[3] < sizeof(cipher_preference)) && + (cipher_preference[ptr[3]] > preference_selected)) { + preference_selected = cipher_preference[ptr[3]]; + cipher_selected_id = ptr[3]; + } + ptr += PAIRWISE_CIPHER_SUITE_LEN; + } + + if (preference_selected == 0) { + PRINTM(MERROR, "RSNE: PAIRWISE_CIPHER not supported\n"); + return MLAN_STATUS_FAILURE; + } + if ((preference_selected == PREFERENCE_TKIP) && + ((*akm_type == AssocAgentAuth_Wpa3Sae) || + (*akm_type == AssocAgentAuth_Owe))) { + PRINTM(MERROR, + "RSNE: PAIRWISE_CIPHER TKIP not allowed for AKM %s\n", + (*akm_type == AssocAgentAuth_Wpa3Sae) ? "SAE" : "ÖWE"); + return MLAN_STATUS_FAILURE; + } + if ((preference_selected == PREFERENCE_TKIP) && + (*akm_type == AssocAgentAuth_Auto)) { + *akm_type = AssocAgentAuth_Open; + } + /* Process AKM + * Preference order for AssocAgentAuth_Auto: + * FT Authentication using SAE 00-0F-AC:9 (not supported in embedded + * supplicant) SAE Authentication 00-0F-AC:8 OWE Authentication + * 00-0F-AC:18 FT Authentication using PSK 00-0F-AC:4 (not supported in + * embedded supplicant) PSK using SHA-256 00-0F-AC:6 PSK 00-0F-AC:2 + */ + ptr = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) + + sizeof(t_u16) + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN; + akm_suite_count = wlan_le16_to_cpu(*(t_u16 *)ptr); + ptr += sizeof(t_u16); // move pointer to AKM suite + + if ((akm_suite_count == 0) || (ptr + AKM_SUITE_LEN * akm_suite_count + + sizeof(t_u16)) > end_ptr) { // sizeof(t_u16) + // is for + // rsncap + PRINTM(MERROR, "RSNE: AKM Suite or RSNCAP not correct\n"); + return MLAN_STATUS_FAILURE; + } + + akm_type_selected = 0; + if (*akm_type == AssocAgentAuth_Auto) { + // find the best one + for (i = 0; i < akm_suite_count; i++) { + if ((ptr[3] < sizeof(akm_preference)) && + (akm_preference[ptr[3]] > akm_type_selected)) { + akm_type_selected = akm_preference[ptr[3]]; + akm_type_id = ptr[3]; + } + ptr += AKM_SUITE_LEN; + } + if (akm_type_selected) { + if (akm_type_id == 6) + *akm_type = AssocAgentAuth_Open; + else if (akm_type_id == 2) + *akm_type = AssocAgentAuth_Open; + else if (akm_type_id == 18) + *akm_type = AssocAgentAuth_Owe; + else if (akm_type_id == 8) + *akm_type = AssocAgentAuth_Wpa3Sae; + } + } else { + // find the matched AKM + for (i = 0; i < akm_suite_count; i++) { + if (ptr[3] < sizeof(akm_preference)) { + if ((*akm_type == AssocAgentAuth_Open) && + (ptr[3] == 6)) { + break; + } else if ((*akm_type == AssocAgentAuth_Open) && + (ptr[3] == 2)) { + break; + } else if ((*akm_type == + AssocAgentAuth_Wpa3Sae) && + (ptr[3] == 8)) { + break; + } else if ((*akm_type == AssocAgentAuth_Owe) && + (ptr[3] == 18)) { break; } - } else if (!memcmp(pmadapter, temp, sha_256_oui, - AKM_SUITE_LEN)) { - found = 1; - break; } - temp += AKM_SUITE_LEN; - temp_akm_suite_count--; + ptr += AKM_SUITE_LEN; } - if (found) { - /* Copy SHA256 as AKM suite */ - memcpy_ext(pmadapter, - ptlv_rsn_ie->rsn_ie + - (sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * - PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16)), - temp, AKM_SUITE_LEN, AKM_SUITE_LEN); - /* Shift remaining bytes of RSN IE after this */ - memmove(pmadapter, - ptlv_rsn_ie->rsn_ie + - (sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * - PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16) + AKM_SUITE_LEN), - ptlv_rsn_ie->rsn_ie + - (sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * - PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16) + - akm_suite_count * AKM_SUITE_LEN), - ptlv_rsn_ie->header.len - - (sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * - PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16) + - akm_suite_count * AKM_SUITE_LEN)); - ptlv_rsn_ie->header.len = - ptlv_rsn_ie->header.len - - (akm_suite_count - 1) * AKM_SUITE_LEN; - /* Update akm suite count */ - akm_suite_count = 1; - *akm_suite_count_ptr = akm_suite_count; + if (i == akm_suite_count) { + akm_type_selected = 0; // not found + } else { + akm_type_selected = akm_preference[ptr[3]]; + akm_type_id = ptr[3]; } } - ptr = (t_u16 *)(ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) + - sizeof(t_u16) + - pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + - sizeof(t_u16) + akm_suite_count * AKM_SUITE_LEN); - prsn_cap = ptr; + + if (akm_type_selected == 0) { + PRINTM(MERROR, "RSNE: AKM Suite not found for authtype %d\n", + *akm_type); + return MLAN_STATUS_FAILURE; + } + /* Process RSNCAP */ + ptr = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) + + sizeof(t_u16) + + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + + sizeof(t_u16) + akm_suite_count * AKM_SUITE_LEN; + prsn_cap = (t_u16 *)ptr; ap_mfpc = ((*prsn_cap & (0x1 << MFPC_BIT)) == (0x1 << MFPC_BIT)); ap_mfpr = ((*prsn_cap & (0x1 << MFPR_BIT)) == (0x1 << MFPR_BIT)); @@ -740,14 +845,66 @@ ((!ap_mfpc) && ap_mfpr) || (ap_mfpc && ap_mfpr && (!pmpriv->pmfcfg.mfpc))) { PRINTM(MERROR, - "Mismatch in PMF config of STA and AP, can't associate to AP\n"); + "RSNE: Mismatch in PMF config of STA and AP, can't associate to AP\n"); return MLAN_STATUS_FAILURE; } - if ((pmpriv->pmfcfg.mfpr && pmpriv->pmfcfg.mfpc) || pmpriv->pmfcfg.mfpc) { - *prsn_cap |= PMF_MASK; - *prsn_cap &= pmf_mask; - } + *prsn_cap |= PMF_MASK; + *prsn_cap &= pmf_mask; + // PMKID + ptr += sizeof(t_u16); + if (end_ptr >= (ptr + sizeof(t_u16))) { + pmkid_count = wlan_le16_to_cpu(*(t_u16 *)ptr); + ptr += sizeof(t_u16); + + if (pmkid_count && + (end_ptr >= (ptr + pmkid_count * PMKID_LEN))) { + pmkid_list_ptr = ptr; + ptr += pmkid_count * PMKID_LEN; + } + } + // Group Mgmt Cipher Suite + if ((end_ptr >= (ptr + GROUP_MGMT_CIPHER_SUITE_LEN)) && + (pmf_mask & PMF_MASK)) { + group_mgmt_cipher_suite_ptr = ptr; + } + /* Compose new RSNE */ + // pairwiase + ptr = pairwise_cipher_count_ptr; + *(t_u16 *)ptr = wlan_cpu_to_le16(1); + ptr += sizeof(t_u16); + oui[3] = cipher_selected_id; + *(t_u32 *)ptr = *(t_u32 *)oui; + ptr += PAIRWISE_CIPHER_SUITE_LEN; + // akm + *(t_u16 *)ptr = wlan_cpu_to_le16(1); + ptr += sizeof(t_u16); + oui[3] = akm_type_id; + *(t_u32 *)ptr = *(t_u32 *)oui; + ptr += AKM_SUITE_LEN; + // RSNCAP + *(t_u16 *)ptr = wlan_cpu_to_le16(*prsn_cap); + ptr += sizeof(t_u16); + // PMKID list + if (pmkid_list_ptr || group_mgmt_cipher_suite_ptr) { + // Add PMKID + *(t_u16 *)ptr = wlan_cpu_to_le16(pmkid_count); + ptr += sizeof(t_u16); + if (pmkid_count) { + memcpy_ext(pmadapter, ptr, (t_u8 *)pmkid_list_ptr, + (pmkid_count * PMKID_LEN), (end_ptr - ptr)); + ptr += pmkid_count * PMKID_LEN; + } + if (group_mgmt_cipher_suite_ptr) { + // Add Group Mgmt Cipher Suite + memcpy_ext(pmadapter, ptr, + (t_u8 *)group_mgmt_cipher_suite_ptr, + GROUP_MGMT_CIPHER_SUITE_LEN, + (end_ptr - ptr)); + ptr += GROUP_MGMT_CIPHER_SUITE_LEN; + } + } + *rsn_ie_len = ptr - ptlv_rsn_ie->rsn_ie; return ret; } @@ -759,17 +916,16 @@ * @param rsn_ie A pointer to rsn_ie * */ -t_u8 -wlan_ft_akm_is_used(mlan_private *pmpriv, t_u8 *rsn_ie) +t_u8 wlan_ft_akm_is_used(mlan_private *pmpriv, t_u8 *rsn_ie) { t_u8 *temp; t_u16 count; t_u16 pairwise_cipher_count = 0; t_u16 akm_suite_count = 0; t_u8 found = 0; - t_u8 rsn_ft_1x_oui[4] = { 0x00, 0x0f, 0xac, 0x03 }; - t_u8 rsn_ft_psk_oui[4] = { 0x00, 0x0f, 0xac, 0x04 }; - t_u8 rsn_ft_sae_oui[4] = { 0x00, 0x0f, 0xac, 0x09 }; + t_u8 rsn_ft_1x_oui[4] = {0x00, 0x0f, 0xac, 0x03}; + t_u8 rsn_ft_psk_oui[4] = {0x00, 0x0f, 0xac, 0x04}; + t_u8 rsn_ft_sae_oui[4] = {0x00, 0x0f, 0xac, 0x09}; mlan_adapter *pmadapter = pmpriv->adapter; ENTER(); @@ -822,8 +978,7 @@ * * @return MFALSE if not found; MTURE if found */ -static t_u8 -wlan_find_ie(t_u8 *ie, t_u8 ie_len, t_u8 ie_type) +static t_u8 wlan_find_ie(t_u8 *ie, t_u8 ie_len, t_u8 ie_type) { IEEEtypes_Header_t *pheader = MNULL; t_u8 *pos = MNULL; @@ -836,7 +991,8 @@ ret_len = ie_len; while (ret_len >= 2) { pheader = (IEEEtypes_Header_t *)pos; - if ((t_s8)(pheader->len + sizeof(IEEEtypes_Header_t)) > ret_len) { + if ((t_s8)(pheader->len + sizeof(IEEEtypes_Header_t)) > + ret_len) { PRINTM(MMSG, "invalid IE length = %d left len %d\n", pheader->len, ret_len); break; @@ -863,9 +1019,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_802_11_associate(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_associate(mlan_private *pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -877,6 +1033,7 @@ MrvlIEtypes_RatesParamSet_t *prates_tlv; MrvlIEtypes_AuthType_t *pauth_tlv = MNULL; MrvlIEtypes_RsnParamSet_t *prsn_ie_tlv = MNULL; + MrvlIEtypes_SAE_PWE_Mode_t *prsnx_ie_tlv = MNULL; MrvlIEtypes_SecurityCfg_t *psecurity_cfg_ie = MNULL; MrvlIEtypes_ChanListParamSet_t *pchan_tlv; WLAN_802_11_RATES rates; @@ -889,9 +1046,10 @@ t_u8 ft_akm = 0; t_u8 oper_class; t_u8 oper_class_flag = MFALSE; + t_u8 akm_type = 0; MrvlIEtypes_HostMlme_t *host_mlme_tlv = MNULL; MrvlIEtypes_PrevBssid_t *prev_bssid_tlv = MNULL; - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; ENTER(); @@ -904,6 +1062,7 @@ pmpriv->pattempted_bss_desc = pbss_desc; /* clear assoc_rsp_size */ pmpriv->assoc_rsp_size = 0; + pmpriv->assoc_req_size = 0; memcpy_ext(pmadapter, passo->peer_sta_addr, pbss_desc->mac_address, sizeof(pbss_desc->mac_address), @@ -965,17 +1124,16 @@ PRINTM(MINFO, "ASSOC_CMD: Rates size = %d\n", rates_size); /* Add the Authentication type to be used for Auth frames if needed */ - if ((pmpriv->sec_info.authentication_mode != MLAN_AUTH_MODE_AUTO) - ) { + if ((pmpriv->sec_info.authentication_mode != MLAN_AUTH_MODE_AUTO) || + (pbss_desc->owe_transition_mode == OWE_TRANS_MODE_OWE)) { pauth_tlv = (MrvlIEtypes_AuthType_t *)pos; pauth_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_AUTH_TYPE); pauth_tlv->header.len = sizeof(pauth_tlv->auth_type); if ((pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled) || (pmpriv->sec_info.authentication_mode == MLAN_AUTH_MODE_NETWORKEAP)) - pauth_tlv->auth_type = wlan_cpu_to_le16((t_u16)pmpriv-> - sec_info. - authentication_mode); + pauth_tlv->auth_type = wlan_cpu_to_le16( + (t_u16)pmpriv->sec_info.authentication_mode); else if (pmpriv->sec_info.authentication_mode == MLAN_AUTH_MODE_FT) pauth_tlv->auth_type = @@ -984,9 +1142,16 @@ MLAN_AUTH_MODE_SAE) pauth_tlv->auth_type = wlan_cpu_to_le16(AssocAgentAuth_Wpa3Sae); + else if (!pmpriv->curr_bss_params.host_mlme && + ((pbss_desc->owe_transition_mode == + OWE_TRANS_MODE_OWE) || + pmpriv->sec_info.authentication_mode == + MLAN_AUTH_MODE_OWE)) + pauth_tlv->auth_type = + wlan_cpu_to_le16(AssocAgentAuth_Owe); else pauth_tlv->auth_type = - wlan_cpu_to_le16(MLAN_AUTH_MODE_OPEN); + wlan_cpu_to_le16(AssocAgentAuth_Open); pos += sizeof(pauth_tlv->header) + pauth_tlv->header.len; pauth_tlv->header.len = wlan_cpu_to_le16(pauth_tlv->header.len); } @@ -998,17 +1163,17 @@ (pbss_desc->prsnx_ie->data[0] & (0x1 << SAE_H2E_BIT))) { MrvlIEtypes_SAE_PWE_Mode_t *psae_pwe_mode_tlv; - /* Setup the sae pwe derivation mode TLV in the association command */ - psae_pwe_mode_tlv = (MrvlIEtypes_SAE_PWE_Mode_t *) pos; - psae_pwe_mode_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_WPA3_SAE_PWE_DERIVATION_MODE); + /* Setup the sae pwe derivation mode TLV in the + * association command */ + psae_pwe_mode_tlv = (MrvlIEtypes_SAE_PWE_Mode_t *)pos; + psae_pwe_mode_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_WPA3_SAE_PWE_DERIVATION_MODE); psae_pwe_mode_tlv->header.len = sizeof(psae_pwe_mode_tlv->pwe); psae_pwe_mode_tlv->pwe[0] = pbss_desc->prsnx_ie->data[0]; pos += sizeof(psae_pwe_mode_tlv->header) + - sizeof(psae_pwe_mode_tlv->pwe); + sizeof(psae_pwe_mode_tlv->pwe); } } @@ -1016,8 +1181,9 @@ (pbss_desc->bss_band & pmpriv->config_bands) && !(ISSUPP_11NENABLED(pmadapter->fw_cap_info) && (!pbss_desc->disable_11n) && - (pmpriv->config_bands & BAND_GN - || pmpriv->config_bands & BAND_AN) && (pbss_desc->pht_cap))) { + (pmpriv->config_bands & BAND_GN || + pmpriv->config_bands & BAND_AN) && + (pbss_desc->pht_cap))) { /* Append a channel TLV for the channel the attempted AP was * found on */ pchan_tlv = (MrvlIEtypes_ChanListParamSet_t *)pos; @@ -1033,8 +1199,7 @@ pchan_tlv->chan_scan_param[0].chan_number); pchan_tlv->chan_scan_param[0].bandcfg.chanBand = - wlan_band_to_radio_type((t_u8)pbss_desc->bss_band); - + wlan_band_to_radio_type(pbss_desc->bss_band); PRINTM(MINFO, "Assoc: TLV Bandcfg = %x\n", pchan_tlv->chan_scan_param[0].bandcfg); pos += sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); @@ -1064,15 +1229,16 @@ } HEXDUMP("ASSOC_CMD: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len; prsn_ie_tlv->header.len = wlan_cpu_to_le16(prsn_ie_tlv->header.len); - /** parse rsn ie to find whether ft akm is used*/ + /** parse rsn ie to find whether ft akm is used*/ ft_akm = wlan_ft_akm_is_used(pmpriv, pmpriv->wpa_ie); - /* Append PMF Configuration coming from cfg80211 layer */ - psecurity_cfg_ie = (MrvlIEtypes_SecurityCfg_t *) pos; + /* Append PMF Configuration coming from cfg80211 layer + */ + psecurity_cfg_ie = (MrvlIEtypes_SecurityCfg_t *)pos; psecurity_cfg_ie->header.type = wlan_cpu_to_le16(TLV_TYPE_SECURITY_CFG); @@ -1086,8 +1252,8 @@ else psecurity_cfg_ie->use_mfp = MTRUE; psecurity_cfg_ie->header.len = sizeof(t_u8); - pos += sizeof(psecurity_cfg_ie->header) - + psecurity_cfg_ie->header.len; + pos += sizeof(psecurity_cfg_ie->header) + + psecurity_cfg_ie->header.len; } #ifdef DRV_EMBEDDED_SUPPLICANT else if (supplicantIsEnabled(pmpriv->psapriv)) { @@ -1098,25 +1264,27 @@ else if (pbss_desc->pwpa_ie) rsn_wpa_ie_tmp = pbss_desc->pwpa_ie; prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; - pos += supplicantFormatRsnWpaTlv(pmpriv->psapriv, - rsn_wpa_ie_tmp, - prsn_ie_tlv); + pos += supplicantFormatRsnWpaTlv( + pmpriv->psapriv, rsn_wpa_ie_tmp, prsn_ie_tlv); } #endif - else if (pmpriv->sec_info.ewpa_enabled) { + else if (pmpriv->sec_info.ewpa_enabled || + (pbss_desc->owe_transition_mode == + OWE_TRANS_MODE_OWE) || + (pmpriv->sec_info.authentication_mode == + MLAN_AUTH_MODE_OWE)) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; if (pbss_desc->pwpa_ie) { prsn_ie_tlv->header.type = (t_u16)(*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id; + .vend_hdr.element_id; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header. - type); + prsn_ie_tlv->header.type = wlan_cpu_to_le16( + prsn_ie_tlv->header.type); prsn_ie_tlv->header.len = (t_u16)(*(pbss_desc->pwpa_ie)) - .vend_hdr.len; + .vend_hdr.len; prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; if (prsn_ie_tlv->header.len <= @@ -1124,7 +1292,7 @@ memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, &((*(pbss_desc->pwpa_ie)) - .vend_hdr.oui[0]), + .vend_hdr.oui[0]), prsn_ie_tlv->header.len, prsn_ie_tlv->header.len); } else { @@ -1135,26 +1303,24 @@ HEXDUMP("ASSOC_CMD: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - wlan_cpu_to_le16(prsn_ie_tlv->header. - len); + prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len = wlan_cpu_to_le16( + prsn_ie_tlv->header.len); } if (pbss_desc->prsn_ie) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; prsn_ie_tlv->header.type = (t_u16)(*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id; + .ieee_hdr.element_id; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header. - type); + prsn_ie_tlv->header.type = wlan_cpu_to_le16( + prsn_ie_tlv->header.type); prsn_ie_tlv->header.len = (t_u16)(*(pbss_desc->prsn_ie)) - .ieee_hdr.len; + .ieee_hdr.len; prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; if (prsn_ie_tlv->header.len <= @@ -1162,11 +1328,19 @@ memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, &((*(pbss_desc->prsn_ie)) - .data[0]), + .data[0]), prsn_ie_tlv->header.len, prsn_ie_tlv->header.len); - ret = wlan_update_rsn_ie(pmpriv, - prsn_ie_tlv); + akm_type = + pauth_tlv ? + wlan_le16_to_cpu( + pauth_tlv + ->auth_type) : + AssocAgentAuth_Auto; + ret = wlan_update_rsn_ie( + pmpriv, prsn_ie_tlv, + &prsn_ie_tlv->header.len, + &akm_type); if (ret != MLAN_STATUS_SUCCESS) { goto done; } @@ -1178,12 +1352,63 @@ HEXDUMP("ASSOC_CMD: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - wlan_cpu_to_le16(prsn_ie_tlv->header. - len); + prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len = wlan_cpu_to_le16( + prsn_ie_tlv->header.len); + + if ((pauth_tlv == MNULL) && + (pmpriv->sec_info.authentication_mode == + MLAN_AUTH_MODE_AUTO)) { + pauth_tlv = + (MrvlIEtypes_AuthType_t *)pos; + pauth_tlv->header.type = + wlan_cpu_to_le16( + TLV_TYPE_AUTH_TYPE); + pauth_tlv->header.len = + sizeof(pauth_tlv->auth_type); + pauth_tlv->auth_type = + wlan_cpu_to_le16(akm_type); + + pos += sizeof(pauth_tlv->header) + + pauth_tlv->header.len; + pauth_tlv->header.len = + wlan_cpu_to_le16( + pauth_tlv->header.len); + } + } + if ((pbss_desc->prsnx_ie) && + (akm_type == AssocAgentAuth_Wpa3Sae)) { + prsnx_ie_tlv = + (MrvlIEtypes_SAE_PWE_Mode_t *)pos; + prsnx_ie_tlv->header.type = + (t_u16)(*(pbss_desc->prsnx_ie)) + .ieee_hdr.element_id; + prsnx_ie_tlv->header.type = + prsnx_ie_tlv->header.type & 0x00FF; + prsnx_ie_tlv->header.type = wlan_cpu_to_le16( + prsnx_ie_tlv->header.type); + prsnx_ie_tlv->header.len = + (t_u16)(*(pbss_desc->prsnx_ie)) + .ieee_hdr.len; + prsnx_ie_tlv->header.len = + prsnx_ie_tlv->header.len & 0x00FF; + + memcpy_ext(pmadapter, prsnx_ie_tlv->pwe, + &((*(pbss_desc->prsnx_ie)).data[0]), + prsnx_ie_tlv->header.len, + prsnx_ie_tlv->header.len); + + HEXDUMP("ASSOC_CMD: RSNX IE", + (t_u8 *)prsnx_ie_tlv, + sizeof(prsnx_ie_tlv->header) + + prsnx_ie_tlv->header.len); + + pos += sizeof(prsnx_ie_tlv->header) + + prsnx_ie_tlv->header.len; + prsnx_ie_tlv->header.len = wlan_cpu_to_le16( + prsnx_ie_tlv->header.len); } } } @@ -1201,11 +1426,11 @@ REGULATORY_CLASS); if (!oper_class_flag) { if (MLAN_STATUS_SUCCESS == - wlan_get_curr_oper_class(pmpriv, - pbss_desc->phy_param_set. - ds_param_set.current_chan, - pbss_desc->curr_bandwidth, - &oper_class)) + wlan_get_curr_oper_class( + pmpriv, + pbss_desc->phy_param_set.ds_param_set + .current_chan, + pbss_desc->curr_bandwidth, &oper_class)) wlan_add_supported_oper_class_ie(pmpriv, &pos, oper_class); } @@ -1215,12 +1440,11 @@ wlan_11ac_bandconfig_allowed(pmpriv, pbss_desc->bss_band)) wlan_cmd_append_11ac_tlv(pmpriv, pbss_desc, &pos); - if ((IS_FW_SUPPORT_11AX(pmadapter)) && (!pbss_desc->disable_11n) && - wlan_11ax_bandconfig_allowed(pmpriv, pbss_desc->bss_band)) + if ((IS_FW_SUPPORT_11AX(pmadapter)) && + wlan_11ax_bandconfig_allowed(pmpriv, pbss_desc)) wlan_cmd_append_11ax_tlv(pmpriv, pbss_desc, &pos); - wlan_wmm_process_association_req(pmpriv, &pos, &pbss_desc->wmm_ie, - pbss_desc->pht_cap); + wlan_wmm_process_association_req(pmpriv, &pos, &pbss_desc->wmm_ie); if (pmpriv->sec_info.wapi_enabled && pmpriv->wapi_ie_len) wlan_cmd_append_wapi_ie(pmpriv, &pos); @@ -1230,24 +1454,23 @@ wlan_cmd_append_generic_ie(pmpriv, &pos); if (ft_akm && pbss_desc->pmd_ie) - wlan_cmd_append_pass_through_ie(pmpriv, - (IEEEtypes_Generic_t *) - pbss_desc->pmd_ie, &pos); + wlan_cmd_append_pass_through_ie( + pmpriv, (IEEEtypes_Generic_t *)pbss_desc->pmd_ie, &pos); wlan_cmd_append_tsf_tlv(pmpriv, &pos, pbss_desc); if (pmpriv->curr_bss_params.host_mlme) { - host_mlme_tlv = (MrvlIEtypes_HostMlme_t *) pos; + host_mlme_tlv = (MrvlIEtypes_HostMlme_t *)pos; host_mlme_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HOST_MLME); host_mlme_tlv->header.len = wlan_cpu_to_le16(sizeof(host_mlme_tlv->host_mlme)); host_mlme_tlv->host_mlme = MTRUE; pos += sizeof(host_mlme_tlv->header) + - host_mlme_tlv->header.len; + host_mlme_tlv->header.len; } if (memcmp(pmadapter, &pmpriv->curr_bss_params.prev_bssid, zero_mac, MLAN_MAC_ADDR_LENGTH)) { - prev_bssid_tlv = (MrvlIEtypes_PrevBssid_t *) pos; + prev_bssid_tlv = (MrvlIEtypes_PrevBssid_t *)pos; prev_bssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_PREV_BSSID); prev_bssid_tlv->header.len = MLAN_MAC_ADDR_LENGTH; @@ -1259,7 +1482,7 @@ pos += sizeof(prev_bssid_tlv->header) + MLAN_MAC_ADDR_LENGTH; } - if (wlan_11d_create_dnld_countryinfo(pmpriv, (t_u8)pbss_desc->bss_band)) { + if (wlan_11d_create_dnld_countryinfo(pmpriv, pbss_desc->bss_band)) { PRINTM(MERROR, "Dnld_countryinfo_11d failed\n"); ret = MLAN_STATUS_FAILURE; goto done; @@ -1274,10 +1497,10 @@ * Call 11h join API after capability bits are set so adhoc/infra 11h * behavior can be properly triggered. pos modified if data is appended */ - wlan_11h_process_join(pmpriv, &pos, &passo->cap_info, - (t_u8)pbss_desc->bss_band, - pbss_desc->phy_param_set.ds_param_set. - current_chan, &pbss_desc->wlan_11h_bss_info); + wlan_11h_process_join( + pmpriv, &pos, &passo->cap_info, (t_u8)pbss_desc->bss_band, + pbss_desc->phy_param_set.ds_param_set.current_chan, + &pbss_desc->wlan_11h_bss_info); cmd->size = wlan_cpu_to_le16((t_u16)(pos - (t_u8 *)passo) + S_DS_GEN); @@ -1376,9 +1599,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_associate(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) +mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *pioctl_req = (mlan_ioctl_req *)pioctl_buf; @@ -1401,11 +1624,9 @@ if (!memcmp(pmpriv->adapter, hdr->BssId, pmpriv->pattempted_bss_desc->mac_address, MLAN_MAC_ADDR_LENGTH)) - passoc_rsp = - (IEEEtypes_AssocRsp_t *)((t_u8 *)(&resp->params) - + - sizeof - (IEEEtypes_MgmtHdr_t)); + passoc_rsp = (IEEEtypes_AssocRsp_t + *)((t_u8 *)(&resp->params) + + sizeof(IEEEtypes_MgmtHdr_t)); else passoc_rsp = (IEEEtypes_AssocRsp_t *)&resp->params; } else @@ -1443,9 +1664,10 @@ MLAN_MAC_ADDR_LENGTH)) wlan_reset_connect_state(pmpriv, MTRUE); else - wlan_recv_event(pmpriv, - MLAN_EVENT_ID_DRV_ASSOC_FAILURE_REPORT, - MNULL); + wlan_recv_event( + pmpriv, + MLAN_EVENT_ID_DRV_ASSOC_FAILURE_REPORT, + MNULL); } else wlan_reset_connect_state(pmpriv, MTRUE); pmpriv->adapter->dbg.num_cmd_assoc_failure++; @@ -1492,7 +1714,7 @@ pmpriv->curr_bss_params.bss_descriptor.channel = pbss_desc->phy_param_set.ds_param_set.current_chan; - pmpriv->curr_bss_params.band = (t_u8)pbss_desc->bss_band; + pmpriv->curr_bss_params.band = pbss_desc->bss_band; /* Store current channel for further reference. * This would save one extra call to get current @@ -1501,7 +1723,7 @@ pmpriv->adapter->dfsr_channel = pmpriv->curr_bss_params.bss_descriptor.channel; - /* + /*` * Adjust the timestamps in the scan table to be relative to the newly * associated AP's TSF */ @@ -1512,10 +1734,7 @@ else pmpriv->curr_bss_params.wmm_enabled = MFALSE; - if ((pmpriv->wmm_required || - (pbss_desc->pht_cap && - (pbss_desc->pht_cap->ieee_hdr.element_id == HT_CAPABILITY))) && - pmpriv->curr_bss_params.wmm_enabled) + if (pmpriv->wmm_required && pmpriv->curr_bss_params.wmm_enabled) pmpriv->wmm_enabled = MTRUE; else pmpriv->wmm_enabled = MFALSE; @@ -1553,17 +1772,18 @@ pmpriv->bcn_nf_avg = 0; pmpriv->rxpd_rate = 0; pmpriv->rxpd_rate_info = 0; - /* Reset mib statistics */ + /* Reset mib statistics*/ pmpriv->amsdu_rx_cnt = 0; pmpriv->amsdu_tx_cnt = 0; pmpriv->msdu_in_rx_amsdu_cnt = 0; pmpriv->msdu_in_tx_amsdu_cnt = 0; if (pbss_desc->pvht_cap && pbss_desc->pht_cap) { - if (GET_VHTCAP_MAXMPDULEN - (pbss_desc->pvht_cap->vht_cap.vht_cap_info) == 2) + if (GET_VHTCAP_MAXMPDULEN( + pbss_desc->pvht_cap->vht_cap.vht_cap_info) == 2) pmpriv->max_amsdu = MLAN_TX_DATA_BUF_SIZE_12K; - else if (GET_VHTCAP_MAXMPDULEN - (pbss_desc->pvht_cap->vht_cap.vht_cap_info) == 1) + else if (GET_VHTCAP_MAXMPDULEN( + pbss_desc->pvht_cap->vht_cap.vht_cap_info) == + 1) pmpriv->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else pmpriv->max_amsdu = MLAN_TX_DATA_BUF_SIZE_4K; @@ -1591,58 +1811,57 @@ if (media_connected) { /** replace ralist's mac address with new mac address */ if (0 == - wlan_ralist_update(pmpriv, cur_mac, - pmpriv->curr_bss_params.bss_descriptor. - mac_address)) + wlan_ralist_update( + pmpriv, cur_mac, + pmpriv->curr_bss_params.bss_descriptor.mac_address)) wlan_ralist_add(pmpriv, - pmpriv->curr_bss_params.bss_descriptor. - mac_address); + pmpriv->curr_bss_params.bss_descriptor + .mac_address); wlan_11n_cleanup_reorder_tbl(pmpriv); wlan_11n_deleteall_txbastream_tbl(pmpriv); } else - wlan_ralist_add(pmpriv, - pmpriv->curr_bss_params.bss_descriptor. - mac_address); + wlan_ralist_add( + pmpriv, + pmpriv->curr_bss_params.bss_descriptor.mac_address); wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_CONNECTED, pevent); +#ifdef UAP_SUPPORT + if (pmpriv->adapter->dfs_mode) + wlan_11h_update_dfs_master_state_by_sta(pmpriv); +#endif - /* Send OBSS scan param to the application if available */ - wlan_2040_coex_event(pmpriv); wlan_coex_ampdu_rxwinsize(pmpriv->adapter); - if (!pmpriv->sec_info.wpa_enabled && !pmpriv->sec_info.wpa2_enabled - && !pmpriv->sec_info.ewpa_enabled - && !pmpriv->sec_info.wapi_enabled - && !pmpriv->wps.session_enable && !pmpriv->sec_info.osen_enabled + if (!pmpriv->sec_info.wpa_enabled && !pmpriv->sec_info.wpa2_enabled && + !pmpriv->sec_info.ewpa_enabled && !pmpriv->sec_info.wapi_enabled && + !pmpriv->wps.session_enable && !pmpriv->sec_info.osen_enabled #ifdef DRV_EMBEDDED_SUPPLICANT && !supplicantIsEnabled(pmpriv->psapriv) #endif - ) { + ) { /* We are in Open/WEP mode, open port immediately */ if (pmpriv->port_ctrl_mode == MTRUE) { pmpriv->port_open = MTRUE; PRINTM(MINFO, "ASSOC_RESP: port_status = OPEN\n"); } } - if (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled - || pmpriv->sec_info.ewpa_enabled - || pmpriv->sec_info.wapi_enabled - || pmpriv->wps.session_enable || pmpriv->sec_info.osen_enabled + if (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled || + pmpriv->sec_info.ewpa_enabled || pmpriv->sec_info.wapi_enabled || + pmpriv->wps.session_enable || pmpriv->sec_info.osen_enabled #ifdef DRV_EMBEDDED_SUPPLICANT || (supplicantIsEnabled(pmpriv->psapriv)) #endif - ) + ) pmpriv->adapter->scan_block = MTRUE; #ifdef DRV_EMBEDDED_SUPPLICANT - supplicantInitSession(pmpriv->psapriv, - (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor. - ssid.ssid, - pmpriv->curr_bss_params.bss_descriptor.ssid. - ssid_len, - (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor. - mac_address, (t_u8 *)&pmpriv->curr_addr); + supplicantInitSession( + pmpriv->psapriv, + (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor.ssid.ssid, + pmpriv->curr_bss_params.bss_descriptor.ssid.ssid_len, + (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor.mac_address, + (t_u8 *)&pmpriv->curr_addr); #endif pevent = (mlan_event *)event_buf; @@ -1650,7 +1869,7 @@ pevent->bss_index = pmpriv->bss_index; pevent->event_id = MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER; pevent->event_len = sizeof(assoc_logger_data); - assoc_succ = (assoc_logger_data *) pevent->event_buf; + assoc_succ = (assoc_logger_data *)pevent->event_buf; memcpy_ext(pmpriv->adapter, (t_u8 *)assoc_succ->bssid, pbss_desc->mac_address, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); @@ -1670,9 +1889,10 @@ if (ret != MLAN_STATUS_SUCCESS) { if (passoc_rsp->status_code) pioctl_req->status_code = - (wlan_le16_to_cpu - (*(t_u16 *)&passoc_rsp->capability) - << 16) + passoc_rsp->status_code; + (wlan_le16_to_cpu(*(t_u16 *)&passoc_rsp + ->capability) + << 16) + + passoc_rsp->status_code; else pioctl_req->status_code = MLAN_ERROR_CMD_ASSOC_FAIL; @@ -1694,9 +1914,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_802_11_ad_hoc_start(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_ad_hoc_start(mlan_private *pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -1709,11 +1929,10 @@ MrvlIEtypes_RsnParamSet_t *prsn_ie_tlv; /* wpa ie for WPA_NONE AES */ - const t_u8 wpa_ie[24] = { 0xdd, 0x16, 0x00, 0x50, 0xf2, 0x01, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x04, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00 - }; + const t_u8 wpa_ie[24] = {0xdd, 0x16, 0x00, 0x50, 0xf2, 0x01, + 0x01, 0x00, 0x00, 0x50, 0xf2, 0x04, + 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00, + 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00}; t_s32 append_size_11h = 0; t_u8 *pos = (t_u8 *)padhoc_start + sizeof(HostCmd_DS_802_11_AD_HOC_START); @@ -1774,16 +1993,13 @@ padhoc_start->phy_param_set.ds_param_set.element_id = DS_PARA_IE_ID; padhoc_start->phy_param_set.ds_param_set.len = DS_PARA_IE_LEN; - if (!wlan_get_cfp_by_band_and_channel - (pmadapter, pmadapter->adhoc_start_band, - (t_u16)pmpriv->adhoc_channel, pmadapter->region_channel)) { + if (!wlan_get_cfp_by_band_and_channel( + pmadapter, pmadapter->adhoc_start_band, + (t_u16)pmpriv->adhoc_channel, pmadapter->region_channel)) { chan_freq_power_t *cfp; - cfp = wlan_get_cfp_by_band_and_channel(pmadapter, - pmadapter-> - adhoc_start_band, - FIRST_VALID_CHANNEL, - pmadapter-> - region_channel); + cfp = wlan_get_cfp_by_band_and_channel( + pmadapter, pmadapter->adhoc_start_band, + FIRST_VALID_CHANNEL, pmadapter->region_channel); if (cfp) pmpriv->adhoc_channel = (t_u8)cfp->channel; } @@ -1828,8 +2044,8 @@ pbss_desc->cap_info.ibss = 1; /* Set up privacy in pbss_desc */ - if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled - || pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { + if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled || + pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { /** Ad-Hoc capability privacy on */ #define AD_HOC_CAP_PRIVACY_ON 1 PRINTM(MINFO, "ADHOC_S_CMD: wep_status set, Privacy to WEP\n"); @@ -1837,7 +2053,7 @@ padhoc_start->cap.privacy = AD_HOC_CAP_PRIVACY_ON; } else { PRINTM(MWARN, "ADHOC_S_CMD: wep_status NOT set, Setting " - "Privacy to ACCEPT ALL\n"); + "Privacy to ACCEPT ALL\n"); pbss_desc->privacy = Wlan802_11PrivFilterAcceptAll; } @@ -1959,7 +2175,7 @@ DBG_HEXDUMP(MCMD_D, "ADHOC_S_CMD: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; cmd_append_size += sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; @@ -1967,10 +2183,9 @@ wlan_cpu_to_le16(prsn_ie_tlv->header.len); } - cmd->size = (t_u16)wlan_cpu_to_le16((t_u16) - (sizeof - (HostCmd_DS_802_11_AD_HOC_START) + - S_DS_GEN + cmd_append_size)); + cmd->size = (t_u16)wlan_cpu_to_le16( + (t_u16)(sizeof(HostCmd_DS_802_11_AD_HOC_START) + S_DS_GEN + + cmd_append_size)); memcpy_ext(pmadapter, &tmp_cap, &padhoc_start->cap, sizeof(t_u16), sizeof(tmp_cap)); @@ -2000,9 +2215,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_802_11_ad_hoc_join(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_ad_hoc_join(mlan_private *pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -2015,6 +2230,7 @@ t_u32 i, rates_size = 0; t_u32 curr_pkt_filter; t_u8 *pos = (t_u8 *)padhoc_join + sizeof(HostCmd_DS_802_11_AD_HOC_JOIN); + t_s32 append_size_11h = 0; ENTER(); @@ -2022,7 +2238,7 @@ #define USE_G_PROTECTION 0x02 if (pbss_desc->erp_flags & USE_G_PROTECTION) { curr_pkt_filter = pmpriv->curr_pkt_filter | - HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; + HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MAC_CONTROL, HostCmd_ACT_GEN_SET, 0, MNULL, @@ -2057,16 +2273,16 @@ sizeof(IEEEtypes_PhyParamSet_t)); padhoc_join->bss_descriptor.phy_param_set.fh_param_set.dwell_time = - wlan_cpu_to_le16(padhoc_join->bss_descriptor.phy_param_set. - fh_param_set.dwell_time); + wlan_cpu_to_le16(padhoc_join->bss_descriptor.phy_param_set + .fh_param_set.dwell_time); memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.ss_param_set, &pbss_desc->ss_param_set, sizeof(IEEEtypes_SsParamSet_t), sizeof(IEEEtypes_SsParamSet_t)); padhoc_join->bss_descriptor.ss_param_set.ibss_param_set.atim_window = 0; padhoc_join->bss_descriptor.ss_param_set.ibss_param_set.atim_window = - wlan_cpu_to_le16(padhoc_join->bss_descriptor.ss_param_set. - ibss_param_set.atim_window); + wlan_cpu_to_le16(padhoc_join->bss_descriptor.ss_param_set + .ibss_param_set.atim_window); memcpy_ext(pmadapter, &tmp_cap, &pbss_desc->cap_info, sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); @@ -2107,10 +2323,10 @@ /* Copy the channel information */ pmpriv->curr_bss_params.bss_descriptor.channel = pbss_desc->channel; - pmpriv->curr_bss_params.band = (t_u8)pbss_desc->bss_band; + pmpriv->curr_bss_params.band = pbss_desc->bss_band; - if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled - || pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) + if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled || + pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) padhoc_join->bss_descriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; if (IS_SUPPORT_MULTI_BANDS(pmadapter)) { @@ -2128,7 +2344,7 @@ pchan_tlv->chan_scan_param[0].chan_number); pchan_tlv->chan_scan_param[0].bandcfg.chanBand = - wlan_band_to_radio_type((t_u8)pbss_desc->bss_band); + wlan_band_to_radio_type(pbss_desc->bss_band); PRINTM(MINFO, "ADHOC_J_CMD: TLV Bandcfg = %x\n", pchan_tlv->chan_scan_param[0].bandcfg); @@ -2137,7 +2353,7 @@ sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); } - if (wlan_11d_create_dnld_countryinfo(pmpriv, (t_u8)pbss_desc->bss_band)) { + if (wlan_11d_create_dnld_countryinfo(pmpriv, pbss_desc->bss_band)) { PRINTM(MERROR, "Dnld_countryinfo_11d failed\n"); ret = MLAN_STATUS_FAILURE; goto done; @@ -2153,12 +2369,17 @@ * adhoc/infra 11h behavior can be properly triggered. * pos modified if data is appended */ - cmd_append_size += + append_size_11h += wlan_11h_process_join(pmpriv, &pos, &padhoc_join->bss_descriptor.cap, - (t_u8)pbss_desc->bss_band, - pbss_desc->channel, + pbss_desc->bss_band, pbss_desc->channel, &pbss_desc->wlan_11h_bss_info); + if (append_size_11h >= 0) + cmd_append_size += append_size_11h; + else { + ret = MLAN_STATUS_FAILURE; + goto done; + } if (pmpriv->sec_info.wpa_enabled) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; @@ -2190,7 +2411,7 @@ if (pbss_desc->pwpa_ie) { prsn_ie_tlv->header.type = (t_u16)(*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id; + .vend_hdr.element_id; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = @@ -2199,10 +2420,11 @@ (t_u16)(*(pbss_desc->pwpa_ie)).vend_hdr.len; prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= (sizeof(pmpriv->wpa_ie))) { + if (prsn_ie_tlv->header.len <= + (sizeof(pmpriv->wpa_ie))) { memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, &((*(pbss_desc->pwpa_ie)) - .vend_hdr.oui[0]), + .vend_hdr.oui[0]), prsn_ie_tlv->header.len, prsn_ie_tlv->header.len); } else { @@ -2212,11 +2434,11 @@ HEXDUMP("ADHOC_JOIN: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len; cmd_append_size += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len; prsn_ie_tlv->header.len = wlan_cpu_to_le16(prsn_ie_tlv->header.len); } @@ -2224,7 +2446,7 @@ prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; prsn_ie_tlv->header.type = (t_u16)(*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id; + .ieee_hdr.element_id; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = @@ -2233,7 +2455,8 @@ (t_u16)(*(pbss_desc->prsn_ie)).ieee_hdr.len; prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= (sizeof(pmpriv->wpa_ie))) { + if (prsn_ie_tlv->header.len <= + (sizeof(pmpriv->wpa_ie))) { memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, &((*(pbss_desc->prsn_ie)).data[0]), prsn_ie_tlv->header.len, @@ -2245,20 +2468,19 @@ HEXDUMP("ADHOC_JOIN: RSN IE", (t_u8 *)prsn_ie_tlv, sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); + prsn_ie_tlv->header.len); pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len; cmd_append_size += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; + prsn_ie_tlv->header.len; prsn_ie_tlv->header.len = wlan_cpu_to_le16(prsn_ie_tlv->header.len); } } - cmd->size = (t_u16)wlan_cpu_to_le16((t_u16) - (sizeof - (HostCmd_DS_802_11_AD_HOC_JOIN) + - S_DS_GEN + cmd_append_size)); + cmd->size = (t_u16)wlan_cpu_to_le16( + (t_u16)(sizeof(HostCmd_DS_802_11_AD_HOC_JOIN) + S_DS_GEN + + cmd_append_size)); memcpy_ext(pmadapter, &tmp_cap, &padhoc_join->bss_descriptor.cap, sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); @@ -2282,9 +2504,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_ad_hoc(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) +mlan_status wlan_ret_802_11_ad_hoc(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *pioctl_req = (mlan_ioctl_req *)pioctl_buf; @@ -2300,7 +2521,7 @@ int ie_len = 0; IEEEtypes_WmmParameter_t *pwmm_param_ie = MNULL; mlan_adapter *pmadapter = pmpriv->adapter; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; ENTER(); @@ -2308,23 +2529,23 @@ if (command == HostCmd_CMD_802_11_AD_HOC_START) { result = padhoc_start_result->result; ie_len = resp->size - - (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + - S_DS_GEN); + (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + + S_DS_GEN); pwmm_param_ie = (IEEEtypes_WmmParameter_t - *)((t_u8 *)resp + - (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + - S_DS_GEN)); + *)((t_u8 *)resp + + (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + + S_DS_GEN)); } else { result = padhoc_join_result->result; ie_len = resp->size - - (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + - S_DS_GEN); + (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + + S_DS_GEN); pwmm_param_ie = (IEEEtypes_WmmParameter_t - *)((t_u8 *)resp + - (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + - S_DS_GEN)); + *)((t_u8 *)resp + + (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + + S_DS_GEN)); } pbss_desc = pmpriv->pattempted_bss_desc; @@ -2389,8 +2610,9 @@ DBG_HEXDUMP(MCMD_D, "WMM Param", (t_u8 *)pwmm_param_ie, ie_len); memcpy_ext(pmpriv->adapter, - (t_u8 *)&pmpriv->curr_bss_params. - bss_descriptor.wmm_ie, pwmm_param_ie, + (t_u8 *)&pmpriv->curr_bss_params + .bss_descriptor.wmm_ie, + pwmm_param_ie, (pwmm_param_ie->vend_hdr.len + 2), sizeof(IEEEtypes_WmmParameter_t)); pmpriv->wmm_enabled = MTRUE; @@ -2437,9 +2659,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_associate(mlan_private *pmpriv, t_void *pioctl_buf, - BSSDescriptor_t *pbss_desc) +mlan_status wlan_associate(mlan_private *pmpriv, t_void *pioctl_buf, + BSSDescriptor_t *pbss_desc) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 current_bssid[MLAN_MAC_ADDR_LENGTH]; @@ -2481,9 +2702,8 @@ * * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail */ -mlan_status -wlan_adhoc_start(mlan_private *pmpriv, t_void *pioctl_buf, - mlan_802_11_ssid *padhoc_ssid) +mlan_status wlan_adhoc_start(mlan_private *pmpriv, t_void *pioctl_buf, + mlan_802_11_ssid *padhoc_ssid) { mlan_status ret = MLAN_STATUS_SUCCESS; wlan_meas_state_t *pmeas_state = &pmpriv->adapter->state_meas; @@ -2498,7 +2718,8 @@ */ if (!pmeas_state->meas_rpt_returned.rpt.basic.map.unmeasured) { radar = pmeas_state->meas_rpt_returned.rpt.basic.map.radar ? - MTRUE : MFALSE; + MTRUE : + MFALSE; } if (radar) { @@ -2538,9 +2759,8 @@ * * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail */ -mlan_status -wlan_adhoc_join(mlan_private *pmpriv, t_void *pioctl_buf, - BSSDescriptor_t *pbss_desc) +mlan_status wlan_adhoc_join(mlan_private *pmpriv, t_void *pioctl_buf, + BSSDescriptor_t *pbss_desc) { pmlan_adapter pmadapter = pmpriv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2595,15 +2815,13 @@ * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail, * MLAN_STATUS_PENDING--pending */ -mlan_status -wlan_disconnect(mlan_private *pmpriv, - mlan_ioctl_req *pioctl_req, mlan_deauth_param *deauth_param) +mlan_status wlan_disconnect(mlan_private *pmpriv, mlan_ioctl_req *pioctl_req, + mlan_deauth_param *deauth_param) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_deauth_param local_param = {.mac_addr = {0, 0, 0, 0, 0, 0}, - .reason_code = DEF_DEAUTH_REASON_CODE - }; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + .reason_code = DEF_DEAUTH_REASON_CODE}; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -2617,24 +2835,23 @@ zero_mac, sizeof(zero_mac))) memcpy_ext(pmpriv->adapter, local_param.mac_addr, - (t_u8 *)&pmpriv->curr_bss_params. - bss_descriptor.mac_address, + (t_u8 *)&pmpriv->curr_bss_params + .bss_descriptor.mac_address, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); #ifdef WIFI_DIRECT_SUPPORT if (pmpriv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_DISASSOCIATE, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - &local_param); + ret = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_802_11_DISASSOCIATE, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_req, &local_param); else #endif - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_DEAUTHENTICATE, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - &local_param); + ret = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_802_11_DEAUTHENTICATE, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_req, &local_param); if (ret == MLAN_STATUS_SUCCESS && pioctl_req) ret = MLAN_STATUS_PENDING; @@ -2661,8 +2878,7 @@ * * @return Radio type designator for use in a channel TLV */ -t_u8 -wlan_band_to_radio_type(t_u8 band) +t_u8 wlan_band_to_radio_type(t_u16 band) { t_u8 ret_radio_type;
diff --git a/wlan_sd8987/mlan/mlan_join.h b/wlan_sd8987/mlan/mlan_join.h index 44d9e84..5a90761 100755 --- a/wlan_sd8987/mlan/mlan_join.h +++ b/wlan_sd8987/mlan/mlan_join.h
@@ -8,7 +8,7 @@ * both adhoc and infrastructure networks * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_main.h b/wlan_sd8987/mlan/mlan_main.h index f399852..643db9a 100755 --- a/wlan_sd8987/mlan/mlan_main.h +++ b/wlan_sd8987/mlan/mlan_main.h
@@ -5,7 +5,7 @@ * in MLAN module. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -31,11 +31,11 @@ #define _MLAN_MAIN_H_ #ifdef DEBUG_LEVEL1 -extern t_void (*print_callback) (t_pvoid pmoal_handle, t_u32 level, - char *pformat, IN ...); +extern t_void (*print_callback)(t_pvoid pmoal_handle, t_u32 level, + char *pformat, IN...); -extern mlan_status (*get_sys_time_callback) (t_void *pmoal_handle, - t_u32 *psec, t_u32 *pusec); +extern mlan_status (*get_sys_time_callback)(t_void *pmoal_handle, t_u32 *psec, + t_u32 *pusec); extern t_u32 mlan_drvdbg; @@ -346,10 +346,16 @@ (x)->rx_pkt_offset = wlan_le16_to_cpu((x)->rx_pkt_offset); \ (x)->rx_pkt_type = wlan_le16_to_cpu((x)->rx_pkt_type); \ (x)->seq_num = wlan_le16_to_cpu((x)->seq_num); \ - (x)->rx_info = wlan_le32_to_cpu((x)->rx_info); \ - + (x)->rx_info = wlan_le32_to_cpu((x)->rx_info); } +/** Convert RxPD extra header from little endian format to CPU format */ +#define endian_convert_RxPD_extra_header(x) \ + do { \ + (x)->channel_flags = wlan_le16_to_cpu((x)->channel_flags); \ + (x)->vht_sig1 = wlan_le32_to_cpu((x)->vht_sig1); \ + (x)->vht_sig2 = wlan_le32_to_cpu((x)->vht_sig2); \ + } while (0) #else /** Convert ulong n/w to host */ #define mlan_ntohl(x) swap_byte_32(x) @@ -380,10 +386,14 @@ #define endian_convert_RxPD(x) \ do { \ } while (0) +/** Convert RxPD extra header from little endian format to CPU format */ +#define endian_convert_RxPD_extra_header(x) \ + do { \ + } while (0) #endif /* BIG_ENDIAN_SUPPORT */ /** Global moal_assert_callback */ -extern t_void (*assert_callback) (t_void *pmoal_handle, t_u32 cond); +extern t_void (*assert_callback)(t_void *pmoal_handle, t_u32 cond); /** Assertion */ #define MASSERT(cond) \ @@ -557,7 +567,9 @@ #define SDIO_CMD53_MAX_SIZE 65280 #define MAX_SUPPORT_AMSDU_SIZE 4096 /** Maximum numbfer of registers to read for multiple port */ -#if defined(SD8887) || defined(SD8997) || defined(SD8977) || defined(SD8987) || defined(SD9098) || defined(SD9097) || defined(SD8978) || defined(SD9177) +#if defined(SD8887) || defined(SD8997) || defined(SD8977) || \ + defined(SD8987) || defined(SD9098) || defined(SD9097) || \ + defined(SDNW62X) || defined(SD8978) || defined(SD9177) #define MAX_MP_REGS 196 #else /* upto 0xB7 */ @@ -566,16 +578,16 @@ /** Maximum port */ #define MAX_PORT 32 /** Maximum port 16 */ -#define MAX_PORT_16 (16) +#define MAX_PORT_16 (16) /** max MP REGS */ #define MAX_MP_REGS_MAX (196) /** Multi port TX aggregation buffer size */ -#define SDIO_MP_TX_AGGR_DEF_BUF_SIZE (65280) /* 64K - 256 */ +#define SDIO_MP_TX_AGGR_DEF_BUF_SIZE (65280) /* 64K - 256 */ /** Multi port RX aggregation buffer size */ -#define SDIO_MP_RX_AGGR_DEF_BUF_SIZE (65280) /* 64K - 256 */ +#define SDIO_MP_RX_AGGR_DEF_BUF_SIZE (65280) /* 64K - 256 */ #endif /* SDIO */ @@ -587,18 +599,19 @@ /** Low threshold to allow Rx BA */ #define RX_LOW_THRESHOLD 128 -#define MFG_CMD_SET_TEST_MODE 1 +#define MFG_CMD_SET_TEST_MODE 1 #define MFG_CMD_UNSET_TEST_MODE 0 -#define MFG_CMD_TX_ANT 0x1004 -#define MFG_CMD_RX_ANT 0x1005 -#define MFG_CMD_TX_CONT 0x1009 -#define MFG_CMD_RF_CHAN 0x100A -#define MFG_CMD_CLR_RX_ERR 0x1010 -#define MFG_CMD_TX_FRAME 0x1021 -#define MFG_CMD_RF_BAND_AG 0x1034 -#define MFG_CMD_RF_CHANNELBW 0x1044 -#define MFG_CMD_RADIO_MODE_CFG 0x1211 +#define MFG_CMD_TX_ANT 0x1004 +#define MFG_CMD_RX_ANT 0x1005 +#define MFG_CMD_TX_CONT 0x1009 +#define MFG_CMD_RF_CHAN 0x100A +#define MFG_CMD_CLR_RX_ERR 0x1010 +#define MFG_CMD_TX_FRAME 0x1021 +#define MFG_CMD_RF_BAND_AG 0x1034 +#define MFG_CMD_RF_CHANNELBW 0x1044 +#define MFG_CMD_RADIO_MODE_CFG 0x1211 #define MFG_CMD_CONFIG_MAC_HE_TB_TX 0x110A +#define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C /** Debug command number */ #define DBG_CMD_NUM 10 @@ -753,7 +766,7 @@ /** packet count threshold to setup BA */ t_u8 ba_packet_threshold; /** is 11n enabled */ - t_u8 is_11n_enabled; + t_u8 is_wmm_enabled; /** max amsdu size */ t_u16 max_amsdu; /** BA stream status */ @@ -812,7 +825,7 @@ /** WMM queue priority table */ t_u8 queue_priority[MAX_AC_QUEUES]; /** User priority packet transmission control */ - t_u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ + t_u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ /** Number of transmit packets queued */ mlan_scalar tx_pkts_queued; @@ -851,7 +864,7 @@ /** Uapsd enable?*/ t_u8 wmm_uapsd_enabled; /** Band */ - t_u8 band; + t_u16 band; /** Number of rates supported */ t_u32 num_of_rates; /** Supported rates*/ @@ -908,7 +921,7 @@ /** Region code for US, Japan ... */ t_u8 region; /** Band B/G/A, used for BAND_CONFIG cmd */ - t_u8 band; + t_u16 band; /** Actual No. of elements in the array below */ t_u8 num_cfp; /** chan-freq-txpower mapping table */ @@ -925,10 +938,12 @@ /** Domain regulatory information */ typedef struct _wlan_802_11d_domain_reg { + /** dfs_region */ + t_u8 dfs_region; /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; /** band that channels in sub_band belong to */ - t_u8 band; + t_u16 band; /** No. of subband in below */ t_u8 no_of_sub_band; /** Subband data to send/last sent */ @@ -966,7 +981,7 @@ typedef struct { /** UAP internal callback after wlan_uap_get_channel */ /** (parameter is really pointer to mlan_private) */ - mlan_status (*get_chan_callback) (t_void *); + mlan_status (*get_chan_callback)(t_void *); /** current ioctl_req (to be completed in callback) */ pmlan_ioctl_req pioctl_req_curr; /** band config from MrvlIEtypes_channel_band_t */ @@ -991,23 +1006,22 @@ /** mlan_operations data structure */ typedef struct _mlan_operations { /** cmd init handler */ - mlan_status (*init_cmd) (t_void *priv, t_u8 first_bss); + mlan_status (*init_cmd)(t_void *priv, t_u8 first_bss); /** ioctl handler */ - mlan_status (*ioctl) (t_void *adapter, pmlan_ioctl_req pioctl_req); + mlan_status (*ioctl)(t_void *adapter, pmlan_ioctl_req pioctl_req); /** cmd handler */ - mlan_status (*prepare_cmd) (t_void *priv, t_u16 cmd_no, - t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, t_void *pdata_buf, - t_void *pcmd_buf); + mlan_status (*prepare_cmd)(t_void *priv, t_u16 cmd_no, t_u16 cmd_action, + t_u32 cmd_oid, t_void *pioctl_buf, + t_void *pdata_buf, t_void *pcmd_buf); /** cmdresp handler */ - mlan_status (*process_cmdresp) (t_void *priv, t_u16 cmdresp_no, - t_void *pcmd_buf, t_void *pioctl); + mlan_status (*process_cmdresp)(t_void *priv, t_u16 cmdresp_no, + t_void *pcmd_buf, t_void *pioctl); /** rx handler */ - mlan_status (*process_rx_packet) (t_void *adapter, pmlan_buffer pmbuf); + mlan_status (*process_rx_packet)(t_void *adapter, pmlan_buffer pmbuf); /** event handler */ - mlan_status (*process_event) (t_void *priv); + mlan_status (*process_event)(t_void *priv); /** txpd handler */ - t_void *(*process_txpd) (t_void *priv, pmlan_buffer pmbuf); + t_void *(*process_txpd)(t_void *priv, pmlan_buffer pmbuf); /** BSS role */ mlan_bss_role bss_role; } mlan_operations, *pmlan_operations; @@ -1052,9 +1066,9 @@ /** Tx rate */ t_u8 tx_rate; t_u8 tx_rate_info; - /*HE tx tone mode and DCM info */ + /*HE tx tone mode and DCM info*/ t_u8 ext_tx_rate_info; - /*HE rx tone mode and DCM info */ + /*HE rx tone mode and DCM info*/ t_u8 rxpd_rx_info; /** rxpd_htinfo */ t_u8 rxpd_rate_info; @@ -1071,7 +1085,7 @@ #ifdef UAP_SUPPORT /** UAP 11n flag */ t_u8 is_11n_enabled; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ /** UAP 11ac flag */ t_u8 is_11ac_enabled; /** UAP 11ax flag */ @@ -1172,6 +1186,7 @@ /** AdHoc previous ssid used for Start */ mlan_802_11_ssid adhoc_last_start_ssid; #endif + mlan_ds_11h_chan_rep_req chan_rep_req; /** FSM variable for 11d support */ wlan_802_11d_state_t state_11d; /** FSM variable for 11h support */ @@ -1183,9 +1198,11 @@ t_bool uap_host_based; /**UAP operating channel*/ t_u8 uap_channel; + /**UAP bandwidth*/ + t_u8 uap_bandwidth; /** state variable for UAP Get Info callback */ wlan_uap_get_info_cb_t uap_state_chan_cb; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ /** Security related */ /** Encryption parameter */ @@ -1278,7 +1295,10 @@ t_u8 assoc_rsp_buf[MRVDRV_ASSOC_RSP_BUF_SIZE]; /** Length of the data stored in assoc_rsp_buf */ t_u32 assoc_rsp_size; - + /** Buffer to store the association req IEs */ + t_u8 assoc_req_buf[MRVDRV_ASSOC_RSP_BUF_SIZE]; + /** Length of the data stored in assoc_rsp_buf */ + t_u32 assoc_req_size; /** Generic IEEE IEs passed from the application to be inserted into the * association request to firmware */ @@ -1294,7 +1314,7 @@ /** WPS */ wps_t wps; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** function table */ mlan_operations ops; @@ -1324,6 +1344,8 @@ #ifdef USB /** USB data port */ t_u32 port; + /** port Index */ + t_u32 port_index; #endif /** Control TX AMPDU on infra link */ t_u8 txaggrctrl; @@ -1340,6 +1362,12 @@ t_u32 amsdu_tx_cnt; /** tx msdu count in amsdu*/ t_u32 msdu_in_tx_amsdu_cnt; + /** channel load info for current channel */ + t_u16 ch_load_param; + /** Noise floor value for current channel */ + t_s16 noise; + /** rx quality info */ + t_u16 rx_quality; } mlan_private, *pmlan_private; typedef struct _assoc_logger { @@ -1524,15 +1552,15 @@ t_u8 support_rate[32]; /** rate size */ t_u8 rate_len; - /*Qos capability info */ + /*Qos capability info*/ t_u8 qos_info; /** HT info in TDLS setup confirm*/ IEEEtypes_HTInfo_t HTInfo; /** peer BSSCO_20_40*/ IEEEtypes_2040BSSCo_t BSSCO_20_40; - /*Extended capability */ + /*Extended capability*/ IEEEtypes_ExtCap_t ExtCap; - /*RSN IE */ + /*RSN IE*/ IEEEtypes_Generic_t rsn_ie; /**Link ID*/ IEEEtypes_LinkIDElement_t link_ie; @@ -1542,6 +1570,10 @@ IEEEtypes_VHTCap_t vht_cap; /** VHT Operations IE */ IEEEtypes_VHTOprat_t vht_oprat; + /** HE Capabilities IE */ + IEEEtypes_HECap_t tdls_he_cap; + /** HE Operations IE */ + IEEEtypes_HeOp_t he_op; /** wapi key on off flag */ t_u8 wapi_key_on; /** tx pause status */ @@ -1618,6 +1650,8 @@ t_bool dfs_radar_found; /** Channel radar is being checked on. BAND_A is assumed. */ t_u8 dfs_check_channel; + /** Channel radar is being checked on bandwidth*/ + t_u8 dfs_check_bandwidth; /** point to the priv which start the DFS check */ t_void *dfs_check_priv; /** Timestamp when we got last report, @@ -1712,8 +1746,8 @@ * @param pmbuf_aggr Pointer to aggregation buffer * @param pmbuf Pointer to buffer to copy */ -static inline t_void -wlan_link_buf_to_aggr(pmlan_buffer pmbuf_aggr, pmlan_buffer pmbuf) +static inline t_void wlan_link_buf_to_aggr(pmlan_buffer pmbuf_aggr, + pmlan_buffer pmbuf) { /* link new buf at end of list */ pmbuf->pnext = pmbuf_aggr; @@ -1786,7 +1820,7 @@ usb_aggr_ctrl_cfg aggr_ctrl; } usb_rx_deaggr_params; -#define MAX_USB_TX_PORT_NUM 1 +#define MAX_USB_TX_PORT_NUM 2 /** data structure for USB Tx Aggregation */ typedef struct _usb_tx_aggr_params { /** Tx aggregation control */ @@ -1828,7 +1862,7 @@ int num_wowlan_entry; /** Num for IPv6 neighbor solicitation message offload */ int num_ipv6_ns_offload; - + int clear_mef_entry; /** criteria*/ t_u32 criteria; /** MEF CFG Array to store etted_entry_bitmap; @@ -1889,17 +1923,22 @@ t_u32 dev_cap_mask; /** oob independent reset mode */ t_u32 indrstcfg; + /** drcs channel time mode */ + t_u32 drcs_chantime_mode; /** passive to active scan */ t_u8 passive_to_active_scan; /** uap max sta */ t_u8 uap_max_sta; /** dfs w53 cfg */ t_u8 dfs53cfg; + /** dfs_offload */ + t_u8 dfs_offload; #ifdef PCIE - /** adma ring size */ + /** adma ring size */ t_u16 ring_size; #endif t_u8 ext_scan; + t_u8 mcs32; } mlan_init_para, *pmlan_init_para; #ifdef SDIO @@ -1969,17 +2008,17 @@ typedef struct _mlan_sdio_card { const mlan_sdio_card_reg *reg; - /** maximum ports */ + /** maximum ports */ t_u8 max_ports; - /** mp aggregation packet limit */ + /** mp aggregation packet limit */ t_u8 mp_aggr_pkt_limit; - /** sdio new mode support */ + /** sdio new mode support */ t_bool supports_sdio_new_mode; - /** max tx aggr buf size */ + /** max tx aggr buf size */ t_u32 mp_tx_aggr_buf_size; - /** max rx aggr buf size */ + /** max rx aggr buf size */ t_u32 mp_rx_aggr_buf_size; - /** IO port */ + /** IO port */ t_u32 ioport; /** number of interrupt receive */ t_u32 num_of_irq; @@ -2065,14 +2104,14 @@ #endif #ifdef PCIE -#define MAX_TXRX_BD 32 -#define ADMA_MAX_TXRX_BD 512 -#define ADMA_DEF_TXRX_BD 128 +#define MAX_TXRX_BD 32 +#define ADMA_MAX_TXRX_BD 512 +#define ADMA_DEF_TXRX_BD 128 /** 128 entry will mapping to 7*/ #define TXRX_DEF_NUM_DESC 7 /** 8 entry will mapping to 3 */ #define EVT_NUM_DESC 3 -#define MLAN_MAX_TXRX_BD MAX(ADMA_MAX_TXRX_BD, MAX_TXRX_BD) +#define MLAN_MAX_TXRX_BD MAX(ADMA_MAX_TXRX_BD, MAX_TXRX_BD) /** 8 Event buffer ring */ #define MLAN_MAX_EVT_BD 0x08 typedef struct _mlan_pcie_card_reg { @@ -2169,7 +2208,7 @@ t_bool txbd_flush; /** txrx data dma ring size */ t_u16 txrx_bd_size; - /** txrx num desc */ + /** txrx num desc */ t_u16 txrx_num_desc; /** Shadow copy of RXBD write pointer */ @@ -2224,6 +2263,8 @@ /** USB sggregation supported by FW */ t_u8 fw_usb_aggr; + /** port status: MFALSE-port available MTRUE--port busy*/ + t_u8 usb_port_status[MAX_USB_TX_PORT_NUM]; } mlan_usb_card, *pmlan_usb_card; #endif @@ -2231,7 +2272,7 @@ typedef struct _mlan_card_info { /** Max Tx buffer size */ t_u32 max_tx_buf_size; - /** support V14_FW_API */ + /** support V14_FW_API */ t_u8 v14_fw_api; /** support V16_FW_API */ t_u8 v16_fw_api; @@ -2248,43 +2289,43 @@ /**Adapter_operations data structure*/ typedef struct _adapter_operations { /**firmware download handler*/ - mlan_status (*dnld_fw) (pmlan_adapter pmadapter, pmlan_fw_image pmfw); + mlan_status (*dnld_fw)(pmlan_adapter pmadapter, pmlan_fw_image pmfw); /**interrupt handler*/ - mlan_status (*interrupt) (t_u16 msg_id, pmlan_adapter pmadapter); + mlan_status (*interrupt)(t_u16 msg_id, pmlan_adapter pmadapter); /**INT process handler*/ - mlan_status (*process_int_status) (pmlan_adapter pmadapter); + mlan_status (*process_int_status)(pmlan_adapter pmadapter); /**host to card handler*/ - mlan_status (*host_to_card) (pmlan_private pmpriv, t_u8 type, - mlan_buffer *pmbuf, - mlan_tx_param *tx_param); - /*wakeup card */ - mlan_status (*wakeup_card) (pmlan_adapter pmadapter, t_u8 timeout); - /*reset the PM setting of card */ - mlan_status (*reset_card) (pmlan_adapter adapter); + mlan_status (*host_to_card)(pmlan_private pmpriv, t_u8 type, + mlan_buffer *pmbuf, + mlan_tx_param *tx_param); + /*wakeup card*/ + mlan_status (*wakeup_card)(pmlan_adapter pmadapter, t_u8 timeout); + /*reset the PM setting of card*/ + mlan_status (*reset_card)(pmlan_adapter adapter); /** Handle event/cmd complete*/ - mlan_status (*event_complete) (mlan_adapter *pmlan_adapter, - pmlan_buffer pmbuf, mlan_status status); - /** Handle complete receiving data */ - mlan_status (*data_complete) (mlan_adapter *pmlan_adapter, + mlan_status (*event_complete)(mlan_adapter *pmlan_adapter, pmlan_buffer pmbuf, mlan_status status); + /** Handle complete receiving data */ + mlan_status (*data_complete)(mlan_adapter *pmlan_adapter, + pmlan_buffer pmbuf, mlan_status status); /** Handle command response complete */ - mlan_status (*cmdrsp_complete) (mlan_adapter *pmlan_adapter, - pmlan_buffer pmbuf, mlan_status status); + mlan_status (*cmdrsp_complete)(mlan_adapter *pmlan_adapter, + pmlan_buffer pmbuf, mlan_status status); /** Handle rx packet */ - mlan_status (*handle_rx_packet) (mlan_adapter *pmadapter, - pmlan_buffer pmbuf); + mlan_status (*handle_rx_packet)(mlan_adapter *pmadapter, + pmlan_buffer pmbuf); /** handle dump interface specific info */ - mlan_status (*debug_dump) (mlan_adapter *pmadapter); + mlan_status (*debug_dump)(mlan_adapter *pmadapter); /** disable host interrupt */ - mlan_status (*disable_host_int) (mlan_adapter *pmadapter); + mlan_status (*disable_host_int)(mlan_adapter *pmadapter); /** enable host interrupt */ - mlan_status (*enable_host_int) (mlan_adapter *pmadapter); + mlan_status (*enable_host_int)(mlan_adapter *pmadapter); /**Interface header length*/ t_u32 intf_header_len; } mlan_adapter_operations; /** Adapter data structure for MLAN */ -typedef struct _mlan_adapter { +struct _mlan_adapter { /** MOAL handle structure */ t_void *pmoal_handle; /** BSS Attributes */ @@ -2365,7 +2406,9 @@ t_u32 fw_cap_info; /** Extended firmware capability information */ t_u32 fw_cap_ext; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) /** High byte for 5G, low byte for 2G, like 0x2211 0x22 for 5G, 0x11 for * 2G */ t_u16 user_htstream; @@ -2457,6 +2500,8 @@ mlan_list_head cmd_pending_q; /** Command queue for scanning */ mlan_list_head scan_pending_q; + /** Command pending queue while scanning */ + mlan_list_head ext_cmd_pending_q; /** ioctl pending queue */ mlan_list_head ioctl_pending_q; /** pending_ioctl flag */ @@ -2464,6 +2509,12 @@ pmlan_private pending_disconnect_priv; /** mlan_processing */ t_u32 scan_processing; + /** scan state */ + t_u32 scan_state; + /** firmware support for roaming*/ + t_u8 fw_roaming; + /** User set passphrase*/ + t_u8 userset_passphrase; /** ext_scan enh support flag */ t_u8 ext_scan_enh; /** scan type: 0 legacy, 1: enhance scan*/ @@ -2498,7 +2549,7 @@ region_chan_t universal_channel[MAX_REGION_CHANNEL_NUM]; /** Parsed region channel */ parsed_region_chan_11d_t parsed_region_chan; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** 11D and Domain Regulatory Data */ wlan_802_11d_domain_reg_t domain_reg; /** Country Code */ @@ -2515,6 +2566,8 @@ wlan_dfs_testing_settings_t dfs_test_params; /** dfs w53 cfg */ t_u8 dfs53cfg; + /** dfs_mode */ + t_u8 dfs_mode; /** FSM variable for MEAS support */ wlan_meas_state_t state_meas; /** Scan table */ @@ -2587,6 +2640,14 @@ /** Tx data endpoint address */ t_u8 tx_data_ep; #endif + /** Multi channel status */ + t_u8 mc_status; +#ifdef USB + /** port status: MFALSE-port available MTRUE--port busy*/ + t_u8 usb_port_status[MAX_USB_TX_PORT_NUM]; + /** usb tx ports */ + t_u8 usb_tx_ports[MAX_USB_TX_PORT_NUM]; +#endif /** sleep_params_t */ sleep_params_t sleep_params; @@ -2671,7 +2732,7 @@ #ifdef STA_SUPPORT /** Adhoc Secondary Channel Bandwidth */ t_u8 chan_bandwidth; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** 802.11ac device capabilities */ t_u32 hw_dot_11ac_dev_cap; @@ -2703,7 +2764,7 @@ t_u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; /** ARP filter buffer size */ t_u32 arp_filter_size; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Minimum delay between HsActive and HostWake (in msec) */ t_u16 min_wake_holdoff; /** Host sleep wake interval(in msec) */ @@ -2751,8 +2812,10 @@ /** Cal data length */ t_u32 cal_data_len; /** tdls status */ - /* TDLS_NOT_SETUP|TDLS_SWITCHING_CHANNEL|TDLS_IN_BASE_CHANNEL|TDLS_IN_SWITCH_CHANNEL */ + /* TDLS_NOT_SETUP|TDLS_SWITCHING_CHANNEL|TDLS_IN_BASE_CHANNEL|TDLS_IN_SWITCH_CHANNEL*/ tdlsStatus_e tdls_status; + /** NetMon enabled */ + t_u32 enable_net_mon; /** Feature control bitmask */ t_u32 feature_control; @@ -2760,10 +2823,12 @@ t_u8 coex_rx_winsize; t_bool dfs_repeater; t_u32 dfsr_channel; + t_bool mc_policy; t_u8 chanrpt_param_bandcfg; #if defined(PCIE) mlan_buffer *ssu_buf; #endif + t_u8 csi_enabled; /** maximum sta connection */ t_u8 max_sta_conn; otp_region_info_t *otp_region; @@ -2787,7 +2852,12 @@ t_u32 tp_state_on; /** Packet drop point */ t_u32 tp_state_drop_point; -} mlan_adapter, *pmlan_adapter; + /* lower 8 bytes of uuid */ + t_u64 uuid_lo; + + /* higher 8 bytes of uuid */ + t_u64 uuid_hi; +}; /** Check if stream 2X2 enabled */ #define IS_STREAM_2X2(x) ((x)&FEATURE_CTRL_STREAM_2X2) @@ -2806,6 +2876,31 @@ /** Ethernet packet type offset */ #define MLAN_ETHER_PKT_TYPE_OFFSET (12) +/** Rx packet Sniffer Operation Mode + * + * MODE1 : Can be enabled only in disconnected state. + * + * MODE3 : Can be enabled irrespective of active connection state. + * Both 802.11 and rtap headers are attached to all destined + * unicast data frames in the FW and uploaded to the host driver. + * Such frame will be duplicated in mlan, one for monitor interface + * and other for data interface, by reconstructing the 802.3 header. + */ +#define NET_MON_MODE_DISABLED 0 +#define NET_MON_MODE1 1 +#define NET_MON_MODE3 3 +mlan_status wlan_cmd_net_monitor(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); + +mlan_status wlan_ret_net_monitor(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); + +mlan_status wlan_misc_ioctl_net_monitor(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); + +void wlan_rxpdinfo_to_radiotapinfo(pmlan_private priv, RxPD *prx_pd, + radiotap_info *prt_info); + mlan_status wlan_init_lock_list(pmlan_adapter pmadapter); mlan_status wlan_init_priv_lock_list(pmlan_adapter pmadapter, t_u8 start_index); t_void wlan_free_lock_list(pmlan_adapter pmadapter); @@ -2845,9 +2940,9 @@ mlan_status wlan_process_event(pmlan_adapter pmadapter); /** Prepare command */ -mlan_status wlan_prepare_cmd(pmlan_private priv, t_u16 cmd_no, - t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, t_void *pdata_buf); +mlan_status wlan_prepare_cmd(pmlan_private priv, t_u16 cmd_no, t_u16 cmd_action, + t_u32 cmd_oid, t_void *pioctl_buf, + t_void *pdata_buf); /** cmd timeout handler */ t_void wlan_cmd_timeout_func(t_void *function_context); @@ -2858,8 +2953,7 @@ * @param pmadapter Pointer to mlan_adapter * @return MTRUE/MFALSE; */ -static inline t_u8 -wlan_is_tx_pending(mlan_adapter *pmadapter) +static inline t_u8 wlan_is_tx_pending(mlan_adapter *pmadapter) { #ifdef PCIE if (IS_PCIE(pmadapter->card_type) && @@ -2879,7 +2973,7 @@ mlan_status wlan_get_info_debug_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -#if defined(STA_SUPPORT) && defined(UAP_SUPPORT) +#if defined(STA_SUPPORT) || defined(UAP_SUPPORT) extern pmlan_operations mlan_ops[]; /** Set/Get BSS role */ mlan_status wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, @@ -2890,6 +2984,9 @@ mlan_status wlan_misc_ssu(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); #endif +mlan_status wlan_misc_csi(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +mlan_status wlan_process_csi_event(pmlan_private pmpriv); + mlan_status wlan_misc_hal_phy_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -2973,33 +3070,35 @@ * * @return N/A */ -static INLINE t_void -wlan_reset_usb_tx_aggr(pmlan_adapter pmadapter) +static INLINE t_void wlan_reset_usb_tx_aggr(pmlan_adapter pmadapter) { t_s32 i = 0; pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { - pcb->moal_spin_lock(pmadapter->pmoal_handle, - pmadapter->pcard_usb->usb_tx_aggr[i]. - paggr_lock); + pcb->moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->pcard_usb->usb_tx_aggr[i].paggr_lock); if (pmadapter->pcard_usb->usb_tx_aggr[i].aggr_hold_timer_is_set) { pcb->moal_stop_timer(pmadapter->pmoal_handle, - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .paggr_hold_timer); + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .paggr_hold_timer); pmadapter->pcard_usb->usb_tx_aggr[i] .aggr_hold_timer_is_set = MFALSE; } if (pmadapter->pcard_usb->usb_tx_aggr[i].aggr_ctrl.enable && pmadapter->pcard_usb->usb_tx_aggr[i].pmbuf_aggr != MNULL) { - wlan_write_data_complete(pmadapter, pmadapter->pcard_usb->usb_tx_aggr[i].pmbuf_aggr, MLAN_STATUS_FAILURE); /* did not get sent */ + wlan_write_data_complete( + pmadapter, + pmadapter->pcard_usb->usb_tx_aggr[i].pmbuf_aggr, + MLAN_STATUS_FAILURE); /* did not get sent */ pmadapter->pcard_usb->usb_tx_aggr[i].pmbuf_aggr = MNULL; pmadapter->pcard_usb->usb_tx_aggr[i].aggr_len = 0; } - pcb->moal_spin_unlock(pmadapter->pmoal_handle, - pmadapter->pcard_usb->usb_tx_aggr[i]. - paggr_lock); + pcb->moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->pcard_usb->usb_tx_aggr[i].paggr_lock); } LEAVE(); } @@ -3047,8 +3146,9 @@ /** Check if this is the last packet */ t_u8 wlan_check_last_packet_indication(pmlan_private priv); -#define MOAL_ALLOC_MLAN_BUFFER (0) -#define MOAL_MALLOC_BUFFER (1) +#define MOAL_ALLOC_MLAN_BUFFER MBIT(0) +#define MOAL_MALLOC_BUFFER MBIT(1) +#define MOAL_MEM_FLAG_ATOMIC MBIT(2) #ifdef PCIE /* This defines the direction arg to the DMA mapping routines. */ @@ -3077,21 +3177,20 @@ /** handle command for enhanced power save mode */ mlan_status wlan_cmd_enh_power_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 ps_bitmap, - t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_u16 ps_bitmap, t_void *pdata_buf); /** handle command resp for enhanced power save mode */ mlan_status wlan_ret_enh_power_mode(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); /** handle commnand for cfg data */ -mlan_status wlan_cmd_cfg_data(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, - t_u32 cmd_oid, t_void *pdata_buf); +mlan_status wlan_cmd_cfg_data(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pdata_buf); /** handle command resp for cfg data */ -mlan_status wlan_ret_cfg_data(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf); +mlan_status wlan_ret_cfg_data(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf); /** Process sleep confirm command response */ void wlan_process_sleep_confirm_resp(pmlan_adapter pmadapter, t_u8 *pbuf, @@ -3122,8 +3221,8 @@ pmlan_ioctl_req pioctl_req); mlan_status wlan_cmd_wifi_direct_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_ret_wifi_direct_mode(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); @@ -3137,8 +3236,7 @@ pmlan_ioctl_req pioctl_req); #endif mlan_status wlan_cmd_gpio_tsf_latch(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, mlan_ioctl_req *pioctl_buf, t_void *pdata_buf); mlan_status wlan_ret_gpio_tsf_latch(pmlan_private pmpriv, @@ -3198,12 +3296,10 @@ mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, +mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_ret_tx_rate_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_rate_ioctl_cfg(pmlan_adapter pmadapter, @@ -3224,9 +3320,8 @@ t_void wlan_host_sleep_wakeup_event(pmlan_private priv); /** Prepares command of robustcoex */ -mlan_status wlan_cmd_robustcoex(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_u16 *pdata_buf); +mlan_status wlan_cmd_robustcoex(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf); /** Set Robustcoex gpiocfg */ mlan_status wlan_misc_robustcoex(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -3235,12 +3330,10 @@ mlan_status wlan_misc_dmcs_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); /** Prepares command of DMCS config */ -mlan_status wlan_cmd_dmcs_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, +mlan_status wlan_cmd_dmcs_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); /** Handles command response of DMCS config */ -mlan_status wlan_ret_dmcs_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_dmcs_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #if defined(PCIE) @@ -3256,19 +3349,61 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -#ifdef RX_PACKET_COALESCE -mlan_status wlan_cmd_rx_pkt_coalesce_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_rx_pkt_coalesce_cfg(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf); +mlan_status wlan_handle_event_multi_chan_info(pmlan_private pmpriv, + pmlan_buffer pevent); +#ifdef USB + +/** + * @brief This function update the port status + * + * @param pmadapter A pointer to mlan_adapter + * @param port USB port + * @param status port status + * + * @return N/A + */ +static INLINE void wlan_update_port_status(pmlan_adapter pmadapter, t_u32 port, + t_u8 status) +{ + int i; + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { + if (port == pmadapter->usb_tx_ports[i]) { + pmadapter->pcard_usb->usb_port_status[i] = status; + break; + } + } + return; +} + +inline t_u8 wlan_usb_data_sent(pmlan_adapter pmadapter); +void wlan_resync_usb_port(pmlan_adapter pmadapter); + +/** + * @brief This function return port index + * + * @param pmadapter A pointer to mlan_adapter + * @param port USB port + * @return port index + * + */ +static INLINE t_u8 wlan_get_port_index(pmlan_adapter pmadapter, t_u32 port) +{ + t_u8 i; + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { + if (port == pmadapter->usb_tx_ports[i]) { + return i; + } + } + return 0; +} + #endif -#ifdef STA_SUPPORT /** warm reset */ mlan_status wlan_misc_ioctl_warm_reset(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); + +#ifdef STA_SUPPORT /** Process received packet */ mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf); /** ioctl handler for station mode */ @@ -3277,8 +3412,8 @@ /** cmd handler for station mode */ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, - t_void *pdata_buf, t_void *pcmd_buf); + t_void *pioctl_buf, t_void *pdata_buf, + t_void *pcmd_buf); /** cmdresp handler for station mode */ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, @@ -3304,18 +3439,18 @@ wlan_user_scan_cfg *puser_scan_in); /** Scan for specific SSID */ -mlan_status wlan_scan_specific_ssid(mlan_private *pmpriv, - t_void *pioctl_buf, +mlan_status wlan_scan_specific_ssid(mlan_private *pmpriv, t_void *pioctl_buf, mlan_802_11_ssid *preq_ssid); /** Scan command handler */ -mlan_status wlan_cmd_802_11_scan(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf); +mlan_status wlan_cmd_802_11_scan(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, + t_void *pdata_buf); /** Handler for scan command response */ -mlan_status wlan_ret_802_11_scan(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf); +mlan_status wlan_ret_802_11_scan(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf); +t_u8 wlan_get_ext_scan_state(HostCmd_DS_COMMAND *pcmd); /** Extended scan command handler */ mlan_status wlan_cmd_802_11_scan_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, @@ -3368,13 +3503,12 @@ t_void wlan_2040_coex_event(pmlan_private pmpriv); /** convert band to radio type */ -t_u8 wlan_band_to_radio_type(t_u8 band); +t_u8 wlan_band_to_radio_type(t_u16 band); /** convert radio_type to band */ -t_u8 radio_type_to_band(t_u8 chanBand); +t_u16 radio_type_to_band(t_u8 chanBand); /** Disconnect */ -mlan_status wlan_disconnect(mlan_private *pmpriv, - mlan_ioctl_req *pioctl_req, +mlan_status wlan_disconnect(mlan_private *pmpriv, mlan_ioctl_req *pioctl_req, mlan_deauth_param *deauth_param); /** Ad-Hoc start */ @@ -3416,20 +3550,20 @@ mlan_ioctl_req *pioctl_buf); /** Get Channel-Frequency-Power by band and channel */ -chan_freq_power_t *wlan_get_cfp_by_band_and_channel(pmlan_adapter pmadapter, - t_u8 band, t_u16 channel, - region_chan_t - *region_channel); +chan_freq_power_t * +wlan_get_cfp_by_band_and_channel(pmlan_adapter pmadapter, t_u16 band, + t_u16 channel, region_chan_t *region_channel); /** Find Channel-Frequency-Power by band and channel */ chan_freq_power_t *wlan_find_cfp_by_band_and_channel(mlan_adapter *pmadapter, - t_u8 band, t_u16 channel); + t_u16 band, t_u16 channel); /** Find Channel-Frequency-Power by band and frequency */ chan_freq_power_t *wlan_find_cfp_by_band_and_freq(mlan_adapter *pmadapter, - t_u8 band, t_u32 freq); + t_u16 band, t_u32 freq); /** Get Tx power of channel from Channel-Frequency-Power */ -t_u8 wlan_get_txpwr_of_chan_from_cfp(mlan_private *pmpriv, t_u8 channel); +t_u8 wlan_get_txpwr_of_chan_from_cfp(mlan_private *pmpriv, t_u16 band, + t_u8 channel); /** find frequency from band and channel */ -t_u32 wlan_find_freq_from_band_chan(t_u8, t_u8); +t_u32 wlan_find_freq_from_band_chan(t_u16 band, t_u8 chan); /* Save a beacon buffer of the current bss descriptor */ t_void wlan_save_curr_bcn(mlan_private *pmpriv); @@ -3456,15 +3590,13 @@ t_u8 wlan_is_rate_auto(mlan_private *pmpriv); /** Get rate index */ int wlan_get_rate_index(pmlan_adapter pmadapter, t_u16 *rateBitmap, int size); -mlan_status wlan_cmd_rxabortcfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); -mlan_status wlan_ret_rxabortcfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_cmd_rxabortcfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_rxabortcfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_cmd_rxabortcfg_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_ret_rxabortcfg_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); @@ -3481,32 +3613,31 @@ mlan_status wlan_ret_dot11mc_unassoc_ftm_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_hal_phy_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, +mlan_status wlan_cmd_hal_phy_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_u16 *pdata_buf); -mlan_status wlan_ret_hal_phy_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_hal_phy_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); - +mlan_status wlan_cmd_ips_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_ips_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); mlan_status wlan_cmd_rate_adapt_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_ret_rate_adapt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_cmd_cck_desense_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_ret_cck_desense_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_arb_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); -mlan_status wlan_ret_arb_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_cmd_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_misc_ioctl_rxabortcfg(pmlan_adapter pmadapter, @@ -3536,27 +3667,30 @@ /* CFP related functions */ /** Region code index table */ extern t_u16 region_code_index[MRVDRV_MAX_REGION_CODE]; -/** The table to keep CFP code for BG */ -extern t_u16 cfp_code_index_bg[MRVDRV_MAX_CFP_CODE_BG]; /** The table to keep CFP code for A */ extern t_u16 cfp_code_index_a[MRVDRV_MAX_CFP_CODE_A]; /** Set region table */ -mlan_status wlan_set_regiontable(mlan_private *pmpriv, t_u8 region, t_u8 band); +mlan_status wlan_set_regiontable(mlan_private *pmpriv, t_u8 region, t_u16 band); /** Get radar detection requirements*/ t_bool wlan_get_cfp_radar_detect(mlan_private *priv, t_u8 chnl); /** check if scan type is passive for b/g band*/ t_bool wlan_bg_scan_type_is_passive(mlan_private *priv, t_u8 chnl); /** check if channel is NO_IR (passive) */ -t_bool wlan_is_chan_passive(mlan_private *priv, t_u8 band, t_u8 chan); +t_bool wlan_is_chan_passive(mlan_private *priv, t_u16 band, t_u8 chan); /** check if channel is disabled */ -t_bool wlan_is_chan_disabled(mlan_private *priv, t_u8 band, t_u8 chan); +t_bool wlan_is_chan_disabled(mlan_private *priv, t_u16 band, t_u8 chan); /** check if channel is blacklisted */ -t_bool wlan_is_chan_blacklisted(mlan_private *priv, t_u8 band, t_u8 chan); +t_bool wlan_is_chan_blacklisted(mlan_private *priv, t_u16 band, t_u8 chan); /** set blacklist setting for a channel */ -t_bool wlan_set_chan_blacklist(mlan_private *priv, t_u8 band, t_u8 chan, +t_bool wlan_set_chan_blacklist(mlan_private *priv, t_u16 band, t_u8 chan, t_bool bl); +dfs_state_t wlan_get_chan_dfs_state(mlan_private *priv, t_u16 band, t_u8 chan); +t_void wlan_set_chan_dfs_state(mlan_private *priv, t_u16 band, t_u8 chan, + dfs_state_t dfs_state); +t_void wlan_reset_all_chan_dfs_state(mlan_private *priv, t_u16 band, + dfs_state_t dfs_state); /* 802.11D related functions */ /** Initialize 11D */ t_void wlan_11d_priv_init(mlan_private *pmpriv); @@ -3579,16 +3713,16 @@ mlan_status wlan_ret_802_11d_domain_info(mlan_private *pmpriv, HostCmd_DS_COMMAND *resp); /** Convert channel to frequency */ -t_u32 wlan_11d_chan_2_freq(pmlan_adapter pmadapter, t_u8 chan, t_u8 band); +t_u32 wlan_11d_chan_2_freq(pmlan_adapter pmadapter, t_u8 chan, t_u16 band); #ifdef STA_SUPPORT /** Set 11D universal table */ -mlan_status wlan_11d_set_universaltable(mlan_private *pmpriv, t_u8 band); +mlan_status wlan_11d_set_universaltable(mlan_private *pmpriv, t_u16 band); /** Clear 11D region table */ mlan_status wlan_11d_clear_parsedtable(mlan_private *pmpriv); /** Create 11D country information for downloading */ -mlan_status wlan_11d_create_dnld_countryinfo(mlan_private *pmpriv, t_u8 band); +mlan_status wlan_11d_create_dnld_countryinfo(mlan_private *pmpriv, t_u16 band); /** Get scan type from 11D info */ -t_u8 wlan_11d_get_scan_type(pmlan_adapter pmadapter, t_u8 band, t_u8 chan, +t_u8 wlan_11d_get_scan_type(pmlan_adapter pmadapter, t_u16 band, t_u8 chan, parsed_region_chan_11d_t *parsed_region_chan); /** Parse 11D country info */ mlan_status wlan_11d_parse_dnld_countryinfo(mlan_private *pmpriv, @@ -3596,15 +3730,13 @@ /** Prepare 11D domain information for download */ mlan_status wlan_11d_prepare_dnld_domain_info_cmd(mlan_private *pmpriv); /** Parse 11D country information into domain info */ -mlan_status wlan_11d_parse_domain_info(pmlan_adapter pmadapter, - IEEEtypes_CountryInfoFullSet_t - *country_info, t_u8 band, - parsed_region_chan_11d_t - *parsed_region_chan); +mlan_status wlan_11d_parse_domain_info( + pmlan_adapter pmadapter, IEEEtypes_CountryInfoFullSet_t *country_info, + t_u16 band, parsed_region_chan_11d_t *parsed_region_chan); #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT /** Handle 11D domain information from UAP */ -mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u8 band, +mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, t_u8 *domain_tlv, t_void *pioctl_buf); #endif @@ -3614,8 +3746,8 @@ /** This function converts region string to CFP table code */ mlan_status wlan_misc_country_2_cfp_table_code(pmlan_adapter pmadapter, - t_u8 *country_code, - t_u8 *cfp_bg, t_u8 *cfp_a); + t_u8 *country_code, t_u8 *cfp_bg, + t_u8 *cfp_a); /** This function finds if given country code is in EU table */ t_bool wlan_is_etsi_country(pmlan_adapter pmadapter, t_u8 *country_code); @@ -3638,6 +3770,15 @@ t_u8 *wlan_get_specific_ie(pmlan_private priv, t_u8 *ie_buf, t_u8 ie_len, IEEEtypes_ElementId_e id, t_u8 ext_id); t_u8 wlan_is_wmm_ie_present(pmlan_adapter pmadapter, t_u8 *pbuf, t_u16 buf_len); +/** Ethernet II header */ +typedef struct { + /** Ethernet II header destination address */ + t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; + /** Ethernet II header source address */ + t_u8 src_addr[MLAN_MAC_ADDR_LENGTH]; + /** Ethernet II header length */ + t_u16 ethertype; +} EthII_Hdr_t; /** * @brief This function checks whether a station TDLS link is enabled or not @@ -3647,8 +3788,8 @@ * @return * TDLS_NOT_SETUP/TDLS_SETUP_INPROGRESS/TDLS_SETUP_COMPLETE/TDLS_SETUP_FAILURE/TDLS_TEAR_DOWN */ -static INLINE tdlsStatus_e -wlan_get_tdls_link_status(mlan_private *priv, t_u8 *mac) +static INLINE tdlsStatus_e wlan_get_tdls_link_status(mlan_private *priv, + t_u8 *mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); @@ -3663,8 +3804,7 @@ * @param status tdls link status * @return MTRUE/MFALSE */ -static INLINE int -wlan_is_tdls_link_chan_switching(tdlsStatus_e status) +static INLINE int wlan_is_tdls_link_chan_switching(tdlsStatus_e status) { return (status == TDLS_SWITCHING_CHANNEL) ? MTRUE : MFALSE; } @@ -3675,8 +3815,7 @@ * @param status tdls link status * @return MTRUE/MFALSE */ -static INLINE int -wlan_is_send_cmd_allowed(tdlsStatus_e status) +static INLINE int wlan_is_send_cmd_allowed(tdlsStatus_e status) { int ret = MTRUE; switch (status) { @@ -3696,8 +3835,7 @@ * @param status tdls link status * @return MTRUE/MFALSE */ -static INLINE int -wlan_is_tdls_link_setup(tdlsStatus_e status) +static INLINE int wlan_is_tdls_link_setup(tdlsStatus_e status) { int ret = MFALSE; switch (status) { @@ -3721,8 +3859,7 @@ * * @return MTRUE or MFALSE */ -static INLINE int -wlan_is_tx_pause(mlan_private *priv, t_u8 *ra) +static INLINE int wlan_is_tx_pause(mlan_private *priv, t_u8 *ra) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ra); @@ -3730,9 +3867,29 @@ return sta_ptr->tx_pause; return MFALSE; } - t_u16 wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 *mac, t_u8 tx_pause); +#if defined(USB) +/** + * @brief This function used to check if specific port is ready + * + * @param pmadapter A pointer to mlan_adapter + * @param port_index port index; + * + * @return MTRUE -- port is ready. + * MFALSE -- port is busy. + */ +static inline t_u8 wlan_is_port_ready(pmlan_adapter pmadapter, t_u32 port_index) +{ + if (IS_USB(pmadapter->card_type)) + return (pmadapter->pcard_usb->usb_port_status[port_index]) ? + MFALSE : + MTRUE; + else + return MTRUE; +} +#endif + #ifdef UAP_SUPPORT mlan_status wlan_process_uap_rx_packet(mlan_private *priv, pmlan_buffer pmbuf); t_void wlan_drop_tx_pkts(pmlan_private priv); @@ -3749,8 +3906,8 @@ mlan_status wlan_cmd_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd); -mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf); +mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf); #ifdef SDIO mlan_status wlan_cmd_sdio_rx_aggr_cfg(HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, t_void *pdata_buf); @@ -3760,15 +3917,12 @@ mlan_status wlan_misc_ioctl_mac_control(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_mac_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, +mlan_status wlan_cmd_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_mac_control(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, +mlan_status wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); mlan_status wlan_ret_cw_mode_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, @@ -3791,8 +3945,7 @@ mlan_status wlan_ret_reg_access(mlan_adapter *pmadapter, t_u16 type, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_ret_mem_access(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_mem_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, @@ -3801,9 +3954,8 @@ pmlan_ioctl_req pioctl_req); mlan_status wlan_reg_mem_ioctl_mem_rw(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); +mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); mlan_status wlan_cmd_mem_access(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); mlan_status wlan_cmd_802_11_mac_address(pmlan_private pmpriv, @@ -3869,24 +4021,21 @@ #endif #ifdef STA_SUPPORT -void wlan_add_ext_capa_info_ie(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc, t_u8 **pptlv_out); +void wlan_add_ext_capa_info_ie(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **pptlv_out); #endif -mlan_status wlan_cmd_boot_sleep(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, - t_void *pdata_buf); +mlan_status wlan_cmd_boot_sleep(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_boot_sleep(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_boot_sleep(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) mlan_status wlan_cmd_crypto(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_u16 *pdata_buf); -mlan_status wlan_ret_crypto(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_crypto(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #endif @@ -3894,8 +4043,8 @@ #define BW_40MHZ 1 #define BW_80MHZ 2 #define BW_160MHZ 3 -int wlan_add_supported_oper_class_ie(mlan_private *pmpriv, - t_u8 **pptlv_out, t_u8 curr_oper_class); +int wlan_add_supported_oper_class_ie(mlan_private *pmpriv, t_u8 **pptlv_out, + t_u8 curr_oper_class); mlan_status wlan_get_curr_oper_class(mlan_private *pmpriv, t_u8 channel, t_u8 bw, t_u8 *oper_class); mlan_status wlan_check_operclass_validation(mlan_private *pmpriv, t_u8 channel, @@ -3921,8 +4070,8 @@ mlan_status wlan_misc_ioctl_aggr_ctrl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); mlan_status wlan_cmd_packet_aggr_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_ret_packet_aggr_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); @@ -3932,12 +4081,37 @@ mlan_status wlan_misc_ioctl_region(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -#ifdef RX_PACKET_COALESCE -mlan_status +mlan_status wlan_misc_ioctl_multi_chan_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); -wlan_misc_ioctl_rx_pkt_coalesce_config(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req); -#endif +mlan_status wlan_cmd_multi_chan_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); + +mlan_status wlan_ret_multi_chan_cfg(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); + +mlan_status wlan_misc_ioctl_multi_chan_policy(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); + +mlan_status wlan_cmd_multi_chan_policy(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); + +mlan_status wlan_ret_multi_chan_policy(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); + +mlan_status wlan_misc_ioctl_drcs_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); + +mlan_status wlan_cmd_drcs_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); + +mlan_status wlan_ret_drcs_cfg(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); void wlan_bt_coex_wlan_param_update_event(pmlan_private priv, pmlan_buffer pevent); @@ -3959,8 +4133,8 @@ mlan_status wlan_misc_ioctl_cwmode_ctrl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_set_mef_entry(mlan_private *pmpriv, - pmlan_adapter pmadapter, mef_cfg_data * pmef); +mlan_status wlan_set_mef_entry(mlan_private *pmpriv, pmlan_adapter pmadapter, + mef_cfg_data *pmef); mlan_status wlan_process_mef_cfg_cmd(mlan_private *pmpriv, pmlan_adapter pmadapter); mlan_status wlan_misc_ioctl_mef_flt_cfg(pmlan_adapter pmadapter, @@ -3968,10 +4142,9 @@ mlan_status wlan_misc_ioctl_ind_rst_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_cmd_ind_rst_cfg(HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_ind_rst_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_cmd_ind_rst_cfg(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); +mlan_status wlan_ret_ind_rst_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); mlan_status wlan_cmd_802_11_supplicant_pmk(pmlan_private pmpriv, @@ -3985,6 +4158,21 @@ mlan_status wlan_sec_ioctl_passphrase(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +mlan_status wlan_cmd_mc_aggr_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_mc_aggr_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); +mlan_status wlan_misc_ioctl_mc_aggr_cfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req); +mlan_status wlan_misc_ioctl_ch_load(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req); +mlan_status wlan_misc_ioctl_ch_load_results(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req); +mlan_status wlan_cmd_get_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_ret_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); + mlan_status wlan_misc_ioctl_get_tsf(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); void wlan_add_fw_cfp_tables(pmlan_private pmpriv, t_u8 *buf, t_u16 buf_left); @@ -4001,12 +4189,13 @@ mlan_status wlan_cmd_get_tsf(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action); -mlan_status wlan_ret_get_tsf(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_get_tsf(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); t_u8 wlan_ft_akm_is_used(mlan_private *pmpriv, t_u8 *rsn_ie); +mlan_status wlan_clear_fw_roaming_pmk(pmlan_private pmpriv); + mlan_status wlan_get_rgchnpwr_cfg(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req); mlan_status wlan_get_chan_trpc_cfg(pmlan_adapter pmadapter, @@ -4022,12 +4211,12 @@ HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); -t_u8 wlan_ieee_rateid_to_mrvl_rateid(mlan_private *priv, - t_u16 IeeeMacRate, t_u8 *dst_mac); +t_u8 wlan_ieee_rateid_to_mrvl_rateid(mlan_private *priv, t_u16 IeeeMacRate, + t_u8 *dst_mac); t_u8 wlan_mrvl_rateid_to_ieee_rateid(t_u8 rate); -t_u8 wlan_get_center_freq_idx(mlan_private *pmpriv, t_u16 band, - t_u32 pri_chan, t_u8 chan_bw); +t_u8 wlan_get_center_freq_idx(mlan_private *pmpriv, t_u16 band, t_u32 pri_chan, + t_u8 chan_bw); mlan_status wlan_ret_chan_region_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, @@ -4036,8 +4225,8 @@ mlan_status wlan_misc_ioctl_fw_dump_event(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req); mlan_status wlan_cmd_fw_dump_event(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_misc_bootsleep(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -4045,10 +4234,9 @@ mlan_status wlan_misc_ioctl_dyn_bw(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req); mlan_status wlan_cmd_config_dyn_bw(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_dyn_bw(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); +mlan_status wlan_ret_dyn_bw(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); #ifdef UAP_SUPPORT @@ -4067,13 +4255,23 @@ HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_range_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, +mlan_status wlan_cmd_range_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_range_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, +mlan_status wlan_ret_range_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); +mlan_status wlan_misc_ioctl_get_sensor_temp(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); +mlan_status wlan_cmd_get_sensor_temp(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action); +mlan_status wlan_ret_get_sensor_temp(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); + +/** Set/Get Country code */ +mlan_status wlan_misc_ioctl_country_code(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req); + /** * @brief RA based queueing * @@ -4081,8 +4279,7 @@ * * @return MTRUE or MFALSE */ -static INLINE t_u8 -queuing_ra_based(pmlan_private priv) +static INLINE t_u8 queuing_ra_based(pmlan_private priv) { /* * Currently we assume if we are in Infra, then DA=RA. This might not be @@ -4105,8 +4302,7 @@ * * @return Number of Rates copied */ -static INLINE t_u32 -wlan_copy_rates(t_u8 *dest, t_u32 pos, t_u8 *src, int len) +static INLINE t_u32 wlan_copy_rates(t_u8 *dest, t_u32 pos, t_u8 *src, int len) { int i; @@ -4126,12 +4322,12 @@ * * @return Length of string */ -static INLINE t_u32 -wlan_strlen(const char *str) +static INLINE t_u32 wlan_strlen(const char *str) { t_u32 i; - for (i = 0; str[i] != 0; i++) ; + for (i = 0; str[i] != 0; i++) + ; return i; } @@ -4143,11 +4339,10 @@ * * @return Non zero if chr is a hex, else 0 */ -static INLINE t_u32 -wlan_isxdigit(t_u8 chr) +static INLINE t_u32 wlan_isxdigit(t_u8 chr) { return (chr <= 'f' && chr >= 'a') || (chr <= 'F' && chr >= 'A') || - (chr <= '9' && chr >= '0'); + (chr <= '9' && chr >= '0'); } /** @@ -4157,8 +4352,7 @@ * * @return Non zero if chr is space etc, else 0 */ -static INLINE t_u32 -wlan_isspace(t_u8 chr) +static INLINE t_u32 wlan_isspace(t_u8 chr) { return chr <= ' ' && (chr == ' ' || (chr <= 13 && chr >= 9)); } @@ -4189,8 +4383,7 @@ * @return MTRUE -- cmd pending * MFALSE -- no pending cmd */ -static INLINE int -wlan_is_cmd_pending(mlan_adapter *pmadapter) +static INLINE int wlan_is_cmd_pending(mlan_adapter *pmadapter) { int ret; cmd_ctrl_node *pcmd_node = MNULL; @@ -4218,8 +4411,8 @@ * * @return Pointer to mlan_private */ -static INLINE mlan_private * -wlan_get_priv_by_id(mlan_adapter *pmadapter, t_u32 bss_num, t_u32 bss_type) +static INLINE mlan_private *wlan_get_priv_by_id(mlan_adapter *pmadapter, + t_u32 bss_num, t_u32 bss_type) { int i; @@ -4242,8 +4435,8 @@ * * @return Pointer to mlan_private */ -static INLINE mlan_private * -wlan_get_priv(mlan_adapter *pmadapter, mlan_bss_role bss_role) +static INLINE mlan_private *wlan_get_priv(mlan_adapter *pmadapter, + mlan_bss_role bss_role) { int i; @@ -4271,8 +4464,8 @@ */ static INLINE int wlan_count_priv_cond(mlan_adapter *pmadapter, - t_bool (*count_cond) (pmlan_private pmpriv), - t_bool (*check_cond) (pmlan_private pmpriv)) + t_bool (*count_cond)(pmlan_private pmpriv), + t_bool (*check_cond)(pmlan_private pmpriv)) { pmlan_private pmpriv; int count = 0; @@ -4308,8 +4501,8 @@ */ static INLINE int wlan_do_task_on_privs(mlan_adapter *pmadapter, - t_void (*operation) (pmlan_private pmpriv), - t_bool (*check_cond) (pmlan_private pmpriv)) + t_void (*operation)(pmlan_private pmpriv), + t_bool (*check_cond)(pmlan_private pmpriv)) { pmlan_private pmpriv; int count = 0; @@ -4350,7 +4543,7 @@ */ static INLINE int wlan_get_privs_by_cond(mlan_adapter *pmadapter, - t_bool (*check_cond) (pmlan_private pmpriv), + t_bool (*check_cond)(pmlan_private pmpriv), mlan_private **ppriv_list) { pmlan_private pmpriv; @@ -4393,8 +4586,8 @@ */ static INLINE int wlan_get_privs_by_two_cond(mlan_adapter *pmadapter, - t_bool (*check_cond) (pmlan_private pmpriv), - t_bool (*check_cond_2) (pmlan_private pmpriv), + t_bool (*check_cond)(pmlan_private pmpriv), + t_bool (*check_cond_2)(pmlan_private pmpriv), t_bool and_conditions, mlan_private **ppriv_list) { pmlan_private pmpriv;
diff --git a/wlan_sd8987/mlan/mlan_meas.c b/wlan_sd8987/mlan/mlan_meas.c index f6b7cbb..5ed4776 100755 --- a/wlan_sd8987/mlan/mlan_meas.c +++ b/wlan_sd8987/mlan/mlan_meas.c
@@ -12,7 +12,7 @@ * - ENABLE_MEAS * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -60,8 +60,7 @@ * * @return Constant string representing measurement type */ -static const char * -wlan_meas_get_meas_type_str(MeasType_t meas_type) +static const char *wlan_meas_get_meas_type_str(MeasType_t meas_type) { if (meas_type <= WLAN_MEAS_11H_MAX_TYPE) return meas_type_str[meas_type]; @@ -193,9 +192,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static int -wlan_meas_cmdresp_get_report(mlan_private *pmpriv, - const HostCmd_DS_COMMAND *resp) +static int wlan_meas_cmdresp_get_report(mlan_private *pmpriv, + const HostCmd_DS_COMMAND *resp) { mlan_adapter *pmadapter = pmpriv->adapter; const HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt = &resp->params.meas_rpt; @@ -248,9 +246,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static int -wlan_meas_cmd_request(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd_ptr, const void *pinfo_buf) +static int wlan_meas_cmd_request(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd_ptr, + const void *pinfo_buf) { const HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req = (HostCmd_DS_MEASUREMENT_REQUEST *)pinfo_buf; @@ -288,8 +286,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static int -wlan_meas_cmd_get_report(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd_ptr) +static int wlan_meas_cmd_get_report(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd_ptr) { ENTER(); @@ -343,12 +341,11 @@ * the timeout expires * - Error return from wlan_prepare_cmd routine otherwise */ -int -wlan_meas_util_send_req(mlan_private *pmpriv, - HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req, - t_u32 wait_for_resp_timeout, - pmlan_ioctl_req pioctl_req, - HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt) +int wlan_meas_util_send_req(mlan_private *pmpriv, + HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req, + t_u32 wait_for_resp_timeout, + pmlan_ioctl_req pioctl_req, + HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt) { static t_u8 auto_dialog_tok; wlan_meas_state_t *pmeas_state = &pmpriv->adapter->state_meas; @@ -359,7 +356,7 @@ /* If dialogTok was set to 0 or not provided, autoset */ pmeas_req->dialog_token = (pmeas_req->dialog_token ? pmeas_req->dialog_token : - ++auto_dialog_tok); + ++auto_dialog_tok); /* Check for rollover of the dialog token. Avoid using 0 as a token */ pmeas_req->dialog_token = @@ -404,9 +401,8 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE * */ -int -wlan_meas_cmd_process(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd_ptr, - const void *pinfo_buf) +int wlan_meas_cmd_process(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd_ptr, + const void *pinfo_buf) { int ret = MLAN_STATUS_SUCCESS; @@ -443,8 +439,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -int -wlan_meas_cmdresp_process(mlan_private *pmpriv, const HostCmd_DS_COMMAND *resp) +int wlan_meas_cmdresp_process(mlan_private *pmpriv, + const HostCmd_DS_COMMAND *resp) { int ret = MLAN_STATUS_SUCCESS;
diff --git a/wlan_sd8987/mlan/mlan_meas.h b/wlan_sd8987/mlan/mlan_meas.h index 079cf3b..2106391 100755 --- a/wlan_sd8987/mlan/mlan_meas.h +++ b/wlan_sd8987/mlan/mlan_meas.h
@@ -9,7 +9,7 @@ * @sa mlan_meas.c * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -37,13 +37,11 @@ #include "mlan_fw.h" /* Send a given measurement request to the firmware, report back the result */ -extern int - -wlan_meas_util_send_req(pmlan_private pmpriv, - pHostCmd_DS_MEASUREMENT_REQUEST pmeas_req, - t_u32 wait_for_resp_timeout, - pmlan_ioctl_req pioctl_req, - pHostCmd_DS_MEASUREMENT_REPORT pmeas_rpt); +extern int wlan_meas_util_send_req(pmlan_private pmpriv, + pHostCmd_DS_MEASUREMENT_REQUEST pmeas_req, + t_u32 wait_for_resp_timeout, + pmlan_ioctl_req pioctl_req, + pHostCmd_DS_MEASUREMENT_REPORT pmeas_rpt); /* Setup a measurement command before it is sent to the firmware */ extern int wlan_meas_cmd_process(mlan_private *pmpriv,
diff --git a/wlan_sd8987/mlan/mlan_misc.c b/wlan_sd8987/mlan/mlan_misc.c index b377ce0..3ffa5bb 100755 --- a/wlan_sd8987/mlan/mlan_misc.c +++ b/wlan_sd8987/mlan/mlan_misc.c
@@ -4,7 +4,7 @@ * @brief This file include miscellaneous functions for MLAN module * * - * Copyright 2009-2021 NXP + * Copyright 2009-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -61,8 +61,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_pending_interrupt(pmlan_adapter pmadapter) +static t_u8 wlan_pending_interrupt(pmlan_adapter pmadapter) { if (!IS_USB(pmadapter->card_type) && pmadapter->ireg) return MTRUE; @@ -87,8 +86,8 @@ * * @return MLAN_STATUS_SUCCESS --unused, otherwise used. */ -static mlan_status -wlan_is_custom_ie_index_unused(pmlan_private pmpriv, t_u16 idx) +static mlan_status wlan_is_custom_ie_index_unused(pmlan_private pmpriv, + t_u16 idx) { t_u8 i = 0; pmlan_adapter pmadapter = pmpriv->adapter; @@ -122,10 +121,10 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_custom_ioctl_get_autoidx(pmlan_private pmpriv, - pmlan_ioctl_req pioctl_req, - t_u16 mask, custom_ie *ie_data, t_u16 *idx) +static mlan_status wlan_custom_ioctl_get_autoidx(pmlan_private pmpriv, + pmlan_ioctl_req pioctl_req, + t_u16 mask, custom_ie *ie_data, + t_u16 *idx) { t_u16 index = 0, insert = MFALSE; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -145,10 +144,10 @@ if (pmpriv->mgmt_ie[index].ie_length) { if (!memcmp(pmpriv->adapter, pmpriv->mgmt_ie[index] - .ie_buffer, + .ie_buffer, ie_data->ie_buffer, pmpriv->mgmt_ie[index] - .ie_length)) { + .ie_length)) { PRINTM(MINFO, "IE with the same mask exists at index %d mask=0x%x\n", index, mask); @@ -158,7 +157,8 @@ } /* Check if enough space is available */ if (pmpriv->mgmt_ie[index].ie_length + - ie_data->ie_length > MAX_IE_SIZE) { + ie_data->ie_length > + MAX_IE_SIZE) { index++; continue; } @@ -170,7 +170,8 @@ if (!insert) { for (index = 0; index < MIN(pmpriv->adapter->max_mgmt_ie_index, - MAX_MGMT_IE_INDEX); index++) { + MAX_MGMT_IE_INDEX); + index++) { if (pmpriv->mgmt_ie[index].ie_length == 0) { /* * Check if this index is in use @@ -178,8 +179,8 @@ * move ahead to next index */ if (MLAN_STATUS_SUCCESS == - wlan_is_custom_ie_index_unused - (pmpriv, index)) { + wlan_is_custom_ie_index_unused( + pmpriv, index)) { insert = MTRUE; break; } else { @@ -216,15 +217,14 @@ * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_custom_ioctl_auto_delete(pmlan_private pmpriv, - pmlan_ioctl_req pioctl_req, - custom_ie *ie_data, t_u16 idx) +static mlan_status wlan_custom_ioctl_auto_delete(pmlan_private pmpriv, + pmlan_ioctl_req pioctl_req, + custom_ie *ie_data, t_u16 idx) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = pmpriv->adapter; t_u16 index = 0, insert = MFALSE, del_len; - t_u8 del_ie[MAX_IE_SIZE], ie[MAX_IE_SIZE]; + t_u8 del_ie[MAX_IE_SIZE], ie[MAX_IE_SIZE] = {0}; t_s32 cnt, tmp_len = 0; t_u8 *tmp_ie; @@ -253,24 +253,24 @@ cnt, MAX_IE_SIZE); if (pmpriv->mgmt_ie[index].ie_length > (cnt + del_len)) - memcpy_ext(pmpriv->adapter, &ie[cnt], - &pmpriv->mgmt_ie[index]. - ie_buffer[MIN - ((MAX_IE_SIZE - 1), + memcpy_ext( + pmpriv->adapter, &ie[cnt], + &pmpriv->mgmt_ie[index].ie_buffer + [MIN((MAX_IE_SIZE - 1), (cnt + del_len))], - (pmpriv->mgmt_ie[index] - .ie_length - (cnt + - del_len)), - MAX_IE_SIZE - cnt); + (pmpriv->mgmt_ie[index] + .ie_length - + (cnt + del_len)), + MAX_IE_SIZE - cnt); memset(pmpriv->adapter, &pmpriv->mgmt_ie[index].ie_buffer, 0, - sizeof(pmpriv->mgmt_ie[index]. - ie_buffer)); + sizeof(pmpriv->mgmt_ie[index].ie_buffer)); memcpy_ext(pmpriv->adapter, &pmpriv->mgmt_ie[index].ie_buffer, ie, pmpriv->mgmt_ie[index].ie_length - - del_len, MAX_IE_SIZE); + del_len, + MAX_IE_SIZE); pmpriv->mgmt_ie[index].ie_length -= del_len; if (MLAN_CUSTOM_IE_AUTO_IDX_MASK == idx) /* set a bit to indicate caller about @@ -312,8 +312,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_host_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_host_cmd(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -341,9 +341,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_init_shutdown(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_init_shutdown(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -384,8 +383,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -mlan_status -wlan_get_info_debug_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_info_debug_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -402,16 +401,16 @@ if (pioctl_req->action == MLAN_ACT_GET) { ptid = ac_to_tid[WMM_AC_BK]; debug_info->wmm_ac_bk = pmpriv->wmm.packets_out[ptid[0]] + - pmpriv->wmm.packets_out[ptid[1]]; + pmpriv->wmm.packets_out[ptid[1]]; ptid = ac_to_tid[WMM_AC_BE]; debug_info->wmm_ac_be = pmpriv->wmm.packets_out[ptid[0]] + - pmpriv->wmm.packets_out[ptid[1]]; + pmpriv->wmm.packets_out[ptid[1]]; ptid = ac_to_tid[WMM_AC_VI]; debug_info->wmm_ac_vi = pmpriv->wmm.packets_out[ptid[0]] + - pmpriv->wmm.packets_out[ptid[1]]; + pmpriv->wmm.packets_out[ptid[1]]; ptid = ac_to_tid[WMM_AC_VO]; debug_info->wmm_ac_vo = pmpriv->wmm.packets_out[ptid[0]] + - pmpriv->wmm.packets_out[ptid[1]]; + pmpriv->wmm.packets_out[ptid[1]]; debug_info->max_tx_buf_size = (t_u32)pmadapter->max_tx_buf_size; debug_info->tx_buf_size = (t_u32)pmadapter->tx_buf_size; debug_info->curr_tx_buf_size = @@ -442,6 +441,7 @@ debug_info->port_open = pmpriv->port_open; debug_info->bypass_pkt_count = pmadapter->bypass_pkt_count; debug_info->scan_processing = pmadapter->scan_processing; + debug_info->scan_state = pmadapter->scan_state; debug_info->mlan_processing = pmadapter->mlan_processing; debug_info->main_lock_flag = pmadapter->main_lock_flag; debug_info->main_process_cnt = pmadapter->main_process_cnt; @@ -492,8 +492,9 @@ debug_info->num_no_cmd_node = pmadapter->dbg.num_no_cmd_node; debug_info->pending_cmd = (pmadapter->curr_cmd) ? - pmadapter->dbg.last_cmd_id - [pmadapter->dbg.last_cmd_index] : 0; + pmadapter->dbg.last_cmd_id + [pmadapter->dbg.last_cmd_index] : + 0; debug_info->dnld_cmd_in_secs = pmadapter->dnld_cmd_in_secs; #ifdef SDIO if (IS_SD(pmadapter->card_type)) { @@ -537,16 +538,16 @@ pmadapter->pcard_sd->mp_data_port_mask; debug_info->last_mp_index = pmadapter->pcard_sd->last_mp_index; - memcpy_ext(pmadapter, debug_info->last_mp_wr_bitmap, - pmadapter->pcard_sd->last_mp_wr_bitmap, - sizeof(pmadapter->pcard_sd-> - last_mp_wr_bitmap), - sizeof(debug_info->last_mp_wr_bitmap)); - memcpy_ext(pmadapter, debug_info->last_mp_wr_ports, - pmadapter->pcard_sd->last_mp_wr_ports, - sizeof(pmadapter->pcard_sd-> - last_mp_wr_ports), - sizeof(debug_info->last_mp_wr_ports)); + memcpy_ext( + pmadapter, debug_info->last_mp_wr_bitmap, + pmadapter->pcard_sd->last_mp_wr_bitmap, + sizeof(pmadapter->pcard_sd->last_mp_wr_bitmap), + sizeof(debug_info->last_mp_wr_bitmap)); + memcpy_ext( + pmadapter, debug_info->last_mp_wr_ports, + pmadapter->pcard_sd->last_mp_wr_ports, + sizeof(pmadapter->pcard_sd->last_mp_wr_ports), + sizeof(debug_info->last_mp_wr_ports)); memcpy_ext(pmadapter, debug_info->last_mp_wr_len, pmadapter->pcard_sd->last_mp_wr_len, sizeof(pmadapter->pcard_sd->last_mp_wr_len), @@ -555,11 +556,11 @@ pmadapter->pcard_sd->last_mp_wr_info, sizeof(pmadapter->pcard_sd->last_mp_wr_info), sizeof(debug_info->last_mp_wr_info)); - memcpy_ext(pmadapter, debug_info->last_curr_wr_port, - pmadapter->pcard_sd->last_curr_wr_port, - sizeof(pmadapter->pcard_sd-> - last_curr_wr_port), - sizeof(debug_info->last_curr_wr_port)); + memcpy_ext( + pmadapter, debug_info->last_curr_wr_port, + pmadapter->pcard_sd->last_curr_wr_port, + sizeof(pmadapter->pcard_sd->last_curr_wr_port), + sizeof(debug_info->last_curr_wr_port)); debug_info->mpa_buf = pmadapter->pcard_sd->mpa_buf; debug_info->mpa_buf_size = pmadapter->pcard_sd->mpa_buf_size; @@ -647,8 +648,8 @@ * * @return MLAN_STATUS_PENDING -- success, otherwise fail */ -mlan_status -wlan_misc_ioctl_mac_control(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_mac_control(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -684,8 +685,7 @@ * @param function_context A pointer to function_context * @return N/A */ -t_void -wlan_wakeup_card_timeout_func(void *function_context) +t_void wlan_wakeup_card_timeout_func(void *function_context) { pmlan_adapter pmadapter = (pmlan_adapter)function_context; mlan_private *pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); @@ -713,8 +713,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_pm_ioctl_hscfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_pm_ioctl_hscfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_pm_cfg *pm = MNULL; @@ -756,12 +756,10 @@ status = MLAN_STATUS_FAILURE; break; } - status = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_HS_CFG_ENH, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - (t_void *)(&pmadapter-> - hs_cfg)); + status = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_802_11_HS_CFG_ENH, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + (t_void *)(&pmadapter->hs_cfg)); if (status == MLAN_STATUS_SUCCESS) status = MLAN_STATUS_PENDING; if (pm->param.hs_cfg.conditions == @@ -788,6 +786,8 @@ pmadapter->gpio_wave = pm->param.hs_cfg.gpio_wave; pmadapter->hs_wake_interval = pm->param.hs_cfg.hs_wake_interval; + pmadapter->min_wake_holdoff = + pm->param.hs_cfg.min_wake_holdoff; } break; case MLAN_ACT_GET: @@ -805,6 +805,7 @@ pm->param.hs_cfg.ext_gap = pmadapter->ext_gap; pm->param.hs_cfg.gpio_wave = pmadapter->gpio_wave; pm->param.hs_cfg.hs_wake_interval = pmadapter->hs_wake_interval; + pm->param.hs_cfg.min_wake_holdoff = pmadapter->min_wake_holdoff; break; default: pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; @@ -825,8 +826,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_misc_robustcoex(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_robustcoex(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -859,8 +860,8 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_dmcs_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_dmcs_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -894,8 +895,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_misc_ssu(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ssu(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -931,8 +931,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_misc_hal_phy_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_hal_phy_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -954,6 +954,54 @@ } /** + * @brief Enable/disable CSI support + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, + * otherwise fail + */ +mlan_status wlan_misc_csi(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *csi_cfg = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + t_u16 cmd_act; + + ENTER(); + + if (csi_cfg->param.csi_params.csi_enable == 1) { + if (pmadapter->csi_enabled) { + PRINTM(MERROR, + "Enable CSI: CSI was already enabled.\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + cmd_act = CSI_CMD_ENABLE; + } else { + if (!pmadapter->csi_enabled) { + PRINTM(MERROR, + "Disable CSI: CSI was already disabled.\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + cmd_act = CSI_CMD_DISABLE; + } + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_CSI, cmd_act, 0, + (t_void *)pioctl_req, + &csi_cfg->param.csi_params); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + +done: + LEAVE(); + return ret; +} + +/** * @brief This function allocates a mlan_buffer. * * @param pmadapter Pointer to mlan_adapter @@ -962,15 +1010,15 @@ * @param malloc_flag flag to user moal_malloc * @return mlan_buffer pointer or MNULL */ -pmlan_buffer -wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, - t_u32 head_room, t_u32 malloc_flag) +pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, + t_u32 head_room, t_u32 malloc_flag) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_buffer pmbuf = MNULL; t_u32 buf_size = 0; t_u8 *tmp_buf = MNULL; pmlan_callbacks pcb = &pmadapter->callbacks; + t_u32 mem_flags = MLAN_MEM_DEF | MLAN_MEM_DMA; ENTER(); @@ -978,17 +1026,16 @@ /* make sure that the data length is at least SDIO block size */ if (IS_SD(pmadapter->card_type)) data_len = (data_len + MLAN_SDIO_BLOCK_SIZE - 1) / - MLAN_SDIO_BLOCK_SIZE * MLAN_SDIO_BLOCK_SIZE; + MLAN_SDIO_BLOCK_SIZE * MLAN_SDIO_BLOCK_SIZE; #endif /* head_room is not implemented for malloc mlan buffer */ - - switch (malloc_flag) { - case MOAL_MALLOC_BUFFER: + if (malloc_flag & MOAL_MALLOC_BUFFER) { buf_size = sizeof(mlan_buffer) + data_len + DMA_ALIGNMENT; + if (malloc_flag & MOAL_MEM_FLAG_ATOMIC) + mem_flags |= MLAN_MEM_FLAG_ATOMIC; ret = pcb->moal_malloc(pmadapter->pmoal_handle, buf_size, - MLAN_MEM_DEF | MLAN_MEM_DMA, - (t_u8 **)&pmbuf); + mem_flags, (t_u8 **)&pmbuf); if ((ret != MLAN_STATUS_SUCCESS) || !pmbuf) { pmbuf = MNULL; goto exit; @@ -997,19 +1044,16 @@ pmbuf->pdesc = MNULL; /* Align address */ - pmbuf->pbuf = (t_u8 *)ALIGN_ADDR((t_u8 *)pmbuf + - sizeof(mlan_buffer), - DMA_ALIGNMENT); + pmbuf->pbuf = (t_u8 *)ALIGN_ADDR( + (t_u8 *)pmbuf + sizeof(mlan_buffer), DMA_ALIGNMENT); pmbuf->data_offset = 0; pmbuf->data_len = data_len; pmbuf->flags |= MLAN_BUF_FLAG_MALLOC_BUF; - break; - - case MOAL_ALLOC_MLAN_BUFFER: + } else if (malloc_flag & MOAL_ALLOC_MLAN_BUFFER) { /* use moal_alloc_mlan_buffer, head_room supported */ - ret = pcb->moal_alloc_mlan_buffer(pmadapter->pmoal_handle, - data_len + DMA_ALIGNMENT + - head_room, &pmbuf); + ret = pcb->moal_alloc_mlan_buffer( + pmadapter->pmoal_handle, + data_len + DMA_ALIGNMENT + head_room, &pmbuf); if ((ret != MLAN_STATUS_SUCCESS) || !pmbuf) { PRINTM(MERROR, "Failed to allocate 'mlan_buffer'\n"); goto exit; @@ -1021,7 +1065,6 @@ (t_u32)(tmp_buf - (pmbuf->pbuf + pmbuf->data_offset)); pmbuf->data_len = data_len; pmbuf->flags = 0; - break; } exit: @@ -1037,20 +1080,18 @@ * * @return N/A */ -t_void -wlan_free_mlan_buffer(mlan_adapter *pmadapter, pmlan_buffer pmbuf) +t_void wlan_free_mlan_buffer(mlan_adapter *pmadapter, pmlan_buffer pmbuf) { pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); if (pcb && pmbuf) { if (pmbuf->flags & MLAN_BUF_FLAG_BRIDGE_BUF) - util_scalar_decrement(pmadapter->pmoal_handle, - &pmadapter->pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_decrement( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); if (pmbuf->flags & MLAN_BUF_FLAG_MALLOC_BUF) pcb->moal_mfree(pmadapter->pmoal_handle, (t_u8 *)pmbuf); else @@ -1071,8 +1112,7 @@ * * @return N/A */ -t_void -wlan_delay_func(mlan_adapter *pmadapter, t_u32 delay, t_delay_unit u) +t_void wlan_delay_func(mlan_adapter *pmadapter, t_u32 delay, t_delay_unit u) { t_u32 now_tv_sec, now_tv_usec; t_u32 upto_tv_sec, upto_tv_usec; @@ -1096,7 +1136,9 @@ break; case MSEC: delay *= 1000; - /* fall through */ + upto_tv_sec += (delay / 1000000); + upto_tv_usec += (delay % 1000000); + break; case USEC: upto_tv_sec += (delay / 1000000); upto_tv_usec += (delay % 1000000); @@ -1131,8 +1173,8 @@ * * @return MLAN_STATUS_PENDING --success, MLAN_STATUS_FAILURE */ -mlan_status -wlan_bss_ioctl_bss_remove(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_bss_ioctl_bss_remove(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { ENTER(); wlan_cancel_bss_pending_cmd(pmadapter, pioctl_req->bss_index); @@ -1149,8 +1191,8 @@ * * @return MLAN_STATUS_PENDING --success, MLAN_STATUS_FAILURE */ -mlan_status -wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1182,16 +1224,11 @@ #ifdef USB if (IS_USB(pmadapter->card_type)) { - while ((pmbuf = - (pmlan_buffer)util_dequeue_list(pmadapter-> - pmoal_handle, - &pmadapter-> - rx_data_queue, - pcb-> - moal_spin_lock, - pcb-> - moal_spin_unlock))) - { + while ((pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, + &pmadapter->rx_data_queue, + pcb->moal_spin_lock, + pcb->moal_spin_unlock))) { pcb->moal_recv_complete(pmadapter->pmoal_handle, pmbuf, pmadapter->rx_data_ep, @@ -1206,6 +1243,10 @@ pmpriv->bss_type = MLAN_BSS_TYPE_UAP; /* Initialize private structures */ wlan_init_priv(pmpriv); + /* restore mac address */ + memcpy_ext(pmpriv->adapter, pmpriv->curr_addr, + pmpriv->adapter->permanent_addr, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); mlan_block_rx_process(pmadapter, MFALSE); /* Initialize function table */ for (j = 0; mlan_ops[j]; j++) { @@ -1219,23 +1260,24 @@ for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i] && GET_BSS_ROLE(pmadapter->priv[i]) == - MLAN_BSS_ROLE_STA) + MLAN_BSS_ROLE_STA) global_band |= pmadapter->priv[i]->config_bands; } if (global_band != pmadapter->config_bands) { - if (wlan_set_regiontable - (pmpriv, (t_u8)pmadapter->region_code, - global_band | pmadapter->adhoc_start_band)) { + if (wlan_set_regiontable( + pmpriv, (t_u8)pmadapter->region_code, + global_band | + pmadapter->adhoc_start_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; } - if (wlan_11d_set_universaltable(pmpriv, - global_band | - pmadapter-> - adhoc_start_band)) { + if (wlan_11d_set_universaltable( + pmpriv, + global_band | + pmadapter->adhoc_start_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; @@ -1284,9 +1326,9 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_custom_ie_list(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req, t_bool send_ioctl) +mlan_status wlan_misc_ioctl_custom_ie_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req, + t_bool send_ioctl) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1328,9 +1370,9 @@ if (MLAN_CUSTOM_IE_AUTO_IDX_MASK == index) { /* Automatic Deletion */ if (mask == MLAN_CUSTOM_IE_DELETE_MASK) { - ret = wlan_custom_ioctl_auto_delete - (pmpriv, pioctl_req, ie_data, - index); + ret = wlan_custom_ioctl_auto_delete( + pmpriv, pioctl_req, ie_data, + index); /* if IE to delete is not found, return * error */ if (ret == MLAN_STATUS_FAILURE) @@ -1338,7 +1380,7 @@ index = ie_data->ie_index; memset(pmadapter, ie_data, 0, sizeof(custom_ie) * - MAX_MGMT_IE_INDEX_TO_FW); + MAX_MGMT_IE_INDEX_TO_FW); len = 0; for (i = 0; i < pmadapter->max_mgmt_ie_index; @@ -1346,88 +1388,60 @@ /* Check if index is updated * before sending to FW */ if (index & ((t_u16)1) << i) { - memcpy_ext(pmadapter, - (t_u8 *) - ie_data + - len, &i, - sizeof - (ie_data-> - ie_index), - sizeof - (ie_data-> - ie_index)); - len += sizeof(ie_data-> - ie_index); - memcpy_ext(pmadapter, - (t_u8 *) - ie_data + - len, - &pmpriv-> - mgmt_ie[i] - . - mgmt_subtype_mask, - sizeof - (ie_data-> - mgmt_subtype_mask), - sizeof - (ie_data-> - mgmt_subtype_mask)); - len += sizeof(ie_data-> - mgmt_subtype_mask); - memcpy_ext(pmadapter, - (t_u8 *) - ie_data + - len, - &pmpriv-> - mgmt_ie[i] - .ie_length, - sizeof - (ie_data-> - ie_length), - sizeof - (ie_data-> - ie_length)); - len += sizeof(ie_data-> - ie_length); + memcpy_ext( + pmadapter, + (t_u8 *)ie_data + + len, + &i, + sizeof(ie_data->ie_index), + sizeof(ie_data->ie_index)); + len += sizeof( + ie_data->ie_index); + memcpy_ext( + pmadapter, + (t_u8 *)ie_data + + len, + &pmpriv->mgmt_ie[i] + .mgmt_subtype_mask, + sizeof(ie_data->mgmt_subtype_mask), + sizeof(ie_data->mgmt_subtype_mask)); + len += sizeof( + ie_data->mgmt_subtype_mask); + memcpy_ext( + pmadapter, + (t_u8 *)ie_data + + len, + &pmpriv->mgmt_ie[i] + .ie_length, + sizeof(ie_data->ie_length), + sizeof(ie_data->ie_length)); + len += sizeof( + ie_data->ie_length); if (pmpriv->mgmt_ie[i] - .ie_length) { - memcpy_ext - (pmadapter, - (t_u8 - *) - ie_data - + len, - &pmpriv-> - mgmt_ie - [i] - . - ie_buffer, - pmpriv-> - mgmt_ie - [i] - . - ie_length, - pmpriv-> - mgmt_ie - [i] - . - ie_length); - len += pmpriv-> - mgmt_ie - [i] - . - ie_length; + .ie_length) { + memcpy_ext( + pmadapter, + (t_u8 *)ie_data + + len, + &pmpriv->mgmt_ie[i] + .ie_buffer, + pmpriv->mgmt_ie[i] + .ie_length, + pmpriv->mgmt_ie[i] + .ie_length); + len += pmpriv->mgmt_ie[i] + .ie_length; } } } misc->param.cust_ie.len += len; pioctl_req->action = MLAN_ACT_SET; cmd_action = HostCmd_ACT_GEN_SET; - } else { /* Automatic Addition */ + } else { /* Automatic Addition */ if (MLAN_STATUS_FAILURE == - wlan_custom_ioctl_get_autoidx - (pmpriv, pioctl_req, mask, ie_data, - &index)) { + wlan_custom_ioctl_get_autoidx( + pmpriv, pioctl_req, mask, + ie_data, &index)) { PRINTM(MERROR, "Failed to Set the IE buffer\n"); ret = MLAN_STATUS_FAILURE; @@ -1435,20 +1449,20 @@ } mask &= ~MLAN_CUSTOM_IE_NEW_MASK; if (MLAN_CUSTOM_IE_AUTO_IDX_MASK == - index || + index || index >= MAX_MGMT_IE_INDEX) { ret = MLAN_STATUS_SUCCESS; goto done; } tmp_ie = (t_u8 *)&pmpriv->mgmt_ie[index] - .ie_buffer; - memcpy_ext(pmadapter, - tmp_ie + - pmpriv->mgmt_ie[index] - .ie_length, - &ie_data->ie_buffer, - ie_data->ie_length, - ie_data->ie_length); + .ie_buffer; + memcpy_ext( + pmadapter, + tmp_ie + pmpriv->mgmt_ie[index] + .ie_length, + &ie_data->ie_buffer, + ie_data->ie_length, + ie_data->ie_length); pmpriv->mgmt_ie[index].ie_length += ie_data->ie_length; pmpriv->mgmt_ie[index].ie_index = index; @@ -1459,17 +1473,16 @@ cmd_action = HostCmd_ACT_GEN_SET; ie_data->ie_index = index; ie_data->ie_length = - pmpriv->mgmt_ie[index]. - ie_length; - memcpy_ext(pmadapter, - &ie_data->ie_buffer, - &pmpriv->mgmt_ie[index] - .ie_buffer, - pmpriv->mgmt_ie[index]. - ie_length, MAX_IE_SIZE); + pmpriv->mgmt_ie[index].ie_length; + memcpy_ext( + pmadapter, &ie_data->ie_buffer, + &pmpriv->mgmt_ie[index] + .ie_buffer, + pmpriv->mgmt_ie[index].ie_length, + MAX_IE_SIZE); misc->param.cust_ie.len += pmpriv->mgmt_ie[index] - .ie_length + + .ie_length + MLAN_CUSTOM_IE_HDR_SIZE; } } else { @@ -1483,35 +1496,34 @@ } /* Set/Clear the IE and save it */ if (ie_data->mgmt_subtype_mask == - MLAN_CUSTOM_IE_DELETE_MASK && + MLAN_CUSTOM_IE_DELETE_MASK && ie_data->ie_length) { PRINTM(MINFO, "Clear the IE buffer\n"); - ret = wlan_custom_ioctl_auto_delete - (pmpriv, pioctl_req, ie_data, - index); + ret = wlan_custom_ioctl_auto_delete( + pmpriv, pioctl_req, ie_data, + index); /* if IE to delete is not found, return * error */ if (ret == MLAN_STATUS_FAILURE) goto done; memset(pmadapter, ie_data, 0, sizeof(custom_ie) * - MAX_MGMT_IE_INDEX_TO_FW); - memcpy_ext(pmadapter, (t_u8 *)ie_data, - &pmpriv->mgmt_ie[index], - pmpriv->mgmt_ie[index]. - ie_length + - MLAN_CUSTOM_IE_HDR_SIZE, - pmpriv->mgmt_ie[index]. - ie_length + - MLAN_CUSTOM_IE_HDR_SIZE); + MAX_MGMT_IE_INDEX_TO_FW); + memcpy_ext( + pmadapter, (t_u8 *)ie_data, + &pmpriv->mgmt_ie[index], + pmpriv->mgmt_ie[index].ie_length + + MLAN_CUSTOM_IE_HDR_SIZE, + pmpriv->mgmt_ie[index].ie_length + + MLAN_CUSTOM_IE_HDR_SIZE); } else { /* * Check if this index is being used on * any other interfaces. If yes, then * the request needs to be rejected. */ - ret = wlan_is_custom_ie_index_unused - (pmpriv, index); + ret = wlan_is_custom_ie_index_unused( + pmpriv, index); if (ret == MLAN_STATUS_FAILURE) { PRINTM(MERROR, "IE index is used by other interface.\n"); @@ -1528,23 +1540,22 @@ ie_data->ie_length = 0; else { if ((pmpriv->mgmt_ie[index] - .mgmt_subtype_mask == - ie_data->mgmt_subtype_mask) - && (pmpriv->mgmt_ie[index] - .ie_length == - ie_data->ie_length) && + .mgmt_subtype_mask == + ie_data->mgmt_subtype_mask) && + (pmpriv->mgmt_ie[index] + .ie_length == + ie_data->ie_length) && !memcmp(pmpriv->adapter, - pmpriv-> - mgmt_ie[index] - .ie_buffer, + pmpriv->mgmt_ie[index] + .ie_buffer, ie_data->ie_buffer, - ie_data-> - ie_length)) { + ie_data->ie_length)) { PRINTM(MIOCTL, "same custom ie already configured!\n"); if (ioctl_len <= 0 && - misc->param.cust_ie. - len == 0) { + misc->param.cust_ie + .len == + 0) { goto done; } else { /* remove @@ -1552,11 +1563,13 @@ * from app * buffer */ app_data_len -= - ie_data-> - ie_length - + + ie_data->ie_length + MLAN_CUSTOM_IE_HDR_SIZE; - memmove(pmadapter, (t_u8 *)ie_data, ie_data->ie_buffer + ie_data->ie_length, ioctl_len); + memmove(pmadapter, + (t_u8 *)ie_data, + ie_data->ie_buffer + + ie_data->ie_length, + ioctl_len); continue; } } @@ -1581,19 +1594,17 @@ /* Send command to firmware */ if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) { - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MGMT_IE_LIST, - cmd_action, 0, - (send_ioctl) ? (t_void *)pioctl_req : - MNULL, &misc->param.cust_ie); + ret = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_MGMT_IE_LIST, cmd_action, 0, + (send_ioctl) ? (t_void *)pioctl_req : MNULL, + &misc->param.cust_ie); } #ifdef UAP_SUPPORT else if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP) { - ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_SYS_CONFIGURE, - cmd_action, 0, - (send_ioctl) ? (t_void *)pioctl_req : - MNULL, - (send_ioctl) ? MNULL : &misc->param. - cust_ie); + ret = wlan_prepare_cmd( + pmpriv, HOST_CMD_APCMD_SYS_CONFIGURE, cmd_action, 0, + (send_ioctl) ? (t_void *)pioctl_req : MNULL, + (send_ioctl) ? MNULL : &misc->param.cust_ie); } #endif if (ret == MLAN_STATUS_SUCCESS) @@ -1611,8 +1622,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_reg_mem *reg_mem = MNULL; @@ -1629,19 +1640,25 @@ switch (reg_mem->param.reg_rw.type) { case MLAN_REG_MAC: -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) case MLAN_REG_MAC2: #endif cmd_no = HostCmd_CMD_MAC_REG_ACCESS; break; case MLAN_REG_BBP: -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) case MLAN_REG_BBP2: #endif cmd_no = HostCmd_CMD_BBP_REG_ACCESS; break; case MLAN_REG_RF: -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) case MLAN_REG_RF2: #endif cmd_no = HostCmd_CMD_RF_REG_ACCESS; @@ -1653,11 +1670,21 @@ cmd_no = HostCmd_CMD_TARGET_ACCESS; break; case MLAN_REG_BCA: -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) case MLAN_REG_BCA2: #endif cmd_no = HostCmd_CMD_BCA_REG_ACCESS; break; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) || \ + defined(SD9177) + case MLAN_REG_CIU: + cmd_no = HostCmd_CMD_REG_ACCESS; + break; +#endif default: pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; ret = MLAN_STATUS_FAILURE; @@ -1685,9 +1712,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_reg_mem_ioctl_read_eeprom(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_reg_mem_ioctl_read_eeprom(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_reg_mem *reg_mem = MNULL; @@ -1720,8 +1746,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_reg_mem_ioctl_mem_rw(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_reg_mem_ioctl_mem_rw(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_reg_mem *reg_mem = MNULL; @@ -1755,8 +1781,7 @@ * * @return MFALSE/MTRUE */ -t_u8 -wlan_is_station_list_empty(mlan_private *priv) +t_u8 wlan_is_station_list_empty(mlan_private *priv) { ENTER(); if (!(util_peek_list(priv->adapter->pmoal_handle, &priv->sta_list, @@ -1778,8 +1803,7 @@ * * @return A pointer to structure sta_node */ -sta_node * -wlan_get_station_entry(mlan_private *priv, t_u8 *mac) +sta_node *wlan_get_station_entry(mlan_private *priv, t_u8 *mac) { sta_node *sta_ptr; @@ -1789,9 +1813,8 @@ LEAVE(); return MNULL; } - sta_ptr = - (sta_node *)util_peek_list(priv->adapter->pmoal_handle, - &priv->sta_list, MNULL, MNULL); + sta_ptr = (sta_node *)util_peek_list(priv->adapter->pmoal_handle, + &priv->sta_list, MNULL, MNULL); while (sta_ptr && (sta_ptr != (sta_node *)&priv->sta_list)) { if (!memcmp(priv->adapter, sta_ptr->mac_addr, mac, @@ -1814,8 +1837,7 @@ * * @return A pointer to structure sta_node */ -sta_node * -wlan_add_station_entry(mlan_private *priv, t_u8 *mac) +sta_node *wlan_add_station_entry(mlan_private *priv, t_u8 *mac) { sta_node *sta_ptr = MNULL; @@ -1858,8 +1880,7 @@ * * @return N/A */ -t_void -wlan_delete_station_entry(mlan_private *priv, t_u8 *mac) +t_void wlan_delete_station_entry(mlan_private *priv, t_u8 *mac) { sta_node *sta_ptr = MNULL; ENTER(); @@ -1890,19 +1911,15 @@ * * @return N/A */ -t_void -wlan_delete_station_list(pmlan_private priv) +t_void wlan_delete_station_list(pmlan_private priv) { sta_node *sta_ptr; ENTER(); - while ((sta_ptr = - (sta_node *)util_dequeue_list(priv->adapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock))) { + while ((sta_ptr = (sta_node *)util_dequeue_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock))) { #ifdef DRV_EMBEDDED_AUTHENTICATOR if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) && IsAuthenticatorEnabled(priv->psapriv)) @@ -1923,24 +1940,21 @@ * @param buf A pointer to tdls_peer_info buf * @return number of tdls peer */ -int -wlan_get_tdls_list(mlan_private *priv, tdls_peer_info *buf) +int wlan_get_tdls_list(mlan_private *priv, tdls_peer_info *buf) { tdls_peer_info *peer_info = buf; sta_node *sta_ptr = MNULL; int count = 0; + IEEEtypes_Header_t *ieee_hdr; ENTER(); if (priv->bss_type != MLAN_BSS_TYPE_STA) { LEAVE(); return count; } - sta_ptr = - (sta_node *)util_peek_list(priv->adapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + sta_ptr = (sta_node *)util_peek_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!sta_ptr) { LEAVE(); return count; @@ -1962,6 +1976,11 @@ &sta_ptr->vht_cap, sizeof(IEEEtypes_VHTCap_t), sizeof(peer_info->vht_cap)); + ieee_hdr = (IEEEtypes_Header_t *)peer_info->he_cap; + memcpy_ext(priv->adapter, peer_info->he_cap, + &sta_ptr->he_cap, + sizeof(IEEEtypes_Header_t) + ieee_hdr->len, + sizeof(peer_info->he_cap)); peer_info++; count++; } @@ -1981,8 +2000,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tdls_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tdls_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2001,10 +2020,8 @@ ENTER(); if (misc->param.tdls_config.tdls_action == WLAN_TDLS_TEAR_DOWN_REQ) { - sta_ptr = - wlan_get_station_entry(pmpriv, - tdls_all_cfg->u.tdls_tear_down. - peer_mac_addr); + sta_ptr = wlan_get_station_entry( + pmpriv, tdls_all_cfg->u.tdls_tear_down.peer_mac_addr); if (sta_ptr && sta_ptr->external_tdls) { pevent->bss_index = pmpriv->bss_index; pevent->event_id = MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; @@ -2034,9 +2051,8 @@ pMrvlTlv = (MrvlIEtypes_Data_t *)pos; switch (pMrvlTlv->header.type) { case SUPPORTED_CHANNELS: - pmpriv->chan_supp_len = - (t_u8)MIN(pMrvlTlv->header.len, - MAX_IE_SIZE); + pmpriv->chan_supp_len = (t_u8)MIN( + pMrvlTlv->header.len, MAX_IE_SIZE); memset(pmadapter, pmpriv->chan_supp, 0, sizeof(pmpriv->chan_supp)); memcpy_ext(pmadapter, pmpriv->chan_supp, @@ -2047,9 +2063,8 @@ pmpriv->chan_supp_len); break; case REGULATORY_CLASS: - pmpriv->supp_regulatory_class_len = - (t_u8)MIN(pMrvlTlv->header.len, - MAX_IE_SIZE); + pmpriv->supp_regulatory_class_len = (t_u8)MIN( + pMrvlTlv->header.len, MAX_IE_SIZE); memset(pmadapter, pmpriv->supp_regulatory_class, 0, sizeof(pmpriv->supp_regulatory_class)); @@ -2067,7 +2082,7 @@ } remain_len -= pMrvlTlv->header.len; pos += sizeof(MrvlIEtypesHeader_t) + - pMrvlTlv->header.len; + pMrvlTlv->header.len; } LEAVE(); return ret; @@ -2093,8 +2108,7 @@ * * @return */ -t_void -wlan_tdls_config(pmlan_private pmpriv, t_u8 enable) +t_void wlan_tdls_config(pmlan_private pmpriv, t_u8 enable) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -2118,8 +2132,11 @@ tdls_all_cfg->u.tdls_config.enable = enable; tdls_config->tdls_action = WLAN_TDLS_CONFIG; /* Send command to firmware */ - wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, HostCmd_ACT_GEN_SET, - 0, MNULL, tdls_config); + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, + HostCmd_ACT_GEN_SET, 0, MNULL, tdls_config); + if (ret) + PRINTM(MERROR, "Error sending cmd to FW\n"); + PRINTM(MCMND, "tdls_config: enable=%d\n", enable); if (tdls_config) @@ -2135,8 +2152,7 @@ * * @return */ -static t_void -wlan_tdls_cs_param_config(pmlan_private pmpriv) +static t_void wlan_tdls_cs_param_config(pmlan_private pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -2164,8 +2180,10 @@ tdls_all_cfg->u.tdls_cs_params.threshold_directlink = 0; /* Send command to firmware */ - wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, HostCmd_ACT_GEN_SET, - 0, MNULL, tdls_config); + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, + HostCmd_ACT_GEN_SET, 0, MNULL, tdls_config); + if (ret) + PRINTM(MERROR, "Error sending cmd to FW\n"); if (tdls_config) pcb->moal_mfree(pmadapter->pmoal_handle, (t_u8 *)tdls_config); @@ -2182,9 +2200,8 @@ * * @return */ -static t_void -wlan_tdls_cs_start(pmlan_private pmpriv, t_u8 *peer_mac_addr, - pmlan_ioctl_req pioctl_buf) +static t_void wlan_tdls_cs_start(pmlan_private pmpriv, t_u8 *peer_mac_addr, + pmlan_ioctl_req pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -2214,12 +2231,11 @@ sizeof(mlan_ds_misc_tdls_config)); tdls_all_cfg = (tdls_all_config *)tdls_config->tdls_data; if (tdls_all_cfg->u.tdls_chan_switch.primary_channel > 14) { - tdls_all_cfg->u.tdls_chan_switch. - secondary_channel_offset = - wlan_get_second_channel_offset(pmpriv, - tdls_all_cfg->u. - tdls_chan_switch. - primary_channel); + tdls_all_cfg->u.tdls_chan_switch + .secondary_channel_offset = + wlan_get_second_channel_offset( + pmpriv, tdls_all_cfg->u.tdls_chan_switch + .primary_channel); } PRINTM(MCMND, "Start TDLS CS: channel=%d\n", tdls_all_cfg->u.tdls_chan_switch.primary_channel); @@ -2234,11 +2250,10 @@ pmpriv->tdls_cs_channel; if (pmpriv->tdls_cs_channel > 14) { tdls_all_cfg->u.tdls_chan_switch.band = BAND_5GHZ; - tdls_all_cfg->u.tdls_chan_switch. - secondary_channel_offset = - wlan_get_second_channel_offset(pmpriv, - pmpriv-> - tdls_cs_channel); + tdls_all_cfg->u.tdls_chan_switch + .secondary_channel_offset = + wlan_get_second_channel_offset( + pmpriv, pmpriv->tdls_cs_channel); } else { tdls_all_cfg->u.tdls_chan_switch.band = BAND_2GHZ; } @@ -2251,8 +2266,10 @@ tdls_all_cfg->u.tdls_chan_switch.periodicity = 1; /* Send command to firmware */ - wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, HostCmd_ACT_GEN_SET, - 0, MNULL, tdls_config); + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_CONFIG, + HostCmd_ACT_GEN_SET, 0, MNULL, tdls_config); + if (ret) + PRINTM(MERROR, "Error sending cmd to FW\n"); if (tdls_config) pcb->moal_mfree(pmadapter->pmoal_handle, (t_u8 *)tdls_config); @@ -2269,8 +2286,7 @@ * @param pioctl_buf A pointer to command buffer * @return */ -static t_void -wlan_tdls_cs_stop(pmlan_private pmpriv, t_u8 *peer_mac_addr) +static t_void wlan_tdls_cs_stop(pmlan_private pmpriv, t_u8 *peer_mac_addr) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -2317,9 +2333,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tdls_cs_channel(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tdls_cs_channel(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2335,7 +2350,6 @@ LEAVE(); return ret; } - /** * @brief Set/Get the TDLS idle time. * @@ -2344,9 +2358,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tdls_idle_time(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tdls_idle_time(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2371,8 +2384,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tdls_oper(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tdls_oper(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2395,25 +2408,26 @@ sta_ptr->status = TDLS_SETUP_COMPLETE; pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; if (!pmpriv->txaggrctrl) - wlan_11n_send_delba_to_peer(pmpriv, - pmpriv-> - curr_bss_params. - bss_descriptor. - mac_address); - if (sta_ptr->HTcap.ieee_hdr.element_id == HT_CAPABILITY) { + wlan_11n_send_delba_to_peer( + pmpriv, + pmpriv->curr_bss_params.bss_descriptor + .mac_address); + if (sta_ptr->HTcap.ieee_hdr.element_id == + HT_CAPABILITY) { sta_ptr->is_11n_enabled = MTRUE; - if (GETHT_MAXAMSDU - (sta_ptr->HTcap.ht_cap.ht_cap_info)) + if (GETHT_MAXAMSDU( + sta_ptr->HTcap.ht_cap.ht_cap_info)) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_4K; for (i = 0; i < MAX_NUM_TID; i++) { - if (sta_ptr->is_11n_enabled) + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) sta_ptr->ampdu_sta[i] = pmpriv->aggr_prio_tbl[i] - .ampdu_user; + .ampdu_user; else sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; @@ -2423,15 +2437,15 @@ } wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, TDLS_SETUP_COMPLETE); - if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH - (sta_ptr->ExtCap.ext_cap)) { + if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + sta_ptr->ExtCap.ext_cap)) { wlan_tdls_config(pmpriv, MTRUE); wlan_tdls_cs_param_config(pmpriv); /**tdls cs start*/ if (pmpriv->tdls_cs_channel && pmpriv->tdls_cs_channel != - pmpriv->curr_bss_params.bss_descriptor. - channel) + pmpriv->curr_bss_params + .bss_descriptor.channel) wlan_tdls_cs_start(pmpriv, ptdls_oper->peer_mac, MNULL); @@ -2456,19 +2470,19 @@ MLAN_MAC_ADDR_LENGTH); tdls_evt->reason_code = MLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; - wlan_recv_event(pmpriv, - MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, - ptdls_event); + wlan_recv_event( + pmpriv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, TDLS_TEAR_DOWN); - if (sta_ptr->is_11n_enabled) { - wlan_cleanup_reorder_tbl(pmpriv, - ptdls_oper-> - peer_mac); - wlan_11n_cleanup_txbastream_tbl(pmpriv, - ptdls_oper-> - peer_mac); + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) { + wlan_cleanup_reorder_tbl( + pmpriv, ptdls_oper->peer_mac); + wlan_11n_cleanup_txbastream_tbl( + pmpriv, ptdls_oper->peer_mac); } wlan_delete_station_entry(pmpriv, ptdls_oper->peer_mac); @@ -2484,7 +2498,7 @@ MNULL); break; case WLAN_TDLS_DISABLE_LINK: - /* Send command to firmware to delete tdls link */ + /* Send command to firmware to delete tdls link*/ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_TDLS_OPERATION, HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, ptdls_oper); @@ -2498,10 +2512,8 @@ break; } if (!sta_ptr) - sta_ptr = - wlan_add_station_entry(pmpriv, - misc->param.tdls_oper. - peer_mac); + sta_ptr = wlan_add_station_entry( + pmpriv, misc->param.tdls_oper.peer_mac); if (sta_ptr) { sta_ptr->status = TDLS_SETUP_INPROGRESS; sta_ptr->external_tdls = MTRUE; @@ -2553,8 +2565,7 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static void -wlan_get_ap_ext_cap(mlan_private *pmpriv, ExtCap_t *ext_cap) +static void wlan_get_ap_ext_cap(mlan_private *pmpriv, ExtCap_t *ext_cap) { pmlan_adapter pmadapter = pmpriv->adapter; BSSDescriptor_t *pbss_desc; @@ -2563,7 +2574,7 @@ if (pbss_desc->pext_cap) { memcpy_ext(pmadapter, (t_u8 *)ext_cap, (t_u8 *)pbss_desc->pext_cap + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pbss_desc->pext_cap->ieee_hdr.len, sizeof(ExtCap_t)); } return; @@ -2577,9 +2588,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tdls_get_ies(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tdls_get_ies(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -2595,13 +2605,14 @@ IEEEtypes_VHTOprat_t *vht_oprat = MNULL; IEEEtypes_AssocRsp_t *passoc_rsp = MNULL; IEEEtypes_AID_t *aid_info = MNULL; - t_u8 supp_chan[] = { 1, 11 }; - t_u8 regulatory_class[] = { 1, /**current class*/ - 1, 2, 3, 4, 12, 22, 23, 24, - 25, 27, 28, 29, 30, 32, 33 - }; /**list - regulatory - class*/ + IEEEtypes_HECap_t *he_cap = MNULL; + IEEEtypes_HeOp_t *he_op = MNULL; + t_u8 supp_chan[] = {1, 11}; + t_u8 regulatory_class[] = {1, /**current class*/ + 1, 2, 3, 4, 12, 22, 23, 24, + 25, 27, 28, 29, 30, 32, 33}; /**list + regulatory + class*/ IEEEtypes_Generic_t *pSupp_chan = MNULL, *pRegulatory_class = MNULL; sta_node *sta_ptr = MNULL; ENTER(); @@ -2626,11 +2637,10 @@ RESET_EXTCAP_TDLS_CHAN_SWITCH(ext_cap->ext_cap); if (pmpriv->host_tdls_uapsd_support) { - /* uapsd in tdls confirm frame */ + /* uapsd in tdls confirm frame*/ if (tdls_ies->flags & TDLS_IE_FLAGS_HTINFO) { - if (sta_ptr && - ISSUPP_EXTCAP_TDLS_UAPSD(sta_ptr->ExtCap. - ext_cap)) + if (sta_ptr && ISSUPP_EXTCAP_TDLS_UAPSD( + sta_ptr->ExtCap.ext_cap)) SET_EXTCAP_TDLS_UAPSD(ext_cap->ext_cap); } else { SET_EXTCAP_TDLS_UAPSD(ext_cap->ext_cap); @@ -2639,14 +2649,12 @@ /* channel switch support */ if (pmpriv->host_tdls_cs_support && !IS_EXTCAP_TDLS_CHLSWITCHPROHIB(ap_ext_cap)) { - /* channel switch in tdls confirm frame */ + /* channel switch in tdls confirm frame*/ if (tdls_ies->flags & TDLS_IE_FLAGS_HTINFO) { - if (sta_ptr && - ISSUPP_EXTCAP_TDLS_CHAN_SWITCH(sta_ptr-> - ExtCap. - ext_cap)) - SET_EXTCAP_TDLS_CHAN_SWITCH(ext_cap-> - ext_cap); + if (sta_ptr && ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + sta_ptr->ExtCap.ext_cap)) + SET_EXTCAP_TDLS_CHAN_SWITCH( + ext_cap->ext_cap); } else { SET_EXTCAP_TDLS_CHAN_SWITCH(ext_cap->ext_cap); } @@ -2659,8 +2667,8 @@ /* if peer does not support wider bandwidth, don't set wider * bandwidth*/ if (sta_ptr && sta_ptr->rate_len && - !ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH(sta_ptr->ExtCap. - ext_cap)) + !ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH( + sta_ptr->ExtCap.ext_cap)) RESET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap->ext_cap); DBG_HEXDUMP(MCMD_D, "TDLS extcap", tdls_ies->ext_cap, sizeof(IEEEtypes_ExtCap_t)); @@ -2678,9 +2686,9 @@ if (tdls_ies->flags & TDLS_IE_FLAGS_HTCAP) { ht_cap = (IEEEtypes_HTCap_t *)tdls_ies->ht_cap; memset(pmadapter, ht_cap, 0, sizeof(IEEEtypes_HTCap_t)); - if ((sta_ptr && - !ISSUPP_EXTCAP_TDLS_CHAN_SWITCH(sta_ptr->ExtCap.ext_cap)) - || IS_EXTCAP_TDLS_CHLSWITCHPROHIB(ap_ext_cap)) + if ((sta_ptr && !ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + sta_ptr->ExtCap.ext_cap)) || + IS_EXTCAP_TDLS_CHLSWITCHPROHIB(ap_ext_cap)) wlan_fill_ht_cap_ie(pmpriv, ht_cap, pbss_desc->bss_band); else if (pmpriv->host_tdls_cs_support && @@ -2705,7 +2713,7 @@ wlan_fill_vht_cap_ie(pmpriv, vht_cap, pbss_desc->bss_band); if (ht_cap) SETHT_SUPPCHANWIDTH(ht_cap->ht_cap.ht_cap_info); - DBG_HEXDUMP(MCMD_D, "TDLS vhtcap", tdls_ies->vht_cap, + DBG_HEXDUMP(MCMD_D, "TDLS VHT Cap IE", tdls_ies->vht_cap, sizeof(IEEEtypes_VHTCap_t)); } /** fill the vhtoperation based on hwspec */ @@ -2722,16 +2730,15 @@ tdls_ies->vht_oprat, sizeof(IEEEtypes_VHTOprat_t), sizeof(IEEEtypes_VHTOprat_t)); - DBG_HEXDUMP(MCMD_D, "TDLS vht_oprat", tdls_ies->vht_oprat, - sizeof(IEEEtypes_VHTOprat_t)); + DBG_HEXDUMP(MCMD_D, "TDLS VHT Operation IE", + tdls_ies->vht_oprat, sizeof(IEEEtypes_VHTOprat_t)); } /** fill the AID info */ if (tdls_ies->flags & TDLS_IE_FLAGS_AID) { if (pmpriv->curr_bss_params.host_mlme) - passoc_rsp = - (IEEEtypes_AssocRsp_t *)(pmpriv->assoc_rsp_buf + - sizeof - (IEEEtypes_MgmtHdr_t)); + passoc_rsp = (IEEEtypes_AssocRsp_t + *)(pmpriv->assoc_rsp_buf + + sizeof(IEEEtypes_MgmtHdr_t)); else passoc_rsp = (IEEEtypes_AssocRsp_t *)pmpriv->assoc_rsp_buf; @@ -2742,6 +2749,26 @@ aid_info->AID = wlan_le16_to_cpu(passoc_rsp->a_id); PRINTM(MCMND, "TDLS AID=0x%x\n", aid_info->AID); } + /** fill the hecap based on hwspec */ + if (tdls_ies->flags & TDLS_IE_FLAGS_HECAP) { + he_cap = (IEEEtypes_HECap_t *)tdls_ies->he_cap; + memset(pmadapter, he_cap, 0, sizeof(IEEEtypes_HECap_t)); + wlan_fill_he_cap_ie(pmpriv, he_cap, pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "TDLS HE Cap IE", tdls_ies->he_cap, + sizeof(IEEEtypes_Header_t) + he_cap->ieee_hdr.len); + } + + if (tdls_ies->flags & TDLS_IE_FLAGS_HEOP) { + he_op = (IEEEtypes_HeOp_t *)tdls_ies->he_op; + memset(pmadapter, he_op, 0, sizeof(IEEEtypes_HeOp_t)); + wlan_fill_he_op_ie(pmpriv, he_op); + } + if (sta_ptr) { + memcpy_ext(pmadapter, &sta_ptr->he_op, tdls_ies->he_op, + sizeof(IEEEtypes_HeOp_t), sizeof(IEEEtypes_HeOp_t)); + DBG_HEXDUMP(MCMD_D, "TDLS HE Operation IE", tdls_ies->he_op, + sizeof(IEEEtypes_HeOp_t)); + } /** fill the htinfo */ if (tdls_ies->flags & TDLS_IE_FLAGS_HTINFO) { ht_info = (IEEEtypes_HTInfo_t *)tdls_ies->ht_info; @@ -2752,22 +2779,20 @@ /* follow AP's channel bandwidth */ if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && pbss_desc->pht_info && - ISALLOWED_CHANWIDTH40(pbss_desc->pht_info->ht_info. - field2)) { + ISALLOWED_CHANWIDTH40( + pbss_desc->pht_info->ht_info.field2)) { ht_info->ht_info.field2 = pbss_desc->pht_info->ht_info.field2; } else { ht_info->ht_info.field2 = - wlan_get_second_channel_offset(pmpriv, - pbss_desc-> - channel); + wlan_get_second_channel_offset( + pmpriv, pbss_desc->channel); } if (vht_oprat && vht_oprat->ieee_hdr.element_id == VHT_OPERATION) { ht_info->ht_info.field2 = - wlan_get_second_channel_offset(pmpriv, - pbss_desc-> - channel); + wlan_get_second_channel_offset( + pmpriv, pbss_desc->channel); ht_info->ht_info.field2 |= MBIT(2); } if (sta_ptr) @@ -2796,10 +2821,9 @@ memcpy_ext(pmadapter, pSupp_chan->data, supp_chan, sizeof(supp_chan), sizeof(pSupp_chan->data)); } - DBG_HEXDUMP(MCMD_D, "TDLS supported channel", - tdls_ies->supp_chan, - pSupp_chan->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP( + MCMD_D, "TDLS supported channel", tdls_ies->supp_chan, + pSupp_chan->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); /**fill supported Regulatory Class IE*/ pRegulatory_class = @@ -2822,7 +2846,7 @@ DBG_HEXDUMP(MCMD_D, "TDLS supported regulatory class", tdls_ies->regulatory_class, pRegulatory_class->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); } LEAVE(); return ret; @@ -2836,9 +2860,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_radio_ioctl_mimo_switch_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_radio_ioctl_mimo_switch_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_radio_cfg *radio_cfg = (mlan_ds_radio_cfg *)pioctl_req->pbuf; @@ -2866,8 +2889,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_get_info_ver_ext(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_info_ver_ext(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_get_info *pinfo = (mlan_ds_get_info *)pioctl_req->pbuf; @@ -2895,8 +2918,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_ioctl_link_statistic(mlan_private *pmpriv, pmlan_ioctl_req pioctl_req) +mlan_status wlan_ioctl_link_statistic(mlan_private *pmpriv, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u16 cmd_action = 0; @@ -2949,8 +2972,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_get_tx_rx_histogram(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_tx_rx_histogram(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -2979,8 +3002,7 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_set_drvdbg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_set_drvdbg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) { mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3003,8 +3025,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_reg_rx_mgmt_ind(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_reg_rx_mgmt_ind(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -3038,9 +3060,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_802dot11_mgmt_pkt(mlan_private *priv, - t_u8 *payload, t_u32 payload_len, RxPD *prx_pd) +mlan_status wlan_process_802dot11_mgmt_pkt(mlan_private *priv, t_u8 *payload, + t_u32 payload_len, RxPD *prx_pd) { pmlan_adapter pmadapter = priv->adapter; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3050,7 +3071,7 @@ t_u8 *event_buf = MNULL; mlan_event *pevent = MNULL; t_u8 unicast = 0; - t_u8 broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; IEEE80211_MGMT *mgmt = MNULL; t_u8 category = 0; t_u8 action_code = 0; @@ -3086,77 +3107,66 @@ if (!memcmp(pmadapter, pieee_pkt_hdr->addr3, priv->curr_addr, MLAN_MAC_ADDR_LENGTH)) { PRINTM(MMSG, - "wlan: HostMlme MICRO_AP_STA_ASSOC " - MACSTR "\n", + "wlan: HostMlme MICRO_AP_STA_ASSOC " MACSTR + "\n", MAC2STR(pieee_pkt_hdr->addr2)); mgmt = (IEEE80211_MGMT *)payload; - sta_ptr = - wlan_add_station_entry(priv, - pieee_pkt_hdr-> - addr2); + sta_ptr = wlan_add_station_entry( + priv, pieee_pkt_hdr->addr2); if (sta_ptr) { - sta_ptr->capability = - wlan_le16_to_cpu(mgmt->u. - assoc_req. - capab_info); - pmbuf = wlan_alloc_mlan_buffer - (pmadapter, payload_len, 0, - MOAL_MALLOC_BUFFER); + sta_ptr->capability = wlan_le16_to_cpu( + mgmt->u.assoc_req.capab_info); + pmbuf = wlan_alloc_mlan_buffer( + pmadapter, payload_len, 0, + MOAL_MALLOC_BUFFER); if (pmbuf) { PRINTM(MCMND, "check sta capability\n"); pmbuf->data_len = ASSOC_EVENT_FIX_SIZE; - tlv = (MrvlIETypes_MgmtFrameSet_t *)(pmbuf->pbuf + pmbuf->data_offset + pmbuf->data_len); - tlv->type = - wlan_cpu_to_le16 - (TLV_TYPE_MGMT_FRAME); - tlv->len = - sizeof - (IEEEtypes_FrameCtl_t); - memcpy_ext(pmadapter, - (t_u8 *)&tlv-> - frame_control, - &pieee_pkt_hdr-> - frm_ctl, - sizeof - (IEEEtypes_FrameCtl_t), - sizeof - (IEEEtypes_FrameCtl_t)); - pmbuf->data_len += - sizeof - (MrvlIETypes_MgmtFrameSet_t); - memcpy_ext(pmadapter, - pmbuf->pbuf + - pmbuf->data_offset + - pmbuf->data_len, - payload + - sizeof - (wlan_802_11_header), - payload_len - - sizeof - (wlan_802_11_header), - payload_len - - sizeof - (wlan_802_11_header)); + tlv = (MrvlIETypes_MgmtFrameSet_t + *)(pmbuf->pbuf + + pmbuf->data_offset + + pmbuf->data_len); + tlv->type = wlan_cpu_to_le16( + TLV_TYPE_MGMT_FRAME); + tlv->len = sizeof( + IEEEtypes_FrameCtl_t); + memcpy_ext( + pmadapter, + (t_u8 *)&tlv + ->frame_control, + &pieee_pkt_hdr->frm_ctl, + sizeof(IEEEtypes_FrameCtl_t), + sizeof(IEEEtypes_FrameCtl_t)); + pmbuf->data_len += sizeof( + MrvlIETypes_MgmtFrameSet_t); + memcpy_ext( + pmadapter, + pmbuf->pbuf + + pmbuf->data_offset + + pmbuf->data_len, + payload + + sizeof(wlan_802_11_header), + payload_len - + sizeof(wlan_802_11_header), + payload_len - + sizeof(wlan_802_11_header)); pmbuf->data_len += payload_len - - sizeof - (wlan_802_11_header); + sizeof(wlan_802_11_header); tlv->len += payload_len - - sizeof - (wlan_802_11_header); - tlv->len = - wlan_cpu_to_le16(tlv-> - len); - DBG_HEXDUMP(MCMD_D, "assoc_req", - pmbuf->pbuf + - pmbuf->data_offset, - pmbuf->data_len); - wlan_check_sta_capability(priv, - pmbuf, - sta_ptr); + sizeof(wlan_802_11_header); + tlv->len = wlan_cpu_to_le16( + tlv->len); + DBG_HEXDUMP( + MCMD_D, "assoc_req", + pmbuf->pbuf + + pmbuf->data_offset, + pmbuf->data_len); + wlan_check_sta_capability( + priv, pmbuf, sta_ptr); wlan_free_mlan_buffer(pmadapter, pmbuf); } @@ -3192,8 +3202,8 @@ priv->curr_addr, MLAN_MAC_ADDR_LENGTH)) { PRINTM_NETINTF(MMSG, priv); PRINTM(MMSG, - "wlan: HostMlme Deauth Receive from " - MACSTR "\n", + "wlan: HostMlme Deauth Receive from " MACSTR + "\n", MAC2STR(pieee_pkt_hdr->addr2)); } } @@ -3201,12 +3211,13 @@ if (priv->bss_role == MLAN_BSS_ROLE_STA) { if (priv->curr_bss_params.host_mlme) { if (memcmp(pmadapter, pieee_pkt_hdr->addr3, - (t_u8 *)priv->curr_bss_params. - bss_descriptor.mac_address, + (t_u8 *)priv->curr_bss_params + .bss_descriptor.mac_address, MLAN_MAC_ADDR_LENGTH)) { PRINTM(MCMND, - "Dropping Deauth frame from other bssid: type=%d " - MACSTR "\n", sub_type, + "Dropping Deauth frame from other bssid: type=%d " MACSTR + "\n", + sub_type, MAC2STR(pieee_pkt_hdr->addr3)); LEAVE(); return ret; @@ -3216,9 +3227,9 @@ "wlan: HostMlme Disconnected: sub_type=%d\n", sub_type); pmadapter->pending_disconnect_priv = priv; - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } } break; @@ -3261,7 +3272,8 @@ MLAN_MAC_ADDR_LENGTH)) { PRINTM(MINFO, "Dropping mgmt frame for others: type=%d " MACSTR - "\n", sub_type, MAC2STR(pieee_pkt_hdr->addr1)); + "\n", + sub_type, MAC2STR(pieee_pkt_hdr->addr1)); LEAVE(); return ret; } @@ -3277,8 +3289,7 @@ pevent = (pmlan_event)event_buf; pevent->bss_index = priv->bss_index; mgmt = (IEEE80211_MGMT *)payload; - if (!priv->curr_bss_params.host_mlme && - sub_type == SUBTYPE_ACTION && + if (!priv->curr_bss_params.host_mlme && sub_type == SUBTYPE_ACTION && mgmt->u.ft_resp.category == FT_CATEGORY && mgmt->u.ft_resp.action == FT_ACTION_RESPONSE && mgmt->u.ft_resp.status_code == 0) { @@ -3318,10 +3329,10 @@ memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, (t_u8 *)&pevent->event_id, sizeof(pevent->event_id), pevent->event_len); - memcpy_ext(pmadapter, - (t_u8 *)(pevent->event_buf + - sizeof(pevent->event_id)), payload, - payload_len, payload_len); + memcpy_ext( + pmadapter, + (t_u8 *)(pevent->event_buf + sizeof(pevent->event_id)), + payload, payload_len, payload_len); } wlan_recv_event(priv, pevent->event_id, pevent); if (event_buf) @@ -3339,8 +3350,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ext_capa_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ext_capa_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -3375,17 +3386,15 @@ * * @return MTRUE or MFALSE; */ -t_u32 -wlan_is_ext_capa_support(mlan_private *pmpriv) +t_u32 wlan_is_ext_capa_support(mlan_private *pmpriv) { ENTER(); if (ISSUPP_EXTCAP_TDLS(pmpriv->ext_cap) || ISSUPP_EXTCAP_INTERWORKING(pmpriv->ext_cap) || - ISSUPP_EXTCAP_BSS_TRANSITION(pmpriv->ext_cap) - || ISSUPP_EXTCAP_QOS_MAP(pmpriv->ext_cap) - || ISSUPP_EXTCAP_OPERMODENTF(pmpriv->ext_cap) - ) { + ISSUPP_EXTCAP_BSS_TRANSITION(pmpriv->ext_cap) || + ISSUPP_EXTCAP_QOS_MAP(pmpriv->ext_cap) || + ISSUPP_EXTCAP_OPERMODENTF(pmpriv->ext_cap)) { LEAVE(); return MTRUE; } else { @@ -3403,8 +3412,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_hotspot_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_hotspot_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -3431,9 +3440,8 @@ * * @return N/A */ -void -wlan_add_ext_capa_info_ie(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc, t_u8 **pptlv_out) +void wlan_add_ext_capa_info_ie(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, + t_u8 **pptlv_out) { MrvlIETypes_ExtCap_t *pext_cap = MNULL; @@ -3467,8 +3475,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_otp_user_data(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_otp_user_data(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -3476,7 +3484,8 @@ ENTER(); - if (misc->param.otp_user_data.user_data_length > MAX_OTP_USER_DATA_LEN) { + if (misc->param.otp_user_data.user_data_length > + MAX_OTP_USER_DATA_LEN) { PRINTM(MERROR, "Invalid OTP user data length\n"); pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; LEAVE(); @@ -3494,6 +3503,33 @@ return ret; } +#ifdef UAP_SUPPORT +/** + * @brief Check 11B support Rates + * + * + * @param pmadapter Private mlan adapter structure + * + * @return MTRUE/MFALSE + * + */ +static t_u8 wlan_check_ie_11b_support_rates(pIEEEtypes_Generic_t prates) +{ + int i; + t_u8 rate; + t_u8 ret = MTRUE; + for (i = 0; i < prates->ieee_hdr.len; i++) { + rate = prates->data[i] & 0x7f; + if ((rate != 0x02) && (rate != 0x04) && (rate != 0x0b) && + (rate != 0x16)) { + ret = MFALSE; + break; + } + } + return ret; +} +#endif + /** * @brief This function will search for the specific ie * @@ -3503,9 +3539,8 @@ * * @return N/A */ -void -wlan_check_sta_capability(pmlan_private priv, pmlan_buffer pevent, - sta_node *sta_ptr) +void wlan_check_sta_capability(pmlan_private priv, pmlan_buffer pevent, + sta_node *sta_ptr) { t_u16 tlv_type, tlv_len; t_u16 frame_control, frame_sub_type = 0; @@ -3515,7 +3550,8 @@ IEEEtypes_VHTCap_t *pvht_cap = MNULL; IEEEtypes_Extension_t *phe_cap = MNULL; #ifdef UAP_SUPPORT - t_u8 *ext_rate = MNULL, *erp = MNULL; + t_u8 *rate = MNULL; + t_u8 b_only = MFALSE; #endif int tlv_buf_left = pevent->data_len - ASSOC_EVENT_FIX_SIZE; @@ -3540,16 +3576,15 @@ (t_u8 *)&(mgmt_tlv->frame_control), sizeof(frame_control), sizeof(frame_control)); - frame_sub_type = - IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE - (frame_control); + frame_sub_type = IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE( + frame_control); if ((mgmt_tlv->frame_control.type == 0) && ((frame_sub_type == SUBTYPE_BEACON) #ifdef UAP_SUPPORT || (frame_sub_type == SUBTYPE_ASSOC_REQUEST) || (frame_sub_type == SUBTYPE_REASSOC_REQUEST) #endif - )) { + )) { if (frame_sub_type == SUBTYPE_BEACON) assoc_ie_len = sizeof(IEEEtypes_Beacon_t); @@ -3564,8 +3599,8 @@ sizeof(IEEEtypes_ReAssocRqst_t); #endif ie_len = tlv_len - - sizeof(IEEEtypes_FrameCtl_t) - - assoc_ie_len; + sizeof(IEEEtypes_FrameCtl_t) - + assoc_ie_len; assoc_req_ie = (t_u8 *)tlv + sizeof(MrvlIETypes_MgmtFrameSet_t) + @@ -3588,9 +3623,9 @@ pht_cap, sizeof(IEEEtypes_HTCap_t), sizeof(IEEEtypes_HTCap_t)); - if (GETHT_MAXAMSDU - (wlan_le16_to_cpu - (pht_cap->ht_cap.ht_cap_info))) + if (GETHT_MAXAMSDU(wlan_le16_to_cpu( + pht_cap->ht_cap + .ht_cap_info))) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else @@ -3608,16 +3643,16 @@ (priv->is_11ac_enabled == MTRUE)) { PRINTM(MCMND, "STA supports 11ac\n"); sta_ptr->is_11ac_enabled = MTRUE; - if (GET_VHTCAP_MAXMPDULEN - (wlan_le32_to_cpu - (pvht_cap->vht_cap. - vht_cap_info)) == 2) + if (GET_VHTCAP_MAXMPDULEN(wlan_le32_to_cpu( + pvht_cap->vht_cap + .vht_cap_info)) == + 2) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_12K; - else if (GET_VHTCAP_MAXMPDULEN - (wlan_le32_to_cpu - (pvht_cap->vht_cap. - vht_cap_info)) == 1) + else if (GET_VHTCAP_MAXMPDULEN(wlan_le32_to_cpu( + pvht_cap->vht_cap + .vht_cap_info)) == + 1) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else @@ -3631,38 +3666,33 @@ wlan_get_specific_ie(priv, assoc_req_ie, ie_len, EXTENSION, HE_CAPABILITY); - if (phe_cap && (priv->is_11ax_enabled == MTRUE)) { + if (phe_cap && + (priv->is_11ax_enabled == MTRUE)) { PRINTM(MCMND, "STA supports 11ax\n"); sta_ptr->is_11ax_enabled = MTRUE; - memcpy_ext(priv->adapter, - (t_u8 *)&sta_ptr->he_cap, - phe_cap, - phe_cap->ieee_hdr.len + - sizeof(IEEEtypes_Header_t), - sizeof(IEEEtypes_HECap_t)); - sta_ptr->he_cap.ieee_hdr.len = - MIN(phe_cap->ieee_hdr.len, - sizeof(IEEEtypes_HECap_t) - - sizeof(IEEEtypes_Header_t)); + memcpy_ext( + priv->adapter, + (t_u8 *)&sta_ptr->he_cap, + phe_cap, + phe_cap->ieee_hdr.len + + sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_HECap_t)); + sta_ptr->he_cap.ieee_hdr.len = MIN( + phe_cap->ieee_hdr.len, + sizeof(IEEEtypes_HECap_t) - + sizeof(IEEEtypes_Header_t)); } else { PRINTM(MCMND, "STA doesn't support 11ax\n"); } #ifdef UAP_SUPPORT /* Note: iphone6 does not have ERP_INFO */ - ext_rate = - wlan_get_specific_ie(priv, assoc_req_ie, - ie_len, - EXTENDED_SUPPORTED_RATES, - 0); - erp = wlan_get_specific_ie(priv, assoc_req_ie, - ie_len, ERP_INFO, 0); - if (!ext_rate) - PRINTM(MCMND, - "STA doesn't support EXTENDED_SUPPORTED_RATES\n"); - if (!erp) - PRINTM(MCMND, - "STA doesn't support ERP_INFO\n"); + rate = wlan_get_specific_ie(priv, assoc_req_ie, + ie_len, + SUPPORTED_RATES, 0); + if (rate) + b_only = wlan_check_ie_11b_support_rates( + (pIEEEtypes_Generic_t)rate); if (sta_ptr->is_11ax_enabled) { if (priv->uap_channel <= 14) sta_ptr->bandmode = BAND_GAX; @@ -3678,20 +3708,20 @@ sta_ptr->bandmode = BAND_GN; else sta_ptr->bandmode = BAND_AN; - } else if (ext_rate || erp) { - if (priv->uap_channel <= 14) - sta_ptr->bandmode = BAND_G; + } else if (priv->uap_channel <= 14) { + if (b_only) + sta_ptr->bandmode = BAND_B; else - sta_ptr->bandmode = BAND_A; + sta_ptr->bandmode = BAND_G; } else - sta_ptr->bandmode = BAND_B; + sta_ptr->bandmode = BAND_A; #endif #ifdef DRV_EMBEDDED_AUTHENTICATOR if (IsAuthenticatorEnabled(priv->psapriv)) - authenticator_get_sta_security_info - (priv->psapriv, - sta_ptr->cm_connectioninfo, - assoc_req_ie, ie_len); + authenticator_get_sta_security_info( + priv->psapriv, + sta_ptr->cm_connectioninfo, + assoc_req_ie, ie_len); #endif break; } @@ -3714,8 +3744,7 @@ * * @return MTRUE/MFALSE */ -t_u8 -wlan_is_wmm_ie_present(pmlan_adapter pmadapter, t_u8 *pbuf, t_u16 buf_len) +t_u8 wlan_is_wmm_ie_present(pmlan_adapter pmadapter, t_u8 *pbuf, t_u16 buf_len) { t_u16 bytes_left = buf_len; IEEEtypes_ElementId_e element_id; @@ -3723,7 +3752,7 @@ t_u8 element_len; t_u16 total_ie_len; IEEEtypes_VendorSpecific_t *pvendor_ie; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; t_u8 find_wmm_ie = MFALSE; ENTER(); @@ -3736,7 +3765,7 @@ if (bytes_left < total_ie_len) { PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + "bytes left < IE length\n"); bytes_left = 0; continue; } @@ -3775,9 +3804,8 @@ * * @return ie's poiner or MNULL */ -t_u8 * -wlan_get_specific_ie(pmlan_private priv, t_u8 *ie_buf, t_u8 ie_len, - IEEEtypes_ElementId_e id, t_u8 ext_id) +t_u8 *wlan_get_specific_ie(pmlan_private priv, t_u8 *ie_buf, t_u8 ie_len, + IEEEtypes_ElementId_e id, t_u8 ext_id) { t_u32 bytes_left = ie_len; t_u8 *pcurrent_ptr = ie_buf; @@ -3797,7 +3825,7 @@ total_ie_len = element_len + sizeof(IEEEtypes_Header_t); if (bytes_left < total_ie_len) { PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + "bytes left < IE length\n"); break; } if ((!ext_id && element_id == id) || @@ -3826,8 +3854,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -mlan_status -wlan_get_pm_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_pm_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pm_cfg = MNULL; @@ -3844,7 +3872,7 @@ #if defined(SDIO) || defined(PCIE) || wlan_pending_interrupt(pmadapter) #endif - ) { + ) { pm_cfg->param.ps_info.is_suspend_allowed = MFALSE; #if defined(SDIO) || defined(PCIE) PRINTM(MIOCTL, @@ -3876,8 +3904,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -mlan_status -wlan_get_hs_wakeup_reason(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_get_hs_wakeup_reason(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; pmlan_ds_pm_cfg pm_cfg = MNULL; @@ -3907,8 +3935,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_radio_ioctl_radio_ctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_radio_ioctl_radio_ctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_radio_cfg *radio_cfg = MNULL; @@ -3953,8 +3981,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3972,9 +4000,12 @@ if (pioctl_req->action == MLAN_ACT_SET) { /* User input validation */ if (IS_STREAM_2X2(pmadapter->feature_control)) { -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDNW62X(pmadapter->card_type)) { ant_cfg->tx_antenna &= 0x0303; ant_cfg->rx_antenna &= 0x0303; /** 2G antcfg TX */ @@ -3996,9 +4027,8 @@ /* 2G antcfg RX */ if (ant_cfg->rx_antenna & 0x00FF) { pmadapter->user_htstream &= ~0xF; - pmadapter->user_htstream |= - bitcount(ant_cfg-> - rx_antenna & 0x00FF); + pmadapter->user_htstream |= bitcount( + ant_cfg->rx_antenna & 0x00FF); } /* 5G antcfg RX */ if (ant_cfg->rx_antenna & 0xFF00) { @@ -4018,14 +4048,16 @@ ant_cfg->tx_antenna &= 0x0003; ant_cfg->rx_antenna &= 0x0003; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) } #endif if (!ant_cfg->tx_antenna || bitcount(ant_cfg->tx_antenna & 0x00FF) > - pmadapter->number_of_antenna || + pmadapter->number_of_antenna || bitcount(ant_cfg->tx_antenna & 0xFF00) > - pmadapter->number_of_antenna) { + pmadapter->number_of_antenna) { PRINTM(MERROR, "Invalid TX antenna setting: 0x%x\n", ant_cfg->tx_antenna); @@ -4036,9 +4068,9 @@ } if (ant_cfg->rx_antenna) { if (bitcount(ant_cfg->rx_antenna & 0x00FF) > - pmadapter->number_of_antenna || + pmadapter->number_of_antenna || bitcount(ant_cfg->rx_antenna & 0xFF00) > - pmadapter->number_of_antenna) { + pmadapter->number_of_antenna) { PRINTM(MERROR, "Invalid RX antenna setting: 0x%x\n", ant_cfg->rx_antenna); @@ -4071,7 +4103,8 @@ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_RF_ANTENNA, cmd_action, 0, (t_void *)pioctl_req, (IS_STREAM_2X2(pmadapter->feature_control)) ? - (t_void *)ant_cfg : (t_void *)ant_cfg_1x1); + (t_void *)ant_cfg : + (t_void *)ant_cfg_1x1); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -4089,9 +4122,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_rate_ioctl_get_rate_bitmap(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_get_rate_bitmap(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4117,9 +4149,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_rate_ioctl_set_rate_bitmap(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_set_rate_bitmap(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_rate *ds_rate = MNULL; mlan_status ret = MLAN_STATUS_FAILURE; @@ -4163,9 +4194,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_rate_ioctl_get_rate_value(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_get_rate_value(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_rate *rate = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4224,9 +4254,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_rate_ioctl_set_rate_value(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_set_rate_value(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_rate *ds_rate = MNULL; WLAN_802_11_RATES rates; @@ -4254,14 +4283,15 @@ bitmap_rates[9] = 0x3FFF; /* Support all VHT-MCSs rate */ for (i = 0; i < NELEMENTS(pmpriv->bitmap_rates) - 10; i++) - bitmap_rates[i + 10] = 0x03FF; /* 10 Bits valid */ + bitmap_rates[i + 10] = 0x03FF; /* 10 Bits valid */ } else { memset(pmadapter, rates, 0, sizeof(rates)); wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) ? - pmpriv->config_bands : - pmadapter->adhoc_start_band, rates); + pmpriv->config_bands : + pmadapter->adhoc_start_band, + rates); rate = rates; for (i = 0; (rate[i] && i < WLAN_SUPPORTED_RATES); i++) { PRINTM(MINFO, "Rate=0x%X Wanted=0x%X\n", rate[i], @@ -4274,21 +4304,21 @@ (i == WLAN_SUPPORTED_RATES)) { PRINTM(MERROR, "The fixed data rate 0x%X is out " - "of range\n", ds_rate->param.rate_cfg.rate); + "of range\n", + ds_rate->param.rate_cfg.rate); pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; goto exit; } memset(pmadapter, bitmap_rates, 0, sizeof(bitmap_rates)); - rate_index = - wlan_data_rate_to_index(pmadapter, - ds_rate->param.rate_cfg.rate); + rate_index = wlan_data_rate_to_index( + pmadapter, ds_rate->param.rate_cfg.rate); /* Only allow b/g rates to be set */ if (rate_index >= MLAN_RATE_INDEX_HRDSSS0 && rate_index <= MLAN_RATE_INDEX_HRDSSS3) bitmap_rates[0] = 1 << rate_index; else { - rate_index -= 1; /* There is a 0x00 in the table */ + rate_index -= 1; /* There is a 0x00 in the table */ if (rate_index >= MLAN_RATE_INDEX_OFDM0 && rate_index <= MLAN_RATE_INDEX_OFDM7) bitmap_rates[1] = 1 << (rate_index - @@ -4316,9 +4346,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_rate_ioctl_get_rate_index(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_get_rate_index(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4344,9 +4373,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_rate_ioctl_set_rate_index(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl_set_rate_index(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { t_u32 rate_index; t_u32 rate_format; @@ -4379,7 +4407,7 @@ /* [10..17] VHT */ /* Support all VHT-MCSs rate for NSS 1 and 2 */ for (i = 10; i < 12; i++) - bitmap_rates[i] = 0x03FF; /* 10 Bits valid */ + bitmap_rates[i] = 0x03FF; /* 10 Bits valid */ /* Set to 0 as default value for all other NSSs */ for (i = 12; i < 17; i++) bitmap_rates[i] = 0x0; @@ -4436,8 +4464,7 @@ if ((rate_index <= MLAN_RATE_INDEX_MCS11) && (MLAN_RATE_NSS1 <= nss) && (nss <= MLAN_RATE_NSS2)) { - bitmap_rates[18 + nss - - MLAN_RATE_NSS1] = + bitmap_rates[18 + nss - MLAN_RATE_NSS1] = (1 << rate_index); ret = MLAN_STATUS_SUCCESS; } @@ -4489,8 +4516,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_rate_ioctl_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_rate_ioctl_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_rate *rate = MNULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -4533,9 +4560,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_rate_ioctl_get_data_rate(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_rate_ioctl_get_data_rate(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4567,9 +4593,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_radio_ioctl_remain_chan_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_radio_ioctl_remain_chan_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_radio_cfg *radio_cfg = MNULL; @@ -4605,9 +4630,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_bss_ioctl_wifi_direct_mode(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_bss_ioctl_wifi_direct_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = MNULL; @@ -4644,8 +4668,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_p2p_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_p2p_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -4681,9 +4705,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_gpio_tsf_latch_config(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_gpio_tsf_latch_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -4718,8 +4741,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_get_tsf_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_get_tsf_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -4751,9 +4774,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_coalesce_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_coalesce_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -4788,8 +4810,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_aggr_ctrl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_aggr_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -4826,9 +4848,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_usb_aggr_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_usb_aggr_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -4873,8 +4894,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_txcontrol(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_txcontrol(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -4892,18 +4913,16 @@ return ret; } -#ifdef RX_PACKET_COALESCE /** - * @brief Get/Set RX packet coalescing configuration + * @brief Get/Set channel time and buffer weight configuration * * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_rx_pkt_coalesce_config(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_multi_chan_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -4920,9 +4939,9 @@ cmd_action = HostCmd_ACT_GEN_GET; /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_RX_PKT_COALESCE_CFG, + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MULTI_CHAN_CONFIG, cmd_action, 0, (t_void *)pioctl_req, - &misc->param.rx_coalesce); + &misc->param.multi_chan_cfg); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -4930,7 +4949,86 @@ LEAVE(); return ret; } -#endif + +/** + * @brief Get/Set multi-channel policy setting + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_misc_ioctl_multi_chan_policy(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = MNULL; + t_u16 cmd_action = 0; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (pioctl_req->action == MLAN_ACT_SET) { + if (pmadapter->dfs_repeater) { + PRINTM(MMSG, + "DFS-Repeater is on, can not enable DRCS\n"); + ret = MLAN_STATUS_FAILURE; + goto fail; + } + cmd_action = HostCmd_ACT_GEN_SET; + } else { + cmd_action = HostCmd_ACT_GEN_GET; + } + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MULTI_CHAN_POLICY, + cmd_action, 0, (t_void *)pioctl_req, + &misc->param.multi_chan_policy); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; +fail: + LEAVE(); + return ret; +} + +/** + * @brief Get/Set DRCS configuration + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_misc_ioctl_drcs_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = MNULL; + t_u16 cmd_action = 0; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else + cmd_action = HostCmd_ACT_GEN_GET; + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_DRCS_CONFIG, cmd_action, 0, + (t_void *)pioctl_req, &misc->param.drcs_cfg); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} /** * @brief Is any uAP started or STA connected? @@ -4939,8 +5037,7 @@ * * @return MTRUE/MFALSE */ -t_bool -wlan_check_interface_active(mlan_adapter *pmadapter) +t_bool wlan_check_interface_active(mlan_adapter *pmadapter) { t_bool ret = MFALSE; pmlan_private pmpriv; @@ -4957,7 +5054,7 @@ ret = pmpriv->uap_bss_started; else #endif - if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) + if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) ret = pmpriv->media_connected; } if (ret) @@ -4975,9 +5072,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_dfs_repeater_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_dfs_repeater_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -4994,11 +5090,19 @@ */ if (wlan_check_interface_active(pmadapter)) { PRINTM(MMSG, "DFS-Repeater active priv found," - " skip enabling the mode.\n"); + " skip enabling the mode.\n"); ret = MLAN_STATUS_FAILURE; goto done; } + /* If DRCS is on then we should not set + * DFS-repeater mode */ + if (pmadapter->mc_policy) { + PRINTM(MERROR, + "DFS-repeater cannot be started when DRCS is on\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } cmd_action = HostCmd_ACT_GEN_SET; } else { cmd_action = HostCmd_ACT_GEN_GET; @@ -5024,9 +5128,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_low_pwr_mode(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_low_pwr_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -5056,9 +5159,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_pmic_configure(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_pmic_configure(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -5084,8 +5186,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_cwmode_ctrl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_cwmode_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -5122,8 +5224,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -inline mlan_status -push_n(pmlan_adapter pmadapter, mef_stack *s, t_u8 len, t_u8 *val) +inline mlan_status push_n(pmlan_adapter pmadapter, mef_stack *s, t_u8 len, + t_u8 *val) { if ((s->sp + len) <= MAX_NUM_STACK_BYTES) { memcpy_ext(pmadapter, s->byte + s->sp, val, len, @@ -5145,8 +5247,7 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -inline mlan_status -mef_push(pmlan_adapter pmadapter, mef_stack *s, mef_op *op) +inline mlan_status mef_push(pmlan_adapter pmadapter, mef_stack *s, mef_op *op) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 nbytes; @@ -5161,10 +5262,10 @@ case OPERAND_BYTE_SEQ: nbytes = op->val[0]; if (MLAN_STATUS_SUCCESS == - push_n(pmadapter, s, nbytes, op->val + 1) && + push_n(pmadapter, s, nbytes, op->val + 1) && MLAN_STATUS_SUCCESS == push_n(pmadapter, s, 1, op->val) && MLAN_STATUS_SUCCESS == - push_n(pmadapter, s, 1, &op->operand_type)) + push_n(pmadapter, s, 1, &op->operand_type)) ret = MLAN_STATUS_SUCCESS; else ret = MLAN_STATUS_FAILURE; @@ -5185,8 +5286,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -static mlan_status -push_filter_dnum_eq(pmlan_adapter pmadapter, mef_stack *s, mef_filter_t *filter) +static mlan_status push_filter_dnum_eq(pmlan_adapter pmadapter, mef_stack *s, + mef_filter_t *filter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 dnum; @@ -5256,8 +5357,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -static mlan_status -push_filter_byte_eq(pmlan_adapter pmadapter, mef_stack *s, mef_filter_t *filter) +static mlan_status push_filter_byte_eq(pmlan_adapter pmadapter, mef_stack *s, + mef_filter_t *filter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 dnum; @@ -5328,8 +5429,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -static mlan_status -push_filter_bit_eq(pmlan_adapter pmadapter, mef_stack *s, mef_filter_t *filter) +static mlan_status push_filter_bit_eq(pmlan_adapter pmadapter, mef_stack *s, + mef_filter_t *filter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 dnum; @@ -5401,8 +5502,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -static mlan_status -wlan_push_filter(pmlan_adapter pmadapter, mef_stack *s, mef_filter_t *filter) +static mlan_status wlan_push_filter(pmlan_adapter pmadapter, mef_stack *s, + mef_filter_t *filter) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5433,9 +5534,9 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -static mlan_status -wlan_generate_mef_filter_stack(pmlan_adapter pmadapter, - mef_stack *s, mef_entry_t *entry) +static mlan_status wlan_generate_mef_filter_stack(pmlan_adapter pmadapter, + mef_stack *s, + mef_entry_t *entry) { mlan_status ret = MLAN_STATUS_SUCCESS; mef_op op; @@ -5473,9 +5574,8 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -mlan_status -wlan_set_mef_entry(mlan_private *pmpriv, - pmlan_adapter pmadapter, mef_cfg_data * pmef) +mlan_status wlan_set_mef_entry(mlan_private *pmpriv, pmlan_adapter pmadapter, + mef_cfg_data *pmef) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cmd *hostcmd; @@ -5560,38 +5660,41 @@ * * @return MLAN_STATUS_SUCCESS or FAIL */ -mlan_status -wlan_process_mef_cfg_cmd(mlan_private *pmpriv, pmlan_adapter pmadapter) +mlan_status wlan_process_mef_cfg_cmd(mlan_private *pmpriv, + pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb; mef_cfg_data mef; - mef_entry_t *pentry; + mef_entry_t *pentry = MNULL; mef_entry *pmef; t_u16 entry_num = 0; ENTER(); pcb = &pmadapter->callbacks; + memset(pmadapter, &mef, 0, sizeof(mef_cfg_data)); /** check how many entries in adapter*/ pmef = &pmadapter->entry_cfg; entry_num += pmef->enable_autoarp_entry; entry_num += pmef->num_wowlan_entry; entry_num += pmef->num_ipv6_ns_offload; - if (!entry_num) { + if (!entry_num && !pmef->clear_mef_entry) { PRINTM(MIOCTL, "No filter entries\n"); goto done; } - - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - sizeof(mef_entry_t) * entry_num, MLAN_MEM_DEF, - (t_u8 **)&mef.pentry); - if (ret != MLAN_STATUS_SUCCESS || mef.pentry == MNULL) { - PRINTM(MERROR, "Failed to allocate cmd data buffer\n"); - ret = MLAN_STATUS_FAILURE; - goto err_handle; + if (entry_num) { + ret = pcb->moal_malloc(pmadapter->pmoal_handle, + sizeof(mef_entry_t) * entry_num, + MLAN_MEM_DEF, (t_u8 **)&mef.pentry); + if (ret != MLAN_STATUS_SUCCESS || mef.pentry == MNULL) { + PRINTM(MERROR, "Failed to allocate cmd data buffer\n"); + ret = MLAN_STATUS_FAILURE; + goto err_handle; + } } + /** Fill mef_cfg structure*/ mef.criteria = pmef->criteria; mef.entry_num = entry_num; @@ -5635,8 +5738,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_misc_ioctl_mef_flt_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_mef_flt_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -5674,16 +5777,31 @@ sizeof(mef_entry_t), sizeof(mef_entry_t)); if (MLAN_STATUS_SUCCESS != - wlan_process_mef_cfg_cmd(pmadapter-> - priv[pioctl_req-> - bss_index], - pmadapter)) + wlan_process_mef_cfg_cmd( + pmadapter + ->priv[pioctl_req->bss_index], + pmadapter)) PRINTM(MERROR, "Set MEF Entries Error\n"); - } else if (mef_cfg->op_code & MLAN_IPADDR_OP_IP_REMOVE) { + } else if (!(mef_cfg->op_code & + MLAN_IPADDR_OP_IP_REMOVE)) { pmef->enable_autoarp_entry = 0; + pmef->num_wowlan_entry = 0; + pmef->num_ipv6_ns_offload = 0; + pmef->clear_mef_entry = 1; memset(pmadapter, &pmef->entry[5], 0, sizeof(mef_entry_t)); + memset(pmadapter, &pmef->entry[6], 0, + sizeof(mef_entry_t)); + memset(pmadapter, &pmef->entry[7], 0, + sizeof(mef_entry_t)); + if (MLAN_STATUS_SUCCESS != + wlan_process_mef_cfg_cmd( + pmadapter + ->priv[pioctl_req->bss_index], + pmadapter)) + PRINTM(MERROR, + "Clear MEF Entries Error\n"); } } break; @@ -5711,8 +5829,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_sec_ioctl_passphrase(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_sec_ioctl_passphrase(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -5729,9 +5847,9 @@ if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA && !IS_FW_SUPPORT_SUPPLICANT(pmpriv->adapter)) { if (sec->param.passphrase.psk_type == MLAN_PSK_QUERY) - SupplicantQueryPassphrase(pmpriv->psapriv, - (void *)&sec->param. - passphrase); + SupplicantQueryPassphrase( + pmpriv->psapriv, + (void *)&sec->param.passphrase); else if (sec->param.passphrase.psk_type == MLAN_PSK_CLEAR) SupplicantClearPMK(pmpriv->psapriv, (void *)&sec->param.passphrase); @@ -5761,10 +5879,10 @@ #ifdef STA_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA && sec->param.passphrase.ssid.ssid_len == 0) { - i = wlan_find_bssid_in_list(pmpriv, - (t_u8 *)&sec->param. - passphrase.bssid, - MLAN_BSS_MODE_AUTO); + i = wlan_find_bssid_in_list( + pmpriv, + (t_u8 *)&sec->param.passphrase.bssid, + MLAN_BSS_MODE_AUTO); if (i >= 0) { pbss_desc = &pmadapter->pscan_table[i]; memcpy_ext(pmadapter, @@ -5805,8 +5923,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_per_pkt_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_per_pkt_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -5831,8 +5949,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_region(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_region(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -5871,7 +5989,7 @@ pmadapter->cfp_code_a = misc->param.region_code; if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->adhoc_start_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; ret = MLAN_STATUS_FAILURE; } @@ -5890,8 +6008,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_ind_rst_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_ind_rst_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -5925,8 +6043,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_get_tsf(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_get_tsf(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5960,8 +6078,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_chan_reg_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_chan_reg_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5995,9 +6113,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_ioctl_operclass_validation(pmlan_adapter pmadapter, - mlan_ioctl_req *pioctl_req) +mlan_status wlan_misc_ioctl_operclass_validation(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -6030,8 +6147,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_get_rgchnpwr_cfg(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +mlan_status wlan_get_rgchnpwr_cfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -6053,6 +6170,111 @@ } /** + * @brief Get/Set mc_aggr_cfg + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_ioctl_mc_aggr_cfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + cmd_action = pioctl_req->action; + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MC_AGGR_CFG, cmd_action, 0, + (t_void *)pioctl_req, + (t_void *)&misc->param.mc_aggr_cfg); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} +/** + * @brief get channel load results + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_ioctl_ch_load_results(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + mlan_private *pmpriv = MNULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + if (pioctl_req == MNULL) + return MLAN_STATUS_FAILURE; + pmpriv = pmadapter->priv[pioctl_req->bss_index]; + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + cmd_action = pioctl_req->action; + + /* Send request to firmware */ + if (pmpriv->ch_load_param == 255) { + return MLAN_STATUS_FAILURE; + } else { + misc->param.ch_load.ch_load_param = pmpriv->ch_load_param; + misc->param.ch_load.noise = pmpriv->noise; + misc->param.ch_load.rx_quality = pmpriv->rx_quality; + } + + LEAVE(); + return ret; +} + +/** + * @brief get channel load + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_ioctl_ch_load(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + mlan_private *pmpriv = MNULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + if (pioctl_req == MNULL) + return MLAN_STATUS_FAILURE; + pmpriv = pmadapter->priv[pioctl_req->bss_index]; + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + cmd_action = pioctl_req->action; + + /* Send request to firmware */ + pmpriv->ch_load_param = 255; /* Default value for identifying + update/non-updated value*/ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_GET_CH_LOAD, cmd_action, 0, + (t_void *)pioctl_req, + (t_void *)&misc->param.ch_load); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief Get CHAN_TPRC setting * * @param pmadapter A pointer to mlan_adapter structure @@ -6060,8 +6282,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_get_chan_trpc_cfg(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +mlan_status wlan_get_chan_trpc_cfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -6093,8 +6315,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_ioctl_oper_class(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +mlan_status wlan_misc_ioctl_oper_class(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -6142,9 +6364,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_ioctl_fw_dump_event(pmlan_adapter pmadapter, - mlan_ioctl_req *pioctl_req) +mlan_status wlan_misc_ioctl_fw_dump_event(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; t_u16 cmd_action = 0; @@ -6174,6 +6395,48 @@ } /** + * @brief Set/Get the network monitor configuration. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_ioctl_net_monitor(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv; + mlan_ds_misc_cfg *misc; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + + ENTER(); + + if (!pioctl_req) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else + cmd_action = HostCmd_ACT_GEN_GET; + + /* Send command to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_NET_MONITOR, + cmd_action, 0, (t_void *)pioctl_req, + &misc->param.net_mon); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief config boot sleep * * @param pmadapter A pointer to mlan_adapter structure @@ -6181,8 +6444,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_bootsleep(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_bootsleep(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -6223,8 +6486,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { t_u32 i, global_band = 0; t_u32 infra_band = 0; @@ -6261,7 +6524,7 @@ if (pmadapter->priv[i] && pmadapter->priv[i] != pmpriv && GET_BSS_ROLE(pmadapter->priv[i]) == - MLAN_BSS_ROLE_STA) + MLAN_BSS_ROLE_STA) global_band |= (t_u32)pmadapter->priv[i]->config_bands; } @@ -6293,16 +6556,14 @@ * adhoc channel compiles with new adhoc_band */ if (!adhoc_channel) { - if (!wlan_find_cfp_by_band_and_channel - (pmadapter, pmadapter->adhoc_start_band, - pmpriv->adhoc_channel)) { + if (!wlan_find_cfp_by_band_and_channel( + pmadapter, pmadapter->adhoc_start_band, + pmpriv->adhoc_channel)) { /* Pass back the default channel */ radio_cfg->param.band_cfg.adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - if ((pmadapter->adhoc_start_band & BAND_A) - ) { - radio_cfg->param.band_cfg. - adhoc_channel = + if ((pmadapter->adhoc_start_band & BAND_A)) { + radio_cfg->param.band_cfg.adhoc_channel = DEFAULT_AD_HOC_CHANNEL_A; } } @@ -6310,9 +6571,9 @@ /* Return error if adhoc_band and adhoc_channel * combination is invalid */ - if (!wlan_find_cfp_by_band_and_channel - (pmadapter, pmadapter->adhoc_start_band, - (t_u16)adhoc_channel)) { + if (!wlan_find_cfp_by_band_and_channel( + pmadapter, pmadapter->adhoc_start_band, + (t_u16)adhoc_channel)) { pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; LEAVE(); @@ -6351,8 +6612,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_rxabortcfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_rxabortcfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6374,7 +6635,6 @@ LEAVE(); return ret; } - /** * @brief Rx Abort Cfg ext * @@ -6383,9 +6643,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_rxabortcfg_ext(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_rxabortcfg_ext(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6416,9 +6675,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_dot11mc_unassoc_ftm_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_dot11mc_unassoc_ftm_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6449,9 +6707,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tx_ampdu_prot_mode(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tx_ampdu_prot_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6482,9 +6739,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_rate_adapt_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_rate_adapt_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6515,9 +6771,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_cck_desense_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_cck_desense_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6548,8 +6803,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_ioctl_dyn_bw(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +mlan_status wlan_misc_ioctl_dyn_bw(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -6589,9 +6844,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -mlan_status -wlan_power_ioctl_set_get_lpm(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +mlan_status wlan_power_ioctl_set_get_lpm(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -6625,8 +6879,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_rf_test_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_rf_test_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = MNULL; mlan_ds_misc_cfg *pmisc = MNULL; @@ -6675,6 +6929,19 @@ cmd_action, 0, (t_void *)pioctl_req, &(pmisc->param.mfg_tx_frame2)); break; + case MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME: + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else { + PRINTM(MERROR, "Unsupported cmd_action\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MFG_COMMAND, + cmd_action, 0, (t_void *)pioctl_req, + &(pmisc->param.mfg_tx_trigger_config)); + break; + case MLAN_OID_MISC_RF_TEST_HE_POWER: if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; @@ -6704,8 +6971,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_range_ext(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_range_ext(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -6726,7 +6993,98 @@ LEAVE(); return ret; +} +/** + * @brief Perform warm reset + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, MLAN_STATUS_FAILURE + */ +mlan_status wlan_misc_ioctl_warm_reset(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + pmlan_callbacks pcb = &pmadapter->callbacks; + pmlan_buffer pmbuf; + t_s32 i = 0; + t_u16 mc_policy = pmadapter->mc_policy; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + ENTER(); + mlan_block_rx_process(pmadapter, MTRUE); + + /* Cancel all pending commands and complete ioctls */ + if (misc->param.fw_reload) + wlan_cancel_all_pending_cmd(pmadapter, MTRUE); + + /** Init all the head nodes and free all the locks here */ + for (i = 0; i < pmadapter->priv_num; i++) + wlan_free_priv(pmadapter->priv[i]); + + while ((pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->rx_data_queue, + pcb->moal_spin_lock, pcb->moal_spin_unlock))) { + pmadapter->ops.data_complete(pmadapter, pmbuf, + MLAN_STATUS_FAILURE); + } + pmadapter->rx_pkts_queued = 0; + + /* Initialize adapter structure */ + wlan_init_adapter(pmadapter); + pmadapter->hw_status = WlanHardwareStatusInitializing; + + /* Initialize private structures */ + for (i = 0; i < pmadapter->priv_num; i++) { + if (pmadapter->priv[i]) + wlan_init_priv(pmadapter->priv[i]); + } + mlan_block_rx_process(pmadapter, MFALSE); + + if (misc->param.fw_reload != MTRUE) { + /* Restart the firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_FUNC_SHUTDOWN, + HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); + if (ret) + goto done; + } + + /* Issue firmware initialize commands for first BSS, + * for other interfaces it will be called after getting + * the last init command response of previous interface + */ + pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); + if (!pmpriv) { + ret = MLAN_STATUS_FAILURE; + LEAVE(); + return ret; + } + ret = wlan_adapter_get_hw_spec(pmpriv->adapter); + if (ret == MLAN_STATUS_FAILURE) { + LEAVE(); + return ret; + } + ret = pmpriv->ops.init_cmd(pmpriv, MTRUE); + if (ret == MLAN_STATUS_FAILURE) { + LEAVE(); + return ret; + } + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MULTI_CHAN_POLICY, + HostCmd_ACT_GEN_SET, 0, MNULL, &mc_policy); + if (ret == MLAN_STATUS_FAILURE) { + LEAVE(); + return ret; + } + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + if (ret == MLAN_STATUS_PENDING) + pmadapter->pwarm_reset_ioctl_req = pioctl_req; +done: + LEAVE(); + return ret; } #ifdef UAP_SUPPORT @@ -6738,9 +7096,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_wacp_mode(IN pmlan_adapter pmadapter, - IN pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_wacp_mode(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -6756,11 +7113,8 @@ else cmd_action = HostCmd_ACT_GEN_GET; - ret = wlan_prepare_cmd(pmpriv, - HOST_CMD_APCMD_SYS_CONFIGURE, - cmd_action, - 0, - (t_void *)pioctl_req, + ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_SYS_CONFIGURE, cmd_action, + 0, (t_void *)pioctl_req, (t_void *)&misc->param.wacp_mode); if (ret == MLAN_STATUS_SUCCESS) @@ -6770,3 +7124,100 @@ return ret; } #endif + +mlan_status wlan_misc_ioctl_get_sensor_temp(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + ENTER(); + + if (pioctl_req->action == MLAN_ACT_GET) + cmd_action = HostCmd_ACT_GEN_GET; + else { + PRINTM(MERROR, " Sensor temp only support get operation \n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_DS_GET_SENSOR_TEMP, cmd_action, + 0, (t_void *)pioctl_req, MNULL); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** + * @brief This function sets up country code and downloads CMD to FW + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req Pointer to the IOCTL request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_misc_ioctl_country_code(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_country_code *country_code = MNULL; + mlan_ds_misc_cfg *cfg_misc = MNULL; + t_u8 cfp_bg = 0, cfp_a = 0; + + ENTER(); + + cfg_misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + country_code = &cfg_misc->param.country_code; + + if (pioctl_req->action == MLAN_ACT_SET) { + if (pmadapter->otp_region && pmadapter->otp_region->force_reg) { + PRINTM(MERROR, + "ForceRegionRule is set in the on-chip OTP" + "memory\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + /* Update region code and table based on country code */ + if (wlan_misc_country_2_cfp_table_code( + pmadapter, country_code->country_code, &cfp_bg, + &cfp_a)) { + PRINTM(MERROR, "Country code not found!\n"); + pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; + ret = MLAN_STATUS_FAILURE; + goto done; + } + pmadapter->cfp_code_bg = cfp_bg; + pmadapter->cfp_code_a = cfp_a; + if (cfp_a) + pmadapter->region_code = cfp_a; + else if (cfp_bg) + pmadapter->region_code = cfp_bg; + else + pmadapter->region_code = 0; + if (wlan_set_regiontable(pmpriv, pmadapter->region_code, + pmadapter->config_bands | + pmadapter->adhoc_start_band)) { + pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; + ret = MLAN_STATUS_FAILURE; + goto done; + } + memcpy_ext(pmadapter, pmadapter->country_code, + country_code->country_code, COUNTRY_CODE_LEN, + COUNTRY_CODE_LEN); + } else { + /* GET operation */ + memcpy_ext(pmadapter, country_code->country_code, + pmadapter->country_code, COUNTRY_CODE_LEN, + COUNTRY_CODE_LEN); + } + +done: + LEAVE(); + return ret; +}
diff --git a/wlan_sd8987/mlan/mlan_module.c b/wlan_sd8987/mlan/mlan_module.c index 724c794..2281d45 100755 --- a/wlan_sd8987/mlan/mlan_module.c +++ b/wlan_sd8987/mlan/mlan_module.c
@@ -3,7 +3,7 @@ * @brief This file declares the exported symbols from MLAN. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlan/mlan_pcie.c b/wlan_sd8987/mlan/mlan_pcie.c index 2aa9e1a..297bb6e 100755 --- a/wlan_sd8987/mlan/mlan_pcie.c +++ b/wlan_sd8987/mlan/mlan_pcie.c
@@ -118,7 +118,7 @@ }; #endif -#ifdef PCIE9097 +#if defined(PCIE9097) || defined(PCIENW62X) static const struct _mlan_pcie_card_reg mlan_reg_pcie9097_b0 = { .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, .reg_txbd_wrptr = PCIE9098_TXBD_WRPTR, @@ -152,7 +152,7 @@ }; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) static const struct _mlan_pcie_card_reg mlan_reg_pcie9098 = { .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, .reg_txbd_wrptr = PCIE9098_TXBD_WRPTR, @@ -204,7 +204,7 @@ static mlan_status wlan_pcie_delete_evtbd_ring(pmlan_adapter pmadapter); static mlan_status wlan_pcie_delete_rxbd_ring(pmlan_adapter pmadapter); -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /** * @brief This function init the adma setting * @@ -216,9 +216,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, - t_u64 pbase, t_u16 size, t_u8 init) +static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, + t_u64 pbase, t_u16 size, t_u8 init) { t_u32 dma_cfg, dma_cfg2, dma_cfg3, int_mapping; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -343,7 +342,8 @@ dma_cfg2 |= ADMA_DST_ADDR_IS_HOST; } - if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSIX) { + if (pmadapter->pcard_pcie->pcie_int_mode == + PCIE_INT_MODE_MSIX) { if (pcb->moal_read_reg(pmadapter->pmoal_handle, q_addr + ADMA_MSIX_DOORBELL_DATA, &msix_data)) { @@ -356,11 +356,11 @@ msix_data &= ~ADMA_MSIX_PF_MASK; msix_data |= msix_vector; msix_data |= pmadapter->pcard_pcie->func_num - << ADMA_MSIX_PF_BIT; + << ADMA_MSIX_PF_BIT; PRINTM(MCMND, "msix_data=0x%x\n", msix_data); if (pcb->moal_write_reg(pmadapter->pmoal_handle, q_addr + - ADMA_MSIX_DOORBELL_DATA, + ADMA_MSIX_DOORBELL_DATA, (t_u32)msix_data)) { PRINTM(MERROR, "Failed to write DMA DOORBELL_DATA.\n"); @@ -408,10 +408,10 @@ } if (init) { /** Enable DMA done interrupt */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - q_addr + - ADMA_SRC_INT_STATUS_MASK, - DEF_ADMA_INT_MASK)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + q_addr + ADMA_SRC_INT_STATUS_MASK, + DEF_ADMA_INT_MASK)) { PRINTM(MERROR, "Failed to write ADMA_SRC_INT_STATUS_MASK.\n"); ret = MLAN_STATUS_FAILURE; @@ -457,10 +457,10 @@ } if (init && (dma_mode == DMA_MODE_DUAL_DESC)) { /** Enable DMA done interrupt */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - q_addr + - ADMA_DST_INT_STATUS_MASK, - DEF_ADMA_INT_MASK)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + q_addr + ADMA_DST_INT_STATUS_MASK, + DEF_ADMA_INT_MASK)) { PRINTM(MERROR, "Failed to write ADMA_SRC_INT_STATUS_MASK.\n"); ret = MLAN_STATUS_FAILURE; @@ -513,8 +513,7 @@ * * @return N/A */ -static void -wlan_pcie_init_adma_ring_size(mlan_adapter *pmadapter) +static void wlan_pcie_init_adma_ring_size(mlan_adapter *pmadapter) { t_u16 num_desc = 0; t_u16 ring_size = 0; @@ -543,7 +542,7 @@ #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /** * @brief This function set the host interrupt select mask * @@ -552,8 +551,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_set_host_int_select_mask(mlan_adapter *pmadapter, t_u8 enable) +static mlan_status wlan_pcie_set_host_int_select_mask(mlan_adapter *pmadapter, + t_u8 enable) { pmlan_callbacks pcb = &pmadapter->callbacks; t_u32 int_sel_mask = 0; @@ -576,8 +575,8 @@ if (!pmadapter->pcard_pcie->reg->msi_int_wr_clr) { /** enable read to clear interrupt */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_clr_sel, + pmadapter->pcard_pcie->reg + ->reg_host_int_clr_sel, int_clr_mask)) { PRINTM(MWARN, "enable read to clear interrupt failed\n"); @@ -591,7 +590,7 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /** * @brief This function handles command response completion * @@ -600,8 +599,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_vdll_complete(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_send_vdll_complete(mlan_adapter *pmadapter) { mlan_buffer *pcmdbuf; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -628,8 +626,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_vdll(mlan_adapter *pmadapter, mlan_buffer *pmbuf) +static mlan_status wlan_pcie_send_vdll(mlan_adapter *pmadapter, + mlan_buffer *pmbuf) { mlan_status ret = MLAN_STATUS_PENDING; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -646,10 +644,9 @@ *tmp = wlan_cpu_to_le16(MLAN_TYPE_VDLL); if (MLAN_STATUS_FAILURE == - pcb->moal_map_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + pmbuf->data_offset, - &pmbuf->buf_pa, pmbuf->data_len, - PCI_DMA_TODEVICE)) { + pcb->moal_map_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + &pmbuf->buf_pa, pmbuf->data_len, PCI_DMA_TODEVICE)) { PRINTM(MERROR, "PCIE - Download VDLL block: moal_map_memory failed\n"); ret = MLAN_STATUS_FAILURE; @@ -678,8 +675,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_disable_host_int_mask(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_disable_host_int_mask(mlan_adapter *pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; @@ -702,8 +698,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_enable_host_int_mask(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_enable_host_int_mask(mlan_adapter *pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); @@ -737,10 +732,10 @@ host_int_status_mask = pmadapter->pcard_pcie->reg->host_intr_mask; /* Enable host int status mask */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status_mask, - host_int_status_mask)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_host_int_status_mask, + host_int_status_mask)) { PRINTM(MWARN, "Enable host interrupt status mask failed\n"); LEAVE(); return MLAN_STATUS_FAILURE; @@ -756,8 +751,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_disable_pcie_host_int(mlan_adapter *pmadapter) +static mlan_status wlan_disable_pcie_host_int(mlan_adapter *pmadapter) { mlan_status ret; @@ -767,8 +761,9 @@ LEAVE(); return ret; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || + (pmadapter->card_type == CARD_TYPE_PCIENW62X) || (pmadapter->card_type == CARD_TYPE_PCIE9097)) { ret = wlan_pcie_set_host_int_select_mask(pmadapter, MFALSE); if (ret) { @@ -790,8 +785,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_clear_pending_int_status(mlan_adapter *pmadapter) +static mlan_status wlan_clear_pending_int_status(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 pcie_ireg = 0; @@ -812,8 +806,8 @@ PRINTM(MMSG, "pcie_ireg=0x%x\n", pcie_ireg); if (pmadapter->pcard_pcie->reg->msi_int_wr_clr) { if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status, + pmadapter->pcard_pcie->reg + ->reg_host_int_status, ~pcie_ireg)) { PRINTM(MERROR, "Write host int status register failed\n"); @@ -834,8 +828,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_enable_pcie_host_int(mlan_adapter *pmadapter) +static mlan_status wlan_enable_pcie_host_int(mlan_adapter *pmadapter) { mlan_status ret; @@ -846,8 +839,9 @@ LEAVE(); return ret; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || + (pmadapter->card_type == CARD_TYPE_PCIENW62X) || (pmadapter->card_type == CARD_TYPE_PCIE9097)) { ret = wlan_pcie_set_host_int_select_mask(pmadapter, MTRUE); if (ret) { @@ -868,8 +862,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -877,7 +870,7 @@ #if defined(PCIE8997) || defined(PCIE8897) pmlan_pcie_data_buf ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) padma_dual_desc_buf padma_bd_buf; #endif @@ -899,7 +892,7 @@ pmadapter->pcard_pcie->txrx_bd_size; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->txbd_ring_size = sizeof(adma_dual_desc_buf) * @@ -908,12 +901,10 @@ PRINTM(MINFO, "TX ring: allocating %d bytes\n", pmadapter->pcard_pcie->txbd_ring_size); - ret = pcb->moal_malloc_consistent(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->txbd_ring_size, - &pmadapter->pcard_pcie-> - txbd_ring_vbase, - &pmadapter->pcard_pcie-> - txbd_ring_pbase); + ret = pcb->moal_malloc_consistent( + pmadapter->pmoal_handle, pmadapter->pcard_pcie->txbd_ring_size, + &pmadapter->pcard_pcie->txbd_ring_vbase, + &pmadapter->pcard_pcie->txbd_ring_pbase); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "%s: No free moal_malloc_consistent\n", @@ -932,19 +923,20 @@ for (i = 0; i < pmadapter->pcard_pcie->txrx_bd_size; i++) { pmadapter->pcard_pcie->tx_buf_list[i] = MNULL; -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf - *) (pmadapter->pcard_pcie->txbd_ring_vbase + - (sizeof(adma_dual_desc_buf) * i)); + *)(pmadapter->pcard_pcie + ->txbd_ring_vbase + + (sizeof(adma_dual_desc_buf) * i)); pmadapter->pcard_pcie->txbd_ring[i] = (t_void *)padma_bd_buf; padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; - padma_bd_buf->flags = + padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_SRC_HOST | - ADMA_BD_FLAG_SOP | ADMA_BD_FLAG_EOP; + ADMA_BD_FLAG_SOP | ADMA_BD_FLAG_EOP); padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } @@ -954,8 +946,9 @@ if (!pmadapter->pcard_pcie->reg->use_adma) { ptx_bd_buf = (mlan_pcie_data_buf - *)(pmadapter->pcard_pcie->txbd_ring_vbase + - (sizeof(mlan_pcie_data_buf) * i)); + *)(pmadapter->pcard_pcie + ->txbd_ring_vbase + + (sizeof(mlan_pcie_data_buf) * i)); pmadapter->pcard_pcie->txbd_ring[i] = (t_void *)ptx_bd_buf; ptx_bd_buf->paddr = 0; @@ -977,8 +970,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) { t_u32 i; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -986,7 +978,7 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1006,8 +998,9 @@ pmadapter->pcard_pcie->tx_buf_list[i] = MNULL; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - ptx_bd_buf = (mlan_pcie_data_buf *) - pmadapter->pcard_pcie->txbd_ring[i]; + ptx_bd_buf = + (mlan_pcie_data_buf *) + pmadapter->pcard_pcie->txbd_ring[i]; if (ptx_bd_buf) { ptx_bd_buf->paddr = 0; @@ -1019,10 +1012,11 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { - padma_bd_buf = (adma_dual_desc_buf *) - pmadapter->pcard_pcie->txbd_ring[i]; + padma_bd_buf = + (adma_dual_desc_buf *) + pmadapter->pcard_pcie->txbd_ring[i]; if (padma_bd_buf) { padma_bd_buf->paddr = 0; @@ -1037,17 +1031,11 @@ } if (pmadapter->pcard_pcie->txbd_ring_vbase) { - pmadapter->callbacks.moal_mfree_consistent(pmadapter-> - pmoal_handle, - pmadapter-> - pcard_pcie-> - txbd_ring_size, - pmadapter-> - pcard_pcie-> - txbd_ring_vbase, - pmadapter-> - pcard_pcie-> - txbd_ring_pbase); + pmadapter->callbacks.moal_mfree_consistent( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->txbd_ring_size, + pmadapter->pcard_pcie->txbd_ring_vbase, + pmadapter->pcard_pcie->txbd_ring_pbase); } pmadapter->pcard_pcie->txbd_pending = 0; pmadapter->pcard_pcie->txbd_ring_size = 0; @@ -1067,8 +1055,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1077,7 +1064,7 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1094,14 +1081,14 @@ pmadapter->pcard_pcie->rxbd_wrptr = pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; /* allocate shared memory for the BD ring and divide the same in - to several descriptors */ + to several descriptors */ pmadapter->pcard_pcie->rxbd_ring_size = sizeof(mlan_pcie_data_buf) * pmadapter->pcard_pcie->txrx_bd_size; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /* * driver maintaines the write pointer and firmware maintaines the read * pointer. The read pointer starts at 0 (zero) while the write pointer @@ -1119,12 +1106,10 @@ PRINTM(MINFO, "RX ring: allocating %d bytes\n", pmadapter->pcard_pcie->rxbd_ring_size); - ret = pcb->moal_malloc_consistent(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->rxbd_ring_size, - &pmadapter->pcard_pcie-> - rxbd_ring_vbase, - &pmadapter->pcard_pcie-> - rxbd_ring_pbase); + ret = pcb->moal_malloc_consistent( + pmadapter->pmoal_handle, pmadapter->pcard_pcie->rxbd_ring_size, + &pmadapter->pcard_pcie->rxbd_ring_vbase, + &pmadapter->pcard_pcie->rxbd_ring_pbase); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "%s: No free moal_malloc_consistent\n", @@ -1179,31 +1164,36 @@ if (!pmadapter->pcard_pcie->reg->use_adma) { prxbd_buf = (mlan_pcie_data_buf - *)(pmadapter->pcard_pcie->rxbd_ring_vbase + - (sizeof(mlan_pcie_data_buf) * i)); + *)(pmadapter->pcard_pcie + ->rxbd_ring_vbase + + (sizeof(mlan_pcie_data_buf) * i)); pmadapter->pcard_pcie->rxbd_ring[i] = (t_void *)prxbd_buf; - prxbd_buf->paddr = pmbuf->buf_pa; - prxbd_buf->len = (t_u16)pmbuf->data_len; - prxbd_buf->flags = MLAN_BD_FLAG_SOP | MLAN_BD_FLAG_EOP; + prxbd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + prxbd_buf->len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); + prxbd_buf->flags = wlan_cpu_to_le16(MLAN_BD_FLAG_SOP | + MLAN_BD_FLAG_EOP); prxbd_buf->offset = 0; - prxbd_buf->frag_len = (t_u16)pmbuf->data_len; + prxbd_buf->frag_len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf - *) (pmadapter->pcard_pcie->rxbd_ring_vbase + - (sizeof(adma_dual_desc_buf) * i)); + *)(pmadapter->pcard_pcie + ->rxbd_ring_vbase + + (sizeof(adma_dual_desc_buf) * i)); pmadapter->pcard_pcie->rxbd_ring[i] = (t_void *)padma_bd_buf; - padma_bd_buf->paddr = pmbuf->buf_pa; - padma_bd_buf->len = - ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE); - padma_bd_buf->flags = - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + padma_bd_buf->len = wlan_cpu_to_le16( + ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE)); + padma_bd_buf->flags = wlan_cpu_to_le16( + ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } @@ -1221,8 +1211,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) { t_u32 i; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1230,7 +1219,7 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1243,15 +1232,15 @@ pmbuf->buf_pa, MLAN_RX_DATA_BUF_SIZE, PCI_DMA_FROMDEVICE); - wlan_free_mlan_buffer(pmadapter, - pmadapter->pcard_pcie-> - rx_buf_list[i]); + wlan_free_mlan_buffer( + pmadapter, + pmadapter->pcard_pcie->rx_buf_list[i]); } pmadapter->pcard_pcie->rx_buf_list[i] = MNULL; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { prxbd_buf = (mlan_pcie_data_buf *) - pmadapter->pcard_pcie->rxbd_ring[i]; + pmadapter->pcard_pcie->rxbd_ring[i]; if (prxbd_buf) { prxbd_buf->paddr = 0; @@ -1261,10 +1250,11 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { - padma_bd_buf = (adma_dual_desc_buf *) - pmadapter->pcard_pcie->rxbd_ring[i]; + padma_bd_buf = + (adma_dual_desc_buf *) + pmadapter->pcard_pcie->rxbd_ring[i]; if (padma_bd_buf) { padma_bd_buf->paddr = 0; @@ -1279,17 +1269,11 @@ } if (pmadapter->pcard_pcie->rxbd_ring_vbase) - pmadapter->callbacks.moal_mfree_consistent(pmadapter-> - pmoal_handle, - pmadapter-> - pcard_pcie-> - rxbd_ring_size, - pmadapter-> - pcard_pcie-> - rxbd_ring_vbase, - pmadapter-> - pcard_pcie-> - rxbd_ring_pbase); + pmadapter->callbacks.moal_mfree_consistent( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->rxbd_ring_size, + pmadapter->pcard_pcie->rxbd_ring_vbase, + pmadapter->pcard_pcie->rxbd_ring_pbase); pmadapter->pcard_pcie->rxbd_ring_size = 0; pmadapter->pcard_pcie->rxbd_rdptr = 0; pmadapter->pcard_pcie->rxbd_wrptr = 0; @@ -1307,8 +1291,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1318,7 +1301,7 @@ pmlan_pcie_evt_buf pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1337,7 +1320,7 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->evtbd_wrptr = MLAN_MAX_EVT_BD; pmadapter->pcard_pcie->evtbd_ring_size = @@ -1347,13 +1330,10 @@ PRINTM(MINFO, "Evt ring: allocating %d bytes\n", pmadapter->pcard_pcie->evtbd_ring_size); - ret = pcb->moal_malloc_consistent(pmadapter->pmoal_handle, - pmadapter->pcard_pcie-> - evtbd_ring_size, - &pmadapter->pcard_pcie-> - evtbd_ring_vbase, - &pmadapter->pcard_pcie-> - evtbd_ring_pbase); + ret = pcb->moal_malloc_consistent( + pmadapter->pmoal_handle, pmadapter->pcard_pcie->evtbd_ring_size, + &pmadapter->pcard_pcie->evtbd_ring_vbase, + &pmadapter->pcard_pcie->evtbd_ring_pbase); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "%s: No free moal_malloc_consistent\n", @@ -1395,33 +1375,37 @@ LEAVE(); return MLAN_STATUS_FAILURE; } + #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { pevtbd_buf = (mlan_pcie_evt_buf - *)(pmadapter->pcard_pcie->evtbd_ring_vbase + - (sizeof(mlan_pcie_evt_buf) * i)); + *)(pmadapter->pcard_pcie + ->evtbd_ring_vbase + + (sizeof(mlan_pcie_evt_buf) * i)); pmadapter->pcard_pcie->evtbd_ring[i] = (t_void *)pevtbd_buf; - pevtbd_buf->paddr = pmbuf->buf_pa; - pevtbd_buf->len = (t_u16)pmbuf->data_len; + pevtbd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + pevtbd_buf->len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); pevtbd_buf->flags = 0; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf - *) (pmadapter->pcard_pcie->evtbd_ring_vbase + - (sizeof(adma_dual_desc_buf) * i)); + *)(pmadapter->pcard_pcie + ->evtbd_ring_vbase + + (sizeof(adma_dual_desc_buf) * i)); pmadapter->pcard_pcie->evtbd_ring[i] = (t_void *)padma_bd_buf; - padma_bd_buf->paddr = pmbuf->buf_pa; - padma_bd_buf->len = - ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE); - padma_bd_buf->flags = - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + padma_bd_buf->len = wlan_cpu_to_le16( + ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE)); + padma_bd_buf->flags = wlan_cpu_to_le16( + ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } @@ -1439,8 +1423,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) { t_u32 i; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1448,7 +1431,7 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1466,8 +1449,9 @@ pmadapter->pcard_pcie->evt_buf_list[i] = MNULL; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - pevtbd_buf = (mlan_pcie_evt_buf *) - pmadapter->pcard_pcie->evtbd_ring[i]; + pevtbd_buf = + (mlan_pcie_evt_buf *) + pmadapter->pcard_pcie->evtbd_ring[i]; if (pevtbd_buf) { pevtbd_buf->paddr = 0; @@ -1477,10 +1461,11 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { - padma_bd_buf = (adma_dual_desc_buf *) - pmadapter->pcard_pcie->evtbd_ring[i]; + padma_bd_buf = + (adma_dual_desc_buf *) + pmadapter->pcard_pcie->evtbd_ring[i]; if (padma_bd_buf) { padma_bd_buf->paddr = 0; @@ -1495,17 +1480,11 @@ } if (pmadapter->pcard_pcie->evtbd_ring_vbase) - pmadapter->callbacks.moal_mfree_consistent(pmadapter-> - pmoal_handle, - pmadapter-> - pcard_pcie-> - evtbd_ring_size, - pmadapter-> - pcard_pcie-> - evtbd_ring_vbase, - pmadapter-> - pcard_pcie-> - evtbd_ring_pbase); + pmadapter->callbacks.moal_mfree_consistent( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->evtbd_ring_size, + pmadapter->pcard_pcie->evtbd_ring_vbase, + pmadapter->pcard_pcie->evtbd_ring_pbase); pmadapter->pcard_pcie->evtbd_rdptr = 0; pmadapter->pcard_pcie->evtbd_wrptr = 0; @@ -1524,8 +1503,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_alloc_cmdrsp_buf(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_alloc_cmdrsp_buf(mlan_adapter *pmadapter) { mlan_buffer *pmbuf = MNULL; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1575,8 +1553,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_delete_cmdrsp_buf(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_delete_cmdrsp_buf(mlan_adapter *pmadapter) { mlan_buffer *pmbuf = MNULL; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1594,12 +1571,10 @@ cmdrsp_vbase = pmbuf->pbuf; cmdrsp_pbase = pmbuf->buf_pa; if (cmdrsp_vbase) - pmadapter->callbacks.moal_mfree_consistent(pmadapter-> - pmoal_handle, - pmbuf-> - total_pcie_buf_len, - cmdrsp_vbase, - cmdrsp_pbase); + pmadapter->callbacks.moal_mfree_consistent( + pmadapter->pmoal_handle, + pmbuf->total_pcie_buf_len, cmdrsp_vbase, + cmdrsp_pbase); wlan_free_mlan_buffer(pmadapter, pmbuf); pmadapter->pcard_pcie->cmdrsp_buf = MNULL; } @@ -1627,8 +1602,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_flush_txbd_ring(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_flush_txbd_ring(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1644,9 +1618,10 @@ pmadapter->pcard_pcie->txbd_flush = MTRUE; /* write pointer already set at last send */ /* send dnld-rdy intr again, wait for completion */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_event, CPU_INTR_DNLD_RDY)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_cpu_int_event, + CPU_INTR_DNLD_RDY)) { PRINTM(MERROR, "SEND DATA (FLUSH): failed to assert dnld-rdy interrupt.\n"); ret = MLAN_STATUS_FAILURE; @@ -1666,8 +1641,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_check_tx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) +static t_u8 wlan_check_tx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) { #if defined(PCIE8997) || defined(PCIE8897) t_u32 txrx_rw_ptr_mask = pmadapter->pcard_pcie->reg->txrx_rw_ptr_mask; @@ -1684,7 +1658,7 @@ return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->txbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -1703,8 +1677,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_data_complete(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) { const t_u32 num_tx_buffs = pmadapter->pcard_pcie->txrx_bd_size; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1719,7 +1692,7 @@ pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; t_u32 wrptr; #endif @@ -1743,7 +1716,7 @@ rdptr = rdptr >> TXBD_RW_PTR_START; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { wrptr = rdptr & 0xffff; rdptr = rdptr >> ADMA_RPTR_START; @@ -1763,12 +1736,10 @@ "SEND DATA COMP: Detach pmbuf %p at tx_ring[%d], pmadapter->txbd_rdptr=0x%x\n", pmbuf, wrdoneidx, pmadapter->pcard_pcie->txbd_rdptr); - ret = pcb->moal_unmap_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + - pmbuf->data_offset, - pmbuf->buf_pa, - pmbuf->data_len, - PCI_DMA_TODEVICE); + ret = pcb->moal_unmap_memory( + pmadapter->pmoal_handle, + pmbuf->pbuf + pmbuf->data_offset, pmbuf->buf_pa, + pmbuf->data_len, PCI_DMA_TODEVICE); if (ret == MLAN_STATUS_FAILURE) { PRINTM(MERROR, "%s: moal_unmap_memory failed\n", __FUNCTION__); @@ -1789,9 +1760,8 @@ pmadapter->pcard_pcie->tx_buf_list[wrdoneidx] = MNULL; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - ptx_bd_buf = - (mlan_pcie_data_buf *)pmadapter->pcard_pcie-> - txbd_ring[wrdoneidx]; + ptx_bd_buf = (mlan_pcie_data_buf *)pmadapter->pcard_pcie + ->txbd_ring[wrdoneidx]; ptx_bd_buf->paddr = 0; ptx_bd_buf->len = 0; ptx_bd_buf->flags = 0; @@ -1806,11 +1776,11 @@ txrx_rw_ptr_rollover_ind); } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = - (adma_dual_desc_buf *) pmadapter->pcard_pcie-> - txbd_ring[wrdoneidx]; + (adma_dual_desc_buf *)pmadapter->pcard_pcie + ->txbd_ring[wrdoneidx]; padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; padma_bd_buf->flags = 0; @@ -1846,15 +1816,13 @@ ((wrptr & rollover_ind) == (rdptr & rollover_ind))) #endif -#if defined(PCIE9098) || defined(PCIE9097) -#define ADMA_TXBD_IS_FULL(wrptr, rdptr, mask, rollover_ind) \ - (((wrptr & mask) == (rdptr & mask)) && \ - ((wrptr & rollover_ind) != \ - (rdptr & rollover_ind))) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) +#define ADMA_TXBD_IS_FULL(wrptr, rdptr, mask, rollover_ind) \ + (((wrptr & mask) == (rdptr & mask)) && \ + ((wrptr & rollover_ind) != (rdptr & rollover_ind))) #endif -static t_u8 -wlan_check_txbd_not_full(mlan_adapter *pmadapter) +static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) { t_u32 txrx_rw_ptr_mask; t_u32 txrx_rw_ptr_rollover_ind; @@ -1872,7 +1840,7 @@ return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { txrx_rw_ptr_mask = pmadapter->pcard_pcie->txrx_bd_size - 1; txrx_rw_ptr_rollover_ind = pmadapter->pcard_pcie->txrx_bd_size; @@ -1899,9 +1867,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, - mlan_buffer *pmbuf, mlan_tx_param *tx_param) +static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, + mlan_buffer *pmbuf, + mlan_tx_param *tx_param) { t_u32 reg_txbd_wrptr = pmadapter->pcard_pcie->reg->reg_txbd_wrptr; #if defined(PCIE8997) || defined(PCIE8897) @@ -1910,7 +1878,7 @@ pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *ptx_bd_buf = MNULL; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf = MNULL; #endif const t_u32 num_tx_buffs = pmadapter->pcard_pcie->txrx_bd_size; @@ -1924,7 +1892,7 @@ ENTER(); - if (!(pmadapter && pmbuf)) { + if (!pmbuf) { PRINTM(MERROR, "%s() has no buffer", __FUNCTION__); ret = MLAN_STATUS_FAILURE; goto done; @@ -1968,13 +1936,15 @@ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { wr_ptr_start = TXBD_RW_PTR_START; - ptx_bd_buf = - (mlan_pcie_data_buf *)pmadapter->pcard_pcie-> - txbd_ring[wrindx]; - ptx_bd_buf->paddr = pmbuf->buf_pa; - ptx_bd_buf->len = (t_u16)pmbuf->data_len; - ptx_bd_buf->flags = MLAN_BD_FLAG_SOP | MLAN_BD_FLAG_EOP; - ptx_bd_buf->frag_len = (t_u16)pmbuf->data_len; + ptx_bd_buf = (mlan_pcie_data_buf *)pmadapter->pcard_pcie + ->txbd_ring[wrindx]; + ptx_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + ptx_bd_buf->len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); + ptx_bd_buf->flags = wlan_cpu_to_le16(MLAN_BD_FLAG_SOP | + MLAN_BD_FLAG_EOP); + ptx_bd_buf->frag_len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); ptx_bd_buf->offset = 0; pmadapter->pcard_pcie->last_tx_pkt_size[wrindx] = pmbuf->data_len; @@ -1986,26 +1956,26 @@ txrx_rw_ptr_rollover_ind) ^ txrx_rw_ptr_rollover_ind); rxbd_val = pmadapter->pcard_pcie->rxbd_wrptr & - pmadapter->pcard_pcie->reg-> - txrx_rw_ptr_wrap_mask; + pmadapter->pcard_pcie->reg + ->txrx_rw_ptr_wrap_mask; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { wr_ptr_start = ADMA_WPTR_START; - padma_bd_buf = - (adma_dual_desc_buf *) pmadapter->pcard_pcie-> - txbd_ring[wrindx]; - padma_bd_buf->paddr = pmbuf->buf_pa; + padma_bd_buf = (adma_dual_desc_buf *)pmadapter + ->pcard_pcie->txbd_ring[wrindx]; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); padma_bd_buf->len = ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE); - padma_bd_buf->flags = + padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_SOP | ADMA_BD_FLAG_EOP | - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_SRC_HOST; + ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_SRC_HOST); if (padma_bd_buf->len < ADMA_MIN_PKT_SIZE) padma_bd_buf->len = ADMA_MIN_PKT_SIZE; - padma_bd_buf->pkt_size = pmbuf->data_len; + padma_bd_buf->len = wlan_cpu_to_le16(padma_bd_buf->len); + padma_bd_buf->pkt_size = padma_bd_buf->len; pmadapter->pcard_pcie->last_tx_pkt_size[wrindx] = pmbuf->data_len; pmadapter->pcard_pcie->txbd_wrptr++; @@ -2020,7 +1990,8 @@ /* Write the TX ring write pointer in to REG_TXBD_WRPTR */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, reg_txbd_wrptr, (pmadapter->pcard_pcie->txbd_wrptr - << wr_ptr_start) | rxbd_val)) { + << wr_ptr_start) | + rxbd_val)) { PRINTM(MERROR, "SEND DATA: failed to write REG_TXBD_WRPTR\n"); ret = MLAN_STATUS_FAILURE; @@ -2049,8 +2020,8 @@ if (!pmadapter->pcard_pcie->reg->use_adma) { /* Send the TX ready interrupt */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_event, + pmadapter->pcard_pcie->reg + ->reg_cpu_int_event, CPU_INTR_DNLD_RDY)) PRINTM(MERROR, "SEND DATA (FULL): failed to assert dnld-rdy interrupt\n"); @@ -2065,10 +2036,9 @@ done_unmap: if (MLAN_STATUS_FAILURE == - pcb->moal_unmap_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + pmbuf->data_offset, - pmbuf->buf_pa, pmbuf->data_len, - PCI_DMA_TODEVICE)) { + pcb->moal_unmap_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + pmbuf->buf_pa, pmbuf->data_len, PCI_DMA_TODEVICE)) { PRINTM(MERROR, "SEND DATA: failed to moal_unmap_memory\n"); ret = MLAN_STATUS_FAILURE; } @@ -2083,7 +2053,7 @@ ptx_bd_buf->offset = 0; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma && padma_bd_buf) { padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; @@ -2105,8 +2075,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_check_rx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) +static t_u8 wlan_check_rx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) { #if defined(PCIE8997) || defined(PCIE8897) t_u32 txrx_rw_ptr_mask = pmadapter->pcard_pcie->reg->txrx_rw_ptr_mask; @@ -2124,7 +2093,7 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->rxbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -2145,8 +2114,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_is_rx_pending_full(mlan_adapter *pmadapter, t_u32 rdptr) +static t_u8 wlan_is_rx_pending_full(mlan_adapter *pmadapter, t_u32 rdptr) { #if defined(PCIE8997) || defined(PCIE8897) t_u32 txrx_rw_ptr_mask = pmadapter->pcard_pcie->reg->txrx_rw_ptr_mask; @@ -2156,26 +2124,26 @@ PRINTM(MDATA, "local wrptr: 0x%x(0x%x) -> reg rdptr: 0x%x(0x%x)\n", (pmadapter->pcard_pcie->rxbd_wrptr & txrx_rw_ptr_mask), - (pmadapter->pcard_pcie-> - rxbd_wrptr & txrx_rw_ptr_rollover_ind), + (pmadapter->pcard_pcie->rxbd_wrptr & + txrx_rw_ptr_rollover_ind), (rdptr & txrx_rw_ptr_mask), (rdptr & txrx_rw_ptr_rollover_ind)); if (((rdptr & txrx_rw_ptr_mask) == (pmadapter->pcard_pcie->rxbd_wrptr & txrx_rw_ptr_mask)) && ((rdptr & txrx_rw_ptr_rollover_ind) == - (pmadapter->pcard_pcie-> - rxbd_wrptr & txrx_rw_ptr_rollover_ind))) + (pmadapter->pcard_pcie->rxbd_wrptr & + txrx_rw_ptr_rollover_ind))) return MTRUE; else return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { PRINTM(MDATA, "local wrptr: 0x%x -> reg rdptr: 0x%x\n", - (pmadapter->pcard_pcie-> - rxbd_wrptr & ADMA_RW_PTR_WRAP_MASK), + (pmadapter->pcard_pcie->rxbd_wrptr & + ADMA_RW_PTR_WRAP_MASK), (rdptr & ADMA_RW_PTR_WRAP_MASK)); if ((rdptr & ADMA_RW_PTR_WRAP_MASK) == (pmadapter->pcard_pcie->rxbd_wrptr & ADMA_RW_PTR_WRAP_MASK)) @@ -2195,8 +2163,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_process_recv_data(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2212,7 +2179,7 @@ pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif t_u32 in_ts_sec, in_ts_usec; @@ -2220,27 +2187,29 @@ ENTER(); /* Read the RX ring Read pointer set by firmware */ - if (pcb->moal_read_reg(pmadapter->pmoal_handle, reg_rxbd_rdptr, &rdptr)) { + if (pcb->moal_read_reg(pmadapter->pmoal_handle, reg_rxbd_rdptr, + &rdptr)) { PRINTM(MERROR, "RECV DATA: failed to read REG_RXBD_RDPTR\n"); ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif - if (pmadapter->tp_state_on && wlan_is_rx_pending_full(pmadapter, rdptr)) { + if (pmadapter->tp_state_on && + wlan_is_rx_pending_full(pmadapter, rdptr)) { PRINTM(MDATA, "RX FULL!\n"); - pmadapter->callbacks.moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, - 6, 0); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 6, 0); } while (wlan_check_rx_pending_buffer(pmadapter, rdptr)) { /* detach pmbuf (with data) from Rx Ring */ rd_index = pmadapter->pcard_pcie->rxbd_rdptr & (num_rx_buffs - 1); - if (rd_index > (t_u32)(pmadapter->pcard_pcie->txrx_bd_size - 1)) { + if (rd_index > + (t_u32)(pmadapter->pcard_pcie->txrx_bd_size - 1)) { PRINTM(MERROR, "RECV DATA: Invalid Rx buffer index.\n"); ret = MLAN_STATUS_FAILURE; goto done; @@ -2277,47 +2246,42 @@ /* send buffer to host (which will free it) */ pmbuf->data_len = rx_len - PCIE_INTF_HEADER_LEN; pmbuf->data_offset += PCIE_INTF_HEADER_LEN; - //rx_trace 5 + // rx_trace 5 if (pmadapter->tp_state_on) { - pmadapter->callbacks. - moal_tp_accounting(pmadapter-> - pmoal_handle, pmbuf, - 5 /*RX_DROP_P1 */ ); - pcb->moal_get_system_time(pmadapter-> - pmoal_handle, - &in_ts_sec, - &in_ts_usec); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf, + 5 /*RX_DROP_P1*/); + pcb->moal_get_system_time( + pmadapter->pmoal_handle, &in_ts_sec, + &in_ts_usec); pmbuf->in_ts_sec = in_ts_sec; pmbuf->in_ts_usec = in_ts_usec; } if (pmadapter->tp_state_drop_point == - 5 /*RX_DROP_P1 */ ) { + 5 /*RX_DROP_P1*/) { pmadapter->ops.data_complete(pmadapter, pmbuf, ret); } else { PRINTM(MINFO, "RECV DATA: Received packet from FW successfully\n"); - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); - util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter-> - rx_data_queue, - (pmlan_linked_list)pmbuf, - MNULL, MNULL); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); + util_enqueue_list_tail( + pmadapter->pmoal_handle, + &pmadapter->rx_data_queue, + (pmlan_linked_list)pmbuf, MNULL, MNULL); pmadapter->rx_pkts_queued++; if (pmadapter->tp_state_on) - pmadapter->callbacks. - moal_tp_accounting_rx_param - (pmadapter->pmoal_handle, 1, - pmadapter->rx_pkts_queued); - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue.plock); + pmadapter->callbacks + .moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, + 1, + pmadapter + ->rx_pkts_queued); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); pmadapter->data_received = MTRUE; } @@ -2354,23 +2318,25 @@ pmadapter->pcard_pcie->rx_buf_list[rd_index] = pmbuf; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - prxbd_buf = - (mlan_pcie_data_buf *)pmadapter->pcard_pcie-> - rxbd_ring[rd_index]; - prxbd_buf->paddr = pmbuf->buf_pa; - prxbd_buf->len = (t_u16)pmbuf->data_len; - prxbd_buf->flags = MLAN_BD_FLAG_SOP | MLAN_BD_FLAG_EOP; + prxbd_buf = (mlan_pcie_data_buf *)pmadapter->pcard_pcie + ->rxbd_ring[rd_index]; + prxbd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + prxbd_buf->len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); + prxbd_buf->flags = wlan_cpu_to_le16(MLAN_BD_FLAG_SOP | + MLAN_BD_FLAG_EOP); prxbd_buf->offset = 0; - prxbd_buf->frag_len = (t_u16)pmbuf->data_len; + prxbd_buf->frag_len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); /* update rxbd's rdptrs */ if ((++pmadapter->pcard_pcie->rxbd_rdptr & txrx_rw_ptr_mask) == pmadapter->pcard_pcie->txrx_bd_size) { pmadapter->pcard_pcie->rxbd_rdptr = - ((pmadapter->pcard_pcie-> - rxbd_rdptr & txrx_rw_ptr_rollover_ind) - ^ txrx_rw_ptr_rollover_ind); + ((pmadapter->pcard_pcie->rxbd_rdptr & + txrx_rw_ptr_rollover_ind) ^ + txrx_rw_ptr_rollover_ind); } /* update rxbd's wrptrs */ @@ -2378,26 +2344,26 @@ txrx_rw_ptr_mask) == pmadapter->pcard_pcie->txrx_bd_size) { pmadapter->pcard_pcie->rxbd_wrptr = - ((pmadapter->pcard_pcie-> - rxbd_wrptr & txrx_rw_ptr_rollover_ind) - ^ txrx_rw_ptr_rollover_ind); + ((pmadapter->pcard_pcie->rxbd_wrptr & + txrx_rw_ptr_rollover_ind) ^ + txrx_rw_ptr_rollover_ind); } txbd_val = pmadapter->pcard_pcie->txbd_wrptr & - pmadapter->pcard_pcie->reg-> - txrx_rw_ptr_wrap_mask; + pmadapter->pcard_pcie->reg + ->txrx_rw_ptr_wrap_mask; txbd_val = txbd_val << TXBD_RW_PTR_START; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = - (adma_dual_desc_buf *) pmadapter->pcard_pcie-> - rxbd_ring[rd_index]; - padma_bd_buf->paddr = pmbuf->buf_pa; - padma_bd_buf->len = - ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE); - padma_bd_buf->flags = - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST; + (adma_dual_desc_buf *)pmadapter->pcard_pcie + ->rxbd_ring[rd_index]; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + padma_bd_buf->len = wlan_cpu_to_le16( + ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE)); + padma_bd_buf->flags = wlan_cpu_to_le16( + ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; pmadapter->pcard_pcie->rxbd_rdptr++; @@ -2412,11 +2378,10 @@ pmadapter->pcard_pcie->rxbd_wrptr, rdptr); /* Write the RX ring write pointer in to REG_RXBD_WRPTR */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_rxbd_wrptr, - pmadapter->pcard_pcie-> - rxbd_wrptr | txbd_val)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_rxbd_wrptr, + pmadapter->pcard_pcie->rxbd_wrptr | txbd_val)) { PRINTM(MERROR, "RECV DATA: failed to write REG_RXBD_WRPTR\n"); ret = MLAN_STATUS_FAILURE; @@ -2431,7 +2396,7 @@ ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -2451,8 +2416,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_cmd(mlan_adapter *pmadapter, mlan_buffer *pmbuf) +static mlan_status wlan_pcie_send_cmd(mlan_adapter *pmadapter, + mlan_buffer *pmbuf) { mlan_status ret = MLAN_STATUS_PENDING; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2485,10 +2450,9 @@ *(t_u16 *)&payload[2] = wlan_cpu_to_le16(MLAN_TYPE_CMD); if (MLAN_STATUS_FAILURE == - pcb->moal_map_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + pmbuf->data_offset, - &pmbuf->buf_pa, MLAN_RX_CMD_BUF_SIZE, - PCI_DMA_TODEVICE)) { + pcb->moal_map_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + &pmbuf->buf_pa, MLAN_RX_CMD_BUF_SIZE, PCI_DMA_TODEVICE)) { PRINTM(MERROR, "Command buffer : moal_map_memory failed\n"); LEAVE(); return MLAN_STATUS_FAILURE; @@ -2498,35 +2462,34 @@ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { /* To send a command, the driver will: - 1. Write the 64bit physical address of the data buffer to - SCRATCH1 + SCRATCH0 - 2. Ring the door bell (i.e. set the door bell interrupt) + 1. Write the 64bit physical address of the data buffer to + SCRATCH1 + SCRATCH0 + 2. Ring the door bell (i.e. set the door bell interrupt) - In response to door bell interrupt, the firmware will + In response to door bell interrupt, the firmware will perform the DMA of the command packet (first header to obtain the total length and then rest of the command). - */ + */ if (pmadapter->pcard_pcie->cmdrsp_buf) { /* Write the lower 32bits of the cmdrsp buffer physical address */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, REG_CMDRSP_ADDR_LO, - (t_u32)pmadapter->pcard_pcie-> - cmdrsp_buf->buf_pa)) { + (t_u32)pmadapter->pcard_pcie + ->cmdrsp_buf->buf_pa)) { PRINTM(MERROR, "Failed to write download command to boot code.\n"); ret = MLAN_STATUS_FAILURE; goto done; } /* Write the upper 32bits of the cmdrsp buffer physical - address */ - if (pcb-> - moal_write_reg(pmadapter->pmoal_handle, - REG_CMDRSP_ADDR_HI, - (t_u32)((t_u64)pmadapter-> - pcard_pcie->cmdrsp_buf-> - buf_pa >> 32))) { + address */ + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, REG_CMDRSP_ADDR_HI, + (t_u32)((t_u64)pmadapter->pcard_pcie + ->cmdrsp_buf->buf_pa >> + 32))) { PRINTM(MERROR, "Failed to write download command to boot code.\n"); ret = MLAN_STATUS_FAILURE; @@ -2536,10 +2499,9 @@ /* Write the lower 32bits of the physical address to * REG_CMD_ADDR_LO */ - if (pcb-> - moal_write_reg(pmadapter->pmoal_handle, REG_CMD_ADDR_LO, - (t_u32)pmadapter->pcard_pcie->cmd_buf-> - buf_pa)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, REG_CMD_ADDR_LO, + (t_u32)pmadapter->pcard_pcie->cmd_buf->buf_pa)) { PRINTM(MERROR, "Failed to write download command to boot code.\n"); ret = MLAN_STATUS_FAILURE; @@ -2549,8 +2511,9 @@ * REG_CMD_ADDR_HI */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, REG_CMD_ADDR_HI, - (t_u32)((t_u64)pmadapter->pcard_pcie-> - cmd_buf->buf_pa >> 32))) { + (t_u32)((t_u64)pmadapter->pcard_pcie + ->cmd_buf->buf_pa >> + 32))) { PRINTM(MERROR, "Failed to write download command to boot code.\n"); ret = MLAN_STATUS_FAILURE; @@ -2558,9 +2521,9 @@ } /* Write the command length to REG_CMD_SIZE */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, REG_CMD_SIZE, - pmadapter->pcard_pcie->cmd_buf-> - data_len)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, REG_CMD_SIZE, + pmadapter->pcard_pcie->cmd_buf->data_len)) { PRINTM(MERROR, "Failed to write command length to REG_CMD_SIZE\n"); ret = MLAN_STATUS_FAILURE; @@ -2568,10 +2531,10 @@ } /* Ring the door bell */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_event, - CPU_INTR_DOOR_BELL)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_cpu_int_event, + CPU_INTR_DOOR_BELL)) { PRINTM(MERROR, "Failed to assert door-bell interrupt.\n"); ret = MLAN_STATUS_FAILURE; @@ -2579,7 +2542,7 @@ } } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { /* To send a command, the driver will: 1. driver prepare the cmdrep buffer for adma @@ -2588,7 +2551,7 @@ 3. driver programs src_base_addr register to define source location of DMA data 4. driver sets src_wptr to 1 to initiate DMA operation - */ + */ wlan_init_adma(pmadapter, ADMA_CMDRESP, pmadapter->pcard_pcie->cmdrsp_buf->buf_pa, MRVDRV_SIZE_OF_CMD_BUFFER, MFALSE); @@ -2610,8 +2573,8 @@ #define MLAN_SLEEP_COOKIE_DEF 0xBEEFBEEF #define MAX_DELAY_LOOP_COUNT 100 -static void -mlan_delay_for_sleep_cookie(mlan_adapter *pmadapter, t_u32 max_delay_loop_cnt) +static void mlan_delay_for_sleep_cookie(mlan_adapter *pmadapter, + t_u32 max_delay_loop_cnt) { t_u8 *buffer; t_u32 sleep_cookie = 0; @@ -2642,8 +2605,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_process_cmd_resp(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_process_cmd_resp(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2677,11 +2639,11 @@ } if (!pmadapter->curr_cmd) { if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) { - wlan_process_sleep_confirm_resp(pmadapter, - pmbuf->pbuf + - pmbuf->data_offset + - PCIE_INTF_HEADER_LEN, - pmadapter->upld_len); + wlan_process_sleep_confirm_resp( + pmadapter, + pmbuf->pbuf + pmbuf->data_offset + + PCIE_INTF_HEADER_LEN, + pmadapter->upld_len); /* We are sending sleep confirm done interrupt in the * middle of sleep handshake. There is a corner case * when Tx done interrupt is received from firmware @@ -2699,8 +2661,8 @@ */ wlan_pcie_enable_host_int_mask(pmadapter); if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_event, + pmadapter->pcard_pcie->reg + ->reg_cpu_int_event, CPU_INTR_SLEEP_CFM_DONE)) { PRINTM(MERROR, "Write register failed\n"); LEAVE(); @@ -2713,7 +2675,7 @@ } memcpy_ext(pmadapter, pmadapter->upld_buf, pmbuf->pbuf + pmbuf->data_offset + - PCIE_INTF_HEADER_LEN, + PCIE_INTF_HEADER_LEN, pmadapter->upld_len, MRVDRV_SIZE_OF_CMD_BUFFER); } else { @@ -2728,8 +2690,8 @@ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { /* Clear the cmd-rsp buffer address in scratch - registers. This will prevent firmware from writing to - the same response buffer again. */ + registers. This will prevent firmware from writing to + the same response buffer again. */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, REG_CMDRSP_ADDR_LO, 0)) { PRINTM(MERROR, @@ -2738,7 +2700,7 @@ goto done; } /* Write the upper 32bits of the cmdrsp buffer physical - address */ + address */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, REG_CMDRSP_ADDR_HI, 0)) { PRINTM(MERROR, @@ -2748,7 +2710,7 @@ } } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { /* Clear the cmd-rsp buffer address in adma registers. This will prevent firmware from writing to the same @@ -2777,14 +2739,13 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_cmdrsp_complete(mlan_adapter *pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_pcie_cmdrsp_complete(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { - ENTER(); - /*return the cmd response pmbuf */ + /*return the cmd response pmbuf*/ if (pmbuf) { pmbuf->data_len = MRVDRV_SIZE_OF_CMD_BUFFER; pmbuf->data_offset -= PCIE_INTF_HEADER_LEN; @@ -2803,8 +2764,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_check_evt_buffer(mlan_adapter *pmadapter, t_u32 rdptr) +static t_u8 wlan_check_evt_buffer(mlan_adapter *pmadapter, t_u32 rdptr) { #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { @@ -2818,7 +2778,7 @@ return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->evtbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -2837,8 +2797,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_process_event_ready(mlan_adapter *pmadapter) +static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) { t_u32 rd_index = pmadapter->pcard_pcie->evtbd_rdptr & (MLAN_MAX_EVT_BD - 1); @@ -2847,14 +2806,14 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif ENTER(); if (pmadapter->event_received) { PRINTM(MINFO, "Event being processed, do not " - "process this interrupt just yet\n"); + "process this interrupt just yet\n"); LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -2873,7 +2832,7 @@ LEAVE(); return MLAN_STATUS_FAILURE; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -2886,7 +2845,7 @@ PRINTM(MINFO, "EvtRdy: Read Index: %d\n", rd_index); pmbuf_evt = pmadapter->pcard_pcie->evt_buf_list[rd_index]; - /*unmap the pmbuf for CPU Access */ + /*unmap the pmbuf for CPU Access*/ pcb->moal_unmap_memory(pmadapter->pmoal_handle, pmbuf_evt->pbuf + pmbuf_evt->data_offset, pmbuf_evt->buf_pa, MAX_EVENT_SIZE, @@ -2896,20 +2855,19 @@ and will return back after event handling callback */ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - pevtbd_buf = - (mlan_pcie_evt_buf *)pmadapter->pcard_pcie-> - evtbd_ring[rd_index]; + pevtbd_buf = (mlan_pcie_evt_buf *)pmadapter->pcard_pcie + ->evtbd_ring[rd_index]; pevtbd_buf->paddr = 0; pevtbd_buf->len = 0; pevtbd_buf->flags = 0; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = - (adma_dual_desc_buf *) pmadapter->pcard_pcie-> - evtbd_ring[rd_index]; + (adma_dual_desc_buf *)pmadapter->pcard_pcie + ->evtbd_ring[rd_index]; padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; padma_bd_buf->flags = 0; @@ -2931,7 +2889,7 @@ (evt_len - MLAN_EVENT_HEADER_LEN < MAX_EVENT_SIZE)) memcpy_ext(pmadapter, pmadapter->event_body, pmbuf_evt->pbuf + pmbuf_evt->data_offset + - MLAN_EVENT_HEADER_LEN, + MLAN_EVENT_HEADER_LEN, evt_len - MLAN_EVENT_HEADER_LEN, sizeof(pmadapter->event_body)); @@ -2954,7 +2912,7 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_rdptr &= ADMA_RW_PTR_WRAP_MASK; @@ -2963,13 +2921,13 @@ /* Do not update the event write pointer here, wait till the buffer is released. This is just to make things simpler, we need to find a better method of managing these buffers. - */ + */ } else { PRINTM(MINTR, "------>EVENT DONE\n"); - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_event, - CPU_INTR_EVENT_DONE)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_cpu_int_event, + CPU_INTR_EVENT_DONE)) { PRINTM(MERROR, "Failed to asset event done interrupt\n"); return MLAN_STATUS_FAILURE; @@ -2987,9 +2945,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_event_complete(mlan_adapter *pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2999,7 +2957,7 @@ #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) adma_dual_desc_buf *padma_bd_buf; #endif @@ -3023,7 +2981,7 @@ ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -3045,26 +3003,25 @@ pmadapter->pcard_pcie->evt_buf_list[wrptr] = pmbuf; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { - pevtbd_buf = - (mlan_pcie_evt_buf *)pmadapter->pcard_pcie-> - evtbd_ring[wrptr]; - pevtbd_buf->paddr = pmbuf->buf_pa; - pevtbd_buf->len = (t_u16)pmbuf->data_len; + pevtbd_buf = (mlan_pcie_evt_buf *)pmadapter->pcard_pcie + ->evtbd_ring[wrptr]; + pevtbd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + pevtbd_buf->len = + wlan_cpu_to_le16((t_u16)pmbuf->data_len); pevtbd_buf->flags = 0; } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { - padma_bd_buf = - (adma_dual_desc_buf *) pmadapter->pcard_pcie-> - evtbd_ring[wrptr]; - padma_bd_buf->paddr = pmbuf->buf_pa; - padma_bd_buf->len = - ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE); + padma_bd_buf = (adma_dual_desc_buf *)pmadapter + ->pcard_pcie->evtbd_ring[wrptr]; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + padma_bd_buf->len = wlan_cpu_to_le16( + ALIGN_SZ(pmbuf->data_len, ADMA_ALIGN_SIZE)); padma_bd_buf->flags = 0; - padma_bd_buf->flags = - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST; + padma_bd_buf->flags = wlan_cpu_to_le16( + ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } @@ -3091,7 +3048,7 @@ } } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; #endif @@ -3127,8 +3084,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_send_boot_cmd(mlan_adapter *pmadapter, mlan_buffer *pmbuf) +static mlan_status wlan_pcie_send_boot_cmd(mlan_adapter *pmadapter, + mlan_buffer *pmbuf) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3142,10 +3099,9 @@ } if (MLAN_STATUS_FAILURE == - pcb->moal_map_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + pmbuf->data_offset, - &pmbuf->buf_pa, WLAN_UPLD_SIZE, - PCI_DMA_TODEVICE)) { + pcb->moal_map_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + &pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) { PRINTM(MERROR, "BootCmd: failed to moal_map_memory\n"); LEAVE(); return MLAN_STATUS_FAILURE; @@ -3206,10 +3162,9 @@ done: if (MLAN_STATUS_FAILURE == - pcb->moal_unmap_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + pmbuf->data_offset, - pmbuf->buf_pa, WLAN_UPLD_SIZE, - PCI_DMA_TODEVICE)) + pcb->moal_unmap_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) PRINTM(MERROR, "BootCmd: failed to moal_unmap_memory\n"); LEAVE(); return ret; @@ -3222,8 +3177,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_pcie_init_fw(pmlan_adapter pmadapter) +mlan_status wlan_pcie_init_fw(pmlan_adapter pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; t_u32 txbd_val = 0; @@ -3231,7 +3185,7 @@ #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { txbd_val = pmadapter->pcard_pcie->txbd_wrptr & - pmadapter->pcard_pcie->reg->txrx_rw_ptr_wrap_mask; + pmadapter->pcard_pcie->reg->txrx_rw_ptr_wrap_mask; txbd_val = txbd_val << TXBD_RW_PTR_START; } #endif @@ -3262,8 +3216,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_prog_fw_w_helper(mlan_adapter *pmadapter, mlan_fw_image *fw) +static mlan_status wlan_pcie_prog_fw_w_helper(mlan_adapter *pmadapter, + mlan_fw_image *fw) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 *firmware = fw->pfw_buf; @@ -3327,6 +3281,10 @@ if (IS_PCIE9097(pmadapter->card_type)) check_fw_status = MTRUE; #endif +#if defined(PCIENW62X) + if (IS_PCIENW62X(pmadapter->card_type)) + check_fw_status = MTRUE; +#endif /* Perform firmware data transfer */ do { @@ -3338,9 +3296,10 @@ break; for (tries = 0; tries < MAX_POLL_TRIES; tries++) { - ret = pcb->moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_scratch_2, &len); + ret = pcb->moal_read_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_scratch_2, + &len); if (ret) { PRINTM(MWARN, "Failed reading length from boot code\n"); @@ -3365,11 +3324,11 @@ if (len & MBIT(0)) { if (check_fw_status) { /* Get offset from fw dnld offset Register */ - ret = pcb->moal_read_reg(pmadapter-> - pmoal_handle, - pmadapter->pcard_pcie-> - reg->reg_scratch_6, - &fw_dnld_offset); + ret = pcb->moal_read_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg + ->reg_scratch_6, + &fw_dnld_offset); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "FW download failure @ %d, reading fw dnld offset failed\n", @@ -3378,11 +3337,11 @@ } /* Get CRC MIC error from fw dnld status * Register */ - ret = pcb->moal_read_reg(pmadapter-> - pmoal_handle, - pmadapter->pcard_pcie-> - reg->reg_scratch_7, - &fw_dnld_status); + ret = pcb->moal_read_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg + ->reg_scratch_7, + &fw_dnld_status); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "FW download failure @ %d, reading fw dnld status failed\n", @@ -3397,7 +3356,8 @@ if (block_retry_cnt > MAX_WRITE_IOMEM_RETRY) { PRINTM(MERROR, "FW download failure @ %d, over max " - "retry count\n", offset); + "retry count\n", + offset); goto done; } PRINTM(MERROR, @@ -3413,7 +3373,8 @@ if (mic_retry > MAX_FW_RETRY) { PRINTM(MERROR, "FW download failure @ %d, over max " - "mic retry count\n", offset); + "mic retry count\n", + offset); goto done; } } @@ -3443,24 +3404,24 @@ if (read_retry_cnt > MAX_READ_REG_RETRY) { PRINTM(MERROR, "prog_fw: Failed to get command done interrupt " - "retry count = %d\n", read_retry_cnt); + "retry count = %d\n", + read_retry_cnt); goto done; } if (pcb->moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_cpu_int_status, + pmadapter->pcard_pcie->reg + ->reg_cpu_int_status, &ireg_intr)) { PRINTM(MERROR, "prog_fw: Failed to read " "interrupt status during fw dnld\n"); /* buffer was mapped in send_boot_cmd, unmap * first */ - pcb->moal_unmap_memory(pmadapter->pmoal_handle, - pmbuf->pbuf + - pmbuf->data_offset, - pmbuf->buf_pa, - WLAN_UPLD_SIZE, - PCI_DMA_TODEVICE); + pcb->moal_unmap_memory( + pmadapter->pmoal_handle, + pmbuf->pbuf + pmbuf->data_offset, + pmbuf->buf_pa, WLAN_UPLD_SIZE, + PCI_DMA_TODEVICE); goto done; } read_retry_cnt++; @@ -3500,8 +3461,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_get_pcie_device(pmlan_adapter pmadapter) +mlan_status wlan_get_pcie_device(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u16 card_type = pmadapter->card_type; @@ -3533,18 +3493,21 @@ pmadapter->pcard_pcie->txrx_bd_size = MAX_TXRX_BD; break; #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) case CARD_TYPE_PCIE9097: case CARD_TYPE_PCIE9098: + case CARD_TYPE_PCIENW62X: pmadapter->pcard_pcie->reg = &mlan_reg_pcie9098; pmadapter->pcard_info = &mlan_card_info_pcie9098; pmadapter->pcard_pcie->txrx_bd_size = ADMA_DEF_TXRX_BD; pmadapter->pcard_pcie->txrx_num_desc = TXRX_DEF_NUM_DESC; -#ifdef PCIE9097 - if (card_type == CARD_TYPE_PCIE9097 && - pmadapter->card_rev == CHIP_9097_REV_B0) +#if defined(PCIE9097) || defined(PCIENW62X) + if ((card_type == CARD_TYPE_PCIE9097 && + pmadapter->card_rev == CHIP_9097_REV_B0) || + (card_type == CARD_TYPE_PCIENW62X)) pmadapter->pcard_pcie->reg = &mlan_reg_pcie9097_b0; #endif + break; #endif default: @@ -3564,16 +3527,15 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_pcie_wakeup(mlan_adapter *pmadapter) +mlan_status wlan_pcie_wakeup(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 data = 0; ENTER(); /* Enable interrupts or any chip access will wakeup device */ - ret = pmadapter->callbacks.moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_ip_rev, &data); + ret = pmadapter->callbacks.moal_read_reg( + pmadapter->pmoal_handle, pmadapter->pcard_pcie->reg->reg_ip_rev, + &data); if (ret == MLAN_STATUS_SUCCESS) { PRINTM(MINFO, @@ -3595,8 +3557,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_FAILURE -- if the intererupt is not for us */ -static mlan_status -wlan_pcie_interrupt(t_u16 msg_id, pmlan_adapter pmadapter) +static mlan_status wlan_pcie_interrupt(t_u16 msg_id, pmlan_adapter pmadapter) { t_u32 pcie_ireg; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3612,7 +3573,7 @@ pcb->moal_spin_unlock(pmoal_handle, pint_lock); } else if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSIX) { pcie_ireg = (1 << msg_id) & - pmadapter->pcard_pcie->reg->host_intr_mask; + pmadapter->pcard_pcie->reg->host_intr_mask; if (pcie_ireg) { if (!pmadapter->pps_uapsd_mode && (pmadapter->ps_state == PS_STATE_SLEEP)) { @@ -3628,9 +3589,10 @@ PRINTM(MINTR, "ireg: 0x%08x\n", pcie_ireg); } else { wlan_pcie_disable_host_int_mask(pmadapter); - if (pcb->moal_read_reg(pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status, &pcie_ireg)) { + if (pcb->moal_read_reg( + pmoal_handle, + pmadapter->pcard_pcie->reg->reg_host_int_status, + &pcie_ireg)) { PRINTM(MERROR, "Read func%d register failed\n", pmadapter->pcard_pcie->func_num); LEAVE(); @@ -3654,8 +3616,8 @@ /* Clear the pending interrupts */ if (pcb->moal_write_reg(pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status, + pmadapter->pcard_pcie->reg + ->reg_host_int_status, ~pcie_ireg)) { PRINTM(MWARN, "Write register failed\n"); LEAVE(); @@ -3680,8 +3642,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_msix_int(mlan_adapter *pmadapter) +mlan_status wlan_process_msix_int(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 pcie_ireg = 0; @@ -3722,7 +3683,7 @@ if (ret) goto done; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->host_intr_cmd_dnld && (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_dnld)) { if (pmadapter->cmd_sent) @@ -3748,8 +3709,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_process_pcie_int_status(mlan_adapter *pmadapter) +static mlan_status wlan_process_pcie_int_status(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 pcie_ireg = 0; @@ -3767,9 +3727,10 @@ pmadapter->ireg = 0; pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pint_lock); if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSI) { - if (pcb->moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status, &pcie_ireg)) { + if (pcb->moal_read_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_host_int_status, + &pcie_ireg)) { PRINTM(MERROR, "Read func%d register failed\n", pmadapter->pcard_pcie->func_num); ret = MLAN_STATUS_FAILURE; @@ -3780,11 +3741,11 @@ PRINTM(MINTR, "func%d: pcie_ireg=0x%x\n", pmadapter->pcard_pcie->func_num, pcie_ireg); if (pmadapter->pcard_pcie->reg->msi_int_wr_clr) { - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie-> - reg-> - reg_host_int_status, - ~pcie_ireg)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg + ->reg_host_int_status, + ~pcie_ireg)) { PRINTM(MERROR, "Write register failed\n"); ret = MLAN_STATUS_FAILURE; @@ -3802,40 +3763,40 @@ } } while (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_mask) { - if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_dnld_done) { + if (pcie_ireg & + pmadapter->pcard_pcie->reg->host_intr_dnld_done) { pcie_ireg &= - ~pmadapter->pcard_pcie->reg-> - host_intr_dnld_done; + ~pmadapter->pcard_pcie->reg->host_intr_dnld_done; PRINTM(MINFO, "<--- DATA sent Interrupt --->\n"); - pmadapter->callbacks. - moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, 3, 0); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 3, 0); ret = wlan_pcie_send_data_complete(pmadapter); if (ret) goto done; } - if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_upld_rdy) { + if (pcie_ireg & + pmadapter->pcard_pcie->reg->host_intr_upld_rdy) { pcie_ireg &= ~pmadapter->pcard_pcie->reg->host_intr_upld_rdy; PRINTM(MINFO, "Rx DATA\n"); - pmadapter->callbacks. - moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, 0, 0); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 0, 0); ret = wlan_pcie_process_recv_data(pmadapter); if (ret) goto done; } - if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_event_rdy) { + if (pcie_ireg & + pmadapter->pcard_pcie->reg->host_intr_event_rdy) { pcie_ireg &= - ~pmadapter->pcard_pcie->reg-> - host_intr_event_rdy; + ~pmadapter->pcard_pcie->reg->host_intr_event_rdy; PRINTM(MINFO, "Rx EVENT\n"); ret = wlan_pcie_process_event_ready(pmadapter); if (ret) goto done; } - if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_done) { + if (pcie_ireg & + pmadapter->pcard_pcie->reg->host_intr_cmd_done) { pcie_ireg &= ~pmadapter->pcard_pcie->reg->host_intr_cmd_done; if (pmadapter->cmd_sent) { @@ -3846,7 +3807,7 @@ if (ret) goto done; } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->host_intr_cmd_dnld && (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_dnld)) { @@ -3866,9 +3827,10 @@ pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pint_lock); } - if (pcb->moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_host_int_status, &pcie_ireg)) { + if (pcb->moal_read_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_host_int_status, + &pcie_ireg)) { PRINTM(MERROR, "Read func%d register failed\n", pmadapter->pcard_pcie->func_num); ret = MLAN_STATUS_FAILURE; @@ -3881,11 +3843,11 @@ if ((pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_LEGACY) || pmadapter->pcard_pcie->reg->msi_int_wr_clr) { - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie-> - reg-> - reg_host_int_status, - ~pcie_ireg)) { + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg + ->reg_host_int_status, + ~pcie_ireg)) { PRINTM(MWARN, "Write register failed\n"); return MLAN_STATUS_FAILURE; @@ -3907,11 +3869,9 @@ PRINTM(MINFO, "cmd_sent=%d data_sent=%d\n", pmadapter->cmd_sent, pmadapter->data_sent); if (pmadapter->pcard_pcie->pcie_int_mode != PCIE_INT_MODE_MSI) { - if (pmadapter->ps_state != PS_STATE_SLEEP || pmadapter->pcard_info->supp_ps_handshake) wlan_pcie_enable_host_int_mask(pmadapter); - } done: LEAVE(); @@ -3927,8 +3887,7 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE * */ -mlan_status -wlan_set_drv_ready_reg(mlan_adapter *pmadapter, t_u32 val) +mlan_status wlan_set_drv_ready_reg(mlan_adapter *pmadapter, t_u32 val) { pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3955,8 +3914,8 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE * */ -static mlan_status -wlan_pcie_check_winner_status(mlan_adapter *pmadapter, t_u32 *val) +static mlan_status wlan_pcie_check_winner_status(mlan_adapter *pmadapter, + t_u32 *val) { t_u32 winner = 0; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3985,8 +3944,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_check_fw_status(mlan_adapter *pmadapter, t_u32 pollnum) +static mlan_status wlan_pcie_check_fw_status(mlan_adapter *pmadapter, + t_u32 pollnum) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3998,8 +3957,8 @@ /* Wait for firmware initialization event */ for (tries = 0; tries < pollnum; tries++) { if (pcb->moal_read_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg-> - reg_scratch_3, &firmware_stat)) + pmadapter->pcard_pcie->reg->reg_scratch_3, + &firmware_stat)) ret = MLAN_STATUS_FAILURE; else ret = MLAN_STATUS_SUCCESS; @@ -4009,7 +3968,7 @@ ret = MLAN_STATUS_SUCCESS; break; } else { - wlan_mdelay(pmadapter, 100); + wlan_mdelay(pmadapter, 10); ret = MLAN_STATUS_FAILURE; } } @@ -4025,8 +3984,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_pcie_init(mlan_adapter *pmadapter) +mlan_status wlan_pcie_init(mlan_adapter *pmadapter) { ENTER(); @@ -4048,8 +4006,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pcie_dnld_fw(pmlan_adapter pmadapter, pmlan_fw_image pmfw) +static mlan_status wlan_pcie_dnld_fw(pmlan_adapter pmadapter, + pmlan_fw_image pmfw) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 poll_num = 1; @@ -4128,9 +4086,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_pcie_host_to_card(pmlan_private pmpriv, t_u8 type, - mlan_buffer *pmbuf, mlan_tx_param *tx_param) +mlan_status wlan_pcie_host_to_card(pmlan_private pmpriv, t_u8 type, + mlan_buffer *pmbuf, mlan_tx_param *tx_param) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = pmpriv->adapter; @@ -4146,7 +4103,7 @@ ret = wlan_pcie_send_data(pmadapter, type, pmbuf, tx_param); else if (type == MLAN_TYPE_CMD) ret = wlan_pcie_send_cmd(pmadapter, pmbuf); -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) else if (type == MLAN_TYPE_VDLL) ret = wlan_pcie_send_vdll(pmadapter, pmbuf); #endif @@ -4161,8 +4118,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_alloc_ssu_pcie_buf(pmlan_adapter pmadapter) +mlan_status wlan_alloc_ssu_pcie_buf(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -4227,8 +4183,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_free_ssu_pcie_buf(pmlan_adapter pmadapter) +mlan_status wlan_free_ssu_pcie_buf(pmlan_adapter pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; mlan_buffer *pmbuf = MNULL; @@ -4271,14 +4226,14 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_alloc_pcie_ring_buf(pmlan_adapter pmadapter) +mlan_status wlan_alloc_pcie_ring_buf(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || + (pmadapter->card_type == CARD_TYPE_PCIENW62X) || (pmadapter->card_type == CARD_TYPE_PCIE9097)) { wlan_pcie_init_adma_ring_size(pmadapter); } @@ -4323,8 +4278,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_free_pcie_ring_buf(pmlan_adapter pmadapter) +mlan_status wlan_free_pcie_ring_buf(pmlan_adapter pmadapter) { ENTER(); @@ -4335,7 +4289,8 @@ pmadapter->pcard_pcie->cmdrsp_buf = MNULL; #ifdef RPTR_MEM_COP if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || - (pmadapter->card_type == CARD_TYPE_PCIE9097)) + (pmadapter->card_type == + CARD_TYPE_PCIENW62X)(pmadapter->card_type == CARD_TYPE_PCIE9097)) wlan_pcie_free_rdptrs(pmadapter); #endif @@ -4353,8 +4308,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_clean_pcie_ring_buf(pmlan_adapter pmadapter) +mlan_status wlan_clean_pcie_ring_buf(pmlan_adapter pmadapter) { ENTER(); #if defined(PCIE8997) || defined(PCIE8897) @@ -4373,8 +4327,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_set_pcie_buf_config(mlan_private *pmpriv) +mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv) { pmlan_adapter pmadapter = MNULL; #if defined(PCIE8997) || defined(PCIE8897) @@ -4394,22 +4347,27 @@ sizeof(HostCmd_DS_PCIE_HOST_BUF_DETAILS)); /* Send the ring base addresses and count to firmware */ - host_spec.txbd_addr_lo = - (t_u32)(pmadapter->pcard_pcie->txbd_ring_pbase); - host_spec.txbd_addr_hi = (t_u32)(((t_u64)pmadapter->pcard_pcie-> - txbd_ring_pbase) >> 32); - host_spec.txbd_count = pmadapter->pcard_pcie->txrx_bd_size; - host_spec.rxbd_addr_lo = - (t_u32)(pmadapter->pcard_pcie->rxbd_ring_pbase); - host_spec.rxbd_addr_hi = (t_u32)(((t_u64)pmadapter->pcard_pcie-> - rxbd_ring_pbase) >> 32); - host_spec.rxbd_count = pmadapter->pcard_pcie->txrx_bd_size; - host_spec.evtbd_addr_lo = - (t_u32)(pmadapter->pcard_pcie->evtbd_ring_pbase); - host_spec.evtbd_addr_hi = (t_u32)(((t_u64)pmadapter-> - pcard_pcie-> - evtbd_ring_pbase) >> 32); - host_spec.evtbd_count = MLAN_MAX_EVT_BD; + host_spec.txbd_addr_lo = wlan_cpu_to_le32( + (t_u32)(pmadapter->pcard_pcie->txbd_ring_pbase)); + host_spec.txbd_addr_hi = wlan_cpu_to_le32(( + t_u32)(((t_u64)pmadapter->pcard_pcie->txbd_ring_pbase) >> + 32)); + host_spec.txbd_count = + wlan_cpu_to_le32(pmadapter->pcard_pcie->txrx_bd_size); + host_spec.rxbd_addr_lo = wlan_cpu_to_le32( + (t_u32)(pmadapter->pcard_pcie->rxbd_ring_pbase)); + host_spec.rxbd_addr_hi = wlan_cpu_to_le32(( + t_u32)(((t_u64)pmadapter->pcard_pcie->rxbd_ring_pbase) >> + 32)); + host_spec.rxbd_count = + wlan_cpu_to_le32(pmadapter->pcard_pcie->txrx_bd_size); + host_spec.evtbd_addr_lo = wlan_cpu_to_le32( + (t_u32)(pmadapter->pcard_pcie->evtbd_ring_pbase)); + host_spec.evtbd_addr_hi = + wlan_cpu_to_le32((t_u32)(((t_u64)pmadapter->pcard_pcie + ->evtbd_ring_pbase) >> + 32)); + host_spec.evtbd_count = wlan_cpu_to_le32(MLAN_MAX_EVT_BD); ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_PCIE_HOST_BUF_DETAILS, @@ -4422,7 +4380,7 @@ } } #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) if (pmadapter->pcard_pcie->reg->use_adma) { /** config ADMA for Tx Data */ wlan_init_adma(pmadapter, ADMA_TX_DATA, @@ -4460,10 +4418,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_pcie_host_buf_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_pvoid pdata_buf) +mlan_status wlan_cmd_pcie_host_buf_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_pvoid pdata_buf) { HostCmd_DS_PCIE_HOST_BUF_DETAILS *ppcie_hoost_spec = &cmd->params.pcie_host_spec; @@ -4471,8 +4428,8 @@ ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_PCIE_HOST_BUF_DETAILS); - cmd->size = wlan_cpu_to_le16((sizeof(HostCmd_DS_PCIE_HOST_BUF_DETAILS)) - + S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + (sizeof(HostCmd_DS_PCIE_HOST_BUF_DETAILS)) + S_DS_GEN); if (cmd_action == HostCmd_ACT_GEN_SET) { memcpy_ext(pmpriv->adapter, ppcie_hoost_spec, pdata_buf, @@ -4493,8 +4450,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pm_pcie_wakeup_card(pmlan_adapter pmadapter, t_u8 timeout) +static mlan_status wlan_pm_pcie_wakeup_card(pmlan_adapter pmadapter, + t_u8 timeout) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 age_ts_usec; @@ -4507,10 +4464,9 @@ &age_ts_usec); if (timeout) { - pmadapter->callbacks.moal_start_timer(pmadapter->pmoal_handle, - pmadapter-> - pwakeup_fw_timer, MFALSE, - MRVDRV_TIMER_3S); + pmadapter->callbacks.moal_start_timer( + pmadapter->pmoal_handle, pmadapter->pwakeup_fw_timer, + MFALSE, MRVDRV_TIMER_3S); pmadapter->wakeup_fw_timer_is_set = MTRUE; } @@ -4520,8 +4476,7 @@ return ret; } -static mlan_status -wlan_pcie_debug_dump(pmlan_adapter pmadapter) +static mlan_status wlan_pcie_debug_dump(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_buffer pmbuf = pmadapter->pcard_pcie->cmdrsp_buf; @@ -4547,9 +4502,9 @@ * @param pmbuf A pointer to the mlan_buffer * @return N/A */ -static mlan_status -wlan_pcie_data_complete(pmlan_adapter pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_pcie_data_complete(pmlan_adapter pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { ENTER();
diff --git a/wlan_sd8987/mlan/mlan_pcie.h b/wlan_sd8987/mlan/mlan_pcie.h index 5f129b4..bd17a18 100755 --- a/wlan_sd8987/mlan/mlan_pcie.h +++ b/wlan_sd8987/mlan/mlan_pcie.h
@@ -136,7 +136,7 @@ /** DMA cfg3 register */ #define ADMA_DMA_CFG3 0x0040 /** ADMA Queue pointer clear */ -#define ADMA_Q_PTR_CLR MBIT(0) +#define ADMA_Q_PTR_CLR MBIT(0) /** source rd ptr address low */ #define ADMA_SRC_RD_PTR_LOW 0x0044 /** source rd ptr address high */ @@ -182,7 +182,7 @@ /** PF start bit */ #define ADMA_MSIX_PF_BIT 24 -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /** PCIE9098 dev_id/vendor id reg */ #define PCIE9098_DEV_ID_REG 0x0000 /** PCIE revision ID register */ @@ -369,23 +369,23 @@ #ifdef PCIE8997 /* PCIE read data pointer for queue 0 and 1 */ -#define PCIE8997_RD_DATA_PTR_Q0_Q1 0xC1A4 /* 0x8000C1A4 */ +#define PCIE8997_RD_DATA_PTR_Q0_Q1 0xC1A4 /* 0x8000C1A4 */ /* PCIE read data pointer for queue 2 and 3 */ -#define PCIE8997_RD_DATA_PTR_Q2_Q3 0xC1A8 /* 0x8000C1A8 */ +#define PCIE8997_RD_DATA_PTR_Q2_Q3 0xC1A8 /* 0x8000C1A8 */ /* PCIE write data pointer for queue 0 and 1 */ -#define PCIE8997_WR_DATA_PTR_Q0_Q1 0xC174 /* 0x8000C174 */ +#define PCIE8997_WR_DATA_PTR_Q0_Q1 0xC174 /* 0x8000C174 */ /* PCIE write data pointer for queue 2 and 3 */ -#define PCIE8997_WR_DATA_PTR_Q2_Q3 0xC178 /* 0x8000C178 */ +#define PCIE8997_WR_DATA_PTR_Q2_Q3 0xC178 /* 0x8000C178 */ #endif #ifdef PCIE8897 /* PCIE read data pointer for queue 0 and 1 */ -#define PCIE8897_RD_DATA_PTR_Q0_Q1 0xC08C /* 0x8000C08C */ +#define PCIE8897_RD_DATA_PTR_Q0_Q1 0xC08C /* 0x8000C08C */ /* PCIE read data pointer for queue 2 and 3 */ -#define PCIE8897_RD_DATA_PTR_Q2_Q3 0xC090 /* 0x8000C090 */ +#define PCIE8897_RD_DATA_PTR_Q2_Q3 0xC090 /* 0x8000C090 */ /* PCIE write data pointer for queue 0 and 1 */ -#define PCIE8897_WR_DATA_PTR_Q0_Q1 0xC05C /* 0x8000C05C */ +#define PCIE8897_WR_DATA_PTR_Q0_Q1 0xC05C /* 0x8000C05C */ /* PCIE write data pointer for queue 2 and 3 */ -#define PCIE8897_WR_DATA_PTR_Q2_Q3 0xC060 /* 0x8000C060 */ +#define PCIE8897_WR_DATA_PTR_Q2_Q3 0xC060 /* 0x8000C060 */ #endif /** Download ready interrupt for CPU */
diff --git a/wlan_sd8987/mlan/mlan_scan.c b/wlan_sd8987/mlan/mlan_scan.c index 42577cd..544f7b0 100755 --- a/wlan_sd8987/mlan/mlan_scan.c +++ b/wlan_sd8987/mlan/mlan_scan.c
@@ -6,7 +6,7 @@ * for sending scan commands to the firmware. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -125,20 +125,20 @@ }; static t_u8 wpa_ouis[CIPHER_SUITE_MAX][4] = { - {0x00, 0x50, 0xf2, 0x01}, /* WEP40 */ - {0x00, 0x50, 0xf2, 0x02}, /* TKIP */ - {0x00, 0x50, 0xf2, 0x04}, /* AES */ - {0x00, 0x50, 0xf2, 0x05}, /* WEP104 */ + {0x00, 0x50, 0xf2, 0x01}, /* WEP40 */ + {0x00, 0x50, 0xf2, 0x02}, /* TKIP */ + {0x00, 0x50, 0xf2, 0x04}, /* AES */ + {0x00, 0x50, 0xf2, 0x05}, /* WEP104 */ }; static t_u8 rsn_oui[CIPHER_SUITE_MAX][4] = { - {0x00, 0x0f, 0xac, 0x01}, /* WEP40 */ - {0x00, 0x0f, 0xac, 0x02}, /* TKIP */ - {0x00, 0x0f, 0xac, 0x04}, /* AES */ - {0x00, 0x0f, 0xac, 0x05}, /* WEP104 */ - {0x00, 0x0f, 0xac, 0x08}, /* GCMP */ - {0x00, 0x0f, 0xac, 0x09}, /* GCMP-256 */ - {0x00, 0x0f, 0xac, 0x0a}, /* CCMP-256 */ + {0x00, 0x0f, 0xac, 0x01}, /* WEP40 */ + {0x00, 0x0f, 0xac, 0x02}, /* TKIP */ + {0x00, 0x0f, 0xac, 0x04}, /* AES */ + {0x00, 0x0f, 0xac, 0x05}, /* WEP104 */ + {0x00, 0x0f, 0xac, 0x08}, /* GCMP */ + {0x00, 0x0f, 0xac, 0x09}, /* GCMP-256 */ + {0x00, 0x0f, 0xac, 0x0a}, /* CCMP-256 */ }; /** @@ -150,10 +150,9 @@ * @return Band type conversion of scanBand used in join/assoc cmds * */ -t_u8 -radio_type_to_band(t_u8 radio_type) +t_u16 radio_type_to_band(t_u8 radio_type) { - t_u8 ret_band; + t_u16 ret_band; switch (radio_type) { case BAND_5GHZ: @@ -183,10 +182,10 @@ mlan_adapter *pmadapter = pmpriv->adapter; t_u8 i; chan_statistics_t *pchan_stats = - (chan_statistics_t *) ((t_u8 *)pchanstats_tlv + - sizeof(MrvlIEtypesHeader_t)); + (chan_statistics_t *)((t_u8 *)pchanstats_tlv + + sizeof(MrvlIEtypesHeader_t)); t_u8 num_chan = wlan_le16_to_cpu(pchanstats_tlv->header.len) / - sizeof(chan_statistics_t); + sizeof(chan_statistics_t); ENTER(); @@ -211,9 +210,9 @@ pchan_stats->cca_scan_duration, pchan_stats->cca_busy_duration); memcpy_ext(pmadapter, - (chan_statistics_t *) & pmadapter-> - pchan_stats[pmadapter->idx_chan_stats], pchan_stats, - sizeof(chan_statistics_t), + (chan_statistics_t *)&pmadapter + ->pchan_stats[pmadapter->idx_chan_stats], + pchan_stats, sizeof(chan_statistics_t), sizeof(chan_statistics_t)); pmadapter->idx_chan_stats++; pchan_stats++; @@ -231,8 +230,8 @@ * @param pbss_desc A pointer to current BSS descriptor * @return 0 on failure to find OUI, 1 on success. */ -static t_u8 -search_oui_in_ie(mlan_adapter *pmadapter, IEBody *ie_body, t_u8 *oui) +static t_u8 search_oui_in_ie(mlan_adapter *pmadapter, IEBody *ie_body, + t_u8 *oui) { t_u8 count; @@ -273,9 +272,8 @@ * @param pbss_desc A pointer to current BSS descriptor * @return 0 on failure to find AES OUI, 1 on success. */ -static t_u8 -is_rsn_oui_present(mlan_adapter *pmadapter, - BSSDescriptor_t *pbss_desc, t_u32 cipher_suite) +static t_u8 is_rsn_oui_present(mlan_adapter *pmadapter, + BSSDescriptor_t *pbss_desc, t_u32 cipher_suite) { t_u8 *oui = MNULL; IEBody *ie_body = MNULL; @@ -307,8 +305,8 @@ * @param pmadapter A pointer to mlan adapter. * @return 0 on failure to find AES OUI, 1 on success. */ -static t_u8 -is_rsn_oui_present_in_wpa_ie(mlan_private *pmpriv, t_u32 cipher_suite) +static t_u8 is_rsn_oui_present_in_wpa_ie(mlan_private *pmpriv, + t_u32 cipher_suite) { mlan_adapter *pmadapter = pmpriv->adapter; t_u8 *oui = MNULL; @@ -343,9 +341,8 @@ * @param pbss_desc A pointer to current BSS descriptor * @return 0 on failure to find AES OUI, 1 on success. */ -static t_u8 -is_wpa_oui_present(mlan_adapter *pmadapter, - BSSDescriptor_t *pbss_desc, t_u32 cipher_suite) +static t_u8 is_wpa_oui_present(mlan_adapter *pmadapter, + BSSDescriptor_t *pbss_desc, t_u32 cipher_suite) { t_u8 *oui = MNULL; IEBody *ie_body = MNULL; @@ -376,10 +373,9 @@ * @return matched: non-zero. unmatched: 0 * */ -static t_u8 -wlan_is_band_compatible(t_u8 cfg_band, t_u8 scan_band) +static t_u8 wlan_is_band_compatible(t_u8 cfg_band, t_u8 scan_band) { - t_u8 band; + t_u16 band; switch (scan_band) { case BAND_A: band = BAND_A | BAND_AN | BAND_AAC; @@ -400,8 +396,7 @@ * @param pmpriv A pointer to mlan_private structure * @return index in BSSID list */ -static t_s32 -wlan_find_best_network_in_list(mlan_private *pmpriv) +static t_s32 wlan_find_best_network_in_list(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; t_u32 mode = pmpriv->bss_mode; @@ -420,9 +415,8 @@ if (wlan_is_network_compatible(pmpriv, i, mode) >= 0) { if (SCAN_RSSI(pmadapter->pscan_table[i].rssi) > best_rssi) { - best_rssi = - SCAN_RSSI(pmadapter-> - pscan_table[i].rssi); + best_rssi = SCAN_RSSI( + pmadapter->pscan_table[i].rssi); best_net = i; } } @@ -431,9 +425,8 @@ default: if (SCAN_RSSI(pmadapter->pscan_table[i].rssi) > best_rssi) { - best_rssi = - SCAN_RSSI(pmadapter->pscan_table[i]. - rssi); + best_rssi = SCAN_RSSI( + pmadapter->pscan_table[i].rssi); best_net = i; } break; @@ -461,11 +454,9 @@ * * @return num of channel */ -static t_u8 -wlan_scan_create_channel_list(mlan_private *pmpriv, - const wlan_user_scan_cfg *puser_scan_in, - ChanScanParamSet_t *pscan_chan_list, - t_u8 filtered_scan) +static t_u8 wlan_scan_create_channel_list( + mlan_private *pmpriv, const wlan_user_scan_cfg *puser_scan_in, + ChanScanParamSet_t *pscan_chan_list, t_u8 filtered_scan) { mlan_adapter *pmadapter = pmpriv->adapter; region_chan_t *pscan_region; @@ -475,7 +466,7 @@ t_u32 next_chan; t_u8 scan_type; t_u8 radio_type; - t_u8 band; + t_u16 band; t_u16 scan_dur = 0; ENTER(); @@ -498,7 +489,7 @@ if (puser_scan_in && !puser_scan_in->chan_list[0].chan_number && puser_scan_in->chan_list[0].radio_type & BAND_SPECIFIED) { radio_type = puser_scan_in->chan_list[0].radio_type & - ~BAND_SPECIFIED; + ~BAND_SPECIFIED; if (!radio_type && (pscan_region->band != BAND_B) && (pscan_region->band != BAND_G)) continue; @@ -539,16 +530,16 @@ pscan_chan_list[chan_idx].bandcfg.chanBand = BAND_5GHZ; /* Passive scan on DFS channels */ - if (wlan_11h_radar_detect_required - (pmpriv, (t_u8)cfp->channel) && - scan_type != MLAN_SCAN_TYPE_PASSIVE) + if (wlan_11h_radar_detect_required( + pmpriv, (t_u8)cfp->channel) && + scan_type == MLAN_SCAN_TYPE_PASSIVE) scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; break; case BAND_B: case BAND_G: - if (wlan_bg_scan_type_is_passive - (pmpriv, (t_u8)cfp->channel)) { + if (wlan_bg_scan_type_is_passive( + pmpriv, (t_u8)cfp->channel)) { scan_type = MLAN_SCAN_TYPE_PASSIVE; } pscan_chan_list[chan_idx].bandcfg.chanBand = @@ -563,10 +554,10 @@ if (puser_scan_in && puser_scan_in->chan_list[0].scan_time) { scan_dur = (t_u16)puser_scan_in->chan_list[0] - .scan_time; + .scan_time; } else if (scan_type == MLAN_SCAN_TYPE_PASSIVE || scan_type == - MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE) { + MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE) { scan_dur = pmadapter->passive_scan_time; } else if (filtered_scan) { scan_dur = pmadapter->specific_scan_time; @@ -575,13 +566,14 @@ } if (scan_type == MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE && pmadapter->passive_to_active_scan == - MLAN_PASS_TO_ACT_SCAN_EN) { + MLAN_PASS_TO_ACT_SCAN_EN) { scan_dur = MAX(scan_dur, MIN_PASSIVE_TO_ACTIVE_SCAN_TIME); pscan_chan_list[chan_idx] .chan_scan_mode.passive_to_active_scan = MTRUE; } + pscan_chan_list[chan_idx].max_scan_time = wlan_cpu_to_le16(scan_dur); @@ -603,9 +595,9 @@ "chan=%d, mode=%d, passive_to_active=%d\n", pscan_chan_list[chan_idx].chan_number, pscan_chan_list[chan_idx] - .chan_scan_mode.passive_scan, + .chan_scan_mode.passive_scan, pscan_chan_list[chan_idx] - .chan_scan_mode.passive_to_active_scan); + .chan_scan_mode.passive_to_active_scan); chan_idx++; } } @@ -622,8 +614,8 @@ * * @return N/A */ -static void -wlan_add_wps_probe_request_ie(mlan_private *pmpriv, t_u8 **pptlv_out) +static void wlan_add_wps_probe_request_ie(mlan_private *pmpriv, + t_u8 **pptlv_out) { MrvlIEtypesHeader_t *tlv; @@ -689,6 +681,14 @@ t_u32 done_early; t_u32 cmd_no; t_u32 first_chan = 1; + t_u8 *ptlv_pos; + MrvlIETypes_HTCap_t *pht_cap; + + MrvlIETypes_VHTCap_t *pvht_cap; + MrvlIEtypes_Extension_t *phe_cap; + t_u16 len = 0; + t_u8 radio_type = 0; + mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; ENTER(); @@ -741,18 +741,16 @@ */ while (tlv_idx < max_chan_per_scan && ptmp_chan_list->chan_number && !done_early) { - if (wlan_is_chan_blacklisted(pmpriv, - radio_type_to_band - (ptmp_chan_list->bandcfg. - chanBand), - ptmp_chan_list-> - chan_number) || - wlan_is_chan_disabled(pmpriv, - radio_type_to_band - (ptmp_chan_list->bandcfg. - chanBand), - ptmp_chan_list-> - chan_number)) { + if (wlan_is_chan_blacklisted( + pmpriv, + radio_type_to_band( + ptmp_chan_list->bandcfg.chanBand), + ptmp_chan_list->chan_number) || + wlan_is_chan_disabled( + pmpriv, + radio_type_to_band( + ptmp_chan_list->bandcfg.chanBand), + ptmp_chan_list->chan_number)) { PRINTM(MCMND, "Block scan chan = %d\n", ptmp_chan_list->chan_number); ptmp_chan_list++; @@ -764,7 +762,7 @@ MTRUE; first_chan = 0; } - + radio_type = ptmp_chan_list->bandcfg.chanBand; PRINTM(MCMD_D, "Scan: Chan(%3d), bandcfg(%x), Mode(%d,%d), Dur(%d)\n", ptmp_chan_list->chan_number, @@ -778,7 +776,7 @@ /* Restore the TLV buffer */ pchan_tlv_out = (MrvlIEtypes_ChanListParamSet_t *) - pchan_tlv_out_temp; + pchan_tlv_out_temp; pchan_tlv_out->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANLIST); pchan_tlv_out->header.len = 0; @@ -795,25 +793,23 @@ /* Special Case: For Japan, Scan on CH14 for 11G rates is not allowed - Hence Rates TLV needs to be updated to support only + Hence Rates TLV needs to be updated to support only 11B rates */ if ((pmadapter->region_code == COUNTRY_CODE_JP_40 || pmadapter->region_code == COUNTRY_CODE_JP_FF) && - (ptmp_chan_list->chan_number == 14) - && (pmadapter->ext_scan_type != EXT_SCAN_ENHANCE) - ) { - + (ptmp_chan_list->chan_number == 14) && + (pmadapter->ext_scan_type != EXT_SCAN_ENHANCE)) { t_u8 *ptlv_pos = pscan_cfg_out->tlv_buf; t_u16 old_ratetlv_len, new_ratetlv_len; MrvlIEtypesHeader_t *header; MrvlIEtypes_RatesParamSet_t *prates_tlv; /* Preserve the current TLV buffer */ - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - MAX_SCAN_CFG_ALLOC - - CHAN_TLV_MAX_SIZE, - MLAN_MEM_DEF, - (t_u8 **)&ptlv_temp); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + MAX_SCAN_CFG_ALLOC - CHAN_TLV_MAX_SIZE, + MLAN_MEM_DEF | MOAL_MEM_FLAG_ATOMIC, + (t_u8 **)&ptlv_temp); if (ret != MLAN_STATUS_SUCCESS || !ptlv_temp) { PRINTM(MERROR, "Memory allocation for pscan_cfg_out failed!\n"); @@ -829,22 +825,21 @@ memcpy_ext(pmadapter, ptlv_temp, ptlv_pos, tlv_buf_len, MAX_SCAN_CFG_ALLOC - - CHAN_TLV_MAX_SIZE); + CHAN_TLV_MAX_SIZE); /* Search for Rates TLV */ while ((!foundJPch14) && (ptlv_pos < pchan_tlv_out_temp)) { - header = (MrvlIEtypesHeader_t *) - ptlv_pos; + header = + (MrvlIEtypesHeader_t *)ptlv_pos; if (header->type == wlan_cpu_to_le16(TLV_TYPE_RATES)) foundJPch14 = MTRUE; else ptlv_pos += - (sizeof - (MrvlIEtypesHeader_t) + - wlan_le16_to_cpu - (header->len)); + (sizeof(MrvlIEtypesHeader_t) + + wlan_le16_to_cpu( + header->len)); } if (foundJPch14) { @@ -853,24 +848,22 @@ * buffer*/ prates_tlv = (MrvlIEtypes_RatesParamSet_t *) - ptlv_pos; + ptlv_pos; old_ratetlv_len = sizeof(MrvlIEtypesHeader_t) + - wlan_le16_to_cpu(prates_tlv-> - header.len); + wlan_le16_to_cpu( + prates_tlv->header.len); - prates_tlv->header.len = - wlan_copy_rates(prates_tlv-> - rates, 0, - SupportedRates_B, - sizeof - (SupportedRates_B)); + prates_tlv->header.len = wlan_copy_rates( + prates_tlv->rates, 0, + SupportedRates_B, + sizeof(SupportedRates_B)); new_ratetlv_len = sizeof(MrvlIEtypesHeader_t) + prates_tlv->header.len; prates_tlv->header.len = - wlan_cpu_to_le16(prates_tlv-> - header.len); + wlan_cpu_to_le16( + prates_tlv->header.len); memmove(pmadapter, ptlv_pos + new_ratetlv_len, @@ -880,12 +873,12 @@ old_ratetlv_len))); pchan_tlv_out = (MrvlIEtypes_ChanListParamSet_t - *)(pchan_tlv_out_temp - - (old_ratetlv_len - - new_ratetlv_len)); + *)(pchan_tlv_out_temp - + (old_ratetlv_len - + new_ratetlv_len)); pchan_tlv_out->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_CHANLIST); + wlan_cpu_to_le16( + TLV_TYPE_CHANLIST); pchan_tlv_out->header.len = 0; } } @@ -910,10 +903,9 @@ * compensates for any TLVs that were appended * before the channel list. */ - pscan_cfg_out->tlv_buf_len = (t_u32)((t_u8 *) - pchan_tlv_out - - pscan_cfg_out-> - tlv_buf); + pscan_cfg_out->tlv_buf_len = + (t_u32)((t_u8 *)pchan_tlv_out - + pscan_cfg_out->tlv_buf); /* Add the size of the channel tlv header and the data * length */ @@ -985,9 +977,10 @@ /* The total scan time should be less than scan command timeout * value */ - if (total_scan_time > MRVDRV_MAX_TOTAL_SCAN_TIME) { + if (!total_scan_time || + total_scan_time > MRVDRV_MAX_TOTAL_SCAN_TIME) { PRINTM(MMSG, - "Total scan time %d ms is over limit (%d ms), scan skipped\n", + "Total scan time %d ms is invalid, limit (%d ms), scan skipped\n", total_scan_time, MRVDRV_MAX_TOTAL_SCAN_TIME); if (pioctl_req) pioctl_req->status_code = @@ -995,10 +988,61 @@ ret = MLAN_STATUS_FAILURE; break; } + ptlv_pos = (t_u8 *)pchan_tlv_out + pchan_tlv_out->header.len + + sizeof(MrvlIEtypesHeader_t); pchan_tlv_out->header.len = wlan_cpu_to_le16(pchan_tlv_out->header.len); + if (ISSUPP_11NENABLED(pmpriv->adapter->fw_cap_info) && + (pmpriv->config_bands & BAND_GN || + pmpriv->config_bands & BAND_AN)) { + pht_cap = (MrvlIETypes_HTCap_t *)ptlv_pos; + memset(pmadapter, pht_cap, 0, + sizeof(MrvlIETypes_HTCap_t)); + pht_cap->header.type = wlan_cpu_to_le16(HT_CAPABILITY); + pht_cap->header.len = sizeof(HTCap_t); + wlan_fill_ht_cap_tlv(pmpriv, pht_cap, + pmpriv->config_bands, MTRUE); + HEXDUMP("SCAN: HT_CAPABILITIES IE", (t_u8 *)pht_cap, + sizeof(MrvlIETypes_HTCap_t)); + ptlv_pos += sizeof(MrvlIETypes_HTCap_t); + pht_cap->header.len = + wlan_cpu_to_le16(pht_cap->header.len); + } + + if (ISSUPP_11ACENABLED(pmpriv->adapter->fw_cap_info) && + (pmpriv->config_bands & BAND_AAC)) { + pvht_cap = (MrvlIETypes_VHTCap_t *)ptlv_pos; + memset(pmadapter, pvht_cap, 0, + sizeof(MrvlIETypes_VHTCap_t)); + pvht_cap->header.type = + wlan_cpu_to_le16(VHT_CAPABILITY); + pvht_cap->header.len = sizeof(VHT_capa_t); + wlan_fill_vht_cap_tlv(pmpriv, pvht_cap, + pmpriv->config_bands, MFALSE, + MFALSE); + HEXDUMP("SCAN: VHT_CAPABILITIES IE", (t_u8 *)pvht_cap, + sizeof(MrvlIETypes_VHTCap_t)); + ptlv_pos += sizeof(MrvlIETypes_VHTCap_t); + pvht_cap->header.len = + wlan_cpu_to_le16(pvht_cap->header.len); + } + + if (IS_FW_SUPPORT_11AX(pmadapter) && + ((pmpriv->config_bands & BAND_GAX) || + (pmpriv->config_bands & BAND_AAX))) { + phe_cap = (MrvlIEtypes_Extension_t *)ptlv_pos; + len = wlan_fill_he_cap_tlv(pmpriv, pmpriv->config_bands, + phe_cap, MFALSE); + HEXDUMP("SCAN: HE_CAPABILITIES IE", (t_u8 *)phe_cap, + len); + ptlv_pos += len; + } + + pscan_cfg_out->tlv_buf_len = + (t_u32)((t_u8 *)ptlv_pos - pscan_cfg_out->tlv_buf); + pmadapter->pscan_channels = pstart_chan; /* Send the scan command to the firmware with the specified cfg @@ -1007,7 +1051,7 @@ #ifdef USB8801 && !IS_USB8801(pmadapter->card_type) #endif - ) + ) cmd_no = HostCmd_CMD_802_11_SCAN_EXT; else cmd_no = HostCmd_CMD_802_11_SCAN; @@ -1067,14 +1111,12 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_scan_setup_scan_config(mlan_private *pmpriv, - wlan_user_scan_cfg *puser_scan_in, - wlan_scan_cmd_config *pscan_cfg_out, - MrvlIEtypes_ChanListParamSet_t **ppchan_list_out, - ChanScanParamSet_t *pscan_chan_list, - t_u8 *pmax_chan_per_scan, t_u8 *pfiltered_scan, - t_u8 *pscan_current_only) +static mlan_status wlan_scan_setup_scan_config( + mlan_private *pmpriv, wlan_user_scan_cfg *puser_scan_in, + wlan_scan_cmd_config *pscan_cfg_out, + MrvlIEtypes_ChanListParamSet_t **ppchan_list_out, + ChanScanParamSet_t *pscan_chan_list, t_u8 *pmax_chan_per_scan, + t_u8 *pfiltered_scan, t_u8 *pscan_current_only) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1083,7 +1125,7 @@ MrvlIEtypes_RatesParamSet_t *prates_tlv; MrvlIEtypes_Bssid_List_t *pbssid_tlv; - const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; t_u8 *ptlv_pos; t_u32 num_probes; t_u32 ssid_len; @@ -1097,13 +1139,8 @@ t_u8 ssid_filter; WLAN_802_11_RATES rates; t_u32 rates_size; - MrvlIETypes_HTCap_t *pht_cap; - - MrvlIETypes_VHTCap_t *pvht_cap; MrvlIEtypes_ScanChanGap_t *pscan_gap_tlv; MrvlIEtypes_BssMode_t *pbss_mode; - MrvlIEtypes_Extension_t *phe_cap; - t_u16 len = 0; t_u8 num_of_channel = 0; ENTER(); @@ -1140,14 +1177,14 @@ /* Set the bss type scan filter, use Adapter setting if unset */ pscan_cfg_out->bss_mode = (puser_scan_in->bss_mode ? - (t_u8)puser_scan_in->bss_mode : - (t_u8)pmadapter->scan_mode); + (t_u8)puser_scan_in->bss_mode : + (t_u8)pmadapter->scan_mode); /* Set the number of probes to send, use Adapter setting if * unset */ num_probes = (puser_scan_in->num_probes ? puser_scan_in->num_probes : - pmadapter->scan_probes); + pmadapter->scan_probes); /* * Set the BSSID filter to the incoming configuration, * if non-zero. If not set, it will remain disabled @@ -1163,28 +1200,27 @@ pbssid_tlv = (MrvlIEtypes_Bssid_List_t *)ptlv_pos; pbssid_tlv->header.type = TLV_TYPE_BSSID; - pbssid_tlv->header.len = - wlan_cpu_to_le16(MLAN_MAC_ADDR_LENGTH * - puser_scan_in-> - bssid_num); + pbssid_tlv->header.len = wlan_cpu_to_le16( + MLAN_MAC_ADDR_LENGTH * + puser_scan_in->bssid_num); memcpy_ext(pmadapter, pbssid_tlv->bssid, puser_scan_in->bssid_list, MLAN_MAC_ADDR_LENGTH * - puser_scan_in->bssid_num, + puser_scan_in->bssid_num, MLAN_MAC_ADDR_LENGTH * - puser_scan_in->bssid_num); - ptlv_pos += - sizeof(MrvlIEtypesHeader_t) + - MLAN_MAC_ADDR_LENGTH * - puser_scan_in->bssid_num; - DBG_HEXDUMP(MCMD_D, "scan bssid filter", - pbssid_tlv, - sizeof(MrvlIEtypesHeader_t) + + puser_scan_in->bssid_num); + ptlv_pos += sizeof(MrvlIEtypesHeader_t) + MLAN_MAC_ADDR_LENGTH * - puser_scan_in->bssid_num); - } else if (memcmp - (pmadapter, pscan_cfg_out->specific_bssid, - &zero_mac, sizeof(zero_mac))) { + puser_scan_in->bssid_num; + DBG_HEXDUMP( + MCMD_D, "scan bssid filter", pbssid_tlv, + sizeof(MrvlIEtypesHeader_t) + + MLAN_MAC_ADDR_LENGTH * + puser_scan_in + ->bssid_num); + } else if (memcmp(pmadapter, + pscan_cfg_out->specific_bssid, + &zero_mac, sizeof(zero_mac))) { pbssid_tlv = (MrvlIEtypes_Bssid_List_t *)ptlv_pos; pbssid_tlv->header.type = TLV_TYPE_BSSID; @@ -1203,17 +1239,17 @@ (*puser_scan_in->ssid_list[ssid_idx].ssid || puser_scan_in->ssid_list[ssid_idx].max_len)); ssid_idx++) { - ssid_len = wlan_strlen((char *)puser_scan_in-> - ssid_list[ssid_idx].ssid); + ssid_len = wlan_strlen( + (char *)puser_scan_in->ssid_list[ssid_idx].ssid); pwildcard_ssid_tlv = (MrvlIEtypes_WildCardSsIdParamSet_t *)ptlv_pos; pwildcard_ssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WILDCARDSSID); - pwildcard_ssid_tlv->header.len = (t_u16)(ssid_len + - sizeof - (pwildcard_ssid_tlv-> - max_ssid_length)); + pwildcard_ssid_tlv->header.len = + (t_u16)(ssid_len + + sizeof(pwildcard_ssid_tlv + ->max_ssid_length)); pwildcard_ssid_tlv->max_ssid_length = puser_scan_in->ssid_list[ssid_idx].max_len; @@ -1224,9 +1260,8 @@ ptlv_pos += (sizeof(pwildcard_ssid_tlv->header) + pwildcard_ssid_tlv->header.len); - pwildcard_ssid_tlv->header.len = - wlan_cpu_to_le16(pwildcard_ssid_tlv->header. - len); + pwildcard_ssid_tlv->header.len = wlan_cpu_to_le16( + pwildcard_ssid_tlv->header.len); PRINTM(MINFO, "Scan: ssid_list[%d]: %s, %d\n", ssid_idx, pwildcard_ssid_tlv->ssid, @@ -1278,12 +1313,10 @@ pscan_gap_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_SCAN_CHANNEL_GAP); pscan_gap_tlv->header.len = sizeof(pscan_gap_tlv->gap); - pscan_gap_tlv->gap = wlan_cpu_to_le16((t_u16) - puser_scan_in-> - scan_chan_gap); - ptlv_pos += - sizeof(pscan_gap_tlv->header) + - pscan_gap_tlv->header.len; + pscan_gap_tlv->gap = wlan_cpu_to_le16( + (t_u16)puser_scan_in->scan_chan_gap); + ptlv_pos += sizeof(pscan_gap_tlv->header) + + pscan_gap_tlv->header.len; pscan_gap_tlv->header.len = wlan_cpu_to_le16(pscan_gap_tlv->header.len); } @@ -1298,10 +1331,10 @@ pscan_gap_tlv->gap = wlan_cpu_to_le16((t_u16)pmadapter->scan_chan_gap); ptlv_pos += sizeof(pscan_gap_tlv->header) + - pscan_gap_tlv->header.len; + pscan_gap_tlv->header.len; } if (pmadapter->ext_scan) { - pbss_mode = (MrvlIEtypes_BssMode_t *) ptlv_pos; + pbss_mode = (MrvlIEtypes_BssMode_t *)ptlv_pos; pbss_mode->header.type = wlan_cpu_to_le16(TLV_TYPE_BSS_MODE); pbss_mode->header.len = sizeof(pbss_mode->bss_mode); pbss_mode->bss_mode = pscan_cfg_out->bss_mode; @@ -1339,7 +1372,7 @@ wlan_cpu_to_le16((t_u16)num_probes); ptlv_pos += sizeof(pnum_probes_tlv->header) + - pnum_probes_tlv->header.len; + pnum_probes_tlv->header.len; pnum_probes_tlv->header.len = wlan_cpu_to_le16(pnum_probes_tlv->header.len); @@ -1348,11 +1381,12 @@ /* Append rates tlv */ memset(pmadapter, rates, 0, sizeof(rates)); - rates_size = wlan_get_supported_rates(pmpriv, pmpriv->bss_mode, - (pmpriv->bss_mode == - MLAN_BSS_MODE_INFRA) ? pmpriv-> - config_bands : pmadapter-> - adhoc_start_band, rates); + rates_size = wlan_get_supported_rates( + pmpriv, pmpriv->bss_mode, + (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) ? + pmpriv->config_bands : + pmadapter->adhoc_start_band, + rates); prates_tlv = (MrvlIEtypes_RatesParamSet_t *)ptlv_pos; prates_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_RATES); @@ -1362,42 +1396,6 @@ PRINTM(MINFO, "SCAN_CMD: Rates size = %d\n", rates_size); - if (ISSUPP_11NENABLED(pmpriv->adapter->fw_cap_info) && - (pmpriv->config_bands & BAND_GN - || pmpriv->config_bands & BAND_AN)) { - pht_cap = (MrvlIETypes_HTCap_t *)ptlv_pos; - memset(pmadapter, pht_cap, 0, sizeof(MrvlIETypes_HTCap_t)); - pht_cap->header.type = wlan_cpu_to_le16(HT_CAPABILITY); - pht_cap->header.len = sizeof(HTCap_t); - wlan_fill_ht_cap_tlv(pmpriv, pht_cap, pmpriv->config_bands, - MTRUE); - HEXDUMP("SCAN: HT_CAPABILITIES IE", (t_u8 *)pht_cap, - sizeof(MrvlIETypes_HTCap_t)); - ptlv_pos += sizeof(MrvlIETypes_HTCap_t); - pht_cap->header.len = wlan_cpu_to_le16(pht_cap->header.len); - } - - if (ISSUPP_11ACENABLED(pmpriv->adapter->fw_cap_info) && - (pmpriv->config_bands & BAND_AAC)) { - pvht_cap = (MrvlIETypes_VHTCap_t *)ptlv_pos; - memset(pmadapter, pvht_cap, 0, sizeof(MrvlIETypes_VHTCap_t)); - pvht_cap->header.type = wlan_cpu_to_le16(VHT_CAPABILITY); - pvht_cap->header.len = sizeof(VHT_capa_t); - wlan_fill_vht_cap_tlv(pmpriv, pvht_cap, pmpriv->config_bands, - MFALSE, MFALSE); - HEXDUMP("SCAN: VHT_CAPABILITIES IE", (t_u8 *)pvht_cap, - sizeof(MrvlIETypes_VHTCap_t)); - ptlv_pos += sizeof(MrvlIETypes_VHTCap_t); - pvht_cap->header.len = wlan_cpu_to_le16(pvht_cap->header.len); - } - - if (IS_FW_SUPPORT_11AX(pmadapter) && (pmpriv->config_bands & BAND_AAX)) { - phe_cap = (MrvlIEtypes_Extension_t *) ptlv_pos; - len = wlan_fill_he_cap_tlv(pmpriv, BAND_A, phe_cap, MFALSE); - HEXDUMP("SCAN: HE_CAPABILITIES IE", (t_u8 *)phe_cap, len); - ptlv_pos += len; - } - if (wlan_is_ext_capa_support(pmpriv)) wlan_add_ext_capa_info_ie(pmpriv, MNULL, &ptlv_pos); if (pmpriv->adapter->ecsa_enable) { @@ -1413,14 +1411,15 @@ pmpriv->usr_dot_11n_dev_cap_bg; if (usr_dot_11n_dev_cap & MBIT(17)) { bandwidth = BW_40MHZ; - if (ISSUPP_11ACENABLED(pmadapter->fw_cap_info) - && (pmpriv->config_bands & BAND_AAC)) + if (ISSUPP_11ACENABLED( + pmadapter->fw_cap_info) && + (pmpriv->config_bands & BAND_AAC)) bandwidth = BW_80MHZ; } - wlan_get_curr_oper_class(pmpriv, - pmpriv->curr_bss_params. - bss_descriptor.channel, - bandwidth, &oper_class); + wlan_get_curr_oper_class( + pmpriv, + pmpriv->curr_bss_params.bss_descriptor.channel, + bandwidth, &oper_class); } wlan_add_supported_oper_class_ie(pmpriv, &ptlv_pos, oper_class); } @@ -1428,7 +1427,7 @@ if (puser_scan_in && puser_scan_in->proberesp_only) { MrvlIEtypes_OnlyProberesp_t *proberesp_only = - (MrvlIEtypes_OnlyProberesp_t *) ptlv_pos; + (MrvlIEtypes_OnlyProberesp_t *)ptlv_pos; memset(pmadapter, proberesp_only, 0, sizeof(MrvlIEtypes_OnlyProberesp_t)); proberesp_only->header.type = @@ -1472,9 +1471,9 @@ puser_scan_in->chan_list[chan_idx].radio_type; /*Ignore 5G/2G channels if radio_type do not match * band*/ - if (!wlan_is_band_compatible(pmpriv->config_bands, - radio_type_to_band - (radio_type))) + if (!wlan_is_band_compatible( + pmpriv->config_bands, + radio_type_to_band(radio_type))) continue; (pscan_chan_list + chan_list_idx)->bandcfg.chanBand = radio_type; @@ -1500,30 +1499,35 @@ ret = MLAN_STATUS_FAILURE; LEAVE(); return ret; - } } - - if (wlan_is_chan_passive(pmpriv, radio_type, channel)) { - /* do not send probe requests on this channel */ - scan_type = MLAN_SCAN_TYPE_PASSIVE; + if (!puser_scan_in->scan_cfg_only) { + if (wlan_is_chan_passive( + pmpriv, + radio_type_to_band(radio_type), + channel)) { + /* do not send probe requests on this + * channel */ + scan_type = MLAN_SCAN_TYPE_PASSIVE; + } } /* Prevent active scanning on a radar controlled channel */ if (radio_type == BAND_5GHZ && - scan_type != MLAN_SCAN_TYPE_PASSIVE) { + scan_type == MLAN_SCAN_TYPE_PASSIVE) { if (pmadapter->active_scan_triggered == MFALSE) - if (wlan_11h_radar_detect_required - (pmpriv, channel)) { + if (wlan_11h_radar_detect_required( + pmpriv, channel)) { scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; } } if (radio_type == BAND_2GHZ && + !puser_scan_in->scan_cfg_only && scan_type != MLAN_SCAN_TYPE_PASSIVE) { if (pmadapter->active_scan_triggered == MFALSE) - if (wlan_bg_scan_type_is_passive - (pmpriv, channel)) { + if (wlan_bg_scan_type_is_passive( + pmpriv, channel)) { scan_type = MLAN_SCAN_TYPE_PASSIVE; } @@ -1541,14 +1545,13 @@ } if (puser_scan_in->chan_list[chan_idx].scan_time) { - scan_dur = - (t_u16)puser_scan_in-> - chan_list[chan_idx] - .scan_time; + scan_dur = (t_u16)puser_scan_in + ->chan_list[chan_idx] + .scan_time; } else { if (scan_type == MLAN_SCAN_TYPE_PASSIVE || scan_type == - MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE) { + MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE) { scan_dur = pmadapter->passive_scan_time; } else if (*pfiltered_scan) { scan_dur = @@ -1564,21 +1567,20 @@ scan_dur = pmadapter->coex_min_scan_time; if (scan_type == MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE && pmadapter->passive_to_active_scan == - MLAN_PASS_TO_ACT_SCAN_EN) { + MLAN_PASS_TO_ACT_SCAN_EN) { (pscan_chan_list + chan_list_idx) - ->chan_scan_mode. - passive_to_active_scan = MTRUE; - scan_dur = - MAX(MIN_PASSIVE_TO_ACTIVE_SCAN_TIME, - scan_dur); + ->chan_scan_mode.passive_to_active_scan = + MTRUE; + scan_dur = MAX(MIN_PASSIVE_TO_ACTIVE_SCAN_TIME, + scan_dur); } PRINTM(MINFO, "chan=%d, mode=%d, passive_to_active=%d\n", (pscan_chan_list + chan_list_idx)->chan_number, (pscan_chan_list + chan_list_idx) - ->chan_scan_mode.passive_scan, + ->chan_scan_mode.passive_scan, (pscan_chan_list + chan_list_idx) - ->chan_scan_mode.passive_to_active_scan); + ->chan_scan_mode.passive_to_active_scan); (pscan_chan_list + chan_list_idx)->min_scan_time = wlan_cpu_to_le16(scan_dur); @@ -1602,9 +1604,6 @@ *pfiltered_scan); PRINTM(MCMND, "Scan: Creating full region channel list %d\n", num_of_channel); - if (num_of_channel > MRVDRV_MAX_CHANNELS_PER_SCAN) - pmadapter->ext_scan_type = EXT_SCAN_DEFAULT; - } LEAVE(); @@ -1627,12 +1626,11 @@ * * @return N/A */ -static t_void -wlan_ret_802_11_scan_get_tlv_ptrs(pmlan_adapter pmadapter, - MrvlIEtypes_Data_t *ptlv, - t_u32 tlv_buf_size, - t_u32 req_tlv_type, - MrvlIEtypes_Data_t **pptlv) +static t_void wlan_ret_802_11_scan_get_tlv_ptrs(pmlan_adapter pmadapter, + MrvlIEtypes_Data_t *ptlv, + t_u32 tlv_buf_size, + t_u32 req_tlv_type, + MrvlIEtypes_Data_t **pptlv) { MrvlIEtypes_Data_t *pcurrent_tlv; t_u32 tlv_buf_left; @@ -1696,7 +1694,7 @@ pcurrent_tlv = (MrvlIEtypes_Data_t *)(pcurrent_tlv->data + tlv_len); - } /* while */ + } /* while */ LEAVE(); } @@ -1716,11 +1714,11 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, - BSSDescriptor_t *pbss_entry, - t_u8 **pbeacon_info, t_u32 *bytes_left, - t_u8 ext_scan) +static mlan_status wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, + BSSDescriptor_t *pbss_entry, + t_u8 **pbeacon_info, + t_u32 *bytes_left, + t_u8 ext_scan) { mlan_status ret = MLAN_STATUS_SUCCESS; IEEEtypes_ElementId_e element_id; @@ -1742,9 +1740,10 @@ IEEEtypes_ERPInfo_t *perp_info; IEEEtypes_VendorSpecific_t *pvendor_ie; - const t_u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 }; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; - const t_u8 osen_oui[] = { 0x50, 0x6f, 0x9a, 0x12 }; + const t_u8 wpa_oui[4] = {0x00, 0x50, 0xf2, 0x01}; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; + const t_u8 owe_oui[4] = {0x50, 0x6f, 0x9a, 0x1c}; + const t_u8 osen_oui[] = {0x50, 0x6f, 0x9a, 0x12}; IEEEtypes_CountryInfoSet_t *pcountry_info; IEEEtypes_Extension_t *pext_tlv; @@ -1866,7 +1865,7 @@ if (pcap_info->spectrum_mgmt == 1) { PRINTM(MINFO, "InterpretIE: 11h- Spectrum Management " - "capability bit found\n"); + "capability bit found\n"); pbss_entry->wlan_11h_bss_info.sensed_11h = 1; } @@ -1878,7 +1877,7 @@ if (bytes_left_for_current_beacon < total_ie_len) { PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + "bytes left < IE length\n"); bytes_left_for_current_beacon = 0; ret = MLAN_STATUS_FAILURE; continue; @@ -1926,13 +1925,13 @@ &pbss_entry->phy_param_set.fh_param_set, pfh_param_set, total_ie_len, sizeof(IEEEtypes_FhParamSet_t)); - pbss_entry->phy_param_set.fh_param_set.len = - MIN(element_len, - (sizeof(IEEEtypes_FhParamSet_t) - - sizeof(IEEEtypes_Header_t))); + pbss_entry->phy_param_set.fh_param_set.len = MIN( + element_len, (sizeof(IEEEtypes_FhParamSet_t) - + sizeof(IEEEtypes_Header_t))); pbss_entry->phy_param_set.fh_param_set.dwell_time = - wlan_le16_to_cpu(pbss_entry->phy_param_set. - fh_param_set.dwell_time); + wlan_le16_to_cpu( + pbss_entry->phy_param_set.fh_param_set + .dwell_time); break; case DS_PARAM_SET: @@ -1945,10 +1944,9 @@ &pbss_entry->phy_param_set.ds_param_set, pds_param_set, total_ie_len, sizeof(IEEEtypes_DsParamSet_t)); - pbss_entry->phy_param_set.ds_param_set.len = - MIN(element_len, - (sizeof(IEEEtypes_DsParamSet_t) - - sizeof(IEEEtypes_Header_t))); + pbss_entry->phy_param_set.ds_param_set.len = MIN( + element_len, (sizeof(IEEEtypes_DsParamSet_t) - + sizeof(IEEEtypes_Header_t))); break; case CF_PARAM_SET: @@ -1957,10 +1955,9 @@ &pbss_entry->ss_param_set.cf_param_set, pcf_param_set, total_ie_len, sizeof(IEEEtypes_CfParamSet_t)); - pbss_entry->ss_param_set.cf_param_set.len = - MIN(element_len, - (sizeof(IEEEtypes_CfParamSet_t) - - sizeof(IEEEtypes_Header_t))); + pbss_entry->ss_param_set.cf_param_set.len = MIN( + element_len, (sizeof(IEEEtypes_CfParamSet_t) - + sizeof(IEEEtypes_Header_t))); break; case IBSS_PARAM_SET: @@ -1972,21 +1969,20 @@ &pbss_entry->ss_param_set.ibss_param_set, pibss_param_set, total_ie_len, sizeof(IEEEtypes_IbssParamSet_t)); - pbss_entry->ss_param_set.ibss_param_set.len = - MIN(element_len, - (sizeof(IEEEtypes_IbssParamSet_t) - - sizeof(IEEEtypes_Header_t))); + pbss_entry->ss_param_set.ibss_param_set.len = MIN( + element_len, (sizeof(IEEEtypes_IbssParamSet_t) - + sizeof(IEEEtypes_Header_t))); break; - /* Handle Country Info IE */ + /* Handle Country Info IE */ case COUNTRY_INFO: pcountry_info = (IEEEtypes_CountryInfoSet_t *)pcurrent_ptr; if (pcountry_info->len < - sizeof(pcountry_info->country_code) || + sizeof(pcountry_info->country_code) || (unsigned)(pcountry_info->len + 2) > - sizeof(IEEEtypes_CountryInfoFullSet_t)) { + sizeof(IEEEtypes_CountryInfoFullSet_t)) { PRINTM(MERROR, "InterpretIE: 11D- Err " "country_info len =%d min=%d max=%d\n", @@ -2018,10 +2014,9 @@ case IBSS_DFS: case SUPPORTED_CHANNELS: case TPC_REQUEST: - wlan_11h_process_bss_elem(pmadapter, - &pbss_entry-> - wlan_11h_bss_info, - pcurrent_ptr); + wlan_11h_process_bss_elem( + pmadapter, &pbss_entry->wlan_11h_bss_info, + pcurrent_ptr); break; case EXTENDED_SUPPORTED_RATES: /* @@ -2061,7 +2056,7 @@ wpa_oui, sizeof(wpa_oui))) { pbss_entry->pwpa_ie = (IEEEtypes_VendorSpecific_t *) - pcurrent_ptr; + pcurrent_ptr; pbss_entry->wpa_offset = (t_u16)(pcurrent_ptr - pbss_entry->pbeacon_buf); @@ -2069,13 +2064,12 @@ (t_u8 *)pbss_entry->pwpa_ie, ((*(pbss_entry->pwpa_ie)).vend_hdr.len + sizeof(IEEEtypes_Header_t))); - } else if (!memcmp - (pmadapter, pvendor_ie->vend_hdr.oui, - wmm_oui, sizeof(wmm_oui))) { + } else if (!memcmp(pmadapter, pvendor_ie->vend_hdr.oui, + wmm_oui, sizeof(wmm_oui))) { if (total_ie_len == - sizeof(IEEEtypes_WmmParameter_t) || + sizeof(IEEEtypes_WmmParameter_t) || total_ie_len == - sizeof(IEEEtypes_WmmInfo_t)) { + sizeof(IEEEtypes_WmmInfo_t)) { /* * Only accept and copy the WMM IE if * it matches the size expected for the @@ -2089,6 +2083,54 @@ (t_u8 *)&pbss_entry->wmm_ie, total_ie_len); } + } else if (IS_FW_SUPPORT_EMBEDDED_OWE(pmadapter) && + !memcmp(pmadapter, pvendor_ie->vend_hdr.oui, + owe_oui, sizeof(owe_oui))) { + /* Current Format of OWE IE is + * element_id:element_len:oui:MAC Address:SSID + * length:SSID */ + t_u8 trans_ssid_len = *( + pcurrent_ptr + + sizeof(IEEEtypes_Header_t) + + sizeof(owe_oui) + MLAN_MAC_ADDR_LENGTH); + + if (!trans_ssid_len || + trans_ssid_len > MRVDRV_MAX_SSID_LENGTH) { + bytes_left_for_current_beacon = 0; + continue; + } + if (!pcap_info->privacy) + pbss_entry->owe_transition_mode = + OWE_TRANS_MODE_OPEN; + else + pbss_entry->owe_transition_mode = + OWE_TRANS_MODE_OWE; + + memcpy_ext( + pmadapter, + pbss_entry->trans_mac_address, + (pcurrent_ptr + + sizeof(IEEEtypes_Header_t) + + sizeof(owe_oui)), + MLAN_MAC_ADDR_LENGTH, + sizeof(pbss_entry->trans_mac_address)); + pbss_entry->trans_ssid.ssid_len = + trans_ssid_len; + memcpy_ext( + pmadapter, pbss_entry->trans_ssid.ssid, + (pcurrent_ptr + + sizeof(IEEEtypes_Header_t) + + sizeof(owe_oui) + + MLAN_MAC_ADDR_LENGTH + sizeof(t_u8)), + trans_ssid_len, + sizeof(pbss_entry->trans_ssid.ssid)); + + PRINTM(MCMND, + "InterpretIE: OWE Transition AP privacy=%d MAC Addr-" MACSTR + " ssid %s\n", + pbss_entry->owe_transition_mode, + MAC2STR(pbss_entry->trans_mac_address), + pbss_entry->trans_ssid.ssid); } else if (!memcmp(pmadapter, pvendor_ie->vend_hdr.oui, osen_oui, sizeof(osen_oui))) { pbss_entry->posen_ie = @@ -2099,7 +2141,7 @@ HEXDUMP("InterpretIE: Resp OSEN_IE", (t_u8 *)pbss_entry->posen_ie, (*(pbss_entry->posen_ie)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); } break; case RSN_IE: @@ -2110,7 +2152,7 @@ HEXDUMP("InterpretIE: Resp RSN_IE", (t_u8 *)pbss_entry->prsn_ie, (*(pbss_entry->prsn_ie)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case RSNX_IE: pbss_entry->prsnx_ie = @@ -2120,7 +2162,7 @@ HEXDUMP("InterpretIE: Resp RSNX_IE", (t_u8 *)pbss_entry->prsnx_ie, (*(pbss_entry->prsnx_ie)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case WAPI_IE: pbss_entry->pwapi_ie = @@ -2130,7 +2172,7 @@ HEXDUMP("InterpretIE: Resp WAPI_IE", (t_u8 *)pbss_entry->pwapi_ie, (*(pbss_entry->pwapi_ie)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case MULTI_BSSID: if (IS_FW_SUPPORT_MULTIBSSID(pmadapter)) { @@ -2146,7 +2188,7 @@ HEXDUMP("InterpretIE: Resp HTCAP_IE", (t_u8 *)pbss_entry->pht_cap, (*(pbss_entry->pht_cap)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case HT_OPERATION: pbss_entry->pht_info = @@ -2156,7 +2198,7 @@ HEXDUMP("InterpretIE: Resp HTINFO_IE", (t_u8 *)pbss_entry->pht_info, (*(pbss_entry->pht_info)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case BSSCO_2040: pbss_entry->pbss_co_2040 = @@ -2166,7 +2208,7 @@ HEXDUMP("InterpretIE: Resp 2040BSSCOEXISTANCE_IE", (t_u8 *)pbss_entry->pbss_co_2040, (*(pbss_entry->pbss_co_2040)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case EXT_CAPABILITY: pbss_entry->pext_cap = @@ -2176,7 +2218,7 @@ HEXDUMP("InterpretIE: Resp EXTCAP_IE", (t_u8 *)pbss_entry->pext_cap, (*(pbss_entry->pext_cap)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case OVERLAPBSSSCANPARAM: pbss_entry->poverlap_bss_scan_param = @@ -2186,7 +2228,8 @@ HEXDUMP("InterpretIE: Resp OBSS_IE", (t_u8 *)pbss_entry->poverlap_bss_scan_param, (*(pbss_entry->poverlap_bss_scan_param)) - .ieee_hdr.len + sizeof(IEEEtypes_Header_t)); + .ieee_hdr.len + + sizeof(IEEEtypes_Header_t)); break; case VHT_CAPABILITY: pbss_entry->pvht_cap = @@ -2196,7 +2239,7 @@ HEXDUMP("InterpretIE: Resp VHTCAP_IE", (t_u8 *)pbss_entry->pvht_cap, (*(pbss_entry->pvht_cap)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case VHT_OPERATION: pbss_entry->pvht_oprat = @@ -2206,7 +2249,7 @@ HEXDUMP("InterpretIE: Resp VHTOPER_IE", (t_u8 *)pbss_entry->pvht_oprat, (*(pbss_entry->pvht_oprat)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case EXT_BSS_LOAD: pbss_entry->pext_bssload = @@ -2216,7 +2259,7 @@ HEXDUMP("InterpretIE: Resp EXTBSSLOAD_IE", (t_u8 *)pbss_entry->pext_bssload, (*(pbss_entry->pext_bssload)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case VHT_TX_POWER_ENV: pbss_entry->pvht_txpower = @@ -2226,7 +2269,7 @@ HEXDUMP("InterpretIE: Resp TXPOW_IE", (t_u8 *)pbss_entry->pvht_txpower, (*(pbss_entry->pvht_txpower)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case EXT_POWER_CONSTR: pbss_entry->pext_pwer = @@ -2236,7 +2279,7 @@ HEXDUMP("InterpretIE: Resp EXTPOW_IE", (t_u8 *)pbss_entry->pext_pwer, (*(pbss_entry->pext_pwer)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case QUIET_CHAN: pbss_entry->pquiet_chan = @@ -2246,7 +2289,7 @@ HEXDUMP("InterpretIE: Resp QUIETCHAN_IE", (t_u8 *)pbss_entry->pquiet_chan, (*(pbss_entry->pquiet_chan)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case BW_CHANNEL_SWITCH: /* RANDYTODO */ @@ -2261,14 +2304,14 @@ HEXDUMP("InterpretIE: Resp OPERMODENTF_IE", (t_u8 *)pbss_entry->poper_mode, (*(pbss_entry->poper_mode)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case EXTENSION: - pext_tlv = (IEEEtypes_Extension_t *) pcurrent_ptr; + pext_tlv = (IEEEtypes_Extension_t *)pcurrent_ptr; switch (pext_tlv->ext_id) { case HE_CAPABILITY: pbss_entry->phe_cap = - (IEEEtypes_HECap_t *) pcurrent_ptr; + (IEEEtypes_HECap_t *)pcurrent_ptr; pbss_entry->he_cap_offset = (t_u16)(pcurrent_ptr - pbss_entry->pbeacon_buf); @@ -2292,7 +2335,7 @@ HEXDUMP("InterpretIE: Resp Mobility Domain IE", (t_u8 *)pbss_entry->pmd_ie, (*(pbss_entry->pmd_ie)).ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; default: break; @@ -2303,7 +2346,7 @@ /* Need to account for IE ID and IE Len */ bytes_left_for_current_beacon -= (element_len + 2); - } /* while (bytes_left_for_current_beacon > 2) */ + } /* while (bytes_left_for_current_beacon > 2) */ LEAVE(); return ret; @@ -2317,134 +2360,126 @@ * * @return N/A */ -static t_void -wlan_adjust_ie_in_bss_entry(mlan_private *pmpriv, BSSDescriptor_t *pbss_entry) +static t_void wlan_adjust_ie_in_bss_entry(mlan_private *pmpriv, + BSSDescriptor_t *pbss_entry) { ENTER(); if (pbss_entry->pbeacon_buf) { if (pbss_entry->pwpa_ie) { pbss_entry->pwpa_ie = (IEEEtypes_VendorSpecific_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->wpa_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->wpa_offset); } if (pbss_entry->prsn_ie) { pbss_entry->prsn_ie = - (IEEEtypes_Generic_t *)(pbss_entry-> - pbeacon_buf + + (IEEEtypes_Generic_t *)(pbss_entry->pbeacon_buf + pbss_entry->rsn_offset); } if (pbss_entry->pwapi_ie) { pbss_entry->pwapi_ie = - (IEEEtypes_Generic_t *)(pbss_entry-> - pbeacon_buf + - pbss_entry-> - wapi_offset); + (IEEEtypes_Generic_t *)(pbss_entry->pbeacon_buf + + pbss_entry->wapi_offset); } if (pbss_entry->posen_ie) { pbss_entry->posen_ie = - (IEEEtypes_Generic_t *)(pbss_entry-> - pbeacon_buf + - pbss_entry-> - osen_offset); + (IEEEtypes_Generic_t *)(pbss_entry->pbeacon_buf + + pbss_entry->osen_offset); } if (pbss_entry->pmd_ie) { pbss_entry->pmd_ie = (IEEEtypes_MobilityDomain_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->md_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->md_offset); } if (pbss_entry->pht_cap) { pbss_entry->pht_cap = (IEEEtypes_HTCap_t *)(pbss_entry->pbeacon_buf + - pbss_entry-> - ht_cap_offset); + pbss_entry->ht_cap_offset); } if (pbss_entry->pht_info) { pbss_entry->pht_info = (IEEEtypes_HTInfo_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->ht_info_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->ht_info_offset); } if (pbss_entry->pbss_co_2040) { pbss_entry->pbss_co_2040 = (IEEEtypes_2040BSSCo_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->bss_co_2040_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->bss_co_2040_offset); } if (pbss_entry->pext_cap) { pbss_entry->pext_cap = (IEEEtypes_ExtCap_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->ext_cap_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->ext_cap_offset); } if (pbss_entry->poverlap_bss_scan_param) { pbss_entry->poverlap_bss_scan_param = (IEEEtypes_OverlapBSSScanParam_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->overlap_bss_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->overlap_bss_offset); } if (pbss_entry->pvht_cap) { pbss_entry->pvht_cap = (IEEEtypes_VHTCap_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->vht_cap_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->vht_cap_offset); } if (pbss_entry->pvht_oprat) { pbss_entry->pvht_oprat = (IEEEtypes_VHTOprat_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->vht_oprat_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->vht_oprat_offset); } if (pbss_entry->pvht_txpower) { pbss_entry->pvht_txpower = (IEEEtypes_VHTtxpower_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->vht_txpower_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->vht_txpower_offset); } if (pbss_entry->pext_pwer) { pbss_entry->pext_pwer = (IEEEtypes_ExtPwerCons_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->ext_pwer_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->ext_pwer_offset); } if (pbss_entry->pext_bssload) { pbss_entry->pext_bssload = (IEEEtypes_ExtBSSload_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->ext_bssload_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->ext_bssload_offset); } if (pbss_entry->pquiet_chan) { pbss_entry->pquiet_chan = (IEEEtypes_QuietChan_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->quiet_chan_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->quiet_chan_offset); } if (pbss_entry->poper_mode) { pbss_entry->poper_mode = (IEEEtypes_OperModeNtf_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->oper_mode_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->oper_mode_offset); } if (pbss_entry->phe_cap) { pbss_entry->phe_cap = - (IEEEtypes_HECap_t *) (pbss_entry->pbeacon_buf + - pbss_entry-> - he_cap_offset); + (IEEEtypes_HECap_t *)(pbss_entry->pbeacon_buf + + pbss_entry->he_cap_offset); } if (pbss_entry->phe_oprat) { pbss_entry->phe_oprat = (IEEEtypes_Extension_t - *) (pbss_entry->pbeacon_buf + - pbss_entry->he_oprat_offset); + *)(pbss_entry->pbeacon_buf + + pbss_entry->he_oprat_offset); } if (pbss_entry->prsnx_ie) { pbss_entry->prsnx_ie = - (IEEEtypes_Generic_t - *)(pbss_entry->pbeacon_buf + - pbss_entry->rsnx_offset); + (IEEEtypes_Generic_t *)(pbss_entry->pbeacon_buf + + pbss_entry->rsnx_offset); } } else { pbss_entry->pwpa_ie = MNULL; @@ -2498,11 +2533,10 @@ * * @return N/A */ -static t_void -wlan_ret_802_11_scan_store_beacon(mlan_private *pmpriv, - t_u32 beacon_idx, - t_u32 num_of_ent, - BSSDescriptor_t *pnew_beacon) +static t_void wlan_ret_802_11_scan_store_beacon(mlan_private *pmpriv, + t_u32 beacon_idx, + t_u32 num_of_ent, + BSSDescriptor_t *pnew_beacon) { mlan_adapter *pmadapter = pmpriv->adapter; t_u8 *pbcn_store; @@ -2610,20 +2644,20 @@ for (adj_idx = 0; adj_idx < num_of_ent; adj_idx++) { if (pmadapter->pscan_table[adj_idx] - .pbeacon_buf > pbcn_store) { + .pbeacon_buf > pbcn_store) { pmadapter->pscan_table[adj_idx] .pbeacon_buf -= (bcn_space - old_bcn_size); - wlan_adjust_ie_in_bss_entry - (pmpriv, - &pmadapter-> - pscan_table[adj_idx]); + wlan_adjust_ie_in_bss_entry( + pmpriv, + &pmadapter->pscan_table + [adj_idx]); } } } } else if (pmadapter->pbcn_buf_end + - (new_bcn_size - bcn_space) < + (new_bcn_size - bcn_space) < (pmadapter->bcn_buf + pmadapter->bcn_buf_size)) { /* * Beacon is larger than space previously allocated @@ -2636,8 +2670,7 @@ beacon_idx, old_bcn_size, new_bcn_size, bcn_space, (pmadapter->bcn_buf_size - - (pmadapter->pbcn_buf_end - - pmadapter->bcn_buf))); + (pmadapter->pbcn_buf_end - pmadapter->bcn_buf))); /* * memmove (since the memory overlaps) the data @@ -2652,8 +2685,7 @@ (t_ptr)new_bcn_size), (void *)((t_ptr)pbcn_store + (t_ptr)bcn_space), (t_u32)((t_ptr)pmadapter->pbcn_buf_end - - ((t_ptr)pbcn_store + - (t_ptr)bcn_space))); + ((t_ptr)pbcn_store + (t_ptr)bcn_space))); /* Copy the new beacon buffer entry over the old one */ memcpy_ext(pmadapter, pbcn_store, @@ -2676,15 +2708,14 @@ /* Adjust beacon buffer pointers that are past the * current */ for (adj_idx = 0; adj_idx < num_of_ent; adj_idx++) { - if (pmadapter->pscan_table[adj_idx]. - pbeacon_buf > pbcn_store) { + if (pmadapter->pscan_table[adj_idx].pbeacon_buf > + pbcn_store) { pmadapter->pscan_table[adj_idx] .pbeacon_buf += (new_bcn_size - bcn_space); - wlan_adjust_ie_in_bss_entry(pmpriv, - &pmadapter-> - pscan_table - [adj_idx]); + wlan_adjust_ie_in_bss_entry( + pmpriv, + &pmadapter->pscan_table[adj_idx]); } } } else { @@ -2699,125 +2730,123 @@ beacon_idx, old_bcn_size, new_bcn_size, bcn_space, (pmadapter->bcn_buf_size - - (pmadapter->pbcn_buf_end - - pmadapter->bcn_buf))); + (pmadapter->pbcn_buf_end - pmadapter->bcn_buf))); /* Storage failure, keep old beacon intact */ pnew_beacon->beacon_buf_size = old_bcn_size; if (pnew_beacon->pwpa_ie) pnew_beacon->wpa_offset = pmadapter->pscan_table[beacon_idx] - .wpa_offset; + .wpa_offset; if (pnew_beacon->prsn_ie) pnew_beacon->rsn_offset = pmadapter->pscan_table[beacon_idx] - .rsn_offset; + .rsn_offset; if (pnew_beacon->pwapi_ie) pnew_beacon->wapi_offset = pmadapter->pscan_table[beacon_idx] - .wapi_offset; + .wapi_offset; if (pnew_beacon->posen_ie) pnew_beacon->osen_offset = pmadapter->pscan_table[beacon_idx] - .osen_offset; + .osen_offset; if (pnew_beacon->pmd_ie) pnew_beacon->md_offset = pmadapter->pscan_table[beacon_idx] - .md_offset; + .md_offset; if (pnew_beacon->pht_cap) pnew_beacon->ht_cap_offset = pmadapter->pscan_table[beacon_idx] - .ht_cap_offset; + .ht_cap_offset; if (pnew_beacon->pht_info) pnew_beacon->ht_info_offset = pmadapter->pscan_table[beacon_idx] - .ht_info_offset; + .ht_info_offset; if (pnew_beacon->pbss_co_2040) pnew_beacon->bss_co_2040_offset = pmadapter->pscan_table[beacon_idx] - .bss_co_2040_offset; + .bss_co_2040_offset; if (pnew_beacon->pext_cap) pnew_beacon->ext_cap_offset = pmadapter->pscan_table[beacon_idx] - .ext_cap_offset; + .ext_cap_offset; if (pnew_beacon->poverlap_bss_scan_param) pnew_beacon->overlap_bss_offset = pmadapter->pscan_table[beacon_idx] - .overlap_bss_offset; + .overlap_bss_offset; if (pnew_beacon->pvht_cap) pnew_beacon->vht_cap_offset = pmadapter->pscan_table[beacon_idx] - .vht_cap_offset; + .vht_cap_offset; if (pnew_beacon->pvht_oprat) pnew_beacon->vht_oprat_offset = pmadapter->pscan_table[beacon_idx] - .vht_oprat_offset; + .vht_oprat_offset; if (pnew_beacon->pvht_txpower) pnew_beacon->vht_txpower_offset = pmadapter->pscan_table[beacon_idx] - .vht_txpower_offset; + .vht_txpower_offset; if (pnew_beacon->pext_pwer) pnew_beacon->ext_pwer_offset = pmadapter->pscan_table[beacon_idx] - .ext_pwer_offset; + .ext_pwer_offset; if (pnew_beacon->pext_bssload) pnew_beacon->ext_bssload_offset = pmadapter->pscan_table[beacon_idx] - .ext_bssload_offset; + .ext_bssload_offset; if (pnew_beacon->pquiet_chan) pnew_beacon->quiet_chan_offset = pmadapter->pscan_table[beacon_idx] - .quiet_chan_offset; + .quiet_chan_offset; if (pnew_beacon->poper_mode) pnew_beacon->oper_mode_offset = pmadapter->pscan_table[beacon_idx] - .oper_mode_offset; + .oper_mode_offset; if (pnew_beacon->phe_cap) pnew_beacon->he_cap_offset = pmadapter->pscan_table[beacon_idx] - .he_cap_offset; + .he_cap_offset; if (pnew_beacon->phe_oprat) pnew_beacon->he_oprat_offset = pmadapter->pscan_table[beacon_idx] - .he_oprat_offset; + .he_oprat_offset; if (pnew_beacon->prsnx_ie) pnew_beacon->rsnx_offset = pmadapter->pscan_table[beacon_idx] - .rsnx_offset; + .rsnx_offset; } /* Point the new entry to its permanent storage space */ pnew_beacon->pbeacon_buf = pbcn_store; wlan_adjust_ie_in_bss_entry(pmpriv, pnew_beacon); } else { if ((pmadapter->pbcn_buf_end + pnew_beacon->beacon_buf_size + - SCAN_BEACON_ENTRY_PAD > + SCAN_BEACON_ENTRY_PAD > (pmadapter->bcn_buf + pmadapter->bcn_buf_size)) && (pmadapter->bcn_buf_size < MAX_SCAN_BEACON_BUFFER)) { /* no space for this entry, realloc bcn buffer */ if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - ret = pmadapter->callbacks. - moal_vmalloc(pmadapter->pmoal_handle, - pmadapter->bcn_buf_size + - DEFAULT_SCAN_BEACON_BUFFER, - (t_u8 **)&tmp_buf); + ret = pmadapter->callbacks.moal_vmalloc( + pmadapter->pmoal_handle, + pmadapter->bcn_buf_size + + DEFAULT_SCAN_BEACON_BUFFER, + (t_u8 **)&tmp_buf); else - ret = pmadapter->callbacks. - moal_malloc(pmadapter->pmoal_handle, - pmadapter->bcn_buf_size + - DEFAULT_SCAN_BEACON_BUFFER, - MLAN_MEM_DEF, - (t_u8 **)&tmp_buf); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, + pmadapter->bcn_buf_size + + DEFAULT_SCAN_BEACON_BUFFER, + MLAN_MEM_DEF, (t_u8 **)&tmp_buf); if ((ret == MLAN_STATUS_SUCCESS) && (tmp_buf)) { PRINTM(MCMND, "Realloc Beacon buffer, old size=%d, new_size=%d\n", pmadapter->bcn_buf_size, pmadapter->bcn_buf_size + - DEFAULT_SCAN_BEACON_BUFFER); + DEFAULT_SCAN_BEACON_BUFFER); bcn_size = pmadapter->pbcn_buf_end - - pmadapter->bcn_buf; + pmadapter->bcn_buf; memcpy_ext(pmadapter, tmp_buf, pmadapter->bcn_buf, bcn_size, bcn_size); @@ -2827,30 +2856,25 @@ adj_idx++) { bcn_offset = pmadapter->pscan_table[adj_idx] - .pbeacon_buf - + .pbeacon_buf - pmadapter->bcn_buf; pmadapter->pscan_table[adj_idx] .pbeacon_buf = tmp_buf + bcn_offset; - wlan_adjust_ie_in_bss_entry(pmpriv, - &pmadapter-> - pscan_table - [adj_idx]); + wlan_adjust_ie_in_bss_entry( + pmpriv, + &pmadapter->pscan_table[adj_idx]); } pmadapter->pbcn_buf_end = tmp_buf + bcn_size; if (pmadapter->callbacks.moal_vmalloc && pmadapter->callbacks.moal_vfree) - pmadapter->callbacks. - moal_vfree(pmadapter-> - pmoal_handle, - (t_u8 *)pmadapter-> - bcn_buf); + pmadapter->callbacks.moal_vfree( + pmadapter->pmoal_handle, + (t_u8 *)pmadapter->bcn_buf); else - pmadapter->callbacks. - moal_mfree(pmadapter-> - pmoal_handle, - (t_u8 *)pmadapter-> - bcn_buf); + pmadapter->callbacks.moal_mfree( + pmadapter->pmoal_handle, + (t_u8 *)pmadapter->bcn_buf); pmadapter->bcn_buf = tmp_buf; pmadapter->bcn_buf_size += DEFAULT_SCAN_BEACON_BUFFER; @@ -2861,7 +2885,7 @@ * if we can fit it in the remaining space */ if (pmadapter->pbcn_buf_end + pnew_beacon->beacon_buf_size + - SCAN_BEACON_ENTRY_PAD < + SCAN_BEACON_ENTRY_PAD < (pmadapter->bcn_buf + pmadapter->bcn_buf_size)) { /* * Copy the beacon buffer data from the local entry @@ -2894,8 +2918,7 @@ beacon_idx, pnew_beacon->beacon_buf_size, (pmadapter->pbcn_buf_end - pmadapter->bcn_buf), (pmadapter->bcn_buf_size - - (pmadapter->pbcn_buf_end - - pmadapter->bcn_buf))); + (pmadapter->pbcn_buf_end - pmadapter->bcn_buf))); } else { /* * No space for new beacon @@ -2906,8 +2929,7 @@ beacon_idx, MAC2STR(pnew_beacon->mac_address), pnew_beacon->beacon_buf_size, (pmadapter->bcn_buf_size - - (pmadapter->pbcn_buf_end - - pmadapter->bcn_buf))); + (pmadapter->pbcn_buf_end - pmadapter->bcn_buf))); /* * Storage failure; clear storage records @@ -2930,8 +2952,7 @@ * * @return MLAN_STATUS_SUCCESS, otherwise failure */ -static mlan_status -wlan_update_curr_bcn(mlan_private *pmpriv) +static mlan_status wlan_update_curr_bcn(mlan_private *pmpriv) { BSSDescriptor_t *pcurr_bss = &pmpriv->curr_bss_params.bss_descriptor; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2947,8 +2968,8 @@ if (pcurr_bss->pwpa_ie) { pcurr_bss->pwpa_ie = (IEEEtypes_VendorSpecific_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->wpa_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->wpa_offset); } if (pcurr_bss->prsn_ie) { pcurr_bss->prsn_ie = @@ -2957,8 +2978,8 @@ } if (pcurr_bss->pmd_ie) { pcurr_bss->pmd_ie = (IEEEtypes_MobilityDomain_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->md_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->md_offset); } if (pcurr_bss->pht_cap) { pcurr_bss->pht_cap = @@ -2969,97 +2990,95 @@ if (pcurr_bss->pht_info) { pcurr_bss->pht_info = (IEEEtypes_HTInfo_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->ht_info_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->ht_info_offset); } if (pcurr_bss->pbss_co_2040) { pcurr_bss->pbss_co_2040 = (IEEEtypes_2040BSSCo_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->bss_co_2040_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->bss_co_2040_offset); } if (pcurr_bss->pext_cap) { pcurr_bss->pext_cap = (IEEEtypes_ExtCap_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->ext_cap_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->ext_cap_offset); } if (pcurr_bss->poverlap_bss_scan_param) { pcurr_bss->poverlap_bss_scan_param = (IEEEtypes_OverlapBSSScanParam_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->overlap_bss_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->overlap_bss_offset); } if (pcurr_bss->pvht_cap) { pcurr_bss->pvht_cap = (IEEEtypes_VHTCap_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->vht_cap_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->vht_cap_offset); } if (pcurr_bss->pvht_oprat) { pcurr_bss->pvht_oprat = (IEEEtypes_VHTOprat_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->vht_oprat_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->vht_oprat_offset); } if (pcurr_bss->pvht_txpower) { pcurr_bss->pvht_txpower = (IEEEtypes_VHTtxpower_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->vht_txpower_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->vht_txpower_offset); } if (pcurr_bss->pext_pwer) { pcurr_bss->pext_pwer = (IEEEtypes_ExtPwerCons_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->ext_pwer_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->ext_pwer_offset); } if (pcurr_bss->pext_bssload) { pcurr_bss->pext_bssload = (IEEEtypes_ExtBSSload_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->ext_bssload_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->ext_bssload_offset); } if (pcurr_bss->pquiet_chan) { pcurr_bss->pquiet_chan = (IEEEtypes_QuietChan_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->quiet_chan_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->quiet_chan_offset); } if (pcurr_bss->poper_mode) { pcurr_bss->poper_mode = (IEEEtypes_OperModeNtf_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->oper_mode_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->oper_mode_offset); } if (pcurr_bss->phe_cap) { pcurr_bss->phe_cap = - (IEEEtypes_HECap_t *) (pcurr_bss->pbeacon_buf + - pcurr_bss-> - he_cap_offset); + (IEEEtypes_HECap_t *)(pcurr_bss->pbeacon_buf + + pcurr_bss->he_cap_offset); } if (pcurr_bss->phe_oprat) { pcurr_bss->phe_oprat = (IEEEtypes_Extension_t - *) (pcurr_bss->pbeacon_buf + - pcurr_bss->he_oprat_offset); + *)(pcurr_bss->pbeacon_buf + + pcurr_bss->he_oprat_offset); } if (pcurr_bss->prsnx_ie) { pcurr_bss->prsnx_ie = - (IEEEtypes_Generic_t - *)(pcurr_bss->pbeacon_buf + - pcurr_bss->rsnx_offset); + (IEEEtypes_Generic_t *)(pcurr_bss->pbeacon_buf + + pcurr_bss->rsnx_offset); } PRINTM(MINFO, "current beacon restored %d\n", @@ -3081,8 +3100,7 @@ * * @return channel load */ -static t_u16 -wlan_get_chan_load(mlan_adapter *pmadapter, t_u8 channel) +static t_u16 wlan_get_chan_load(mlan_adapter *pmadapter, t_u8 channel) { t_u16 chan_load = 0; int i; @@ -3107,8 +3125,8 @@ * @param min_flag flag to get min rssi * @return rssi */ -static t_u8 -wlan_get_chan_rssi(mlan_adapter *pmadapter, t_u8 channel, t_u8 min_flag) +static t_u8 wlan_get_chan_rssi(mlan_adapter *pmadapter, t_u8 channel, + t_u8 min_flag) { t_u8 rssi = 0; int i; @@ -3118,13 +3136,13 @@ rssi = (t_s32)pmadapter->pscan_table[i].rssi; else { if (min_flag) - rssi = MIN(rssi, - pmadapter->pscan_table[i]. - rssi); + rssi = MIN( + rssi, + pmadapter->pscan_table[i].rssi); else - rssi = MAX(rssi, - pmadapter->pscan_table[i]. - rssi); + rssi = MAX( + rssi, + pmadapter->pscan_table[i].rssi); } } } @@ -3137,8 +3155,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return N/A */ -static t_void -wlan_update_chan_rssi(mlan_adapter *pmadapter) +static t_void wlan_update_chan_rssi(mlan_adapter *pmadapter) { int i; t_s8 min_rssi = 0; @@ -3147,14 +3164,12 @@ for (i = 0; i < (int)pmadapter->num_in_chan_stats; i++) { if (pmadapter->pchan_stats[i].chan_num && pmadapter->pchan_stats[i].cca_scan_duration) { - min_rssi = - -wlan_get_chan_rssi(pmadapter, - pmadapter->pchan_stats[i]. - chan_num, MFALSE); - max_rssi = - -wlan_get_chan_rssi(pmadapter, - pmadapter->pchan_stats[i]. - chan_num, MTRUE); + min_rssi = -wlan_get_chan_rssi( + pmadapter, pmadapter->pchan_stats[i].chan_num, + MFALSE); + max_rssi = -wlan_get_chan_rssi( + pmadapter, pmadapter->pchan_stats[i].chan_num, + MTRUE); rss = min_rssi - pmadapter->pchan_stats[i].noise; // rss should always > 0, FW need fix the wrong // rssi/noise in scantable @@ -3193,8 +3208,7 @@ * * @return N/A */ -static t_void -wlan_scan_process_results(mlan_private *pmpriv) +static t_void wlan_scan_process_results(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; t_s32 j; @@ -3206,20 +3220,19 @@ ENTER(); if (pmpriv->media_connected == MTRUE) { - j = wlan_find_bssid_in_list(pmpriv, - pmpriv->curr_bss_params. - bss_descriptor.mac_address, - pmpriv->bss_mode); + j = wlan_find_bssid_in_list( + pmpriv, + pmpriv->curr_bss_params.bss_descriptor.mac_address, + pmpriv->bss_mode); if (j >= 0) { memcpy_ext(pmadapter, &pmadapter->pscan_table[j].ssid, &pmpriv->curr_bss_params.bss_descriptor.ssid, sizeof(mlan_802_11_ssid), sizeof(mlan_802_11_ssid)); - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - pmpriv-> - curr_bcn_buf_lock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmpriv->curr_bcn_buf_lock); pmpriv->curr_bss_params.bss_descriptor.pwpa_ie = MNULL; pmpriv->curr_bss_params.bss_descriptor.wpa_offset = 0; pmpriv->curr_bss_params.bss_descriptor.prsn_ie = MNULL; @@ -3239,42 +3252,42 @@ 0; pmpriv->curr_bss_params.bss_descriptor.pbss_co_2040 = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - bss_co_2040_offset = 0; + pmpriv->curr_bss_params.bss_descriptor + .bss_co_2040_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pext_cap = MNULL; pmpriv->curr_bss_params.bss_descriptor.ext_cap_offset = 0; - pmpriv->curr_bss_params.bss_descriptor. - poverlap_bss_scan_param = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - overlap_bss_offset = 0; + pmpriv->curr_bss_params.bss_descriptor + .poverlap_bss_scan_param = MNULL; + pmpriv->curr_bss_params.bss_descriptor + .overlap_bss_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pvht_cap = MNULL; pmpriv->curr_bss_params.bss_descriptor.vht_cap_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pvht_oprat = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - vht_oprat_offset = 0; + pmpriv->curr_bss_params.bss_descriptor.vht_oprat_offset = + 0; pmpriv->curr_bss_params.bss_descriptor.pvht_txpower = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - vht_txpower_offset = 0; + pmpriv->curr_bss_params.bss_descriptor + .vht_txpower_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pext_pwer = MNULL; pmpriv->curr_bss_params.bss_descriptor.ext_pwer_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pext_bssload = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - ext_bssload_offset = 0; + pmpriv->curr_bss_params.bss_descriptor + .ext_bssload_offset = 0; pmpriv->curr_bss_params.bss_descriptor.pquiet_chan = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - quiet_chan_offset = 0; + pmpriv->curr_bss_params.bss_descriptor + .quiet_chan_offset = 0; pmpriv->curr_bss_params.bss_descriptor.poper_mode = MNULL; - pmpriv->curr_bss_params.bss_descriptor. - oper_mode_offset = 0; + pmpriv->curr_bss_params.bss_descriptor.oper_mode_offset = + 0; pmpriv->curr_bss_params.bss_descriptor.phe_cap = MNULL; pmpriv->curr_bss_params.bss_descriptor.he_cap_offset = 0; @@ -3288,25 +3301,23 @@ MNULL; pmpriv->curr_bss_params.bss_descriptor.beacon_buf_size = 0; - pmpriv->curr_bss_params.bss_descriptor. - beacon_buf_size_max = 0; + pmpriv->curr_bss_params.bss_descriptor + .beacon_buf_size_max = 0; PRINTM(MINFO, "Found current ssid/bssid in list @ index #%d\n", j); /* Make a copy of current BSSID descriptor */ - memcpy_ext(pmadapter, - &pmpriv->curr_bss_params.bss_descriptor, - &pmadapter->pscan_table[j], - sizeof(pmpriv->curr_bss_params. - bss_descriptor), - sizeof(pmpriv->curr_bss_params. - bss_descriptor)); + memcpy_ext( + pmadapter, + &pmpriv->curr_bss_params.bss_descriptor, + &pmadapter->pscan_table[j], + sizeof(pmpriv->curr_bss_params.bss_descriptor), + sizeof(pmpriv->curr_bss_params.bss_descriptor)); - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - pmpriv-> - curr_bcn_buf_lock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmpriv->curr_bcn_buf_lock); wlan_save_curr_bcn(pmpriv); } else { // Apend to the end of scan table @@ -3315,40 +3326,40 @@ sizeof(BSSDescriptor_t), MLAN_MEM_DEF, (t_u8 **)&bss_new_entry); - if (ret == MLAN_STATUS_SUCCESS && bss_new_entry) { - memcpy_ext(pmadapter, bss_new_entry, - &pmpriv->curr_bss_params. - bss_descriptor, - sizeof(pmpriv-> - curr_bss_params. - bss_descriptor), - sizeof(BSSDescriptor_t)); + if (ret == MLAN_STATUS_SUCCESS && + bss_new_entry) { + memcpy_ext( + pmadapter, bss_new_entry, + &pmpriv->curr_bss_params + .bss_descriptor, + sizeof(pmpriv->curr_bss_params + .bss_descriptor), + sizeof(BSSDescriptor_t)); if (pmadapter->num_in_scan_table < MRVDRV_MAX_BSSID_LIST) pmadapter->num_in_scan_table++; - pmadapter->pscan_table - [pmadapter->num_in_scan_table - - 1] + pmadapter + ->pscan_table + [pmadapter->num_in_scan_table - + 1] .pbeacon_buf = MNULL; - wlan_ret_802_11_scan_store_beacon - (pmpriv, - pmadapter->num_in_scan_table - - 1, - pmadapter->num_in_scan_table, - bss_new_entry); + wlan_ret_802_11_scan_store_beacon( + pmpriv, + pmadapter->num_in_scan_table - + 1, + pmadapter->num_in_scan_table, + bss_new_entry); if (bss_new_entry->pbeacon_buf == MNULL) pmadapter->num_in_scan_table--; else - memcpy_ext(pmadapter, - &pmadapter-> - pscan_table - [pmadapter-> - num_in_scan_table - - 1], bss_new_entry, - sizeof - (BSSDescriptor_t), - sizeof - (BSSDescriptor_t)); + memcpy_ext( + pmadapter, + &pmadapter->pscan_table + [pmadapter->num_in_scan_table - + 1], + bss_new_entry, + sizeof(BSSDescriptor_t), + sizeof(BSSDescriptor_t)); pcb->moal_mfree(pmadapter->pmoal_handle, (t_u8 *)bss_new_entry); } @@ -3363,9 +3374,8 @@ i, MAC2STR(pmadapter->pscan_table[i].mac_address), (t_s32)pmadapter->pscan_table[i].rssi, pmadapter->pscan_table[i].ssid.ssid); - pmadapter->pscan_table[i].chan_load = - wlan_get_chan_load(pmadapter, - pmadapter->pscan_table[i].channel); + pmadapter->pscan_table[i].chan_load = wlan_get_chan_load( + pmadapter, pmadapter->pscan_table[i].channel); } wlan_update_chan_rssi(pmadapter); @@ -3393,8 +3403,8 @@ * * @pre table_idx must be an index to a valid entry */ -static t_void -wlan_scan_delete_table_entry(mlan_private *pmpriv, t_s32 table_idx) +static t_void wlan_scan_delete_table_entry(mlan_private *pmpriv, + t_s32 table_idx) { mlan_adapter *pmadapter = pmpriv->adapter; t_u32 del_idx; @@ -3472,160 +3482,198 @@ if (pmadapter->pscan_table[del_idx].pwpa_ie) { pmadapter->pscan_table[del_idx].pwpa_ie = (IEEEtypes_VendorSpecific_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .wpa_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .wpa_offset); } if (pmadapter->pscan_table[del_idx].prsn_ie) { pmadapter->pscan_table[del_idx].prsn_ie = (IEEEtypes_Generic_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .rsn_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .rsn_offset); } if (pmadapter->pscan_table[del_idx].pwapi_ie) { pmadapter->pscan_table[del_idx].pwapi_ie = (IEEEtypes_Generic_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .wapi_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .wapi_offset); } if (pmadapter->pscan_table[del_idx].posen_ie) { pmadapter->pscan_table[del_idx].posen_ie = (IEEEtypes_Generic_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .osen_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .osen_offset); } if (pmadapter->pscan_table[del_idx].pmd_ie) { pmadapter->pscan_table[del_idx].pmd_ie = (IEEEtypes_MobilityDomain_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .md_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .md_offset); } if (pmadapter->pscan_table[del_idx].pht_cap) { pmadapter->pscan_table[del_idx].pht_cap = (IEEEtypes_HTCap_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .ht_cap_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .ht_cap_offset); } if (pmadapter->pscan_table[del_idx].pht_info) { pmadapter->pscan_table[del_idx].pht_info = (IEEEtypes_HTInfo_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .ht_info_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .ht_info_offset); } if (pmadapter->pscan_table[del_idx].pbss_co_2040) { pmadapter->pscan_table[del_idx].pbss_co_2040 = (IEEEtypes_2040BSSCo_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .bss_co_2040_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .bss_co_2040_offset); } if (pmadapter->pscan_table[del_idx].pext_cap) { pmadapter->pscan_table[del_idx].pext_cap = (IEEEtypes_ExtCap_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .ext_cap_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .ext_cap_offset); } if (pmadapter->pscan_table[del_idx] - .poverlap_bss_scan_param) { + .poverlap_bss_scan_param) { pmadapter->pscan_table[del_idx] .poverlap_bss_scan_param = (IEEEtypes_OverlapBSSScanParam_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .overlap_bss_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .overlap_bss_offset); } if (pmadapter->pscan_table[del_idx].pvht_cap) { pmadapter->pscan_table[del_idx].pvht_cap = (IEEEtypes_VHTCap_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .vht_cap_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .vht_cap_offset); } if (pmadapter->pscan_table[del_idx].pvht_oprat) { pmadapter->pscan_table[del_idx].pvht_oprat = (IEEEtypes_VHTOprat_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .vht_oprat_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .vht_oprat_offset); } if (pmadapter->pscan_table[del_idx].pvht_txpower) { pmadapter->pscan_table[del_idx].pvht_txpower = (IEEEtypes_VHTtxpower_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .vht_txpower_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .vht_txpower_offset); } if (pmadapter->pscan_table[del_idx].pext_pwer) { pmadapter->pscan_table[del_idx].pext_pwer = (IEEEtypes_ExtPwerCons_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .ext_pwer_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .ext_pwer_offset); } if (pmadapter->pscan_table[del_idx].pext_bssload) { pmadapter->pscan_table[del_idx].pext_bssload = (IEEEtypes_ExtBSSload_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .ext_bssload_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .ext_bssload_offset); } if (pmadapter->pscan_table[del_idx].pquiet_chan) { pmadapter->pscan_table[del_idx].pquiet_chan = (IEEEtypes_QuietChan_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .quiet_chan_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .quiet_chan_offset); } if (pmadapter->pscan_table[del_idx].poper_mode) { pmadapter->pscan_table[del_idx].poper_mode = (IEEEtypes_OperModeNtf_t - *)(pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .oper_mode_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .oper_mode_offset); } if (pmadapter->pscan_table[del_idx].phe_cap) { pmadapter->pscan_table[del_idx].phe_cap = (IEEEtypes_HECap_t - *) (pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .he_cap_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .he_cap_offset); } if (pmadapter->pscan_table[del_idx].phe_oprat) { pmadapter->pscan_table[del_idx].phe_oprat = (IEEEtypes_Extension_t - *) (pmadapter->pscan_table[del_idx] - .pbeacon_buf + - pmadapter->pscan_table[del_idx] - .he_oprat_offset); + *)(pmadapter + ->pscan_table[del_idx] + .pbeacon_buf + + pmadapter + ->pscan_table[del_idx] + .he_oprat_offset); } } } @@ -3648,8 +3696,7 @@ * * @return N/A */ -static void -wlan_scan_delete_ageout_entry(mlan_private *pmpriv) +static void wlan_scan_delete_ageout_entry(mlan_private *pmpriv) { BSSDescriptor_t *pbss_entry; mlan_adapter *pmadapter = pmpriv->adapter; @@ -3743,8 +3790,7 @@ * * @return Index in ScanTable, or negative value if error */ -t_s32 -wlan_is_network_compatible(mlan_private *pmpriv, t_u32 index, t_u32 mode) +t_s32 wlan_is_network_compatible(mlan_private *pmpriv, t_u32 index, t_u32 mode) { mlan_adapter *pmadapter = pmpriv->adapter; BSSDescriptor_t *pbss_desc; @@ -3790,6 +3836,13 @@ LEAVE(); return index; } + if ((pbss_desc->owe_transition_mode == OWE_TRANS_MODE_OPEN) && + (pmpriv->sec_info.authentication_mode != MLAN_AUTH_MODE_OWE)) { + PRINTM(MINFO, + "Return success directly in OWE Transition mode\n"); + LEAVE(); + return index; + } if (pmpriv->sec_info.osen_enabled && pbss_desc->posen_ie && ((*(pbss_desc->posen_ie)).ieee_hdr.element_id == @@ -3808,26 +3861,26 @@ #ifdef DRV_EMBEDDED_SUPPLICANT || supplicantIsEnabled(pmpriv->psapriv) #endif - )) { + || pmpriv->sec_info.authentication_mode == MLAN_AUTH_MODE_OWE || + pbss_desc->owe_transition_mode == OWE_TRANS_MODE_OWE)) { if (((pbss_desc->pwpa_ie) && ((*(pbss_desc->pwpa_ie)).vend_hdr.element_id == WPA_IE)) || ((pbss_desc->prsn_ie) && ((*(pbss_desc->prsn_ie)).ieee_hdr.element_id == RSN_IE))) { - if (((pmpriv->adapter->config_bands & BAND_GN - || pmpriv->adapter->config_bands & BAND_AN) && + if (((pmpriv->adapter->config_bands & BAND_GN || + pmpriv->adapter->config_bands & BAND_AN) && pbss_desc->pht_cap) && (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) && !is_wpa_oui_present(pmpriv->adapter, pbss_desc, CIPHER_SUITE_CCMP) && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_CCMP) - && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_GCMP) && + CIPHER_SUITE_CCMP) && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_GCMP_256) - && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_CCMP_256)) { - + CIPHER_SUITE_GCMP) && + !is_rsn_oui_present(pmpriv->adapter, pbss_desc, + CIPHER_SUITE_GCMP_256) && + !is_rsn_oui_present(pmpriv->adapter, pbss_desc, + CIPHER_SUITE_CCMP_256)) { if (is_wpa_oui_present(pmpriv->adapter, pbss_desc, CIPHER_SUITE_TKIP) || @@ -3867,17 +3920,18 @@ ((!pbss_desc->pwpa_ie) || ((*(pbss_desc->pwpa_ie)).vend_hdr.element_id != WPA_IE)) && ((!pbss_desc->prsn_ie) || - ((*(pbss_desc->prsn_ie)).ieee_hdr.element_id != RSN_IE)) - && pmpriv->sec_info.encryption_mode == - MLAN_ENCRYPTION_MODE_NONE && !pbss_desc->privacy) { + ((*(pbss_desc->prsn_ie)).ieee_hdr.element_id != RSN_IE)) && + pmpriv->sec_info.encryption_mode == + MLAN_ENCRYPTION_MODE_NONE && + !pbss_desc->privacy) { /* No security */ LEAVE(); return index; } else if (pmpriv->sec_info.wep_status == - Wlan802_11WEPEnabled && + Wlan802_11WEPEnabled && !pmpriv->sec_info.wpa_enabled && - !pmpriv->sec_info.wpa2_enabled - && pbss_desc->privacy) { + !pmpriv->sec_info.wpa2_enabled && + pbss_desc->privacy) { /* Static WEP enabled */ PRINTM(MINFO, "Disable 11n in WEP mode\n"); pbss_desc->disable_11n = MTRUE; @@ -3911,7 +3965,7 @@ LEAVE(); return index; } else if (pmpriv->sec_info.wep_status == - Wlan802_11WEPDisabled && + Wlan802_11WEPDisabled && pmpriv->sec_info.wpa_enabled && !pmpriv->sec_info.wpa2_enabled && ((pbss_desc->pwpa_ie) && @@ -3921,27 +3975,30 @@ * Privacy bit may NOT be set in some APs like * LinkSys WRT54G && pbss_desc->privacy */ - ) { + ) { PRINTM(MINFO, "wlan_is_network_compatible() WPA: index=%d wpa_ie=%#x " "rsn_ie=%#x WEP=%s WPA=%s WPA2=%s EncMode=%#x " "privacy=%#x\n", index, - (pbss_desc->pwpa_ie) ? (*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id : - 0, (pbss_desc->prsn_ie) ? (*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id : - 0, + (pbss_desc->pwpa_ie) ? + (*(pbss_desc->pwpa_ie)) + .vend_hdr.element_id : + 0, + (pbss_desc->prsn_ie) ? + (*(pbss_desc->prsn_ie)) + .ieee_hdr.element_id : + 0, (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled) ? - "e" : - "d", + "e" : + "d", (pmpriv->sec_info.wpa_enabled) ? "e" : "d", (pmpriv->sec_info.wpa2_enabled) ? "e" : "d", pmpriv->sec_info.encryption_mode, pbss_desc->privacy); - if (((pmpriv->adapter->config_bands & BAND_GN - || pmpriv->adapter->config_bands & BAND_AN) && + if (((pmpriv->adapter->config_bands & BAND_GN || + pmpriv->adapter->config_bands & BAND_AN) && pbss_desc->pht_cap) && (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) && !is_wpa_oui_present(pmpriv->adapter, pbss_desc, @@ -3960,7 +4017,7 @@ LEAVE(); return index; } else if (pmpriv->sec_info.wep_status == - Wlan802_11WEPDisabled && + Wlan802_11WEPDisabled && !pmpriv->sec_info.wpa_enabled && pmpriv->sec_info.wpa2_enabled && ((pbss_desc->prsn_ie) && @@ -3970,55 +4027,57 @@ * Privacy bit may NOT be set in some APs like * LinkSys WRT54G && pbss_desc->privacy */ - ) { + ) { /* WPA2 enabled */ PRINTM(MINFO, "wlan_is_network_compatible() WPA2: index=%d wpa_ie=%#x " "rsn_ie=%#x WEP=%s WPA=%s WPA2=%s EncMode=%#x " "privacy=%#x\n", index, - (pbss_desc->pwpa_ie) ? (*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id : - 0, (pbss_desc->prsn_ie) ? (*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id : - 0, + (pbss_desc->pwpa_ie) ? + (*(pbss_desc->pwpa_ie)) + .vend_hdr.element_id : + 0, + (pbss_desc->prsn_ie) ? + (*(pbss_desc->prsn_ie)) + .ieee_hdr.element_id : + 0, (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled) ? - "e" : - "d", + "e" : + "d", (pmpriv->sec_info.wpa_enabled) ? "e" : "d", (pmpriv->sec_info.wpa2_enabled) ? "e" : "d", pmpriv->sec_info.encryption_mode, pbss_desc->privacy); - if (((pmpriv->adapter->config_bands & BAND_GN - || pmpriv->adapter->config_bands & BAND_AN) && + if (((pmpriv->adapter->config_bands & BAND_GN || + pmpriv->adapter->config_bands & BAND_AN) && pbss_desc->pht_cap) && (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_CCMP) - && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_GCMP) && + CIPHER_SUITE_CCMP) && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_GCMP_256) - && !is_rsn_oui_present(pmpriv->adapter, pbss_desc, - CIPHER_SUITE_CCMP_256)) { + CIPHER_SUITE_GCMP) && + !is_rsn_oui_present(pmpriv->adapter, pbss_desc, + CIPHER_SUITE_GCMP_256) && + !is_rsn_oui_present(pmpriv->adapter, pbss_desc, + CIPHER_SUITE_CCMP_256)) { if (is_rsn_oui_present(pmpriv->adapter, pbss_desc, CIPHER_SUITE_TKIP)) { PRINTM(MINFO, "Disable 11n if AES is not supported by AP\n"); pbss_desc->disable_11n = MTRUE; - } else if (is_rsn_oui_present_in_wpa_ie - (pmpriv, CIPHER_SUITE_CCMP) || - is_rsn_oui_present_in_wpa_ie(pmpriv, - CIPHER_SUITE_GCMP) - || - is_rsn_oui_present_in_wpa_ie(pmpriv, - CIPHER_SUITE_GCMP_256) - || - is_rsn_oui_present_in_wpa_ie(pmpriv, - CIPHER_SUITE_CCMP_256)) - { + } else if (is_rsn_oui_present_in_wpa_ie( + pmpriv, CIPHER_SUITE_CCMP) || + is_rsn_oui_present_in_wpa_ie( + pmpriv, CIPHER_SUITE_GCMP) || + is_rsn_oui_present_in_wpa_ie( + pmpriv, + CIPHER_SUITE_GCMP_256) || + is_rsn_oui_present_in_wpa_ie( + pmpriv, + CIPHER_SUITE_CCMP_256)) { LEAVE(); return index; } else { @@ -4028,27 +4087,33 @@ } LEAVE(); return index; - } else if (pmpriv->sec_info.wep_status == Wlan802_11WEPDisabled - && !pmpriv->sec_info.wpa_enabled && + } else if (pmpriv->sec_info.wep_status == + Wlan802_11WEPDisabled && + !pmpriv->sec_info.wpa_enabled && !pmpriv->sec_info.wpa2_enabled && ((!pbss_desc->pwpa_ie) || ((*(pbss_desc->pwpa_ie)).vend_hdr.element_id != - WPA_IE)) && ((!pbss_desc->prsn_ie) || - ((*(pbss_desc->prsn_ie)).ieee_hdr. - element_id != RSN_IE)) - && pmpriv->sec_info.encryption_mode != - MLAN_ENCRYPTION_MODE_NONE && pbss_desc->privacy) { + WPA_IE)) && + ((!pbss_desc->prsn_ie) || + ((*(pbss_desc->prsn_ie)).ieee_hdr.element_id != + RSN_IE)) && + pmpriv->sec_info.encryption_mode != + MLAN_ENCRYPTION_MODE_NONE && + pbss_desc->privacy) { /* Dynamic WEP enabled */ pbss_desc->disable_11n = MTRUE; PRINTM(MINFO, "wlan_is_network_compatible() dynamic WEP: index=%d " "wpa_ie=%#x rsn_ie=%#x EncMode=%#x privacy=%#x\n", index, - (pbss_desc->pwpa_ie) ? (*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id : - 0, (pbss_desc->prsn_ie) ? (*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id : - 0, + (pbss_desc->pwpa_ie) ? + (*(pbss_desc->pwpa_ie)) + .vend_hdr.element_id : + 0, + (pbss_desc->prsn_ie) ? + (*(pbss_desc->prsn_ie)) + .ieee_hdr.element_id : + 0, pmpriv->sec_info.encryption_mode, pbss_desc->privacy); LEAVE(); @@ -4060,14 +4125,14 @@ "rsn_ie=%#x WEP=%s WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", index, (pbss_desc->pwpa_ie) ? - (*(pbss_desc->pwpa_ie)).vend_hdr.element_id : - 0, + (*(pbss_desc->pwpa_ie)).vend_hdr.element_id : + 0, (pbss_desc->prsn_ie) ? - (*(pbss_desc->prsn_ie)).ieee_hdr.element_id : - 0, + (*(pbss_desc->prsn_ie)).ieee_hdr.element_id : + 0, (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled) ? - "e" : - "d", + "e" : + "d", (pmpriv->sec_info.wpa_enabled) ? "e" : "d", (pmpriv->sec_info.wpa2_enabled) ? "e" : "d", pmpriv->sec_info.encryption_mode, pbss_desc->privacy); @@ -4086,8 +4151,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_flush_scan_table(pmlan_adapter pmadapter) +mlan_status wlan_flush_scan_table(pmlan_adapter pmadapter) { t_u8 i = 0; ENTER(); @@ -4123,9 +4187,8 @@ * * @return MLAN_STATUS_SUCCESS or < 0 if error */ -mlan_status -wlan_scan_networks(mlan_private *pmpriv, t_void *pioctl_buf, - wlan_user_scan_cfg *puser_scan_in) +mlan_status wlan_scan_networks(mlan_private *pmpriv, t_void *pioctl_buf, + wlan_user_scan_cfg *puser_scan_in) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -4142,12 +4205,12 @@ t_u8 filtered_scan; t_u8 scan_current_chan_only; t_u8 max_chan_per_scan; - t_u8 i; ENTER(); ret = pcb->moal_malloc(pmadapter->pmoal_handle, - sizeof(wlan_scan_cmd_config_tlv), MLAN_MEM_DEF, + sizeof(wlan_scan_cmd_config_tlv), + MLAN_MEM_DEF | MLAN_MEM_FLAG_ATOMIC, (t_u8 **)&pscan_cfg_out); if (ret != MLAN_STATUS_SUCCESS || !pscan_cfg_out) { PRINTM(MERROR, "Memory allocation for pscan_cfg_out failed!\n"); @@ -4158,7 +4221,8 @@ } buf_size = sizeof(ChanScanParamSet_t) * WLAN_USER_SCAN_CHAN_MAX; - ret = pcb->moal_malloc(pmadapter->pmoal_handle, buf_size, MLAN_MEM_DEF, + ret = pcb->moal_malloc(pmadapter->pmoal_handle, buf_size, + MLAN_MEM_DEF | MLAN_MEM_FLAG_ATOMIC, (t_u8 **)&pscan_chan_list); if (ret != MLAN_STATUS_SUCCESS || !pscan_chan_list) { PRINTM(MERROR, "Failed to allocate scan_chan_list\n"); @@ -4207,8 +4271,6 @@ } else { wlan_scan_delete_ageout_entry(pmpriv); } - for (i = 0; i < pmadapter->num_in_chan_stats; i++) - pmadapter->pchan_stats[i].cca_scan_duration = 0; pmadapter->idx_chan_stats = 0; ret = wlan_scan_channel_list(pmpriv, pioctl_buf, max_chan_per_scan, @@ -4217,31 +4279,19 @@ /* Get scan command from scan_pending_q and put to cmd_pending_q */ if (ret == MLAN_STATUS_SUCCESS) { - if (pmadapter->ext_scan && pmadapter->ext_scan_enh && - pmadapter->ext_scan_type == EXT_SCAN_ENHANCE) { - wlan_request_cmd_lock(pmadapter); + wlan_request_cmd_lock(pmadapter); + if (util_peek_list(pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, MNULL, MNULL)) { + pcmd_node = (cmd_ctrl_node *)util_dequeue_list( + pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, MNULL, MNULL); pmadapter->pscan_ioctl_req = pioctl_req; pmadapter->scan_processing = MTRUE; - wlan_release_cmd_lock(pmadapter); - } else { - wlan_request_cmd_lock(pmadapter); - if (util_peek_list(pmadapter->pmoal_handle, - &pmadapter->scan_pending_q, MNULL, - MNULL)) { - pcmd_node = - (cmd_ctrl_node *) - util_dequeue_list(pmadapter-> - pmoal_handle, - &pmadapter-> - scan_pending_q, MNULL, - MNULL); - pmadapter->pscan_ioctl_req = pioctl_req; - pmadapter->scan_processing = MTRUE; - wlan_insert_cmd_to_pending_q(pmadapter, - pcmd_node, MTRUE); - } - wlan_release_cmd_lock(pmadapter); + pmadapter->scan_state = SCAN_STATE_SCAN_START; + wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, + MTRUE); } + wlan_release_cmd_lock(pmadapter); } if (pscan_cfg_out) pcb->moal_mfree(pmadapter->pmoal_handle, (t_u8 *)pscan_cfg_out); @@ -4272,9 +4322,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_scan(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_scan(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd, + t_void *pdata_buf) { HostCmd_DS_802_11_SCAN *pscan_cmd = &pcmd->params.scan; wlan_scan_cmd_config *pscan_cfg; @@ -4293,11 +4342,9 @@ pcmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_SCAN); /* Size is equal to the sizeof(fixed portions) + the TLV len + header */ - pcmd->size = (t_u16)wlan_cpu_to_le16((t_u16) - (sizeof(pscan_cmd->bss_mode) + - sizeof(pscan_cmd->bssid) + - pscan_cfg->tlv_buf_len + - S_DS_GEN)); + pcmd->size = (t_u16)wlan_cpu_to_le16( + (t_u16)(sizeof(pscan_cmd->bss_mode) + sizeof(pscan_cmd->bssid) + + pscan_cfg->tlv_buf_len + S_DS_GEN)); LEAVE(); return MLAN_STATUS_SUCCESS; @@ -4313,9 +4360,8 @@ * @return MTRUE/MFALSE */ -static t_bool -wlan_active_scan_req_for_passive_chan(mlan_private *pmpriv, - mlan_ioctl_req *pioctl_buf) +static t_bool wlan_active_scan_req_for_passive_chan(mlan_private *pmpriv, + mlan_ioctl_req *pioctl_buf) { t_bool ret = MFALSE; mlan_adapter *pmadapter = pmpriv->adapter; @@ -4323,7 +4369,7 @@ t_bool chan_listed = MFALSE; t_u8 id = 0; t_u32 bss_idx, i; - t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = { 0 }; + t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = {0}; mlan_callbacks *pcb = (mlan_callbacks *)&pmpriv->adapter->callbacks; wlan_user_scan_cfg *user_scan_cfg; mlan_ds_scan *pscan = (mlan_ds_scan *)pioctl_buf->pbuf; @@ -4334,7 +4380,7 @@ if (pscan->sub_command == MLAN_OID_SCAN_USER_CONFIG) { puser_scan_in = (wlan_user_scan_cfg *) - pscan->param.user_scan.scan_cfg_buf; + pscan->param.user_scan.scan_cfg_buf; if (!puser_scan_in->ssid_filter) goto done; } @@ -4347,7 +4393,8 @@ if ((pcb->moal_malloc(pmadapter->pmoal_handle, sizeof(wlan_user_scan_cfg), MLAN_MEM_DEF, (t_u8 **)&user_scan_cfg) != - MLAN_STATUS_SUCCESS) || !user_scan_cfg) { + MLAN_STATUS_SUCCESS) || + !user_scan_cfg) { PRINTM(MERROR, "Memory allocation for user_scan_cfg failed\n"); goto done; } @@ -4365,11 +4412,11 @@ puser_scan_in->chan_list[i].chan_number; i++) { if (puser_scan_in->chan_list[i] - .chan_number == + .chan_number == pmadapter->pscan_table[bss_idx] - .channel) { + .channel) { if (puser_scan_in->chan_list[i] - .scan_type == + .scan_type == MLAN_SCAN_TYPE_PASSIVE) scan_reqd = MTRUE; break; @@ -4381,19 +4428,17 @@ } else { if ((pmadapter->pscan_table[bss_idx].bss_band & BAND_A) && - wlan_11h_radar_detect_required(pmpriv, - pmadapter-> - pscan_table - [bss_idx] - .channel)) + wlan_11h_radar_detect_required( + pmpriv, + pmadapter->pscan_table[bss_idx] + .channel)) scan_reqd = MTRUE; if (pmadapter->pscan_table[bss_idx].bss_band & - (BAND_B | BAND_G) && - wlan_bg_scan_type_is_passive(pmpriv, - pmadapter-> - pscan_table - [bss_idx] - .channel)) + (BAND_B | BAND_G) && + wlan_bg_scan_type_is_passive( + pmpriv, + pmadapter->pscan_table[bss_idx] + .channel)) scan_reqd = MTRUE; } @@ -4401,13 +4446,13 @@ chan_listed = MFALSE; for (i = 0; i < id; i++) { if ((user_scan_cfg->chan_list[i] - .chan_number == + .chan_number == pmadapter->pscan_table[bss_idx] - .channel) && + .channel) && (user_scan_cfg->chan_list[i] - .radio_type & + .radio_type & pmadapter->pscan_table[bss_idx] - .bss_band)) { + .bss_band)) { chan_listed = MTRUE; break; } @@ -4418,12 +4463,12 @@ pmadapter->pscan_table[bss_idx].channel; if (pmadapter->pscan_table[bss_idx].bss_band & (BAND_B | BAND_G)) - user_scan_cfg->chan_list[id]. - radio_type = BAND_2GHZ; - if (pmadapter->pscan_table[bss_idx]. - bss_band & BAND_A) - user_scan_cfg->chan_list[id]. - radio_type = BAND_5GHZ; + user_scan_cfg->chan_list[id].radio_type = + BAND_2GHZ; + if (pmadapter->pscan_table[bss_idx].bss_band & + BAND_A) + user_scan_cfg->chan_list[id].radio_type = + BAND_5GHZ; user_scan_cfg->chan_list[id].scan_type = MLAN_SCAN_TYPE_ACTIVE; id++; @@ -4485,9 +4530,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_scan(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) +mlan_status wlan_ret_802_11_scan(mlan_private *pmpriv, HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -4509,10 +4553,10 @@ chan_freq_power_t *cfp; MrvlIEtypes_ChanBandListParamSet_t *pchan_band_tlv = MNULL; ChanBandParamSet_t *pchan_band; - t_u8 band; + t_u16 band; t_u8 is_bgscan_resp; t_u32 age_ts_usec; - t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = { 0 }; + t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = {0}; t_u32 status_code = 0; pmlan_ioctl_req pscan_ioctl_req = MNULL; @@ -4543,9 +4587,8 @@ pscan_rsp->number_of_sets); /* Update the age_in_second */ - pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, - &pmadapter->age_in_secs, - &age_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pmadapter->age_in_secs, &age_ts_usec); num_in_table = pmadapter->num_in_scan_table; pbss_info = pscan_rsp->bss_desc_and_tlv_buffer; @@ -4557,12 +4600,11 @@ * response header (S_DS_GEN) */ tlv_buf_size = scan_resp_size - - (bytes_left + sizeof(pscan_rsp->bss_descript_size) + - sizeof(pscan_rsp->number_of_sets) + S_DS_GEN); + (bytes_left + sizeof(pscan_rsp->bss_descript_size) + + sizeof(pscan_rsp->number_of_sets) + S_DS_GEN); if (is_bgscan_resp) - tlv_buf_size -= - sizeof(resp->params.bg_scan_query_resp. - report_condition); + tlv_buf_size -= sizeof( + resp->params.bg_scan_query_resp.report_condition); ptlv = (MrvlIEtypes_Data_t *)(pscan_rsp->bss_desc_and_tlv_buffer + bytes_left); @@ -4579,14 +4621,12 @@ * Search the TLV buffer space in the scan response * for any valid TLVs */ - wlan_ret_802_11_scan_get_tlv_ptrs(pmadapter, ptlv, tlv_buf_size, - TLV_TYPE_CHANNELBANDLIST, - (MrvlIEtypes_Data_t **) - &pchan_band_tlv); - wlan_ret_802_11_scan_get_tlv_ptrs(pmadapter, ptlv, tlv_buf_size, - TLV_TYPE_CHANNEL_STATS, - (MrvlIEtypes_Data_t **) - &pchanstats_tlv); + wlan_ret_802_11_scan_get_tlv_ptrs( + pmadapter, ptlv, tlv_buf_size, TLV_TYPE_CHANNELBANDLIST, + (MrvlIEtypes_Data_t **)&pchan_band_tlv); + wlan_ret_802_11_scan_get_tlv_ptrs( + pmadapter, ptlv, tlv_buf_size, TLV_TYPE_CHANNEL_STATS, + (MrvlIEtypes_Data_t **)&pchanstats_tlv); if (pchanstats_tlv) wlan_update_chan_statistics(pmpriv, pchanstats_tlv); @@ -4612,9 +4652,9 @@ memset(pmadapter, bss_new_entry, 0x00, sizeof(BSSDescriptor_t)); /* Process the data fields and IEs returned for this BSS */ - if (wlan_interpret_bss_desc_with_ie - (pmadapter, bss_new_entry, &pbss_info, &bytes_left, - MFALSE) == MLAN_STATUS_SUCCESS) { + if (wlan_interpret_bss_desc_with_ie( + pmadapter, bss_new_entry, &pbss_info, &bytes_left, + MFALSE) == MLAN_STATUS_SUCCESS) { PRINTM(MINFO, "SCAN_RESP: BSSID = " MACSTR "\n", MAC2STR(bss_new_entry->mac_address)); @@ -4622,8 +4662,8 @@ if (pchan_band_tlv) { pchan_band = &pchan_band_tlv->chan_band_param[idx]; - band = radio_type_to_band(pchan_band->bandcfg. - chanBand); + band = radio_type_to_band( + pchan_band->bandcfg.chanBand); if (!bss_new_entry->channel) bss_new_entry->channel = pchan_band->chan_number; @@ -4634,13 +4674,9 @@ */ bss_new_entry->bss_band = band; bss_new_entry->age_in_secs = pmadapter->age_in_secs; - cfp = wlan_find_cfp_by_band_and_channel(pmadapter, - (t_u8) - bss_new_entry-> - bss_band, - (t_u16) - bss_new_entry-> - channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, bss_new_entry->bss_band, + (t_u16)bss_new_entry->channel); if (cfp) bss_new_entry->freq = cfp->freq; else @@ -4660,9 +4696,8 @@ if (!memcmp(pmadapter, bss_new_entry->mac_address, pmadapter->pscan_table[bss_idx] - .mac_address, - sizeof(bss_new_entry-> - mac_address))) { + .mac_address, + sizeof(bss_new_entry->mac_address))) { /* * If the SSID matches as well, it is a * duplicate of this entry. Keep the @@ -4671,14 +4706,15 @@ */ if ((bss_new_entry->ssid.ssid_len == pmadapter->pscan_table[bss_idx] - .ssid.ssid_len) && - (!memcmp(pmadapter, - bss_new_entry->ssid.ssid, - pmadapter-> - pscan_table[bss_idx] - .ssid.ssid, - bss_new_entry->ssid. - ssid_len))) { + .ssid.ssid_len) && + (!memcmp( + pmadapter, + bss_new_entry->ssid.ssid, + pmadapter + ->pscan_table[bss_idx] + .ssid.ssid, + bss_new_entry->ssid + .ssid_len))) { PRINTM(MINFO, "SCAN_RESP: Duplicate of index: %d\n", bss_idx); @@ -4692,12 +4728,13 @@ * the table */ if (!memcmp(pmadapter, - pmadapter-> - pscan_table[bss_idx] - .ssid.ssid, null_ssid, - pmadapter-> - pscan_table[bss_idx] - .ssid.ssid_len)) { + pmadapter + ->pscan_table[bss_idx] + .ssid.ssid, + null_ssid, + pmadapter + ->pscan_table[bss_idx] + .ssid.ssid_len)) { PRINTM(MINFO, "SCAN_RESP: Duplicate of index: %d\n", bss_idx); @@ -4734,9 +4771,8 @@ * application retrieval. Duplicate beacon/probe * responses are updated if possible */ - wlan_ret_802_11_scan_store_beacon(pmpriv, bss_idx, - num_in_table, - bss_new_entry); + wlan_ret_802_11_scan_store_beacon( + pmpriv, bss_idx, num_in_table, bss_new_entry); if (bss_new_entry->pbeacon_buf == MNULL) { PRINTM(MCMND, "No space for beacon, drop this entry\n"); @@ -4750,10 +4786,10 @@ * the beacon or probe response was received. */ if (ptsf_tlv) { - memcpy_ext(pmpriv->adapter, &tsf_val, - &ptsf_tlv->tsf_data[idx * - TSF_DATA_SIZE], - sizeof(tsf_val), sizeof(tsf_val)); + memcpy_ext( + pmpriv->adapter, &tsf_val, + &ptsf_tlv->tsf_data[idx * TSF_DATA_SIZE], + sizeof(tsf_val), sizeof(tsf_val)); tsf_val = wlan_le64_to_cpu(tsf_val); memcpy_ext(pmpriv->adapter, &bss_new_entry->network_tsf, @@ -4791,12 +4827,14 @@ wlan_release_cmd_lock(pmadapter); if (pmadapter->pscan_ioctl_req) { if (((mlan_ds_scan *)pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == - MLAN_OID_SCAN_SPECIFIC_SSID || + ->sub_command == + MLAN_OID_SCAN_SPECIFIC_SSID || ((mlan_ds_scan *)pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == MLAN_OID_SCAN_USER_CONFIG) { - if (wlan_active_scan_req_for_passive_chan - (pmpriv, pmadapter->pscan_ioctl_req)) { + ->sub_command == + MLAN_OID_SCAN_USER_CONFIG) { + if (wlan_active_scan_req_for_passive_chan( + pmpriv, + pmadapter->pscan_ioctl_req)) { goto done; } } @@ -4816,10 +4854,10 @@ if (pscan_ioctl_req) { pscan_ioctl_req->status_code = MLAN_ERROR_NO_ERROR; /* Indicate ioctl complete */ - pcb->moal_ioctl_complete(pmadapter->pmoal_handle, - (pmlan_ioctl_req) - pscan_ioctl_req, - MLAN_STATUS_SUCCESS); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + (pmlan_ioctl_req)pscan_ioctl_req, + MLAN_STATUS_SUCCESS); } wlan_release_cmd_lock(pmadapter); pmadapter->bgscan_reported = MFALSE; @@ -4834,13 +4872,9 @@ } else { /* Get scan command from scan_pending_q and put to * cmd_pending_q */ - pcmd_node = - (cmd_ctrl_node *)util_dequeue_list(pmadapter-> - pmoal_handle, - &pmadapter-> - scan_pending_q, - MNULL, - MNULL); + pcmd_node = (cmd_ctrl_node *)util_dequeue_list( + pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, MNULL, MNULL); wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, MTRUE); wlan_release_cmd_lock(pmadapter); @@ -4871,6 +4905,26 @@ } /** + * @brief Get ext_scan state from ext_scan_type + * + * + * @param pcmd A pointer to HostCmd_DS_COMMAND structure to be sent to + * firmware with the HostCmd_DS_802_11_SCAN_EXT structure + * + * @return + * SCAN_STATE_EXT_SCAN_ENH/SCAN_STATE_EXT_SCAN_CANCEL/SCAN_STATE_EXT_SCAN_ENH + */ +t_u8 wlan_get_ext_scan_state(HostCmd_DS_COMMAND *pcmd) +{ + HostCmd_DS_802_11_SCAN_EXT *pext_scan_cmd = &pcmd->params.ext_scan; + if (pext_scan_cmd->ext_scan_type == EXT_SCAN_ENHANCE) + return SCAN_STATE_EXT_SCAN_ENH; + if (pext_scan_cmd->ext_scan_type == EXT_SCAN_CANCEL) + return SCAN_STATE_EXT_SCAN_CANCEL; + return SCAN_STATE_EXT_SCAN; +} + +/** * @brief Prepare an extended scan command to be sent to the firmware * * Use the wlan_scan_cmd_config sent to the command processing module in @@ -4885,9 +4939,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_scan_ext(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_scan_ext(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_void *pdata_buf) { HostCmd_DS_802_11_SCAN_EXT *pext_scan_cmd = &pcmd->params.ext_scan; wlan_scan_cmd_config *pscan_cfg = MNULL; @@ -4903,15 +4957,10 @@ else pext_scan_cmd->ext_scan_type = EXT_SCAN_DEFAULT; } else { - pcmd->size = - wlan_cpu_to_le16((t_u16) - (sizeof - (pext_scan_cmd-> - ext_scan_type) + - (t_u16)(sizeof - (pext_scan_cmd-> - reserved)) + - S_DS_GEN)); + pcmd->size = wlan_cpu_to_le16(( + t_u16)(sizeof(pext_scan_cmd->ext_scan_type) + + (t_u16)(sizeof(pext_scan_cmd->reserved)) + + S_DS_GEN)); pext_scan_cmd->ext_scan_type = EXT_SCAN_CANCEL; LEAVE(); return MLAN_STATUS_SUCCESS; @@ -4929,10 +4978,10 @@ pscan_cfg->tlv_buf_len); /* Size is equal to the sizeof(fixed portions) + the TLV len + header */ - pcmd->size = wlan_cpu_to_le16((t_u16) - (sizeof(pext_scan_cmd->ext_scan_type) + - (t_u16)sizeof(pext_scan_cmd->reserved) + - pscan_cfg->tlv_buf_len + S_DS_GEN)); + pcmd->size = wlan_cpu_to_le16( + (t_u16)(sizeof(pext_scan_cmd->ext_scan_type) + + (t_u16)sizeof(pext_scan_cmd->reserved) + + pscan_cfg->tlv_buf_len + S_DS_GEN)); LEAVE(); return MLAN_STATUS_SUCCESS; @@ -4947,9 +4996,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_scan_ext(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) +mlan_status wlan_ret_802_11_scan_ext(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + t_void *pioctl_buf) { HostCmd_DS_802_11_SCAN_EXT *pext_scan_cmd = &(resp->params.ext_scan); MrvlIEtypesHeader_t *tlv = MNULL; @@ -4964,11 +5013,13 @@ ENTER(); PRINTM(MINFO, "EXT scan returns successfully\n"); + pmadapter->scan_state |= wlan_get_ext_scan_state(resp); ext_scan_type = pext_scan_cmd->ext_scan_type; if (ext_scan_type == EXT_SCAN_CANCEL) { PRINTM(MCMND, "Cancel scan command completed!\n"); wlan_request_cmd_lock(pmadapter); pmadapter->scan_processing = MFALSE; + pmadapter->scan_state |= SCAN_STATE_SCAN_COMPLETE; pmadapter->ext_scan_type = EXT_SCAN_DEFAULT; wlan_release_cmd_lock(pmadapter); /* Need to indicate IOCTL complete */ @@ -4992,7 +5043,7 @@ } tlv = (MrvlIEtypesHeader_t *)pext_scan_cmd->tlv_buffer; tlv_buf_left = resp->size - - (sizeof(HostCmd_DS_802_11_SCAN_EXT) - 1 + S_DS_GEN); + (sizeof(HostCmd_DS_802_11_SCAN_EXT) - 1 + S_DS_GEN); while (tlv_buf_left >= sizeof(MrvlIEtypesHeader_t)) { tlv_type = wlan_le16_to_cpu(tlv->type); tlv_len = wlan_le16_to_cpu(tlv->len); @@ -5025,15 +5076,14 @@ * * @return N/A */ -static t_void -wlan_add_new_entry_to_scan_table(mlan_private *pmpriv, - BSSDescriptor_t *bss_new_entry, - t_u32 *num_in_tbl) +static t_void wlan_add_new_entry_to_scan_table(mlan_private *pmpriv, + BSSDescriptor_t *bss_new_entry, + t_u32 *num_in_tbl) { mlan_adapter *pmadapter = pmpriv->adapter; t_u32 bss_idx; t_u32 num_in_table = *num_in_tbl; - t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = { 0 }; + t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = {0}; /* * Search the scan table for the same bssid @@ -5066,8 +5116,9 @@ */ if (!memcmp(pmadapter, pmadapter->pscan_table[bss_idx].ssid.ssid, - null_ssid, pmadapter->pscan_table[bss_idx] - .ssid.ssid_len)) { + null_ssid, + pmadapter->pscan_table[bss_idx] + .ssid.ssid_len)) { PRINTM(MINFO, "EXT_SCAN: Duplicate of index: %d\n", bss_idx); @@ -5131,13 +5182,10 @@ * * @return MLAN_STATUS_FAILURE/MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_update_ssid_in_beacon_buf(mlan_adapter *pmadapter, - BSSDescriptor_t *pbss_entry, - BSSDescriptor_t *pnew_entry, - IEEEtypes_Ssid_t * pssid, - IEEEtypes_ExtCap_t *pnew_extcap, - IEEEtypes_Generic_t *pnew_rsnx) +static mlan_status wlan_update_ssid_in_beacon_buf( + mlan_adapter *pmadapter, BSSDescriptor_t *pbss_entry, + BSSDescriptor_t *pnew_entry, IEEEtypes_Ssid_t *pssid, + IEEEtypes_ExtCap_t *pnew_extcap, IEEEtypes_Generic_t *pnew_rsnx) { mlan_callbacks *pcb = (pmlan_callbacks)&pmadapter->callbacks; t_u8 *pbeacon_buf = MNULL; @@ -5180,15 +5228,16 @@ /** copy left IE to new beacon buffer */ memcpy_ext(pmadapter, pbeacon_buf + BEACON_FIX_SIZE + pssid->len + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pbss_entry->pbeacon_buf + BEACON_FIX_SIZE + - pbss_entry->ssid.ssid_len + - sizeof(IEEEtypes_Header_t), + pbss_entry->ssid.ssid_len + + sizeof(IEEEtypes_Header_t), pbss_entry->beacon_buf_size - BEACON_FIX_SIZE - - (pbss_entry->ssid.ssid_len + - sizeof(IEEEtypes_Header_t)), + (pbss_entry->ssid.ssid_len + + sizeof(IEEEtypes_Header_t)), pbss_entry->beacon_buf_size - BEACON_FIX_SIZE - - (pbss_entry->ssid.ssid_len + sizeof(IEEEtypes_Header_t))); + (pbss_entry->ssid.ssid_len + + sizeof(IEEEtypes_Header_t))); /* adjust the ie pointer */ if (pnew_entry->pwpa_ie) @@ -5211,17 +5260,16 @@ if (pnew_entry->pext_cap) { pnew_entry->ext_cap_offset += offset; if (pnew_extcap) { - pextcap = - (IEEEtypes_ExtCap_t *)(pnew_entry->pbeacon_buf + - pnew_entry-> - ext_cap_offset); + pextcap = (IEEEtypes_ExtCap_t + *)(pnew_entry->pbeacon_buf + + pnew_entry->ext_cap_offset); memcpy_ext(pmadapter, pbeacon_buf + pnew_entry->ext_cap_offset, (t_u8 *)pnew_extcap, pnew_extcap->ieee_hdr.len + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pextcap->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); } } if (pnew_entry->poverlap_bss_scan_param) @@ -5245,11 +5293,10 @@ if (pnew_entry->phe_oprat) pnew_entry->he_oprat_offset += offset; if (pnew_rsnx) - memcpy_ext(pmadapter, pbeacon_buf + rsnx_offset, - (t_u8 *)pnew_rsnx, - pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t), - pnew_rsnx->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + memcpy_ext( + pmadapter, pbeacon_buf + rsnx_offset, (t_u8 *)pnew_rsnx, + pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t), + pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); DBG_HEXDUMP(MCMD_D, "MBSSID beacon buf", pbeacon_buf, beacon_buf_size); ret = MLAN_STATUS_SUCCESS; done: @@ -5266,19 +5313,18 @@ * * @return N/A */ -static void -wlan_gen_multi_bssid_by_bssid_index(pmlan_adapter pmadapter, - BSSDescriptor_t *pbss_entry, - BSSDescriptor_t *pnew_entry, - t_u8 bssid_index, t_u8 max_bssid_indicator) +static void wlan_gen_multi_bssid_by_bssid_index(pmlan_adapter pmadapter, + BSSDescriptor_t *pbss_entry, + BSSDescriptor_t *pnew_entry, + t_u8 bssid_index, + t_u8 max_bssid_indicator) { t_u8 mask = 0xff; t_u8 new_bssid[6]; t_u8 bssid_a; t_u8 src_bssid[6]; - memcpy_ext(pmadapter, (t_u8 *)src_bssid, - pbss_entry->mac_address, + memcpy_ext(pmadapter, (t_u8 *)src_bssid, pbss_entry->mac_address, sizeof(mlan_802_11_mac_addr), sizeof(src_bssid)); memcpy_ext(pmadapter, (t_u8 *)new_bssid, (t_u8 *)&pbss_entry->mac_address, @@ -5309,12 +5355,10 @@ * * @return N/A */ -static t_void -wlan_parse_non_trans_bssid_profile(mlan_private *pmpriv, - BSSDescriptor_t *pbss_entry, - IEEEtypes_NonTransBSSIDProfile_t * - pbss_profile, t_u32 *num_in_table, - t_u8 max_bssid_indicator) +static t_void wlan_parse_non_trans_bssid_profile( + mlan_private *pmpriv, BSSDescriptor_t *pbss_entry, + IEEEtypes_NonTransBSSIDProfile_t *pbss_profile, t_u32 *num_in_table, + t_u8 max_bssid_indicator) { mlan_adapter *pmadapter = pmpriv->adapter; IEEEtypes_Header_t *pheader = @@ -5322,7 +5366,7 @@ IEEEtypes_MultiBSSIDIndex_t *pbssid_index = MNULL; IEEEtypes_Ssid_t *pssid = MNULL; IEEEtypes_NotxBssCap_t *pcap = - (IEEEtypes_NotxBssCap_t *) pbss_profile->profile_data; + (IEEEtypes_NotxBssCap_t *)pbss_profile->profile_data; t_u8 *pos = pbss_profile->profile_data; t_s8 left_len = pbss_profile->ieee_hdr.len; t_u8 ret = MFALSE; @@ -5355,7 +5399,7 @@ } switch (pheader->element_id) { case MBSSID_INDEX: - pbssid_index = (IEEEtypes_MultiBSSIDIndex_t *) pos; + pbssid_index = (IEEEtypes_MultiBSSIDIndex_t *)pos; if (pbssid_index->bssid_index == 0 || pbssid_index->bssid_index > 46) { PRINTM(MERROR, @@ -5370,16 +5414,16 @@ pextcap = (IEEEtypes_ExtCap_t *)pos; DBG_HEXDUMP(MCMD_D, "MBSSID extcap", pos, pextcap->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case RSNX_IE: prsnx = (IEEEtypes_Generic_t *)pos; DBG_HEXDUMP(MCMD_D, "MBSSID RSNX", pos, prsnx->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case SSID: - pssid = (IEEEtypes_Ssid_t *) pos; + pssid = (IEEEtypes_Ssid_t *)pos; PRINTM(MCMND, "MBSSID: Find mbssid ssid=%s\n", pssid->ssid); break; @@ -5412,10 +5456,9 @@ pssid->ssid, pssid->len, MLAN_MAX_SSID_LENGTH); if (MLAN_STATUS_SUCCESS != - wlan_update_ssid_in_beacon_buf(pmadapter, - pbss_entry, - bss_new_entry, pssid, - pextcap, prsnx)) { + wlan_update_ssid_in_beacon_buf( + pmadapter, pbss_entry, bss_new_entry, pssid, + pextcap, prsnx)) { PRINTM(MERROR, "Fail to update MBSSID beacon buf\n"); pcb->moal_mfree(pmadapter->pmoal_handle, @@ -5451,11 +5494,10 @@ * * @return number entry in scan table */ -static t_void -wlan_parse_multi_bssid_ie(mlan_private *pmpriv, - BSSDescriptor_t *pbss_entry, - IEEEtypes_MultiBSSID_t * pmulti_bssid, - t_u32 *num_in_table) +static t_void wlan_parse_multi_bssid_ie(mlan_private *pmpriv, + BSSDescriptor_t *pbss_entry, + IEEEtypes_MultiBSSID_t *pmulti_bssid, + t_u32 *num_in_table) { t_u32 bytes_left = 0; t_u8 *pcurrent_ptr = MNULL; @@ -5467,7 +5509,7 @@ pcurrent_ptr = pmulti_bssid->sub_elem_data; while (bytes_left >= 2) { pbssid_profile = - (IEEEtypes_NonTransBSSIDProfile_t *) pcurrent_ptr; + (IEEEtypes_NonTransBSSIDProfile_t *)pcurrent_ptr; if (pbssid_profile->ieee_hdr.element_id != NONTRANS_BSSID_PROFILE_SUBELEM_ID) { PRINTM(MERROR, "Invalid multi-bssid IE\n"); @@ -5477,10 +5519,9 @@ PRINTM(MERROR, "Invalid multi-bssid IE\n"); break; } - wlan_parse_non_trans_bssid_profile(pmpriv, pbss_entry, - pbssid_profile, num_in_table, - pmulti_bssid-> - max_bssid_indicator); + wlan_parse_non_trans_bssid_profile( + pmpriv, pbss_entry, pbssid_profile, num_in_table, + pmulti_bssid->max_bssid_indicator); pcurrent_ptr += pbssid_profile->ieee_hdr.len + 2; bytes_left -= pbssid_profile->ieee_hdr.len + 2; } @@ -5498,16 +5539,16 @@ * * @return N/A */ -static void -wlan_parse_multi_bssid_ap(mlan_private *pmpriv, - BSSDescriptor_t *pbss_entry, t_u32 *num_in_table) +static void wlan_parse_multi_bssid_ap(mlan_private *pmpriv, + BSSDescriptor_t *pbss_entry, + t_u32 *num_in_table) { IEEEtypes_ElementId_e element_id; t_u8 element_len; t_u16 total_ie_len; t_u32 bytes_left = pbss_entry->beacon_buf_size - BEACON_FIX_SIZE; t_u8 *pcurrent_ptr = pbss_entry->pbeacon_buf + BEACON_FIX_SIZE; - IEEEtypes_Ssid_t *pssid = (IEEEtypes_Ssid_t *) pcurrent_ptr; + IEEEtypes_Ssid_t *pssid = (IEEEtypes_Ssid_t *)pcurrent_ptr; if (pssid->element_id != SSID) { PRINTM(MERROR, @@ -5522,14 +5563,15 @@ if (bytes_left < total_ie_len) { PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + "bytes left < IE length\n"); bytes_left = 0; continue; } if (element_id == MULTI_BSSID) - wlan_parse_multi_bssid_ie(pmpriv, pbss_entry, - (IEEEtypes_MultiBSSID_t *) - pcurrent_ptr, num_in_table); + wlan_parse_multi_bssid_ie( + pmpriv, pbss_entry, + (IEEEtypes_MultiBSSID_t *)pcurrent_ptr, + num_in_table); pcurrent_ptr += total_ie_len; bytes_left -= total_ie_len; } @@ -5546,10 +5588,10 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_parse_ext_scan_result(mlan_private *pmpriv, - t_u8 number_of_sets, - t_u8 *pscan_resp, t_u16 scan_resp_size) +static mlan_status wlan_parse_ext_scan_result(mlan_private *pmpriv, + t_u8 number_of_sets, + t_u8 *pscan_resp, + t_u16 scan_resp_size) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; @@ -5566,7 +5608,7 @@ MrvlIEtypes_Data_t *ptlv = MNULL; MrvlIEtypes_Bss_Scan_Rsp_t *pscan_rsp_tlv = MNULL; MrvlIEtypes_Bss_Scan_Info_t *pscan_info_tlv = MNULL; - t_u8 band; + t_u16 band; t_u32 age_ts_usec; ENTER(); @@ -5585,9 +5627,8 @@ PRINTM(MINFO, "EXT_SCAN: returned %d APs before parsing\n", number_of_sets); /* Update the age_in_second */ - pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, - &pmadapter->age_in_secs, - &age_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pmadapter->age_in_secs, &age_ts_usec); num_in_table = pmadapter->num_in_scan_table; ptlv = (MrvlIEtypes_Data_t *)pscan_resp; @@ -5636,7 +5677,7 @@ /* Process variable TLV */ while (bytes_left_for_tlv >= sizeof(MrvlIEtypesHeader_t) && wlan_le16_to_cpu(ptlv->header.type) != - TLV_TYPE_BSS_SCAN_RSP) { + TLV_TYPE_BSS_SCAN_RSP) { tlv_type = wlan_le16_to_cpu(ptlv->header.type); tlv_len = wlan_le16_to_cpu(ptlv->header.len); if (bytes_left_for_tlv < @@ -5654,7 +5695,7 @@ (MrvlIEtypes_Bss_Scan_Info_t *)ptlv; if (tlv_len != sizeof(MrvlIEtypes_Bss_Scan_Info_t) - - sizeof(MrvlIEtypesHeader_t)) { + sizeof(MrvlIEtypesHeader_t)) { bytes_left_for_tlv = 0; continue; } @@ -5684,9 +5725,9 @@ memset(pmadapter, bss_new_entry, 0x00, sizeof(BSSDescriptor_t)); /* Process the data fields and IEs returned for this BSS */ - if (wlan_interpret_bss_desc_with_ie - (pmadapter, bss_new_entry, &pbss_info, &bytes_left, - MTRUE) == MLAN_STATUS_SUCCESS) { + if (wlan_interpret_bss_desc_with_ie( + pmadapter, bss_new_entry, &pbss_info, &bytes_left, + MTRUE) == MLAN_STATUS_SUCCESS) { PRINTM(MINFO, "EXT_SCAN: BSSID = " MACSTR "\n", MAC2STR(bss_new_entry->mac_address)); @@ -5699,9 +5740,8 @@ */ if (pscan_info_tlv) { /* RSSI is 2 byte long */ - bss_new_entry->rssi = - -(t_s32)(wlan_le16_to_cpu - (pscan_info_tlv->rssi)); + bss_new_entry->rssi = -(t_s32)(wlan_le16_to_cpu( + pscan_info_tlv->rssi)); PRINTM(MINFO, "EXT_SCAN: RSSI=%d\n", bss_new_entry->rssi); memcpy_ext(pmpriv->adapter, &tsf_val, @@ -5713,8 +5753,8 @@ &tsf_val, sizeof(bss_new_entry->network_tsf), sizeof(bss_new_entry->network_tsf)); - band = radio_type_to_band(pscan_info_tlv-> - bandcfg.chanBand); + band = radio_type_to_band( + pscan_info_tlv->bandcfg.chanBand); if (!bss_new_entry->channel) bss_new_entry->channel = pscan_info_tlv->channel; @@ -5724,13 +5764,9 @@ bss_new_entry->bss_band = band; bss_new_entry->age_in_secs = pmadapter->age_in_secs; - cfp = wlan_find_cfp_by_band_and_channel(pmadapter, - (t_u8) - bss_new_entry-> - bss_band, - (t_u16) - bss_new_entry-> - channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, bss_new_entry->bss_band, + (t_u16)bss_new_entry->channel); if (cfp) bss_new_entry->freq = cfp->freq; else @@ -5745,9 +5781,9 @@ if (IS_FW_SUPPORT_MULTIBSSID(pmadapter)) { if (bss_new_entry->multi_bssid_ap == MULTI_BSSID_AP) - wlan_parse_multi_bssid_ap(pmpriv, - bss_new_entry, - &num_in_table); + wlan_parse_multi_bssid_ap( + pmpriv, bss_new_entry, + &num_in_table); } wlan_add_new_entry_to_scan_table(pmpriv, bss_new_entry, &num_in_table); @@ -5767,9 +5803,8 @@ /* Update the total number of BSSIDs in the scan table */ pmadapter->num_in_scan_table = num_in_table; /* Update the age_in_second */ - pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, - &pmadapter->age_in_secs, - &age_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pmadapter->age_in_secs, &age_ts_usec); done: if (bss_new_entry) @@ -5787,8 +5822,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_handle_event_ext_scan_report(mlan_private *pmpriv, mlan_buffer *pmbuf) +mlan_status wlan_handle_event_ext_scan_report(mlan_private *pmpriv, + mlan_buffer *pmbuf) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = &pmadapter->callbacks; @@ -5804,24 +5839,33 @@ DBG_HEXDUMP(MCMD_D, "EVENT EXT_SCAN", pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len); + + if (!pevent_scan->more_event) + pmadapter->scan_state |= SCAN_STATE_EXT_SCAN_RESULT | + SCAN_STATE_LAST_EXT_SCAN_RESULT; + else + pmadapter->scan_state |= SCAN_STATE_EXT_SCAN_RESULT; + wlan_parse_ext_scan_result(pmpriv, pevent_scan->num_of_set, ptlv, tlv_buf_left); - if (!pevent_scan->more_event - && (pmadapter->ext_scan_type != EXT_SCAN_ENHANCE) - ) { + if (!pevent_scan->more_event && + (pmadapter->ext_scan_type != EXT_SCAN_ENHANCE)) { wlan_request_cmd_lock(pmadapter); if (!util_peek_list(pmadapter->pmoal_handle, &pmadapter->scan_pending_q, MNULL, MNULL)) { wlan_release_cmd_lock(pmadapter); if (pmadapter->pscan_ioctl_req) { if (((mlan_ds_scan *) - pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == - MLAN_OID_SCAN_SPECIFIC_SSID || + pmadapter->pscan_ioctl_req->pbuf) + ->sub_command == + MLAN_OID_SCAN_SPECIFIC_SSID || ((mlan_ds_scan *) - pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == MLAN_OID_SCAN_USER_CONFIG) { - if (wlan_active_scan_req_for_passive_chan(pmpriv, pmadapter->pscan_ioctl_req)) { + pmadapter->pscan_ioctl_req->pbuf) + ->sub_command == + MLAN_OID_SCAN_USER_CONFIG) { + if (wlan_active_scan_req_for_passive_chan( + pmpriv, + pmadapter->pscan_ioctl_req)) { LEAVE(); return ret; } @@ -5835,17 +5879,17 @@ wlan_scan_process_results(pmpriv); wlan_request_cmd_lock(pmadapter); pmadapter->scan_processing = MFALSE; + pmadapter->scan_state |= SCAN_STATE_SCAN_COMPLETE; pioctl_req = pmadapter->pscan_ioctl_req; pmadapter->pscan_ioctl_req = MNULL; /* Need to indicate IOCTL complete */ if (pioctl_req != MNULL) { pioctl_req->status_code = MLAN_ERROR_NO_ERROR; /* Indicate ioctl complete */ - pcb->moal_ioctl_complete(pmadapter-> - pmoal_handle, - (pmlan_ioctl_req) - pioctl_req, - MLAN_STATUS_SUCCESS); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + (pmlan_ioctl_req)pioctl_req, + MLAN_STATUS_SUCCESS); } wlan_release_cmd_lock(pmadapter); @@ -5861,6 +5905,9 @@ wlan_flush_scan_queue(pmadapter); wlan_request_cmd_lock(pmadapter); pmadapter->scan_processing = MFALSE; + pmadapter->scan_state |= + SCAN_STATE_SCAN_COMPLETE; + pioctl_req = pmadapter->pscan_ioctl_req; pmadapter->pscan_ioctl_req = MNULL; /* Indicate IOCTL complete */ @@ -5869,23 +5916,19 @@ MLAN_ERROR_FW_NOT_READY; /* Indicate ioctl complete */ - pcb->moal_ioctl_complete(pmadapter-> - pmoal_handle, - (pmlan_ioctl_req) - pioctl_req, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + (pmlan_ioctl_req)pioctl_req, + MLAN_STATUS_FAILURE); } wlan_release_cmd_lock(pmadapter); } else { /* Get scan command from scan_pending_q and put * to cmd_pending_q */ - pcmd_node = - (cmd_ctrl_node *) - util_dequeue_list(pmadapter-> - pmoal_handle, - &pmadapter-> - scan_pending_q, MNULL, - MNULL); + pcmd_node = (cmd_ctrl_node *)util_dequeue_list( + pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, MNULL, + MNULL); wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, MTRUE); wlan_release_cmd_lock(pmadapter); @@ -5904,8 +5947,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_handle_event_ext_scan_status(mlan_private *pmpriv, mlan_buffer *pmbuf) +mlan_status wlan_handle_event_ext_scan_status(mlan_private *pmpriv, + mlan_buffer *pmbuf) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5916,6 +5959,7 @@ MrvlIEtypesHeader_t *tlv; MrvlIEtypes_ChannelStats_t *tlv_chan_stats; t_u8 status; + cmd_ctrl_node *pcmd_node = MNULL; ENTER(); @@ -5924,9 +5968,10 @@ ret = MLAN_STATUS_FAILURE; goto done; } + pmadapter->scan_state |= SCAN_STATE_EXT_SCAN_STATUS; scan_event = - (pmlan_event_scan_status) (pmbuf->pbuf + pmbuf->data_offset); + (pmlan_event_scan_status)(pmbuf->pbuf + pmbuf->data_offset); DBG_HEXDUMP(MCMD_D, "EVENT: Ext_Scan_Status", scan_event, pmbuf->data_len); status = scan_event->scan_status; @@ -5959,6 +6004,47 @@ } done: + wlan_request_cmd_lock(pmadapter); + if (util_peek_list(pmadapter->pmoal_handle, &pmadapter->scan_pending_q, + MNULL, MNULL)) { + /* If firmware not ready, do not issue any more scan + * commands */ + if (pmadapter->hw_status != WlanHardwareStatusReady) { + wlan_release_cmd_lock(pmadapter); + /* Flush all pending scan commands */ + wlan_flush_scan_queue(pmadapter); + wlan_request_cmd_lock(pmadapter); + pmadapter->scan_processing = MFALSE; + pmadapter->scan_state |= SCAN_STATE_SCAN_COMPLETE; + pioctl_req = pmadapter->pscan_ioctl_req; + pmadapter->pscan_ioctl_req = MNULL; + /* Indicate IOCTL complete */ + if (pioctl_req != MNULL) { + pioctl_req->status_code = + MLAN_ERROR_FW_NOT_READY; + + /* Indicate ioctl complete */ + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + (pmlan_ioctl_req)pioctl_req, + MLAN_STATUS_FAILURE); + } + wlan_release_cmd_lock(pmadapter); + } else { + /* Get scan command from scan_pending_q and put + * to cmd_pending_q */ + pcmd_node = (cmd_ctrl_node *)util_dequeue_list( + pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, MNULL, MNULL); + wlan_insert_cmd_to_pending_q(pmadapter, pcmd_node, + MTRUE); + wlan_release_cmd_lock(pmadapter); + } + LEAVE(); + return ret; + } + wlan_release_cmd_lock(pmadapter); + /* Now we got response from FW, cancel the command timer */ if (!pmadapter->curr_cmd && pmadapter->cmd_timer_is_set) { /* Cancel command timeout timer */ @@ -5969,12 +6055,13 @@ } if (pmadapter->pscan_ioctl_req) { if (((mlan_ds_scan *)pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == - MLAN_OID_SCAN_SPECIFIC_SSID || + ->sub_command == + MLAN_OID_SCAN_SPECIFIC_SSID || ((mlan_ds_scan *)pmadapter->pscan_ioctl_req->pbuf) - ->sub_command == MLAN_OID_SCAN_USER_CONFIG) { - if (wlan_active_scan_req_for_passive_chan - (pmpriv, pmadapter->pscan_ioctl_req)) { + ->sub_command == + MLAN_OID_SCAN_USER_CONFIG) { + if (wlan_active_scan_req_for_passive_chan( + pmpriv, pmadapter->pscan_ioctl_req)) { LEAVE(); return ret; } @@ -5989,6 +6076,7 @@ /** Complete scan ioctl */ wlan_request_cmd_lock(pmadapter); pmadapter->scan_processing = MFALSE; + pmadapter->scan_state |= SCAN_STATE_SCAN_COMPLETE; pioctl_req = pmadapter->pscan_ioctl_req; pmadapter->pscan_ioctl_req = MNULL; /* Need to indicate IOCTL complete */ @@ -6016,9 +6104,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_802_11_bg_scan_query(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf) +mlan_status wlan_cmd_802_11_bg_scan_query(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_void *pdata_buf) { HostCmd_DS_802_11_BG_SCAN_QUERY *bg_query = &pcmd->params.bg_scan_query; @@ -6061,7 +6149,7 @@ t_u32 next_chan; t_u8 scan_type; t_u8 radio_type; - t_u8 band; + t_u16 band; ENTER(); @@ -6083,7 +6171,7 @@ if (pbg_scan_in && !pbg_scan_in->chan_list[0].chan_number && pbg_scan_in->chan_list[0].radio_type & BAND_SPECIFIED) { radio_type = pbg_scan_in->chan_list[0].radio_type & - ~BAND_SPECIFIED; + ~BAND_SPECIFIED; if (!radio_type && (pscan_region->band != BAND_B) && (pscan_region->band != BAND_G)) continue; @@ -6115,14 +6203,14 @@ tlv_chan_list->chan_scan_param[chan_idx] .bandcfg.chanBand = BAND_5GHZ; /* Passive scan on DFS channels */ - if (wlan_11h_radar_detect_required - (pmpriv, (t_u8)cfp->channel)) + if (wlan_11h_radar_detect_required( + pmpriv, (t_u8)cfp->channel)) scan_type = MLAN_SCAN_TYPE_PASSIVE; break; case BAND_B: case BAND_G: - if (wlan_bg_scan_type_is_passive - (pmpriv, (t_u8)cfp->channel)) + if (wlan_bg_scan_type_is_passive( + pmpriv, (t_u8)cfp->channel)) scan_type = MLAN_SCAN_TYPE_PASSIVE; tlv_chan_list->chan_scan_param[chan_idx] .bandcfg.chanBand = BAND_2GHZ; @@ -6133,33 +6221,30 @@ break; } - if (pbg_scan_in && pbg_scan_in->chan_list[0].scan_time) { + if (pbg_scan_in && + pbg_scan_in->chan_list[0].scan_time) { tlv_chan_list->chan_scan_param[chan_idx] - .max_scan_time = wlan_cpu_to_le16((t_u16)pbg_scan_in->chan_list[0] - . - scan_time); + .max_scan_time = wlan_cpu_to_le16( + (t_u16)pbg_scan_in->chan_list[0] + .scan_time); tlv_chan_list->chan_scan_param[chan_idx] - .min_scan_time = wlan_cpu_to_le16((t_u16)pbg_scan_in->chan_list[0] - . - scan_time); + .min_scan_time = wlan_cpu_to_le16( + (t_u16)pbg_scan_in->chan_list[0] + .scan_time); } else if (scan_type == MLAN_SCAN_TYPE_PASSIVE) { tlv_chan_list->chan_scan_param[chan_idx] - .max_scan_time = - wlan_cpu_to_le16(pmadapter-> - passive_scan_time); + .max_scan_time = wlan_cpu_to_le16( + pmadapter->passive_scan_time); tlv_chan_list->chan_scan_param[chan_idx] - .min_scan_time = - wlan_cpu_to_le16(pmadapter-> - passive_scan_time); + .min_scan_time = wlan_cpu_to_le16( + pmadapter->passive_scan_time); } else { tlv_chan_list->chan_scan_param[chan_idx] - .max_scan_time = - wlan_cpu_to_le16(pmadapter-> - specific_scan_time); + .max_scan_time = wlan_cpu_to_le16( + pmadapter->specific_scan_time); tlv_chan_list->chan_scan_param[chan_idx] - .min_scan_time = - wlan_cpu_to_le16(pmadapter-> - specific_scan_time); + .min_scan_time = wlan_cpu_to_le16( + pmadapter->specific_scan_time); } if (scan_type == MLAN_SCAN_TYPE_PASSIVE) { @@ -6189,9 +6274,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_bgscan_config(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf) +mlan_status wlan_cmd_bgscan_config(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, t_void *pdata_buf) { mlan_adapter *pmadapter = pmpriv->adapter; HostCmd_DS_802_11_BG_SCAN_CONFIG *bg_scan = @@ -6224,8 +6308,8 @@ t_u8 radio_type; t_u16 scan_dur; t_u8 scan_type; - t_u8 band; - const t_u8 zero_mac[6] = { 0, 0, 0, 0, 0, 0 }; + t_u16 band; + const t_u8 zero_mac[6] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -6250,7 +6334,7 @@ tlv = (t_u8 *)bg_scan + sizeof(HostCmd_DS_802_11_BG_SCAN_CONFIG); num_probes = (bg_scan_in->num_probes ? bg_scan_in->num_probes : - pmadapter->scan_probes); + pmadapter->scan_probes); if (num_probes) { pnum_probes_tlv = (MrvlIEtypes_NumProbes_t *)tlv; pnum_probes_tlv->header.type = @@ -6265,10 +6349,9 @@ if (bg_scan_in->rssi_threshold) { rssi_tlv = (MrvlIEtypes_BeaconLowRssiThreshold_t *)tlv; rssi_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_RSSI_LOW); - rssi_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconLowRssiThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + rssi_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconLowRssiThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); rssi_tlv->value = bg_scan_in->rssi_threshold; rssi_tlv->frequency = 0; tlv += sizeof(MrvlIEtypes_BeaconLowRssiThreshold_t); @@ -6277,10 +6360,9 @@ if (bg_scan_in->snr_threshold) { snr_tlv = (MrvlIEtypes_BeaconLowSnrThreshold_t *)tlv; snr_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_SNR_LOW); - snr_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconLowSnrThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + snr_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconLowSnrThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); snr_tlv->value = bg_scan_in->snr_threshold; snr_tlv->frequency = 0; tlv += sizeof(MrvlIEtypes_BeaconLowRssiThreshold_t); @@ -6302,8 +6384,8 @@ (*bg_scan_in->ssid_list[ssid_idx].ssid || bg_scan_in->ssid_list[ssid_idx].max_len)); ssid_idx++) { - ssid_len = wlan_strlen((char *)bg_scan_in->ssid_list[ssid_idx]. - ssid); + ssid_len = wlan_strlen( + (char *)bg_scan_in->ssid_list[ssid_idx].ssid); pwildcard_ssid_tlv = (MrvlIEtypes_WildCardSsIdParamSet_t *)tlv; pwildcard_ssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WILDCARDSSID); @@ -6316,10 +6398,9 @@ bg_scan_in->ssid_list[ssid_idx].ssid, ssid_len, MLAN_MAX_SSID_LENGTH); tlv += sizeof(pwildcard_ssid_tlv->header) + - pwildcard_ssid_tlv->header.len; - cmd_size += - sizeof(pwildcard_ssid_tlv->header) + - pwildcard_ssid_tlv->header.len; + pwildcard_ssid_tlv->header.len; + cmd_size += sizeof(pwildcard_ssid_tlv->header) + + pwildcard_ssid_tlv->header.len; pwildcard_ssid_tlv->header.len = wlan_cpu_to_le16(pwildcard_ssid_tlv->header.len); PRINTM(MINFO, "Scan: ssid_list[%d]: %s, %d\n", ssid_idx, @@ -6331,36 +6412,33 @@ PRINTM(MINFO, "Scan: Using supplied channel list\n"); chan_num = 0; for (chan_idx = 0; chan_idx < WLAN_BG_SCAN_CHAN_MAX && - bg_scan_in->chan_list[chan_idx].chan_number; chan_idx++) { + bg_scan_in->chan_list[chan_idx].chan_number; + chan_idx++) { radio_type = bg_scan_in->chan_list[chan_idx].radio_type; if (bg_scan_in->bss_type == MLAN_SCAN_MODE_IBSS || pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) band = pmadapter->adhoc_start_band; else band = pmpriv->config_bands; - if (!wlan_is_band_compatible - (band, radio_type_to_band(radio_type))) + if (!wlan_is_band_compatible( + band, radio_type_to_band(radio_type))) continue; scan_type = bg_scan_in->chan_list[chan_idx].scan_type; /* Prevent active scanning on a radar controlled channel */ if (radio_type == BAND_5GHZ) { - if (wlan_11h_radar_detect_required(pmpriv, - bg_scan_in-> - chan_list - [chan_idx] - . - chan_number)) - { + if (wlan_11h_radar_detect_required( + pmpriv, + bg_scan_in->chan_list[chan_idx] + .chan_number)) { scan_type = MLAN_SCAN_TYPE_PASSIVE; } } if (radio_type == BAND_2GHZ) { - if (wlan_bg_scan_type_is_passive(pmpriv, - bg_scan_in-> - chan_list - [chan_idx] - .chan_number)) { + if (wlan_bg_scan_type_is_passive( + pmpriv, + bg_scan_in->chan_list[chan_idx] + .chan_number)) { scan_type = MLAN_SCAN_TYPE_PASSIVE; } } @@ -6380,7 +6458,7 @@ if (bg_scan_in->chan_list[chan_idx].scan_time) { scan_dur = (t_u16)bg_scan_in->chan_list[chan_idx] - .scan_time; + .scan_time; } else { if (scan_type == MLAN_SCAN_TYPE_PASSIVE) { scan_dur = pmadapter->passive_scan_time; @@ -6400,9 +6478,9 @@ tlv_chan_list->header.len = wlan_cpu_to_le16(sizeof(ChanScanParamSet_t) * chan_num); tlv += sizeof(MrvlIEtypesHeader_t) + - sizeof(ChanScanParamSet_t) * chan_num; + sizeof(ChanScanParamSet_t) * chan_num; cmd_size += sizeof(MrvlIEtypesHeader_t) + - sizeof(ChanScanParamSet_t) * chan_num; + sizeof(ChanScanParamSet_t) * chan_num; } else { tlv_chan_list = (MrvlIEtypes_ChanListParamSet_t *)tlv; chan_num = wlan_bgscan_create_channel_list(pmpriv, bg_scan_in, @@ -6412,9 +6490,9 @@ tlv_chan_list->header.len = wlan_cpu_to_le16(sizeof(ChanScanParamSet_t) * chan_num); tlv += sizeof(MrvlIEtypesHeader_t) + - sizeof(ChanScanParamSet_t) * chan_num; + sizeof(ChanScanParamSet_t) * chan_num; cmd_size += sizeof(MrvlIEtypesHeader_t) + - sizeof(ChanScanParamSet_t) * chan_num; + sizeof(ChanScanParamSet_t) * chan_num; } if (bg_scan_in->chan_per_scan) { bg_scan->chan_per_scan = bg_scan_in->chan_per_scan; @@ -6426,8 +6504,8 @@ MRVDRV_MAX_CHANNELS_PER_SPECIFIC_SCAN; } if (ISSUPP_11NENABLED(pmpriv->adapter->fw_cap_info) && - (pmpriv->config_bands & BAND_GN - || pmpriv->config_bands & BAND_AN)) { + (pmpriv->config_bands & BAND_GN || + pmpriv->config_bands & BAND_AN)) { pht_cap = (MrvlIETypes_HTCap_t *)tlv; memset(pmadapter, pht_cap, 0, sizeof(MrvlIETypes_HTCap_t)); pht_cap->header.type = wlan_cpu_to_le16(HT_CAPABILITY); @@ -6455,9 +6533,12 @@ pvht_cap->header.len = wlan_cpu_to_le16(pvht_cap->header.len); } - if (IS_FW_SUPPORT_11AX(pmadapter) && (pmpriv->config_bands & BAND_AAX)) { - phe_cap = (MrvlIEtypes_Extension_t *) tlv; - len = wlan_fill_he_cap_tlv(pmpriv, BAND_A, phe_cap, MFALSE); + if (IS_FW_SUPPORT_11AX(pmadapter) && + ((pmpriv->config_bands & BAND_GAX) || + (pmpriv->config_bands & BAND_AAX))) { + phe_cap = (MrvlIEtypes_Extension_t *)tlv; + len = wlan_fill_he_cap_tlv(pmpriv, pmpriv->config_bands, + phe_cap, MFALSE); DBG_HEXDUMP(MCMD_D, "BGSCAN: HE_CAPABILITIES IE", (t_u8 *)phe_cap, len); tlv += len; @@ -6480,14 +6561,15 @@ pmpriv->usr_dot_11n_dev_cap_bg; if (usr_dot_11n_dev_cap & MBIT(17)) { bandwidth = BW_40MHZ; - if (ISSUPP_11ACENABLED(pmadapter->fw_cap_info) - && (pmpriv->config_bands & BAND_AAC)) + if (ISSUPP_11ACENABLED( + pmadapter->fw_cap_info) && + (pmpriv->config_bands & BAND_AAC)) bandwidth = BW_80MHZ; } - wlan_get_curr_oper_class(pmpriv, - pmpriv->curr_bss_params. - bss_descriptor.channel, - bandwidth, &oper_class); + wlan_get_curr_oper_class( + pmpriv, + pmpriv->curr_bss_params.bss_descriptor.channel, + bandwidth, &oper_class); } len = wlan_add_supported_oper_class_ie(pmpriv, &tlv, oper_class); @@ -6497,16 +6579,15 @@ tlv_start_later = (MrvlIEtypes_StartLater_t *)tlv; tlv_start_later->header.type = wlan_cpu_to_le16(TLV_TYPE_STARTBGSCANLATER); - tlv_start_later->header.len = - wlan_cpu_to_le16(sizeof(MrvlIEtypes_StartLater_t) - - sizeof(MrvlIEtypesHeader_t)); + tlv_start_later->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_StartLater_t) - sizeof(MrvlIEtypesHeader_t)); tlv_start_later->value = wlan_cpu_to_le16(bg_scan_in->start_later); tlv += sizeof(MrvlIEtypes_StartLater_t); cmd_size += sizeof(MrvlIEtypes_StartLater_t); if (bg_scan_in->config_ees) { /* Fill EES configuration */ - tlv_ees_cfg = (MrvlIEtypes_EESParamSet_t *) tlv; + tlv_ees_cfg = (MrvlIEtypes_EESParamSet_t *)tlv; tlv_ees_cfg->header.type = wlan_cpu_to_le16(TLV_TYPE_EES_CFG); tlv_ees_cfg->header.len = wlan_cpu_to_le16(sizeof(MrvlIEtypes_EESParamSet_t) - @@ -6531,13 +6612,12 @@ if (bg_scan_in->network_count) { /* Fill EES network configuration */ - tlv_ees_net_cfg = (MrvlIEtype_EESNetworkCfg_t *) tlv; + tlv_ees_net_cfg = (MrvlIEtype_EESNetworkCfg_t *)tlv; tlv_ees_net_cfg->header.type = wlan_cpu_to_le16(TLV_TYPE_EES_NET_CFG); - tlv_ees_net_cfg->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtype_EESNetworkCfg_t) - - sizeof(MrvlIEtypesHeader_t)); + tlv_ees_net_cfg->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtype_EESNetworkCfg_t) - + sizeof(MrvlIEtypesHeader_t)); tlv_ees_net_cfg->network_count = bg_scan_in->network_count; tlv_ees_net_cfg->max_conn_count = @@ -6548,28 +6628,28 @@ cmd_size += sizeof(MrvlIEtype_EESNetworkCfg_t); for (index = 0; index < bg_scan_in->network_count; index++) { - if (wlan_strlen - ((char *)bg_scan_in->ees_ssid_cfg[index] - .ssid)) { + if (wlan_strlen((char *)bg_scan_in + ->ees_ssid_cfg[index] + .ssid)) { /* Fill SSID settings */ tlv_ssid = (MrvlIEtypes_SsIdParamSet_t *) - tlv; + tlv; tlv_ssid->header.type = wlan_cpu_to_le16(TLV_TYPE_SSID); - tlv_ssid->header.len = wlan_cpu_to_le16((t_u16)bg_scan_in->ees_ssid_cfg[index] - . - max_len); - memcpy_ext(pmadapter, tlv_ssid->ssid, - bg_scan_in-> - ees_ssid_cfg[index] - .ssid, - bg_scan_in-> - ees_ssid_cfg[index] - .max_len, - MLAN_MAX_SSID_LENGTH); + tlv_ssid->header.len = wlan_cpu_to_le16( + (t_u16)bg_scan_in + ->ees_ssid_cfg[index] + .max_len); + memcpy_ext( + pmadapter, tlv_ssid->ssid, + bg_scan_in->ees_ssid_cfg[index] + .ssid, + bg_scan_in->ees_ssid_cfg[index] + .max_len, + MLAN_MAX_SSID_LENGTH); tlv += sizeof(MrvlIEtypesHeader_t) + - tlv_ssid->header.len; + tlv_ssid->header.len; cmd_size += sizeof(MrvlIEtypesHeader_t) + tlv_ssid->header.len; @@ -6577,42 +6657,37 @@ /* Fill Wildcard SSID settings */ pwildcard_ssid_tlv = (MrvlIEtypes_WildCardSsIdParamSet_t - *)tlv; + *)tlv; pwildcard_ssid_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_WILDCARDSSID); - pwildcard_ssid_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_WildCardSsIdParamSet_t) - - - sizeof - (MrvlIEtypesHeader_t)); + wlan_cpu_to_le16( + TLV_TYPE_WILDCARDSSID); + pwildcard_ssid_tlv->header + .len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_WildCardSsIdParamSet_t) - + sizeof(MrvlIEtypesHeader_t)); pwildcard_ssid_tlv->max_ssid_length = MLAN_MAX_SSID_LENGTH; tlv += sizeof(MrvlIEtypesHeader_t) + - sizeof(pwildcard_ssid_tlv-> - max_ssid_length); + sizeof(pwildcard_ssid_tlv + ->max_ssid_length); cmd_size += sizeof(MrvlIEtypesHeader_t) + - sizeof(pwildcard_ssid_tlv-> - max_ssid_length); + sizeof(pwildcard_ssid_tlv + ->max_ssid_length); } /* Fill Cipher settings */ tlv_ees_cipher = (MrvlIEtypes_Cipher_t *)tlv; tlv_ees_cipher->header.type = wlan_cpu_to_le16(TLV_TYPE_CIPHER); - tlv_ees_cipher->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_Cipher_t) - - - sizeof - (MrvlIEtypesHeader_t)); + tlv_ees_cipher->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_Cipher_t) - + sizeof(MrvlIEtypesHeader_t)); tlv_ees_cipher->pair_cipher = bg_scan_in->ees_ssid_cfg[index] - .pair_cipher; + .pair_cipher; tlv_ees_cipher->group_cipher = bg_scan_in->ees_ssid_cfg[index] - .group_cipher; + .group_cipher; tlv += sizeof(MrvlIEtypes_Cipher_t); cmd_size += sizeof(MrvlIEtypes_Cipher_t); } @@ -6650,9 +6725,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_bgscan_config(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_bgscan_config(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_scan *pscan = MNULL; HostCmd_DS_802_11_BG_SCAN_CONFIG *bg_scan = @@ -6690,10 +6765,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ret_802_11_bgscan_query(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_802_11_bgscan_query(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_scan *pscan = MNULL; mlan_adapter *pmadapter = pmpriv->adapter; @@ -6733,9 +6807,8 @@ * * @return index in BSSID list or < 0 if error */ -t_s32 -wlan_find_ssid_in_list(mlan_private *pmpriv, - mlan_802_11_ssid *ssid, t_u8 *bssid, t_u32 mode) +t_s32 wlan_find_ssid_in_list(mlan_private *pmpriv, mlan_802_11_ssid *ssid, + t_u8 *bssid, t_u32 mode) { mlan_adapter *pmadapter = pmpriv->adapter; t_s32 net = -1, j; @@ -6759,9 +6832,9 @@ !memcmp(pmadapter, pmadapter->pscan_table[i].mac_address, bssid, MLAN_MAC_ADDR_LENGTH))) { if ((mode == MLAN_BSS_MODE_INFRA) && - !wlan_is_band_compatible(pmpriv->config_bands, - pmadapter->pscan_table[i]. - bss_band)) + !wlan_is_band_compatible( + pmpriv->config_bands, + pmadapter->pscan_table[i].bss_band)) continue; switch (mode) { @@ -6771,11 +6844,12 @@ if (j >= 0) { if (SCAN_RSSI(pmadapter->pscan_table[i] - .rssi) > best_rssi) { - best_rssi = - SCAN_RSSI(pmadapter-> - pscan_table[i] - .rssi); + .rssi) > + best_rssi) { + best_rssi = SCAN_RSSI( + pmadapter + ->pscan_table[i] + .rssi); net = i; } } else { @@ -6793,9 +6867,8 @@ */ if (SCAN_RSSI(pmadapter->pscan_table[i].rssi) > best_rssi) { - best_rssi = - SCAN_RSSI(pmadapter-> - pscan_table[i].rssi); + best_rssi = SCAN_RSSI( + pmadapter->pscan_table[i].rssi); net = i; } break; @@ -6816,8 +6889,7 @@ * * @return index in BSSID list or < 0 if error */ -t_s32 -wlan_find_bssid_in_list(mlan_private *pmpriv, t_u8 *bssid, t_u32 mode) +t_s32 wlan_find_bssid_in_list(mlan_private *pmpriv, t_u8 *bssid, t_u32 mode) { mlan_adapter *pmadapter = pmpriv->adapter; t_s32 net = -1; @@ -6844,9 +6916,9 @@ if (!memcmp(pmadapter, pmadapter->pscan_table[i].mac_address, bssid, MLAN_MAC_ADDR_LENGTH)) { if ((mode == MLAN_BSS_MODE_INFRA) && - !wlan_is_band_compatible(pmpriv->config_bands, - pmadapter->pscan_table[i]. - bss_band)) + !wlan_is_band_compatible( + pmpriv->config_bands, + pmadapter->pscan_table[i].bss_band)) continue; switch (mode) { case MLAN_BSS_MODE_INFRA: @@ -6874,9 +6946,8 @@ * * @return 0--ssid is same, otherwise is different */ -t_s32 -wlan_ssid_cmp(pmlan_adapter pmadapter, mlan_802_11_ssid *ssid1, - mlan_802_11_ssid *ssid2) +t_s32 wlan_ssid_cmp(pmlan_adapter pmadapter, mlan_802_11_ssid *ssid1, + mlan_802_11_ssid *ssid2) { ENTER(); @@ -6902,8 +6973,8 @@ * * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -mlan_status -wlan_find_best_network(mlan_private *pmpriv, mlan_ssid_bssid *preq_ssid_bssid) +mlan_status wlan_find_best_network(mlan_private *pmpriv, + mlan_ssid_bssid *preq_ssid_bssid) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -6929,10 +7000,8 @@ if (pmpriv->bss_mode == MLAN_BSS_MODE_AUTO) pmpriv->bss_mode = preq_bss->bss_mode; preq_ssid_bssid->channel = (t_u16)preq_bss->channel; - if (preq_bss->pmd_ie - && wlan_ft_akm_is_used(pmpriv, (t_u8 *)preq_bss->prsn_ie) - ) { - + if (preq_bss->pmd_ie && + wlan_ft_akm_is_used(pmpriv, (t_u8 *)preq_bss->prsn_ie)) { preq_ssid_bssid->ft_md = preq_bss->pmd_ie->mdid; preq_ssid_bssid->ft_cap = preq_bss->pmd_ie->ft_cap; } @@ -6964,9 +7033,8 @@ * * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -mlan_status -wlan_scan_specific_ssid(mlan_private *pmpriv, - t_void *pioctl_buf, mlan_802_11_ssid *preq_ssid) +mlan_status wlan_scan_specific_ssid(mlan_private *pmpriv, t_void *pioctl_buf, + mlan_802_11_ssid *preq_ssid) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_callbacks *pcb = (mlan_callbacks *)&pmpriv->adapter->callbacks; @@ -6984,7 +7052,8 @@ wlan_scan_delete_ssid_table_entry(pmpriv, preq_ssid); ret = pcb->moal_malloc(pmpriv->adapter->pmoal_handle, - sizeof(wlan_user_scan_cfg), MLAN_MEM_DEF, + sizeof(wlan_user_scan_cfg), + MLAN_MEM_DEF | MLAN_MEM_FLAG_ATOMIC, (t_u8 **)&pscan_cfg); if (ret != MLAN_STATUS_SUCCESS || !pscan_cfg) { @@ -7023,8 +7092,7 @@ * * @return N/A */ -t_void -wlan_save_curr_bcn(mlan_private *pmpriv) +t_void wlan_save_curr_bcn(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (pmlan_callbacks)&pmadapter->callbacks; @@ -7048,7 +7116,8 @@ if (pmpriv->curr_bcn_size) { ret = pcb->moal_malloc(pmadapter->pmoal_handle, pcurr_bss->beacon_buf_size, - MLAN_MEM_DEF, + MLAN_MEM_DEF | + MLAN_MEM_FLAG_ATOMIC, &pmpriv->pcurr_bcn_buf); if ((ret == MLAN_STATUS_SUCCESS) && @@ -7080,8 +7149,7 @@ * * @return N/A */ -t_void -wlan_free_curr_bcn(mlan_private *pmpriv) +t_void wlan_free_curr_bcn(mlan_private *pmpriv) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_callbacks *pcb = (pmlan_callbacks)&pmadapter->callbacks;
diff --git a/wlan_sd8987/mlan/mlan_sdio.c b/wlan_sd8987/mlan/mlan_sdio.c index 6cabdd5..e1b6f20 100755 --- a/wlan_sd8987/mlan/mlan_sdio.c +++ b/wlan_sd8987/mlan/mlan_sdio.c
@@ -3,7 +3,7 @@ * @brief This file contains SDIO specific code * * - * Copyright 2008-2021 NXP + * Copyright 2008-2021, 2023 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -48,9 +48,10 @@ .base_1_reg = 0x6D, .poll_reg = 0x5C, .host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK | - CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, + CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, .host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS | - DN_LD_CMD_PORT_HOST_INT_STATUS | UP_LD_CMD_PORT_HOST_INT_STATUS, + DN_LD_CMD_PORT_HOST_INT_STATUS | + UP_LD_CMD_PORT_HOST_INT_STATUS, .status_reg_0 = 0x90, .status_reg_1 = 0x91, .sdio_int_mask = 0xff, @@ -157,9 +158,10 @@ .base_1_reg = 0x61, .poll_reg = 0x50, .host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK | - CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, + CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, .host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS | - DN_LD_CMD_PORT_HOST_INT_STATUS | UP_LD_CMD_PORT_HOST_INT_STATUS, + DN_LD_CMD_PORT_HOST_INT_STATUS | + UP_LD_CMD_PORT_HOST_INT_STATUS, .status_reg_0 = 0xC0, .status_reg_1 = 0xC1, .sdio_int_mask = 0xff, @@ -218,7 +220,9 @@ }; #endif -#if defined(SD8977) || defined(SD8997) || defined(SD8987) || defined(SD9098) || defined(SD9097) || defined(SD8978) || defined(SD9177) +#if defined(SD8977) || defined(SD8997) || defined(SD8987) || \ + defined(SD9098) || defined(SD9097) || defined(SDNW62X) || \ + defined(SD8978) || defined(SD9177) static const struct _mlan_sdio_card_reg mlan_reg_sd8977_sd8997 = { .start_rd_port = 0, .start_wr_port = 0, @@ -226,9 +230,10 @@ .base_1_reg = 0xf9, .poll_reg = 0x5C, .host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK | - CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, + CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK, .host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS | - DN_LD_CMD_PORT_HOST_INT_STATUS | UP_LD_CMD_PORT_HOST_INT_STATUS, + DN_LD_CMD_PORT_HOST_INT_STATUS | + UP_LD_CMD_PORT_HOST_INT_STATUS, .status_reg_0 = 0xe8, .status_reg_1 = 0xe9, .sdio_int_mask = 0xff, @@ -304,6 +309,17 @@ .default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2, }; #endif + +#ifdef SDNW62X +static const struct _mlan_card_info mlan_card_info_sdnw62x = { + .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, + .v16_fw_api = 1, + .v17_fw_api = 1, + .supp_ps_handshake = 0, + .default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2, +}; +#endif + #ifdef SD9098 static const struct _mlan_card_info mlan_card_info_sd9098 = { .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, @@ -355,8 +371,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_init_ioport(mlan_adapter *pmadapter) +static mlan_status wlan_sdio_init_ioport(mlan_adapter *pmadapter) { t_u32 reg; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -441,8 +456,10 @@ return MLAN_STATUS_FAILURE; } } + #if defined(SD8977) || defined(SD8978) - if (IS_SD8977(pmadapter->card_type) || IS_SD8978(pmadapter->card_type)) { + if (IS_SD8977(pmadapter->card_type) || + IS_SD8978(pmadapter->card_type)) { if ((pmadapter->init_para.int_mode == INT_MODE_GPIO) && (pmadapter->init_para.gpio_pin == GPIO_INT_NEW_MODE)) { PRINTM(MMSG, "Enable GPIO-1 int mode\n"); @@ -485,8 +502,8 @@ * @param port Port * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_write_data_sync(mlan_adapter *pmadapter, mlan_buffer *pmbuf, t_u32 port) +static mlan_status wlan_write_data_sync(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, t_u32 port) { t_u32 i = 0; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -527,8 +544,7 @@ * @param pport A pointer to port number * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_get_rd_port(mlan_adapter *pmadapter, t_u8 *pport) +static mlan_status wlan_get_rd_port(mlan_adapter *pmadapter, t_u8 *pport) { t_u32 rd_bitmap = pmadapter->pcard_sd->mp_rd_bitmap; const mlan_sdio_card_reg *reg = pmadapter->pcard_sd->reg; @@ -557,10 +573,8 @@ } else { if (pmadapter->pcard_sd->mp_rd_bitmap & (1 << pmadapter->pcard_sd->curr_rd_port)) { - pmadapter->pcard_sd->mp_rd_bitmap &= - (t_u32)(~ - (1 << pmadapter->pcard_sd-> - curr_rd_port)); + pmadapter->pcard_sd->mp_rd_bitmap &= (t_u32)(~( + 1 << pmadapter->pcard_sd->curr_rd_port)); *pport = pmadapter->pcard_sd->curr_rd_port; /* hw rx wraps round only after port (MAX_PORT-1) */ @@ -587,8 +601,7 @@ * @param pport A pointer to port number * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_get_wr_port_data(mlan_adapter *pmadapter, t_u8 *pport) +static mlan_status wlan_get_wr_port_data(mlan_adapter *pmadapter, t_u8 *pport) { t_u32 wr_bitmap = pmadapter->pcard_sd->mp_wr_bitmap; const mlan_sdio_card_reg *reg = pmadapter->pcard_sd->reg; @@ -639,8 +652,8 @@ * @param bits the bit mask * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_poll_card_status(mlan_adapter *pmadapter, t_u8 bits) +static mlan_status wlan_sdio_poll_card_status(mlan_adapter *pmadapter, + t_u8 bits) { pmlan_callbacks pcb = &pmadapter->callbacks; t_u32 tries; @@ -674,8 +687,7 @@ * @param dat A pointer to keep returned data * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_read_fw_status(mlan_adapter *pmadapter, t_u16 *dat) +static mlan_status wlan_sdio_read_fw_status(mlan_adapter *pmadapter, t_u16 *dat) { pmlan_callbacks pcb = &pmadapter->callbacks; t_u32 fws0 = 0, fws1 = 0; @@ -707,8 +719,8 @@ * @param dat A pointer to keep returned data * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_read_fw_dnld_offset(mlan_adapter *pmadapter, t_u32 *dat) +static mlan_status wlan_sdio_read_fw_dnld_offset(mlan_adapter *pmadapter, + t_u32 *dat) { pmlan_callbacks pcb = &pmadapter->callbacks; const mlan_sdio_card_reg *reg = pmadapter->pcard_sd->reg; @@ -774,8 +786,8 @@ * @param dat A pointer to keep returned data * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_read_fw_dnld_status(mlan_adapter *pmadapter, t_u16 *dat) +static mlan_status wlan_sdio_read_fw_dnld_status(mlan_adapter *pmadapter, + t_u16 *dat) { pmlan_callbacks pcb = &pmadapter->callbacks; const mlan_sdio_card_reg *reg = pmadapter->pcard_sd->reg; @@ -818,8 +830,8 @@ * @param mask the interrupt mask * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) +static mlan_status wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, + t_u8 mask) { t_u32 host_int_mask = 0; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -858,8 +870,8 @@ * @param mask the interrupt mask * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) +static mlan_status wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, + t_u8 mask) { pmlan_callbacks pcb = &pmadapter->callbacks; @@ -890,10 +902,9 @@ * @param ioport the SDIO ioport * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_card_to_host(mlan_adapter *pmadapter, t_u32 *type, - t_u32 *nb, pmlan_buffer pmbuf, - t_u32 npayload, t_u32 ioport) +static mlan_status wlan_sdio_card_to_host(mlan_adapter *pmadapter, t_u32 *type, + t_u32 *nb, pmlan_buffer pmbuf, + t_u32 npayload, t_u32 ioport) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -940,8 +951,8 @@ DBG_HEXDUMP(MIF_D, "SDIO Blk Rd", pmbuf->pbuf + pmbuf->data_offset, MIN(*nb, MAX_DATA_DUMP_LEN)); - *type = wlan_le16_to_cpu(*(t_u16 *) - (pmbuf->pbuf + pmbuf->data_offset + 2)); + *type = wlan_le16_to_cpu( + *(t_u16 *)(pmbuf->pbuf + pmbuf->data_offset + 2)); exit: LEAVE(); @@ -957,15 +968,15 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_prog_fw_w_helper(pmlan_adapter pmadapter, t_u8 *fw, t_u32 fw_len) +static mlan_status wlan_sdio_prog_fw_w_helper(pmlan_adapter pmadapter, t_u8 *fw, + t_u32 fw_len) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; t_u8 *firmware = fw; t_u32 firmwarelen = fw_len; t_u32 offset = 0; - t_u32 base0, base1; + t_u32 base0 = 0, base1; t_void *tmpfwbuf = MNULL; t_u32 tmpfwbufsz; t_u8 *fwbuf; @@ -1015,7 +1026,8 @@ if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Card Revision register read failed:" - "card_revision_reg=0x%x\n", rev_id_reg); + "card_revision_reg=0x%x\n", + rev_id_reg); goto done; } /* Skyhawk A0, need to check both CRC and MIC error */ @@ -1023,21 +1035,18 @@ check_fw_status = MTRUE; } #endif -#if defined(SD9097) - if (IS_SD9097(pmadapter->card_type)) +#if defined(SD9097) || defined(SD9177) || defined(SDNW62X) + if (IS_SD9097(pmadapter->card_type) || + IS_SDNW62X(pmadapter->card_type) || IS_SD9177(pmadapter->card_type)) check_fw_status = MTRUE; #endif -#if defined(SD9177) - if (IS_SD9177(pmadapter->card_type)) - check_fw_status = MTRUE; -#endif + /* Perform firmware data transfer */ do { /* The host polls for the DN_LD_CARD_RDY and CARD_IO_READY bits */ - ret = wlan_sdio_poll_card_status(pmadapter, - CARD_IO_READY | - DN_LD_CARD_RDY); + ret = wlan_sdio_poll_card_status( + pmadapter, CARD_IO_READY | DN_LD_CARD_RDY); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MFATAL, "WLAN: FW download with helper poll status timeout @ %d\n", @@ -1095,8 +1104,8 @@ /* New fw download process, check CRC and MIC error */ if (check_fw_status) { /* Get offset from fw dnld offset Register */ - ret = wlan_sdio_read_fw_dnld_offset(pmadapter, - &fw_dnld_offset); + ret = wlan_sdio_read_fw_dnld_offset( + pmadapter, &fw_dnld_offset); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MFATAL, "WLAN: FW download with helper read fw dnld offset failed @ %d\n", @@ -1105,8 +1114,8 @@ } /* Get CRC MIC error from fw dnld status * Register */ - ret = wlan_sdio_read_fw_dnld_status(pmadapter, - &fw_dnld_status); + ret = wlan_sdio_read_fw_dnld_status( + pmadapter, &fw_dnld_status); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MFATAL, "WLAN: FW download with helper read fw dnld status failed @ %d\n", @@ -1128,7 +1137,8 @@ PRINTM(MERROR, "WLAN: FW CRC error indicated by the helper:" - " len = 0x%04X, txlen = %d\n", len, txlen); + " len = 0x%04X, txlen = %d\n", + len, txlen); len &= ~MBIT(0); if (fw_dnld_status & (MBIT(6) | MBIT(7))) { offset = 0; @@ -1156,7 +1166,7 @@ PRINTM(MINFO, "."); tx_blocks = (txlen + MLAN_SDIO_BLOCK_SIZE_FW_DNLD - 1) / - MLAN_SDIO_BLOCK_SIZE_FW_DNLD; + MLAN_SDIO_BLOCK_SIZE_FW_DNLD; /* Copy payload to buffer */ if (firmware) @@ -1209,8 +1219,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_disable_sdio_host_int(pmlan_adapter pmadapter) +static mlan_status wlan_disable_sdio_host_int(pmlan_adapter pmadapter) { mlan_status ret; @@ -1230,9 +1239,9 @@ * @param lock_flag flag for spin_lock. * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_decode_rx_packet(mlan_adapter *pmadapter, - mlan_buffer *pmbuf, t_u32 upld_typ, t_u8 lock_flag) +static mlan_status wlan_decode_rx_packet(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, t_u32 upld_typ, + t_u8 lock_flag) { t_u8 *cmd_buf; t_u32 event; @@ -1248,22 +1257,18 @@ if (pmadapter->rx_work_flag) { pmbuf->buf_type = MLAN_BUF_TYPE_SPA_DATA; if (lock_flag) - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); util_enqueue_list_tail(pmadapter->pmoal_handle, &pmadapter->rx_data_queue, (pmlan_linked_list)pmbuf, MNULL, MNULL); pmadapter->rx_pkts_queued++; if (lock_flag) - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue.plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); } else { wlan_decode_spa_buffer(pmadapter, pmbuf->pbuf + pmbuf->data_offset, @@ -1284,49 +1289,42 @@ pmbuf->data_len = (pmadapter->upld_len - SDIO_INTF_HEADER_LEN); pmbuf->data_offset += SDIO_INTF_HEADER_LEN; if (pmadapter->rx_work_flag) { - //rx_trace 5 + // rx_trace 5 if (pmadapter->tp_state_on) { - pmadapter->callbacks. - moal_tp_accounting(pmadapter-> - pmoal_handle, pmbuf, - 5 /*RX_DROP_P1 */ ); - pcb->moal_get_system_time(pmadapter-> - pmoal_handle, - &in_ts_sec, - &in_ts_usec); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf, + 5 /*RX_DROP_P1*/); + pcb->moal_get_system_time( + pmadapter->pmoal_handle, &in_ts_sec, + &in_ts_usec); pmbuf->in_ts_sec = in_ts_sec; pmbuf->in_ts_usec = in_ts_usec; } if (pmadapter->tp_state_drop_point == - 5 /*RX_DROP_P1 */ ) { - pmadapter->ops.data_complete(pmadapter, pmbuf, - MLAN_STATUS_SUCCESS); + 5 /*RX_DROP_P1*/) { + pmadapter->ops.data_complete( + pmadapter, pmbuf, MLAN_STATUS_SUCCESS); } else { if (lock_flag) - pmadapter->callbacks. - moal_spin_lock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); - util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter-> - rx_data_queue, - (pmlan_linked_list)pmbuf, - MNULL, MNULL); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); + util_enqueue_list_tail( + pmadapter->pmoal_handle, + &pmadapter->rx_data_queue, + (pmlan_linked_list)pmbuf, MNULL, MNULL); pmadapter->rx_pkts_queued++; if (pmadapter->tp_state_on) - pmadapter->callbacks. - moal_tp_accounting_rx_param - (pmadapter->pmoal_handle, 1, - pmadapter->rx_pkts_queued); + pmadapter->callbacks + .moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, + 1, + pmadapter + ->rx_pkts_queued); if (lock_flag) - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); } } else { wlan_handle_rx_packet(pmadapter, pmbuf); @@ -1342,19 +1340,17 @@ if (!pmadapter->curr_cmd) { cmd_buf = pmadapter->upld_buf; if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) { - wlan_process_sleep_confirm_resp(pmadapter, - pmbuf->pbuf + - pmbuf-> - data_offset + - SDIO_INTF_HEADER_LEN, - pmadapter-> - upld_len - - SDIO_INTF_HEADER_LEN); + wlan_process_sleep_confirm_resp( + pmadapter, + pmbuf->pbuf + pmbuf->data_offset + + SDIO_INTF_HEADER_LEN, + pmadapter->upld_len - + SDIO_INTF_HEADER_LEN); } pmadapter->upld_len -= SDIO_INTF_HEADER_LEN; memcpy_ext(pmadapter, cmd_buf, pmbuf->pbuf + pmbuf->data_offset + - SDIO_INTF_HEADER_LEN, + SDIO_INTF_HEADER_LEN, pmadapter->upld_len - SDIO_INTF_HEADER_LEN, MRVDRV_SIZE_OF_CMD_BUFFER); wlan_free_mlan_buffer(pmadapter, pmbuf); @@ -1384,7 +1380,7 @@ MAX_EVENT_SIZE)) { memcpy_ext(pmadapter, pmadapter->event_body, pmbuf->pbuf + pmbuf->data_offset + - MLAN_EVENT_HEADER_LEN, + MLAN_EVENT_HEADER_LEN, pmadapter->upld_len - MLAN_EVENT_HEADER_LEN, MAX_EVENT_SIZE); } @@ -1415,8 +1411,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_receive_single_packet(mlan_adapter *pmadapter) +static mlan_status wlan_receive_single_packet(mlan_adapter *pmadapter) { mlan_buffer *pmbuf; t_u8 port; @@ -1459,8 +1454,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_receive_mp_aggr_buf(mlan_adapter *pmadapter) +static mlan_status wlan_receive_mp_aggr_buf(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1490,9 +1484,9 @@ pind++) { pmadapter->pcard_sd->mpa_rx.mbuf_arr[pind]->data_len = pmadapter->pcard_sd->mpa_rx.len_arr[pind]; - wlan_link_buf_to_aggr(&mbuf_aggr, - pmadapter->pcard_sd->mpa_rx. - mbuf_arr[pind]); + wlan_link_buf_to_aggr( + &mbuf_aggr, + pmadapter->pcard_sd->mpa_rx.mbuf_arr[pind]); } } else { mbuf_aggr.pbuf = (t_u8 *)pmadapter->pcard_sd->mpa_rx.buf; @@ -1504,11 +1498,11 @@ /* port_count = pmadapter->mpa_rx.pkt_cnt - 1; */ cmd53_port = (pmadapter->pcard_sd->ioport | SDIO_MPA_ADDR_BASE | (port_count << 8)) + - pmadapter->pcard_sd->mpa_rx.start_port; + pmadapter->pcard_sd->mpa_rx.start_port; } else { cmd53_port = (pmadapter->pcard_sd->ioport | SDIO_MPA_ADDR_BASE | (pmadapter->pcard_sd->mpa_rx.ports << 4)) + - pmadapter->pcard_sd->mpa_rx.start_port; + pmadapter->pcard_sd->mpa_rx.start_port; } do { ret = pcb->moal_read_data_sync(pmadapter->pmoal_handle, @@ -1531,24 +1525,21 @@ } } while (ret == MLAN_STATUS_FAILURE); if (pmadapter->rx_work_flag) - pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, - pmadapter->rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); if (!pmadapter->pcard_sd->mpa_rx.buf && pmadapter->pcard_sd->mpa_rx.pkt_cnt > 1) { for (pind = 0; pind < pmadapter->pcard_sd->mpa_rx.pkt_cnt; pind++) { mbuf_deaggr = pmadapter->pcard_sd->mpa_rx.mbuf_arr[pind]; - pkt_len = - wlan_le16_to_cpu(*(t_u16 *) - (mbuf_deaggr->pbuf + - mbuf_deaggr->data_offset)); - pkt_type = - wlan_le16_to_cpu(*(t_u16 *) - (mbuf_deaggr->pbuf + - mbuf_deaggr->data_offset + - 2)); + pkt_len = wlan_le16_to_cpu( + *(t_u16 *)(mbuf_deaggr->pbuf + + mbuf_deaggr->data_offset)); + pkt_type = wlan_le16_to_cpu( + *(t_u16 *)(mbuf_deaggr->pbuf + + mbuf_deaggr->data_offset + 2)); pmadapter->upld_len = pkt_len; wlan_decode_rx_packet(pmadapter, mbuf_deaggr, pkt_type, MFALSE); @@ -1573,13 +1564,13 @@ /* copy pkt to deaggr buf */ mbuf_deaggr = pmadapter->pcard_sd->mpa_rx.mbuf_arr[pind]; - if ((pkt_type == MLAN_TYPE_DATA - || pkt_type == MLAN_TYPE_SPA_DATA) && + if ((pkt_type == MLAN_TYPE_DATA || + pkt_type == MLAN_TYPE_SPA_DATA) && (pkt_len <= pmadapter->pcard_sd->mpa_rx.len_arr[pind])) { memcpy_ext(pmadapter, mbuf_deaggr->pbuf + - mbuf_deaggr->data_offset, + mbuf_deaggr->data_offset, curr_ptr, pkt_len, pkt_len); pmadapter->upld_len = pkt_len; /* Process de-aggr packet */ @@ -1589,19 +1580,19 @@ PRINTM(MERROR, "Wrong aggr packet: type=%d, len=%d, max_len=%d\n", pkt_type, pkt_len, - pmadapter->pcard_sd->mpa_rx. - len_arr[pind]); + pmadapter->pcard_sd->mpa_rx + .len_arr[pind]); wlan_free_mlan_buffer(pmadapter, mbuf_deaggr); } curr_ptr += pmadapter->pcard_sd->mpa_rx.len_arr[pind]; } } if (pmadapter->rx_work_flag) - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - pmadapter->rx_data_queue. - plock); - pmadapter->pcard_sd->mpa_rx_count[pmadapter->pcard_sd->mpa_rx.pkt_cnt - - 1]++; + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); + pmadapter->pcard_sd + ->mpa_rx_count[pmadapter->pcard_sd->mpa_rx.pkt_cnt - 1]++; MP_RX_AGGR_BUF_RESET(pmadapter); done: return ret; @@ -1616,9 +1607,9 @@ * @param rx_len Length of received packet * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_card_to_host_mp_aggr(mlan_adapter *pmadapter, - mlan_buffer *pmbuf, t_u8 port, t_u16 rx_len) +static mlan_status wlan_sdio_card_to_host_mp_aggr(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, t_u8 port, + t_u16 rx_len) { mlan_status ret = MLAN_STATUS_SUCCESS; t_s32 f_do_rx_aggr = 0; @@ -1648,11 +1639,9 @@ goto rx_curr_single; } if ((new_mode && - (pmadapter->pcard_sd->mp_rd_bitmap & reg->data_port_mask)) - || (!new_mode && - (pmadapter->pcard_sd-> - mp_rd_bitmap & (~((t_u32)CTRL_PORT_MASK)))) - ) { + (pmadapter->pcard_sd->mp_rd_bitmap & reg->data_port_mask)) || + (!new_mode && (pmadapter->pcard_sd->mp_rd_bitmap & + (~((t_u32)CTRL_PORT_MASK))))) { /* Some more data RX pending */ PRINTM(MINFO, "card_2_host_mp_aggr: Not last packet\n"); @@ -1695,10 +1684,9 @@ MP_RX_AGGR_SETUP_NONEWMODE(pmadapter, pmbuf, port, rx_len); if (MP_RX_AGGR_PKT_LIMIT_REACHED(pmadapter) || - ((new_mode && MP_RX_AGGR_PORT_LIMIT_REACHED(pmadapter)) - || (!new_mode && - MP_RX_AGGR_PORT_LIMIT_REACHED_NONEWMODE(pmadapter)) - )) { + ((new_mode && MP_RX_AGGR_PORT_LIMIT_REACHED(pmadapter)) || + (!new_mode && + MP_RX_AGGR_PORT_LIMIT_REACHED_NONEWMODE(pmadapter)))) { PRINTM(MINFO, "card_2_host_mp_aggr: Aggregation Packet limit reached\n"); /* No more pkts allowed in Aggr buf, rx it */ @@ -1708,7 +1696,8 @@ if (f_do_rx_aggr) { /* do aggr RX now */ - if (MLAN_STATUS_SUCCESS != wlan_receive_mp_aggr_buf(pmadapter)) { + if (MLAN_STATUS_SUCCESS != + wlan_receive_mp_aggr_buf(pmadapter)) { ret = MLAN_STATUS_FAILURE; goto done; } @@ -1719,18 +1708,16 @@ rx_len); if (MLAN_STATUS_SUCCESS != - wlan_sdio_card_to_host(pmadapter, &pkt_type, - (t_u32 *)&pmadapter->upld_len, pmbuf, - rx_len, - pmadapter->pcard_sd->ioport + - port)) { + wlan_sdio_card_to_host( + pmadapter, &pkt_type, (t_u32 *)&pmadapter->upld_len, + pmbuf, rx_len, + pmadapter->pcard_sd->ioport + port)) { ret = MLAN_STATUS_FAILURE; goto done; } if (!new_mode && - ((port == CTRL_PORT) && - ((pkt_type != MLAN_TYPE_EVENT) && - (pkt_type != MLAN_TYPE_CMD)))) { + ((port == CTRL_PORT) && ((pkt_type != MLAN_TYPE_EVENT) && + (pkt_type != MLAN_TYPE_CMD)))) { PRINTM(MERROR, "Wrong pkt from CTRL PORT: type=%d, len=%dd\n", pkt_type, pmbuf->data_len); @@ -1738,10 +1725,9 @@ ret = MLAN_STATUS_FAILURE; goto done; } - if (new_mode || (port != CTRL_PORT) - ) { - if (pkt_type != MLAN_TYPE_DATA - && pkt_type != MLAN_TYPE_SPA_DATA) { + if (new_mode || (port != CTRL_PORT)) { + if (pkt_type != MLAN_TYPE_DATA && + pkt_type != MLAN_TYPE_SPA_DATA) { PRINTM(MERROR, "receive a wrong pkt from DATA PORT: type=%d, len=%dd\n", pkt_type, pmbuf->data_len); @@ -1751,8 +1737,7 @@ } } - if (new_mode || (port != CTRL_PORT) - ) + if (new_mode || (port != CTRL_PORT)) pmadapter->pcard_sd->mpa_rx_count[0]++; wlan_decode_rx_packet(pmadapter, pmbuf, pkt_type, MTRUE); @@ -1773,9 +1758,9 @@ for (pind = 0; pind < pmadapter->pcard_sd->mpa_rx.pkt_cnt; pind++) { - wlan_free_mlan_buffer(pmadapter, - pmadapter->pcard_sd-> - mpa_rx.mbuf_arr[pind]); + wlan_free_mlan_buffer( + pmadapter, pmadapter->pcard_sd->mpa_rx + .mbuf_arr[pind]); } MP_RX_AGGR_BUF_RESET(pmadapter); } @@ -1797,8 +1782,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_send_mp_aggr_buf(mlan_adapter *pmadapter) +mlan_status wlan_send_mp_aggr_buf(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 cmd53_port = 0; @@ -1828,9 +1812,9 @@ mbuf_aggr.pnext = mbuf_aggr.pprev = &mbuf_aggr; mbuf_aggr.use_count = 0; for (i = 0; i < pmadapter->pcard_sd->mpa_tx.pkt_cnt; i++) - wlan_link_buf_to_aggr(&mbuf_aggr, - pmadapter->pcard_sd->mpa_tx. - mbuf_arr[i]); + wlan_link_buf_to_aggr( + &mbuf_aggr, + pmadapter->pcard_sd->mpa_tx.mbuf_arr[i]); } else { mbuf_aggr.pbuf = (t_u8 *)pmadapter->pcard_sd->mpa_tx.buf; mbuf_aggr.data_len = pmadapter->pcard_sd->mpa_tx.buf_len; @@ -1840,57 +1824,57 @@ port_count = bitcount(pmadapter->pcard_sd->mpa_tx.ports) - 1; cmd53_port = (pmadapter->pcard_sd->ioport | SDIO_MPA_ADDR_BASE | (port_count << 8)) + - pmadapter->pcard_sd->mpa_tx.start_port; + pmadapter->pcard_sd->mpa_tx.start_port; } else { cmd53_port = (pmadapter->pcard_sd->ioport | SDIO_MPA_ADDR_BASE | (pmadapter->pcard_sd->mpa_tx.ports << 4)) + - pmadapter->pcard_sd->mpa_tx.start_port; + pmadapter->pcard_sd->mpa_tx.start_port; } if (pmadapter->pcard_sd->mpa_tx.pkt_cnt == 1) cmd53_port = pmadapter->pcard_sd->ioport + - pmadapter->pcard_sd->mpa_tx.start_port; + pmadapter->pcard_sd->mpa_tx.start_port; /** only one packet */ if (!pmadapter->pcard_sd->mpa_tx.buf && pmadapter->pcard_sd->mpa_tx.pkt_cnt == 1) - ret = wlan_write_data_sync(pmadapter, - pmadapter->pcard_sd->mpa_tx. - mbuf_arr[0], cmd53_port); + ret = wlan_write_data_sync( + pmadapter, pmadapter->pcard_sd->mpa_tx.mbuf_arr[0], + cmd53_port); else ret = wlan_write_data_sync(pmadapter, &mbuf_aggr, cmd53_port); if (!pmadapter->pcard_sd->mpa_tx.buf) { /** free mlan buffer */ for (i = 0; i < pmadapter->pcard_sd->mpa_tx.pkt_cnt; i++) { - wlan_write_data_complete(pmadapter, - pmadapter->pcard_sd->mpa_tx. - mbuf_arr[i], - MLAN_STATUS_SUCCESS); + wlan_write_data_complete( + pmadapter, + pmadapter->pcard_sd->mpa_tx.mbuf_arr[i], + MLAN_STATUS_SUCCESS); } } if (!(pmadapter->pcard_sd->mp_wr_bitmap & (1 << pmadapter->pcard_sd->curr_wr_port)) && (pmadapter->pcard_sd->mpa_tx.pkt_cnt < mp_aggr_pkt_limit)) pmadapter->pcard_sd->mpa_sent_no_ports++; - pmadapter->pcard_sd->mpa_tx_count[pmadapter->pcard_sd->mpa_tx.pkt_cnt - - 1]++; - pmadapter->pcard_sd->last_mp_wr_bitmap[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->mpa_tx_count[pmadapter->pcard_sd->mpa_tx.pkt_cnt - 1]++; + pmadapter->pcard_sd + ->last_mp_wr_bitmap[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->mp_wr_bitmap; - pmadapter->pcard_sd->last_mp_wr_ports[pmadapter->pcard_sd-> - last_mp_index] = cmd53_port; - pmadapter->pcard_sd->last_mp_wr_len[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_mp_wr_ports[pmadapter->pcard_sd->last_mp_index] = + cmd53_port; + pmadapter->pcard_sd->last_mp_wr_len[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->mpa_tx.buf_len; - pmadapter->pcard_sd->last_curr_wr_port[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_curr_wr_port[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->curr_wr_port; - memcpy_ext(pmadapter, - (t_u8 *)&pmadapter->pcard_sd->last_mp_wr_info[pmadapter-> - pcard_sd-> - last_mp_index * - mp_aggr_pkt_limit], - (t_u8 *)pmadapter->pcard_sd->mpa_tx.mp_wr_info, - mp_aggr_pkt_limit * sizeof(t_u16), - mp_aggr_pkt_limit * sizeof(t_u16)); + memcpy_ext( + pmadapter, + (t_u8 *)&pmadapter->pcard_sd + ->last_mp_wr_info[pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit], + (t_u8 *)pmadapter->pcard_sd->mpa_tx.mp_wr_info, + mp_aggr_pkt_limit * sizeof(t_u16), + mp_aggr_pkt_limit * sizeof(t_u16)); pmadapter->pcard_sd->last_mp_index++; if (pmadapter->pcard_sd->last_mp_index >= SDIO_MP_DBG_NUM) pmadapter->pcard_sd->last_mp_index = 0; @@ -1908,9 +1892,9 @@ * @param next_pkt_len Length of next packet used for multiport aggregation * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_host_to_card_mp_aggr(mlan_adapter *pmadapter, - mlan_buffer *mbuf, t_u8 port, t_u32 next_pkt_len) +static mlan_status wlan_host_to_card_mp_aggr(mlan_adapter *pmadapter, + mlan_buffer *mbuf, t_u8 port, + t_u32 next_pkt_len) { mlan_status ret = MLAN_STATUS_SUCCESS; t_s32 f_send_aggr_buf = 0; @@ -1945,9 +1929,9 @@ if (!(pmadapter->pcard_sd->mp_wr_bitmap & (1 << pmadapter->pcard_sd->curr_wr_port)) || - !MP_TX_AGGR_BUF_HAS_ROOM(pmadapter, mbuf, - mbuf->data_len + - next_pkt_len)) { + !MP_TX_AGGR_BUF_HAS_ROOM( + pmadapter, mbuf, + mbuf->data_len + next_pkt_len)) { f_send_aggr_buf = 1; } } else { @@ -1996,14 +1980,15 @@ if (f_precopy_cur_buf) { PRINTM(MINFO, "host_2_card_mp_aggr: Precopy current buffer\n"); if (pmadapter->pcard_sd->mpa_buf) - memcpy_ext(pmadapter, - pmadapter->pcard_sd->mpa_buf + - (pmadapter->pcard_sd->last_mp_index * - mp_aggr_pkt_limit + - pmadapter->pcard_sd->mpa_tx.pkt_cnt) * - MLAN_SDIO_BLOCK_SIZE, - mbuf->pbuf + mbuf->data_offset, - MLAN_SDIO_BLOCK_SIZE, MLAN_SDIO_BLOCK_SIZE); + memcpy_ext( + pmadapter, + pmadapter->pcard_sd->mpa_buf + + (pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit + + pmadapter->pcard_sd->mpa_tx.pkt_cnt) * + MLAN_SDIO_BLOCK_SIZE, + mbuf->pbuf + mbuf->data_offset, + MLAN_SDIO_BLOCK_SIZE, MLAN_SDIO_BLOCK_SIZE); if (!pmadapter->pcard_sd->mpa_tx.buf) { if (new_mode) MP_TX_AGGR_BUF_PUT_SG(pmadapter, mbuf, port); @@ -2018,9 +2003,8 @@ MP_TX_AGGR_BUF_PUT_NONEWMODE(pmadapter, mbuf, port); } - if (MP_TX_AGGR_PKT_LIMIT_REACHED(pmadapter) - || (!new_mode && MP_TX_AGGR_PORT_LIMIT_REACHED(pmadapter)) - ) { + if (MP_TX_AGGR_PKT_LIMIT_REACHED(pmadapter) || + (!new_mode && MP_TX_AGGR_PORT_LIMIT_REACHED(pmadapter))) { PRINTM(MIF_D, "host_2_card_mp_aggr: Aggregation Pkt limit reached\n"); /* No more pkts allowed in Aggr buf, send it */ @@ -2040,35 +2024,33 @@ if (!(pmadapter->pcard_sd->mp_wr_bitmap & (1 << pmadapter->pcard_sd->curr_wr_port))) pmadapter->pcard_sd->mpa_sent_no_ports++; - pmadapter->pcard_sd->last_mp_wr_bitmap[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_mp_wr_bitmap[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->mp_wr_bitmap; - pmadapter->pcard_sd->last_mp_wr_ports[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_mp_wr_ports[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->ioport + port; - pmadapter->pcard_sd->last_mp_wr_len[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_mp_wr_len[pmadapter->pcard_sd->last_mp_index] = mbuf->data_len; memset(pmadapter, - (t_u8 *)&pmadapter->pcard_sd->last_mp_wr_info[pmadapter-> - pcard_sd-> - last_mp_index - * - mp_aggr_pkt_limit], + (t_u8 *)&pmadapter->pcard_sd->last_mp_wr_info + [pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit], 0, sizeof(t_u16) * mp_aggr_pkt_limit); - pmadapter->pcard_sd->last_mp_wr_info[pmadapter->pcard_sd-> - last_mp_index * - mp_aggr_pkt_limit] = + pmadapter->pcard_sd + ->last_mp_wr_info[pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit] = *(t_u16 *)(mbuf->pbuf + mbuf->data_offset); - pmadapter->pcard_sd->last_curr_wr_port[pmadapter->pcard_sd-> - last_mp_index] = + pmadapter->pcard_sd + ->last_curr_wr_port[pmadapter->pcard_sd->last_mp_index] = pmadapter->pcard_sd->curr_wr_port; if (pmadapter->pcard_sd->mpa_buf) memcpy_ext(pmadapter, pmadapter->pcard_sd->mpa_buf + - (pmadapter->pcard_sd->last_mp_index * - mp_aggr_pkt_limit * - MLAN_SDIO_BLOCK_SIZE), + (pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit * + MLAN_SDIO_BLOCK_SIZE), mbuf->pbuf + mbuf->data_offset, MLAN_SDIO_BLOCK_SIZE, MLAN_SDIO_BLOCK_SIZE); pmadapter->pcard_sd->last_mp_index++; @@ -2079,14 +2061,15 @@ if (f_postcopy_cur_buf) { PRINTM(MINFO, "host_2_card_mp_aggr: Postcopy current buffer\n"); if (pmadapter->pcard_sd->mpa_buf) - memcpy_ext(pmadapter, - pmadapter->pcard_sd->mpa_buf + - (pmadapter->pcard_sd->last_mp_index * - mp_aggr_pkt_limit + - pmadapter->pcard_sd->mpa_tx.pkt_cnt) * - MLAN_SDIO_BLOCK_SIZE, - mbuf->pbuf + mbuf->data_offset, - MLAN_SDIO_BLOCK_SIZE, MLAN_SDIO_BLOCK_SIZE); + memcpy_ext( + pmadapter, + pmadapter->pcard_sd->mpa_buf + + (pmadapter->pcard_sd->last_mp_index * + mp_aggr_pkt_limit + + pmadapter->pcard_sd->mpa_tx.pkt_cnt) * + MLAN_SDIO_BLOCK_SIZE, + mbuf->pbuf + mbuf->data_offset, + MLAN_SDIO_BLOCK_SIZE, MLAN_SDIO_BLOCK_SIZE); if (!pmadapter->pcard_sd->mpa_tx.buf) { if (new_mode) MP_TX_AGGR_BUF_PUT_SG(pmadapter, mbuf, port); @@ -2123,8 +2106,8 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE * */ -static mlan_status -wlan_sdio_check_winner_status(mlan_adapter *pmadapter, t_u32 *val) +static mlan_status wlan_sdio_check_winner_status(mlan_adapter *pmadapter, + t_u32 *val) { t_u32 winner = 0; pmlan_callbacks pcb; @@ -2160,8 +2143,8 @@ * @param pollnum Maximum polling number * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_check_fw_status(mlan_adapter *pmadapter, t_u32 pollnum) +static mlan_status wlan_sdio_check_fw_status(mlan_adapter *pmadapter, + t_u32 pollnum) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u16 firmwarestat = 0; @@ -2178,7 +2161,7 @@ ret = MLAN_STATUS_SUCCESS; break; } else { - wlan_mdelay(pmadapter, 100); + wlan_mdelay(pmadapter, 10); ret = MLAN_STATUS_FAILURE; } } @@ -2202,8 +2185,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_enable_sdio_host_int(pmlan_adapter pmadapter) +static mlan_status wlan_enable_sdio_host_int(pmlan_adapter pmadapter) { mlan_status ret; t_u8 mask = pmadapter->pcard_sd->reg->host_int_enable; @@ -2222,8 +2204,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_dnld_fw(pmlan_adapter pmadapter, pmlan_fw_image pmfw) +static mlan_status wlan_sdio_dnld_fw(pmlan_adapter pmadapter, + pmlan_fw_image pmfw) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 poll_num = 1; @@ -2231,13 +2213,13 @@ ENTER(); -/*when using GPIO wakeup, don't run the below code. - *if using GPIO wakeup, host will do handshake with FW - *to check if FW wake up and pull up SDIO line, then reload driver. - *So when using GPIO wakeup, don't need driver to do check wakeup status again. - *when using SDIO interface wakeup, run the below code; - *if using SDIO interface wakeup, driver need to do check wakeup status with FW. - */ + /*when using GPIO wakeup, don't run the below code. + *if using GPIO wakeup, host will do handshake with FW + *to check if FW wake up and pull up SDIO line, then reload driver. + *So when using GPIO wakeup, don't need driver to do check wakeup status + *again. when using SDIO interface wakeup, run the below code; if using + *SDIO interface wakeup, driver need to do check wakeup status with FW. + */ /* Card specific probing */ ret = wlan_sdio_probe(pmadapter); @@ -2323,8 +2305,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_sdio_probe(pmlan_adapter pmadapter) +mlan_status wlan_sdio_probe(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 sdio_ireg = 0; @@ -2358,8 +2339,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_get_sdio_device(pmlan_adapter pmadapter) +mlan_status wlan_get_sdio_device(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u16 card_type = pmadapter->card_type; @@ -2439,6 +2419,12 @@ pmadapter->pcard_info = &mlan_card_info_sd9097; break; #endif +#ifdef SDNW62X + case CARD_TYPE_SDNW62X: + pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; + pmadapter->pcard_info = &mlan_card_info_sdnw62x; + break; +#endif #ifdef SD9177 case CARD_TYPE_SD9177: pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; @@ -2461,8 +2447,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return N/A */ -void -wlan_dump_mp_registers(pmlan_adapter pmadapter) +void wlan_dump_mp_registers(pmlan_adapter pmadapter) { t_u32 mp_wr_bitmap; t_bool new_mode = pmadapter->pcard_sd->supports_sdio_new_mode; @@ -2476,7 +2461,7 @@ mp_wr_bitmap = (t_u32)pmadapter->pcard_sd->mp_regs[reg->wr_bitmap_l]; mp_wr_bitmap |= ((t_u32)pmadapter->pcard_sd->mp_regs[reg->wr_bitmap_u]) - << 8; + << 8; if (new_mode) { mp_wr_bitmap |= ((t_u32)pmadapter->pcard_sd->mp_regs[reg->wr_bitmap_1l]) @@ -2491,7 +2476,7 @@ mp_wr_bitmap, pmadapter->pcard_sd->mp_wr_bitmap); mp_rd_bitmap = (t_u32)pmadapter->pcard_sd->mp_regs[reg->rd_bitmap_l]; mp_rd_bitmap |= ((t_u32)pmadapter->pcard_sd->mp_regs[reg->rd_bitmap_u]) - << 8; + << 8; if (new_mode) { mp_rd_bitmap |= ((t_u32)pmadapter->pcard_sd->mp_regs[reg->rd_bitmap_1l]) @@ -2505,7 +2490,7 @@ if (new_mode) { rx_len = ((t_u16)pmadapter->pcard_sd->mp_regs[cmd_rd_len_1]) - << 8; + << 8; rx_len |= (t_u16)pmadapter->pcard_sd->mp_regs[cmd_rd_len_0]; PRINTM(MMSG, "wlan: cmd rx buffer rx_len = %d\n", rx_len); } @@ -2516,6 +2501,9 @@ if (new_mode && rx_len) sdio_ireg |= UP_LD_CMD_PORT_HOST_INT_STATUS; + if (new_mode && pmadapter->cmd_sent) + sdio_ireg |= DN_LD_CMD_PORT_HOST_INT_STATUS; + if (!(pmadapter->pcard_sd->mp_wr_bitmap & pmadapter->pcard_sd->mp_data_port_mask)) { if (mp_wr_bitmap & pmadapter->pcard_sd->mp_data_port_mask) @@ -2536,8 +2524,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_sdio_interrupt(t_u16 msg_id, pmlan_adapter pmadapter) +static mlan_status wlan_sdio_interrupt(t_u16 msg_id, pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2556,12 +2543,10 @@ mbuf.pbuf = pmadapter->pcard_sd->mp_regs + offset; mbuf.data_len = MIN(max_mp_regs, MLAN_SDIO_BLOCK_SIZE); do { - ret = pcb->moal_read_data_sync(pmadapter->pmoal_handle, - &mbuf, - (REG_PORT + - offset) | - MLAN_SDIO_BYTE_MODE_MASK, - 0); + ret = pcb->moal_read_data_sync( + pmadapter->pmoal_handle, &mbuf, + (REG_PORT + offset) | MLAN_SDIO_BYTE_MODE_MASK, + 0); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "wlan: cmd53 read regs failed: %d port=%x retry=%d\n", @@ -2624,9 +2609,8 @@ * @param rx_len Length of received packet * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_card_to_host_recovery(mlan_adapter *pmadapter, - t_u8 port, t_u16 rx_len) +static mlan_status wlan_sdio_card_to_host_recovery(mlan_adapter *pmadapter, + t_u8 port, t_u16 rx_len) { mlan_buffer mbuf; t_u32 pkt_type = 0; @@ -2681,8 +2665,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_process_sdio_int_status(mlan_adapter *pmadapter) +static mlan_status wlan_process_sdio_int_status(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -2725,18 +2708,17 @@ if (sdio_ireg & UP_LD_CMD_PORT_HOST_INT_STATUS) { /* read the len of control packet */ - rx_len = ((t_u16)pmadapter->pcard_sd-> - mp_regs[cmd_rd_len_1]) - << 8; - rx_len |= - (t_u16)pmadapter->pcard_sd-> - mp_regs[cmd_rd_len_0]; + rx_len = ((t_u16)pmadapter->pcard_sd + ->mp_regs[cmd_rd_len_1]) + << 8; + rx_len |= (t_u16)pmadapter->pcard_sd + ->mp_regs[cmd_rd_len_0]; PRINTM(MINFO, "RX: cmd port rx_len=%u\n", rx_len); rx_blocks = (rx_len + MLAN_SDIO_BLOCK_SIZE - 1) / - MLAN_SDIO_BLOCK_SIZE; + MLAN_SDIO_BLOCK_SIZE; if (rx_len <= SDIO_INTF_HEADER_LEN || (rx_blocks * MLAN_SDIO_BLOCK_SIZE) > - ALLOC_BUF_SIZE) { + ALLOC_BUF_SIZE) { PRINTM(MERROR, "invalid rx_len=%d\n", rx_len); ret = MLAN_STATUS_FAILURE; goto done; @@ -2755,12 +2737,11 @@ /* Transfer data from card */ if (MLAN_STATUS_SUCCESS != wlan_sdio_card_to_host(pmadapter, &upld_typ, - (t_u32 *)&pmadapter-> - upld_len, pmbuf, rx_len, - pmadapter->pcard_sd-> - ioport | CMD_PORT_SLCT)) { - pmadapter->dbg. - num_cmdevt_card_to_host_failure++; + (t_u32 *)&pmadapter->upld_len, + pmbuf, rx_len, + pmadapter->pcard_sd->ioport | + CMD_PORT_SLCT)) { + pmadapter->dbg.num_cmdevt_card_to_host_failure++; PRINTM(MERROR, "Card-to-host cmd failed: int status=0x%x\n", sdio_ireg); @@ -2797,12 +2778,12 @@ << 8; if (new_mode) { pmadapter->pcard_sd->mp_wr_bitmap |= - ((t_u32)pmadapter->pcard_sd-> - mp_regs[reg->wr_bitmap_1l]) + ((t_u32)pmadapter->pcard_sd + ->mp_regs[reg->wr_bitmap_1l]) << 16; pmadapter->pcard_sd->mp_wr_bitmap |= - ((t_u32)pmadapter->pcard_sd-> - mp_regs[reg->wr_bitmap_1u]) + ((t_u32)pmadapter->pcard_sd + ->mp_regs[reg->wr_bitmap_1u]) << 24; } bit_count = bitcount(pmadapter->pcard_sd->mp_wr_bitmap & @@ -2823,18 +2804,18 @@ if (pmadapter->data_sent && (pmadapter->pcard_sd->mp_wr_bitmap & (1 << pmadapter->pcard_sd->curr_wr_port))) { - pmadapter->callbacks. - moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, 3, 0); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 3, 0); PRINTM(MINFO, " <--- Tx DONE Interrupt --->\n"); pmadapter->data_sent = MFALSE; } } if ((!new_mode) && (pmadapter->cmd_sent == MTRUE)) { - /* Check if firmware has attach buffer at command port and update just that in wr_bit_map. */ + /* Check if firmware has attach buffer at command port and + * update just that in wr_bit_map. */ pmadapter->pcard_sd->mp_wr_bitmap |= - (t_u32)pmadapter->pcard_sd-> - mp_regs[reg->wr_bitmap_l] & CTRL_PORT_MASK; + (t_u32)pmadapter->pcard_sd->mp_regs[reg->wr_bitmap_l] & + CTRL_PORT_MASK; if (pmadapter->pcard_sd->mp_wr_bitmap & CTRL_PORT_MASK) pmadapter->cmd_sent = MFALSE; } @@ -2847,12 +2828,12 @@ << 8; if (new_mode) { pmadapter->pcard_sd->mp_rd_bitmap |= - ((t_u32)pmadapter->pcard_sd-> - mp_regs[reg->rd_bitmap_1l]) + ((t_u32)pmadapter->pcard_sd + ->mp_regs[reg->rd_bitmap_1l]) << 16; pmadapter->pcard_sd->mp_rd_bitmap |= - ((t_u32)pmadapter->pcard_sd-> - mp_regs[reg->rd_bitmap_1u]) + ((t_u32)pmadapter->pcard_sd + ->mp_regs[reg->rd_bitmap_1u]) << 24; } pmadapter->pcard_sd->last_recv_rd_bitmap = @@ -2860,9 +2841,8 @@ PRINTM(MINTR, "UPLD: rd_bitmap=0x%08x\n", pmadapter->pcard_sd->mp_rd_bitmap); - pmadapter->callbacks.moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, - 0, 0); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 0, 0); while (MTRUE) { ret = wlan_get_rd_port(pmadapter, &port); @@ -2873,17 +2853,17 @@ } len_reg_l = rd_len_p0_l + (port << 1); len_reg_u = rd_len_p0_u + (port << 1); - rx_len = ((t_u16)pmadapter->pcard_sd-> - mp_regs[len_reg_u]) + rx_len = + ((t_u16)pmadapter->pcard_sd->mp_regs[len_reg_u]) << 8; rx_len |= (t_u16)pmadapter->pcard_sd->mp_regs[len_reg_l]; PRINTM(MINFO, "RX: port=%d rx_len=%u\n", port, rx_len); rx_blocks = (rx_len + MLAN_SDIO_BLOCK_SIZE - 1) / - MLAN_SDIO_BLOCK_SIZE; + MLAN_SDIO_BLOCK_SIZE; if (rx_len <= SDIO_INTF_HEADER_LEN || (rx_blocks * MLAN_SDIO_BLOCK_SIZE) > - pmadapter->pcard_sd->mpa_rx.buf_size) { + pmadapter->pcard_sd->mpa_rx.buf_size) { PRINTM(MERROR, "invalid rx_len=%d\n", rx_len); ret = MLAN_STATUS_FAILURE; goto done; @@ -2891,22 +2871,20 @@ rx_len = (t_u16)(rx_blocks * MLAN_SDIO_BLOCK_SIZE); if (!new_mode && (port == CTRL_PORT)) - pmbuf = wlan_alloc_mlan_buffer(pmadapter, - rx_len, 0, - MOAL_MALLOC_BUFFER); + pmbuf = wlan_alloc_mlan_buffer( + pmadapter, rx_len, 0, + MOAL_MALLOC_BUFFER); else - pmbuf = wlan_alloc_mlan_buffer(pmadapter, - rx_len, - MLAN_RX_HEADER_LEN, - MOAL_ALLOC_MLAN_BUFFER); + pmbuf = wlan_alloc_mlan_buffer( + pmadapter, rx_len, MLAN_RX_HEADER_LEN, + MOAL_ALLOC_MLAN_BUFFER); if (pmbuf == MNULL) { PRINTM(MERROR, "Failed to allocate 'mlan_buffer'\n"); pmadapter->dbg.num_alloc_buffer_failure++; if (MLAN_STATUS_SUCCESS == - wlan_sdio_card_to_host_recovery(pmadapter, - port, - rx_len)) + wlan_sdio_card_to_host_recovery( + pmadapter, port, rx_len)) continue; ret = MLAN_STATUS_FAILURE; goto done; @@ -2916,11 +2894,11 @@ wlan_sdio_card_to_host_mp_aggr(pmadapter, pmbuf, port, rx_len)) { if ((!new_mode) && (port == CTRL_PORT)) - pmadapter->dbg. - num_cmdevt_card_to_host_failure++; + pmadapter->dbg + .num_cmdevt_card_to_host_failure++; else - pmadapter->dbg. - num_rx_card_to_host_failure++; + pmadapter->dbg + .num_rx_card_to_host_failure++; PRINTM(MERROR, "Card to host failed: int status=0x%x\n", @@ -2972,9 +2950,8 @@ * @param tx_param A pointer to mlan_tx_param * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_sdio_host_to_card(mlan_adapter *pmadapter, t_u8 type, - mlan_buffer *pmbuf, mlan_tx_param *tx_param) +mlan_status wlan_sdio_host_to_card(mlan_adapter *pmadapter, t_u8 type, + mlan_buffer *pmbuf, mlan_tx_param *tx_param) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 buf_block_len; @@ -3017,7 +2994,7 @@ ret = wlan_host_to_card_mp_aggr(pmadapter, pmbuf, port, 0); } else { - /*Type must be MLAN_TYPE_CMD */ + /*Type must be MLAN_TYPE_CMD*/ pmadapter->cmd_sent = MTRUE; if (!new_mode) pmadapter->pcard_sd->mp_wr_bitmap &= @@ -3060,7 +3037,7 @@ return ret; } -#if (defined(SD9098) || defined(SD9097) || defined(SD9177)) +#if (defined(SD9098) || defined(SD9097) || defined(SDNW62X) || defined(SD9177)) /** * @brief This function sends vdll data to the card. * @@ -3069,8 +3046,8 @@ * SDIO header) * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_send_vdll(mlan_adapter *pmadapter, mlan_buffer *pmbuf) +static mlan_status wlan_sdio_send_vdll(mlan_adapter *pmadapter, + mlan_buffer *pmbuf) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 buf_block_len; @@ -3114,14 +3091,14 @@ * @param tx_param A pointer to mlan_tx_param * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_sdio_host_to_card_ext(pmlan_private pmpriv, t_u8 type, - mlan_buffer *pmbuf, mlan_tx_param *tx_param) +static mlan_status wlan_sdio_host_to_card_ext(pmlan_private pmpriv, t_u8 type, + mlan_buffer *pmbuf, + mlan_tx_param *tx_param) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; -#if (defined(SD9098) || defined(SD9097) || defined(SD9177)) +#if (defined(SD9098) || defined(SD9097) || defined(SDNW62X) || defined(SD9177)) if (type == MLAN_TYPE_VDLL) return wlan_sdio_send_vdll(pmadapter, pmbuf); #endif @@ -3143,8 +3120,7 @@ * * @return N/A */ -void -wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len) +void wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len) { int total_pkt_len; t_u8 block_num = 0; @@ -3162,7 +3138,8 @@ total_pkt_len); goto done; } - while (total_pkt_len >= (OFFSET_OF_SDIO_HEADER + SDIO_INTF_HEADER_LEN)) { + while (total_pkt_len >= + (OFFSET_OF_SDIO_HEADER + SDIO_INTF_HEADER_LEN)) { block_num = *(data + OFFSET_OF_BLOCK_NUMBER); block_size = pmadapter->pcard_sd->sdio_rx_block_size * block_num; @@ -3172,20 +3149,17 @@ block_num, total_pkt_len); break; } - pkt_len = - wlan_le16_to_cpu(*(t_u16 *) - (data + OFFSET_OF_SDIO_HEADER)); + pkt_len = wlan_le16_to_cpu( + *(t_u16 *)(data + OFFSET_OF_SDIO_HEADER)); if ((pkt_len + OFFSET_OF_SDIO_HEADER) > block_size) { PRINTM(MERROR, "Error in pkt, pkt_len=%d, block_size=%d\n", pkt_len, block_size); break; } - mbuf_deaggr = - wlan_alloc_mlan_buffer(pmadapter, - pkt_len - SDIO_INTF_HEADER_LEN, - MLAN_RX_HEADER_LEN, - MOAL_ALLOC_MLAN_BUFFER); + mbuf_deaggr = wlan_alloc_mlan_buffer( + pmadapter, pkt_len - SDIO_INTF_HEADER_LEN, + MLAN_RX_HEADER_LEN, MOAL_ALLOC_MLAN_BUFFER); if (mbuf_deaggr == MNULL) { PRINTM(MERROR, "Error allocating daggr mlan_buffer\n"); break; @@ -3214,8 +3188,7 @@ * @param pmbuf A pointer to the SDIO mpa data * @return N/A */ -t_void -wlan_sdio_deaggr_rx_pkt(pmlan_adapter pmadapter, mlan_buffer *pmbuf) +t_void wlan_sdio_deaggr_rx_pkt(pmlan_adapter pmadapter, mlan_buffer *pmbuf) { if (pmbuf->buf_type == MLAN_BUF_TYPE_SPA_DATA) { wlan_decode_spa_buffer(pmadapter, @@ -3236,9 +3209,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_alloc_sdio_mpa_buffers(mlan_adapter *pmadapter, - t_u32 mpa_tx_buf_size, t_u32 mpa_rx_buf_size) +mlan_status wlan_alloc_sdio_mpa_buffers(mlan_adapter *pmadapter, + t_u32 mpa_tx_buf_size, + t_u32 mpa_rx_buf_size) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3249,11 +3222,11 @@ if ((pmadapter->pcard_sd->max_segs < mp_aggr_pkt_limit) || (pmadapter->pcard_sd->max_seg_size < pmadapter->pcard_sd->max_sp_tx_size)) { - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - mpa_tx_buf_size + DMA_ALIGNMENT, - MLAN_MEM_DEF | MLAN_MEM_DMA, - (t_u8 **)&pmadapter->pcard_sd->mpa_tx. - head_ptr); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + mpa_tx_buf_size + DMA_ALIGNMENT, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->mpa_tx.head_ptr); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->mpa_tx.head_ptr) { PRINTM(MERROR, @@ -3261,9 +3234,8 @@ ret = MLAN_STATUS_FAILURE; goto error; } - pmadapter->pcard_sd->mpa_tx.buf = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->mpa_tx.head_ptr, - DMA_ALIGNMENT); + pmadapter->pcard_sd->mpa_tx.buf = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->mpa_tx.head_ptr, DMA_ALIGNMENT); } else { PRINTM(MMSG, "wlan: Enable TX SG mode\n"); pmadapter->pcard_sd->mpa_tx.head_ptr = MNULL; @@ -3274,11 +3246,11 @@ if ((pmadapter->pcard_sd->max_segs < mp_aggr_pkt_limit) || (pmadapter->pcard_sd->max_seg_size < pmadapter->pcard_sd->max_sp_rx_size)) { - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - mpa_rx_buf_size + DMA_ALIGNMENT, - MLAN_MEM_DEF | MLAN_MEM_DMA, - (t_u8 **)&pmadapter->pcard_sd->mpa_rx. - head_ptr); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + mpa_rx_buf_size + DMA_ALIGNMENT, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->mpa_rx.head_ptr); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->mpa_rx.head_ptr) { PRINTM(MERROR, @@ -3286,9 +3258,8 @@ ret = MLAN_STATUS_FAILURE; goto error; } - pmadapter->pcard_sd->mpa_rx.buf = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->mpa_rx.head_ptr, - DMA_ALIGNMENT); + pmadapter->pcard_sd->mpa_rx.buf = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->mpa_rx.head_ptr, DMA_ALIGNMENT); } else { PRINTM(MMSG, "wlan: Enable RX SG mode\n"); pmadapter->pcard_sd->mpa_rx.head_ptr = MNULL; @@ -3310,8 +3281,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_free_sdio_mpa_buffers(mlan_adapter *pmadapter) +mlan_status wlan_free_sdio_mpa_buffers(mlan_adapter *pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3344,8 +3314,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_re_alloc_sdio_rx_mpa_buffer(mlan_adapter *pmadapter) +mlan_status wlan_re_alloc_sdio_rx_mpa_buffer(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3369,13 +3338,11 @@ pmadapter->pcard_sd->rx_buffer = MNULL; pmadapter->pcard_sd->rx_buf = MNULL; } - ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - SDIO_CMD53_MAX_SIZE + - DMA_ALIGNMENT, - MLAN_MEM_DEF | - MLAN_MEM_DMA, - (t_u8 **)&pmadapter-> - pcard_sd->rx_buffer); + ret = pmadapter->callbacks.moal_malloc( + pmadapter->pmoal_handle, + SDIO_CMD53_MAX_SIZE + DMA_ALIGNMENT, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->rx_buffer); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->rx_buffer) { @@ -3383,18 +3350,17 @@ ret = MLAN_STATUS_FAILURE; goto error; } - pmadapter->pcard_sd->rx_buf = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->rx_buffer, - DMA_ALIGNMENT); + pmadapter->pcard_sd->rx_buf = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->rx_buffer, DMA_ALIGNMENT); } if ((pmadapter->pcard_sd->max_segs < mp_aggr_pkt_limit) || (pmadapter->pcard_sd->max_seg_size < pmadapter->pcard_sd->max_sp_rx_size)) { - ret = pcb->moal_malloc(pmadapter->pmoal_handle, - mpa_rx_buf_size + DMA_ALIGNMENT, - MLAN_MEM_DEF | MLAN_MEM_DMA, - (t_u8 **)&pmadapter->pcard_sd->mpa_rx. - head_ptr); + ret = pcb->moal_malloc( + pmadapter->pmoal_handle, + mpa_rx_buf_size + DMA_ALIGNMENT, + MLAN_MEM_DEF | MLAN_MEM_DMA, + (t_u8 **)&pmadapter->pcard_sd->mpa_rx.head_ptr); if (ret != MLAN_STATUS_SUCCESS || !pmadapter->pcard_sd->mpa_rx.head_ptr) { PRINTM(MERROR, @@ -3402,9 +3368,8 @@ ret = MLAN_STATUS_FAILURE; goto error; } - pmadapter->pcard_sd->mpa_rx.buf = - (t_u8 *)ALIGN_ADDR(pmadapter->pcard_sd->mpa_rx.head_ptr, - DMA_ALIGNMENT); + pmadapter->pcard_sd->mpa_rx.buf = (t_u8 *)ALIGN_ADDR( + pmadapter->pcard_sd->mpa_rx.head_ptr, DMA_ALIGNMENT); } else { PRINTM(MMSG, "wlan: Enable RX SG mode\n"); pmadapter->pcard_sd->mpa_rx.head_ptr = MNULL; @@ -3424,8 +3389,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pm_sdio_wakeup_card(pmlan_adapter pmadapter, t_u8 timeout) +static mlan_status wlan_pm_sdio_wakeup_card(pmlan_adapter pmadapter, + t_u8 timeout) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 age_ts_usec; @@ -3438,10 +3403,9 @@ &age_ts_usec); if (timeout) { - pmadapter->callbacks.moal_start_timer(pmadapter->pmoal_handle, - pmadapter-> - pwakeup_fw_timer, MFALSE, - MRVDRV_TIMER_3S); + pmadapter->callbacks.moal_start_timer( + pmadapter->pmoal_handle, pmadapter->pwakeup_fw_timer, + MFALSE, MRVDRV_TIMER_5S); pmadapter->wakeup_fw_timer_is_set = MTRUE; } @@ -3459,8 +3423,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pm_sdio_reset_card(pmlan_adapter pmadapter) +static mlan_status wlan_pm_sdio_reset_card(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -3481,8 +3444,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_set_sdio_gpio_int(pmlan_private priv) +mlan_status wlan_set_sdio_gpio_int(pmlan_private priv) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = MNULL; @@ -3532,10 +3494,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_sdio_gpio_int(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_sdio_gpio_int(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_SDIO_GPIO_INT_CONFIG *psdio_gpio_int = &cmd->params.sdio_gpio_int; @@ -3566,8 +3527,7 @@ return MLAN_STATUS_SUCCESS; } -mlan_status -wlan_reset_fw(pmlan_adapter pmadapter) +mlan_status wlan_reset_fw(pmlan_adapter pmadapter) { t_u32 tries = 0; t_u32 value = 1; @@ -3600,7 +3560,9 @@ ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(SD8997) || defined(SD8977) || defined(SD8987) || defined(SD9098) || defined(SD9097) || defined(SD8978) || defined(SD9177) +#if defined(SD8997) || defined(SD8977) || defined(SD8987) || \ + defined(SD9098) || defined(SD9097) || defined(SDNW62X) || \ + defined(SD8978) || defined(SD9177) if (MFALSE #ifdef SD8997 || IS_SD8997(pmadapter->card_type) @@ -3620,10 +3582,13 @@ #ifdef SD9097 || IS_SD9097(pmadapter->card_type) #endif +#ifdef SDNW62X + || IS_SDNW62X(pmadapter->card_type) +#endif #ifdef SD9177 || IS_SD9177(pmadapter->card_type) #endif - ) { + ) { pcb->moal_read_reg(pmadapter->pmoal_handle, HOST_TO_CARD_EVENT_REG, &value); pcb->moal_write_reg(pmadapter->pmoal_handle, @@ -3660,9 +3625,9 @@ * @param pmbuf A pointer to the mlan_buffer * @return N/A */ -static mlan_status -wlan_sdio_data_evt_complete(pmlan_adapter pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_sdio_data_evt_complete(pmlan_adapter pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { ENTER(); @@ -3679,8 +3644,8 @@ * @param pmbuf A pointer to the mlan_buffer * @return */ -static mlan_status -wlan_sdio_handle_rx_packet(mlan_adapter *pmadapter, pmlan_buffer pmbuf) +static mlan_status wlan_sdio_handle_rx_packet(mlan_adapter *pmadapter, + pmlan_buffer pmbuf) { ENTER();
diff --git a/wlan_sd8987/mlan/mlan_sdio.h b/wlan_sd8987/mlan/mlan_sdio.h index f62b1d9..4d0fa3e 100755 --- a/wlan_sd8987/mlan/mlan_sdio.h +++ b/wlan_sd8987/mlan/mlan_sdio.h
@@ -131,9 +131,9 @@ /** Port for memory */ #define MEM_PORT 0x10000 /** Ctrl port */ -#define CTRL_PORT 0 +#define CTRL_PORT 0 /** Ctrl port mask */ -#define CTRL_PORT_MASK 0x0001 +#define CTRL_PORT_MASK 0x0001 /** Card Control Registers : cmd53 new mode */ #define CMD53_NEW_MODE (0x1U << 0) /** Card Control Registers : cmd53 tx len format 1 (0x10) */ @@ -194,23 +194,29 @@ a->pcard_sd->mpa_tx.pkt_cnt++; \ } while (0) -#define MP_TX_AGGR_BUF_PUT_NONEWMODE(a, mbuf, port) do { \ - pmadapter->callbacks.moal_memmove(a->pmoal_handle, \ - &a->pcard_sd->mpa_tx.buf[a->pcard_sd->mpa_tx.buf_len], \ - mbuf->pbuf+mbuf->data_offset, mbuf->data_len);\ - a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \ - a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = *(t_u16 *)(mbuf->pbuf+mbuf->data_offset); \ - if (!a->pcard_sd->mpa_tx.pkt_cnt) { \ - a->pcard_sd->mpa_tx.start_port = port; \ - } \ - if (a->pcard_sd->mpa_tx.start_port <= port) { \ - a->pcard_sd->mpa_tx.ports |= (1 << (a->pcard_sd->mpa_tx.pkt_cnt)); \ - } else { \ - a->pcard_sd->mpa_tx.ports |= (1 << (a->pcard_sd->mpa_tx.pkt_cnt \ - + 1 + (a->pcard_sd->max_ports - a->pcard_sd->mp_end_port))); \ - } \ - a->pcard_sd->mpa_tx.pkt_cnt++; \ -} while (0) +#define MP_TX_AGGR_BUF_PUT_NONEWMODE(a, mbuf, port) \ + do { \ + pmadapter->callbacks.moal_memmove( \ + a->pmoal_handle, \ + &a->pcard_sd->mpa_tx.buf[a->pcard_sd->mpa_tx.buf_len], \ + mbuf->pbuf + mbuf->data_offset, mbuf->data_len); \ + a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \ + a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = \ + *(t_u16 *)(mbuf->pbuf + mbuf->data_offset); \ + if (!a->pcard_sd->mpa_tx.pkt_cnt) { \ + a->pcard_sd->mpa_tx.start_port = port; \ + } \ + if (a->pcard_sd->mpa_tx.start_port <= port) { \ + a->pcard_sd->mpa_tx.ports |= \ + (1 << (a->pcard_sd->mpa_tx.pkt_cnt)); \ + } else { \ + a->pcard_sd->mpa_tx.ports |= \ + (1 << (a->pcard_sd->mpa_tx.pkt_cnt + 1 + \ + (a->pcard_sd->max_ports - \ + a->pcard_sd->mp_end_port))); \ + } \ + a->pcard_sd->mpa_tx.pkt_cnt++; \ + } while (0) #define MP_TX_AGGR_BUF_PUT_SG(a, mbuf, port) \ do { \ a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \ @@ -224,30 +230,36 @@ a->pcard_sd->mpa_tx.ports |= (1 << port); \ a->pcard_sd->mpa_tx.pkt_cnt++; \ } while (0) -#define MP_TX_AGGR_BUF_PUT_SG_NONEWMODE(a, mbuf, port) do { \ - a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \ - a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = *(t_u16 *)(mbuf->pbuf+mbuf->data_offset); \ - a->pcard_sd->mpa_tx.mbuf_arr[a->pcard_sd->mpa_tx.pkt_cnt] = mbuf; \ - if (!a->pcard_sd->mpa_tx.pkt_cnt) { \ - a->pcard_sd->mpa_tx.start_port = port; \ - } \ - if (a->pcard_sd->mpa_tx.start_port <= port) { \ - a->pcard_sd->mpa_tx.ports |= (1 << (a->pcard_sd->mpa_tx.pkt_cnt)); \ - } else { \ - a->pcard_sd->mpa_tx.ports |= (1 << (a->pcard_sd->mpa_tx.pkt_cnt \ - + 1 + (a->pcard_sd->max_ports - a->pcard_sd->mp_end_port))); \ - } \ - a->pcard_sd->mpa_tx.pkt_cnt++; \ -} while (0) +#define MP_TX_AGGR_BUF_PUT_SG_NONEWMODE(a, mbuf, port) \ + do { \ + a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \ + a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = \ + *(t_u16 *)(mbuf->pbuf + mbuf->data_offset); \ + a->pcard_sd->mpa_tx.mbuf_arr[a->pcard_sd->mpa_tx.pkt_cnt] = \ + mbuf; \ + if (!a->pcard_sd->mpa_tx.pkt_cnt) { \ + a->pcard_sd->mpa_tx.start_port = port; \ + } \ + if (a->pcard_sd->mpa_tx.start_port <= port) { \ + a->pcard_sd->mpa_tx.ports |= \ + (1 << (a->pcard_sd->mpa_tx.pkt_cnt)); \ + } else { \ + a->pcard_sd->mpa_tx.ports |= \ + (1 << (a->pcard_sd->mpa_tx.pkt_cnt + 1 + \ + (a->pcard_sd->max_ports - \ + a->pcard_sd->mp_end_port))); \ + } \ + a->pcard_sd->mpa_tx.pkt_cnt++; \ + } while (0) /** SDIO Tx aggregation limit ? */ #define MP_TX_AGGR_PKT_LIMIT_REACHED(a) \ ((a->pcard_sd->mpa_tx.pkt_cnt) == (a->pcard_sd->mpa_tx.pkt_aggr_limit)) -#define MP_TX_AGGR_PORT_LIMIT_REACHED(a) ((a->pcard_sd->curr_wr_port < \ - a->pcard_sd->mpa_tx.start_port) && (((a->pcard_sd->max_ports - \ - a->pcard_sd->mpa_tx.start_port) + a->pcard_sd->curr_wr_port) >= \ - a->pcard_sd->mp_aggr_pkt_limit)) +#define MP_TX_AGGR_PORT_LIMIT_REACHED(a) \ + ((a->pcard_sd->curr_wr_port < a->pcard_sd->mpa_tx.start_port) && \ + (((a->pcard_sd->max_ports - a->pcard_sd->mpa_tx.start_port) + \ + a->pcard_sd->curr_wr_port) >= a->pcard_sd->mp_aggr_pkt_limit)) /** Reset SDIO Tx aggregation buffer parameters */ #define MP_TX_AGGR_BUF_RESET(a) \ @@ -272,15 +284,15 @@ /* note: hw rx wraps round only after port (MAX_PORT-1) */ #define MP_RX_AGGR_PORT_LIMIT_REACHED(a) \ (((a->pcard_sd->curr_rd_port < a->pcard_sd->mpa_rx.start_port) && \ - (((a->pcard_sd->max_ports - a->pcard_sd->mpa_rx.start_port) + \ + (((a->pcard_sd->max_ports - a->pcard_sd->mpa_rx.start_port) + \ a->pcard_sd->curr_rd_port) >= (a->pcard_sd->mp_end_port >> 1))) || \ ((a->pcard_sd->curr_rd_port - a->pcard_sd->mpa_rx.start_port) >= \ (a->pcard_sd->mp_end_port >> 1))) -#define MP_RX_AGGR_PORT_LIMIT_REACHED_NONEWMODE(a) ((a->pcard_sd->curr_rd_port < \ - a->pcard_sd->mpa_rx.start_port) && (((a->pcard_sd->max_ports - \ - a->pcard_sd->mpa_rx.start_port) + a->pcard_sd->curr_rd_port) >= \ - a->pcard_sd->mp_aggr_pkt_limit)) +#define MP_RX_AGGR_PORT_LIMIT_REACHED_NONEWMODE(a) \ + ((a->pcard_sd->curr_rd_port < a->pcard_sd->mpa_rx.start_port) && \ + (((a->pcard_sd->max_ports - a->pcard_sd->mpa_rx.start_port) + \ + a->pcard_sd->curr_rd_port) >= a->pcard_sd->mp_aggr_pkt_limit)) /** SDIO Rx aggregation in progress ? */ #define MP_RX_AGGR_IN_PROGRESS(a) (a->pcard_sd->mpa_rx.pkt_cnt > 0) @@ -304,20 +316,25 @@ a->pcard_sd->mpa_rx.pkt_cnt++; \ } while (0) -#define MP_RX_AGGR_SETUP_NONEWMODE(a, mbuf, port, rx_len) do { \ - a->pcard_sd->mpa_rx.buf_len += rx_len; \ - if (!a->pcard_sd->mpa_rx.pkt_cnt) { \ - a->pcard_sd->mpa_rx.start_port = port; \ - } \ - if (a->pcard_sd->mpa_rx.start_port <= port) { \ - a->pcard_sd->mpa_rx.ports |= (1 << (a->pcard_sd->mpa_rx.pkt_cnt)); \ - } else { \ - a->pcard_sd->mpa_rx.ports |= (1 << (a->pcard_sd->mpa_rx.pkt_cnt + 1)); \ - } \ - a->pcard_sd->mpa_rx.mbuf_arr[a->pcard_sd->mpa_rx.pkt_cnt] = mbuf; \ - a->pcard_sd->mpa_rx.len_arr[a->pcard_sd->mpa_rx.pkt_cnt] = rx_len; \ - a->pcard_sd->mpa_rx.pkt_cnt++; \ -} while (0); +#define MP_RX_AGGR_SETUP_NONEWMODE(a, mbuf, port, rx_len) \ + do { \ + a->pcard_sd->mpa_rx.buf_len += rx_len; \ + if (!a->pcard_sd->mpa_rx.pkt_cnt) { \ + a->pcard_sd->mpa_rx.start_port = port; \ + } \ + if (a->pcard_sd->mpa_rx.start_port <= port) { \ + a->pcard_sd->mpa_rx.ports |= \ + (1 << (a->pcard_sd->mpa_rx.pkt_cnt)); \ + } else { \ + a->pcard_sd->mpa_rx.ports |= \ + (1 << (a->pcard_sd->mpa_rx.pkt_cnt + 1)); \ + } \ + a->pcard_sd->mpa_rx.mbuf_arr[a->pcard_sd->mpa_rx.pkt_cnt] = \ + mbuf; \ + a->pcard_sd->mpa_rx.len_arr[a->pcard_sd->mpa_rx.pkt_cnt] = \ + rx_len; \ + a->pcard_sd->mpa_rx.pkt_cnt++; \ + } while (0); /** Reset SDIO Rx aggregation buffer parameters */ #define MP_RX_AGGR_BUF_RESET(a) \ @@ -350,8 +367,8 @@ mlan_buffer *mbuf, mlan_tx_param *tx_param); mlan_status wlan_set_sdio_gpio_int(pmlan_private priv); mlan_status wlan_cmd_sdio_gpio_int(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_reset_fw(pmlan_adapter pmadapter); #endif /* _MLAN_SDIO_H */
diff --git a/wlan_sd8987/mlan/mlan_shim.c b/wlan_sd8987/mlan/mlan_shim.c index 28d04f8..fdd7140 100755 --- a/wlan_sd8987/mlan/mlan_shim.c +++ b/wlan_sd8987/mlan/mlan_shim.c
@@ -108,7 +108,7 @@ }; /** Global moal_assert callback */ -t_void (*assert_callback) (t_pvoid pmoal_handle, t_u32 cond) = MNULL; +t_void (*assert_callback)(t_pvoid pmoal_handle, t_u32 cond) = MNULL; #ifdef DEBUG_LEVEL1 #ifdef DEBUG_LEVEL2 #define DEFAULT_DEBUG_MASK (0xffffffff) @@ -117,12 +117,12 @@ #endif /** Global moal_print callback */ -t_void (*print_callback) (t_pvoid pmoal_handle, t_u32 level, - char *pformat, IN ...) = MNULL; +t_void (*print_callback)(t_pvoid pmoal_handle, t_u32 level, char *pformat, + IN...) = MNULL; /** Global moal_get_system_time callback */ -mlan_status (*get_sys_time_callback) (t_pvoid pmoal_handle, t_pu32 psec, - t_pu32 pusec) = MNULL; +mlan_status (*get_sys_time_callback)(t_pvoid pmoal_handle, t_pu32 psec, + t_pu32 pusec) = MNULL; /** Global driver debug mit masks */ t_u32 mlan_drvdbg = DEFAULT_DEBUG_MASK; @@ -140,8 +140,7 @@ * @param pmadapter A pointer to mlan_adapter structure * */ -static void -wlan_process_pending_ioctl(mlan_adapter *pmadapter) +static void wlan_process_pending_ioctl(mlan_adapter *pmadapter) { pmlan_ioctl_req pioctl_buf; mlan_status status = MLAN_STATUS_SUCCESS; @@ -156,11 +155,9 @@ pcb = &pmadapter->callbacks; - while ((pioctl_buf = - (pmlan_ioctl_req)util_dequeue_list(pmadapter->pmoal_handle, - &pmadapter->ioctl_pending_q, - pcb->moal_spin_lock, - pcb->moal_spin_unlock))) { + while ((pioctl_buf = (pmlan_ioctl_req)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->ioctl_pending_q, + pcb->moal_spin_lock, pcb->moal_spin_unlock))) { switch (pioctl_buf->req_id) { #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) case MLAN_IOCTL_BSS: @@ -173,7 +170,6 @@ } break; #endif -#ifdef STA_SUPPORT case MLAN_IOCTL_MISC_CFG: misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; if (misc->sub_command == MLAN_OID_MISC_WARM_RESET) { @@ -182,7 +178,6 @@ pioctl_buf); } break; -#endif default: break; } @@ -192,7 +187,6 @@ } LEAVE(); } - /******************************************************** Global Functions ********************************************************/ @@ -224,8 +218,7 @@ * See Also * mlan_unregister */ -mlan_status -mlan_register(pmlan_device pmdevice, t_void **ppmlan_adapter) +mlan_status mlan_register(pmlan_device pmdevice, t_void **ppmlan_adapter) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = MNULL; @@ -335,6 +328,7 @@ pmadapter->card_type = pmdevice->card_type; pmadapter->card_rev = pmdevice->card_rev; pmadapter->init_para.uap_max_sta = pmdevice->uap_max_sta; + pmadapter->init_para.mcs32 = pmdevice->mcs32; #ifdef SDIO if (IS_SD(pmadapter->card_type)) { @@ -446,6 +440,7 @@ pmadapter->multiple_dtim = pmdevice->multi_dtim; pmadapter->inact_tmo = pmdevice->inact_tmo; + pmadapter->init_para.drcs_chantime_mode = pmdevice->drcs_chantime_mode; pmadapter->hs_wake_interval = pmdevice->hs_wake_interval; if (pmdevice->indication_gpio != 0xff) { pmadapter->ind_gpio = pmdevice->indication_gpio & 0x0f; @@ -463,9 +458,12 @@ pmadapter->rx_cmd_ep = pmdevice->rx_cmd_ep; pmadapter->tx_data_ep = pmdevice->tx_data_ep; pmadapter->rx_data_ep = pmdevice->rx_data_ep; + pmadapter->usb_tx_ports[0] = pmdevice->tx_data_ep; + pmadapter->usb_tx_ports[1] = pmdevice->tx_data2_ep; } #endif pmadapter->init_para.dfs53cfg = pmdevice->dfs53cfg; + pmadapter->init_para.dfs_offload = pmdevice->dfs_offload; pmadapter->priv_num = 0; pmadapter->priv[0] = MNULL; @@ -486,24 +484,40 @@ memset(pmadapter, pmadapter->priv[0], 0, sizeof(mlan_private)); pmadapter->priv[0]->adapter = pmadapter; - pmadapter->priv[0]->bss_type = (t_u8)pmdevice->bss_attr[0].bss_type; - pmadapter->priv[0]->frame_type = (t_u8)pmdevice->bss_attr[0].frame_type; - pmadapter->priv[0]->bss_priority = - (t_u8)pmdevice->bss_attr[0].bss_priority; - if (pmdevice->bss_attr[0].bss_type == MLAN_BSS_TYPE_STA) + if (pmdevice->drv_mode & DRV_MODE_MASK) { + /* Save bss_type, frame_type & bss_priority */ + pmadapter->priv[0]->bss_type = 0xff; + pmadapter->priv[0]->frame_type = MLAN_DATA_FRAME_TYPE_ETH_II; + pmadapter->priv[0]->bss_priority = 0; pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_STA; - else if (pmdevice->bss_attr[0].bss_type == MLAN_BSS_TYPE_UAP) - pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_UAP; + + /* Save bss_index and bss_num */ + pmadapter->priv[0]->bss_index = 0; + pmadapter->priv[0]->bss_num = 0xff; + } else { + pmadapter->priv[0]->bss_type = + (t_u8)pmdevice->bss_attr[0].bss_type; + pmadapter->priv[0]->frame_type = + (t_u8)pmdevice->bss_attr[0].frame_type; + pmadapter->priv[0]->bss_priority = + (t_u8)pmdevice->bss_attr[0].bss_priority; + if (pmdevice->bss_attr[0].bss_type == MLAN_BSS_TYPE_STA) + pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_STA; + else if (pmdevice->bss_attr[0].bss_type == MLAN_BSS_TYPE_UAP) + pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_UAP; #ifdef WIFI_DIRECT_SUPPORT - else if (pmdevice->bss_attr[0].bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { - pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_STA; - if (pmdevice->bss_attr[0].bss_virtual) - pmadapter->priv[0]->bss_virtual = MTRUE; - } + else if (pmdevice->bss_attr[0].bss_type == + MLAN_BSS_TYPE_WIFIDIRECT) { + pmadapter->priv[0]->bss_role = MLAN_BSS_ROLE_STA; + if (pmdevice->bss_attr[0].bss_virtual) + pmadapter->priv[0]->bss_virtual = MTRUE; + } #endif - /* Save bss_index and bss_num */ - pmadapter->priv[0]->bss_index = 0; - pmadapter->priv[0]->bss_num = (t_u8)pmdevice->bss_attr[0].bss_num; + /* Save bss_index and bss_num */ + pmadapter->priv[0]->bss_index = 0; + pmadapter->priv[0]->bss_num = + (t_u8)pmdevice->bss_attr[0].bss_num; + } /* init function table */ for (j = 0; mlan_ops[j]; j++) { @@ -580,8 +594,7 @@ * @return MLAN_STATUS_SUCCESS * The deregistration succeeded. */ -mlan_status -mlan_unregister(t_void *padapter) +mlan_status mlan_unregister(t_void *padapter) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -631,8 +644,7 @@ * MLAN_STATUS_FAILURE * The firmware download failed. */ -mlan_status -mlan_dnld_fw(t_void *padapter, pmlan_fw_image pmfw) +mlan_status mlan_dnld_fw(t_void *padapter, pmlan_fw_image pmfw) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -665,8 +677,7 @@ * MLAN_STATUS_FAILURE * The firmware download failed. */ -mlan_status -mlan_disable_host_int(t_void *padapter) +mlan_status mlan_disable_host_int(t_void *padapter) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -700,8 +711,7 @@ * MLAN_STATUS_FAILURE * The firmware download failed. */ -mlan_status -mlan_enable_host_int(t_void *padapter) +mlan_status mlan_enable_host_int(t_void *padapter) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -734,8 +744,7 @@ * @return MLAN_STATUS_SUCCESS * */ -mlan_status -mlan_set_init_param(t_void *padapter, pmlan_init_param pparam) +mlan_status mlan_set_init_param(t_void *padapter, pmlan_init_param pparam) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -775,8 +784,7 @@ * MLAN_STATUS_FAILURE * The firmware initialization failed. */ -mlan_status -mlan_init_fw(t_void *padapter) +mlan_status mlan_init_fw(t_void *padapter) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -806,8 +814,7 @@ * MLAN_STATUS_FAILURE * The firmware shutdown call failed. */ -mlan_status -mlan_shutdown_fw(t_void *padapter) +mlan_status mlan_shutdown_fw(t_void *padapter) { mlan_status ret = MLAN_STATUS_PENDING; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -847,21 +854,17 @@ pcb = &pmadapter->callbacks; /** cancel pending ioctl */ - while ((pioctl_buf = - (pmlan_ioctl_req)util_dequeue_list(pmadapter->pmoal_handle, - &pmadapter->ioctl_pending_q, - pcb->moal_spin_lock, - pcb->moal_spin_unlock))) { + while ((pioctl_buf = (pmlan_ioctl_req)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->ioctl_pending_q, + pcb->moal_spin_lock, pcb->moal_spin_unlock))) { pioctl_buf->status_code = MLAN_ERROR_CMD_CANCEL; pcb->moal_ioctl_complete(pmadapter->pmoal_handle, pioctl_buf, MLAN_STATUS_FAILURE); } - while ((pmbuf = - (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, - &pmadapter->rx_data_queue, - pcb->moal_spin_lock, - pcb->moal_spin_unlock))) { + while ((pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->rx_data_queue, + pcb->moal_spin_lock, pcb->moal_spin_unlock))) { #ifdef USB if (IS_USB(pmadapter->card_type)) pcb->moal_recv_complete(pmadapter->pmoal_handle, pmbuf, @@ -895,8 +898,7 @@ * * @return N/A */ -static t_void -mlan_queue_main_work(mlan_adapter *pmadapter) +static t_void mlan_queue_main_work(mlan_adapter *pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); @@ -925,8 +927,7 @@ * * @return N/A */ -static t_void -mlan_queue_rx_work(mlan_adapter *pmadapter) +static t_void mlan_queue_rx_work(mlan_adapter *pmadapter) { pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); @@ -956,8 +957,7 @@ * * @return N/A */ -void -mlan_block_main_process(mlan_adapter *pmadapter, t_u8 block) +void mlan_block_main_process(mlan_adapter *pmadapter, t_u8 block) { pmlan_callbacks pcb = &pmadapter->callbacks; pcb->moal_spin_lock(pmadapter->pmoal_handle, @@ -972,10 +972,9 @@ pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pmain_proc_lock); PRINTM(MEVENT, "wlan: wait main work done...\n"); - wlan_recv_event(wlan_get_priv - (pmadapter, MLAN_BSS_ROLE_ANY), - MLAN_EVENT_ID_DRV_FLUSH_MAIN_WORK, - MNULL); + wlan_recv_event( + wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_FLUSH_MAIN_WORK, MNULL); } else { pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pmain_proc_lock); @@ -991,8 +990,7 @@ * * @return N/A */ -void -mlan_block_rx_process(mlan_adapter *pmadapter, t_u8 block) +void mlan_block_rx_process(mlan_adapter *pmadapter, t_u8 block) { pmlan_callbacks pcb = &pmadapter->callbacks; pcb->moal_spin_lock(pmadapter->pmoal_handle, pmadapter->prx_proc_lock); @@ -1024,8 +1022,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -mlan_rx_process(t_void *padapter, t_u8 *rx_pkts) +mlan_status mlan_rx_process(t_void *padapter, t_u8 *rx_pkts) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -1058,14 +1055,12 @@ while (MTRUE) { #ifdef DRV_EMBEDDED_AUTHENTICATOR if (pmadapter->authenticator_priv) { - if (IsAuthenticatorEnabled - (pmadapter->authenticator_priv->psapriv)) { - AuthenticatorKeyMgmtInit(pmadapter-> - authenticator_priv-> - psapriv, - pmadapter-> - authenticator_priv-> - curr_addr); + if (IsAuthenticatorEnabled( + pmadapter->authenticator_priv->psapriv)) { + AuthenticatorKeyMgmtInit( + pmadapter->authenticator_priv->psapriv, + pmadapter->authenticator_priv + ->curr_addr); pmadapter->authenticator_priv = MNULL; } } @@ -1074,41 +1069,35 @@ pmadapter->flush_data = MFALSE; wlan_flush_rxreorder_tbl(pmadapter); } - pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, - pmadapter->rx_data_queue. - plock); - pmbuf = (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, - &pmadapter-> - rx_data_queue, MNULL, - MNULL); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); + pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, &pmadapter->rx_data_queue, + MNULL, MNULL); if (!pmbuf) { - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); break; } pmadapter->rx_pkts_queued--; rx_num++; - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - pmadapter->rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); - //rx_trace 6 + // rx_trace 6 if (pmadapter->tp_state_on) { - pmadapter->callbacks.moal_tp_accounting(pmadapter-> - pmoal_handle, - pmbuf, - 6 - /*RX_DROP_P2 */ - ); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf, + 6 /*RX_DROP_P2*/); pcb->moal_get_system_time(pmadapter->pmoal_handle, &in_ts_sec, &in_ts_usec); pmbuf->extra_ts_sec = in_ts_sec; pmbuf->extra_ts_usec = in_ts_usec; } - if (pmadapter->tp_state_drop_point == 6 /*RX_DROP_P2 */ ) { + if (pmadapter->tp_state_drop_point == 6 /*RX_DROP_P2*/) { pmadapter->ops.data_complete(pmadapter, pmbuf, ret); goto rx_process_start; } @@ -1147,8 +1136,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -mlan_main_process(t_void *padapter) +mlan_status mlan_main_process(t_void *padapter) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -1187,17 +1175,15 @@ } if (pmadapter->pending_disconnect_priv) { PRINTM(MEVENT, "Reset connect state\n"); - wlan_reset_connect_state(pmadapter-> - pending_disconnect_priv, - MTRUE); + wlan_reset_connect_state( + pmadapter->pending_disconnect_priv, MTRUE); pmadapter->pending_disconnect_priv = MNULL; } #if defined(SDIO) || defined(PCIE) if (!IS_USB(pmadapter->card_type)) { if (pmadapter->rx_pkts_queued > HIGH_RX_PENDING) { - pcb->moal_tp_accounting_rx_param(pmadapter-> - pmoal_handle, - 2, 0); + pcb->moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 2, 0); PRINTM(MEVENT, "Pause\n"); pmadapter->delay_task_flag = MTRUE; mlan_queue_rx_work(pmadapter); @@ -1225,25 +1211,24 @@ pmadapter->pm_wakeup_fw_try = MTRUE; continue; } - if (IS_CARD_RX_RCVD(pmadapter) - || - (!pmadapter->cmd_sent && pmadapter->vdll_ctrl.pending_block) - ) { + if (IS_CARD_RX_RCVD(pmadapter) || + (!pmadapter->cmd_sent && + pmadapter->vdll_ctrl.pending_block)) { pmadapter->data_received = MFALSE; if (pmadapter->hs_activated == MTRUE) { pmadapter->is_hs_configured = MFALSE; - wlan_host_sleep_activated_event(wlan_get_priv - (pmadapter, - MLAN_BSS_ROLE_ANY), - MFALSE); + wlan_host_sleep_activated_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MFALSE); } pmadapter->pm_wakeup_fw_try = MFALSE; if (pmadapter->ps_state == PS_STATE_SLEEP) pmadapter->ps_state = PS_STATE_AWAKE; if (pmadapter->wakeup_fw_timer_is_set) { - pcb->moal_stop_timer(pmadapter->pmoal_handle, - pmadapter-> - pwakeup_fw_timer); + pcb->moal_stop_timer( + pmadapter->pmoal_handle, + pmadapter->pwakeup_fw_timer); pmadapter->wakeup_fw_timer_is_set = MFALSE; } } else { @@ -1253,24 +1238,24 @@ /* Check if we need to confirm Sleep Request received * previously */ if (pmadapter->ps_state == PS_STATE_PRE_SLEEP) - if (!pmadapter->cmd_sent && !pmadapter->curr_cmd - && !pmadapter->vdll_ctrl.pending_block) + if (!pmadapter->cmd_sent && + !pmadapter->curr_cmd && + !pmadapter->vdll_ctrl.pending_block) wlan_check_ps_cond(pmadapter); if (pmadapter->ps_state != PS_STATE_AWAKE || (pmadapter->tx_lock_flag == MTRUE)) break; - if (pmadapter->data_sent - || wlan_is_tdls_link_chan_switching(pmadapter-> - tdls_status) - || (wlan_bypass_tx_list_empty(pmadapter) && - wlan_wmm_lists_empty(pmadapter)) - || wlan_11h_radar_detected_tx_blocked(pmadapter) - ) { + if (pmadapter->data_sent || + wlan_is_tdls_link_chan_switching( + pmadapter->tdls_status) || + (wlan_bypass_tx_list_empty(pmadapter) && + wlan_wmm_lists_empty(pmadapter)) || + wlan_11h_radar_detected_tx_blocked(pmadapter)) { if (pmadapter->cmd_sent || pmadapter->curr_cmd || - !wlan_is_send_cmd_allowed(pmadapter-> - tdls_status) || + !wlan_is_send_cmd_allowed( + pmadapter->tdls_status) || !wlan_is_cmd_pending(pmadapter)) { break; } @@ -1278,12 +1263,16 @@ } /* Check for Cmd Resp */ + wlan_request_cmd_lock(pmadapter); if (pmadapter->cmd_resp_received) { pmadapter->cmd_resp_received = MFALSE; + wlan_release_cmd_lock(pmadapter); + wlan_process_cmdresp(pmadapter); /* call moal back when init_fw is done */ - if (pmadapter->hw_status == WlanHardwareStatusInitdone) { + if (pmadapter->hw_status == + WlanHardwareStatusInitdone) { pmadapter->hw_status = WlanHardwareStatusReady; wlan_init_fw_complete(pmadapter); } else if (pmadapter->hw_status == @@ -1292,6 +1281,8 @@ WlanHardwareStatusInitializing; wlan_get_hw_spec_complete(pmadapter); } + } else { + wlan_release_cmd_lock(pmadapter); } /* Check for event */ @@ -1303,8 +1294,8 @@ /* Check if we need to confirm Sleep Request received previously */ if (pmadapter->ps_state == PS_STATE_PRE_SLEEP) - if (!pmadapter->cmd_sent && !pmadapter->curr_cmd - && !pmadapter->vdll_ctrl.pending_block) + if (!pmadapter->cmd_sent && !pmadapter->curr_cmd && + !pmadapter->vdll_ctrl.pending_block) wlan_check_ps_cond(pmadapter); /* @@ -1312,25 +1303,22 @@ * Sleep Request event. */ if ((pmadapter->ps_state == PS_STATE_SLEEP) || - (pmadapter->ps_state == PS_STATE_PRE_SLEEP) - || (pmadapter->ps_state == PS_STATE_SLEEP_CFM) || - (pmadapter->tx_lock_flag == MTRUE) - ) { + (pmadapter->ps_state == PS_STATE_PRE_SLEEP) || + (pmadapter->ps_state == PS_STATE_SLEEP_CFM) || + (pmadapter->tx_lock_flag == MTRUE)) { continue; } /* in a case of race condition, download the VDLL block here */ - if (!pmadapter->cmd_sent && pmadapter->vdll_ctrl.pending_block) { - wlan_download_vdll_block(pmadapter, - pmadapter->vdll_ctrl. - pending_block, - pmadapter->vdll_ctrl. - pending_block_len); + if (!pmadapter->cmd_sent && + pmadapter->vdll_ctrl.pending_block) { + wlan_download_vdll_block( + pmadapter, pmadapter->vdll_ctrl.pending_block, + pmadapter->vdll_ctrl.pending_block_len); pmadapter->vdll_ctrl.pending_block = MNULL; } - if (!pmadapter->cmd_sent && !pmadapter->curr_cmd - && wlan_is_send_cmd_allowed(pmadapter->tdls_status) - ) { + if (!pmadapter->cmd_sent && !pmadapter->curr_cmd && + wlan_is_send_cmd_allowed(pmadapter->tdls_status)) { if (wlan_exec_next_cmd(pmadapter) == MLAN_STATUS_FAILURE) { ret = MLAN_STATUS_FAILURE; @@ -1346,35 +1334,35 @@ wlan_process_bypass_tx(pmadapter); if (pmadapter->hs_activated == MTRUE) { pmadapter->is_hs_configured = MFALSE; - wlan_host_sleep_activated_event(wlan_get_priv - (pmadapter, - MLAN_BSS_ROLE_ANY), - MFALSE); + wlan_host_sleep_activated_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MFALSE); } } - if (!pmadapter->data_sent && !wlan_wmm_lists_empty(pmadapter) - && !wlan_11h_radar_detected_tx_blocked(pmadapter) - && !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status) - ) { + if (!pmadapter->data_sent && !wlan_wmm_lists_empty(pmadapter) && + !wlan_11h_radar_detected_tx_blocked(pmadapter) && + !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status)) { wlan_wmm_process_tx(pmadapter); if (pmadapter->hs_activated == MTRUE) { pmadapter->is_hs_configured = MFALSE; - wlan_host_sleep_activated_event(wlan_get_priv - (pmadapter, - MLAN_BSS_ROLE_ANY), - MFALSE); + wlan_host_sleep_activated_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MFALSE); } } + #ifdef STA_SUPPORT if (pmadapter->delay_null_pkt && !pmadapter->cmd_sent && !pmadapter->curr_cmd && !wlan_is_cmd_pending(pmadapter) && wlan_bypass_tx_list_empty(pmadapter) && wlan_wmm_lists_empty(pmadapter)) { - if (wlan_send_null_packet - (wlan_get_priv(pmadapter, MLAN_BSS_ROLE_STA), - MRVDRV_TxPD_POWER_MGMT_NULL_PACKET | - MRVDRV_TxPD_POWER_MGMT_LAST_PACKET) == + if (wlan_send_null_packet( + wlan_get_priv(pmadapter, MLAN_BSS_ROLE_STA), + MRVDRV_TxPD_POWER_MGMT_NULL_PACKET | + MRVDRV_TxPD_POWER_MGMT_LAST_PACKET) == MLAN_STATUS_SUCCESS) { pmadapter->delay_null_pkt = MFALSE; } @@ -1411,8 +1399,7 @@ * * @return MLAN_STATUS_PENDING */ -mlan_status -mlan_send_packet(t_void *padapter, pmlan_buffer pmbuf) +mlan_status mlan_send_packet(t_void *padapter, pmlan_buffer pmbuf) { mlan_status ret = MLAN_STATUS_PENDING; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -1432,17 +1419,17 @@ pmbuf->flags |= MLAN_BUF_FLAG_MOAL_TX_BUF; pmpriv = pmadapter->priv[pmbuf->bss_index]; - eth_type = mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + - MLAN_ETHER_PKT_TYPE_OFFSET]); + eth_type = + mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + + MLAN_ETHER_PKT_TYPE_OFFSET]); if (((pmadapter->priv[pmbuf->bss_index]->port_ctrl_mode == MTRUE) && - ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) - || (eth_type == MLAN_ETHER_PKT_TYPE_ARP) - || (eth_type == MLAN_ETHER_PKT_TYPE_WAPI) - )) - || (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) - || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) + ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || + (eth_type == MLAN_ETHER_PKT_TYPE_ARP) || + (eth_type == MLAN_ETHER_PKT_TYPE_WAPI))) || + (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) || + (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) - ) { + ) { if (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) { memcpy_ext(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, @@ -1458,24 +1445,20 @@ MAC2STR(pmbuf->pbuf + pmbuf->data_offset)); } if (pmadapter->tp_state_on) - pmadapter->callbacks.moal_tp_accounting(pmadapter-> - pmoal_handle, - pmbuf->pdesc, - 2); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf->pdesc, 2); if (pmadapter->tp_state_drop_point == 2) return 0; else wlan_add_buf_bypass_txqueue(pmadapter, pmbuf); } else { if (pmadapter->tp_state_on) - pmadapter->callbacks.moal_tp_accounting(pmadapter-> - pmoal_handle, - pmbuf->pdesc, - 2); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf->pdesc, 2); if (pmadapter->tp_state_drop_point == 2) return 0; else - /* Transmit the packet */ + /* Transmit the packet*/ wlan_wmm_add_buf_txqueue(pmadapter, pmbuf); } @@ -1492,8 +1475,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -mlan_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) +mlan_status mlan_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = (pmlan_adapter)adapter; @@ -1529,10 +1511,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -mlan_write_data_async_complete(t_void *padapter, - pmlan_buffer pmbuf, t_u32 port, - mlan_status status) +mlan_status mlan_write_data_async_complete(t_void *padapter, pmlan_buffer pmbuf, + t_u32 port, mlan_status status) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -1546,6 +1526,9 @@ wlan_free_mlan_buffer(pmadapter, pmbuf); } else { pmadapter->data_sent = MFALSE; + wlan_update_port_status(pmadapter, port, MFALSE); + PRINTM(MDATA, "mlan_write_data_async_complete: DATA(%d)\n", + port); ret = wlan_write_data_complete(pmadapter, pmbuf, status); } @@ -1563,16 +1546,15 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or * MLAN_STATUS_PENDING */ -mlan_status -mlan_recv(t_void *padapter, pmlan_buffer pmbuf, t_u32 port) +mlan_status mlan_recv(t_void *padapter, pmlan_buffer pmbuf, t_u32 port) { mlan_status ret = MLAN_STATUS_PENDING; mlan_adapter *pmadapter = (mlan_adapter *)padapter; t_u8 *pbuf; t_u32 len, recv_type; - t_u32 event_cause; + t_u32 event_cause = 0; #ifdef DEBUG_LEVEL1 - t_u32 sec, usec; + t_u32 sec = 0, usec = 0; #endif t_u32 max_rx_data_size = MLAN_RX_DATA_BUF_SIZE; @@ -1605,11 +1587,11 @@ if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) { pmbuf->data_offset += MLAN_TYPE_LEN; pmbuf->data_len -= MLAN_TYPE_LEN; - wlan_process_sleep_confirm_resp - (pmadapter, - pmbuf->pbuf + - pmbuf->data_offset, - pmbuf->data_len); + wlan_process_sleep_confirm_resp( + pmadapter, + pmbuf->pbuf + + pmbuf->data_offset, + pmbuf->data_len); pmbuf->flags |= MLAN_BUF_FLAG_SLEEPCFM_RESP; ret = MLAN_STATUS_SUCCESS; @@ -1621,11 +1603,13 @@ } PRINTM(MINFO, "mlan_recv: no curr_cmd\n"); } else { + wlan_request_cmd_lock(pmadapter); pmadapter->upld_len = len; pmbuf->data_offset += MLAN_TYPE_LEN; pmbuf->data_len -= MLAN_TYPE_LEN; pmadapter->curr_cmd->respbuf = pmbuf; pmadapter->cmd_resp_received = MTRUE; + wlan_release_cmd_lock(pmadapter); } break; case MLAN_USB_TYPE_EVENT: @@ -1659,18 +1643,16 @@ PRINTM(MDATA, "mlan_recv: DATA (%lu.%06lu)\n", sec, usec); #if defined(USB) if (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.enable) { - max_rx_data_size = - pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_max; - if (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_mode == MLAN_USB_AGGR_MODE_NUM) { + max_rx_data_size = pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_max; + if (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl + .aggr_mode == MLAN_USB_AGGR_MODE_NUM) { max_rx_data_size *= MAX(MLAN_USB_MAX_PKT_SIZE, - pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_align); - max_rx_data_size = - MAX(max_rx_data_size, - MLAN_RX_DATA_BUF_SIZE); + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align); + max_rx_data_size = MAX(max_rx_data_size, + MLAN_RX_DATA_BUF_SIZE); } } #endif @@ -1680,27 +1662,20 @@ PRINTM(MERROR, "mlan_recv: DATA too large\n"); } else { pmadapter->upld_len = len; - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &pmbuf-> - in_ts_sec, - &pmbuf-> - in_ts_usec); - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pmbuf->in_ts_sec, + &pmbuf->in_ts_usec); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); util_enqueue_list_tail(pmadapter->pmoal_handle, &pmadapter->rx_data_queue, (pmlan_linked_list)pmbuf, MNULL, MNULL); pmadapter->rx_pkts_queued++; - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - pmadapter-> - rx_data_queue. - plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + pmadapter->rx_data_queue.plock); pmadapter->data_received = MTRUE; mlan_queue_rx_work(pmadapter); } @@ -1724,9 +1699,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -mlan_recv_packet_complete(t_void *padapter, - pmlan_buffer pmbuf, mlan_status status) +mlan_status mlan_recv_packet_complete(t_void *padapter, pmlan_buffer pmbuf, + mlan_status status) { mlan_adapter *pmadapter = (mlan_adapter *)padapter; @@ -1745,8 +1719,7 @@ * * @return wmm queue priority (0 - 3) */ -t_u8 -mlan_select_wmm_queue(t_void *padapter, t_u8 bss_num, t_u8 tid) +t_u8 mlan_select_wmm_queue(t_void *padapter, t_u8 bss_num, t_u8 tid) { mlan_adapter *pmadapter = (mlan_adapter *)padapter; pmlan_private pmpriv = pmadapter->priv[bss_num]; @@ -1766,8 +1739,7 @@ * * @return N/A */ -void -mlan_process_deaggr_pkt(t_void *padapter, pmlan_buffer pmbuf, t_u8 *drop) +void mlan_process_deaggr_pkt(t_void *padapter, pmlan_buffer pmbuf, t_u8 *drop) { mlan_adapter *pmadapter = (mlan_adapter *)padapter; mlan_private *pmpriv; @@ -1775,19 +1747,23 @@ *drop = MFALSE; pmpriv = pmadapter->priv[pmbuf->bss_index]; - eth_type = mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + - MLAN_ETHER_PKT_TYPE_OFFSET]); + eth_type = + mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + + MLAN_ETHER_PKT_TYPE_OFFSET]); switch (eth_type) { case MLAN_ETHER_PKT_TYPE_EAPOL: PRINTM(MEVENT, "Recevie AMSDU EAPOL frame\n"); if (pmpriv->sec_info.ewpa_enabled) { *drop = MTRUE; - wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_EAPOL_PKT, - 0, 0, MNULL, pmbuf); + if (MLAN_STATUS_FAILURE == + wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_EAPOL_PKT, 0, 0, + MNULL, pmbuf)) { + PRINTM(MERROR, "Preparing the CMD failed\n"); + } wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL); - } break; case MLAN_ETHER_PKT_TYPE_TDLS_ACTION: @@ -1812,8 +1788,7 @@ * @param adapter A pointer to mlan_adapter structure * @return MLAN_STATUS_FAILURE -- if the intererupt is not for us */ -mlan_status -mlan_interrupt(t_u16 msg_id, t_void *adapter) +mlan_status mlan_interrupt(t_u16 msg_id, t_void *adapter) { mlan_adapter *pmadapter = (mlan_adapter *)adapter; mlan_status ret; @@ -1832,8 +1807,7 @@ * @param keep_wakeup keep wake up flag * @return N/A */ -t_void -mlan_pm_wakeup_card(t_void *adapter, t_u8 keep_wakeup) +t_void mlan_pm_wakeup_card(t_void *adapter, t_u8 keep_wakeup) { mlan_adapter *pmadapter = (mlan_adapter *)adapter; @@ -1851,8 +1825,7 @@ * @param adapter A pointer to mlan_adapter structure * @return MTRUE/MFALSE */ -t_u8 -mlan_is_main_process_running(t_void *adapter) +t_u8 mlan_is_main_process_running(t_void *adapter) { mlan_adapter *pmadapter = (mlan_adapter *)adapter; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1881,8 +1854,7 @@ * @param func_num PCIE function num * @return N/A */ -t_void -mlan_set_int_mode(t_void *adapter, t_u32 int_mode, t_u8 func_num) +t_void mlan_set_int_mode(t_void *adapter, t_u32 int_mode, t_u8 func_num) { mlan_adapter *pmadapter = (mlan_adapter *)adapter; ENTER();
diff --git a/wlan_sd8987/mlan/mlan_sta_cmd.c b/wlan_sd8987/mlan/mlan_sta_cmd.c index f51619c..3550bff 100755 --- a/wlan_sd8987/mlan/mlan_sta_cmd.c +++ b/wlan_sd8987/mlan/mlan_sta_cmd.c
@@ -5,7 +5,7 @@ * it is ready. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -66,9 +66,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_rssi_info(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action) +static mlan_status wlan_cmd_802_11_rssi_info(pmlan_private pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action) { ENTER(); @@ -103,10 +103,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_rssi_info_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *pcmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_rssi_info_ext(pmlan_private pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_802_11_RSSI_INFO_EXT *rssi_info_ext_cmd = &pcmd->params.rssi_info_ext; @@ -124,7 +124,7 @@ if (info->param.path_id) { pos = (t_u8 *)rssi_info_ext_cmd->tlv_buf; - signal_info_tlv = (MrvlIEtypes_RSSI_EXT_t *) pos; + signal_info_tlv = (MrvlIEtypes_RSSI_EXT_t *)pos; signal_info_tlv->header.len = wlan_cpu_to_le16(sizeof(MrvlIEtypes_RSSI_EXT_t) - sizeof(MrvlIEtypesHeader_t)); @@ -150,10 +150,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_snmp_mib(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u32 cmd_oid, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_snmp_mib(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pdata_buf) { HostCmd_DS_802_11_SNMP_MIB *psnmp_mib = &cmd->params.smib; t_u32 ul_temp; @@ -291,6 +291,16 @@ cmd->size += sizeof(t_u8); } break; + case ChanTrackParam_i: + psnmp_mib->oid = wlan_cpu_to_le16((t_u16)ChanTrackParam_i); + if (cmd_action == HostCmd_ACT_GEN_SET) { + psnmp_mib->query_type = + wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + psnmp_mib->buf_size = wlan_cpu_to_le16(sizeof(t_u8)); + psnmp_mib->value[0] = *(t_u8 *)pdata_buf; + cmd->size += sizeof(t_u8); + } + break; default: break; } @@ -311,8 +321,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_get_log(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd) +static mlan_status wlan_cmd_802_11_get_log(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd) { ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_GET_LOG); @@ -332,12 +342,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_mfg_tx_cont(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 action, t_void *pdata_buf) +static mlan_status wlan_cmd_mfg_tx_cont(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 action, + t_void *pdata_buf) { - struct mfg_cmd_tx_cont *mcmd = (struct mfg_cmd_tx_cont - *)&cmd->params.mfg_tx_cont; + struct mfg_cmd_tx_cont *mcmd = + (struct mfg_cmd_tx_cont *)&cmd->params.mfg_tx_cont; struct mfg_cmd_tx_cont *cfg = (struct mfg_cmd_tx_cont *)pdata_buf; ENTER(); @@ -369,18 +379,18 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_mfg_tx_frame(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 action, t_void *pdata_buf) +static mlan_status wlan_cmd_mfg_tx_frame(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 action, + t_void *pdata_buf) { - struct mfg_cmd_tx_frame2 *mcmd = (struct mfg_cmd_tx_frame2 - *)&cmd->params.mfg_tx_frame2; + struct mfg_cmd_tx_frame2 *mcmd = + (struct mfg_cmd_tx_frame2 *)&cmd->params.mfg_tx_frame2; struct mfg_cmd_tx_frame2 *cfg = (struct mfg_cmd_tx_frame2 *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MFG_COMMAND); - cmd->size = wlan_cpu_to_le16(sizeof(struct mfg_cmd_tx_frame2) + - S_DS_GEN); + cmd->size = + wlan_cpu_to_le16(sizeof(struct mfg_cmd_tx_frame2) + S_DS_GEN); mcmd->mfg_cmd = wlan_cpu_to_le32(cfg->mfg_cmd); mcmd->action = wlan_cpu_to_le16(action); @@ -415,6 +425,55 @@ } /** + * @brief This function prepares command of MFG config trigger frame. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_cmd_mfg_config_trigger_frame(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 action, + t_void *pdata_buf) +{ + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *mcmd = + (mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *)&cmd->params + .mfg_tx_trigger_config; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *cfg = + (mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *)pdata_buf; + + ENTER(); + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MFG_COMMAND); + cmd->size = wlan_cpu_to_le16( + sizeof(mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t) + S_DS_GEN); + mcmd->mfg_cmd = wlan_cpu_to_le32(cfg->mfg_cmd); + mcmd->action = wlan_cpu_to_le16(action); + if (action == HostCmd_ACT_GEN_SET) { + mcmd->enable_tx = wlan_cpu_to_le32(cfg->enable_tx); + mcmd->standalone_hetb = wlan_cpu_to_le32(cfg->standalone_hetb); + mcmd->frmCtl.type = wlan_cpu_to_le16(cfg->frmCtl.type); + mcmd->frmCtl.sub_type = wlan_cpu_to_le16(cfg->frmCtl.sub_type); + mcmd->duration = wlan_cpu_to_le16(cfg->duration); + + mcmd->trig_common_field = + wlan_cpu_to_le64(cfg->trig_common_field); + + memcpy_ext(pmpriv->adapter, &mcmd->trig_user_info_field, + &cfg->trig_user_info_field, + sizeof(cfg->trig_user_info_field), + sizeof(mcmd->trig_user_info_field)); + + mcmd->basic_trig_user_info = + wlan_cpu_to_le16(cfg->basic_trig_user_info); + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares command of MFG HE TB Tx. * * @param pmpriv A pointer to mlan_private structure @@ -425,17 +484,16 @@ * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 action, t_void *pdata_buf) +mlan_status wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 action, t_void *pdata_buf) { - struct mfg_Cmd_HE_TBTx_t *mcmd = (struct mfg_Cmd_HE_TBTx_t - *)&cmd->params.mfg_he_power; + struct mfg_Cmd_HE_TBTx_t *mcmd = + (struct mfg_Cmd_HE_TBTx_t *)&cmd->params.mfg_he_power; struct mfg_Cmd_HE_TBTx_t *cfg = (struct mfg_Cmd_HE_TBTx_t *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MFG_COMMAND); - cmd->size = wlan_cpu_to_le16(sizeof(struct mfg_Cmd_HE_TBTx_t) + - S_DS_GEN); + cmd->size = + wlan_cpu_to_le16(sizeof(struct mfg_Cmd_HE_TBTx_t) + S_DS_GEN); mcmd->mfg_cmd = wlan_cpu_to_le32(cfg->mfg_cmd); mcmd->action = wlan_cpu_to_le16(action); @@ -449,7 +507,6 @@ LEAVE(); return MLAN_STATUS_SUCCESS; - } /** @@ -462,14 +519,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_mfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 action, t_void *pdata_buf) +mlan_status wlan_cmd_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 action, t_void *pdata_buf) { - struct mfg_cmd_generic_cfg *mcmd = (struct mfg_cmd_generic_cfg - *)&cmd->params.mfg_generic_cfg; - struct mfg_cmd_generic_cfg *cfg = (struct mfg_cmd_generic_cfg - *)pdata_buf; + struct mfg_cmd_generic_cfg *mcmd = + (struct mfg_cmd_generic_cfg *)&cmd->params.mfg_generic_cfg; + struct mfg_cmd_generic_cfg *cfg = + (struct mfg_cmd_generic_cfg *)pdata_buf; mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -488,6 +544,10 @@ case MFG_CMD_CONFIG_MAC_HE_TB_TX: ret = wlan_cmd_mfg_he_tb_tx(pmpriv, cmd, action, pdata_buf); goto cmd_mfg_done; + case MFG_CMD_CONFIG_TRIGGER_FRAME: + ret = wlan_cmd_mfg_config_trigger_frame(pmpriv, cmd, action, + pdata_buf); + goto cmd_mfg_done; case MFG_CMD_SET_TEST_MODE: case MFG_CMD_UNSET_TEST_MODE: case MFG_CMD_TX_ANT: @@ -504,8 +564,8 @@ goto cmd_mfg_done; } cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MFG_COMMAND); - cmd->size = wlan_cpu_to_le16(sizeof(struct mfg_cmd_generic_cfg) + - S_DS_GEN); + cmd->size = + wlan_cpu_to_le16(sizeof(struct mfg_cmd_generic_cfg) + S_DS_GEN); mcmd->mfg_cmd = wlan_cpu_to_le32(cfg->mfg_cmd); mcmd->action = wlan_cpu_to_le16(action); @@ -529,10 +589,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_tx_power_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_tx_power_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { MrvlTypes_Power_Group_t *ppg_tlv = MNULL; HostCmd_DS_TXPWR_CFG *ptxp = MNULL; @@ -546,20 +605,20 @@ case HostCmd_ACT_GEN_SET: ptxp = (HostCmd_DS_TXPWR_CFG *)pdata_buf; if (ptxp->mode) { - ppg_tlv = (MrvlTypes_Power_Group_t *) - ((t_u8 *)pdata_buf + - sizeof(HostCmd_DS_TXPWR_CFG)); + ppg_tlv = (MrvlTypes_Power_Group_t + *)((t_u8 *)pdata_buf + + sizeof(HostCmd_DS_TXPWR_CFG)); memmove(pmpriv->adapter, ptxp_cfg, pdata_buf, sizeof(HostCmd_DS_TXPWR_CFG) + + sizeof(MrvlTypes_Power_Group_t) + + ppg_tlv->length); + + ppg_tlv = (MrvlTypes_Power_Group_t + *)((t_u8 *)ptxp_cfg + + sizeof(HostCmd_DS_TXPWR_CFG)); + cmd->size += wlan_cpu_to_le16( sizeof(MrvlTypes_Power_Group_t) + ppg_tlv->length); - - ppg_tlv = (MrvlTypes_Power_Group_t *) - ((t_u8 *)ptxp_cfg + - sizeof(HostCmd_DS_TXPWR_CFG)); - cmd->size += - wlan_cpu_to_le16(sizeof(MrvlTypes_Power_Group_t) - + ppg_tlv->length); ppg_tlv->type = wlan_cpu_to_le16(ppg_tlv->type); ppg_tlv->length = wlan_cpu_to_le16(ppg_tlv->length); } else { @@ -588,10 +647,10 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_rf_tx_power(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_rf_tx_power(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_802_11_RF_TX_POWER *prtp = &cmd->params.txp; @@ -628,8 +687,7 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -wlan_is_p2p_connected(pmlan_adapter pmadapter) +static t_u8 wlan_is_p2p_connected(pmlan_adapter pmadapter) { int j; pmlan_private priv; @@ -667,10 +725,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_hs_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, hs_config_param *pdata_buf) +static mlan_status wlan_cmd_802_11_hs_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + hs_config_param *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_802_11_HS_CFG_ENH *phs_cfg = &cmd->params.opt_hs_cfg; @@ -698,13 +756,13 @@ pmadapter->arp_filter_size); memcpy_ext(pmpriv->adapter, ((t_u8 *)phs_cfg) + - sizeof(HostCmd_DS_802_11_HS_CFG_ENH), + sizeof(HostCmd_DS_802_11_HS_CFG_ENH), pmadapter->arp_filter, pmadapter->arp_filter_size, pmadapter->arp_filter_size); cmd->size = pmadapter->arp_filter_size + - sizeof(HostCmd_DS_802_11_HS_CFG_ENH) + S_DS_GEN; + sizeof(HostCmd_DS_802_11_HS_CFG_ENH) + S_DS_GEN; tlv = (t_u8 *)phs_cfg + sizeof(HostCmd_DS_802_11_HS_CFG_ENH) + - pmadapter->arp_filter_size; + pmadapter->arp_filter_size; } else cmd->size = S_DS_GEN + sizeof(HostCmd_DS_802_11_HS_CFG_ENH); @@ -717,9 +775,9 @@ phs_cfg->action = wlan_cpu_to_le16(HS_CONFIGURE); #ifdef WIFI_DIRECT_SUPPORT if (wlan_is_p2p_connected(pmadapter)) - phs_cfg->params.hs_config.conditions = - wlan_cpu_to_le32(pdata_buf->conditions | - HOST_SLEEP_COND_MULTICAST_DATA); + phs_cfg->params.hs_config.conditions = wlan_cpu_to_le32( + pdata_buf->conditions | + HOST_SLEEP_COND_MULTICAST_DATA); else #endif phs_cfg->params.hs_config.conditions = @@ -731,10 +789,9 @@ holdoff_tlv = (MrvlIEtypes_HsWakeHoldoff_t *)tlv; holdoff_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HS_WAKE_HOLDOFF); - holdoff_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_HsWakeHoldoff_t) - - sizeof(MrvlIEtypesHeader_t)); + holdoff_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_HsWakeHoldoff_t) - + sizeof(MrvlIEtypesHeader_t)); holdoff_tlv->min_wake_holdoff = wlan_cpu_to_le16(pmadapter->min_wake_holdoff); tlv += sizeof(MrvlIEtypes_HsWakeHoldoff_t); @@ -744,18 +801,16 @@ if (pmadapter->hs_wake_interval && pmpriv->media_connected && (pmpriv->bss_type == MLAN_BSS_TYPE_STA)) { cmd->size += sizeof(MrvlIEtypes_PsParamsInHs_t); - psparam_tlv = (MrvlIEtypes_PsParamsInHs_t *) tlv; + psparam_tlv = (MrvlIEtypes_PsParamsInHs_t *)tlv; psparam_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_PS_PARAMS_IN_HS); - psparam_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_PsParamsInHs_t) - - sizeof(MrvlIEtypesHeader_t)); + psparam_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_PsParamsInHs_t) - + sizeof(MrvlIEtypesHeader_t)); psparam_tlv->hs_wake_interval = wlan_cpu_to_le32(pmadapter->hs_wake_interval); - psparam_tlv->hs_inactivity_timeout = - wlan_cpu_to_le32(pmadapter-> - hs_inactivity_timeout); + psparam_tlv->hs_inactivity_timeout = wlan_cpu_to_le32( + pmadapter->hs_inactivity_timeout); tlv += sizeof(MrvlIEtypes_PsParamsInHs_t); PRINTM(MCMND, "hs_wake_interval=%d\n", pmadapter->hs_wake_interval); @@ -764,27 +819,24 @@ } if (pmadapter->param_type_ind == 1) { cmd->size += sizeof(MrvlIEtypes_WakeupSourceGPIO_t); - gpio_tlv = (MrvlIEtypes_WakeupSourceGPIO_t *) tlv; - gpio_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_HS_WAKEUP_SOURCE_GPIO); - gpio_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_WakeupSourceGPIO_t) - - sizeof(MrvlIEtypesHeader_t)); + gpio_tlv = (MrvlIEtypes_WakeupSourceGPIO_t *)tlv; + gpio_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_HS_WAKEUP_SOURCE_GPIO); + gpio_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_WakeupSourceGPIO_t) - + sizeof(MrvlIEtypesHeader_t)); gpio_tlv->ind_gpio = (t_u8)pmadapter->ind_gpio; gpio_tlv->level = (t_u8)pmadapter->level; tlv += sizeof(MrvlIEtypes_WakeupSourceGPIO_t); } if (pmadapter->param_type_ext == 2) { cmd->size += sizeof(MrvlIEtypes_WakeupExtend_t); - ext_tlv = (MrvlIEtypes_WakeupExtend_t *) tlv; + ext_tlv = (MrvlIEtypes_WakeupExtend_t *)tlv; ext_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WAKEUP_EXTEND); - ext_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_WakeupExtend_t) - - sizeof(MrvlIEtypesHeader_t)); + ext_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_WakeupExtend_t) - + sizeof(MrvlIEtypesHeader_t)); ext_tlv->event_force_ignore = wlan_cpu_to_le32(pmadapter->event_force_ignore); ext_tlv->event_use_ext_gap = @@ -799,8 +851,8 @@ memset(pmadapter, mgmt_filter, 0, MAX_MGMT_FRAME_FILTER * - sizeof(mgmt_frame_filter)); - mgmt_filter_tlv = (MrvlIEtypes_MgmtFrameFilter_t *) tlv; + sizeof(mgmt_frame_filter)); + mgmt_filter_tlv = (MrvlIEtypes_MgmtFrameFilter_t *)tlv; mgmt_filter_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_MGMT_FRAME_WAKEUP); tlv += sizeof(MrvlIEtypesHeader_t); @@ -810,10 +862,8 @@ (t_u8)pmadapter->mgmt_filter[i].action; mgmt_filter[i].type = (t_u8)pmadapter->mgmt_filter[i].type; - mgmt_filter[i].frame_mask = - wlan_cpu_to_le32(pmadapter-> - mgmt_filter[i]. - frame_mask); + mgmt_filter[i].frame_mask = wlan_cpu_to_le32( + pmadapter->mgmt_filter[i].frame_mask); i++; } memcpy_ext(pmadapter, (t_u8 *)mgmt_filter_tlv->filter, @@ -824,35 +874,30 @@ mgmt_filter_tlv->header.len = wlan_cpu_to_le16(i * sizeof(mgmt_frame_filter)); cmd->size += i * sizeof(mgmt_frame_filter) + - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); } if (pmadapter->hs_mimo_switch) { cmd->size += sizeof(MrvlIEtypes_HS_Antmode_t); - antmode_tlv = (MrvlIEtypes_HS_Antmode_t *) tlv; + antmode_tlv = (MrvlIEtypes_HS_Antmode_t *)tlv; antmode_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HS_ANTMODE); - antmode_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_HS_Antmode_t) - - sizeof(MrvlIEtypesHeader_t)); + antmode_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_HS_Antmode_t) - + sizeof(MrvlIEtypesHeader_t)); antmode_tlv->txpath_antmode = ANTMODE_FW_DECISION; antmode_tlv->rxpath_antmode = ANTMODE_FW_DECISION; tlv += sizeof(MrvlIEtypes_HS_Antmode_t); - PRINTM(MCMND, - "hs_mimo_switch=%d\n", + PRINTM(MCMND, "hs_mimo_switch=%d\n", pmadapter->hs_mimo_switch); - PRINTM(MCMND, - "txpath_antmode=%d, rxpath_antmode=%d\n", + PRINTM(MCMND, "txpath_antmode=%d, rxpath_antmode=%d\n", antmode_tlv->txpath_antmode, antmode_tlv->rxpath_antmode); } cmd->size = wlan_cpu_to_le16(cmd->size); - PRINTM(MCMND, - "HS_CFG_CMD: condition:0x%x gpio:0x%x\n", + PRINTM(MCMND, "HS_CFG_CMD: condition:0x%x gpio:0x%x\n", phs_cfg->params.hs_config.conditions, phs_cfg->params.hs_config.gpio); - PRINTM(MCMND, - "HS_CFG_CMD: gap:0x%x holdoff=%d\n", + PRINTM(MCMND, "HS_CFG_CMD: gap:0x%x holdoff=%d\n", phs_cfg->params.hs_config.gap, pmadapter->min_wake_holdoff); PRINTM(MCMND, @@ -875,10 +920,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_sleep_period(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) +static mlan_status wlan_cmd_802_11_sleep_period(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_u16 *pdata_buf) { HostCmd_DS_802_11_SLEEP_PERIOD *pcmd_sleep_pd = &cmd->params.sleep_pd; @@ -906,10 +951,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_sleep_params(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) +static mlan_status wlan_cmd_802_11_sleep_params(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_u16 *pdata_buf) { HostCmd_DS_802_11_SLEEP_PARAMS *pcmd_sp = &cmd->params.sleep_param; mlan_ds_sleep_params *psp = (mlan_ds_sleep_params *)pdata_buf; @@ -948,10 +993,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_mac_multicast_adr(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_mac_multicast_adr(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { mlan_multicast_list *pmcast_list = (mlan_multicast_list *)pdata_buf; HostCmd_DS_MAC_MULTICAST_ADR *pmc_addr = &cmd->params.mc_addr; @@ -982,10 +1027,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_deauthenticate(pmlan_private pmpriv, - t_u16 cmd_no, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_deauthenticate(pmlan_private pmpriv, + t_u16 cmd_no, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_DS_802_11_DEAUTHENTICATE *pdeauth = &cmd->params.deauth; @@ -1026,8 +1071,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_ad_hoc_stop(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd) +static mlan_status wlan_cmd_802_11_ad_hoc_stop(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd) { ENTER(); @@ -1052,10 +1097,10 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_802_11_key_material(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u32 cmd_oid, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_key_material(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pdata_buf) { HostCmd_DS_802_11_KEY_MATERIAL *pkey_material = &cmd->params.key_material; @@ -1108,17 +1153,15 @@ wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN); pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_MCAST_KEY | - KEY_INFO_UCAST_KEY); + pkey_material->key_param_set.key_info = wlan_cpu_to_le16( + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.mac_addr, pkey->mac_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(pkey_material->action)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(pkey_material->action)); PRINTM(MCMND, "Remove Key\n"); goto done; } @@ -1130,9 +1173,8 @@ memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.mac_addr, pkey->mac_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); if (pkey->key_len <= MAX_WEP_KEY_SIZE) { - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(wep_param_t)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(wep_param_t)); pkey_material->key_param_set.key_type = KEY_TYPE_ID_WEP; if (pkey->is_current_wep_key) { pkey_material->key_param_set.key_info |= @@ -1189,14 +1231,12 @@ pmpriv->sec_info.wapi_key_on = MTRUE; pkey_material->key_param_set.key_info = wlan_cpu_to_le16(pkey_material->key_param_set.key_info); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(wapi_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(wapi_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(wapi_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set WAPI Key\n"); goto done; } @@ -1219,9 +1259,10 @@ pkey->key_flags & KEY_FLAG_GCMP_256) { if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) { - memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params.gcmp. - pn, pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); + memcpy_ext( + pmpriv->adapter, + pkey_material->key_param_set.key_params.gcmp.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); } if (pkey->key_flags & KEY_FLAG_GCMP) pkey_material->key_param_set.key_type = @@ -1234,14 +1275,12 @@ memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.gcmp.key, pkey->key_material, pkey->key_len, WPA_GCMP_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(gcmp_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(gcmp_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(gcmp_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(gcmp_param) + + sizeof(pkey_material->action)); goto done; } @@ -1249,9 +1288,9 @@ if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) { memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params. - ccmp256.pn, pkey->pn, SEQ_MAX_SIZE, - WPA_PN_SIZE); + pkey_material->key_param_set.key_params + .ccmp256.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); } pkey_material->key_param_set.key_type = KEY_TYPE_ID_CCMP_256; pkey_material->key_param_set.key_params.ccmp256.key_len = @@ -1260,14 +1299,12 @@ pkey_material->key_param_set.key_params.ccmp256.key, pkey->key_material, pkey->key_len, WPA_CCMP_256_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(ccmp_256_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(ccmp_256_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(ccmp_256_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(ccmp_256_param) + + sizeof(pkey_material->action)); goto done; } @@ -1275,23 +1312,22 @@ !(pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) - memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params.aes. - pn, pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); + memcpy_ext( + pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); pkey_material->key_param_set.key_type = KEY_TYPE_ID_AES; pkey_material->key_param_set.key_params.aes.key_len = wlan_cpu_to_le16(pkey->key_len); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.aes.key, pkey->key_material, pkey->key_len, WPA_AES_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(aes_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(aes_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(aes_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(aes_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set AES Key\n"); goto done; } @@ -1300,9 +1336,9 @@ if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params. - cmac_aes.ipn, pkey->pn, SEQ_MAX_SIZE, - IGTK_PN_SIZE); + pkey_material->key_param_set.key_params + .cmac_aes.ipn, + pkey->pn, SEQ_MAX_SIZE, IGTK_PN_SIZE); pkey_material->key_param_set.key_info &= ~(wlan_cpu_to_le16(KEY_INFO_MCAST_KEY)); pkey_material->key_param_set.key_info |= @@ -1318,14 +1354,12 @@ memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.cmac_aes.key, pkey->key_material, pkey->key_len, CMAC_AES_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(cmac_aes_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(cmac_aes_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(cmac_aes_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param) + + sizeof(pkey_material->action)); if (pkey->key_flags & KEY_FLAG_GMAC_128) PRINTM(MCMND, "Set AES 128 GMAC Key\n"); else @@ -1337,9 +1371,9 @@ if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params. - cmac_aes.ipn, pkey->pn, SEQ_MAX_SIZE, - IGTK_PN_SIZE); + pkey_material->key_param_set.key_params + .cmac_aes.ipn, + pkey->pn, SEQ_MAX_SIZE, IGTK_PN_SIZE); pkey_material->key_param_set.key_info &= ~(wlan_cpu_to_le16(KEY_INFO_MCAST_KEY)); pkey_material->key_param_set.key_info |= @@ -1352,37 +1386,34 @@ pkey_material->key_param_set.key_params.cmac_aes.key, pkey->key_material, pkey->key_len, WPA_IGTK_256_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(gmac_aes_256_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(gmac_aes_256_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(gmac_aes_256_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(gmac_aes_256_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set AES 256 GMAC Key\n"); goto done; } if (pkey->key_len == WPA_TKIP_KEY_LEN) { if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) - memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params.tkip. - pn, pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); + memcpy_ext( + pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); pkey_material->key_param_set.key_type = KEY_TYPE_ID_TKIP; pkey_material->key_param_set.key_params.tkip.key_len = wlan_cpu_to_le16(pkey->key_len); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.tkip.key, pkey->key_material, pkey->key_len, WPA_TKIP_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(tkip_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(tkip_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(tkip_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set TKIP Key\n"); } done: @@ -1401,14 +1432,14 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_gtk_rekey_offload(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u32 cmd_oid, t_void *pdata_buf) +static mlan_status wlan_cmd_gtk_rekey_offload(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pdata_buf) { HostCmd_DS_GTK_REKEY_PARAMS *rekey = &cmd->params.gtk_rekey; mlan_ds_misc_gtk_rekey_data *data = - (mlan_ds_misc_gtk_rekey_data *) pdata_buf; + (mlan_ds_misc_gtk_rekey_data *)pdata_buf; t_u64 rekey_ctr; ENTER(); @@ -1421,9 +1452,8 @@ MLAN_KEK_LEN); memcpy_ext(pmpriv->adapter, rekey->kck, data->kck, MLAN_KCK_LEN, MLAN_KCK_LEN); - rekey_ctr = - wlan_le64_to_cpu(swap_byte_64 - (*(t_u64 *)data->replay_ctr)); + rekey_ctr = wlan_le64_to_cpu( + swap_byte_64(*(t_u64 *)data->replay_ctr)); rekey->replay_ctr_low = wlan_cpu_to_le32((t_u32)rekey_ctr); rekey->replay_ctr_high = wlan_cpu_to_le32((t_u64)rekey_ctr >> 32); @@ -1443,9 +1473,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_eapol_pkt(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_eapol_pkt(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_EAPOL_PKT *eapol_pkt = &cmd->params.eapol_pkt; mlan_buffer *pmbuf = (mlan_buffer *)pdata_buf; @@ -1476,14 +1506,14 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_supplicant_profile(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_supplicant_profile(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_802_11_SUPPLICANT_PROFILE *sup_profile = - (HostCmd_DS_802_11_SUPPLICANT_PROFILE *)&(cmd->params. - esupplicant_profile); + (HostCmd_DS_802_11_SUPPLICANT_PROFILE *)&( + cmd->params.esupplicant_profile); MrvlIEtypes_EncrProto_t *encr_proto_tlv = MNULL; MrvlIEtypes_Cipher_t *pcipher_tlv = MNULL; t_u8 *ptlv_buffer = (t_u8 *)sup_profile->tlv_buf; @@ -1491,9 +1521,8 @@ ENTER(); - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_SUPPLICANT_PROFILE) + - S_DS_GEN - 1); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_SUPPLICANT_PROFILE) + S_DS_GEN - 1); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_SUPPLICANT_PROFILE); sup_profile->action = wlan_cpu_to_le16(cmd_action); if ((cmd_action == HostCmd_ACT_GEN_SET) && pdata_buf) { @@ -1551,10 +1580,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_802_11_rf_channel(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_802_11_rf_channel(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_802_11_RF_CHANNEL *prf_chan = &cmd->params.rf_channel; @@ -1565,8 +1594,7 @@ S_DS_GEN); if (cmd_action == HostCmd_ACT_GEN_SET) { - if ((pmpriv->adapter->adhoc_start_band & BAND_A) - ) + if ((pmpriv->adapter->adhoc_start_band & BAND_A)) prf_chan->rf_type.bandcfg.chanBand = BAND_5GHZ; prf_chan->rf_type.bandcfg.chanWidth = pmpriv->adapter->chan_bandwidth; @@ -1588,10 +1616,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_ibss_coalescing_status(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_ibss_coalescing_status(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { HostCmd_DS_802_11_IBSS_STATUS *pibss_coal = &(cmd->params.ibss_coalescing); @@ -1613,7 +1641,7 @@ pibss_coal->enable = wlan_cpu_to_le16(enable); break; - /* In other case.. Nothing to do */ + /* In other case.. Nothing to do */ case HostCmd_ACT_GEN_GET: default: break; @@ -1633,10 +1661,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_mgmt_ie_list(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_mgmt_ie_list(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { t_u16 req_len = 0, travel_len = 0; custom_ie *cptr = MNULL; @@ -1656,6 +1683,11 @@ pmgmt_ie_list->ds_mgmt_ie.len = wlan_cpu_to_le16(cust_ie->len); req_len = cust_ie->len; + if (req_len > sizeof(cust_ie->ie_data_list)) { + PRINTM(MERROR, "Invalid cust_ie->len=%d\n", req_len); + LEAVE(); + return MLAN_STATUS_FAILURE; + } travel_len = 0; /* conversion for index, mask, len */ if (req_len == sizeof(t_u16)) @@ -1679,7 +1711,7 @@ sizeof(pmgmt_ie_list->ds_mgmt_ie.ie_data_list)); cmd->size -= (MAX_MGMT_IE_INDEX_TO_FW * sizeof(custom_ie)) + - sizeof(tlvbuf_max_mgmt_ie); + sizeof(tlvbuf_max_mgmt_ie); cmd->size += cust_ie->len; cmd->size = wlan_cpu_to_le16(cmd->size); @@ -1697,17 +1729,16 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_tdls_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_tdls_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { t_u16 travel_len = 0; mlan_ds_misc_tdls_config *tdls_config = MNULL; tdls_all_config *tdls_all_cfg = MNULL; HostCmd_DS_TDLS_CONFIG *ptdls_config_data = &(cmd->params.tdls_config_data); - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -1745,7 +1776,7 @@ sizeof(t_u16), sizeof(t_u16)); memcpy_ext(pmpriv->adapter, (t_u8 *)ptdls_config_data->tdls_info.tdls_data + - sizeof(t_u16), + sizeof(t_u16), &tdls_all_cfg->u.tdls_set.tlv_buffer, travel_len, MAX_TDLS_DATA_LEN - sizeof(t_u16)); travel_len += sizeof(t_u16); @@ -1760,12 +1791,10 @@ case WLAN_TDLS_SETUP_REQ: travel_len = sizeof(tdls_all_cfg->u.tdls_setup); - tdls_all_cfg->u.tdls_setup.setup_timeout = - wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. - setup_timeout); - tdls_all_cfg->u.tdls_setup.key_lifetime = - wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. - key_lifetime); + tdls_all_cfg->u.tdls_setup.setup_timeout = wlan_cpu_to_le32( + tdls_all_cfg->u.tdls_setup.setup_timeout); + tdls_all_cfg->u.tdls_setup.key_lifetime = wlan_cpu_to_le32( + tdls_all_cfg->u.tdls_setup.key_lifetime); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, &tdls_all_cfg->u.tdls_setup, travel_len, @@ -1774,9 +1803,8 @@ case WLAN_TDLS_TEAR_DOWN_REQ: travel_len = sizeof(tdls_all_cfg->u.tdls_tear_down); - tdls_all_cfg->u.tdls_tear_down.reason_code = - wlan_cpu_to_le16(tdls_all_cfg->u.tdls_tear_down. - reason_code); + tdls_all_cfg->u.tdls_tear_down.reason_code = wlan_cpu_to_le16( + tdls_all_cfg->u.tdls_tear_down.reason_code); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, &tdls_all_cfg->u.tdls_tear_down, travel_len, @@ -1791,12 +1819,11 @@ break; case WLAN_TDLS_INIT_CHAN_SWITCH: travel_len = sizeof(tdls_all_cfg->u.tdls_chan_switch); - tdls_all_cfg->u.tdls_chan_switch.switch_time = - wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. - switch_time); + tdls_all_cfg->u.tdls_chan_switch.switch_time = wlan_cpu_to_le16( + tdls_all_cfg->u.tdls_chan_switch.switch_time); tdls_all_cfg->u.tdls_chan_switch.switch_timeout = - wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. - switch_timeout); + wlan_cpu_to_le16( + tdls_all_cfg->u.tdls_chan_switch.switch_timeout); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, &tdls_all_cfg->u.tdls_chan_switch, travel_len, @@ -1820,9 +1847,8 @@ break; case WLAN_TDLS_POWER_MODE: travel_len = sizeof(tdls_all_cfg->u.tdls_power_mode); - tdls_all_cfg->u.tdls_power_mode.power_mode = - wlan_cpu_to_le16(tdls_all_cfg->u.tdls_power_mode. - power_mode); + tdls_all_cfg->u.tdls_power_mode.power_mode = wlan_cpu_to_le16( + tdls_all_cfg->u.tdls_power_mode.power_mode); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, &tdls_all_cfg->u.tdls_power_mode, travel_len, @@ -1838,9 +1864,9 @@ sizeof(tdls_all_cfg->u.tdls_link_status_req); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, - tdls_all_cfg->u.tdls_link_status_req. - peer_mac_addr, travel_len, - MAX_TDLS_DATA_LEN); + tdls_all_cfg->u.tdls_link_status_req + .peer_mac_addr, + travel_len, MAX_TDLS_DATA_LEN); } break; @@ -1854,9 +1880,8 @@ case WLAN_TDLS_DEBUG_STOP_RX: case WLAN_TDLS_DEBUG_CS_RET_IM: travel_len = sizeof(tdls_all_cfg->u.tdls_debug_data); - tdls_all_cfg->u.tdls_debug_data.debug_data = - wlan_cpu_to_le16(tdls_all_cfg->u.tdls_debug_data. - debug_data); + tdls_all_cfg->u.tdls_debug_data.debug_data = wlan_cpu_to_le16( + tdls_all_cfg->u.tdls_debug_data.debug_data); memcpy_ext(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, &tdls_all_cfg->u.tdls_debug_data, travel_len, @@ -1886,9 +1911,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_tdls_oper(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_tdls_oper(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) { t_u16 travel_len = 0; mlan_ds_misc_tdls_oper *tdls_oper = MNULL; @@ -1907,6 +1932,8 @@ MrvlIETypes_VHTCap_t *VHTcap_tlv = MNULL; MrvlIETypes_VHTOprat_t *VHTOper_tlv = MNULL; MrvlIETypes_AID_t *AidInfo = MNULL; + MrvlIEtypes_Extension_t *hecap_tlv = MNULL; + MrvlIEtypes_He_Op_t *heop_tlv = MNULL; MrvlIEtypes_TDLS_Idle_Timeout_t *TdlsIdleTimeout = MNULL; ENTER(); @@ -1930,11 +1957,11 @@ case WLAN_TDLS_CONFIG_LINK: if (sta_ptr) { ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_CONFIG); - /*capability */ + /*capability*/ *(t_u16 *)pos = wlan_cpu_to_le16(sta_ptr->capability); travel_len += sizeof(sta_ptr->capability); - /*supported rate */ + /*supported rate*/ Rate_tlv = (MrvlIEtypes_RatesParamSet_t *)(pos + travel_len); Rate_tlv->header.type = @@ -1943,7 +1970,7 @@ wlan_cpu_to_le16(sta_ptr->rate_len); memcpy_ext(pmpriv->adapter, pos + travel_len + - sizeof(MrvlIEtypesHeader_t), + sizeof(MrvlIEtypesHeader_t), sta_ptr->support_rate, sta_ptr->rate_len, sta_ptr->rate_len); travel_len += @@ -1956,16 +1983,14 @@ travel_len); ExCap->header.type = wlan_cpu_to_le16(TLV_TYPE_EXTCAP); - ExCap->header.len = - wlan_cpu_to_le16(sta_ptr->ExtCap. - ieee_hdr.len); + ExCap->header.len = wlan_cpu_to_le16( + sta_ptr->ExtCap.ieee_hdr.len); memcpy_ext(pmpriv->adapter, &ExCap->ext_cap, &sta_ptr->ExtCap.ext_cap, sta_ptr->ExtCap.ieee_hdr.len, sta_ptr->ExtCap.ieee_hdr.len); - travel_len += - sta_ptr->ExtCap.ieee_hdr.len + - sizeof(MrvlIEtypesHeader_t); + travel_len += sta_ptr->ExtCap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); } if (ExCap) { if (pmpriv->host_tdls_uapsd_support && @@ -1973,7 +1998,7 @@ /* qos_info */ qos_info = (MrvlIETypes_qosinfo_t - *)(pos + travel_len); + *)(pos + travel_len); qos_info->header.type = wlan_cpu_to_le16(QOS_INFO); qos_info->header.len = @@ -1986,34 +2011,31 @@ } if (!(pmpriv->host_tdls_cs_support && - ISSUPP_EXTCAP_TDLS_CHAN_SWITCH(ExCap-> - ext_cap))) - RESET_EXTCAP_TDLS_CHAN_SWITCH(ExCap-> - ext_cap); + ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + ExCap->ext_cap))) + RESET_EXTCAP_TDLS_CHAN_SWITCH( + ExCap->ext_cap); } - /*RSN ie */ + /*RSN ie*/ if (sta_ptr->rsn_ie.ieee_hdr.element_id == RSN_IE) { Rsn_ie = (MrvlIEtypes_RsnParamSet_t - *)(pos + travel_len); - Rsn_ie->header.type = - wlan_cpu_to_le16(sta_ptr->rsn_ie. - ieee_hdr.element_id); - Rsn_ie->header.len = - wlan_cpu_to_le16(sta_ptr->rsn_ie. - ieee_hdr.len); + *)(pos + travel_len); + Rsn_ie->header.type = wlan_cpu_to_le16( + sta_ptr->rsn_ie.ieee_hdr.element_id); + Rsn_ie->header.len = wlan_cpu_to_le16( + sta_ptr->rsn_ie.ieee_hdr.len); memcpy_ext(pmpriv->adapter, Rsn_ie->rsn_ie, sta_ptr->rsn_ie.data, sta_ptr->rsn_ie.ieee_hdr.len, sta_ptr->rsn_ie.ieee_hdr.len); - travel_len += - sta_ptr->rsn_ie.ieee_hdr.len + - sizeof(MrvlIEtypesHeader_t); + travel_len += sta_ptr->rsn_ie.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); } - /*Link ID */ + /*Link ID*/ if (sta_ptr->link_ie.element_id == LINK_ID) { LinkID = (MrvlIETypes_LinkIDElement_t - *)(pos + travel_len); + *)(pos + travel_len); LinkID->header.type = wlan_cpu_to_le16(LINK_ID); LinkID->header.len = wlan_cpu_to_le16(sta_ptr->link_ie.len); @@ -2022,24 +2044,23 @@ sta_ptr->link_ie.len, sizeof(LinkID->bssid)); travel_len += sta_ptr->link_ie.len + - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); } - /*HT capability */ - if (sta_ptr->HTcap.ieee_hdr.element_id == HT_CAPABILITY) { + /*HT capability*/ + if (sta_ptr->HTcap.ieee_hdr.element_id == + HT_CAPABILITY) { HTcap_tlv = (MrvlIETypes_HTCap_t *)(pos + travel_len); HTcap_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HT_CAP); - HTcap_tlv->header.len = - wlan_cpu_to_le16(sta_ptr->HTcap. - ieee_hdr.len); + HTcap_tlv->header.len = wlan_cpu_to_le16( + sta_ptr->HTcap.ieee_hdr.len); memcpy_ext(pmpriv->adapter, &HTcap_tlv->ht_cap, &sta_ptr->HTcap.ht_cap, sta_ptr->HTcap.ieee_hdr.len, sizeof(HTcap_tlv->ht_cap)); - travel_len += - sta_ptr->HTcap.ieee_hdr.len + - sizeof(MrvlIEtypesHeader_t); + travel_len += sta_ptr->HTcap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); } if (HTcap_tlv) { if (pmpriv->host_tdls_cs_support && @@ -2047,47 +2068,44 @@ wlan_fill_ht_cap_tlv(pmpriv, HTcap_tlv, BAND_A, MFALSE); else - wlan_fill_ht_cap_tlv(pmpriv, HTcap_tlv, - pbss_desc-> - bss_band, MFALSE); + wlan_fill_ht_cap_tlv( + pmpriv, HTcap_tlv, + pbss_desc->bss_band, MFALSE); DBG_HEXDUMP(MCMD_D, "FW htcap", (t_u8 *)HTcap_tlv, sizeof(MrvlIETypes_HTCap_t)); } - /*HT info */ - if (sta_ptr->HTInfo.ieee_hdr.element_id == HT_OPERATION) { + /*HT info*/ + if (sta_ptr->HTInfo.ieee_hdr.element_id == + HT_OPERATION) { HTInfo_tlv = (MrvlIETypes_HTInfo_t *)(pos + travel_len); HTInfo_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HT_INFO); - HTInfo_tlv->header.len = - wlan_cpu_to_le16(sta_ptr->HTInfo. - ieee_hdr.len); + HTInfo_tlv->header.len = wlan_cpu_to_le16( + sta_ptr->HTInfo.ieee_hdr.len); memcpy_ext(pmpriv->adapter, &HTInfo_tlv->ht_info, &sta_ptr->HTInfo.ht_info, sta_ptr->HTInfo.ieee_hdr.len, sizeof(HTInfo_tlv->ht_info)); - travel_len += - sta_ptr->HTInfo.ieee_hdr.len + - sizeof(MrvlIEtypesHeader_t); + travel_len += sta_ptr->HTInfo.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); DBG_HEXDUMP(MCMD_D, "HT Info", (t_u8 *)HTInfo_tlv, sizeof(MrvlIETypes_HTInfo_t)); } - /*20/40 BSS co-exist */ + /*20/40 BSS co-exist*/ if (sta_ptr->BSSCO_20_40.ieee_hdr.element_id == BSSCO_2040) { BSSCo = (MrvlIETypes_2040BSSCo_t *)(pos + travel_len); - BSSCo->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_2040BSS_COEXISTENCE); - BSSCo->header.len = - wlan_cpu_to_le16(sta_ptr->BSSCO_20_40. - ieee_hdr.len); + BSSCo->header.type = wlan_cpu_to_le16( + TLV_TYPE_2040BSS_COEXISTENCE); + BSSCo->header.len = wlan_cpu_to_le16( + sta_ptr->BSSCO_20_40.ieee_hdr.len); memcpy_ext(pmpriv->adapter, &BSSCo->bss_co_2040, &sta_ptr->BSSCO_20_40.bss_co_2040, sta_ptr->BSSCO_20_40.ieee_hdr.len, @@ -2098,81 +2116,142 @@ } /* Check if we need enable the 11AC */ if (sta_ptr && sta_ptr->vht_oprat.ieee_hdr.element_id == - VHT_OPERATION) { + VHT_OPERATION) { /** AID */ if (sta_ptr->aid_info.ieee_hdr.element_id == AID_INFO) { AidInfo = (MrvlIETypes_AID_t - *)(pos + travel_len); + *)(pos + travel_len); AidInfo->header.type = wlan_cpu_to_le16(AID_INFO); - AidInfo->header.len = - wlan_cpu_to_le16(sta_ptr-> - aid_info. - ieee_hdr.len); - AidInfo->AID = - wlan_cpu_to_le16(sta_ptr-> - aid_info.AID); + AidInfo->header.len = wlan_cpu_to_le16( + sta_ptr->aid_info.ieee_hdr.len); + AidInfo->AID = wlan_cpu_to_le16( + sta_ptr->aid_info.AID); + travel_len += sizeof(MrvlIETypes_AID_t); } /* Vht capability */ if (sta_ptr->vht_cap.ieee_hdr.element_id == VHT_CAPABILITY) { VHTcap_tlv = (MrvlIETypes_VHTCap_t - *)(pos + travel_len); + *)(pos + travel_len); VHTcap_tlv->header.type = - wlan_cpu_to_le16 - (VHT_CAPABILITY); - VHTcap_tlv->header.len = - wlan_cpu_to_le16(sta_ptr-> - vht_cap. - ieee_hdr.len); - memcpy_ext(pmpriv->adapter, - &VHTcap_tlv->vht_cap, - &sta_ptr->vht_cap.vht_cap, - sta_ptr->vht_cap.ieee_hdr. - len, - sizeof(VHTcap_tlv->vht_cap)); + wlan_cpu_to_le16( + VHT_CAPABILITY); + VHTcap_tlv->header + .len = wlan_cpu_to_le16( + sta_ptr->vht_cap.ieee_hdr.len); + memcpy_ext( + pmpriv->adapter, + &VHTcap_tlv->vht_cap, + &sta_ptr->vht_cap.vht_cap, + sta_ptr->vht_cap.ieee_hdr.len, + sizeof(VHTcap_tlv->vht_cap)); travel_len += sta_ptr->vht_cap.ieee_hdr.len + sizeof(MrvlIEtypesHeader_t); } if (VHTcap_tlv) { - wlan_fill_vht_cap_tlv(pmpriv, - VHTcap_tlv, - pbss_desc-> - bss_band, MTRUE, - MTRUE); - DBG_HEXDUMP(MCMD_D, "FW Vhtcap", - (t_u8 *)VHTcap_tlv, - sizeof - (MrvlIETypes_VHTCap_t)); + wlan_fill_vht_cap_tlv( + pmpriv, VHTcap_tlv, + pbss_desc->bss_band, MTRUE, + MTRUE); + DBG_HEXDUMP( + MCMD_D, + "TDLS Config Link: VHT Capability", + (t_u8 *)VHTcap_tlv, + sizeof(MrvlIETypes_VHTCap_t)); } - /*Vht operation */ + /*Vht operation*/ VHTOper_tlv = (MrvlIETypes_VHTOprat_t *)(pos + travel_len); VHTOper_tlv->header.type = wlan_cpu_to_le16(VHT_OPERATION); - VHTOper_tlv->header.len = - wlan_cpu_to_le16(sta_ptr->vht_oprat. - ieee_hdr.len); + VHTOper_tlv->header.len = wlan_cpu_to_le16( + sta_ptr->vht_oprat.ieee_hdr.len); memcpy_ext(pmpriv->adapter, &VHTOper_tlv->chan_width, &sta_ptr->vht_oprat.chan_width, sta_ptr->vht_oprat.ieee_hdr.len, - sizeof(VHTOper_tlv->chan_width)); - VHTOper_tlv->basic_MCS_map = - wlan_cpu_to_le16(VHTOper_tlv-> - basic_MCS_map); - travel_len += - sta_ptr->vht_oprat.ieee_hdr.len + - sizeof(MrvlIEtypesHeader_t); - DBG_HEXDUMP(MCMD_D, "VHT operation", + (sizeof(MrvlIETypes_VHTOprat_t) - + sizeof(MrvlIEtypesHeader_t))); + VHTOper_tlv->basic_MCS_map = wlan_cpu_to_le16( + VHTOper_tlv->basic_MCS_map); + travel_len += sta_ptr->vht_oprat.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + DBG_HEXDUMP(MCMD_D, + "TDLS Config Link: VHT operation", (t_u8 *)VHTOper_tlv, sizeof(MrvlIETypes_VHTOprat_t)); } + /* Check if we need enable the 11AX */ + if (sta_ptr && + (sta_ptr->he_op.ieee_hdr.element_id == EXTENSION) && + (sta_ptr->he_op.ext_id == HE_OPERATION)) { + /* HE Capability */ + hecap_tlv = + (MrvlIEtypes_Extension_t *)(pos + + travel_len); + /* fill the peer HE CAP IE */ + memcpy_ext(pmpriv->adapter, &hecap_tlv->ext_id, + &sta_ptr->tdls_he_cap.ext_id, + sta_ptr->tdls_he_cap.ieee_hdr.len, + sizeof(MrvlIEtypes_He_cap_t) - + sizeof(MrvlIEtypesHeader_t)); + hecap_tlv->type = + wlan_cpu_to_le16(TLV_TYPE_EXTENSION_ID); + hecap_tlv->len = MIN( + sta_ptr->tdls_he_cap.ieee_hdr.len, + sizeof(MrvlIEtypes_He_cap_t) - + sizeof(MrvlIEtypesHeader_t)); + hecap_tlv->len = + wlan_cpu_to_le16(hecap_tlv->len); +#if 0 + wlan_fill_he_cap_tlv(pmpriv, + pmpriv->config_bands, + hecap_tlv, MFALSE); +#endif + + travel_len += wlan_le16_to_cpu(hecap_tlv->len) + + sizeof(MrvlIEtypesHeader_t); + + DBG_HEXDUMP( + MCMD_D, + "TDLS Config Link: HE Capability", + (t_u8 *)hecap_tlv, + wlan_le16_to_cpu(hecap_tlv->len) + + sizeof(MrvlIEtypesHeader_t)); + + /* HE Operation */ + heop_tlv = (MrvlIEtypes_He_Op_t *)(pos + + travel_len); + heop_tlv->header.type = + wlan_cpu_to_le16(EXTENSION); + heop_tlv->header.len = wlan_cpu_to_le16( + sta_ptr->he_op.ieee_hdr.len); + memcpy_ext(pmpriv->adapter, &heop_tlv->ext_id, + &sta_ptr->he_op.ext_id, + sta_ptr->he_op.ieee_hdr.len, + sizeof(MrvlIEtypes_He_Op_t) - + sizeof(MrvlIEtypesHeader_t)); + heop_tlv->he_op_param1 = wlan_cpu_to_le16( + heop_tlv->he_op_param1); + heop_tlv->basic_he_mcs_nss = wlan_cpu_to_le16( + heop_tlv->basic_he_mcs_nss); + travel_len += + wlan_le16_to_cpu(heop_tlv->header.len) + + sizeof(MrvlIEtypesHeader_t); + DBG_HEXDUMP( + MCMD_D, + "TDLS Config Link: HE Operation", + (t_u8 *)heop_tlv, + wlan_le16_to_cpu(heop_tlv->header.len) + + sizeof(MrvlIEtypesHeader_t)); + } + TdlsIdleTimeout = (MrvlIEtypes_TDLS_Idle_Timeout_t *)(pos + travel_len); @@ -2209,10 +2288,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_sysclock_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_sysclock_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG *cfg = &cmd->params.sys_clock_cfg; mlan_ds_misc_sys_clock *clk_cfg = (mlan_ds_misc_sys_clock *)pdata_buf; @@ -2221,9 +2299,8 @@ ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_ECL_SYSTEM_CLOCK_CONFIG); - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG) + - S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG) + S_DS_GEN); cfg->action = wlan_cpu_to_le16(cmd_action); cfg->cur_sys_clk = wlan_cpu_to_le16(clk_cfg->cur_sys_clk); @@ -2246,10 +2323,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_subscribe_event(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_subscribe_event(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { mlan_ds_subscribe_evt *sub_evt = (mlan_ds_subscribe_evt *)pdata_buf; HostCmd_DS_SUBSCRIBE_EVENT *evt = @@ -2282,10 +2358,9 @@ if (sub_evt->evt_bitmap & SUBSCRIBE_EVT_RSSI_LOW) { rssi_low = (MrvlIEtypes_BeaconLowRssiThreshold_t *)tlv; rssi_low->header.type = wlan_cpu_to_le16(TLV_TYPE_RSSI_LOW); - rssi_low->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconLowRssiThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + rssi_low->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconLowRssiThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); rssi_low->value = sub_evt->low_rssi; rssi_low->frequency = sub_evt->low_rssi_freq; tlv += sizeof(MrvlIEtypes_BeaconLowRssiThreshold_t); @@ -2294,10 +2369,9 @@ if (sub_evt->evt_bitmap & SUBSCRIBE_EVT_SNR_LOW) { snr_low = (MrvlIEtypes_BeaconLowSnrThreshold_t *)tlv; snr_low->header.type = wlan_cpu_to_le16(TLV_TYPE_SNR_LOW); - snr_low->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconLowSnrThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + snr_low->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconLowSnrThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); snr_low->value = sub_evt->low_snr; snr_low->frequency = sub_evt->low_snr_freq; tlv += sizeof(MrvlIEtypes_BeaconLowSnrThreshold_t); @@ -2328,10 +2402,9 @@ if (sub_evt->evt_bitmap & SUBSCRIBE_EVT_RSSI_HIGH) { rssi_high = (MrvlIEtypes_BeaconHighRssiThreshold_t *)tlv; rssi_high->header.type = wlan_cpu_to_le16(TLV_TYPE_RSSI_HIGH); - rssi_high->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconHighRssiThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + rssi_high->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconHighRssiThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); rssi_high->value = sub_evt->high_rssi; rssi_high->frequency = sub_evt->high_rssi_freq; tlv += sizeof(MrvlIEtypes_BeaconHighRssiThreshold_t); @@ -2340,10 +2413,9 @@ if (sub_evt->evt_bitmap & SUBSCRIBE_EVT_SNR_HIGH) { snr_high = (MrvlIEtypes_BeaconHighSnrThreshold_t *)tlv; snr_high->header.type = wlan_cpu_to_le16(TLV_TYPE_SNR_HIGH); - snr_high->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_BeaconHighSnrThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + snr_high->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_BeaconHighSnrThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); snr_high->value = sub_evt->high_snr; snr_high->frequency = sub_evt->high_snr_freq; tlv += sizeof(MrvlIEtypes_BeaconHighSnrThreshold_t); @@ -2353,10 +2425,9 @@ data_rssi_low = (MrvlIEtypes_DataLowRssiThreshold_t *)tlv; data_rssi_low->header.type = wlan_cpu_to_le16(TLV_TYPE_RSSI_LOW_DATA); - data_rssi_low->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_DataLowRssiThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + data_rssi_low->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_DataLowRssiThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); data_rssi_low->value = sub_evt->data_low_rssi; data_rssi_low->frequency = sub_evt->data_low_rssi_freq; tlv += sizeof(MrvlIEtypes_DataLowRssiThreshold_t); @@ -2366,10 +2437,9 @@ data_snr_low = (MrvlIEtypes_DataLowSnrThreshold_t *)tlv; data_snr_low->header.type = wlan_cpu_to_le16(TLV_TYPE_SNR_LOW_DATA); - data_snr_low->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_DataLowSnrThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + data_snr_low->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_DataLowSnrThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); data_snr_low->value = sub_evt->data_low_snr; data_snr_low->frequency = sub_evt->data_low_snr_freq; tlv += sizeof(MrvlIEtypes_DataLowSnrThreshold_t); @@ -2379,10 +2449,9 @@ data_rssi_high = (MrvlIEtypes_DataHighRssiThreshold_t *)tlv; data_rssi_high->header.type = wlan_cpu_to_le16(TLV_TYPE_RSSI_HIGH_DATA); - data_rssi_high->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_DataHighRssiThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + data_rssi_high->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_DataHighRssiThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); data_rssi_high->value = sub_evt->data_high_rssi; data_rssi_high->frequency = sub_evt->data_high_rssi_freq; tlv += sizeof(MrvlIEtypes_DataHighRssiThreshold_t); @@ -2392,10 +2461,9 @@ data_snr_high = (MrvlIEtypes_DataHighSnrThreshold_t *)tlv; data_snr_high->header.type = wlan_cpu_to_le16(TLV_TYPE_SNR_HIGH_DATA); - data_snr_high->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_DataHighSnrThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + data_snr_high->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_DataHighSnrThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); data_snr_high->value = sub_evt->data_high_snr; data_snr_high->frequency = sub_evt->data_high_snr_freq; tlv += sizeof(MrvlIEtypes_DataHighSnrThreshold_t); @@ -2405,10 +2473,9 @@ link_quality = (MrvlIEtypes_LinkQualityThreshold_t *)tlv; link_quality->header.type = wlan_cpu_to_le16(TLV_TYPE_LINK_QUALITY); - link_quality->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_LinkQualityThreshold_t) - - sizeof(MrvlIEtypesHeader_t)); + link_quality->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_LinkQualityThreshold_t) - + sizeof(MrvlIEtypesHeader_t)); link_quality->link_snr = wlan_cpu_to_le16(sub_evt->link_snr); link_quality->link_snr_freq = wlan_cpu_to_le16(sub_evt->link_snr_freq); @@ -2449,10 +2516,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_otp_user_data(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_otp_user_data(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { mlan_ds_misc_otp_user_data *user_data = (mlan_ds_misc_otp_user_data *)pdata_buf; @@ -2476,6 +2542,46 @@ return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command of fw auto re-connect. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_cmd_fw_auto_reconnect(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) +{ + HostCmd_DS_FW_AUTO_RECONNECT *fw_auto_reconnect = + &cmd->params.fw_auto_reconnect_cmd; + mlan_ds_fw_reconnect *fw_auto_reconn = + (mlan_ds_fw_reconnect *)pdata_buf; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_FW_AUTO_RECONNECT); + cmd->size = wlan_cpu_to_le16((sizeof(HostCmd_DS_FW_AUTO_RECONNECT)) + + S_DS_GEN); + + fw_auto_reconnect->action = wlan_cpu_to_le16(cmd_action); + + if (cmd_action == HostCmd_ACT_GEN_SET) { + fw_auto_reconnect->reconnect_counter = + fw_auto_reconn->fw_reconn_counter; + fw_auto_reconnect->reconnect_interval = + fw_auto_reconn->fw_reconn_interval; + fw_auto_reconnect->flags = + wlan_cpu_to_le16(fw_auto_reconn->fw_reconn_flags); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + #ifdef USB /** * @brief This function prepares command of packet aggragation @@ -2512,11 +2618,9 @@ wlan_cpu_to_le16(MRVL_USB_AGGR_PARAM_TLV_ID); usb_aggr_param_tlv->header.len = wlan_cpu_to_le16(MRVL_USB_AGGR_PARAM_TLV_LEN); - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE) + - S_DS_GEN + MRVL_USB_AGGR_PARAM_TLV_LEN + - sizeof(MrvlIEtypesHeader_t) - 1); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE) + S_DS_GEN + + MRVL_USB_AGGR_PARAM_TLV_LEN + sizeof(MrvlIEtypesHeader_t) - 1); if (pmadapter->data_sent || (!wlan_bypass_tx_list_empty(pmadapter)) || (!wlan_wmm_lists_empty(pmadapter))) { @@ -2531,23 +2635,18 @@ usb_aggr_param_tlv->enable = 0; if (usb_aggr_ctrl->tx_aggr_ctrl.enable) usb_aggr_param_tlv->enable |= MBIT(1); - usb_aggr_param_tlv->tx_aggr_align = - wlan_cpu_to_le16(usb_aggr_ctrl->tx_aggr_ctrl. - aggr_align); + usb_aggr_param_tlv->tx_aggr_align = wlan_cpu_to_le16( + usb_aggr_ctrl->tx_aggr_ctrl.aggr_align); if (usb_aggr_ctrl->rx_deaggr_ctrl.enable) usb_aggr_param_tlv->enable |= MBIT(0); - usb_aggr_param_tlv->rx_aggr_mode = - wlan_cpu_to_le16(usb_aggr_ctrl->rx_deaggr_ctrl. - aggr_mode); - usb_aggr_param_tlv->rx_aggr_align = - wlan_cpu_to_le16(usb_aggr_ctrl->rx_deaggr_ctrl. - aggr_align); - usb_aggr_param_tlv->rx_aggr_max = - wlan_cpu_to_le16(usb_aggr_ctrl->rx_deaggr_ctrl. - aggr_max); - usb_aggr_param_tlv->rx_aggr_tmo = - wlan_cpu_to_le16(usb_aggr_ctrl->rx_deaggr_ctrl. - aggr_tmo); + usb_aggr_param_tlv->rx_aggr_mode = wlan_cpu_to_le16( + usb_aggr_ctrl->rx_deaggr_ctrl.aggr_mode); + usb_aggr_param_tlv->rx_aggr_align = wlan_cpu_to_le16( + usb_aggr_ctrl->rx_deaggr_ctrl.aggr_align); + usb_aggr_param_tlv->rx_aggr_max = wlan_cpu_to_le16( + usb_aggr_ctrl->rx_deaggr_ctrl.aggr_max); + usb_aggr_param_tlv->rx_aggr_tmo = wlan_cpu_to_le16( + usb_aggr_ctrl->rx_deaggr_ctrl.aggr_tmo); usb_aggr_param_tlv->enable = wlan_cpu_to_le16(usb_aggr_param_tlv->enable); } @@ -2565,9 +2664,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_inactivity_timeout(HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_inactivity_timeout(HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { pmlan_ds_inactivity_to inac_to; HostCmd_DS_INACTIVITY_TIMEOUT_EXT *cmd_inac_to = @@ -2597,6 +2696,89 @@ } /** + * @brief This function prepares network monitor command + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_net_monitor(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + mlan_ds_misc_net_monitor *net_mon; + HostCmd_DS_802_11_NET_MONITOR *cmd_net_mon = &cmd->params.net_mon; + ChanBandParamSet_t *pchan_band = MNULL; + t_u8 sec_chan_offset = 0; + t_u32 bw_offset = 0; + + ENTER(); + + net_mon = (mlan_ds_misc_net_monitor *)pdata_buf; + + cmd->size = wlan_cpu_to_le16(S_DS_GEN + + sizeof(HostCmd_DS_802_11_NET_MONITOR)); + cmd->command = wlan_cpu_to_le16(cmd->command); + cmd_net_mon->action = wlan_cpu_to_le16(cmd_action); + if (cmd_action == HostCmd_ACT_GEN_SET) { + if (net_mon->enable_net_mon) { + cmd_net_mon->enable_net_mon = + wlan_cpu_to_le16((t_u16)NET_MON_MODE1); + cmd_net_mon->filter_flag = + wlan_cpu_to_le16((t_u16)net_mon->filter_flag); + } + if (net_mon->enable_net_mon && net_mon->channel) { + pchan_band = + &cmd_net_mon->monitor_chan.chan_band_param[0]; + cmd_net_mon->monitor_chan.header.type = + wlan_cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); + cmd_net_mon->monitor_chan.header.len = + wlan_cpu_to_le16(sizeof(ChanBandParamSet_t)); + pchan_band->chan_number = (t_u8)net_mon->channel; + pchan_band->bandcfg.chanBand = + wlan_band_to_radio_type((t_u16)net_mon->band); + + if (net_mon->band & BAND_GN || + net_mon->band & BAND_AN || + net_mon->band & BAND_GAC || + net_mon->band & BAND_AAC) { + bw_offset = net_mon->chan_bandwidth; + if (bw_offset == CHANNEL_BW_40MHZ_ABOVE) { + pchan_band->bandcfg.chan2Offset = + SEC_CHAN_ABOVE; + pchan_band->bandcfg.chanWidth = + CHAN_BW_40MHZ; + } else if (bw_offset == + CHANNEL_BW_40MHZ_BELOW) { + pchan_band->bandcfg.chan2Offset = + SEC_CHAN_BELOW; + pchan_band->bandcfg.chanWidth = + CHAN_BW_40MHZ; + } else if (bw_offset == CHANNEL_BW_80MHZ) { + sec_chan_offset = + wlan_get_second_channel_offset( + pmpriv, + net_mon->channel); + if (sec_chan_offset == SEC_CHAN_ABOVE) + pchan_band->bandcfg.chan2Offset = + SEC_CHAN_ABOVE; + else if (sec_chan_offset == + SEC_CHAN_BELOW) + pchan_band->bandcfg.chan2Offset = + SEC_CHAN_BELOW; + pchan_band->bandcfg.chanWidth = + CHAN_BW_80MHZ; + } + } + } + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares Low Power Mode * * @param pmpriv A pointer to mlan_private structure @@ -2606,9 +2788,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_low_pwr_mode(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +static mlan_status wlan_cmd_low_pwr_mode(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_CONFIG_LOW_PWR_MODE *cmd_lpm_cfg = &cmd->params.low_pwr_mode_cfg; @@ -2637,10 +2819,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_dfs_repeater_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_dfs_repeater_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { mlan_ds_misc_dfs_repeater *dfs_repeater = MNULL; HostCmd_DS_DFS_REPEATER_MODE *cmd_dfs_repeater = @@ -2672,22 +2854,22 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_cmd_coalesce_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_coalesce_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_COALESCE_CONFIG *coalesce_config = &cmd->params.coalesce_config; - mlan_ds_coalesce_cfg *cfg = (mlan_ds_coalesce_cfg *) pdata_buf; + mlan_ds_coalesce_cfg *cfg = (mlan_ds_coalesce_cfg *)pdata_buf; t_u16 cnt, idx, length; struct coalesce_filt_field_param *param; struct coalesce_receive_filt_rule *rule; ENTER(); - cmd->size = (sizeof(HostCmd_DS_COALESCE_CONFIG) - - sizeof(struct coalesce_receive_filt_rule)) + S_DS_GEN; + cmd->size = (sizeof(HostCmd_DS_COALESCE_CONFIG) - + sizeof(struct coalesce_receive_filt_rule)) + + S_DS_GEN; cmd->command = wlan_cpu_to_le16(HostCmd_CMD_COALESCE_CFG); coalesce_config->action = wlan_cpu_to_le16(cmd_action); coalesce_config->num_of_rules = wlan_cpu_to_le16(cfg->num_of_rules); @@ -2696,34 +2878,32 @@ for (cnt = 0; cnt < cfg->num_of_rules; cnt++) { rule->header.type = wlan_cpu_to_le16(TLV_TYPE_COALESCE_RULE); - rule->max_coalescing_delay = - wlan_cpu_to_le16(cfg->rule[cnt]. - max_coalescing_delay); + rule->max_coalescing_delay = wlan_cpu_to_le16( + cfg->rule[cnt].max_coalescing_delay); rule->pkt_type = cfg->rule[cnt].pkt_type; rule->num_of_fields = cfg->rule[cnt].num_of_fields; length = 0; param = rule->params; - for (idx = 0; idx < cfg->rule[cnt].num_of_fields; idx++) { + for (idx = 0; idx < cfg->rule[cnt].num_of_fields; + idx++) { param->operation = cfg->rule[cnt].params[idx].operation; param->operand_len = cfg->rule[cnt].params[idx].operand_len; - param->offset = - wlan_cpu_to_le16(cfg->rule[cnt]. - params[idx].offset); + param->offset = wlan_cpu_to_le16( + cfg->rule[cnt].params[idx].offset); memcpy_ext(pmpriv->adapter, param->operand_byte_stream, cfg->rule[cnt] - .params[idx] - .operand_byte_stream, + .params[idx] + .operand_byte_stream, param->operand_len, sizeof(param->operand_byte_stream)); - length += - sizeof(struct - coalesce_filt_field_param); + length += sizeof( + struct coalesce_filt_field_param); param++; } @@ -2736,9 +2916,9 @@ wlan_cpu_to_le16(length + sizeof(t_u16) + sizeof(t_u8) + sizeof(t_u8)); - /* Add the rule length to the command size */ + /* Add the rule length to the command size*/ cmd->size += wlan_le16_to_cpu(rule->header.len) + - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); rule = (void *)((t_u8 *)rule->params + length); } @@ -2752,25 +2932,6 @@ * Global Functions ********************************************************/ -static mlan_status -wlan_cmd_get_sensor_temp(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action) -{ - ENTER(); - - if (cmd_action != HostCmd_ACT_GEN_GET) { - PRINTM(MERROR, "wlan_cmd_get_sensor_temp: support GET only.\n"); - LEAVE(); - return MLAN_STATUS_FAILURE; - } - - cmd->command = wlan_cpu_to_le16(HostCmd_DS_GET_SENSOR_TEMP); - cmd->size = wlan_cpu_to_le16(S_DS_GEN + 4); - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function prepares command of arb cfg * @@ -2780,26 +2941,25 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_arb_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CMD_ARB_CONFIG *cfg_cmd = - (HostCmd_DS_CMD_ARB_CONFIG *) & cmd->params.arb_cfg; - mlan_ds_misc_arb_cfg *misc_cfg = (mlan_ds_misc_arb_cfg *) pdata_buf; + (HostCmd_DS_CMD_ARB_CONFIG *)&cmd->params.arb_cfg; + mlan_ds_misc_arb_cfg *misc_cfg = (mlan_ds_misc_arb_cfg *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_ARB_CONFIG); - cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_CMD_ARB_CONFIG) + - S_DS_GEN); + cmd->size = + wlan_cpu_to_le16(sizeof(HostCmd_DS_CMD_ARB_CONFIG) + S_DS_GEN); cfg_cmd->action = wlan_cpu_to_le16(cmd_action); if (cmd_action == HostCmd_ACT_GEN_SET) { cfg_cmd->arb_mode = wlan_cpu_to_le32(misc_cfg->arb_mode); if (misc_cfg->arb_mode == 3) { -#define DEF_ARB_TX_WIN 4 -#define DEF_ARB_TIMEOUT 0 +#define DEF_ARB_TX_WIN 4 +#define DEF_ARB_TIMEOUT 0 pmpriv->add_ba_param.timeout = DEF_ARB_TIMEOUT; pmpriv->add_ba_param.tx_win_size = DEF_ARB_TX_WIN; } else { @@ -2824,14 +2984,13 @@ * @return N/A */ -mlan_status -wlan_cmd_ipv6_ra_offload(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, - void *pdata_buf) +mlan_status wlan_cmd_ipv6_ra_offload(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, + void *pdata_buf) { HostCmd_DS_IPV6_RA_OFFLOAD *ipv6_ra_cfg = &pcmd->params.ipv6_ra_offload; mlan_ds_misc_ipv6_ra_offload *ipv6_ra_offload = - (mlan_ds_misc_ipv6_ra_offload *) pdata_buf; + (mlan_ds_misc_ipv6_ra_offload *)pdata_buf; MrvlIEtypesHeader_t *ie = &ipv6_ra_cfg->ipv6_addr_param.Header; ENTER(); @@ -2846,9 +3005,8 @@ ipv6_ra_cfg->ipv6_addr_param.ipv6_addr, ipv6_ra_offload->ipv6_addr, 16, sizeof(ipv6_ra_cfg->ipv6_addr_param.ipv6_addr)); - pcmd->size = - wlan_cpu_to_le16(S_DS_GEN + - sizeof(HostCmd_DS_IPV6_RA_OFFLOAD)); + pcmd->size = wlan_cpu_to_le16( + S_DS_GEN + sizeof(HostCmd_DS_IPV6_RA_OFFLOAD)); } else if (cmd_action == HostCmd_ACT_GEN_GET) pcmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(ipv6_ra_cfg->action)); @@ -2864,11 +3022,11 @@ * @param cmd Hostcmd ID * @return N/A */ -static mlan_status -wlan_cmd_sta_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, - mlan_ioctl_req *pioctl_buf, t_void *pdata_buf) +static mlan_status wlan_cmd_sta_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + mlan_ioctl_req *pioctl_buf, + t_void *pdata_buf) { mlan_ds_bss *bss = MNULL; HostCmd_DS_STA_CONFIGURE *sta_cfg_cmd = &cmd->params.sta_cfg; @@ -2885,22 +3043,19 @@ (cmd_action == HostCmd_ACT_GEN_GET)) { cmd->command = wlan_cpu_to_le16(HostCmd_CMD_STA_CONFIGURE); - cmd->size = - wlan_cpu_to_le16(S_DS_GEN + - sizeof - (HostCmd_DS_STA_CONFIGURE) + - sizeof(*tlv_band_channel)); + cmd->size = wlan_cpu_to_le16( + S_DS_GEN + sizeof(HostCmd_DS_STA_CONFIGURE) + + sizeof(*tlv_band_channel)); sta_cfg_cmd->action = wlan_cpu_to_le16(cmd_action); tlv_band_channel = (MrvlIEtypes_channel_band_t *) - sta_cfg_cmd->tlv_buffer; + sta_cfg_cmd->tlv_buffer; memset(pmpriv->adapter, tlv_band_channel, 0x00, sizeof(*tlv_band_channel)); tlv_band_channel->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); - tlv_band_channel->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_channel_band_t) - - sizeof(MrvlIEtypesHeader_t)); + tlv_band_channel->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_channel_band_t) - + sizeof(MrvlIEtypesHeader_t)); ret = MLAN_STATUS_SUCCESS; } } @@ -2910,6 +3065,379 @@ } /** + * @brief This function prepare the config tlvs of roam offload. + * + * @param priv A pointer to mlan_private structure + * @param tlv_no TLV type + * @param value Pointer to mlan_ds_misc_roam_offload structure + * @param pointer Value of trigger_condition + * @param size Pointer to the buffer of HostCmd_DS_ROAM_OFFLOAD + * @return N/A + */ +static t_u16 mlan_prepare_roam_offload_tlv(pmlan_private pmpriv, t_u32 type, + mlan_ds_misc_roam_offload *roam, + t_u8 trigger_condition, t_u8 *pos) +{ + MrvlIEtypes_fw_roam_enable_t *enable_tlv = MNULL; + MrvlIEtypes_fw_roam_trigger_condition_t *trigger_condition_tlv = MNULL; + MrvlIEtypes_Bssid_t *bssid_tlv = MNULL; + MrvlIEtypes_SsIdParamSet_t *ssid_tlv = MNULL; + MrvlIEtypes_fw_roam_retry_count_t *retry_count_tlv = MNULL; + MrvlIEtypes_para_rssi_t *rssi_para_tlv = MNULL; + MrvlIEtypes_fw_roam_bgscan_setting_t *bgscan_set_tlv = MNULL; + MrvlIEtypes_roam_blacklist_t *blacklist_tlv = MNULL; + MrvlIEtypes_ees_param_set_t *ees_param_tlv = MNULL; + MrvlIEtypes_band_rssi_t *band_rssi_tlv = MNULL; + MrvlIEtypes_beacon_miss_threshold_t *bcn_miss_threshold_tlv = MNULL; + MrvlIEtypes_pre_beacon_miss_threshold_t *pre_bcn_miss_threshold_tlv = + MNULL; + MrvlIEtypes_RepeatCount_t *tlv_repeat = MNULL; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}, *begin; + int i = 0; + + ENTER(); + + begin = pos; + if (type & FW_ROAM_ENABLE) { + enable_tlv = (MrvlIEtypes_fw_roam_enable_t *)pos; + enable_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_ROAM); + enable_tlv->header.len = + wlan_cpu_to_le16(sizeof(MrvlIEtypes_fw_roam_enable_t) - + sizeof(MrvlIEtypesHeader_t)); + if (roam->enable <= ROAM_OFFLOAD_WITHOUT_APLIST) + enable_tlv->roam_enable = roam->enable; + else + enable_tlv->roam_enable = ROAM_OFFLOAD_WITHOUT_APLIST; + pos += sizeof(MrvlIEtypes_fw_roam_enable_t); + } + if (type & FW_ROAM_TRIGGER_COND) { + trigger_condition_tlv = + (MrvlIEtypes_fw_roam_trigger_condition_t *)pos; + trigger_condition_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_ROM_TRIGGER); + trigger_condition_tlv->header.len = wlan_cpu_to_le16( + sizeof(trigger_condition_tlv->trigger_condition)); + trigger_condition_tlv->trigger_condition = + wlan_cpu_to_le16(trigger_condition); + pos += sizeof(trigger_condition_tlv->header) + + sizeof(trigger_condition_tlv->trigger_condition); + } + if (type & FW_ROAM_BSSID) { + bssid_tlv = (MrvlIEtypes_Bssid_t *)pos; + bssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_BSSID); + bssid_tlv->header.len = + wlan_cpu_to_le16(sizeof(bssid_tlv->bssid)); + if (memcmp(pmpriv->adapter, roam->bssid_reconnect, zero_mac, + sizeof(zero_mac)) != 0) + memcpy_ext(pmpriv->adapter, bssid_tlv->bssid, + roam->bssid_reconnect, + sizeof(bssid_tlv->bssid), + sizeof(bssid_tlv->bssid)); + else { + if (roam->config_mode == ROAM_OFFLOAD_SUSPEND_CFG) + memcpy_ext(pmpriv->adapter, bssid_tlv->bssid, + pmpriv->curr_bss_params + .bss_descriptor.mac_address, + sizeof(bssid_tlv->bssid), + sizeof(bssid_tlv->bssid)); + else if (roam->config_mode == ROAM_OFFLOAD_RESUME_CFG) + memcpy_ext(pmpriv->adapter, bssid_tlv->bssid, + zero_mac, sizeof(bssid_tlv->bssid), + sizeof(bssid_tlv->bssid)); + } + pos += sizeof(bssid_tlv->header) + sizeof(bssid_tlv->bssid); + } + if (type & FW_ROAM_SSID) { + for (i = 0; i < roam->ssid_list.ssid_num; i++) { + ssid_tlv = (MrvlIEtypes_SsIdParamSet_t *)pos; + ssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_SSID); + memcpy_ext(pmpriv->adapter, ssid_tlv->ssid, + roam->ssid_list.ssids[i].ssid, + roam->ssid_list.ssids[i].ssid_len, + roam->ssid_list.ssids[i].ssid_len); + pos += sizeof(ssid_tlv->header) + + wlan_strlen(ssid_tlv->ssid); + ssid_tlv->header.len = + wlan_cpu_to_le16(wlan_strlen(ssid_tlv->ssid)); + } + if (!roam->ssid_list.ssid_num) { + ssid_tlv = (MrvlIEtypes_SsIdParamSet_t *)pos; + ssid_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_SSID); + memcpy_ext( + pmpriv->adapter, ssid_tlv->ssid, + pmpriv->curr_bss_params.bss_descriptor.ssid.ssid, + pmpriv->curr_bss_params.bss_descriptor.ssid + .ssid_len, + pmpriv->curr_bss_params.bss_descriptor.ssid + .ssid_len); + ssid_tlv->header.len = + wlan_cpu_to_le16(wlan_strlen(ssid_tlv->ssid)); + pos += sizeof(ssid_tlv->header) + ssid_tlv->header.len; + } + } + if (type & FW_ROAM_RETRY_COUNT) { + retry_count_tlv = (MrvlIEtypes_fw_roam_retry_count_t *)pos; + retry_count_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_ROM_RETRY_COUNT); + retry_count_tlv->header.len = + wlan_cpu_to_le16(sizeof(retry_count_tlv->retry_count)); + if (roam->retry_count) + retry_count_tlv->retry_count = + wlan_cpu_to_le16(roam->retry_count); + else + retry_count_tlv->retry_count = + wlan_cpu_to_le16(RETRY_UNLIMITED_TIME); + pos += sizeof(retry_count_tlv->header) + + sizeof(retry_count_tlv->retry_count); + } + if (type & FW_ROAM_RSSI_PARA) { + rssi_para_tlv = (MrvlIEtypes_para_rssi_t *)pos; + rssi_para_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_ROM_PARA_RSSI); + rssi_para_tlv->header.len = + wlan_cpu_to_le16(sizeof(rssi_para_tlv->max_rssi) + + sizeof(rssi_para_tlv->min_rssi) + + sizeof(rssi_para_tlv->step_rssi)); + rssi_para_tlv->max_rssi = roam->para_rssi.max_rssi; + rssi_para_tlv->min_rssi = roam->para_rssi.min_rssi; + rssi_para_tlv->step_rssi = roam->para_rssi.step_rssi; + pos += sizeof(rssi_para_tlv->header) + + sizeof(rssi_para_tlv->max_rssi) + + sizeof(rssi_para_tlv->min_rssi) + + sizeof(rssi_para_tlv->step_rssi); + } + if (type & FW_ROAM_BAND_RSSI) { + band_rssi_tlv = (MrvlIEtypes_band_rssi_t *)pos; + band_rssi_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_BAND_RSSI); + band_rssi_tlv->header.len = + wlan_cpu_to_le16(sizeof(MrvlIEtypes_band_rssi_t) - + sizeof(MrvlIEtypesHeader_t)); + band_rssi_tlv->band_rssi.band_preferred = + roam->band_rssi.band_preferred; + band_rssi_tlv->band_rssi.rssi_hysteresis = + roam->band_rssi.rssi_hysteresis; + pos += sizeof(MrvlIEtypes_band_rssi_t); + } + + if (type & FW_ROAM_BGSCAN_PARAM) { + bgscan_set_tlv = (MrvlIEtypes_fw_roam_bgscan_setting_t *)pos; + bgscan_set_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_ROM_BGSCAN); + bgscan_set_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_fw_roam_bgscan_setting_t) - + sizeof(MrvlIEtypesHeader_t)); + bgscan_set_tlv->bss_type = roam->bgscan_cfg.bss_type; + bgscan_set_tlv->channels_perscan = + roam->bgscan_cfg.channels_per_scan; + bgscan_set_tlv->scan_interval = + wlan_cpu_to_le32(roam->bgscan_cfg.scan_interval); + bgscan_set_tlv->report_condition = + wlan_cpu_to_le32(roam->bgscan_cfg.bg_rpt_condition); + pos += sizeof(MrvlIEtypes_fw_roam_bgscan_setting_t); + } + + if (type & FW_ROAM_EES_PARAM) { + ees_param_tlv = (MrvlIEtypes_ees_param_set_t *)pos; + ees_param_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_ENERGYEFFICIENTSCAN); + ees_param_tlv->header.len = + wlan_cpu_to_le16(sizeof(MrvlIEtypes_ees_param_set_t) - + sizeof(MrvlIEtypesHeader_t)); + ees_param_tlv->ees_cfg.ees_mode = + wlan_cpu_to_le16(roam->ees_cfg.ees_mode); + ees_param_tlv->ees_cfg.ees_rpt_condition = + wlan_cpu_to_le16(roam->ees_cfg.ees_rpt_condition); + ees_param_tlv->ees_cfg.high_scan_period = + wlan_cpu_to_le16(roam->ees_cfg.high_scan_period); + ees_param_tlv->ees_cfg.high_scan_count = + wlan_cpu_to_le16(roam->ees_cfg.high_scan_count); + ees_param_tlv->ees_cfg.mid_scan_period = + wlan_cpu_to_le16(roam->ees_cfg.mid_scan_period); + ees_param_tlv->ees_cfg.mid_scan_count = + wlan_cpu_to_le16(roam->ees_cfg.mid_scan_count); + ees_param_tlv->ees_cfg.low_scan_period = + wlan_cpu_to_le16(roam->ees_cfg.low_scan_period); + ees_param_tlv->ees_cfg.low_scan_count = + wlan_cpu_to_le16(roam->ees_cfg.low_scan_count); + pos += sizeof(MrvlIEtypes_ees_param_set_t); + } + + if (type & FW_ROAM_BCN_MISS_THRESHOLD) { + bcn_miss_threshold_tlv = + (MrvlIEtypes_beacon_miss_threshold_t *)pos; + bcn_miss_threshold_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_BCNMISS); + bcn_miss_threshold_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_beacon_miss_threshold_t) - + sizeof(MrvlIEtypesHeader_t)); + bcn_miss_threshold_tlv->bcn_miss_threshold = + roam->bcn_miss_threshold; + pos += sizeof(MrvlIEtypes_beacon_miss_threshold_t); + } + + if (type & FW_ROAM_PRE_BCN_MISS_THRESHOLD) { + pre_bcn_miss_threshold_tlv = + (MrvlIEtypes_pre_beacon_miss_threshold_t *)pos; + pre_bcn_miss_threshold_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_PRE_BCNMISS); + pre_bcn_miss_threshold_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_pre_beacon_miss_threshold_t) - + sizeof(MrvlIEtypesHeader_t)); + pre_bcn_miss_threshold_tlv->pre_bcn_miss_threshold = + roam->pre_bcn_miss_threshold; + pos += sizeof(MrvlIEtypes_pre_beacon_miss_threshold_t); + } + + if (type & FW_ROAM_BLACKLIST) { + blacklist_tlv = (MrvlIEtypes_roam_blacklist_t *)pos; + blacklist_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_BLACKLIST_BSSID); + blacklist_tlv->header.len = + roam->black_list.ap_num * MLAN_MAC_ADDR_LENGTH + + sizeof(roam->black_list.ap_num); + memcpy_ext(pmpriv->adapter, (t_u8 *)&blacklist_tlv->blacklist, + (t_u8 *)&roam->black_list, blacklist_tlv->header.len, + sizeof(blacklist_tlv->blacklist)); + pos += sizeof(MrvlIEtypesHeader_t) + blacklist_tlv->header.len; + blacklist_tlv->header.len = + wlan_cpu_to_le16(blacklist_tlv->header.len); + } + + if (type & FW_ROAM_REPEAT_CNT) { + tlv_repeat = (MrvlIEtypes_RepeatCount_t *)pos; + tlv_repeat->header.type = + wlan_cpu_to_le16(TLV_TYPE_REPEAT_COUNT); + tlv_repeat->header.len = + wlan_cpu_to_le16(sizeof(MrvlIEtypes_RepeatCount_t) - + sizeof(MrvlIEtypesHeader_t)); + tlv_repeat->repeat_count = wlan_cpu_to_le16(roam->repeat_count); + pos += sizeof(MrvlIEtypes_RepeatCount_t); + } + LEAVE(); + return (pos - begin); +} +/** + * @brief This function sends enable/disable roam offload command to firmware. + * + * @param pmpriv A pointer to mlan_private structure + * @param pcmd Hostcmd ID + * @param cmd_action Command action + * @return N/A + */ +static mlan_status wlan_cmd_roam_offload(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_ROAM_OFFLOAD *roam_cmd = &cmd->params.roam_offload; + MrvlIEtypes_roam_aplist_t *aplist = MNULL; + t_u8 *pos = (t_u8 *)roam_cmd + sizeof(roam_cmd->action); + mlan_ds_misc_roam_offload *roam = MNULL; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; + t_u32 type = 0; + t_u8 trigger_condition = 0; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_ROAM_OFFLOAD); + cmd->size = S_DS_GEN + sizeof(HostCmd_DS_ROAM_OFFLOAD); + roam_cmd->action = wlan_cpu_to_le16(cmd_action); + + roam = (mlan_ds_misc_roam_offload *)pdata_buf; + + if (roam->config_mode) { + switch (roam->config_mode) { + case ROAM_OFFLOAD_ENABLE: + type |= FW_ROAM_ENABLE; + if (roam->enable && roam->enable != AUTO_RECONNECT) { + type |= FW_ROAM_TRIGGER_COND; + trigger_condition |= RSSI_LOW_TRIGGER | + PRE_BEACON_LOST_TRIGGER; + } + break; + case ROAM_OFFLOAD_SUSPEND_CFG: + type |= FW_ROAM_TRIGGER_COND | FW_ROAM_RETRY_COUNT; + if (roam->enable == AUTO_RECONNECT) { + type |= FW_ROAM_BSSID | FW_ROAM_SSID; + trigger_condition = LINK_LOST_TRIGGER | + DEAUTH_WITH_EXT_AP_TRIGGER; + } else + trigger_condition = LINK_LOST_TRIGGER | + DEAUTH_WITH_EXT_AP_TRIGGER | + RSSI_LOW_TRIGGER | + PRE_BEACON_LOST_TRIGGER; + + if (roam->enable == ROAM_OFFLOAD_WITH_BSSID) + type |= FW_ROAM_BSSID; + if (roam->enable == ROAM_OFFLOAD_WITH_SSID) + type |= FW_ROAM_SSID; + break; + case ROAM_OFFLOAD_RESUME_CFG: + type |= FW_ROAM_TRIGGER_COND; + if (roam->enable == AUTO_RECONNECT) + trigger_condition = NO_TRIGGER; + else + trigger_condition = RSSI_LOW_TRIGGER | + PRE_BEACON_LOST_TRIGGER; + if (roam->enable == ROAM_OFFLOAD_WITH_BSSID || + roam->enable == AUTO_RECONNECT) + type |= FW_ROAM_BSSID; + break; + case ROAM_OFFLOAD_PARAM_CFG: + if (roam->enable && roam->enable != AUTO_RECONNECT) { + if (roam->retry_count != 0) + type |= FW_ROAM_RETRY_COUNT; + if (roam->ssid_list.ssid_num) + type |= FW_ROAM_SSID; + if (roam->para_rssi.set_flag) + type |= FW_ROAM_RSSI_PARA; + if (memcmp(pmpriv->adapter, + roam->bssid_reconnect, zero_mac, + sizeof(zero_mac)) != 0) + type |= FW_ROAM_BSSID; + if (roam->band_rssi_flag) + type |= FW_ROAM_BAND_RSSI; + if (roam->bgscan_set_flag) + type |= FW_ROAM_BGSCAN_PARAM; + if (roam->ees_param_set_flag) + type |= FW_ROAM_EES_PARAM; + if (roam->bcn_miss_threshold) + type |= FW_ROAM_BCN_MISS_THRESHOLD; + if (roam->pre_bcn_miss_threshold) + type |= FW_ROAM_PRE_BCN_MISS_THRESHOLD; + if (roam->black_list.ap_num) + type |= FW_ROAM_BLACKLIST; + if (roam->trigger_condition != 0xff) { + type |= FW_ROAM_TRIGGER_COND; + trigger_condition = + roam->trigger_condition; + } + if (roam->repeat_count) + type |= FW_ROAM_REPEAT_CNT; + } + break; + } + cmd->size += mlan_prepare_roam_offload_tlv( + pmpriv, type, roam, trigger_condition, pos); + } + if (roam->aplist.ap_num) { + aplist = (MrvlIEtypes_roam_aplist_t *)pos; + aplist->header.type = wlan_cpu_to_le16(TLV_TYPE_APLIST); + aplist->header.len = roam->aplist.ap_num * MLAN_MAC_ADDR_LENGTH; + memcpy_ext(pmpriv->adapter, aplist->ap_mac, roam->aplist.ap_mac, + roam->aplist.ap_num * MLAN_MAC_ADDR_LENGTH, + roam->aplist.ap_num * MLAN_MAC_ADDR_LENGTH); + pos += sizeof(aplist->header) + aplist->header.len; + cmd->size += sizeof(aplist->header) + aplist->header.len; + aplist->header.len = wlan_cpu_to_le16(aplist->header.len); + } + cmd->size = wlan_cpu_to_le16(cmd->size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function sends set and get auto tx command to firmware. * * @param pmpriv A pointer to mlan_private structure @@ -2919,10 +3447,9 @@ * @param pdata_buf A void pointer to information buffer * @return N/A */ -static mlan_status -wlan_cmd_auto_tx(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u32 cmd_oid, t_void *pdata_buf) +static mlan_status wlan_cmd_auto_tx(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_u32 cmd_oid, t_void *pdata_buf) { HostCmd_DS_AUTO_TX *auto_tx_cmd = &cmd->params.auto_tx; t_u8 *pos = (t_u8 *)auto_tx_cmd->tlv_buffer; @@ -2931,7 +3458,7 @@ MrvlIEtypes_Keep_Alive_Ctrl_t *ctrl_tlv = MNULL; MrvlIEtypes_Keep_Alive_Pkt_t *pkt_tlv = MNULL; mlan_ds_misc_keep_alive *misc_keep_alive = MNULL; - t_u8 eth_ip[] = { 0x08, 0x00 }; + t_u8 eth_ip[] = {0x08, 0x00}; ENTER(); @@ -2941,47 +3468,38 @@ switch (cmd_oid) { case OID_CLOUD_KEEP_ALIVE: - misc_keep_alive = (mlan_ds_misc_keep_alive *) pdata_buf; - keep_alive_tlv = (MrvlIEtypes_Cloud_Keep_Alive_t *) pos; + misc_keep_alive = (mlan_ds_misc_keep_alive *)pdata_buf; + keep_alive_tlv = (MrvlIEtypes_Cloud_Keep_Alive_t *)pos; keep_alive_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_CLOUD_KEEP_ALIVE); keep_alive_tlv->keep_alive_id = misc_keep_alive->mkeep_alive_id; keep_alive_tlv->enable = misc_keep_alive->enable; len = len + sizeof(keep_alive_tlv->keep_alive_id) + - sizeof(keep_alive_tlv->enable); + sizeof(keep_alive_tlv->enable); pos = pos + len + sizeof(MrvlIEtypesHeader_t); if (cmd_action == HostCmd_ACT_GEN_SET) { if (misc_keep_alive->enable) { - ctrl_tlv = - (MrvlIEtypes_Keep_Alive_Ctrl_t *) pos; - ctrl_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_KEEP_ALIVE_CTRL); - ctrl_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_Keep_Alive_Ctrl_t) - - - sizeof - (MrvlIEtypesHeader_t)); - ctrl_tlv->snd_interval = - wlan_cpu_to_le32(misc_keep_alive-> - send_interval); - ctrl_tlv->retry_interval = - wlan_cpu_to_le16(misc_keep_alive-> - retry_interval); - ctrl_tlv->retry_count = - wlan_cpu_to_le16(misc_keep_alive-> - retry_count); + ctrl_tlv = (MrvlIEtypes_Keep_Alive_Ctrl_t *)pos; + ctrl_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_KEEP_ALIVE_CTRL); + ctrl_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_Keep_Alive_Ctrl_t) - + sizeof(MrvlIEtypesHeader_t)); + ctrl_tlv->snd_interval = wlan_cpu_to_le32( + misc_keep_alive->send_interval); + ctrl_tlv->retry_interval = wlan_cpu_to_le16( + misc_keep_alive->retry_interval); + ctrl_tlv->retry_count = wlan_cpu_to_le16( + misc_keep_alive->retry_count); len = len + - sizeof(MrvlIEtypes_Keep_Alive_Ctrl_t); + sizeof(MrvlIEtypes_Keep_Alive_Ctrl_t); pos = pos + - sizeof(MrvlIEtypes_Keep_Alive_Ctrl_t); - pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *) pos; - pkt_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_KEEP_ALIVE_PKT); + sizeof(MrvlIEtypes_Keep_Alive_Ctrl_t); + pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *)pos; + pkt_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_KEEP_ALIVE_PKT); memcpy_ext(pmpriv->adapter, pkt_tlv->eth_header.dest_addr, misc_keep_alive->dst_mac, @@ -2992,38 +3510,41 @@ misc_keep_alive->src_mac, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - memcpy_ext(pmpriv->adapter, - (t_u8 *)&pkt_tlv->eth_header. - h803_len, eth_ip, sizeof(t_u16), - sizeof(t_u16)); + memcpy_ext( + pmpriv->adapter, + (t_u8 *)&pkt_tlv->eth_header.h803_len, + eth_ip, sizeof(t_u16), sizeof(t_u16)); if (misc_keep_alive->ether_type) - pkt_tlv->eth_header.h803_len = - mlan_htons(misc_keep_alive-> - ether_type); + pkt_tlv->eth_header + .h803_len = mlan_htons( + misc_keep_alive->ether_type); else memcpy_ext(pmpriv->adapter, - (t_u8 *)&pkt_tlv->eth_header. - h803_len, eth_ip, - sizeof(t_u16), + (t_u8 *)&pkt_tlv->eth_header + .h803_len, + eth_ip, sizeof(t_u16), sizeof(t_u16)); - pkt_tlv->header.len = - wlan_cpu_to_le16(sizeof(Eth803Hdr_t) + - misc_keep_alive-> - pkt_len); - len = len + sizeof(MrvlIEtypesHeader_t) + + memcpy_ext(pmpriv->adapter, + (t_u8 *)&pkt_tlv->ip_packet, + misc_keep_alive->packet, + misc_keep_alive->pkt_len, + MKEEP_ALIVE_IP_PKT_MAX); + pkt_tlv->header.len = wlan_cpu_to_le16( sizeof(Eth803Hdr_t) + - misc_keep_alive->pkt_len; + misc_keep_alive->pkt_len); + len = len + sizeof(MrvlIEtypesHeader_t) + + sizeof(Eth803Hdr_t) + + misc_keep_alive->pkt_len; } else { - pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *) pos; - pkt_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_KEEP_ALIVE_PKT); + pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *)pos; + pkt_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_KEEP_ALIVE_PKT); pkt_tlv->header.len = 0; len = len + sizeof(MrvlIEtypesHeader_t); } } if (cmd_action == HostCmd_ACT_GEN_RESET) { - pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *) pos; + pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t *)pos; pkt_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_KEEP_ALIVE_PKT); pkt_tlv->header.len = 0; @@ -3050,8 +3571,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_is_cmd_allowed(mlan_private *priv, t_u16 cmd_no) +static mlan_status wlan_is_cmd_allowed(mlan_private *priv, t_u16 cmd_no) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3076,6 +3596,55 @@ } /** + * @brief This function enable/disable CSI support. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_cmd_csi(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) +{ + HostCmd_DS_CSI_CFG *csi_cfg_cmd = &cmd->params.csi_params; + mlan_ds_csi_params *csi_params = MNULL; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_CSI); + cmd->size = sizeof(HostCmd_DS_CSI_CFG) + S_DS_GEN; + csi_cfg_cmd->action = wlan_cpu_to_le16(cmd_action); + switch (cmd_action) { + case CSI_CMD_ENABLE: + csi_params = (mlan_ds_csi_params *)pdata_buf; + csi_cfg_cmd->head_id = wlan_cpu_to_le32(csi_params->head_id); + csi_cfg_cmd->tail_id = wlan_cpu_to_le32(csi_params->tail_id); + csi_cfg_cmd->chip_id = csi_params->chip_id; + csi_cfg_cmd->csi_filter_cnt = csi_params->csi_filter_cnt; + if (csi_cfg_cmd->csi_filter_cnt > CSI_FILTER_MAX) + csi_cfg_cmd->csi_filter_cnt = CSI_FILTER_MAX; + memcpy_ext(pmpriv->adapter, (t_u8 *)csi_cfg_cmd->csi_filter, + (t_u8 *)csi_params->csi_filter, + sizeof(mlan_csi_filter_t) * + csi_cfg_cmd->csi_filter_cnt, + sizeof(csi_cfg_cmd->csi_filter)); + DBG_HEXDUMP(MCMD_D, "Enable CSI", csi_cfg_cmd, + sizeof(HostCmd_DS_CSI_CFG)); + break; + case CSI_CMD_DISABLE: + DBG_HEXDUMP(MCMD_D, "Disable CSI", csi_cfg_cmd, + sizeof(HostCmd_DS_CSI_CFG)); + default: + break; + } + cmd->size = wlan_cpu_to_le16(cmd->size); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepare the command before sending to firmware. * * @param priv A pointer to mlan_private structure @@ -3088,11 +3657,10 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, - t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, - t_void *pdata_buf, t_void *pcmd_buf) +mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pioctl_buf, t_void *pdata_buf, + t_void *pcmd_buf) { HostCmd_DS_COMMAND *cmd_ptr = (HostCmd_DS_COMMAND *)pcmd_buf; mlan_private *pmpriv = (mlan_private *)priv; @@ -3170,10 +3738,17 @@ ret = wlan_cmd_ssu(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; #endif + case HostCmd_CMD_CSI: + ret = wlan_cmd_csi(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; case HostCmd_CMD_HAL_PHY_CFG: ret = wlan_cmd_hal_phy_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_IPS_CONFIG: + ret = wlan_cmd_ips_config(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; case HOST_CMD_PMIC_CONFIGURE: cmd_ptr->command = wlan_cpu_to_le16(cmd_no); cmd_ptr->size = wlan_cpu_to_le16(S_DS_GEN); @@ -3246,9 +3821,8 @@ cmd_ptr->command = wlan_cpu_to_le16(cmd_no); cmd_ptr->params.verext.version_str_sel = (t_u8)(*((t_u32 *)pdata_buf)); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_VERSION_EXT) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_VERSION_EXT) + S_DS_GEN); ret = MLAN_STATUS_SUCCESS; break; case HostCmd_CMD_RX_MGMT_IND: @@ -3257,9 +3831,8 @@ wlan_cpu_to_le16(cmd_action); cmd_ptr->params.rx_mgmt_ind.mgmt_subtype_mask = wlan_cpu_to_le32((t_u32)(*((t_u32 *)pdata_buf))); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_RX_MGMT_IND) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_RX_MGMT_IND) + S_DS_GEN); break; case HostCmd_CMD_802_11_RF_CHANNEL: ret = wlan_cmd_802_11_rf_channel(pmpriv, cmd_ptr, cmd_action, @@ -3348,9 +3921,8 @@ case HostCmd_CMD_WMM_GET_STATUS: PRINTM(MINFO, "WMM: WMM_GET_STATUS cmd sent\n"); cmd_ptr->command = wlan_cpu_to_le16(HostCmd_CMD_WMM_GET_STATUS); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_WMM_GET_STATUS) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_WMM_GET_STATUS) + S_DS_GEN); ret = MLAN_STATUS_SUCCESS; break; case HostCmd_CMD_WMM_ADDTS_REQ: @@ -3402,6 +3974,7 @@ case HostCmd_CMD_TARGET_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS: case HostCmd_CMD_BCA_REG_ACCESS: + case HostCmd_CMD_REG_ACCESS: ret = wlan_cmd_reg_access(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; @@ -3428,17 +4001,20 @@ cmd_ptr->params.bss_mode.con_type = *(t_u8 *)pdata_buf; } else #endif - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) + if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) cmd_ptr->params.bss_mode.con_type = CONNECTION_TYPE_ADHOC; else if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) cmd_ptr->params.bss_mode.con_type = CONNECTION_TYPE_INFRA; - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SET_BSS_MODE) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SET_BSS_MODE) + S_DS_GEN); ret = MLAN_STATUS_SUCCESS; break; + case HostCmd_CMD_802_11_NET_MONITOR: + ret = wlan_cmd_net_monitor(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; case HostCmd_CMD_MEASUREMENT_REQUEST: case HostCmd_CMD_MEASUREMENT_REPORT: ret = wlan_meas_cmd_process(pmpriv, cmd_ptr, pdata_buf); @@ -3469,6 +4045,10 @@ ret = wlan_cmd_otp_user_data(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_FW_AUTO_RECONNECT: + ret = wlan_cmd_fw_auto_reconnect(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; case HostCmd_CMD_HS_WAKEUP_REASON: ret = wlan_cmd_hs_wakeup_reason(pmpriv, cmd_ptr, pdata_buf); break; @@ -3482,17 +4062,21 @@ break; #ifdef USB case HostCmd_CMD_PACKET_AGGR_OVER_HOST_INTERFACE: - ret = wlan_cmd_packet_aggr_over_host_interface(pmpriv, cmd_ptr, - cmd_action, - pdata_buf); + ret = wlan_cmd_packet_aggr_over_host_interface( + pmpriv, cmd_ptr, cmd_action, pdata_buf); break; #endif -#ifdef RX_PACKET_COALESCE - case HostCmd_CMD_RX_PKT_COALESCE_CFG: - ret = wlan_cmd_rx_pkt_coalesce_cfg(pmpriv, cmd_ptr, cmd_action, - pdata_buf); + case HostCmd_CMD_MULTI_CHAN_CONFIG: + ret = wlan_cmd_multi_chan_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); break; -#endif + case HostCmd_CMD_MULTI_CHAN_POLICY: + ret = wlan_cmd_multi_chan_policy(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_DRCS_CONFIG: + ret = wlan_cmd_drcs_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; case HostCMD_CONFIG_LOW_POWER_MODE: ret = wlan_cmd_low_pwr_mode(pmpriv, cmd_ptr, pdata_buf); break; @@ -3523,15 +4107,19 @@ ret = wlan_cmd_ind_rst_cfg(cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_ROAM_OFFLOAD: + ret = wlan_cmd_roam_offload(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_802_11_PS_INACTIVITY_TIMEOUT: ret = wlan_cmd_ps_inactivity_timeout(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; case HostCmd_CMD_CHAN_REGION_CFG: cmd_ptr->command = wlan_cpu_to_le16(cmd_no); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_CHAN_REGION_CFG) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_CHAN_REGION_CFG) + S_DS_GEN); cmd_ptr->params.reg_cfg.action = wlan_cpu_to_le16(cmd_action); break; case HostCmd_CMD_AUTO_TX: @@ -3609,13 +4197,20 @@ pdata_buf); break; case HostCmd_CMD_LOW_POWER_MODE_CFG: - ret = wlan_cmd_set_get_low_power_mode_cfg(pmpriv, cmd_ptr, - cmd_action, - pdata_buf); + ret = wlan_cmd_set_get_low_power_mode_cfg( + pmpriv, cmd_ptr, cmd_action, pdata_buf); break; case HostCmd_CMD_MFG_COMMAND: ret = wlan_cmd_mfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_MC_AGGR_CFG: + ret = wlan_cmd_mc_aggr_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_GET_CH_LOAD: + ret = wlan_cmd_get_ch_load(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; default: PRINTM(MERROR, "PREP_CMD: unknown command- %#x\n", cmd_no); ret = MLAN_STATUS_FAILURE; @@ -3634,8 +4229,7 @@ * * @return MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_sta_init_cmd(t_void *priv, t_u8 first_bss) +mlan_status wlan_ops_sta_init_cmd(t_void *priv, t_u8 first_bss) { pmlan_private pmpriv = (pmlan_private)priv; mlan_status ret = MLAN_STATUS_SUCCESS;
diff --git a/wlan_sd8987/mlan/mlan_sta_cmdresp.c b/wlan_sd8987/mlan/mlan_sta_cmdresp.c index baa1bb6..a70b71c 100755 --- a/wlan_sd8987/mlan/mlan_sta_cmdresp.c +++ b/wlan_sd8987/mlan/mlan_sta_cmdresp.c
@@ -4,7 +4,7 @@ * responses generated by firmware. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -98,21 +98,19 @@ TDLS_TEAR_DOWN); if (sta_ptr) { /**tdls cs stop*/ - if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH - (sta_ptr->ExtCap.ext_cap)) + if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + sta_ptr->ExtCap.ext_cap)) wlan_tdls_config(pmpriv, MFALSE); - if (sta_ptr->is_11n_enabled) { - wlan_cleanup_reorder_tbl(pmpriv, - ptdls_oper_data-> - peer_mac); - wlan_11n_cleanup_txbastream_tbl(pmpriv, - ptdls_oper_data-> - peer_mac); + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) { + wlan_cleanup_reorder_tbl( + pmpriv, ptdls_oper_data->peer_mac); + wlan_11n_cleanup_txbastream_tbl( + pmpriv, ptdls_oper_data->peer_mac); } if (sta_ptr->status >= TDLS_SETUP_INPROGRESS) - wlan_delete_station_entry(pmpriv, - ptdls_oper_data-> - peer_mac); + wlan_delete_station_entry( + pmpriv, ptdls_oper_data->peer_mac); } if (wlan_is_station_list_empty(pmpriv) == MTRUE) pmadapter->tdls_status = TDLS_NOT_SETUP; @@ -142,9 +140,9 @@ * * @return N/A */ -static mlan_status -wlan_process_cmdresp_error(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_process_cmdresp_error(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; pmlan_ioctl_req pscan_ioctl_req = MNULL; @@ -159,30 +157,28 @@ mlan_status ret = MLAN_STATUS_FAILURE; ENTER(); - if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG - && resp->command != HostCmd_CMD_CHAN_REGION_CFG) + if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG && + resp->command != HostCmd_CMD_CHAN_REGION_CFG) PRINTM(MERROR, "CMD_RESP: cmd %#x error, result=%#x\n", resp->command, resp->result); if (pioctl_buf) pioctl_buf->status_code = MLAN_ERROR_FW_CMDRESP; switch (resp->command) { - case HostCmd_CMD_802_11_PS_MODE_ENH:{ - HostCmd_DS_802_11_PS_MODE_ENH *pm = - &resp->params.psmode_enh; - PRINTM(MERROR, - "PS_MODE_ENH command failed: result=0x%x action=0x%X\n", - resp->result, wlan_le16_to_cpu(pm->action)); - /* - * We do not re-try enter-ps command in ad-hoc mode. - */ - if (wlan_le16_to_cpu(pm->action) == EN_AUTO_PS && - (wlan_le16_to_cpu(pm->params.auto_ps.ps_bitmap) & - BITMAP_STA_PS) && - pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - pmadapter->ps_mode = Wlan802_11PowerModeCAM; - } - break; + case HostCmd_CMD_802_11_PS_MODE_ENH: { + HostCmd_DS_802_11_PS_MODE_ENH *pm = &resp->params.psmode_enh; + PRINTM(MERROR, + "PS_MODE_ENH command failed: result=0x%x action=0x%X\n", + resp->result, wlan_le16_to_cpu(pm->action)); + /* + * We do not re-try enter-ps command in ad-hoc mode. + */ + if (wlan_le16_to_cpu(pm->action) == EN_AUTO_PS && + (wlan_le16_to_cpu(pm->params.auto_ps.ps_bitmap) & + BITMAP_STA_PS) && + pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) + pmadapter->ps_mode = Wlan802_11PowerModeCAM; + } break; case HostCmd_CMD_802_11_SCAN_EXT: case HostCmd_CMD_802_11_SCAN: /* Cancel all pending scan command */ @@ -196,12 +192,12 @@ pmadapter->pscan_ioctl_req = MNULL; /* Need to indicate IOCTL complete */ if (pscan_ioctl_req) { - pscan_ioctl_req->status_code = MLAN_ERROR_CMD_SCAN_FAIL; + pscan_ioctl_req->status_code = MLAN_ERROR_NO_ERROR; /* Indicate ioctl complete */ - pcb->moal_ioctl_complete(pmadapter->pmoal_handle, - (pmlan_ioctl_req) - pscan_ioctl_req, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmadapter->pmoal_handle, + (pmlan_ioctl_req)pscan_ioctl_req, + MLAN_STATUS_SUCCESS); } wlan_release_cmd_lock(pmadapter); wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_SCAN_REPORT, MNULL); @@ -211,28 +207,29 @@ break; case HostCmd_CMD_TDLS_CONFIG: - ptdls_config_data->tdls_info.tdls_action = - wlan_le16_to_cpu(ptdls_config_data->tdls_info. - tdls_action); + ptdls_config_data->tdls_info.tdls_action = wlan_le16_to_cpu( + ptdls_config_data->tdls_info.tdls_action); switch (ptdls_config_data->tdls_info.tdls_action) { case WLAN_TDLS_SETUP_REQ: /* TDLS link setup error ;display error in logs */ - tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + tdls_all_cfg = + (tdls_all_config *) + ptdls_config_data->tdls_info.tdls_data; PRINTM(MERROR, "TDLS Setup Failed, error %d\n", - wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. - reason_code)); + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp + .reason_code)); break; case WLAN_TDLS_INIT_CHAN_SWITCH: - tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + tdls_all_cfg = + (tdls_all_config *) + ptdls_config_data->tdls_info.tdls_data; PRINTM(MERROR, "TDLS init channel switch failed," MACSTR ": reason=%d\n", - MAC2STR(tdls_all_cfg->u.tdls_cmd_resp. - peer_mac_addr), - wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. - reason_code)); + MAC2STR(tdls_all_cfg->u.tdls_cmd_resp + .peer_mac_addr), + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp + .reason_code)); break; } break; @@ -270,71 +267,66 @@ break; #endif - case HostCmd_CMD_MGMT_IE_LIST:{ - HostCmd_DS_MGMT_IE_LIST_CFG *pmgmt_ie_list = - &(resp->params.mgmt_ie_list); - t_u16 resp_len = 0, travel_len = 0, index; - mlan_ds_misc_custom_ie *cust_ie = MNULL; - custom_ie *cptr; + case HostCmd_CMD_MGMT_IE_LIST: { + HostCmd_DS_MGMT_IE_LIST_CFG *pmgmt_ie_list = + &(resp->params.mgmt_ie_list); + t_u16 resp_len = 0, travel_len = 0, index; + mlan_ds_misc_custom_ie *cust_ie = MNULL; + custom_ie *cptr; - if (wlan_le16_to_cpu(pmgmt_ie_list->action) == - HostCmd_ACT_GEN_GET) - break; + if (wlan_le16_to_cpu(pmgmt_ie_list->action) == + HostCmd_ACT_GEN_GET) + break; - cust_ie = - (mlan_ds_misc_custom_ie *)&pmgmt_ie_list-> - ds_mgmt_ie; - if (cust_ie) { - cust_ie->type = wlan_le16_to_cpu(cust_ie->type); - resp_len = cust_ie->len = - wlan_le16_to_cpu(cust_ie->len); - travel_len = 0; - /* conversion for index, mask, len */ - if (resp_len == sizeof(t_u16)) - cust_ie->ie_data_list[0] - .ie_index = - wlan_cpu_to_le16(cust_ie-> - ie_data_list - [0].ie_index); + cust_ie = (mlan_ds_misc_custom_ie *)&pmgmt_ie_list->ds_mgmt_ie; + if (cust_ie) { + cust_ie->type = wlan_le16_to_cpu(cust_ie->type); + resp_len = cust_ie->len = + wlan_le16_to_cpu(cust_ie->len); + travel_len = 0; + /* conversion for index, mask, len */ + if (resp_len == sizeof(t_u16)) + cust_ie->ie_data_list[0] + .ie_index = wlan_cpu_to_le16( + cust_ie->ie_data_list[0].ie_index); - while (resp_len > sizeof(t_u16)) { - cptr = (custom_ie - *)(((t_u8 *)cust_ie-> - ie_data_list) + travel_len); - index = cptr->ie_index = - wlan_le16_to_cpu(cptr-> - ie_index); - cptr->mgmt_subtype_mask = - wlan_le16_to_cpu(cptr-> - mgmt_subtype_mask); - cptr->ie_length = - wlan_le16_to_cpu(cptr-> - ie_length); - travel_len += - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; - resp_len -= - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; - if ((pmpriv->mgmt_ie[index]. - mgmt_subtype_mask == - cptr->mgmt_subtype_mask) && - (pmpriv->mgmt_ie[index].ie_length == - cptr->ie_length) && - !memcmp(pmpriv->adapter, - pmpriv->mgmt_ie[index]. - ie_buffer, cptr->ie_buffer, - cptr->ie_length)) { - PRINTM(MERROR, - "set custom ie fail, remove ie index :%d\n", - index); - memset(pmadapter, - &pmpriv->mgmt_ie[index], - 0, sizeof(custom_ie)); - } + while (resp_len > sizeof(t_u16)) { + cptr = (custom_ie *)(((t_u8 *)cust_ie + ->ie_data_list) + + travel_len); + index = cptr->ie_index = + wlan_le16_to_cpu(cptr->ie_index); + cptr->mgmt_subtype_mask = wlan_le16_to_cpu( + cptr->mgmt_subtype_mask); + cptr->ie_length = + wlan_le16_to_cpu(cptr->ie_length); + travel_len += cptr->ie_length + + sizeof(custom_ie) - MAX_IE_SIZE; + resp_len -= cptr->ie_length + + sizeof(custom_ie) - MAX_IE_SIZE; + if ((pmpriv->mgmt_ie[index].mgmt_subtype_mask == + cptr->mgmt_subtype_mask) && + (pmpriv->mgmt_ie[index].ie_length == + cptr->ie_length) && + !memcmp(pmpriv->adapter, + pmpriv->mgmt_ie[index].ie_buffer, + cptr->ie_buffer, cptr->ie_length)) { + PRINTM(MERROR, + "set custom ie fail, remove ie index :%d\n", + index); + memset(pmadapter, + &pmpriv->mgmt_ie[index], 0, + sizeof(custom_ie)); } } - } break; + } + } break; + case HostCmd_CMD_ROAM_OFFLOAD: + if (MLAN_STATUS_SUCCESS != wlan_clear_fw_roaming_pmk(pmpriv)) + PRINTM(MERROR, "wlan_clear_fw_roaming_pmk fail\n"); + pmpriv->adapter->fw_roaming = MFALSE; + PRINTM(MERROR, "FW do not support roaming!\n"); + break; case HostCmd_CMD_CHAN_REGION_CFG: ret = MLAN_STATUS_SUCCESS; PRINTM(MCMND, "FW don't support chan region cfg command!\n"); @@ -369,10 +361,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_rssi_info_ext(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_rssi_info_ext(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RSSI_INFO_EXT *prssi_info_rsp = &resp->params.rssi_info_ext; @@ -388,7 +379,7 @@ if (pioctl_buf != MNULL) { info = (mlan_ds_get_info *)pioctl_buf->pbuf; signal_info_tlv = - (MrvlIEtypes_RSSI_EXT_t *) (prssi_info_rsp->tlv_buf); + (MrvlIEtypes_RSSI_EXT_t *)(prssi_info_rsp->tlv_buf); tlv_left_len = resp->size - (sizeof(HostCmd_DS_802_11_RSSI_INFO_EXT) + S_DS_GEN); @@ -398,53 +389,46 @@ tlv_len = wlan_le16_to_cpu(signal_info_tlv->header.len); if ((tlv_id != TLV_TYPE_RSSI_INFO) || (tlv_len != sizeof(MrvlIEtypes_RSSI_EXT_t) - - sizeof(MrvlIEtypesHeader_t))) { + sizeof(MrvlIEtypesHeader_t))) { PRINTM(MERROR, "Invalid RSSI INFO TLV, type=%d, len=%d\n", tlv_id, tlv_len); break; } - signal = (mlan_ds_get_signal *)&info->param. - signal_ext[tlv_num]; + signal = (mlan_ds_get_signal *)&info->param + .signal_ext[tlv_num]; /* PATH ID */ signal->selector = wlan_le16_to_cpu(signal_info_tlv->path_id); /* RSSI */ - signal->bcn_rssi_last = - wlan_le16_to_cpu(signal_info_tlv-> - bcn_rssi_last); + signal->bcn_rssi_last = wlan_le16_to_cpu( + signal_info_tlv->bcn_rssi_last); signal->bcn_rssi_avg = wlan_le16_to_cpu(signal_info_tlv->bcn_rssi_avg); - signal->data_rssi_last = - wlan_le16_to_cpu(signal_info_tlv-> - data_rssi_last); - signal->data_rssi_avg = - wlan_le16_to_cpu(signal_info_tlv-> - data_rssi_avg); + signal->data_rssi_last = wlan_le16_to_cpu( + signal_info_tlv->data_rssi_last); + signal->data_rssi_avg = wlan_le16_to_cpu( + signal_info_tlv->data_rssi_avg); /* SNR */ - signal->bcn_snr_last = - CAL_SNR(wlan_le16_to_cpu - (signal_info_tlv->bcn_rssi_last), - wlan_le16_to_cpu(signal_info_tlv-> - bcn_nf_last)); - signal->bcn_snr_avg = - CAL_SNR(wlan_le16_to_cpu - (signal_info_tlv->bcn_rssi_avg), - wlan_le16_to_cpu(signal_info_tlv-> - bcn_nf_avg)); - signal->data_snr_last = - CAL_SNR(wlan_le16_to_cpu - (signal_info_tlv->data_rssi_last), - wlan_le16_to_cpu(signal_info_tlv-> - data_nf_last)); - signal->data_snr_avg = - CAL_SNR(wlan_le16_to_cpu - (signal_info_tlv->data_rssi_avg), - wlan_le16_to_cpu(signal_info_tlv-> - data_nf_avg)); + signal->bcn_snr_last = CAL_SNR( + wlan_le16_to_cpu( + signal_info_tlv->bcn_rssi_last), + wlan_le16_to_cpu(signal_info_tlv->bcn_nf_last)); + signal->bcn_snr_avg = CAL_SNR( + wlan_le16_to_cpu(signal_info_tlv->bcn_rssi_avg), + wlan_le16_to_cpu(signal_info_tlv->bcn_nf_avg)); + signal->data_snr_last = CAL_SNR( + wlan_le16_to_cpu( + signal_info_tlv->data_rssi_last), + wlan_le16_to_cpu( + signal_info_tlv->data_nf_last)); + signal->data_snr_avg = CAL_SNR( + wlan_le16_to_cpu( + signal_info_tlv->data_rssi_avg), + wlan_le16_to_cpu(signal_info_tlv->data_nf_avg)); /* NF */ signal->bcn_nf_last = @@ -480,9 +464,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_rssi_info(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_rssi_info(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RSSI_INFO_RSP *prssi_info_rsp = &resp->params.rssi_info_rsp; @@ -563,9 +547,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_snmp_mib(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_snmp_mib(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_SNMP_MIB *psmib = &resp->params.smib; t_u16 oid = wlan_le16_to_cpu(psmib->oid); @@ -632,7 +616,7 @@ default: break; } - } else { /* (query_type == HostCmd_ACT_GEN_SET) */ + } else { /* (query_type == HostCmd_ACT_GEN_SET) */ /* Update state for 11d */ if (oid == Dot11D_i) { ul_temp = wlan_le16_to_cpu(*((t_u16 *)(psmib->value))); @@ -645,16 +629,17 @@ /* Update state for 11h */ if (oid == Dot11H_i) { ul_temp = wlan_le16_to_cpu(*((t_u16 *)(psmib->value))); + PRINTM(MCMND, "wlan: Dot11H_i=%d\n", ul_temp); /* Set 11h state to priv */ pmpriv->intf_state_11h.is_11h_active = (ul_temp & ENABLE_11H_MASK); /* Set radar_det state to adapter */ pmpriv->adapter->state_11h.is_master_radar_det_active = (ul_temp & MASTER_RADAR_DET_MASK) ? MTRUE : - MFALSE; + MFALSE; pmpriv->adapter->state_11h.is_slave_radar_det_active = (ul_temp & SLAVE_RADAR_DET_MASK) ? MTRUE : - MFALSE; + MFALSE; } } @@ -676,9 +661,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_get_log(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_get_log(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_GET_LOG *pget_log = (HostCmd_DS_802_11_GET_LOG *)&resp->params.get_log; @@ -765,7 +750,7 @@ wlan_le32_to_cpu(pget_log->gdma_abort_cnt); pget_info->param.stats.g_reset_rx_mac_cnt = wlan_le32_to_cpu(pget_log->g_reset_rx_mac_cnt); - //Ownership error counters + // Ownership error counters pget_info->param.stats.dwCtlErrCnt = wlan_le32_to_cpu(pget_log->dwCtlErrCnt); pget_info->param.stats.dwBcnErrCnt = @@ -788,49 +773,44 @@ wlan_le32_to_cpu(pget_log->tx_frag_cnt); for (i = 0; i < 8; i++) { pget_info->param.stats.qos_tx_frag_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_tx_frag_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_tx_frag_cnt[i]); pget_info->param.stats.qos_failed_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_failed_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_failed_cnt[i]); pget_info->param.stats.qos_retry_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_retry_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_retry_cnt[i]); pget_info->param.stats.qos_multi_retry_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_multi_retry_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_multi_retry_cnt[i]); pget_info->param.stats.qos_frm_dup_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_frm_dup_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_frm_dup_cnt[i]); pget_info->param.stats.qos_rts_suc_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rts_suc_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_rts_suc_cnt[i]); pget_info->param.stats.qos_rts_failure_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rts_failure_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_rts_failure_cnt[i]); pget_info->param.stats.qos_ack_failure_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_ack_failure_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_ack_failure_cnt[i]); pget_info->param.stats.qos_rx_frag_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rx_frag_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_rx_frag_cnt[i]); pget_info->param.stats.qos_tx_frm_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_tx_frm_cnt[i]); - pget_info->param.stats. - qos_discarded_frm_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_discarded_frm_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_tx_frm_cnt[i]); + pget_info->param.stats.qos_discarded_frm_cnt + [i] = wlan_le32_to_cpu( + pget_log->qos_discarded_frm_cnt[i]); pget_info->param.stats.qos_mpdus_rx_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_mpdus_rx_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_mpdus_rx_cnt[i]); pget_info->param.stats.qos_retries_rx_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_retries_rx_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_retries_rx_cnt[i]); } pget_info->param.stats.cmacicv_errors = wlan_le32_to_cpu(pget_log->cmacicv_errors); @@ -853,38 +833,38 @@ pget_info->param.stats.retry_amsdu_cnt = wlan_le32_to_cpu(pget_log->retry_amsdu_cnt); pget_info->param.stats.multi_retry_amsdu_cnt = - wlan_le32_to_cpu(pget_log-> - multi_retry_amsdu_cnt); + wlan_le32_to_cpu( + pget_log->multi_retry_amsdu_cnt); pget_info->param.stats.tx_octets_in_amsdu_cnt = - wlan_le64_to_cpu(pget_log-> - tx_octets_in_amsdu_cnt); + wlan_le64_to_cpu( + pget_log->tx_octets_in_amsdu_cnt); pget_info->param.stats.amsdu_ack_failure_cnt = - wlan_le32_to_cpu(pget_log-> - amsdu_ack_failure_cnt); + wlan_le32_to_cpu( + pget_log->amsdu_ack_failure_cnt); pget_info->param.stats.rx_amsdu_cnt = wlan_le32_to_cpu(pget_log->rx_amsdu_cnt); pget_info->param.stats.rx_octets_in_amsdu_cnt = - wlan_le64_to_cpu(pget_log-> - rx_octets_in_amsdu_cnt); + wlan_le64_to_cpu( + pget_log->rx_octets_in_amsdu_cnt); pget_info->param.stats.tx_ampdu_cnt = wlan_le32_to_cpu(pget_log->tx_ampdu_cnt); pget_info->param.stats.tx_mpdus_in_ampdu_cnt = - wlan_le32_to_cpu(pget_log-> - tx_mpdus_in_ampdu_cnt); + wlan_le32_to_cpu( + pget_log->tx_mpdus_in_ampdu_cnt); pget_info->param.stats.tx_octets_in_ampdu_cnt = - wlan_le64_to_cpu(pget_log-> - tx_octets_in_ampdu_cnt); + wlan_le64_to_cpu( + pget_log->tx_octets_in_ampdu_cnt); pget_info->param.stats.ampdu_rx_cnt = wlan_le32_to_cpu(pget_log->ampdu_rx_cnt); pget_info->param.stats.mpdu_in_rx_ampdu_cnt = - wlan_le32_to_cpu(pget_log-> - mpdu_in_rx_ampdu_cnt); + wlan_le32_to_cpu( + pget_log->mpdu_in_rx_ampdu_cnt); pget_info->param.stats.rx_octets_in_ampdu_cnt = - wlan_le64_to_cpu(pget_log-> - rx_octets_in_ampdu_cnt); + wlan_le64_to_cpu( + pget_log->rx_octets_in_ampdu_cnt); pget_info->param.stats.ampdu_delimiter_crc_error_cnt = - wlan_le32_to_cpu(pget_log-> - ampdu_delimiter_crc_error_cnt); + wlan_le32_to_cpu( + pget_log->ampdu_delimiter_crc_error_cnt); /* Indicate ioctl complete */ pioctl_buf->data_read_written = @@ -906,8 +886,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_get_power_level(pmlan_private pmpriv, void *pdata_buf) +static mlan_status wlan_get_power_level(pmlan_private pmpriv, void *pdata_buf) { t_u16 length = 0; t_s8 max_power = -1, min_power = -1; @@ -918,7 +897,8 @@ if (pdata_buf) { ppg_tlv = (MrvlTypes_Power_Group_t - *)((t_u8 *)pdata_buf + sizeof(HostCmd_DS_TXPWR_CFG)); + *)((t_u8 *)pdata_buf + + sizeof(HostCmd_DS_TXPWR_CFG)); pg = (Power_Group_t *)((t_u8 *)ppg_tlv + sizeof(MrvlTypes_Power_Group_t)); length = ppg_tlv->length; @@ -957,9 +937,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_tx_power_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_tx_power_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_TXPWR_CFG *ptxp_cfg = &resp->params.txp_cfg; MrvlTypes_Power_Group_t *ppg_tlv = MNULL; @@ -1021,9 +1001,9 @@ i = 0; while ((ppg_tlv->length) && (i < MAX_POWER_GROUP)) { - pwr_grp = - (mlan_power_group *)&power-> - param.power_ext.power_group[i]; + pwr_grp = (mlan_power_group *)&power + ->param.power_ext + .power_group[i]; pwr_grp->first_rate_ind = 0; pwr_grp->last_rate_ind = 0; if (pg->modulation_class == @@ -1098,10 +1078,9 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_rf_tx_power(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_rf_tx_power(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RF_TX_POWER *rtp = &resp->params.txp; t_u16 action = wlan_le16_to_cpu(rtp->action); @@ -1142,10 +1121,9 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_sleep_period(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_sleep_period(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_SLEEP_PERIOD *pcmd_sleep_pd = &resp->params.sleep_pd; mlan_ds_pm_cfg *pm_cfg = MNULL; @@ -1186,10 +1164,9 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_sleep_params(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_sleep_params(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_SLEEP_PARAMS *presp_sp = &resp->params.sleep_param; mlan_ds_pm_cfg *pm_cfg = MNULL; @@ -1234,9 +1211,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_mac_multicast_adr(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_mac_multicast_adr(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { ENTER(); if (pioctl_buf) { @@ -1256,10 +1233,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_deauthenticate(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_deauthenticate(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; t_u8 event_buf[32]; @@ -1272,7 +1248,6 @@ &pmpriv->curr_bss_params.bss_descriptor.mac_address, sizeof(resp->params.deauth.mac_addr))) { wlan_reset_connect_state(pmpriv, MTRUE); - } if (pmpriv->adapter->state_rdh.stage == RDH_STOP_INTFS) wlan_11h_radar_detected_callback((t_void *)pmpriv); @@ -1298,10 +1273,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_ad_hoc_stop(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_ad_hoc_stop(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { ENTER(); @@ -1321,14 +1295,13 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_key_material(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_key_material(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_KEY_MATERIAL *pkey = &resp->params.key_material; mlan_ds_sec_cfg *sec = MNULL; - t_u8 zero_kek[MLAN_KEK_LEN] = { 0 }; + t_u8 zero_kek[MLAN_KEK_LEN] = {0}; ENTER(); @@ -1345,10 +1318,16 @@ } if (memcmp(pmpriv->adapter, pmpriv->gtk_rekey.kek, zero_kek, sizeof(zero_kek)) != 0) { - wlan_prepare_cmd(pmpriv, - HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, - HostCmd_ACT_GEN_SET, 0, MNULL, - &pmpriv->gtk_rekey); + mlan_status ret = MLAN_STATUS_SUCCESS; + ret = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, + HostCmd_ACT_GEN_SET, 0, MNULL, + &pmpriv->gtk_rekey); + if (ret) { + PRINTM(MINFO, + "Error sending message to FW\n"); + } memset(pmpriv->adapter, &pmpriv->gtk_rekey, 0, sizeof(mlan_ds_misc_gtk_rekey_data)); } @@ -1366,8 +1345,9 @@ sec->param.encrypt_key.key_index = pkey->key_param_set.key_idx; PRINTM(MIOCTL, - "key_type=%d, key_index=%d, key_info=0x%x " - MACSTR "\n", pkey->key_param_set.key_type, + "key_type=%d, key_index=%d, key_info=0x%x " MACSTR + "\n", + pkey->key_param_set.key_type, pkey->key_param_set.key_idx, wlan_le16_to_cpu(pkey->key_param_set.key_info), MAC2STR(sec->param.encrypt_key.mac_addr)); @@ -1375,84 +1355,101 @@ case KEY_TYPE_ID_WAPI: sec->param.encrypt_key.is_wapi_key = MTRUE; sec->param.encrypt_key.key_len = - wlan_le16_to_cpu(pkey->key_param_set. - key_params.wapi. - key_len); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.key_material, - pkey->key_param_set.key_params.wapi. - key, sec->param.encrypt_key.key_len, - sizeof(sec->param.encrypt_key. - key_material)); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.pn, - pkey->key_param_set.key_params.wapi. - pn, PN_SIZE, - sizeof(sec->param.encrypt_key.pn)); + wlan_le16_to_cpu( + pkey->key_param_set.key_params + .wapi.key_len); + memcpy_ext( + pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.wapi.key, + sec->param.encrypt_key.key_len, + sizeof(sec->param.encrypt_key + .key_material)); + memcpy_ext( + pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.wapi.pn, + PN_SIZE, + sizeof(sec->param.encrypt_key.pn)); break; case KEY_TYPE_ID_TKIP: sec->param.encrypt_key.key_len = - wlan_le16_to_cpu(pkey->key_param_set. - key_params.tkip. - key_len); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.key_material, - pkey->key_param_set.key_params.tkip. - key, sec->param.encrypt_key.key_len, - sizeof(sec->param.encrypt_key. - key_material)); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.pn, - pkey->key_param_set.key_params.tkip. - pn, WPA_PN_SIZE, - sizeof(sec->param.encrypt_key.pn)); + wlan_le16_to_cpu( + pkey->key_param_set.key_params + .tkip.key_len); + memcpy_ext( + pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.tkip.key, + sec->param.encrypt_key.key_len, + sizeof(sec->param.encrypt_key + .key_material)); + memcpy_ext( + pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.tkip.pn, + WPA_PN_SIZE, + sizeof(sec->param.encrypt_key.pn)); break; case KEY_TYPE_ID_AES: sec->param.encrypt_key.key_len = - wlan_le16_to_cpu(pkey->key_param_set. - key_params.aes. - key_len); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.key_material, - pkey->key_param_set.key_params.aes. - key, sec->param.encrypt_key.key_len, - sizeof(sec->param.encrypt_key. - key_material)); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.pn, - pkey->key_param_set.key_params.aes. - pn, WPA_PN_SIZE, - sizeof(sec->param.encrypt_key.pn)); + wlan_le16_to_cpu( + pkey->key_param_set.key_params + .aes.key_len); + sec->param.encrypt_key + .key_len = MIN( + sec->param.encrypt_key.key_len, + sizeof(pkey->key_param_set.key_params + .aes.key)), + memcpy_ext(pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.aes.key, + sec->param.encrypt_key.key_len, + sizeof(sec->param.encrypt_key.key_material)); + memcpy_ext( + pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.aes.pn, + WPA_PN_SIZE, + sizeof(sec->param.encrypt_key.pn)); break; case KEY_TYPE_ID_AES_CMAC: sec->param.encrypt_key.key_len = - wlan_le16_to_cpu(pkey->key_param_set. - key_params.cmac_aes. - key_len); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.key_material, - pkey->key_param_set.key_params. - cmac_aes.key, - sec->param.encrypt_key.key_len, - sizeof(sec->param.encrypt_key. - key_material)); + wlan_le16_to_cpu( + pkey->key_param_set.key_params + .cmac_aes.key_len); + sec->param.encrypt_key + .key_len = MIN( + sec->param.encrypt_key.key_len, + sizeof(pkey->key_param_set.key_params + .cmac_aes.key)), + memcpy_ext(pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.cmac_aes.key, + sec->param.encrypt_key.key_len, + sizeof(sec->param.encrypt_key.key_material)); memcpy_ext(pmpriv->adapter, sec->param.encrypt_key.pn, - pkey->key_param_set.key_params. - cmac_aes.ipn, IGTK_PN_SIZE, + pkey->key_param_set.key_params + .cmac_aes.ipn, + IGTK_PN_SIZE, sizeof(sec->param.encrypt_key.pn)); break; case KEY_TYPE_ID_WEP: sec->param.encrypt_key.key_len = - wlan_le16_to_cpu(pkey->key_param_set. - key_params.wep. - key_len); - memcpy_ext(pmpriv->adapter, - sec->param.encrypt_key.key_material, - pkey->key_param_set.key_params.wep. - key, sec->param.encrypt_key.key_len, - sizeof(sec->param.encrypt_key. - key_material)); + wlan_le16_to_cpu( + pkey->key_param_set.key_params + .wep.key_len); + sec->param.encrypt_key + .key_len = MIN( + sec->param.encrypt_key.key_len, + sizeof(pkey->key_param_set.key_params + .wep.key)), + memcpy_ext(pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.wep.key, + sec->param.encrypt_key.key_len, + sizeof(sec->param.encrypt_key.key_material)); break; } } @@ -1499,8 +1496,8 @@ encr_proto_tlv = (MrvlIEtypes_EncrProto_t *)head; sec->param.esupp_mode.rsn_mode = - wlan_le16_to_cpu(encr_proto_tlv-> - rsn_mode); + wlan_le16_to_cpu( + encr_proto_tlv->rsn_mode); PRINTM(MINFO, "rsn_mode=0x%x\n", sec->param.esupp_mode.rsn_mode); break; @@ -1534,9 +1531,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_802_11_rf_channel(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_802_11_rf_channel(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_RF_CHANNEL *prf_channel = &resp->params.rf_channel; t_u16 new_channel = wlan_le16_to_cpu(prf_channel->current_channel); @@ -1566,12 +1563,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_ibss_coalescing_status(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp) +static mlan_status wlan_ret_ibss_coalescing_status(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp) { HostCmd_DS_802_11_IBSS_STATUS *pibss_coal_resp = &(resp->params.ibss_coalescing); - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -1599,8 +1596,8 @@ memcpy_ext(pmpriv->adapter, pmpriv->curr_bss_params.bss_descriptor.mac_address, pibss_coal_resp->bssid, MLAN_MAC_ADDR_LENGTH, - sizeof(pmpriv->curr_bss_params.bss_descriptor. - mac_address)); + sizeof(pmpriv->curr_bss_params.bss_descriptor + .mac_address)); /* Beacon Interval and ATIM window */ pmpriv->curr_bss_params.bss_descriptor.beacon_period = @@ -1610,8 +1607,8 @@ /* ERP Information */ pmpriv->curr_bss_params.bss_descriptor.erp_flags = - (t_u8)wlan_le16_to_cpu(pibss_coal_resp-> - use_g_rate_protect); + (t_u8)wlan_le16_to_cpu( + pibss_coal_resp->use_g_rate_protect); pmpriv->adhoc_state = ADHOC_COALESCED; } @@ -1629,9 +1626,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_mgmt_ie_list(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_mgmt_ie_list(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { t_u16 resp_len = 0, travel_len = 0; int i = 0; @@ -1648,8 +1645,8 @@ if ((pmpriv->adapter->state_rdh.stage == RDH_SET_CUSTOM_IE) || (pmpriv->adapter->state_rdh.stage == RDH_REM_CUSTOM_IE)) if (!pmpriv->adapter->ecsa_enable) - wlan_11h_radar_detected_callback((t_void *) - pmpriv); + wlan_11h_radar_detected_callback( + (t_void *)pmpriv); LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -1662,9 +1659,8 @@ travel_len = 0; /* conversion for index, mask, len */ if (resp_len == sizeof(t_u16)) - cust_ie->ie_data_list[0].ie_index = - wlan_cpu_to_le16(cust_ie->ie_data_list[0]. - ie_index); + cust_ie->ie_data_list[0].ie_index = wlan_cpu_to_le16( + cust_ie->ie_data_list[0].ie_index); while (resp_len > sizeof(t_u16)) { cptr = (custom_ie *)(((t_u8 *)cust_ie->ie_data_list) + @@ -1674,9 +1670,9 @@ wlan_le16_to_cpu(cptr->mgmt_subtype_mask); cptr->ie_length = wlan_le16_to_cpu(cptr->ie_length); travel_len += cptr->ie_length + sizeof(custom_ie) - - MAX_IE_SIZE; + MAX_IE_SIZE; resp_len -= cptr->ie_length + sizeof(custom_ie) - - MAX_IE_SIZE; + MAX_IE_SIZE; } memcpy_ext(pmpriv->adapter, &misc->param.cust_ie, cust_ie, (cust_ie->len + sizeof(MrvlIEtypesHeader_t)), @@ -1693,27 +1689,24 @@ wlan_le16_to_cpu(max_mgmt_ie->count); for (i = 0; i < max_mgmt_ie->count; i++) { max_mgmt_ie->info[i] - .buf_size = - wlan_le16_to_cpu(max_mgmt_ie-> - info[i]. - buf_size); + .buf_size = wlan_le16_to_cpu( + max_mgmt_ie->info[i].buf_size); max_mgmt_ie->info[i] - .buf_count = - wlan_le16_to_cpu(max_mgmt_ie-> - info[i]. - buf_count); + .buf_count = wlan_le16_to_cpu( + max_mgmt_ie->info[i].buf_count); } /* Append max_mgmt_ie TLV after custom_ie */ - memcpy_ext(pmpriv->adapter, - (t_u8 *)&misc->param.cust_ie + - (cust_ie->len + - sizeof(MrvlIEtypesHeader_t)), - max_mgmt_ie, - max_mgmt_ie->len + - sizeof(MrvlIEtypesHeader_t), - sizeof(misc->param.cust_ie) - - (cust_ie->len + - sizeof(MrvlIEtypesHeader_t))); + memcpy_ext( + pmpriv->adapter, + (t_u8 *)&misc->param.cust_ie + + (cust_ie->len + + sizeof(MrvlIEtypesHeader_t)), + max_mgmt_ie, + max_mgmt_ie->len + + sizeof(MrvlIEtypesHeader_t), + sizeof(misc->param.cust_ie) - + (cust_ie->len + + sizeof(MrvlIEtypesHeader_t))); } } } @@ -1730,8 +1723,7 @@ * * @return N/A */ -static void -wlan_set_tdls_powermode(pmlan_private pmpriv, t_u8 powermode) +static void wlan_set_tdls_powermode(pmlan_private pmpriv, t_u8 powermode) { ENTER(); @@ -1767,9 +1759,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_ret_tdls_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_tdls_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { t_u8 i = 0; t_u16 link_length = 0, final_data_rate = 0; @@ -1789,7 +1781,7 @@ case WLAN_TDLS_CONFIG: misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; if (pmpriv->host_tdls_cs_support || pmpriv->host_tdls_uapsd_support) break; @@ -1811,20 +1803,19 @@ case WLAN_TDLS_DISCOVERY_REQ: misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; tdls_all_cfg->u.tdls_discovery_resp.payload_len = - wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. - payload_len); - tdls_all_cfg->u.tdls_discovery_resp.cap_info = - wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. - cap_info); + wlan_le16_to_cpu( + tdls_all_cfg->u.tdls_discovery_resp.payload_len); + tdls_all_cfg->u.tdls_discovery_resp.cap_info = wlan_le16_to_cpu( + tdls_all_cfg->u.tdls_discovery_resp.cap_info); memcpy_ext(pmpriv->adapter, &misc->param.tdls_config, &ptdls_config_data->tdls_info, (resp->size - S_DS_GEN), sizeof(mlan_ds_misc_tdls_config)); PRINTM(MCMND, "TDLS_DISCOVERY_REQ: " MACSTR "\n", MAC2STR(tdls_all_cfg->u.tdls_discovery_resp - .peer_mac_addr)); + .peer_mac_addr)); break; case WLAN_TDLS_SETUP_REQ: @@ -1832,24 +1823,20 @@ * TDLS link being setup, block all data for this Peer */ tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; PRINTM(MCMND, "TDLS_SETUP_REQ: " MACSTR "\n", MAC2STR(tdls_all_cfg->u.tdls_setup.peer_mac_addr)); - sta_ptr = - wlan_get_station_entry(pmpriv, - tdls_all_cfg->u.tdls_setup. - peer_mac_addr); + sta_ptr = wlan_get_station_entry( + pmpriv, tdls_all_cfg->u.tdls_setup.peer_mac_addr); if (!sta_ptr) { - sta_ptr = wlan_add_station_entry(pmpriv, - tdls_all_cfg->u. - tdls_setup. - peer_mac_addr); + sta_ptr = wlan_add_station_entry( + pmpriv, + tdls_all_cfg->u.tdls_setup.peer_mac_addr); if (sta_ptr) { sta_ptr->status = TDLS_SETUP_INPROGRESS; - wlan_hold_tdls_packets(pmpriv, - tdls_all_cfg->u. - tdls_setup. - peer_mac_addr); + wlan_hold_tdls_packets( + pmpriv, tdls_all_cfg->u.tdls_setup + .peer_mac_addr); } } break; @@ -1859,30 +1846,27 @@ * TDLS link torn down, open data ports if blocked */ tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; - wlan_restore_tdls_packets(pmpriv, - tdls_all_cfg->u.tdls_tear_down. - peer_mac_addr, TDLS_TEAR_DOWN); + ptdls_config_data->tdls_info.tdls_data; + wlan_restore_tdls_packets( + pmpriv, tdls_all_cfg->u.tdls_tear_down.peer_mac_addr, + TDLS_TEAR_DOWN); PRINTM(MCMND, "TDLS_TEARDOWN_REQ: " MACSTR "\n", MAC2STR(tdls_all_cfg->u.tdls_tear_down.peer_mac_addr)); - sta_ptr = - wlan_get_station_entry(pmpriv, - tdls_all_cfg->u.tdls_tear_down. - peer_mac_addr); + sta_ptr = wlan_get_station_entry( + pmpriv, tdls_all_cfg->u.tdls_tear_down.peer_mac_addr); if (sta_ptr) { - if (sta_ptr->is_11n_enabled) { - wlan_cleanup_reorder_tbl(pmpriv, - tdls_all_cfg->u. - tdls_tear_down. - peer_mac_addr); - wlan_11n_cleanup_txbastream_tbl(pmpriv, - tdls_all_cfg->u. - tdls_tear_down. - peer_mac_addr); + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) { + wlan_cleanup_reorder_tbl( + pmpriv, tdls_all_cfg->u.tdls_tear_down + .peer_mac_addr); + wlan_11n_cleanup_txbastream_tbl( + pmpriv, tdls_all_cfg->u.tdls_tear_down + .peer_mac_addr); } - wlan_delete_station_entry(pmpriv, - tdls_all_cfg->u. - tdls_tear_down.peer_mac_addr); + wlan_delete_station_entry( + pmpriv, + tdls_all_cfg->u.tdls_tear_down.peer_mac_addr); if (MTRUE == wlan_is_station_list_empty(pmpriv)) pmadapter->tdls_status = TDLS_NOT_SETUP; else @@ -1891,7 +1875,7 @@ break; case WLAN_TDLS_INIT_CHAN_SWITCH: tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; PRINTM(MCMND, "TDLS_INIT_CHANNEL_SWITCH: " MACSTR " chan=%d periodicity=%d\n", @@ -1903,10 +1887,10 @@ case WLAN_TDLS_LINK_STATUS: misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; tdls_all_cfg->u.tdls_link_status_resp.payload_len = wlan_le16_to_cpu(tdls_all_cfg->u.tdls_link_status_resp - .payload_len); + .payload_len); link_ptr = tdls_all_cfg->u.tdls_link_status_resp.link_stats; for (i = 0; i < tdls_all_cfg->u.tdls_link_status_resp.active_links; @@ -1924,9 +1908,8 @@ link_length = sizeof(tdls_each_link_status) - 1; /* adjust as per open or secure network */ if (link_ptr->link_flags & 0x02) { - link_ptr->key_lifetime = - wlan_le32_to_cpu(link_ptr-> - key_lifetime); + link_ptr->key_lifetime = wlan_le32_to_cpu( + link_ptr->key_lifetime); link_length += link_ptr->key_length; } else { link_length -= @@ -1934,15 +1917,9 @@ sizeof(link_ptr->key_lifetime) + sizeof(link_ptr->key_length); } - final_data_rate = - (t_u16)wlan_index_to_data_rate(pmadapter, - link_ptr->u. - rate_info. - tx_data_rate, - link_ptr->u. - rate_info. - tx_rate_htinfo, - 0); + final_data_rate = (t_u16)wlan_index_to_data_rate( + pmadapter, link_ptr->u.rate_info.tx_data_rate, + link_ptr->u.rate_info.tx_rate_htinfo, 0); link_ptr->u.final_data_rate = final_data_rate / 2; link_ptr = @@ -1957,20 +1934,19 @@ case WLAN_TDLS_POWER_MODE: misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; - tdls_all_cfg->u.tdls_power_mode.power_mode = - wlan_le16_to_cpu(tdls_all_cfg->u.tdls_power_mode. - power_mode); - wlan_set_tdls_powermode(pmpriv, - (t_u8)tdls_all_cfg->u.tdls_power_mode. - power_mode); + ptdls_config_data->tdls_info.tdls_data; + tdls_all_cfg->u.tdls_power_mode.power_mode = wlan_le16_to_cpu( + tdls_all_cfg->u.tdls_power_mode.power_mode); + wlan_set_tdls_powermode( + pmpriv, + (t_u8)tdls_all_cfg->u.tdls_power_mode.power_mode); break; case WLAN_TDLS_STOP_CHAN_SWITCH: tdls_all_cfg = (tdls_all_config *) - ptdls_config_data->tdls_info.tdls_data; + ptdls_config_data->tdls_info.tdls_data; PRINTM(MCMND, "TDLS_STOP_CHANNEL_SWITCH: " MACSTR "\n", - MAC2STR(tdls_all_cfg->u.tdls_stop_chan_switch. - peer_mac_addr)); + MAC2STR(tdls_all_cfg->u.tdls_stop_chan_switch + .peer_mac_addr)); break; case WLAN_TDLS_CS_PARAMS: case WLAN_TDLS_CS_DISABLE: @@ -2004,9 +1980,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_ret_tdls_oper(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_tdls_oper(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_TDLS_OPER *ptdls_oper = &(resp->params.tdls_oper_data); sta_node *sta_ptr = MNULL; @@ -2049,15 +2025,15 @@ TDLS_TEAR_DOWN); if (sta_ptr) { /**tdls cs stop*/ - if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH - (sta_ptr->ExtCap.ext_cap)) + if (ISSUPP_EXTCAP_TDLS_CHAN_SWITCH( + sta_ptr->ExtCap.ext_cap)) wlan_tdls_config(pmpriv, MFALSE); - if (sta_ptr->is_11n_enabled) { + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) { wlan_cleanup_reorder_tbl(pmpriv, ptdls_oper->peer_mac); - wlan_11n_cleanup_txbastream_tbl(pmpriv, - ptdls_oper-> - peer_mac); + wlan_11n_cleanup_txbastream_tbl( + pmpriv, ptdls_oper->peer_mac); } if (sta_ptr->status >= TDLS_SETUP_INPROGRESS) wlan_delete_station_entry(pmpriv, @@ -2093,9 +2069,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_sysclock_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_sysclock_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *mis_ccfg = MNULL; HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG *clk_cfg = @@ -2130,16 +2106,14 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_inactivity_timeout(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_inactivity_timeout(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_pm_cfg *pmcfg = MNULL; mlan_ds_inactivity_to *inac_to = MNULL; HostCmd_DS_INACTIVITY_TIMEOUT_EXT *cmd_inac_to = - (HostCmd_DS_INACTIVITY_TIMEOUT_EXT *) - &resp->params.inactivity_to; + (HostCmd_DS_INACTIVITY_TIMEOUT_EXT *)&resp->params.inactivity_to; ENTER(); @@ -2162,6 +2136,61 @@ /** * @brief This function handles the command response of + * network monitor + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to command buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_net_monitor(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *pmisc = MNULL; + mlan_ds_misc_net_monitor *net_mon = MNULL; + HostCmd_DS_802_11_NET_MONITOR *cmd_net_mon = + (HostCmd_DS_802_11_NET_MONITOR *)&resp->params.net_mon; + ChanBandParamSet_t *pchan_band = MNULL; + t_u16 band_info = 0; + + ENTER(); + + if (pioctl_buf && (pioctl_buf->action == MLAN_ACT_GET)) { + pmisc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + net_mon = &pmisc->param.net_mon; + net_mon->enable_net_mon = + wlan_le16_to_cpu(cmd_net_mon->enable_net_mon); + net_mon->filter_flag = + wlan_le16_to_cpu(cmd_net_mon->filter_flag); + pchan_band = &cmd_net_mon->monitor_chan.chan_band_param[0]; + /* Band information in the TLV is bits[1:0] */ + band_info = pchan_band->bandcfg.chanBand; + net_mon->channel = pchan_band->chan_number; + if (band_info == BAND_2GHZ) + net_mon->band |= (BAND_B | BAND_G); + if (band_info == BAND_5GHZ) + net_mon->band |= BAND_A; + net_mon->chan_bandwidth = + GET_SECONDARYCHAN(pchan_band->bandcfg.chan2Offset); + if (band_info == BAND_2GHZ) + net_mon->band |= BAND_GN; + if (band_info == BAND_5GHZ) + net_mon->band |= BAND_AN; + if (band_info == BAND_2GHZ) + net_mon->band |= BAND_GAC; + if (band_info == BAND_5GHZ) + net_mon->band |= BAND_AAC; + } + pmpriv->adapter->enable_net_mon = + wlan_le16_to_cpu(cmd_net_mon->enable_net_mon); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of * subscribe event * * @param pmpriv A pointer to mlan_private structure @@ -2170,9 +2199,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_subscribe_event(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_subscribe_event(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_SUBSCRIBE_EVENT *evt = (HostCmd_DS_SUBSCRIBE_EVENT *)&resp->params.subscribe_event; @@ -2200,9 +2229,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_otp_user_data(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_otp_user_data(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_OTP_USER_DATA *cmd_user_data = (HostCmd_DS_OTP_USER_DATA *)&resp->params.otp_user_data; @@ -2226,6 +2255,42 @@ return MLAN_STATUS_SUCCESS; } +/** + * @brief This function handles the command response of + * fw auto re-connect + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to command buffer + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_ret_fw_auto_reconnect(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + HostCmd_DS_FW_AUTO_RECONNECT *fw_auto_reconnect = + (HostCmd_DS_FW_AUTO_RECONNECT *)&resp->params + .fw_auto_reconnect_cmd; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + + if (pioctl_buf && (pioctl_buf->action == MLAN_ACT_GET)) { + misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + misc->param.fw_auto_reconnect.fw_reconn_counter = + fw_auto_reconnect->reconnect_counter; + misc->param.fw_auto_reconnect.fw_reconn_interval = + fw_auto_reconnect->reconnect_interval; + misc->param.fw_auto_reconnect.fw_reconn_flags = + wlan_le16_to_cpu(fw_auto_reconnect->flags); + pioctl_buf->data_read_written = sizeof(mlan_ds_misc_cfg); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + #ifdef USB /** * @brief This function handles the command response of @@ -2244,8 +2309,8 @@ { mlan_ds_misc_cfg *misc = MNULL; HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE *packet_aggr = - (HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE *)&resp->params. - packet_aggr; + (HostCmd_DS_PACKET_AGGR_OVER_HOST_INTERFACE *)&resp->params + .packet_aggr; MrvlIETypes_USBAggrParam_t *usb_aggr_param_tlv = MNULL; mlan_ds_misc_usb_aggr_ctrl *usb_aggr_ctrl = MNULL; t_u8 *ptlv_buffer = (t_u8 *)packet_aggr->tlv_buf; @@ -2272,15 +2337,13 @@ tlv = (*ptlv_buffer) | (*(ptlv_buffer + 1) << 8); switch (tlv) { case MRVL_USB_AGGR_PARAM_TLV_ID: - usb_aggr_param_tlv = (MrvlIETypes_USBAggrParam_t *) - ptlv_buffer; + usb_aggr_param_tlv = + (MrvlIETypes_USBAggrParam_t *)ptlv_buffer; misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - usb_aggr_ctrl = - (mlan_ds_misc_usb_aggr_ctrl *)&(misc->param. - usb_aggr_params); - usb_aggr_param_tlv->header.len = - wlan_le16_to_cpu(usb_aggr_param_tlv->header. - len); + usb_aggr_ctrl = (mlan_ds_misc_usb_aggr_ctrl *)&( + misc->param.usb_aggr_params); + usb_aggr_param_tlv->header.len = wlan_le16_to_cpu( + usb_aggr_param_tlv->header.len); usb_aggr_param_tlv->enable = wlan_le16_to_cpu(usb_aggr_param_tlv->enable); #if defined(USB) @@ -2289,42 +2352,49 @@ * MLAN */ for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_ctrl.enable = - usb_aggr_ctrl->tx_aggr_ctrl. - enable; + .aggr_ctrl.enable = + usb_aggr_ctrl->tx_aggr_ctrl + .enable; if (pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_ctrl.aggr_mode != - usb_aggr_ctrl->tx_aggr_ctrl. - aggr_mode) { - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .aggr_ctrl.aggr_mode = usb_aggr_ctrl - ->tx_aggr_ctrl.aggr_mode; + .aggr_ctrl.aggr_mode != + usb_aggr_ctrl->tx_aggr_ctrl + .aggr_mode) { + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .aggr_ctrl.aggr_mode = + usb_aggr_ctrl + ->tx_aggr_ctrl + .aggr_mode; changed = 1; } if (pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_ctrl.aggr_align != - usb_aggr_ctrl->tx_aggr_ctrl. - aggr_align) { - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .aggr_ctrl.aggr_align = usb_aggr_ctrl - ->tx_aggr_ctrl.aggr_align; + .aggr_ctrl.aggr_align != + usb_aggr_ctrl->tx_aggr_ctrl + .aggr_align) { + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .aggr_ctrl.aggr_align = + usb_aggr_ctrl + ->tx_aggr_ctrl + .aggr_align; changed = 1; } if (pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_ctrl.aggr_max != - usb_aggr_ctrl->tx_aggr_ctrl. - aggr_max) { - pmadapter->pcard_usb-> - usb_tx_aggr[i] - .aggr_ctrl.aggr_max = usb_aggr_ctrl - ->tx_aggr_ctrl.aggr_max; + .aggr_ctrl.aggr_max != + usb_aggr_ctrl->tx_aggr_ctrl + .aggr_max) { + pmadapter->pcard_usb + ->usb_tx_aggr[i] + .aggr_ctrl.aggr_max = + usb_aggr_ctrl + ->tx_aggr_ctrl + .aggr_max; changed = 1; } pmadapter->pcard_usb->usb_tx_aggr[i] - .aggr_ctrl.aggr_tmo = usb_aggr_ctrl - ->tx_aggr_ctrl.aggr_tmo; + .aggr_ctrl.aggr_tmo = + usb_aggr_ctrl->tx_aggr_ctrl + .aggr_tmo; } } else { if (usb_aggr_param_tlv->enable & MBIT(1)) @@ -2333,18 +2403,18 @@ else usb_aggr_ctrl->tx_aggr_ctrl.enable = MFALSE; - usb_aggr_ctrl->tx_aggr_ctrl.aggr_align = - wlan_le16_to_cpu(usb_aggr_param_tlv-> - tx_aggr_align); + usb_aggr_ctrl->tx_aggr_ctrl + .aggr_align = wlan_le16_to_cpu( + usb_aggr_param_tlv->tx_aggr_align); usb_aggr_ctrl->tx_aggr_ctrl.aggr_mode = pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.aggr_mode; + .aggr_ctrl.aggr_mode; usb_aggr_ctrl->tx_aggr_ctrl.aggr_max = pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.aggr_max; + .aggr_ctrl.aggr_max; usb_aggr_ctrl->tx_aggr_ctrl.aggr_tmo = pmadapter->pcard_usb->usb_tx_aggr[0] - .aggr_ctrl.aggr_tmo; + .aggr_ctrl.aggr_tmo; } if (changed) wlan_reset_usb_tx_aggr(pmadapter); @@ -2354,32 +2424,32 @@ if (pioctl_buf->action == MLAN_ACT_SET) { /* Update the Rx deaggregation values in * MLAN */ - pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - enable = + pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl + .enable = usb_aggr_ctrl->rx_deaggr_ctrl.enable; - if (pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_mode != + if (pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_mode != usb_aggr_ctrl->rx_deaggr_ctrl.aggr_mode) - pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_mode = - usb_aggr_ctrl - ->rx_deaggr_ctrl.aggr_mode; - if (pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_align != + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_mode = + usb_aggr_ctrl->rx_deaggr_ctrl + .aggr_mode; + if (pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align != usb_aggr_ctrl->rx_deaggr_ctrl.aggr_align) - pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_align = - usb_aggr_ctrl - ->rx_deaggr_ctrl.aggr_align; - if (pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_max != + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align = + usb_aggr_ctrl->rx_deaggr_ctrl + .aggr_align; + if (pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_max != usb_aggr_ctrl->rx_deaggr_ctrl.aggr_max) - pmadapter->pcard_usb->usb_rx_deaggr. - aggr_ctrl.aggr_max = - usb_aggr_ctrl - ->rx_deaggr_ctrl.aggr_max; - pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_tmo = + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_max = + usb_aggr_ctrl->rx_deaggr_ctrl + .aggr_max; + pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl + .aggr_tmo = usb_aggr_ctrl->rx_deaggr_ctrl.aggr_tmo; } else { if (usb_aggr_param_tlv->enable & MBIT(0)) @@ -2388,22 +2458,22 @@ else usb_aggr_ctrl->rx_deaggr_ctrl.enable = MFALSE; - usb_aggr_ctrl->rx_deaggr_ctrl.aggr_mode = - wlan_le16_to_cpu(usb_aggr_param_tlv-> - rx_aggr_mode); - usb_aggr_ctrl->rx_deaggr_ctrl.aggr_align = - wlan_le16_to_cpu(usb_aggr_param_tlv-> - rx_aggr_align); + usb_aggr_ctrl->rx_deaggr_ctrl + .aggr_mode = wlan_le16_to_cpu( + usb_aggr_param_tlv->rx_aggr_mode); + usb_aggr_ctrl->rx_deaggr_ctrl + .aggr_align = wlan_le16_to_cpu( + usb_aggr_param_tlv->rx_aggr_align); usb_aggr_ctrl->rx_deaggr_ctrl.aggr_max = - wlan_le16_to_cpu(usb_aggr_param_tlv-> - rx_aggr_max); + wlan_le16_to_cpu( + usb_aggr_param_tlv->rx_aggr_max); usb_aggr_ctrl->rx_deaggr_ctrl.aggr_tmo = - wlan_le16_to_cpu(usb_aggr_param_tlv-> - rx_aggr_tmo); + wlan_le16_to_cpu( + usb_aggr_param_tlv->rx_aggr_tmo); } #endif ptlv_buffer += usb_aggr_param_tlv->header.len + - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); tlv_buf_len -= (usb_aggr_param_tlv->header.len + sizeof(MrvlIEtypesHeader_t)); break; @@ -2427,9 +2497,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_dfs_repeater_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_dfs_repeater_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_DFS_REPEATER_MODE *cmd_dfs_repeater = &resp->params.dfs_repeater; @@ -2468,37 +2538,15 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_coalesce_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_coalesce_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { ENTER(); LEAVE(); return MLAN_STATUS_SUCCESS; } -static mlan_status -wlan_ret_get_sensor_temp(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) -{ - mlan_ds_misc_cfg *pcfg = MNULL; - const HostCmd_DS_SENSOR_TEMP *pSensorT = &resp->params.temp_sensor; - - ENTER(); - - if (pioctl_buf) { - pcfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - pcfg->param.sensor_temp.temperature = - wlan_le32_to_cpu(pSensorT->temperature); - PRINTM(MCMND, "get SOC temperature %u C \n", - pSensorT->temperature); - } - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function handles the command response of arb Cfg * @@ -2508,12 +2556,11 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_arb_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_ARB_CONFIG *cfg_cmd = - (HostCmd_DS_CMD_ARB_CONFIG *) & resp->params.arb_cfg; + (HostCmd_DS_CMD_ARB_CONFIG *)&resp->params.arb_cfg; mlan_ds_misc_cfg *misc_cfg = MNULL; ENTER(); @@ -2536,9 +2583,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_ipv6_ra_offload(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_ipv6_ra_offload(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_IPV6_RA_OFFLOAD *ipv6_ra_resp = &resp->params.ipv6_ra_offload; @@ -2549,9 +2596,8 @@ if (pioctl_buf && (pioctl_buf->action == MLAN_ACT_GET)) { misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - ipv6_ra = - (mlan_ds_misc_ipv6_ra_offload *) & misc->param. - ipv6_ra_offload; + ipv6_ra = (mlan_ds_misc_ipv6_ra_offload *)&misc->param + .ipv6_ra_offload; ipv6_ra->enable = ipv6_ra_resp->enable; memcpy_ext(pmpriv->adapter, ipv6_ra->ipv6_addr, ipv6_ra_resp->ipv6_addr_param.ipv6_addr, 16, @@ -2572,12 +2618,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_sta_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_sta_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_STA_CONFIGURE *cmdrsp_sta_cfg = - (HostCmd_DS_STA_CONFIGURE *) & resp->params.sta_cfg; + (HostCmd_DS_STA_CONFIGURE *)&resp->params.sta_cfg; mlan_ds_bss *bss = MNULL; MrvlIEtypes_channel_band_t *tlv_band_channel = MNULL; @@ -2588,7 +2634,7 @@ if (bss->sub_command == MLAN_OID_BSS_CHAN_INFO) { tlv_band_channel = (MrvlIEtypes_channel_band_t *) - cmdrsp_sta_cfg->tlv_buffer; + cmdrsp_sta_cfg->tlv_buffer; bss->param.sta_channel.bandcfg = tlv_band_channel->bandcfg; bss->param.sta_channel.channel = @@ -2598,13 +2644,11 @@ if (bss->param.sta_channel.bandcfg.chanWidth == CHAN_BW_80MHZ) bss->param.sta_channel.center_chan = - wlan_get_center_freq_idx(pmpriv, - BAND_AAC, - bss-> - param. - sta_channel. - channel, - CHANNEL_BW_80MHZ); + wlan_get_center_freq_idx( + pmpriv, BAND_AAC, + bss->param.sta_channel + .channel, + CHANNEL_BW_80MHZ); PRINTM(MCMND, "Get STA channel, band=0x%x, channel=%d, is_11n_enabled=%d center_chan=%d\n", bss->param.sta_channel.bandcfg, @@ -2622,6 +2666,70 @@ } /** + * @brief This function clears PMK in fw for fw roaming + * + * @param pmpriv A pointer to mlan_private structure + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_clear_fw_roaming_pmk(pmlan_private pmpriv) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_SUPPLICANT_PMK, + HostCmd_ACT_GEN_REMOVE, 0, MNULL, MNULL); + + LEAVE(); + return ret; +} + +/** + * @brief This function handles the command response of enable/disable roaming + * offload to fw + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_ret_roam_offload(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + HostCmd_DS_ROAM_OFFLOAD *cmdrsp_roam_offload = + (HostCmd_DS_ROAM_OFFLOAD *)&resp->params.roam_offload; + mlan_status status = MLAN_STATUS_SUCCESS; + MrvlIEtypesHeader_t *header = MNULL; + MrvlIEtypes_fw_roam_enable_t *roam_offload_enable = MNULL; + + ENTER(); + + if (resp->result == HostCmd_RESULT_OK) { + header = (MrvlIEtypesHeader_t *)cmdrsp_roam_offload->tlv; + header->type = wlan_le16_to_cpu(header->type); + if (header->type == TLV_TYPE_ROAM) { + roam_offload_enable = (MrvlIEtypes_fw_roam_enable_t *) + cmdrsp_roam_offload->tlv; + if ((t_u8)roam_offload_enable->roam_enable) + pmpriv->adapter->fw_roaming = MTRUE; + else { + pmpriv->adapter->fw_roaming = MFALSE; + if (MLAN_STATUS_SUCCESS != + wlan_clear_fw_roaming_pmk(pmpriv)) + PRINTM(MERROR, + "wlan_clear_fw_roaming_pmk failed\n"); + } + } + } + + LEAVE(); + return status; +} + +/** * @brief This function handles the command response of set/get auto tx * * @param pmpriv A pointer to mlan_private structure @@ -2630,12 +2738,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_auto_tx(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_auto_tx(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_AUTO_TX *cmdrsp_auto_tx = - (HostCmd_DS_AUTO_TX *) & resp->params.auto_tx; + (HostCmd_DS_AUTO_TX *)&resp->params.auto_tx; mlan_status status = MLAN_STATUS_SUCCESS; MrvlIEtypesHeader_t *header = MNULL; mlan_ds_misc_cfg *misc = MNULL; @@ -2668,10 +2776,9 @@ len = wlan_le16_to_cpu(header->len); if (header->type == TLV_TYPE_CLOUD_KEEP_ALIVE) { keep_alive_tlv = (MrvlIEtypes_Cloud_Keep_Alive_t *) - cmdrsp_auto_tx->tlv_buffer; - misc_keep_alive = - (mlan_ds_misc_keep_alive *) & misc->param. - keep_alive; + cmdrsp_auto_tx->tlv_buffer; + misc_keep_alive = (mlan_ds_misc_keep_alive *)&misc + ->param.keep_alive; misc_keep_alive->mkeep_alive_id = keep_alive_tlv->keep_alive_id; misc_keep_alive->enable = keep_alive_tlv->enable; @@ -2679,46 +2786,43 @@ (action == HostCmd_ACT_GEN_RESET)) && !keep_alive_tlv->enable) { len = len - - sizeof(keep_alive_tlv->keep_alive_id) - - sizeof(keep_alive_tlv->enable); + sizeof(keep_alive_tlv->keep_alive_id) - + sizeof(keep_alive_tlv->enable); if (len > sizeof(MrvlIEtypesHeader_t)) { header = (MrvlIEtypesHeader_t *) - keep_alive_tlv->tlv; + keep_alive_tlv->tlv; header->type = wlan_le16_to_cpu(header->type); len = wlan_le16_to_cpu(header->len) - - sizeof(Eth803Hdr_t); + sizeof(Eth803Hdr_t); if (header->type == TLV_TYPE_KEEP_ALIVE_PKT) { pkt_tlv = (MrvlIEtypes_Keep_Alive_Pkt_t - *) keep_alive_tlv->tlv; - memcpy_ext(pmpriv->adapter, - misc_keep_alive-> - dst_mac, - pkt_tlv->eth_header. - dest_addr, - MLAN_MAC_ADDR_LENGTH, - sizeof - (misc_keep_alive-> - dst_mac)); - memcpy_ext(pmpriv->adapter, - misc_keep_alive-> - src_mac, - pkt_tlv->eth_header. - src_addr, - MLAN_MAC_ADDR_LENGTH, - sizeof - (misc_keep_alive-> - src_mac)); - memcpy_ext(pmpriv->adapter, - misc_keep_alive-> - packet, - pkt_tlv->ip_packet, - len, - sizeof - (misc_keep_alive-> - packet)); + *)keep_alive_tlv + ->tlv; + memcpy_ext( + pmpriv->adapter, + misc_keep_alive->dst_mac, + pkt_tlv->eth_header + .dest_addr, + MLAN_MAC_ADDR_LENGTH, + sizeof(misc_keep_alive + ->dst_mac)); + memcpy_ext( + pmpriv->adapter, + misc_keep_alive->src_mac, + pkt_tlv->eth_header + .src_addr, + MLAN_MAC_ADDR_LENGTH, + sizeof(misc_keep_alive + ->src_mac)); + memcpy_ext( + pmpriv->adapter, + misc_keep_alive->packet, + pkt_tlv->ip_packet, len, + sizeof(misc_keep_alive + ->packet)); misc_keep_alive->pkt_len = len; } } @@ -2743,13 +2847,13 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_mfg_tx_cont(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_mfg_tx_cont(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; - struct mfg_cmd_tx_cont *mcmd = (struct mfg_cmd_tx_cont - *)&resp->params.mfg_tx_cont; + struct mfg_cmd_tx_cont *mcmd = + (struct mfg_cmd_tx_cont *)&resp->params.mfg_tx_cont; struct mfg_cmd_tx_cont *cfg = MNULL; ENTER(); @@ -2781,13 +2885,13 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_mfg_tx_frame(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_mfg_tx_frame(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; - struct mfg_cmd_tx_frame2 *mcmd = (struct mfg_cmd_tx_frame2 - *)&resp->params.mfg_tx_frame2; + struct mfg_cmd_tx_frame2 *mcmd = + (struct mfg_cmd_tx_frame2 *)&resp->params.mfg_tx_frame2; struct mfg_cmd_tx_frame2 *cfg = MNULL; ENTER(); @@ -2824,6 +2928,53 @@ LEAVE(); return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command resp of MFG config Trigger frame + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_ret_mfg_config_trigger_frame(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *misc = MNULL; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *mcmd = + (mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *)&resp->params + .mfg_tx_trigger_config; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *cfg = MNULL; + + ENTER(); + if (!pioctl_buf) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + cfg = (mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *)&misc->param + .mfg_tx_trigger_config; + + cfg->enable_tx = wlan_le32_to_cpu(mcmd->enable_tx); + cfg->standalone_hetb = wlan_le32_to_cpu(mcmd->standalone_hetb); + cfg->frmCtl.type = wlan_le16_to_cpu(mcmd->frmCtl.type); + cfg->frmCtl.sub_type = wlan_le16_to_cpu(mcmd->frmCtl.sub_type); + cfg->duration = wlan_le16_to_cpu(mcmd->duration); + + cfg->trig_common_field = wlan_le64_to_cpu(mcmd->trig_common_field); + + memcpy_ext(pmpriv->adapter, &cfg->trig_user_info_field, + &mcmd->trig_user_info_field, + sizeof(mcmd->trig_user_info_field), + sizeof(cfg->trig_user_info_field)); + + cfg->basic_trig_user_info = + wlan_le16_to_cpu(mcmd->basic_trig_user_info); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} /** * @brief This function prepares command resp of MFG HE TB Tx @@ -2835,13 +2986,13 @@ * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_mfg_he_tb_tx(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_mfg_he_tb_tx(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; - struct mfg_Cmd_HE_TBTx_t *mcmd = (struct mfg_Cmd_HE_TBTx_t - *)&resp->params.mfg_he_power; + struct mfg_Cmd_HE_TBTx_t *mcmd = + (struct mfg_Cmd_HE_TBTx_t *)&resp->params.mfg_he_power; struct mfg_Cmd_HE_TBTx_t *cfg = MNULL; ENTER(); @@ -2860,7 +3011,6 @@ LEAVE(); return MLAN_STATUS_SUCCESS; - } /** @@ -2872,15 +3022,17 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_mfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_misc_cfg *misc = MNULL; - struct mfg_cmd_generic_cfg *mcmd = (struct mfg_cmd_generic_cfg - *)&resp->params.mfg_generic_cfg; + struct mfg_cmd_generic_cfg *mcmd = + (struct mfg_cmd_generic_cfg *)&resp->params.mfg_generic_cfg; struct mfg_cmd_generic_cfg *cfg = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; +#ifdef SD9177 + mlan_adapter *pmadapter = pmpriv->adapter; +#endif ENTER(); if (!pioctl_buf) { @@ -2897,6 +3049,10 @@ case MFG_CMD_CONFIG_MAC_HE_TB_TX: ret = wlan_ret_mfg_he_tb_tx(pmpriv, resp, pioctl_buf); goto cmd_mfg_done; + case MFG_CMD_CONFIG_TRIGGER_FRAME: + ret = wlan_ret_mfg_config_trigger_frame(pmpriv, resp, + pioctl_buf); + goto cmd_mfg_done; case MFG_CMD_SET_TEST_MODE: case MFG_CMD_UNSET_TEST_MODE: case MFG_CMD_TX_ANT: @@ -2916,7 +3072,20 @@ cfg = (struct mfg_cmd_generic_cfg *)&misc->param.mfg_generic_cfg; cfg->error = wlan_le32_to_cpu(mcmd->error); - cfg->data1 = wlan_le32_to_cpu(mcmd->data1); + +#ifdef SD9177 + if (IS_SD9177(pmadapter->card_type) && + (wlan_le32_to_cpu(mcmd->mfg_cmd) == MFG_CMD_RFPWR)) { + //! TX_POWER was multipied by 16 while passing to fw + //! So It is needed to divide by 16 for user vals understanding. + cfg->data1 = (wlan_le32_to_cpu(mcmd->data1) >> 4); + } else { +#endif + cfg->data1 = wlan_le32_to_cpu(mcmd->data1); +#ifdef SD9177 + } +#endif + cfg->data2 = wlan_le32_to_cpu(mcmd->data2); cfg->data3 = wlan_le32_to_cpu(mcmd->data3); cmd_mfg_done: @@ -2934,9 +3103,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, - t_void *pcmd_buf, t_void *pioctl) +mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, + t_void *pcmd_buf, t_void *pioctl) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *)priv; @@ -2951,8 +3119,7 @@ ENTER(); /* If the command is not successful, cleanup and return failure */ - if ((resp->result != HostCmd_RESULT_OK) - ) { + if ((resp->result != HostCmd_RESULT_OK)) { ret = wlan_process_cmdresp_error(pmpriv, resp, pioctl_buf); LEAVE(); return ret; @@ -3034,6 +3201,15 @@ resp->params.ssu_params.rec_len); break; #endif + case HostCmd_CMD_CSI: + if (resp->params.csi_params.action == CSI_CMD_ENABLE) { + pmadapter->csi_enabled = 1; + PRINTM(MCMND, "CSI ENABLE cmdresp\n"); + } else { + pmadapter->csi_enabled = 0; + PRINTM(MCMND, "CSI DISABLE cmdresp\n"); + } + break; case HostCmd_CMD_802_11_ASSOCIATE: ret = wlan_ret_802_11_associate(pmpriv, resp, pioctl_buf); break; @@ -3121,6 +3297,10 @@ break; case HostCmd_CMD_RECONFIGURE_TX_BUFF: wlan_set_tx_pause_flag(pmpriv, MFALSE); +#if defined(USB) + if (IS_USB(pmadapter->card_type)) + wlan_resync_usb_port(pmadapter); +#endif pmadapter->tx_buf_size = (t_u16)wlan_le16_to_cpu(resp->params.tx_buf.buff_size); @@ -3128,21 +3308,19 @@ if (IS_SD(pmadapter->card_type)) { pmadapter->tx_buf_size = (pmadapter->tx_buf_size / MLAN_SDIO_BLOCK_SIZE) * - MLAN_SDIO_BLOCK_SIZE; - pmadapter->pcard_sd->mp_end_port = - wlan_le16_to_cpu(resp->params.tx_buf. - mp_end_port); + MLAN_SDIO_BLOCK_SIZE; + pmadapter->pcard_sd->mp_end_port = wlan_le16_to_cpu( + resp->params.tx_buf.mp_end_port); pmadapter->pcard_sd->mp_data_port_mask = pmadapter->pcard_sd->reg->data_port_mask; for (ctr = 1; - ctr <= - pmadapter->pcard_sd->max_ports - - pmadapter->pcard_sd->mp_end_port; ctr++) { + ctr <= pmadapter->pcard_sd->max_ports - + pmadapter->pcard_sd->mp_end_port; + ctr++) { pmadapter->pcard_sd->mp_data_port_mask &= - ~(1 << - (pmadapter->pcard_sd->max_ports - - ctr)); + ~(1 << (pmadapter->pcard_sd->max_ports - + ctr)); } pmadapter->pcard_sd->curr_wr_port = @@ -3151,8 +3329,8 @@ MIN(pmadapter->pcard_sd->mp_aggr_pkt_limit, (pmadapter->pcard_sd->mp_end_port >> 1)); PRINTM(MCMND, "end port %d, data port mask %x\n", - wlan_le16_to_cpu(resp->params.tx_buf. - mp_end_port), + wlan_le16_to_cpu( + resp->params.tx_buf.mp_end_port), pmadapter->pcard_sd->mp_data_port_mask); } #endif @@ -3164,10 +3342,9 @@ ret = wlan_ret_amsdu_aggr_ctrl(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_WMM_GET_STATUS: - ret = wlan_ret_wmm_get_status(pmpriv, - resp->params.get_wmm_status. - queue_status_tlv, - resp->size - S_DS_GEN); + ret = wlan_ret_wmm_get_status( + pmpriv, resp->params.get_wmm_status.queue_status_tlv, + resp->size - S_DS_GEN); break; case HostCmd_CMD_WMM_ADDTS_REQ: ret = wlan_ret_wmm_addts_req(pmpriv, resp, pioctl_buf); @@ -3207,8 +3384,8 @@ break; #if 0 case HostCmd_CMD_RECONFIGURE_TX_BUFF: - pmadapter->tx_buf_size = - (t_u16)wlan_le16_to_cpu(resp->params.tx_buf.buff_size); + pmadapter->tx_buf_size = (t_u16)wlan_le16_to_cpu(resp->params. + tx_buf.buff_size); break; #endif case HostCmd_CMD_TX_BF_CFG: @@ -3224,6 +3401,7 @@ case HostCmd_CMD_TARGET_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS: case HostCmd_CMD_BCA_REG_ACCESS: + case HostCmd_CMD_REG_ACCESS: ret = wlan_ret_reg_access(pmpriv->adapter, cmdresp_no, resp, pioctl_buf); break; @@ -3243,6 +3421,9 @@ case HostCmd_CMD_MEASUREMENT_REPORT: ret = wlan_meas_cmdresp_process(pmpriv, resp); break; + case HostCmd_CMD_802_11_NET_MONITOR: + ret = wlan_ret_net_monitor(pmpriv, resp, pioctl_buf); + break; #if defined(PCIE) #if defined(PCIE8997) || defined(PCIE8897) case HostCmd_CMD_PCIE_HOST_BUF_DETAILS: @@ -3264,6 +3445,9 @@ case HostCmd_CMD_OTP_READ_USER_DATA: ret = wlan_ret_otp_user_data(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_FW_AUTO_RECONNECT: + ret = wlan_ret_fw_auto_reconnect(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_HS_WAKEUP_REASON: ret = wlan_ret_hs_wakeup_reason(pmpriv, resp, pioctl_buf); break; @@ -3279,11 +3463,15 @@ pioctl_buf); break; #endif -#ifdef RX_PACKET_COALESCE - case HostCmd_CMD_RX_PKT_COALESCE_CFG: - ret = wlan_ret_rx_pkt_coalesce_cfg(pmpriv, resp, pioctl_buf); + case HostCmd_CMD_MULTI_CHAN_CONFIG: + ret = wlan_ret_multi_chan_cfg(pmpriv, resp, pioctl_buf); break; -#endif + case HostCmd_CMD_MULTI_CHAN_POLICY: + ret = wlan_ret_multi_chan_policy(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_DRCS_CONFIG: + ret = wlan_ret_drcs_cfg(pmpriv, resp, pioctl_buf); + break; case HostCMD_CONFIG_LOW_POWER_MODE: break; case HostCmd_DFS_REPEATER_MODE: @@ -3312,6 +3500,9 @@ break; case HostCmd_CMD_802_11_PS_INACTIVITY_TIMEOUT: break; + case HostCmd_CMD_ROAM_OFFLOAD: + ret = wlan_ret_roam_offload(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_GET_TSF: ret = wlan_ret_get_tsf(pmpriv, resp, pioctl_buf); break; @@ -3368,6 +3559,9 @@ case HostCmd_CMD_HAL_PHY_CFG: ret = wlan_ret_hal_phy_cfg(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_IPS_CONFIG: + ret = wlan_ret_ips_cfg(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_RATE_ADAPT_CFG: ret = wlan_ret_rate_adapt_cfg(pmpriv, resp, pioctl_buf); break; @@ -3384,6 +3578,12 @@ case HostCmd_CMD_MFG_COMMAND: ret = wlan_ret_mfg(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_MC_AGGR_CFG: + ret = wlan_ret_mc_aggr_cfg(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_GET_CH_LOAD: + ret = wlan_ret_ch_load(pmpriv, resp, pioctl_buf); + break; default: PRINTM(MERROR, "CMD_RESP: Unknown command response %#x\n", resp->command);
diff --git a/wlan_sd8987/mlan/mlan_sta_event.c b/wlan_sd8987/mlan/mlan_sta_event.c index 66c2fe5..effe3cc 100755 --- a/wlan_sd8987/mlan/mlan_sta_event.c +++ b/wlan_sd8987/mlan/mlan_sta_event.c
@@ -3,7 +3,7 @@ * @brief This file contains MLAN event handling. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -55,8 +55,7 @@ * @param pmpriv A pointer to mlan_private structure * @return N/A */ -static t_void -wlan_handle_disconnect_event(pmlan_private pmpriv) +static t_void wlan_handle_disconnect_event(pmlan_private pmpriv) { ENTER(); @@ -74,8 +73,7 @@ * * @return N/A */ -static void -wlan_parse_tdls_event(pmlan_private priv, pmlan_buffer pevent) +static void wlan_parse_tdls_event(pmlan_private priv, pmlan_buffer pevent) { Event_tdls_generic *tdls_event = (Event_tdls_generic *)(pevent->pbuf + pevent->data_offset + @@ -107,15 +105,12 @@ switch (wlan_le16_to_cpu(tdls_event->event_type)) { case TDLS_EVENT_TYPE_SETUP_REQ: if (sta_ptr == MNULL) { - sta_ptr = - wlan_add_station_entry(priv, - tdls_event-> - peer_mac_addr); + sta_ptr = wlan_add_station_entry( + priv, tdls_event->peer_mac_addr); if (sta_ptr) { sta_ptr->status = TDLS_SETUP_INPROGRESS; - wlan_hold_tdls_packets(priv, - tdls_event-> - peer_mac_addr); + wlan_hold_tdls_packets( + priv, tdls_event->peer_mac_addr); } } break; @@ -124,19 +119,18 @@ if (sta_ptr) { sta_ptr->status = TDLS_SETUP_COMPLETE; /* parse the TLV for station's capability */ - ie_len = wlan_le16_to_cpu(tdls_event->u.ie_data. - ie_length); + ie_len = wlan_le16_to_cpu( + tdls_event->u.ie_data.ie_length); if (ie_len) { pht_cap = (IEEEtypes_HTCap_t *) - wlan_get_specific_ie(priv, - tdls_event->u. - ie_data.ie_ptr, - ie_len, - HT_CAPABILITY, 0); + wlan_get_specific_ie( + priv, + tdls_event->u.ie_data.ie_ptr, + ie_len, HT_CAPABILITY, 0); if (pht_cap) { sta_ptr->is_11n_enabled = MTRUE; - if (GETHT_MAXAMSDU - (pht_cap->ht_cap.ht_cap_info)) + if (GETHT_MAXAMSDU( + pht_cap->ht_cap.ht_cap_info)) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else @@ -145,10 +139,11 @@ } } for (i = 0; i < MAX_NUM_TID; i++) { - if (sta_ptr->is_11n_enabled) + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) sta_ptr->ampdu_sta[i] = priv->aggr_prio_tbl[i] - .ampdu_user; + .ampdu_user; else sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; @@ -176,6 +171,7 @@ case TDLS_EVENT_TYPE_LINK_TORN_DOWN: if (sta_ptr) { if (sta_ptr->external_tdls) { + mlan_status ret = MLAN_STATUS_SUCCESS; PRINTM(MMSG, "Receive TDLS TEAR DOWN event, Disable TDLS LINK\n"); pmadapter->tdls_status = TDLS_TEAR_DOWN; @@ -188,10 +184,13 @@ MLAN_MAC_ADDR_LENGTH); /* Send command to firmware to delete tdls * link*/ - wlan_prepare_cmd(priv, - HostCmd_CMD_TDLS_OPERATION, - HostCmd_ACT_GEN_SET, 0, - (t_void *)MNULL, &tdls_oper); + ret = wlan_prepare_cmd( + priv, HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, 0, (t_void *)MNULL, + &tdls_oper); + if (ret) + PRINTM(MERROR, + "11D: failed to send cmd to FW\n"); ptdls_event->bss_index = priv->bss_index; ptdls_event->event_id = MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; @@ -202,29 +201,28 @@ tdls_event->peer_mac_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - tdls_evt->reason_code = - wlan_le16_to_cpu(tdls_event->u. - reason_code); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, - ptdls_event); + tdls_evt->reason_code = wlan_le16_to_cpu( + tdls_event->u.reason_code); + wlan_recv_event( + priv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); /* Signal MOAL to trigger mlan_main_process */ - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); LEAVE(); return; } wlan_restore_tdls_packets(priv, tdls_event->peer_mac_addr, TDLS_TEAR_DOWN); - if (sta_ptr->is_11n_enabled) { - wlan_cleanup_reorder_tbl(priv, - tdls_event-> - peer_mac_addr); - wlan_11n_cleanup_txbastream_tbl(priv, - tdls_event-> - peer_mac_addr); + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) { + wlan_cleanup_reorder_tbl( + priv, tdls_event->peer_mac_addr); + wlan_11n_cleanup_txbastream_tbl( + priv, tdls_event->peer_mac_addr); } wlan_delete_station_entry(priv, tdls_event->peer_mac_addr); @@ -246,22 +244,20 @@ /* enable traffic to AP */ if (pmadapter->tdls_status != TDLS_IN_BASE_CHANNEL) { - wlan_update_non_tdls_ralist(priv, - tdls_event-> - peer_mac_addr, - MFALSE); + wlan_update_non_tdls_ralist( + priv, tdls_event->peer_mac_addr, + MFALSE); pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; } - } else if (tdls_event->u.switch_result. - current_channel == TDLS_OFF_CHANNEL) { + } else if (tdls_event->u.switch_result.current_channel == + TDLS_OFF_CHANNEL) { /* pause traffic to AP */ if (pmadapter->tdls_status != TDLS_IN_OFF_CHANNEL) { - wlan_update_non_tdls_ralist(priv, - tdls_event-> - peer_mac_addr, - MTRUE); + wlan_update_non_tdls_ralist( + priv, tdls_event->peer_mac_addr, + MTRUE); pmadapter->tdls_status = TDLS_IN_OFF_CHANNEL; } @@ -301,8 +297,7 @@ * * @return N/A */ -static void -wlan_send_tdls_tear_down_request(pmlan_private priv) +static void wlan_send_tdls_tear_down_request(pmlan_private priv) { t_u8 event_buf[100]; mlan_event *ptdls_event = (mlan_event *)event_buf; @@ -312,13 +307,10 @@ ENTER(); - sta_ptr = - (sta_node *)util_peek_list(priv->adapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + sta_ptr = (sta_node *)util_peek_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!sta_ptr) { LEAVE(); return; @@ -359,8 +351,7 @@ * * @return N/A */ -t_void -wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) +t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) { mlan_adapter *pmadapter = priv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -383,7 +374,12 @@ if (drv_disconnect) { priv->media_connected = MFALSE; pmadapter->state_rdh.tx_block = MFALSE; - wlan_11h_check_update_radar_det_state(priv); +#ifdef UAP_SUPPORT + if (pmadapter->dfs_mode) + wlan_11h_update_dfs_master_state_on_disconect(priv); + else +#endif + wlan_11h_check_update_radar_det_state(priv); } if (priv->port_ctrl_mode == MTRUE) { @@ -459,8 +455,6 @@ pmadapter->tx_lock_flag = MFALSE; pmadapter->pps_uapsd_mode = MFALSE; pmadapter->delay_null_pkt = MFALSE; - if (priv->bss_type == MLAN_BSS_TYPE_STA) - pmadapter->hs_wake_interval = 0; if ((wlan_fw_11d_is_enabled(priv)) && (priv->state_11d.user_enable_11d == DISABLE_11D)) { @@ -504,8 +498,7 @@ * * @return N/A */ -t_void -wlan_2040_coex_event(pmlan_private pmpriv) +t_void wlan_2040_coex_event(pmlan_private pmpriv) { t_u8 event_buf[100]; mlan_event *pevent = (mlan_event *)event_buf; @@ -514,19 +507,18 @@ ENTER(); if (pmpriv->curr_bss_params.bss_descriptor.poverlap_bss_scan_param && - pmpriv->curr_bss_params.bss_descriptor.poverlap_bss_scan_param-> - ieee_hdr.element_id == OVERLAPBSSSCANPARAM) { - ele_len = - pmpriv->curr_bss_params.bss_descriptor. - poverlap_bss_scan_param->ieee_hdr.len; + pmpriv->curr_bss_params.bss_descriptor.poverlap_bss_scan_param + ->ieee_hdr.element_id == OVERLAPBSSSCANPARAM) { + ele_len = pmpriv->curr_bss_params.bss_descriptor + .poverlap_bss_scan_param->ieee_hdr.len; pevent->bss_index = pmpriv->bss_index; pevent->event_id = MLAN_EVENT_ID_DRV_OBSS_SCAN_PARAM; pevent->event_len = ele_len; /* Copy OBSS scan parameters */ memcpy_ext(pmpriv->adapter, (t_u8 *)pevent->event_buf, - (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor. - poverlap_bss_scan_param->obss_scan_param, ele_len, - pevent->event_len); + (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor + .poverlap_bss_scan_param->obss_scan_param, + ele_len, pevent->event_len); wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_OBSS_SCAN_PARAM, pevent); } @@ -542,8 +534,8 @@ * * @return N/A */ -static void -wlan_process_sta_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) +static void wlan_process_sta_tx_pause_event(pmlan_private priv, + pmlan_buffer pevent) { t_u16 tlv_type, tlv_len; int tlv_buf_left = pevent->data_len - sizeof(t_u32); @@ -580,26 +572,23 @@ else priv->tx_pause = MFALSE; } else { - status = wlan_get_tdls_link_status(priv, - tx_pause_tlv-> - peermac); + status = wlan_get_tdls_link_status( + priv, tx_pause_tlv->peermac); if (MTRUE == wlan_is_tdls_link_setup(status)) { - sta_ptr = - wlan_get_station_entry(priv, - tx_pause_tlv-> - peermac); + sta_ptr = wlan_get_station_entry( + priv, tx_pause_tlv->peermac); if (sta_ptr) { if (sta_ptr->tx_pause != tx_pause_tlv->tx_pause) { sta_ptr->tx_pause = - tx_pause_tlv-> - tx_pause; - wlan_update_ralist_tx_pause - (priv, - tx_pause_tlv-> - peermac, - tx_pause_tlv-> - tx_pause); + tx_pause_tlv + ->tx_pause; + wlan_update_ralist_tx_pause( + priv, + tx_pause_tlv + ->peermac, + tx_pause_tlv + ->tx_pause); } } } @@ -622,8 +611,7 @@ * received from firmware * @return N/A */ -static void -wlan_print_disconnect_reason(t_u16 reason_code) +static void wlan_print_disconnect_reason(t_u16 reason_code) { ENTER(); @@ -678,8 +666,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_sta_process_event(t_void *priv) +mlan_status wlan_ops_sta_process_event(t_void *priv) { pmlan_private pmpriv = (pmlan_private)priv; pmlan_adapter pmadapter = pmpriv->adapter; @@ -691,6 +678,7 @@ t_u16 reason_code; pmlan_callbacks pcb = &pmadapter->callbacks; mlan_event *pevent = MNULL; + t_u8 addr[MLAN_MAC_ADDR_LENGTH]; chan_band_info *pchan_band_info = MNULL; t_u8 radar_chan; t_u16 enable = 0; @@ -813,15 +801,21 @@ break; pmadapter->tx_lock_flag = MFALSE; if (pmadapter->pps_uapsd_mode && pmadapter->gen_null_pkt) { - if (MTRUE == wlan_check_last_packet_indication(pmpriv)) { - if (!pmadapter->data_sent) { - if (wlan_send_null_packet(pmpriv, - MRVDRV_TxPD_POWER_MGMT_NULL_PACKET - | - MRVDRV_TxPD_POWER_MGMT_LAST_PACKET) - == MLAN_STATUS_SUCCESS) { - LEAVE(); - return MLAN_STATUS_SUCCESS; + if (MTRUE == + wlan_check_last_packet_indication(pmpriv)) { + if (!pmadapter->data_sent +#if defined(USB) + && wlan_is_port_ready(pmadapter, + pmpriv->port_index) +#endif + ) { + if (wlan_send_null_packet( + pmpriv, + MRVDRV_TxPD_POWER_MGMT_NULL_PACKET | + MRVDRV_TxPD_POWER_MGMT_LAST_PACKET) == + MLAN_STATUS_SUCCESS) { + ret = MLAN_STATUS_SUCCESS; + goto done; } } } @@ -856,6 +850,14 @@ wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_ADHOC_LINK_LOST, MNULL); break; + case EVENT_ASSOC_REQ_IE: + pmpriv->assoc_req_size = pmbuf->data_len - sizeof(eventcause); + evt_buf = + (pmbuf->pbuf + pmbuf->data_offset + sizeof(eventcause)); + memcpy_ext(pmpriv->adapter, pmpriv->assoc_req_buf, evt_buf, + pmbuf->data_len - sizeof(eventcause), + MRVDRV_ASSOC_RSP_BUF_SIZE); + break; case EVENT_FW_DEBUG_INFO: pevent->bss_index = pmpriv->bss_index; @@ -863,7 +865,7 @@ pevent->event_len = pmbuf->data_len - sizeof(eventcause); memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), pevent->event_len, pevent->event_len); PRINTM(MEVENT, "EVENT: FW Debug Info %s\n", (t_u8 *)pevent->event_buf); @@ -890,24 +892,26 @@ } pmadapter->scan_block = MFALSE; wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_PORT_RELEASE, MNULL); + /* Send OBSS scan param to the application */ + wlan_2040_coex_event(pmpriv); break; case EVENT_STOP_TX: PRINTM(MEVENT, "EVENT: Stop Tx (%#x)\n", eventcause); - wlan_11h_tx_disable(pmpriv); /* this fn will send event up to - MOAL */ + wlan_11h_tx_disable(pmpriv); /* this fn will send event up to + MOAL */ break; case EVENT_START_TX: PRINTM(MEVENT, "EVENT: Start Tx (%#x)\n", eventcause); - wlan_11h_tx_enable(pmpriv); /* this fn will send event up to - MOAL */ + wlan_11h_tx_enable(pmpriv); /* this fn will send event up to + MOAL */ break; case EVENT_CHANNEL_SWITCH: PRINTM(MEVENT, "EVENT: Channel Switch (%#x)\n", eventcause); if (pmadapter->ecsa_enable) { MrvlIEtypes_channel_band_t *pchan_info = (MrvlIEtypes_channel_band_t - *)(pmadapter->event_body); + *)(pmadapter->event_body); t_u8 channel = pchan_info->channel; chan_freq_power_t *cfp = MNULL; DBG_HEXDUMP(MCMD_D, "chan band config", @@ -917,11 +921,11 @@ channel); #define MAX_CHANNEL_BAND_B 14 if (channel <= MAX_CHANNEL_BAND_B) - cfp = wlan_find_cfp_by_band_and_channel - (pmadapter, BAND_B, channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, BAND_B, channel); else - cfp = wlan_find_cfp_by_band_and_channel - (pmadapter, BAND_A, channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, BAND_A, channel); pmpriv->curr_bss_params.bss_descriptor.channel = channel; if (cfp) @@ -929,6 +933,10 @@ cfp->freq; else pmpriv->curr_bss_params.bss_descriptor.freq = 0; +#ifdef UAP_SUPPORT + if (pmpriv->adapter->dfs_mode) + wlan_11h_update_dfs_master_state_by_sta(pmpriv); +#endif if (pmpriv->adapter->state_rdh.stage == RDH_SET_CUSTOM_IE) { pmadapter->state_rdh.stage = @@ -942,7 +950,7 @@ pevent->event_id = MLAN_EVENT_ID_FW_CHAN_SWITCH_COMPLETE; pevent->event_len = sizeof(chan_band_info); - pchan_band_info = (chan_band_info *) pevent->event_buf; + pchan_band_info = (chan_band_info *)pevent->event_buf; /* Copy event data */ memcpy_ext(pmadapter, (t_u8 *)&pchan_band_info->bandcfg, (t_u8 *)&pchan_info->bandcfg, @@ -951,10 +959,10 @@ pchan_band_info->channel = pchan_info->channel; if (pchan_band_info->bandcfg.chanWidth == CHAN_BW_80MHZ) pchan_band_info->center_chan = - wlan_get_center_freq_idx(priv, BAND_AAC, - pchan_info-> - channel, - CHANNEL_BW_80MHZ); + wlan_get_center_freq_idx( + priv, BAND_AAC, + pchan_info->channel, + CHANNEL_BW_80MHZ); wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_CHAN_SWITCH_COMPLETE, pevent); @@ -985,9 +993,8 @@ pmadapter->state_rdh.stage = RDH_CHK_INTFS; wlan_11h_radar_detected_handling(pmadapter, pmpriv); } else { - PRINTM(MEVENT, - "Ignore Event Radar Detected - handling" - " already in progress.\n"); + PRINTM(MEVENT, "Ignore Event Radar Detected - handling" + " already in progress.\n"); } break; @@ -1001,11 +1008,11 @@ /* Copy event data */ memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), pevent->event_len, pevent->event_len); /* Handle / pass event data */ ret = wlan_11h_handle_event_chanrpt_ready(pmpriv, pevent, - &radar_chan); + &radar_chan, 0); /* Also send this event as passthru */ pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; pevent->event_len = pmbuf->data_len; @@ -1037,7 +1044,7 @@ case EVENT_WMM_STATUS_CHANGE: if (pmbuf && pmbuf->data_len > - sizeof(eventcause) + sizeof(MrvlIEtypesHeader_t)) { + sizeof(eventcause) + sizeof(MrvlIEtypesHeader_t)) { PRINTM(MEVENT, "EVENT: WMM status changed: %d\n", pmbuf->data_len); @@ -1046,7 +1053,7 @@ wlan_ret_wmm_get_status(pmpriv, evt_buf, pmbuf->data_len - - sizeof(eventcause)); + sizeof(eventcause)); } else { PRINTM(MEVENT, "EVENT: WMM status changed\n"); ret = wlan_cmd_wmm_status_change(pmpriv); @@ -1113,9 +1120,9 @@ break; case EVENT_IBSS_COALESCED: PRINTM(MEVENT, "EVENT: IBSS_COALESCED\n"); - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, - HostCmd_ACT_GEN_GET, 0, MNULL, MNULL); + ret = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, + HostCmd_ACT_GEN_GET, 0, MNULL, MNULL); break; case EVENT_ADDBA: PRINTM(MEVENT, "EVENT: ADDBA Request\n"); @@ -1139,9 +1146,9 @@ case EVENT_BA_STREAM_TIMEOUT: PRINTM(MEVENT, "EVENT: BA Stream timeout\n"); if (pmpriv->media_connected == MTRUE) - wlan_11n_ba_stream_timeout(pmpriv, - (HostCmd_DS_11N_BATIMEOUT *) - pmadapter->event_body); + wlan_11n_ba_stream_timeout( + pmpriv, (HostCmd_DS_11N_BATIMEOUT *) + pmadapter->event_body); else PRINTM(MERROR, "Ignore BA Stream timeout event in disconnected state\n"); @@ -1158,9 +1165,9 @@ MIN(pmadapter->curr_tx_buf_size, wlan_le16_to_cpu(*(t_u16 *)pmadapter->event_body)); if (pmbuf->data_len == sizeof(eventcause) + sizeof(t_u32)) { - enable = wlan_le16_to_cpu(*(t_u16 *) - (pmadapter->event_body + - sizeof(t_u16))); + enable = wlan_le16_to_cpu( + *(t_u16 *)(pmadapter->event_body + + sizeof(t_u16))); if (enable) pmpriv->amsdu_disable = MFALSE; else @@ -1250,17 +1257,19 @@ break; case EVENT_IBSS_STATION_DISCONNECT: break; - case EVENT_SAD_REPORT: - { + case EVENT_SAD_REPORT: { #ifdef DEBUG_LEVEL1 - t_u8 *pevt_dat = pmbuf->pbuf + pmbuf->data_offset + - sizeof(t_u32); + t_u8 *pevt_dat = + pmbuf->pbuf + pmbuf->data_offset + sizeof(t_u32); #endif - PRINTM(MEVENT, - "EVENT: Antenna Diversity %d (%d, %d, %d, %d)\n", - eventcause, pevt_dat[0] + 1, pevt_dat[1] + 1, - pevt_dat[2], pevt_dat[3]); - } + PRINTM(MEVENT, + "EVENT: Antenna Diversity %d (%d, %d, %d, %d)\n", + eventcause, pevt_dat[0] + 1, pevt_dat[1] + 1, + pevt_dat[2], pevt_dat[3]); + } break; + case EVENT_MULTI_CHAN_INFO: + PRINTM(MEVENT, "EVENT: MULTI_CHAN_INFO\n"); + wlan_handle_event_multi_chan_info(pmpriv, pmbuf); break; case EVENT_FW_DUMP_INFO: @@ -1302,24 +1311,29 @@ */ memcpy_ext(pmadapter, (t_u8 *)pmadapter->ssu_buf->pbuf + - pmadapter->ssu_buf->data_offset, + pmadapter->ssu_buf->data_offset, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), (pmbuf->data_len - sizeof(eventcause)), (pmbuf->data_len - sizeof(eventcause))); DBG_HEXDUMP(MEVT_D, "SSU data", (t_u8 *)pmadapter->ssu_buf->pbuf + - pmadapter->ssu_buf->data_offset, 512); + pmadapter->ssu_buf->data_offset, + 512); pevent->bss_index = pmpriv->bss_index; pevent->event_id = MLAN_EVENT_ID_SSU_DUMP_FILE; pevent->event_len = MLAN_SSU_BUF_SIZE; *(t_ptr *)pevent->event_buf = (t_ptr)pmadapter->ssu_buf->pbuf + - pmadapter->ssu_buf->data_offset; + pmadapter->ssu_buf->data_offset; wlan_recv_event(pmpriv, pevent->event_id, pevent); wlan_free_ssu_pcie_buf(pmadapter); break; #endif + case EVENT_CSI: + PRINTM(MEVENT, "EVENT: EVENT_CSI on STA\n"); + wlan_process_csi_event(pmpriv); + break; case EVENT_MEF_HOST_WAKEUP: PRINTM(MEVENT, "EVENT: EVENT_MEF_HOST_WAKEUP len=%d\n", pmbuf->data_len); @@ -1327,6 +1341,41 @@ case EVENT_MANAGEMENT_FRAME_WAKEUP: PRINTM(MEVENT, "EVENT: EVENT_MANAGEMENT_FRAME_WAKEUP HOST\n"); break; + case EVENT_ROAM_OFFLOAD: + memcpy_ext(pmadapter, addr, + pmpriv->curr_bss_params.bss_descriptor.mac_address, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + memcpy_ext(pmadapter, + pmpriv->curr_bss_params.bss_descriptor.mac_address, + (t_u8 *)(pmadapter->event_body + 2), + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + /** replace ralist's mac address with new mac address */ + if (0 == + wlan_ralist_update( + pmpriv, addr, + pmpriv->curr_bss_params.bss_descriptor.mac_address)) + wlan_ralist_add(pmpriv, + pmpriv->curr_bss_params.bss_descriptor + .mac_address); + wlan_11n_cleanup_reorder_tbl(pmpriv); + wlan_11n_deleteall_txbastream_tbl(pmpriv); + /*Update the BSS for inform kernel, otherwise kernel will give + * warning for not find BSS*/ + memcpy_ext(pmadapter, (t_u8 *)&pmadapter->pscan_table[0], + (t_u8 *)&pmpriv->curr_bss_params.bss_descriptor, + sizeof(BSSDescriptor_t), sizeof(BSSDescriptor_t)); + if (!pmadapter->num_in_scan_table) + pmadapter->num_in_scan_table = 1; + PRINTM(MEVENT, "EVENT: ROAM OFFLOAD IN FW SUCCESS\n"); + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT; + /** Drop event id length and 2 bytes reverved length*/ + pevent->event_len = pmbuf->data_len - sizeof(eventcause) - 2; + memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, + pmadapter->event_body + 2, pevent->event_len, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); + break; case EVENT_CLOUD_KEEP_ALIVE_RETRY_FAIL: break; case EVENT_VDLL_IND: @@ -1346,6 +1395,17 @@ pmadapter->fw_hang_report = MTRUE; wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DBG_DUMP, MNULL); break; + case CHAN_LOAD_EVENT: { + t_u8 *ptr = MNULL; + HostCmd_DS_GET_CH_LOAD *cfg_cmd = MNULL; + ptr = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); + ptr += 4; /* data start */ + cfg_cmd = (HostCmd_DS_GET_CH_LOAD *)ptr; + pmpriv->ch_load_param = wlan_le16_to_cpu(cfg_cmd->ch_load); + pmpriv->noise = wlan_le16_to_cpu(cfg_cmd->noise); + pmpriv->rx_quality = wlan_le16_to_cpu(cfg_cmd->rx_quality); + break; + } default: PRINTM(MEVENT, "EVENT: unknown event id: %#x\n", eventcause); wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_UNKNOWN, MNULL);
diff --git a/wlan_sd8987/mlan/mlan_sta_ioctl.c b/wlan_sd8987/mlan/mlan_sta_ioctl.c index 1d62434..205a2a8 100755 --- a/wlan_sd8987/mlan/mlan_sta_ioctl.c +++ b/wlan_sd8987/mlan/mlan_sta_ioctl.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for station ioctl. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -59,8 +59,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_get_info_signal(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_get_info_signal(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -115,8 +115,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_get_info_signal_ext(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_get_info_signal_ext(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -165,8 +165,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_get_info_stats(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_get_info_stats(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -213,9 +213,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl_get_chan_info(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_get_chan_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -262,8 +261,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_get_info_bss_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_get_info_bss_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -296,7 +295,7 @@ info->param.bss_info.beacon_interval = pbss_desc->beacon_period; /* Band */ - info->param.bss_info.bss_band = (t_u8)pbss_desc->bss_band; + info->param.bss_info.bss_band = pbss_desc->bss_band; /* Region code */ info->param.bss_info.region_code = pmadapter->region_code; @@ -348,7 +347,7 @@ if (pbss_desc->pext_cap) { memcpy_ext(pmadapter, &info->param.bss_info.ext_cap, (t_u8 *)pbss_desc->pext_cap + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), pbss_desc->pext_cap->ieee_hdr.len, sizeof(info->param.bss_info.ext_cap)); } @@ -358,8 +357,7 @@ /* Association ID */ info->param.bss_info.assoc_id = - (t_u16)((IEEEtypes_AssocRsp_t *)pmpriv->assoc_rsp_buf) - ->a_id; + (t_u16)((IEEEtypes_AssocRsp_t *)pmpriv->assoc_rsp_buf)->a_id; /* AP/Peer supported rates */ memset(pmadapter, info->param.bss_info.peer_supp_rates, 0, @@ -387,8 +385,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_get_info_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_get_info_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_get_info *pget_info = MNULL; @@ -414,6 +412,8 @@ pget_info->param.fw_info.fw_ver = pmadapter->fw_release_number; pget_info->param.fw_info.hotfix_version = pmadapter->fw_hotfix_ver; + pget_info->param.fw_info.tx_buf_size = pmadapter->tx_buf_size; + memcpy_ext(pmadapter, &pget_info->param.fw_info.mac_addr, pmpriv->curr_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); @@ -446,6 +446,8 @@ pmpriv->usr_dot_11ac_mcs_support; pget_info->param.fw_info.usr_dot_11ac_dev_cap_a = pmpriv->usr_dot_11ac_dev_cap_a; + pget_info->param.fw_info.uuid_lo = pmadapter->uuid_lo; + pget_info->param.fw_info.uuid_hi = pmadapter->uuid_hi; pget_info->param.fw_info.hw_hecap_len = pmadapter->hw_hecap_len; pget_info->param.fw_info.hw_2g_hecap_len = pmadapter->hw_2g_hecap_len; @@ -460,6 +462,9 @@ pget_info->param.fw_info.antinfo = pmadapter->antinfo; pget_info->param.fw_info.max_ap_assoc_sta = pmadapter->max_sta_conn; + pget_info->param.fw_info.fw_roaming_support = + (pmadapter->fw_cap_info & FW_ROAMING_SUPPORT) ? 0x01 : + 0x00; pget_info->param.fw_info.fw_beacon_prot = IS_FW_SUPPORT_BEACON_PROT(pmadapter) ? 0x01 : 0x00; break; @@ -493,8 +498,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_snmp_mib_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_snmp_mib_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -542,6 +547,13 @@ value = mib->param.signalext_enable; cmd_oid = SignalextEnable_i; break; + case MLAN_OID_SNMP_MIB_CHAN_TRACK: + if (!IS_FW_SUPPORT_CHAN_TRACK(pmadapter)) { + goto exit; + } + value = mib->param.chan_track; + cmd_oid = ChanTrackParam_i; + break; } /* Send request to firmware */ @@ -564,8 +576,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_radio_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_radio_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_radio_cfg *radio_cfg = MNULL; @@ -593,12 +605,12 @@ status = wlan_radio_ioctl_ant_cfg(pmadapter, pioctl_req); break; case MLAN_OID_REMAIN_CHAN_CFG: - status = wlan_radio_ioctl_remain_chan_cfg(pmadapter, - pioctl_req); + status = + wlan_radio_ioctl_remain_chan_cfg(pmadapter, pioctl_req); break; case MLAN_OID_MIMO_SWITCH: - status = wlan_radio_ioctl_mimo_switch_cfg(pmadapter, - pioctl_req); + status = + wlan_radio_ioctl_mimo_switch_cfg(pmadapter, pioctl_req); break; default: pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; @@ -618,8 +630,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl_mac_address(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_mac_address(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -656,9 +668,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_set_multicast_list(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_set_multicast_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -693,29 +704,26 @@ ~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE; if (bss->param.multicast_list.num_multicast_addr) { PRINTM(MINFO, "Set multicast list=%d\n", - bss->param.multicast_list. - num_multicast_addr); + bss->param.multicast_list + .num_multicast_addr); /* Set multicast addresses to firmware */ if (old_pkt_filter == pmpriv->curr_pkt_filter) { /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET, - 0, - (t_void *) - pioctl_req, - &bss->param. - multicast_list); + ret = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_MAC_MULTICAST_ADR, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_req, + &bss->param.multicast_list); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; } else { /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET, - 0, MNULL, - &bss->param. - multicast_list); + ret = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_MAC_MULTICAST_ADR, + HostCmd_ACT_GEN_SET, 0, MNULL, + &bss->param.multicast_list); } if (ret) goto exit; @@ -746,9 +754,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl_get_channel_list(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_get_channel_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -769,7 +776,7 @@ (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS && pmpriv->adhoc_state != ADHOC_STARTED))) { t_u8 chan_no; - t_u8 band; + t_u16 band; parsed_region_chan_11d_t *parsed_region_chan = MNULL; parsed_region_chan_11d_t region_chan; @@ -782,12 +789,12 @@ /*If country IE is present in the associated AP then return the channel list from country IE - else return it from the learning table */ + else return it from the learning table*/ - if (wlan_11d_parse_domain_info - (pmadapter, &pbss_desc->country_info, - (t_u8)pbss_desc->bss_band, - ®ion_chan) == MLAN_STATUS_SUCCESS) { + if (wlan_11d_parse_domain_info( + pmadapter, &pbss_desc->country_info, + pbss_desc->bss_band, + ®ion_chan) == MLAN_STATUS_SUCCESS) { parsed_region_chan = ®ion_chan; } else { parsed_region_chan = &pmadapter->parsed_region_chan; @@ -798,32 +805,34 @@ for (i = 0; (bss->param.chanlist.num_of_chan < MLAN_MAX_CHANNEL_NUM) && - (i < parsed_region_chan->no_of_chan); i++) { + (i < parsed_region_chan->no_of_chan); + i++) { chan_no = parsed_region_chan->chan_pwr[i].chan; band = parsed_region_chan->chan_pwr[i].band; PRINTM(MINFO, "band=%d, chan_no=%d\n", band, chan_no); bss->param.chanlist.cf[bss->param.chanlist.num_of_chan] .channel = (t_u32)chan_no; bss->param.chanlist.cf[bss->param.chanlist.num_of_chan] - .freq = - (t_u32)wlan_11d_chan_2_freq(pmadapter, chan_no, - band); + .freq = (t_u32)wlan_11d_chan_2_freq( + pmadapter, chan_no, band); bss->param.chanlist.num_of_chan++; } } else { for (j = 0; (bss->param.chanlist.num_of_chan < MLAN_MAX_CHANNEL_NUM) && - (j < MAX_REGION_CHANNEL_NUM); j++) { + (j < MAX_REGION_CHANNEL_NUM); + j++) { cfp = pmadapter->region_channel[j].pcfp; for (i = 0; (bss->param.chanlist.num_of_chan < MLAN_MAX_CHANNEL_NUM) && - pmadapter->region_channel[j].valid && cfp && - (i < pmadapter->region_channel[j].num_cfp); i++) { - bss->param.chanlist.cf[bss->param.chanlist. - num_of_chan] + pmadapter->region_channel[j].valid && cfp && + (i < pmadapter->region_channel[j].num_cfp); + i++) { + bss->param.chanlist + .cf[bss->param.chanlist.num_of_chan] .channel = (t_u32)cfp->channel; - bss->param.chanlist.cf[bss->param.chanlist. - num_of_chan] + bss->param.chanlist + .cf[bss->param.chanlist.num_of_chan] .freq = (t_u32)cfp->freq; bss->param.chanlist.num_of_chan++; cfp++; @@ -851,8 +860,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl_channel(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_channel(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = MNULL; mlan_ds_bss *bss = MNULL; @@ -868,12 +877,9 @@ pmpriv = pmadapter->priv[pioctl_req->bss_index]; bss = (mlan_ds_bss *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_GET) { - cfp = wlan_find_cfp_by_band_and_channel(pmadapter, - pmpriv->curr_bss_params. - band, - (t_u16)pmpriv-> - curr_bss_params. - bss_descriptor.channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, pmpriv->curr_bss_params.band, + (t_u16)pmpriv->curr_bss_params.bss_descriptor.channel); if (cfp) { bss->param.bss_chan.channel = cfp->channel; bss->param.bss_chan.freq = cfp->freq; @@ -895,30 +901,24 @@ pmadapter->adhoc_start_band = BAND_G | BAND_B; if (bss->param.bss_chan.channel) { if (bss->param.bss_chan.channel <= MAX_CHANNEL_BAND_B) - cfp = wlan_find_cfp_by_band_and_channel(pmadapter, - BAND_B, - (t_u16)bss-> - param.bss_chan. - channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, BAND_B, + (t_u16)bss->param.bss_chan.channel); if (!cfp) { - cfp = wlan_find_cfp_by_band_and_channel(pmadapter, - BAND_A, - (t_u16)bss-> - param.bss_chan. - channel); + cfp = wlan_find_cfp_by_band_and_channel( + pmadapter, BAND_A, + (t_u16)bss->param.bss_chan.channel); if (cfp) { pmadapter->adhoc_start_band = BAND_A; } } } else { if (bss->param.bss_chan.freq <= MAX_FREQUENCY_BAND_B) - cfp = wlan_find_cfp_by_band_and_freq(pmadapter, BAND_B, - bss->param. - bss_chan.freq); + cfp = wlan_find_cfp_by_band_and_freq( + pmadapter, BAND_B, bss->param.bss_chan.freq); if (!cfp) { - cfp = wlan_find_cfp_by_band_and_freq(pmadapter, BAND_A, - bss->param. - bss_chan.freq); + cfp = wlan_find_cfp_by_band_and_freq( + pmadapter, BAND_A, bss->param.bss_chan.freq); if (cfp) { pmadapter->adhoc_start_band = BAND_A; } @@ -949,8 +949,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_mode(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1005,14 +1005,14 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl_start(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_start(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = (mlan_ds_bss *)pioctl_req->pbuf; t_s32 i = -1; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -1033,33 +1033,28 @@ if (memcmp(pmadapter, &bss->param.ssid_bssid.bssid, zero_mac, sizeof(zero_mac))) - i = wlan_find_ssid_in_list(pmpriv, - &bss->param. - ssid_bssid. - ssid, - (t_u8 *) - &bss->param. - ssid_bssid. - bssid, - MLAN_BSS_MODE_INFRA); + i = wlan_find_ssid_in_list( + pmpriv, + &bss->param.ssid_bssid.ssid, + (t_u8 *)&bss->param.ssid_bssid + .bssid, + MLAN_BSS_MODE_INFRA); else - i = wlan_find_ssid_in_list(pmpriv, - &bss->param. - ssid_bssid. - ssid, MNULL, - MLAN_BSS_MODE_INFRA); + i = wlan_find_ssid_in_list( + pmpriv, + &bss->param.ssid_bssid.ssid, + MNULL, MLAN_BSS_MODE_INFRA); } else { - i = wlan_find_bssid_in_list(pmpriv, - (t_u8 *)&bss->param. - ssid_bssid.bssid, - MLAN_BSS_MODE_INFRA); + i = wlan_find_bssid_in_list( + pmpriv, + (t_u8 *)&bss->param.ssid_bssid.bssid, + MLAN_BSS_MODE_INFRA); } } else { /* use bsslist index number to assoicate */ - i = wlan_is_network_compatible(pmpriv, - bss->param.ssid_bssid. - idx - 1, - pmpriv->bss_mode); + i = wlan_is_network_compatible( + pmpriv, bss->param.ssid_bssid.idx - 1, + pmpriv->bss_mode); } if (i >= 0) { /* block if upper-layer tries to reconnect before new @@ -1093,7 +1088,7 @@ &pmadapter->pscan_table[i]); if (ret) goto start_ssid_done; - } else { /* i >= 0 */ + } else { /* i >= 0 */ PRINTM(MERROR, "SSID not found in scan list: ssid=%s, " MACSTR ", idx=%d\n", @@ -1109,8 +1104,8 @@ /* If the requested SSID matches current SSID, return */ if (bss->param.ssid_bssid.ssid.ssid_len && (!wlan_ssid_cmp(pmadapter, - &pmpriv->curr_bss_params.bss_descriptor. - ssid, &bss->param.ssid_bssid.ssid))) { + &pmpriv->curr_bss_params.bss_descriptor.ssid, + &bss->param.ssid_bssid.ssid))) { ret = MLAN_STATUS_SUCCESS; goto start_ssid_done; } @@ -1127,23 +1122,20 @@ bss->param.ssid_bssid.idx > pmadapter->num_in_scan_table) { /* Search for the requested network in the scan table */ if (bss->param.ssid_bssid.ssid.ssid_len) { - i = wlan_find_ssid_in_list(pmpriv, - &bss->param. - ssid_bssid.ssid, - MNULL, - MLAN_BSS_MODE_IBSS); + i = wlan_find_ssid_in_list( + pmpriv, &bss->param.ssid_bssid.ssid, + MNULL, MLAN_BSS_MODE_IBSS); } else { - i = wlan_find_bssid_in_list(pmpriv, - (t_u8 *)&bss->param. - ssid_bssid.bssid, - MLAN_BSS_MODE_IBSS); + i = wlan_find_bssid_in_list( + pmpriv, + (t_u8 *)&bss->param.ssid_bssid.bssid, + MLAN_BSS_MODE_IBSS); } } else { /* use bsslist index number to assoicate */ - i = wlan_is_network_compatible(pmpriv, - bss->param.ssid_bssid. - idx - 1, - pmpriv->bss_mode); + i = wlan_is_network_compatible( + pmpriv, bss->param.ssid_bssid.idx - 1, + pmpriv->bss_mode); } if (i >= 0) { @@ -1155,7 +1147,7 @@ &pmadapter->pscan_table[i]); if (ret) goto start_ssid_done; - } else { /* i >= 0 */ + } else { /* i >= 0 */ PRINTM(MINFO, "Network not found in the list, " "creating adhoc with ssid = %s\n", @@ -1186,8 +1178,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_stop(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_stop(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1210,8 +1202,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_ibss_channel(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_ibss_channel(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1254,9 +1246,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_listen_interval(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_listen_interval(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1281,9 +1272,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_bss_ioctl_beacon_interval(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_beacon_interval(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1294,8 +1284,8 @@ bss->param.bcn_interval = pmpriv->beacon_period; if (pmpriv->media_connected == MTRUE) bss->param.bcn_interval = - pmpriv->curr_bss_params.bss_descriptor. - beacon_period; + pmpriv->curr_bss_params.bss_descriptor + .beacon_period; } else pmpriv->beacon_period = (t_u16)bss->param.bcn_interval; pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; @@ -1311,8 +1301,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_bss_ioctl_atim_window(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_atim_window(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1323,8 +1313,8 @@ bss->param.atim_window = pmpriv->atim_window; if (pmpriv->media_connected == MTRUE) bss->param.atim_window = - pmpriv->curr_bss_params.bss_descriptor. - atim_window; + pmpriv->curr_bss_params.bss_descriptor + .atim_window; } else pmpriv->atim_window = (t_u16)bss->param.atim_window; @@ -1341,8 +1331,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -static mlan_status -wlan_query_passphrase(mlan_private *priv, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_query_passphrase(mlan_private *priv, + pmlan_ioctl_req pioctl_req) { mlan_adapter *pmadapter = priv->adapter; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1405,8 +1395,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_find_bss(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_find_bss(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1449,8 +1439,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_bss_ioctl_find_bssid(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl_find_bssid(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -1502,8 +1492,7 @@ (t_u32)ssid_bssid->channel); /* check if this channel is supported in the region */ - if (!wlan_find_cfp_by_band_and_channel(pmadapter, - (t_u8)ssid_bssid->bss_band, + if (!wlan_find_cfp_by_band_and_channel(pmadapter, ssid_bssid->bss_band, (t_u32)ssid_bssid->channel)) { PRINTM(MERROR, "Unsupported Channel for region 0x%x\n", pmadapter->region_code); @@ -1522,8 +1511,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_bss_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_bss_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = MNULL; @@ -1643,16 +1632,16 @@ rate = (mlan_ds_rate *)pioctl_req->pbuf; if (rate->param.rate_band_cfg.config_bands && rate->param.rate_band_cfg.bss_mode) - wlan_get_active_data_rates(pmpriv, - rate->param.rate_band_cfg.bss_mode, - rate->param.rate_band_cfg. - config_bands, rate->param.rates); + wlan_get_active_data_rates( + pmpriv, rate->param.rate_band_cfg.bss_mode, + rate->param.rate_band_cfg.config_bands, + rate->param.rates); else wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) ? - pmpriv->config_bands : - pmadapter->adhoc_start_band, + pmpriv->config_bands : + pmadapter->adhoc_start_band, rate->param.rates); pioctl_req->data_read_written = MLAN_SUPPORTED_RATES + MLAN_SUB_COMMAND_SIZE; @@ -1669,8 +1658,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_rate_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_rate_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_rate *rate = MNULL; @@ -1715,9 +1704,9 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_power_ioctl_get_power(pmlan_adapter pmadapter, - t_u16 cmd_no, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_power_ioctl_get_power(pmlan_adapter pmadapter, + t_u16 cmd_no, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1743,8 +1732,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_power_ioctl_set_power(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_power_ioctl_set_power(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_power_cfg *power = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1789,7 +1778,7 @@ if (!power->param.power_cfg.is_power_auto) { txp_cfg->mode = 1; pg_tlv = (MrvlTypes_Power_Group_t - *)(buf + sizeof(HostCmd_DS_TXPWR_CFG)); + *)(buf + sizeof(HostCmd_DS_TXPWR_CFG)); pg_tlv->type = TLV_TYPE_POWER_GROUP; pg_tlv->length = 4 * sizeof(Power_Group_t); pg = (Power_Group_t *)(buf + sizeof(HostCmd_DS_TXPWR_CFG) + @@ -1853,9 +1842,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_power_ioctl_set_power_ext(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_power_ioctl_set_power_ext(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1889,7 +1877,7 @@ txp_cfg->mode = 1; pg_tlv = (MrvlTypes_Power_Group_t - *)(buf + sizeof(HostCmd_DS_TXPWR_CFG)); + *)(buf + sizeof(HostCmd_DS_TXPWR_CFG)); pg_tlv->type = TLV_TYPE_POWER_GROUP; pg_tlv->length = sizeof(Power_Group_t); pg = (Power_Group_t *)(buf + sizeof(HostCmd_DS_TXPWR_CFG) + @@ -1900,7 +1888,8 @@ pg->power_step = (t_s8)pwr_grp->power_step; if (pwr_grp->rate_format == MLAN_RATE_FORMAT_LG) { - if (pwr_grp->first_rate_ind <= MLAN_RATE_INDEX_HRDSSS3) { + if (pwr_grp->first_rate_ind <= + MLAN_RATE_INDEX_HRDSSS3) { pg->modulation_class = MOD_CLASS_HR_DSSS; } else { pg->modulation_class = MOD_CLASS_OFDM; @@ -1955,8 +1944,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_power_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_power_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_power_cfg *power = MNULL; @@ -1975,9 +1964,8 @@ switch (power->sub_command) { case MLAN_OID_POWER_CFG: if (pioctl_req->action == MLAN_ACT_GET) - status = wlan_power_ioctl_get_power(pmadapter, - HostCmd_CMD_TXPWR_CFG, - pioctl_req); + status = wlan_power_ioctl_get_power( + pmadapter, HostCmd_CMD_TXPWR_CFG, pioctl_req); else status = wlan_power_ioctl_set_power(pmadapter, pioctl_req); @@ -1985,9 +1973,8 @@ case MLAN_OID_POWER_CFG_EXT: if (pioctl_req->action == MLAN_ACT_GET) - status = wlan_power_ioctl_get_power(pmadapter, - HostCmd_CMD_TXPWR_CFG, - pioctl_req); + status = wlan_power_ioctl_get_power( + pmadapter, HostCmd_CMD_TXPWR_CFG, pioctl_req); else status = wlan_power_ioctl_set_power_ext(pmadapter, pioctl_req); @@ -2013,9 +2000,9 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_pm_ioctl_ps_mode(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req, t_u16 ps_mode) +static mlan_status wlan_pm_ioctl_ps_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req, + t_u16 ps_mode) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2025,7 +2012,8 @@ if (pioctl_req->action == MLAN_ACT_SET) { sub_cmd = (pmadapter->ps_mode == Wlan802_11PowerModePSP) ? - EN_AUTO_PS : DIS_AUTO_PS; + EN_AUTO_PS : + DIS_AUTO_PS; ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_PS_MODE_ENH, sub_cmd, BITMAP_STA_PS, (t_void *)pioctl_req, MNULL); @@ -2054,9 +2042,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_pm_ioctl_inactivity_timeout(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_pm_ioctl_inactivity_timeout(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_pm_cfg *pmcfg = MNULL; @@ -2090,8 +2077,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_set_auto_deep_sleep(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_set_auto_deep_sleep(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = @@ -2102,7 +2089,7 @@ ENTER(); if (((mlan_ds_pm_cfg *)pioctl_req->pbuf) - ->param.auto_deep_sleep.auto_ds == DEEP_SLEEP_ON) { + ->param.auto_deep_sleep.auto_ds == DEEP_SLEEP_ON) { auto_ds.auto_ds = DEEP_SLEEP_ON; PRINTM(MINFO, "Auto Deep Sleep: on\n"); mode = EN_AUTO_PS; @@ -2111,10 +2098,9 @@ PRINTM(MINFO, "Auto Deep Sleep: off\n"); mode = DIS_AUTO_PS; } - if (((mlan_ds_pm_cfg *)pioctl_req->pbuf)->param.auto_deep_sleep. - idletime) + if (((mlan_ds_pm_cfg *)pioctl_req->pbuf)->param.auto_deep_sleep.idletime) auto_ds.idletime = ((mlan_ds_pm_cfg *)pioctl_req->pbuf) - ->param.auto_deep_sleep.idletime; + ->param.auto_deep_sleep.idletime; else auto_ds.idletime = pmadapter->idle_time; /* note: the command could be queued and executed @@ -2139,8 +2125,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_set_get_sleep_pd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_set_get_sleep_pd(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2174,8 +2160,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_set_get_ps_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_set_get_ps_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_pm_cfg *pm_cfg = MNULL; @@ -2204,8 +2190,8 @@ (t_u32)pmadapter->null_pkt_interval; if (pm_cfg->param.ps_cfg.multiple_dtim_interval) pmadapter->multiple_dtim = - (t_u16)pm_cfg->param.ps_cfg. - multiple_dtim_interval; + (t_u16)pm_cfg->param.ps_cfg + .multiple_dtim_interval; else pm_cfg->param.ps_cfg.multiple_dtim_interval = (t_u32)pmadapter->multiple_dtim; @@ -2251,8 +2237,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_set_get_bcn_timeout(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_set_get_bcn_timeout(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2282,8 +2268,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_set_get_sleep_params(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_set_get_sleep_params(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2317,8 +2303,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_config_mgmt_filter(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_config_mgmt_filter(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pm_cfg = MNULL; @@ -2351,8 +2337,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_pm_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_pm_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pm = MNULL; @@ -2396,29 +2382,29 @@ status = wlan_pm_ioctl_hscfg(pmadapter, pioctl_req); break; case MLAN_OID_PM_CFG_INACTIVITY_TO: - status = wlan_pm_ioctl_inactivity_timeout(pmadapter, - pioctl_req); + status = + wlan_pm_ioctl_inactivity_timeout(pmadapter, pioctl_req); break; case MLAN_OID_PM_CFG_DEEP_SLEEP: switch (pioctl_req->action) { case MLAN_ACT_SET: if (pmadapter->is_deep_sleep && pm->param.auto_deep_sleep.auto_ds == - DEEP_SLEEP_ON) { + DEEP_SLEEP_ON) { PRINTM(MMSG, "Station already in enhanced deep sleep mode\n"); status = MLAN_STATUS_FAILURE; break; } else if (!pmadapter->is_deep_sleep && pm->param.auto_deep_sleep.auto_ds == - DEEP_SLEEP_OFF) { + DEEP_SLEEP_OFF) { PRINTM(MMSG, "Station already not in enhanced deep sleep mode\n"); status = MLAN_STATUS_FAILURE; break; } - status = wlan_set_auto_deep_sleep(pmadapter, - pioctl_req); + status = + wlan_set_auto_deep_sleep(pmadapter, pioctl_req); break; case MLAN_ACT_GET: if (pmadapter->is_deep_sleep) { @@ -2475,8 +2461,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_set_wpa_ie_helper(mlan_private *priv, t_u8 *ie_data_ptr, t_u16 ie_len) +static mlan_status wlan_set_wpa_ie_helper(mlan_private *priv, t_u8 *ie_data_ptr, + t_u16 ie_len) { ENTER(); @@ -2522,8 +2508,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_set_osen_ie(mlan_private *priv, t_u8 *ie_data_ptr, t_u16 ie_len) +static mlan_status wlan_set_osen_ie(mlan_private *priv, t_u8 *ie_data_ptr, + t_u16 ie_len) { ENTER(); if (ie_len) { @@ -2560,8 +2546,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_set_wapi_ie(mlan_private *priv, t_u8 *ie_data_ptr, t_u16 ie_len) +static mlan_status wlan_set_wapi_ie(mlan_private *priv, t_u8 *ie_data_ptr, + t_u16 ie_len) { ENTER(); if (ie_len) { @@ -2598,8 +2584,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_sec_ioctl_wapi_enable(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_wapi_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2628,8 +2614,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_set_wapi_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_set_wapi_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2655,9 +2641,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_port_ctrl_enable(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_port_ctrl_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_sec_cfg *sec = MNULL; @@ -2698,8 +2683,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_sec_ioctl_auth_mode(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_auth_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2724,8 +2709,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_sec_ioctl_encrypt_mode(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_encrypt_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2749,8 +2734,7 @@ * * @return random charactor */ -static t_u8 -wlan_get_random_charactor(pmlan_adapter pmadapter) +static t_u8 wlan_get_random_charactor(pmlan_adapter pmadapter) { t_u32 sec, usec; t_u8 ch = 0; @@ -2774,8 +2758,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_sec_ioctl_wpa_enable(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_wpa_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2804,8 +2788,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_set_wep_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_set_wep_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -2825,14 +2809,14 @@ sec->param.encrypt_key.key_index = index; } else { if (sec->param.encrypt_key.key_index >= MRVL_NUM_WEP_KEY) { - if ((sec->param.encrypt_key.key_remove == MTRUE)&& + if ((sec->param.encrypt_key.key_remove == MTRUE) && (sec->param.encrypt_key.key_index <= 5)) { /* call firmware remove key */ - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - &sec->param.encrypt_key); + ret = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_req, + &sec->param.encrypt_key); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; goto exit; @@ -2844,7 +2828,7 @@ index = sec->param.encrypt_key.key_index; } - if ((sec->param.encrypt_key.key_disable == MTRUE)|| + if ((sec->param.encrypt_key.key_disable == MTRUE) || (sec->param.encrypt_key.key_remove == MTRUE)) { pmpriv->sec_info.wep_status = Wlan802_11WEPDisabled; /* remove key */ @@ -2862,7 +2846,7 @@ } else { if (sec->param.encrypt_key.key_len) { if ((sec->param.encrypt_key.key_len != - WEP_104_BIT_LEN)&& + WEP_104_BIT_LEN) && (sec->param.encrypt_key.key_len != WEP_40_BIT_LEN)) { PRINTM(MERROR, "Invalid wep key len=%d\n", @@ -2880,8 +2864,8 @@ i < (int)sec->param.encrypt_key.key_len; i++) sec->param.encrypt_key.key_material[i] = - wlan_get_random_charactor - (pmadapter); + wlan_get_random_charactor( + pmadapter); } pwep_key = &pmpriv->wep_key[index]; /* Cleanup */ @@ -2894,7 +2878,8 @@ MRVL_KEY_BUFFER_SIZE_IN_BYTE); pwep_key->key_index = index; pwep_key->key_length = sec->param.encrypt_key.key_len; - if (pmpriv->sec_info.wep_status != Wlan802_11WEPEnabled) { + if (pmpriv->sec_info.wep_status != + Wlan802_11WEPEnabled) { /* * The status is set as Key Absent * so as to make sure we display the @@ -2909,8 +2894,8 @@ pwep_key = &pmpriv->wep_key[index]; if (!pwep_key->key_length) { if (pmpriv->sec_info.wpa_enabled || - pmpriv->sec_info.wpa2_enabled - || pmpriv->sec_info.wapi_enabled) { + pmpriv->sec_info.wpa2_enabled || + pmpriv->sec_info.wapi_enabled) { ret = MLAN_STATUS_SUCCESS; goto exit; } @@ -2954,7 +2939,9 @@ goto exit; if (!sec->param.encrypt_key.key_len) { sec->param.encrypt_key.key_index = pwep_key->key_index; - sec->param.encrypt_key.key_len = pwep_key->key_length; + sec->param.encrypt_key.key_len = + MIN(pwep_key->key_length, + sizeof(pwep_key->key_material)); memcpy_ext(pmadapter, sec->param.encrypt_key.key_material, pwep_key->key_material, @@ -3006,8 +2993,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_set_wpa_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_set_wpa_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3044,8 +3031,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_get_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_get_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3059,15 +3046,15 @@ pmpriv->wep_key_curr_index = 0; if ((pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled) || - (pmpriv->sec_info.wep_status == Wlan802_11WEPKeyAbsent) - || pmpriv->sec_info.ewpa_enabled - || pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled) { + (pmpriv->sec_info.wep_status == Wlan802_11WEPKeyAbsent) || + pmpriv->sec_info.ewpa_enabled || pmpriv->sec_info.wpa_enabled || + pmpriv->sec_info.wpa2_enabled) { sec->param.encrypt_key.key_disable = MFALSE; } else { sec->param.encrypt_key.key_disable = MTRUE; } if (sec->param.encrypt_key.key_index == MLAN_KEY_INDEX_DEFAULT) { - if ((pmpriv->wep_key[pmpriv->wep_key_curr_index].key_length)&& + if ((pmpriv->wep_key[pmpriv->wep_key_curr_index].key_length) && (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled)) { index = pmpriv->wep_key_curr_index; sec->param.encrypt_key.key_index = @@ -3080,11 +3067,10 @@ sec->param.encrypt_key.key_len = MIN(MLAN_MAX_KEY_LENGTH, pmpriv->wep_key[index].key_length); - } else if ((pmpriv->sec_info.wpa_enabled) - || (pmpriv->sec_info.ewpa_enabled) - || (pmpriv->sec_info.wpa2_enabled) - || (pmpriv->sec_info.wapi_enabled) - ) { + } else if ((pmpriv->sec_info.wpa_enabled) || + (pmpriv->sec_info.ewpa_enabled) || + (pmpriv->sec_info.wpa2_enabled) || + (pmpriv->sec_info.wapi_enabled)) { /* Return WPA enabled */ sec->param.encrypt_key.key_disable = MFALSE; memcpy_ext(pmadapter, @@ -3092,9 +3078,8 @@ pmpriv->aes_key.key_material, pmpriv->aes_key.key_len, MLAN_MAX_KEY_LENGTH); - sec->param.encrypt_key.key_len = - MIN(MLAN_MAX_KEY_LENGTH, - pmpriv->aes_key.key_len); + sec->param.encrypt_key.key_len = MIN( + MLAN_MAX_KEY_LENGTH, pmpriv->aes_key.key_len); } else { sec->param.encrypt_key.key_disable = MTRUE; } @@ -3111,11 +3096,10 @@ sec->param.encrypt_key.key_len = MIN(MLAN_MAX_KEY_LENGTH, pmpriv->wep_key[index].key_length); - } else if ((pmpriv->sec_info.wpa_enabled) - || (pmpriv->sec_info.ewpa_enabled) - || (pmpriv->sec_info.wpa2_enabled) - || (pmpriv->sec_info.wapi_enabled) - ) { + } else if ((pmpriv->sec_info.wpa_enabled) || + (pmpriv->sec_info.ewpa_enabled) || + (pmpriv->sec_info.wpa2_enabled) || + (pmpriv->sec_info.wapi_enabled)) { /* Return WPA enabled */ sec->param.encrypt_key.key_disable = MFALSE; } else { @@ -3136,8 +3120,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_sec_ioctl_encrypt_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_encrypt_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_sec_cfg *sec = MNULL; @@ -3168,8 +3152,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_query_key(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_query_key(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3180,8 +3164,8 @@ sec = (mlan_ds_sec_cfg *)pioctl_req->pbuf; /* Current driver only supports get PTK/GTK */ if (pmpriv->port_open && - (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled - || pmpriv->sec_info.wapi_enabled)) { + (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled || + pmpriv->sec_info.wapi_enabled)) { /* Send request to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, HostCmd_ACT_GEN_GET, KEY_INFO_ENABLED, @@ -3203,8 +3187,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_sec_ioctl_ewpa_enable(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_ewpa_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3231,8 +3215,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_sec_ioctl_esupp_mode(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_ioctl_esupp_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3253,7 +3237,7 @@ } if (!sec->param.esupp_mode.rsn_mode || (sec->param.esupp_mode.rsn_mode & RSN_TYPE_VALID_BITS) != - sec->param.esupp_mode.rsn_mode) { + sec->param.esupp_mode.rsn_mode) { PRINTM(MERROR, "Invalid RSN mode\n"); pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; ret = MLAN_STATUS_FAILURE; @@ -3262,7 +3246,7 @@ if (!sec->param.esupp_mode.act_paircipher || (sec->param.esupp_mode.act_paircipher & EMBED_CIPHER_VALID_BITS) != - sec->param.esupp_mode.act_paircipher) { + sec->param.esupp_mode.act_paircipher) { PRINTM(MERROR, "Invalid pairwise cipher\n"); pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; ret = MLAN_STATUS_FAILURE; @@ -3271,7 +3255,7 @@ if (!sec->param.esupp_mode.act_groupcipher || (sec->param.esupp_mode.act_groupcipher & EMBED_CIPHER_VALID_BITS) != - sec->param.esupp_mode.act_groupcipher) { + sec->param.esupp_mode.act_groupcipher) { PRINTM(MERROR, "Invalid group cipher\n"); pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; ret = MLAN_STATUS_FAILURE; @@ -3308,8 +3292,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_sec_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_sec_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_sec_cfg *sec = MNULL; @@ -3384,15 +3368,15 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -wlan_set_gen_ie_helper(mlan_private *priv, t_u8 *ie_data_ptr, t_u16 ie_len) +static mlan_status wlan_set_gen_ie_helper(mlan_private *priv, t_u8 *ie_data_ptr, + t_u16 ie_len) { mlan_status ret = MLAN_STATUS_SUCCESS; IEEEtypes_VendorHeader_t *pvendor_ie; - const t_u8 wpa_oui[] = { 0x00, 0x50, 0xf2, 0x01 }; - const t_u8 wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; - const t_u8 osen_oui[] = { 0x50, 0x6f, 0x9a, 0x12 }; - t_u8 i = 0, temp[12] = { 0 }; + const t_u8 wpa_oui[] = {0x00, 0x50, 0xf2, 0x01}; + const t_u8 wps_oui[] = {0x00, 0x50, 0xf2, 0x04}; + const t_u8 osen_oui[] = {0x50, 0x6f, 0x9a, 0x12}; + t_u8 i = 0, temp[12] = {0}; ENTER(); @@ -3419,83 +3403,98 @@ sizeof(temp), sizeof(priv->ext_cap)); } else /* Test to see if it is a WPA IE, if not, then it is a - gen IE */ - if (((pvendor_ie->element_id == WPA_IE) && - (!memcmp - (priv->adapter, pvendor_ie->oui, - wpa_oui, - sizeof(wpa_oui)))) || + gen IE*/ + if (((pvendor_ie->element_id == WPA_IE) && + (!memcmp(priv->adapter, pvendor_ie->oui, wpa_oui, + sizeof(wpa_oui)))) || (pvendor_ie->element_id == RSN_IE)) { - /* IE is a WPA/WPA2 IE so call set_wpa function */ - ret = wlan_set_wpa_ie_helper(priv, ie_data_ptr, ie_len); - priv->wps.session_enable = MFALSE; - } else if (pvendor_ie->element_id == WAPI_IE) { - /* IE is a WAPI IE so call set_wapi function */ - ret = wlan_set_wapi_ie(priv, ie_data_ptr, ie_len); - } else if ((pvendor_ie->element_id == VENDOR_SPECIFIC_221) && - (!memcmp(priv->adapter, pvendor_ie->oui, osen_oui, - sizeof(osen_oui)))) { - /* IE is a OSEN IE so call set_osen function */ - ret = wlan_set_osen_ie(priv, ie_data_ptr, ie_len); - - } else if ((pvendor_ie->element_id == WPS_IE) && - (priv->wps.session_enable == MFALSE) && - (!memcmp(priv->adapter, pvendor_ie->oui, wps_oui, - sizeof(wps_oui)))) { - /* - * Discard first two byte (Element ID and Length) - * because they are not needed in the case of setting - * WPS_IE - */ - if (pvendor_ie->len > 4) { - memcpy_ext(priv->adapter, - (t_u8 *)&priv->wps.wps_ie, - ie_data_ptr, ie_len, - sizeof(IEEEtypes_VendorSpecific_t)); - HEXDUMP("wps_ie", (t_u8 *)&priv->wps.wps_ie, - priv->wps.wps_ie.vend_hdr.len + 2); - } else { - /* Only wps oui exist, reset driver wps buffer + /* IE is a WPA/WPA2 IE so call set_wpa function */ - memset(priv->adapter, (t_u8 *)&priv->wps.wps_ie, - 0x00, sizeof(priv->wps.wps_ie)); - PRINTM(MINFO, "wps_ie cleared\n"); - } - } else { - /* - * Verify that the passed length is not larger than - * the available space remaining in the buffer - */ - if (ie_len < - (sizeof(priv->gen_ie_buf) - priv->gen_ie_buf_len)) { - /* Test to see if it is a WPS IE, if so, enable - * wps session flag */ - pvendor_ie = - (IEEEtypes_VendorHeader_t *)ie_data_ptr; - if ((pvendor_ie->element_id == WPS_IE) && - (!memcmp(priv->adapter, pvendor_ie->oui, - wps_oui, sizeof(wps_oui)))) { - priv->wps.session_enable = MTRUE; - PRINTM(MINFO, "WPS Session Enabled.\n"); - } + ret = wlan_set_wpa_ie_helper(priv, ie_data_ptr, + ie_len); + priv->wps.session_enable = MFALSE; + } else if (pvendor_ie->element_id == WAPI_IE) { + /* IE is a WAPI IE so call set_wapi function */ + ret = wlan_set_wapi_ie(priv, ie_data_ptr, + ie_len); + } else if ((pvendor_ie->element_id == + VENDOR_SPECIFIC_221) && + (!memcmp(priv->adapter, pvendor_ie->oui, + osen_oui, sizeof(osen_oui)))) { + /* IE is a OSEN IE so call set_osen function */ + ret = wlan_set_osen_ie(priv, ie_data_ptr, + ie_len); - /* Append the passed data to the end of - * the genIeBuffer */ - memcpy_ext(priv->adapter, - priv->gen_ie_buf + - priv->gen_ie_buf_len, - ie_data_ptr, ie_len, - MRVDRV_GENIE_BUF_SIZE - - priv->gen_ie_buf_len); - /* Increment the stored buffer length by - * the size passed */ - priv->gen_ie_buf_len += ie_len; + } else if ((pvendor_ie->element_id == WPS_IE) && + (priv->wps.session_enable == MFALSE) && + (!memcmp(priv->adapter, pvendor_ie->oui, + wps_oui, sizeof(wps_oui)))) { + /* + * Discard first two byte (Element ID and + * Length) because they are not needed in the + * case of setting WPS_IE + */ + if (pvendor_ie->len > 4) { + memcpy_ext( + priv->adapter, + (t_u8 *)&priv->wps.wps_ie, + ie_data_ptr, ie_len, + sizeof(IEEEtypes_VendorSpecific_t)); + HEXDUMP("wps_ie", + (t_u8 *)&priv->wps.wps_ie, + priv->wps.wps_ie.vend_hdr.len + + 2); + } else { + /* Only wps oui exist, reset driver wps + * buffer + */ + memset(priv->adapter, + (t_u8 *)&priv->wps.wps_ie, 0x00, + sizeof(priv->wps.wps_ie)); + PRINTM(MINFO, "wps_ie cleared\n"); + } } else { - /* Passed data does not fit in the - * remaining buffer space */ - ret = MLAN_STATUS_FAILURE; + /* + * Verify that the passed length is not larger + * than the available space remaining in the + * buffer + */ + if (ie_len < (sizeof(priv->gen_ie_buf) - + priv->gen_ie_buf_len)) { + /* Test to see if it is a WPS IE, if so, + * enable wps session flag */ + pvendor_ie = + (IEEEtypes_VendorHeader_t *) + ie_data_ptr; + if ((pvendor_ie->element_id == + WPS_IE) && + (!memcmp(priv->adapter, + pvendor_ie->oui, wps_oui, + sizeof(wps_oui)))) { + priv->wps.session_enable = + MTRUE; + PRINTM(MINFO, + "WPS Session Enabled.\n"); + } + + /* Append the passed data to the end of + * the genIeBuffer */ + memcpy_ext( + priv->adapter, + priv->gen_ie_buf + + priv->gen_ie_buf_len, + ie_data_ptr, ie_len, + MRVDRV_GENIE_BUF_SIZE - + priv->gen_ie_buf_len); + /* Increment the stored buffer length by + * the size passed */ + priv->gen_ie_buf_len += ie_len; + } else { + /* Passed data does not fit in the + * remaining buffer space */ + ret = MLAN_STATUS_FAILURE; + } } - } } /* Return MLAN_STATUS_SUCCESS, or MLAN_STATUS_FAILURE for error case */ @@ -3511,8 +3510,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_wws_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_wws_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3561,8 +3560,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_11d_cfg_ioctl_enable(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11d_cfg_ioctl_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3586,9 +3585,9 @@ /* Compare with current settings */ if (pmpriv->state_11d.user_enable_11d != pcfg_11d->param.enable_11d) { - ret = wlan_11d_enable(pmpriv, pioctl_req, - (state_11d_t)pcfg_11d->param. - enable_11d); + ret = wlan_11d_enable( + pmpriv, pioctl_req, + (state_11d_t)pcfg_11d->param.enable_11d); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; } else { @@ -3617,8 +3616,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_11d_clr_chan_table(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11d_clr_chan_table(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3647,8 +3646,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_11d_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11d_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11d_cfg *pcfg_11d = MNULL; @@ -3694,8 +3693,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_wps_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wps_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3747,8 +3746,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_reg_mem_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_reg_mem_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_reg_mem *reg_mem = MNULL; @@ -3791,8 +3790,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_11h_channel_check_req(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11h_channel_check_req(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_FAILURE; @@ -3812,8 +3811,7 @@ memset(pmadapter, &bandcfg, 0, sizeof(Band_Config_t)); pmpriv->adhoc_state = ADHOC_STARTING; - if ((pmadapter->adhoc_start_band & BAND_A) - ) { + if ((pmadapter->adhoc_start_band & BAND_A)) { if (pmpriv->intf_state_11h.adhoc_auto_sel_chan) pmpriv->adhoc_channel = wlan_11h_get_adhoc_start_channel(pmpriv); @@ -3823,10 +3821,9 @@ * availability check. */ if (wlan_11h_radar_detect_required(pmpriv, - pmpriv->adhoc_channel) - && !wlan_11h_is_channel_under_nop(pmadapter, - pmpriv->adhoc_channel) - ) { + pmpriv->adhoc_channel) && + !wlan_11h_is_channel_under_nop(pmadapter, + pmpriv->adhoc_channel)) { /* * Radar detection is required for this channel, make * sure 11h is activated in the firmware @@ -3904,8 +3901,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_11h_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_11h_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_11h_cfg *ds_11hcfg = MNULL; @@ -3954,8 +3951,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_gen_ie(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_gen_ie(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3972,9 +3969,9 @@ pmpriv->wpa_ie, misc->param.gen_ie.len, MAX_IE_SIZE); } else { - wlan_set_gen_ie_helper(pmpriv, - misc->param.gen_ie.ie_data, - (t_u16)misc->param.gen_ie.len); + ret = wlan_set_gen_ie_helper( + pmpriv, misc->param.gen_ie.ie_data, + (t_u16)misc->param.gen_ie.len); } break; case MLAN_IE_TYPE_ARP_FILTER: @@ -4010,91 +4007,6 @@ return ret; } -/** - * @brief Perform warm reset - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_PENDING --success, MLAN_STATUS_FAILURE - */ -mlan_status -wlan_misc_ioctl_warm_reset(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) -{ - pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_status ret = MLAN_STATUS_SUCCESS; - pmlan_callbacks pcb = &pmadapter->callbacks; - pmlan_buffer pmbuf; - t_s32 i = 0; - mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; - - ENTER(); - mlan_block_rx_process(pmadapter, MTRUE); - - /* Cancel all pending commands and complete ioctls */ - if (misc->param.fw_reload) - wlan_cancel_all_pending_cmd(pmadapter, MTRUE); - - /** Init all the head nodes and free all the locks here */ - for (i = 0; i < pmadapter->priv_num; i++) - wlan_free_priv(pmadapter->priv[i]); - - while ((pmbuf = - (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, - &pmadapter->rx_data_queue, - pcb->moal_spin_lock, - pcb->moal_spin_unlock))) { - pmadapter->ops.data_complete(pmadapter, pmbuf, - MLAN_STATUS_FAILURE); - } - pmadapter->rx_pkts_queued = 0; - - /* Initialize adapter structure */ - wlan_init_adapter(pmadapter); - pmadapter->hw_status = WlanHardwareStatusInitializing; - - /* Initialize private structures */ - for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) - wlan_init_priv(pmadapter->priv[i]); - } - mlan_block_rx_process(pmadapter, MFALSE); - - if (misc->param.fw_reload != MTRUE) { - /* Restart the firmware */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_FUNC_SHUTDOWN, - HostCmd_ACT_GEN_SET, 0, MNULL, MNULL); - if (ret) - goto done; - } - - /* Issue firmware initialize commands for first BSS, - * for other interfaces it will be called after getting - * the last init command response of previous interface - */ - pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY); - if (!pmpriv) { - ret = MLAN_STATUS_FAILURE; - LEAVE(); - return ret; - } - ret = wlan_adapter_get_hw_spec(pmpriv->adapter); - if (ret == MLAN_STATUS_FAILURE) { - LEAVE(); - return ret; - } - ret = pmpriv->ops.init_cmd(pmpriv, MTRUE); - if (ret == MLAN_STATUS_FAILURE) { - LEAVE(); - return ret; - } - if (ret == MLAN_STATUS_PENDING) - pmadapter->pwarm_reset_ioctl_req = pioctl_req; -done: - LEAVE(); - return ret; -} - #ifdef SDIO /** * @brief Reconfigure SDIO multiport aggregation parameters @@ -4104,9 +4016,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_sdio_mpa_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_sdio_mpa_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4161,11 +4072,10 @@ pmadapter->pcard_sd->mpa_rx.buf_size = mpa_ctrl->rx_buf_size; - if (wlan_alloc_sdio_mpa_buffers(pmadapter, - pmadapter->pcard_sd-> - mpa_tx.buf_size, - pmadapter->pcard_sd-> - mpa_rx.buf_size) != + if (wlan_alloc_sdio_mpa_buffers( + pmadapter, + pmadapter->pcard_sd->mpa_tx.buf_size, + pmadapter->pcard_sd->mpa_rx.buf_size) != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Failed to allocate sdio mp-a buffers\n"); @@ -4214,8 +4124,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_sysclock(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_sysclock(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -4250,9 +4160,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_misc_ioctl_get_assoc_rsp(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_get_assoc_rsp(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_misc_cfg *misc = MNULL; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4274,6 +4183,36 @@ } /** + * @brief Get the associate request IEs + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_SUCCESS --success + */ +static mlan_status wlan_misc_ioctl_get_assoc_req(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_ds_misc_cfg *misc = MNULL; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + if ((pioctl_req->action == MLAN_ACT_GET) && pmpriv->assoc_req_size) { + memcpy_ext(pmadapter, misc->param.assoc_req.assoc_req_buf, + pmpriv->assoc_req_buf, pmpriv->assoc_req_size, + ASSOC_RSP_BUF_SIZE); + misc->param.assoc_req.assoc_req_len = + MIN(ASSOC_RSP_BUF_SIZE, pmpriv->assoc_req_size); + } + + LEAVE(); + return ret; +} + +/** * @brief Send function softreset command to firmware * * @param pmadapter A pointer to mlan_adapter structure @@ -4281,8 +4220,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_soft_reset(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_soft_reset(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4307,8 +4246,8 @@ * * @return MLAN_STATUS_PENDING -- success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_thermal(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_thermal(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4353,9 +4292,8 @@ * * @return MLAN_STATUS_PENDING -- success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_subscribe_evt(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_subscribe_evt(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4383,6 +4321,42 @@ } /** + * @brief Get/Set fw auto reconnect + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING -- success, otherwise fail + */ +static mlan_status wlan_misc_ioctl_fw_auto_reconnect(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = MNULL; + t_u16 cmd_action = 0; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else + cmd_action = HostCmd_ACT_GEN_GET; + + /* Send command to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_FW_AUTO_RECONNECT, + cmd_action, 0, (t_void *)pioctl_req, + &misc->param.fw_auto_reconnect); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief Set ARP filter based on IP address * * @param pmadapter A pointer to mlan_adapter structure @@ -4391,9 +4365,9 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_ipaddr_arp_filter(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req, t_u32 ipv4_addr) +static mlan_status wlan_ipaddr_arp_filter(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req, + t_u32 ipv4_addr) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -4468,8 +4442,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_mef_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_mef_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4481,14 +4455,12 @@ mlan_ds_misc_cmd *hostcmd = MNULL; t_u32 buf_len = 0; t_u8 *buf, *filter; - t_u8 fltr_buf[] = { 0x02, 0x00, 0x2f, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x01, 0x00, 0x5e, 0x03, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x41, 0x06, 0x00, 0x00, 0x00, - 0x01, 0xff, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x41, 0x45, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x33, 0x33, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x41, 0x45 - }; + t_u8 fltr_buf[] = {0x02, 0x00, 0x2f, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x00, 0x5e, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x41, 0x06, 0x00, 0x00, 0x00, 0x01, 0xff, 0x01, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x41, 0x45, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x33, 0x33, 0x02, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x41, 0x45}; ENTER(); @@ -4579,13 +4551,13 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_ipaddr_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_ipaddr_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; mlan_status ret = MLAN_STATUS_SUCCESS; - t_u32 ipv4_addr[MAX_IPADDR] = { 0 }; + t_u32 ipv4_addr[MAX_IPADDR] = {0}; int i = 0; ENTER(); @@ -4640,9 +4612,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_cfp_code_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_cfp_code_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -4705,7 +4676,7 @@ pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->adhoc_start_band)) { pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; goto done; @@ -4722,75 +4693,6 @@ } /** - * @brief This function sets up country code and downloads CMD to FW - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req Pointer to the IOCTL request buffer - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static mlan_status -wlan_misc_ioctl_country_code(pmlan_adapter pmadapter, - mlan_ioctl_req *pioctl_req) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_ds_misc_country_code *country_code = MNULL; - mlan_ds_misc_cfg *cfg_misc = MNULL; - t_u8 cfp_bg = 0, cfp_a = 0; - - ENTER(); - - cfg_misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; - country_code = &cfg_misc->param.country_code; - - if (pioctl_req->action == MLAN_ACT_SET) { - if (pmadapter->otp_region && pmadapter->otp_region->force_reg) { - PRINTM(MERROR, - "ForceRegionRule is set in the on-chip OTP" - "memory\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - /* Update region code and table based on country code */ - if (wlan_misc_country_2_cfp_table_code - (pmadapter, country_code->country_code, &cfp_bg, &cfp_a)) { - PRINTM(MERROR, "Country code not found!\n"); - pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - goto done; - } - pmadapter->cfp_code_bg = cfp_bg; - pmadapter->cfp_code_a = cfp_a; - if (cfp_a) - pmadapter->region_code = cfp_a; - else if (cfp_bg) - pmadapter->region_code = cfp_bg; - else - pmadapter->region_code = 0; - if (wlan_set_regiontable(pmpriv, pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { - pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - goto done; - } - memcpy_ext(pmadapter, pmadapter->country_code, - country_code->country_code, COUNTRY_CODE_LEN, - COUNTRY_CODE_LEN); - } else { - /* GET operation */ - memcpy_ext(pmadapter, country_code->country_code, - pmadapter->country_code, COUNTRY_CODE_LEN, - COUNTRY_CODE_LEN); - } - -done: - LEAVE(); - return ret; -} - -/** * @brief Configure MFPC and MFPR for management frame protection * * @param pmadapter A pointer to mlan_adapter structure @@ -4798,8 +4700,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_misc_pmfcfg(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +static mlan_status wlan_misc_pmfcfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4830,8 +4732,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_arb_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_arb_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -4861,8 +4763,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -mlan_status -wlan_misc_ioctl_tp_state(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_misc_ioctl_tp_state(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -4876,27 +4778,22 @@ return ret; } -static mlan_status -wlan_misc_ioctl_get_sensor_temp(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_ips_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { - mlan_status ret = MLAN_STATUS_SUCCESS; + pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = MNULL; t_u16 cmd_action = 0; - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); - if (pioctl_req->action == MLAN_ACT_GET) - cmd_action = HostCmd_ACT_GEN_GET; - else { - PRINTM(MERROR, " sensor temp only support get operation \n"); - LEAVE(); - return MLAN_STATUS_FAILURE; - } + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + cmd_action = HostCmd_ACT_GEN_SET; /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_DS_GET_SENSOR_TEMP, cmd_action, - 0, (t_void *)pioctl_req, MNULL); + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_IPS_CONFIG, cmd_action, 0, + (t_void *)pioctl_req, &misc->param.ips_ctrl); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -4913,9 +4810,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_misc_ioctl_ipv6_ra_offload(pmlan_adapter pmadapter, - mlan_ioctl_req *pioctl_req) +mlan_status wlan_misc_ioctl_ipv6_ra_offload(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -4948,9 +4844,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static mlan_status -wlan_misc_ioctl_gtk_rekey_offload(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_ioctl_gtk_rekey_offload(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = MNULL; @@ -4988,6 +4883,106 @@ } /** + * @brief enable/disable roam offload in firmware + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req Pointer to the IOCTL request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_misc_roam_offload(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = MNULL; + t_u16 cmd_action = 0; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (!(pmadapter->fw_cap_info & FW_ROAMING_SUPPORT)) { + PRINTM(MERROR, "Firmware roaming not support\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if (!IS_FW_SUPPORT_SUPPLICANT(pmadapter)) { + PRINTM(MERROR, "Embedded supplicant do not enable\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if ((misc->param.roam_offload.config_mode == ROAM_OFFLOAD_ENABLE) && + misc->param.roam_offload.userset_passphrase) { + pmpriv->adapter->userset_passphrase = + misc->param.roam_offload.userset_passphrase; + if (!misc->param.roam_offload.enable) { + LEAVE(); + return MLAN_STATUS_SUCCESS; + } + } + + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else { + PRINTM(MERROR, "Unsupported cmd_action\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_ROAM_OFFLOAD, cmd_action, 0, + (t_void *)pioctl_req, &misc->param.roam_offload); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** + * @brief set roam offload aplist to firmware + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req Pointer to the IOCTL request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_misc_roam_offload_aplist(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = MNULL; + t_u16 cmd_action = 0; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else { + PRINTM(MERROR, "Unsupported cmd_action\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_ROAM_OFFLOAD, cmd_action, 0, + (t_void *)pioctl_req, &misc->param.roam_offload); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief cloud keep alive * * @param pmadapter A pointer to mlan_adapter structure @@ -4995,8 +4990,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_misc_cloud_keep_alive(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req) +static mlan_status wlan_misc_cloud_keep_alive(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -5038,8 +5033,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = MNULL; @@ -5094,6 +5089,9 @@ case MLAN_OID_MISC_ASSOC_RSP: status = wlan_misc_ioctl_get_assoc_rsp(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_ASSOC_REQ: + status = wlan_misc_ioctl_get_assoc_req(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_INIT_SHUTDOWN: status = wlan_misc_ioctl_init_shutdown(pmadapter, pioctl_req); break; @@ -5120,6 +5118,9 @@ status = wlan_misc_ioctl_tdls_idle_time(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_NET_MONITOR: + status = wlan_misc_ioctl_net_monitor(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_MAC_CONTROL: status = wlan_misc_ioctl_mac_control(pmadapter, pioctl_req); break; @@ -5155,6 +5156,10 @@ case MLAN_OID_MISC_OTP_USER_DATA: status = wlan_misc_otp_user_data(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_AUTO_ASSOC: + status = wlan_misc_ioctl_fw_auto_reconnect(pmadapter, + pioctl_req); + break; #ifdef USB case MLAN_OID_MISC_USB_AGGR_CTRL: status = wlan_misc_ioctl_usb_aggr_ctrl(pmadapter, pioctl_req); @@ -5174,12 +5179,17 @@ case MLAN_OID_MISC_PMFCFG: status = wlan_misc_pmfcfg(pmadapter, pioctl_req); break; -#ifdef RX_PACKET_COALESCE - case MLAN_OID_MISC_RX_PACKET_COALESCE: - status = wlan_misc_ioctl_rx_pkt_coalesce_config(pmadapter, - pioctl_req); + case MLAN_OID_MISC_MULTI_CHAN_CFG: + status = wlan_misc_ioctl_multi_chan_config(pmadapter, + pioctl_req); break; -#endif + case MLAN_OID_MISC_MULTI_CHAN_POLICY: + status = wlan_misc_ioctl_multi_chan_policy(pmadapter, + pioctl_req); + break; + case MLAN_OID_MISC_DRCS_CFG: + status = wlan_misc_ioctl_drcs_config(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_LOW_PWR_MODE: status = wlan_misc_ioctl_low_pwr_mode(pmadapter, pioctl_req); break; @@ -5193,8 +5203,8 @@ status = wlan_misc_ioctl_mef_flt_cfg(pmadapter, pioctl_req); break; case MLAN_OID_MISC_DFS_REAPTER_MODE: - status = wlan_misc_ioctl_dfs_repeater_cfg(pmadapter, - pioctl_req); + status = + wlan_misc_ioctl_dfs_repeater_cfg(pmadapter, pioctl_req); break; case MLAN_OID_MISC_COALESCE_CFG: status = wlan_misc_ioctl_coalesce_cfg(pmadapter, pioctl_req); @@ -5219,9 +5229,24 @@ case MLAN_OID_MISC_IND_RST_CFG: status = wlan_misc_ioctl_ind_rst_cfg(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_MC_AGGR_CFG: + status = wlan_misc_ioctl_mc_aggr_cfg(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_CH_LOAD: + status = wlan_misc_ioctl_ch_load(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_CH_LOAD_RESULTS: + status = wlan_misc_ioctl_ch_load_results(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_GET_TSF: status = wlan_misc_ioctl_get_tsf(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_ROAM_OFFLOAD: + status = wlan_misc_roam_offload(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_ROAM_OFFLOAD_APLIST: + status = wlan_misc_roam_offload_aplist(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_GET_CHAN_REGION_CFG: status = wlan_misc_chan_reg_cfg(pmadapter, pioctl_req); break; @@ -5260,6 +5285,9 @@ status = wlan_misc_ssu(pmadapter, pioctl_req); break; #endif + case MLAN_OID_MISC_CSI: + status = wlan_misc_csi(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_HAL_PHY_CFG: status = wlan_misc_hal_phy_cfg(pmadapter, pioctl_req); break; @@ -5297,6 +5325,7 @@ break; case MLAN_OID_MISC_RF_TEST_GENERIC: case MLAN_OID_MISC_RF_TEST_TX_CONT: + case MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME: case MLAN_OID_MISC_RF_TEST_TX_FRAME: case MLAN_OID_MISC_RF_TEST_HE_POWER: status = wlan_misc_ioctl_rf_test_cfg(pmadapter, pioctl_req); @@ -5310,6 +5339,9 @@ case MLAN_OID_MISC_TP_STATE: status = wlan_misc_ioctl_tp_state(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_IPS_CFG: + status = wlan_misc_ioctl_ips_cfg(pmadapter, pioctl_req); + break; default: if (pioctl_req) pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; @@ -5329,9 +5361,9 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_set_get_scan_cfg(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req, t_u32 action) +static mlan_status wlan_set_get_scan_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req, + t_u32 action) { mlan_ds_scan *scan = MNULL; @@ -5349,16 +5381,16 @@ (t_u16)scan->param.scan_cfg.scan_probe; if (scan->param.scan_cfg.scan_time.specific_scan_time) pmadapter->specific_scan_time = - (t_u16)scan->param.scan_cfg.scan_time. - specific_scan_time; + (t_u16)scan->param.scan_cfg.scan_time + .specific_scan_time; if (scan->param.scan_cfg.scan_time.active_scan_time) pmadapter->active_scan_time = - (t_u16)scan->param.scan_cfg.scan_time. - active_scan_time; + (t_u16)scan->param.scan_cfg.scan_time + .active_scan_time; if (scan->param.scan_cfg.scan_time.passive_scan_time) pmadapter->passive_scan_time = - (t_u16)scan->param.scan_cfg.scan_time. - passive_scan_time; + (t_u16)scan->param.scan_cfg.scan_time + .passive_scan_time; if (scan->param.scan_cfg.passive_to_active_scan) pmadapter->passive_to_active_scan = scan->param.scan_cfg.passive_to_active_scan; @@ -5394,8 +5426,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_scan_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_scan_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status status = MLAN_STATUS_SUCCESS; @@ -5404,8 +5436,8 @@ ENTER(); pscan = (mlan_ds_scan *)pioctl_req->pbuf; - if (pscan->sub_command == MLAN_OID_SCAN_CONFIG - || pscan->sub_command == MLAN_OID_SCAN_BGSCAN_CONFIG) + if (pscan->sub_command == MLAN_OID_SCAN_CONFIG || + pscan->sub_command == MLAN_OID_SCAN_BGSCAN_CONFIG) goto start_config; if (pmadapter->scan_processing && pioctl_req->action == MLAN_ACT_SET && pscan->sub_command != MLAN_OID_SCAN_CANCEL) { @@ -5427,15 +5459,15 @@ status = wlan_scan_networks(pmpriv, pioctl_req, MNULL); break; case MLAN_OID_SCAN_SPECIFIC_SSID: - status = wlan_scan_specific_ssid(pmpriv, pioctl_req, - &pscan->param.scan_req. - scan_ssid); + status = wlan_scan_specific_ssid( + pmpriv, pioctl_req, + &pscan->param.scan_req.scan_ssid); break; case MLAN_OID_SCAN_USER_CONFIG: - status = wlan_scan_networks(pmpriv, pioctl_req, - (wlan_user_scan_cfg *) - pscan->param.user_scan. - scan_cfg_buf); + status = wlan_scan_networks( + pmpriv, pioctl_req, + (wlan_user_scan_cfg *) + pscan->param.user_scan.scan_cfg_buf); break; case MLAN_OID_SCAN_CONFIG: status = wlan_set_get_scan_cfg(pmadapter, pioctl_req, @@ -5450,12 +5482,10 @@ break; case MLAN_OID_SCAN_BGSCAN_CONFIG: /* Send request to firmware */ - status = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_BG_SCAN_CONFIG, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - pscan->param.user_scan. - scan_cfg_buf); + status = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_802_11_BG_SCAN_CONFIG, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + pscan->param.user_scan.scan_cfg_buf); break; default: pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; @@ -5463,10 +5493,10 @@ break; } - if ((status == MLAN_STATUS_SUCCESS) - && (pscan->sub_command != MLAN_OID_SCAN_TABLE_FLUSH) - && (pscan->sub_command != MLAN_OID_SCAN_CANCEL) - && (pscan->sub_command != MLAN_OID_SCAN_CONFIG)) { + if ((status == MLAN_STATUS_SUCCESS) && + (pscan->sub_command != MLAN_OID_SCAN_TABLE_FLUSH) && + (pscan->sub_command != MLAN_OID_SCAN_CANCEL) && + (pscan->sub_command != MLAN_OID_SCAN_CONFIG)) { PRINTM(MINFO, "wlan_scan_ioctl: return MLAN_STATUS_PENDING\n"); status = MLAN_STATUS_PENDING; @@ -5477,7 +5507,8 @@ if (pscan->sub_command == MLAN_OID_SCAN_CONFIG) { status = wlan_set_get_scan_cfg(pmadapter, pioctl_req, MLAN_ACT_GET); - } else if (pscan->sub_command == MLAN_OID_SCAN_GET_CURRENT_BSS) { + } else if (pscan->sub_command == + MLAN_OID_SCAN_GET_CURRENT_BSS) { pscan->param.scan_resp.num_in_scan_table = pmadapter->num_in_scan_table; pscan->param.scan_resp.pscan_table = @@ -5490,15 +5521,14 @@ /* Clear the previous scan result */ memset(pmadapter, pmadapter->pscan_table, 0x00, sizeof(BSSDescriptor_t) * - MRVDRV_MAX_BSSID_LIST); + MRVDRV_MAX_BSSID_LIST); pmadapter->num_in_scan_table = 0; pmadapter->pbcn_buf_end = pmadapter->bcn_buf; - status = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_BG_SCAN_QUERY, - HostCmd_ACT_GEN_GET, - 0, - (t_void *)pioctl_req, - MNULL); + status = wlan_prepare_cmd( + pmpriv, + HostCmd_CMD_802_11_BG_SCAN_QUERY, + HostCmd_ACT_GEN_GET, 0, + (t_void *)pioctl_req, MNULL); if (status == MLAN_STATUS_SUCCESS) { PRINTM(MINFO, "wlan_scan_ioctl: return MLAN_STATUS_PENDING\n"); @@ -5538,8 +5568,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_set_ewpa_mode(mlan_private *priv, mlan_ds_passphrase *psec_pp) +mlan_status wlan_set_ewpa_mode(mlan_private *priv, mlan_ds_passphrase *psec_pp) { ENTER(); @@ -5565,13 +5594,12 @@ * @return MLAN_STATUS_SUCCESS --success, otherwise * fail */ -mlan_status -wlan_find_bss(mlan_private *pmpriv, pmlan_ioctl_req pioctl_req) +mlan_status wlan_find_bss(mlan_private *pmpriv, pmlan_ioctl_req pioctl_req) { mlan_adapter *pmadapter = pmpriv->adapter; mlan_ds_bss *bss = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u8 mac[MLAN_MAC_ADDR_LENGTH]; int i = 0; BSSDescriptor_t *pbss_desc = MNULL; @@ -5582,17 +5610,15 @@ if (memcmp(pmadapter, &bss->param.ssid_bssid.bssid, zero_mac, sizeof(zero_mac))) { - if (bss->param.ssid_bssid.ssid.ssid_len) /* ssid & bssid */ - i = wlan_find_ssid_in_list(pmpriv, - &bss->param.ssid_bssid.ssid, - (t_u8 *)&bss->param. - ssid_bssid.bssid, - pmpriv->bss_mode); + if (bss->param.ssid_bssid.ssid.ssid_len) /* ssid & bssid */ + i = wlan_find_ssid_in_list( + pmpriv, &bss->param.ssid_bssid.ssid, + (t_u8 *)&bss->param.ssid_bssid.bssid, + pmpriv->bss_mode); else - i = wlan_find_bssid_in_list(pmpriv, - (t_u8 *)&bss->param. - ssid_bssid.bssid, - pmpriv->bss_mode); + i = wlan_find_bssid_in_list( + pmpriv, (t_u8 *)&bss->param.ssid_bssid.bssid, + pmpriv->bss_mode); if (i < 0) { memcpy_ext(pmadapter, mac, &bss->param.ssid_bssid.bssid, sizeof(mac), MLAN_MAC_ADDR_LENGTH); @@ -5626,6 +5652,18 @@ memcpy_ext(pmadapter, (t_u8 *)&bss->param.ssid_bssid.bssid, (t_u8 *)&pbss_desc->mac_address, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + if (pbss_desc->owe_transition_mode) { + bss->param.ssid_bssid.owe_transition_mode = + pbss_desc->owe_transition_mode; + memcpy_ext(pmadapter, &bss->param.ssid_bssid.trans_ssid, + &pbss_desc->trans_ssid, + sizeof(mlan_802_11_ssid), + sizeof(mlan_802_11_ssid)); + memcpy_ext(pmadapter, + (t_u8 *)&bss->param.ssid_bssid.trans_bssid, + (t_u8 *)&pbss_desc->trans_mac_address, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + } bss->param.ssid_bssid.rssi = pbss_desc->rssi; bss->param.ssid_bssid.channel = (t_u16)pbss_desc->channel; @@ -5638,9 +5676,8 @@ if (pbss_desc) { /**if rsn do not have ft akm, don't set ft cap and ft md*/ - if (pbss_desc->pmd_ie - && wlan_ft_akm_is_used(pmpriv, (t_u8 *)pbss_desc->prsn_ie) - ) { + if (pbss_desc->pmd_ie && + wlan_ft_akm_is_used(pmpriv, (t_u8 *)pbss_desc->prsn_ie)) { bss->param.ssid_bssid.ft_md = pbss_desc->pmd_ie->mdid; bss->param.ssid_bssid.ft_cap = pbss_desc->pmd_ie->ft_cap; @@ -5660,8 +5697,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -mlan_status -wlan_ops_sta_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_ops_sta_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) { pmlan_adapter pmadapter = (pmlan_adapter)adapter; mlan_status status = MLAN_STATUS_SUCCESS;
diff --git a/wlan_sd8987/mlan/mlan_sta_rx.c b/wlan_sd8987/mlan/mlan_sta_rx.c index fd8aada..bb9920a 100755 --- a/wlan_sd8987/mlan/mlan_sta_rx.c +++ b/wlan_sd8987/mlan/mlan_sta_rx.c
@@ -4,7 +4,7 @@ * module. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -33,6 +33,7 @@ #include "mlan_main.h" #include "mlan_11n_aggr.h" #include "mlan_11n_rxreorder.h" +#include "mlan_11ax.h" #ifdef DRV_EMBEDDED_SUPPLICANT #include "authenticator_api.h" #endif @@ -41,17 +42,6 @@ Local Variables ********************************************************/ -/** Ethernet II header */ -typedef struct { - /** Ethernet II header destination address */ - t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; - /** Ethernet II header source address */ - t_u8 src_addr[MLAN_MAC_ADDR_LENGTH]; - /** Ethernet II header length */ - t_u16 ethertype; - -} EthII_Hdr_t; - /** IPv4 ARP request header */ typedef MLAN_PACK_START struct { /** Hardware type */ @@ -115,11 +105,11 @@ * @param pmadapter A pointer to pmlan_adapter structure * @return TRUE if found such type of packets, FALSE not found */ -static t_u8 -discard_gratuitous_ARP_msg(RxPacketHdr_t *prx_pkt, pmlan_adapter pmadapter) +static t_u8 discard_gratuitous_ARP_msg(RxPacketHdr_t *prx_pkt, + pmlan_adapter pmadapter) { - t_u8 proto_ARP_type[] = { 0x08, 0x06 }; - t_u8 proto_ARP_type_v6[] = { 0x86, 0xDD }; + t_u8 proto_ARP_type[] = {0x08, 0x06}; + t_u8 proto_ARP_type_v6[] = {0x86, 0xDD}; IPv4_ARP_t *parp_hdr; IPv6_Nadv_t *pNadv_hdr; t_u8 ret = MFALSE; @@ -132,7 +122,7 @@ if (memcmp(pmadapter, proto_ARP_type, &prx_pkt->eth803_hdr.h803_len, sizeof(proto_ARP_type)) == 0) { parp_hdr = (IPv4_ARP_t *)(&prx_pkt->rfc1042_hdr); - /* Graguitous ARP can be ARP request or ARP reply */ + /* Graguitous ARP can be ARP request or ARP reply*/ if ((parp_hdr->op_code == mlan_htons(0x01)) || (parp_hdr->op_code == mlan_htons(0x02))) if (memcmp(pmadapter, parp_hdr->src_ip, @@ -165,18 +155,18 @@ * @param len len of tdls action frame buffer * @return N/A */ -void -wlan_process_tdls_action_frame(pmlan_private priv, t_u8 *pbuf, t_u32 len) +void wlan_process_tdls_action_frame(pmlan_private priv, t_u8 *pbuf, t_u32 len) { sta_node *sta_ptr = MNULL; IEEEtypes_VendorHeader_t *pvendor_ie = MNULL; - const t_u8 wmm_oui[] = { 0x00, 0x50, 0xf2, 0x02 }; + const t_u8 wmm_oui[] = {0x00, 0x50, 0xf2, 0x02}; t_u8 *peer; t_u8 *pos, *end; t_u8 action; int ie_len = 0; t_u8 i; int rate_len; + IEEEtypes_Extension_t *ext_ie; #define TDLS_PAYLOAD_TYPE 2 #define TDLS_CATEGORY 0x0c @@ -186,7 +176,7 @@ if (len < (sizeof(EthII_Hdr_t) + 3)) return; if (*(t_u8 *)(pbuf + sizeof(EthII_Hdr_t)) != TDLS_PAYLOAD_TYPE) - /*TDLS payload type = 2 */ + /*TDLS payload type = 2*/ return; if (*(t_u8 *)(pbuf + sizeof(EthII_Hdr_t) + 1) != TDLS_CATEGORY) /*TDLS category = 0xc */ @@ -194,7 +184,7 @@ peer = pbuf + MLAN_MAC_ADDR_LENGTH; action = *(t_u8 *)(pbuf + sizeof(EthII_Hdr_t) + 2); - /*2= payload type + category */ + /*2= payload type + category*/ if (action > TDLS_SETUP_CONFIRM) { /*just handle TDLS setup request/response/confirm */ @@ -206,7 +196,7 @@ sta_ptr = wlan_add_station_entry(priv, peer); if (!sta_ptr) return; - if (action == TDLS_SETUP_REQUEST) { /*setup request */ + if (action == TDLS_SETUP_REQUEST) { /*setup request*/ sta_ptr->status = TDLS_NOT_SETUP; PRINTM(MMSG, "Recv TDLS SETUP Request: peer=" MACSTR "\n", MAC2STR(peer)); @@ -214,27 +204,27 @@ if (len < (sizeof(EthII_Hdr_t) + TDLS_REQ_FIX_LEN)) return; pos = pbuf + sizeof(EthII_Hdr_t) + 4; - /*payload 1+ category 1 + action 1 +dialog 1 */ + /*payload 1+ category 1 + action 1 +dialog 1*/ sta_ptr->capability = mlan_ntohs(*(t_u16 *)pos); ie_len = len - sizeof(EthII_Hdr_t) - TDLS_REQ_FIX_LEN; pos += 2; - } else if (action == 1) { /*setup respons */ + } else if (action == 1) { /*setup respons*/ PRINTM(MMSG, "Recv TDLS SETUP Response: peer=" MACSTR "\n", MAC2STR(peer)); if (len < (sizeof(EthII_Hdr_t) + TDLS_RESP_FIX_LEN)) return; pos = pbuf + sizeof(EthII_Hdr_t) + 6; - /*payload 1+ category 1 + action 1 +dialog 1 +status 2 */ + /*payload 1+ category 1 + action 1 +dialog 1 +status 2*/ sta_ptr->capability = mlan_ntohs(*(t_u16 *)pos); ie_len = len - sizeof(EthII_Hdr_t) - TDLS_RESP_FIX_LEN; pos += 2; - } else { /*setup confirm */ + } else { /*setup confirm*/ PRINTM(MMSG, "Recv TDLS SETUP Confirm: peer=" MACSTR "\n", MAC2STR(peer)); if (len < (sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN)) return; pos = pbuf + sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN; - /*payload 1+ category 1 + action 1 +dialog 1 + status 2 */ + /*payload 1+ category 1 + action 1 +dialog 1 + status 2*/ ie_len = len - sizeof(EthII_Hdr_t) - TDLS_CONFIRM_FIX_LEN; } for (end = pos + ie_len; pos + 1 < end; pos += 2 + pos[1]) { @@ -249,7 +239,7 @@ break; case EXTENDED_SUPPORTED_RATES: rate_len = MIN(pos[1], sizeof(sta_ptr->support_rate) - - sta_ptr->rate_len); + sta_ptr->rate_len); for (i = 0; i < rate_len; i++) sta_ptr->support_rate[sta_ptr->rate_len + i] = pos[2 + i]; @@ -284,7 +274,7 @@ MIN(pos[1], sizeof(ExtCap_t)); memcpy_ext(priv->adapter, (t_u8 *)&sta_ptr->ExtCap, pos, sta_ptr->ExtCap.ieee_hdr.len + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), sizeof(IEEEtypes_ExtCap_t)); DBG_HEXDUMP(MDAT_D, "TDLS Extended capability", (t_u8 *)(&sta_ptr->ExtCap), @@ -293,24 +283,26 @@ case RSN_IE: sta_ptr->rsn_ie.ieee_hdr.len = MIN(pos[1], IEEE_MAX_IE_SIZE - - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); memcpy_ext(priv->adapter, (t_u8 *)&sta_ptr->rsn_ie, pos, sta_ptr->rsn_ie.ieee_hdr.len + - sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_Header_t), sizeof(IEEEtypes_Generic_t)); DBG_HEXDUMP(MDAT_D, "TDLS Rsn ie ", (t_u8 *)(&sta_ptr->rsn_ie), sta_ptr->rsn_ie.ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); break; case QOS_INFO: sta_ptr->qos_info = pos[2]; + sta_ptr->is_wmm_enabled = MTRUE; PRINTM(MDAT_D, "TDLS qos info %x\n", sta_ptr->qos_info); break; case VENDOR_SPECIFIC_221: pvendor_ie = (IEEEtypes_VendorHeader_t *)pos; if (!memcmp(priv->adapter, pvendor_ie->oui, wmm_oui, sizeof(wmm_oui))) { + sta_ptr->is_wmm_enabled = MTRUE; sta_ptr->qos_info = pos[8]; /** qos info in wmm parameters in response and @@ -330,7 +322,7 @@ pos, sizeof(IEEEtypes_VHTCap_t), sizeof(IEEEtypes_VHTCap_t)); sta_ptr->is_11ac_enabled = 1; - DBG_HEXDUMP(MDAT_D, "TDLS VHT capability", + DBG_HEXDUMP(MCMD_D, "Rx TDLS VHT capability", (t_u8 *)(&sta_ptr->vht_cap), MIN(sizeof(IEEEtypes_VHTCap_t), MAX_DATA_DUMP_LEN)); @@ -339,7 +331,7 @@ memcpy_ext(priv->adapter, (t_u8 *)&sta_ptr->vht_oprat, pos, sizeof(IEEEtypes_VHTOprat_t), sizeof(IEEEtypes_VHTOprat_t)); - DBG_HEXDUMP(MDAT_D, "TDLS VHT Operation", + DBG_HEXDUMP(MCMD_D, "Rx TDLS VHT Operation", (t_u8 *)(&sta_ptr->vht_oprat), MIN(sizeof(IEEEtypes_VHTOprat_t), MAX_DATA_DUMP_LEN)); @@ -348,11 +340,47 @@ memcpy_ext(priv->adapter, (t_u8 *)&sta_ptr->aid_info, pos, sizeof(IEEEtypes_AID_t), sizeof(IEEEtypes_AID_t)); - DBG_HEXDUMP(MDAT_D, "TDLS AID Info", + DBG_HEXDUMP(MCMD_D, "Rx TDLS AID Info", (t_u8 *)(&sta_ptr->aid_info), MIN(sizeof(IEEEtypes_AID_t), MAX_DATA_DUMP_LEN)); break; + case EXTENSION: + ext_ie = (IEEEtypes_Extension_t *)pos; + if (ext_ie->ext_id == HE_CAPABILITY) { + memcpy_ext(priv->adapter, + (t_u8 *)&sta_ptr->tdls_he_cap, pos, + ext_ie->ieee_hdr.len + + sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_HECap_t)); + sta_ptr->tdls_he_cap.ieee_hdr.len = + MIN(ext_ie->ieee_hdr.len, + sizeof(IEEEtypes_HECap_t) - + sizeof(IEEEtypes_Header_t)); + sta_ptr->is_11ax_enabled = 1; + DBG_HEXDUMP(MCMD_D, "Rx TDLS HE Capability", + (t_u8 *)(&sta_ptr->tdls_he_cap), + MIN(sizeof(IEEEtypes_Header_t) + + sta_ptr->tdls_he_cap + .ieee_hdr.len, + sizeof(IEEEtypes_HECap_t))); + } else if (ext_ie->ext_id == HE_OPERATION) { + memcpy_ext(priv->adapter, + (t_u8 *)&sta_ptr->he_op, pos, + ext_ie->ieee_hdr.len + + sizeof(IEEEtypes_Header_t), + sizeof(IEEEtypes_HeOp_t)); + ext_ie->ieee_hdr.len = + MIN(ext_ie->ieee_hdr.len, + sizeof(IEEEtypes_HeOp_t) - + sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP(MCMD_D, "Rx TDLS HE Operation", + (t_u8 *)(&sta_ptr->he_op), + MIN(sizeof(IEEEtypes_Header_t) + + ext_ie->ieee_hdr.len, + MAX_DATA_DUMP_LEN)); + } + break; default: break; } @@ -361,6 +389,81 @@ } /** + * @brief This function get pxpd info for radiotap info + * + * @param priv A pointer to pmlan_private + * @param prx_pd A pointer to RxPD + * @param prt_info A pointer to radiotap_info + * + * @return N/A + */ +void wlan_rxpdinfo_to_radiotapinfo(pmlan_private priv, RxPD *prx_pd, + radiotap_info *prt_info) +{ + radiotap_info rt_info_tmp; + t_u8 rx_rate_info = 0; + t_u8 mcs_index = 0; + t_u8 format = 0; + t_u8 bw = 0; + t_u8 gi = 0; + t_u8 ldpc = 0; + t_u8 ext_rate_info = 0; + + memset(priv->adapter, &rt_info_tmp, 0x00, sizeof(rt_info_tmp)); + rt_info_tmp.snr = prx_pd->snr; + rt_info_tmp.nf = prx_pd->nf; + rt_info_tmp.band_config = (prx_pd->rx_info & 0xf); + rt_info_tmp.chan_num = (prx_pd->rx_info & RXPD_CHAN_MASK) >> 5; + ext_rate_info = (t_u8)(prx_pd->rx_info >> 16); + + rt_info_tmp.antenna = prx_pd->antenna; + rx_rate_info = prx_pd->rate_info; + if ((rx_rate_info & 0x3) == MLAN_RATE_FORMAT_VHT) { + /* VHT rate */ + format = MLAN_RATE_FORMAT_VHT; + mcs_index = MIN(prx_pd->rx_rate & 0xF, 9); + /* 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ + bw = (rx_rate_info & 0xC) >> 2; + /* LGI: gi =0, SGI: gi = 1 */ + gi = (rx_rate_info & 0x10) >> 4; + } else if ((rx_rate_info & 0x3) == MLAN_RATE_FORMAT_HT) { + /* HT rate */ + format = MLAN_RATE_FORMAT_HT; + mcs_index = prx_pd->rx_rate; + /* 20M: bw=0, 40M: bw=1 */ + bw = (rx_rate_info & 0xC) >> 2; + /* LGI: gi =0, SGI: gi = 1 */ + gi = (rx_rate_info & 0x10) >> 4; + } else { + /* LG rate */ + format = MLAN_RATE_FORMAT_LG; + mcs_index = (prx_pd->rx_rate > MLAN_RATE_INDEX_OFDM0) ? + prx_pd->rx_rate - 1 : + prx_pd->rx_rate; + } + ldpc = rx_rate_info & 0x40; + + rt_info_tmp.rate_info.mcs_index = mcs_index; + rt_info_tmp.rate_info.rate_info = + (ldpc << 5) | (format << 3) | (bw << 1) | gi; + rt_info_tmp.rate_info.bitrate = + wlan_index_to_data_rate(priv->adapter, prx_pd->rx_rate, + prx_pd->rate_info, ext_rate_info); + + if (prx_pd->flags & RXPD_FLAG_EXTRA_HEADER) + memcpy_ext(priv->adapter, &rt_info_tmp.extra_info, + (t_u8 *)prx_pd + sizeof(*prx_pd), + sizeof(rt_info_tmp.extra_info), + sizeof(rt_info_tmp.extra_info)); + + memset(priv->adapter, prt_info, 0x00, sizeof(radiotap_info)); + memcpy_ext(priv->adapter, prt_info, &rt_info_tmp, sizeof(rt_info_tmp), + sizeof(radiotap_info)); + + return; +} + +/** * @brief This function processes received packet and forwards it * to kernel/upper layer * @@ -369,8 +472,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) +mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = pmadapter->priv[pmbuf->bss_index]; @@ -378,17 +480,15 @@ RxPD *prx_pd; int hdr_chop; EthII_Hdr_t *peth_hdr; - t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = { 0xaa, 0xaa, 0x03, - 0x00, 0x00, 0x00 - }; - t_u8 snap_oui_802_h[MLAN_MAC_ADDR_LENGTH] = { 0xaa, 0xaa, 0x03, - 0x00, 0x00, 0xf8 - }; - t_u8 appletalk_aarp_type[2] = { 0x80, 0xf3 }; - t_u8 ipx_snap_type[2] = { 0x81, 0x37 }; - t_u8 tdls_action_type[2] = { 0x89, 0x0d }; + t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03, + 0x00, 0x00, 0x00}; + t_u8 snap_oui_802_h[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03, + 0x00, 0x00, 0xf8}; + t_u8 appletalk_aarp_type[2] = {0x80, 0xf3}; + t_u8 ipx_snap_type[2] = {0x81, 0x37}; + t_u8 tdls_action_type[2] = {0x89, 0x0d}; #ifdef DRV_EMBEDDED_SUPPLICANT - t_u8 eapol_type[2] = { 0x88, 0x8e }; + t_u8 eapol_type[2] = {0x88, 0x8e}; #endif t_u8 ext_rate_info = 0; @@ -474,10 +574,9 @@ } if (!memcmp(pmadapter, &prx_pkt->eth803_hdr.h803_len, tdls_action_type, sizeof(tdls_action_type))) { - wlan_process_tdls_action_frame(priv, - ((t_u8 *)prx_pd + - prx_pd->rx_pkt_offset), - prx_pd->rx_pkt_length); + wlan_process_tdls_action_frame( + priv, ((t_u8 *)prx_pd + prx_pd->rx_pkt_offset), + prx_pd->rx_pkt_length); } /* Chop off the RxPD */ hdr_chop = (t_u32)((t_ptr)&prx_pkt->eth803_hdr - (t_ptr)prx_pd); @@ -503,6 +602,12 @@ PRINTM(MDATA, "%lu.%06lu : Data => kernel seq_num=%d tid=%d\n", pmbuf->out_ts_sec, pmbuf->out_ts_usec, prx_pd->seq_num, prx_pd->priority); + if (pmadapter->enable_net_mon) { + if (prx_pd->rx_pkt_type == PKT_TYPE_802DOT11) { + pmbuf->flags |= MLAN_BUF_FLAG_NET_MONITOR; + goto mon_process; + } + } #ifdef DRV_EMBEDDED_SUPPLICANT if (supplicantIsEnabled(priv->psapriv) && @@ -521,8 +626,17 @@ } #endif - if (MFALSE || priv->rx_pkt_info) { +mon_process: + if (pmbuf->flags & MLAN_BUF_FLAG_NET_MONITOR) { + // Use some rxpd space to save rxpd info for radiotap header + // We should insure radiotap_info is not bigger than RxPD + wlan_rxpdinfo_to_radiotapinfo( + priv, prx_pd, + (radiotap_info *)(pmbuf->pbuf + pmbuf->data_offset - + sizeof(radiotap_info))); + } + if (MFALSE || priv->rx_pkt_info) { ext_rate_info = (t_u8)(prx_pd->rx_info >> 16); pmbuf->u.rx_info.data_rate = wlan_index_to_data_rate(priv->adapter, prx_pd->rx_rate, @@ -563,8 +677,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_sta_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) +mlan_status wlan_ops_sta_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) { pmlan_adapter pmadapter = (pmlan_adapter)adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -583,11 +696,14 @@ prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset); /* Endian conversion */ endian_convert_RxPD(prx_pd); + if (prx_pd->flags & RXPD_FLAG_EXTRA_HEADER) { + endian_convert_RxPD_extra_header( + (rxpd_extra_info *)((t_u8 *)prx_pd + sizeof(*prx_pd))); + } if (priv->adapter->pcard_info->v14_fw_api) { t_u8 rxpd_rate_info_orig = prx_pd->rate_info; - prx_pd->rate_info = - wlan_convert_v14_rx_rate_info(priv, - rxpd_rate_info_orig); + prx_pd->rate_info = wlan_convert_v14_rx_rate_info( + priv, rxpd_rate_info_orig); PRINTM(MINFO, "STA RX: v14_fw_api=%d rx_rate =%d rxpd_rate_info=0x%x->0x%x\n", priv->adapter->pcard_info->v14_fw_api, prx_pd->rx_rate, @@ -622,14 +738,12 @@ if ((pmgmt_pkt_hdr->wlan_header.frm_ctl & IEEE80211_FC_MGMT_FRAME_TYPE_MASK) == 0) - wlan_process_802dot11_mgmt_pkt(pmadapter-> - priv[pmbuf->bss_index], - (t_u8 *)&pmgmt_pkt_hdr-> - wlan_header, - pmgmt_pkt_hdr->frm_len + - sizeof(wlan_mgmt_pkt) - - sizeof(pmgmt_pkt_hdr-> - frm_len), prx_pd); + wlan_process_802dot11_mgmt_pkt( + pmadapter->priv[pmbuf->bss_index], + (t_u8 *)&pmgmt_pkt_hdr->wlan_header, + pmgmt_pkt_hdr->frm_len + sizeof(wlan_mgmt_pkt) - + sizeof(pmgmt_pkt_hdr->frm_len), + prx_pd); pmadapter->ops.data_complete(pmadapter, pmbuf, ret); goto done; } @@ -639,17 +753,11 @@ priv->rxpd_rx_info = (t_u8)(prx_pd->rx_info >> 16); if (priv->bss_type == MLAN_BSS_TYPE_STA) { antenna = wlan_adjust_antenna(priv, prx_pd); - adj_rx_rate = - wlan_adjust_data_rate(priv, priv->rxpd_rate, - priv->rxpd_rate_info); - pmadapter->callbacks.moal_hist_data_add(pmadapter-> - pmoal_handle, - pmbuf-> - bss_index, - adj_rx_rate, - prx_pd->snr, - prx_pd->nf, - antenna); + adj_rx_rate = wlan_adjust_data_rate( + priv, priv->rxpd_rate, priv->rxpd_rate_info); + pmadapter->callbacks.moal_hist_data_add( + pmadapter->pmoal_handle, pmbuf->bss_index, + adj_rx_rate, prx_pd->snr, prx_pd->nf, antenna); } } @@ -657,9 +765,8 @@ * If the packet is not an unicast packet then send the packet * directly to os. Don't pass thru rx reordering */ - if ((!IS_11N_ENABLED(priv) - && !(prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK) - ) || + if ((!IS_11N_ENABLED(priv) && + !(prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) || memcmp(priv->adapter, priv->curr_addr, prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH)) { priv->snr = prx_pd->snr; @@ -682,14 +789,16 @@ sta_ptr->snr = prx_pd->snr; sta_ptr->nf = prx_pd->nf; if (prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK) { - pmadapter->callbacks. - moal_updata_peer_signal - (pmadapter->pmoal_handle, - pmbuf->bss_index, ta, - prx_pd->snr, prx_pd->nf); + pmadapter->callbacks + .moal_updata_peer_signal( + pmadapter->pmoal_handle, + pmbuf->bss_index, ta, + prx_pd->snr, + prx_pd->nf); } } - if (!sta_ptr || !sta_ptr->is_11n_enabled) { + if (!sta_ptr || (!sta_ptr->is_11n_enabled && + !sta_ptr->is_11ax_enabled)) { wlan_process_rx_packet(pmadapter, pmbuf); goto done; }
diff --git a/wlan_sd8987/mlan/mlan_sta_tx.c b/wlan_sd8987/mlan/mlan_sta_tx.c index 73ca1bf..c5fbd34 100755 --- a/wlan_sd8987/mlan/mlan_sta_tx.c +++ b/wlan_sd8987/mlan/mlan_sta_tx.c
@@ -4,7 +4,7 @@ * transmission in MLAN module. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -56,8 +56,7 @@ * * @return headptr or MNULL */ -t_void * -wlan_ops_sta_process_txpd(t_void *priv, pmlan_buffer pmbuf) +t_void *wlan_ops_sta_process_txpd(t_void *priv, pmlan_buffer pmbuf) { mlan_private *pmpriv = (mlan_private *)priv; pmlan_adapter pmadapter = pmpriv->adapter; @@ -97,7 +96,7 @@ /* head_ptr should be aligned */ head_ptr = pmbuf->pbuf + pmbuf->data_offset - sizeof(TxPD) - - pmpriv->intf_hr_len; + pmpriv->intf_hr_len; head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1))); plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len); @@ -118,8 +117,7 @@ * cause the default value to be used later in this function */ plocal_tx_pd->tx_control = - pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd-> - priority]; + pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd->priority]; if (pmadapter->pps_uapsd_mode) { if (MTRUE == wlan_check_last_packet_indication(pmpriv)) { pmadapter->tx_lock_flag = MTRUE; @@ -130,9 +128,9 @@ if (pmbuf->flags & MLAN_BUF_FLAG_TDLS) plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TDLS_PACKET; /* Offset of actual data */ - plocal_tx_pd->tx_pkt_offset = (t_u16)((t_ptr)pmbuf->pbuf + - pmbuf->data_offset - - (t_ptr)plocal_tx_pd); + plocal_tx_pd->tx_pkt_offset = + (t_u16)((t_ptr)pmbuf->pbuf + pmbuf->data_offset - + (t_ptr)plocal_tx_pd); if (!plocal_tx_pd->tx_control) { /* TxCtrl set by user or default */ @@ -151,8 +149,9 @@ if (pmbuf->flags & MLAN_BUF_FLAG_TX_CTRL) { if (pmbuf->u.tx_info.data_rate) { plocal_tx_pd->tx_control |= - (wlan_ieee_rateid_to_mrvl_rateid - (pmpriv, pmbuf->u.tx_info.data_rate, MNULL) + (wlan_ieee_rateid_to_mrvl_rateid( + pmpriv, pmbuf->u.tx_info.data_rate, + MNULL) << 16); plocal_tx_pd->tx_control |= TXPD_TXRATE_ENABLE; } @@ -166,10 +165,41 @@ (t_u32)pmbuf->u.tx_info.tx_power.val; if (pmbuf->u.tx_info.retry_limit) { plocal_tx_pd->tx_control |= pmbuf->u.tx_info.retry_limit - << 8; + << 8; plocal_tx_pd->tx_control |= TXPD_RETRY_ENABLE; } } + if (pmbuf->flags & MLAN_BUF_FLAG_MC_AGGR_PKT) { + tx_ctrl *ctrl = (tx_ctrl *)&plocal_tx_pd->tx_control; + mc_tx_ctrl *mc_ctrl = + (mc_tx_ctrl *)&plocal_tx_pd->pkt_delay_2ms; + plocal_tx_pd->tx_pkt_type = PKT_TYPE_802DOT11_MC_AGGR; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_START_CYCLE) + ctrl->mc_cycle_start = MTRUE; + else + ctrl->mc_cycle_start = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_END_CYCLE) + ctrl->mc_cycle_end = MTRUE; + else + ctrl->mc_cycle_end = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_START_AMPDU) + ctrl->mc_ampdu_start = MTRUE; + else + ctrl->mc_ampdu_start = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_END_AMPDU) + ctrl->mc_ampdu_end = MTRUE; + else + ctrl->mc_ampdu_end = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_RETRY) + ctrl->mc_pkt_retry = MTRUE; + else + ctrl->mc_pkt_retry = MFALSE; + ctrl->bw = pmbuf->u.mc_tx_info.bandwidth & 0x7; + ctrl->tx_rate = pmbuf->u.mc_tx_info.mcs_index & 0x1f; + mc_ctrl->abs_tsf_expirytime = + wlan_cpu_to_le32(pmbuf->u.mc_tx_info.pkt_expiry); + mc_ctrl->mc_seq = wlan_cpu_to_le16(pmbuf->u.mc_tx_info.seq_num); + } endian_convert_TxPD(plocal_tx_pd); /* Adjust the data offset and length to include TxPD in pmbuf */ @@ -191,8 +221,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise * failure */ -mlan_status -wlan_send_null_packet(pmlan_private priv, t_u8 flags) +mlan_status wlan_send_null_packet(pmlan_private priv, t_u8 flags) { pmlan_adapter pmadapter = MNULL; TxPD *ptx_pd; @@ -228,6 +257,12 @@ ret = MLAN_STATUS_FAILURE; goto done; } +#if defined(USB) + if (!wlan_is_port_ready(pmadapter, priv->port_index)) { + ret = MLAN_STATUS_FAILURE; + goto done; + } +#endif pmbuf = wlan_alloc_mlan_buffer(pmadapter, data_len, 0, MOAL_MALLOC_BUFFER); @@ -298,8 +333,7 @@ * * @return MTRUE or MFALSE */ -t_u8 -wlan_check_last_packet_indication(pmlan_private priv) +t_u8 wlan_check_last_packet_indication(pmlan_private priv) { pmlan_adapter pmadapter = priv->adapter; t_u8 ret = MFALSE; @@ -314,7 +348,8 @@ if (wlan_bypass_tx_list_empty(pmadapter) && wlan_wmm_lists_empty(pmadapter)) { if (((priv->curr_bss_params.wmm_uapsd_enabled == MTRUE) && - priv->wmm_qosinfo) || prop_ps) + priv->wmm_qosinfo) || + prop_ps) ret = MTRUE; }
diff --git a/wlan_sd8987/mlan/mlan_txrx.c b/wlan_sd8987/mlan/mlan_txrx.c index feeddd9..c55c145 100755 --- a/wlan_sd8987/mlan/mlan_txrx.c +++ b/wlan_sd8987/mlan/mlan_txrx.c
@@ -58,8 +58,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) +mlan_status wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private priv = MNULL; @@ -101,8 +100,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise * failure */ -mlan_status -wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, mlan_tx_param *tx_param) +mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, + mlan_tx_param *tx_param) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_adapter pmadapter = priv->adapter; @@ -131,7 +130,6 @@ if (pmadapter->tp_state_drop_point == 4) goto done; else { - ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA, pmbuf, tx_param); } @@ -195,9 +193,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_write_data_complete(pmlan_adapter pmadapter, - pmlan_buffer pmbuf, mlan_status status) +mlan_status wlan_write_data_complete(pmlan_adapter pmadapter, + pmlan_buffer pmbuf, mlan_status status) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb; @@ -223,9 +220,9 @@ for (i = 0; i <= use_count; i++) { pmbuf_next = pmbuf->pnext; if (pmbuf->flags & MLAN_BUF_FLAG_MOAL_TX_BUF) - pcb->moal_send_packet_complete - (pmadapter->pmoal_handle, pmbuf, - status); + pcb->moal_send_packet_complete( + pmadapter->pmoal_handle, pmbuf, + status); else wlan_free_mlan_buffer(pmadapter, pmbuf); pmbuf = pmbuf_next; @@ -234,9 +231,8 @@ #endif if (pmbuf->flags & MLAN_BUF_FLAG_MOAL_TX_BUF) { /* pmbuf was allocated by MOAL */ - pcb->moal_send_packet_complete(pmadapter-> - pmoal_handle, - pmbuf, status); + pcb->moal_send_packet_complete( + pmadapter->pmoal_handle, pmbuf, status); } else { /* pmbuf was allocated by MLAN */ wlan_free_mlan_buffer(pmadapter, pmbuf); @@ -259,9 +255,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_recv_packet_complete(pmlan_adapter pmadapter, - pmlan_buffer pmbuf, mlan_status status) +mlan_status wlan_recv_packet_complete(pmlan_adapter pmadapter, + pmlan_buffer pmbuf, mlan_status status) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -294,8 +289,7 @@ * * @return N/A */ -t_void -wlan_add_buf_bypass_txqueue(mlan_adapter *pmadapter, pmlan_buffer pmbuf) +t_void wlan_add_buf_bypass_txqueue(mlan_adapter *pmadapter, pmlan_buffer pmbuf) { pmlan_private priv = pmadapter->priv[pmbuf->bss_index]; ENTER(); @@ -319,10 +313,30 @@ * * @return MFALSE if not empty; MTRUE if empty */ -INLINE t_u8 -wlan_bypass_tx_list_empty(mlan_adapter *pmadapter) +INLINE t_u8 wlan_bypass_tx_list_empty(mlan_adapter *pmadapter) { - return (pmadapter->bypass_pkt_count) ? MFALSE : MTRUE; +#if defined(USB) + if (IS_USB(pmadapter->card_type)) { + pmlan_callbacks pcb = &pmadapter->callbacks; + pmlan_private priv; + int j = 0; + for (j = 0; j < pmadapter->priv_num; ++j) { + priv = pmadapter->priv[j]; + if (priv) { + if (!wlan_is_port_ready(pmadapter, + priv->port_index)) + continue; + if (util_peek_list(pmadapter->pmoal_handle, + &priv->bypass_txq, + pcb->moal_spin_lock, + pcb->moal_spin_unlock)) + return MFALSE; + } + } + return MTRUE; + } else +#endif + return (pmadapter->bypass_pkt_count) ? MFALSE : MTRUE; } /** @@ -332,8 +346,7 @@ * * @return N/A */ -t_void -wlan_cleanup_bypass_txq(mlan_private *priv) +t_void wlan_cleanup_bypass_txq(mlan_private *priv) { pmlan_buffer pmbuf; mlan_adapter *pmadapter = priv->adapter; @@ -360,8 +373,7 @@ * * @return N/A */ -t_void -wlan_process_bypass_tx(pmlan_adapter pmadapter) +t_void wlan_process_bypass_tx(pmlan_adapter pmadapter) { pmlan_buffer pmbuf; mlan_tx_param tx_param; @@ -373,69 +385,56 @@ for (j = 0; j < pmadapter->priv_num; ++j) { priv = pmadapter->priv[j]; if (priv) { - pmbuf = (pmlan_buffer) - util_dequeue_list(pmadapter-> - pmoal_handle, - &priv->bypass_txq, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); +#if defined(USB) + if (!wlan_is_port_ready(pmadapter, + priv->port_index)) + continue; +#endif + pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, + &priv->bypass_txq, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); if (pmbuf) { - pmadapter->callbacks. - moal_spin_lock(pmadapter-> - pmoal_handle, - priv->bypass_txq. - plock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->bypass_txq.plock); pmadapter->bypass_pkt_count--; - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - priv-> - bypass_txq. - plock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->bypass_txq.plock); PRINTM(MINFO, "Dequeuing bypassed packet %p\n", pmbuf); - if (wlan_bypass_tx_list_empty - (pmadapter)) + if (wlan_bypass_tx_list_empty( + pmadapter)) tx_param.next_pkt_len = 0; else tx_param.next_pkt_len = pmbuf->data_len; - status = wlan_process_tx(pmadapter-> - priv[pmbuf-> - bss_index], - pmbuf, - &tx_param); + status = wlan_process_tx( + pmadapter->priv[pmbuf->bss_index], + pmbuf, &tx_param); if (status == MLAN_STATUS_RESOURCE) { /* Queue the packet again so * that it will be TX'ed later */ - pmadapter->callbacks. - moal_spin_lock - (pmadapter-> - pmoal_handle, - priv->bypass_txq. - plock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->bypass_txq.plock); pmadapter->bypass_pkt_count++; - util_enqueue_list_head - (pmadapter-> - pmoal_handle, - &priv->bypass_txq, - (pmlan_linked_list) - pmbuf, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); - pmadapter->callbacks. - moal_spin_unlock - (pmadapter-> - pmoal_handle, - priv->bypass_txq. - plock); + util_enqueue_list_head( + pmadapter->pmoal_handle, + &priv->bypass_txq, + (pmlan_linked_list)pmbuf, + pmadapter->callbacks + .moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->bypass_txq.plock); } break; } else {
diff --git a/wlan_sd8987/mlan/mlan_uap.h b/wlan_sd8987/mlan/mlan_uap.h index 63e6fd4..2425ebc 100755 --- a/wlan_sd8987/mlan/mlan_uap.h +++ b/wlan_sd8987/mlan/mlan_uap.h
@@ -4,7 +4,7 @@ * of uap functionalities * * - * Copyright 2009-2020 NXP + * Copyright 2009-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -40,8 +40,8 @@ mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, - t_void *pdata_buf, t_void *pcmd_buf); + t_void *pioctl_buf, t_void *pdata_buf, + t_void *pcmd_buf); mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, t_void *pcmd_buf, t_void *pioctl);
diff --git a/wlan_sd8987/mlan/mlan_uap_cmdevent.c b/wlan_sd8987/mlan/mlan_uap_cmdevent.c index cfdd7f3..8f2b0ef 100755 --- a/wlan_sd8987/mlan/mlan_uap_cmdevent.c +++ b/wlan_sd8987/mlan/mlan_uap_cmdevent.c
@@ -3,7 +3,7 @@ * @brief This file contains the handling of AP mode command and event * * - * Copyright 2009-2021 NXP + * Copyright 2009-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -59,13 +59,13 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_set_get_band_steering_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_cmd_set_get_band_steering_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + t_void *pdata_buf) { mlan_ds_band_steer_cfg *pband_steer_cfg = - (mlan_ds_band_steer_cfg *) pdata_buf; + (mlan_ds_band_steer_cfg *)pdata_buf; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_BAND_STEERING); @@ -124,13 +124,13 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_cmd_set_get_beacon_stuck_cfg(IN pmlan_private pmpriv, - IN HostCmd_DS_COMMAND *cmd, - IN t_u16 cmd_action, IN t_void *pdata_buf) +static mlan_status wlan_cmd_set_get_beacon_stuck_cfg(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND *cmd, + IN t_u16 cmd_action, + IN t_void *pdata_buf) { HostCmd_DS_BEACON_STUCK_CFG *pbeacon_stuck_param_cfg = - (HostCmd_DS_BEACON_STUCK_CFG *) (pdata_buf + sizeof(t_u32)); + (HostCmd_DS_BEACON_STUCK_CFG *)(pdata_buf + sizeof(t_u32)); ENTER(); @@ -155,10 +155,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_ret_set_get_beacon_stuck_cfg(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_set_get_beacon_stuck_cfg(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_BEACON_STUCK_CFG *pbeacon_stuck_param_cfg = @@ -189,9 +188,9 @@ * * @return N/A */ -static mlan_status -uap_process_cmdresp_error(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status uap_process_cmdresp_error(mlan_private *pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; #if defined(USB) @@ -200,8 +199,8 @@ mlan_status ret = MLAN_STATUS_FAILURE; ENTER(); - if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG - || resp->command != HostCmd_CMD_CHAN_REGION_CFG) + if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG && + resp->command != HostCmd_CMD_CHAN_REGION_CFG) PRINTM(MERROR, "CMD_RESP: cmd %#x error, result=%#x\n", resp->command, resp->result); if (pioctl_buf) @@ -217,86 +216,73 @@ break; #endif - case HOST_CMD_APCMD_SYS_CONFIGURE:{ - HostCmd_DS_SYS_CONFIG *sys_config = - (HostCmd_DS_SYS_CONFIG *)&resp->params. - sys_config; - t_u16 resp_len = 0, travel_len = 0, index; - mlan_ds_misc_custom_ie *cust_ie = MNULL; - mlan_ds_misc_cfg *misc = MNULL; - custom_ie *cptr; + case HOST_CMD_APCMD_SYS_CONFIGURE: { + HostCmd_DS_SYS_CONFIG *sys_config = + (HostCmd_DS_SYS_CONFIG *)&resp->params.sys_config; + t_u16 resp_len = 0, travel_len = 0, index; + mlan_ds_misc_custom_ie *cust_ie = MNULL; + mlan_ds_misc_cfg *misc = MNULL; + custom_ie *cptr; - if (!pioctl_buf || - (pioctl_buf->req_id != MLAN_IOCTL_MISC_CFG)) - break; - misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - if ((pioctl_buf->action == MLAN_ACT_SET) && - (misc->sub_command == MLAN_OID_MISC_CUSTOM_IE)) { - cust_ie = (mlan_ds_misc_custom_ie *) - sys_config->tlv_buffer; - if (cust_ie) { - cust_ie->type = - wlan_le16_to_cpu(cust_ie->type); - resp_len = cust_ie->len = - wlan_le16_to_cpu(cust_ie->len); - travel_len = 0; - /* conversion for index, mask, len */ - if (resp_len == sizeof(t_u16)) - cust_ie->ie_data_list[0]. - ie_index = - wlan_cpu_to_le16 - (cust_ie-> - ie_data_list[0] - .ie_index); + if (!pioctl_buf || (pioctl_buf->req_id != MLAN_IOCTL_MISC_CFG)) + break; + misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + if ((pioctl_buf->action == MLAN_ACT_SET) && + (misc->sub_command == MLAN_OID_MISC_CUSTOM_IE)) { + cust_ie = (mlan_ds_misc_custom_ie *) + sys_config->tlv_buffer; + if (cust_ie) { + cust_ie->type = wlan_le16_to_cpu(cust_ie->type); + resp_len = cust_ie->len = + wlan_le16_to_cpu(cust_ie->len); + travel_len = 0; + /* conversion for index, mask, len */ + if (resp_len == sizeof(t_u16)) + cust_ie->ie_data_list[0].ie_index = + wlan_cpu_to_le16( + cust_ie->ie_data_list[0] + .ie_index); - while (resp_len > sizeof(t_u16)) { - cptr = (custom_ie - *)(((t_u8 *)cust_ie-> - ie_data_list) + + while (resp_len > sizeof(t_u16)) { + cptr = (custom_ie + *)(((t_u8 *)cust_ie + ->ie_data_list) + travel_len); - index = cptr->ie_index = - wlan_le16_to_cpu(cptr-> - ie_index); - cptr->mgmt_subtype_mask = - wlan_le16_to_cpu(cptr-> - mgmt_subtype_mask); - cptr->ie_length = - wlan_le16_to_cpu(cptr-> - ie_length); - travel_len += - cptr->ie_length + - sizeof(custom_ie) - - MAX_IE_SIZE; - resp_len -= - cptr->ie_length + - sizeof(custom_ie) - - MAX_IE_SIZE; - if ((pmpriv->mgmt_ie[index] + index = cptr->ie_index = + wlan_le16_to_cpu( + cptr->ie_index); + cptr->mgmt_subtype_mask = + wlan_le16_to_cpu( + cptr->mgmt_subtype_mask); + cptr->ie_length = wlan_le16_to_cpu( + cptr->ie_length); + travel_len += cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; + resp_len -= cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; + if ((pmpriv->mgmt_ie[index] .mgmt_subtype_mask == - cptr->mgmt_subtype_mask) && - (pmpriv->mgmt_ie[index]. - ie_length == - cptr->ie_length) && - !memcmp(pmpriv->adapter, - pmpriv-> - mgmt_ie[index] + cptr->mgmt_subtype_mask) && + (pmpriv->mgmt_ie[index].ie_length == + cptr->ie_length) && + !memcmp(pmpriv->adapter, + pmpriv->mgmt_ie[index] .ie_buffer, - cptr->ie_buffer, - cptr->ie_length)) { - PRINTM(MERROR, - "set custom ie fail, remove ie index :%d\n", - index); - memset(pmadapter, - &pmpriv-> - mgmt_ie[index], - 0, - sizeof - (custom_ie)); - } + cptr->ie_buffer, + cptr->ie_length)) { + PRINTM(MERROR, + "set custom ie fail, remove ie index :%d\n", + index); + memset(pmadapter, + &pmpriv->mgmt_ie[index], + 0, sizeof(custom_ie)); } } } - } break; + } + } break; case HostCmd_CMD_PACKET_AGGR_CTRL: #ifdef USB if (IS_USB(pmadapter->card_type)) { @@ -339,8 +325,7 @@ * * @return A pointer to structure sta_node */ -static void -wlan_notify_station_deauth(mlan_private *priv) +static void wlan_notify_station_deauth(mlan_private *priv) { sta_node *sta_ptr; t_u8 event_buf[100]; @@ -348,13 +333,10 @@ t_u8 *pbuf; ENTER(); - sta_ptr = - (sta_node *)util_peek_list(priv->adapter->pmoal_handle, - &priv->sta_list, - priv->adapter->callbacks. - moal_spin_lock, - priv->adapter->callbacks. - moal_spin_unlock); + sta_ptr = (sta_node *)util_peek_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); if (!sta_ptr) { LEAVE(); return; @@ -385,10 +367,10 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_802_11_hs_cfg(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, hs_config_param *pdata_buf) +static mlan_status wlan_uap_cmd_802_11_hs_cfg(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + hs_config_param *pdata_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_802_11_HS_CFG_ENH *phs_cfg = @@ -416,22 +398,18 @@ phs_cfg->params.hs_config.gpio = pdata_buf->gpio; phs_cfg->params.hs_config.gap = pdata_buf->gap; if (pmpriv->adapter->min_wake_holdoff) { - cmd->size = wlan_cpu_to_le16(S_DS_GEN + - sizeof - (HostCmd_DS_802_11_HS_CFG_ENH) - + - sizeof - (MrvlIEtypes_HsWakeHoldoff_t)); + cmd->size = wlan_cpu_to_le16( + S_DS_GEN + + sizeof(HostCmd_DS_802_11_HS_CFG_ENH) + + sizeof(MrvlIEtypes_HsWakeHoldoff_t)); holdoff_tlv = (MrvlIEtypes_HsWakeHoldoff_t *)tlv; holdoff_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HS_WAKE_HOLDOFF); - holdoff_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_HsWakeHoldoff_t) - - sizeof(MrvlIEtypesHeader_t)); - holdoff_tlv->min_wake_holdoff = - wlan_cpu_to_le16(pmpriv->adapter-> - min_wake_holdoff); + holdoff_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_HsWakeHoldoff_t) - + sizeof(MrvlIEtypesHeader_t)); + holdoff_tlv->min_wake_holdoff = wlan_cpu_to_le16( + pmpriv->adapter->min_wake_holdoff); tlv += sizeof(MrvlIEtypes_HsWakeHoldoff_t); } PRINTM(MCMND, @@ -443,27 +421,24 @@ if (pmadapter->param_type_ind == 1) { cmd->size += sizeof(MrvlIEtypes_WakeupSourceGPIO_t); - gpio_tlv = (MrvlIEtypes_WakeupSourceGPIO_t *) tlv; - gpio_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_HS_WAKEUP_SOURCE_GPIO); - gpio_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_WakeupSourceGPIO_t) - - sizeof(MrvlIEtypesHeader_t)); + gpio_tlv = (MrvlIEtypes_WakeupSourceGPIO_t *)tlv; + gpio_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_HS_WAKEUP_SOURCE_GPIO); + gpio_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_WakeupSourceGPIO_t) - + sizeof(MrvlIEtypesHeader_t)); gpio_tlv->ind_gpio = (t_u8)pmadapter->ind_gpio; gpio_tlv->level = (t_u8)pmadapter->level; tlv += sizeof(MrvlIEtypes_WakeupSourceGPIO_t); } if (pmadapter->param_type_ext == 2) { cmd->size += sizeof(MrvlIEtypes_WakeupExtend_t); - ext_tlv = (MrvlIEtypes_WakeupExtend_t *) tlv; + ext_tlv = (MrvlIEtypes_WakeupExtend_t *)tlv; ext_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WAKEUP_EXTEND); - ext_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_WakeupExtend_t) - - sizeof(MrvlIEtypesHeader_t)); + ext_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_WakeupExtend_t) - + sizeof(MrvlIEtypesHeader_t)); ext_tlv->event_force_ignore = wlan_cpu_to_le32(pmadapter->event_force_ignore); ext_tlv->event_use_ext_gap = @@ -477,8 +452,8 @@ mgmt_frame_filter mgmt_filter[MAX_MGMT_FRAME_FILTER]; memset(pmadapter, mgmt_filter, 0, MAX_MGMT_FRAME_FILTER * - sizeof(mgmt_frame_filter)); - mgmt_filter_tlv = (MrvlIEtypes_MgmtFrameFilter_t *) tlv; + sizeof(mgmt_frame_filter)); + mgmt_filter_tlv = (MrvlIEtypes_MgmtFrameFilter_t *)tlv; mgmt_filter_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_MGMT_FRAME_WAKEUP); tlv += sizeof(MrvlIEtypesHeader_t); @@ -488,10 +463,8 @@ (t_u8)pmadapter->mgmt_filter[i].action; mgmt_filter[i].type = (t_u8)pmadapter->mgmt_filter[i].type; - mgmt_filter[i].frame_mask = - wlan_cpu_to_le32(pmadapter-> - mgmt_filter[i]. - frame_mask); + mgmt_filter[i].frame_mask = wlan_cpu_to_le32( + pmadapter->mgmt_filter[i].frame_mask); i++; } memcpy_ext(pmadapter, (t_u8 *)mgmt_filter_tlv->filter, @@ -502,17 +475,16 @@ mgmt_filter_tlv->header.len = wlan_cpu_to_le16(i * sizeof(mgmt_frame_filter)); cmd->size += i * sizeof(mgmt_frame_filter) + - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); } if (pmadapter->hs_mimo_switch) { cmd->size += sizeof(MrvlIEtypes_HS_Antmode_t); - antmode_tlv = (MrvlIEtypes_HS_Antmode_t *) tlv; + antmode_tlv = (MrvlIEtypes_HS_Antmode_t *)tlv; antmode_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HS_ANTMODE); - antmode_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_HS_Antmode_t) - - sizeof(MrvlIEtypesHeader_t)); + antmode_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_HS_Antmode_t) - + sizeof(MrvlIEtypesHeader_t)); antmode_tlv->txpath_antmode = ANTMODE_FW_DECISION; antmode_tlv->rxpath_antmode = ANTMODE_FW_DECISION; tlv += sizeof(MrvlIEtypes_HS_Antmode_t); @@ -536,10 +508,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_txdatapause(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_txdatapause(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_CMD_TX_DATA_PAUSE *pause_cmd = (HostCmd_DS_CMD_TX_DATA_PAUSE *)&cmd->params.tx_data_pause; @@ -571,9 +542,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_txdatapause(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_txdatapause(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_CMD_TX_DATA_PAUSE *pause_cmd = (HostCmd_DS_CMD_TX_DATA_PAUSE *)&resp->params.tx_data_pause; @@ -600,8 +571,7 @@ * * @return N/A */ -static void -wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) +static void wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) { t_u16 tlv_type, tlv_len; int tlv_buf_left = pevent->data_len - sizeof(t_u32); @@ -610,7 +580,7 @@ sizeof(t_u32)); MrvlIEtypes_tx_pause_t *tx_pause_tlv; sta_node *sta_ptr = MNULL; - t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; t_u32 total_pkts_queued; t_u16 tx_pkts_queued = 0; ; @@ -635,36 +605,31 @@ if (!memcmp(priv->adapter, bc_mac, tx_pause_tlv->peermac, MLAN_MAC_ADDR_LENGTH)) - tx_pkts_queued = - wlan_update_ralist_tx_pause(priv, - tx_pause_tlv-> - peermac, - tx_pause_tlv-> - tx_pause); - else if (!memcmp - (priv->adapter, priv->curr_addr, - tx_pause_tlv->peermac, - MLAN_MAC_ADDR_LENGTH)) { + tx_pkts_queued = wlan_update_ralist_tx_pause( + priv, tx_pause_tlv->peermac, + tx_pause_tlv->tx_pause); + else if (!memcmp(priv->adapter, priv->curr_addr, + tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { if (tx_pause_tlv->tx_pause) priv->tx_pause = MTRUE; else priv->tx_pause = MFALSE; } else { - sta_ptr = - wlan_get_station_entry(priv, - tx_pause_tlv-> - peermac); + sta_ptr = wlan_get_station_entry( + priv, tx_pause_tlv->peermac); if (sta_ptr) { if (sta_ptr->tx_pause != tx_pause_tlv->tx_pause) { sta_ptr->tx_pause = tx_pause_tlv->tx_pause; tx_pkts_queued = - wlan_update_ralist_tx_pause - (priv, - tx_pause_tlv->peermac, - tx_pause_tlv-> - tx_pause); + wlan_update_ralist_tx_pause( + priv, + tx_pause_tlv + ->peermac, + tx_pause_tlv + ->tx_pause); } } } @@ -695,10 +660,10 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_cmd_ap_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, pmlan_ioctl_req pioctl_buf) +static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + pmlan_ioctl_req pioctl_buf) { mlan_ds_bss *bss = MNULL; HostCmd_DS_SYS_CONFIG *sys_config = @@ -745,10 +710,12 @@ MrvlIEtypes_preamble_t *tlv_preamble = MNULL; t_u32 cmd_size = 0; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u16 i; t_u16 ac; -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) int rx_mcs_supp = 0; #endif @@ -782,7 +749,7 @@ /* ACS is not allowed when DFS repeater mode is on */ if (pmpriv->adapter->dfs_repeater) { PRINTM(MERROR, "ACS is not allowed when" - "DFS repeater mode is on.\n"); + "DFS repeater mode is on.\n"); return MLAN_STATUS_FAILURE; } } @@ -790,18 +757,16 @@ if (bss->param.bss_config.ssid.ssid_len) { tlv_ssid = (MrvlIEtypes_SsIdParamSet_t *)tlv; tlv_ssid->header.type = wlan_cpu_to_le16(TLV_TYPE_SSID); - tlv_ssid->header.len = wlan_cpu_to_le16((t_u16)bss->param. - bss_config.ssid. - ssid_len); + tlv_ssid->header.len = wlan_cpu_to_le16( + (t_u16)bss->param.bss_config.ssid.ssid_len); memcpy_ext(pmpriv->adapter, tlv_ssid->ssid, bss->param.bss_config.ssid.ssid, bss->param.bss_config.ssid.ssid_len, MLAN_MAX_SSID_LENGTH); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + - bss->param.bss_config.ssid.ssid_len; + cmd_size += sizeof(MrvlIEtypesHeader_t) + + bss->param.bss_config.ssid.ssid_len; tlv += sizeof(MrvlIEtypesHeader_t) + - bss->param.bss_config.ssid.ssid_len; + bss->param.bss_config.ssid.ssid_len; } if ((bss->param.bss_config.beacon_period >= MIN_BEACON_PERIOD) && @@ -950,24 +915,22 @@ tlv_sta_ageout->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_STA_AGEOUT_TIMER); tlv_sta_ageout->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_sta_ageout->sta_ageout_timer = - wlan_cpu_to_le32(bss->param.bss_config. - sta_ageout_timer); + tlv_sta_ageout->sta_ageout_timer = wlan_cpu_to_le32( + bss->param.bss_config.sta_ageout_timer); cmd_size += sizeof(MrvlIEtypes_sta_ageout_t); tlv += sizeof(MrvlIEtypes_sta_ageout_t); } - if (((bss->param.bss_config.ps_sta_ageout_timer >= MIN_STAGE_OUT_TIME) - && (bss->param.bss_config.ps_sta_ageout_timer <= - MAX_STAGE_OUT_TIME)) || + if (((bss->param.bss_config.ps_sta_ageout_timer >= MIN_STAGE_OUT_TIME) && + (bss->param.bss_config.ps_sta_ageout_timer <= + MAX_STAGE_OUT_TIME)) || (bss->param.bss_config.ps_sta_ageout_timer == 0)) { tlv_ps_sta_ageout = (MrvlIEtypes_ps_sta_ageout_t *)tlv; tlv_ps_sta_ageout->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER); tlv_ps_sta_ageout->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_ps_sta_ageout->ps_sta_ageout_timer = - wlan_cpu_to_le32(bss->param.bss_config. - ps_sta_ageout_timer); + tlv_ps_sta_ageout->ps_sta_ageout_timer = wlan_cpu_to_le32( + bss->param.bss_config.ps_sta_ageout_timer); cmd_size += sizeof(MrvlIEtypes_ps_sta_ageout_t); tlv += sizeof(MrvlIEtypes_ps_sta_ageout_t); } @@ -1005,6 +968,7 @@ cmd_size += sizeof(MrvlIEtypes_retry_limit_t); tlv += sizeof(MrvlIEtypes_retry_limit_t); } + #ifdef DRV_EMBEDDED_AUTHENTICATOR if (IS_FW_SUPPORT_AUTHENTICATOR(pmpriv->adapter)) { #endif @@ -1012,14 +976,13 @@ (MAX_VALID_DWORD)) { tlv_pairwise_timeout = (MrvlIEtypes_eapol_pwk_hsk_timeout_t *)tlv; - tlv_pairwise_timeout->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT); + tlv_pairwise_timeout->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT); tlv_pairwise_timeout->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_pairwise_timeout->pairwise_update_timeout = - wlan_cpu_to_le32(bss->param.bss_config. - pairwise_update_timeout); + tlv_pairwise_timeout + ->pairwise_update_timeout = wlan_cpu_to_le32( + bss->param.bss_config.pairwise_update_timeout); cmd_size += sizeof(MrvlIEtypes_eapol_pwk_hsk_timeout_t); tlv += sizeof(MrvlIEtypes_eapol_pwk_hsk_timeout_t); } @@ -1027,14 +990,12 @@ if (bss->param.bss_config.pwk_retries < (MAX_VALID_DWORD)) { tlv_pairwise_retries = (MrvlIEtypes_eapol_pwk_hsk_retries_t *)tlv; - tlv_pairwise_retries->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES); + tlv_pairwise_retries->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES); tlv_pairwise_retries->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_pairwise_retries->pwk_retries = - wlan_cpu_to_le32(bss->param.bss_config. - pwk_retries); + tlv_pairwise_retries->pwk_retries = wlan_cpu_to_le32( + bss->param.bss_config.pwk_retries); cmd_size += sizeof(MrvlIEtypes_eapol_pwk_hsk_retries_t); tlv += sizeof(MrvlIEtypes_eapol_pwk_hsk_retries_t); } @@ -1043,14 +1004,13 @@ (MAX_VALID_DWORD)) { tlv_groupwise_timeout = (MrvlIEtypes_eapol_gwk_hsk_timeout_t *)tlv; - tlv_groupwise_timeout->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT); + tlv_groupwise_timeout->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT); tlv_groupwise_timeout->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_groupwise_timeout->groupwise_update_timeout = - wlan_cpu_to_le32(bss->param.bss_config. - groupwise_update_timeout); + tlv_groupwise_timeout + ->groupwise_update_timeout = wlan_cpu_to_le32( + bss->param.bss_config.groupwise_update_timeout); cmd_size += sizeof(MrvlIEtypes_eapol_gwk_hsk_timeout_t); tlv += sizeof(MrvlIEtypes_eapol_gwk_hsk_timeout_t); } @@ -1058,14 +1018,12 @@ if (bss->param.bss_config.gwk_retries < (MAX_VALID_DWORD)) { tlv_groupwise_retries = (MrvlIEtypes_eapol_gwk_hsk_retries_t *)tlv; - tlv_groupwise_retries->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES); + tlv_groupwise_retries->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES); tlv_groupwise_retries->header.len = wlan_cpu_to_le16(sizeof(t_u32)); - tlv_groupwise_retries->gwk_retries = - wlan_cpu_to_le32(bss->param.bss_config. - gwk_retries); + tlv_groupwise_retries->gwk_retries = wlan_cpu_to_le32( + bss->param.bss_config.gwk_retries); cmd_size += sizeof(MrvlIEtypes_eapol_gwk_hsk_retries_t); tlv += sizeof(MrvlIEtypes_eapol_gwk_hsk_retries_t); } @@ -1078,11 +1036,9 @@ tlv_mac_filter = (MrvlIEtypes_mac_filter_t *)tlv; tlv_mac_filter->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_STA_MAC_ADDR_FILTER); - tlv_mac_filter->header.len = - wlan_cpu_to_le16(2 + - MLAN_MAC_ADDR_LENGTH * - bss->param.bss_config.filter. - mac_count); + tlv_mac_filter->header.len = wlan_cpu_to_le16( + 2 + MLAN_MAC_ADDR_LENGTH * + bss->param.bss_config.filter.mac_count); tlv_mac_filter->count = (t_u8)bss->param.bss_config.filter.mac_count; tlv_mac_filter->filter_mode = @@ -1090,15 +1046,14 @@ memcpy_ext(pmpriv->adapter, tlv_mac_filter->mac_address, (t_u8 *)bss->param.bss_config.filter.mac_list, MLAN_MAC_ADDR_LENGTH * - bss->param.bss_config.filter.mac_count, + bss->param.bss_config.filter.mac_count, MLAN_MAC_ADDR_LENGTH * MAX_MAC_FILTER_NUM); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + 2 + - MLAN_MAC_ADDR_LENGTH * - bss->param.bss_config.filter.mac_count; + cmd_size += sizeof(MrvlIEtypesHeader_t) + 2 + + MLAN_MAC_ADDR_LENGTH * + bss->param.bss_config.filter.mac_count; tlv += sizeof(MrvlIEtypesHeader_t) + 2 + - MLAN_MAC_ADDR_LENGTH * - bss->param.bss_config.filter.mac_count; + MLAN_MAC_ADDR_LENGTH * + bss->param.bss_config.filter.mac_count; } if (((bss->param.bss_config.bandcfg.scanMode == SCAN_MODE_MANUAL) && @@ -1121,13 +1076,9 @@ tlv_chan_list = (MrvlIEtypes_ChanListParamSet_t *)tlv; tlv_chan_list->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANLIST); - tlv_chan_list->header.len = wlan_cpu_to_le16((t_u16) - (sizeof - (ChanScanParamSet_t) - * - bss->param. - bss_config. - num_of_chan)); + tlv_chan_list->header.len = wlan_cpu_to_le16( + (t_u16)(sizeof(ChanScanParamSet_t) * + bss->param.bss_config.num_of_chan)); pscan_chan = tlv_chan_list->chan_scan_param; for (i = 0; i < bss->param.bss_config.num_of_chan; i++) { pscan_chan->chan_number = @@ -1137,11 +1088,11 @@ pscan_chan++; } cmd_size += sizeof(tlv_chan_list->header) + - (sizeof(ChanScanParamSet_t) * - bss->param.bss_config.num_of_chan); + (sizeof(ChanScanParamSet_t) * + bss->param.bss_config.num_of_chan); tlv += sizeof(tlv_chan_list->header) + - (sizeof(ChanScanParamSet_t) * - bss->param.bss_config.num_of_chan); + (sizeof(ChanScanParamSet_t) * + bss->param.bss_config.num_of_chan); } if ((bss->param.bss_config.auth_mode <= MLAN_AUTH_MODE_SHARED) || @@ -1149,7 +1100,9 @@ tlv_auth_type = (MrvlIEtypes_auth_type_t *)tlv; tlv_auth_type->header.type = wlan_cpu_to_le16(TLV_TYPE_AUTH_TYPE); - tlv_auth_type->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + tlv_auth_type->header.len = + wlan_cpu_to_le16(sizeof(MrvlIEtypes_auth_type_t) - + sizeof(MrvlIEtypesHeader_t)); tlv_auth_type->auth_type = (t_u8)bss->param.bss_config.auth_mode; cmd_size += sizeof(MrvlIEtypes_auth_type_t); @@ -1176,9 +1129,8 @@ tlv_akmp->key_mgmt = wlan_cpu_to_le16(bss->param.bss_config.key_mgmt); tlv_akmp->header.len = sizeof(t_u16); - tlv_akmp->key_mgmt_operation = - wlan_cpu_to_le16(bss->param.bss_config. - key_mgmt_operation); + tlv_akmp->key_mgmt_operation = wlan_cpu_to_le16( + bss->param.bss_config.key_mgmt_operation); tlv_akmp->header.len += sizeof(t_u16); tlv_akmp->header.len = wlan_cpu_to_le16(tlv_akmp->header.len); cmd_size += sizeof(MrvlIEtypes_akmp_t); @@ -1189,14 +1141,13 @@ tlv_pwk_cipher = (MrvlIEtypes_pwk_cipher_t *)tlv; tlv_pwk_cipher->header.type = wlan_cpu_to_le16(TLV_TYPE_PWK_CIPHER); - tlv_pwk_cipher->header.len = - wlan_cpu_to_le16(sizeof(t_u16) + sizeof(t_u8) + - sizeof(t_u8)); + tlv_pwk_cipher->header.len = wlan_cpu_to_le16( + sizeof(t_u16) + sizeof(t_u8) + sizeof(t_u8)); tlv_pwk_cipher->protocol = wlan_cpu_to_le16(PROTOCOL_WPA); tlv_pwk_cipher->pairwise_cipher = - bss->param.bss_config.wpa_cfg. - pairwise_cipher_wpa; + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa; cmd_size += sizeof(MrvlIEtypes_pwk_cipher_t); tlv += sizeof(MrvlIEtypes_pwk_cipher_t); } @@ -1206,14 +1157,13 @@ tlv_pwk_cipher = (MrvlIEtypes_pwk_cipher_t *)tlv; tlv_pwk_cipher->header.type = wlan_cpu_to_le16(TLV_TYPE_PWK_CIPHER); - tlv_pwk_cipher->header.len = - wlan_cpu_to_le16(sizeof(t_u16) + sizeof(t_u8) + - sizeof(t_u8)); + tlv_pwk_cipher->header.len = wlan_cpu_to_le16( + sizeof(t_u16) + sizeof(t_u8) + sizeof(t_u8)); tlv_pwk_cipher->protocol = wlan_cpu_to_le16(PROTOCOL_WPA2); tlv_pwk_cipher->pairwise_cipher = - bss->param.bss_config.wpa_cfg. - pairwise_cipher_wpa2; + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa2; cmd_size += sizeof(MrvlIEtypes_pwk_cipher_t); tlv += sizeof(MrvlIEtypes_pwk_cipher_t); } @@ -1233,9 +1183,8 @@ if (bss->param.bss_config.wpa_cfg.rsn_protection <= MTRUE) { tlv_rsn_prot = (MrvlIEtypes_rsn_replay_prot_t *)tlv; - tlv_rsn_prot->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_RSN_REPLAY_PROTECT); + tlv_rsn_prot->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_RSN_REPLAY_PROTECT); tlv_rsn_prot->header.len = wlan_cpu_to_le16(sizeof(t_u8)); tlv_rsn_prot->rsn_replay_prot = @@ -1243,45 +1192,43 @@ cmd_size += sizeof(MrvlIEtypes_rsn_replay_prot_t); tlv += sizeof(MrvlIEtypes_rsn_replay_prot_t); } + #ifdef DRV_EMBEDDED_AUTHENTICATOR if (IS_FW_SUPPORT_AUTHENTICATOR(pmpriv->adapter)) { #endif if (bss->param.bss_config.wpa_cfg.length) { tlv_passphrase = (MrvlIEtypes_passphrase_t *)tlv; - tlv_passphrase->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_WPA_PASSPHRASE); - tlv_passphrase->header.len = - (t_u16)wlan_cpu_to_le16(bss->param. - bss_config. - wpa_cfg.length); - memcpy_ext(pmpriv->adapter, - tlv_passphrase->passphrase, - bss->param.bss_config.wpa_cfg. - passphrase, - bss->param.bss_config.wpa_cfg.length, - bss->param.bss_config.wpa_cfg. - length); + tlv_passphrase->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_WPA_PASSPHRASE); + tlv_passphrase->header + .len = (t_u16)wlan_cpu_to_le16( + bss->param.bss_config.wpa_cfg.length); + memcpy_ext( + pmpriv->adapter, + tlv_passphrase->passphrase, + bss->param.bss_config.wpa_cfg.passphrase, + bss->param.bss_config.wpa_cfg.length, + bss->param.bss_config.wpa_cfg.length); cmd_size += sizeof(MrvlIEtypesHeader_t) + bss->param.bss_config.wpa_cfg.length; tlv += sizeof(MrvlIEtypesHeader_t) + - bss->param.bss_config.wpa_cfg.length; + bss->param.bss_config.wpa_cfg.length; } if (bss->param.bss_config.wpa_cfg.gk_rekey_time < MAX_GRP_TIMER) { tlv_rekey_time = (MrvlIEtypes_group_rekey_time_t *)tlv; - tlv_rekey_time->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_GRP_REKEY_TIME); + tlv_rekey_time->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_GRP_REKEY_TIME); tlv_rekey_time->header.len = wlan_cpu_to_le16(sizeof(t_u32)); tlv_rekey_time->gk_rekey_time = - wlan_cpu_to_le32(bss->param.bss_config. - wpa_cfg.gk_rekey_time); + wlan_cpu_to_le32( + bss->param.bss_config.wpa_cfg + .gk_rekey_time); cmd_size += sizeof(MrvlIEtypes_group_rekey_time_t); tlv += sizeof(MrvlIEtypes_group_rekey_time_t); @@ -1298,10 +1245,8 @@ tlv_wep_key = (MrvlIEtypes_wep_key_t *)tlv; tlv_wep_key->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); - tlv_wep_key->header.len = - wlan_cpu_to_le16(2 + - bss->param.bss_config.wep_cfg. - key0.length); + tlv_wep_key->header.len = wlan_cpu_to_le16( + 2 + bss->param.bss_config.wep_cfg.key0.length); tlv_wep_key->key_index = bss->param.bss_config.wep_cfg.key0.key_index; tlv_wep_key->is_default = @@ -1310,11 +1255,10 @@ bss->param.bss_config.wep_cfg.key0.key, bss->param.bss_config.wep_cfg.key0.length, bss->param.bss_config.wep_cfg.key0.length); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key0.length; + cmd_size += sizeof(MrvlIEtypesHeader_t) + 2 + + bss->param.bss_config.wep_cfg.key0.length; tlv += sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key0.length; + bss->param.bss_config.wep_cfg.key0.length; } if ((bss->param.bss_config.wep_cfg.key1.length) && @@ -1325,10 +1269,8 @@ tlv_wep_key = (MrvlIEtypes_wep_key_t *)tlv; tlv_wep_key->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); - tlv_wep_key->header.len = - wlan_cpu_to_le16(2 + - bss->param.bss_config.wep_cfg. - key1.length); + tlv_wep_key->header.len = wlan_cpu_to_le16( + 2 + bss->param.bss_config.wep_cfg.key1.length); tlv_wep_key->key_index = bss->param.bss_config.wep_cfg.key1.key_index; tlv_wep_key->is_default = @@ -1337,11 +1279,10 @@ bss->param.bss_config.wep_cfg.key1.key, bss->param.bss_config.wep_cfg.key1.length, bss->param.bss_config.wep_cfg.key1.length); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key1.length; + cmd_size += sizeof(MrvlIEtypesHeader_t) + 2 + + bss->param.bss_config.wep_cfg.key1.length; tlv += sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key1.length; + bss->param.bss_config.wep_cfg.key1.length; } if ((bss->param.bss_config.wep_cfg.key2.length) && @@ -1352,10 +1293,8 @@ tlv_wep_key = (MrvlIEtypes_wep_key_t *)tlv; tlv_wep_key->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); - tlv_wep_key->header.len = - wlan_cpu_to_le16(2 + - bss->param.bss_config.wep_cfg. - key2.length); + tlv_wep_key->header.len = wlan_cpu_to_le16( + 2 + bss->param.bss_config.wep_cfg.key2.length); tlv_wep_key->key_index = bss->param.bss_config.wep_cfg.key2.key_index; tlv_wep_key->is_default = @@ -1364,11 +1303,10 @@ bss->param.bss_config.wep_cfg.key2.key, bss->param.bss_config.wep_cfg.key2.length, bss->param.bss_config.wep_cfg.key2.length); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key2.length; + cmd_size += sizeof(MrvlIEtypesHeader_t) + 2 + + bss->param.bss_config.wep_cfg.key2.length; tlv += sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key2.length; + bss->param.bss_config.wep_cfg.key2.length; } if ((bss->param.bss_config.wep_cfg.key3.length) && @@ -1379,10 +1317,8 @@ tlv_wep_key = (MrvlIEtypes_wep_key_t *)tlv; tlv_wep_key->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); - tlv_wep_key->header.len = - wlan_cpu_to_le16(2 + - bss->param.bss_config.wep_cfg. - key3.length); + tlv_wep_key->header.len = wlan_cpu_to_le16( + 2 + bss->param.bss_config.wep_cfg.key3.length); tlv_wep_key->key_index = bss->param.bss_config.wep_cfg.key3.key_index; tlv_wep_key->is_default = @@ -1391,11 +1327,10 @@ bss->param.bss_config.wep_cfg.key3.key, bss->param.bss_config.wep_cfg.key3.length, bss->param.bss_config.wep_cfg.key3.length); - cmd_size += - sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key3.length; + cmd_size += sizeof(MrvlIEtypesHeader_t) + 2 + + bss->param.bss_config.wep_cfg.key3.length; tlv += sizeof(MrvlIEtypesHeader_t) + 2 + - bss->param.bss_config.wep_cfg.key3.length; + bss->param.bss_config.wep_cfg.key3.length; } } if (bss->param.bss_config.ht_cap_info) { @@ -1409,20 +1344,21 @@ memcpy_ext(pmpriv->adapter, tlv_htcap->ht_cap.supported_mcs_set, bss->param.bss_config.supported_mcs_set, 16, sizeof(tlv_htcap->ht_cap.supported_mcs_set)); -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(SD9097) || defined(USB9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) if (IS_CARD9098(pmpriv->adapter->card_type) || + IS_CARDNW62X(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type)) { if (bss->param.bss_config.supported_mcs_set[0]) { if (bss->param.bss_config.bandcfg.chanBand == BAND_5GHZ) - rx_mcs_supp = - GET_RXMCSSUPP(pmpriv->adapter-> - user_htstream >> - 8); + rx_mcs_supp = GET_RXMCSSUPP( + pmpriv->adapter->user_htstream >> + 8); else - rx_mcs_supp = - GET_RXMCSSUPP(pmpriv->adapter-> - user_htstream); + rx_mcs_supp = GET_RXMCSSUPP( + pmpriv->adapter->user_htstream); if (rx_mcs_supp == 0x1) { tlv_htcap->ht_cap.supported_mcs_set[0] = @@ -1455,9 +1391,8 @@ /* keep copy in private data */ pmpriv->mgmt_frame_passthru_mask = bss->param.bss_config.mgmt_ie_passthru_mask; - tlv_mgmt_ie_passthru->mgmt_ie_mask = - wlan_cpu_to_le32(bss->param.bss_config. - mgmt_ie_passthru_mask); + tlv_mgmt_ie_passthru->mgmt_ie_mask = wlan_cpu_to_le32( + bss->param.bss_config.mgmt_ie_passthru_mask); cmd_size += sizeof(MrvlIEtypes_mgmt_ie_passthru_t); tlv += sizeof(MrvlIEtypes_mgmt_ie_passthru_t); } @@ -1479,9 +1414,8 @@ tlv_wmm_parameter = (MrvlIEtypes_wmm_parameter_t *)tlv; tlv_wmm_parameter->header.type = wlan_cpu_to_le16(TLV_TYPE_VENDOR_SPECIFIC_IE); - tlv_wmm_parameter->header.len = - wlan_cpu_to_le16(sizeof - (bss->param.bss_config.wmm_para)); + tlv_wmm_parameter->header.len = wlan_cpu_to_le16( + sizeof(bss->param.bss_config.wmm_para)); memcpy_ext(pmpriv->adapter, tlv_wmm_parameter->wmm_para.ouitype, bss->param.bss_config.wmm_para.ouitype, sizeof(tlv_wmm_parameter->wmm_para.ouitype), @@ -1496,21 +1430,20 @@ tlv_wmm_parameter->wmm_para.ac_params[ac] .aci_aifsn.aifsn = bss->param.bss_config.wmm_para.ac_params[ac] - .aci_aifsn.aifsn; - tlv_wmm_parameter->wmm_para.ac_params[ac].aci_aifsn. - aci = + .aci_aifsn.aifsn; + tlv_wmm_parameter->wmm_para.ac_params[ac].aci_aifsn.aci = bss->param.bss_config.wmm_para.ac_params[ac] - .aci_aifsn.aci; + .aci_aifsn.aci; tlv_wmm_parameter->wmm_para.ac_params[ac].ecw.ecw_max = bss->param.bss_config.wmm_para.ac_params[ac] - .ecw.ecw_max; + .ecw.ecw_max; tlv_wmm_parameter->wmm_para.ac_params[ac].ecw.ecw_min = bss->param.bss_config.wmm_para.ac_params[ac] - .ecw.ecw_min; + .ecw.ecw_min; tlv_wmm_parameter->wmm_para.ac_params[ac].tx_op_limit = - wlan_cpu_to_le16(bss->param.bss_config.wmm_para. - ac_params[ac] - .tx_op_limit); + wlan_cpu_to_le16(bss->param.bss_config.wmm_para + .ac_params[ac] + .tx_op_limit); } cmd_size += sizeof(MrvlIEtypes_wmm_parameter_t); tlv += sizeof(MrvlIEtypes_wmm_parameter_t); @@ -1549,11 +1482,11 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_cmd_sys_configure(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, - pmlan_ioctl_req pioctl_buf, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_sys_configure(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + pmlan_ioctl_req pioctl_buf, + t_void *pdata_buf) { mlan_ds_bss *bss = MNULL; HostCmd_DS_SYS_CONFIG *sys_config = @@ -1561,9 +1494,9 @@ MrvlIEtypes_MacAddr_t *mac_tlv = MNULL; MrvlIEtypes_channel_band_t *pdat_tlv_cb = MNULL; MrvlIEtypes_beacon_period_t *bcn_pd_tlv = MNULL, - *pdat_tlv_bcnpd = MNULL; + *pdat_tlv_bcnpd = MNULL; MrvlIEtypes_dtim_period_t *dtim_pd_tlv = MNULL, - *pdat_tlv_dtimpd = MNULL; + *pdat_tlv_dtimpd = MNULL; MrvlIEtypes_wmm_parameter_t *tlv_wmm_parameter = MNULL; MrvlIEtypes_ChanListParamSet_t *tlv_chan_list = MNULL; ChanScanParamSet_t *pscan_chan = MNULL; @@ -1601,22 +1534,16 @@ pdat_tlv_cb = (MrvlIEtypes_channel_band_t *)pdata_buf; chan_band_tlv = (MrvlIEtypes_channel_band_t *) - sys_config->tlv_buffer; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_channel_band_t)); - chan_band_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_CHAN_BAND_CONFIG); - chan_band_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_channel_band_t) - - - sizeof - (MrvlIEtypesHeader_t)); + sys_config->tlv_buffer; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + + sizeof(MrvlIEtypes_channel_band_t)); + chan_band_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_CHAN_BAND_CONFIG); + chan_band_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_channel_band_t) - + sizeof(MrvlIEtypesHeader_t)); if (cmd_action) { chan_band_tlv->bandcfg = pdat_tlv_cb->bandcfg; @@ -1629,54 +1556,47 @@ pdat_tlv_bcnpd = (MrvlIEtypes_beacon_period_t *) pdata_buf; bcn_pd_tlv = (MrvlIEtypes_beacon_period_t *) - sys_config->tlv_buffer; + sys_config->tlv_buffer; cmd->size = sizeof(HostCmd_DS_SYS_CONFIG) - 1 + - S_DS_GEN + - sizeof(MrvlIEtypes_beacon_period_t); - bcn_pd_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_BEACON_PERIOD); - bcn_pd_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_beacon_period_t) - - - sizeof - (MrvlIEtypesHeader_t)); + S_DS_GEN + + sizeof(MrvlIEtypes_beacon_period_t); + bcn_pd_tlv->header.type = wlan_cpu_to_le16( + TLV_TYPE_UAP_BEACON_PERIOD); + bcn_pd_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_beacon_period_t) - + sizeof(MrvlIEtypesHeader_t)); if (cmd_action) { bcn_pd_tlv->beacon_period = - wlan_cpu_to_le16 - (pdat_tlv_bcnpd->beacon_period); + wlan_cpu_to_le16( + pdat_tlv_bcnpd + ->beacon_period); } /* Add TLV_UAP_DTIM_PERIOD if it follws in * pdata_buf */ pdat_tlv_dtimpd = (MrvlIEtypes_dtim_period_t - *)(((t_u8 *)pdata_buf) + - sizeof - (MrvlIEtypes_beacon_period_t)); + *)(((t_u8 *)pdata_buf) + + sizeof(MrvlIEtypes_beacon_period_t)); if (TLV_TYPE_UAP_DTIM_PERIOD == pdat_tlv_dtimpd->header.type) { dtim_pd_tlv = (MrvlIEtypes_dtim_period_t - *)(sys_config->tlv_buffer + - sizeof - (MrvlIEtypes_beacon_period_t)); - cmd->size += - sizeof - (MrvlIEtypes_dtim_period_t); - dtim_pd_tlv->header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_DTIM_PERIOD); - dtim_pd_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_dtim_period_t) - - - sizeof - (MrvlIEtypesHeader_t)); + *)(sys_config + ->tlv_buffer + + sizeof(MrvlIEtypes_beacon_period_t)); + cmd->size += sizeof( + MrvlIEtypes_dtim_period_t); + dtim_pd_tlv->header + .type = wlan_cpu_to_le16( + TLV_TYPE_UAP_DTIM_PERIOD); + dtim_pd_tlv->header + .len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_dtim_period_t) - + sizeof(MrvlIEtypesHeader_t)); if (cmd_action) { dtim_pd_tlv->dtim_period = - pdat_tlv_dtimpd-> - dtim_period; + pdat_tlv_dtimpd + ->dtim_period; } } /* Finalize cmd size */ @@ -1685,13 +1605,10 @@ break; case TLV_TYPE_MGMT_IE: cust_ie = (mlan_ds_misc_custom_ie *)pdata_buf; - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypesHeader_t) + - cust_ie->len); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + sizeof(MrvlIEtypesHeader_t) + + cust_ie->len); ie_header->type = wlan_cpu_to_le16(TLV_TYPE_MGMT_IE); ie_header->len = wlan_cpu_to_le16(cust_ie->len); @@ -1702,33 +1619,29 @@ /* conversion for index, mask, len */ if (req_len == sizeof(t_u16)) cust_ie->ie_data_list[0] - .ie_index = - wlan_cpu_to_le16 - (cust_ie-> - ie_data_list[0] - .ie_index); + .ie_index = wlan_cpu_to_le16( + cust_ie->ie_data_list[0] + .ie_index); while (req_len > sizeof(t_u16)) { cptr = (custom_ie - *)(((t_u8 *)&cust_ie-> - ie_data_list) + - travel_len); + *)(((t_u8 *)&cust_ie + ->ie_data_list) + + travel_len); travel_len += cptr->ie_length + sizeof(custom_ie) - MAX_IE_SIZE; - req_len -= - cptr->ie_length + - sizeof(custom_ie) - - MAX_IE_SIZE; + req_len -= cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; cptr->ie_index = - wlan_cpu_to_le16(cptr-> - ie_index); - cptr->mgmt_subtype_mask = - wlan_cpu_to_le16(cptr-> - mgmt_subtype_mask); + wlan_cpu_to_le16( + cptr->ie_index); + cptr->mgmt_subtype_mask = wlan_cpu_to_le16( + cptr->mgmt_subtype_mask); cptr->ie_length = - wlan_cpu_to_le16(cptr-> - ie_length); + wlan_cpu_to_le16( + cptr->ie_length); } memcpy_ext(pmpriv->adapter, ie, cust_ie->ie_data_list, @@ -1737,46 +1650,41 @@ break; case REGULATORY_CLASS: poper_class_tlv = - (MrvlIEtypes_chan_bw_oper_t *) - pdata_buf; - ret = wlan_get_curr_oper_class(pmpriv, - poper_class_tlv-> - ds_chan_bw_oper. - channel, - poper_class_tlv-> - ds_chan_bw_oper. - bandwidth, - &curr_oper_class); + (MrvlIEtypes_chan_bw_oper_t *)pdata_buf; + ret = wlan_get_curr_oper_class( + pmpriv, + poper_class_tlv->ds_chan_bw_oper.channel, + poper_class_tlv->ds_chan_bw_oper + .bandwidth, + &curr_oper_class); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Can not get current oper class! bandwidth = %d, channel = %d\n", - poper_class_tlv->ds_chan_bw_oper. - bandwidth, - poper_class_tlv->ds_chan_bw_oper. - channel); + poper_class_tlv->ds_chan_bw_oper + .bandwidth, + poper_class_tlv->ds_chan_bw_oper + .channel); } if (cmd_action == HostCmd_ACT_GEN_SET) - length = wlan_add_supported_oper_class_ie(pmpriv, &oper_class_ie, curr_oper_class); - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - length); + length = + wlan_add_supported_oper_class_ie( + pmpriv, &oper_class_ie, + curr_oper_class); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + length); break; case TLV_TYPE_UAP_MAX_STA_CNT_PER_CHIP: - memcpy_ext(pmpriv->adapter, - sys_config->tlv_buffer, pdata_buf, - sizeof - (MrvlIEtypes_uap_max_sta_cnt_t), - sizeof - (MrvlIEtypes_uap_max_sta_cnt_t)); - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_uap_max_sta_cnt_t)); + memcpy_ext( + pmpriv->adapter, sys_config->tlv_buffer, + pdata_buf, + sizeof(MrvlIEtypes_uap_max_sta_cnt_t), + sizeof(MrvlIEtypes_uap_max_sta_cnt_t)); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + + sizeof(MrvlIEtypes_uap_max_sta_cnt_t)); break; default: PRINTM(MERROR, @@ -1788,10 +1696,9 @@ } else { mac_tlv = (MrvlIEtypes_MacAddr_t *)sys_config->tlv_buffer; - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof(MrvlIEtypes_MacAddr_t)); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypes_MacAddr_t)); mac_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_MAC_ADDRESS); mac_tlv->header.len = @@ -1805,10 +1712,9 @@ if (bss->sub_command == MLAN_OID_BSS_MAC_ADDR) { mac_tlv = (MrvlIEtypes_MacAddr_t *)sys_config->tlv_buffer; - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof(MrvlIEtypes_MacAddr_t)); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypes_MacAddr_t)); mac_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_MAC_ADDRESS); mac_tlv->header.len = @@ -1820,123 +1726,107 @@ MLAN_MAC_ADDR_LENGTH); } else if (bss->sub_command == MLAN_OID_UAP_CFG_WMM_PARAM) { tlv_wmm_parameter = (MrvlIEtypes_wmm_parameter_t *) - sys_config->tlv_buffer; - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_wmm_parameter_t)); + sys_config->tlv_buffer; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypes_wmm_parameter_t)); tlv_wmm_parameter->header.type = wlan_cpu_to_le16(TLV_TYPE_AP_WMM_PARAM); - tlv_wmm_parameter->header.len = - wlan_cpu_to_le16(sizeof - (bss->param.ap_wmm_para)); + tlv_wmm_parameter->header.len = wlan_cpu_to_le16( + sizeof(bss->param.ap_wmm_para)); if (cmd_action == HostCmd_ACT_GEN_SET) { for (ac = 0; ac < 4; ac++) { - tlv_wmm_parameter->wmm_para. - ac_params[ac] + tlv_wmm_parameter->wmm_para + .ac_params[ac] .aci_aifsn.aifsn = - bss->param.ap_wmm_para. - ac_params[ac] - .aci_aifsn.aifsn; - tlv_wmm_parameter->wmm_para. - ac_params[ac] + bss->param.ap_wmm_para + .ac_params[ac] + .aci_aifsn.aifsn; + tlv_wmm_parameter->wmm_para + .ac_params[ac] .aci_aifsn.aci = - bss->param.ap_wmm_para. - ac_params[ac] - .aci_aifsn.aci; - tlv_wmm_parameter->wmm_para. - ac_params[ac] + bss->param.ap_wmm_para + .ac_params[ac] + .aci_aifsn.aci; + tlv_wmm_parameter->wmm_para + .ac_params[ac] .ecw.ecw_max = - bss->param.ap_wmm_para. - ac_params[ac] - .ecw.ecw_max; - tlv_wmm_parameter->wmm_para. - ac_params[ac] + bss->param.ap_wmm_para + .ac_params[ac] + .ecw.ecw_max; + tlv_wmm_parameter->wmm_para + .ac_params[ac] .ecw.ecw_min = - bss->param.ap_wmm_para. - ac_params[ac] - .ecw.ecw_min; - tlv_wmm_parameter->wmm_para. - ac_params[ac] - .tx_op_limit = - wlan_cpu_to_le16(bss->param. - ap_wmm_para. - ac_params[ac] - .tx_op_limit); + bss->param.ap_wmm_para + .ac_params[ac] + .ecw.ecw_min; + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .tx_op_limit = wlan_cpu_to_le16( + bss->param.ap_wmm_para + .ac_params[ac] + .tx_op_limit); } } } else if (bss->sub_command == MLAN_OID_UAP_SCAN_CHANNELS) { tlv_chan_list = (MrvlIEtypes_ChanListParamSet_t *) - sys_config->tlv_buffer; + sys_config->tlv_buffer; tlv_chan_list->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANLIST); if (bss->param.ap_scan_channels.num_of_chan && bss->param.ap_scan_channels.num_of_chan <= - MLAN_MAX_CHANNEL) { - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof(tlv_chan_list-> - header) + - sizeof - (ChanScanParamSet_t) * - bss->param. - ap_scan_channels. - num_of_chan); - tlv_chan_list->header.len = - wlan_cpu_to_le16((t_u16) - (sizeof - (ChanScanParamSet_t) * - bss->param. - ap_scan_channels. - num_of_chan)); + MLAN_MAX_CHANNEL) { + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + + sizeof(tlv_chan_list->header) + + sizeof(ChanScanParamSet_t) * + bss->param.ap_scan_channels + .num_of_chan); + tlv_chan_list->header.len = wlan_cpu_to_le16( + (t_u16)(sizeof(ChanScanParamSet_t) * + bss->param.ap_scan_channels + .num_of_chan)); pscan_chan = tlv_chan_list->chan_scan_param; for (i = 0; i < bss->param.ap_scan_channels.num_of_chan; i++) { pscan_chan->chan_number = - bss->param.ap_scan_channels. - chan_list[i] - .chan_number; + bss->param.ap_scan_channels + .chan_list[i] + .chan_number; pscan_chan->bandcfg = - bss->param.ap_scan_channels. - chan_list[i] - .bandcfg; + bss->param.ap_scan_channels + .chan_list[i] + .bandcfg; pscan_chan++; } PRINTM(MCMND, "Set AP scan channel list = %d\n", bss->param.ap_scan_channels.num_of_chan); } else { - tlv_chan_list->header.len = wlan_cpu_to_le16((t_u16)(sizeof(ChanScanParamSet_t) * MLAN_MAX_CHANNEL)); - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_ChanListParamSet_t) - + - sizeof - (ChanScanParamSet_t) * - MLAN_MAX_CHANNEL); + tlv_chan_list->header.len = wlan_cpu_to_le16( + (t_u16)(sizeof(ChanScanParamSet_t) * + MLAN_MAX_CHANNEL)); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + + sizeof(MrvlIEtypes_ChanListParamSet_t) + + sizeof(ChanScanParamSet_t) * + MLAN_MAX_CHANNEL); } } else if (bss->sub_command == MLAN_OID_UAP_CHANNEL) { chan_band_tlv = (MrvlIEtypes_channel_band_t *) - sys_config->tlv_buffer; - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_channel_band_t)); + sys_config->tlv_buffer; + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypes_channel_band_t)); chan_band_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_CHAN_BAND_CONFIG); - chan_band_tlv->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_channel_band_t) - - sizeof(MrvlIEtypesHeader_t)); + chan_band_tlv->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_channel_band_t) - + sizeof(MrvlIEtypesHeader_t)); if (cmd_action == HostCmd_ACT_GEN_SET) { chan_band_tlv->bandcfg = bss->param.ap_channel.bandcfg; @@ -1948,36 +1838,31 @@ bss->param.ap_channel.channel); } } else if (bss->sub_command == MLAN_OID_ACTION_CHAN_SWITCH) { - cmd->size = - sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + - sizeof(MrvlIEtypes_action_chan_switch_t); + cmd->size = sizeof(HostCmd_DS_SYS_CONFIG) - 1 + + S_DS_GEN + + sizeof(MrvlIEtypes_action_chan_switch_t); tlv_chan_switch = (MrvlIEtypes_action_chan_switch_t *) - sys_config->tlv_buffer; - tlv_chan_switch->header.type = - wlan_cpu_to_le16 - (MRVL_ACTION_CHAN_SWITCH_ANNOUNCE); - //mode reserve for future use + sys_config->tlv_buffer; + tlv_chan_switch->header.type = wlan_cpu_to_le16( + MRVL_ACTION_CHAN_SWITCH_ANNOUNCE); + // mode reserve for future use tlv_chan_switch->mode = 0; + tlv_chan_switch->num_pkt = + bss->param.chanswitch.chan_switch_count; if (bss->param.chanswitch.new_oper_class) { - tlv_chan_switch->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_action_chan_switch_t) - - - sizeof - (MrvlIEtypesHeader_t) + - sizeof - (IEEEtypes_ExtChanSwitchAnn_t)); - ecsa_ie = - (IEEEtypes_ExtChanSwitchAnn_t *) - tlv_chan_switch->ie_buf; + tlv_chan_switch->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_action_chan_switch_t) - + sizeof(MrvlIEtypesHeader_t) + + sizeof(IEEEtypes_ExtChanSwitchAnn_t)); + ecsa_ie = (IEEEtypes_ExtChanSwitchAnn_t *) + tlv_chan_switch->ie_buf; ecsa_ie->element_id = EXTEND_CHANNEL_SWITCH_ANN; ecsa_ie->len = sizeof(IEEEtypes_ExtChanSwitchAnn_t) - sizeof(IEEEtypes_Header_t); ecsa_ie->chan_switch_mode = bss->param.chanswitch.chan_switch_mode; - ecsa_ie->chan_switch_count = - bss->param.chanswitch.chan_switch_count; + ecsa_ie->chan_switch_count = 0; ecsa_ie->new_channel_num = bss->param.chanswitch.new_channel_num; ecsa_ie->new_oper_class = @@ -1985,24 +1870,19 @@ cmd->size += sizeof(IEEEtypes_ExtChanSwitchAnn_t); } else { - tlv_chan_switch->header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_action_chan_switch_t) - - - sizeof - (MrvlIEtypesHeader_t) + - sizeof - (IEEEtypes_ChanSwitchAnn_t)); + tlv_chan_switch->header.len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_action_chan_switch_t) - + sizeof(MrvlIEtypesHeader_t) + + sizeof(IEEEtypes_ChanSwitchAnn_t)); csa_ie = (IEEEtypes_ChanSwitchAnn_t *) - tlv_chan_switch->ie_buf; + tlv_chan_switch->ie_buf; csa_ie->element_id = CHANNEL_SWITCH_ANN; csa_ie->len = sizeof(IEEEtypes_ChanSwitchAnn_t) - sizeof(IEEEtypes_Header_t); csa_ie->chan_switch_mode = bss->param.chanswitch.chan_switch_mode; - csa_ie->chan_switch_count = - bss->param.chanswitch.chan_switch_count; + csa_ie->chan_switch_count = 0; csa_ie->new_channel_num = bss->param.chanswitch.new_channel_num; cmd->size += sizeof(IEEEtypes_ChanSwitchAnn_t); @@ -2018,11 +1898,10 @@ misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; if ((misc->sub_command == MLAN_OID_MISC_GEN_IE) && (misc->param.gen_ie.type == MLAN_IE_TYPE_GEN_IE)) { - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof(MrvlIEtypesHeader_t) + - misc->param.gen_ie.len); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypesHeader_t) + + misc->param.gen_ie.len); ie_header->type = wlan_cpu_to_le16(TLV_TYPE_WAPI_IE); ie_header->len = wlan_cpu_to_le16(misc->param.gen_ie.len); @@ -2034,11 +1913,10 @@ } if ((misc->sub_command == MLAN_OID_MISC_CUSTOM_IE) && (misc->param.cust_ie.type == TLV_TYPE_MGMT_IE)) { - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof(MrvlIEtypesHeader_t) + - misc->param.cust_ie.len); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypesHeader_t) + + misc->param.cust_ie.len); ie_header->type = wlan_cpu_to_le16(TLV_TYPE_MGMT_IE); ie_header->len = wlan_cpu_to_le16(misc->param.cust_ie.len); @@ -2049,44 +1927,41 @@ /* conversion for index, mask, len */ if (req_len == sizeof(t_u16)) misc->param.cust_ie.ie_data_list[0] - .ie_index = - wlan_cpu_to_le16(misc->param. - cust_ie. - ie_data_list[0] - .ie_index); + .ie_index = wlan_cpu_to_le16( + misc->param.cust_ie + .ie_data_list[0] + .ie_index); while (req_len > sizeof(t_u16)) { cptr = (custom_ie - *)(((t_u8 *)&misc->param. - cust_ie.ie_data_list) + - travel_len); - travel_len += - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; - req_len -= - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; - cptr->ie_index = - wlan_cpu_to_le16(cptr-> - ie_index); + *)(((t_u8 *)&misc->param + .cust_ie + .ie_data_list) + + travel_len); + travel_len += cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; + req_len -= cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; + cptr->ie_index = wlan_cpu_to_le16( + cptr->ie_index); cptr->mgmt_subtype_mask = - wlan_cpu_to_le16(cptr-> - mgmt_subtype_mask); - cptr->ie_length = - wlan_cpu_to_le16(cptr-> - ie_length); + wlan_cpu_to_le16( + cptr->mgmt_subtype_mask); + cptr->ie_length = wlan_cpu_to_le16( + cptr->ie_length); } if (misc->param.cust_ie.len) - memcpy_ext(pmpriv->adapter, ie, - misc->param.cust_ie. - ie_data_list, - misc->param.cust_ie.len, - misc->param.cust_ie.len); + memcpy_ext( + pmpriv->adapter, ie, + misc->param.cust_ie.ie_data_list, + misc->param.cust_ie.len, + misc->param.cust_ie.len); } } if (misc->sub_command == MLAN_OID_MISC_WACP_MODE) { - tlv_wacp_mode = - (MrvlIEtypes_wacp_mode_t *) sys_config-> - tlv_buffer; + tlv_wacp_mode = (MrvlIEtypes_wacp_mode_t *) + sys_config->tlv_buffer; tlv_wacp_mode->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_WACP_MODE); tlv_wacp_mode->header.len = @@ -2095,11 +1970,9 @@ tlv_wacp_mode->wacp_mode = misc->param.wacp_mode; } - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SYS_CONFIG) - - 1 + S_DS_GEN + - sizeof - (MrvlIEtypes_wacp_mode_t)); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SYS_CONFIG) - 1 + S_DS_GEN + + sizeof(MrvlIEtypes_wacp_mode_t)); } } done: @@ -2116,9 +1989,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_cmd_ap_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_cmd_ap_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_SYS_CONFIG *sys_config = (HostCmd_DS_SYS_CONFIG *)&resp->params.sys_config; @@ -2211,12 +2084,11 @@ break; case TLV_TYPE_UAP_BEACON_PERIOD: tlv_beacon_period = (MrvlIEtypes_beacon_period_t *)tlv; - bss->param.bss_config.beacon_period = - wlan_le16_to_cpu(tlv_beacon_period-> - beacon_period); + bss->param.bss_config.beacon_period = wlan_le16_to_cpu( + tlv_beacon_period->beacon_period); pmpriv->uap_state_chan_cb.beacon_period = - wlan_le16_to_cpu(tlv_beacon_period-> - beacon_period); + wlan_le16_to_cpu( + tlv_beacon_period->beacon_period); break; case TLV_TYPE_UAP_DTIM_PERIOD: tlv_dtim_period = (MrvlIEtypes_dtim_period_t *)tlv; @@ -2277,27 +2149,25 @@ case TLV_TYPE_UAP_STA_AGEOUT_TIMER: tlv_sta_ageout = (MrvlIEtypes_sta_ageout_t *)tlv; bss->param.bss_config.sta_ageout_timer = - wlan_le32_to_cpu(tlv_sta_ageout-> - sta_ageout_timer); + wlan_le32_to_cpu( + tlv_sta_ageout->sta_ageout_timer); break; case TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER: tlv_ps_sta_ageout = (MrvlIEtypes_ps_sta_ageout_t *)tlv; bss->param.bss_config.ps_sta_ageout_timer = - wlan_le32_to_cpu(tlv_ps_sta_ageout-> - ps_sta_ageout_timer); + wlan_le32_to_cpu( + tlv_ps_sta_ageout->ps_sta_ageout_timer); break; case TLV_TYPE_UAP_RTS_THRESHOLD: tlv_rts_threshold = (MrvlIEtypes_rts_threshold_t *)tlv; - bss->param.bss_config.rts_threshold = - wlan_le16_to_cpu(tlv_rts_threshold-> - rts_threshold); + bss->param.bss_config.rts_threshold = wlan_le16_to_cpu( + tlv_rts_threshold->rts_threshold); break; case TLV_TYPE_UAP_FRAG_THRESHOLD: tlv_frag_threshold = (MrvlIEtypes_frag_threshold_t *)tlv; - bss->param.bss_config.frag_threshold = - wlan_le16_to_cpu(tlv_frag_threshold-> - frag_threshold); + bss->param.bss_config.frag_threshold = wlan_le16_to_cpu( + tlv_frag_threshold->frag_threshold); break; case TLV_TYPE_UAP_RETRY_LIMIT: tlv_retry_limit = (MrvlIEtypes_retry_limit_t *)tlv; @@ -2307,37 +2177,36 @@ case TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT: tlv_pairwise_timeout = (MrvlIEtypes_eapol_pwk_hsk_timeout_t *)tlv; - bss->param.bss_config.pairwise_update_timeout = - wlan_le32_to_cpu(tlv_pairwise_timeout-> - pairwise_update_timeout); + bss->param.bss_config + .pairwise_update_timeout = wlan_le32_to_cpu( + tlv_pairwise_timeout->pairwise_update_timeout); break; case TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES: tlv_pairwise_retries = (MrvlIEtypes_eapol_pwk_hsk_retries_t *)tlv; - bss->param.bss_config.pwk_retries = - wlan_le32_to_cpu(tlv_pairwise_retries-> - pwk_retries); + bss->param.bss_config.pwk_retries = wlan_le32_to_cpu( + tlv_pairwise_retries->pwk_retries); break; case TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT: tlv_groupwise_timeout = (MrvlIEtypes_eapol_gwk_hsk_timeout_t *)tlv; bss->param.bss_config.groupwise_update_timeout = - wlan_le32_to_cpu(tlv_groupwise_timeout-> - groupwise_update_timeout); + wlan_le32_to_cpu( + tlv_groupwise_timeout + ->groupwise_update_timeout); break; case TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES: tlv_groupwise_retries = (MrvlIEtypes_eapol_gwk_hsk_retries_t *)tlv; - bss->param.bss_config.gwk_retries = - wlan_le32_to_cpu(tlv_groupwise_retries-> - gwk_retries); + bss->param.bss_config.gwk_retries = wlan_le32_to_cpu( + tlv_groupwise_retries->gwk_retries); break; case TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK: tlv_mgmt_ie_passthru = (MrvlIEtypes_mgmt_ie_passthru_t *)tlv; bss->param.bss_config.mgmt_ie_passthru_mask = - wlan_le32_to_cpu(tlv_mgmt_ie_passthru-> - mgmt_ie_mask); + wlan_le32_to_cpu( + tlv_mgmt_ie_passthru->mgmt_ie_mask); break; case TLV_TYPE_2040_BSS_COEX_CONTROL: tlv_2040_coex_enable = @@ -2351,18 +2220,21 @@ MIN(MAX_MAC_FILTER_NUM, tlv_mac_filter->count); bss->param.bss_config.filter.filter_mode = tlv_mac_filter->filter_mode; - memcpy_ext(pmpriv->adapter, - (t_u8 *)bss->param.bss_config.filter. - mac_list, tlv_mac_filter->mac_address, - MLAN_MAC_ADDR_LENGTH * - bss->param.bss_config.filter.mac_count, - sizeof(bss->param.bss_config.filter. - mac_list)); + memcpy_ext( + pmpriv->adapter, + (t_u8 *)bss->param.bss_config.filter.mac_list, + tlv_mac_filter->mac_address, + MLAN_MAC_ADDR_LENGTH * + bss->param.bss_config.filter.mac_count, + sizeof(bss->param.bss_config.filter.mac_list)); break; case TLV_TYPE_UAP_CHAN_BAND_CONFIG: tlv_chan_band = (MrvlIEtypes_channel_band_t *)tlv; bss->param.bss_config.bandcfg = tlv_chan_band->bandcfg; bss->param.bss_config.channel = tlv_chan_band->channel; + pmpriv->uap_channel = tlv_chan_band->channel; + pmpriv->uap_bandwidth = + tlv_chan_band->bandcfg.chanWidth; pmpriv->uap_state_chan_cb.bandcfg = tlv_chan_band->bandcfg; pmpriv->uap_state_chan_cb.channel = @@ -2373,7 +2245,8 @@ bss->param.bss_config.num_of_chan = tlv_len / sizeof(ChanScanParamSet_t); pscan_chan = tlv_chan_list->chan_scan_param; - for (i = 0; i < bss->param.bss_config.num_of_chan; i++) { + for (i = 0; i < bss->param.bss_config.num_of_chan; + i++) { bss->param.bss_config.chan_list[i].chan_number = pscan_chan->chan_number; bss->param.bss_config.chan_list[i].bandcfg = @@ -2385,13 +2258,19 @@ tlv_auth_type = (MrvlIEtypes_auth_type_t *)tlv; bss->param.bss_config.auth_mode = tlv_auth_type->auth_type; + if (tlv_len == (sizeof(MrvlIEtypes_auth_type_t) - + sizeof(MrvlIEtypesHeader_t))) { + bss->param.bss_config.pwe_derivation = + tlv_auth_type->PWE_derivation; + bss->param.bss_config.transition_disable = + tlv_auth_type->transition_disable; + } break; case TLV_TYPE_UAP_ENCRYPT_PROTOCOL: tlv_encrypt_protocol = (MrvlIEtypes_encrypt_protocol_t *)tlv; - bss->param.bss_config.protocol = - wlan_le16_to_cpu(tlv_encrypt_protocol-> - protocol); + bss->param.bss_config.protocol = wlan_le16_to_cpu( + tlv_encrypt_protocol->protocol); break; case TLV_TYPE_UAP_AKMP: tlv_akmp = (MrvlIEtypes_akmp_t *)tlv; @@ -2399,25 +2278,30 @@ wlan_le16_to_cpu(tlv_akmp->key_mgmt); if (tlv_len > sizeof(t_u16)) bss->param.bss_config.key_mgmt_operation = - wlan_le16_to_cpu(tlv_akmp-> - key_mgmt_operation); + wlan_le16_to_cpu( + tlv_akmp->key_mgmt_operation); break; case TLV_TYPE_PWK_CIPHER: tlv_pwk_cipher = (MrvlIEtypes_pwk_cipher_t *)tlv; if (wlan_le16_to_cpu(tlv_pwk_cipher->protocol) & PROTOCOL_WPA) - bss->param.bss_config.wpa_cfg. - pairwise_cipher_wpa = + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa = tlv_pwk_cipher->pairwise_cipher; if (wlan_le16_to_cpu(tlv_pwk_cipher->protocol) & PROTOCOL_WPA2) - bss->param.bss_config.wpa_cfg. - pairwise_cipher_wpa2 = + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa2 = + tlv_pwk_cipher->pairwise_cipher; + if (wlan_le16_to_cpu(tlv_pwk_cipher->protocol) & + PROTOCOL_OWE) + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa2 = tlv_pwk_cipher->pairwise_cipher; if (wlan_le16_to_cpu(tlv_pwk_cipher->protocol) & PROTOCOL_WPA3_SAE) - bss->param.bss_config.wpa_cfg. - pairwise_cipher_wpa2 = + bss->param.bss_config.wpa_cfg + .pairwise_cipher_wpa2 = tlv_pwk_cipher->pairwise_cipher; break; case TLV_TYPE_GWK_CIPHER: @@ -2438,8 +2322,8 @@ bss->param.bss_config.wpa_cfg.passphrase, tlv_passphrase->passphrase, bss->param.bss_config.wpa_cfg.length, - sizeof(bss->param.bss_config.wpa_cfg. - passphrase)); + sizeof(bss->param.bss_config.wpa_cfg + .passphrase)); break; #ifdef WIFI_DIRECT_SUPPORT case TLV_TYPE_UAP_PSK: @@ -2485,7 +2369,7 @@ wlan_le16_to_cpu(tlv_bss_status->bss_status); pmpriv->uap_bss_started = (bss->param.bss_config.bss_status) ? MTRUE : - MFALSE; + MFALSE; break; case TLV_TYPE_HT_CAPABILITY: tlv_htcap = (MrvlIETypes_HTCap_t *)tlv; @@ -2493,11 +2377,11 @@ wlan_le16_to_cpu(tlv_htcap->ht_cap.ht_cap_info); bss->param.bss_config.ampdu_param = tlv_htcap->ht_cap.ampdu_param; - memcpy_ext(pmpriv->adapter, - bss->param.bss_config.supported_mcs_set, - tlv_htcap->ht_cap.supported_mcs_set, 16, - sizeof(bss->param.bss_config. - supported_mcs_set)); + memcpy_ext( + pmpriv->adapter, + bss->param.bss_config.supported_mcs_set, + tlv_htcap->ht_cap.supported_mcs_set, 16, + sizeof(bss->param.bss_config.supported_mcs_set)); bss->param.bss_config.ht_ext_cap = wlan_le16_to_cpu(tlv_htcap->ht_cap.ht_ext_cap); bss->param.bss_config.tx_bf_cap = @@ -2511,29 +2395,29 @@ for (ac = 0; ac < 4; ac++) { bss->param.bss_config.wmm_para.ac_params[ac] .aci_aifsn.aifsn = - tlv_wmm_parameter->wmm_para. - ac_params[ac] - .aci_aifsn.aifsn; + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .aci_aifsn.aifsn; bss->param.bss_config.wmm_para.ac_params[ac] .aci_aifsn.aci = - tlv_wmm_parameter->wmm_para. - ac_params[ac] - .aci_aifsn.aci; + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .aci_aifsn.aci; bss->param.bss_config.wmm_para.ac_params[ac] .ecw.ecw_max = - tlv_wmm_parameter->wmm_para. - ac_params[ac] - .ecw.ecw_max; + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .ecw.ecw_max; bss->param.bss_config.wmm_para.ac_params[ac] .ecw.ecw_min = - tlv_wmm_parameter->wmm_para. - ac_params[ac] - .ecw.ecw_min; + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .ecw.ecw_min; bss->param.bss_config.wmm_para.ac_params[ac] - .tx_op_limit = - wlan_le16_to_cpu(tlv_wmm_parameter-> - wmm_para.ac_params[ac] - .tx_op_limit); + .tx_op_limit = wlan_le16_to_cpu( + tlv_wmm_parameter->wmm_para + .ac_params[ac] + .tx_op_limit); } break; } @@ -2561,9 +2445,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_sys_reset(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_sys_reset(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { ENTER(); @@ -2591,9 +2475,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_sys_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_sys_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { int resp_len = 0, travel_len = 0; t_u32 i = 0; @@ -2620,6 +2504,8 @@ MrvlIEtypes_uap_max_sta_cnt_t *tlv_uap_max_sta = MNULL; ENTER(); + sys_config->action = wlan_le16_to_cpu(sys_config->action); + if (pioctl_buf) { if (pioctl_buf->req_id == MLAN_IOCTL_BSS) { bss = (mlan_ds_bss *)pioctl_buf->pbuf; @@ -2635,163 +2521,194 @@ } else if (bss->sub_command == MLAN_OID_UAP_CFG_WMM_PARAM) { if (TLV_TYPE_AP_WMM_PARAM == - wlan_le16_to_cpu(tlv_wmm_parameter->header. - type)) { - if (wlan_le16_to_cpu - (tlv_wmm_parameter->header.len) < + wlan_le16_to_cpu( + tlv_wmm_parameter->header.type)) { + if (wlan_le16_to_cpu( + tlv_wmm_parameter->header + .len) < sizeof(bss->param.ap_wmm_para)) { PRINTM(MCMND, "FW don't support AP WMM PARAM\n"); } else { - bss->param.ap_wmm_para. - reserved = + bss->param.ap_wmm_para.reserved = MLAN_STATUS_COMPLETE; for (ac = 0; ac < 4; ac++) { - bss->param.ap_wmm_para. - ac_params[ac] - .aci_aifsn. - aifsn = - tlv_wmm_parameter-> - wmm_para. - ac_params[ac] - .aci_aifsn. - aifsn; - bss->param.ap_wmm_para. - ac_params[ac] + bss->param.ap_wmm_para + .ac_params[ac] + .aci_aifsn + .aifsn = + tlv_wmm_parameter + ->wmm_para + .ac_params + [ac] + .aci_aifsn + .aifsn; + bss->param.ap_wmm_para + .ac_params[ac] .aci_aifsn.aci = - tlv_wmm_parameter-> - wmm_para. - ac_params[ac] - .aci_aifsn.aci; - bss->param.ap_wmm_para. - ac_params[ac] + tlv_wmm_parameter + ->wmm_para + .ac_params + [ac] + .aci_aifsn + .aci; + bss->param.ap_wmm_para + .ac_params[ac] .ecw.ecw_max = - tlv_wmm_parameter-> - wmm_para. - ac_params[ac] - .ecw.ecw_max; - bss->param.ap_wmm_para. - ac_params[ac] + tlv_wmm_parameter + ->wmm_para + .ac_params + [ac] + .ecw + .ecw_max; + bss->param.ap_wmm_para + .ac_params[ac] .ecw.ecw_min = - tlv_wmm_parameter-> - wmm_para. - ac_params[ac] - .ecw.ecw_min; - bss->param.ap_wmm_para. - ac_params[ac] - .tx_op_limit = - wlan_le16_to_cpu - (tlv_wmm_parameter-> - wmm_para. - ac_params[ac] - .tx_op_limit); + tlv_wmm_parameter + ->wmm_para + .ac_params + [ac] + .ecw + .ecw_min; + bss->param.ap_wmm_para + .ac_params[ac] + .tx_op_limit = wlan_le16_to_cpu( + tlv_wmm_parameter + ->wmm_para + .ac_params + [ac] + .tx_op_limit); PRINTM(MCMND, "ac=%d, aifsn=%d, aci=%d, ecw_max=%d, ecw_min=%d, tx_op=%d\n", ac, - bss->param. - ap_wmm_para. - ac_params[ac] - .aci_aifsn.aifsn, - bss->param. - ap_wmm_para. - ac_params[ac] - .aci_aifsn.aci, - bss->param. - ap_wmm_para. - ac_params[ac] - .ecw.ecw_max, - bss->param. - ap_wmm_para. - ac_params[ac] - .ecw.ecw_min, - bss->param. - ap_wmm_para. - ac_params[ac] - .tx_op_limit); + bss->param + .ap_wmm_para + .ac_params + [ac] + .aci_aifsn + .aifsn, + bss->param + .ap_wmm_para + .ac_params + [ac] + .aci_aifsn + .aci, + bss->param + .ap_wmm_para + .ac_params + [ac] + .ecw + .ecw_max, + bss->param + .ap_wmm_para + .ac_params + [ac] + .ecw + .ecw_min, + bss->param + .ap_wmm_para + .ac_params + [ac] + .tx_op_limit); } } } } else if (bss->sub_command == MLAN_OID_UAP_SCAN_CHANNELS) { if (TLV_TYPE_CHANLIST == - wlan_le16_to_cpu(tlv_chan_list->header. - type)) { + wlan_le16_to_cpu( + tlv_chan_list->header.type)) { pscan_chan = tlv_chan_list->chan_scan_param; - bss->param.ap_scan_channels. - num_of_chan = 0; + bss->param.ap_scan_channels.num_of_chan = + 0; for (i = 0; i < - (int) - wlan_le16_to_cpu(tlv_chan_list-> - header.len) / - sizeof(ChanScanParamSet_t); i++) { - if (bss->param.ap_scan_channels. - remove_nop_channel && - wlan_11h_is_channel_under_nop - (pmpriv->adapter, - pscan_chan->chan_number)) { - bss->param. - ap_scan_channels. - num_remvoed_channel++; + (int)wlan_le16_to_cpu( + tlv_chan_list->header.len) / + sizeof(ChanScanParamSet_t); + i++) { + if (bss->param.ap_scan_channels + .remove_nop_channel && + wlan_11h_is_channel_under_nop( + pmpriv->adapter, + pscan_chan + ->chan_number)) { + bss->param + .ap_scan_channels + .num_remvoed_channel++; PRINTM(MCMND, "Remove nop channel=%d\n", - pscan_chan-> - chan_number); + pscan_chan + ->chan_number); pscan_chan++; continue; } - bss->param.ap_scan_channels. - chan_list[bss->param. - ap_scan_channels. - num_of_chan] + bss->param.ap_scan_channels + .chan_list + [bss->param + .ap_scan_channels + .num_of_chan] .chan_number = pscan_chan->chan_number; - bss->param.ap_scan_channels. - chan_list[bss->param. - ap_scan_channels. - num_of_chan] + bss->param.ap_scan_channels + .chan_list + [bss->param + .ap_scan_channels + .num_of_chan] .bandcfg = pscan_chan->bandcfg; - bss->param.ap_scan_channels. - num_of_chan++; + bss->param.ap_scan_channels + .num_of_chan++; pscan_chan++; } PRINTM(MCMND, "AP scan channel list=%d\n", - bss->param.ap_scan_channels. - num_of_chan); + bss->param.ap_scan_channels + .num_of_chan); } } else if (bss->sub_command == MLAN_OID_UAP_CHANNEL) { if (TLV_TYPE_UAP_CHAN_BAND_CONFIG == - wlan_le16_to_cpu(chan_band_tlv->header. - type)) { + wlan_le16_to_cpu( + chan_band_tlv->header.type)) { bss->param.ap_channel.bandcfg = chan_band_tlv->bandcfg; bss->param.ap_channel.channel = chan_band_tlv->channel; + bss->param.ap_channel.center_chan = 0; bss->param.ap_channel.is_11n_enabled = pmpriv->is_11n_enabled; + pmpriv->uap_channel = + chan_band_tlv->channel; + pmpriv->uap_bandwidth = + chan_band_tlv->bandcfg.chanWidth; + pmpriv->uap_state_chan_cb.bandcfg = + chan_band_tlv->bandcfg; + pmpriv->uap_state_chan_cb.channel = + chan_band_tlv->channel; bss->param.ap_channel.is_dfs_chan = - wlan_11h_radar_detect_required - (pmpriv, - bss->param.ap_channel.channel); + wlan_11h_radar_detect_required( + pmpriv, + bss->param.ap_channel + .channel); if (chan_band_tlv->bandcfg.chanWidth == CHAN_BW_80MHZ) - bss->param.ap_channel. - center_chan = - wlan_get_center_freq_idx - (pmpriv, BAND_AAC, - chan_band_tlv->channel, - CHANNEL_BW_80MHZ); + bss->param.ap_channel + .center_chan = + wlan_get_center_freq_idx( + pmpriv, + BAND_AAC, + chan_band_tlv + ->channel, + CHANNEL_BW_80MHZ); PRINTM(MCMND, "AP channel, band=0x%x, channel=%d, is_11n_enabled=%d center_chan=%d\n", bss->param.ap_channel.bandcfg, bss->param.ap_channel.channel, - bss->param.ap_channel. - is_11n_enabled, - bss->param.ap_channel. - center_chan); + bss->param.ap_channel + .is_11n_enabled, + bss->param.ap_channel + .center_chan); } } else if ((bss->sub_command == MLAN_OID_UAP_BSS_CONFIG) && @@ -2803,7 +2720,7 @@ if (pioctl_buf->req_id == MLAN_IOCTL_MISC_CFG) { misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; cust_ie = (mlan_ds_misc_custom_ie *) - sys_config->tlv_buffer; + sys_config->tlv_buffer; if ((pioctl_buf->action == MLAN_ACT_GET || pioctl_buf->action == MLAN_ACT_SET) && (misc->sub_command == MLAN_OID_MISC_CUSTOM_IE)) { @@ -2814,95 +2731,94 @@ /* conversion for index, mask, len */ if (resp_len == sizeof(t_u16)) cust_ie->ie_data_list[0].ie_index = - wlan_cpu_to_le16(cust_ie-> - ie_data_list[0] - .ie_index); + wlan_cpu_to_le16( + cust_ie->ie_data_list[0] + .ie_index); while (resp_len > (int)sizeof(t_u16)) { cptr = (custom_ie - *)(((t_u8 *)cust_ie-> - ie_data_list) + travel_len); - cptr->ie_index = - wlan_le16_to_cpu(cptr-> - ie_index); + *)(((t_u8 *)cust_ie + ->ie_data_list) + + travel_len); + cptr->ie_index = wlan_le16_to_cpu( + cptr->ie_index); cptr->mgmt_subtype_mask = - wlan_le16_to_cpu(cptr-> - mgmt_subtype_mask); - cptr->ie_length = - wlan_le16_to_cpu(cptr-> - ie_length); - travel_len += - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; - resp_len -= - cptr->ie_length + - sizeof(custom_ie) - MAX_IE_SIZE; + wlan_le16_to_cpu( + cptr->mgmt_subtype_mask); + cptr->ie_length = wlan_le16_to_cpu( + cptr->ie_length); + travel_len += cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; + resp_len -= cptr->ie_length + + sizeof(custom_ie) - + MAX_IE_SIZE; } memcpy_ext(pmpriv->adapter, &misc->param.cust_ie, cust_ie, cust_ie->len + - sizeof(MrvlIEtypesHeader_t), + sizeof(MrvlIEtypesHeader_t), sizeof(mlan_ds_misc_custom_ie) - - sizeof(tlvbuf_max_mgmt_ie)); + sizeof(tlvbuf_max_mgmt_ie)); max_mgmt_ie = (tlvbuf_max_mgmt_ie - *)(sys_config->tlv_buffer + - cust_ie->len + - sizeof(MrvlIEtypesHeader_t)); + *)(sys_config->tlv_buffer + + cust_ie->len + + sizeof(MrvlIEtypesHeader_t)); if (max_mgmt_ie) { - max_mgmt_ie->type = - wlan_le16_to_cpu(max_mgmt_ie-> - type); + max_mgmt_ie->type = wlan_le16_to_cpu( + max_mgmt_ie->type); if (max_mgmt_ie->type == TLV_TYPE_MAX_MGMT_IE) { max_mgmt_ie->len = - wlan_le16_to_cpu - (max_mgmt_ie->len); + wlan_le16_to_cpu( + max_mgmt_ie + ->len); max_mgmt_ie->count = - wlan_le16_to_cpu - (max_mgmt_ie->count); + wlan_le16_to_cpu( + max_mgmt_ie + ->count); for (i = 0; i < max_mgmt_ie->count; i++) { max_mgmt_ie->info[i] - .buf_size = - wlan_le16_to_cpu - (max_mgmt_ie-> - info[i] - .buf_size); + .buf_size = wlan_le16_to_cpu( + max_mgmt_ie + ->info[i] + .buf_size); max_mgmt_ie->info[i] - .buf_count = - wlan_le16_to_cpu - (max_mgmt_ie-> - info[i] - .buf_count); + .buf_count = wlan_le16_to_cpu( + max_mgmt_ie + ->info[i] + .buf_count); } /* Append max_mgmt_ie TLV after * custom_ie */ - memcpy_ext(pmpriv->adapter, - (t_u8 *)&misc->param. - cust_ie + - (cust_ie->len + - sizeof - (MrvlIEtypesHeader_t)), - max_mgmt_ie, - max_mgmt_ie->len + - sizeof - (MrvlIEtypesHeader_t), - sizeof - (tlvbuf_max_mgmt_ie)); + memcpy_ext( + pmpriv->adapter, + (t_u8 *)&misc->param + .cust_ie + + (cust_ie->len + + sizeof(MrvlIEtypesHeader_t)), + max_mgmt_ie, + max_mgmt_ie->len + + sizeof(MrvlIEtypesHeader_t), + sizeof(tlvbuf_max_mgmt_ie)); } } } } - } else { /* no ioctl: driver generated get/set */ + } else { /* no ioctl: driver generated get/set */ switch (wlan_le16_to_cpu(tlv->header.type)) { case TLV_TYPE_UAP_MAC_ADDRESS: - memcpy_ext(pmpriv->adapter, pmpriv->curr_addr, tlv->mac, - MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + if (sys_config->action == HostCmd_ACT_GEN_SET) { + memcpy_ext(pmpriv->adapter, pmpriv->curr_addr, + tlv->mac, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + } break; case TLV_TYPE_UAP_MAX_STA_CNT_PER_CHIP: - tlv_uap_max_sta = (MrvlIEtypes_uap_max_sta_cnt_t *) tlv; + tlv_uap_max_sta = (MrvlIEtypes_uap_max_sta_cnt_t *)tlv; pmpriv->adapter->max_sta_conn = wlan_le16_to_cpu(tlv_uap_max_sta->uap_max_sta); PRINTM(MCMND, "Uap max_sta per chip=%d\n", @@ -2914,8 +2830,8 @@ pmpriv->uap_state_chan_cb.channel = tlv_cb->channel; /* call callback waiting for channel info */ if (pmpriv->uap_state_chan_cb.get_chan_callback) - pmpriv->uap_state_chan_cb. - get_chan_callback(pmpriv); + pmpriv->uap_state_chan_cb.get_chan_callback( + pmpriv); break; case TLV_TYPE_UAP_BEACON_PERIOD: tlv_bcnpd = (MrvlIEtypes_beacon_period_t *)tlv; @@ -2924,16 +2840,16 @@ /* copy dtim_period as well if it follows */ tlv_dtimpd = (MrvlIEtypes_dtim_period_t - *)(((t_u8 *)tlv) + - sizeof(MrvlIEtypes_beacon_period_t)); + *)(((t_u8 *)tlv) + + sizeof(MrvlIEtypes_beacon_period_t)); if (TLV_TYPE_UAP_DTIM_PERIOD == wlan_le16_to_cpu(tlv_dtimpd->header.type)) pmpriv->uap_state_chan_cb.dtim_period = tlv_dtimpd->dtim_period; /* call callback waiting for beacon/dtim info */ if (pmpriv->uap_state_chan_cb.get_chan_callback) - pmpriv->uap_state_chan_cb. - get_chan_callback(pmpriv); + pmpriv->uap_state_chan_cb.get_chan_callback( + pmpriv); break; case TLV_TYPE_MGMT_IE: if ((pmpriv->adapter->state_rdh.stage == @@ -2941,9 +2857,8 @@ (pmpriv->adapter->state_rdh.stage == RDH_REM_CUSTOM_IE)) { if (!pmpriv->adapter->ecsa_enable) - wlan_11h_radar_detected_callback((t_void - *) - pmpriv); + wlan_11h_radar_detected_callback( + (t_void *)pmpriv); } break; } @@ -2963,11 +2878,11 @@ * @param pdata_buf A pointer to information buffer * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_cmd_snmp_mib(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u32 cmd_oid, - pmlan_ioctl_req pioctl_buf, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_snmp_mib(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u32 cmd_oid, + pmlan_ioctl_req pioctl_buf, + t_void *pdata_buf) { HostCmd_DS_802_11_SNMP_MIB *psnmp_mib = &cmd->params.smib; HostCmd_DS_UAP_802_11_SNMP_MIB *puap_snmp_mib = &cmd->params.uap_smib; @@ -3007,15 +2922,13 @@ if (cmd_oid == StopDeauth_i) { psnmp_mib->oid = wlan_cpu_to_le16((t_u16)StopDeauth_i); psnmp_mib->buf_size = wlan_cpu_to_le16(sizeof(t_u8)); - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_802_11_SNMP_MIB) + - S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_802_11_SNMP_MIB) + S_DS_GEN); } else { - cmd->size = wlan_cpu_to_le16(sizeof(t_u16) + S_DS_GEN + - sizeof(snmp_oids) * - sizeof - (MrvlIEtypes_snmp_oid_t)); + cmd->size = wlan_cpu_to_le16( + sizeof(t_u16) + S_DS_GEN + + sizeof(snmp_oids) * + sizeof(MrvlIEtypes_snmp_oid_t)); psnmp_oid = (t_u8 *)&puap_snmp_mib->snmp_data; for (i = 0; i < sizeof(snmp_oids); i++) { /* SNMP OID header type */ @@ -3028,7 +2941,7 @@ psnmp_oid += sizeof(t_u16) + sizeof(t_u32); } } - } else { /* cmd_action == ACT_SET */ + } else { /* cmd_action == ACT_SET */ cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB); cmd->size = sizeof(HostCmd_DS_802_11_SNMP_MIB) - 1 + S_DS_GEN; psnmp_mib->query_type = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); @@ -3055,6 +2968,16 @@ psnmp_mib->value[0] = *((t_u8 *)pdata_buf); cmd->size += sizeof(t_u8); break; + case Dot11H_fakeRadar: + psnmp_mib->oid = wlan_cpu_to_le16((t_u16)cmd_oid); + psnmp_mib->buf_size = 0; + break; + case ChanTrackParam_i: + psnmp_mib->oid = wlan_cpu_to_le16((t_u16)cmd_oid); + psnmp_mib->buf_size = wlan_cpu_to_le16(sizeof(t_u8)); + psnmp_mib->value[0] = *((t_u8 *)pdata_buf); + cmd->size += sizeof(t_u8); + break; default: PRINTM(MERROR, "Unsupported OID.\n"); ret = MLAN_STATUS_FAILURE; @@ -3075,8 +2998,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_802_11_get_log(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd) +static mlan_status wlan_uap_cmd_802_11_get_log(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd) { ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_GET_LOG); @@ -3094,8 +3017,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_bss_start(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd) +static mlan_status wlan_uap_cmd_bss_start(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd) { MrvlIEtypes_HostMlme_t *tlv; @@ -3103,7 +3026,7 @@ cmd->command = wlan_cpu_to_le16(HOST_CMD_APCMD_BSS_START); cmd->size = S_DS_GEN; if (pmpriv->uap_host_based & UAP_FLAG_HOST_MLME) { - tlv = (MrvlIEtypes_HostMlme_t *) ((t_u8 *)cmd + cmd->size); + tlv = (MrvlIEtypes_HostMlme_t *)((t_u8 *)cmd + cmd->size); tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_HOST_MLME); tlv->header.len = wlan_cpu_to_le16(sizeof(tlv->host_mlme)); tlv->host_mlme = MTRUE; @@ -3123,9 +3046,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_snmp_mib(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_snmp_mib(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { pmlan_adapter pmadapter = pmpriv->adapter; HostCmd_DS_802_11_SNMP_MIB *psnmp_mib = @@ -3241,7 +3164,7 @@ tlv_buf_left -= sizeof(MrvlIEtypes_snmp_oid_t); psnmp_oid += sizeof(t_u32); } - } else { /* ACT_SET */ + } else { /* ACT_SET */ switch (wlan_le16_to_cpu(psnmp_mib->oid)) { case Dot11D_i: data = wlan_le16_to_cpu(*((t_u16 *)(psnmp_mib->value))); @@ -3253,6 +3176,7 @@ break; case Dot11H_i: data = wlan_le16_to_cpu(*((t_u16 *)(psnmp_mib->value))); + PRINTM(MCMND, "wlan: uap Dot11H_i=%d\n", data); /* Set 11h state to priv */ pmpriv->intf_state_11h.is_11h_active = (data & ENABLE_11H_MASK); @@ -3278,9 +3202,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_get_log(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_get_log(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_802_11_GET_LOG *pget_log = (HostCmd_DS_802_11_GET_LOG *)&resp->params.get_log; @@ -3367,7 +3291,7 @@ wlan_le32_to_cpu(pget_log->gdma_abort_cnt); pget_info->param.stats.g_reset_rx_mac_cnt = wlan_le32_to_cpu(pget_log->g_reset_rx_mac_cnt); - //Ownership error counters + // Ownership error counters pget_info->param.stats.dwCtlErrCnt = wlan_le32_to_cpu(pget_log->dwCtlErrCnt); pget_info->param.stats.dwBcnErrCnt = @@ -3390,49 +3314,44 @@ wlan_le32_to_cpu(pget_log->tx_frag_cnt); for (i = 0; i < 8; i++) { pget_info->param.stats.qos_tx_frag_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_tx_frag_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_tx_frag_cnt[i]); pget_info->param.stats.qos_failed_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_failed_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_failed_cnt[i]); pget_info->param.stats.qos_retry_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_retry_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_retry_cnt[i]); pget_info->param.stats.qos_multi_retry_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_multi_retry_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_multi_retry_cnt[i]); pget_info->param.stats.qos_frm_dup_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_frm_dup_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_frm_dup_cnt[i]); pget_info->param.stats.qos_rts_suc_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rts_suc_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_rts_suc_cnt[i]); pget_info->param.stats.qos_rts_failure_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rts_failure_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_rts_failure_cnt[i]); pget_info->param.stats.qos_ack_failure_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_ack_failure_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_ack_failure_cnt[i]); pget_info->param.stats.qos_rx_frag_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_rx_frag_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_rx_frag_cnt[i]); pget_info->param.stats.qos_tx_frm_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_tx_frm_cnt[i]); - pget_info->param.stats. - qos_discarded_frm_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_discarded_frm_cnt - [i]); + wlan_le32_to_cpu( + pget_log->qos_tx_frm_cnt[i]); + pget_info->param.stats.qos_discarded_frm_cnt + [i] = wlan_le32_to_cpu( + pget_log->qos_discarded_frm_cnt[i]); pget_info->param.stats.qos_mpdus_rx_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_mpdus_rx_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_mpdus_rx_cnt[i]); pget_info->param.stats.qos_retries_rx_cnt[i] = - wlan_le32_to_cpu(pget_log-> - qos_retries_rx_cnt[i]); + wlan_le32_to_cpu( + pget_log->qos_retries_rx_cnt[i]); } pget_info->param.stats.mgmt_ccmp_replays = wlan_le32_to_cpu(pget_log->mgmt_ccmp_replays); @@ -3443,38 +3362,38 @@ pget_info->param.stats.retry_amsdu_cnt = wlan_le32_to_cpu(pget_log->retry_amsdu_cnt); pget_info->param.stats.multi_retry_amsdu_cnt = - wlan_le32_to_cpu(pget_log-> - multi_retry_amsdu_cnt); + wlan_le32_to_cpu( + pget_log->multi_retry_amsdu_cnt); pget_info->param.stats.tx_octets_in_amsdu_cnt = - wlan_le64_to_cpu(pget_log-> - tx_octets_in_amsdu_cnt); + wlan_le64_to_cpu( + pget_log->tx_octets_in_amsdu_cnt); pget_info->param.stats.amsdu_ack_failure_cnt = - wlan_le32_to_cpu(pget_log-> - amsdu_ack_failure_cnt); + wlan_le32_to_cpu( + pget_log->amsdu_ack_failure_cnt); pget_info->param.stats.rx_amsdu_cnt = wlan_le32_to_cpu(pget_log->rx_amsdu_cnt); pget_info->param.stats.rx_octets_in_amsdu_cnt = - wlan_le64_to_cpu(pget_log-> - rx_octets_in_amsdu_cnt); + wlan_le64_to_cpu( + pget_log->rx_octets_in_amsdu_cnt); pget_info->param.stats.tx_ampdu_cnt = wlan_le32_to_cpu(pget_log->tx_ampdu_cnt); pget_info->param.stats.tx_mpdus_in_ampdu_cnt = - wlan_le32_to_cpu(pget_log-> - tx_mpdus_in_ampdu_cnt); + wlan_le32_to_cpu( + pget_log->tx_mpdus_in_ampdu_cnt); pget_info->param.stats.tx_octets_in_ampdu_cnt = - wlan_le64_to_cpu(pget_log-> - tx_octets_in_ampdu_cnt); + wlan_le64_to_cpu( + pget_log->tx_octets_in_ampdu_cnt); pget_info->param.stats.ampdu_rx_cnt = wlan_le32_to_cpu(pget_log->ampdu_rx_cnt); pget_info->param.stats.mpdu_in_rx_ampdu_cnt = - wlan_le32_to_cpu(pget_log-> - mpdu_in_rx_ampdu_cnt); + wlan_le32_to_cpu( + pget_log->mpdu_in_rx_ampdu_cnt); pget_info->param.stats.rx_octets_in_ampdu_cnt = - wlan_le64_to_cpu(pget_log-> - rx_octets_in_ampdu_cnt); + wlan_le64_to_cpu( + pget_log->rx_octets_in_ampdu_cnt); pget_info->param.stats.ampdu_delimiter_crc_error_cnt = - wlan_le32_to_cpu(pget_log-> - ampdu_delimiter_crc_error_cnt); + wlan_le32_to_cpu( + pget_log->ampdu_delimiter_crc_error_cnt); /* Indicate ioctl complete */ pioctl_buf->data_read_written = @@ -3496,9 +3415,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_sta_deauth(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_sta_deauth(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_DS_STA_DEAUTH *pcmd_sta_deauth = (HostCmd_DS_STA_DEAUTH *)&cmd->params.sta_deauth; @@ -3522,9 +3441,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_report_mic(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_report_mic(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { HostCmd_DS_REPORT_MIC *pcmd_report_mic = (HostCmd_DS_REPORT_MIC *)&cmd->params.report_mic; @@ -3548,10 +3467,10 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_key_material(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 cmd_oid, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_key_material(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 cmd_oid, + t_void *pdata_buf) { HostCmd_DS_802_11_KEY_MATERIAL *pkey_material = &cmd->params.key_material; @@ -3582,17 +3501,15 @@ wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN); pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_MCAST_KEY | - KEY_INFO_UCAST_KEY); + pkey_material->key_param_set.key_info = wlan_cpu_to_le16( + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.mac_addr, pkey->mac_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(pkey_material->action)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(pkey_material->action)); PRINTM(MCMND, "Remove Key\n"); goto done; } @@ -3604,9 +3521,8 @@ memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.mac_addr, pkey->mac_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); if (pkey->key_len <= MAX_WEP_KEY_SIZE) { - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(wep_param_t)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(wep_param_t)); pkey_material->key_param_set.key_type = KEY_TYPE_ID_WEP; pkey_material->key_param_set.key_info |= KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY; @@ -3665,14 +3581,12 @@ } pkey_material->key_param_set.key_info = wlan_cpu_to_le16(pkey_material->key_param_set.key_info); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(wapi_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(wapi_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(wapi_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set WAPI Key\n"); goto done; } @@ -3683,23 +3597,22 @@ !(pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) - memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params.aes. - pn, pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); + memcpy_ext( + pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); pkey_material->key_param_set.key_type = KEY_TYPE_ID_AES; pkey_material->key_param_set.key_params.aes.key_len = wlan_cpu_to_le16(pkey->key_len); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.aes.key, pkey->key_material, pkey->key_len, WPA_AES_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(aes_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(aes_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(aes_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(aes_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set AES Key\n"); goto done; } @@ -3708,9 +3621,9 @@ if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params. - cmac_aes.ipn, pkey->pn, SEQ_MAX_SIZE, - IGTK_PN_SIZE); + pkey_material->key_param_set.key_params + .cmac_aes.ipn, + pkey->pn, SEQ_MAX_SIZE, IGTK_PN_SIZE); pkey_material->key_param_set.key_info &= ~(wlan_cpu_to_le16(KEY_INFO_MCAST_KEY)); pkey_material->key_param_set.key_info |= @@ -3726,14 +3639,12 @@ memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.cmac_aes.key, pkey->key_material, pkey->key_len, CMAC_AES_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(cmac_aes_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(cmac_aes_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(cmac_aes_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param) + + sizeof(pkey_material->action)); if (pkey->key_flags & KEY_FLAG_GMAC_128) PRINTM(MCMND, "Set AES 128 GMAC Key\n"); else @@ -3745,9 +3656,9 @@ if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params. - cmac_aes.ipn, pkey->pn, SEQ_MAX_SIZE, - IGTK_PN_SIZE); + pkey_material->key_param_set.key_params + .cmac_aes.ipn, + pkey->pn, SEQ_MAX_SIZE, IGTK_PN_SIZE); pkey_material->key_param_set.key_info &= ~(wlan_cpu_to_le16(KEY_INFO_MCAST_KEY)); pkey_material->key_param_set.key_info |= @@ -3760,37 +3671,34 @@ pkey_material->key_param_set.key_params.cmac_aes.key, pkey->key_material, pkey->key_len, WPA_IGTK_256_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(gmac_aes_256_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(gmac_aes_256_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(gmac_aes_256_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(gmac_aes_256_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set AES 256 GMAC Key\n"); goto done; } if (pkey->key_len == WPA_TKIP_KEY_LEN) { if (pkey->key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) - memcpy_ext(pmpriv->adapter, - pkey_material->key_param_set.key_params.tkip. - pn, pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); + memcpy_ext( + pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.pn, + pkey->pn, SEQ_MAX_SIZE, WPA_PN_SIZE); pkey_material->key_param_set.key_type = KEY_TYPE_ID_TKIP; pkey_material->key_param_set.key_params.tkip.key_len = wlan_cpu_to_le16(pkey->key_len); memcpy_ext(pmpriv->adapter, pkey_material->key_param_set.key_params.tkip.key, pkey->key_material, pkey->key_len, WPA_TKIP_KEY_LEN); - pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + - sizeof(tkip_param)); - cmd->size = - wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + - S_DS_GEN + KEY_PARAMS_FIXED_LEN + - sizeof(tkip_param) + - sizeof(pkey_material->action)); + pkey_material->key_param_set.length = wlan_cpu_to_le16( + KEY_PARAMS_FIXED_LEN + sizeof(tkip_param)); + cmd->size = wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param) + + sizeof(pkey_material->action)); PRINTM(MCMND, "Set TKIP Key\n"); } done: @@ -3807,9 +3715,9 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_sta_list(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_sta_list(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_STA_LIST *sta_list = (HostCmd_DS_STA_LIST *)&resp->params.sta_list; @@ -3831,9 +3739,10 @@ info->param.sta_list.sta_count = MIN(info->param.sta_list.sta_count, MAX_NUM_CLIENTS); ie_buf = (t_u8 *)&info->param.sta_list.info[0]; - ie_buf += sizeof(sta_info_data) * - info->param.sta_list.sta_count; - pioctl_buf->data_read_written = sizeof(mlan_ds_sta_list) - + ie_buf += + sizeof(sta_info_data) * info->param.sta_list.sta_count; + pioctl_buf->data_read_written = + sizeof(mlan_ds_sta_list) - sizeof(sta_info_data) * MAX_NUM_CLIENTS; for (i = 0; i < info->param.sta_list.sta_count; i++) { tlv_len = wlan_le16_to_cpu(tlv->header.len); @@ -3845,9 +3754,7 @@ tlv_len + sizeof(MrvlIEtypesHeader_t) - sizeof(MrvlIEtypes_sta_info_t); if (info->param.sta_list.info[i].ie_len) { - memcpy_ext(pmpriv->adapter, - ie_buf, - tlv->ie_buf, + memcpy_ext(pmpriv->adapter, ie_buf, tlv->ie_buf, info->param.sta_list.info[i].ie_len, info->param.sta_list.info[i].ie_len); ie_buf += info->param.sta_list.info[i].ie_len; @@ -3860,18 +3767,18 @@ if (sta_ptr) { info->param.sta_list.info[i].bandmode = sta_ptr->bandmode; - memcpy_ext(pmpriv->adapter, - &(info->param.sta_list.info[i]. - stats), &(sta_ptr->stats), - sizeof(sta_stats), - sizeof(sta_stats)); + memcpy_ext( + pmpriv->adapter, + &(info->param.sta_list.info[i].stats), + &(sta_ptr->stats), sizeof(sta_stats), + sizeof(sta_stats)); } else info->param.sta_list.info[i].bandmode = 0xFF; pioctl_buf->data_read_written += sizeof(sta_info_data) + info->param.sta_list.info[i].ie_len; buf += sizeof(MrvlIEtypes_sta_info_t) + - info->param.sta_list.info[i].ie_len; + info->param.sta_list.info[i].ie_len; tlv = (MrvlIEtypes_sta_info_t *)buf; } PRINTM(MCMND, "Total sta_list size=%d\n", @@ -3893,8 +3800,7 @@ * * @return N/A */ -static void -wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) +static void wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) { t_u16 tlv_type, tlv_len; int tlv_buf_left = pevent->data_len - BSS_START_EVENT_FIX_SIZE; @@ -3902,12 +3808,12 @@ (MrvlIEtypesHeader_t *)(pevent->pbuf + pevent->data_offset + BSS_START_EVENT_FIX_SIZE); - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; IEEEtypes_WmmParameter_t wmm_param_ie; MrvlIEtypes_channel_band_t *pchan_info; t_u8 event_buf[100]; mlan_event *event = (mlan_event *)event_buf; - chan_band_info *pchan_band_info = (chan_band_info *) event->event_buf; + chan_band_info *pchan_band_info = (chan_band_info *)event->event_buf; MrvlIEtypes_He_cap_t *pext_tlv = MNULL; ENTER(); @@ -3916,6 +3822,7 @@ priv->is_11n_enabled = MFALSE; priv->is_11ac_enabled = MFALSE; priv->is_11ax_enabled = MFALSE; + event->event_id = 0; while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) { tlv_type = wlan_le16_to_cpu(tlv->type); @@ -3937,11 +3844,11 @@ priv->is_11ac_enabled = MTRUE; } if (tlv_type == EXTENSION) { - pext_tlv = (MrvlIEtypes_He_cap_t *) tlv; + pext_tlv = (MrvlIEtypes_He_cap_t *)tlv; if (pext_tlv->ext_id == HE_CAPABILITY) { - DBG_HEXDUMP(MCMD_D, "HE_CAP tlv", tlv, - tlv_len + - sizeof(MrvlIEtypesHeader_t)); + DBG_HEXDUMP( + MCMD_D, "HE_CAP tlv", tlv, + tlv_len + sizeof(MrvlIEtypesHeader_t)); priv->is_11ax_enabled = MTRUE; } } @@ -3950,9 +3857,9 @@ if (!memcmp(priv->adapter, (t_u8 *)tlv + sizeof(MrvlIEtypesHeader_t), wmm_oui, sizeof(wmm_oui))) { - DBG_HEXDUMP(MCMD_D, "wmm ie tlv", tlv, - tlv_len + - sizeof(MrvlIEtypesHeader_t)); + DBG_HEXDUMP( + MCMD_D, "wmm ie tlv", tlv, + tlv_len + sizeof(MrvlIEtypesHeader_t)); priv->wmm_enabled = MFALSE; wlan_wmm_setup_ac_downgrade(priv); priv->wmm_enabled = MTRUE; @@ -3983,8 +3890,11 @@ tlv_len + sizeof(MrvlIEtypesHeader_t)); pchan_info = (MrvlIEtypes_channel_band_t *)tlv; priv->uap_channel = pchan_info->channel; - PRINTM(MCMND, "uap_channel FW: 0x%x\n", - priv->uap_channel); + priv->uap_bandwidth = pchan_info->bandcfg.chanWidth; + priv->uap_state_chan_cb.channel = pchan_info->channel; + priv->uap_state_chan_cb.bandcfg = pchan_info->bandcfg; + PRINTM(MCMND, "uap_channel FW: 0x%x bw=%d\n", + priv->uap_channel, priv->uap_bandwidth); event->bss_index = priv->bss_index; event->event_id = MLAN_EVENT_ID_DRV_UAP_CHAN_INFO; event->event_len = sizeof(chan_band_info); @@ -3994,10 +3904,10 @@ tlv_len); if (pchan_band_info->bandcfg.chanWidth == CHAN_BW_80MHZ) pchan_band_info->center_chan = - wlan_get_center_freq_idx(priv, BAND_AAC, - pchan_info-> - channel, - CHANNEL_BW_80MHZ); + wlan_get_center_freq_idx( + priv, BAND_AAC, + pchan_info->channel, + CHANNEL_BW_80MHZ); if (priv->adapter->ecsa_enable) { int ret; t_u8 bandwidth = BW_20MHZ; @@ -4018,10 +3928,10 @@ chan_bw_oper.ds_chan_bw_oper.bandwidth = bandwidth; - ret = wlan_prepare_cmd(priv, - HOST_CMD_APCMD_SYS_CONFIGURE, - HostCmd_ACT_GEN_SET, 0, - MNULL, &chan_bw_oper); + ret = wlan_prepare_cmd( + priv, HOST_CMD_APCMD_SYS_CONFIGURE, + HostCmd_ACT_GEN_SET, 0, MNULL, + &chan_bw_oper); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, @@ -4056,8 +3966,7 @@ * * @return MFALSE */ -static t_u32 -wlan_update_wapi_info_tlv(pmlan_private priv, pmlan_buffer pevent) +static t_u32 wlan_update_wapi_info_tlv(pmlan_private priv, pmlan_buffer pevent) { t_u32 ret = MFALSE; t_u16 tlv_type, tlv_len; @@ -4114,9 +4023,9 @@ * * @return MFALSE */ -static t_u32 -wlan_process_sta_assoc_event(pmlan_private priv, - mlan_event *pevent, pmlan_buffer pmbuf) +static t_u32 wlan_process_sta_assoc_event(pmlan_private priv, + mlan_event *pevent, + pmlan_buffer pmbuf) { t_u32 ret = MFALSE; t_u16 tlv_type, tlv_len; @@ -4151,9 +4060,8 @@ (t_u8 *)&(mgmt_tlv->frame_control), sizeof(frame_control), sizeof(frame_control)); - frame_sub_type = - IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE - (frame_control); + frame_sub_type = IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE( + frame_control); if ((mgmt_tlv->frame_control.type == 0) && ((frame_sub_type == SUBTYPE_ASSOC_REQUEST) || (frame_sub_type == SUBTYPE_REASSOC_REQUEST))) { @@ -4166,15 +4074,15 @@ sizeof(IEEEtypes_ReAssocRqst_t); ie_len = tlv_len - - sizeof(IEEEtypes_FrameCtl_t) - - assoc_ie_len; + sizeof(IEEEtypes_FrameCtl_t) - + assoc_ie_len; assoc_req_ie = (t_u8 *)tlv + sizeof(MrvlIETypes_MgmtFrameSet_t) + assoc_ie_len; memcpy_ext(priv->adapter, pevent->event_buf + - pevent->event_len, + pevent->event_len, assoc_req_ie, ie_len, ie_len); pevent->event_len += ie_len; break; @@ -4201,13 +4109,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_ret_cmd_uap_acs_scan(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_cmd_uap_acs_scan(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCMD_DS_APCMD_ACS_SCAN *acs_scan = - (HostCMD_DS_APCMD_ACS_SCAN *) & resp->params.acs_scan; + (HostCMD_DS_APCMD_ACS_SCAN *)&resp->params.acs_scan; mlan_ds_bss *bss = MNULL; ENTER(); @@ -4233,13 +4140,12 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_cmd_oper_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) +static mlan_status wlan_uap_cmd_oper_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) { HostCmd_DS_UAP_OPER_CTRL *poper_ctl = - (HostCmd_DS_UAP_OPER_CTRL *) & cmd->params.uap_oper_ctrl; + (HostCmd_DS_UAP_OPER_CTRL *)&cmd->params.uap_oper_ctrl; mlan_ds_bss *bss = (mlan_ds_bss *)pdata_buf; mlan_uap_oper_ctrl *uap_oper_ctrl = &bss->param.ap_oper_ctrl; Band_Config_t *bandcfg = MNULL; @@ -4258,23 +4164,21 @@ wlan_cpu_to_le16(uap_oper_ctrl->chan_opt); if (uap_oper_ctrl->chan_opt == 3) { poper_ctl->channel_band.header.type = - wlan_cpu_to_le16 - (TLV_TYPE_UAP_CHAN_BAND_CONFIG); - poper_ctl->channel_band.header.len = - wlan_cpu_to_le16(sizeof - (MrvlIEtypes_channel_band_t) - - - sizeof - (MrvlIEtypesHeader_t)); + wlan_cpu_to_le16( + TLV_TYPE_UAP_CHAN_BAND_CONFIG); + poper_ctl->channel_band.header + .len = wlan_cpu_to_le16( + sizeof(MrvlIEtypes_channel_band_t) - + sizeof(MrvlIEtypesHeader_t)); bandcfg = &poper_ctl->channel_band.bandcfg; if (uap_oper_ctrl->channel > 14) bandcfg->chanBand = BAND_5GHZ; bandcfg->chanWidth = uap_oper_ctrl->band_cfg; if (bandcfg->chanWidth) bandcfg->chan2Offset = - wlan_get_second_channel_offset - (pmpriv, - uap_oper_ctrl->channel); + wlan_get_second_channel_offset( + pmpriv, + uap_oper_ctrl->channel); bandcfg->scanMode = SCAN_MODE_MANUAL; poper_ctl->channel_band.channel = uap_oper_ctrl->channel; @@ -4295,12 +4199,12 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -wlan_uap_ret_oper_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_uap_ret_oper_ctrl(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_UAP_OPER_CTRL *poper_ctl = - (HostCmd_DS_UAP_OPER_CTRL *) & resp->params.uap_oper_ctrl; + (HostCmd_DS_UAP_OPER_CTRL *)&resp->params.uap_oper_ctrl; mlan_ds_bss *bss = MNULL; mlan_uap_oper_ctrl *uap_oper_ctrl = MNULL; Band_Config_t *bandcfg = MNULL; @@ -4309,8 +4213,7 @@ if (pioctl_buf && pioctl_buf->action == MLAN_ACT_GET) { bss = (mlan_ds_bss *)pioctl_buf->pbuf; - uap_oper_ctrl = - (mlan_uap_oper_ctrl *) & bss->param.ap_oper_ctrl; + uap_oper_ctrl = (mlan_uap_oper_ctrl *)&bss->param.ap_oper_ctrl; uap_oper_ctrl->ctrl_value = wlan_le16_to_cpu(poper_ctl->ctrl); uap_oper_ctrl->chan_opt = wlan_le16_to_cpu(poper_ctl->chan_opt); uap_oper_ctrl->channel = poper_ctl->channel_band.channel; @@ -4357,14 +4260,14 @@ * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_cmd_add_station(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, pmlan_ioctl_req pioctl_buf) +static mlan_status wlan_uap_cmd_add_station(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, + pmlan_ioctl_req pioctl_buf) { mlan_ds_bss *bss = MNULL; HostCmd_DS_ADD_STATION *new_sta = - (HostCmd_DS_ADD_STATION *) & cmd->params.sta_info; + (HostCmd_DS_ADD_STATION *)&cmd->params.sta_info; sta_node *sta_ptr = MNULL; t_u16 tlv_buf_left; t_u8 *pos = MNULL; @@ -4394,10 +4297,8 @@ sta_ptr = wlan_get_station_entry(pmpriv, bss->param.sta_info.peer_mac); if (!sta_ptr) - sta_ptr = - wlan_add_station_entry(pmpriv, - bss->param.sta_info. - peer_mac); + sta_ptr = wlan_add_station_entry( + pmpriv, bss->param.sta_info.peer_mac); } else { sta_ptr = wlan_add_station_entry(pmpriv, bss->param.sta_info.peer_mac); @@ -4427,7 +4328,7 @@ sta_ptr->is_wmm_enabled = MTRUE; } // append sta_flag_flags. - pstaflag = (MrvlIEtypes_StaFlag_t *) pos; + pstaflag = (MrvlIEtypes_StaFlag_t *)pos; pstaflag->header.type = wlan_cpu_to_le16(TLV_TYPE_UAP_STA_FLAGS); pstaflag->header.len = wlan_cpu_to_le16(sizeof(t_u32)); pstaflag->sta_flags = wlan_cpu_to_le32(bss->param.sta_info.sta_flags); @@ -4441,7 +4342,8 @@ case EXT_CAPABILITY: break; case SUPPORTED_RATES: - b_only = wlan_check_11B_support_rates((MrvlIEtypes_RatesParamSet_t *)tlv); + b_only = wlan_check_11B_support_rates( + (MrvlIEtypes_RatesParamSet_t *)tlv); break; case QOS_INFO: PRINTM(MCMND, "STA supports wmm\n"); @@ -4451,13 +4353,14 @@ PRINTM(MCMND, "STA supports 11n\n"); sta_ptr->is_11n_enabled = MTRUE; phtcap = (MrvlIETypes_HTCap_t *)tlv; - if (sta_ptr->HTcap.ieee_hdr.element_id == HT_CAPABILITY) { - if (GETHT_40MHZ_INTOLARANT - (sta_ptr->HTcap.ht_cap.ht_cap_info)) { + if (sta_ptr->HTcap.ieee_hdr.element_id == + HT_CAPABILITY) { + if (GETHT_40MHZ_INTOLARANT( + sta_ptr->HTcap.ht_cap.ht_cap_info)) { PRINTM(MCMND, "SETHT_40MHZ_INTOLARANT\n"); - SETHT_40MHZ_INTOLARANT(phtcap->ht_cap. - ht_cap_info); + SETHT_40MHZ_INTOLARANT( + phtcap->ht_cap.ht_cap_info); } } if (GETHT_MAXAMSDU(phtcap->ht_cap.ht_cap_info)) @@ -4469,11 +4372,11 @@ PRINTM(MCMND, "STA supports 11ac\n"); sta_ptr->is_11ac_enabled = MTRUE; pvhtcap = (MrvlIETypes_VHTCap_t *)tlv; - if (GET_VHTCAP_MAXMPDULEN(pvhtcap->vht_cap.vht_cap_info) - == 2) + if (GET_VHTCAP_MAXMPDULEN( + pvhtcap->vht_cap.vht_cap_info) == 2) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_12K; - else if (GET_VHTCAP_MAXMPDULEN - (pvhtcap->vht_cap.vht_cap_info) == 1) + else if (GET_VHTCAP_MAXMPDULEN( + pvhtcap->vht_cap.vht_cap_info) == 1) sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_8K; else sta_ptr->max_amsdu = MLAN_TX_DATA_BUF_SIZE_4K; @@ -4481,7 +4384,7 @@ case OPER_MODE_NTF: break; case EXTENSION: - pext_tlv = (MrvlIEtypes_Extension_t *) tlv; + pext_tlv = (MrvlIEtypes_Extension_t *)tlv; if (pext_tlv->ext_id == HE_CAPABILITY) { sta_ptr->is_11ax_enabled = MTRUE; PRINTM(MCMND, "STA supports 11ax\n"); @@ -4508,16 +4411,15 @@ if (pext_tlv == MNULL) { tlv = (MrvlIEtypesHeader_t *)pos; tlv->type = wlan_cpu_to_le16(EXTENSION); - tlv->len = - wlan_cpu_to_le16(MIN - (sta_ptr->he_cap.ieee_hdr.len, - sizeof(IEEEtypes_HECap_t) - - sizeof(IEEEtypes_Header_t))); + tlv->len = wlan_cpu_to_le16( + MIN(sta_ptr->he_cap.ieee_hdr.len, + sizeof(IEEEtypes_HECap_t) - + sizeof(IEEEtypes_Header_t))); pos += sizeof(MrvlIEtypesHeader_t); memcpy_ext(pmadapter, pos, - (t_u8 *)&sta_ptr->he_cap.ext_id, - tlv->len, tlv->len); + (t_u8 *)&sta_ptr->he_cap.ext_id, tlv->len, + tlv->len); travel_len += sizeof(MrvlIEtypesHeader_t) + tlv->len; } } @@ -4548,7 +4450,7 @@ } for (i = 0; i < MAX_NUM_TID; i++) { - if (sta_ptr->is_11n_enabled) + if (sta_ptr->is_11n_enabled || sta_ptr->is_11ax_enabled) sta_ptr->ampdu_sta[i] = pmpriv->aggr_prio_tbl[i].ampdu_user; else @@ -4562,6 +4464,81 @@ return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command of per peer stats + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_cmd_stats(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_STATS *stats_cmd = (HostCmd_DS_STATS *)&cmd->params.stats; + Stats_Cfg_Params_TLV_t *cfg_param = MNULL; + mlan_ds_stats *stats = (mlan_ds_stats *)pdata_buf; + Stats_Cfg_Params_TLV_t *stats_param = MNULL; + + ENTER(); + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_STATS); + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_STATS) + S_DS_GEN); + if (cmd_action) { + cmd->size = + wlan_cpu_to_le16(sizeof(HostCmd_DS_STATS) + S_DS_GEN + + sizeof(Stats_Cfg_Params_TLV_t) - 1); + stats_cmd->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + + stats_param = (Stats_Cfg_Params_TLV_t *)stats->tlv_buf; + if (stats_param->tlvHeader.type == + NXP_802_11_PER_PEER_STATS_CFG_TLV_ID) { + cfg_param = + (Stats_Cfg_Params_TLV_t *)stats_cmd->tlv_buffer; + *cfg_param = *stats_param; + } + } else { + cmd->size = + wlan_cpu_to_le16(sizeof(HostCmd_DS_STATS) + S_DS_GEN); + stats_cmd->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_GET); + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of stats + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS + */ +static mlan_status wlan_ret_stats(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + HostCmd_DS_STATS *cfg_cmd = (HostCmd_DS_STATS *)&resp->params.stats; + mlan_ds_misc_cfg *misc_cfg = MNULL; + t_u8 *pBuf = (t_u8 *)&cfg_cmd->tlv_buffer; + int len = resp->size; + + ENTER(); + if (pioctl_buf) { + misc_cfg = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + len -= (S_DS_GEN + sizeof(t_u16)); + memcpy_ext(pmpriv->adapter, + (t_u8 *)&misc_cfg->param.stats.tlv_buf, pBuf, len, + len); + misc_cfg->param.stats.tlv_len = len; + pioctl_buf->buf_len = sizeof(mlan_ds_stats) + len - 1; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /******************************************************** Global Functions ********************************************************/ @@ -4578,11 +4555,10 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, - t_u16 cmd_action, t_u32 cmd_oid, - t_void *pioctl_buf, - t_void *pdata_buf, t_void *pcmd_buf) +mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, + t_u16 cmd_action, t_u32 cmd_oid, + t_void *pioctl_buf, t_void *pdata_buf, + t_void *pcmd_buf) { HostCmd_DS_COMMAND *cmd_ptr = (HostCmd_DS_COMMAND *)pcmd_buf; mlan_private *pmpriv = (mlan_private *)priv; @@ -4728,9 +4704,8 @@ else cmd_ptr->params.bss_mode.con_type = BSS_MODE_WIFIDIRECT_GO; - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_SET_BSS_MODE) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_SET_BSS_MODE) + S_DS_GEN); ret = MLAN_STATUS_SUCCESS; break; #endif @@ -4738,9 +4713,8 @@ cmd_ptr->command = wlan_cpu_to_le16(cmd_no); cmd_ptr->params.verext.version_str_sel = (t_u8)(*((t_u32 *)pdata_buf)); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_VERSION_EXT) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_VERSION_EXT) + S_DS_GEN); ret = MLAN_STATUS_SUCCESS; break; case HostCmd_CMD_RX_MGMT_IND: @@ -4749,9 +4723,8 @@ wlan_cpu_to_le16(cmd_action); cmd_ptr->params.rx_mgmt_ind.mgmt_subtype_mask = (t_u32)(*((t_u32 *)pdata_buf)); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_RX_MGMT_IND) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_RX_MGMT_IND) + S_DS_GEN); break; case HostCmd_CMD_CFG_TX_DATA_PAUSE: ret = wlan_uap_cmd_txdatapause(pmpriv, cmd_ptr, cmd_action, @@ -4812,6 +4785,7 @@ case HostCmd_CMD_TARGET_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS: case HostCmd_CMD_BCA_REG_ACCESS: + case HostCmd_CMD_REG_ACCESS: ret = wlan_cmd_reg_access(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; @@ -4821,12 +4795,17 @@ case HostCmd_CMD_WMM_QUEUE_CONFIG: ret = wlan_cmd_wmm_queue_config(pmpriv, cmd_ptr, pdata_buf); break; -#ifdef RX_PACKET_COALESCE - case HostCmd_CMD_RX_PKT_COALESCE_CFG: - ret = wlan_cmd_rx_pkt_coalesce_cfg(pmpriv, cmd_ptr, cmd_action, - pdata_buf); + case HostCmd_CMD_MULTI_CHAN_CONFIG: + ret = wlan_cmd_multi_chan_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); break; -#endif + case HostCmd_CMD_MULTI_CHAN_POLICY: + ret = wlan_cmd_multi_chan_policy(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_DRCS_CONFIG: + ret = wlan_cmd_drcs_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; case HOST_CMD_APCMD_OPER_CTRL: ret = wlan_uap_cmd_oper_ctrl(pmpriv, cmd_ptr, cmd_action, pdata_buf); @@ -4846,11 +4825,14 @@ case HostCmd_CMD_CHAN_REGION_CFG: cmd_ptr->command = wlan_cpu_to_le16(cmd_no); - cmd_ptr->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_CHAN_REGION_CFG) + - S_DS_GEN); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_CHAN_REGION_CFG) + S_DS_GEN); cmd_ptr->params.reg_cfg.action = wlan_cpu_to_le16(cmd_action); break; + case HostCmd_CMD_802_11_NET_MONITOR: + ret = wlan_cmd_net_monitor(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; case HostCmd_CMD_PACKET_AGGR_CTRL: ret = wlan_cmd_packet_aggr_ctrl(pmpriv, cmd_ptr, cmd_action, pdata_buf); @@ -4928,9 +4910,8 @@ pdata_buf); break; case HostCmd_CMD_LOW_POWER_MODE_CFG: - ret = wlan_cmd_set_get_low_power_mode_cfg(pmpriv, cmd_ptr, - cmd_action, - pdata_buf); + ret = wlan_cmd_set_get_low_power_mode_cfg( + pmpriv, cmd_ptr, cmd_action, pdata_buf); break; case HostCmd_CMD_802_11_BAND_STEERING: ret = wlan_cmd_set_get_band_steering_cfg(pmpriv, cmd_ptr, @@ -4944,6 +4925,20 @@ ret = wlan_cmd_hal_phy_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_MC_AGGR_CFG: + ret = wlan_cmd_mc_aggr_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_802_11_STATS: + ret = wlan_cmd_stats(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; + case HostCmd_CMD_GET_CH_LOAD: + ret = wlan_cmd_get_ch_load(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_DS_GET_SENSOR_TEMP: + wlan_cmd_get_sensor_temp(pmpriv, cmd_ptr, cmd_action); + break; default: PRINTM(MERROR, "PREP_CMD: unknown command- %#x\n", cmd_no); if (pioctl_req) @@ -4965,9 +4960,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, - t_void *pcmd_buf, t_void *pioctl) +mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, + t_void *pcmd_buf, t_void *pioctl) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *)priv; @@ -5000,13 +4994,11 @@ if (!pmpriv->intf_state_11h.is_11h_host && !pstate_dfs->dfs_check_pending && pstate_dfs->dfs_check_channel) { - pmpriv->adapter->callbacks.moal_get_system_time(pmpriv-> - adapter-> - pmoal_handle, - &sec, - &usec); + pmpriv->adapter->callbacks.moal_get_system_time( + pmpriv->adapter->pmoal_handle, &sec, &usec); pstate_dfs->dfs_report_time_sec = sec; } + wlan_reset_all_chan_dfs_state(priv, BAND_A, DFS_USABLE); if (pmpriv->intf_state_11h.is_11h_host) pmpriv->intf_state_11h.tx_disabled = MFALSE; else { @@ -5035,7 +5027,7 @@ pmpriv->adapter->tx_lock_flag = MFALSE; pmpriv->adapter->pps_uapsd_mode = MFALSE; pmpriv->adapter->delay_null_pkt = MFALSE; - /* Clear AMSDU statistics */ + /* Clear AMSDU statistics*/ pmpriv->amsdu_rx_cnt = 0; pmpriv->amsdu_tx_cnt = 0; pmpriv->msdu_in_rx_amsdu_cnt = 0; @@ -5123,8 +5115,15 @@ break; case HostCmd_CMD_SET_BSS_MODE: break; + case HostCmd_CMD_802_11_NET_MONITOR: + ret = wlan_ret_net_monitor(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_RECONFIGURE_TX_BUFF: wlan_set_tx_pause_flag(pmpriv, MFALSE); +#if defined(USB) + if (IS_USB(pmadapter->card_type)) + wlan_resync_usb_port(pmadapter); +#endif pmadapter->tx_buf_size = (t_u16)wlan_le16_to_cpu(resp->params.tx_buf.buff_size); @@ -5132,21 +5131,19 @@ if (IS_SD(pmadapter->card_type)) { pmadapter->tx_buf_size = (pmadapter->tx_buf_size / MLAN_SDIO_BLOCK_SIZE) * - MLAN_SDIO_BLOCK_SIZE; - pmadapter->pcard_sd->mp_end_port = - wlan_le16_to_cpu(resp->params.tx_buf. - mp_end_port); + MLAN_SDIO_BLOCK_SIZE; + pmadapter->pcard_sd->mp_end_port = wlan_le16_to_cpu( + resp->params.tx_buf.mp_end_port); pmadapter->pcard_sd->mp_data_port_mask = pmadapter->pcard_sd->reg->data_port_mask; for (ctr = 1; - ctr <= - pmadapter->pcard_sd->max_ports - - pmadapter->pcard_sd->mp_end_port; ctr++) { + ctr <= pmadapter->pcard_sd->max_ports - + pmadapter->pcard_sd->mp_end_port; + ctr++) { pmadapter->pcard_sd->mp_data_port_mask &= - ~(1 << - (pmadapter->pcard_sd->max_ports - - ctr)); + ~(1 << (pmadapter->pcard_sd->max_ports - + ctr)); } pmadapter->pcard_sd->curr_wr_port = @@ -5155,8 +5152,8 @@ MIN(pmadapter->pcard_sd->mp_aggr_pkt_limit, (pmadapter->pcard_sd->mp_end_port >> 1)); PRINTM(MCMND, "end port %d, data port mask %x\n", - wlan_le16_to_cpu(resp->params.tx_buf. - mp_end_port), + wlan_le16_to_cpu( + resp->params.tx_buf.mp_end_port), pmadapter->pcard_sd->mp_data_port_mask); } #endif @@ -5226,6 +5223,7 @@ case HostCmd_CMD_TARGET_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS: case HostCmd_CMD_BCA_REG_ACCESS: + case HostCmd_CMD_REG_ACCESS: ret = wlan_ret_reg_access(pmpriv->adapter, cmdresp_no, resp, pioctl_buf); break; @@ -5235,11 +5233,15 @@ case HostCmd_CMD_WMM_QUEUE_CONFIG: ret = wlan_ret_wmm_queue_config(pmpriv, resp, pioctl_buf); break; -#ifdef RX_PACKET_COALESCE - case HostCmd_CMD_RX_PKT_COALESCE_CFG: - ret = wlan_ret_rx_pkt_coalesce_cfg(pmpriv, resp, pioctl_buf); + case HostCmd_CMD_MULTI_CHAN_CONFIG: + ret = wlan_ret_multi_chan_cfg(pmpriv, resp, pioctl_buf); break; -#endif + case HostCmd_CMD_MULTI_CHAN_POLICY: + ret = wlan_ret_multi_chan_policy(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_DRCS_CONFIG: + ret = wlan_ret_drcs_cfg(pmpriv, resp, pioctl_buf); + break; case HostCMD_APCMD_ACS_SCAN: ret = wlan_ret_cmd_uap_acs_scan(pmpriv, resp, pioctl_buf); break; @@ -5330,6 +5332,18 @@ ret = wlan_ret_set_get_beacon_stuck_cfg(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_MC_AGGR_CFG: + ret = wlan_ret_mc_aggr_cfg(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_802_11_STATS: + ret = wlan_ret_stats(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_GET_CH_LOAD: + ret = wlan_ret_ch_load(pmpriv, resp, pioctl_buf); + break; + case HostCmd_DS_GET_SENSOR_TEMP: + ret = wlan_ret_get_sensor_temp(pmpriv, resp, pioctl_buf); + break; default: PRINTM(MERROR, "CMD_RESP: Unknown command response %#x\n", resp->command); @@ -5348,8 +5362,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_uap_process_event(t_void *priv) +mlan_status wlan_ops_uap_process_event(t_void *priv) { pmlan_private pmpriv = (pmlan_private)priv; pmlan_adapter pmadapter = pmpriv->adapter; @@ -5363,6 +5376,7 @@ sta_node *sta_ptr = MNULL; t_u8 i = 0; t_u8 channel = 0; + t_u8 bandwidth = 0; MrvlIEtypes_channel_band_t *pchan_info = MNULL; chan_band_info *pchan_band_info = MNULL; event_exceed_max_p2p_conn *event_excd_p2p = MNULL; @@ -5417,6 +5431,8 @@ MNULL); } #endif + if (wlan_11h_radar_detect_required(pmpriv, pmpriv->uap_channel)) + wlan_11h_update_dfs_master_state_by_uap(pmpriv); break; case EVENT_MICRO_AP_BSS_ACTIVE: PRINTM(MEVENT, "EVENT: MICRO_AP_BSS_ACTIVE\n"); @@ -5471,17 +5487,18 @@ MAC2STR(sta_addr)); if (!sta_ptr) break; - if (pmpriv->is_11n_enabled + wlan_check_sta_capability(pmpriv, pmbuf, sta_ptr); + if (pmpriv->is_11n_enabled || pmpriv->is_11ax_enabled #ifdef DRV_EMBEDDED_AUTHENTICATOR || IsAuthenticatorEnabled(pmpriv->psapriv) #endif - ) { - wlan_check_sta_capability(pmpriv, pmbuf, sta_ptr); + ) { for (i = 0; i < MAX_NUM_TID; i++) { - if (sta_ptr->is_11n_enabled) + if (sta_ptr->is_11n_enabled || + sta_ptr->is_11ax_enabled) sta_ptr->ampdu_sta[i] = pmpriv->aggr_prio_tbl[i] - .ampdu_user; + .ampdu_user; else sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; @@ -5494,9 +5511,8 @@ #ifdef DRV_EMBEDDED_AUTHENTICATOR /**enter authenticator*/ if (IsAuthenticatorEnabled(pmpriv->psapriv)) - AuthenticatorSendEapolPacket(pmpriv->psapriv, - sta_ptr-> - cm_connectioninfo); + AuthenticatorSendEapolPacket( + pmpriv->psapriv, sta_ptr->cm_connectioninfo); #endif pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; break; @@ -5511,10 +5527,11 @@ wlan_recv_event(pmpriv, pevent->event_id, pevent); memcpy_ext(pmadapter, sta_addr, pmadapter->event_body + 2, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + sta_ptr = wlan_get_station_entry(pmpriv, sta_addr); PRINTM_NETINTF(MMSG, pmpriv); PRINTM(MMSG, "wlan: EVENT: MICRO_AP_STA_DEAUTH " MACSTR "\n", MAC2STR(sta_addr)); - if (pmpriv->is_11n_enabled) { + if (pmpriv->is_11n_enabled || pmpriv->is_11ax_enabled) { wlan_cleanup_reorder_tbl(pmpriv, sta_addr); wlan_11n_cleanup_txbastream_tbl(pmpriv, sta_addr); } @@ -5549,9 +5566,9 @@ case EVENT_BA_STREAM_TIMEOUT: PRINTM(MEVENT, "EVENT: BA Stream timeout\n"); if (pmpriv->media_connected == MTRUE) - wlan_11n_ba_stream_timeout(pmpriv, - (HostCmd_DS_11N_BATIMEOUT *) - pmadapter->event_body); + wlan_11n_ba_stream_timeout( + pmpriv, (HostCmd_DS_11N_BATIMEOUT *) + pmadapter->event_body); else PRINTM(MERROR, "Ignore BA Stream timeout event in BSS idle state\n"); @@ -5568,9 +5585,9 @@ MIN(pmadapter->curr_tx_buf_size, wlan_le16_to_cpu(*(t_u16 *)pmadapter->event_body)); if (pmbuf->data_len == sizeof(eventcause) + sizeof(t_u32)) { - enable = wlan_le16_to_cpu(*(t_u16 *) - (pmadapter->event_body + - sizeof(t_u16))); + enable = wlan_le16_to_cpu( + *(t_u16 *)(pmadapter->event_body + + sizeof(t_u16))); if (enable) pmpriv->amsdu_disable = MFALSE; else @@ -5590,11 +5607,10 @@ if (pmpriv->adapter->dfs_test_params.cac_restart && pmpriv->adapter->state_dfs.dfs_check_pending) { wlan_11h_cancel_radar_detect(pmpriv); - wlan_11h_issue_radar_detect(pmpriv, MNULL, - pmpriv->adapter-> - dfs_test_params.chan, - pmpriv->adapter-> - dfs_test_params.bandcfg); + wlan_11h_issue_radar_detect( + pmpriv, MNULL, + pmpriv->adapter->dfs_test_params.chan, + pmpriv->adapter->dfs_test_params.bandcfg); pevent->event_id = 0; break; } @@ -5607,44 +5623,51 @@ pmbuf->pbuf + pmbuf->data_offset, pevent->event_len, pevent->event_len); wlan_recv_event(pmpriv, pevent->event_id, pevent); - pevent->event_id = 0; /* clear to avoid resending at end of fcn - */ + pevent->event_id = 0; /* clear to avoid resending at end of fcn + */ /* Print event data */ pevent->event_id = MLAN_EVENT_ID_FW_RADAR_DETECTED; pevent->event_len = pmbuf->data_len - sizeof(eventcause); memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), pevent->event_len, pevent->event_len); - wlan_11h_print_event_radar_detected(pmpriv, pevent, &channel); + wlan_11h_print_event_radar_detected(pmpriv, pevent, &channel, + &bandwidth); *((t_u8 *)pevent->event_buf) = channel; + *((t_u8 *)pevent->event_buf + 1) = bandwidth; + if (pmpriv->bss_type == MLAN_BSS_TYPE_DFS) { + wlan_recv_event(priv, MLAN_EVENT_ID_FW_RADAR_DETECTED, + pevent); + pevent->event_id = 0; /* clear to avoid + resending at end of fcn + */ + break; + } if (!pmpriv->intf_state_11h.is_11h_host) { if (pmadapter->state_rdh.stage == RDH_OFF) { pmadapter->state_rdh.stage = RDH_CHK_INTFS; wlan_11h_radar_detected_handling(pmadapter, pmpriv); - if (pmpriv->uap_host_based) - wlan_recv_event(priv, - MLAN_EVENT_ID_FW_RADAR_DETECTED, - pevent); + wlan_recv_event(priv, + MLAN_EVENT_ID_FW_RADAR_DETECTED, + pevent); } else { PRINTM(MEVENT, "Ignore Event Radar Detected - handling" " already in progress.\n"); } } else { - if (pmpriv->adapter->dfs_test_params. - no_channel_change_on_radar || - pmpriv->adapter->dfs_test_params. - fixed_new_channel_on_radar) { - if (pmadapter->state_rdh.stage == RDH_OFF || - pmadapter->state_rdh.stage == - RDH_SET_CUSTOM_IE) { + if (pmpriv->adapter->dfs_test_params + .no_channel_change_on_radar || + pmpriv->adapter->dfs_test_params + .fixed_new_channel_on_radar) { + if (pmadapter->state_rdh.stage == RDH_OFF) { pmadapter->state_rdh.stage = RDH_CHK_INTFS; - wlan_11h_radar_detected_handling - (pmadapter, pmpriv); + wlan_11h_radar_detected_handling( + pmadapter, pmpriv); } else PRINTM(MEVENT, "Ignore Event Radar Detected - handling already in progress.\n"); @@ -5653,12 +5676,11 @@ wlan_recv_event(priv, MLAN_EVENT_ID_FW_RADAR_DETECTED, pevent); - } } - pevent->event_id = 0; /* clear to avoid resending at end of fcn - */ + pevent->event_id = 0; /* clear to avoid resending at end of fcn + */ break; case EVENT_CHANNEL_REPORT_RDY: PRINTM_NETINTF(MEVENT, pmpriv); @@ -5672,15 +5694,29 @@ /* Copy event data */ memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), pevent->event_len, pevent->event_len); /* Handle / pass event data, and free buffer */ ret = wlan_11h_handle_event_chanrpt_ready(pmpriv, pevent, - &channel); + &channel, &bandwidth); + if (pmpriv->bss_type == MLAN_BSS_TYPE_DFS) { + *((t_u8 *)pevent->event_buf) = + pmpriv->adapter->state_dfs.dfs_radar_found; + *((t_u8 *)pevent->event_buf + 1) = channel; + *((t_u8 *)pevent->event_buf + 2) = bandwidth; + wlan_recv_event(pmpriv, + MLAN_EVENT_ID_FW_CHANNEL_REPORT_RDY, + pevent); + pevent->event_id = 0; /* clear to avoid resending at end + of fcn */ + break; + } if (pmpriv->intf_state_11h.is_11h_host) { *((t_u8 *)pevent->event_buf) = pmpriv->adapter->state_dfs.dfs_radar_found; *((t_u8 *)pevent->event_buf + 1) = channel; + *((t_u8 *)pevent->event_buf + 2) = bandwidth; + wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_CHANNEL_REPORT_RDY, pevent); @@ -5699,28 +5735,15 @@ PRINTM(MEVENT, "EVENT: CHANNEL_SWITCH new channel %d\n", channel); pmpriv->uap_channel = channel; + pmpriv->uap_bandwidth = pchan_info->bandcfg.chanWidth; pmpriv->uap_state_chan_cb.channel = pchan_info->channel; pmpriv->uap_state_chan_cb.bandcfg = pchan_info->bandcfg; - if (wlan_11h_radar_detect_required(pmpriv, pchan_info->channel)) { - if (!wlan_11h_is_active(pmpriv)) { - /* active 11h extention in Fw */ - ret = wlan_11h_activate(pmpriv, MNULL, MTRUE); - ret = wlan_11h_config_master_radar_det(pmpriv, - MTRUE); - ret = wlan_11h_check_update_radar_det_state - (pmpriv); - } - if (pmpriv->uap_host_based) - pmpriv->intf_state_11h.is_11h_host = MTRUE; - wlan_11h_set_dfs_check_chan(pmpriv, - pchan_info->channel); - } + if (wlan_11h_radar_detect_required(pmpriv, pchan_info->channel)) + wlan_11h_update_dfs_master_state_by_uap(pmpriv); if ((pmpriv->adapter->state_rdh.stage != RDH_OFF && - !pmpriv->intf_state_11h.is_11h_host) - || pmpriv->adapter->dfs_test_params. - no_channel_change_on_radar || - pmpriv->adapter->dfs_test_params. - fixed_new_channel_on_radar) { + !pmpriv->intf_state_11h.is_11h_host) || + pmpriv->adapter->dfs_test_params.no_channel_change_on_radar || + pmpriv->adapter->dfs_test_params.fixed_new_channel_on_radar) { /* Handle embedded DFS */ if (pmpriv->adapter->state_rdh.stage == RDH_SET_CUSTOM_IE) { @@ -5733,13 +5756,15 @@ } else { /* Handle Host-based DFS and non-DFS(normal uap) case */ pmpriv->intf_state_11h.tx_disabled = MFALSE; + } + if (pmpriv->uap_host_based) { memset(pmadapter, event_buf, 0x00, MAX_EVENT_SIZE); /* Setup event buffer */ pevent->bss_index = pmpriv->bss_index; pevent->event_id = MLAN_EVENT_ID_FW_CHAN_SWITCH_COMPLETE; pevent->event_len = sizeof(chan_band_info); - pchan_band_info = (chan_band_info *) pevent->event_buf; + pchan_band_info = (chan_band_info *)pevent->event_buf; /* Copy event data */ memcpy_ext(pmadapter, (t_u8 *)&pchan_band_info->bandcfg, (t_u8 *)&pchan_info->bandcfg, @@ -5748,10 +5773,10 @@ pchan_band_info->channel = pchan_info->channel; if (pchan_band_info->bandcfg.chanWidth == CHAN_BW_80MHZ) pchan_band_info->center_chan = - wlan_get_center_freq_idx(priv, BAND_AAC, - pchan_info-> - channel, - CHANNEL_BW_80MHZ); + wlan_get_center_freq_idx( + priv, BAND_AAC, + pchan_info->channel, + CHANNEL_BW_80MHZ); pchan_band_info->is_11n_enabled = pmpriv->is_11n_enabled; wlan_recv_event(pmpriv, @@ -5767,6 +5792,10 @@ wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_FLUSH_RX_WORK, MNULL); pevent->event_id = MLAN_EVENT_ID_FW_REMAIN_ON_CHAN_EXPIRED; break; + case EVENT_MULTI_CHAN_INFO: + PRINTM(MEVENT, "EVENT: MULTI_CHAN_INFO\n"); + wlan_handle_event_multi_chan_info(pmpriv, pmbuf); + break; case EVENT_FW_DEBUG_INFO: memset(pmadapter, event_buf, 0x00, MAX_EVENT_SIZE); @@ -5775,13 +5804,13 @@ pevent->event_len = pmbuf->data_len - sizeof(eventcause); memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), + sizeof(eventcause), pevent->event_len, pevent->event_len); PRINTM(MEVENT, "EVENT: FW Debug Info %s\n", (t_u8 *)pevent->event_buf); wlan_recv_event(pmpriv, pevent->event_id, pevent); - pevent->event_id = 0; /* clear to avoid resending at end of fcn - */ + pevent->event_id = 0; /* clear to avoid resending at end of fcn + */ break; case EVENT_TX_STATUS_REPORT: PRINTM(MINFO, "EVENT: TX_STATUS\n"); @@ -5793,8 +5822,8 @@ break; case EVENT_EXCEED_MAX_P2P_CONN: event_excd_p2p = - (event_exceed_max_p2p_conn *) (pmbuf->pbuf + - pmbuf->data_offset); + (event_exceed_max_p2p_conn *)(pmbuf->pbuf + + pmbuf->data_offset); PRINTM(MEVENT, "EVENT: EXCEED MAX P2P CONNECTION\n"); PRINTM(MEVENT, "REQUEST P2P MAC: " MACSTR "\n", MAC2STR(event_excd_p2p->peer_mac_addr)); @@ -5803,6 +5832,10 @@ case EVENT_VDLL_IND: wlan_process_vdll_event(pmpriv, pmbuf); break; + case EVENT_CSI: + PRINTM(MEVENT, "EVENT: EVENT_CSI on UAP\n"); + wlan_process_csi_event(pmpriv); + break; case EVENT_FW_HANG_REPORT: if (pmbuf->data_len < (sizeof(eventcause) + sizeof(t_u16))) { @@ -5820,14 +5853,30 @@ break; case EVENT_WATCHDOG_TMOUT: PRINTM(MEVENT, "EVENT: EVENT_WATCHDOG_TMOUT reasoncode=%d\n", - wlan_le16_to_cpu(*(t_u16 *) - (pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause)))); + wlan_le16_to_cpu(*(t_u16 *)(pmbuf->pbuf + + pmbuf->data_offset + + sizeof(eventcause)))); pevent->event_id = MLAN_EVENT_ID_DRV_WIFI_STATUS; pevent->event_len = sizeof(pevent->event_id) + sizeof(t_u16); memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, pmbuf->pbuf + pmbuf->data_offset + - sizeof(eventcause), sizeof(t_u16), sizeof(t_u16)); + sizeof(eventcause), + sizeof(t_u16), sizeof(t_u16)); + break; + case CHAN_LOAD_EVENT: { + t_u8 *ptr = MNULL; + HostCmd_DS_GET_CH_LOAD *cfg_cmd = MNULL; + ptr = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); + ptr += 4; /* actual data buffer start */ + cfg_cmd = (HostCmd_DS_GET_CH_LOAD *)ptr; + pmpriv->ch_load_param = wlan_le16_to_cpu(cfg_cmd->ch_load); + pmpriv->noise = wlan_le16_to_cpu(cfg_cmd->noise); + pmpriv->rx_quality = wlan_le16_to_cpu(cfg_cmd->rx_quality); + break; + } + case EVENT_FW_DUMP_INFO: + PRINTM(MINFO, "EVENT: Dump FW info\n"); + pevent->event_id = MLAN_EVENT_ID_FW_DUMP_INFO; break; default: pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; @@ -5857,8 +5906,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_set_uap_max_sta(pmlan_private pmpriv, t_u8 uap_max_sta) +static mlan_status wlan_uap_set_uap_max_sta(pmlan_private pmpriv, + t_u8 uap_max_sta) { MrvlIEtypes_uap_max_sta_cnt_t tlv_uap_max_sta; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5883,8 +5932,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_uap_init_cmd(t_void *priv, t_u8 first_bss) +mlan_status wlan_ops_uap_init_cmd(t_void *priv, t_u8 first_bss) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = (pmlan_private)priv; @@ -5905,9 +5953,8 @@ } if (pmpriv->adapter->init_para.uap_max_sta && (pmpriv->adapter->init_para.uap_max_sta <= MAX_STA_COUNT)) - wlan_uap_set_uap_max_sta(pmpriv, - pmpriv->adapter->init_para. - uap_max_sta); + wlan_uap_set_uap_max_sta( + pmpriv, pmpriv->adapter->init_para.uap_max_sta); ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_SYS_CONFIGURE, HostCmd_ACT_GEN_GET, 0, MNULL, MNULL);
diff --git a/wlan_sd8987/mlan/mlan_uap_ioctl.c b/wlan_sd8987/mlan/mlan_uap_ioctl.c index 16eef40..439dc01 100755 --- a/wlan_sd8987/mlan/mlan_uap_ioctl.c +++ b/wlan_sd8987/mlan/mlan_uap_ioctl.c
@@ -3,7 +3,7 @@ * @brief This file contains the handling of AP mode ioctls * * - * Copyright 2009-2021 NXP + * Copyright 2009-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -54,8 +54,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_stop(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_stop(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -72,8 +72,7 @@ return ret; } -static t_bool -wlan_can_radar_det_skip(mlan_private *priv) +static t_bool wlan_can_radar_det_skip(mlan_private *priv) { mlan_private *priv_list[MLAN_MAX_BSS_NUM]; mlan_private *pmpriv; @@ -84,7 +83,8 @@ * is off then 11n_radar detection is not required for subsequent BSSes * since they will follow the primary bss. */ - if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)) { + if (!priv->adapter->mc_policy && + (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)) { memset(pmadapter, priv_list, 0x00, sizeof(priv_list)); pcount = wlan_get_privs_by_cond(pmadapter, wlan_is_intf_active, priv_list); @@ -96,7 +96,6 @@ } return MFALSE; } - /** * @brief Callback to finish BSS IOCTL START * Not to be called directly to initiate bss_start @@ -106,8 +105,7 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_bss_ioctl_start */ -static mlan_status -wlan_uap_callback_bss_ioctl_start(t_void *priv) +static mlan_status wlan_uap_callback_bss_ioctl_start(t_void *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *)priv; @@ -115,6 +113,7 @@ wlan_uap_get_info_cb_t *puap_state_chan_cb = &pmpriv->uap_state_chan_cb; t_u8 old_channel; t_bool under_nop = MFALSE; + dfs_state_t dfs_state; ENTER(); /* clear callback now that we're here */ puap_state_chan_cb->get_chan_callback = MNULL; @@ -139,11 +138,10 @@ PRINTM(MERROR, "BSS start is blocked when DFS-repeater\n" "mode is on and STA is not connected\n"); - pcb->moal_ioctl_complete(pmpriv->adapter-> - pmoal_handle, - puap_state_chan_cb-> - pioctl_req_curr, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmpriv->adapter->pmoal_handle, + puap_state_chan_cb->pioctl_req_curr, + MLAN_STATUS_FAILURE); goto done; } else { /* STA is connected. @@ -153,10 +151,13 @@ goto prep_bss_start; } } - + dfs_state = wlan_get_chan_dfs_state( + pmpriv, BAND_A, puap_state_chan_cb->channel); + if (dfs_state == DFS_AVAILABLE) + goto prep_bss_start; /* first check if channel is under NOP */ - if (wlan_11h_is_channel_under_nop - (pmpriv->adapter, puap_state_chan_cb->channel)) { + if (wlan_11h_is_channel_under_nop( + pmpriv->adapter, puap_state_chan_cb->channel)) { /* recently we've seen radar on this channel */ ret = MLAN_STATUS_FAILURE; under_nop = MTRUE; @@ -164,50 +165,44 @@ /* Check cached radar check on the channel */ if (ret == MLAN_STATUS_SUCCESS) - ret = wlan_11h_check_chan_report(pmpriv, - puap_state_chan_cb-> - channel); + ret = wlan_11h_check_chan_report( + pmpriv, puap_state_chan_cb->channel); /* Found radar: try to switch to a non-dfs channel */ if (ret != MLAN_STATUS_SUCCESS) { old_channel = puap_state_chan_cb->channel; - ret = wlan_11h_switch_non_dfs_chan(pmpriv, - &puap_state_chan_cb-> - channel); + ret = wlan_11h_switch_non_dfs_chan( + pmpriv, &puap_state_chan_cb->channel); if (ret == MLAN_STATUS_SUCCESS) { - wlan_11h_update_bandcfg(pmpriv, - &pmpriv-> - uap_state_chan_cb. - bandcfg, - puap_state_chan_cb-> - channel); + wlan_11h_update_bandcfg( + pmpriv, + &pmpriv->uap_state_chan_cb.bandcfg, + puap_state_chan_cb->channel); PRINTM(MCMD_D, "NOP: uap band config:0x%x channel=%d\n", pmpriv->uap_state_chan_cb.bandcfg, puap_state_chan_cb->channel); - ret = wlan_uap_set_channel(pmpriv, - pmpriv-> - uap_state_chan_cb. - bandcfg, - puap_state_chan_cb-> - channel); + ret = wlan_uap_set_channel( + pmpriv, + pmpriv->uap_state_chan_cb.bandcfg, + puap_state_chan_cb->channel); if (ret == MLAN_STATUS_SUCCESS) { if (under_nop) { PRINTM(MMSG, "Channel %d under NOP," " switched to new channel %d successfully.\n", old_channel, - puap_state_chan_cb-> - channel); + puap_state_chan_cb + ->channel); } else { PRINTM(MMSG, "Radar found on channel %d," " switched to new channel %d successfully.\n", old_channel, - puap_state_chan_cb-> - channel); + puap_state_chan_cb + ->channel); } } else { if (under_nop) { @@ -215,22 +210,21 @@ "Channel %d under NOP," " switch to new channel %d failed.\n", old_channel, - puap_state_chan_cb-> - channel); + puap_state_chan_cb + ->channel); } else { PRINTM(MMSG, "Radar found on channel %d," " switch to new channel %d failed.\n", old_channel, - puap_state_chan_cb-> - channel); + puap_state_chan_cb + ->channel); } - pcb->moal_ioctl_complete(pmpriv-> - adapter-> - pmoal_handle, - puap_state_chan_cb-> - pioctl_req_curr, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmpriv->adapter->pmoal_handle, + puap_state_chan_cb + ->pioctl_req_curr, + MLAN_STATUS_FAILURE); goto done; } } else { @@ -245,11 +239,10 @@ } /* No command sent with the ioctl, need manually * signal completion */ - pcb->moal_ioctl_complete(pmpriv->adapter-> - pmoal_handle, - puap_state_chan_cb-> - pioctl_req_curr, - MLAN_STATUS_FAILURE); + pcb->moal_ioctl_complete( + pmpriv->adapter->pmoal_handle, + puap_state_chan_cb->pioctl_req_curr, + MLAN_STATUS_FAILURE); goto done; } } else { @@ -268,7 +261,7 @@ ret = MLAN_STATUS_PENDING; done: - puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ + puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ LEAVE(); return ret; } @@ -284,8 +277,8 @@ /** * @sa wlan_uap_callback_bss_ioctl_start */ -static mlan_status -wlan_uap_bss_ioctl_start(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_start(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -330,8 +323,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_reset(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_reset(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -381,9 +374,8 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE */ -static mlan_status -wlan_uap_bss_ioctl_add_station(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_add_station(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -408,9 +400,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_mac_address(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_mac_address(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_bss *bss = MNULL; @@ -445,9 +436,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_uap_wmm_param(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_uap_wmm_param(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -542,9 +532,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_uap_channel(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_uap_channel(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -575,9 +564,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_uap_oper_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_uap_oper_ctrl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -613,8 +601,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_get_stats(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_get_stats(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -639,8 +627,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_get_stats_log(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_get_stats_log(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -687,8 +675,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -720,9 +708,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_deauth_sta(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_deauth_sta(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -749,8 +736,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_get_sta_list(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_get_sta_list(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -777,9 +764,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_misc_ioctl_soft_reset(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_misc_ioctl_soft_reset(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -804,9 +790,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_misc_ioctl_txdatapause(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_misc_ioctl_txdatapause(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *pmisc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; @@ -837,8 +822,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_pm_ioctl_mode(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_pm_ioctl_mode(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_pm_cfg *pm = MNULL; @@ -889,8 +874,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_set_wapi_ie(mlan_private *priv, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_set_wapi_ie(mlan_private *priv, + pmlan_ioctl_req pioctl_req) { mlan_ds_misc_cfg *misc = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -943,8 +928,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, * otherwise fail */ -static mlan_status -wlan_uap_misc_ioctl_gen_ie(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_misc_ioctl_gen_ie(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -959,7 +944,7 @@ (pioctl_req->action == MLAN_ACT_SET)) { if (misc->param.gen_ie.len) { pvendor_ie = (IEEEtypes_VendorHeader_t *) - misc->param.gen_ie.ie_data; + misc->param.gen_ie.ie_data; if (pvendor_ie->element_id == WAPI_IE) { /* IE is a WAPI IE so call set_wapi function */ ret = wlan_uap_set_wapi_ie(pmpriv, pioctl_req); @@ -981,9 +966,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_uap_sec_ioctl_wapi_enable(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_sec_ioctl_wapi_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1088,8 +1072,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_uap_get_bss_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_get_bss_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1127,11 +1111,11 @@ * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * - * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, otherwise - * fail + * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, + * otherwise fail */ -static mlan_status -wlan_uap_pm_ioctl_deepsleep(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_pm_ioctl_deepsleep(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1166,7 +1150,7 @@ return MLAN_STATUS_FAILURE; } if (((mlan_ds_pm_cfg *)pioctl_req->pbuf) - ->param.auto_deep_sleep.auto_ds == DEEP_SLEEP_ON) { + ->param.auto_deep_sleep.auto_ds == DEEP_SLEEP_ON) { auto_ds.auto_ds = DEEP_SLEEP_ON; mode = EN_AUTO_PS; PRINTM(MINFO, "Auto Deep Sleep: on\n"); @@ -1176,9 +1160,10 @@ PRINTM(MINFO, "Auto Deep Sleep: off\n"); } if (((mlan_ds_pm_cfg *)pioctl_req->pbuf) - ->param.auto_deep_sleep.idletime) - auto_ds.idletime = ((mlan_ds_pm_cfg *)pioctl_req->pbuf) - ->param.auto_deep_sleep.idletime; + ->param.auto_deep_sleep.idletime) + auto_ds.idletime = + ((mlan_ds_pm_cfg *)pioctl_req->pbuf) + ->param.auto_deep_sleep.idletime; else auto_ds.idletime = pmadapter->idle_time; ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_PS_MODE_ENH, @@ -1197,11 +1182,11 @@ * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * - * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, otherwise - * fail + * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, + * otherwise fail */ -static mlan_status -wlan_misc_band_steering_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_band_steering_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1235,11 +1220,11 @@ * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * - * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, otherwise fail + * @return MLAN_STATUS_SUCCES/MLAN_STATUS_PENDING --success, + * otherwise fail */ -static mlan_status -wlan_misc_beacon_stuck_cfg(IN pmlan_adapter pmadapter, - IN pmlan_ioctl_req pioctl_req) +static mlan_status wlan_misc_beacon_stuck_cfg(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1279,8 +1264,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_snmp_mib_11d(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_snmp_mib_11d(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1325,14 +1310,13 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_domain_info */ -static mlan_status -wlan_uap_callback_domain_info(t_void *priv) +static mlan_status wlan_uap_callback_domain_info(t_void *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *)priv; wlan_uap_get_info_cb_t *puap_state_chan_cb = &pmpriv->uap_state_chan_cb; mlan_ds_11d_cfg *cfg11d; - t_u8 band; + t_u16 band; pmlan_adapter pmadapter = pmpriv->adapter; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -1347,12 +1331,11 @@ } cfg11d = (mlan_ds_11d_cfg *)puap_state_chan_cb->pioctl_req_curr->pbuf; band = (puap_state_chan_cb->bandcfg.chanBand == BAND_5GHZ) ? BAND_A : - BAND_B; + BAND_B; - ret = wlan_11d_handle_uap_domain_info(pmpriv, band, - cfg11d->param.domain_tlv, - puap_state_chan_cb-> - pioctl_req_curr); + ret = wlan_11d_handle_uap_domain_info( + pmpriv, band, cfg11d->param.domain_tlv, + puap_state_chan_cb->pioctl_req_curr); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; else { @@ -1363,7 +1346,7 @@ MLAN_STATUS_FAILURE); } - puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ + puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ LEAVE(); return ret; } @@ -1377,8 +1360,8 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_callback_domain_info */ -static mlan_status -wlan_uap_domain_info(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_domain_info(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1424,8 +1407,7 @@ * @return MLAN_STATUS_SUCCESS/PENDING --success, otherwise fail * @sa wlan_uap_11h_channel_check_req */ -static mlan_status -wlan_uap_callback_11h_channel_check_req(t_void *priv) +static mlan_status wlan_uap_callback_11h_channel_check_req(t_void *priv) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_private *pmpriv = (mlan_private *)priv; @@ -1434,6 +1416,7 @@ Band_Config_t *pband_cfg = &puap_state_chan_cb->bandcfg; /* keep copy as local variable */ pmlan_ioctl_req pioctl = puap_state_chan_cb->pioctl_req_curr; + dfs_state_t dfs_state; ENTER(); /* clear callback now that we're here */ puap_state_chan_cb->get_chan_callback = MNULL; @@ -1458,6 +1441,19 @@ ret = wlan_11h_config_master_radar_det(pmpriv, MTRUE); ret = wlan_11h_check_update_radar_det_state(pmpriv); + dfs_state = wlan_get_chan_dfs_state( + pmpriv, BAND_A, puap_state_chan_cb->channel); + if (dfs_state == DFS_AVAILABLE) { + wlan_11h_set_dfs_check_chan(pmpriv, + puap_state_chan_cb->channel, + pband_cfg->chanWidth); + PRINTM(MCMND, "DFS: Channel %d is Avaliable\n", + puap_state_chan_cb->channel); + pcb->moal_ioctl_complete(pmpriv->adapter->pmoal_handle, + pioctl, MLAN_STATUS_COMPLETE); + LEAVE(); + return ret; + } /* Check for radar on the channel */ ret = wlan_11h_issue_radar_detect(pmpriv, pioctl, puap_state_chan_cb->channel, @@ -1484,9 +1480,8 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_callback_11h_channel_check_req */ -static mlan_status -wlan_uap_11h_channel_check_req(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_11h_channel_check_req(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1505,7 +1500,8 @@ pmpriv->intf_state_11h.is_11h_host = p11h_cfg->param.chan_rpt_req.host_based; - if (!pmpriv->intf_state_11h.is_11h_host) { + if (!pmpriv->intf_state_11h.is_11h_host && + pmpriv->bss_type != MLAN_BSS_TYPE_DFS) { /* store params, issue command to get UAP channel, whose * CMD_RESP will callback remainder of 11H channel check * handling */ @@ -1523,24 +1519,45 @@ ret = wlan_11h_config_master_radar_det(pmpriv, MTRUE); ret = wlan_11h_check_update_radar_det_state(pmpriv); } - if (p11h_cfg->param.chan_rpt_req.millisec_dwell_time) { - if (pmpriv->adapter->dfs_test_params. - user_cac_period_msec) { + if (p11h_cfg->param.chan_rpt_req.millisec_dwell_time || + pmpriv->bss_type == MLAN_BSS_TYPE_DFS) { + if (pmpriv->adapter->dfs_test_params + .user_cac_period_msec) { PRINTM(MCMD_D, "cfg80211 dfs_testing - user CAC period=%d (msec)\n", - pmpriv->adapter->dfs_test_params. - user_cac_period_msec); - p11h_cfg->param.chan_rpt_req. - millisec_dwell_time = - pmpriv->adapter->dfs_test_params. - user_cac_period_msec; + pmpriv->adapter->dfs_test_params + .user_cac_period_msec); + p11h_cfg->param.chan_rpt_req + .millisec_dwell_time = + pmpriv->adapter->dfs_test_params + .user_cac_period_msec; } - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_CHAN_REPORT_REQUEST, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, - (t_void *)&p11h_cfg->param. - chan_rpt_req); + if (pmpriv->adapter->dfs_test_params.cac_restart && + p11h_cfg->param.chan_rpt_req.millisec_dwell_time) { + pmpriv->adapter->dfs_test_params.chan = + p11h_cfg->param.chan_rpt_req.chanNum; + pmpriv->adapter->dfs_test_params + .millisec_dwell_time = + p11h_cfg->param.chan_rpt_req + .millisec_dwell_time; + memcpy_ext( + pmpriv->adapter, + &pmpriv->adapter->dfs_test_params + .bandcfg, + &p11h_cfg->param.chan_rpt_req.bandcfg, + sizeof(Band_Config_t), + sizeof(Band_Config_t)); + } + if (p11h_cfg->param.chan_rpt_req.millisec_dwell_time) + PRINTM(MMSG, + "11h: issuing DFS Radar check for channel=%d." + " Please wait for response...\n", + p11h_cfg->param.chan_rpt_req.chanNum); + + ret = wlan_prepare_cmd( + pmpriv, HostCmd_CMD_CHAN_REPORT_REQUEST, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + (t_void *)&p11h_cfg->param.chan_rpt_req); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -1560,8 +1577,7 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_snmp_mib_11h */ -static mlan_status -wlan_uap_callback_snmp_mib_11h(t_void *priv) +static mlan_status wlan_uap_callback_snmp_mib_11h(t_void *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *)priv; @@ -1580,18 +1596,17 @@ if (enable_11h) { if ((puap_state_chan_cb->bandcfg.chanBand == BAND_5GHZ) && !wlan_can_radar_det_skip(pmpriv) && - wlan_11h_radar_detect_required(pmpriv, - puap_state_chan_cb-> - channel)) { + wlan_11h_radar_detect_required( + pmpriv, puap_state_chan_cb->channel)) { if (!wlan_11h_is_master_radar_det_active(pmpriv)) wlan_11h_config_master_radar_det(pmpriv, MTRUE); } else { puap_state_chan_cb->pioctl_req_curr->status_code = MLAN_STATUS_SUCCESS; - pcb->moal_ioctl_complete(pmpriv->adapter->pmoal_handle, - puap_state_chan_cb-> - pioctl_req_curr, - MLAN_STATUS_SUCCESS); + pcb->moal_ioctl_complete( + pmpriv->adapter->pmoal_handle, + puap_state_chan_cb->pioctl_req_curr, + MLAN_STATUS_SUCCESS); goto done; } } @@ -1603,7 +1618,7 @@ if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; done: - puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ + puap_state_chan_cb->pioctl_req_curr = MNULL; /* prevent re-use */ LEAVE(); return ret; } @@ -1617,8 +1632,8 @@ * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_callback_snmp_mib_11h */ -static mlan_status -wlan_uap_snmp_mib_11h(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_snmp_mib_11h(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -1665,6 +1680,42 @@ } /** + * @brief Set SNMP MIB for 11H + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + * @sa wlan_uap_callback_snmp_mib_11h + */ +static mlan_status wlan_uap_snmp_mib_11h_fakeradar(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + ENTER(); + + if (pioctl_req->buf_len < sizeof(mlan_ds_snmp_mib)) { + PRINTM(MWARN, "MLAN snmp_mib IOCTL length is too short.\n"); + pioctl_req->data_read_written = 0; + pioctl_req->buf_len_needed = sizeof(mlan_ds_snmp_mib); + LEAVE(); + return MLAN_STATUS_RESOURCE; + } + /* Send cmd to FW to trigger fakeradar in firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_SNMP_MIB, + HostCmd_ACT_GEN_SET, Dot11H_fakeRadar, + (t_void *)pioctl_req, MNULL); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief ACS scan * * @param pmadapter A pointer to mlan_adapter structure @@ -1672,8 +1723,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_bss_ioctl_acs_scan(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_bss_ioctl_acs_scan(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1706,8 +1757,7 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_uap_get_channel(pmlan_private pmpriv) +mlan_status wlan_uap_get_channel(pmlan_private pmpriv) { MrvlIEtypes_channel_band_t tlv_chan_band; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1716,7 +1766,7 @@ memset(pmpriv->adapter, &tlv_chan_band, 0, sizeof(tlv_chan_band)); tlv_chan_band.header.type = TLV_TYPE_UAP_CHAN_BAND_CONFIG; tlv_chan_band.header.len = sizeof(MrvlIEtypes_channel_band_t) - - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); ret = wlan_prepare_cmd(pmpriv, HOST_CMD_APCMD_SYS_CONFIGURE, HostCmd_ACT_GEN_GET, 0, MNULL, &tlv_chan_band); @@ -1733,9 +1783,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_uap_set_channel(pmlan_private pmpriv, - Band_Config_t uap_band_cfg, t_u8 channel) +mlan_status wlan_uap_set_channel(pmlan_private pmpriv, + Band_Config_t uap_band_cfg, t_u8 channel) { MrvlIEtypes_channel_band_t tlv_chan_band; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1744,7 +1793,7 @@ memset(pmpriv->adapter, &tlv_chan_band, 0, sizeof(tlv_chan_band)); tlv_chan_band.header.type = TLV_TYPE_UAP_CHAN_BAND_CONFIG; tlv_chan_band.header.len = sizeof(MrvlIEtypes_channel_band_t) - - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); tlv_chan_band.bandcfg = uap_band_cfg; tlv_chan_band.channel = channel; @@ -1761,8 +1810,7 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_uap_get_beacon_dtim(pmlan_private pmpriv) +mlan_status wlan_uap_get_beacon_dtim(pmlan_private pmpriv) { t_u8 tlv_buffer[sizeof(MrvlIEtypes_beacon_period_t) + sizeof(MrvlIEtypes_dtim_period_t)]; @@ -1776,11 +1824,11 @@ ptlv_beacon_pd = (MrvlIEtypes_beacon_period_t *)tlv_buffer; ptlv_beacon_pd->header.type = TLV_TYPE_UAP_BEACON_PERIOD; ptlv_beacon_pd->header.len = sizeof(MrvlIEtypes_beacon_period_t) - - sizeof(MrvlIEtypesHeader_t); + sizeof(MrvlIEtypesHeader_t); ptlv_dtim_pd = (MrvlIEtypes_dtim_period_t - *)(tlv_buffer + sizeof(MrvlIEtypes_beacon_period_t)); + *)(tlv_buffer + sizeof(MrvlIEtypes_beacon_period_t)); ptlv_dtim_pd->header.type = TLV_TYPE_UAP_DTIM_PERIOD; ptlv_dtim_pd->header.len = sizeof(MrvlIEtypes_dtim_period_t) - sizeof(MrvlIEtypesHeader_t); @@ -1792,6 +1840,39 @@ } /** + * @brief Get/Start/Stop/Reset stats + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +static mlan_status wlan_misc_ioctl_stats(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + cmd_action = pioctl_req->action; + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_STATS, cmd_action, 0, + (t_void *)pioctl_req, + (t_void *)&misc->param.stats); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief Set/Get deauth control. * * @param pmadapter A pointer to mlan_adapter structure @@ -1799,9 +1880,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_uap_snmp_mib_ctrl_deauth(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) +static mlan_status wlan_uap_snmp_mib_ctrl_deauth(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1830,6 +1910,43 @@ } /** + * @brief Set/Get channel tracking control. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +static mlan_status wlan_uap_snmp_mib_chan_track(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_snmp_mib *mib = (mlan_ds_snmp_mib *)pioctl_req->pbuf; + t_u16 cmd_action = 0; + + ENTER(); + + mib = (mlan_ds_snmp_mib *)pioctl_req->pbuf; + if (pioctl_req->action == MLAN_ACT_SET) { + cmd_action = HostCmd_ACT_GEN_SET; + } else { + cmd_action = HostCmd_ACT_GEN_GET; + } + + /* Send command to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_SNMP_MIB, cmd_action, + ChanTrackParam_i, (t_void *)pioctl_req, + &mib->param.chan_track); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** * @brief MLAN uap ioctl handler * * @param adapter A pointer to mlan_adapter structure @@ -1837,8 +1954,7 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) { pmlan_adapter pmadapter = (pmlan_adapter)adapter; mlan_status status = MLAN_STATUS_SUCCESS; @@ -1869,8 +1985,8 @@ else if (bss->sub_command == MLAN_OID_BSS_STOP) status = wlan_uap_bss_ioctl_stop(pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_BSS_START) - status = wlan_uap_bss_ioctl_start(pmadapter, - pioctl_req); + status = + wlan_uap_bss_ioctl_start(pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_UAP_BSS_CONFIG) status = wlan_uap_bss_ioctl_config(pmadapter, pioctl_req); @@ -1878,17 +1994,16 @@ status = wlan_uap_bss_ioctl_deauth_sta(pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_UAP_BSS_RESET) - status = wlan_uap_bss_ioctl_reset(pmadapter, - pioctl_req); + status = + wlan_uap_bss_ioctl_reset(pmadapter, pioctl_req); #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) else if (bss->sub_command == MLAN_OID_BSS_ROLE) { - util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter->ioctl_pending_q, - (pmlan_linked_list)pioctl_req, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_enqueue_list_tail( + pmadapter->pmoal_handle, + &pmadapter->ioctl_pending_q, + (pmlan_linked_list)pioctl_req, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); pmadapter->pending_ioctl = MTRUE; status = MLAN_STATUS_PENDING; } @@ -1905,8 +2020,8 @@ status = wlan_uap_bss_ioctl_uap_wmm_param(pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_UAP_SCAN_CHANNELS) - status = wlan_uap_bss_ioctl_uap_scan_channels(pmadapter, - pioctl_req); + status = wlan_uap_bss_ioctl_uap_scan_channels( + pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_UAP_CHANNEL) status = wlan_uap_bss_ioctl_uap_channel(pmadapter, pioctl_req); @@ -1920,8 +2035,8 @@ status = wlan_uap_bss_ioctl_add_station(pmadapter, pioctl_req); else if (bss->sub_command == MLAN_OID_ACTION_CHAN_SWITCH) - status = wlan_uap_bss_ioctl_action_chan_switch - (pmadapter, pioctl_req); + status = wlan_uap_bss_ioctl_action_chan_switch( + pmadapter, pioctl_req); break; #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) case MLAN_IOCTL_SCAN: @@ -1949,8 +2064,8 @@ if (pget_info->sub_command == MLAN_OID_GET_VER_EXT) status = wlan_get_info_ver_ext(pmadapter, pioctl_req); else if (pget_info->sub_command == MLAN_OID_GET_DEBUG_INFO) - status = wlan_get_info_debug_info(pmadapter, - pioctl_req); + status = + wlan_get_info_debug_info(pmadapter, pioctl_req); else if (pget_info->sub_command == MLAN_OID_GET_STATS) status = wlan_uap_get_stats(pmadapter, pioctl_req); else if (pget_info->sub_command == MLAN_OID_GET_UAP_STATS_LOG) @@ -1970,6 +2085,9 @@ pmadapter->fw_release_number; pget_info->param.fw_info.hotfix_version = pmadapter->fw_hotfix_ver; + pget_info->param.fw_info.tx_buf_size = + pmadapter->tx_buf_size; + pget_info->param.fw_info.fw_bands = pmadapter->fw_bands; pget_info->param.fw_info.ecsa_enable = pmadapter->ecsa_enable; @@ -2005,12 +2123,12 @@ pmadapter->hw_he_cap, pmadapter->hw_hecap_len, sizeof(pget_info->param.fw_info.hw_he_cap)); - memcpy_ext(pmadapter, - pget_info->param.fw_info.hw_2g_he_cap, - pmadapter->hw_2g_he_cap, - pmadapter->hw_2g_hecap_len, - sizeof(pget_info->param.fw_info. - hw_2g_he_cap)); + memcpy_ext( + pmadapter, + pget_info->param.fw_info.hw_2g_he_cap, + pmadapter->hw_2g_he_cap, + pmadapter->hw_2g_hecap_len, + sizeof(pget_info->param.fw_info.hw_2g_he_cap)); pget_info->param.fw_info.region_code = pmadapter->region_code; if (pmadapter->otp_region && @@ -2020,33 +2138,49 @@ pget_info->param.fw_info.force_reg = MFALSE; pget_info->param.fw_info.fw_supplicant_support = IS_FW_SUPPORT_SUPPLICANT(pmadapter) ? 0x01 : - 0x00; + 0x00; pget_info->param.fw_info.antinfo = pmadapter->antinfo; pget_info->param.fw_info.max_ap_assoc_sta = pmadapter->max_sta_conn; + pget_info->param.fw_info.uuid_lo = pmadapter->uuid_lo; + pget_info->param.fw_info.uuid_hi = pmadapter->uuid_hi; } else if (pget_info->sub_command == MLAN_OID_LINK_STATS) status = wlan_ioctl_link_statistic(pmpriv, pioctl_req); break; case MLAN_IOCTL_MISC_CFG: misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + if (misc->sub_command == MLAN_OID_MISC_GET_SENSOR_TEMP) { + status = wlan_misc_ioctl_get_sensor_temp(pmadapter, + pioctl_req); + } if (misc->sub_command == MLAN_OID_MISC_INIT_SHUTDOWN) status = wlan_misc_ioctl_init_shutdown(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_SOFT_RESET) status = wlan_uap_misc_ioctl_soft_reset(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_WARM_RESET) { + PRINTM(MCMND, "Request UAP WARM RESET\n"); + util_enqueue_list_tail( + pmadapter->pmoal_handle, + &pmadapter->ioctl_pending_q, + (pmlan_linked_list)pioctl_req, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); + pmadapter->pending_ioctl = MTRUE; + status = MLAN_STATUS_PENDING; + } if (misc->sub_command == MLAN_OID_MISC_HOST_CMD) - status = wlan_misc_ioctl_host_cmd(pmadapter, - pioctl_req); + status = + wlan_misc_ioctl_host_cmd(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_REGION) status = wlan_misc_ioctl_region(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_GEN_IE) status = wlan_uap_misc_ioctl_gen_ie(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_CUSTOM_IE) - status = wlan_misc_ioctl_custom_ie_list(pmadapter, - pioctl_req, - MTRUE); + status = wlan_misc_ioctl_custom_ie_list( + pmadapter, pioctl_req, MTRUE); if (misc->sub_command == MLAN_OID_MISC_TX_DATAPAUSE) status = wlan_uap_misc_ioctl_txdatapause(pmadapter, pioctl_req); @@ -2063,11 +2197,15 @@ if (misc->sub_command == MLAN_OID_MISC_MAC_CONTROL) status = wlan_misc_ioctl_mac_control(pmadapter, pioctl_req); -#ifdef RX_PACKET_COALESCE - if (misc->sub_command == MLAN_OID_MISC_RX_PACKET_COALESCE) - status = wlan_misc_ioctl_rx_pkt_coalesce_config - (pmadapter, pioctl_req); -#endif + if (misc->sub_command == MLAN_OID_MISC_MULTI_CHAN_CFG) + status = wlan_misc_ioctl_multi_chan_config(pmadapter, + pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_MULTI_CHAN_POLICY) + status = wlan_misc_ioctl_multi_chan_policy(pmadapter, + pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_DRCS_CFG) + status = wlan_misc_ioctl_drcs_config(pmadapter, + pioctl_req); #ifdef WIFI_DIRECT_SUPPORT if (misc->sub_command == MLAN_OID_MISC_WIFI_DIRECT_CONFIG) status = wlan_misc_p2p_config(pmadapter, pioctl_req); @@ -2092,13 +2230,23 @@ if (misc->sub_command == MLAN_OID_MISC_IND_RST_CFG) status = wlan_misc_ioctl_ind_rst_cfg(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_MC_AGGR_CFG) + status = wlan_misc_ioctl_mc_aggr_cfg(pmadapter, + pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_STATS) + status = wlan_misc_ioctl_stats(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_CH_LOAD) + status = wlan_misc_ioctl_ch_load(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_CH_LOAD_RESULTS) + status = wlan_misc_ioctl_ch_load_results(pmadapter, + pioctl_req); if (misc->sub_command == MLAN_OID_MISC_GET_TSF) status = wlan_misc_ioctl_get_tsf(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_GET_CHAN_REGION_CFG) status = wlan_misc_chan_reg_cfg(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_OPER_CLASS_CHECK) - status = wlan_misc_ioctl_operclass_validation(pmadapter, - pioctl_req); + status = wlan_misc_ioctl_operclass_validation( + pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_OPER_CLASS) status = wlan_misc_ioctl_oper_class(pmadapter, pioctl_req); @@ -2107,6 +2255,9 @@ pioctl_req); if (misc->sub_command == MLAN_OID_MISC_PER_PKT_CFG) status = wlan_misc_per_pkt_cfg(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_NET_MONITOR) + status = wlan_misc_ioctl_net_monitor(pmadapter, + pioctl_req); if (misc->sub_command == MLAN_OID_MISC_FW_DUMP_EVENT) status = wlan_misc_ioctl_fw_dump_event(pmadapter, pioctl_req); @@ -2120,8 +2271,8 @@ status = wlan_misc_ioctl_tx_ampdu_prot_mode(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_DOT11MC_UNASSOC_FTM_CFG) - status = wlan_misc_ioctl_dot11mc_unassoc_ftm_cfg - (pmadapter, pioctl_req); + status = wlan_misc_ioctl_dot11mc_unassoc_ftm_cfg( + pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_HAL_PHY_CFG) status = wlan_misc_hal_phy_cfg(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_RATE_ADAPT_CFG) @@ -2135,8 +2286,8 @@ if (misc->sub_command == MLAN_OID_MISC_DMCS_CONFIG) status = wlan_misc_dmcs_config(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_GET_TX_RX_HISTOGRAM) - status = wlan_get_tx_rx_histogram(pmadapter, - pioctl_req); + status = + wlan_get_tx_rx_histogram(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_CFP_INFO) status = wlan_get_cfpinfo(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_BOOT_SLEEP) @@ -2161,6 +2312,9 @@ if (misc->sub_command == MLAN_OID_MISC_WACP_MODE) status = wlan_misc_ioctl_wacp_mode(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_COUNTRY_CODE) + status = wlan_misc_ioctl_country_code(pmadapter, + pioctl_req); break; case MLAN_IOCTL_POWER_CFG: power = (mlan_ds_power_cfg *)pioctl_req->pbuf; @@ -2194,6 +2348,12 @@ status = wlan_uap_snmp_mib_11d(pmadapter, pioctl_req); if (snmp->sub_command == MLAN_OID_SNMP_MIB_DOT11H) status = wlan_uap_snmp_mib_11h(pmadapter, pioctl_req); + if (snmp->sub_command == MLAN_OID_SNMP_MIB_DOT11H_FAKERADAR) + status = wlan_uap_snmp_mib_11h_fakeradar(pmadapter, + pioctl_req); + if (snmp->sub_command == MLAN_OID_SNMP_MIB_CHAN_TRACK) + status = wlan_uap_snmp_mib_chan_track(pmadapter, + pioctl_req); break; case MLAN_IOCTL_SEC_CFG: sec = (mlan_ds_sec_cfg *)pioctl_req->pbuf; @@ -2204,8 +2364,8 @@ status = wlan_uap_sec_ioctl_wapi_enable(pmadapter, pioctl_req); if (sec->sub_command == MLAN_OID_SEC_CFG_REPORT_MIC_ERR) - status = wlan_uap_sec_ioctl_report_mic_error(pmadapter, - pioctl_req); + status = wlan_uap_sec_ioctl_report_mic_error( + pmadapter, pioctl_req); break; case MLAN_IOCTL_11N_CFG: status = wlan_11n_cfg_ioctl(pmadapter, pioctl_req); @@ -2215,8 +2375,8 @@ if (cfg11d->sub_command == MLAN_OID_11D_DOMAIN_INFO) status = wlan_uap_domain_info(pmadapter, pioctl_req); else if (cfg11d->sub_command == MLAN_OID_11D_DOMAIN_INFO_EXT) - status = wlan_11d_cfg_domain_info(pmadapter, - pioctl_req); + status = + wlan_11d_cfg_domain_info(pmadapter, pioctl_req); break; case MLAN_IOCTL_11H_CFG: cfg11h = (mlan_ds_11h_cfg *)pioctl_req->pbuf; @@ -2227,17 +2387,25 @@ status = wlan_11h_ioctl_dfs_testing(pmadapter, pioctl_req); if (cfg11h->sub_command == MLAN_OID_11H_CHAN_NOP_INFO) - status = wlan_11h_ioctl_get_channel_nop_info(pmadapter, - pioctl_req); + status = wlan_11h_ioctl_channel_nop_info(pmadapter, + pioctl_req); + if (cfg11h->sub_command == MLAN_OID_11H_NOP_CHAN_LIST) + status = wlan_11h_ioctl_nop_channel_list(pmadapter, + pioctl_req); if (cfg11h->sub_command == MLAN_OID_11H_CHAN_REPORT_REQUEST) status = wlan_11h_ioctl_dfs_chan_report(pmpriv, pioctl_req); if (cfg11h->sub_command == MLAN_OID_11H_CHAN_SWITCH_COUNT) status = wlan_11h_ioctl_chan_switch_count(pmadapter, pioctl_req); + if (cfg11h->sub_command == MLAN_OID_11H_CHAN_DFS_STATE) + status = wlan_11h_ioctl_chan_dfs_state(pmadapter, + pioctl_req); if (cfg11h->sub_command == MLAN_OID_11H_DFS_W53_CFG) status = wlan_11h_ioctl_dfs_w53_cfg(pmadapter, pioctl_req); + if (cfg11h->sub_command == MLAN_OID_11H_DFS_MODE) + status = wlan_11h_ioctl_dfs_mode(pmadapter, pioctl_req); break; case MLAN_IOCTL_RADIO_CFG: radiocfg = (mlan_ds_radio_cfg *)pioctl_req->pbuf; @@ -2251,8 +2419,8 @@ status = wlan_radio_ioctl_remain_chan_cfg(pmadapter, pioctl_req); if (radiocfg->sub_command == MLAN_OID_ANT_CFG) - status = wlan_radio_ioctl_ant_cfg(pmadapter, - pioctl_req); + status = + wlan_radio_ioctl_ant_cfg(pmadapter, pioctl_req); if (radiocfg->sub_command == MLAN_OID_BAND_CFG) status = wlan_radio_ioctl_band_cfg(pmadapter, pioctl_req);
diff --git a/wlan_sd8987/mlan/mlan_uap_txrx.c b/wlan_sd8987/mlan/mlan_uap_txrx.c index 3a98e52..1fe11f7 100755 --- a/wlan_sd8987/mlan/mlan_uap_txrx.c +++ b/wlan_sd8987/mlan/mlan_uap_txrx.c
@@ -53,8 +53,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) +static mlan_status wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, + pmlan_buffer pmbuf) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef DEBUG_LEVEL1 @@ -113,8 +113,7 @@ * @return MLAN_STATUS_FAILURE -- drop packet, otherwise forward to * network stack */ -static mlan_status -wlan_check_unicast_packet(mlan_private *priv, t_u8 *mac) +static mlan_status wlan_check_unicast_packet(mlan_private *priv, t_u8 *mac) { int j; sta_node *sta_ptr = MNULL; @@ -150,7 +149,6 @@ LEAVE(); return ret; } - /******************************************************** Global Functions ********************************************************/ @@ -162,8 +160,7 @@ * * @return headptr or MNULL */ -t_void * -wlan_ops_uap_process_txpd(t_void *priv, pmlan_buffer pmbuf) +t_void *wlan_ops_uap_process_txpd(t_void *priv, pmlan_buffer pmbuf) { pmlan_private pmpriv = (pmlan_private)priv; TxPD *plocal_tx_pd; @@ -204,7 +201,7 @@ /* head_ptr should be aligned */ head_ptr = pmbuf->pbuf + pmbuf->data_offset - sizeof(TxPD) - - pmpriv->intf_hr_len; + pmpriv->intf_hr_len; head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1))); plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len); @@ -227,8 +224,7 @@ * cause the default value to be used later in this function */ plocal_tx_pd->tx_control = - pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd-> - priority]; + pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd->priority]; if (pmbuf->flags & MLAN_BUF_FLAG_TX_STATUS) { plocal_tx_pd->tx_control_1 |= pmbuf->tx_seq_num << 8; @@ -236,9 +232,9 @@ } /* Offset of actual data */ - plocal_tx_pd->tx_pkt_offset = (t_u16)((t_ptr)pmbuf->pbuf + - pmbuf->data_offset - - (t_ptr)plocal_tx_pd); + plocal_tx_pd->tx_pkt_offset = + (t_u16)((t_ptr)pmbuf->pbuf + pmbuf->data_offset - + (t_ptr)plocal_tx_pd); if (!plocal_tx_pd->tx_control) { /* TxCtrl set by user or default */ @@ -256,8 +252,9 @@ pmbuf->pbuf + pmbuf->data_offset, sizeof(dst_mac), sizeof(dst_mac)); plocal_tx_pd->tx_control |= - (wlan_ieee_rateid_to_mrvl_rateid - (pmpriv, pmbuf->u.tx_info.data_rate, dst_mac) + (wlan_ieee_rateid_to_mrvl_rateid( + pmpriv, pmbuf->u.tx_info.data_rate, + dst_mac) << 16); plocal_tx_pd->tx_control |= TXPD_TXRATE_ENABLE; } @@ -271,10 +268,41 @@ (t_u32)pmbuf->u.tx_info.tx_power.val; if (pmbuf->u.tx_info.retry_limit) { plocal_tx_pd->tx_control |= pmbuf->u.tx_info.retry_limit - << 8; + << 8; plocal_tx_pd->tx_control |= TXPD_RETRY_ENABLE; } } + if (pmbuf->flags & MLAN_BUF_FLAG_MC_AGGR_PKT) { + tx_ctrl *ctrl = (tx_ctrl *)&plocal_tx_pd->tx_control; + mc_tx_ctrl *mc_ctrl = + (mc_tx_ctrl *)&plocal_tx_pd->pkt_delay_2ms; + plocal_tx_pd->tx_pkt_type = PKT_TYPE_802DOT11_MC_AGGR; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_START_CYCLE) + ctrl->mc_cycle_start = MTRUE; + else + ctrl->mc_cycle_start = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_END_CYCLE) + ctrl->mc_cycle_end = MTRUE; + else + ctrl->mc_cycle_end = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_START_AMPDU) + ctrl->mc_ampdu_start = MTRUE; + else + ctrl->mc_ampdu_start = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_END_AMPDU) + ctrl->mc_ampdu_end = MTRUE; + else + ctrl->mc_ampdu_end = MFALSE; + if (pmbuf->u.mc_tx_info.mc_pkt_flags & MC_FLAG_RETRY) + ctrl->mc_pkt_retry = MTRUE; + else + ctrl->mc_pkt_retry = MFALSE; + ctrl->bw = pmbuf->u.mc_tx_info.bandwidth & 0x7; + ctrl->tx_rate = pmbuf->u.mc_tx_info.mcs_index & 0x1f; + mc_ctrl->abs_tsf_expirytime = + wlan_cpu_to_le32(pmbuf->u.mc_tx_info.pkt_expiry); + mc_ctrl->mc_seq = wlan_cpu_to_le16(pmbuf->u.mc_tx_info.seq_num); + } endian_convert_TxPD(plocal_tx_pd); @@ -297,8 +325,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_ops_uap_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) +mlan_status wlan_ops_uap_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) { pmlan_adapter pmadapter = (pmlan_adapter)adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -311,7 +338,7 @@ t_u16 rx_pkt_type = 0; sta_node *sta_ptr = MNULL; #ifdef DRV_EMBEDDED_AUTHENTICATOR - t_u8 eapol_type[2] = { 0x88, 0x8e }; + t_u8 eapol_type[2] = {0x88, 0x8e}; #endif t_u16 adj_rx_rate = 0; t_u8 antenna = 0; @@ -326,11 +353,15 @@ /* Endian conversion */ endian_convert_RxPD(prx_pd); + if (prx_pd->flags & RXPD_FLAG_EXTRA_HEADER) { + endian_convert_RxPD_extra_header( + (rxpd_extra_info *)((t_u8 *)prx_pd + sizeof(*prx_pd))); + } + if (priv->adapter->pcard_info->v14_fw_api) { t_u8 rxpd_rate_info_orig = prx_pd->rate_info; - prx_pd->rate_info = - wlan_convert_v14_rx_rate_info(priv, - rxpd_rate_info_orig); + prx_pd->rate_info = wlan_convert_v14_rx_rate_info( + priv, rxpd_rate_info_orig); PRINTM(MINFO, "UAP RX: v14_fw_api=%d rx_rate =%d rxpd_rate_info=0x%x->0x%x\n", priv->adapter->pcard_info->v14_fw_api, prx_pd->rx_rate, @@ -381,18 +412,16 @@ puap_pkt_hdr->frm_len = wlan_le16_to_cpu(puap_pkt_hdr->frm_len); if ((puap_pkt_hdr->wlan_header.frm_ctl & IEEE80211_FC_MGMT_FRAME_TYPE_MASK) == 0) - wlan_process_802dot11_mgmt_pkt(pmadapter-> - priv[pmbuf->bss_index], - (t_u8 *)&puap_pkt_hdr-> - wlan_header, - puap_pkt_hdr->frm_len + - sizeof(wlan_mgmt_pkt) - - sizeof(puap_pkt_hdr-> - frm_len), - (RxPD *)prx_pd); + wlan_process_802dot11_mgmt_pkt( + pmadapter->priv[pmbuf->bss_index], + (t_u8 *)&puap_pkt_hdr->wlan_header, + puap_pkt_hdr->frm_len + sizeof(wlan_mgmt_pkt) - + sizeof(puap_pkt_hdr->frm_len), + (RxPD *)prx_pd); pmadapter->ops.data_complete(pmadapter, pmbuf, ret); goto done; } + if (rx_pkt_type != PKT_TYPE_BAR) { priv->rxpd_rate = prx_pd->rx_rate; priv->rxpd_rate_info = prx_pd->rate_info; @@ -400,17 +429,11 @@ if (priv->bss_type == MLAN_BSS_TYPE_UAP) { antenna = wlan_adjust_antenna(priv, (RxPD *)prx_pd); - adj_rx_rate = - wlan_adjust_data_rate(priv, priv->rxpd_rate, - priv->rxpd_rate_info); - pmadapter->callbacks.moal_hist_data_add(pmadapter-> - pmoal_handle, - pmbuf-> - bss_index, - adj_rx_rate, - prx_pd->snr, - prx_pd->nf, - antenna); + adj_rx_rate = wlan_adjust_data_rate( + priv, priv->rxpd_rate, priv->rxpd_rate_info); + pmadapter->callbacks.moal_hist_data_add( + pmadapter->pmoal_handle, pmbuf->bss_index, + adj_rx_rate, prx_pd->snr, prx_pd->nf, antenna); } } @@ -418,22 +441,24 @@ if (sta_ptr) { sta_ptr->snr = prx_pd->snr; sta_ptr->nf = prx_pd->nf; - pmadapter->callbacks.moal_get_system_time(pmadapter-> - pmoal_handle, - &last_rx_sec, - &last_rx_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &last_rx_sec, &last_rx_usec); sta_ptr->stats.last_rx_in_msec = - (t_u64)last_rx_sec *1000 + (t_u64)last_rx_usec / 1000; + (t_u64)last_rx_sec * 1000 + (t_u64)last_rx_usec / 1000; + if (rx_pkt_type != PKT_TYPE_BAR) { + sta_ptr->stats.rx_packets++; + sta_ptr->stats.rx_bytes += prx_pd->rx_pkt_length; + } } + #ifdef DRV_EMBEDDED_AUTHENTICATOR /**process eapol packet for uap*/ if (IsAuthenticatorEnabled(priv->psapriv) && (!memcmp(pmadapter, &prx_pkt->eth803_hdr.h803_len, eapol_type, sizeof(eapol_type)))) { - ret = AuthenticatorProcessEapolPacket(priv->psapriv, - ((t_u8 *)prx_pd + - prx_pd->rx_pkt_offset), - prx_pd->rx_pkt_length); + ret = AuthenticatorProcessEapolPacket( + priv->psapriv, ((t_u8 *)prx_pd + prx_pd->rx_pkt_offset), + prx_pd->rx_pkt_length); if (ret == MLAN_STATUS_SUCCESS) { pmadapter->ops.data_complete(pmadapter, pmbuf, ret); goto done; @@ -442,6 +467,11 @@ #endif pmbuf->priority |= prx_pd->priority; + if (pmadapter->enable_net_mon && + (prx_pd->rx_pkt_type == PKT_TYPE_802DOT11)) { + wlan_process_uap_rx_packet(priv, pmbuf); + goto done; + } memcpy_ext(pmadapter, ta, prx_pkt->eth803_hdr.src_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); if ((rx_pkt_type != PKT_TYPE_BAR) && (prx_pd->priority < MAX_NUM_TID)) { @@ -453,12 +483,10 @@ } } /* check if UAP enable 11n */ - if (!priv->is_11n_enabled || + if ((!priv->is_11n_enabled && !priv->is_11ax_enabled) || (!wlan_11n_get_rxreorder_tbl((mlan_private *)priv, prx_pd->priority, - ta) - && (prx_pd->rx_pkt_type != PKT_TYPE_AMSDU) - ) - ) { + ta) && + (prx_pd->rx_pkt_type != PKT_TYPE_AMSDU))) { if (priv->pkt_fwd) wlan_process_uap_rx_packet(priv, pmbuf); else @@ -486,8 +514,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_uap_recv_packet(mlan_private *priv, pmlan_buffer pmbuf) +mlan_status wlan_uap_recv_packet(mlan_private *priv, pmlan_buffer pmbuf) { pmlan_adapter pmadapter = priv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -505,16 +532,16 @@ MAC2STR(prx_pkt->eth803_hdr.dest_addr)); /* don't do packet forwarding in disconnected state */ - if ((priv->media_connected == MFALSE) || - (pmbuf->data_len > MV_ETH_FRAME_LEN)) + if (priv->media_connected == MFALSE) goto upload; if (prx_pkt->eth803_hdr.dest_addr[0] & 0x01) { if (!(priv->pkt_fwd & PKT_FWD_INTRA_BCAST)) { /* Multicast pkt */ - newbuf = wlan_alloc_mlan_buffer(pmadapter, - MLAN_TX_DATA_BUF_SIZE_2K, - 0, MOAL_MALLOC_BUFFER); + newbuf = + wlan_alloc_mlan_buffer(pmadapter, + MLAN_TX_DATA_BUF_SIZE_2K, + 0, MOAL_MALLOC_BUFFER); if (newbuf) { newbuf->bss_index = pmbuf->bss_index; newbuf->buf_type = pmbuf->buf_type; @@ -524,37 +551,34 @@ newbuf->data_offset = (sizeof(TxPD) + priv->intf_hr_len + DMA_ALIGNMENT); - util_scalar_increment(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_increment( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF; /* copy the data */ memcpy_ext(pmadapter, (t_u8 *)newbuf->pbuf + - newbuf->data_offset, + newbuf->data_offset, pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len, MLAN_TX_DATA_BUF_SIZE_2K); newbuf->data_len = pmbuf->data_len; wlan_wmm_add_buf_txqueue(pmadapter, newbuf); - if (util_scalar_read(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock) > + if (util_scalar_read( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock) > RX_HIGH_THRESHOLD) wlan_drop_tx_pkts(priv); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } } } else { @@ -562,9 +586,10 @@ (wlan_get_station_entry(priv, prx_pkt->eth803_hdr.dest_addr))) { /* Intra BSS packet */ - newbuf = wlan_alloc_mlan_buffer(pmadapter, - MLAN_TX_DATA_BUF_SIZE_2K, - 0, MOAL_MALLOC_BUFFER); + newbuf = + wlan_alloc_mlan_buffer(pmadapter, + MLAN_TX_DATA_BUF_SIZE_2K, + 0, MOAL_MALLOC_BUFFER); if (newbuf) { newbuf->bss_index = pmbuf->bss_index; newbuf->buf_type = pmbuf->buf_type; @@ -574,42 +599,38 @@ newbuf->data_offset = (sizeof(TxPD) + priv->intf_hr_len + DMA_ALIGNMENT); - util_scalar_increment(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_increment( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF; /* copy the data */ memcpy_ext(pmadapter, (t_u8 *)newbuf->pbuf + - newbuf->data_offset, + newbuf->data_offset, pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len, MLAN_TX_DATA_BUF_SIZE_2K); newbuf->data_len = pmbuf->data_len; wlan_wmm_add_buf_txqueue(pmadapter, newbuf); - if (util_scalar_read(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock) > + if (util_scalar_read( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock) > RX_HIGH_THRESHOLD) wlan_drop_tx_pkts(priv); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } goto done; } else if (MLAN_STATUS_FAILURE == - wlan_check_unicast_packet(priv, - prx_pkt->eth803_hdr. - dest_addr)) { + wlan_check_unicast_packet( + priv, prx_pkt->eth803_hdr.dest_addr)) { /* drop packet */ PRINTM(MDATA, "Drop AMSDU dest " MACSTR "\n", MAC2STR(prx_pkt->eth803_hdr.dest_addr)); @@ -634,8 +655,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_process_uap_rx_packet(mlan_private *priv, pmlan_buffer pmbuf) +mlan_status wlan_process_uap_rx_packet(mlan_private *priv, pmlan_buffer pmbuf) { pmlan_adapter pmadapter = priv->adapter; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -661,18 +681,25 @@ PRINTM(MDATA, "Rx dest " MACSTR "\n", MAC2STR(prx_pkt->eth803_hdr.dest_addr)); + if (pmadapter->enable_net_mon) { + if (prx_pd->rx_pkt_type == PKT_TYPE_802DOT11) { + pmbuf->flags |= MLAN_BUF_FLAG_NET_MONITOR; + goto upload; + } + } + /* don't do packet forwarding in disconnected state */ /* don't do packet forwarding when packet > 1514 */ - if ((priv->media_connected == MFALSE) || - ((pmbuf->data_len - prx_pd->rx_pkt_offset) > MV_ETH_FRAME_LEN)) + if (priv->media_connected == MFALSE) goto upload; if (prx_pkt->eth803_hdr.dest_addr[0] & 0x01) { if (!(priv->pkt_fwd & PKT_FWD_INTRA_BCAST)) { /* Multicast pkt */ - newbuf = wlan_alloc_mlan_buffer(pmadapter, - MLAN_TX_DATA_BUF_SIZE_2K, - 0, MOAL_MALLOC_BUFFER); + newbuf = + wlan_alloc_mlan_buffer(pmadapter, + MLAN_TX_DATA_BUF_SIZE_2K, + 0, MOAL_MALLOC_BUFFER); if (newbuf) { newbuf->bss_index = pmbuf->bss_index; newbuf->buf_type = pmbuf->buf_type; @@ -682,39 +709,36 @@ newbuf->data_offset = (sizeof(TxPD) + priv->intf_hr_len + DMA_ALIGNMENT); - util_scalar_increment(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_increment( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF; /* copy the data, skip rxpd */ memcpy_ext(pmadapter, (t_u8 *)newbuf->pbuf + - newbuf->data_offset, + newbuf->data_offset, pmbuf->pbuf + pmbuf->data_offset + - prx_pd->rx_pkt_offset, + prx_pd->rx_pkt_offset, pmbuf->data_len - - prx_pd->rx_pkt_offset, + prx_pd->rx_pkt_offset, MLAN_TX_DATA_BUF_SIZE_2K); newbuf->data_len = pmbuf->data_len - prx_pd->rx_pkt_offset; wlan_wmm_add_buf_txqueue(pmadapter, newbuf); - if (util_scalar_read(pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock) > + if (util_scalar_read( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock) > RX_HIGH_THRESHOLD) wlan_drop_tx_pkts(priv); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } } } else { @@ -725,10 +749,10 @@ #ifdef USB if (IS_USB(pmadapter->card_type)) { if (pmbuf->flags & MLAN_BUF_FLAG_RX_DEAGGR) { - newbuf = wlan_alloc_mlan_buffer - (pmadapter, - MLAN_TX_DATA_BUF_SIZE_2K, 0, - MOAL_MALLOC_BUFFER); + newbuf = wlan_alloc_mlan_buffer( + pmadapter, + MLAN_TX_DATA_BUF_SIZE_2K, 0, + MOAL_MALLOC_BUFFER); if (newbuf) { newbuf->bss_index = pmbuf->bss_index; @@ -744,59 +768,50 @@ (sizeof(TxPD) + priv->intf_hr_len + DMA_ALIGNMENT); - util_scalar_increment - (pmadapter-> - pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_increment( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks + .moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock); newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF; /* copy the data, skip rxpd */ - memcpy_ext(pmadapter, - (t_u8 *)newbuf-> - pbuf + - newbuf->data_offset, - pmbuf->pbuf + - pmbuf->data_offset + - prx_pd-> - rx_pkt_offset, - pmbuf->data_len - - prx_pd-> - rx_pkt_offset, - pmbuf->data_len - - prx_pd-> - rx_pkt_offset); + memcpy_ext( + pmadapter, + (t_u8 *)newbuf->pbuf + + newbuf->data_offset, + pmbuf->pbuf + + pmbuf->data_offset + + prx_pd->rx_pkt_offset, + pmbuf->data_len - + prx_pd->rx_pkt_offset, + pmbuf->data_len - + prx_pd->rx_pkt_offset); newbuf->data_len = pmbuf->data_len - prx_pd->rx_pkt_offset; - wlan_wmm_add_buf_txqueue - (pmadapter, newbuf); - if (util_scalar_read - (pmadapter->pmoal_handle, - &pmadapter-> - pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock) > + wlan_wmm_add_buf_txqueue( + pmadapter, newbuf); + if (util_scalar_read( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks + .moal_spin_lock, + pmadapter->callbacks + .moal_spin_unlock) > RX_HIGH_THRESHOLD) wlan_drop_tx_pkts(priv); - wlan_recv_event(priv, - MLAN_EVENT_ID_DRV_DEFER_HANDLING, - MNULL); + wlan_recv_event( + priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); } - pmadapter->callbacks. - moal_recv_complete(pmadapter-> - pmoal_handle, - pmbuf, - pmadapter-> - rx_data_ep, - ret); + pmadapter->callbacks.moal_recv_complete( + pmadapter->pmoal_handle, pmbuf, + pmadapter->rx_data_ep, ret); goto done; } } @@ -804,28 +819,25 @@ pmbuf->data_len -= prx_pd->rx_pkt_offset; pmbuf->data_offset += prx_pd->rx_pkt_offset; pmbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF; - util_scalar_increment(pmadapter->pmoal_handle, - &pmadapter->pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock); + util_scalar_increment( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); wlan_wmm_add_buf_txqueue(pmadapter, pmbuf); - if (util_scalar_read(pmadapter->pmoal_handle, - &pmadapter->pending_bridge_pkts, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock) > + if (util_scalar_read( + pmadapter->pmoal_handle, + &pmadapter->pending_bridge_pkts, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock) > RX_HIGH_THRESHOLD) wlan_drop_tx_pkts(priv); wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL); goto done; } else if (MLAN_STATUS_FAILURE == - wlan_check_unicast_packet(priv, - prx_pkt->eth803_hdr. - dest_addr)) { + wlan_check_unicast_packet( + priv, prx_pkt->eth803_hdr.dest_addr)) { PRINTM(MDATA, "Drop Pkts: Rx dest " MACSTR "\n", MAC2STR(prx_pkt->eth803_hdr.dest_addr)); pmbuf->status_code = MLAN_ERROR_PKT_INVALID; @@ -847,6 +859,14 @@ PRINTM(MDATA, "%lu.%06lu : Data => kernel seq_num=%d tid=%d\n", pmbuf->out_ts_sec, pmbuf->out_ts_usec, prx_pd->seq_num, prx_pd->priority); + if (pmbuf->flags & MLAN_BUF_FLAG_NET_MONITOR) { + // Use some rxpd space to save rxpd info for radiotap header + // We should insure radiotap_info is not bigger than RxPD + wlan_rxpdinfo_to_radiotapinfo( + priv, (RxPD *)prx_pd, + (radiotap_info *)(pmbuf->pbuf + pmbuf->data_offset - + sizeof(radiotap_info))); + } ret = pmadapter->callbacks.moal_recv_packet(pmadapter->pmoal_handle, pmbuf);
diff --git a/wlan_sd8987/mlan/mlan_usb.c b/wlan_sd8987/mlan/mlan_usb.c index 98232f0..48be972 100755 --- a/wlan_sd8987/mlan/mlan_usb.c +++ b/wlan_sd8987/mlan/mlan_usb.c
@@ -93,6 +93,16 @@ }; #endif +#ifdef USBNW62X +static const struct _mlan_card_info mlan_card_info_usbNW62X = { + .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, + .v16_fw_api = 1, + .v17_fw_api = 1, + .supp_ps_handshake = 1, + .default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2, +}; +#endif + /******************************************************** Global Variables ********************************************************/ @@ -108,8 +118,8 @@ * @param rev_id A pointer to chip revision id * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_usb_check_revision(mlan_adapter *pmadapter, t_u32 *rev_id) +static mlan_status wlan_usb_check_revision(mlan_adapter *pmadapter, + t_u32 *rev_id) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -183,8 +193,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter, pmlan_fw_image pmfw) +static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter, + pmlan_fw_image pmfw) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; @@ -245,6 +255,11 @@ if (IS_USB9097(pmadapter->card_type)) check_fw_status = MTRUE; #endif +#if defined(USBNW62X) + if (IS_USBNW62X(pmadapter->card_type)) + check_fw_status = MTRUE; +#endif + do { /* Send pseudo data to check winner status first */ if (check_winner) { @@ -260,11 +275,10 @@ sizeof(FWHeader), sizeof(fwdata->fw_header)); else - pcb->moal_get_fw_data(pmadapter->pmoal_handle, - TotalBytes, - sizeof(FWHeader), - (t_u8 *)&fwdata-> - fw_header); + pcb->moal_get_fw_data( + pmadapter->pmoal_handle, TotalBytes, + sizeof(FWHeader), + (t_u8 *)&fwdata->fw_header); DataLength = wlan_le32_to_cpu(fwdata->fw_header.data_length); @@ -307,10 +321,10 @@ mbuf.pbuf = (t_u8 *)fwdata; mbuf.data_len = length; /* Send the firmware block */ - ret = pcb->moal_write_data_sync(pmadapter->pmoal_handle, - &mbuf, - pmadapter->tx_cmd_ep, - MLAN_USB_BULK_MSG_TIMEOUT); + ret = pcb->moal_write_data_sync( + pmadapter->pmoal_handle, &mbuf, + pmadapter->tx_cmd_ep, + MLAN_USB_BULK_MSG_TIMEOUT); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "fw_dnld: write_data failed, ret %d\n", @@ -323,10 +337,10 @@ mbuf.data_len = FW_DNLD_RX_BUF_SIZE; /* Receive the firmware block response */ - ret = pcb->moal_read_data_sync(pmadapter->pmoal_handle, - &mbuf, - pmadapter->rx_cmd_ep, - MLAN_USB_BULK_MSG_TIMEOUT); + ret = pcb->moal_read_data_sync( + pmadapter->pmoal_handle, &mbuf, + pmadapter->rx_cmd_ep, + MLAN_USB_BULK_MSG_TIMEOUT); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "fw_dnld: read_data failed, ret %d\n", @@ -352,6 +366,16 @@ break; } + if (check_fw_status && + (SyncFWHeader.status & MBIT(9))) { + PRINTM(MERROR, + "FW received Blk with SE_BOOT error 0x%x\n", + SyncFWHeader.status); + retries = 0; + ret = MLAN_STATUS_FAILURE; + break; + } + /* Check the firmware block response for CRC errors */ if (SyncFWHeader.cmd) { /* Check firmware block response for CRC and MIC @@ -420,9 +444,8 @@ * * @return Number of packets */ -static int -wlan_usb_deaggr_rx_num_pkts(pmlan_adapter pmadapter, t_u8 *pdata, - int aggr_pkt_len) +static int wlan_usb_deaggr_rx_num_pkts(pmlan_adapter pmadapter, t_u8 *pdata, + int aggr_pkt_len) { int pkt_count = 0, pkt_len; RxPD *prx_pd; @@ -431,23 +454,22 @@ while (aggr_pkt_len >= (int)sizeof(RxPD)) { prx_pd = (RxPD *)pdata; pkt_len = wlan_le16_to_cpu(prx_pd->rx_pkt_length) + - wlan_le16_to_cpu(prx_pd->rx_pkt_offset); - if (pkt_len == 0) /* blank RxPD can be at the end */ + wlan_le16_to_cpu(prx_pd->rx_pkt_offset); + if (pkt_len == 0) /* blank RxPD can be at the end */ break; ++pkt_count; - if (aggr_pkt_len == pkt_len) /* last packet has no padding */ + if (aggr_pkt_len == pkt_len) /* last packet has no padding */ break; /* skip padding and goto next */ if (pkt_len % pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.aggr_align) pkt_len += - (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_align - - (pkt_len % - pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_align)); + (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl + .aggr_align - + (pkt_len % pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align)); aggr_pkt_len -= pkt_len; pdata += pkt_len; } @@ -455,12 +477,13 @@ return pkt_count; } -static inline t_u32 -usb_tx_aggr_pad_len(t_u32 len, usb_tx_aggr_params *pusb_tx_aggr) +static inline t_u32 usb_tx_aggr_pad_len(t_u32 len, + usb_tx_aggr_params *pusb_tx_aggr) { return (len % pusb_tx_aggr->aggr_ctrl.aggr_align) ? - (len + (pusb_tx_aggr->aggr_ctrl.aggr_align - - (len % pusb_tx_aggr->aggr_ctrl.aggr_align))) : len; + (len + (pusb_tx_aggr->aggr_ctrl.aggr_align - + (len % pusb_tx_aggr->aggr_ctrl.aggr_align))) : + len; } /** @@ -483,7 +506,7 @@ usb_tx_aggr_pad_len(pmbuf_aggr->data_len, pusb_tx_aggr); memcpy_ext(pmadapter, pmbuf_aggr->pbuf + pmbuf_aggr->data_offset + - pmbuf_aggr->data_len, + pmbuf_aggr->data_len, pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len, pmbuf->data_len); pmbuf_aggr->data_len += pmbuf->data_len; @@ -515,11 +538,11 @@ usb_tx_aggr_pad_len(pmbuf_aggr->data_len, pusb_tx_aggr); memcpy_ext(pmadapter, pmbuf_aggr->pbuf + pmbuf_aggr->data_offset + - pmbuf_aggr->data_len, + pmbuf_aggr->data_len, pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len, pmbuf->data_len); payload = pmbuf_aggr->pbuf + pmbuf_aggr->data_offset + - pmbuf_aggr->data_len; + pmbuf_aggr->data_len; if (last) { offset = pmbuf->data_len; *(t_u16 *)&payload[2] = @@ -566,15 +589,15 @@ if (pusb_tx_aggr->aggr_ctrl.aggr_mode == MLAN_USB_AGGR_MODE_LEN_V2) { if (i == use_count) - wlan_usb_tx_copy_buf_to_aggr_v2 - (pmadapter, pmbuf_aggr, - pmbuf_curr, MTRUE, - pusb_tx_aggr); + wlan_usb_tx_copy_buf_to_aggr_v2( + pmadapter, pmbuf_aggr, + pmbuf_curr, MTRUE, + pusb_tx_aggr); else - wlan_usb_tx_copy_buf_to_aggr_v2 - (pmadapter, pmbuf_aggr, - pmbuf_curr, MFALSE, - pusb_tx_aggr); + wlan_usb_tx_copy_buf_to_aggr_v2( + pmadapter, pmbuf_aggr, + pmbuf_curr, MFALSE, + pusb_tx_aggr); } else wlan_usb_tx_copy_buf_to_aggr(pmadapter, pmbuf_aggr, @@ -618,8 +641,8 @@ * @param pmadapter Pointer to mlan_adapter structure * @param pusb_tx_aggr Pointer to usb_tx_aggr_params */ -static inline t_void -wlan_usb_tx_send_aggr(pmlan_adapter pmadapter, usb_tx_aggr_params *pusb_tx_aggr) +static inline t_void wlan_usb_tx_send_aggr(pmlan_adapter pmadapter, + usb_tx_aggr_params *pusb_tx_aggr) { mlan_status ret; pmlan_buffer pmbuf_aggr = pusb_tx_aggr->pmbuf_aggr; @@ -665,12 +688,11 @@ } if (pmbuf_aggr && pmbuf_aggr->data_len) { - pmadapter->data_sent = MTRUE; - ret = pmadapter->callbacks.moal_write_data_async(pmadapter-> - pmoal_handle, - pmbuf_aggr, - pusb_tx_aggr-> - port); + wlan_update_port_status(pmadapter, pusb_tx_aggr->port, MTRUE); + pmadapter->data_sent = wlan_usb_data_sent(pmadapter); + ret = pmadapter->callbacks.moal_write_data_async( + pmadapter->pmoal_handle, pmbuf_aggr, + pusb_tx_aggr->port); switch (ret) { case MLAN_STATUS_PRESOURCE: PRINTM(MINFO, "MLAN_STATUS_PRESOURCE is returned\n"); @@ -689,6 +711,8 @@ wlan_write_data_complete(pmadapter, pmbuf_aggr, ret); break; case MLAN_STATUS_FAILURE: + wlan_update_port_status(pmadapter, pusb_tx_aggr->port, + MFALSE); pmadapter->data_sent = MFALSE; PRINTM(MERROR, "Error: moal_write_data_async failed: 0x%X\n", @@ -698,6 +722,8 @@ wlan_write_data_complete(pmadapter, pmbuf_aggr, ret); break; case MLAN_STATUS_PENDING: + wlan_update_port_status(pmadapter, pusb_tx_aggr->port, + MFALSE); pmadapter->data_sent = MFALSE; break; case MLAN_STATUS_SUCCESS: @@ -724,8 +750,7 @@ * @param pmadapter A pointer to mlan_adapter structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_get_usb_device(pmlan_adapter pmadapter) +mlan_status wlan_get_usb_device(pmlan_adapter pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u16 card_type = pmadapter->card_type; @@ -773,6 +798,11 @@ pmadapter->pcard_info = &mlan_card_info_usb9097; break; #endif +#ifdef USBNW62X + case CARD_TYPE_USBNW62X: + pmadapter->pcard_info = &mlan_card_info_usbNW62X; + break; +#endif default: PRINTM(MERROR, "can't get right USB card type \n"); ret = MLAN_STATUS_FAILURE; @@ -791,8 +821,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_usb_dnld_fw(pmlan_adapter pmadapter, pmlan_fw_image pmfw) +static mlan_status wlan_usb_dnld_fw(pmlan_adapter pmadapter, + pmlan_fw_image pmfw) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -816,10 +846,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf) +mlan_status wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { - const t_u8 zero_rx_pd[sizeof(RxPD)] = { 0 }; + const t_u8 zero_rx_pd[sizeof(RxPD)] = {0}; mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 curr_pkt_len; RxPD *prx_pd; @@ -832,7 +861,7 @@ pdata = pmbuf->pbuf + pmbuf->data_offset; prx_pd = (RxPD *)pdata; curr_pkt_len = wlan_le16_to_cpu(prx_pd->rx_pkt_length) + - wlan_le16_to_cpu(prx_pd->rx_pkt_offset); + wlan_le16_to_cpu(prx_pd->rx_pkt_offset); /* if non-aggregate, just send through, don’t process here */ aggr_len = pmbuf->data_len; if ((aggr_len == (t_s32)curr_pkt_len) || @@ -884,18 +913,17 @@ /* round up to next block boundary */ if (curr_pkt_len % pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.aggr_align) - curr_pkt_len += - (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_align - - (curr_pkt_len % - pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl. - aggr_align)); + curr_pkt_len += (pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align - + (curr_pkt_len % + pmadapter->pcard_usb->usb_rx_deaggr + .aggr_ctrl.aggr_align)); /* point to next packet */ aggr_len -= curr_pkt_len; pdata += curr_pkt_len; prx_pd = (RxPD *)pdata; curr_pkt_len = wlan_le16_to_cpu(prx_pd->rx_pkt_length) + - wlan_le16_to_cpu(prx_pd->rx_pkt_offset); + wlan_le16_to_cpu(prx_pd->rx_pkt_offset); } /* free original pmbuf (since not sent for processing) */ @@ -913,9 +941,8 @@ * * @return MTRUE/MFALSE */ -static t_u8 -wlan_is_port_tx_paused(pmlan_adapter pmadapter, - usb_tx_aggr_params *pusb_tx_aggr) +static t_u8 wlan_is_port_tx_paused(pmlan_adapter pmadapter, + usb_tx_aggr_params *pusb_tx_aggr) { mlan_private *pmpriv = MNULL; t_u8 i; @@ -938,20 +965,21 @@ * @param function_context A pointer to function_context * @return N/A */ -t_void -wlan_usb_tx_aggr_timeout_func(t_void *function_context) +t_void wlan_usb_tx_aggr_timeout_func(t_void *function_context) { usb_tx_aggr_params *pusb_tx_aggr = (usb_tx_aggr_params *)function_context; + t_u8 port_index = 0; pmlan_adapter pmadapter = (mlan_adapter *)pusb_tx_aggr->phandle; pmlan_callbacks pcb = &pmadapter->callbacks; ENTER(); pcb->moal_spin_lock(pmadapter->pmoal_handle, pusb_tx_aggr->paggr_lock); pusb_tx_aggr->aggr_hold_timer_is_set = MFALSE; - if (pusb_tx_aggr->pmbuf_aggr && !pmadapter->data_sent - && !wlan_is_port_tx_paused(pmadapter, pusb_tx_aggr) - ) + port_index = wlan_get_port_index(pmadapter, pusb_tx_aggr->port); + if (pusb_tx_aggr->pmbuf_aggr && + wlan_is_port_ready(pmadapter, port_index) && + !wlan_is_port_tx_paused(pmadapter, pusb_tx_aggr)) wlan_usb_tx_send_aggr(pmadapter, pusb_tx_aggr); pcb->moal_spin_unlock(pmadapter->pmoal_handle, pusb_tx_aggr->paggr_lock); @@ -975,11 +1003,10 @@ * in order to handle complete AFTER the aggregate is sent. * pmbuf_aggr->data_len is used to keep track of bytes aggregated so far. */ -mlan_status -wlan_usb_host_to_card_aggr(pmlan_adapter pmadapter, - pmlan_buffer pmbuf, - mlan_tx_param *tx_param, - usb_tx_aggr_params *pusb_tx_aggr) +mlan_status wlan_usb_host_to_card_aggr(pmlan_adapter pmadapter, + pmlan_buffer pmbuf, + mlan_tx_param *tx_param, + usb_tx_aggr_params *pusb_tx_aggr) { pmlan_callbacks pcb = &pmadapter->callbacks; pmlan_buffer pmbuf_aggr; @@ -1046,23 +1073,22 @@ pusb_tx_aggr); if ((aggr_len_counter + pmbuf->data_len) < max_aggr_size) { - f_precopy_cur_buf = 1; /* can fit current packet in aggr - */ + f_precopy_cur_buf = 1; /* can fit current packet in aggr + */ if (next_pkt_len) { - aggr_len_counter += - usb_tx_aggr_pad_len(pmbuf->data_len, - pusb_tx_aggr); + aggr_len_counter += usb_tx_aggr_pad_len( + pmbuf->data_len, pusb_tx_aggr); if ((aggr_len_counter + next_pkt_len) >= max_aggr_size) - f_send_aggr_buf = 1; /* can't fit next - packet, send now - */ + f_send_aggr_buf = 1; /* can't fit next + packet, send now + */ } } else { /* can't fit current packet */ if (pusb_tx_aggr->aggr_len) - f_send_aggr_buf = 1; /* send aggr first */ - f_postcopy_cur_buf = 1; /* then copy into new aggr_buf + f_send_aggr_buf = 1; /* send aggr first */ + f_postcopy_cur_buf = 1; /* then copy into new aggr_buf */ } } @@ -1079,19 +1105,19 @@ if (pmbuf_aggr->use_count + 1 >= max_aggr_num) f_send_aggr_buf = 1; - if (pmbuf->flags & MLAN_BUF_FLAG_NULL_PKT - || pmbuf->flags & MLAN_BUF_FLAG_TCP_ACK) + if (pmbuf->flags & MLAN_BUF_FLAG_NULL_PKT || + pmbuf->flags & MLAN_BUF_FLAG_TCP_ACK) f_send_aggr_buf = 1; if (f_send_aggr_buf) { PRINTM(MIF_D, "%s: Send aggregate buffer.\n", __FUNCTION__); wlan_usb_tx_send_aggr(pmadapter, pusb_tx_aggr); - pmbuf_aggr = pusb_tx_aggr->pmbuf_aggr; /* update ptr */ + pmbuf_aggr = pusb_tx_aggr->pmbuf_aggr; /* update ptr */ } if (f_postcopy_cur_buf) { PRINTM(MIF_D, "%s: Postcopy current buffer.\n", __FUNCTION__); - if (!pmbuf_aggr) { /* this is possible if just sent (above) */ + if (!pmbuf_aggr) { /* this is possible if just sent (above) */ /* use this buf to start linked list */ pmbuf->pnext = pmbuf->pprev = pmbuf; pmbuf_aggr = pmbuf; @@ -1118,6 +1144,98 @@ } /** + * @brief This function used to check if any USB port still available + * + * @param pmadapter A pointer to mlan_adapter + * + * @return MTRUE--non of the port is available. + * MFALSE -- still have port available. + */ +inline t_u8 wlan_usb_data_sent(pmlan_adapter pmadapter) +{ + int i; + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { + if (pmadapter->pcard_usb->usb_port_status[i] == MFALSE) + return MFALSE; + } + return MTRUE; +} + +/** + * @brief This function resync the USB tx port + * + * @param pmadapter A pointer to mlan_adapter + * + * @return N/A + */ +void wlan_resync_usb_port(pmlan_adapter pmadapter) +{ + t_u32 active_port = pmadapter->usb_tx_ports[0]; + int i; + /* MC is enabled */ + if (pmadapter->mc_status) { + for (i = 0; i < MIN(pmadapter->priv_num, MLAN_MAX_BSS_NUM); + i++) { + if (pmadapter->priv[i]) { + if (((GET_BSS_ROLE(pmadapter->priv[i]) == + MLAN_BSS_ROLE_UAP) && + !pmadapter->priv[i]->uap_bss_started) || + ((GET_BSS_ROLE(pmadapter->priv[i]) == + MLAN_BSS_ROLE_STA) && + !pmadapter->priv[i]->media_connected)) { + PRINTM(MINFO, + "Set deactive interface to default EP\n"); + pmadapter->priv[i]->port = + pmadapter->usb_tx_ports[0]; + ; + pmadapter->priv[i]->port_index = 0; + } + } + } + /** Enable all the ports */ + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) + pmadapter->pcard_usb->usb_port_status[i] = MFALSE; + } else { + /* Get active port from connected interface */ + for (i = 0; i < MIN(pmadapter->priv_num, MLAN_MAX_BSS_NUM); + i++) { + if (pmadapter->priv[i]) { + if (((GET_BSS_ROLE(pmadapter->priv[i]) == + MLAN_BSS_ROLE_UAP) && + pmadapter->priv[i]->uap_bss_started) || + ((GET_BSS_ROLE(pmadapter->priv[i]) == + MLAN_BSS_ROLE_STA) && + pmadapter->priv[i]->media_connected)) { + active_port = pmadapter->priv[i]->port; + PRINTM(MEVENT, "active port=%d\n", + active_port); + break; + } + } + } + /** set all the interface to the same port */ + for (i = 0; i < MIN(pmadapter->priv_num, MLAN_MAX_BSS_NUM); + i++) { + if (pmadapter->priv[i]) { + pmadapter->priv[i]->port = active_port; + pmadapter->priv[i]->port_index = + wlan_get_port_index(pmadapter, + active_port); + } + } + for (i = 0; i < MAX_USB_TX_PORT_NUM; i++) { + if (active_port == pmadapter->usb_tx_ports[i]) + pmadapter->pcard_usb->usb_port_status[i] = + MFALSE; + else + pmadapter->pcard_usb->usb_port_status[i] = + MTRUE; + } + } + return; +} + +/** * @brief This function wakes up the card. * * @param pmadapter A pointer to mlan_adapter structure @@ -1125,8 +1243,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_pm_usb_wakeup_card(pmlan_adapter pmadapter, t_u8 timeout) +static mlan_status wlan_pm_usb_wakeup_card(pmlan_adapter pmadapter, + t_u8 timeout) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 age_ts_usec; @@ -1164,9 +1282,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -wlan_usb_host_to_card(pmlan_private pmpriv, t_u8 type, - mlan_buffer *pmbuf, mlan_tx_param *tx_param) +static mlan_status wlan_usb_host_to_card(pmlan_private pmpriv, t_u8 type, + mlan_buffer *pmbuf, + mlan_tx_param *tx_param) { mlan_status ret = MLAN_STATUS_SUCCESS; usb_tx_aggr_params *pusb_tx_aggr = MNULL; @@ -1179,16 +1297,13 @@ return MLAN_STATUS_FAILURE; } if (type == MLAN_TYPE_CMD -#if (defined(USB9098) || defined(USB9097)) +#if (defined(USB9098) || defined(USB9097) || defined(USBNW62X)) || type == MLAN_TYPE_VDLL #endif - ) { + ) { pmadapter->cmd_sent = MTRUE; - ret = pmadapter->callbacks.moal_write_data_async(pmadapter-> - pmoal_handle, - pmbuf, - pmadapter-> - tx_cmd_ep); + ret = pmadapter->callbacks.moal_write_data_async( + pmadapter->pmoal_handle, pmbuf, pmadapter->tx_cmd_ep); if (ret == MLAN_STATUS_FAILURE) pmadapter->cmd_sent = MFALSE; LEAVE(); @@ -1199,11 +1314,11 @@ ret = wlan_usb_host_to_card_aggr(pmadapter, pmbuf, tx_param, pusb_tx_aggr); } else { - pmadapter->data_sent = MTRUE; - ret = pmadapter->callbacks.moal_write_data_async(pmadapter-> - pmoal_handle, - pmbuf, - pmpriv->port); + pmadapter->pcard_usb->usb_port_status[pmpriv->port_index] = + MTRUE; + pmadapter->data_sent = wlan_usb_data_sent(pmadapter); + ret = pmadapter->callbacks.moal_write_data_async( + pmadapter->pmoal_handle, pmbuf, pmpriv->port); switch (ret) { case MLAN_STATUS_PRESOURCE: PRINTM(MINFO, "MLAN_STATUS_PRESOURCE is returned\n"); @@ -1212,9 +1327,13 @@ break; case MLAN_STATUS_FAILURE: + pmadapter->pcard_usb + ->usb_port_status[pmpriv->port_index] = MFALSE; pmadapter->data_sent = MFALSE; break; case MLAN_STATUS_PENDING: + pmadapter->pcard_usb + ->usb_port_status[pmpriv->port_index] = MFALSE; pmadapter->data_sent = MFALSE; break; case MLAN_STATUS_SUCCESS: @@ -1222,7 +1341,6 @@ default: break; } - } LEAVE(); @@ -1236,9 +1354,9 @@ * @param pmbuf A pointer to the mlan_buffer * @return N/A */ -static mlan_status -wlan_usb_cmdevt_complete(pmlan_adapter pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_usb_cmdevt_complete(pmlan_adapter pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { ENTER(); @@ -1256,9 +1374,9 @@ * @param pmbuf A pointer to the mlan_buffer * @return N/A */ -static mlan_status -wlan_usb_data_complete(pmlan_adapter pmadapter, - mlan_buffer *pmbuf, mlan_status status) +static mlan_status wlan_usb_data_complete(pmlan_adapter pmadapter, + mlan_buffer *pmbuf, + mlan_status status) { ENTER(); @@ -1276,8 +1394,8 @@ * @param pmbuf A pointer to the mlan_buffer * @return */ -static mlan_status -wlan_usb_handle_rx_packet(mlan_adapter *pmadapter, pmlan_buffer pmbuf) +static mlan_status wlan_usb_handle_rx_packet(mlan_adapter *pmadapter, + pmlan_buffer pmbuf) { ENTER();
diff --git a/wlan_sd8987/mlan/mlan_util.h b/wlan_sd8987/mlan/mlan_util.h index 24657a1..9485f1a 100755 --- a/wlan_sd8987/mlan/mlan_util.h +++ b/wlan_sd8987/mlan/mlan_util.h
@@ -48,7 +48,7 @@ } mlan_list_head, *pmlan_list_head; /** MLAN MNULL pointer */ -#define MNULL ((void *)0) +#define MNULL ((void *)0) /** * @brief This function initializes a list without locking @@ -57,8 +57,7 @@ * * @return N/A */ -static INLINE t_void -util_init_list(pmlan_linked_list phead) +static INLINE t_void util_init_list(pmlan_linked_list phead) { /* Both next and prev point to self */ phead->pprev = phead->pnext = (pmlan_linked_list)phead; @@ -73,11 +72,9 @@ * * @return N/A */ -static INLINE t_void -util_init_list_head(t_void *pmoal_handle, pmlan_list_head phead, - t_u8 lock_required, - mlan_status (*moal_init_lock) (t_void *handle, - t_void **pplock)) +static INLINE t_void util_init_list_head( + t_void *pmoal_handle, pmlan_list_head phead, t_u8 lock_required, + mlan_status (*moal_init_lock)(t_void *handle, t_void **pplock)) { /* Both next and prev point to self */ util_init_list((pmlan_linked_list)phead); @@ -95,10 +92,9 @@ * * @return N/A */ -static INLINE t_void -util_free_list_head(t_void *pmoal_handle, pmlan_list_head phead, - mlan_status (*moal_free_lock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_free_list_head( + t_void *pmoal_handle, pmlan_list_head phead, + mlan_status (*moal_free_lock)(t_void *handle, t_void *plock)) { phead->pprev = phead->pnext = MNULL; if (phead->plock) @@ -116,8 +112,8 @@ */ static INLINE pmlan_linked_list util_peek_list(t_void *pmoal_handle, pmlan_list_head phead, - mlan_status (*moal_spin_lock) (t_void *handle, t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, t_void *plock)) + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { pmlan_linked_list pnode = MNULL; @@ -140,13 +136,10 @@ * * @return N/A */ -static INLINE t_void -util_enqueue_list_tail(t_void *pmoal_handle, pmlan_list_head phead, - pmlan_linked_list pnode, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_enqueue_list_tail( + t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { pmlan_linked_list pold_last; @@ -171,13 +164,10 @@ * * @return N/A */ -static INLINE t_void -util_enqueue_list_head(t_void *pmoal_handle, pmlan_list_head phead, - pmlan_linked_list pnode, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_enqueue_list_head( + t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { pmlan_linked_list pold_first; @@ -202,12 +192,10 @@ * * @return N/A */ -static INLINE t_void -util_unlink_list(t_void *pmoal_handle, pmlan_list_head phead, - pmlan_linked_list pnode, - mlan_status (*moal_spin_lock) (t_void *handle, t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_unlink_list( + t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { pmlan_linked_list pmy_prev; pmlan_linked_list pmy_next; @@ -233,11 +221,10 @@ * * @return List node */ -static INLINE pmlan_linked_list -util_dequeue_list(t_void *pmoal_handle, pmlan_list_head phead, - mlan_status (*moal_spin_lock) (t_void *handle, t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE pmlan_linked_list util_dequeue_list( + t_void *pmoal_handle, pmlan_list_head phead, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { pmlan_linked_list pnode; @@ -289,8 +276,7 @@ static INLINE t_void util_scalar_init(t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 val, t_void *plock_to_use, - mlan_status (*moal_init_lock) (t_void *handle, - t_void **pplock)) + mlan_status (*moal_init_lock)(t_void *handle, t_void **pplock)) { pscalar->value = val; pscalar->flags = 0; @@ -313,7 +299,7 @@ */ static INLINE t_void util_scalar_free(t_void *pmoal_handle, pmlan_scalar pscalar, - mlan_status (*moal_free_lock) (t_void *handle, t_void *plock)) + mlan_status (*moal_free_lock)(t_void *handle, t_void *plock)) { if (pscalar->flags & MLAN_SCALAR_FLAG_UNIQUE_LOCK) moal_free_lock(pmoal_handle, pscalar->plock); @@ -330,9 +316,8 @@ */ static INLINE t_s32 util_scalar_read(t_void *pmoal_handle, pmlan_scalar pscalar, - mlan_status (*moal_spin_lock) (t_void *handle, t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { t_s32 val; @@ -355,11 +340,10 @@ * * @return N/A */ -static INLINE t_void -util_scalar_write(t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 val, - mlan_status (*moal_spin_lock) (t_void *handle, t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_scalar_write( + t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 val, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { if (moal_spin_lock) moal_spin_lock(pmoal_handle, pscalar->plock); @@ -377,12 +361,10 @@ * * @return N/A */ -static INLINE t_void -util_scalar_increment(t_void *pmoal_handle, pmlan_scalar pscalar, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_scalar_increment( + t_void *pmoal_handle, pmlan_scalar pscalar, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { if (moal_spin_lock) moal_spin_lock(pmoal_handle, pscalar->plock); @@ -400,12 +382,10 @@ * * @return N/A */ -static INLINE t_void -util_scalar_decrement(t_void *pmoal_handle, pmlan_scalar pscalar, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_void util_scalar_decrement( + t_void *pmoal_handle, pmlan_scalar pscalar, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { if (moal_spin_lock) moal_spin_lock(pmoal_handle, pscalar->plock); @@ -425,12 +405,10 @@ * * @return Value after offset */ -static INLINE t_s32 -util_scalar_offset(t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 offset, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_s32 util_scalar_offset( + t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 offset, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { t_s32 newval; @@ -457,14 +435,11 @@ * * @return Comparison result (MTRUE or MFALSE) */ -static INLINE t_u8 -util_scalar_conditional_write(t_void *pmoal_handle, pmlan_scalar pscalar, - MLAN_SCALAR_CONDITIONAL condition, - t_s32 val_compare, t_s32 val_to_set, - mlan_status (*moal_spin_lock) (t_void *handle, - t_void *plock), - mlan_status (*moal_spin_unlock) (t_void *handle, - t_void *plock)) +static INLINE t_u8 util_scalar_conditional_write( + t_void *pmoal_handle, pmlan_scalar pscalar, + MLAN_SCALAR_CONDITIONAL condition, t_s32 val_compare, t_s32 val_to_set, + mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock), + mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock)) { t_u8 update; if (moal_spin_lock) @@ -507,13 +482,11 @@ * @param num number * @return number of bits */ -static INLINE t_u32 -bitcount(t_u32 num) +static INLINE t_u32 bitcount(t_u32 num) { t_u32 count = 0; - static t_u32 nibblebits[] = { 0, 1, 1, 2, 1, 2, 2, 3, - 1, 2, 2, 3, 2, 3, 3, 4 - }; + static t_u32 nibblebits[] = {0, 1, 1, 2, 1, 2, 2, 3, + 1, 2, 2, 3, 2, 3, 3, 4}; for (; num != 0; num >>= 4) count += nibblebits[num & 0x0f]; return count;
diff --git a/wlan_sd8987/mlan/mlan_wmm.c b/wlan_sd8987/mlan/mlan_wmm.c index 6709c7c..c8aab0f 100755 --- a/wlan_sd8987/mlan/mlan_wmm.c +++ b/wlan_sd8987/mlan/mlan_wmm.c
@@ -34,6 +34,7 @@ #include "mlan_main.h" #include "mlan_wmm.h" #include "mlan_11n.h" +#include "mlan_11ax.h" #ifdef SDIO #include "mlan_sdio.h" #endif /* SDIO */ @@ -46,9 +47,8 @@ ********************************************************/ /** WMM information IE */ -static const t_u8 wmm_info_ie[] = { WMM_IE, 0x07, 0x00, 0x50, 0xf2, - 0x02, 0x00, 0x01, 0x00 -}; +static const t_u8 wmm_info_ie[] = {WMM_IE, 0x07, 0x00, 0x50, 0xf2, + 0x02, 0x00, 0x01, 0x00}; /** Type enumeration of WMM AC_QUEUES */ typedef MLAN_PACK_START enum _wmm_ac_e { @@ -63,24 +63,22 @@ * is higher than the enumeration for AC_BE (0); hence the needed * mapping conversion for wmm AC to priority Queue Index */ -static const t_u8 wmm_aci_to_qidx_map[] = { WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, - WMM_AC_VO -}; - +static const t_u8 wmm_aci_to_qidx_map[] = {WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, + WMM_AC_VO}; /** * This table will be used to store the tid values based on ACs. * It is initialized to default values per TID. */ static t_u8 tos_to_tid[] = { /* TID DSCP_P2 DSCP_P1 DSCP_P0 WMM_AC */ - 0x01, /* 0 1 0 AC_BK */ - 0x02, /* 0 0 0 AC_BK */ - 0x00, /* 0 0 1 AC_BE */ - 0x03, /* 0 1 1 AC_BE */ - 0x04, /* 1 0 0 AC_VI */ - 0x05, /* 1 0 1 AC_VI */ - 0x06, /* 1 1 0 AC_VO */ - 0x07 /* 1 1 1 AC_VO */ + 0x01, /* 0 1 0 AC_BK */ + 0x02, /* 0 0 0 AC_BK */ + 0x00, /* 0 0 1 AC_BE */ + 0x03, /* 0 1 1 AC_BE */ + 0x04, /* 1 0 0 AC_VI */ + 0x05, /* 1 0 1 AC_VI */ + 0x06, /* 1 1 0 AC_VO */ + 0x07 /* 1 1 1 AC_VO */ }; /** @@ -88,24 +86,22 @@ * which is in sequential order, and can be compared. * Use this to compare the priority of two different TIDs. */ -t_u8 tos_to_tid_inv[] = { 0x02, /* from tos_to_tid[2] = 0 */ - 0x00, /* from tos_to_tid[0] = 1 */ - 0x01, /* from tos_to_tid[1] = 2 */ - 0x03, 0x04, 0x05, 0x06, 0x07 -}; +t_u8 tos_to_tid_inv[] = {0x02, /* from tos_to_tid[2] = 0 */ + 0x00, /* from tos_to_tid[0] = 1 */ + 0x01, /* from tos_to_tid[1] = 2 */ + 0x03, 0x04, 0x05, 0x06, 0x07}; /** * This table will provide the tid value for given ac. This table does not * change and will be used to copy back the default values to tos_to_tid in * case of disconnect. */ -t_u8 ac_to_tid[4][2] = { {1, 2}, {0, 3}, {4, 5}, {6, 7} }; +t_u8 ac_to_tid[4][2] = {{1, 2}, {0, 3}, {4, 5}, {6, 7}}; /* Map of TOS UP values to WMM AC */ -static const mlan_wmm_ac_e tos_to_ac[] = { WMM_AC_BE, WMM_AC_BK, WMM_AC_BK, - WMM_AC_BE, WMM_AC_VI, WMM_AC_VI, - WMM_AC_VO, WMM_AC_VO -}; +static const mlan_wmm_ac_e tos_to_ac[] = {WMM_AC_BE, WMM_AC_BK, WMM_AC_BK, + WMM_AC_BE, WMM_AC_VI, WMM_AC_VI, + WMM_AC_VO, WMM_AC_VO}; raListTbl *wlan_wmm_get_ralist_node(pmlan_private priv, t_u8 tid, t_u8 *ra_addr); @@ -124,7 +120,7 @@ static void wlan_wmm_ac_debug_print(const IEEEtypes_WmmAcParameters_t *pac_param) { - const char *ac_str[] = { "BK", "BE", "VI", "VO" }; + const char *ac_str[] = {"BK", "BE", "VI", "VO"}; ENTER(); @@ -139,7 +135,6 @@ LEAVE(); } - /** Print the WMM AC for debug purpose */ #define PRINTM_AC(pac_param) wlan_wmm_ac_debug_print(pac_param) #else @@ -155,8 +150,8 @@ * * @return ra_list */ -static raListTbl * -wlan_wmm_allocate_ralist_node(pmlan_adapter pmadapter, t_u8 *ra) +static raListTbl *wlan_wmm_allocate_ralist_node(pmlan_adapter pmadapter, + t_u8 *ra) { raListTbl *ra_list = MNULL; @@ -193,8 +188,7 @@ * * @return N/A */ -static t_void -wlan_add_buf_tdls_txqueue(pmlan_private priv, pmlan_buffer pmbuf) +static t_void wlan_add_buf_tdls_txqueue(pmlan_private priv, pmlan_buffer pmbuf) { mlan_adapter *pmadapter = priv->adapter; ENTER(); @@ -212,8 +206,7 @@ * * @return N/A */ -static t_void -wlan_cleanup_tdls_txq(pmlan_private priv) +static t_void wlan_cleanup_tdls_txq(pmlan_private priv) { pmlan_buffer pmbuf; mlan_adapter *pmadapter = priv->adapter; @@ -242,8 +235,8 @@ * * @return N/A */ -static void -wlan_wmm_queue_priorities_tid(pmlan_private priv, t_u8 queue_priority[]) +static void wlan_wmm_queue_priorities_tid(pmlan_private priv, + t_u8 queue_priority[]) { int i; @@ -276,8 +269,8 @@ * * @return WMM AC The eval_ac traffic is to be sent on. */ -static mlan_wmm_ac_e -wlan_wmm_eval_downgrade_ac(pmlan_private priv, mlan_wmm_ac_e eval_ac) +static mlan_wmm_ac_e wlan_wmm_eval_downgrade_ac(pmlan_private priv, + mlan_wmm_ac_e eval_ac) { int down_ac; mlan_wmm_ac_e ret_ac; @@ -324,8 +317,8 @@ * * @return WMM AC Queue mapping of the IP TOS field */ -static INLINE mlan_wmm_ac_e -wlan_wmm_convert_tos_to_ac(pmlan_adapter pmadapter, t_u32 tos) +static INLINE mlan_wmm_ac_e wlan_wmm_convert_tos_to_ac(pmlan_adapter pmadapter, + t_u32 tos) { ENTER(); @@ -350,17 +343,15 @@ * @return Same tid as input if downgrading not required or * the tid the traffic for the given tid should be downgraded to */ -static INLINE t_u8 -wlan_wmm_downgrade_tid(pmlan_private priv, t_u32 tid) +static INLINE t_u8 wlan_wmm_downgrade_tid(pmlan_private priv, t_u32 tid) { mlan_wmm_ac_e ac_down; pmlan_adapter pmadapter = priv->adapter; ENTER(); - ac_down = - priv->wmm. - ac_down_graded_vals[wlan_wmm_convert_tos_to_ac(pmadapter, tid)]; + ac_down = priv->wmm.ac_down_graded_vals[wlan_wmm_convert_tos_to_ac( + pmadapter, tid)]; LEAVE(); /* * Send the index to tid array, picking from the array will be @@ -382,8 +373,8 @@ * * @return N/A */ -static INLINE void -wlan_wmm_del_pkts_in_ralist_node(pmlan_private priv, raListTbl *ra_list) +static INLINE void wlan_wmm_del_pkts_in_ralist_node(pmlan_private priv, + raListTbl *ra_list) { pmlan_buffer pmbuf; pmlan_adapter pmadapter = priv->adapter; @@ -411,8 +402,8 @@ * * @return N/A */ -static INLINE void -wlan_wmm_del_pkts_in_ralist(pmlan_private priv, mlan_list_head *ra_list_head) +static INLINE void wlan_wmm_del_pkts_in_ralist(pmlan_private priv, + mlan_list_head *ra_list_head) { raListTbl *ra_list; @@ -437,8 +428,7 @@ * * @return N/A */ -static void -wlan_wmm_cleanup_queues(pmlan_private priv) +static void wlan_wmm_cleanup_queues(pmlan_private priv) { int i; @@ -466,8 +456,7 @@ * * @return N/A */ -static void -wlan_wmm_delete_all_ralist(pmlan_private priv) +static void wlan_wmm_delete_all_ralist(pmlan_private priv) { raListTbl *ra_list; int i; @@ -477,10 +466,10 @@ for (i = 0; i < MAX_NUM_TID; ++i) { PRINTM(MINFO, "RAList: Freeing buffers for TID %d\n", i); - while ((ra_list = - (raListTbl *)util_peek_list(pmadapter->pmoal_handle, - &priv->wmm.tid_tbl_ptr[i]. - ra_list, MNULL, MNULL))) { + while ((ra_list = (raListTbl *)util_peek_list( + pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, MNULL, + MNULL))) { util_unlink_list(pmadapter->pmoal_handle, &priv->wmm.tid_tbl_ptr[i].ra_list, (pmlan_linked_list)ra_list, MNULL, @@ -490,8 +479,8 @@ (t_u8 *)ra_list); } - util_init_list((pmlan_linked_list)&priv->wmm.tid_tbl_ptr[i]. - ra_list); + util_init_list( + (pmlan_linked_list)&priv->wmm.tid_tbl_ptr[i].ra_list); priv->wmm.tid_tbl_ptr[i].ra_list_curr = MNULL; } @@ -507,12 +496,12 @@ * * @return ra_list */ -static raListTbl * -wlan_wmm_get_queue_raptr(pmlan_private priv, t_u8 tid, t_u8 *ra_addr) +static raListTbl *wlan_wmm_get_queue_raptr(pmlan_private priv, t_u8 tid, + t_u8 *ra_addr) { raListTbl *ra_list; #ifdef UAP_SUPPORT - t_u8 bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; #endif ENTER(); @@ -555,9 +544,9 @@ * * @return N/A */ -static void -wlan_send_wmmac_host_event(pmlan_private priv, char *type_str, - t_u8 *src_addr, t_u8 tid, t_u8 up, t_u8 status) +static void wlan_send_wmmac_host_event(pmlan_private priv, char *type_str, + t_u8 *src_addr, t_u8 tid, t_u8 up, + t_u8 status) { t_u8 event_buf[100]; mlan_event *pevent; @@ -566,9 +555,9 @@ ENTER(); /* Format one of the following two output strings: - ** - TSPEC:ADDTS_RSP:[<status code>]:TID=X:UP=Y - ** - TSPEC:DELTS_RX:[<reason code>]:TID=X:UP=Y - */ + ** - TSPEC:ADDTS_RSP:[<status code>]:TID=X:UP=Y + ** - TSPEC:DELTS_RX:[<reason code>]:TID=X:UP=Y + */ pevent = (mlan_event *)event_buf; pout_buf = pevent->event_buf; @@ -622,9 +611,9 @@ * * @return raListTbl */ -static raListTbl * -wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, - pmlan_private *priv, int *tid) +static raListTbl *wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, + pmlan_private *priv, + int *tid) { pmlan_private priv_tmp; raListTbl *ptr, *head; @@ -644,7 +633,7 @@ if (pmadapter->bssprio_tbl[j].bssprio_cur == (mlan_bssprio_node *)&pmadapter->bssprio_tbl[j] - .bssprio_head) { + .bssprio_head) { pmadapter->bssprio_tbl[j].bssprio_cur = pmadapter->bssprio_tbl[j].bssprio_cur->pnext; } @@ -672,19 +661,31 @@ /* Ignore data pkts from a BSS if tx pause */ goto next_intf; } +#if defined(USB) + if (!wlan_is_port_ready(pmadapter, + priv_tmp->port_index)) { + PRINTM(MINFO, + "get_highest_prio_ptr(): " + "usb port is busy,Ignore pkts from BSS%d\n", + priv_tmp->bss_index); + /* Ignore data pkts from a BSS if usb port is + * busy */ + goto next_intf; + } +#endif - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - priv_tmp->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv_tmp->wmm.ra_list_spinlock); - for (i = util_scalar_read(pmadapter->pmoal_handle, - &priv_tmp->wmm. - highest_queued_prio, MNULL, - MNULL); i >= LOW_PRIO_TID; - --i) { + for (i = util_scalar_read( + pmadapter->pmoal_handle, + &priv_tmp->wmm.highest_queued_prio, MNULL, + MNULL); + i >= LOW_PRIO_TID; --i) { tid_ptr = &(priv_tmp) - ->wmm.tid_tbl_ptr[tos_to_tid[i]]; + ->wmm + .tid_tbl_ptr[tos_to_tid[i]]; if (!util_peek_list(pmadapter->pmoal_handle, &tid_ptr->ra_list, MNULL, MNULL)) @@ -701,10 +702,10 @@ do { if (!ptr->tx_pause && - util_peek_list(pmadapter-> - pmoal_handle, - &ptr->buf_head, - MNULL, MNULL)) { + util_peek_list( + pmadapter->pmoal_handle, + &ptr->buf_head, MNULL, + MNULL)) { /* Because WMM only support * BK/BE/VI/VO, we have 8 tid * We should balance the traffic @@ -716,30 +717,28 @@ next_tid = tos_to_tid[next_prio]; if (priv_tmp->wmm.pkts_queued - [next_tid] && + [next_tid] && (priv_tmp->wmm.pkts_queued - [next_tid] > + [next_tid] > priv_tmp->wmm.pkts_paused - [next_tid])) - util_scalar_write - (pmadapter-> - pmoal_handle, - &priv_tmp->wmm. - highest_queued_prio, - next_prio, - MNULL, MNULL); + [next_tid])) + util_scalar_write( + pmadapter->pmoal_handle, + &priv_tmp->wmm + .highest_queued_prio, + next_prio, + MNULL, MNULL); else /* if * highest_queued_prio > * i, set it to i */ - util_scalar_conditional_write - (pmadapter-> - pmoal_handle, - &priv_tmp->wmm. - highest_queued_prio, - MLAN_SCALAR_COND_GREATER_THAN, - i, i, MNULL, - MNULL); + util_scalar_conditional_write( + pmadapter->pmoal_handle, + &priv_tmp->wmm + .highest_queued_prio, + MLAN_SCALAR_COND_GREATER_THAN, + i, i, MNULL, + MNULL); *priv = priv_tmp; *tid = tos_to_tid[i]; /* hold priv->ra_list_spinlock @@ -763,30 +762,28 @@ if (util_scalar_read(pmadapter->pmoal_handle, &priv_tmp->wmm.tx_pkts_queued, MNULL, MNULL)) - util_scalar_write(pmadapter->pmoal_handle, - &priv_tmp->wmm. - highest_queued_prio, - HIGH_PRIO_TID, MNULL, MNULL); + util_scalar_write( + pmadapter->pmoal_handle, + &priv_tmp->wmm.highest_queued_prio, + HIGH_PRIO_TID, MNULL, MNULL); else /* No packet at any TID for this priv. Mark as * such to skip checking TIDs for this priv * (until pkt is added). */ - util_scalar_write(pmadapter->pmoal_handle, - &priv_tmp->wmm. - highest_queued_prio, - NO_PKT_PRIO_TID, MNULL, - MNULL); + util_scalar_write( + pmadapter->pmoal_handle, + &priv_tmp->wmm.highest_queued_prio, + NO_PKT_PRIO_TID, MNULL, MNULL); - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv_tmp->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv_tmp->wmm.ra_list_spinlock); -next_intf: + next_intf: bssprio_node = bssprio_node->pnext; if (bssprio_node == (mlan_bssprio_node *)&pmadapter->bssprio_tbl[j] - .bssprio_head) + .bssprio_head) bssprio_node = bssprio_node->pnext; pmadapter->bssprio_tbl[j].bssprio_cur = bssprio_node; } while (bssprio_node != bssprio_head); @@ -805,8 +802,8 @@ * * @return Packet count */ -static int -wlan_num_pkts_in_txq(mlan_private *priv, raListTbl *ptr, int max_buf_size) +static int wlan_num_pkts_in_txq(mlan_private *priv, raListTbl *ptr, + int max_buf_size) { int count = 0, total_size = 0; pmlan_buffer pmbuf; @@ -835,8 +832,8 @@ * * @return N/A */ -static INLINE void -wlan_send_single_packet(pmlan_private priv, raListTbl *ptr, int ptrindex) +static INLINE void wlan_send_single_packet(pmlan_private priv, raListTbl *ptr, + int ptrindex) { pmlan_buffer pmbuf; pmlan_buffer pmbuf_next; @@ -854,34 +851,28 @@ util_scalar_decrement(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); ptr->total_pkts--; - pmbuf_next = - (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, - &ptr->buf_head, MNULL, - MNULL); - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmbuf_next = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, &ptr->buf_head, MNULL, MNULL); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); tx_param.next_pkt_len = ((pmbuf_next) ? pmbuf_next->data_len + sizeof(TxPD) : - 0); + 0); status = wlan_process_tx(priv, pmbuf, &tx_param); if (status == MLAN_STATUS_RESOURCE) { /** Queue the packet back at the head */ PRINTM(MDAT_D, "Queuing pkt back to raList %p %p\n", ptr, pmbuf); - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); if (!wlan_is_ralist_valid(priv, ptr, ptrindex)) { - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); LEAVE(); @@ -898,15 +889,13 @@ ptr->total_pkts++; pmbuf->flags |= MLAN_BUF_FLAG_REQUEUED_PKT; - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); } else { - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); if (wlan_is_ralist_valid(priv, ptr, ptrindex)) { priv->wmm.packets_out[ptrindex]++; priv->wmm.tid_tbl_ptr[ptrindex].ra_list_curr = @@ -914,16 +903,14 @@ } pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur = pmadapter->bssprio_tbl[priv->bss_priority] - .bssprio_cur->pnext; - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + .bssprio_cur->pnext; + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); } } else { - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); PRINTM(MINFO, "Nothing to send\n"); } @@ -938,8 +925,7 @@ * * @return MTRUE or MFALSE */ -static INLINE int -wlan_is_ptr_processed(mlan_private *priv, raListTbl *ptr) +static INLINE int wlan_is_ptr_processed(mlan_private *priv, raListTbl *ptr) { pmlan_buffer pmbuf; @@ -960,8 +946,8 @@ * * @return N/A */ -static INLINE void -wlan_send_processed_packet(pmlan_private priv, raListTbl *ptr, int ptrindex) +static INLINE void wlan_send_processed_packet(pmlan_private priv, + raListTbl *ptr, int ptrindex) { pmlan_buffer pmbuf_next = MNULL; mlan_tx_param tx_param; @@ -972,16 +958,13 @@ pmbuf = (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, &ptr->buf_head, MNULL, MNULL); if (pmbuf) { - pmbuf_next = - (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, - &ptr->buf_head, MNULL, - MNULL); - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmbuf_next = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, &ptr->buf_head, MNULL, MNULL); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); tx_param.next_pkt_len = - ((pmbuf_next) ? pmbuf_next->data_len + - sizeof(TxPD) : 0); + ((pmbuf_next) ? pmbuf_next->data_len + sizeof(TxPD) : + 0); ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA, pmbuf, &tx_param); @@ -993,17 +976,14 @@ #endif case MLAN_STATUS_RESOURCE: PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n"); - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); if (!wlan_is_ralist_valid(priv, ptr, ptrindex)) { - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); LEAVE(); @@ -1015,10 +995,9 @@ MNULL); pmbuf->flags |= MLAN_BUF_FLAG_REQUEUED_PKT; - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); break; case MLAN_STATUS_FAILURE: PRINTM(MERROR, "Error: Failed to write data\n"); @@ -1039,10 +1018,9 @@ break; } if (ret != MLAN_STATUS_RESOURCE) { - pmadapter->callbacks.moal_spin_lock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_lock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); if (wlan_is_ralist_valid(priv, ptr, ptrindex)) { priv->wmm.packets_out[ptrindex]++; priv->wmm.tid_tbl_ptr[ptrindex].ra_list_curr = @@ -1051,20 +1029,18 @@ } pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur = pmadapter->bssprio_tbl[priv->bss_priority] - .bssprio_cur->pnext; + .bssprio_cur->pnext; priv->wmm.pkts_queued[ptrindex]--; util_scalar_decrement(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); } } else { - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); } } @@ -1075,8 +1051,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static int -wlan_dequeue_tx_packet(pmlan_adapter pmadapter) +static int wlan_dequeue_tx_packet(pmlan_adapter pmadapter) { raListTbl *ptr; pmlan_private priv = MNULL; @@ -1122,20 +1097,15 @@ if (ptr->del_ba_count >= DEL_BA_THRESHOLD) wlan_update_del_ba_count(priv, ptr); if (pmadapter->tp_state_on) { - pmbuf = (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, - &ptr->buf_head, MNULL, - MNULL); + pmbuf = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, &ptr->buf_head, MNULL, MNULL); if (pmbuf) { - pmadapter->callbacks.moal_tp_accounting(pmadapter-> - pmoal_handle, - pmbuf->pdesc, - 3); + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf->pdesc, 3); if (pmadapter->tp_state_drop_point == 3) { - pmbuf = (pmlan_buffer) - util_dequeue_list(pmadapter-> - pmoal_handle, - &ptr->buf_head, MNULL, - MNULL); + pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, &ptr->buf_head, + MNULL, MNULL); PRINTM(MERROR, "Dequeuing the packet %p %p\n", ptr, pmbuf); priv->wmm.pkts_queued[ptrindex]--; @@ -1143,11 +1113,9 @@ &priv->wmm.tx_pkts_queued, MNULL, MNULL); ptr->total_pkts--; - pmadapter->callbacks. - moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_SUCCESS); LEAVE(); @@ -1155,13 +1123,13 @@ } } } - if (!ptr->is_11n_enabled || + if (!ptr->is_wmm_enabled || (ptr->ba_status || ptr->del_ba_count >= DEL_BA_THRESHOLD) #ifdef STA_SUPPORT || priv->wps.session_enable #endif /* STA_SUPPORT */ - ) { - if (ptr->is_11n_enabled && ptr->ba_status && + ) { + if (ptr->is_wmm_enabled && ptr->ba_status && ptr->amsdu_in_ampdu && wlan_is_amsdu_allowed(priv, ptr, tid) && (wlan_num_pkts_in_txq(priv, ptr, pmadapter->tx_buf_size) >= @@ -1177,24 +1145,22 @@ PRINTM(MINFO, "BA setup threshold %d reached. tid=%d\n", ptr->packet_count, tid); - if (!wlan_11n_get_txbastream_tbl - (priv, tid, ptr->ra, MFALSE)) { - wlan_11n_create_txbastream_tbl(priv, - ptr->ra, - tid, - BA_STREAM_SETUP_INPROGRESS); + if (!wlan_11n_get_txbastream_tbl( + priv, tid, ptr->ra, MFALSE)) { + wlan_11n_create_txbastream_tbl( + priv, ptr->ra, tid, + BA_STREAM_SETUP_INPROGRESS); wlan_send_addba(priv, tid, ptr->ra); } } else if (wlan_find_stream_to_delete(priv, ptr, tid, &tid_del, ra)) { PRINTM(MDAT_D, "tid_del=%d tid=%d\n", tid_del, tid); - if (!wlan_11n_get_txbastream_tbl - (priv, tid, ptr->ra, MFALSE)) { - wlan_11n_create_txbastream_tbl(priv, - ptr->ra, - tid, - BA_STREAM_SETUP_INPROGRESS); + if (!wlan_11n_get_txbastream_tbl( + priv, tid, ptr->ra, MFALSE)) { + wlan_11n_create_txbastream_tbl( + priv, ptr->ra, tid, + BA_STREAM_SETUP_INPROGRESS); wlan_send_delba(priv, MNULL, tid_del, ra, 1); } @@ -1224,8 +1190,7 @@ * * @return packets queued for this mac */ -t_u16 -wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 *mac, t_u8 tx_pause) +t_u16 wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 *mac, t_u8 tx_pause) { raListTbl *ra_list; int i; @@ -1278,8 +1243,7 @@ * * @return N/A */ -t_void -wlan_update_non_tdls_ralist(mlan_private *priv, t_u8 *mac, t_u8 tx_pause) +t_void wlan_update_non_tdls_ralist(mlan_private *priv, t_u8 *mac, t_u8 tx_pause) { raListTbl *ra_list; int i; @@ -1291,16 +1255,14 @@ pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); for (i = 0; i < MAX_NUM_TID; ++i) { - ra_list = - (raListTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->wmm.tid_tbl_ptr[i]. - ra_list, MNULL, MNULL); + ra_list = (raListTbl *)util_peek_list( + priv->adapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, MNULL, MNULL); while (ra_list && (ra_list != (raListTbl *)&priv->wmm.tid_tbl_ptr[i].ra_list)) { - if (memcmp - (priv->adapter, ra_list->ra, mac, - MLAN_MAC_ADDR_LENGTH) && + if (memcmp(priv->adapter, ra_list->ra, mac, + MLAN_MAC_ADDR_LENGTH) && ra_list->tx_pause != tx_pause) { pkt_cnt += ra_list->total_pkts; ra_list->tx_pause = tx_pause; @@ -1344,8 +1306,8 @@ * * @return pmlan_buffer or MNULL */ -static pmlan_buffer -wlan_find_tdls_packets(mlan_private *priv, raListTbl *ra_list, t_u8 *mac) +static pmlan_buffer wlan_find_tdls_packets(mlan_private *priv, + raListTbl *ra_list, t_u8 *mac) { pmlan_buffer pmbuf = MNULL; mlan_adapter *pmadapter = priv->adapter; @@ -1378,8 +1340,7 @@ * * @return pmlan_buffer or MNULL */ -static pmlan_buffer -wlan_find_packets_tdls_txq(mlan_private *priv, t_u8 *mac) +static pmlan_buffer wlan_find_packets_tdls_txq(mlan_private *priv, t_u8 *mac) { pmlan_buffer pmbuf = MNULL; mlan_adapter *pmadapter = priv->adapter; @@ -1413,8 +1374,7 @@ * * @return N/A */ -static t_void -wlan_wmm_delete_tdls_ralist(pmlan_private priv, t_u8 *mac) +static t_void wlan_wmm_delete_tdls_ralist(pmlan_private priv, t_u8 *mac) { raListTbl *ra_list; raListTbl *ra_list_ap = MNULL; @@ -1427,22 +1387,17 @@ ra_list = wlan_wmm_get_ralist_node(priv, i, mac); if (ra_list) { PRINTM(MDATA, "delete TDLS ralist %p\n", ra_list); - ra_list_ap = - (raListTbl *)util_peek_list(pmadapter-> - pmoal_handle, - &priv->wmm. - tid_tbl_ptr[i]. - ra_list, MNULL, - MNULL); + ra_list_ap = (raListTbl *)util_peek_list( + pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, MNULL, + MNULL); if (!ra_list_ap) { LEAVE(); return; } - while ((pmbuf = - (pmlan_buffer)util_peek_list(pmadapter-> - pmoal_handle, - &ra_list->buf_head, - MNULL, MNULL))) { + while ((pmbuf = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, + &ra_list->buf_head, MNULL, MNULL))) { util_unlink_list(pmadapter->pmoal_handle, &ra_list->buf_head, (pmlan_linked_list)pmbuf, @@ -1454,10 +1409,10 @@ ra_list_ap->total_pkts++; ra_list_ap->packet_count++; } - util_free_list_head((t_void *)pmadapter->pmoal_handle, - &ra_list->buf_head, - pmadapter->callbacks. - moal_free_lock); + util_free_list_head( + (t_void *)pmadapter->pmoal_handle, + &ra_list->buf_head, + pmadapter->callbacks.moal_free_lock); util_unlink_list(pmadapter->pmoal_handle, &priv->wmm.tid_tbl_ptr[i].ra_list, @@ -1485,8 +1440,7 @@ * * @return threshold value. */ -t_u8 -wlan_get_random_ba_threshold(pmlan_adapter pmadapter) +t_u8 wlan_get_random_ba_threshold(pmlan_adapter pmadapter) { t_u32 sec, usec; t_u8 ba_threshold = 0; @@ -1505,7 +1459,7 @@ usec = (usec & 0xFFFF) + (usec >> 16); ba_threshold = (((sec << 16) + usec) % BA_SETUP_MAX_PACKET_THRESHOLD) + - pmadapter->min_ba_threshold; + pmadapter->min_ba_threshold; PRINTM(MINFO, "pmadapter->min_ba_threshold = %d\n", pmadapter->min_ba_threshold); PRINTM(MINFO, "setup BA after %d packets\n", ba_threshold); @@ -1521,8 +1475,7 @@ * * @return N/A */ -t_void -wlan_clean_txrx(pmlan_private priv) +t_void wlan_clean_txrx(pmlan_private priv) { mlan_adapter *pmadapter = priv->adapter; t_u8 i = 0; @@ -1576,8 +1529,7 @@ * * @return N/A */ -void -wlan_wmm_default_queue_priorities(pmlan_private priv) +void wlan_wmm_default_queue_priorities(pmlan_private priv) { ENTER(); @@ -1598,9 +1550,8 @@ * * @return N/A */ -void -wlan_wmm_setup_queue_priorities(pmlan_private priv, - IEEEtypes_WmmParameter_t *pwmm_ie) +void wlan_wmm_setup_queue_priorities(pmlan_private priv, + IEEEtypes_WmmParameter_t *pwmm_ie) { t_u16 cw_min, avg_back_off, tmp[4]; t_u32 i, j, num_ac; @@ -1628,10 +1579,10 @@ for (num_ac = 0; num_ac < NELEMENTS(pwmm_ie->ac_params); num_ac++) { cw_min = (1 << pwmm_ie->ac_params[num_ac].ecw.ecw_min) - 1; avg_back_off = (cw_min >> 1) + - pwmm_ie->ac_params[num_ac].aci_aifsn.aifsn; + pwmm_ie->ac_params[num_ac].aci_aifsn.aifsn; ac_idx = wmm_aci_to_qidx_map[pwmm_ie->ac_params[num_ac] - .aci_aifsn.aci]; + .aci_aifsn.aci]; priv->wmm.queue_priority[ac_idx] = ac_idx; tmp[ac_idx] = avg_back_off; @@ -1677,8 +1628,7 @@ * * @return N/A */ -void -wlan_wmm_setup_ac_downgrade(pmlan_private priv) +void wlan_wmm_setup_ac_downgrade(pmlan_private priv) { int ac_val; @@ -1695,9 +1645,8 @@ } else { for (ac_val = WMM_AC_BK; ac_val <= WMM_AC_VO; ac_val++) { priv->wmm.ac_down_graded_vals[ac_val] = - wlan_wmm_eval_downgrade_ac(priv, - (mlan_wmm_ac_e) - ac_val); + wlan_wmm_eval_downgrade_ac( + priv, (mlan_wmm_ac_e)ac_val); PRINTM(MINFO, "WMM: AC PRIO %d maps to %d\n", ac_val, priv->wmm.ac_down_graded_vals[ac_val]); } @@ -1707,6 +1656,47 @@ } /** + * @brief This function checks whether a station has WMM enabled or not + * + * @param priv A pointer to mlan_private + * @param mac station mac address + * @return MTRUE or MFALSE + */ +static t_u8 is_station_wmm_enabled(mlan_private *priv, t_u8 *mac) +{ + sta_node *sta_ptr = MNULL; + sta_ptr = wlan_get_station_entry(priv, mac); + if (sta_ptr) { + if (sta_ptr->is_11n_enabled || sta_ptr->is_11ax_enabled) + return MTRUE; + } + return MFALSE; +} + +/** + * @brief This function checks whether wmm is supported + * + * @param priv A pointer to mlan_private + * @param ra Address of the receiver STA + * + * @return MTRUE or MFALSE + */ +static int wlan_is_wmm_enabled(mlan_private *priv, t_u8 *ra) +{ + int ret = MFALSE; + ENTER(); +#ifdef UAP_SUPPORT + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if ((!(ra[0] & 0x01)) && + (priv->is_11n_enabled || priv->is_11ax_enabled)) + ret = is_station_wmm_enabled(priv, ra); + } +#endif /* UAP_SUPPORT */ + LEAVE(); + return ret; +} + +/** * @brief Allocate and add a RA list for all TIDs with the given RA * * @param priv Pointer to the mlan_private driver data struct @@ -1714,8 +1704,7 @@ * * @return N/A */ -void -wlan_ralist_add(mlan_private *priv, t_u8 *ra) +void wlan_ralist_add(mlan_private *priv, t_u8 *ra) { int i; raListTbl *ra_list; @@ -1733,8 +1722,8 @@ ra_list->ba_status = BA_STREAM_NOT_SETUP; ra_list->amsdu_in_ampdu = MFALSE; if (queuing_ra_based(priv)) { - ra_list->is_11n_enabled = wlan_is_11n_enabled(priv, ra); - if (ra_list->is_11n_enabled) + ra_list->is_wmm_enabled = wlan_is_wmm_enabled(priv, ra); + if (ra_list->is_wmm_enabled) ra_list->max_amsdu = get_station_max_amsdu_size(priv, ra); ra_list->tx_pause = wlan_is_tx_pause(priv, ra); @@ -1743,25 +1732,25 @@ ra_list->tx_pause = MFALSE; status = wlan_get_tdls_link_status(priv, ra); if (MTRUE == wlan_is_tdls_link_setup(status)) { - ra_list->is_11n_enabled = - is_station_11n_enabled(priv, ra); - if (ra_list->is_11n_enabled) + ra_list->is_wmm_enabled = + is_station_wmm_enabled(priv, ra); + if (ra_list->is_wmm_enabled) ra_list->max_amsdu = get_station_max_amsdu_size(priv, ra); ra_list->is_tdls_link = MTRUE; } else { - ra_list->is_11n_enabled = IS_11N_ENABLED(priv); - if (ra_list->is_11n_enabled) + ra_list->is_wmm_enabled = IS_11N_ENABLED(priv); + if (ra_list->is_wmm_enabled) ra_list->max_amsdu = priv->max_amsdu; } } PRINTM_NETINTF(MDATA, priv); - PRINTM(MDATA, "ralist %p: is_11n_enabled=%d max_amsdu=%d\n", - ra_list, ra_list->is_11n_enabled, ra_list->max_amsdu); + PRINTM(MDATA, "ralist %p: is_wmm_enabled=%d max_amsdu=%d\n", + ra_list, ra_list->is_wmm_enabled, ra_list->max_amsdu); - if (ra_list->is_11n_enabled) { + if (ra_list->is_wmm_enabled) { ra_list->packet_count = 0; ra_list->ba_packet_threshold = wlan_get_random_ba_threshold(pmadapter); @@ -1786,8 +1775,7 @@ * * @return N/A */ -t_void -wlan_init_wmm_param(pmlan_adapter pmadapter) +t_void wlan_init_wmm_param(pmlan_adapter pmadapter) { /* Reuse the same structure of WmmAcParameters_t for configuration * purpose here. the definition of acm bit is changed to ucm (user @@ -1831,8 +1819,7 @@ * * @return N/A */ -t_void -wlan_wmm_init(pmlan_adapter pmadapter) +t_void wlan_wmm_init(pmlan_adapter pmadapter) { int i, j; pmlan_private priv; @@ -1847,7 +1834,7 @@ tos_to_tid_inv[i]; priv->aggr_prio_tbl[i].ampdu_ap = priv->aggr_prio_tbl[i].ampdu_user = - tos_to_tid_inv[i]; + tos_to_tid_inv[i]; priv->ibss_ampdu[i] = priv->aggr_prio_tbl[i].ampdu_user; priv->wmm.pkts_queued[i] = 0; @@ -1860,12 +1847,12 @@ priv->aggr_prio_tbl[7].amsdu = BA_STREAM_NOT_ALLOWED; priv->aggr_prio_tbl[6].ampdu_ap = priv->aggr_prio_tbl[6].ampdu_user = - BA_STREAM_NOT_ALLOWED; + BA_STREAM_NOT_ALLOWED; priv->ibss_ampdu[6] = BA_STREAM_NOT_ALLOWED; priv->aggr_prio_tbl[7].ampdu_ap = priv->aggr_prio_tbl[7].ampdu_user = - BA_STREAM_NOT_ALLOWED; + BA_STREAM_NOT_ALLOWED; priv->ibss_ampdu[7] = BA_STREAM_NOT_ALLOWED; priv->add_ba_param.timeout = @@ -1915,8 +1902,7 @@ * * @return N/A */ -void -wlan_wmm_setup_queues(pmlan_private priv) +void wlan_wmm_setup_queues(pmlan_private priv) { ENTER(); wlan_wmm_setup_queue_priorities(priv, MNULL); @@ -1932,15 +1918,14 @@ * * @return MLAN_STATUS_SUCCESS; MLAN_STATUS_FAILURE */ -mlan_status -wlan_cmd_wmm_status_change(pmlan_private priv) +mlan_status wlan_cmd_wmm_status_change(pmlan_private priv) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); - ret = wlan_prepare_cmd(priv, HostCmd_CMD_WMM_GET_STATUS, 0, 0, - MNULL, MNULL); + ret = wlan_prepare_cmd(priv, HostCmd_CMD_WMM_GET_STATUS, 0, 0, MNULL, + MNULL); LEAVE(); return ret; } @@ -1953,8 +1938,7 @@ * * @return MFALSE if not empty; MTRUE if empty */ -int -wlan_wmm_lists_empty(pmlan_adapter pmadapter) +int wlan_wmm_lists_empty(pmlan_adapter pmadapter) { int j; pmlan_private priv; @@ -1973,13 +1957,16 @@ } if (priv->tx_pause) continue; +#if defined(USB) + if (!wlan_is_port_ready(pmadapter, priv->port_index)) + continue; +#endif - if (util_scalar_read(pmadapter->pmoal_handle, - &priv->wmm.tx_pkts_queued, - pmadapter->callbacks. - moal_spin_lock, - pmadapter->callbacks. - moal_spin_unlock)) { + if (util_scalar_read( + pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock)) { LEAVE(); return MFALSE; } @@ -1999,8 +1986,7 @@ * * @return ra_list or MNULL */ -raListTbl * -wlan_wmm_get_ralist_node(pmlan_private priv, t_u8 tid, t_u8 *ra_addr) +raListTbl *wlan_wmm_get_ralist_node(pmlan_private priv, t_u8 tid, t_u8 *ra_addr) { raListTbl *ra_list; ENTER(); @@ -2030,16 +2016,15 @@ * * @return MTRUE- valid. MFALSE- invalid. */ -int -wlan_is_ralist_valid(mlan_private *priv, raListTbl *ra_list, int ptrindex) +int wlan_is_ralist_valid(mlan_private *priv, raListTbl *ra_list, int ptrindex) { raListTbl *rlist; ENTER(); - rlist = (raListTbl *)util_peek_list(priv->adapter->pmoal_handle, - &priv->wmm.tid_tbl_ptr[ptrindex]. - ra_list, MNULL, MNULL); + rlist = (raListTbl *)util_peek_list( + priv->adapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[ptrindex].ra_list, MNULL, MNULL); while (rlist && (rlist != @@ -2064,8 +2049,7 @@ * * @return integer count of updated nodes */ -int -wlan_ralist_update(mlan_private *priv, t_u8 *old_ra, t_u8 *new_ra) +int wlan_ralist_update(mlan_private *priv, t_u8 *old_ra, t_u8 *new_ra) { t_u8 tid; int update_count; @@ -2082,15 +2066,15 @@ update_count++; if (queuing_ra_based(priv)) { - ra_list->is_11n_enabled = - wlan_is_11n_enabled(priv, new_ra); - if (ra_list->is_11n_enabled) + ra_list->is_wmm_enabled = + wlan_is_wmm_enabled(priv, new_ra); + if (ra_list->is_wmm_enabled) ra_list->max_amsdu = - get_station_max_amsdu_size(priv, - new_ra); + get_station_max_amsdu_size( + priv, new_ra); } else { - ra_list->is_11n_enabled = IS_11N_ENABLED(priv); - if (ra_list->is_11n_enabled) + ra_list->is_wmm_enabled = IS_11N_ENABLED(priv); + if (ra_list->is_wmm_enabled) ra_list->max_amsdu = priv->max_amsdu; } @@ -2103,7 +2087,7 @@ PRINTM(MINFO, "ralist_update: %p, %d, " MACSTR "-->" MACSTR "\n", - ra_list, ra_list->is_11n_enabled, + ra_list, ra_list->is_wmm_enabled, MAC2STR(ra_list->ra), MAC2STR(new_ra)); memcpy_ext(priv->adapter, ra_list->ra, new_ra, @@ -2123,8 +2107,7 @@ * * @return N/A */ -t_void -wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) +t_void wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { pmlan_private priv = pmadapter->priv[pmbuf->bss_index]; t_u32 tid; @@ -2162,20 +2145,16 @@ pmbuf->flags |= MLAN_BUF_FLAG_TDLS; } else if (status == TDLS_SETUP_INPROGRESS) { wlan_add_buf_tdls_txqueue(priv, pmbuf); - pmadapter->callbacks.moal_spin_unlock(pmadapter-> - pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); LEAVE(); return; } else - ra_list = - (raListTbl *)util_peek_list(pmadapter-> - pmoal_handle, - &priv->wmm. - tid_tbl_ptr - [tid_down].ra_list, - MNULL, MNULL); + ra_list = (raListTbl *)util_peek_list( + pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[tid_down].ra_list, MNULL, + MNULL); } else { memcpy_ext(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); @@ -2186,8 +2165,10 @@ else if (priv->bss_type == MLAN_BSS_TYPE_UAP) { sta_ptr = wlan_get_station_entry(priv, ra); if (sta_ptr) { - if (!sta_ptr->is_wmm_enabled - && !priv->is_11ac_enabled) { + sta_ptr->stats.tx_bytes += pmbuf->data_len; + sta_ptr->stats.tx_packets++; + if (!sta_ptr->is_wmm_enabled && + !priv->is_11ac_enabled) { tid_down = wlan_wmm_downgrade_tid(priv, 0xff); } @@ -2202,9 +2183,8 @@ PRINTM(MWARN, "Drop packet %p, ra_list=%p, media_connected=%d\n", pmbuf, ra_list, priv->media_connected); - pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, - priv->wmm. - ra_list_spinlock); + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); LEAVE(); return; @@ -2228,12 +2208,10 @@ &priv->wmm.tx_pkts_queued, MNULL, MNULL); /* if highest_queued_prio < prio(tid_down), set it to * prio(tid_down) */ - util_scalar_conditional_write(pmadapter->pmoal_handle, - &priv->wmm.highest_queued_prio, - MLAN_SCALAR_COND_LESS_THAN, - tos_to_tid_inv[tid_down], - tos_to_tid_inv[tid_down], MNULL, - MNULL); + util_scalar_conditional_write( + pmadapter->pmoal_handle, &priv->wmm.highest_queued_prio, + MLAN_SCALAR_COND_LESS_THAN, tos_to_tid_inv[tid_down], + tos_to_tid_inv[tid_down], MNULL, MNULL); } /* Record the current time the packet was queued; used to determine * the amount of time the packet was queued in the driver before it @@ -2241,9 +2219,8 @@ * packet to the firmware for aggregate delay calculation for stats * and MSDU lifetime expiry. */ - pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, - &pmbuf->in_ts_sec, - &pmbuf->in_ts_usec); + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &pmbuf->in_ts_sec, &pmbuf->in_ts_usec); pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); @@ -2268,8 +2245,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_get_status(pmlan_private priv, t_u8 *ptlv, int resp_len) +mlan_status wlan_ret_wmm_get_status(pmlan_private priv, t_u8 *ptlv, + int resp_len) { t_u8 *pcurrent = ptlv; t_u32 tlv_len; @@ -2313,9 +2290,14 @@ ptlv_wmm_q_status->flow_required, ptlv_wmm_q_status->disabled); + /* Pick the minimum among these to avoid array out of + * bounds */ + ptlv_wmm_q_status->queue_index = MIN( + ptlv_wmm_q_status->queue_index, MAX_AC_QUEUES); + pac_status = - &priv->wmm.ac_status[ptlv_wmm_q_status-> - queue_index]; + &priv->wmm.ac_status[ptlv_wmm_q_status + ->queue_index]; pac_status->disabled = ptlv_wmm_q_status->disabled; pac_status->flow_required = ptlv_wmm_q_status->flow_required; @@ -2323,7 +2305,7 @@ ptlv_wmm_q_status->flow_created; break; - case TLV_TYPE_VENDOR_SPECIFIC_IE: /* WMM_IE */ + case TLV_TYPE_VENDOR_SPECIFIC_IE: /* WMM_IE */ /* * Point the regular IEEE IE 2 bytes into the NXP IE * and setup the IEEE IE type and length byte fields @@ -2343,8 +2325,9 @@ pwmm_param_ie->qos_info.para_set_count); memcpy_ext(priv->adapter, - (t_u8 *)&priv->curr_bss_params. - bss_descriptor.wmm_ie, pwmm_param_ie, + (t_u8 *)&priv->curr_bss_params.bss_descriptor + .wmm_ie, + pwmm_param_ie, (pwmm_param_ie->vend_hdr.len + 2), sizeof(IEEEtypes_WmmParameter_t)); send_wmm_event = MTRUE; @@ -2355,56 +2338,40 @@ ptlv_action = (MrvlIETypes_ActionFrame_t *)pcurrent; ptlv_action->actionFrame.wmmAc.tspecAct.category = - wlan_le32_to_cpu(ptlv_action->actionFrame.wmmAc. - tspecAct.category); + wlan_le32_to_cpu(ptlv_action->actionFrame.wmmAc + .tspecAct.category); if (ptlv_action->actionFrame.wmmAc.tspecAct.category == IEEE_MGMT_ACTION_CATEGORY_WMM_TSPEC) { ptlv_action->actionFrame.wmmAc.tspecAct.action = - wlan_le32_to_cpu(ptlv_action-> - actionFrame.wmmAc. - tspecAct.action); - switch (ptlv_action->actionFrame.wmmAc.tspecAct. - action) { + wlan_le32_to_cpu( + ptlv_action->actionFrame.wmmAc + .tspecAct.action); + switch (ptlv_action->actionFrame.wmmAc.tspecAct + .action) { case TSPEC_ACTION_CODE_ADDTS_RSP: - padd_ts_rsp = - &ptlv_action->actionFrame.wmmAc. - addTsRsp; - wlan_send_wmmac_host_event(priv, - "ADDTS_RSP", - ptlv_action-> - srcAddr, - padd_ts_rsp-> - tspecIE. - TspecBody. - TSInfo.TID, - padd_ts_rsp-> - tspecIE. - TspecBody. - TSInfo. - UserPri, - padd_ts_rsp-> - statusCode); + padd_ts_rsp = &ptlv_action->actionFrame + .wmmAc.addTsRsp; + wlan_send_wmmac_host_event( + priv, "ADDTS_RSP", + ptlv_action->srcAddr, + padd_ts_rsp->tspecIE.TspecBody + .TSInfo.TID, + padd_ts_rsp->tspecIE.TspecBody + .TSInfo.UserPri, + padd_ts_rsp->statusCode); break; case TSPEC_ACTION_CODE_DELTS: - pdel_ts = - &ptlv_action->actionFrame.wmmAc. - delTs; - wlan_send_wmmac_host_event(priv, - "DELTS_RX", - ptlv_action-> - srcAddr, - pdel_ts-> - tspecIE. - TspecBody. - TSInfo.TID, - pdel_ts-> - tspecIE. - TspecBody. - TSInfo. - UserPri, - pdel_ts-> - reasonCode); + pdel_ts = &ptlv_action->actionFrame + .wmmAc.delTs; + wlan_send_wmmac_host_event( + priv, "DELTS_RX", + ptlv_action->srcAddr, + pdel_ts->tspecIE.TspecBody + .TSInfo.TID, + pdel_ts->tspecIE.TspecBody + .TSInfo.UserPri, + pdel_ts->reasonCode); break; case TSPEC_ACTION_CODE_ADDTS_REQ: @@ -2445,14 +2412,11 @@ * @param ppassoc_buf Output parameter: Pointer to the TLV output buffer, * modified on return to point after the appended WMM TLV * @param pwmm_ie Pointer to the WMM IE for the BSS we are joining - * @param pht_cap Pointer to the HT IE for the BSS we are joining * * @return Length of data appended to the association tlv buffer */ -t_u32 -wlan_wmm_process_association_req(pmlan_private priv, t_u8 **ppassoc_buf, - IEEEtypes_WmmParameter_t *pwmm_ie, - IEEEtypes_HTCap_t *pht_cap) +t_u32 wlan_wmm_process_association_req(pmlan_private priv, t_u8 **ppassoc_buf, + IEEEtypes_WmmParameter_t *pwmm_ie) { MrvlIEtypes_WmmParamSet_t *pwmm_tlv; t_u32 ret_len = 0; @@ -2477,11 +2441,7 @@ PRINTM(MINFO, "WMM: process assoc req: bss->wmmIe=0x%x\n", pwmm_ie->vend_hdr.element_id); - if ((priv->wmm_required - || (pht_cap && (pht_cap->ieee_hdr.element_id == HT_CAPABILITY) && - (priv->config_bands & BAND_GN || priv->config_bands & BAND_AN)) - ) - && pwmm_ie->vend_hdr.element_id == WMM_IE) { + if (priv->wmm_required && pwmm_ie->vend_hdr.element_id == WMM_IE) { pwmm_tlv = (MrvlIEtypes_WmmParamSet_t *)*ppassoc_buf; pwmm_tlv->header.type = (t_u16)wmm_info_ie[0]; pwmm_tlv->header.type = wlan_cpu_to_le16(pwmm_tlv->header.type); @@ -2522,9 +2482,8 @@ * * @return Time delay of the packet in 2ms units after having limit applied */ -t_u8 -wlan_wmm_compute_driver_packet_delay(pmlan_private priv, - const pmlan_buffer pmbuf) +t_u8 wlan_wmm_compute_driver_packet_delay(pmlan_private priv, + const pmlan_buffer pmbuf) { t_u8 ret_val = 0; t_u32 out_ts_sec, out_ts_usec; @@ -2532,17 +2491,14 @@ ENTER(); - priv->adapter->callbacks.moal_get_system_time(priv->adapter-> - pmoal_handle, &out_ts_sec, - &out_ts_usec); + priv->adapter->callbacks.moal_get_system_time( + priv->adapter->pmoal_handle, &out_ts_sec, &out_ts_usec); if (priv->adapter->tp_state_on) { pmbuf->out_ts_sec = out_ts_sec; pmbuf->out_ts_usec = out_ts_usec; if (pmbuf->in_ts_sec) - priv->adapter->callbacks.moal_tp_accounting(priv-> - adapter-> - pmoal_handle, - pmbuf, 11); + priv->adapter->callbacks.moal_tp_accounting( + priv->adapter->pmoal_handle, pmbuf, 11); } queue_delay = (t_s32)(out_ts_sec - pmbuf->in_ts_sec) * 1000; queue_delay += (t_s32)(out_ts_usec - pmbuf->in_ts_usec) / 1000; @@ -2553,9 +2509,8 @@ * * Pass max value if queue_delay is beyond the uint8 range */ - ret_val = - (t_u8)(MIN(queue_delay, (t_s32)priv->wmm.drv_pkt_delay_max) >> - 1); + ret_val = (t_u8)(MIN(queue_delay, (t_s32)priv->wmm.drv_pkt_delay_max) >> + 1); PRINTM(MINFO, "WMM: Pkt Delay: %d ms, %d ms sent to FW\n", queue_delay, ret_val); @@ -2571,8 +2526,7 @@ * * @return N/A */ -void -wlan_wmm_process_tx(pmlan_adapter pmadapter) +void wlan_wmm_process_tx(pmlan_adapter pmadapter) { ENTER(); @@ -2613,14 +2567,13 @@ * * @return wmm_queue priority (0-3) */ -t_u8 -wlan_wmm_select_queue(mlan_private *pmpriv, t_u8 tid) +t_u8 wlan_wmm_select_queue(mlan_private *pmpriv, t_u8 tid) { pmlan_adapter pmadapter = pmpriv->adapter; t_u8 i; mlan_wmm_ac_e ac_down = - pmpriv->wmm. - ac_down_graded_vals[wlan_wmm_convert_tos_to_ac(pmadapter, tid)]; + pmpriv->wmm.ac_down_graded_vals[wlan_wmm_convert_tos_to_ac( + pmadapter, tid)]; ENTER(); @@ -2643,9 +2596,9 @@ * * @return N/A */ -static INLINE t_u8 -wlan_del_tx_pkts_in_ralist(pmlan_private priv, - mlan_list_head *ra_list_head, int tid) +static INLINE t_u8 wlan_del_tx_pkts_in_ralist(pmlan_private priv, + mlan_list_head *ra_list_head, + int tid) { raListTbl *ra_list = MNULL; pmlan_adapter pmadapter = priv->adapter; @@ -2658,15 +2611,14 @@ if (ra_list->total_pkts && (ra_list->tx_pause || (ra_list->total_pkts > RX_LOW_THRESHOLD))) { - pmbuf = (pmlan_buffer)util_dequeue_list(pmadapter-> - pmoal_handle, - &ra_list-> - buf_head, MNULL, - MNULL); + pmbuf = (pmlan_buffer)util_dequeue_list( + pmadapter->pmoal_handle, &ra_list->buf_head, + MNULL, MNULL); if (pmbuf) { PRINTM(MDATA, - "Drop pkts: tid=%d tx_pause=%d pkts=%d " - MACSTR "\n", tid, ra_list->tx_pause, + "Drop pkts: tid=%d tx_pause=%d pkts=%d " MACSTR + "\n", + tid, ra_list->tx_pause, ra_list->total_pkts, MAC2STR(ra_list->ra)); wlan_write_data_complete(pmadapter, pmbuf, @@ -2677,11 +2629,10 @@ if (ra_list->tx_pause) priv->wmm.pkts_paused[tid]--; else - util_scalar_decrement(pmadapter-> - pmoal_handle, - &priv->wmm. - tx_pkts_queued, - MNULL, MNULL); + util_scalar_decrement( + pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + MNULL, MNULL); ret = MTRUE; break; } @@ -2700,8 +2651,7 @@ * * @return N/A */ -t_void -wlan_drop_tx_pkts(pmlan_private priv) +t_void wlan_drop_tx_pkts(pmlan_private priv) { int j; static int i; @@ -2711,8 +2661,8 @@ for (j = 0; j < MAX_NUM_TID; j++, i++) { if (i == MAX_NUM_TID) i = 0; - if (wlan_del_tx_pkts_in_ralist - (priv, &priv->wmm.tid_tbl_ptr[i].ra_list, i)) { + if (wlan_del_tx_pkts_in_ralist( + priv, &priv->wmm.tid_tbl_ptr[i].ra_list, i)) { i++; break; } @@ -2730,8 +2680,7 @@ * * @return N/A */ -t_void -wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 *mac) +t_void wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 *mac) { raListTbl *ra_list; int i; @@ -2762,7 +2711,7 @@ if (priv->wmm.tid_tbl_ptr[i].ra_list_curr == ra_list) priv->wmm.tid_tbl_ptr[i].ra_list_curr = (raListTbl *)&priv->wmm.tid_tbl_ptr[i] - .ra_list; + .ra_list; } } if (pkt_cnt) { @@ -2791,8 +2740,7 @@ * * @return N/A */ -t_void -wlan_hold_tdls_packets(pmlan_private priv, t_u8 *mac) +t_void wlan_hold_tdls_packets(pmlan_private priv, t_u8 *mac) { pmlan_buffer pmbuf; mlan_adapter *pmadapter = priv->adapter; @@ -2804,9 +2752,9 @@ priv->wmm.ra_list_spinlock); PRINTM(MDATA, "wlan_hold_tdls_packets: " MACSTR "\n", MAC2STR(mac)); for (i = 0; i < MAX_NUM_TID; ++i) { - ra_list = (raListTbl *)util_peek_list(pmadapter->pmoal_handle, - &priv->wmm.tid_tbl_ptr[i]. - ra_list, MNULL, MNULL); + ra_list = (raListTbl *)util_peek_list( + pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, MNULL, MNULL); if (ra_list) { while ((pmbuf = wlan_find_tdls_packets(priv, ra_list, mac))) { @@ -2839,8 +2787,8 @@ * * @return pmlan_buffer or MNULL */ -t_void -wlan_restore_tdls_packets(pmlan_private priv, t_u8 *mac, tdlsStatus_e status) +t_void wlan_restore_tdls_packets(pmlan_private priv, t_u8 *mac, + tdlsStatus_e status) { pmlan_buffer pmbuf; mlan_adapter *pmadapter = priv->adapter; @@ -2865,13 +2813,10 @@ ra_list = wlan_wmm_get_queue_raptr(priv, tid_down, mac); pmbuf->flags |= MLAN_BUF_FLAG_TDLS; } else { - ra_list = - (raListTbl *)util_peek_list(pmadapter-> - pmoal_handle, - &priv->wmm. - tid_tbl_ptr - [tid_down].ra_list, - MNULL, MNULL); + ra_list = (raListTbl *)util_peek_list( + pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[tid_down].ra_list, MNULL, + MNULL); pmbuf->flags &= ~MLAN_BUF_FLAG_TDLS; } if (!ra_list) { @@ -2895,12 +2840,10 @@ priv->wmm.pkts_queued[tid_down]++; util_scalar_increment(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); - util_scalar_conditional_write(pmadapter->pmoal_handle, - &priv->wmm.highest_queued_prio, - MLAN_SCALAR_COND_LESS_THAN, - tos_to_tid_inv[tid_down], - tos_to_tid_inv[tid_down], MNULL, - MNULL); + util_scalar_conditional_write( + pmadapter->pmoal_handle, &priv->wmm.highest_queued_prio, + MLAN_SCALAR_COND_LESS_THAN, tos_to_tid_inv[tid_down], + tos_to_tid_inv[tid_down], MNULL, MNULL); } if (status != TDLS_SETUP_COMPLETE) wlan_wmm_delete_tdls_ralist(priv, mac); @@ -2917,9 +2860,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_addts_req(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_addts_req(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) { mlan_ds_wmm_addts *paddts = (mlan_ds_wmm_addts *)pdata_buf; HostCmd_DS_WMM_ADDTS_REQ *pcmd_addts = &cmd->params.add_ts; @@ -2953,10 +2895,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_addts_req(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_addts_req(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm = MNULL; mlan_ds_wmm_addts *paddts = MNULL; @@ -3013,9 +2954,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_delts_req(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_delts_req(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) { mlan_ds_wmm_delts *pdelts = (mlan_ds_wmm_delts *)pdata_buf; HostCmd_DS_WMM_DELTS_REQ *pcmd_delts = &cmd->params.del_ts; @@ -3046,10 +2986,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_delts_req(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_delts_req(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm; IEEEtypes_WMM_TSPEC_t *ptspec_ie; @@ -3067,14 +3006,12 @@ if (pwmm->param.delts.result == 0) { ptspec_ie = (IEEEtypes_WMM_TSPEC_t *) - presp_delts->tspec_data; - wlan_send_wmmac_host_event(pmpriv, "DELTS_TX", MNULL, - ptspec_ie->TspecBody.TSInfo. - TID, - ptspec_ie->TspecBody.TSInfo. - UserPri, - presp_delts-> - ieee_reason_code); + presp_delts->tspec_data; + wlan_send_wmmac_host_event( + pmpriv, "DELTS_TX", MNULL, + ptspec_ie->TspecBody.TSInfo.TID, + ptspec_ie->TspecBody.TSInfo.UserPri, + presp_delts->ieee_reason_code); } } @@ -3090,9 +3027,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_queue_stats(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_queue_stats(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) { mlan_ds_wmm_queue_stats *pqstats = (mlan_ds_wmm_queue_stats *)pdata_buf; HostCmd_DS_WMM_QUEUE_STATS *pcmd_qstats = &cmd->params.queue_stats; @@ -3133,10 +3069,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_queue_stats(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_queue_stats(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm = MNULL; mlan_ds_wmm_queue_stats *pqstats = MNULL; @@ -3162,9 +3097,8 @@ pqstats->policed_time = wlan_le16_to_cpu(presp_qstats->policed_time); for (id = 0; id < MLAN_WMM_STATS_PKTS_HIST_BINS; id++) { - pqstats->delay_histogram[id] = - wlan_le16_to_cpu(presp_qstats-> - delay_histogram[id]); + pqstats->delay_histogram[id] = wlan_le16_to_cpu( + presp_qstats->delay_histogram[id]); } } @@ -3180,9 +3114,8 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_ts_status(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_ts_status(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) { mlan_ds_wmm_ts_status *pts_status = (mlan_ds_wmm_ts_status *)pdata_buf; HostCmd_DS_WMM_TS_STATUS *pcmd_ts_status = &cmd->params.ts_status; @@ -3211,9 +3144,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_ts_status(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_ts_status(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm = MNULL; HostCmd_DS_WMM_TS_STATUS *presp_ts_status = &resp->params.ts_status; @@ -3242,8 +3175,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_wmm_ioctl_enable(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_enable(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3267,8 +3200,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_wmm_ioctl_qos(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_qos(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3299,8 +3232,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_wmm_ioctl_addts_req(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_addts_req(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3329,8 +3262,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_wmm_ioctl_delts_req(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_delts_req(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3359,8 +3292,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_wmm_ioctl_queue_stats(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_queue_stats(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3389,8 +3322,8 @@ * * @return MLAN_STATUS_SUCCESS --success */ -static mlan_status -wlan_wmm_ioctl_queue_status(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_queue_status(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3430,8 +3363,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_wmm_ioctl_ts_status(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_ts_status(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3463,10 +3396,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_param_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u8 cmd_action, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_param_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u8 cmd_action, + t_void *pdata_buf) { wmm_ac_parameters_t *ac_params = (wmm_ac_parameters_t *)pdata_buf; HostCmd_DS_WMM_PARAM_CONFIG *pcmd_cfg = &cmd->params.param_config; @@ -3485,9 +3417,8 @@ sizeof(wmm_ac_parameters_t) * MAX_AC_QUEUES, sizeof(wmm_ac_parameters_t) * MAX_AC_QUEUES); for (i = 0; i < MAX_AC_QUEUES; i++) { - pcmd_cfg->ac_params[i].tx_op_limit = - wlan_cpu_to_le16(pcmd_cfg->ac_params[i]. - tx_op_limit); + pcmd_cfg->ac_params[i].tx_op_limit = wlan_cpu_to_le16( + pcmd_cfg->ac_params[i].tx_op_limit); } } LEAVE(); @@ -3503,14 +3434,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_param_config(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_param_config(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm = MNULL; HostCmd_DS_WMM_PARAM_CONFIG *pcfg = - (HostCmd_DS_WMM_PARAM_CONFIG *) & resp->params.param_config; + (HostCmd_DS_WMM_PARAM_CONFIG *)&resp->params.param_config; t_u8 i; ENTER(); @@ -3518,9 +3448,8 @@ if (pioctl_buf) { pwmm = (mlan_ds_wmm_cfg *)pioctl_buf->pbuf; for (i = 0; i < MAX_AC_QUEUES; i++) { - pcfg->ac_params[i].tx_op_limit = - wlan_le16_to_cpu(pcfg->ac_params[i]. - tx_op_limit); + pcfg->ac_params[i].tx_op_limit = wlan_le16_to_cpu( + pcfg->ac_params[i].tx_op_limit); } memcpy_ext(pmpriv->adapter, pwmm->param.ac_params, pcfg->ac_params, @@ -3540,9 +3469,9 @@ * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_cmd_wmm_queue_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, t_void *pdata_buf) +mlan_status wlan_cmd_wmm_queue_config(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, + t_void *pdata_buf) { mlan_ds_wmm_queue_config *pqcfg = (mlan_ds_wmm_queue_config *)pdata_buf; HostCmd_DS_WMM_QUEUE_CONFIG *pcmd_qcfg = &cmd->params.queue_config; @@ -3550,11 +3479,9 @@ ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_WMM_QUEUE_CONFIG); - cmd->size = - wlan_cpu_to_le16(sizeof(pcmd_qcfg->action) + - sizeof(pcmd_qcfg->access_category) + - sizeof(pcmd_qcfg->msdu_lifetime_expiry) + - S_DS_GEN); + cmd->size = wlan_cpu_to_le16( + sizeof(pcmd_qcfg->action) + sizeof(pcmd_qcfg->access_category) + + sizeof(pcmd_qcfg->msdu_lifetime_expiry) + S_DS_GEN); cmd->result = 0; pcmd_qcfg->action = pqcfg->action; @@ -3575,10 +3502,9 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -wlan_ret_wmm_queue_config(pmlan_private pmpriv, - const HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +mlan_status wlan_ret_wmm_queue_config(pmlan_private pmpriv, + const HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { mlan_ds_wmm_cfg *pwmm = MNULL; const HostCmd_DS_WMM_QUEUE_CONFIG *presp_qcfg = @@ -3607,8 +3533,8 @@ * * @return MLAN_STATUS_PENDING --success, otherwise fail */ -static mlan_status -wlan_wmm_ioctl_queue_config(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +static mlan_status wlan_wmm_ioctl_queue_config(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -3637,8 +3563,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -mlan_status -wlan_wmm_cfg_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) +mlan_status wlan_wmm_cfg_ioctl(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_wmm_cfg *wmm = MNULL; @@ -3698,8 +3624,7 @@ * @return number of ralist entry * */ -int -wlan_get_ralist_info(mlan_private *priv, ralist_info *buf) +int wlan_get_ralist_info(mlan_private *priv, ralist_info *buf) { ralist_info *plist = buf; mlan_list_head *ra_list_head = MNULL; @@ -3739,8 +3664,7 @@ * @return N/A * */ -void -wlan_dump_ralist(mlan_private *priv) +void wlan_dump_ralist(mlan_private *priv) { mlan_list_head *ra_list_head = MNULL; raListTbl *ra_list; @@ -3784,8 +3708,7 @@ * @return tid_down * */ -int -wlan_get_wmm_tid_down(mlan_private *priv, int tid) +int wlan_get_wmm_tid_down(mlan_private *priv, int tid) { return wlan_wmm_downgrade_tid(priv, tid); }
diff --git a/wlan_sd8987/mlan/mlan_wmm.h b/wlan_sd8987/mlan/mlan_wmm.h index 73ce820..64fcc22 100755 --- a/wlan_sd8987/mlan/mlan_wmm.h +++ b/wlan_sd8987/mlan/mlan_wmm.h
@@ -37,8 +37,7 @@ * * @return TID */ -static INLINE t_u32 -wlan_get_tid(pmlan_adapter pmadapter, praListTbl ptr) +static INLINE t_u32 wlan_get_tid(pmlan_adapter pmadapter, praListTbl ptr) { pmlan_buffer mbuf; @@ -48,7 +47,7 @@ LEAVE(); if (!mbuf) { - return 0; // The default TID,BE + return 0; // The default TID,BE } else return mbuf->priority; } @@ -60,8 +59,7 @@ * * @return Length of list */ -static INLINE t_u32 -wlan_wmm_list_len(pmlan_list_head head) +static INLINE t_u32 wlan_wmm_list_len(pmlan_list_head head) { pmlan_linked_list pos; t_u32 count = 0; @@ -86,8 +84,7 @@ * * @return N/A */ -static INLINE t_void -wlan_request_ralist_lock(pmlan_private priv) +static INLINE t_void wlan_request_ralist_lock(pmlan_private priv) { mlan_adapter *pmadapter = priv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -109,8 +106,7 @@ * * @return N/A */ -static INLINE t_void -wlan_release_ralist_lock(pmlan_private priv) +static INLINE t_void wlan_release_ralist_lock(pmlan_private priv) { mlan_adapter *pmadapter = priv->adapter; mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks; @@ -158,8 +154,8 @@ void wlan_wmm_default_queue_priorities(pmlan_private priv); /* process wmm_param_config command */ mlan_status wlan_cmd_wmm_param_config(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u8 cmd_action, t_void *pdata_buf); + HostCmd_DS_COMMAND *cmd, t_u8 cmd_action, + t_void *pdata_buf); /* process wmm_param_config command response */ mlan_status wlan_ret_wmm_param_config(pmlan_private pmpriv, @@ -170,8 +166,7 @@ /** Process WMM association request */ extern t_u32 wlan_wmm_process_association_req(pmlan_private priv, t_u8 **ppAssocBuf, - IEEEtypes_WmmParameter_t *pWmmIE, - IEEEtypes_HTCap_t *pHTCap); + IEEEtypes_WmmParameter_t *pWmmIE); #endif /* STA_SUPPORT */ /** setup wmm queue priorities */
diff --git a/wlan_sd8987/mlinux/mlan.h b/wlan_sd8987/mlinux/mlan.h index 566ad50..4d48ce8 100755 --- a/wlan_sd8987/mlinux/mlan.h +++ b/wlan_sd8987/mlinux/mlan.h
@@ -4,7 +4,7 @@ * It also defines the data structures used for APIs between MLAN and MOAL. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlinux/mlan_decl.h b/wlan_sd8987/mlinux/mlan_decl.h index 8ae44dc..3f43ae7 100755 --- a/wlan_sd8987/mlinux/mlan_decl.h +++ b/wlan_sd8987/mlinux/mlan_decl.h
@@ -3,7 +3,7 @@ * @brief This file declares the generic data structures and APIs. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "292.p15" +#define MLAN_RELEASE_VERSION "368.p3" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -98,6 +98,8 @@ /** MLAN FALSE */ #define MFALSE (0) +#define CHANNEL_SPEC_SNIFFER_MODE 1 + #ifndef MACSTR /** MAC address security format */ #define MACSTR "%02x:XX:XX:XX:%02x:%02x" @@ -127,13 +129,8 @@ /** Return aligned offset */ #define OFFSET_ALIGN_ADDR(p, a) (t_u32)(ALIGN_ADDR(p, a) - (t_ptr)p) -#if defined(WIFI_DIRECT_SUPPORT) /** Maximum BSS numbers */ #define MLAN_MAX_BSS_NUM (16) -#else -/** Maximum BSS numbers */ -#define MLAN_MAX_BSS_NUM (2) -#endif /** NET IP alignment */ #define MLAN_NET_IP_ALIGN 2 @@ -269,7 +266,7 @@ /** pcie card reset */ #define FW_RELOAD_PCIE_RESET 4 #endif -#define FW_RELOAD_SDIO_HW_RESET 5 +#define FW_RELOAD_SDIO_HW_RESET 5 #ifdef USB #define MLAN_USB_BLOCK_SIZE (512) @@ -295,10 +292,11 @@ #define MLAN_USB_TX_AGGR_TIMEOUT_MSEC MLAN_USB_TX_MIN_AGGR_TIMEOUT #define MLAN_USB_TX_AGGR_TIMEOUT_DYN (0xFFFF) #endif /*USB*/ + /** MLAN MAC Address Length */ #define MLAN_MAC_ADDR_LENGTH (6) /** MLAN 802.11 MAC Address */ - typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; +typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** MLAN Maximum SSID Length */ #define MLAN_MAX_SSID_LENGTH (32) @@ -374,6 +372,8 @@ #define CARD_TYPE_9177 0x09 /** 8801 card type */ #define CARD_TYPE_8801 0x0a +/** OWL card type */ +#define CARD_TYPE_NW62X 0x0b /** 9098 A0 reverion num */ #define CHIP_9098_REV_A0 1 @@ -405,6 +405,8 @@ #define CARD_TYPE_SD9177 (CARD_TYPE_9177 | (INTF_SD << 8)) /** SD8801 card type */ #define CARD_TYPE_SD8801 (CARD_TYPE_8801 | (INTF_SD << 8)) +/** SD_NW62X card type */ +#define CARD_TYPE_SDNW62X (CARD_TYPE_NW62X | (INTF_SD << 8)) #define IS_SD8887(ct) (CARD_TYPE_SD8887 == (ct)) #define IS_SD8897(ct) (CARD_TYPE_SD8897 == (ct)) @@ -416,6 +418,7 @@ #define IS_SD9098(ct) (CARD_TYPE_SD9098 == (ct)) #define IS_SD9177(ct) (CARD_TYPE_SD9177 == (ct)) #define IS_SD8801(ct) (CARD_TYPE_SD8801 == (ct)) +#define IS_SDNW62X(ct) (CARD_TYPE_SDNW62X == (ct)) /** SD8887 Card */ #define CARD_SD8887 "SD8887" @@ -424,21 +427,21 @@ /** SD8977 Card */ #define CARD_SD8977 "SD8977" /** SD8978 Card */ -#define CARD_SD8978 "SD8978" +#define CARD_SD8978 "SDIW416" /** SD8997 Card */ #define CARD_SD8997 "SD8997" /** SD8987 Card */ #define CARD_SD8987 "SD8987" /** SD9097 Card */ -#define CARD_SD9097 "SD9097" -/** SDIW620 Card */ -#define CARD_SDIW620 "SDIW620" +#define CARD_SD9097 "SDIW620" /** SD9098 Card */ #define CARD_SD9098 "SD9098" /** SD9177 Card */ -#define CARD_SD9177 "SD9177" +#define CARD_SD9177 "SDIW612" /** SD8801 Card */ #define CARD_SD8801 "SD8801" +/** SDNW62X Card */ +#define CARD_SDNW62X "SDNW62X" #endif #ifdef PCIE @@ -450,31 +453,36 @@ #define CARD_TYPE_PCIE9097 (CARD_TYPE_9097 | (INTF_PCIE << 8)) /** PCIE9098 card type */ #define CARD_TYPE_PCIE9098 (CARD_TYPE_9098 | (INTF_PCIE << 8)) +/** PCIENW62X card type */ +#define CARD_TYPE_PCIENW62X (CARD_TYPE_NW62X | (INTF_PCIE << 8)) #define IS_PCIE8897(ct) (CARD_TYPE_PCIE8897 == (ct)) #define IS_PCIE8997(ct) (CARD_TYPE_PCIE8997 == (ct)) #define IS_PCIE9097(ct) (CARD_TYPE_PCIE9097 == (ct)) #define IS_PCIE9098(ct) (CARD_TYPE_PCIE9098 == (ct)) +#define IS_PCIENW62X(ct) (CARD_TYPE_PCIENW62X == (ct)) /** PCIE8897 Card */ #define CARD_PCIE8897 "PCIE8897" /** PCIE8997 Card */ #define CARD_PCIE8997 "PCIE8997" /** PCIE9097 Card */ -#define CARD_PCIE9097 "PCIE9097" -/** PCIEIW620 Card */ -#define CARD_PCIEIW620 "PCIEIW620" +#define CARD_PCIE9097 "PCIEIW620" /** PCIE9000S Card */ #define CARD_PCIE9000S "PCIE9000S" /** PCIE9098 Card */ #define CARD_PCIE9098 "PCIE9098" /** PCIEAW690 Card */ #define CARD_PCIEAW690 "PCIEAW690" +/** PCIENW62X Card */ +#define CARD_PCIENW62X "PCIENW62X" +/** PCIEIW629 Card */ +#define CARD_PCIEIW629 "PCIEIW629" #endif #ifdef USB /** USB8801 card type */ -#define CARD_TYPE_USB8801 (CARD_TYPE_8801 | (INTF_USB << 8)) +#define CARD_TYPE_USB8801 (CARD_TYPE_8801 | (INTF_USB << 8)) /** USB8897 card type */ #define CARD_TYPE_USB8897 (CARD_TYPE_8897 | (INTF_USB << 8)) /** USB8997 card type */ @@ -485,6 +493,8 @@ #define CARD_TYPE_USB9098 (CARD_TYPE_9098 | (INTF_USB << 8)) /** USB9097 card type */ #define CARD_TYPE_USB9097 (CARD_TYPE_9097 | (INTF_USB << 8)) +/** USBNW62X card type */ +#define CARD_TYPE_USBNW62X (CARD_TYPE_NW62X | (INTF_USB << 8)) #define IS_USB8801(ct) (CARD_TYPE_USB8801 == (ct)) #define IS_USB8897(ct) (CARD_TYPE_USB8897 == (ct)) @@ -492,24 +502,25 @@ #define IS_USB8978(ct) (CARD_TYPE_USB8978 == (ct)) #define IS_USB9098(ct) (CARD_TYPE_USB9098 == (ct)) #define IS_USB9097(ct) (CARD_TYPE_USB9097 == (ct)) +#define IS_USBNW62X(ct) (CARD_TYPE_USBNW62X == (ct)) /** USB8801 Card */ -#define CARD_USB8801 "USB8801" +#define CARD_USB8801 "USB8801" /** USB8897 Card */ #define CARD_USB8897 "USB8897" /** USB8997 Card */ #define CARD_USB8997 "USB8997" /** USB8978 Card */ -#define CARD_USB8978 "USB8978" +#define CARD_USB8978 "USBIW416" /** USB9098 Card */ #define CARD_USB9098 "USB9098" /** USB9097 Card */ -#define CARD_USB9097 "USB9097" -/** USBIW620 Card */ -#define CARD_USBIW620 "USBIW620" +#define CARD_USB9097 "USBIW620" +/** USBNW62X Card */ +#define CARD_USBNW62X "USBNW62X" #endif -#define IS_CARD8801(ct) (CARD_TYPE_8801 == ((ct) & 0xf)) +#define IS_CARD8801(ct) (CARD_TYPE_8801 == ((ct)&0xf)) #define IS_CARD8887(ct) (CARD_TYPE_8887 == ((ct)&0xf)) #define IS_CARD8897(ct) (CARD_TYPE_8897 == ((ct)&0xf)) #define IS_CARD8977(ct) (CARD_TYPE_8977 == ((ct)&0xf)) @@ -518,6 +529,7 @@ #define IS_CARD9098(ct) (CARD_TYPE_9098 == ((ct)&0xf)) #define IS_CARD9097(ct) (CARD_TYPE_9097 == ((ct)&0xf)) #define IS_CARD9177(ct) (CARD_TYPE_9177 == ((ct)&0xf)) +#define IS_CARDNW62X(ct) (CARD_TYPE_NW62X == ((ct)&0xf)) typedef struct _card_type_entry { t_u16 card_type; @@ -577,6 +589,9 @@ /** Buffer flag for TX_STATUS */ #define MLAN_BUF_FLAG_TX_STATUS MBIT(10) +/** Buffer flag for NET_MONITOR */ +#define MLAN_BUF_FLAG_NET_MONITOR MBIT(11) + /** Buffer flag for NULL data packet */ #define MLAN_BUF_FLAG_NULL_PKT MBIT(12) /** Buffer flag for Diag pkt */ @@ -584,6 +599,8 @@ #define MLAN_BUF_FLAG_TX_CTRL MBIT(14) +#define MLAN_BUF_FLAG_MC_AGGR_PKT MBIT(17) + #ifdef DEBUG_LEVEL1 /** Debug level bit definition */ #define MMSG MBIT(0) @@ -612,6 +629,8 @@ /** Memory allocation type: DMA */ #define MLAN_MEM_DMA MBIT(0) +/** Memory allocation flag: ATOMIC */ +#define MLAN_MEM_FLAG_ATOMIC MBIT(1) /** Default memory allocation flag */ #define MLAN_MEM_DEF 0 @@ -670,6 +689,18 @@ #endif } mlan_buf_type; +#define SCAN_STATE_SCAN_START MBIT(0) +#define SCAN_STATE_EXT_SCAN MBIT(1) +#define SCAN_STATE_EXT_SCAN_ENH MBIT(2) +#define SCAN_STATE_EXT_SCAN_CANCEL MBIT(3) +#define SCAN_STATE_EXT_SCAN_CMDRESP MBIT(4) +#define SCAN_STATE_EXT_SCAN_ENH_CMDRESP MBIT(5) +#define SCAN_STATE_EXT_SCAN_CANCEL_CMDRESP MBIT(6) +#define SCAN_STATE_EXT_SCAN_RESULT MBIT(7) +#define SCAN_STATE_LAST_EXT_SCAN_RESULT MBIT(8) +#define SCAN_STATE_EXT_SCAN_STATUS MBIT(9) +#define SCAN_STATE_SCAN_COMPLETE MBIT(10) + #ifdef USB /** mlan_usb_ep */ typedef enum _mlan_usb_ep { @@ -693,6 +724,7 @@ #ifdef WIFI_DIRECT_SUPPORT MLAN_BSS_TYPE_WIFIDIRECT = 2, #endif + MLAN_BSS_TYPE_DFS = 8, MLAN_BSS_TYPE_ANY = 0xff, } mlan_bss_type; @@ -766,6 +798,7 @@ #if defined(PCIE) MLAN_EVENT_ID_SSU_DUMP_FILE = 0x00000039, #endif /* SSU_SUPPORT */ + MLAN_EVENT_ID_CSI = 0x00000040, /* Event generated by MLAN driver (MSB=1) */ MLAN_EVENT_ID_DRV_CONNECTED = 0x80000001, MLAN_EVENT_ID_DRV_DEFER_HANDLING = 0x80000002, @@ -788,6 +821,7 @@ #ifdef UAP_SUPPORT MLAN_EVENT_ID_DRV_UAP_CHAN_INFO = 0x80000020, #endif + MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT = 0x80000023, MLAN_EVENT_ID_DRV_ASSOC_FAILURE_LOGGER = 0x80000026, MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER = 0x80000027, MLAN_EVENT_ID_DRV_DISCONNECT_LOGGER = 0x80000028, @@ -842,7 +876,7 @@ #define OID_TYPE_CAL 0x2 #define OID_TYPE_DPD 0xa -#define UNKNOW_DPD_LENGTH 0xffffffff +#define UNKNOW_DPD_LENGTH 0xffffffff /** Custom data structure */ typedef struct _mlan_init_param { @@ -871,27 +905,32 @@ }; /** channel band */ -enum { BAND_2GHZ = 0, +enum { + BAND_2GHZ = 0, BAND_5GHZ = 1, - BAND_4GHZ = 2, + BAND_6GHZ = 2, + BAND_4GHZ = 3, }; /** channel offset */ -enum { SEC_CHAN_NONE = 0, +enum { + SEC_CHAN_NONE = 0, SEC_CHAN_ABOVE = 1, SEC_CHAN_5MHZ = 2, SEC_CHAN_BELOW = 3 }; /** channel bandwidth */ -enum { CHAN_BW_20MHZ = 0, +enum { + CHAN_BW_20MHZ = 0, CHAN_BW_10MHZ, CHAN_BW_40MHZ, CHAN_BW_80MHZ, }; /** scan mode */ -enum { SCAN_MODE_MANUAL = 0, +enum { + SCAN_MODE_MANUAL = 0, SCAN_MODE_ACS, SCAN_MODE_USER, }; @@ -923,26 +962,34 @@ DFS_W53_OLD = 2 } dfs_w53_cfg_t; +typedef enum _dfs_moe_t { + /** driver default DFS behavior */ + DFS_MODE_DEFAULT = 0, + /* disable DFS master when uap and station operate in same DFS channel + */ + DFS_MODE_ENH = 1, +} dfs_mode_t; + /** Band_Config_t */ typedef MLAN_PACK_START struct _Band_Config_t { #ifdef BIG_ENDIAN_SUPPORT /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=user*/ - t_u8 scanMode:2; + t_u8 scanMode : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ - t_u8 chan2Offset:2; + t_u8 chan2Offset : 2; /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth:2; + t_u8 chanWidth : 2; /** Band Info - (00)=2.4GHz, (01)=5GHz */ - t_u8 chanBand:2; + t_u8 chanBand : 2; #else /** Band Info - (00)=2.4GHz, (01)=5GHz */ - t_u8 chanBand:2; + t_u8 chanBand : 2; /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth:2; + t_u8 chanWidth : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ - t_u8 chan2Offset:2; + t_u8 chan2Offset : 2; /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=Adoption mode*/ - t_u8 scanMode:2; + t_u8 scanMode : 2; #endif } MLAN_PACK_END Band_Config_t; @@ -1022,17 +1069,56 @@ /** mlan_cmdresp_event data structure */ typedef struct _mlan_cmdresp_event { - /** BSS index number for multiple BSS support */ + /** BSS index number for multiple BSS support */ t_u32 bss_index; - /** Event ID */ + /** Event ID */ mlan_event_id event_id; - /** Event length */ + /** Event length */ t_u32 event_len; - /** resp buffer pointer */ + /** resp buffer pointer */ t_u8 *resp; } mlan_cmdresp_event, *pmlan_cmdresp_event; /** csi event data structure */ +typedef MLAN_PACK_START struct _csi_record_ds { + /** Length in DWORDS, including header */ + t_u16 Len; + /** CSI signature. 0xABCD fixed */ + t_u16 CSI_Sign; + /** User defined HeaderID */ + t_u32 CSI_HeaderID; + /** Packet info field */ + t_u16 PKT_info; + /** Frame control field for the received packet*/ + t_u16 FCF; + /** Timestamp when packet received */ + t_u64 TSF; + /** Received Packet Destination MAC Address */ + t_u8 Dst_MAC[6]; + /** Received Packet Source MAC Address */ + t_u8 Src_MAC[6]; + /** RSSI for antenna A */ + t_u8 Rx_RSSI_A; + /** RSSI for antenna B */ + t_u8 Rx_RSSI_B; + /** Noise floor for antenna A */ + t_u8 Rx_NF_A; + /** Noise floor for antenna A */ + t_u8 Rx_NF_B; + /** Rx signal strength above noise floor */ + t_u8 Rx_SINR; + /** Channel */ + t_u8 channel; + /** user defined Chip ID */ + t_u16 chip_id; + /** Reserved */ + t_u32 rsvd; + /** CSI data length in DWORDs */ + t_u32 CSI_Data_Length; + /** Start of CSI data */ + t_u8 CSI_Data[0]; + /** At the end of CSI raw data, user defined TailID of 4 bytes*/ +} MLAN_PACK_END csi_record_ds, *pcsi_record_ds; /** mlan_ioctl_req data structure */ typedef struct _mlan_ioctl_req { @@ -1060,26 +1146,70 @@ t_ptr reserved_1; } mlan_ioctl_req, *pmlan_ioctl_req; +typedef MLAN_PACK_START struct _mix_rate_info { + /** bit0: LGI: gi=0, SGI: gi= 1 */ + /** bit1-2: 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ + /** bit3-4: LG: format=0, HT: format=1, VHT: format=2 */ + /** bit5: LDPC: 0-not support, 1-support */ + /** bit6-7:reserved */ + t_u8 rate_info; + /** MCS index */ + t_u8 mcs_index; + /** bitrate, in 500Kbps */ + t_u16 bitrate; +} MLAN_PACK_END mix_rate_info, *pmix_rate_info; + +typedef MLAN_PACK_START struct _rxpd_extra_info { + /** flags */ + t_u8 flags; + /** channel.flags */ + t_u16 channel_flags; + /** mcs.known */ + t_u8 mcs_known; + /** mcs.flags */ + t_u8 mcs_flags; + /** vht sig1 */ + t_u32 vht_sig1; + /** vht sig2 */ + t_u32 vht_sig2; +} MLAN_PACK_END rxpd_extra_info, *prxpd_extra_info; + +typedef MLAN_PACK_START struct _radiotap_info { + /** Rate Info */ + mix_rate_info rate_info; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** band config */ + t_u8 band_config; + /** chan number */ + t_u8 chan_num; + t_u8 antenna; + /** extra rxpd info from FW */ + rxpd_extra_info extra_info; +} MLAN_PACK_END radiotap_info, *pradiotap_info; + /** txpower structure */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT /** Host tx power ctrl: 0x0: use fw setting for TX power 0x1: value specified in bit[6] and bit[5:0] are valid */ - t_u8 hostctl:1; + t_u8 hostctl : 1; /** Sign of the power specified in bit[5:0] */ - t_u8 sign:1; + t_u8 sign : 1; /** Power to be used for transmission(in dBm) */ - t_u8 abs_val:6; + t_u8 abs_val : 6; #else /** Power to be used for transmission(in dBm) */ - t_u8 abs_val:6; + t_u8 abs_val : 6; /** Sign of the power specified in bit[5:0] */ - t_u8 sign:1; + t_u8 sign : 1; /** Host tx power ctrl: 0x0: use fw setting for TX power 0x1: value specified in bit[6] and bit[5:0] are valid */ - t_u8 hostctl:1; + t_u8 hostctl : 1; #endif } MLAN_PACK_END tx_power_t; /* pkt_txctrl */ @@ -1111,6 +1241,25 @@ t_u8 rssi; } MLAN_PACK_END pkt_rxinfo, *ppkt_rxinfo; +#define MC_FLAG_RETRY MBIT(0) +#define MC_FLAG_START_CYCLE MBIT(1) +#define MC_FLAG_END_CYCLE MBIT(2) +#define MC_FLAG_START_AMPDU MBIT(3) +#define MC_FLAG_END_AMPDU MBIT(4) +/* mc pkt txcontrol */ +typedef MLAN_PACK_START struct _mc_txcontrol { + /** Data rate in mcs index, 0-7 */ + t_u8 mcs_index; + /** band width 0-20Mhz, 1-40Mhz */ + t_u8 bandwidth; + /** seq_num */ + t_u16 seq_num; + /** packet expiry time */ + t_u32 pkt_expiry; + /** mc_pkt_flags */ + t_u8 mc_pkt_flags; +} MLAN_PACK_END mc_txcontrol, *pmc_txcontrol; + /** mlan_buffer data structure */ typedef struct _mlan_buffer { /** Pointer to previous mlan_buffer */ @@ -1152,7 +1301,7 @@ t_u32 out_ts_usec; /** tx_seq_num */ t_u32 tx_seq_num; - /** Time stamp when packet is deque from rx_q(seconds) */ + /** Time stamp when packet is deque from rx_q(seconds) */ t_u32 extra_ts_sec; /** Time stamp when packet is dequed from rx_q(micro seconds) */ t_u32 extra_ts_usec; @@ -1162,6 +1311,7 @@ /** Use count for this buffer */ t_u32 use_count; union { + mc_txcontrol mc_tx_info; pkt_txctrl tx_info; pkt_rxinfo rx_info; } u; @@ -1228,8 +1378,8 @@ MLAN_WMM_STATS_ACTION_START = 0, MLAN_WMM_STATS_ACTION_STOP = 1, MLAN_WMM_STATS_ACTION_GET_CLR = 2, - MLAN_WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */ - MLAN_WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */ + MLAN_WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */ + MLAN_WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */ MLAN_WMM_STATS_ACTION_MAX } MLAN_PACK_END mlan_wmm_queue_stats_action_e; @@ -1255,7 +1405,7 @@ } MLAN_PACK_END wlan_ioctl_wmm_ts_status_t, /** Type definition of mlan_ds_wmm_ts_status for MLAN_OID_WMM_CFG_TS_STATUS */ -mlan_ds_wmm_ts_status, *pmlan_ds_wmm_ts_status; + mlan_ds_wmm_ts_status, *pmlan_ds_wmm_ts_status; /** Max Ie length */ #define MAX_IE_SIZE 256 @@ -1572,17 +1722,17 @@ /** wifi rate */ typedef struct { /** 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */ - t_u32 preamble:3; + t_u32 preamble : 3; /** 0:1x1, 1:2x2, 3:3x3, 4:4x4 */ - t_u32 nss:2; + t_u32 nss : 2; /** 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */ - t_u32 bw:3; + t_u32 bw : 3; /** OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps */ /** HT/VHT it would be mcs index */ - t_u32 rateMcsIdx:8; + t_u32 rateMcsIdx : 8; /** reserved */ - t_u32 reserved:16; + t_u32 reserved : 16; /** units of 100 Kbps */ t_u32 bitrate; } wifi_rate; @@ -1602,6 +1752,15 @@ t_u32 time_usec; } wifi_timeval; +#define timeval_to_msec(timeval) \ + (t_u64)((t_u64)(timeval.time_sec) * 1000 + \ + (t_u64)(timeval.time_usec) / 1000) +#define timeval_to_usec(timeval) \ + (t_u64)((t_u64)(timeval.time_sec) * 1000 * 1000 + \ + (t_u64)(timeval.time_usec)) +#define is_zero_timeval(timeval) \ + ((timeval.time_sec == 0) && (timeval.time_usec == 0)) + #define MAX_NUM_RATE 32 #define MAX_RADIO 2 #define MAX_NUM_CHAN 1 @@ -1683,15 +1842,6 @@ t_u32 cca_busy_time; } wifi_channel_stat; -#define timeval_to_msec(timeval) \ - (t_u64)((t_u64)(timeval.time_sec) * 1000 + \ - (t_u64)(timeval.time_usec) / 1000) -#define timeval_to_usec(timeval) \ - (t_u64)((t_u64)(timeval.time_sec) * 1000 * 1000 + \ - (t_u64)(timeval.time_usec)) -#define is_zero_timeval(timeval) \ - ((timeval.time_sec == 0) && (timeval.time_usec == 0)) - /** radio statistics */ typedef struct { /** wifi radio (if multiple radio supported) */ @@ -1705,7 +1855,7 @@ t_u32 reserved0; /** TBD: tx_time_per_levels: pointer to an array of radio transmit per * power levels in msecs accured over time */ - /* t_u32 *reserved1; */ + /* t_u32 *reserved1;*/ /** msecs the radio is in active receive (32 bits number accruing over * time) */ t_u32 rx_time; @@ -1815,7 +1965,7 @@ /** interface statistics */ typedef struct { /** wifi interface */ - /* wifi_interface_handle iface; */ + /* wifi_interface_handle iface;*/ /** current state of the interface */ mlan_interface_link_layer_info info; /** access point beacon received count from connected AP */ @@ -1887,7 +2037,16 @@ /** station stats */ typedef struct _sta_stats { + /** last_rx_in_msec */ t_u64 last_rx_in_msec; + /** rx_packets */ + t_u32 rx_packets; + /** tx packets */ + t_u32 tx_packets; + /** rx bytes */ + t_u32 rx_bytes; + /** tx bytes */ + t_u32 tx_bytes; } sta_stats; #ifdef PRAGMA_PACK @@ -1897,171 +2056,156 @@ /** mlan_callbacks data structure */ typedef struct _mlan_callbacks { /** moal_get_fw_data */ - mlan_status (*moal_get_fw_data) (t_void *pmoal, - t_u32 offset, t_u32 len, t_u8 *pbuf); - mlan_status (*moal_get_vdll_data) (t_void *pmoal, t_u32 len, - t_u8 *pbuf); + mlan_status (*moal_get_fw_data)(t_void *pmoal, t_u32 offset, t_u32 len, + t_u8 *pbuf); + mlan_status (*moal_get_vdll_data)(t_void *pmoal, t_u32 len, t_u8 *pbuf); /** moal_get_hw_spec_complete */ - mlan_status (*moal_get_hw_spec_complete) (t_void *pmoal, - mlan_status status, - pmlan_hw_info phw, - pmlan_bss_tbl ptbl); + mlan_status (*moal_get_hw_spec_complete)(t_void *pmoal, + mlan_status status, + pmlan_hw_info phw, + pmlan_bss_tbl ptbl); /** moal_init_fw_complete */ - mlan_status (*moal_init_fw_complete) (t_void *pmoal, - mlan_status status); + mlan_status (*moal_init_fw_complete)(t_void *pmoal, mlan_status status); /** moal_shutdown_fw_complete */ - mlan_status (*moal_shutdown_fw_complete) (t_void *pmoal, - mlan_status status); + mlan_status (*moal_shutdown_fw_complete)(t_void *pmoal, + mlan_status status); /** moal_send_packet_complete */ - mlan_status (*moal_send_packet_complete) (t_void *pmoal, - pmlan_buffer pmbuf, - mlan_status status); + mlan_status (*moal_send_packet_complete)(t_void *pmoal, + pmlan_buffer pmbuf, + mlan_status status); /** moal_recv_complete */ - mlan_status (*moal_recv_complete) (t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port, - mlan_status status); + mlan_status (*moal_recv_complete)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port, mlan_status status); /** moal_recv_packet */ - mlan_status (*moal_recv_packet) (t_void *pmoal, pmlan_buffer pmbuf); - /** moal_recv_amsdu_packet */ - mlan_status (*moal_recv_amsdu_packet) (t_void *pmoal, - pmlan_buffer pmbuf); + mlan_status (*moal_recv_packet)(t_void *pmoal, pmlan_buffer pmbuf); + /** moal_recv_amsdu_packet */ + mlan_status (*moal_recv_amsdu_packet)(t_void *pmoal, + pmlan_buffer pmbuf); /** moal_recv_event */ - mlan_status (*moal_recv_event) (t_void *pmoal, pmlan_event pmevent); + mlan_status (*moal_recv_event)(t_void *pmoal, pmlan_event pmevent); /** moal_ioctl_complete */ - mlan_status (*moal_ioctl_complete) (t_void *pmoal, - pmlan_ioctl_req pioctl_req, - mlan_status status); + mlan_status (*moal_ioctl_complete)(t_void *pmoal, + pmlan_ioctl_req pioctl_req, + mlan_status status); /** moal_alloc_mlan_buffer */ - mlan_status (*moal_alloc_mlan_buffer) (t_void *pmoal, - t_u32 size, ppmlan_buffer pmbuf); + mlan_status (*moal_alloc_mlan_buffer)(t_void *pmoal, t_u32 size, + ppmlan_buffer pmbuf); /** moal_free_mlan_buffer */ - mlan_status (*moal_free_mlan_buffer) (t_void *pmoal, - pmlan_buffer pmbuf); + mlan_status (*moal_free_mlan_buffer)(t_void *pmoal, pmlan_buffer pmbuf); #ifdef USB /** moal_write_data_async */ - mlan_status (*moal_write_data_async) (t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port); -#endif /* USB */ + mlan_status (*moal_write_data_async)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port); +#endif /* USB */ #if defined(SDIO) || defined(PCIE) /** moal_write_reg */ - mlan_status (*moal_write_reg) (t_void *pmoal, t_u32 reg, t_u32 data); + mlan_status (*moal_write_reg)(t_void *pmoal, t_u32 reg, t_u32 data); /** moal_read_reg */ - mlan_status (*moal_read_reg) (t_void *pmoal, t_u32 reg, t_u32 *data); -#endif /* SDIO || PCIE */ + mlan_status (*moal_read_reg)(t_void *pmoal, t_u32 reg, t_u32 *data); +#endif /* SDIO || PCIE */ /** moal_write_data_sync */ - mlan_status (*moal_write_data_sync) (t_void *pmoal, - pmlan_buffer pmbuf, - t_u32 port, t_u32 timeout); - /** moal_read_data_sync */ - mlan_status (*moal_read_data_sync) (t_void *pmoal, - pmlan_buffer pmbuf, + mlan_status (*moal_write_data_sync)(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, t_u32 timeout); + /** moal_read_data_sync */ + mlan_status (*moal_read_data_sync)(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port, t_u32 timeout); /** moal_malloc */ - mlan_status (*moal_malloc) (t_void *pmoal, t_u32 size, - t_u32 flag, t_u8 **ppbuf); + mlan_status (*moal_malloc)(t_void *pmoal, t_u32 size, t_u32 flag, + t_u8 **ppbuf); /** moal_mfree */ - mlan_status (*moal_mfree) (t_void *pmoal, t_u8 *pbuf); + mlan_status (*moal_mfree)(t_void *pmoal, t_u8 *pbuf); /** moal_vmalloc */ - mlan_status (*moal_vmalloc) (t_void *pmoal, t_u32 size, t_u8 **ppbuf); + mlan_status (*moal_vmalloc)(t_void *pmoal, t_u32 size, t_u8 **ppbuf); /** moal_vfree */ - mlan_status (*moal_vfree) (t_void *pmoal, t_u8 *pbuf); + mlan_status (*moal_vfree)(t_void *pmoal, t_u8 *pbuf); #ifdef PCIE /** moal_malloc_consistent */ - mlan_status (*moal_malloc_consistent) (t_void *pmoal, - t_u32 size, t_u8 **ppbuf, - t_u64 *pbuf_pa); + mlan_status (*moal_malloc_consistent)(t_void *pmoal, t_u32 size, + t_u8 **ppbuf, t_u64 *pbuf_pa); /** moal_mfree_consistent */ - mlan_status (*moal_mfree_consistent) (t_void *pmoal, - t_u32 size, t_u8 *pbuf, - t_u64 buf_pa); + mlan_status (*moal_mfree_consistent)(t_void *pmoal, t_u32 size, + t_u8 *pbuf, t_u64 buf_pa); /** moal_map_memory */ - mlan_status (*moal_map_memory) (t_void *pmoal, t_u8 *pbuf, - t_u64 *pbuf_pa, t_u32 size, t_u32 flag); + mlan_status (*moal_map_memory)(t_void *pmoal, t_u8 *pbuf, + t_u64 *pbuf_pa, t_u32 size, t_u32 flag); /** moal_unmap_memory */ - mlan_status (*moal_unmap_memory) (t_void *pmoal, t_u8 *pbuf, - t_u64 buf_pa, t_u32 size, t_u32 flag); -#endif /* PCIE */ + mlan_status (*moal_unmap_memory)(t_void *pmoal, t_u8 *pbuf, + t_u64 buf_pa, t_u32 size, t_u32 flag); +#endif /* PCIE */ /** moal_memset */ - t_void *(*moal_memset) (t_void *pmoal, t_void *pmem, - t_u8 byte, t_u32 num); + t_void *(*moal_memset)(t_void *pmoal, t_void *pmem, t_u8 byte, + t_u32 num); /** moal_memcpy */ - t_void *(*moal_memcpy) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); + t_void *(*moal_memcpy)(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num); /** moal_memcpy_ext */ - t_void *(*moal_memcpy_ext) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num, - t_u32 dest_size); + t_void *(*moal_memcpy_ext)(t_void *pmoal, t_void *pdest, + const t_void *psrc, t_u32 num, + t_u32 dest_size); /** moal_memmove */ - t_void *(*moal_memmove) (t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); + t_void *(*moal_memmove)(t_void *pmoal, t_void *pdest, + const t_void *psrc, t_u32 num); /** moal_memcmp */ - t_s32 (*moal_memcmp) (t_void *pmoal, const t_void *pmem1, - const t_void *pmem2, t_u32 num); + t_s32 (*moal_memcmp)(t_void *pmoal, const t_void *pmem1, + const t_void *pmem2, t_u32 num); /** moal_udelay */ - t_void (*moal_udelay) (t_void *pmoal, t_u32 udelay); + t_void (*moal_udelay)(t_void *pmoal, t_u32 udelay); /** moal_usleep_range */ - t_void (*moal_usleep_range) (t_void *pmoal, - t_u32 min_delay, t_u32 max_delay); + t_void (*moal_usleep_range)(t_void *pmoal, t_u32 min_delay, + t_u32 max_delay); /** moal_get_boot_ktime */ - mlan_status (*moal_get_boot_ktime) (t_void *pmoal, t_u64 *pnsec); + mlan_status (*moal_get_boot_ktime)(t_void *pmoal, t_u64 *pnsec); /** moal_get_system_time */ - mlan_status (*moal_get_system_time) (t_void *pmoal, - t_u32 *psec, t_u32 *pusec); + mlan_status (*moal_get_system_time)(t_void *pmoal, t_u32 *psec, + t_u32 *pusec); /** moal_init_timer*/ - mlan_status (*moal_init_timer) (t_void *pmoal, - t_void **pptimer, - IN t_void (*callback) (t_void - *pcontext), - t_void *pcontext); + mlan_status (*moal_init_timer)(t_void *pmoal, t_void **pptimer, + IN t_void (*callback)(t_void *pcontext), + t_void *pcontext); /** moal_free_timer */ - mlan_status (*moal_free_timer) (t_void *pmoal, t_void *ptimer); + mlan_status (*moal_free_timer)(t_void *pmoal, t_void *ptimer); /** moal_start_timer*/ - mlan_status (*moal_start_timer) (t_void *pmoal, - t_void *ptimer, t_u8 periodic, - t_u32 msec); + mlan_status (*moal_start_timer)(t_void *pmoal, t_void *ptimer, + t_u8 periodic, t_u32 msec); /** moal_stop_timer*/ - mlan_status (*moal_stop_timer) (t_void *pmoal, t_void *ptimer); + mlan_status (*moal_stop_timer)(t_void *pmoal, t_void *ptimer); /** moal_init_lock */ - mlan_status (*moal_init_lock) (t_void *pmoal, t_void **pplock); + mlan_status (*moal_init_lock)(t_void *pmoal, t_void **pplock); /** moal_free_lock */ - mlan_status (*moal_free_lock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_free_lock)(t_void *pmoal, t_void *plock); /** moal_spin_lock */ - mlan_status (*moal_spin_lock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_spin_lock)(t_void *pmoal, t_void *plock); /** moal_spin_unlock */ - mlan_status (*moal_spin_unlock) (t_void *pmoal, t_void *plock); + mlan_status (*moal_spin_unlock)(t_void *pmoal, t_void *plock); /** moal_print */ - t_void (*moal_print) (t_void *pmoal, t_u32 level, - char *pformat, IN ...); + t_void (*moal_print)(t_void *pmoal, t_u32 level, char *pformat, IN...); /** moal_print_netintf */ - t_void (*moal_print_netintf) (t_void *pmoal, - t_u32 bss_index, t_u32 level); + t_void (*moal_print_netintf)(t_void *pmoal, t_u32 bss_index, + t_u32 level); /** moal_assert */ - t_void (*moal_assert) (t_void *pmoal, t_u32 cond); + t_void (*moal_assert)(t_void *pmoal, t_u32 cond); /** moal_hist_data_add */ - t_void (*moal_hist_data_add) (t_void *pmoal, - t_u32 bss_index, t_u16 rx_rate, - t_s8 snr, t_s8 nflr, t_u8 antenna); - t_void (*moal_updata_peer_signal) (t_void *pmoal, - t_u32 bss_index, - t_u8 *peer_addr, t_s8 snr, - t_s8 nflr); - t_u64 (*moal_do_div) (t_u64 num, t_u32 base); + t_void (*moal_hist_data_add)(t_void *pmoal, t_u32 bss_index, + t_u16 rx_rate, t_s8 snr, t_s8 nflr, + t_u8 antenna); + t_void (*moal_updata_peer_signal)(t_void *pmoal, t_u32 bss_index, + t_u8 *peer_addr, t_s8 snr, t_s8 nflr); + t_u64 (*moal_do_div)(t_u64 num, t_u32 base); #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) - mlan_status (*moal_wait_hostcmd_complete) (t_void *pmoal, - t_u32 bss_index); - mlan_status (*moal_notify_hostcmd_complete) (t_void *pmoal, - t_u32 bss_index); + mlan_status (*moal_wait_hostcmd_complete)(t_void *pmoal, + t_u32 bss_index); + mlan_status (*moal_notify_hostcmd_complete)(t_void *pmoal, + t_u32 bss_index); #endif - void (*moal_tp_accounting) (t_void *pmoal, - t_void *buf, t_u32 drop_point); - void (*moal_tp_accounting_rx_param) (t_void *pmoal, - unsigned int type, - unsigned int rsvd1); - void (*moal_amsdu_tp_accounting) (t_void *pmoal, t_s32 delay, - t_s32 copy_delay); + void (*moal_tp_accounting)(t_void *pmoal, t_void *buf, + t_u32 drop_point); + void (*moal_tp_accounting_rx_param)(t_void *pmoal, unsigned int type, + unsigned int rsvd1); + void (*moal_amsdu_tp_accounting)(t_void *pmoal, t_s32 delay, + t_s32 copy_delay); } mlan_callbacks, *pmlan_callbacks; /** Parameter unchanged, use MLAN default setting */ @@ -2183,6 +2327,8 @@ t_u8 indication_gpio; /** Dynamic MIMO-SISO switch for hscfg*/ t_u8 hs_mimo_switch; + /** channel time and mode for DRCS*/ + t_u32 drcs_chantime_mode; #ifdef USB /** Tx CMD endpoint address */ t_u8 tx_cmd_ep; @@ -2193,6 +2339,8 @@ t_u8 rx_data_ep; /** Tx data endpoint address */ t_u8 tx_data_ep; + /** Tx data second endpoint address */ + t_u8 tx_data2_ep; #endif /** passive to active scan */ t_u8 passive_to_active_scan; @@ -2202,8 +2350,12 @@ t_u32 drv_mode; /** dfs w53 cfg */ t_u8 dfs53cfg; - /** extend enhance scan */ + /** dfs_offload */ + t_u8 dfs_offload; + /** extend enhance scan */ t_u8 ext_scan; + /* mcs32 setting */ + t_u8 mcs32; } mlan_device, *pmlan_device; /** MLAN API function prototype */ @@ -2285,4 +2437,6 @@ /** mlan unmask host interrupt */ MLAN_API mlan_status mlan_enable_host_int(t_void *padapter); +#define CSI_SIGNATURE 0xABCD + #endif /* !_MLAN_DECL_H_ */
diff --git a/wlan_sd8987/mlinux/mlan_ieee.h b/wlan_sd8987/mlinux/mlan_ieee.h index aec54d5..cf2ef85 100755 --- a/wlan_sd8987/mlinux/mlan_ieee.h +++ b/wlan_sd8987/mlinux/mlan_ieee.h
@@ -4,7 +4,7 @@ * definitions used in MLAN and MOAL module. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -42,7 +42,7 @@ typedef enum _WLAN_802_11_NETWORK_TYPE { Wlan802_11FH, Wlan802_11DS, - /* Defined as upper bound */ + /* Defined as upper bound*/ Wlan802_11NetworkTypeMax } WLAN_802_11_NETWORK_TYPE; @@ -67,7 +67,8 @@ typedef enum _IEEEtypes_Ext_ElementId_e { HE_CAPABILITY = 35, - HE_OPERATION = 36 + HE_OPERATION = 36, + HE_6G_CAPABILITY = 59 } IEEEtypes_Ext_ElementId_e; /** IEEE Type definitions */ @@ -101,7 +102,7 @@ MBSSID_INDEX = 85, EXT_CAPABILITY = 127, LINK_ID = 101, - /*IEEE802.11r */ + /*IEEE802.11r*/ MOBILITY_DOMAIN = 54, FAST_BSS_TRANSITION = 55, TIMEOUT_INTERVAL = 56, @@ -180,18 +181,18 @@ typedef MLAN_PACK_START struct _IEEEtypes_FtCapPolicy_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:6; + t_u8 reserved : 6; /** RIC support */ - t_u8 ric:1; + t_u8 ric : 1; /** FT over the DS capable */ - t_u8 ft_over_ds:1; + t_u8 ft_over_ds : 1; #else /** FT over the DS capable */ - t_u8 ft_over_ds:1; + t_u8 ft_over_ds : 1; /** RIC support */ - t_u8 ric:1; + t_u8 ric : 1; /** Reserved */ - t_u8 reserved:6; + t_u8 reserved : 6; #endif } MLAN_PACK_END IEEEtypes_FtCapPolicy_t; @@ -327,54 +328,54 @@ /** Capability Bit Map*/ #ifdef BIG_ENDIAN_SUPPORT typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { - t_u8 rsrvd1:2; - t_u8 dsss_ofdm:1; - t_u8 radio_measurement:1; - t_u8 rsvrd2:1; - t_u8 short_slot_time:1; - t_u8 rsrvd3:1; - t_u8 spectrum_mgmt:1; - t_u8 chan_agility:1; - t_u8 pbcc:1; - t_u8 short_preamble:1; - t_u8 privacy:1; - t_u8 cf_poll_rqst:1; - t_u8 cf_pollable:1; - t_u8 ibss:1; - t_u8 ess:1; + t_u8 rsrvd1 : 2; + t_u8 dsss_ofdm : 1; + t_u8 radio_measurement : 1; + t_u8 rsvrd2 : 1; + t_u8 short_slot_time : 1; + t_u8 rsrvd3 : 1; + t_u8 spectrum_mgmt : 1; + t_u8 chan_agility : 1; + t_u8 pbcc : 1; + t_u8 short_preamble : 1; + t_u8 privacy : 1; + t_u8 cf_poll_rqst : 1; + t_u8 cf_pollable : 1; + t_u8 ibss : 1; + t_u8 ess : 1; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #else typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { /** Capability Bit Map : ESS */ - t_u8 ess:1; + t_u8 ess : 1; /** Capability Bit Map : IBSS */ - t_u8 ibss:1; + t_u8 ibss : 1; /** Capability Bit Map : CF pollable */ - t_u8 cf_pollable:1; + t_u8 cf_pollable : 1; /** Capability Bit Map : CF poll request */ - t_u8 cf_poll_rqst:1; + t_u8 cf_poll_rqst : 1; /** Capability Bit Map : privacy */ - t_u8 privacy:1; + t_u8 privacy : 1; /** Capability Bit Map : Short preamble */ - t_u8 short_preamble:1; + t_u8 short_preamble : 1; /** Capability Bit Map : PBCC */ - t_u8 pbcc:1; + t_u8 pbcc : 1; /** Capability Bit Map : Channel agility */ - t_u8 chan_agility:1; + t_u8 chan_agility : 1; /** Capability Bit Map : Spectrum management */ - t_u8 spectrum_mgmt:1; + t_u8 spectrum_mgmt : 1; /** Capability Bit Map : Reserved */ - t_u8 rsrvd3:1; + t_u8 rsrvd3 : 1; /** Capability Bit Map : Short slot time */ - t_u8 short_slot_time:1; + t_u8 short_slot_time : 1; /** Capability Bit Map : APSD */ - t_u8 Apsd:1; + t_u8 Apsd : 1; /** Capability Bit Map : Reserved */ - t_u8 rsvrd2:1; + t_u8 rsvrd2 : 1; /** Capability Bit Map : DSS OFDM */ - t_u8 dsss_ofdm:1; + t_u8 dsss_ofdm : 1; /** Capability Bit Map : Reserved */ - t_u8 rsrvd1:2; + t_u8 rsrvd1 : 2; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #endif /* BIG_ENDIAN_SUPPORT */ @@ -478,9 +479,9 @@ /** IEEEtypes_SeqCtl_t */ typedef MLAN_PACK_START struct _IEEEtypes_SeqCtl_t { /** Fragment Number */ - t_u16 FragNum:4; + t_u16 FragNum : 4; /** Sequence Number */ - t_u16 SeqNum:12; + t_u16 SeqNum : 12; } MLAN_PACK_END IEEEtypes_SeqCtl_t; /** IEEEtypes_MgmtHdr_t */ @@ -593,63 +594,63 @@ typedef MLAN_PACK_START struct _IEEEtypes_WmmQosInfo_t { #ifdef BIG_ENDIAN_SUPPORT /** QoS UAPSD */ - t_u8 qos_uapsd:1; + t_u8 qos_uapsd : 1; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; #else /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** QoS UAPSD */ - t_u8 qos_uapsd:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 qos_uapsd : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmQosInfo_t, *pIEEEtypes_WmmQosInfo_t; /** Data structure of WMM Aci/Aifsn */ typedef MLAN_PACK_START struct _IEEEtypes_WmmAciAifsn_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:1; + t_u8 reserved : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; #else /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Reserved */ - t_u8 reserved:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmAciAifsn_t, *pIEEEtypes_WmmAciAifsn_t; /** Data structure of WMM ECW */ typedef MLAN_PACK_START struct _IEEEtypes_WmmEcw_t { #ifdef BIG_ENDIAN_SUPPORT /** Maximum Ecw */ - t_u8 ecw_max:4; + t_u8 ecw_max : 4; /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; #else /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; /** Maximum Ecw */ - t_u8 ecw_max:4; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 ecw_max : 4; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END IEEEtypes_WmmEcw_t, *pIEEEtypes_WmmEcw_t; /** Data structure of WMM AC parameters */ typedef MLAN_PACK_START struct _IEEEtypes_WmmAcParameters_t { IEEEtypes_WmmAciAifsn_t aci_aifsn; /**< AciAifSn */ - IEEEtypes_WmmEcw_t ecw; /**< Ecw */ + IEEEtypes_WmmEcw_t ecw; /**< Ecw */ t_u16 tx_op_limit; /**< Tx op limit */ } MLAN_PACK_END IEEEtypes_WmmAcParameters_t, *pIEEEtypes_WmmAcParameters_t; @@ -732,57 +733,59 @@ /** Data structure of WMM TSPEC information */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 Reserved17_23:7; /* ! Reserved */ - t_u8 Schedule:1; - IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy:2; - t_u8 UserPri:3; /* ! 802.1d User Priority */ - //IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* !Legacy/Trigg*/ - t_u8 PowerSaveBehavior:1; - t_u8 Aggregation:1; /* ! Reserved */ - t_u8 AccessPolicy2:1; /* ! */ - t_u8 AccessPolicy1:1; /* ! */ - IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction:2; - t_u8 TID:4; /* ! Unique identifier */ - //IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; - t_u8 TrafficType:1; + t_u8 Reserved17_23 : 7; /* ! Reserved */ + t_u8 Schedule : 1; + IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy : 2; + t_u8 UserPri : 3; /* ! 802.1d User Priority */ + // IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* + // !Legacy/Trigg*/ + t_u8 PowerSaveBehavior : 1; + t_u8 Aggregation : 1; /* ! Reserved */ + t_u8 AccessPolicy2 : 1; /* ! */ + t_u8 AccessPolicy1 : 1; /* ! */ + IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction : 2; + t_u8 TID : 4; /* ! Unique identifier */ + // IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; + t_u8 TrafficType : 1; #else - //IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; - t_u8 TrafficType:1; - t_u8 TID:4; /* ! Unique identifier */ - IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction:2; - t_u8 AccessPolicy1:1; /* ! */ - t_u8 AccessPolicy2:1; /* ! */ - t_u8 Aggregation:1; /* ! Reserved */ - //IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* ! Legacy/Trigg*/ - t_u8 PowerSaveBehavior:1; - t_u8 UserPri:3; /* ! 802.1d User Priority */ - IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy:2; - t_u8 Schedule:1; - t_u8 Reserved17_23:7; /* ! Reserved */ + // IEEEtypes_WMM_TSPEC_TS_TRAFFIC_TYPE_e TrafficType : 1; + t_u8 TrafficType : 1; + t_u8 TID : 4; /* ! Unique identifier */ + IEEEtypes_WMM_TSPEC_TS_Info_Direction_e Direction : 2; + t_u8 AccessPolicy1 : 1; /* ! */ + t_u8 AccessPolicy2 : 1; /* ! */ + t_u8 Aggregation : 1; /* ! Reserved */ + // IEEEtypes_WMM_TSPEC_TS_Info_PSB_e PowerSaveBehavior : 1; /* ! + // Legacy/Trigg*/ + t_u8 PowerSaveBehavior : 1; + t_u8 UserPri : 3; /* ! 802.1d User Priority */ + IEEEtypes_WMM_TSPEC_TS_Info_AckPolicy_e AckPolicy : 2; + t_u8 Schedule : 1; + t_u8 Reserved17_23 : 7; /* ! Reserved */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_TS_Info_t; /** Data structure of WMM TSPEC Nominal Size */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u16 Fixed:1; /* ! 1: Fixed size given in Size, 0: Var, size is - nominal */ - t_u16 Size:15; /* ! Nominal size in octets */ + t_u16 Fixed : 1; /* ! 1: Fixed size given in Size, 0: Var, size is + nominal */ + t_u16 Size : 15; /* ! Nominal size in octets */ #else - t_u16 Size:15; /* ! Nominal size in octets */ - t_u16 Fixed:1; /* ! 1: Fixed size given in Size, 0: Var, size is - nominal */ + t_u16 Size : 15; /* ! Nominal size in octets */ + t_u16 Fixed : 1; /* ! 1: Fixed size given in Size, 0: Var, size is + nominal */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_NomMSDUSize_t; /** Data structure of WMM TSPEC SBWA */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u16 Whole:3; /* ! Whole portion */ - t_u16 Fractional:13; /* ! Fractional portion */ + t_u16 Whole : 3; /* ! Whole portion */ + t_u16 Fractional : 13; /* ! Fractional portion */ #else - t_u16 Fractional:13; /* ! Fractional portion */ - t_u16 Whole:3; /* ! Whole portion */ + t_u16 Fractional : 13; /* ! Fractional portion */ + t_u16 Whole : 3; /* ! Whole portion */ #endif } MLAN_PACK_END IEEEtypes_WMM_TSPEC_SBWA; @@ -810,8 +813,8 @@ typedef MLAN_PACK_START struct { t_u8 ElementId; t_u8 Len; - t_u8 OuiType[4]; /* 00:50:f2:02 */ - t_u8 OuiSubType; /* 01 */ + t_u8 OuiType[4]; /* 00:50:f2:02 */ + t_u8 OuiSubType; /* 01 */ t_u8 Version; IEEEtypes_WMM_TSPEC_Body_t TspecBody; @@ -834,6 +837,7 @@ IEEE_MGMT_ACTION_CATEGORY_UNPROTECT_WNM = 11, IEEE_MGMT_ACTION_CATEGORY_WMM_TSPEC = 17 + } MLAN_PACK_END IEEEtypes_ActionCategory_e; /** WMM TSPEC operations */ @@ -994,7 +998,7 @@ typedef struct MLAN_PACK_START _DSCP_Exception_t { /* DSCP value 0 to 63 or ff */ t_u8 dscp_value; - /* user priority 0-7 */ + /* user priority 0-7*/ t_u8 user_priority; } MLAN_PACK_END DSCP_Exception_t, *pDSCP_Exception_t; @@ -1115,53 +1119,53 @@ /** VHT MCS rate set field, refer to 802.11ac */ typedef MLAN_PACK_START struct _VHT_MCS_set { t_u16 rx_mcs_map; - t_u16 rx_max_rate; /* bit 29-31 reserved */ + t_u16 rx_max_rate; /* bit 29-31 reserved */ t_u16 tx_mcs_map; - t_u16 tx_max_rate; /* bit 61-63 reserved */ + t_u16 tx_max_rate; /* bit 61-63 reserved */ } MLAN_PACK_END VHT_MCS_set_t, *pVHT_MCS_set_t; /** VHT Capabilities info field, reference 802.11ac D1.4 p89 */ typedef MLAN_PACK_START struct _VHT_capa { #if 0 #ifdef BIG_ENDIAN_SUPPORT - t_u8 mpdu_max_len:2; - t_u8 chan_width:2; - t_u8 rx_LDPC:1; - t_u8 sgi_80:1; - t_u8 sgi_160:1; - t_u8 tx_STBC:1; - t_u8 rx_STBC:3; - t_u8 SU_beamformer_capa:1; - t_u8 SU_beamformee_capa:1; - t_u8 beamformer_ante_num:3; - t_u8 sounding_dim_num:3; - t_u8 MU_beamformer_capa:1; - t_u8 MU_beamformee_capa:1; - t_u8 VHT_TXOP_ps:1; - t_u8 HTC_VHT_capa:1; - t_u8 max_ampdu_len:3; - t_u8 link_apapt_capa:2; - t_u8 reserved_1:4; + t_u8 mpdu_max_len:2; + t_u8 chan_width:2; + t_u8 rx_LDPC:1; + t_u8 sgi_80:1; + t_u8 sgi_160:1; + t_u8 tx_STBC:1; + t_u8 rx_STBC:3; + t_u8 SU_beamformer_capa:1; + t_u8 SU_beamformee_capa:1; + t_u8 beamformer_ante_num:3; + t_u8 sounding_dim_num:3; + t_u8 MU_beamformer_capa:1; + t_u8 MU_beamformee_capa:1; + t_u8 VHT_TXOP_ps:1; + t_u8 HTC_VHT_capa:1; + t_u8 max_ampdu_len:3; + t_u8 link_apapt_capa:2; + t_u8 reserved_1:4; #else - t_u8 reserved_1:4; - t_u8 link_apapt_capa:2; - t_u8 max_ampdu_len:3; - t_u8 HTC_VHT_capa:1; - t_u8 VHT_TXOP_ps:1; - t_u8 MU_beamformee_capa:1; - t_u8 MU_beamformer_capa:1; - t_u8 sounding_dim_num:3; - t_u8 beamformer_ante_num:3; - t_u8 SU_beamformee_capa:1; - t_u8 SU_beamformer_capa:1; - t_u8 rx_STBC:3; - t_u8 tx_STBC:1; - t_u8 sgi_160:1; - t_u8 sgi_80:1; - t_u8 rx_LDPC:1; - t_u8 chan_width:2; - t_u8 mpdu_max_len:2; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved_1:4; + t_u8 link_apapt_capa:2; + t_u8 max_ampdu_len:3; + t_u8 HTC_VHT_capa:1; + t_u8 VHT_TXOP_ps:1; + t_u8 MU_beamformee_capa:1; + t_u8 MU_beamformer_capa:1; + t_u8 sounding_dim_num:3; + t_u8 beamformer_ante_num:3; + t_u8 SU_beamformee_capa:1; + t_u8 SU_beamformer_capa:1; + t_u8 rx_STBC:3; + t_u8 tx_STBC:1; + t_u8 sgi_160:1; + t_u8 sgi_80:1; + t_u8 rx_LDPC:1; + t_u8 chan_width:2; + t_u8 mpdu_max_len:2; +#endif /* BIG_ENDIAN_SUPPORT */ #endif t_u32 vht_cap_info; VHT_MCS_set_t mcs_sets; @@ -1269,6 +1273,51 @@ t_u8 data[]; } MLAN_PACK_END IEEEtypes_Extension_t, *pIEEEtypes_Extension_t; +typedef MLAN_PACK_START struct _IEEEtypes_HeMcsMap_t { +#ifdef BIG_ENDIAN_SUPPORT + /** Max HE-MAC for 8 SS */ + t_u8 max_mcs_8ss : 2; + /** Max HE-MAC for 7 SS */ + t_u8 max_mcs_7ss : 2; + /** Max HE-MAC for 6 SS */ + t_u8 max_mcs_6ss : 2; + /** Max HE-MAC for 5 SS */ + t_u8 max_mcs_5ss : 2; + /** Max HE-MAC for 4 SS */ + t_u8 max_mcs_4ss : 2; + /** Max HE-MAC for 3 SS */ + t_u8 max_mcs_3ss : 2; + /** Max HE-MAC for 2 SS */ + t_u8 max_mcs_2ss : 2; + /** Max HE-MAC for 1 SS */ + t_u8 max_mcs_1ss : 2; +#else + /** Max HE-MAC for 1 SS */ + t_u8 max_mcs_1ss : 2; + /** Max HE-MAC for 2 SS */ + t_u8 max_mcs_2ss : 2; + /** Max HE-MAC for 3 SS */ + t_u8 max_mcs_3ss : 2; + /** Max HE-MAC for 4 SS */ + t_u8 max_mcs_4ss : 2; + /** Max HE-MAC for 5 SS */ + t_u8 max_mcs_5ss : 2; + /** Max HE-MAC for 6 SS */ + t_u8 max_mcs_6ss : 2; + /** Max HE-MAC for 7 SS */ + t_u8 max_mcs_7ss : 2; + /** Max HE-MAC for 8 SS */ + t_u8 max_mcs_8ss : 2; +#endif +} MLAN_PACK_END IEEEtypes_HeMcsMap_t, *pIEEEtypes_HeMcsMap_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeMcsNss_t { + /** HE Rx MCS and NSS Set */ + t_u16 rx_mcs; + /** HE Tx MCS and NSS Set*/ + t_u16 tx_mcs; +} MLAN_PACK_END IEEEtypes_HeMcsNss_t, *pIEEEtypes_HeMcsNss_t; + typedef MLAN_PACK_START struct _IEEEtypes_HECap_t { /** Generic IE header */ IEEEtypes_Header_t ieee_hdr; @@ -1278,11 +1327,85 @@ t_u8 he_mac_cap[6]; /** he phy capability info */ t_u8 he_phy_cap[11]; - /** he txrx mcs support , size would be 4 or 8 or 12 */ + /** he txrx mcs support (for 80 MHz) */ t_u8 he_txrx_mcs_support[4]; - /** PPE Thresholds (optional) */ + /** Optional Field, including he_txrx_mcs_support for 160 and 80+80 MHz, + * and PPE Thresholds */ + t_u8 option[28]; } MLAN_PACK_END IEEEtypes_HECap_t, *pIEEEtypes_HECap_t; +typedef MLAN_PACK_START struct _IEEEtypes_HeOpParam_t { +#ifdef BIG_ENDIAN_SUPPORT + /** Reserved, including 6G Operation Info Pressent (bit17) */ + t_u8 reserved : 6; /* bit 18-23 */ + /* 6g operation info present */ + t_u8 he_6g_op_info_present : 1; /* bit 17 */ + /** ER SU Disable */ + t_u8 er_su_disable : 1; /* bit 16 */ + /** Co-Hosted BSS */ + t_u16 co_located_bss : 1; /* bit 15 */ + /** VHT Operation Info Present */ + t_u16 vht_op_info_present : 1; /* bit 14 */ + /** TXOP Duration RTS Threshold */ + t_u16 txop_dur_rts_threshold : 10; /* bit 4-13 */ + /** TWT Required */ + t_u16 twt_req : 1; /* bit 3 */ + /** Default PE Duration */ + t_u16 default_pe_dur : 3; /* bit 0-2 */ +#else + /** Default PE Duration */ + t_u16 default_pe_dur : 3; /* bit 0-2 */ + /** TWT Required */ + t_u16 twt_req : 1; /* bit 3 */ + /** TXOP Duration RTS Threshold */ + t_u16 txop_dur_rts_threshold : 10; /* bit 4-13 */ + /** VHT Operation Info Present */ + t_u16 vht_op_info_present : 1; /* bit 14 */ + /** Co-Hosted BSS */ + t_u16 co_located_bss : 1; /* bit 15 */ + /** ER SU Disable */ + t_u8 er_su_disable : 1; /* bit 16 */ + /* 6g operation info present */ + t_u8 he_6g_op_info_present : 1; /* bit 17 */ + /** Reserved bit 18-23 */ + t_u8 reserved : 6; /* bit 18-23 */ +#endif +} MLAN_PACK_END IEEEtypes_HeOpParam_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeBssColorInfo_t { +#ifdef BIG_ENDIAN_SUPPORT + /** BSS Color Disabled */ + t_u8 bss_color_disabled : 1; /* bit 7 */ + /** Partial BSS Color */ + t_u8 partial_bss_color : 1; /* bit 6 */ + /** BSS Color */ + t_u8 bss_color : 6; /* bit 0-5 */ +#else + /** BSS Color */ + t_u8 bss_color : 6; /* bit 0-5 */ + /** Partial BSS Color */ + t_u8 partial_bss_color : 1; /* bit 6 */ + /** BSS Color Disabled */ + t_u8 bss_color_disabled : 1; /* bit 7 */ +#endif +} MLAN_PACK_END IEEEtypes_HeBssColorInfo_t; + +typedef MLAN_PACK_START struct _IEEEtypes_HeOp_t { + /** Generic IE header */ + IEEEtypes_Header_t ieee_hdr; + /** Element id extension */ + t_u8 ext_id; + /** HE Operation Parameters */ + IEEEtypes_HeOpParam_t he_op_param; + /** BSS Color Info */ + IEEEtypes_HeBssColorInfo_t bss_color_info; + /** Basic HE-MCS and NSS Set */ + IEEEtypes_HeMcsMap_t basic_he_mcs_nss; + /** Optional Field, including VHT Operation Info Max Co-Hosted BSSID + * Indicator, and 6Ghz Operation Info */ + t_u8 option[9]; +} MLAN_PACK_END IEEEtypes_HeOp_t; + /** default channel switch count */ #define DEF_CHAN_SWITCH_COUNT 5 @@ -1297,7 +1420,7 @@ t_u8 len; /**< Element length after id and len */ t_u8 chan_switch_mode; /**< STA should not transmit any frames if 1 */ t_u8 new_channel_num; /**< Channel # that AP/IBSS is moving to */ - t_u8 chan_switch_count; /**< # of TBTTs before channel switch */ + t_u8 chan_switch_count; /**< # of TBTTs before channel switch */ } MLAN_PACK_END IEEEtypes_ChanSwitchAnn_t; @@ -1318,7 +1441,7 @@ } MLAN_PACK_END IEEEtypes_ExtChanSwitchAnn_t; /** Maximum number of subbands in the IEEEtypes_SupportedChannels_t structure */ -#define WLAN_11H_MAX_SUBBANDS 5 +#define WLAN_11H_MAX_SUBBANDS 6 /** Maximum number of DFS channels configured in IEEEtypes_IBSS_DFS_t */ #define WLAN_11H_MAX_IBSS_DFS_CHANNELS 25 @@ -1353,7 +1476,7 @@ */ typedef MLAN_PACK_START struct { t_u8 start_chan; /**< Starting channel in the subband */ - t_u8 num_chans; /**< Number of channels in the subband */ + t_u8 num_chans; /**< Number of channels in the subband */ } MLAN_PACK_END IEEEtypes_SupportChan_Subband_t; @@ -1399,7 +1522,8 @@ t_u8 local_max_tp_20mhz; /**< Local Maximum Transmit Power for 20 MHZ>*/ t_u8 local_max_tp_40mhz; /**< Local Maximum Transmit Power for 40 MHZ>*/ t_u8 local_max_tp_80mhz; /**< Local Maximum Transmit Power for 80 MHZ>*/ - t_u8 local_max_tp_160mhz_80_80mhz; /**< Local Maximum Transmit Power for 160/80+80 MHZ>*/ + t_u8 local_max_tp_160mhz_80_80mhz; /**< Local Maximum Transmit Power for + 160/80+80 MHZ>*/ } MLAN_PACK_END IEEEtypes_VhtTpcEnvelope_t; /* IEEE Quiet Period Element (7.3.2.23) */ @@ -1427,31 +1551,31 @@ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT /**< Reserved */ - t_u8 rsvd5_7:3; + t_u8 rsvd5_7 : 3; /**< Channel is unmeasured */ - t_u8 unmeasured:1; + t_u8 unmeasured : 1; /**< Radar detected on channel */ - t_u8 radar:1; + t_u8 radar : 1; /**< Unidentified signal found on channel */ - t_u8 unidentified_sig:1; + t_u8 unidentified_sig : 1; /**< OFDM preamble detected on channel */ - t_u8 ofdm_preamble:1; + t_u8 ofdm_preamble : 1; /**< At least one valid MPDU received on channel */ - t_u8 bss:1; + t_u8 bss : 1; #else /**< At least one valid MPDU received on channel */ - t_u8 bss:1; + t_u8 bss : 1; /**< OFDM preamble detected on channel */ - t_u8 ofdm_preamble:1; + t_u8 ofdm_preamble : 1; /**< Unidentified signal found on channel */ - t_u8 unidentified_sig:1; + t_u8 unidentified_sig : 1; /**< Radar detected on channel */ - t_u8 radar:1; + t_u8 radar : 1; /**< Channel is unmeasured */ - t_u8 unmeasured:1; + t_u8 unmeasured : 1; /**< Reserved */ - t_u8 rsvd5_7:3; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 rsvd5_7 : 3; +#endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1511,9 +1635,9 @@ /*802.11z TDLS action frame type and strcuct */ typedef MLAN_PACK_START struct { - /*link indentifier ie =101 */ + /*link indentifier ie =101*/ t_u8 element_id; - /*len = 18 */ + /*len = 18*/ t_u8 len; /** bssid */ t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; @@ -1687,6 +1811,8 @@ t_u8 bssid_num; /** BSSID filter list used in the to limit the scan results */ mlan_802_11_mac_addr bssid_list[MAX_BSSID_FILTER_LIST]; + /** use scan setting from scan_cfg only */ + t_u8 scan_cfg_only; } MLAN_PACK_END wlan_user_scan_cfg; /** Default scan interval in millisecond*/ @@ -1709,7 +1835,10 @@ /**wait for all channel scan to complete to report scan result*/ #define BG_SCAN_WAIT_ALL_CHAN_DONE 0x80000000 /** Maximum number of channels that can be sent in bg scan config */ -#define WLAN_BG_SCAN_CHAN_MAX 38 +#define CHAN_MAX_24G 14 +#define CHAN_MAX_5G 24 +#define CHAN_MAX_UNII4 3 +#define WLAN_BG_SCAN_CHAN_MAX (CHAN_MAX_24G + CHAN_MAX_5G + CHAN_MAX_UNII4) /** Enumeration definition */ /** EES MODE */ @@ -1810,6 +1939,11 @@ } MLAN_PACK_END wlan_bgscan_cfg; #endif /* STA_SUPPORT */ +/** The open AP in OWE transmition Mode */ +#define OWE_TRANS_MODE_OPEN 1 +/** The security AP in OWE trsnsition Mode */ +#define OWE_TRANS_MODE_OWE 2 + #ifdef PRAGMA_PACK #pragma pack(pop) #endif @@ -1824,6 +1958,15 @@ /** SSID */ mlan_802_11_ssid ssid; + /** Transition MAC address */ + mlan_802_11_mac_addr trans_mac_address; + + /** Transition SSID */ + mlan_802_11_ssid trans_ssid; + + /** OWE Transition mode */ + t_u8 owe_transition_mode; + /** WEP encryption requirement */ t_u32 privacy; @@ -1961,7 +2104,7 @@ #ifdef STA_SUPPORT /** Country information set */ IEEEtypes_CountryInfoFullSet_t country_info; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** WPA IE */ IEEEtypes_VendorSpecific_t *pwpa_ie; @@ -1981,7 +2124,7 @@ /** WAPI IE offset in the beacon buffer */ t_u16 wapi_offset; #endif - /* Hotspot 2.0 OSEN AKM IE */ + /* Hotspot 2.0 OSEN AKM IE*/ IEEEtypes_Generic_t *posen_ie; /** osen IE offset in the beacon buffer */ t_u16 osen_offset; @@ -1996,7 +2139,7 @@ t_u32 beacon_buf_size; /** Max allocated size for updated scan response */ t_u32 beacon_buf_size_max; - /** scan age in secs */ + /** scan age in secs */ t_u32 age_in_secs; } BSSDescriptor_t, *pBSSDescriptor_t;
diff --git a/wlan_sd8987/mlinux/mlan_ioctl.h b/wlan_sd8987/mlinux/mlan_ioctl.h index 09c11a1..7790db9 100755 --- a/wlan_sd8987/mlinux/mlan_ioctl.h +++ b/wlan_sd8987/mlinux/mlan_ioctl.h
@@ -3,7 +3,7 @@ * @brief This file declares the IOCTL data structures and APIs. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -110,6 +110,8 @@ MLAN_OID_SNMP_MIB_DTIM_PERIOD = 0x00040006, MLAN_OID_SNMP_MIB_SIGNALEXT_ENABLE = 0x00040007, MLAN_OID_SNMP_MIB_CTRL_DEAUTH = 0x00040008, + MLAN_OID_SNMP_MIB_DOT11H_FAKERADAR = 0x00040009, + MLAN_OID_SNMP_MIB_CHAN_TRACK = 0x0004000A, /* Status Information Group */ MLAN_IOCTL_GET_INFO = 0x00050000, @@ -232,7 +234,10 @@ MLAN_OID_11H_CHAN_REPORT_REQUEST = 0x00110004, MLAN_OID_11H_CHAN_SWITCH_COUNT = 0x00110005, MLAN_OID_11H_CHAN_NOP_INFO = 0x00110006, + MLAN_OID_11H_CHAN_DFS_STATE = 0x00110007, MLAN_OID_11H_DFS_W53_CFG = 0x00110008, + MLAN_OID_11H_DFS_MODE = 0x00110009, + MLAN_OID_11H_NOP_CHAN_LIST = 0x0011000A, /* 802.11n Configuration Group RANDYTODO for value assign */ MLAN_IOCTL_11AC_CFG = 0x00120000, @@ -262,6 +267,7 @@ MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, + MLAN_OID_MISC_NET_MONITOR = 0x00200011, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -276,6 +282,7 @@ #endif MLAN_OID_MISC_HOTSPOT_CFG = 0x0020001C, MLAN_OID_MISC_OTP_USER_DATA = 0x0020001D, + MLAN_OID_MISC_AUTO_ASSOC = 0x0020001E, #ifdef USB MLAN_OID_MISC_USB_AGGR_CTRL = 0x0020001F, #endif @@ -286,6 +293,8 @@ #if defined(STA_SUPPORT) MLAN_OID_MISC_PMFCFG = 0x00200022, #endif + MLAN_OID_MISC_MULTI_CHAN_CFG = 0x00200023, + MLAN_OID_MISC_MULTI_CHAN_POLICY = 0x00200024, #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif @@ -294,9 +303,6 @@ MLAN_OID_MISC_LOW_PWR_MODE = 0x00200029, MLAN_OID_MISC_MEF_FLT_CFG = 0x0020002A, MLAN_OID_MISC_DFS_REAPTER_MODE = 0x0020002B, -#ifdef RX_PACKET_COALESCE - MLAN_OID_MISC_RX_PACKET_COALESCE = 0x0020002C, -#endif MLAN_OID_MISC_TDLS_CS_CHANNEL = 0x0020002D, MLAN_OID_MISC_COALESCE_CFG = 0x0020002E, MLAN_OID_MISC_TDLS_IDLE_TIME = 0x0020002F, @@ -306,10 +312,13 @@ MLAN_OID_MISC_OPER_CLASS = 0x00200038, MLAN_OID_MISC_PMIC_CFG = 0x00200039, MLAN_OID_MISC_IND_RST_CFG = 0x00200040, + MLAN_OID_MISC_ROAM_OFFLOAD = 0x00200042, + MLAN_OID_MISC_ROAM_OFFLOAD_APLIST = 0x00200043, MLAN_OID_MISC_GET_TSF = 0x00200045, MLAN_OID_MISC_GET_CHAN_REGION_CFG = 0x00200046, MLAN_OID_MISC_CLOUD_KEEP_ALIVE = 0x00200048, MLAN_OID_MISC_OPER_CLASS_CHECK = 0x00200049, + MLAN_OID_MISC_DRCS_CFG = 0x00200050, MLAN_OID_MISC_CWMODE_CTRL = 0x00200051, MLAN_OID_MISC_AGGR_CTRL = 0x00200052, @@ -324,6 +333,7 @@ #if defined(PCIE) MLAN_OID_MISC_SSU = 0x00200062, #endif + MLAN_OID_MISC_CSI = 0x00200064, MLAN_OID_MISC_DMCS_CONFIG = 0x00200065, MLAN_OID_MISC_RX_ABORT_CFG = 0x00200066, MLAN_OID_MISC_RX_ABORT_CFG_EXT = 0x00200067, @@ -349,6 +359,12 @@ #endif MLAN_OID_MISC_GPIO_TSF_LATCH = 0x00200082, MLAN_OID_MISC_GET_TSF_INFO = 0x00200083, + MLAN_OID_MISC_ASSOC_REQ = 0x00200084, + MLAN_OID_MISC_IPS_CFG = 0x00200085, + MLAN_OID_MISC_MC_AGGR_CFG = 0x00200086, + MLAN_OID_MISC_CH_LOAD = 0x00200087, + MLAN_OID_MISC_STATS = 0x00200088, + MLAN_OID_MISC_CH_LOAD_RESULTS = 0x00200089, }; /** Sub command size */ @@ -390,6 +406,14 @@ MLAN_PASS_TO_ACT_SCAN_DIS }; +/** Enumeration for passive to active scan */ +enum _mlan_ext_scan { + MLAN_EXTENDED_SCAN_UNCHANGED = 0, + MLAN_LEGACY_SCAN, + MLAN_EXT_SCAN, + MLAN_EXT_SCAN_ENH +}; + /** Max number of supported rates */ #define MLAN_SUPPORTED_RATES 32 @@ -598,6 +622,8 @@ /** Maximum key length */ #define MLAN_MAX_KEY_LENGTH 32 +/** Maximum PMK R0 NAME key length */ +#define MLAN_MAX_PMKR0_NAME_LENGTH 16 /** Maximum atim window in milliseconds */ #define MLAN_MAX_ATIM_WINDOW 50 @@ -630,7 +656,7 @@ } mlan_multicast_list, *pmlan_multicast_list; /** Max channel */ -#define MLAN_MAX_CHANNEL 165 +#define MLAN_MAX_CHANNEL 177 /** Maximum number of channels in table */ #define MLAN_MAX_CHANNEL_NUM 128 @@ -692,6 +718,26 @@ t_u32 assoc_resp_len; } mlan_ds_misc_assoc_rsp, *pmlan_ds_misc_assoc_rsp; +/** Type definition of mlan_ds_misc_assoc_req for MLAN_OID_MISC_ASSOC_REQ */ +typedef struct _mlan_ds_misc_assoc_req { + /** Associate req buffer */ + t_u8 assoc_req_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_req_len; +} mlan_ds_misc_assoc_req, *pmlan_ds_misc_assoc_req; + +/** mlan_ds_assoc_info */ +typedef struct _mlan_ds_assoc_info { + /** Associate req buffer */ + t_u8 assoc_resp_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_resp_len; + /** Associate req buffer */ + t_u8 assoc_req_buf[ASSOC_RSP_BUF_SIZE]; + /** Response buffer length */ + t_u32 assoc_req_len; +} mlan_ds_assoc_info, *pmlan_ds_assoc_info; + /** mlan_ssid_bssid data structure for * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ @@ -720,44 +766,49 @@ t_u8 host_mlme; /** assoicate resp frame/ie from firmware */ mlan_ds_misc_assoc_rsp assoc_rsp; + t_u8 owe_transition_mode; + /** Transition SSID */ + mlan_802_11_ssid trans_ssid; + /** Transition BSSID */ + mlan_802_11_mac_addr trans_bssid; } mlan_ssid_bssid, *pmlan_ssid_bssid; /** Data structure of WMM ECW */ typedef struct _wmm_ecw_t { #ifdef BIG_ENDIAN_SUPPORT /** Maximum Ecw */ - t_u8 ecw_max:4; + t_u8 ecw_max : 4; /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; #else /** Minimum Ecw */ - t_u8 ecw_min:4; + t_u8 ecw_min : 4; /** Maximum Ecw */ - t_u8 ecw_max:4; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 ecw_max : 4; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_ecw_t, *pwmm_ecw_t; /** Data structure of WMM Aci/Aifsn */ typedef struct _wmm_aci_aifsn_t { #ifdef BIG_ENDIAN_SUPPORT /** Reserved */ - t_u8 reserved:1; + t_u8 reserved : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; #else /** Aifsn */ - t_u8 aifsn:4; + t_u8 aifsn : 4; /** Acm */ - t_u8 acm:1; + t_u8 acm : 1; /** Aci */ - t_u8 aci:2; + t_u8 aci : 2; /** Reserved */ - t_u8 reserved:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 reserved : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_aci_aifsn_t, *pwmm_aci_aifsn_t; /** Data structure of WMM AC parameters */ @@ -826,7 +877,7 @@ #define MAX_GRP_TIMER 86400 /** Maximum value of 4 byte configuration */ -#define MAX_VALID_DWORD 0x7FFFFFFF /* (1 << 31) - 1 */ +#define MAX_VALID_DWORD 0x7FFFFFFF /* (1 << 31) - 1 */ /** default UAP BAND 2.4G */ #define DEFAULT_UAP_BAND 0 @@ -865,6 +916,8 @@ #define PROTOCOL_WAPI 0x80 /** WPA3 SAE */ #define PROTOCOL_WPA3_SAE 0x100 +/** OWE */ +#define PROTOCOL_OWE 0x200 /** Key_mgmt_psk */ #define KEY_MGMT_NONE 0x04 @@ -966,19 +1019,19 @@ typedef struct _wmm_qos_info_t { #ifdef BIG_ENDIAN_SUPPORT /** QoS UAPSD */ - t_u8 qos_uapsd:1; + t_u8 qos_uapsd : 1; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; #else /** Parameter set count */ - t_u8 para_set_count:4; + t_u8 para_set_count : 4; /** Reserved */ - t_u8 reserved:3; + t_u8 reserved : 3; /** QoS UAPSD */ - t_u8 qos_uapsd:1; -#endif /* BIG_ENDIAN_SUPPORT */ + t_u8 qos_uapsd : 1; +#endif /* BIG_ENDIAN_SUPPORT */ } wmm_qos_info_t, *pwmm_qos_info_t; /** Data structure of WMM parameter IE */ @@ -1064,6 +1117,10 @@ t_u8 channel; /** auth mode */ t_u16 auth_mode; + /** PWE derivation */ + t_u8 pwe_derivation; + /** transition disable */ + t_u8 transition_disable; /** encryption protocol */ t_u16 protocol; /** key managment type */ @@ -1098,7 +1155,7 @@ #ifdef WIFI_DIRECT_SUPPORT /* pre shared key */ t_u8 psk[MLAN_MAX_KEY_LENGTH]; -#endif /* WIFI_DIRECT_SUPPORT */ +#endif /* WIFI_DIRECT_SUPPORT */ /** Number of channels in scan_channel_list */ t_u32 num_of_chan; /** scan channel list in ACS mode */ @@ -1122,6 +1179,8 @@ scan_chan_list chan_list[MLAN_MAX_CHANNEL]; } mlan_uap_scan_channels; +#define MAX_NUM_PKTS 9 +#define DEF_NUM_PKTS 3 /** mlan_chan_switch_param */ typedef struct _mlan_action_chan_switch { /** mode*/ @@ -1130,9 +1189,9 @@ t_u8 chan_switch_mode; /** oper class*/ t_u8 new_oper_class; - /** new channel */ + /** new channel */ t_u8 new_channel_num; - /** chan_switch_count */ + /** chan_switch_count */ t_u8 chan_switch_count; } mlan_action_chan_switch; @@ -1249,7 +1308,7 @@ wmm_parameter_t ap_wmm_para; /** ap scan channels for MLAN_OID_UAP_SCAN_CHANNELS*/ mlan_uap_scan_channels ap_scan_channels; - /** channel switch for MLAN_OID_UAP_CHAN_SWITCH */ + /** channel switch for MLAN_OID_UAP_CHAN_SWITCH */ mlan_action_chan_switch chanswitch; /** ap channel for MLAN_OID_UAP_CHANNEL*/ chan_band_info ap_channel; @@ -1284,8 +1343,8 @@ t_u8 country_code[2]; t_u8 region_code; t_u8 environment; - t_u8 force_reg:1; - t_u8 reserved:7; + t_u8 force_reg : 1; + t_u8 reserved : 7; t_u8 dfs_region; } MLAN_PACK_END otp_region_info_t; @@ -1313,6 +1372,7 @@ BAND_AAC = 64, BAND_GAX = 256, BAND_AAX = 512, + MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME = 0x0020008C, }; @@ -1412,9 +1472,9 @@ }; #define COALESCE_MAX_RULES 8 -#define COALESCE_MAX_BYTESEQ 4 /* non-adjustable */ +#define COALESCE_MAX_BYTESEQ 4 /* non-adjustable */ #define COALESCE_MAX_FILTERS 4 -#define MAX_COALESCING_DELAY 100 /* in msecs */ +#define MAX_COALESCING_DELAY 100 /* in msecs */ #define MAX_PATTERN_LEN 20 #define MAX_OFFSET_LEN 100 @@ -1460,6 +1520,7 @@ t_u8 signalext_enable; /** Control deauth when uap switch channel */ t_u8 deauthctrl; + t_u8 chan_track; } param; } mlan_ds_snmp_mib, *pmlan_ds_snmp_mib; @@ -1631,53 +1692,53 @@ t_u64 rx_octets_in_ampdu_cnt; /** ampdu delimiter CRC error count */ t_u32 ampdu_delimiter_crc_error_cnt; - /** Rx Stuck Related Info*/ - /** Rx Stuck Issue count */ + /** Rx Stuck Related Info*/ + /** Rx Stuck Issue count */ t_u32 rx_stuck_issue_cnt[2]; - /** Rx Stuck Recovery count */ + /** Rx Stuck Recovery count */ t_u32 rx_stuck_recovery_cnt; - /** Rx Stuck TSF */ + /** Rx Stuck TSF */ t_u64 rx_stuck_tsf[2]; - /** Tx Watchdog Recovery Related Info */ - /** Tx Watchdog Recovery count */ + /** Tx Watchdog Recovery Related Info */ + /** Tx Watchdog Recovery count */ t_u32 tx_watchdog_recovery_cnt; - /** Tx Watchdog TSF */ + /** Tx Watchdog TSF */ t_u64 tx_watchdog_tsf[2]; - /** Channel Switch Related Info */ - /** Channel Switch Announcement Sent */ + /** Channel Switch Related Info */ + /** Channel Switch Announcement Sent */ t_u32 channel_switch_ann_sent; - /** Channel Switch State */ + /** Channel Switch State */ t_u32 channel_switch_state; - /** Register Class */ + /** Register Class */ t_u32 reg_class; - /** Channel Number */ + /** Channel Number */ t_u32 channel_number; - /** Channel Switch Mode */ + /** Channel Switch Mode */ t_u32 channel_switch_mode; - /** Reset Rx Mac Count */ + /** Reset Rx Mac Count */ t_u32 rx_reset_mac_recovery_cnt; - /** ISR2 Not Done Count*/ + /** ISR2 Not Done Count*/ t_u32 rx_Isr2_NotDone_Cnt; - /** GDMA Abort Count */ + /** GDMA Abort Count */ t_u32 gdma_abort_cnt; - /** Rx Reset MAC Count */ + /** Rx Reset MAC Count */ t_u32 g_reset_rx_mac_cnt; - //Ownership error counters - /*Error Ownership error count */ + // Ownership error counters + /*Error Ownership error count*/ t_u32 dwCtlErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwBcnErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwMgtErrCnt; - /*Control Ownership error count */ + /*Control Ownership error count*/ t_u32 dwDatErrCnt; - /*BIGTK MME good count */ + /*BIGTK MME good count*/ t_u32 bigtk_mmeGoodCnt; - /*BIGTK Replay error count */ + /*BIGTK Replay error count*/ t_u32 bigtk_replayErrCnt; - /*BIGTK MIC error count */ + /*BIGTK MIC error count*/ t_u32 bigtk_micErrCnt; - /*BIGTK MME not included count */ + /*BIGTK MME not included count*/ t_u32 bigtk_mmeNotFoundCnt; } mlan_ds_get_stats, *pmlan_ds_get_stats; @@ -1816,6 +1877,8 @@ t_u32 fw_ver; /** Firmware Hotfix version */ t_u8 hotfix_version; + /** tx buf size */ + t_u16 tx_buf_size; /** MAC address */ mlan_802_11_mac_addr mac_addr; /** 802.11n device capabilities */ @@ -1858,15 +1921,26 @@ t_u8 antinfo; /** max AP associated sta count supported by fw */ t_u8 max_ap_assoc_sta; + /** FW support roaming offload */ + t_u8 fw_roaming_support; /** Bandwidth not support 80Mhz */ t_u8 prohibit_80mhz; /** FW support beacon protection */ t_u8 fw_beacon_prot; + + /* lower 8 bytes of uuid */ + t_u64 uuid_lo; + + /* higher 8 bytes of uuid */ + t_u64 uuid_hi; } mlan_fw_info, *pmlan_fw_info; /** Version string buffer length */ #define MLAN_MAX_VER_STR_LEN 128 +/** Maximum length of secure boot uuid */ +#define MLAN_MAX_UUID_LEN 32 + /** mlan_ver_ext data structure for MLAN_OID_GET_VER_EXT */ typedef struct _mlan_ver_ext { /** Selected version string */ @@ -1879,187 +1953,187 @@ /** Extended Capabilities Data */ typedef struct MLAN_PACK_START _ExtCap_t { /** Extended Capabilities value */ - t_u8 rsvdBit87:1; /* bit 87 */ - t_u8 rsvdBit86:1; /* bit 86 */ - t_u8 rsvdBit85:1; /* bit 85 */ - t_u8 beacon_prot:1; /* bit 84 */ - t_u8 rsvdBit83:1; /* bit 83 */ - t_u8 rsvdBit82:1; /* bit 82 */ - t_u8 rsvdBit81:1; /* bit 81 */ - t_u8 rsvdBit80:1; /* bit 80 */ - t_u8 rsvdBit79:1; /* bit 79 */ - t_u8 TWTResp:1; /* bit 78 */ - t_u8 TWTReq:1; /* bit 77 */ - t_u8 rsvdBit76:1; /* bit 76 */ - t_u8 rsvdBit75:1; /* bit 75 */ - t_u8 rsvdBit74:1; /* bit 74 */ - t_u8 rsvdBit73:1; /* bit 73 */ - t_u8 FILS:1; /* bit 72 */ - t_u8 FTMI:1; /* bit 71 */ - t_u8 FTMR:1; /* bit 70 */ - t_u8 CAQ:1; /* bit 69 */ - t_u8 rsvdBit68:1; /* bit 68 */ - t_u8 NCC:1; /* bit 67 */ - t_u8 rsvdBit66:1; /* bit 66 */ - t_u8 chanSchedMgnt:1; /* bit 65 */ - t_u8 MaxAMSDU1:1; /* bit 64 */ - t_u8 MaxAMSDU0:1; /* bit 63 */ - t_u8 OperModeNtf:1; /* bit 62 */ - t_u8 TDLSWildBandwidth:1; /* bit 61 */ - t_u8 rsvdBit60:1; /* bit 60 */ - t_u8 rsvdBit59:1; /* bit 59 */ - t_u8 rsvdBit58:1; /* bit 58 */ - t_u8 rsvdBit57:1; /* bit 57 */ - t_u8 rsvdBit56:1; /* bit 56 */ - t_u8 rsvdBit55:1; /* bit 55 */ - t_u8 rsvdBit54:1; /* bit 54 */ - t_u8 rsvdBit53:1; /* bit 53 */ - t_u8 rsvdBit52:1; /* bit 52 */ - t_u8 rsvdBit51:1; /* bit 51 */ - t_u8 rsvdBit50:1; /* bit 50 */ - t_u8 rsvdBit49:1; /* bit 49 */ - t_u8 rsvdBit48:1; /* bit 48 */ - t_u8 rsvdBit47:1; /* bit 47 */ - t_u8 rsvdBit46:1; /* bit 46 */ - t_u8 rsvdBit45:1; /* bit 45 */ - t_u8 rsvdBit44:1; /* bit 44 */ - t_u8 rsvdBit43:1; /* bit 43 */ - t_u8 rsvdBit42:1; /* bit 42 */ - t_u8 rsvdBit41:1; /* bit 41 */ - t_u8 rsvdBit40:1; /* bit 40 */ - t_u8 TDLSChlSwitchProhib:1; /* bit 39 */ - t_u8 TDLSProhibited:1; /* bit 38 */ - t_u8 TDLSSupport:1; /* bit 37 */ - t_u8 MSGCF_Capa:1; /* bit 36 */ - t_u8 Reserved35:1; /* bit 35 */ - t_u8 SSPN_Interface:1; /* bit 34 */ - t_u8 EBR:1; /* bit 33 */ - t_u8 Qos_Map:1; /* bit 32 */ - t_u8 Interworking:1; /* bit 31 */ - t_u8 TDLSChannelSwitching:1; /* bit 30 */ - t_u8 TDLSPeerPSMSupport:1; /* bit 29 */ - t_u8 TDLSPeerUAPSDSupport:1; /* bit 28 */ - t_u8 UTC:1; /* bit 27 */ - t_u8 DMS:1; /* bit 26 */ - t_u8 SSID_List:1; /* bit 25 */ - t_u8 ChannelUsage:1; /* bit 24 */ - t_u8 TimingMeasurement:1; /* bit 23 */ - t_u8 MultipleBSSID:1; /* bit 22 */ - t_u8 AC_StationCount:1; /* bit 21 */ - t_u8 QoSTrafficCap:1; /* bit 20 */ - t_u8 BSS_Transition:1; /* bit 19 */ - t_u8 TIM_Broadcast:1; /* bit 18 */ - t_u8 WNM_Sleep:1; /* bit 17 */ - t_u8 TFS:1; /* bit 16 */ - t_u8 GeospatialLocation:1; /* bit 15 */ - t_u8 CivicLocation:1; /* bit 14 */ - t_u8 CollocatedIntf:1; /* bit 13 */ - t_u8 ProxyARPService:1; /* bit 12 */ - t_u8 FMS:1; /* bit 11 */ - t_u8 LocationTracking:1; /* bit 10 */ - t_u8 MulticastDiagnostics:1; /* bit 9 */ - t_u8 Diagnostics:1; /* bit 8 */ - t_u8 Event:1; /* bit 7 */ - t_u8 SPSMP_Support:1; /* bit 6 */ - t_u8 Reserved5:1; /* bit 5 */ - t_u8 PSMP_Capable:1; /* bit 4 */ - t_u8 RejectUnadmFrame:1; /* bit 3 */ - t_u8 ExtChanSwitching:1; /* bit 2 */ - t_u8 Reserved1:1; /* bit 1 */ - t_u8 BSS_CoexistSupport:1; /* bit 0 */ + t_u8 rsvdBit87 : 1; /* bit 87 */ + t_u8 rsvdBit86 : 1; /* bit 86 */ + t_u8 rsvdBit85 : 1; /* bit 85 */ + t_u8 beacon_prot : 1; /* bit 84 */ + t_u8 rsvdBit83 : 1; /* bit 83 */ + t_u8 rsvdBit82 : 1; /* bit 82 */ + t_u8 rsvdBit81 : 1; /* bit 81 */ + t_u8 rsvdBit80 : 1; /* bit 80 */ + t_u8 rsvdBit79 : 1; /* bit 79 */ + t_u8 TWTResp : 1; /* bit 78 */ + t_u8 TWTReq : 1; /* bit 77 */ + t_u8 rsvdBit76 : 1; /* bit 76 */ + t_u8 rsvdBit75 : 1; /* bit 75 */ + t_u8 rsvdBit74 : 1; /* bit 74 */ + t_u8 rsvdBit73 : 1; /* bit 73 */ + t_u8 FILS : 1; /* bit 72 */ + t_u8 FTMI : 1; /* bit 71 */ + t_u8 FTMR : 1; /* bit 70 */ + t_u8 CAQ : 1; /* bit 69 */ + t_u8 rsvdBit68 : 1; /* bit 68 */ + t_u8 NCC : 1; /* bit 67 */ + t_u8 rsvdBit66 : 1; /* bit 66 */ + t_u8 chanSchedMgnt : 1; /* bit 65 */ + t_u8 MaxAMSDU1 : 1; /* bit 64 */ + t_u8 MaxAMSDU0 : 1; /* bit 63 */ + t_u8 OperModeNtf : 1; /* bit 62 */ + t_u8 TDLSWildBandwidth : 1; /* bit 61 */ + t_u8 rsvdBit60 : 1; /* bit 60 */ + t_u8 rsvdBit59 : 1; /* bit 59 */ + t_u8 rsvdBit58 : 1; /* bit 58 */ + t_u8 rsvdBit57 : 1; /* bit 57 */ + t_u8 rsvdBit56 : 1; /* bit 56 */ + t_u8 rsvdBit55 : 1; /* bit 55 */ + t_u8 rsvdBit54 : 1; /* bit 54 */ + t_u8 rsvdBit53 : 1; /* bit 53 */ + t_u8 rsvdBit52 : 1; /* bit 52 */ + t_u8 rsvdBit51 : 1; /* bit 51 */ + t_u8 rsvdBit50 : 1; /* bit 50 */ + t_u8 rsvdBit49 : 1; /* bit 49 */ + t_u8 rsvdBit48 : 1; /* bit 48 */ + t_u8 rsvdBit47 : 1; /* bit 47 */ + t_u8 rsvdBit46 : 1; /* bit 46 */ + t_u8 rsvdBit45 : 1; /* bit 45 */ + t_u8 rsvdBit44 : 1; /* bit 44 */ + t_u8 rsvdBit43 : 1; /* bit 43 */ + t_u8 rsvdBit42 : 1; /* bit 42 */ + t_u8 rsvdBit41 : 1; /* bit 41 */ + t_u8 rsvdBit40 : 1; /* bit 40 */ + t_u8 TDLSChlSwitchProhib : 1; /* bit 39 */ + t_u8 TDLSProhibited : 1; /* bit 38 */ + t_u8 TDLSSupport : 1; /* bit 37 */ + t_u8 MSGCF_Capa : 1; /* bit 36 */ + t_u8 Reserved35 : 1; /* bit 35 */ + t_u8 SSPN_Interface : 1; /* bit 34 */ + t_u8 EBR : 1; /* bit 33 */ + t_u8 Qos_Map : 1; /* bit 32 */ + t_u8 Interworking : 1; /* bit 31 */ + t_u8 TDLSChannelSwitching : 1; /* bit 30 */ + t_u8 TDLSPeerPSMSupport : 1; /* bit 29 */ + t_u8 TDLSPeerUAPSDSupport : 1; /* bit 28 */ + t_u8 UTC : 1; /* bit 27 */ + t_u8 DMS : 1; /* bit 26 */ + t_u8 SSID_List : 1; /* bit 25 */ + t_u8 ChannelUsage : 1; /* bit 24 */ + t_u8 TimingMeasurement : 1; /* bit 23 */ + t_u8 MultipleBSSID : 1; /* bit 22 */ + t_u8 AC_StationCount : 1; /* bit 21 */ + t_u8 QoSTrafficCap : 1; /* bit 20 */ + t_u8 BSS_Transition : 1; /* bit 19 */ + t_u8 TIM_Broadcast : 1; /* bit 18 */ + t_u8 WNM_Sleep : 1; /* bit 17 */ + t_u8 TFS : 1; /* bit 16 */ + t_u8 GeospatialLocation : 1; /* bit 15 */ + t_u8 CivicLocation : 1; /* bit 14 */ + t_u8 CollocatedIntf : 1; /* bit 13 */ + t_u8 ProxyARPService : 1; /* bit 12 */ + t_u8 FMS : 1; /* bit 11 */ + t_u8 LocationTracking : 1; /* bit 10 */ + t_u8 MulticastDiagnostics : 1; /* bit 9 */ + t_u8 Diagnostics : 1; /* bit 8 */ + t_u8 Event : 1; /* bit 7 */ + t_u8 SPSMP_Support : 1; /* bit 6 */ + t_u8 Reserved5 : 1; /* bit 5 */ + t_u8 PSMP_Capable : 1; /* bit 4 */ + t_u8 RejectUnadmFrame : 1; /* bit 3 */ + t_u8 ExtChanSwitching : 1; /* bit 2 */ + t_u8 Reserved1 : 1; /* bit 1 */ + t_u8 BSS_CoexistSupport : 1; /* bit 0 */ } MLAN_PACK_END ExtCap_t, *pExtCap_t; #else /** Extended Capabilities Data */ typedef struct MLAN_PACK_START _ExtCap_t { /** Extended Capabilities value */ - t_u8 BSS_CoexistSupport:1; /* bit 0 */ - t_u8 Reserved1:1; /* bit 1 */ - t_u8 ExtChanSwitching:1; /* bit 2 */ - t_u8 RejectUnadmFrame:1; /* bit 3 */ - t_u8 PSMP_Capable:1; /* bit 4 */ - t_u8 Reserved5:1; /* bit 5 */ - t_u8 SPSMP_Support:1; /* bit 6 */ - t_u8 Event:1; /* bit 7 */ - t_u8 Diagnostics:1; /* bit 8 */ - t_u8 MulticastDiagnostics:1; /* bit 9 */ - t_u8 LocationTracking:1; /* bit 10 */ - t_u8 FMS:1; /* bit 11 */ - t_u8 ProxyARPService:1; /* bit 12 */ - t_u8 CollocatedIntf:1; /* bit 13 */ - t_u8 CivicLocation:1; /* bit 14 */ - t_u8 GeospatialLocation:1; /* bit 15 */ - t_u8 TFS:1; /* bit 16 */ - t_u8 WNM_Sleep:1; /* bit 17 */ - t_u8 TIM_Broadcast:1; /* bit 18 */ - t_u8 BSS_Transition:1; /* bit 19 */ - t_u8 QoSTrafficCap:1; /* bit 20 */ - t_u8 AC_StationCount:1; /* bit 21 */ - t_u8 MultipleBSSID:1; /* bit 22 */ - t_u8 TimingMeasurement:1; /* bit 23 */ - t_u8 ChannelUsage:1; /* bit 24 */ - t_u8 SSID_List:1; /* bit 25 */ - t_u8 DMS:1; /* bit 26 */ - t_u8 UTC:1; /* bit 27 */ - t_u8 TDLSPeerUAPSDSupport:1; /* bit 28 */ - t_u8 TDLSPeerPSMSupport:1; /* bit 29 */ - t_u8 TDLSChannelSwitching:1; /* bit 30 */ - t_u8 Interworking:1; /* bit 31 */ - t_u8 Qos_Map:1; /* bit 32 */ - t_u8 EBR:1; /* bit 33 */ - t_u8 SSPN_Interface:1; /* bit 34 */ - t_u8 Reserved35:1; /* bit 35 */ - t_u8 MSGCF_Capa:1; /* bit 36 */ - t_u8 TDLSSupport:1; /* bit 37 */ - t_u8 TDLSProhibited:1; /* bit 38 */ - t_u8 TDLSChlSwitchProhib:1; /* bit 39 */ - t_u8 rsvdBit40:1; /* bit 40 */ - t_u8 rsvdBit41:1; /* bit 41 */ - t_u8 rsvdBit42:1; /* bit 42 */ - t_u8 rsvdBit43:1; /* bit 43 */ - t_u8 rsvdBit44:1; /* bit 44 */ - t_u8 rsvdBit45:1; /* bit 45 */ - t_u8 rsvdBit46:1; /* bit 46 */ - t_u8 rsvdBit47:1; /* bit 47 */ - t_u8 rsvdBit48:1; /* bit 48 */ - t_u8 rsvdBit49:1; /* bit 49 */ - t_u8 rsvdBit50:1; /* bit 50 */ - t_u8 rsvdBit51:1; /* bit 51 */ - t_u8 rsvdBit52:1; /* bit 52 */ - t_u8 rsvdBit53:1; /* bit 53 */ - t_u8 rsvdBit54:1; /* bit 54 */ - t_u8 rsvdBit55:1; /* bit 55 */ - t_u8 rsvdBit56:1; /* bit 56 */ - t_u8 rsvdBit57:1; /* bit 57 */ - t_u8 rsvdBit58:1; /* bit 58 */ - t_u8 rsvdBit59:1; /* bit 59 */ - t_u8 rsvdBit60:1; /* bit 60 */ - t_u8 TDLSWildBandwidth:1; /* bit 61 */ - t_u8 OperModeNtf:1; /* bit 62 */ - t_u8 MaxAMSDU0:1; /* bit 63 */ - t_u8 MaxAMSDU1:1; /* bit 64 */ - t_u8 chanSchedMgnt:1; /* bit 65 */ - t_u8 rsvdBit66:1; /* bit 66 */ - t_u8 NCC:1; /* bit 67 */ - t_u8 rsvdBit68:1; /* bit 68 */ - t_u8 CAQ:1; /* bit 69 */ - t_u8 FTMR:1; /* bit 70 */ - t_u8 FTMI:1; /* bit 71 */ - t_u8 FILS:1; /* bit 72 */ - t_u8 rsvdBit73:1; /* bit 73 */ - t_u8 rsvdBit74:1; /* bit 74 */ - t_u8 rsvdBit75:1; /* bit 75 */ - t_u8 rsvdBit76:1; /* bit 76 */ - t_u8 TWTReq:1; /* bit 77 */ - t_u8 TWTResp:1; /* bit 78 */ - t_u8 rsvdBit79:1; /* bit 79 */ - t_u8 rsvdBit80:1; /* bit 80 */ - t_u8 rsvdBit81:1; /* bit 81 */ - t_u8 rsvdBit82:1; /* bit 82 */ - t_u8 rsvdBit83:1; /* bit 83 */ - t_u8 beacon_prot:1; /* bit 84 */ - t_u8 rsvdBit85:1; /* bit 85 */ - t_u8 rsvdBit86:1; /* bit 86 */ - t_u8 rsvdBit87:1; /* bit 87 */ + t_u8 BSS_CoexistSupport : 1; /* bit 0 */ + t_u8 Reserved1 : 1; /* bit 1 */ + t_u8 ExtChanSwitching : 1; /* bit 2 */ + t_u8 RejectUnadmFrame : 1; /* bit 3 */ + t_u8 PSMP_Capable : 1; /* bit 4 */ + t_u8 Reserved5 : 1; /* bit 5 */ + t_u8 SPSMP_Support : 1; /* bit 6 */ + t_u8 Event : 1; /* bit 7 */ + t_u8 Diagnostics : 1; /* bit 8 */ + t_u8 MulticastDiagnostics : 1; /* bit 9 */ + t_u8 LocationTracking : 1; /* bit 10 */ + t_u8 FMS : 1; /* bit 11 */ + t_u8 ProxyARPService : 1; /* bit 12 */ + t_u8 CollocatedIntf : 1; /* bit 13 */ + t_u8 CivicLocation : 1; /* bit 14 */ + t_u8 GeospatialLocation : 1; /* bit 15 */ + t_u8 TFS : 1; /* bit 16 */ + t_u8 WNM_Sleep : 1; /* bit 17 */ + t_u8 TIM_Broadcast : 1; /* bit 18 */ + t_u8 BSS_Transition : 1; /* bit 19 */ + t_u8 QoSTrafficCap : 1; /* bit 20 */ + t_u8 AC_StationCount : 1; /* bit 21 */ + t_u8 MultipleBSSID : 1; /* bit 22 */ + t_u8 TimingMeasurement : 1; /* bit 23 */ + t_u8 ChannelUsage : 1; /* bit 24 */ + t_u8 SSID_List : 1; /* bit 25 */ + t_u8 DMS : 1; /* bit 26 */ + t_u8 UTC : 1; /* bit 27 */ + t_u8 TDLSPeerUAPSDSupport : 1; /* bit 28 */ + t_u8 TDLSPeerPSMSupport : 1; /* bit 29 */ + t_u8 TDLSChannelSwitching : 1; /* bit 30 */ + t_u8 Interworking : 1; /* bit 31 */ + t_u8 Qos_Map : 1; /* bit 32 */ + t_u8 EBR : 1; /* bit 33 */ + t_u8 SSPN_Interface : 1; /* bit 34 */ + t_u8 Reserved35 : 1; /* bit 35 */ + t_u8 MSGCF_Capa : 1; /* bit 36 */ + t_u8 TDLSSupport : 1; /* bit 37 */ + t_u8 TDLSProhibited : 1; /* bit 38 */ + t_u8 TDLSChlSwitchProhib : 1; /* bit 39 */ + t_u8 rsvdBit40 : 1; /* bit 40 */ + t_u8 rsvdBit41 : 1; /* bit 41 */ + t_u8 rsvdBit42 : 1; /* bit 42 */ + t_u8 rsvdBit43 : 1; /* bit 43 */ + t_u8 rsvdBit44 : 1; /* bit 44 */ + t_u8 rsvdBit45 : 1; /* bit 45 */ + t_u8 rsvdBit46 : 1; /* bit 46 */ + t_u8 rsvdBit47 : 1; /* bit 47 */ + t_u8 rsvdBit48 : 1; /* bit 48 */ + t_u8 rsvdBit49 : 1; /* bit 49 */ + t_u8 rsvdBit50 : 1; /* bit 50 */ + t_u8 rsvdBit51 : 1; /* bit 51 */ + t_u8 rsvdBit52 : 1; /* bit 52 */ + t_u8 rsvdBit53 : 1; /* bit 53 */ + t_u8 rsvdBit54 : 1; /* bit 54 */ + t_u8 rsvdBit55 : 1; /* bit 55 */ + t_u8 rsvdBit56 : 1; /* bit 56 */ + t_u8 rsvdBit57 : 1; /* bit 57 */ + t_u8 rsvdBit58 : 1; /* bit 58 */ + t_u8 rsvdBit59 : 1; /* bit 59 */ + t_u8 rsvdBit60 : 1; /* bit 60 */ + t_u8 TDLSWildBandwidth : 1; /* bit 61 */ + t_u8 OperModeNtf : 1; /* bit 62 */ + t_u8 MaxAMSDU0 : 1; /* bit 63 */ + t_u8 MaxAMSDU1 : 1; /* bit 64 */ + t_u8 chanSchedMgnt : 1; /* bit 65 */ + t_u8 rsvdBit66 : 1; /* bit 66 */ + t_u8 NCC : 1; /* bit 67 */ + t_u8 rsvdBit68 : 1; /* bit 68 */ + t_u8 CAQ : 1; /* bit 69 */ + t_u8 FTMR : 1; /* bit 70 */ + t_u8 FTMI : 1; /* bit 71 */ + t_u8 FILS : 1; /* bit 72 */ + t_u8 rsvdBit73 : 1; /* bit 73 */ + t_u8 rsvdBit74 : 1; /* bit 74 */ + t_u8 rsvdBit75 : 1; /* bit 75 */ + t_u8 rsvdBit76 : 1; /* bit 76 */ + t_u8 TWTReq : 1; /* bit 77 */ + t_u8 TWTResp : 1; /* bit 78 */ + t_u8 rsvdBit79 : 1; /* bit 79 */ + t_u8 rsvdBit80 : 1; /* bit 80 */ + t_u8 rsvdBit81 : 1; /* bit 81 */ + t_u8 rsvdBit82 : 1; /* bit 82 */ + t_u8 rsvdBit83 : 1; /* bit 83 */ + t_u8 beacon_prot : 1; /* bit 84 */ + t_u8 rsvdBit85 : 1; /* bit 85 */ + t_u8 rsvdBit86 : 1; /* bit 86 */ + t_u8 rsvdBit87 : 1; /* bit 87 */ } MLAN_PACK_END ExtCap_t, *pExtCap_t; #endif @@ -2079,7 +2153,7 @@ /** Channel */ t_u32 bss_chan; /** Band */ - t_u8 bss_band; + t_u16 bss_band; /** Region code */ t_u32 region_code; /** Connection status */ @@ -2117,7 +2191,7 @@ t_u8 peer_supp_rates[MLAN_SUPPORTED_RATES]; /** extend capability for AP */ ExtCap_t ext_cap; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Mobility Domain ID */ t_u16 mdid; /** FT Capability policy */ @@ -2187,6 +2261,8 @@ t_u8 ht_cap[IEEE_MAX_IE_SIZE]; /** VHT Capabilities IE */ t_u8 vht_cap[IEEE_MAX_IE_SIZE]; + /** HE Capabilities IE */ + t_u8 he_cap[IEEE_MAX_IE_SIZE]; } tdls_peer_info; /** max ralist num */ @@ -2269,6 +2345,8 @@ t_u32 bypass_pkt_count; /** Corresponds to scan_processing member of mlan_adapter */ t_u32 scan_processing; + /** Corresponds to scan_state member of mlan_adapter */ + t_u32 scan_state; /** Corresponds to mlan_processing member of mlan_adapter */ t_u32 mlan_processing; /** Corresponds to main_lock_flag member of mlan_adapter */ @@ -2316,9 +2394,9 @@ t_u32 mpa_sent_no_ports; /** last recv wr_bitmap */ t_u32 last_recv_wr_bitmap; - /** last recv rd_bitmap */ + /** last recv rd_bitmap */ t_u32 last_recv_rd_bitmap; - /** mp_data_port_mask */ + /** mp_data_port_mask */ t_u32 mp_data_port_mask; /** last mp_wr_bitmap */ t_u32 last_mp_wr_bitmap[SDIO_MP_DBG_NUM]; @@ -2523,6 +2601,7 @@ MLAN_AUTH_MODE_SHARED = 0x01, MLAN_AUTH_MODE_FT = 0x02, MLAN_AUTH_MODE_SAE = 0x03, + MLAN_AUTH_MODE_OWE = 0x04, MLAN_AUTH_MODE_NETWORKEAP = 0x80, MLAN_AUTH_MODE_AUTO = 0xFF, }; @@ -2535,6 +2614,7 @@ AssocAgentAuth_FastBss_Skip, AssocAgentAuth_Network_EAP, AssocAgentAuth_Wpa3Sae = 6, + AssocAgentAuth_Owe = 7, AssocAgentAuth_Auto, } AssocAgentAuthType_e; @@ -2658,6 +2738,8 @@ typedef struct _mlan_pmk_t { /** PMK */ t_u8 pmk[MLAN_MAX_KEY_LENGTH]; + t_u8 pmk_r0[MLAN_MAX_KEY_LENGTH]; + t_u8 pmk_r0_name[MLAN_MAX_PMKR0_NAME_LENGTH]; } mlan_pmk_t; /** Embedded supplicant RSN type: No RSN */ @@ -2708,10 +2790,20 @@ t_u32 act_groupcipher; } mlan_ds_esupp_mode, *pmlan_ds_esupp_mode; +/* Security SSID MAX number support by firmware*/ +#define MAX_SEC_SSID_NUM 6 + /** Type definition of mlan_ds_sec_cfg for MLAN_IOCTL_SEC_CFG */ typedef struct _mlan_ds_sec_cfg { /** Sub-command */ t_u32 sub_command; + /** Flag to extend some structures to support multiple values. + ** For example, mlan_ds_passphrase can only contain one value, + ** if need use mlan_ds_passphrase[N], just set this flag and + ** use mlan_ds_passphrase[] instead to avoid modify + ** more already exist code. + */ + t_u8 multi_passphrase; /** Security configuration parameter */ union { /** Authentication mode for MLAN_OID_SEC_CFG_AUTH_MODE */ @@ -2737,6 +2829,7 @@ #ifdef UAP_SUPPORT t_u8 sta_mac[MLAN_MAC_ADDR_LENGTH]; #endif + mlan_ds_passphrase roam_passphrase[MAX_SEC_SSID_NUM]; } param; } mlan_ds_sec_cfg, *pmlan_ds_sec_cfg; @@ -2970,15 +3063,18 @@ t_u8 max_btm_req_allowed; } mlan_ds_band_steer_cfg, *pmlan_ds_band_steer_cfg; -/** Type definition of mlan_ds_beacon_stuck_param_cfg for MLAN_IOCTL_POWER_CFG */ +/** Type definition of mlan_ds_beacon_stuck_param_cfg for MLAN_IOCTL_POWER_CFG + */ typedef struct _mlan_ds_beacon_stuck_param_cfg { - /** subcmd */ + /** subcmd */ t_u32 subcmd; - /** Set/Get */ + /** Set/Get */ t_u8 action; - /** No of beacon interval after which firmware will check if beacon Tx is going fine */ + /** No of beacon interval after which firmware will check if beacon Tx + * is going fine */ t_u8 beacon_stuck_detect_count; - /** Upon performing MAC reset, no of beacon interval after which firmware will check if recovery was successful */ + /** Upon performing MAC reset, no of beacon interval after which + * firmware will check if recovery was successful */ t_u8 recovery_confirm_count; } mlan_ds_beacon_stuck_param_cfg, *pmlan_ds_beacon_stuck_param_cfg; @@ -3048,6 +3144,8 @@ t_u8 ext_gap; /** GPIO wave level for extend hscfg*/ t_u8 gpio_wave; + /** Minimum delay between HsActive and HostWake (in msec) */ + t_u16 min_wake_holdoff; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; #define MAX_MGMT_FRAME_FILTER 2 @@ -3316,15 +3414,6 @@ } param; } mlan_ds_pm_cfg, *pmlan_ds_pm_cfg; -#ifdef RX_PACKET_COALESCE -typedef struct { - mlan_cmd_result_e cmd_result; /**< Firmware execution result */ - - t_u32 pkt_threshold; /** Packet threshold */ - t_u16 delay; /** Timeout value in milliseconds */ -} wlan_ioctl_rx_pkt_coalesce_config_t; -#endif - /*-----------------------------------------------------------------*/ /** WMM Configuration Group */ /*-----------------------------------------------------------------*/ @@ -3431,7 +3520,7 @@ /** Type definition of mlan_ds_wmm_queue_stats * for MLAN_OID_WMM_CFG_QUEUE_STATS */ -mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; + mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** * @brief IOCTL sub structure for a specific WMM AC Status @@ -3463,7 +3552,7 @@ /** Type definition of mlan_ds_wmm_queue_status * for MLAN_OID_WMM_CFG_QUEUE_STATUS */ -mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; + mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ typedef struct _mlan_ds_wmm_addts { @@ -3895,7 +3984,7 @@ /** Type definition of mlan_ds_11ax_he_cfg for MLAN_OID_11AX_HE_CFG */ typedef struct _mlan_ds_11ax_he_cfg { - /** band, BIT0:2.4G, BIT1:5G*/ + /** band, BIT0:2.4G, BIT1:5G BIT2:6G*/ t_u8 band; /** mlan_ds_11ax_he_capa */ mlan_ds_11ax_he_capa he_cap; @@ -3978,10 +4067,19 @@ } mlan_ds_11ax_txop_cmd, *pmlan_ds_11ax_txop_cmd; /** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_txomi_cmd { +typedef struct MLAN_PACK_START_mlan_ds_11ax_txomi_cmd { /* 11ax spec 9.2.4.6a.2 OM Control 12 bits. Bit 0 to bit 11 */ t_u16 omi; -} mlan_ds_11ax_txomi_cmd, *pmlan_ds_11ax_txomi_cmd; + /* tx option + * 0: send OMI in QoS NULL; 1: send OMI in QoS data; 0xFF: set OMI in + * both + */ + t_u8 tx_option; + /* if OMI is sent in QoS data, specify the number of consecutive data + * packets containing the OMI + */ + t_u8 num_data_pkts; +} MLAN_PACK_END mlan_ds_11ax_txomi_cmd, *pmlan_ds_11ax_txomi_cmd; /** Type definition of mlan_ds_11ax_toltime_cmd for MLAN_OID_11AX_CMD_CFG */ typedef struct _mlan_ds_11ax_toltime_cmd { @@ -4040,7 +4138,7 @@ t_u8 twt_exponent; /** TWT Mantissa Range: [0-sizeof(UINT16)] */ t_u16 twt_mantissa; - /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ + /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ t_u8 twt_request; } MLAN_PACK_END mlan_ds_twt_setup, *pmlan_ds_twt_setup; @@ -4090,12 +4188,19 @@ t_u8 max_tx_pwr; } mlan_ds_subband_set_t; +#define NXP_DFS_UNSET 0 +#define NXP_DFS_FCC 1 +#define NXP_DFS_ETSI 2 +#define NXP_DFS_JP 3 +#define NXP_DFS_UNKNOWN 0xFF /** Domain regulatory information */ typedef struct _mlan_ds_11d_domain_info { + /** DFS region code */ + t_u8 dfs_region; /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; /** Band that channels in sub_band belong to */ - t_u8 band; + t_u16 band; /** No. of subband in below */ t_u8 no_of_sub_band; /** Subband data to send/last sent */ @@ -4111,13 +4216,13 @@ #ifdef STA_SUPPORT /** Enable for MLAN_OID_11D_CFG_ENABLE */ t_u32 enable_11d; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Domain info for MLAN_OID_11D_DOMAIN_INFO_EXT */ mlan_ds_11d_domain_info domain_info; #ifdef UAP_SUPPORT /** tlv data for MLAN_OID_11D_DOMAIN_INFO */ t_u8 domain_tlv[MAX_IE_SIZE]; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ } param; } mlan_ds_11d_cfg, *pmlan_ds_11d_cfg; @@ -4138,7 +4243,15 @@ MLAN_REG_CAU = 5, MLAN_REG_PSU = 6, MLAN_REG_BCA = 7, -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || defined(PCIE9097) || defined(USB9097) || defined(SD9097) +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) || \ + defined(SD9177) + MLAN_REG_CIU = 8, +#endif +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDNW62X) || \ + defined(PCIENW62X) || defined(USBNW62X) || defined(SD9097) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, @@ -4219,12 +4332,23 @@ t_u8 curr_chan; /** channel_width */ t_u8 chan_width; + /** check new channel flag */ + t_u8 check_new_chan; /** flag for chan under nop */ t_bool chan_under_nop; /** chan_ban_info for new channel */ chan_band_info new_chan; } mlan_ds_11h_chan_nop_info, *pmlan_ds_11h_chan_nop_info; +/** Type definition of mlan_ds_11h_nop_chan_list for MLAN_OID_11H_NOP_CHAN_LIST + */ +typedef struct _mlan_ds_11h_nop_chan_list { + /** number of nop channel */ + t_u8 num_chan; + /** chan list array */ + t_u8 chan_list[20]; +} mlan_ds_11h_nop_chan_list, *pmlan_ds_11h_nop_chan_list; + typedef struct _mlan_ds_11h_chan_rep_req { t_u16 startFreq; Band_Config_t bandcfg; @@ -4233,6 +4357,16 @@ t_u8 host_based; } mlan_ds_11h_chan_rep_req; +/** channel dfs state for MLAN_OID_11H_CHAN_DFS_STATE */ +typedef struct _mlan_ds_11h_chan_dfs_state { + /** channel */ + t_u8 channel; + /** is dfs channel */ + t_u8 dfs_required; + /** dfs state */ + dfs_state_t dfs_state; +} mlan_ds_11h_chan_dfs_state; + typedef struct _mlan_ds_11h_dfs_w53_cfg { /** dfs w53 cfg */ t_u8 dfs53cfg; @@ -4250,11 +4384,17 @@ mlan_ds_11h_dfs_testing dfs_testing; /** channel NOP information for MLAN_OID_11H_CHAN_NOP_INFO */ mlan_ds_11h_chan_nop_info ch_nop_info; + /** NOP channel list for MLAN_OID_11H_NOP_CHAN_LIST */ + mlan_ds_11h_nop_chan_list nop_chan_list; /** channel report req for MLAN_OID_11H_CHAN_REPORT_REQUEST */ mlan_ds_11h_chan_rep_req chan_rpt_req; /** channel switch count for MLAN_OID_11H_CHAN_SWITCH_COUNT*/ t_s8 cs_count; + /** channel dfs state for MLAN_OID_11H_CHAN_DFS_STATE */ + mlan_ds_11h_chan_dfs_state ch_dfs_state; mlan_ds_11h_dfs_w53_cfg dfs_w53_cfg; + /** dfs_mode for MLAN_OID_11H_DFS_MODE */ + t_u8 dfs_mode; } param; } mlan_ds_11h_cfg, *pmlan_ds_11h_cfg; @@ -4342,6 +4482,27 @@ MLAN_FUNC_SHUTDOWN, }; +/* Net monitor filters: */ +/* management frame */ +#define MLAN_NETMON_MANAGEMENT MBIT(0) +/* control frame */ +#define MLAN_NETMON_CONTROL MBIT(1) +/* data frame */ +#define MLAN_NETMON_DATA MBIT(2) + +typedef struct _mlan_ds_misc_net_monitor { + /** Enable/disable network monitor */ + t_u32 enable_net_mon; + /** Set net monitor filer flag */ + t_u32 filter_flag; + /** Radio type */ + t_u32 band; + /** Channel */ + t_u32 channel; + /** Secondary channel bandwidth */ + t_u32 chan_bandwidth; +} mlan_ds_misc_net_monitor; + /** Type definition of mlan_ds_misc_tx_datapause * for MLAN_OID_MISC_TX_DATAPAUSE */ @@ -4437,6 +4598,9 @@ #define MLAN_IPADDR_OP_ARP_FILTER MBIT(0) /** IP operation ARP response */ #define MLAN_IPADDR_OP_AUTO_ARP_RESP MBIT(1) +/** Enable opcode bit for MDNS & NS when device enter into suspend **/ +#define MLAN_OP_ADD_MDNS MBIT(2) +#define MLAN_OP_ADD_IPV6_NS MBIT(3) /** Type definition of mlan_ds_misc_ipaddr_cfg for MLAN_OID_MISC_IP_ADDR */ typedef struct _mlan_ds_misc_ipaddr_cfg { @@ -4609,7 +4773,7 @@ * N -- report only happend > N consecutive times */ t_u8 data_high_snr_freq; - /* Link SNR threshold (dB) */ + /* Link SNR threshold (dB)*/ t_u16 link_snr; /* Link SNR frequency */ t_u16 link_snr_freq; @@ -4640,6 +4804,16 @@ t_u8 user_data[MAX_OTP_USER_DATA_LEN]; } mlan_ds_misc_otp_user_data; +/** Type definition of mlan_ds_fw_reconnect for MLAN_OID_MISC_AUTO_ASSOC */ +typedef struct _mlan_ds_fw_reconnect { + /* fw auto re-connect counter */ + t_u8 fw_reconn_counter; + /* fw auto re-connect interval */ + t_u8 fw_reconn_interval; + /* fw auto re-connect flags */ + t_u16 fw_reconn_flags; +} mlan_ds_fw_reconnect; + typedef struct _aggr_ctrl_cfg { /** Enable */ t_u16 enable; @@ -4716,15 +4890,15 @@ /** Type definition of mlan_ds_gpio_tsf_latch */ typedef struct _mlan_ds_gpio_tsf_latch { - /**clock sync Mode */ + /**clock sync Mode */ t_u8 clock_sync_mode; - /**clock sync Role */ + /**clock sync Role */ t_u8 clock_sync_Role; - /**clock sync GPIO Pin Number */ + /**clock sync GPIO Pin Number */ t_u8 clock_sync_gpio_pin_number; - /**clock sync GPIO Level or Toggle */ + /**clock sync GPIO Level or Toggle */ t_u8 clock_sync_gpio_level_toggle; - /**clock sync GPIO Pulse Width */ + /**clock sync GPIO Pulse Width */ t_u16 clock_sync_gpio_pulse_width; } mlan_ds_gpio_tsf_latch; @@ -4736,7 +4910,8 @@ t_u16 tsf_info; /**tsf */ t_u64 tsf; - /**Positive or negative offset in microsecond from Beacon TSF to GPIO toggle TSF */ + /**Positive or negative offset in microsecond from Beacon TSF to GPIO + * toggle TSF */ t_s32 tsf_offset; } mlan_ds_tsf_info; @@ -4749,8 +4924,193 @@ } mlan_ds_misc_pmfcfg; #endif +typedef MLAN_PACK_START struct _mlan_ds_multi_chan_cfg { + /** Channel Time */ + t_u32 channel_time; + /** Buffer Weight */ + t_u8 buffer_weight; + /** tlv len */ + t_u16 tlv_len; + /** TLV buffer */ + t_u8 tlv_buf[]; +} MLAN_PACK_END mlan_ds_multi_chan_cfg; + +typedef MLAN_PACK_START struct _mlan_ds_drcs_cfg { + /** Channel Index*/ + t_u16 chan_idx; + /** Channel time (in TU) for chan_idx */ + t_u8 chantime; + /** Channel swith time (in TU) for chan_idx */ + t_u8 switchtime; + /** Undoze time (in TU) for chan_idx */ + t_u8 undozetime; + /** Rx traffic control scheme when channel switch*/ + /** only valid for GC/STA interface*/ + t_u8 mode; +} MLAN_PACK_END mlan_ds_drcs_cfg; + #define MAX_SSID_NUM 16 #define MAX_AP_LIST 8 +#define RETRY_UNLIMITED_TIME 0xFF + +#define FW_ROAM_ENABLE MBIT(0) +#define FW_ROAM_TRIGGER_COND MBIT(1) +#define FW_ROAM_BSSID MBIT(2) +#define FW_ROAM_SSID MBIT(3) +#define FW_ROAM_RETRY_COUNT MBIT(4) +#define FW_ROAM_RSSI_PARA MBIT(5) +#define FW_ROAM_BAND_RSSI MBIT(6) +#define FW_ROAM_BGSCAN_PARAM MBIT(7) +#define FW_ROAM_EES_PARAM MBIT(8) +#define FW_ROAM_BCN_MISS_THRESHOLD MBIT(9) +#define FW_ROAM_PRE_BCN_MISS_THRESHOLD MBIT(10) +#define FW_ROAM_BLACKLIST MBIT(11) +#define FW_ROAM_REPEAT_CNT MBIT(12) + +/*Roam offload configuration for auto reconnection when suspend and resume*/ +typedef enum _roam_offload_config_mode { + ROAM_OFFLOAD_ENABLE = 1, + ROAM_OFFLOAD_SUSPEND_CFG, + ROAM_OFFLOAD_RESUME_CFG, + ROAM_OFFLOAD_PARAM_CFG, +} roam_offload_config_mode; + +typedef enum _roam_offload_set_mode { + ROAM_OFFLOAD_DISABLE = 0, + ROAM_OFFLOAD_WITH_APLIST, + ROAM_OFFLOAD_WITHOUT_APLIST, + ROAM_OFFLOAD_WITH_BSSID, + ROAM_OFFLOAD_WITH_SSID, + AUTO_RECONNECT, +} roam_offload_set_mode; + +typedef enum _roam_offload_trigger_mode { + NO_TRIGGER = 0x00, + RSSI_LOW_TRIGGER = 0x01, + PRE_BEACON_LOST_TRIGGER = 0x02, + LINK_LOST_TRIGGER = 0x04, + DEAUTH_WITH_EXT_AP_TRIGGER = 0x08, +} roam_offload_trigger_mode; + +/** mlan_ds_misc_ees_cfg structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_ees_cfg { + /* EES mode*/ + t_u16 ees_mode; + /* EES report condition*/ + t_u16 ees_rpt_condition; + /* High scan period(milliseconds)*/ + t_u16 high_scan_period; + /* High scan count*/ + t_u16 high_scan_count; + /* Middle scan period(milliseconds)*/ + t_u16 mid_scan_period; + /* Middle scan count*/ + t_u16 mid_scan_count; + /* Low scan period(milliseconds)*/ + t_u16 low_scan_period; + /* Low scan count*/ + t_u16 low_scan_count; +} MLAN_PACK_END mlan_ds_misc_ees_cfg; + +/** mlan_ds_misc_bgscan_cfg structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_bgscan_cfg { + /* BSS Type 0x1-bss independent, 0x2-bss infrastructure, 0x3-bss any*/ + t_u8 bss_type; + /* Number of channels scanned for each scan*/ + t_u8 channels_per_scan; + /* Interval between consective scans*/ + t_u32 scan_interval; + /* Conditons to trigger report to host*/ + t_u32 bg_rpt_condition; +} MLAN_PACK_END mlan_ds_misc_bgscan_cfg; + +/** mlan_ds_misc_band_rssi structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_band_rssi { + /* RSSI hysteresis*/ + t_u8 rssi_hysteresis; + /* Preferred channel band for fw roaming + * 0:2.4G band; 1: 5G band; 2:4G band; 0xFF:band not set(invalid) + */ + t_u8 band_preferred; +} MLAN_PACK_END mlan_ds_misc_band_rssi; + +/** mlan_ds_misc_ssid_list structure */ +typedef MLAN_PACK_START struct _mlan_ds_misc_ssid_list { + /* SSID number*/ + t_u8 ssid_num; + /* SSID for fw roaming/auto_reconnect*/ + mlan_802_11_ssid ssids[MAX_SSID_NUM]; +} MLAN_PACK_END mlan_ds_misc_ssid_list; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload_aplist { + /** Number of AP**/ + t_u8 ap_num; + /** AP mac addrs**/ + t_u8 ap_mac[MAX_AP_LIST][MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END mlan_ds_misc_roam_offload_aplist; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload_para_rssi { + /** Setting flag**/ + t_u8 set_flag; + /** Max value of RSSI threshold**/ + t_u8 max_rssi; + /** Min value of RSSI threshold**/ + t_u8 min_rssi; + /** Adjusting step value of RSSI threshold**/ + t_u8 step_rssi; +} MLAN_PACK_END mlan_ds_misc_roam_offload_para_rssi; + +typedef MLAN_PACK_START struct _mlan_ds_misc_roam_offload { + /** Enable roam offload**/ + t_u8 enable; + /** User set passphrase**/ + t_u8 userset_passphrase; + /* Condition to trigger roaming + * Bit0 : RSSI low trigger + * Bit1 : Pre-beacon lost trigger + * Bit2 : Link Lost trigger + * Bit3 : Deauth by ext-AP trigger + * Bit4 ~ Bit15 : Reserved + * value 0 : no trigger + * value 0xff : invalid + */ + t_u16 trigger_condition; + /** AP list**/ + mlan_ds_misc_roam_offload_aplist aplist; + /*Roam offload configuration mode for auto connection when suspend and + * resume*/ + roam_offload_config_mode config_mode; + /** Retry count**/ + t_u8 retry_count; + /** RSSI para**/ + mlan_ds_misc_roam_offload_para_rssi para_rssi; + /** BSSID of reconnection**/ + mlan_802_11_mac_addr bssid_reconnect; + /* SSID List(White list)*/ + mlan_ds_misc_ssid_list ssid_list; + /* Black list(BSSID list)*/ + mlan_ds_misc_roam_offload_aplist black_list; + /* BAND and RSSI_HYSTERESIS set flag*/ + t_u8 band_rssi_flag; + mlan_ds_misc_band_rssi band_rssi; + + /* BGSCAN params set flag*/ + t_u8 bgscan_set_flag; + mlan_ds_misc_bgscan_cfg bgscan_cfg; + + /* EES mode params set flag*/ + t_u8 ees_param_set_flag; + mlan_ds_misc_ees_cfg ees_cfg; + + /* Beacon miss threshold*/ + t_u8 bcn_miss_threshold; + + /* Beacon miss threshold*/ + t_u8 pre_bcn_miss_threshold; + + /* Scan repeat count*/ + t_u16 repeat_count; +} MLAN_PACK_END mlan_ds_misc_roam_offload; /**Action ID for TDLS disable link*/ #define WLAN_TDLS_DISABLE_LINK 0x00 @@ -4804,6 +5164,8 @@ #define TDLS_IE_FLAGS_QOS_INFO 0x0080 /** flag for TDLS SETUP */ #define TDLS_IE_FLAGS_SETUP 0x0100 +#define TDLS_IE_FLAGS_HECAP 0x0200 +#define TDLS_IE_FLAGS_HEOP 0x0400 /** TDLS ie buffer */ typedef struct _mlan_ds_misc_tdls_ies { @@ -4825,21 +5187,16 @@ t_u8 vht_oprat[IEEE_MAX_IE_SIZE]; /** aid Info */ t_u8 aid_info[IEEE_MAX_IE_SIZE]; + /** HE Capabilities IE */ + t_u8 he_cap[IEEE_MAX_IE_SIZE]; + /** HE Operation IE */ + t_u8 he_op[IEEE_MAX_IE_SIZE]; /** supported channels */ t_u8 supp_chan[IEEE_MAX_IE_SIZE]; /** supported regulatory class */ t_u8 regulatory_class[IEEE_MAX_IE_SIZE]; } mlan_ds_misc_tdls_ies; -#ifdef RX_PACKET_COALESCE -typedef struct _mlan_ds_misc_rx_packet_coalesce { - /** packet threshold */ - t_u32 packet_threshold; - /** timeout value */ - t_u16 delay; -} mlan_ds_misc_rx_packet_coalesce; -#endif - typedef struct _mlan_ds_misc_dfs_repeater { /** Set or Get */ t_u16 action; @@ -4980,7 +5337,7 @@ t_u8 replay_ctr[MLAN_REPLAY_CTR_LEN]; } mlan_ds_misc_gtk_rekey_data; typedef struct _mlan_ds_bw_chan_oper { - /* bandwidth 20:20M 40:40M 80:80M */ + /* bandwidth 20:20M 40:40M 80:80M*/ t_u8 bandwidth; /* channel number */ t_u8 channel; @@ -5032,9 +5389,9 @@ /** Mode of Operation 0: Disable 1: Tx Continuous Packet 2: Tx * Continuous Wave */ t_u8 mode; - /*channel */ + /*channel*/ t_u8 channel; - /* channel info */ + /* channel info*/ t_u8 chanInfo; /** Tx Power level in dBm */ t_u16 txPower; @@ -5083,6 +5440,34 @@ } mlan_ds_ssu_params; #endif +#define CSI_FILTER_MAX 16 +/** Structure of CSI filters */ +typedef MLAN_PACK_START struct _mlan_csi_filter_t { + /** Source address of the packet to receive */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Pakcet type of the interested CSI */ + t_u8 pkt_type; + /* Packet subtype of the interested CSI */ + t_u8 subtype; + /* Other filter flags */ + t_u8 flags; +} MLAN_PACK_END mlan_csi_filter_t; +/** Structure of CSI parameters */ +typedef MLAN_PACK_START struct _mlan_ds_csi_params { + /** CSI enable flag. 1: enable, 0: disable */ + t_u16 csi_enable; + /** Header ID*/ + t_u32 head_id; + /** Tail ID */ + t_u32 tail_id; + /** Number of CSI filters */ + t_u8 csi_filter_cnt; + /** Chip ID */ + t_u8 chip_id; + /** CSI filters */ + mlan_csi_filter_t csi_filter[CSI_FILTER_MAX]; +} MLAN_PACK_END mlan_ds_csi_params; + typedef MLAN_PACK_START struct _mlan_ds_hal_phy_cfg_params { /** 11b pwr spectral density mask enable/disable */ t_u8 dot11b_psd_mask_cfg; @@ -5138,19 +5523,20 @@ t_u8 trpc_buf[2048]; } mlan_ds_misc_chan_trpc_cfg; -#define MFG_CMD_SET_TEST_MODE 1 +#define MFG_CMD_SET_TEST_MODE 1 #define MFG_CMD_UNSET_TEST_MODE 0 -#define MFG_CMD_TX_ANT 0x1004 -#define MFG_CMD_RX_ANT 0x1005 -#define MFG_CMD_TX_CONT 0x1009 -#define MFG_CMD_RF_CHAN 0x100A -#define MFG_CMD_CLR_RX_ERR 0x1010 -#define MFG_CMD_TX_FRAME 0x1021 -#define MFG_CMD_RFPWR 0x1033 -#define MFG_CMD_RF_BAND_AG 0x1034 -#define MFG_CMD_RF_CHANNELBW 0x1044 -#define MFG_CMD_RADIO_MODE_CFG 0x1211 +#define MFG_CMD_TX_ANT 0x1004 +#define MFG_CMD_RX_ANT 0x1005 +#define MFG_CMD_TX_CONT 0x1009 +#define MFG_CMD_RF_CHAN 0x100A +#define MFG_CMD_CLR_RX_ERR 0x1010 +#define MFG_CMD_TX_FRAME 0x1021 +#define MFG_CMD_RFPWR 0x1033 +#define MFG_CMD_RF_BAND_AG 0x1034 +#define MFG_CMD_RF_CHANNELBW 0x1044 +#define MFG_CMD_RADIO_MODE_CFG 0x1211 #define MFG_CMD_CONFIG_MAC_HE_TB_TX 0x110A +#define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C /** MFG CMD generic cfg */ struct MLAN_PACK_START mfg_cmd_generic_cfg { /** MFG command code */ @@ -5209,19 +5595,19 @@ t_u32 stbc; /** power id */ t_u32 rsvd[2]; - /** NumPkt */ + /** NumPkt */ t_u32 NumPkt; - /** MaxPE */ + /** MaxPE */ t_u32 MaxPE; - /** BeamChange */ + /** BeamChange */ t_u32 BeamChange; - /** Dcm */ + /** Dcm */ t_u32 Dcm; - /** Doppler */ + /** Doppler */ t_u32 Doppler; - /** MidP */ + /** MidP */ t_u32 MidP; - /** QNum */ + /** QNum */ t_u32 QNum; } MLAN_PACK_END; @@ -5253,26 +5639,198 @@ } MLAN_PACK_END; struct MLAN_PACK_START mfg_Cmd_HE_TBTx_t { - /** MFG command code */ + /** MFG command code */ t_u32 mfg_cmd; - /** Action */ + /** Action */ t_u16 action; - /** Device ID */ + /** Device ID */ t_u16 device_id; - /** MFG Error code */ + /** MFG Error code */ t_u32 error; - /** Enable Tx */ + /** Enable Tx */ t_u16 enable; - /** Q num */ + /** Q num */ t_u16 qnum; - /** AID */ + /** AID */ t_u16 aid; - /** AXQ Mu Timer */ + /** AXQ Mu Timer */ t_u16 axq_mu_timer; - /** Tx Power */ - t_u16 tx_power; + /** Tx Power */ + t_s16 tx_power; } MLAN_PACK_END; +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t { + t_u64 reserved : 1; + t_u64 he_sig2 : 9; + t_u64 doppler : 1; + t_u64 spatial_reuse : 16; + t_u64 pe_disambig : 1; + t_u64 pre_fec_pad_fct : 2; + t_u64 ap_tx_pwr : 6; + + t_u64 ldpc_ess : 1; + t_u64 ul_stbc : 1; + t_u64 ltf_symbol : 3; + t_u64 ltf_mode : 1; + t_u64 ltf_type : 2; + + t_u64 ul_bw : 2; + t_u64 cs_required : 1; + t_u64 more_tf : 1; + t_u64 ul_len : 12; + t_u64 trigger_type : 4; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t { + t_u64 trigger_type : 4; + t_u64 ul_len : 12; + t_u64 more_tf : 1; + t_u64 cs_required : 1; + t_u64 ul_bw : 2; + + t_u64 ltf_type : 2; + t_u64 ltf_mode : 1; + t_u64 ltf_symbol : 3; + t_u64 ul_stbc : 1; + t_u64 ldpc_ess : 1; + + t_u64 ap_tx_pwr : 6; + t_u64 pre_fec_pad_fct : 2; + t_u64 pe_disambig : 1; + t_u64 spatial_reuse : 16; + t_u64 doppler : 1; + t_u64 he_sig2 : 9; + t_u64 reserved : 1; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t { + t_u8 reserved : 1; + t_u8 ul_target_rssi : 7; + t_u32 ss_alloc : 6; + t_u32 ul_dcm : 1; + t_u32 ul_mcs : 4; + t_u32 ul_coding_type : 1; + t_u32 ru_alloc : 7; + t_u32 ru_alloc_reg : 1; + t_u32 aid12 : 12; + +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t { + t_u32 aid12 : 12; + t_u32 ru_alloc_reg : 1; + t_u32 ru_alloc : 7; + t_u32 ul_coding_type : 1; + t_u32 ul_mcs : 4; + t_u32 ul_dcm : 1; + t_u32 ss_alloc : 6; + t_u8 ul_target_rssi : 7; + t_u8 reserved : 1; +} MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t { + t_u8 pref_ac : 2; + t_u8 ac_pl : 1; + t_u8 tid_al : 3; + t_u8 mpdu_mu_sf : 2; +} MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t { + t_u8 mpdu_mu_sf : 2; + t_u8 tid_al : 3; + t_u8 ac_pl : 1; + t_u8 pref_ac : 2; +} MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t; +#endif + +#ifdef BIG_ENDIAN_SUPPORT +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t { + /** Order */ + t_u8 order : 1; + /** Wep */ + t_u8 wep : 1; + /** More Data */ + t_u8 more_data : 1; + /** Power Mgmt */ + t_u8 pwr_mgmt : 1; + /** Retry */ + t_u8 retry : 1; + /** More Frag */ + t_u8 more_frag : 1; + /** From DS */ + t_u8 from_ds : 1; + /** To DS */ + t_u8 to_ds : 1; + /** Sub Type */ + t_u8 sub_type : 4; + /** Type */ + t_u8 type : 2; + /** Protocol Version */ + t_u8 protocol_version : 2; +} MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t; +#else +typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t { + /** Protocol Version */ + t_u8 protocol_version : 2; + /** Type */ + t_u8 type : 2; + /** Sub Type */ + t_u8 sub_type : 4; + /** To DS */ + t_u8 to_ds : 1; + /** From DS */ + t_u8 from_ds : 1; + /** More Frag */ + t_u8 more_frag : 1; + /** Retry */ + t_u8 retry : 1; + /** Power Mgmt */ + t_u8 pwr_mgmt : 1; + /** More Data */ + t_u8 more_data : 1; + /** Wep */ + t_u8 wep : 1; + /** Order */ + t_u8 order : 1; +} MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t; +#endif + +typedef MLAN_PACK_START struct _mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t { + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** enable Tx*/ + t_u32 enable_tx; + /** enable Stand Alone HE TB */ + t_u32 standalone_hetb; + /** Frame Control */ + mfg_cmd_IEEEtypes_FrameCtrl_t frmCtl; + /** Duration */ + t_u16 duration; + /** Destination MAC Address */ + t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC Address */ + t_u8 src_addr[MLAN_MAC_ADDR_LENGTH]; + /** Common Info Field **/ + mfg_cmd_IEEEtypes_HETrigComInfo_t trig_common_field; + /** User Info Field **/ + mfg_cmd_IEEEtypes_HETrigUserInfo_t trig_user_info_field; + /** Trigger Dependent User Info Field **/ + mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info; +} MLAN_PACK_END mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t; + typedef struct _mlan_ds_misc_chnrgpwr_cfg { /** length */ t_u16 length; @@ -5290,6 +5848,46 @@ chan_freq_power_t cfp_tbl[]; } mlan_ds_misc_cfp_tbl; +/** mlan_ds_mc_aggr_cfg for MLAN_OID_MISC_MC_AGGR_CFG */ +typedef struct _mlan_ds_mc_aggr_cfg { + /** action */ + t_u8 action; + /* 1 enable, 0 disable + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 enable_bitmap; + /* 1 valid, 0 invalid + * bit 0 MC aggregation + * bit 1 packet expiry + * bit 2 CTS2Self + * bit 3 CTS2Self duration offset*/ + t_u8 mask_bitmap; + /** CTS2Self duration offset */ + t_u16 cts2self_offset; +} mlan_ds_mc_aggr_cfg; + +/** mlan_ds_stats */ +typedef struct _mlan_ds_stats { + /** action */ + t_u16 action; + /** tlv len */ + t_u16 tlv_len; + /** TLV buffer */ + t_u8 tlv_buf[1]; +} mlan_ds_stats; + +typedef struct _mlan_ds_ch_load { + /** action */ + t_u8 action; + t_u16 ch_load_param; + t_s16 noise; + t_u16 rx_quality; + t_u16 duration; + t_u16 cca_th; +} mlan_ds_ch_load; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -5312,6 +5910,8 @@ t_u32 wws_cfg; /** Get associate response for MLAN_OID_MISC_ASSOC_RSP */ mlan_ds_misc_assoc_rsp assoc_resp; + /** Get associate request for MLAN_OID_MISC_ASSOC_REQ */ + mlan_ds_misc_assoc_req assoc_req; /** Function init/shutdown for MLAN_OID_MISC_INIT_SHUTDOWN */ t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ @@ -5327,6 +5927,8 @@ mlan_ds_misc_tdls_ies tdls_ies; /**tdls cs off channel*/ t_u8 tdls_cs_channel; + /** Net monitor for MLAN_OID_MISC_NET_MONITOR */ + mlan_ds_misc_net_monitor net_mon; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ @@ -5357,6 +5959,8 @@ ExtCap_t ext_cap; #endif mlan_ds_misc_otp_user_data otp_user_data; + /** fw re-connect cfg param set */ + mlan_ds_fw_reconnect fw_auto_reconnect; #ifdef USB /** USB aggregation parameters for MLAN_OID_MISC_USB_AGGR_CTRL */ @@ -5368,6 +5972,13 @@ #if defined(STA_SUPPORT) mlan_ds_misc_pmfcfg pmfcfg; #endif + /** Multi-channel config for MLAN_OID_MISC_MULTI_CHAN_CFG */ + mlan_ds_multi_chan_cfg multi_chan_cfg; + /** Multi-channel policy for MLAN_OID_MISC_MULTI_CHAN_POLICY */ + t_u16 multi_chan_policy; + /** channel drcs time slicing config for MLAN_OID_MISC_DRCS_CFG + */ + mlan_ds_drcs_cfg drcs_cfg[2]; #ifdef WIFI_DIRECT_SUPPORT mlan_ds_wifi_direct_config p2p_config; #endif @@ -5378,9 +5989,6 @@ /** MEF-FLT-CONFIG for MLAN_OID_MISC_NV_FLT_CFG */ mlan_ds_misc_mef_flt_cfg mef_flt_cfg; mlan_ds_misc_dfs_repeater dfs_repeater; -#ifdef RX_PACKET_COALESCE - mlan_ds_misc_rx_packet_coalesce rx_coalesce; -#endif /** FW reload flag */ t_u8 fw_reload; mlan_ds_sensor_temp sensor_temp; @@ -5388,6 +5996,8 @@ mlan_ds_misc_gtk_rekey_data gtk_rekey; mlan_ds_bw_chan_oper bw_chan_oper; mlan_ds_ind_rst_cfg ind_rst_cfg; + /** Roam offload */ + mlan_ds_misc_roam_offload roam_offload; t_u64 misc_tsf; mlan_ds_custom_reg_domain custom_reg_domain; mlan_ds_misc_keep_alive keep_alive; @@ -5399,6 +6009,7 @@ #if defined(PCIE) mlan_ds_ssu_params ssu_params; #endif + mlan_ds_csi_params csi_params; /** boot sleep enable or disable */ t_u16 boot_sleep; /** Mapping Policy */ @@ -5418,15 +6029,20 @@ struct mfg_cmd_tx_cont mfg_tx_cont; struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; mlan_ds_misc_arb_cfg arb_cfg; mlan_ds_misc_cfp_tbl cfp; t_u8 range_ext_mode; mlan_ds_misc_dot11mc_unassoc_ftm_cfg dot11mc_unassoc_ftm_cfg; mlan_ds_misc_tp_state tp_state; mlan_ds_hal_phy_cfg_params hal_phy_cfg_params; + mlan_ds_mc_aggr_cfg mc_aggr_cfg; + mlan_ds_stats stats; #ifdef UAP_SUPPORT t_u8 wacp_mode; #endif + t_u32 ips_ctrl; + mlan_ds_ch_load ch_load; } param; } mlan_ds_misc_cfg, *pmlan_ds_misc_cfg;
diff --git a/wlan_sd8987/mlinux/moal_cfg80211.c b/wlan_sd8987/mlinux/moal_cfg80211.c index 580956c..243be76 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211.c +++ b/wlan_sd8987/mlinux/moal_cfg80211.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for CFG80211. * * - * Copyright 2011-2021 NXP + * Copyright 2011-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -33,100 +33,103 @@ /** Supported rates to be advertised to the cfg80211 */ static struct ieee80211_rate cfg80211_rates[] = { { - .bitrate = 10, - .hw_value = 2, - }, + .bitrate = 10, + .hw_value = 2, + }, { - .bitrate = 20, - .hw_value = 4, - }, + .bitrate = 20, + .hw_value = 4, + }, { - .bitrate = 55, - .hw_value = 11, - }, + .bitrate = 55, + .hw_value = 11, + }, { - .bitrate = 110, - .hw_value = 22, - }, + .bitrate = 110, + .hw_value = 22, + }, { - .bitrate = 60, - .hw_value = 12, - }, + .bitrate = 60, + .hw_value = 12, + }, { - .bitrate = 90, - .hw_value = 18, - }, + .bitrate = 90, + .hw_value = 18, + }, { - .bitrate = 120, - .hw_value = 24, - }, + .bitrate = 120, + .hw_value = 24, + }, { - .bitrate = 180, - .hw_value = 36, - }, + .bitrate = 180, + .hw_value = 36, + }, { - .bitrate = 240, - .hw_value = 48, - }, + .bitrate = 240, + .hw_value = 48, + }, { - .bitrate = 360, - .hw_value = 72, - }, + .bitrate = 360, + .hw_value = 72, + }, { - .bitrate = 480, - .hw_value = 96, - }, + .bitrate = 480, + .hw_value = 96, + }, { - .bitrate = 540, - .hw_value = 108, - }, + .bitrate = 540, + .hw_value = 108, + }, }; /** Channel definitions for 2 GHz to be advertised to cfg80211 */ static struct ieee80211_channel cfg80211_channels_2ghz[] = { - {.center_freq = 2412,.hw_value = 1,.max_power = 20}, - {.center_freq = 2417,.hw_value = 2,.max_power = 20}, - {.center_freq = 2422,.hw_value = 3,.max_power = 20}, - {.center_freq = 2427,.hw_value = 4,.max_power = 20}, - {.center_freq = 2432,.hw_value = 5,.max_power = 20}, - {.center_freq = 2437,.hw_value = 6,.max_power = 20}, - {.center_freq = 2442,.hw_value = 7,.max_power = 20}, - {.center_freq = 2447,.hw_value = 8,.max_power = 20}, - {.center_freq = 2452,.hw_value = 9,.max_power = 20}, - {.center_freq = 2457,.hw_value = 10,.max_power = 20}, - {.center_freq = 2462,.hw_value = 11,.max_power = 20}, - {.center_freq = 2467,.hw_value = 12,.max_power = 20}, - {.center_freq = 2472,.hw_value = 13,.max_power = 20}, - {.center_freq = 2484,.hw_value = 14,.max_power = 20}, + {.center_freq = 2412, .hw_value = 1, .max_power = 20}, + {.center_freq = 2417, .hw_value = 2, .max_power = 20}, + {.center_freq = 2422, .hw_value = 3, .max_power = 20}, + {.center_freq = 2427, .hw_value = 4, .max_power = 20}, + {.center_freq = 2432, .hw_value = 5, .max_power = 20}, + {.center_freq = 2437, .hw_value = 6, .max_power = 20}, + {.center_freq = 2442, .hw_value = 7, .max_power = 20}, + {.center_freq = 2447, .hw_value = 8, .max_power = 20}, + {.center_freq = 2452, .hw_value = 9, .max_power = 20}, + {.center_freq = 2457, .hw_value = 10, .max_power = 20}, + {.center_freq = 2462, .hw_value = 11, .max_power = 20}, + {.center_freq = 2467, .hw_value = 12, .max_power = 20}, + {.center_freq = 2472, .hw_value = 13, .max_power = 20}, + {.center_freq = 2484, .hw_value = 14, .max_power = 20}, }; /** Channel definitions for 5 GHz to be advertised to cfg80211 */ static struct ieee80211_channel cfg80211_channels_5ghz[] = { - {.center_freq = 5180,.hw_value = 36,.max_power = 20}, - {.center_freq = 5200,.hw_value = 40,.max_power = 20}, - {.center_freq = 5220,.hw_value = 44,.max_power = 20}, - {.center_freq = 5240,.hw_value = 48,.max_power = 20}, - {.center_freq = 5260,.hw_value = 52,.max_power = 20}, - {.center_freq = 5280,.hw_value = 56,.max_power = 20}, - {.center_freq = 5300,.hw_value = 60,.max_power = 20}, - {.center_freq = 5320,.hw_value = 64,.max_power = 20}, - {.center_freq = 5500,.hw_value = 100,.max_power = 20}, - {.center_freq = 5520,.hw_value = 104,.max_power = 20}, - {.center_freq = 5540,.hw_value = 108,.max_power = 20}, - {.center_freq = 5560,.hw_value = 112,.max_power = 20}, - {.center_freq = 5580,.hw_value = 116,.max_power = 20}, - {.center_freq = 5600,.hw_value = 120,.max_power = 20}, - {.center_freq = 5620,.hw_value = 124,.max_power = 20}, - {.center_freq = 5640,.hw_value = 128,.max_power = 20}, - {.center_freq = 5660,.hw_value = 132,.max_power = 20}, - {.center_freq = 5680,.hw_value = 136,.max_power = 20}, - {.center_freq = 5700,.hw_value = 140,.max_power = 20}, - {.center_freq = 5720,.hw_value = 144,.max_power = 20}, - {.center_freq = 5745,.hw_value = 149,.max_power = 20}, - {.center_freq = 5765,.hw_value = 153,.max_power = 20}, - {.center_freq = 5785,.hw_value = 157,.max_power = 20}, - {.center_freq = 5805,.hw_value = 161,.max_power = 20}, - {.center_freq = 5825,.hw_value = 165,.max_power = 20}, + {.center_freq = 5180, .hw_value = 36, .max_power = 20}, + {.center_freq = 5200, .hw_value = 40, .max_power = 20}, + {.center_freq = 5220, .hw_value = 44, .max_power = 20}, + {.center_freq = 5240, .hw_value = 48, .max_power = 20}, + {.center_freq = 5260, .hw_value = 52, .max_power = 20}, + {.center_freq = 5280, .hw_value = 56, .max_power = 20}, + {.center_freq = 5300, .hw_value = 60, .max_power = 20}, + {.center_freq = 5320, .hw_value = 64, .max_power = 20}, + {.center_freq = 5500, .hw_value = 100, .max_power = 20}, + {.center_freq = 5520, .hw_value = 104, .max_power = 20}, + {.center_freq = 5540, .hw_value = 108, .max_power = 20}, + {.center_freq = 5560, .hw_value = 112, .max_power = 20}, + {.center_freq = 5580, .hw_value = 116, .max_power = 20}, + {.center_freq = 5600, .hw_value = 120, .max_power = 20}, + {.center_freq = 5620, .hw_value = 124, .max_power = 20}, + {.center_freq = 5640, .hw_value = 128, .max_power = 20}, + {.center_freq = 5660, .hw_value = 132, .max_power = 20}, + {.center_freq = 5680, .hw_value = 136, .max_power = 20}, + {.center_freq = 5700, .hw_value = 140, .max_power = 20}, + {.center_freq = 5720, .hw_value = 144, .max_power = 20}, + {.center_freq = 5745, .hw_value = 149, .max_power = 20}, + {.center_freq = 5765, .hw_value = 153, .max_power = 20}, + {.center_freq = 5785, .hw_value = 157, .max_power = 20}, + {.center_freq = 5805, .hw_value = 161, .max_power = 20}, + {.center_freq = 5825, .hw_value = 165, .max_power = 20}, + {.center_freq = 5845, .hw_value = 169, .max_power = 20}, + {.center_freq = 5865, .hw_value = 173, .max_power = 20}, + {.center_freq = 5885, .hw_value = 177, .max_power = 20}, }; struct ieee80211_supported_band cfg80211_band_2ghz = { @@ -145,50 +148,7 @@ .n_bitrates = ARRAY_SIZE(cfg80211_rates) - 4, }; -/** Channel definitions for 5 GHz to be advertised to cfg80211 */ -static struct ieee80211_channel mac1_cfg80211_channels_5ghz[] = { - {.center_freq = 5180,.hw_value = 36,.max_power = 20}, - {.center_freq = 5200,.hw_value = 40,.max_power = 20}, - {.center_freq = 5220,.hw_value = 44,.max_power = 20}, - {.center_freq = 5240,.hw_value = 48,.max_power = 20}, - {.center_freq = 5260,.hw_value = 52,.max_power = 20}, - {.center_freq = 5280,.hw_value = 56,.max_power = 20}, - {.center_freq = 5300,.hw_value = 60,.max_power = 20}, - {.center_freq = 5320,.hw_value = 64,.max_power = 20}, - {.center_freq = 5500,.hw_value = 100,.max_power = 20}, - {.center_freq = 5520,.hw_value = 104,.max_power = 20}, - {.center_freq = 5540,.hw_value = 108,.max_power = 20}, - {.center_freq = 5560,.hw_value = 112,.max_power = 20}, - {.center_freq = 5580,.hw_value = 116,.max_power = 20}, - {.center_freq = 5600,.hw_value = 120,.max_power = 20}, - {.center_freq = 5620,.hw_value = 124,.max_power = 20}, - {.center_freq = 5640,.hw_value = 128,.max_power = 20}, - {.center_freq = 5660,.hw_value = 132,.max_power = 20}, - {.center_freq = 5680,.hw_value = 136,.max_power = 20}, - {.center_freq = 5700,.hw_value = 140,.max_power = 20}, - {.center_freq = 5720,.hw_value = 144,.max_power = 20}, - {.center_freq = 5745,.hw_value = 149,.max_power = 20}, - {.center_freq = 5765,.hw_value = 153,.max_power = 20}, - {.center_freq = 5785,.hw_value = 157,.max_power = 20}, - {.center_freq = 5805,.hw_value = 161,.max_power = 20}, - {.center_freq = 5825,.hw_value = 165,.max_power = 20}, -}; - -struct ieee80211_supported_band mac1_cfg80211_band_2ghz = { - .channels = cfg80211_channels_2ghz, - .band = IEEE80211_BAND_2GHZ, - .n_channels = ARRAY_SIZE(cfg80211_channels_2ghz), - .bitrates = cfg80211_rates, - .n_bitrates = ARRAY_SIZE(cfg80211_rates), -}; - -struct ieee80211_supported_band mac1_cfg80211_band_5ghz = { - .channels = mac1_cfg80211_channels_5ghz, - .band = IEEE80211_BAND_5GHZ, - .n_channels = ARRAY_SIZE(mac1_cfg80211_channels_5ghz), - .bitrates = cfg80211_rates + 4, - .n_bitrates = ARRAY_SIZE(cfg80211_rates) - 4, -}; +extern pmoal_handle m_handle[]; #if KERNEL_VERSION(2, 6, 29) < LINUX_VERSION_CODE #ifdef UAP_SUPPORT @@ -207,6 +167,12 @@ /******************************************************** * Global Functions ********************************************************/ +#ifdef UAP_SUPPORT +#if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 20, 0) +int woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg *he_cfg, + t_u8 wait_option); +#endif +#endif /** * @brief Get the private structure from wiphy @@ -215,8 +181,7 @@ * * @return Pointer to moal_private */ -void * -woal_get_wiphy_priv(struct wiphy *wiphy) +void *woal_get_wiphy_priv(struct wiphy *wiphy) { return (void *)(*(unsigned long *)wiphy_priv(wiphy)); } @@ -228,8 +193,7 @@ * * @return Pointer to moal_private */ -void * -woal_get_netdev_priv(struct net_device *dev) +void *woal_get_netdev_priv(struct net_device *dev) { return (void *)netdev_priv(dev); } @@ -241,8 +205,7 @@ * * @return channel frequency */ -int -woal_get_active_intf_freq(moal_private *priv) +int woal_get_active_intf_freq(moal_private *priv) { moal_handle *handle = priv->phandle; int i; @@ -251,55 +214,43 @@ #ifdef UAP_SUPPORT || priv->bss_started == MTRUE #endif - ) - return ieee80211_channel_to_frequency(priv->channel + ) + return ieee80211_channel_to_frequency( + priv->channel #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE - , - (priv->channel <= - 14 ? IEEE80211_BAND_2GHZ - : IEEE80211_BAND_5GHZ) + , + (priv->channel <= 14 ? IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ) #endif - ); + ); for (i = 0; i < handle->priv_num; i++) { #ifdef STA_SUPPORT if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_STA) { if (handle->priv[i]->media_connected == MTRUE) - return ieee80211_channel_to_frequency(handle-> - priv[i]-> - channel + return ieee80211_channel_to_frequency( + handle->priv[i]->channel #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE - , - (handle-> - priv[i]-> - channel - <= - 14 ? - IEEE80211_BAND_2GHZ - : - IEEE80211_BAND_5GHZ) + , + (handle->priv[i]->channel <= 14 ? + IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ) #endif - ); + ); } #endif #ifdef UAP_SUPPORT if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_UAP) { if (handle->priv[i]->bss_started == MTRUE) - return ieee80211_channel_to_frequency(handle-> - priv[i]-> - channel + return ieee80211_channel_to_frequency( + handle->priv[i]->channel #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE - , - (handle-> - priv[i]-> - channel - <= - 14 ? - IEEE80211_BAND_2GHZ - : - IEEE80211_BAND_5GHZ) + , + (handle->priv[i]->channel <= 14 ? + IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ) #endif - ); + ); } #endif } @@ -313,8 +264,7 @@ * * @return IEEE band type */ -t_u8 -woal_band_cfg_to_ieee_band(t_u32 band) +t_u8 woal_band_cfg_to_ieee_band(t_u32 band) { t_u8 ret_radio_type; @@ -331,7 +281,7 @@ case BAND_B | BAND_G: case BAND_GN: case BAND_B | BAND_GN: - /* Fall Through */ + /* Fall Through */ default: ret_radio_type = IEEE80211_BAND_2GHZ; break; @@ -342,6 +292,32 @@ } /** + * @brief Convert IEEE band type to radio_type + * + * @param ieeeband IEEE band + * + * @return radio_type + */ +t_u8 woal_ieee_band_to_radio_type(t_u8 ieee_band) +{ + t_u8 radio_type = 0; + + ENTER(); + + switch (ieee_band) { + case IEEE80211_BAND_5GHZ: + radio_type = BAND_5GHZ; + break; + case IEEE80211_BAND_2GHZ: + default: + radio_type = BAND_2GHZ; + break; + } + LEAVE(); + return radio_type; +} + +/** * @brief Set/Enable encryption key * * @param priv A pointer to moal_private structure @@ -358,16 +334,16 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep, - t_u32 cipher, const t_u8 *key, int key_len, - const t_u8 *seq, int seq_len, t_u8 key_index, - const t_u8 *addr, int disable, t_u8 wait_option) +mlan_status woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep, + t_u32 cipher, const t_u8 *key, int key_len, + const t_u8 *seq, int seq_len, t_u8 key_index, + const t_u8 *addr, int disable, + t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; mlan_status ret = MLAN_STATUS_SUCCESS; - t_u8 bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; ENTER(); @@ -384,11 +360,10 @@ ((cipher == WLAN_CIPHER_SUITE_WEP40) || (cipher == WLAN_CIPHER_SUITE_WEP104))) { priv->uap_wep_key[key_index].length = key_len; - moal_memcpy_ext(priv->phandle, - priv->uap_wep_key[key_index].key, key, - key_len, - sizeof(priv->uap_wep_key[key_index]. - key)); + moal_memcpy_ext( + priv->phandle, priv->uap_wep_key[key_index].key, + key, key_len, + sizeof(priv->uap_wep_key[key_index].key)); priv->cipher = cipher; priv->uap_wep_key[key_index].key_index = key_index; priv->uap_wep_key[key_index].is_default = MFALSE; @@ -460,8 +435,8 @@ moal_memcpy_ext(priv->phandle, sec->param.encrypt_key.mac_addr, addr, ETH_ALEN, MLAN_MAC_ADDR_LENGTH); - if (memcmp(sec->param.encrypt_key.mac_addr, - bcast_addr, ETH_ALEN) == 0) + if (memcmp(sec->param.encrypt_key.mac_addr, bcast_addr, + ETH_ALEN) == 0) sec->param.encrypt_key.key_flags = KEY_FLAG_GROUP_KEY; else @@ -482,6 +457,7 @@ sec->param.encrypt_key.key_flags |= KEY_FLAG_RX_SEQ_VALID; } + #if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE if (cipher == WLAN_CIPHER_SUITE_GCMP) sec->param.encrypt_key.key_flags |= KEY_FLAG_GCMP; @@ -497,10 +473,10 @@ if (cipher == WLAN_CIPHER_SUITE_AES_CMAC #if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE - || cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 - || cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 + || cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || + cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 #endif - ) { + ) { sec->param.encrypt_key.key_flags |= KEY_FLAG_AES_MCAST_IGTK; @@ -548,9 +524,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key, - int key_len, t_u8 index, t_u8 wait_option) +mlan_status woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key, + int key_len, t_u8 index, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 cipher = 0; @@ -568,9 +544,11 @@ /* No key provided so it is enable key. We * want to just set the transmit key index */ - woal_cfg80211_set_key(priv, 1, cipher, key, key_len, NULL, 0, - index, NULL, 0, wait_option); + ret = woal_cfg80211_set_key(priv, 1, cipher, key, key_len, NULL, + 0, index, NULL, 0, wait_option); } + if (ret != MLAN_STATUS_SUCCESS) + PRINTM(MERROR, "woal_cfg80211_set_wep_keys Fail\n"); LEAVE(); return ret; @@ -583,24 +561,27 @@ * @param wait_option wait_option * @return N/A */ -void -woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option) +void woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option) { t_u16 mask = 0; /* clear BEACON WPS/P2P IE */ if (priv->beacon_wps_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) { PRINTM(MCMND, "Clear BEACON WPS ie\n"); - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, - NULL, 0, MGMT_MASK_BEACON_WPS_P2P, - wait_option); + if (woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P, wait_option)) + PRINTM(MERROR, "%s: clear beacon wps ie failed \n", + __func__); priv->beacon_wps_index = MLAN_CUSTOM_IE_AUTO_IDX_MASK; } if (priv->assocresp_qos_map_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) { PRINTM(MCMND, "Clear associate response QOS map ie\n"); - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, - NULL, 0, - MGMT_MASK_ASSOC_RESP_QOS_MAP, - wait_option); + if (woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_ASSOC_RESP_QOS_MAP, wait_option)) + PRINTM(MERROR, + "%s: Clear associate response QOS map ie failed \n", + __func__); priv->assocresp_qos_map_index = MLAN_CUSTOM_IE_AUTO_IDX_MASK; } /* clear mgmt frame ies */ @@ -621,8 +602,10 @@ priv->beacon_index, priv->probereq_index, priv->proberesp_index, priv->assocresp_index, priv->proberesp_p2p_index, priv->beacon_vendor_index); - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, - NULL, 0, mask, wait_option); + if (woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, + NULL, 0, mask, wait_option)) + PRINTM(MERROR, "%s: Clear ies failed, mask=0x%x\n", + __func__, mask); } priv->probereq_index = MLAN_CUSTOM_IE_AUTO_IDX_MASK; priv->beacon_index = MLAN_CUSTOM_IE_AUTO_IDX_MASK; @@ -642,8 +625,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_bss_role_cfg(moal_private *priv, t_u16 action, t_u8 *bss_role) +int woal_cfg80211_bss_role_cfg(moal_private *priv, t_u16 action, t_u8 *bss_role) { int ret = 0; @@ -651,18 +633,29 @@ if (action == MLAN_ACT_SET) { /* Reset interface */ - woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE); + if (MLAN_STATUS_SUCCESS != + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE)) { + PRINTM(MERROR, "woal_reset_intf fail\n"); + ret = -EFAULT; + goto done; + } } if (MLAN_STATUS_SUCCESS != woal_bss_role_cfg(priv, action, MOAL_IOCTL_WAIT, bss_role)) { + PRINTM(MERROR, "woal_bss_role_cfg fail\n"); ret = -EFAULT; goto done; } if (action == MLAN_ACT_SET) { /* set back the mac address */ - woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != + woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, "woal_request_set_mac_address fail\n"); + ret = -EFAULT; + goto done; + } /* clear the mgmt ies */ woal_clear_all_mgmt_ies(priv, MOAL_IOCTL_WAIT); /* Initialize private structures */ @@ -691,12 +684,11 @@ * * @return N/A */ -void -woal_cfg80211_display_p2p_actframe(const t_u8 *buf, int len, - struct ieee80211_channel *chan, - const t_u8 flag) +void woal_cfg80211_display_p2p_actframe(const t_u8 *buf, int len, + struct ieee80211_channel *chan, + const t_u8 flag) { - const t_u8 p2p_oui[] = { 0x50, 0x6f, 0x9a, 0x09 }; + const t_u8 p2p_oui[] = {0x50, 0x6f, 0x9a, 0x09}; t_u8 subtype; ENTER(); @@ -707,7 +699,7 @@ } if (((struct ieee80211_mgmt *)buf)->u.action.category == - P2P_ACT_FRAME_CATEGORY && + P2P_ACT_FRAME_CATEGORY && !memcmp(buf + P2P_ACT_FRAME_OUI_OFFSET, p2p_oui, sizeof(p2p_oui))) { subtype = *(buf + P2P_ACT_FRAME_OUI_SUBTYPE_OFFSET); switch (subtype) { @@ -784,8 +776,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_init_p2p_client(moal_private *priv) +int woal_cfg80211_init_p2p_client(moal_private *priv) { int ret = MLAN_STATUS_SUCCESS; t_u16 wifi_direct_mode = WIFI_DIRECT_MODE_DISABLE; @@ -850,8 +841,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_init_p2p_go(moal_private *priv) +int woal_cfg80211_init_p2p_go(moal_private *priv) { int ret = MLAN_STATUS_SUCCESS; t_u16 wifi_direct_mode; @@ -916,11 +906,22 @@ p2p_config.noa_duration = priv->phandle->noa_duration; p2p_config.noa_interval = priv->phandle->noa_interval; p2p_config.flags = WIFI_DIRECT_NOA; - woal_p2p_config(priv, MLAN_ACT_SET, &p2p_config); + if (MLAN_STATUS_SUCCESS != + woal_p2p_config(priv, MLAN_ACT_SET, &p2p_config)) { + PRINTM(MERROR, "woal_p2p_config fail\n"); + ret = -EFAULT; + goto done; + } + memset(&ps_mgmt, 0, sizeof(ps_mgmt)); ps_mgmt.flags = PS_FLAG_PS_MODE; ps_mgmt.ps_mode = PS_MODE_INACTIVITY; - woal_set_get_uap_power_mode(priv, MLAN_ACT_SET, &ps_mgmt); + if (MLAN_STATUS_SUCCESS != + woal_set_get_uap_power_mode(priv, MLAN_ACT_SET, &ps_mgmt)) { + PRINTM(MERROR, "woal_set_get_uap_power_mode fail\n"); + ret = -EFAULT; + goto done; + } PRINTM(MMSG, "Enable NOA: duration=%d, interval=%d\n", priv->phandle->noa_duration, priv->phandle->noa_interval); @@ -937,8 +938,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_deinit_p2p(moal_private *priv) +int woal_cfg80211_deinit_p2p(moal_private *priv) { int ret = MLAN_STATUS_SUCCESS; t_u16 wifi_direct_mode; @@ -979,9 +979,9 @@ ret = -EFAULT; goto done; } - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, &channel_status, NULL, - 0, 0)) { + if (woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) { PRINTM(MERROR, "deinit_p2p: Fail to cancel remain on channel\n"); ret = -EFAULT; @@ -990,23 +990,15 @@ if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle->chan, + priv->phandle->cookie, &priv->phandle->chan, #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -1024,7 +1016,12 @@ memset(&ps_mgmt, 0, sizeof(ps_mgmt)); ps_mgmt.flags = PS_FLAG_PS_MODE; ps_mgmt.ps_mode = PS_MODE_DISABLE; - woal_set_get_uap_power_mode(priv, MLAN_ACT_SET, &ps_mgmt); + if (MLAN_STATUS_SUCCESS != + woal_set_get_uap_power_mode(priv, MLAN_ACT_SET, &ps_mgmt)) { + PRINTM(MERROR, "woal_set_get_uap_power_mode fail\n"); + ret = -EFAULT; + goto done; + } bss_role = MLAN_BSS_ROLE_STA; if (MLAN_STATUS_SUCCESS != woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_SET, &bss_role)) { @@ -1046,6 +1043,44 @@ #endif /* KERNEL_VERSION */ #endif /* WIFI_DIRECT_SUPPORT */ +#ifdef UAP_SUPPORT +/** + * @brief Request to cancel CAC + * + * @param priv A pointer to moal_private structure + * + * @return N/A */ +void woal_cancel_cac(moal_private *priv) +{ +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + if (priv->phandle->is_cac_timer_set && + priv->bss_index == priv->phandle->cac_bss_index) { + woal_cancel_timer(&priv->phandle->cac_timer); + priv->phandle->is_cac_timer_set = MFALSE; + /* Make sure Chan Report is cancelled */ + if (woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, "%s: cancel chan report failed \n", + __func__); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel, + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); +#else + cfg80211_cac_event(priv->netdev, NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL); +#endif + memset(&priv->phandle->dfs_channel, 0, + sizeof(struct cfg80211_chan_def)); + priv->phandle->cac_bss_index = 0xff; + } +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) + woal_cancel_cac_block(priv); +#endif + return; +} +#endif + /** * @brief Request the driver to change the interface type * @@ -1057,14 +1092,13 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, +int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, + struct net_device *dev, + enum nl80211_iftype type, #if KERNEL_VERSION(4, 12, 0) > CFG80211_VERSION_CODE - u32 *flags, + u32 *flags, #endif - struct vif_params *params) + struct vif_params *params) { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -1077,15 +1111,56 @@ ENTER(); + if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_MONITOR) { + ret = -EFAULT; + goto done; + } + if (priv->wdev->iftype == type) { PRINTM(MINFO, "Already set to required type\n"); goto done; } #ifdef UAP_SUPPORT + /* when AP mode switch to station mode, we use it to cancel pending CAC + */ + if (priv->wdev->iftype == NL80211_IFTYPE_AP && + type == NL80211_IFTYPE_STATION) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + if (priv->phandle->is_cac_timer_set && + priv->bss_index == priv->phandle->cac_bss_index) { + woal_cancel_timer(&priv->phandle->cac_timer); + priv->phandle->is_cac_timer_set = MFALSE; + /* Make sure Chan Report is cancelled */ + if (woal_11h_cancel_chan_report_ioctl(priv, + MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: cancel chan report failed \n", + __func__); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + cfg80211_cac_event(priv->netdev, + &priv->phandle->dfs_channel, + NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL); +#else + cfg80211_cac_event(priv->netdev, + NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL); +#endif + memset(&priv->phandle->dfs_channel, 0, + sizeof(struct cfg80211_chan_def)); + priv->phandle->cac_bss_index = 0xff; + } +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) + woal_cancel_cac_block(priv); +#endif + } if ((priv->bss_type == MLAN_BSS_TYPE_UAP) && (priv->bss_index > 0)) { + PRINTM(MMSG, + "%s: Skip change virtual intf type on uap: from %d to %d\n", + dev->name, priv->wdev->iftype, type); priv->wdev->iftype = type; - PRINTM(MMSG, "%s: Skip change virtual intf on uap: type=%d\n", - dev->name, type); goto done; } #endif @@ -1107,9 +1182,9 @@ ret = -EFAULT; goto done; } - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, &channel_status, NULL, - 0, 0)) { + if (woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) { PRINTM(MERROR, "change_virtual_intf: Fail to cancel remain on channel\n"); ret = -EFAULT; @@ -1118,23 +1193,15 @@ if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle->chan, + priv->phandle->cookie, &priv->phandle->chan, #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -1183,7 +1250,11 @@ #endif /* WIFI_DIRECT_SUPPORT */ #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) if (priv->bss_type == MLAN_BSS_TYPE_UAP) { +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + woal_cfg80211_del_beacon(wiphy, dev, 0); +#else woal_cfg80211_del_beacon(wiphy, dev); +#endif bss_role = MLAN_BSS_ROLE_STA; woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_SET, &bss_role); @@ -1202,7 +1273,8 @@ priv->phandle->is_go_timer_set = MFALSE; } - if (MLAN_STATUS_SUCCESS != woal_cfg80211_init_p2p_client(priv)) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_init_p2p_client(priv)) { ret = -EFAULT; goto done; } @@ -1217,7 +1289,7 @@ case NL80211_IFTYPE_AP: #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - /* Fall Through */ + /* Fall Through */ case NL80211_IFTYPE_P2P_GO: if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { if (MLAN_STATUS_SUCCESS != @@ -1241,10 +1313,13 @@ #endif if (priv->probereq_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_PROBE_REQ, - MOAL_IOCTL_WAIT); + if (woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, + NULL, 0, MGMT_MASK_PROBE_REQ, + MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: Clear probe req ie failed\n", + __func__); bss_role = MLAN_BSS_ROLE_UAP; woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_SET, &bss_role); @@ -1294,8 +1369,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +int woal_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) { moal_private *priv = NULL; moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); @@ -1409,13 +1483,15 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, - t_u8 key_index, -#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE - bool pairwise, +int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, #endif - const t_u8 *mac_addr, struct key_params *params) + t_u8 key_index, +#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE + bool pairwise, +#endif + const t_u8 *mac_addr, struct key_params *params) { moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev); @@ -1466,13 +1542,15 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, - t_u8 key_index, -#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE - bool pairwise, +int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, #endif - const t_u8 *mac_addr) + t_u8 key_index, +#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE + bool pairwise, +#endif + const t_u8 *mac_addr) { moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev); @@ -1522,13 +1600,17 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_set_default_key(struct wiphy *wiphy, - struct net_device *netdev, t_u8 key_index -#if KERNEL_VERSION(2, 6, 37) < CFG80211_VERSION_CODE - , bool ucast, bool mcast +int woal_cfg80211_set_default_key(struct wiphy *wiphy, + struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, #endif - ) + t_u8 key_index +#if KERNEL_VERSION(2, 6, 37) < CFG80211_VERSION_CODE + , + bool ucast, bool mcast +#endif +) { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev); @@ -1553,9 +1635,12 @@ } #if KERNEL_VERSION(2, 6, 30) <= CFG80211_VERSION_CODE -int -woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, - struct net_device *netdev, t_u8 key_index) +int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, + struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif + t_u8 key_index) { PRINTM(MINFO, "set default mgmt key, key index=%d\n", key_index); @@ -1564,9 +1649,12 @@ #endif #if KERNEL_VERSION(5, 10, 0) <= CFG80211_VERSION_CODE -int -woal_cfg80211_set_default_beacon_key(struct wiphy *wiphy, - struct net_device *netdev, t_u8 key_index) +int woal_cfg80211_set_default_beacon_key(struct wiphy *wiphy, + struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif + t_u8 key_index) { PRINTM(MINFO, "set default beacon key, key index=%d\n", key_index); @@ -1584,14 +1672,12 @@ * * @return 0 --success, otherwise fail */ -mlan_status -woal_set_rekey_data(moal_private *priv, - mlan_ds_misc_gtk_rekey_data * gtk_rekey, - t_u8 action, t_u8 wait_option) +mlan_status woal_set_rekey_data(moal_private *priv, + mlan_ds_misc_gtk_rekey_data *gtk_rekey, + t_u8 action, t_u8 wait_option) { mlan_ioctl_req *req; mlan_ds_misc_cfg *misc_cfg; - int ret = 0; mlan_status status; ENTER(); @@ -1599,7 +1685,8 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { - ret = -ENOMEM; + LEAVE(); + return MLAN_STATUS_FAILURE; } else { misc_cfg = (mlan_ds_misc_cfg *)req->pbuf; misc_cfg->sub_command = MLAN_OID_MISC_GTK_REKEY_OFFLOAD; @@ -1613,14 +1700,12 @@ sizeof(mlan_ds_misc_gtk_rekey_data)); status = woal_request_ioctl(priv, req, wait_option); - if (status != MLAN_STATUS_SUCCESS) - ret = -EFAULT; if (status != MLAN_STATUS_PENDING) kfree(req); } LEAVE(); - return ret; + return status; } /** @@ -1632,9 +1717,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_gtk_rekey_data *data) +int woal_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_gtk_rekey_data *data) { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -1645,8 +1729,8 @@ if (priv->phandle->params.gtk_rekey_offload == GTK_REKEY_OFFLOAD_DISABLE) { - PRINTM(MMSG, - "%s return: gtk_rekey_offload is DISABLE\n", __func__); + PRINTM(MMSG, "%s return: gtk_rekey_offload is DISABLE\n", + __func__); LEAVE(); return ret; } @@ -1693,8 +1777,7 @@ * @param bssid A pointer to bssid * @return pointer to target entry or NULL */ -struct pmksa_entry * -woal_get_pmksa_entry(moal_private *priv, const u8 *bssid) +struct pmksa_entry *woal_get_pmksa_entry(moal_private *priv, const u8 *bssid) { struct pmksa_entry *entry = NULL; unsigned long flags; @@ -1705,7 +1788,7 @@ } spin_lock_irqsave(&priv->pmksa_list_lock, flags); - list_for_each_entry(entry, &priv->pmksa_cache_list, link) { + list_for_each_entry (entry, &priv->pmksa_cache_list, link) { if (!memcmp(entry->bssid, bssid, ETH_ALEN)) { spin_unlock_irqrestore(&priv->pmksa_list_lock, flags); return entry; @@ -1721,19 +1804,18 @@ * @param priv A pointer to moal_private structure * @return success of failure */ -int -woal_flush_pmksa_list(moal_private *priv) +int woal_flush_pmksa_list(moal_private *priv) { struct pmksa_entry *entry, *tmp; unsigned long flags; if (!priv || priv->bss_type != MLAN_BSS_TYPE_STA) { PRINTM(MERROR, "Invalid interface structure\n"); - return -1; + return -EFAULT; } spin_lock_irqsave(&priv->pmksa_list_lock, flags); - list_for_each_entry_safe(entry, tmp, &priv->pmksa_cache_list, link) { + list_for_each_entry_safe (entry, tmp, &priv->pmksa_cache_list, link) { list_del(&entry->link); kfree(entry); } @@ -1750,9 +1832,8 @@ * @param pmksa A pointer to cfg80211_pmksa structure * @return success of failure */ -int -woal_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) +int woal_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_pmksa *pmksa) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); struct pmksa_entry *entry = NULL; @@ -1817,9 +1898,8 @@ * @param pmksa A pointer to cfg80211_pmksa structure * @return success of failure */ -int -woal_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) +int woal_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_pmksa *pmksa) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); struct pmksa_entry *entry, *tmp; @@ -1836,7 +1916,7 @@ PRINTM(MIOCTL, "Delete pmksa: bssid=" MACSTR "\n", MAC2STR(pmksa->bssid)); spin_lock_irqsave(&priv->pmksa_list_lock, flags); - list_for_each_entry_safe(entry, tmp, &priv->pmksa_cache_list, link) { + list_for_each_entry_safe (entry, tmp, &priv->pmksa_cache_list, link) { if (!memcmp(entry->bssid, pmksa->bssid, ETH_ALEN)) { list_del(&entry->link); kfree(entry); @@ -1854,8 +1934,7 @@ * @param dev A pointer to net_device structure * @return success of failure */ -int -woal_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) +int woal_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -1890,13 +1969,12 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_set_channel(struct wiphy *wiphy, +int woal_cfg80211_set_channel(struct wiphy *wiphy, #if KERNEL_VERSION(2, 6, 34) < CFG80211_VERSION_CODE - struct net_device *dev, + struct net_device *dev, #endif - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) + struct ieee80211_channel *chan, + enum nl80211_channel_type channel_type) { int ret = 0; moal_private *priv = NULL; @@ -1941,9 +2019,8 @@ #endif #if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE -static bool -woal_is_pattern_supported(struct cfg80211_pkt_pattern *pat, - t_u8 *byte_seq, t_u8 max_byte_seq) +static bool woal_is_pattern_supported(struct cfg80211_pkt_pattern *pat, + t_u8 *byte_seq, t_u8 max_byte_seq) { int j, k, valid_byte_cnt = 0; bool dont_care_byte = false; @@ -1954,7 +2031,7 @@ moal_memcpy_ext(NULL, byte_seq + valid_byte_cnt, &pat->pattern[j * 8 + k], 1, (t_u32)max_byte_seq - - (t_u32)valid_byte_cnt); + (t_u32)valid_byte_cnt); valid_byte_cnt++; if (dont_care_byte) return false; @@ -1973,12 +2050,11 @@ return true; } -static int -woal_get_coalesce_pkt_type(t_u8 *byte_seq) +static int woal_get_coalesce_pkt_type(t_u8 *byte_seq) { - const t_u8 ipv4_mc_mac[] = { 0x33, 0x33 }; - const t_u8 ipv6_mc_mac[] = { 0x01, 0x00, 0x5e }; - const t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff }; + const t_u8 ipv4_mc_mac[] = {0x33, 0x33}; + const t_u8 ipv6_mc_mac[] = {0x01, 0x00, 0x5e}; + const t_u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff}; if ((byte_seq[0] & 0x01) && (byte_seq[COALESCE_MAX_BYTESEQ] == 1)) return PACKET_TYPE_UNICAST; @@ -1993,9 +2069,8 @@ return 0; } -static int -woal_fill_coalesce_rule_info(struct cfg80211_coalesce_rules *crule, - struct coalesce_rule *mrule) +static int woal_fill_coalesce_rule_info(struct cfg80211_coalesce_rules *crule, + struct coalesce_rule *mrule) { t_u8 byte_seq[COALESCE_MAX_BYTESEQ + 1]; struct filt_field_param *param; @@ -2058,9 +2133,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_set_coalesce(moal_private *priv, t_u16 action, - mlan_ds_coalesce_cfg * coalesce_cfg) +static mlan_status woal_set_coalesce(moal_private *priv, t_u16 action, + mlan_ds_coalesce_cfg *coalesce_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc_cfg = NULL; @@ -2102,9 +2176,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_coalesce(struct wiphy *wiphy, - struct cfg80211_coalesce *coalesce) +int woal_cfg80211_set_coalesce(struct wiphy *wiphy, + struct cfg80211_coalesce *coalesce) { int ret = 0; int i; @@ -2131,9 +2204,8 @@ } else { coalesce_cfg.num_of_rules = coalesce->n_rules; for (i = 0; i < coalesce->n_rules; i++) { - ret = woal_fill_coalesce_rule_info(&coalesce->rules[i], - &coalesce_cfg. - rule[i]); + ret = woal_fill_coalesce_rule_info( + &coalesce->rules[i], &coalesce_cfg.rule[i]); if (ret) { PRINTM(MERROR, "Recheck the patterns provided for rule %d\n", @@ -2165,10 +2237,12 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const u8 *peer, - const struct cfg80211_bitrate_mask *mask) +int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + unsigned int link_id, +#endif + const u8 *peer, + const struct cfg80211_bitrate_mask *mask) { int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -2216,7 +2290,7 @@ rate_cfg->bitmap_rates[1] = mask->control[band].legacy; #if KERNEL_VERSION(3, 4, 0) <= CFG80211_VERSION_CODE - /* Fill MCS rates */ + /* Fill MCS rates */ #if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE rate_cfg->bitmap_rates[2] = mask->control[band].ht_mcs[0]; #else @@ -2252,8 +2326,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) +int woal_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); moal_private *priv = NULL; @@ -2319,8 +2392,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) +int woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); moal_private *priv = NULL; @@ -2383,8 +2455,7 @@ * * @return 0 -- success, otherwise fail */ -void -woal_mgmt_frame_register(moal_private *priv, u16 frame_type, bool reg) +void woal_mgmt_frame_register(moal_private *priv, u16 frame_type, bool reg) { t_u32 mgmt_subtype_mask = 0x0; t_u32 last_mgmt_subtype_mask = priv->mgmt_subtype_mask; @@ -2417,14 +2488,13 @@ * Note that this callback may not sleep, and cannot run * concurrently with itself. */ - woal_reg_rx_mgmt_ind(priv, MLAN_ACT_SET, - &mgmt_subtype_mask, MOAL_NO_WAIT); + woal_reg_rx_mgmt_ind(priv, MLAN_ACT_SET, &mgmt_subtype_mask, + MOAL_NO_WAIT); priv->mgmt_subtype_mask = last_mgmt_subtype_mask; } LEAVE(); } - #if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE /** * @brief register/unregister mgmt frame forwarding @@ -2436,16 +2506,14 @@ * * @return 0 -- success, otherwise fail */ -void -woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, - struct net_device *dev, u16 frame_type, - bool reg) +void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, + struct net_device *dev, u16 frame_type, + bool reg) #else #if KERNEL_VERSION(5, 8, 0) <= CFG80211_VERSION_CODE -void -woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - struct mgmt_frame_regs *upd) +void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, + struct wireless_dev *wdev, + struct mgmt_frame_regs *upd) #else /** * @brief register/unregister mgmt frame forwarding @@ -2457,10 +2525,9 @@ * * @return 0 -- success, otherwise fail */ -void -woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - u16 frame_type, bool reg) +void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, + struct wireless_dev *wdev, + u16 frame_type, bool reg) #endif #endif { @@ -2473,17 +2540,16 @@ #if KERNEL_VERSION(5, 8, 0) <= CFG80211_VERSION_CODE if ((upd->interface_stypes & BIT(IEEE80211_STYPE_AUTH >> 4)) - /** Supplicant 2.8 always register auth, FW will handle auth when - * host_mlme=0 - */ - && !moal_extflg_isset(priv->phandle, EXT_HOST_MLME) - ) + /** Supplicant 2.8 always register auth, FW will handle auth when + * host_mlme=0 + */ + && !moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) upd->interface_stypes &= ~BIT(IEEE80211_STYPE_AUTH >> 4); if (priv->mgmt_subtype_mask != upd->interface_stypes) { priv->mgmt_subtype_mask = upd->interface_stypes; - woal_reg_rx_mgmt_ind(priv, MLAN_ACT_SET, - &upd->interface_stypes, MOAL_NO_WAIT); + woal_reg_rx_mgmt_ind(priv, MLAN_ACT_SET, &upd->interface_stypes, + MOAL_NO_WAIT); } #else if (frame_type == IEEE80211_STYPE_AUTH @@ -2493,7 +2559,7 @@ */ && !moal_extflg_isset(priv->phandle, EXT_HOST_MLME) #endif - ) { + ) { LEAVE(); return; } @@ -2502,6 +2568,8 @@ LEAVE(); } +#ifdef UAP_CFG80211 +#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE /* * @brief prepare and send WOAL_EVENT_CANCEL_CHANRPT * @@ -2509,8 +2577,7 @@ * * @return N/A */ -static void -woal_cancel_chanrpt_event(moal_private *priv) +void woal_cancel_chanrpt_event(moal_private *priv) { struct woal_event *evt; unsigned long flags; @@ -2530,6 +2597,8 @@ spin_unlock_irqrestore(&handle->evt_lock, flags); queue_work(handle->evt_workqueue, &handle->evt_work); } +#endif +#endif #if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE #if KERNEL_VERSION(3, 3, 0) <= CFG80211_VERSION_CODE @@ -2641,30 +2710,29 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_mgmt_tx(struct wiphy *wiphy, +int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, #if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE - struct net_device *dev, + struct net_device *dev, #else - struct wireless_dev *wdev, + struct wireless_dev *wdev, #endif #if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE - struct cfg80211_mgmt_tx_params *params, + struct cfg80211_mgmt_tx_params *params, #else - struct ieee80211_channel *chan, bool offchan, + struct ieee80211_channel *chan, bool offchan, #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE - enum nl80211_channel_type channel_type, - bool channel_type_valid, + enum nl80211_channel_type channel_type, + bool channel_type_valid, #endif - unsigned int wait, const u8 *buf, size_t len, + unsigned int wait, const u8 *buf, size_t len, #if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE - bool no_cck, + bool no_cck, #endif #if KERNEL_VERSION(3, 3, 0) <= CFG80211_VERSION_CODE - bool dont_wait_for_ack, + bool dont_wait_for_ack, #endif #endif - u64 * cookie) + u64 *cookie) { #if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE struct net_device *dev = wdev->netdev; @@ -2680,7 +2748,7 @@ pmlan_buffer pmbuf = NULL; mlan_status status = MLAN_STATUS_SUCCESS; t_u16 packet_len = 0; - t_u8 addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; t_u32 pkt_type; t_u32 tx_control; #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE @@ -2711,8 +2779,8 @@ * device */ if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { - if (ieee80211_is_probe_resp(((struct ieee80211_mgmt *)buf)-> - frame_control)) { + if (ieee80211_is_probe_resp( + ((struct ieee80211_mgmt *)buf)->frame_control)) { PRINTM(MIOCTL, "Skip send probe_resp in GO/UAP mode\n"); goto done; } @@ -2727,11 +2795,17 @@ break; case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_DISASSOC: +#ifdef UAP_SUPPORT + if (!priv->bss_started) { + PRINTM(MCMND, + "Drop deauth packet before AP started\n"); + woal_cancel_cac(priv); + goto done; + } +#endif PRINTM(MMSG, "wlan: HostMlme %s send deauth/disassoc\n", priv->netdev->name); - if (priv->phandle->is_cac_timer_set) - woal_cancel_chanrpt_event(priv); break; case IEEE80211_STYPE_ASSOC_RESP: @@ -2745,12 +2819,13 @@ } } } + #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE if ((ieee80211_is_action(((struct ieee80211_mgmt *)buf)->frame_control)) #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) #endif - ) { + ) { #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) woal_cfg80211_display_p2p_actframe(buf, len, chan, @@ -2770,36 +2845,28 @@ #define MGMT_TX_DEFAULT_WAIT_TIME 1500 if (priv->phandle->remain_on_channel) remain_priv = - priv->phandle->priv[priv->phandle-> - remain_bss_index]; + priv->phandle + ->priv[priv->phandle->remain_bss_index]; /** cancel previous remain on channel */ if (priv->phandle->remain_on_channel && remain_priv) { - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, - &channel_status, NULL, 0, 0)) + if (woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) PRINTM(MERROR, "mgmt_tx:Fail to cancel remain on channel\n"); if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle-> - chan, + priv->phandle->cookie, + &priv->phandle->chan, #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -2809,37 +2876,37 @@ woal_cancel_scan(priv, MOAL_IOCTL_WAIT); #endif - if (chan) { + if (chan && priv->bss_type != MLAN_BSS_ROLE_UAP) { duration = (wait > MGMT_TX_DEFAULT_WAIT_TIME) ? - wait : MGMT_TX_DEFAULT_WAIT_TIME; + wait : + MGMT_TX_DEFAULT_WAIT_TIME; #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE if (channel_type_valid) - ret = woal_cfg80211_remain_on_channel_cfg(priv, - MOAL_IOCTL_WAIT, - MFALSE, - &channel_status, - chan, - channel_type, - duration); + ret = woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, + &channel_status, chan, channel_type, + duration); else #endif - ret = woal_cfg80211_remain_on_channel_cfg(priv, - MOAL_IOCTL_WAIT, - MFALSE, - &channel_status, - chan, - 0, - duration); + ret = woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, + &channel_status, chan, 0, duration); if (ret) { /* Return fail will cause p2p connection fail */ woal_sched_timeout(2); #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE if (channel_type_valid) - ret = woal_cfg80211_remain_on_channel_cfg(priv, MOAL_IOCTL_WAIT, MFALSE, &channel_status, chan, channel_type, duration); + ret = woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, + &channel_status, chan, + channel_type, duration); else #endif - ret = woal_cfg80211_remain_on_channel_cfg(priv, MOAL_IOCTL_WAIT, MFALSE, &channel_status, chan, 0, duration); + ret = woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, + &channel_status, chan, 0, + duration); PRINTM(MERROR, "Try configure remain on channel again, ret=%d\n", ret); @@ -2851,17 +2918,15 @@ #if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE priv->phandle->channel_type = channel_type; #endif - moal_memcpy_ext(priv->phandle, - &priv->phandle->chan, chan, - sizeof(struct - ieee80211_channel), - sizeof(struct - ieee80211_channel)); + moal_memcpy_ext( + priv->phandle, &priv->phandle->chan, + chan, sizeof(struct ieee80211_channel), + sizeof(struct ieee80211_channel)); PRINTM(MIOCTL, "%s: Mgmt Tx: Set remain channel=%d duration=%d\n", dev->name, - ieee80211_frequency_to_channel(chan-> - center_freq), + ieee80211_frequency_to_channel( + chan->center_freq), duration); } } @@ -2873,7 +2938,7 @@ packet_len = (t_u16)len + MLAN_MAC_ADDR_LENGTH; pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); + packet_len + sizeof(packet_len)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); ret = -ENOMEM; @@ -2882,7 +2947,11 @@ #if KERNEL_VERSION(3, 8, 0) > LINUX_VERSION_CODE *cookie = random32() | 1; #else +#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE *cookie = prandom_u32() | 1; +#else + *cookie = get_random_u32() | 1; +#endif #endif pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; @@ -2904,17 +2973,18 @@ remain_len -= sizeof(packet_len); moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len), buf, PACKET_ADDR4_POS, remain_len); + sizeof(packet_len), + buf, PACKET_ADDR4_POS, remain_len); remain_len -= PACKET_ADDR4_POS; moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len) + PACKET_ADDR4_POS, + sizeof(packet_len) + PACKET_ADDR4_POS, addr, MLAN_MAC_ADDR_LENGTH, remain_len); remain_len -= MLAN_MAC_ADDR_LENGTH; moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len) + PACKET_ADDR4_POS + - MLAN_MAC_ADDR_LENGTH, + sizeof(packet_len) + PACKET_ADDR4_POS + + MLAN_MAC_ADDR_LENGTH, buf + PACKET_ADDR4_POS, len - PACKET_ADDR4_POS, remain_len); @@ -2925,7 +2995,7 @@ #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) #endif - ) { + ) { pmbuf->flags = MLAN_BUF_FLAG_TX_STATUS; if (!priv->tx_seq_num) priv->tx_seq_num++; @@ -2970,12 +3040,12 @@ * which may affect the mgmt frame tx. Meanwhile it is only * necessary for P2P action handshake to wait 30ms. */ - if ((ieee80211_is_action(((struct ieee80211_mgmt *)buf)-> - frame_control)) + if ((ieee80211_is_action( + ((struct ieee80211_mgmt *)buf)->frame_control)) #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) #endif - ) { + ) { if (tx_info) break; else @@ -3059,7 +3129,7 @@ remain_len = sizeof(pcustom_ie->ie_data_list); if (beacon_ies_data) { len = sizeof(*beacon_ies_data) - MAX_IE_SIZE + - beacon_ies_data->ie_length; + beacon_ies_data->ie_length; moal_memcpy_ext(priv->phandle, pos, beacon_ies_data, len, remain_len); pos += len; @@ -3069,7 +3139,7 @@ if (proberesp_ies_data) { len = sizeof(*proberesp_ies_data) - MAX_IE_SIZE + - proberesp_ies_data->ie_length; + proberesp_ies_data->ie_length; moal_memcpy_ext(priv->phandle, pos, proberesp_ies_data, len, remain_len); pos += len; @@ -3079,7 +3149,7 @@ if (assocresp_ies_data) { len = sizeof(*assocresp_ies_data) - MAX_IE_SIZE + - assocresp_ies_data->ie_length; + assocresp_ies_data->ie_length; moal_memcpy_ext(priv->phandle, pos, assocresp_ies_data, len, remain_len); pos += len; @@ -3089,7 +3159,7 @@ if (probereq_ies_data) { len = sizeof(*probereq_ies_data) - MAX_IE_SIZE + - probereq_ies_data->ie_length; + probereq_ies_data->ie_length; moal_memcpy_ext(priv->phandle, pos, probereq_ies_data, len, remain_len); pos += len; @@ -3123,7 +3193,7 @@ /* save beacon ie index after auto-indexing */ *beacon_index = misc->param.cust_ie.ie_data_list[0].ie_index; len = sizeof(*beacon_ies_data) - MAX_IE_SIZE + - beacon_ies_data->ie_length; + beacon_ies_data->ie_length; pos += len; } @@ -3132,7 +3202,7 @@ /* save probe resp ie index after auto-indexing */ *proberesp_index = *((t_u16 *)pos); len = sizeof(*proberesp_ies_data) - MAX_IE_SIZE + - proberesp_ies_data->ie_length; + proberesp_ies_data->ie_length; pos += len; } @@ -3141,7 +3211,7 @@ /* save assoc resp ie index after auto-indexing */ *assocresp_index = *((t_u16 *)pos); len = sizeof(*assocresp_ies_data) - MAX_IE_SIZE + - assocresp_ies_data->ie_length; + assocresp_ies_data->ie_length; pos += len; } if (probereq_ies_data && probereq_ies_data->ie_length && @@ -3149,7 +3219,7 @@ /* save probe resp ie index after auto-indexing */ *probereq_index = *((t_u16 *)pos); len = sizeof(*probereq_ies_data) - MAX_IE_SIZE + - probereq_ies_data->ie_length; + probereq_ies_data->ie_length; pos += len; } // TODO why we check status_code at end @@ -3175,9 +3245,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_qos_map(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_qos_map *qos_map) +int woal_cfg80211_set_qos_map(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_qos_map *qos_map) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int i, j, ret = 0; @@ -3265,9 +3334,8 @@ * * @return out IE length */ -static t_u16 -woal_get_specific_ie(const t_u8 *ie, int len, t_u8 *ie_out, - t_u32 ie_out_len, t_u16 mask) +static t_u16 woal_get_specific_ie(const t_u8 *ie, int len, t_u8 *ie_out, + t_u32 ie_out_len, t_u16 mask) { int left_len = len; const t_u8 *pos = ie; @@ -3275,10 +3343,10 @@ t_u8 id = 0; t_u16 out_len = 0; IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; - const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; - const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; - const u8 wfd_oui[4] = { 0x50, 0x6f, 0x9a, 0x0a }; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const u8 wps_oui[4] = {0x00, 0x50, 0xf2, 0x04}; + const u8 p2p_oui[4] = {0x50, 0x6f, 0x9a, 0x09}; + const u8 wfd_oui[4] = {0x50, 0x6f, 0x9a, 0x0a}; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; ENTER(); while (left_len >= 2) { @@ -3295,7 +3363,7 @@ } else if (!memcmp(pvendor_ie->vend_hdr.oui, p2p_oui, sizeof(pvendor_ie->vend_hdr.oui)) && pvendor_ie->vend_hdr.oui_type == - p2p_oui[3]) { + p2p_oui[3]) { if (mask & IE_MASK_P2P) { /** only get first p2p ie here */ moal_memcpy_ext(NULL, ie_out + out_len, @@ -3307,16 +3375,14 @@ } else if (!memcmp(pvendor_ie->vend_hdr.oui, wps_oui, sizeof(pvendor_ie->vend_hdr.oui)) && pvendor_ie->vend_hdr.oui_type == - wps_oui[3]) { + wps_oui[3]) { if (mask & IE_MASK_WPS) { if ((out_len + length + 2) < (int)ie_out_len) { - moal_memcpy_ext(NULL, - ie_out + - out_len, pos, - length + 2, - ie_out_len - - out_len); + moal_memcpy_ext( + NULL, ie_out + out_len, + pos, length + 2, + ie_out_len - out_len); out_len += length + 2; } else { PRINTM(MERROR, @@ -3327,16 +3393,14 @@ } else if (!memcmp(pvendor_ie->vend_hdr.oui, wfd_oui, sizeof(pvendor_ie->vend_hdr.oui)) && pvendor_ie->vend_hdr.oui_type == - wfd_oui[3]) { + wfd_oui[3]) { if (mask & IE_MASK_WFD) { if ((out_len + length + 2) < (int)ie_out_len) { - moal_memcpy_ext(NULL, - ie_out + - out_len, pos, - length + 2, - ie_out_len - - out_len); + moal_memcpy_ext( + NULL, ie_out + out_len, + pos, length + 2, + ie_out_len - out_len); out_len += length + 2; } else { PRINTM(MERROR, @@ -3374,8 +3438,8 @@ * * @return out IE length */ -static t_u8 -woal_find_ie(const t_u8 *ie, int len, const t_u8 *spec_ie, int spec_len) +static t_u8 woal_find_ie(const t_u8 *ie, int len, const t_u8 *spec_ie, + int spec_len) { int left_len = len; const t_u8 *pos = ie; @@ -3409,10 +3473,10 @@ * * @return out IE length */ -static t_u16 -woal_filter_beacon_ies(moal_private *priv, const t_u8 *ie, int len, - t_u8 *ie_out, t_u32 ie_out_len, - t_u16 wps_flag, const t_u8 *dup_ie, int dup_ie_len) +static t_u16 woal_filter_beacon_ies(moal_private *priv, const t_u8 *ie, int len, + t_u8 *ie_out, t_u32 ie_out_len, + t_u16 wps_flag, const t_u8 *dup_ie, + int dup_ie_len) { int left_len = len; const t_u8 *pos = ie; @@ -3420,10 +3484,10 @@ t_u8 id = 0; t_u16 out_len = 0; IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; - const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; - const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; - const u8 wfd_oui[4] = { 0x50, 0x6f, 0x9a, 0x0a }; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const u8 wps_oui[4] = {0x00, 0x50, 0xf2, 0x04}; + const u8 p2p_oui[4] = {0x50, 0x6f, 0x9a, 0x09}; + const u8 wfd_oui[4] = {0x50, 0x6f, 0x9a, 0x0a}; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; t_u8 find_p2p_ie = MFALSE; t_u8 enable_11d = MFALSE; t_u8 ext_id = 0; @@ -3461,6 +3525,7 @@ case HT_OPERATION: case VHT_CAPABILITY: case VHT_OPERATION: +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { if ((out_len + length + 2) < (int)ie_out_len) { moal_memcpy_ext(priv->phandle, @@ -3473,23 +3538,27 @@ "IE too big, fail copy COUNTRY INFO IE\n"); } } +#endif break; case EXTENDED_SUPPORTED_RATES: case WLAN_EID_ERP_INFO: - /* Fall Through */ + /* Fall Through */ case REGULATORY_CLASS: - /* Fall Through */ + /* Fall Through */ case OVERLAPBSSSCANPARAM: - /* Fall Through */ + /* Fall Through */ case WAPI_IE: break; case EXTENSION: ext_id = *(pos + 2); if ((ext_id == HE_CAPABILITY || ext_id == HE_OPERATION) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && !moal_extflg_isset(priv->phandle, EXT_HOST_MLME) - ) +#endif + ) break; else { +#ifdef UAP_SUPPORT #if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 20, 0) if (ext_id == HE_CAPABILITY) { mlan_ds_11ax_he_cfg he_cfg; @@ -3506,25 +3575,24 @@ if (0 == woal_11ax_cfg(priv, MLAN_ACT_GET, - &he_cfg)) { - hecap_ie = - (IEEEtypes_HECap_t *) & - he_cfg.he_cap.len; + &he_cfg, + MOAL_IOCTL_WAIT)) { + hecap_ie = (IEEEtypes_HECap_t + *)&he_cfg + .he_cap.len; hecap_ie->ieee_hdr.len = he_cfg.he_cap.len; hecap_ie->ieee_hdr.element_id = he_cfg.he_cap.id; - moal_memcpy_ext(priv->phandle, - ie_out + - out_len, - hecap_ie, - hecap_ie-> - ieee_hdr.len + + moal_memcpy_ext( + priv->phandle, + ie_out + out_len, + hecap_ie, + hecap_ie->ieee_hdr.len + 2, - ie_out_len - - out_len); + ie_out_len - out_len); out_len += hecap_ie->ieee_hdr.len + @@ -3535,15 +3603,15 @@ } } else #endif +#endif { if ((out_len + length + 2) < (int)ie_out_len) { - moal_memcpy_ext(priv->phandle, - ie_out + - out_len, pos, - length + 2, - ie_out_len - - out_len); + moal_memcpy_ext( + priv->phandle, + ie_out + out_len, pos, + length + 2, + ie_out_len - out_len); out_len += length + 2; } else { PRINTM(MERROR, @@ -3634,8 +3702,14 @@ left_len -= (length + 2); } - if (enable_11d) - woal_set_11d(priv, MOAL_IOCTL_WAIT, MTRUE); +#ifdef UAP_SUPPORT + if (enable_11d && !priv->bss_started) { + if (MLAN_STATUS_SUCCESS != + woal_set_11d(priv, MOAL_IOCTL_WAIT, MTRUE)) { + PRINTM(MERROR, "woal_set_11d fail\n"); + } + } +#endif return out_len; } @@ -3648,8 +3722,7 @@ * * @return MTRUE/MFALSE */ -static t_u8 -is_selected_registrar_on(const t_u8 *ie, int len) +static t_u8 is_selected_registrar_on(const t_u8 *ie, int len) { #define WPS_IE_FIX_LEN 6 #define TLV_ID_SELECTED_REGISTRAR 0x1041 @@ -3660,8 +3733,8 @@ u8 *pos = NULL; while (left_len > (int)sizeof(TLV_Generic_t)) { - tlv_type = ntohs((__force __be16) tlv->type); - tlv_len = ntohs((__force __be16) tlv->len); + tlv_type = ntohs((__force __be16)tlv->type); + tlv_len = ntohs((__force __be16)tlv->len); if (tlv_type == TLV_ID_SELECTED_REGISTRAR) { PRINTM(MIOCTL, "Selected Registrar found !"); pos = (u8 *)tlv + sizeof(TLV_Generic_t); @@ -3686,15 +3759,14 @@ * * @return MTRUE/MFALSE */ -static t_u16 -woal_is_selected_registrar_on(const t_u8 *ie, int len) +static t_u16 woal_is_selected_registrar_on(const t_u8 *ie, int len) { int left_len = len; const t_u8 *pos = ie; int length; t_u8 id = 0; IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; - const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; + const u8 wps_oui[4] = {0x00, 0x50, 0xf2, 0x04}; while (left_len >= 2) { length = *(pos + 1); @@ -3739,13 +3811,12 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_mgmt_frame_ie(moal_private *priv, const t_u8 *beacon_ies, - size_t beacon_ies_len, const t_u8 *proberesp_ies, - size_t proberesp_ies_len, const t_u8 *assocresp_ies, - size_t assocresp_ies_len, const t_u8 *probereq_ies, - size_t probereq_ies_len, t_u16 mask, - t_u8 wait_option) +int woal_cfg80211_mgmt_frame_ie( + moal_private *priv, const t_u8 *beacon_ies, size_t beacon_ies_len, + const t_u8 *proberesp_ies, size_t proberesp_ies_len, + const t_u8 *assocresp_ies, size_t assocresp_ies_len, + const t_u8 *probereq_ies, size_t probereq_ies_len, t_u16 mask, + t_u8 wait_option) { int ret = 0; t_u8 *pos = NULL; @@ -3788,12 +3859,10 @@ #endif beacon_ies_data->ie_index = beacon_wps_index; beacon_ies_data->mgmt_subtype_mask = MGMT_MASK_BEACON; - beacon_ies_data->ie_length = - woal_filter_beacon_ies(priv, beacon_ies, - beacon_ies_len, - beacon_ies_data-> - ie_buffer, MAX_IE_SIZE, - IE_MASK_VENDOR, NULL, 0); + beacon_ies_data->ie_length = woal_filter_beacon_ies( + priv, beacon_ies, beacon_ies_len, + beacon_ies_data->ie_buffer, MAX_IE_SIZE, + IE_MASK_VENDOR, NULL, 0); DBG_HEXDUMP(MCMD_D, "beacon extra ie", beacon_ies_data->ie_buffer, beacon_ies_data->ie_length); @@ -3802,6 +3871,7 @@ if (beacon_wps_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid beacon wps index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -3816,15 +3886,12 @@ (beacon_ies_data->mgmt_subtype_mask == MLAN_CUSTOM_IE_DELETE_MASK)) { if (MLAN_STATUS_FAILURE == - woal_cfg80211_custom_ie(priv, beacon_ies_data, - &beacon_wps_index, - proberesp_ies_data, - &proberesp_index, - assocresp_ies_data, - &assocresp_index, - probereq_ies_data, - &probereq_index, - wait_option)) { + woal_cfg80211_custom_ie( + priv, beacon_ies_data, &beacon_wps_index, + proberesp_ies_data, &proberesp_index, + assocresp_ies_data, &assocresp_index, + probereq_ies_data, &probereq_index, + wait_option)) { PRINTM(MERROR, "Fail to set beacon wps IE\n"); ret = -EFAULT; } @@ -3833,8 +3900,8 @@ beacon_wps_index, beacon_ies_data->ie_length); goto done; } - kfree(beacon_ies_data); // Further allocation of beacon_ies_data - // is happening, so need to free here. + kfree(beacon_ies_data); // Further allocation of beacon_ies_data + // is happening, so need to free here. beacon_ies_data = NULL; } @@ -3857,6 +3924,7 @@ PRINTM(MERROR, "IE too big: assocresp_ies_len=%d\n", (int)assocresp_ies_len); + ret = -EFAULT; goto done; } assocresp_ies_data->ie_length = assocresp_ies_len; @@ -3871,6 +3939,7 @@ if (assocrep_qos_map_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid Qos map index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -3956,13 +4025,13 @@ beacon_ies_data->ie_buffer, beacon_ies_data->ie_length); } - if (beacon_vendor_index != - MLAN_CUSTOM_IE_AUTO_IDX_MASK && + if (beacon_vendor_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK && !beacon_ies_data->ie_length) { /* clear the beacon vendor ies */ if (beacon_vendor_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid beacon_vendor_index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } beacon_ies_data->ie_index = beacon_vendor_index; @@ -3974,14 +4043,14 @@ if ((beacon_ies && beacon_ies_len && beacon_ies_data->ie_length) || (beacon_ies_data->mgmt_subtype_mask == - MLAN_CUSTOM_IE_DELETE_MASK)) { + MLAN_CUSTOM_IE_DELETE_MASK && + beacon_vendor_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK)) { if (MLAN_STATUS_FAILURE == - woal_cfg80211_custom_ie(priv, beacon_ies_data, - &beacon_vendor_index, NULL, - &proberesp_index, NULL, - &assocresp_index, NULL, - &probereq_index, - wait_option)) { + woal_cfg80211_custom_ie( + priv, beacon_ies_data, &beacon_vendor_index, + NULL, &proberesp_index, NULL, + &assocresp_index, NULL, &probereq_index, + wait_option)) { PRINTM(MERROR, "Fail to set beacon vendor IE\n"); ret = -EFAULT; @@ -4001,16 +4070,12 @@ beacon_ies_data->mgmt_subtype_mask = MGMT_MASK_BEACON | MGMT_MASK_ASSOC_RESP | MGMT_MASK_PROBE_RESP; - beacon_ies_data->ie_length = - woal_filter_beacon_ies(priv, beacon_ies, - beacon_ies_len, - beacon_ies_data-> - ie_buffer, MAX_IE_SIZE, - IE_MASK_WPS | IE_MASK_WFD - | IE_MASK_P2P | - IE_MASK_VENDOR, - proberesp_ies, - proberesp_ies_len); + beacon_ies_data->ie_length = woal_filter_beacon_ies( + priv, beacon_ies, beacon_ies_len, + beacon_ies_data->ie_buffer, MAX_IE_SIZE, + IE_MASK_WPS | IE_MASK_WFD | IE_MASK_P2P | + IE_MASK_VENDOR, + proberesp_ies, proberesp_ies_len); if (beacon_ies_data->ie_length) DBG_HEXDUMP(MCMD_D, "beacon ie", beacon_ies_data->ie_buffer, @@ -4024,6 +4089,7 @@ if (beacon_index > MAX_MGMT_IE_INDEX) { PRINTM(MINFO, "Invalid beacon index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -4036,25 +4102,26 @@ } if (proberesp_ies_data) { + proberesp_ies_data->mgmt_subtype_mask = 0xff; if (proberesp_ies && proberesp_ies_len) { /* set the probe response p2p ies */ proberesp_ies_data->ie_index = proberesp_p2p_index; proberesp_ies_data->mgmt_subtype_mask = MGMT_MASK_PROBE_RESP; - proberesp_ies_data->ie_length = - woal_get_specific_ie(proberesp_ies, - proberesp_ies_len, - proberesp_ies_data-> - ie_buffer, MAX_IE_SIZE, - IE_MASK_P2P); + proberesp_ies_data->ie_length = woal_get_specific_ie( + proberesp_ies, proberesp_ies_len, + proberesp_ies_data->ie_buffer, MAX_IE_SIZE, + IE_MASK_P2P); DBG_HEXDUMP(MCMD_D, "proberesp p2p ie", proberesp_ies_data->ie_buffer, proberesp_ies_data->ie_length); - } else if (proberesp_p2p_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) { + } else if (proberesp_p2p_index != + MLAN_CUSTOM_IE_AUTO_IDX_MASK) { /* clear the probe response p2p ies */ if (proberesp_p2p_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid proberesp_p2p_index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } proberesp_ies_data->ie_index = proberesp_p2p_index; @@ -4068,12 +4135,11 @@ (proberesp_ies_data->mgmt_subtype_mask == MLAN_CUSTOM_IE_DELETE_MASK)) { if (MLAN_STATUS_FAILURE == - woal_cfg80211_custom_ie(priv, NULL, &beacon_index, - proberesp_ies_data, - &proberesp_p2p_index, NULL, - &assocresp_index, NULL, - &probereq_index, - wait_option)) { + woal_cfg80211_custom_ie( + priv, NULL, &beacon_index, + proberesp_ies_data, &proberesp_p2p_index, + NULL, &assocresp_index, NULL, + &probereq_index, wait_option)) { PRINTM(MERROR, "Fail to set proberesp p2p IE\n"); ret = -EFAULT; @@ -4093,13 +4159,10 @@ if (proberesp_index == MLAN_CUSTOM_IE_AUTO_IDX_MASK) proberesp_ies_data->mgmt_subtype_mask |= MLAN_CUSTOM_IE_NEW_MASK; - proberesp_ies_data->ie_length = - woal_filter_beacon_ies(priv, proberesp_ies, - proberesp_ies_len, - proberesp_ies_data-> - ie_buffer, MAX_IE_SIZE, - IE_MASK_P2P | - IE_MASK_VENDOR, NULL, 0); + proberesp_ies_data->ie_length = woal_filter_beacon_ies( + priv, proberesp_ies, proberesp_ies_len, + proberesp_ies_data->ie_buffer, MAX_IE_SIZE, + IE_MASK_P2P | IE_MASK_VENDOR, NULL, 0); if (proberesp_ies_data->ie_length) { DBG_HEXDUMP(MCMD_D, "proberesp ie", proberesp_ies_data->ie_buffer, @@ -4113,6 +4176,7 @@ if (proberesp_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid probe resp index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } proberesp_ies_data->ie_index = proberesp_index; @@ -4135,6 +4199,7 @@ PRINTM(MERROR, "IE too big, assocresp_ies_len=%d\n", (int)assocresp_ies_len); + ret = -EFAULT; goto done; } assocresp_ies_data->ie_length = assocresp_ies_len; @@ -4149,6 +4214,7 @@ if (assocresp_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid assoc resp index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -4171,16 +4237,14 @@ if (priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT) { /* filter out P2P/WFD ie/EXT_CAP ie */ probereq_ies_data->ie_length = - woal_filter_beacon_ies(priv, - probereq_ies, - probereq_ies_len, - probereq_ies_data-> - ie_buffer, - MAX_IE_SIZE, - IE_MASK_P2P | - IE_MASK_WFD | - IE_MASK_EXTCAP, - NULL, 0); + woal_filter_beacon_ies( + priv, probereq_ies, + probereq_ies_len, + probereq_ies_data->ie_buffer, + MAX_IE_SIZE, + IE_MASK_P2P | IE_MASK_WFD | + IE_MASK_EXTCAP, + NULL, 0); } else { #endif /* KERNEL_VERSION */ #endif /* WIFI_DIRECT_SUPPORT */ @@ -4188,6 +4252,7 @@ PRINTM(MERROR, "IE too big, probereq_ies_len=%d\n", (int)probereq_ies_len); + ret = -EFAULT; goto done; } probereq_ies_data->ie_length = probereq_ies_len; @@ -4213,6 +4278,7 @@ if (probereq_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid probe req index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } probereq_ies_data->ie_index = probereq_index; @@ -4226,12 +4292,11 @@ if (beacon_ies_data || proberesp_ies_data || assocresp_ies_data || probereq_ies_data) { if (MLAN_STATUS_FAILURE == - woal_cfg80211_custom_ie(priv, beacon_ies_data, - &beacon_index, proberesp_ies_data, - &proberesp_index, - assocresp_ies_data, - &assocresp_index, probereq_ies_data, - &probereq_index, wait_option)) { + woal_cfg80211_custom_ie( + priv, beacon_ies_data, &beacon_index, + proberesp_ies_data, &proberesp_index, + assocresp_ies_data, &assocresp_index, + probereq_ies_data, &probereq_index, wait_option)) { PRINTM(MERROR, "Fail to set beacon proberesp assoc probereq IES\n"); ret = -EFAULT; @@ -4272,6 +4337,62 @@ } /** + * @brief Sets up the ieee80211_supported band + * * + * @param ht_info A pointer to ieee80211_sta_ht_cap structure + * @param dev_cap Device capability information + * @param mcs_set Device MCS sets + * + * @return N/A + */ +struct ieee80211_supported_band *woal_setup_wiphy_bands(t_u8 ieee_band) +{ + struct ieee80211_supported_band *band = NULL; + switch (ieee_band) { + case IEEE80211_BAND_5GHZ: + band = kmemdup(&cfg80211_band_5ghz, + sizeof(struct ieee80211_supported_band), + GFP_KERNEL); + if (!band) { + PRINTM(MERROR, "No memory for 5g band\n"); + break; + } + band->channels = + kmemdup(&cfg80211_channels_5ghz, + sizeof(cfg80211_channels_5ghz), GFP_KERNEL); + if (!band->channels) { + PRINTM(MERROR, "No memory for 5g band->channel\n"); + kfree(band); + band = NULL; + break; + } + band->n_channels = ARRAY_SIZE(cfg80211_channels_5ghz); + break; + case IEEE80211_BAND_2GHZ: + default: + band = kmemdup(&cfg80211_band_2ghz, + sizeof(struct ieee80211_supported_band), + GFP_KERNEL); + if (!band) { + PRINTM(MERROR, "No memory for 2g band\n"); + break; + } + band->channels = + kmemdup(&cfg80211_channels_2ghz, + sizeof(cfg80211_channels_2ghz), GFP_KERNEL); + if (!band->channels) { + PRINTM(MERROR, "No memory for 2g band->channel\n"); + kfree(band); + band = NULL; + break; + } + band->n_channels = ARRAY_SIZE(cfg80211_channels_2ghz); + break; + } + return band; +} + +/** * @brief Sets up the CFG802.11 specific HT capability fields * with default values * @@ -4281,9 +4402,8 @@ * * @return N/A */ -void -woal_cfg80211_setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info, - t_u32 dev_cap, t_u8 *mcs_set) +void woal_cfg80211_setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info, + t_u32 dev_cap, t_u8 *mcs_set) { ENTER(); @@ -4297,31 +4417,31 @@ moal_memcpy_ext(NULL, ht_info->mcs.rx_mask, mcs_set, sizeof(ht_info->mcs.rx_mask), sizeof(ht_info->mcs.rx_mask)); - if (dev_cap & MBIT(8)) /* 40Mhz intolarance enabled */ + if (dev_cap & MBIT(8)) /* 40Mhz intolarance enabled */ ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; - if (dev_cap & MBIT(17)) /* Channel width 20/40Mhz support */ + if (dev_cap & MBIT(17)) /* Channel width 20/40Mhz support */ ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - if ((dev_cap >> 20) & 0x03) /* Delayed ACK supported */ + if ((dev_cap >> 20) & 0x03) /* Delayed ACK supported */ ht_info->cap |= IEEE80211_HT_CAP_DELAY_BA; - if (dev_cap & MBIT(22)) /* Rx LDPC supported */ + if (dev_cap & MBIT(22)) /* Rx LDPC supported */ ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; - if (dev_cap & MBIT(23)) /* Short GI @ 20Mhz supported */ + if (dev_cap & MBIT(23)) /* Short GI @ 20Mhz supported */ ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - if (dev_cap & MBIT(24)) /* Short GI @ 40Mhz supported */ + if (dev_cap & MBIT(24)) /* Short GI @ 40Mhz supported */ ht_info->cap |= IEEE80211_HT_CAP_SGI_40; - if (dev_cap & MBIT(25)) /* Tx STBC supported */ + if (dev_cap & MBIT(25)) /* Tx STBC supported */ ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; - if (dev_cap & MBIT(26)) /* Rx STBC supported */ + if (dev_cap & MBIT(26)) /* Rx STBC supported */ ht_info->cap |= IEEE80211_HT_CAP_RX_STBC; - if (dev_cap & MBIT(27)) /* MIMO PS supported */ - ht_info->cap |= 0; /* WLAN_HT_CAP_SM_PS_STATIC */ - else /* Disable HT SM PS */ + if (dev_cap & MBIT(27)) /* MIMO PS supported */ + ht_info->cap |= 0; /* WLAN_HT_CAP_SM_PS_STATIC */ + else /* Disable HT SM PS */ ht_info->cap |= IEEE80211_HT_CAP_SM_PS; - if (dev_cap & MBIT(29)) /* Green field supported */ + if (dev_cap & MBIT(29)) /* Green field supported */ ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; - if (dev_cap & MBIT(31)) /* MAX AMSDU supported */ + if (dev_cap & MBIT(31)) /* MAX AMSDU supported */ ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; - /* DSSS/CCK in 40Mhz supported */ + /* DSSS/CCK in 40Mhz supported*/ ht_info->cap |= IEEE80211_HT_CAP_DSSSCCK40; ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; @@ -4338,9 +4458,8 @@ * * @return N/A */ -void -woal_cfg80211_setup_vht_cap(moal_private *priv, - struct ieee80211_sta_vht_cap *vht_cap) +void woal_cfg80211_setup_vht_cap(moal_private *priv, + struct ieee80211_sta_vht_cap *vht_cap) { mlan_ioctl_req *req = NULL; mlan_ds_11ac_cfg *cfg_11ac = NULL; @@ -4366,13 +4485,13 @@ vht_cap->vht_supported = true; vht_cap->cap = cfg_11ac->param.vht_cfg.vht_cap_info; vht_cap->vht_mcs.rx_mcs_map = - (__force __le16) cfg_11ac->param.vht_cfg.vht_rx_mcs; + (__force __le16)cfg_11ac->param.vht_cfg.vht_rx_mcs; vht_cap->vht_mcs.rx_highest = - (__force __le16) cfg_11ac->param.vht_cfg.vht_rx_max_rate; + (__force __le16)cfg_11ac->param.vht_cfg.vht_rx_max_rate; vht_cap->vht_mcs.tx_mcs_map = - (__force __le16) cfg_11ac->param.vht_cfg.vht_tx_mcs; + (__force __le16)cfg_11ac->param.vht_cfg.vht_tx_mcs; vht_cap->vht_mcs.tx_highest = - (__force __le16) cfg_11ac->param.vht_cfg.vht_tx_max_rate; + (__force __le16)cfg_11ac->param.vht_cfg.vht_tx_max_rate; PRINTM(MCMND, "vht_cap=0x%x rx_mcs_map=0x%x rx_max=0x%x tx_mcs_map=0x%x tx_max=0x%x\n", vht_cap->cap, vht_cap->vht_mcs.rx_mcs_map, @@ -4385,7 +4504,6 @@ } #endif -#if KERNEL_VERSION(4, 20, 0) <= CFG80211_VERSION_CODE /* =============== 11AX CAP for uAP @@ -4397,13 +4515,13 @@ HE MAC Cap: Bit0: 1 (+HTC HE Support) Bit25: 1 (OM Control Support. But uAP does not support - Tx OM received from the STA, as it does not support UL OFDMA) + Tx OM received from the STA, as it does not support UL OFDMA) HE PHY Cap: Bit1-7: 0x2 (Supported Channel Width Set. - Note it would be changed after 80+80 MHz is supported) + Note it would be changed after 80+80 MHz is supported) Bit8-11: 0x3 (Punctured Preamble Rx. - Note: it would be changed after 80+80 MHz is supported) + Note: it would be changed after 80+80 MHz is supported) Bit12: 0x0 (Device Class) Bit13: 0x1 (LDPC coding in Payload) Bit17: 0x1 (NDP with 4xHE-LTF+3.2usGI) @@ -4418,29 +4536,29 @@ Bit40-42: 0x1 (Number of Sounding Dimentions <= 80 MHz) Bit53: 0x1 (Partial Bandwidth Extended Range) Bit55: 0x1 (PPE Threshold Present. - Note: PPE threshold may have some changes later) + Note: PPE threshold may have some changes later) Bit58: 0x1 (HE SU PPDU and HE MU PPDU with 4xHE-LTF+0.8usGI) Bit59-61: 0x1 (Max Nc) Bit75: 0x1 (Rx 1024-QAM Support < 242-tone RU) */ -#define UAP_HE_MAC_CAP0_MASK 0x00 -#define UAP_HE_MAC_CAP1_MASK 0x00 -#define UAP_HE_MAC_CAP2_MASK 0x00 -#define UAP_HE_MAC_CAP3_MASK 0x02 -#define UAP_HE_MAC_CAP4_MASK 0x00 -#define UAP_HE_MAC_CAP5_MASK 0x00 -#define UAP_HE_PHY_CAP0_MASK 0x04 -#define UAP_HE_PHY_CAP1_MASK 0x23 -#define UAP_HE_PHY_CAP2_MASK 0x3E -#define UAP_HE_PHY_CAP3_MASK 0x88 -#define UAP_HE_PHY_CAP4_MASK 0x1D -#define UAP_HE_PHY_CAP5_MASK 0x01 -#define UAP_HE_PHY_CAP6_MASK 0xA0 -#define UAP_HE_PHY_CAP7_MASK 0x0C -#define UAP_HE_PHY_CAP8_MASK 0x00 -#define UAP_HE_PHY_CAP9_MASK 0x08 -#define UAP_HE_PHY_CAP10_MASK 0x00 +#define UAP_HE_MAC_CAP0_MASK 0x00 +#define UAP_HE_MAC_CAP1_MASK 0x00 +#define UAP_HE_MAC_CAP2_MASK 0x00 +#define UAP_HE_MAC_CAP3_MASK 0x02 +#define UAP_HE_MAC_CAP4_MASK 0x00 +#define UAP_HE_MAC_CAP5_MASK 0x00 +#define UAP_HE_PHY_CAP0_MASK 0x04 +#define UAP_HE_PHY_CAP1_MASK 0x23 +#define UAP_HE_PHY_CAP2_MASK 0x3E +#define UAP_HE_PHY_CAP3_MASK 0x88 +#define UAP_HE_PHY_CAP4_MASK 0x1D +#define UAP_HE_PHY_CAP5_MASK 0x01 +#define UAP_HE_PHY_CAP6_MASK 0xA0 +#define UAP_HE_PHY_CAP7_MASK 0x0C +#define UAP_HE_PHY_CAP8_MASK 0x00 +#define UAP_HE_PHY_CAP9_MASK 0x08 +#define UAP_HE_PHY_CAP10_MASK 0x00 /* 2G @@ -4448,7 +4566,7 @@ HE MAC Cap: Bit0: 1 (+HTC HE Support) Bit25: 1 (OM Control Support. Note: uAP does not support - Tx OM received from the STA, as it does not support UL OFDMA) + Tx OM received from the STA, as it does not support UL OFDMA) HE PHY Cap: Bit1-7: 0x1 (Supported Channel Width Set) @@ -4467,38 +4585,37 @@ Bit40-42: 0x1 (Number of Sounding Dimentions <= 80 MHz) Bit53: 0x1 (Partial Bandwidth Extended Range) Bit55: 0x1 (PPE Threshold Present. - Note: PPE threshold may have some changes later) + Note: PPE threshold may have some changes later) Bit58: 0x1 (HE SU PPDU and HE MU PPDU with 4xHE-LTF+0.8usGI) Bit59-61: 0x1 (Max Nc) Bit75: 0x1 (Rx 1024-QAM Support < 242-tone RU) */ -#define UAP_HE_2G_MAC_CAP0_MASK 0x00 -#define UAP_HE_2G_MAC_CAP1_MASK 0x00 -#define UAP_HE_2G_MAC_CAP2_MASK 0x00 -#define UAP_HE_2G_MAC_CAP3_MASK 0x02 -#define UAP_HE_2G_MAC_CAP4_MASK 0x00 -#define UAP_HE_2G_MAC_CAP5_MASK 0x00 -#define UAP_HE_2G_PHY_CAP0_MASK 0x04 -#define UAP_HE_2G_PHY_CAP1_MASK 0x20 -#define UAP_HE_2G_PHY_CAP2_MASK 0x3E -#define UAP_HE_2G_PHY_CAP3_MASK 0x88 -#define UAP_HE_2G_PHY_CAP4_MASK 0x1D -#define UAP_HE_2G_PHY_CAP5_MASK 0x01 -#define UAP_HE_2G_PHY_CAP6_MASK 0xA0 -#define UAP_HE_2G_PHY_CAP7_MASK 0x0C -#define UAP_HE_2G_PHY_CAP8_MASK 0x00 -#define UAP_HE_2G_PHY_CAP9_MASK 0x08 -#define UAP_HE_2G_PHY_CAP10_MASK 0x00 +#define UAP_HE_2G_MAC_CAP0_MASK 0x00 +#define UAP_HE_2G_MAC_CAP1_MASK 0x00 +#define UAP_HE_2G_MAC_CAP2_MASK 0x00 +#define UAP_HE_2G_MAC_CAP3_MASK 0x02 +#define UAP_HE_2G_MAC_CAP4_MASK 0x00 +#define UAP_HE_2G_MAC_CAP5_MASK 0x00 +#define UAP_HE_2G_PHY_CAP0_MASK 0x02 +#define UAP_HE_2G_PHY_CAP1_MASK 0x20 +#define UAP_HE_2G_PHY_CAP2_MASK 0x3E +#define UAP_HE_2G_PHY_CAP3_MASK 0x88 +#define UAP_HE_2G_PHY_CAP4_MASK 0x1D +#define UAP_HE_2G_PHY_CAP5_MASK 0x01 +#define UAP_HE_2G_PHY_CAP6_MASK 0xA0 +#define UAP_HE_2G_PHY_CAP7_MASK 0x0C +#define UAP_HE_2G_PHY_CAP8_MASK 0x00 +#define UAP_HE_2G_PHY_CAP9_MASK 0x08 +#define UAP_HE_2G_PHY_CAP10_MASK 0x00 /** * @brief update 11ax ie for AP mode * - * @param band band config - * @hecap_ie a pointer to mlan_ds_11ax_he_capa + * @param band channel band + * @hecap_ie a pointer to mlan_ds_11ax_he_capa * * @return 0--success, otherwise failure */ -void -woal_uap_update_11ax_ie(t_u8 band, mlan_ds_11ax_he_capa * hecap_ie) +static void woal_uap_update_11ax_ie(t_u8 band, mlan_ds_11ax_he_capa *hecap_ie) { if (band == BAND_5GHZ) { hecap_ie->he_mac_cap[0] &= UAP_HE_MAC_CAP0_MASK; @@ -4540,6 +4657,7 @@ return; } +#if KERNEL_VERSION(4, 20, 0) <= CFG80211_VERSION_CODE /** * @brief Sets up the CFG802.11 specific HE capability fields * with default * values @@ -4549,9 +4667,8 @@ * * @return N/A */ -void -woal_cfg80211_setup_he_cap(moal_private *priv, - struct ieee80211_supported_band *band) +void woal_cfg80211_setup_he_cap(moal_private *priv, + struct ieee80211_supported_band *band) { mlan_fw_info fw_info; struct ieee80211_sband_iftype_data *iftype_data = NULL; @@ -4562,11 +4679,11 @@ woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); if (band->band == NL80211_BAND_5GHZ) { - phe_cap = (mlan_ds_11ax_he_capa *) fw_info.hw_he_cap; + phe_cap = (mlan_ds_11ax_he_capa *)fw_info.hw_he_cap; hw_hecap_len = fw_info.hw_hecap_len; woal_uap_update_11ax_ie(BAND_5GHZ, phe_cap); } else { - phe_cap = (mlan_ds_11ax_he_capa *) fw_info.hw_2g_he_cap; + phe_cap = (mlan_ds_11ax_he_capa *)fw_info.hw_2g_he_cap; hw_hecap_len = fw_info.hw_2g_hecap_len; woal_uap_update_11ax_ie(BAND_2GHZ, phe_cap); } @@ -4580,6 +4697,7 @@ PRINTM(MERROR, "Fail to allocate iftype data\n"); goto done; } + memset(iftype_data, 0, sizeof(struct ieee80211_sband_iftype_data)); iftype_data->types_mask = MBIT(NL80211_IFTYPE_STATION) | MBIT(NL80211_IFTYPE_AP) | MBIT(NL80211_IFTYPE_P2P_CLIENT) | MBIT(NL80211_IFTYPE_P2P_GO); @@ -4606,10 +4724,11 @@ if (phe_cap->he_phy_cap[0] & MBIT(4)) extra_mcs_size += 4; if (extra_mcs_size) - moal_memcpy_ext(priv->phandle, - (t_u8 *)&iftype_data->he_cap.he_mcs_nss_supp. - rx_mcs_160, phe_cap->val, extra_mcs_size, - sizeof(struct ieee80211_he_mcs_nss_supp) - 4); + moal_memcpy_ext( + priv->phandle, + (t_u8 *)&iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_160, + phe_cap->val, extra_mcs_size, + sizeof(struct ieee80211_he_mcs_nss_supp) - 4); #define HE_CAP_FIX_SIZE 22 // Support PPE threshold @@ -4629,6 +4748,72 @@ done: LEAVE(); } +#else +/** + * @brief setup uap he_cap based on FW he_cap + * + * @param priv A pointer to moal private structure + * @param wait_option wait_option + * + * @return N/A + */ +void woal_cfg80211_setup_uap_he_cap(moal_private *priv, t_u8 wait_option) +{ + mlan_ds_11ax_he_capa *phe_cap = NULL; + mlan_ds_11ax_he_cfg he_cfg; + t_u8 hw_hecap_len; + mlan_fw_info fw_info; +#ifdef UAP_SUPPORT + int ret = 0; +#endif + + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + + // Enable 2G 11AX on UAP + if (fw_info.fw_bands & BAND_GAX) { + memset(&he_cfg, 0, sizeof(he_cfg)); + phe_cap = (mlan_ds_11ax_he_capa *)fw_info.hw_2g_he_cap; + hw_hecap_len = fw_info.hw_2g_hecap_len; + if (hw_hecap_len) { + woal_uap_update_11ax_ie(BAND_2GHZ, phe_cap); + he_cfg.band = MBIT(0); + moal_memcpy_ext(priv->phandle, &he_cfg.he_cap, phe_cap, + hw_hecap_len, + sizeof(mlan_ds_11ax_he_capa)); + DBG_HEXDUMP(MCMD_D, "2G HE_CFG ", (t_u8 *)&he_cfg, + sizeof(he_cfg)); +#ifdef UAP_SUPPORT + ret = woal_11ax_cfg(priv, MLAN_ACT_SET, &he_cfg, + wait_option); + if (ret) + PRINTM(MERROR, "Fail to set 2G HE CAP\n"); +#endif + } + } + // Enable 5G 11AX on UAP + if (fw_info.fw_bands & BAND_AAX) { + memset(&he_cfg, 0, sizeof(he_cfg)); + phe_cap = (mlan_ds_11ax_he_capa *)fw_info.hw_he_cap; + hw_hecap_len = fw_info.hw_hecap_len; + if (hw_hecap_len) { + woal_uap_update_11ax_ie(BAND_5GHZ, phe_cap); + he_cfg.band = MBIT(1); + moal_memcpy_ext(priv->phandle, &he_cfg.he_cap, phe_cap, + hw_hecap_len, + sizeof(mlan_ds_11ax_he_capa)); + DBG_HEXDUMP(MCMD_D, "5G HE_CFG ", (t_u8 *)&he_cfg, + sizeof(he_cfg)); +#ifdef UAP_SUPPORT + ret = woal_11ax_cfg(priv, MLAN_ACT_SET, &he_cfg, + wait_option); + if (ret) + PRINTM(MERROR, "Fail to set 5G HE CAP\n"); +#endif + } + } + return; +} +#endif /** * @brief free iftype_data @@ -4638,22 +4823,26 @@ * * @return N/A */ -void -woal_cfg80211_free_iftype_data(struct wiphy *wiphy) +void woal_cfg80211_free_bands(struct wiphy *wiphy) { - enum nl80211_band band; + t_u8 band; - for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; ++band) { + for (band = NL80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; ++band) { if (!wiphy->bands[band]) continue; - if (!wiphy->bands[band]->iftype_data) - continue; - kfree(wiphy->bands[band]->iftype_data); - wiphy->bands[band]->n_iftype_data = 0; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + if (wiphy->bands[band]->iftype_data) { + kfree(wiphy->bands[band]->iftype_data); + wiphy->bands[band]->n_iftype_data = 0; + } +#endif + kfree(wiphy->bands[band]->channels); + kfree(wiphy->bands[band]); + wiphy->bands[band] = NULL; } } -#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /* * @brief prepare and send fake deauth packet to cfg80211 to * notify wpa_supplicant about disconnection @@ -4664,8 +4853,7 @@ * * @return N/A */ -void -woal_deauth_event(moal_private *priv, int reason_code) +void woal_deauth_event(moal_private *priv, int reason_code) { struct woal_event *evt; unsigned long flags; @@ -4686,6 +4874,7 @@ spin_unlock_irqrestore(&handle->evt_lock, flags); queue_work(handle->evt_workqueue, &handle->evt_work); } +#endif #ifdef STA_CFG80211 #if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE @@ -4697,8 +4886,7 @@ * * @return N/A */ -void -woal_bgscan_stop_event(moal_private *priv) +void woal_bgscan_stop_event(moal_private *priv) { struct woal_event *evt; unsigned long flags; @@ -4723,58 +4911,33 @@ * * @return N/A */ -void -woal_cfg80211_notify_sched_scan_stop(moal_private *priv) +void woal_cfg80211_notify_sched_scan_stop(moal_private *priv) { cfg80211_sched_scan_stopped(priv->wdev->wiphy #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , 0 + , + 0 #endif - ); + ); priv->sched_scanning = MFALSE; PRINTM(MEVENT, "Notify sched scan stopped\n"); } /** - * @brief sched_scan work handler - * - * @param work a pointer to work_struct - * - * @return 0 -- success, otherwise fail - */ -void -woal_sched_scan_work_queue(struct work_struct *work) -{ - struct delayed_work *delayed_work = - container_of(work, struct delayed_work, work); - moal_private *priv = container_of(delayed_work, moal_private, - sched_scan_work); - ENTER(); - - if (priv->sched_scanning) - woal_cfg80211_notify_sched_scan_stop(priv); - - LEAVE(); -} - -/** * @brief report sched_scan result to kernel * * @param priv A pointer moal_private structure * * @return N/A */ -void -woal_report_sched_scan_result(moal_private *priv) +void woal_report_sched_scan_result(moal_private *priv) { cfg80211_sched_scan_results(priv->wdev->wiphy #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - , priv->bg_scan_reqid + , + priv->bg_scan_reqid #endif - ); - queue_delayed_work(priv->sched_scan_workqueue, &priv->sched_scan_work, - msecs_to_jiffies(2000)); - + ); } #endif #endif @@ -4788,8 +4951,7 @@ * * @return N/A */ -void -woal_channel_switch_event(moal_private *priv, chan_band_info * pchan_info) +void woal_channel_switch_event(moal_private *priv, chan_band_info *pchan_info) { struct woal_event *evt; unsigned long flags; @@ -4817,8 +4979,8 @@ * * @return N/A */ -void -woal_cfg80211_notify_channel(moal_private *priv, chan_band_info * pchan_info) +void woal_cfg80211_notify_channel(moal_private *priv, + chan_band_info *pchan_info) { #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE struct cfg80211_chan_def chandef; @@ -4834,7 +4996,17 @@ #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE if (MLAN_STATUS_SUCCESS == woal_chandef_create(priv, &chandef, pchan_info)) { +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE + mutex_lock(&priv->wdev->mtx); +#endif +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + cfg80211_ch_switch_notify(priv->netdev, &chandef, 0, 0); +#else cfg80211_ch_switch_notify(priv->netdev, &chandef); +#endif +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE + mutex_unlock(&priv->wdev->mtx); +#endif priv->channel = pchan_info->channel; #ifdef UAP_CFG80211 moal_memcpy_ext(priv->phandle, &priv->chan, &chandef, @@ -4870,7 +5042,7 @@ type = NL80211_CHAN_HT20; break; } - cfg80211_ch_switch_notify(priv->netdev, freq, type); + cfg80211_ch_switch_notify(priv->netdev, freq, type, 0); #endif #endif LEAVE(); @@ -4887,9 +5059,8 @@ * * @return N/A */ -void -woal_cfg80211_notify_antcfg(moal_private *priv, - struct wiphy *wiphy, mlan_ds_radio_cfg *radio) +void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy, + mlan_ds_radio_cfg *radio) { if (IS_STA_OR_UAP_CFG80211(priv->phandle->params.cfg80211_wext) && wiphy) { @@ -4903,129 +5074,137 @@ (radio->param.ant_cfg.rx_antenna & 0xFF) != 0)) { bands->ht_cap.mcs.rx_mask[1] = 0; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - if (bands->n_iftype_data && bands->iftype_data - && bands->iftype_data->he_cap.has_he) { + if (bands->n_iftype_data && + bands->iftype_data && + bands->iftype_data->he_cap.has_he) { t_u16 mcs_nss[2]; - mcs_nss[0] = - bands->iftype_data->he_cap. - he_mcs_nss_supp.rx_mcs_80; + mcs_nss[0] = bands->iftype_data->he_cap + .he_mcs_nss_supp + .rx_mcs_80; mcs_nss[1] = mcs_nss[0] |= 0x0c; - moal_memcpy_ext(priv->phandle, - (t_void *)&bands-> - iftype_data->he_cap. - he_mcs_nss_supp. - rx_mcs_80, - (t_void *)&mcs_nss, - sizeof(mcs_nss), - sizeof(bands-> - iftype_data-> - he_cap. - he_mcs_nss_supp)); + moal_memcpy_ext( + priv->phandle, + (t_void *)&bands->iftype_data + ->he_cap.he_mcs_nss_supp + .rx_mcs_80, + (t_void *)&mcs_nss, + sizeof(mcs_nss), + sizeof(bands->iftype_data->he_cap + .he_mcs_nss_supp)); } #endif - } else if ((radio->param.ant_cfg.tx_antenna & 0xFF) == 3 - || (radio->param.ant_cfg. - rx_antenna & 0xFF) == 3) { + } else if ((radio->param.ant_cfg.tx_antenna & 0xFF) == + 3 || + (radio->param.ant_cfg.rx_antenna & 0xFF) == + 3) { bands->ht_cap.mcs.rx_mask[1] = 0xff; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - if (bands->n_iftype_data && bands->iftype_data - && bands->iftype_data->he_cap.has_he) { + if (bands->n_iftype_data && + bands->iftype_data && + bands->iftype_data->he_cap.has_he) { t_u16 mcs_nss[2]; - mcs_nss[0] = - bands->iftype_data->he_cap. - he_mcs_nss_supp.rx_mcs_80; + mcs_nss[0] = bands->iftype_data->he_cap + .he_mcs_nss_supp + .rx_mcs_80; mcs_nss[1] = mcs_nss[0] = (mcs_nss[0] & ~0x0c) | ((mcs_nss[0] & 0x3) << 2); - moal_memcpy_ext(priv->phandle, - (t_void *)&bands-> - iftype_data->he_cap. - he_mcs_nss_supp. - rx_mcs_80, - (t_void *)&mcs_nss, - sizeof(mcs_nss), - sizeof(bands-> - iftype_data-> - he_cap. - he_mcs_nss_supp)); + moal_memcpy_ext( + priv->phandle, + (t_void *)&bands->iftype_data + ->he_cap.he_mcs_nss_supp + .rx_mcs_80, + (t_void *)&mcs_nss, + sizeof(mcs_nss), + sizeof(bands->iftype_data->he_cap + .he_mcs_nss_supp)); } #endif } - bands->ht_cap.mcs.rx_mask[4] = 0; } if (wiphy->bands[IEEE80211_BAND_5GHZ]) { struct ieee80211_supported_band *bands = wiphy->bands[IEEE80211_BAND_5GHZ]; - if (((radio->param.ant_cfg.tx_antenna & 0xFF00) != 0x300 - && (radio->param.ant_cfg.tx_antenna & 0xFF00) != 0) - || ((radio->param.ant_cfg.rx_antenna & 0xFF00) != - 0x300 && - (radio->param.ant_cfg.rx_antenna & 0xFF00) != - 0)) { + if (((radio->param.ant_cfg.tx_antenna & 0xFF00) != + 0x300 && + (radio->param.ant_cfg.tx_antenna & 0xFF00) != 0) || + ((radio->param.ant_cfg.rx_antenna & 0xFF00) != + 0x300 && + (radio->param.ant_cfg.rx_antenna & 0xFF00) != 0)) { bands->ht_cap.mcs.rx_mask[1] = 0; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) bands->vht_cap.vht_mcs.rx_mcs_map = - (__force __le16) 0xfffe; + (__force __le16)0xfffe; bands->vht_cap.vht_mcs.tx_mcs_map = - (__force __le16) 0xfffe; + (__force __le16)0xfffe; + bands->vht_cap.vht_mcs.rx_highest = + (__force __le16)0x186; + bands->vht_cap.vht_mcs.tx_highest = + (__force __le16)0x186; +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - if (bands->n_iftype_data && bands->iftype_data - && bands->iftype_data->he_cap.has_he) { + if (bands->n_iftype_data && + bands->iftype_data && + bands->iftype_data->he_cap.has_he) { t_u16 mcs_nss[2]; - mcs_nss[0] = - bands->iftype_data->he_cap. - he_mcs_nss_supp.rx_mcs_80; + mcs_nss[0] = bands->iftype_data->he_cap + .he_mcs_nss_supp + .rx_mcs_80; mcs_nss[1] = mcs_nss[0] |= 0x0c; - moal_memcpy_ext(priv->phandle, - (t_void *)&bands-> - iftype_data->he_cap. - he_mcs_nss_supp. - rx_mcs_80, - (t_void *)&mcs_nss, - sizeof(mcs_nss), - sizeof(bands-> - iftype_data-> - he_cap. - he_mcs_nss_supp)); + moal_memcpy_ext( + priv->phandle, + (t_void *)&bands->iftype_data + ->he_cap.he_mcs_nss_supp + .rx_mcs_80, + (t_void *)&mcs_nss, + sizeof(mcs_nss), + sizeof(bands->iftype_data->he_cap + .he_mcs_nss_supp)); } #endif } else if ((radio->param.ant_cfg.tx_antenna & 0xFF00) == - 0x300 || + 0x300 || (radio->param.ant_cfg.rx_antenna & 0xFF00) == - 0x300) { + 0x300) { bands->ht_cap.mcs.rx_mask[1] = 0xff; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) bands->vht_cap.vht_mcs.rx_mcs_map = - (__force __le16) 0xfffa; + (__force __le16)0xfffa; bands->vht_cap.vht_mcs.tx_mcs_map = - (__force __le16) 0xfffa; + (__force __le16)0xfffa; + bands->vht_cap.vht_mcs.rx_highest = + (__force __le16)0x30c; + bands->vht_cap.vht_mcs.tx_highest = + (__force __le16)0x30c; +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - if (bands->n_iftype_data && bands->iftype_data - && bands->iftype_data->he_cap.has_he) { + if (bands->n_iftype_data && + bands->iftype_data && + bands->iftype_data->he_cap.has_he) { t_u16 mcs_nss[2]; - mcs_nss[0] = - bands->iftype_data->he_cap. - he_mcs_nss_supp.rx_mcs_80; + mcs_nss[0] = bands->iftype_data->he_cap + .he_mcs_nss_supp + .rx_mcs_80; mcs_nss[1] = mcs_nss[0] = (mcs_nss[0] & ~0x0c) | ((mcs_nss[0] & 0x3) << 2); - moal_memcpy_ext(priv->phandle, - (t_void *)&bands-> - iftype_data->he_cap. - he_mcs_nss_supp. - rx_mcs_80, - (t_void *)&mcs_nss, - sizeof(mcs_nss), - sizeof(bands-> - iftype_data-> - he_cap. - he_mcs_nss_supp)); + moal_memcpy_ext( + priv->phandle, + (t_void *)&bands->iftype_data + ->he_cap.he_mcs_nss_supp + .rx_mcs_80, + (t_void *)&mcs_nss, + sizeof(mcs_nss), + sizeof(bands->iftype_data->he_cap + .he_mcs_nss_supp)); } #endif } @@ -5044,10 +5223,9 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE */ -mlan_status -woal_chandef_create(moal_private *priv, - struct cfg80211_chan_def *chandef, - chan_band_info * pchan_info) +mlan_status woal_chandef_create(moal_private *priv, + struct cfg80211_chan_def *chandef, + chan_band_info *pchan_info) { enum ieee80211_band band = IEEE80211_BAND_2GHZ; mlan_status status = MLAN_STATUS_SUCCESS; @@ -5059,9 +5237,9 @@ band = IEEE80211_BAND_2GHZ; else if (pchan_info->bandcfg.chanBand == BAND_5GHZ) band = IEEE80211_BAND_5GHZ; - chandef->chan = ieee80211_get_channel(priv->wdev->wiphy, - ieee80211_channel_to_frequency - (pchan_info->channel, band)); + chandef->chan = ieee80211_get_channel( + priv->wdev->wiphy, + ieee80211_channel_to_frequency(pchan_info->channel, band)); if (chandef->chan == NULL) { PRINTM(MERROR, "Fail on ieee80211_get_channel, channel=%d, band=%d\n", @@ -5086,9 +5264,8 @@ break; case CHAN_BW_80MHZ: chandef->width = NL80211_CHAN_WIDTH_80; - chandef->center_freq1 = - ieee80211_channel_to_frequency(pchan_info->center_chan, - band); + chandef->center_freq1 = ieee80211_channel_to_frequency( + pchan_info->center_chan, band); break; default: break; @@ -5098,3 +5275,170 @@ return status; } #endif + +/** + * @brief Set given radar channel dfs_state to AVAILABLE + * + * @param wiphy A pointer to struct wiphy + * + * @return N/A + */ +void woal_clear_wiphy_dfs_state(struct wiphy *wiphy) +{ + struct ieee80211_supported_band *sband; + int i; + + ENTER(); + if (!wiphy) { + LEAVE(); + return; + } + sband = wiphy->bands[NL80211_BAND_5GHZ]; + + if (!sband) { + LEAVE(); + return; + } + + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & IEEE80211_CHAN_RADAR) { +#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) + if (sband->channels[i].dfs_state == + NL80211_DFS_UNAVAILABLE) { + sband->channels[i].dfs_state = + NL80211_DFS_USABLE; + sband->channels[i].dfs_state_entered = jiffies; + } +#endif + } + } + LEAVE(); +} + +/** + * @brief Set given radar channel dfs_state to AVAILABLE + * + * @param wiphy A pointer to struct wiphy + * @param ch_dfs_state A pointer to struct mlan_ds_11h_chan_dfs_state + * + * @return N/A + */ +int woal_get_wiphy_chan_dfs_state(struct wiphy *wiphy, + mlan_ds_11h_chan_dfs_state *ch_dfs_state) +{ + struct ieee80211_supported_band *sband; + int i; + int ret = -1; + t_u8 channel = ch_dfs_state->channel; + + ENTER(); + if (!wiphy) { + LEAVE(); + return ret; + } + sband = wiphy->bands[NL80211_BAND_5GHZ]; + + if (!sband) { + LEAVE(); + return ret; + } + ch_dfs_state->dfs_required = MFALSE; + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].hw_value == channel) { + if (sband->channels[i].flags & IEEE80211_CHAN_RADAR) { +#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) + ch_dfs_state->dfs_state = + (dfs_state_t)sband->channels[i] + .dfs_state; + ch_dfs_state->dfs_required = MTRUE; +#endif + } + ret = 0; + break; + } + } + LEAVE(); + return ret; +} + +/** + * @brief Set given radar channel dfs_state to AVAILABLE + * + * @param wiphy A pointer to struct wiphy + * @param channel given radar channel + * @param dfs_state dfs_state + * + * @return N/A + */ +static void woal_update_wiphy_chan_dfs_state(struct wiphy *wiphy, t_u8 channel, + t_u8 dfs_state) +{ + struct ieee80211_supported_band *sband; + int i; + + ENTER(); + if (!wiphy) { + LEAVE(); + return; + } + sband = wiphy->bands[NL80211_BAND_5GHZ]; + + if (!sband) { + LEAVE(); + return; + } + + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & IEEE80211_CHAN_RADAR) { + if (sband->channels[i].hw_value == channel) { +#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) + sband->channels[i].dfs_state = dfs_state; + sband->channels[i].dfs_state_entered = jiffies; +#endif + break; + } + } + } +#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) + if (i < sband->n_channels) + PRINTM(MCMD_D, "DFS: Set channel %d dfs_state: %d\n", channel, + sband->channels[i].dfs_state); +#endif + LEAVE(); +} +/** + * @brief Set given radar channel dfs_state + * + * @param wiphy A pointer to wiphy structure + * @param channel given radar channel + * @param dfs_state dfs_state + * + * @return N/A + */ +static void woal_update_wiphy_channel_dfs_state(struct wiphy *wiphy, + t_u8 channel, t_u8 dfs_state) +{ + if (!wiphy) { + LEAVE(); + return; + } + woal_update_wiphy_chan_dfs_state(wiphy, channel, dfs_state); +} + +/** + * @brief update channel dfs state to all wiphy + * + * @param channel given radar channel + * @param dfs_state dfs_state + * + * @return N/A + */ +void woal_update_channel_dfs_state(t_u8 channel, t_u8 dfs_state) +{ + int index; + for (index = 0; index < MAX_MLAN_ADAPTER; index++) { + if (m_handle[index] && m_handle[index]->wiphy) + woal_update_wiphy_channel_dfs_state( + m_handle[index]->wiphy, channel, dfs_state); + } +}
diff --git a/wlan_sd8987/mlinux/moal_cfg80211.h b/wlan_sd8987/mlinux/moal_cfg80211.h index 8b5b98c..d9ca184 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211.h +++ b/wlan_sd8987/mlinux/moal_cfg80211.h
@@ -3,7 +3,7 @@ * @brief This file contains the CFG80211 specific defines. * * - * Copyright 2011-2021 NXP + * Copyright 2011-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -106,7 +106,7 @@ void woal_host_mlme_disconnect(pmoal_private priv, u16 reason_code, u8 *sa); void woal_host_mlme_work_queue(struct work_struct *work); void woal_host_mlme_process_assoc_resp(moal_private *priv, - mlan_ds_misc_assoc_rsp *assoc_rsp); + mlan_ds_assoc_info *assoc_info); #endif #endif @@ -115,6 +115,7 @@ #endif t_u8 woal_band_cfg_to_ieee_band(t_u32 band); +t_u8 woal_ieee_band_to_radio_type(t_u8 ieee_band); int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, @@ -127,6 +128,9 @@ int woal_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed); int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif t_u8 key_index, #if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE bool pairwise, @@ -134,6 +138,9 @@ const t_u8 *mac_addr, struct key_params *params); int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif t_u8 key_index, #if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE bool pairwise, @@ -155,6 +162,9 @@ #endif int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + unsigned int link_id, +#endif const u8 *peer, const struct cfg80211_bitrate_mask *mask); #if KERNEL_VERSION(2, 6, 38) <= CFG80211_VERSION_CODE @@ -173,8 +183,8 @@ enum nl80211_channel_type channel_type, t_u8 wait_option); -static inline int -woal_cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) +static inline int woal_cfg80211_scan_done(struct cfg80211_scan_request *request, + bool aborted) { #if KERNEL_VERSION(4, 8, 0) <= CFG80211_VERSION_CODE struct cfg80211_scan_info info; @@ -186,7 +196,6 @@ #endif return 0; } - mlan_status woal_inform_bss_from_scan_result(moal_private *priv, pmlan_ssid_bssid ssid_bssid, t_u8 wait_option); @@ -204,6 +213,9 @@ #if KERNEL_VERSION(2, 6, 37) < CFG80211_VERSION_CODE int woal_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif t_u8 key_index, bool ucast, bool mcast); #else int woal_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev, @@ -213,12 +225,18 @@ #if KERNEL_VERSION(2, 6, 30) <= CFG80211_VERSION_CODE int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif t_u8 key_index); #endif #if KERNEL_VERSION(5, 10, 0) <= CFG80211_VERSION_CODE int woal_cfg80211_set_default_beacon_key(struct wiphy *wiphy, struct net_device *netdev, +#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || IMX_ANDROID_13) + int link_id, +#endif t_u8 key_index); #endif @@ -238,7 +256,7 @@ #else t_u16 frame_type, bool reg #endif - ); +); int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, #if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE @@ -262,11 +280,7 @@ bool dont_wait_for_ack, #endif #endif - u64 * cookie); - -#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE -void woal_update_radar_chans_dfs_state(struct wiphy *wiphy); -#endif + u64 *cookie); mlan_status woal_register_cfg80211(moal_private *priv); @@ -279,16 +293,20 @@ int woal_cfg80211_bss_role_cfg(moal_private *priv, t_u16 action, t_u8 *bss_role); #endif -#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE -struct wireless_dev *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, - const char *name, - unsigned char - name_assign_type, - enum nl80211_iftype type, -#if KERNEL_VERSION(4, 12, 0) > CFG80211_VERSION_CODE - u32 *flags, + +#ifdef UAP_SUPPORT +void woal_cancel_cac(moal_private *priv); #endif - struct vif_params *params); + +#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE +struct wireless_dev * +woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, const char *name, + unsigned char name_assign_type, + enum nl80211_iftype type, +#if KERNEL_VERSION(4, 12, 0) > CFG80211_VERSION_CODE + u32 *flags, +#endif + struct vif_params *params); #else #if KERNEL_VERSION(3, 7, 0) <= CFG80211_VERSION_CODE struct wireless_dev *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, @@ -326,9 +344,7 @@ int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev); #endif -#if defined(WIFI_DIRECT_SUPPORT) void woal_remove_virtual_interface(moal_handle *handle); -#endif #ifdef WIFI_DIRECT_SUPPORT /* Group Owner Negotiation Req */ @@ -425,7 +441,12 @@ struct beacon_parameters *params); #endif +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) +int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, + unsigned int link_id); +#else int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev); +#endif int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, #if KERNEL_VERSION(3, 19, 0) <= CFG80211_VERSION_CODE struct station_del_parameters *param); @@ -461,8 +482,8 @@ #if defined(UAP_CFG80211) || defined(STA_CFG80211) #if KERNEL_VERSION(3, 5, 0) <= CFG80211_VERSION_CODE void woal_cfg80211_notify_channel(moal_private *priv, - chan_band_info * pchan_info); -void woal_channel_switch_event(moal_private *priv, chan_band_info * pchan_info); + chan_band_info *pchan_info); +void woal_channel_switch_event(moal_private *priv, chan_band_info *pchan_info); #endif #endif @@ -470,41 +491,43 @@ #if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE void woal_bgscan_stop_event(moal_private *priv); void woal_cfg80211_notify_sched_scan_stop(moal_private *priv); -void woal_sched_scan_work_queue(struct work_struct *work); void woal_report_sched_scan_result(moal_private *priv); #endif #endif #if defined(UAP_CFG80211) || defined(STA_CFG80211) -void woal_cfg80211_notify_antcfg(moal_private *priv, - struct wiphy *wiphy, mlan_ds_radio_cfg *radio); +void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy, + mlan_ds_radio_cfg *radio); #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) void woal_deauth_event(moal_private *priv, int reason_code); +#endif #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE mlan_status woal_chandef_create(moal_private *priv, struct cfg80211_chan_def *chandef, - chan_band_info * pchan_info); + chan_band_info *pchan_info); #endif #if KERNEL_VERSION(4, 20, 0) <= CFG80211_VERSION_CODE void woal_cfg80211_setup_he_cap(moal_private *priv, struct ieee80211_supported_band *band); -void woal_cfg80211_free_iftype_data(struct wiphy *wiphy); +#else +void woal_cfg80211_setup_uap_he_cap(moal_private *priv, t_u8 wait_option); #endif +void woal_cfg80211_free_bands(struct wiphy *wiphy); +struct ieee80211_supported_band *woal_setup_wiphy_bands(t_u8 ieee_band); + void woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option); -int woal_cfg80211_mgmt_frame_ie(moal_private *priv, const t_u8 *beacon_ies, - size_t beacon_ies_len, - const t_u8 *proberesp_ies, - size_t proberesp_ies_len, - const t_u8 *assocresp_ies, - size_t assocresp_ies_len, - const t_u8 *probereq_ies, - size_t probereq_ies_len, t_u16 mask, - t_u8 wait_option); +int woal_cfg80211_mgmt_frame_ie( + moal_private *priv, const t_u8 *beacon_ies, size_t beacon_ies_len, + const t_u8 *proberesp_ies, size_t proberesp_ies_len, + const t_u8 *assocresp_ies, size_t assocresp_ies_len, + const t_u8 *probereq_ies, size_t probereq_ies_len, t_u16 mask, + t_u8 wait_option); int woal_get_active_intf_freq(moal_private *priv); @@ -517,6 +540,11 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, pmlan_ds_misc_assoc_rsp assoc_rsp); +void woal_clear_wiphy_dfs_state(struct wiphy *wiphy); +void woal_update_channel_dfs_state(t_u8 channel, t_u8 dfs_state); +int woal_get_wiphy_chan_dfs_state(struct wiphy *wiphy, + mlan_ds_11h_chan_dfs_state *ch_dfs_state); + mlan_status woal_reset_wifi(moal_handle *handle, t_u8 cnt, char *reason); #endif /* _MOAL_CFG80211_H_ */
diff --git a/wlan_sd8987/mlinux/moal_cfg80211_util.c b/wlan_sd8987/mlinux/moal_cfg80211_util.c index 22c71c6..0b885aa 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211_util.c +++ b/wlan_sd8987/mlinux/moal_cfg80211_util.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for CFG80211 vendor. * * - * Copyright 2015-2021 NXP + * Copyright 2015-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -45,135 +45,147 @@ /** vendor events */ static const struct nl80211_vendor_cmd_info vendor_events[] = { { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_hang, - }, /*event_id 0 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_hang, + }, /*event_id 0*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_fw_dump_done, - }, /*event_id 1 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_fw_dump_done, + }, /*event_id 1*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_rssi_monitor, - }, /*event_id 0x1501 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_fw_reset_success, + }, /*event_id 2*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_cloud_keep_alive, - }, /*event_id 0x10003 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_fw_reset_failure, + }, /*event_id 3*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_dfs_radar_detected, - }, /*event_id 0x10004 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_fw_reset_start, + }, /*event_id 4*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_dfs_cac_started, - }, /*event_id 0x10005 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_rssi_monitor, + }, /*event_id 0x1501*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_dfs_cac_finished, - }, /*event_id 0x10006 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_set_key_mgmt_offload, + }, /*event_id 0x10001*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_dfs_cac_aborted, - }, /*event_id 0x10007 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_fw_roam_success, + }, /*event_id 0x10002*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_dfs_nop_finished, - }, /*event_id 0x10008 */ + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_cloud_keep_alive, + }, /*event_id 0x10003*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_wifi_logger_ring_buffer_data, - }, + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_dfs_radar_detected, + }, /*event_id 0x10004*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_wifi_logger_alert, - }, + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_dfs_cac_started, + }, /*event_id 0x10005*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_packet_fate_monitor, - }, + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_dfs_cac_finished, + }, /*event_id 0x10006*/ { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = event_wake_reason_report, - }, + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_dfs_cac_aborted, + }, /*event_id 0x10007*/ + { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_dfs_nop_finished, + }, /*event_id 0x10008*/ + { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_wifi_logger_ring_buffer_data, + }, + { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_wifi_logger_alert, + }, + { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_packet_fate_monitor, + }, + { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = event_wake_reason_report, + }, /**add vendor event here*/ }; /**nxp vendor policies*/ #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE -static const struct -nla_policy woal_ll_stat_policy[ATTR_LL_STATS_MAX + 1] = { +static const struct nla_policy woal_ll_stat_policy[ATTR_LL_STATS_MAX + 1] = { [ATTR_LL_STATS_MPDU_SIZE_THRESHOLD] = {.type = NLA_U32}, [ATTR_LL_STATS_AGGRESSIVE_STATS_GATHERING] = {.type = NLA_U32}, [ATTR_LL_STATS_CLEAR_REQ_MASK] = {.type = NLA_U32}, - [ATTR_LL_STATS_STOP_REQ] = {.type = NLA_U8} -}; + [ATTR_LL_STATS_STOP_REQ] = {.type = NLA_U8}}; -static const struct -nla_policy woal_logger_policy[ATTR_WIFI_LOGGER_MAX + 1] = { +static const struct nla_policy woal_logger_policy[ATTR_WIFI_LOGGER_MAX + 1] = { [ATTR_WIFI_LOGGER_RING_ID] = {.type = NLA_STRING}, [ATTR_WIFI_LOGGER_VERBOSE_LEVEL] = {.type = NLA_U32}, [ATTR_WIFI_LOGGER_FLAGS] = {.type = NLA_U32}, [ATTR_WIFI_LOGGER_MIN_DATA_SIZE] = {.type = NLA_U32}, - [ATTR_WIFI_LOGGER_MAX_INTERVAL_SEC] = {.type = NLA_U32} -}; + [ATTR_WIFI_LOGGER_MAX_INTERVAL_SEC] = {.type = NLA_U32}}; -static const struct -nla_policy woal_attr_policy[ATTR_WIFI_MAX + 1] = { +static const struct nla_policy woal_attr_policy[ATTR_WIFI_MAX + 1] = { [ATTR_CHANNELS_BAND] = {.type = NLA_U32}, - [ATTR_SCAN_MAC_OUI_SET] = {.type = NLA_STRING,.len = 3}, + [ATTR_SCAN_MAC_OUI_SET] = {.type = NLA_STRING, .len = 3}, [ATTR_NODFS_VALUE] = {.type = NLA_U32}, [ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE_MAX] = {.type = NLA_U32}, - [ATTR_WIFI_LATENCY_MODE] = {.type = NLA_U8}, }; // clang-format off static const struct nla_policy - woal_nd_offload_policy[ATTR_ND_OFFLOAD_MAX + 1] = { - [ATTR_ND_OFFLOAD_CONTROL] = {.type = NLA_U8}, + woal_nd_offload_policy[ATTR_ND_OFFLOAD_MAX + 1] = { + [ATTR_ND_OFFLOAD_CONTROL] = {.type = NLA_U8}, }; - // clang-format on -static const struct -nla_policy woal_rssi_monitor_policy[ATTR_RSSI_MONITOR_MAX + 1] = { - [ATTR_RSSI_MONITOR_CONTROL] = {.type = NLA_U32}, - [ATTR_RSSI_MONITOR_MIN_RSSI] = {.type = NLA_S8}, - [ATTR_RSSI_MONITOR_MAX_RSSI] = {.type = NLA_S8}, +static const struct nla_policy + woal_rssi_monitor_policy[ATTR_RSSI_MONITOR_MAX + 1] = { + [ATTR_RSSI_MONITOR_CONTROL] = {.type = NLA_U32}, + [ATTR_RSSI_MONITOR_MIN_RSSI] = {.type = NLA_S8}, + [ATTR_RSSI_MONITOR_MAX_RSSI] = {.type = NLA_S8}, }; -static const struct -nla_policy woal_packet_filter_policy[ATTR_PACKET_FILTER_MAX + 1] = { - [ATTR_PACKET_FILTER_TOTAL_LENGTH] = {.type = NLA_U32}, - [ATTR_PACKET_FILTER_PROGRAM] = {.type = NLA_STRING}, +static const struct nla_policy + woal_packet_filter_policy[ATTR_PACKET_FILTER_MAX + 1] = { + [ATTR_PACKET_FILTER_TOTAL_LENGTH] = {.type = NLA_U32}, + [ATTR_PACKET_FILTER_PROGRAM] = {.type = NLA_STRING}, }; // clang-format off static const struct nla_policy - woal_fw_roaming_policy[MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX + 1] = { - [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONTROL] = {.type = NLA_U32}, - [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_BSSID] = { - .type = NLA_BINARY}, - [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_SSID] = { - .type = NLA_BINARY}, + woal_fw_roaming_policy[MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX + 1] = { + [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONTROL] = {.type = NLA_U32}, + [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_BSSID] = { + .type = NLA_BINARY}, + [MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_SSID] = { + .type = NLA_BINARY}, }; - // clang-format on -static const struct -nla_policy woal_keep_alive_policy[MKEEP_ALIVE_ATTRIBUTE_MAX + 1] = { - [MKEEP_ALIVE_ATTRIBUTE_ID] = {.type = NLA_U8}, - [MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE] = {.type = NLA_U16}, - [MKEEP_ALIVE_ATTRIBUTE_IP_PKT] = {.type = NLA_BINARY}, - [MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN] = {.type = NLA_U16}, - [MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR] = {.type = NLA_STRING,.len = - ETH_ALEN}, - [MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR] = {.type = NLA_STRING,.len = - ETH_ALEN}, - [MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC] = {.type = NLA_U32}, - [MKEEP_ALIVE_ATTRIBUTE_RETRY_INTERVAL] = {.type = NLA_U32}, - [MKEEP_ALIVE_ATTRIBUTE_RETRY_CNT] = {.type = NLA_U8}, +static const struct nla_policy + woal_keep_alive_policy[MKEEP_ALIVE_ATTRIBUTE_MAX + 1] = { + [MKEEP_ALIVE_ATTRIBUTE_ID] = {.type = NLA_U8}, + [MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE] = {.type = NLA_U16}, + [MKEEP_ALIVE_ATTRIBUTE_IP_PKT] = {.type = NLA_BINARY}, + [MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN] = {.type = NLA_U16}, + [MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR] = {.type = NLA_STRING, + .len = ETH_ALEN}, + [MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR] = {.type = NLA_STRING, + .len = ETH_ALEN}, + [MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC] = {.type = NLA_U32}, + [MKEEP_ALIVE_ATTRIBUTE_RETRY_INTERVAL] = {.type = NLA_U32}, + [MKEEP_ALIVE_ATTRIBUTE_RETRY_CNT] = {.type = NLA_U8}, }; #endif @@ -184,8 +196,7 @@ * * @return index of events array */ -static int -woal_get_event_id(int event) +static int woal_get_event_id(int event) { int i = 0; @@ -207,8 +218,8 @@ * * @return 0: success 1: fail */ -int -woal_cfg80211_vendor_event(moal_private *priv, int event, t_u8 *data, int len) +int woal_cfg80211_vendor_event(moal_private *priv, int event, t_u8 *data, + int len) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -255,6 +266,7 @@ return ret; } +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE /** * @brief send fw dump complete event to vendorhal * @@ -262,14 +274,13 @@ * * @return N/A */ -void -woal_cfg80211_vendor_event_fw_dump(moal_private *priv) +void woal_cfg80211_vendor_event_fw_dump(moal_private *priv) { PRINTM(MEVENT, "wlan: Notify FW dump complete event\n"); - woal_cfg80211_vendor_event(priv, event_fw_dump_done, - CUS_EVT_FW_DUMP, strlen(CUS_EVT_FW_DUMP)); - + woal_cfg80211_vendor_event(priv, event_fw_dump_done, CUS_EVT_FW_DUMP, + strlen(CUS_EVT_FW_DUMP)); } +#endif /** * @brief send dfs vendor event to kernel @@ -280,9 +291,8 @@ * * @return N/A */ -void -woal_cfg80211_dfs_vendor_event(moal_private *priv, int event, - struct cfg80211_chan_def *chandef) +void woal_cfg80211_dfs_vendor_event(moal_private *priv, int event, + struct cfg80211_chan_def *chandef) { dfs_event evt; @@ -333,10 +343,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_set_drvdbg(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_set_drvdbg(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { #ifdef DEBUG_LEVEL1 struct net_device *dev = wdev->netdev; @@ -387,9 +396,9 @@ * * @return 0: success other: fail */ -static mlan_status -woal_band_to_valid_channels(moal_private *priv, - wifi_band w_band, int channel[], t_u32 *nchannel) +static mlan_status woal_band_to_valid_channels(moal_private *priv, + wifi_band w_band, int channel[], + t_u32 *nchannel) { int band = 0; struct ieee80211_supported_band *sband; @@ -450,10 +459,9 @@ * * @return 0: success other: fail */ -static int -woal_cfg80211_subcmd_get_valid_channels(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_get_valid_channels(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -470,9 +478,10 @@ err = nla_parse(tb, ATTR_WIFI_MAX, data, len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (err) { PRINTM(MERROR, "%s: nla_parse fail\n", __func__); err = -EFAULT; @@ -480,8 +489,8 @@ } if (!tb[ATTR_CHANNELS_BAND]) { - PRINTM(MERROR, "%s: null attr: tb[ATTR_GET_CH]=%p\n", - __func__, tb[ATTR_CHANNELS_BAND]); + PRINTM(MERROR, "%s: null attr: tb[ATTR_GET_CH]=%p\n", __func__, + tb[ATTR_CHANNELS_BAND]); err = -EINVAL; goto done; } @@ -502,7 +511,7 @@ } mem_needed = nla_total_size(nchannel * sizeof(ch_out[0])) + - nla_total_size(sizeof(nchannel)) + VENDOR_REPLY_OVERHEAD; + nla_total_size(sizeof(nchannel)) + VENDOR_REPLY_OVERHEAD; /* Alloc the SKB for vendor_event */ skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed); if (unlikely(!skb)) { @@ -540,10 +549,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_drv_version(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_drv_version(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -551,7 +559,7 @@ t_u32 reply_len = 0; int ret = 0; t_u32 drv_len = 0; - char drv_version[MLAN_MAX_VER_STR_LEN] = { 0 }; + char drv_version[MLAN_MAX_VER_STR_LEN] = {0}; char *pos; ENTER(); @@ -597,10 +605,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_fw_version(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_fw_version(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -608,7 +615,8 @@ t_u32 reply_len = 0; char end_c = '\0'; int ret = 0; - char fw_ver[32] = { 0 }; + char fw_ver[32] = {0}; + t_u8 hotfix_ver = 0; union { t_u32 l; t_u8 c[4]; @@ -616,9 +624,15 @@ ENTER(); + hotfix_ver = priv->phandle->fw_hotfix_version; ver.l = priv->phandle->fw_release_number; - snprintf(fw_ver, sizeof(fw_ver), "%u.%u.%u.p%u%c", ver.c[2], ver.c[1], - ver.c[0], ver.c[3], end_c); + if (hotfix_ver) { + snprintf(fw_ver, sizeof(fw_ver), "%u.%u.%u.p%u.%u%c", ver.c[2], + ver.c[1], ver.c[0], ver.c[3], hotfix_ver, end_c); + } else { + snprintf(fw_ver, sizeof(fw_ver), "%u.%u.%u.p%u%c", ver.c[2], + ver.c[1], ver.c[0], ver.c[3], end_c); + } reply_len = strlen(fw_ver) + 1; /** Allocate skb for cmd reply*/ @@ -648,10 +662,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_fw_dump(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_fw_dump(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = NULL; moal_private *priv = NULL; @@ -699,10 +712,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_drv_dump(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_drv_dump(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = NULL; moal_private *priv = NULL; @@ -759,42 +771,45 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_supp_feature_set(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_supp_feature_set(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len) { struct sk_buff *skb = NULL; + struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); mlan_fw_info fw_info; + t_u32 reply_len = 0; int ret = 0; t_u32 supp_feature_set = 0; ENTER(); - supp_feature_set = WLAN_FEATURE_INFRA #if defined(UAP_SUPPORT) && defined(STA_SUPPORT) - | WLAN_FEATURE_AP_STA + | WLAN_FEATURE_AP_STA #endif -#if defined(WIFI_LATENCY_MODE_SUPPORT) - | WLAN_FEATURE_SET_LATENCY_MODE -#endif - | WLAN_FEATURE_LINK_LAYER_STATS - | WLAN_FEATURE_LOGGER - | WLAN_FEATURE_RSSI_MONITOR | WLAN_FEATURE_CONFIG_NDO - | WLAN_FEATURE_SCAN_RAND -//#ifdef RTT_SUPPORT -// | WLAN_FEATURE_D2AP_RTT -//#endif - | WLAN_FEATURE_TDLS - | WLAN_FEATURE_MKEEP_ALIVE; + | WLAN_FEATURE_LINK_LAYER_STATS | + WLAN_FEATURE_LOGGER | WLAN_FEATURE_RSSI_MONITOR | + WLAN_FEATURE_CONFIG_NDO | WLAN_FEATURE_SCAN_RAND | + WLAN_FEATURE_MKEEP_ALIVE | WLAN_FEATURE_PNO | + WLAN_FEATURE_TDLS; memset(&fw_info, 0, sizeof(mlan_fw_info)); - woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info)) { + PRINTM(MERROR, "Fail to get fw info\n"); + ret = -EFAULT; + goto done; + } if (fw_info.fw_bands & BAND_A) supp_feature_set |= WLAN_FEATURE_INFRA_5G; + if (fw_info.fw_roaming_support) + supp_feature_set |= WLAN_FEATURE_CONTROL_ROAMING; + + priv->phandle->wifi_hal_flag = MTRUE; reply_len = sizeof(supp_feature_set); /** Allocate skb for cmd reply*/ @@ -818,76 +833,6 @@ return ret; } -#if defined(WIFI_LATENCY_MODE_SUPPORT) -/** - * @brief vendor command to set Wi-Fi latency mode - * - * @param wiphy A pointer to wiphy struct - * @param wdev A pointer to wireless_dev struct - * @param data a pointer to data - * @param len data length - * - * @return 0: success 1: fail - */ -static int woal_cfg80211_subcmd_set_wifi_latency_mode(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) -{ - int ret, rem, type; - u8 latency_mode; - struct net_device *dev = wdev->netdev; - moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); - const struct nlattr *iter; - t_u32 reply_len = 0; - struct sk_buff *skb = NULL; - mlan_status op_status = MLAN_STATUS_SUCCESS; - - PRINTM(MMSG, "wlan: enter subcmd_set_wifi_latency_mode"); - ENTER(); - - nla_for_each_attr(iter, data, data_len, rem) { - type = nla_type(iter); - if (ATTR_WIFI_LATENCY_MODE != type) { - PRINTM(MERROR, "%s. Unknown type: %d\n", __FUNCTION__, type); - ret = 1; - goto done; - } - - latency_mode = nla_get_u8(iter); - /* WIFI_LATENCY_MODE_LOW : 1, WIFI_LATENCY_MODE_NORMAL : 0 */ - if (1 != latency_mode && 0 != latency_mode) { - PRINTM(MERROR, "%s. Invalid Wi-Fi latency mode: %d\n", __FUNCTION__, latency_mode); - ret = 1; - goto done; - } - op_status = woal_set_wifi_low_latency_mode(priv, latency_mode); - - if (MLAN_STATUS_SUCCESS != op_status) { - PRINTM(MERROR, "Set latency mode to %d failed", latency_mode); - ret = 1; - goto done; - } - } - - /** Allocate skb for cmd reply*/ - skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, reply_len); - if (!skb) { - PRINTM(MERROR, "Allocate memory fail for vendor cmd\n"); - ret = 1; - goto done; - } - ret = cfg80211_vendor_cmd_reply(skb); - if (ret) { - PRINTM(MERROR, "Vendor command reply failed ret = %d\n", ret); - ret = 1; - } - -done: - LEAVE(); - return ret; -} -#endif // defined(WIFI_LATENCY_MODE_SUPPORT) - /** * @brief vendor command to set country code * @@ -898,20 +843,19 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_set_country_code(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_set_country_code(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct sk_buff *skb = NULL; t_u32 reply_len = 0; int ret = 0, rem, type; const struct nlattr *iter; - char country[COUNTRY_CODE_LEN] = { 0 }; + char country[COUNTRY_CODE_LEN] = {0}; ENTER(); - nla_for_each_attr(iter, data, data_len, rem) { + nla_for_each_attr (iter, data, data_len, rem) { type = nla_type(iter); switch (type) { case ATTR_COUNTRY_CODE: @@ -954,11 +898,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_wifi_logger_supp_feature_set(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, - int data_len) +static int woal_cfg80211_subcmd_get_wifi_logger_supp_feature_set( + struct wiphy *wiphy, struct wireless_dev *wdev, const void *data, + int data_len) { struct sk_buff *skb = NULL; t_u32 reply_len = 0; @@ -999,20 +941,19 @@ * * @return void */ -static void -woal_get_ring_status(moal_private *priv, int ring_id, - wifi_ring_buffer_status * status) +static void woal_get_ring_status(moal_private *priv, int ring_id, + wifi_ring_buffer_status *status) { int id = 0; wifi_ring_buffer *ring; ENTER(); for (id = 0; id < RING_ID_MAX; id++) { - ring = (wifi_ring_buffer *) priv->rings[id]; + ring = (wifi_ring_buffer *)priv->rings[id]; if (ring && VALID_RING(ring->ring_id) && ring_id == ring->ring_id) { - strncpy(status->name, ring->name, - sizeof(status->name) - 1); + moal_memcpy(priv->phandle, status->name, ring->name, + sizeof(status->name) - 1); status->ring_id = ring->ring_id; status->ring_buffer_byte_size = ring->ring_size; status->written_bytes = ring->ctrl.written_bytes; @@ -1041,10 +982,10 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_ring_buff_status(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_get_ring_buff_status(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -1104,8 +1045,7 @@ * * @return An invalid ring id for failure or valid ring id on success. */ -int -woal_get_ring_id_by_name(moal_private *priv, char *ring_name) +int woal_get_ring_id_by_name(moal_private *priv, char *ring_name) { int id; wifi_ring_buffer *ring; @@ -1113,7 +1053,7 @@ ENTER(); for (id = 0; id < RING_ID_MAX; id++) { - ring = (wifi_ring_buffer *) priv->rings[id]; + ring = (wifi_ring_buffer *)priv->rings[id]; if (ring && !strncmp(ring->name, ring_name, sizeof(ring->name) - 1)) break; @@ -1135,9 +1075,8 @@ * * @return 0: success 1: fail */ -int -woal_start_logging(moal_private *priv, char *ring_name, int log_level, - int flags, int time_intval, int threshold) +int woal_start_logging(moal_private *priv, char *ring_name, int log_level, + int flags, int time_intval, int threshold) { int ret = 0; int ring_id; @@ -1156,7 +1095,7 @@ "%s , log_level : %d, time_intval : %d, threshod %d Bytes\n", __func__, log_level, time_intval, threshold); - ring_buffer = (wifi_ring_buffer *) priv->rings[ring_id]; + ring_buffer = (wifi_ring_buffer *)priv->rings[ring_id]; if (!ring_buffer || ring_buffer->state == RING_STOP) { PRINTM(MERROR, "Ring is stopped!\n"); ret = -EAGAIN; @@ -1196,13 +1135,12 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_start_logging(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_start_logging(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { int ret = 0, rem, type; - char ring_name[RING_NAME_MAX] = { 0 }; + char ring_name[RING_NAME_MAX] = {0}; int log_level = 0, flags = 0, time_intval = 0, threshold = 0; const struct nlattr *iter; struct net_device *dev = wdev->netdev; @@ -1210,7 +1148,7 @@ ENTER(); - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case ATTR_WIFI_LOGGER_RING_ID: @@ -1253,8 +1191,7 @@ * * @return 0: success 1: fail */ -static int -woal_trigger_get_ring_data(moal_private *priv, char *ring_name) +static int woal_trigger_get_ring_data(moal_private *priv, char *ring_name) { int ret = 0; int ring_id; @@ -1269,7 +1206,7 @@ goto done; } - ring_buffer = (wifi_ring_buffer *) priv->rings[ring_id]; + ring_buffer = (wifi_ring_buffer *)priv->rings[ring_id]; if (!ring_buffer) { PRINTM(MERROR, "invalid ring_buffer\n"); ret = -EINVAL; @@ -1294,20 +1231,19 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_ring_data(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_get_ring_data(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { int ret = 0, rem, type; - char ring_name[RING_NAME_MAX] = { 0 }; + char ring_name[RING_NAME_MAX] = {0}; const struct nlattr *iter; struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); ENTER(); - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case ATTR_WIFI_LOGGER_RING_ID: @@ -1338,8 +1274,7 @@ * * @return void */ -static void -woal_ring_reset(wifi_ring_buffer * ring) +static void woal_ring_reset(wifi_ring_buffer *ring) { ENTER(); ring->wp = 0; @@ -1358,16 +1293,16 @@ * * @return A pointer to wifi_ring_buffer_entry struct */ -static wifi_ring_buffer_entry * -woal_get_ring_entry(wifi_ring_buffer * ring, t_u32 offset) +static wifi_ring_buffer_entry *woal_get_ring_entry(wifi_ring_buffer *ring, + t_u32 offset) { wifi_ring_buffer_entry *entry = - (wifi_ring_buffer_entry *) (ring->ring_buf + offset); + (wifi_ring_buffer_entry *)(ring->ring_buf + offset); ENTER(); if (!entry->entry_size) - return (wifi_ring_buffer_entry *) ring->ring_buf; + return (wifi_ring_buffer_entry *)ring->ring_buf; LEAVE(); return entry; @@ -1381,17 +1316,16 @@ * * @return offset of next entry */ -static t_u32 -woal_get_ring_next_entry(wifi_ring_buffer * ring, t_u32 offset) +static t_u32 woal_get_ring_next_entry(wifi_ring_buffer *ring, t_u32 offset) { wifi_ring_buffer_entry *entry = - (wifi_ring_buffer_entry *) (ring->ring_buf + offset); + (wifi_ring_buffer_entry *)(ring->ring_buf + offset); wifi_ring_buffer_entry *next_entry = NULL; ENTER(); if (!entry->entry_size) { - entry = (wifi_ring_buffer_entry *) ring->ring_buf; + entry = (wifi_ring_buffer_entry *)ring->ring_buf; LEAVE(); return ENTRY_LENGTH(entry); } @@ -1400,8 +1334,8 @@ LEAVE(); return 0; } - next_entry = (wifi_ring_buffer_entry *) (ring->ring_buf + offset + - ENTRY_LENGTH(entry)); + next_entry = (wifi_ring_buffer_entry *)(ring->ring_buf + offset + + ENTRY_LENGTH(entry)); if (!next_entry->entry_size) { /* move to head */ LEAVE(); @@ -1421,8 +1355,8 @@ * * @return data length */ -int -woal_ring_pull_data(moal_private *priv, int ring_id, void *data, t_s32 buf_len) +int woal_ring_pull_data(moal_private *priv, int ring_id, void *data, + t_s32 buf_len) { t_s32 r_len = 0; wifi_ring_buffer *ring; @@ -1431,7 +1365,7 @@ ENTER(); - ring = (wifi_ring_buffer *) priv->rings[ring_id]; + ring = (wifi_ring_buffer *)priv->rings[ring_id]; /* get a fresh pending length */ while (buf_left > 0) { @@ -1468,10 +1402,9 @@ * * @return 0: success 1: fail */ -int -woal_ring_buffer_data_vendor_event(moal_private *priv, int ring_id, - t_u8 *data, int len, - wifi_ring_buffer_status * ring_status) +int woal_ring_buffer_data_vendor_event(moal_private *priv, int ring_id, + t_u8 *data, int len, + wifi_ring_buffer_status *ring_status) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -1534,10 +1467,9 @@ * * @return void */ -static void -woal_ring_data_send(moal_private *priv, int ring_id, - const void *data, const t_u32 len, - wifi_ring_buffer_status * ring_status) +static void woal_ring_data_send(moal_private *priv, int ring_id, + const void *data, const t_u32 len, + wifi_ring_buffer_status *ring_status) { struct net_device *ndev = priv->netdev; @@ -1559,8 +1491,7 @@ * * @return void */ -void -woal_ring_poll_worker(struct work_struct *work) +void woal_ring_poll_worker(struct work_struct *work) { struct delayed_work *d_work = to_delayed_work(work); wifi_ring_buffer *ring_info = @@ -1604,14 +1535,14 @@ rlen = woal_ring_pull_data(priv, ringid, buf, buflen); spin_unlock_irqrestore(&ring_info->lock, flags); - hdr = (wifi_ring_buffer_entry *) buf; + hdr = (wifi_ring_buffer_entry *)buf; while (rlen > 0) { ring_status.read_bytes += ENTRY_LENGTH(hdr); - woal_ring_data_send(priv, ringid, hdr, - ENTRY_LENGTH(hdr), &ring_status); + woal_ring_data_send(priv, ringid, hdr, ENTRY_LENGTH(hdr), + &ring_status); rlen -= ENTRY_LENGTH(hdr); - hdr = (wifi_ring_buffer_entry *) ((void *)hdr + - ENTRY_LENGTH(hdr)); + hdr = (wifi_ring_buffer_entry *)((void *)hdr + + ENTRY_LENGTH(hdr)); } exit: kfree(buf); @@ -1631,9 +1562,8 @@ * * @return 0: success -1: fail */ -int -woal_ring_push_data(moal_private *priv, int ring_id, - wifi_ring_buffer_entry * hdr, void *data) +int woal_ring_push_data(moal_private *priv, int ring_id, + wifi_ring_buffer_entry *hdr, void *data) { unsigned long flags; t_u32 w_len; @@ -1643,7 +1573,7 @@ ENTER(); - ring = (wifi_ring_buffer *) priv->rings[ring_id]; + ring = (wifi_ring_buffer *)priv->rings[ring_id]; if (!ring || ring->state != RING_ACTIVE) { PRINTM(MERROR, "Ring is not active\n"); @@ -1671,7 +1601,7 @@ /* full, we should drop one entry */ w_entry = (wifi_ring_buffer_entry - *) (ring->ring_buf + ring->rp); + *)(ring->ring_buf + ring->rp); ring->rp = woal_get_ring_next_entry(ring, ring->rp); ring->ctrl.written_bytes -= @@ -1688,12 +1618,10 @@ if (ring->rp == 0) { /** drop one entry */ w_entry = (wifi_ring_buffer_entry - *) (ring->ring_buf + - ring->rp); - ring->rp = - woal_get_ring_next_entry(ring, - ring-> - rp); + *)(ring->ring_buf + + ring->rp); + ring->rp = woal_get_ring_next_entry( + ring, ring->rp); ring->ctrl.written_bytes -= ENTRY_LENGTH(w_entry); memset((u8 *)w_entry, 0, @@ -1709,7 +1637,7 @@ /** drop one entry */ w_entry = (wifi_ring_buffer_entry - *) (ring->ring_buf + ring->rp); + *)(ring->ring_buf + ring->rp); ring->rp = woal_get_ring_next_entry(ring, ring->rp); ring->ctrl.written_bytes -= @@ -1731,7 +1659,7 @@ goto done; } - w_entry = (wifi_ring_buffer_entry *) (ring->ring_buf + ring->wp); + w_entry = (wifi_ring_buffer_entry *)(ring->ring_buf + ring->wp); /* header */ moal_memcpy_ext(priv->phandle, w_entry, hdr, RING_ENTRY_SIZE, ENTRY_LENGTH(w_entry)); @@ -1774,9 +1702,9 @@ * * @return 0 - success */ -static int -woal_init_ring_buffer_internal(moal_private *priv, void **ring, - t_u16 ringIdx, t_u8 *name, t_u32 ring_sz) +static int woal_init_ring_buffer_internal(moal_private *priv, void **ring, + t_u16 ringIdx, t_u8 *name, + t_u32 ring_sz) { unsigned long flags; wifi_ring_buffer *ring_buff; @@ -1789,7 +1717,7 @@ goto done; } memset(*ring, 0, sizeof(wifi_ring_buffer)); - ring_buff = (wifi_ring_buffer *) * ring; + ring_buff = (wifi_ring_buffer *)*ring; ring_buff->ring_buf = vmalloc(ring_sz); if (!unlikely(ring_buff->ring_buf)) { @@ -1824,8 +1752,7 @@ * * @return data length */ -static int -woal_init_ring_buffer(moal_private *priv) +static int woal_init_ring_buffer(moal_private *priv) { ENTER(); woal_init_ring_buffer_internal(priv, &priv->rings[VERBOSE_RING_ID], @@ -1845,8 +1772,7 @@ * * @return data length */ -static int -woal_deinit_ring_buffer(moal_private *priv) +static int woal_deinit_ring_buffer(moal_private *priv) { int i; enum ring_state ring_state = RING_STOP; @@ -1856,13 +1782,15 @@ ENTER(); for (i = 0; i < RING_ID_MAX; i++) { - ring_buff = (wifi_ring_buffer *) priv->rings[i]; + ring_buff = (wifi_ring_buffer *)priv->rings[i]; if (!ring_buff) continue; spin_lock_irqsave(&ring_buff->lock, lock_flags); ring_state = ring_buff->state; - if (ring_state == RING_ACTIVE) + if (ring_state == RING_ACTIVE) { ring_buff->state = RING_STOP; + ring_buff->interval = 0; + } spin_unlock_irqrestore(&ring_buff->lock, lock_flags); if (ring_state == RING_ACTIVE) cancel_delayed_work_sync(&ring_buff->work); @@ -1886,10 +1814,9 @@ * * @return 0: success -1: fail */ -int -woal_ring_event_logger(moal_private *priv, int ring_id, pmlan_event pmevent) +int woal_ring_event_logger(moal_private *priv, int ring_id, pmlan_event pmevent) { - t_u8 event_buf[100] = { 0 }; + t_u8 event_buf[100] = {0}; wifi_ring_buffer_driver_connectivity_event *connectivity_event; tlv_log *tlv; t_u8 *pos; @@ -1897,7 +1824,7 @@ wifi_ring_buffer *ring; ENTER(); - ring = (wifi_ring_buffer *) priv->rings[ring_id]; + ring = (wifi_ring_buffer *)priv->rings[ring_id]; if (!ring || ring->state != RING_ACTIVE) { PRINTM(MINFO, "Ring is not active\n"); @@ -1908,67 +1835,68 @@ case MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER: if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { assoc_logger_data *pbss_desc = - (assoc_logger_data *) pmevent->event_buf; + (assoc_logger_data *)pmevent->event_buf; memset(&msg_hdr, 0, sizeof(msg_hdr)); msg_hdr.flags |= RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP; msg_hdr.type = ENTRY_TYPE_CONNECT_EVENT; connectivity_event = (wifi_ring_buffer_driver_connectivity_event *) - event_buf; + event_buf; connectivity_event->event = WIFI_EVENT_ASSOC_COMPLETE; pos = (t_u8 *)connectivity_event->tlvs; - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_VENDOR_SPECIFIC; tlv->length = MLAN_MAC_ADDR_LENGTH / 2; moal_memcpy_ext(priv->phandle, tlv->value, pbss_desc->oui, tlv->length, sizeof(event_buf) - - (tlv->value - event_buf)); + (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + TLV_LOG_HEADER_LEN; pos = pos + tlv->length + TLV_LOG_HEADER_LEN; - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_BSSID; tlv->length = sizeof(pbss_desc->bssid); - moal_memcpy_ext(priv->phandle, tlv->value, - pbss_desc->bssid, - sizeof(pbss_desc->bssid), - sizeof(event_buf) - (tlv->value - - event_buf)); + moal_memcpy_ext( + priv->phandle, tlv->value, pbss_desc->bssid, + sizeof(pbss_desc->bssid), + sizeof(event_buf) - (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + TLV_LOG_HEADER_LEN; pos = pos + tlv->length + TLV_LOG_HEADER_LEN; - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_SSID; tlv->length = strlen(pbss_desc->ssid); moal_memcpy_ext(priv->phandle, tlv->value, pbss_desc->ssid, tlv->length, sizeof(event_buf) - - (tlv->value - event_buf)); + (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + TLV_LOG_HEADER_LEN; pos = pos + tlv->length + TLV_LOG_HEADER_LEN; if (pbss_desc->rssi) { - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_RSSI; tlv->length = sizeof(pbss_desc->rssi); - moal_memcpy_ext(priv->phandle, tlv->value, - &pbss_desc->rssi, tlv->length, - sizeof(event_buf) - + moal_memcpy_ext( + priv->phandle, tlv->value, + &pbss_desc->rssi, tlv->length, + sizeof(event_buf) - (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + TLV_LOG_HEADER_LEN; pos = pos + tlv->length + TLV_LOG_HEADER_LEN; } if (pbss_desc->channel) { - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_CHANNEL; tlv->length = sizeof(pbss_desc->channel); - moal_memcpy_ext(priv->phandle, tlv->value, - &pbss_desc->channel, - sizeof(pbss_desc->channel), - sizeof(event_buf) - + moal_memcpy_ext( + priv->phandle, tlv->value, + &pbss_desc->channel, + sizeof(pbss_desc->channel), + sizeof(event_buf) - (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + TLV_LOG_HEADER_LEN; @@ -1990,16 +1918,16 @@ msg_hdr.type = ENTRY_TYPE_CONNECT_EVENT; connectivity_event = (wifi_ring_buffer_driver_connectivity_event *) - event_buf; + event_buf; connectivity_event->event = WIFI_EVENT_ASSOC_COMPLETE; pos = (t_u8 *)connectivity_event->tlvs; - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_STATUS; tlv->length = sizeof(status_code); moal_memcpy_ext(priv->phandle, tlv->value, &status_code, sizeof(status_code), sizeof(event_buf) - - (tlv->value - event_buf)); + (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + 4; msg_hdr.entry_size += sizeof(connectivity_event->event); woal_ring_push_data(priv, ring_id, &msg_hdr, @@ -2015,16 +1943,16 @@ msg_hdr.type = ENTRY_TYPE_CONNECT_EVENT; connectivity_event = (wifi_ring_buffer_driver_connectivity_event *) - event_buf; + event_buf; connectivity_event->event = WIFI_EVENT_ASSOC_COMPLETE; pos = (t_u8 *)connectivity_event->tlvs; - tlv = (tlv_log *) pos; + tlv = (tlv_log *)pos; tlv->tag = WIFI_TAG_REASON_CODE; tlv->length = sizeof(reason_code); moal_memcpy_ext(priv->phandle, tlv->value, &reason_code, sizeof(reason_code), sizeof(event_buf) - - (tlv->value - event_buf)); + (tlv->value - event_buf)); msg_hdr.entry_size += tlv->length + 4; msg_hdr.entry_size += sizeof(connectivity_event->event); woal_ring_push_data(priv, ring_id, &msg_hdr, @@ -2047,9 +1975,8 @@ * * @return 0: success 1: fail */ -int -woal_wake_reason_vendor_event(moal_private *priv, - mlan_ds_hs_wakeup_reason wake_reason) +int woal_wake_reason_vendor_event(moal_private *priv, + mlan_ds_hs_wakeup_reason wake_reason) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -2109,9 +2036,8 @@ * * @return 0: success -1: fail */ -int -woal_wake_reason_logger(moal_private *priv, - mlan_ds_hs_wakeup_reason wake_reason) +int woal_wake_reason_logger(moal_private *priv, + mlan_ds_hs_wakeup_reason wake_reason) { int ret = 0; @@ -2182,12 +2108,10 @@ * * @return 0: success 1: fail */ -int -woal_packet_fate_vendor_event(moal_private *priv, - packet_fate_packet_type pkt_type, - t_u8 fate, frame_type payload_type, - t_u32 drv_ts_usec, t_u32 fw_ts_usec, - t_u8 *data, t_u32 len) +int woal_packet_fate_vendor_event(moal_private *priv, + packet_fate_packet_type pkt_type, t_u8 fate, + frame_type payload_type, t_u32 drv_ts_usec, + t_u32 fw_ts_usec, t_u8 *data, t_u32 len) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -2217,9 +2141,8 @@ len + sizeof(PACKET_FATE_REPORT), event_id, GFP_ATOMIC); #else - skb = cfg80211_vendor_event_alloc(wiphy, - len + sizeof(PACKET_FATE_REPORT), - event_id, GFP_ATOMIC); + skb = cfg80211_vendor_event_alloc( + wiphy, len + sizeof(PACKET_FATE_REPORT), event_id, GFP_ATOMIC); #endif if (!skb) { @@ -2279,11 +2202,10 @@ * * @return 0: success -1: fail */ -int -woal_packet_fate_monitor(moal_private *priv, - packet_fate_packet_type pkt_type, t_u8 fate, - frame_type payload_type, t_u32 drv_ts_usec, - t_u32 fw_ts_usec, t_u8 *data, t_u32 len) +int woal_packet_fate_monitor(moal_private *priv, + packet_fate_packet_type pkt_type, t_u8 fate, + frame_type payload_type, t_u32 drv_ts_usec, + t_u32 fw_ts_usec, t_u8 *data, t_u32 len) { int ret = 0; @@ -2306,8 +2228,7 @@ * * @return 0: success -1: fail */ -static int -woal_init_packet_filter(moal_private *priv) +static int woal_init_packet_filter(moal_private *priv) { int ret = 0; packet_filter *pkt_filter = NULL; @@ -2343,8 +2264,7 @@ * * @return 0: success -1: fail */ -static int -woal_deinit_packet_filter(moal_private *priv) +static int woal_deinit_packet_filter(moal_private *priv) { int ret = 0; packet_filter *pkt_filter = NULL; @@ -2379,10 +2299,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_set_packet_filter(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_set_packet_filter(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -2401,7 +2320,7 @@ goto done; } - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case ATTR_PACKET_FILTER_TOTAL_LENGTH: @@ -2451,11 +2370,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_get_packet_filter_capability(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, - int data_len) +static int woal_cfg80211_subcmd_get_packet_filter_capability( + struct wiphy *wiphy, struct wireless_dev *wdev, const void *data, + int data_len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -2473,7 +2390,7 @@ } reply_len = sizeof(pkt_filter->packet_filter_version) + - sizeof(pkt_filter->packet_filter_max_len); + sizeof(pkt_filter->packet_filter_max_len); /** Allocate skb for cmd reply*/ skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, reply_len); if (!skb) { @@ -2514,16 +2431,15 @@ * @return non-zero if packet should be passed to AP, zero if * packet should be dropped. */ -int -process_packet(const t_u8 *program, t_u32 program_len, const t_u8 *packet, - t_u32 packet_len, t_u32 filter_age) +int process_packet(const t_u8 *program, t_u32 program_len, const t_u8 *packet, + t_u32 packet_len, t_u32 filter_age) { /* Program counter */ t_u32 pc = 0; /* Memory slot values. */ - t_u32 mem[MEM_ITEMS] = { }; + t_u32 mem[MEM_ITEMS] = {}; /* Register values. */ - t_u32 reg[2] = { }; + t_u32 reg[2] = {}; /* Number of instructions remaining to execute. This is done to make * sure there is upper bound on execution time. It should never be hit * and is only for safety. Initialize to the number of bytes in the @@ -2551,11 +2467,11 @@ /* Is offset within packet bounds? */ #define WITHIN_PACKET_BOUNDS(p) (ENFORCE_UNSIGNED(p) && (p) < packet_len) /* Verify an internal condition and accept packet if it fails. */ -#define ASSERT_RETURN(c) \ -do { \ - if (!(c)) \ - return PASS_PKT; \ -} while (0) +#define ASSERT_RETURN(c) \ + do { \ + if (!(c)) \ + return PASS_PKT; \ + } while (0) /* If not within program bounds, Accept the packet */ #define ASSERT_WITHIN_PROGRAM_BOUNDS(p) ASSERT_RETURN(WITHIN_PROGRAM_BOUNDS(p)) /* If not within packet bounds, Accept the packet */ @@ -2608,43 +2524,43 @@ case NXP_LDW_OPCODE: case NXP_LDBX_OPCODE: case NXP_LDHX_OPCODE: - case NXP_LDWX_OPCODE:{ - offs = imm; - if (opcode >= NXP_LDBX_OPCODE) { - /* Note: this can overflow and actually decrease - * offs. - */ - offs += reg[1]; - } - ASSERT_WITHIN_PKT_BOUNDS(offs); - switch (opcode) { - case NXP_LDB_OPCODE: - case NXP_LDBX_OPCODE: - load_size = 1; - break; - case NXP_LDH_OPCODE: - case NXP_LDHX_OPCODE: - load_size = 2; - break; - case NXP_LDW_OPCODE: - case NXP_LDWX_OPCODE: - load_size = 4; - break; - /* Immediately enclosing switch statement - * guarantees - * opcode cannot be any other value. - */ - } - end_offs = offs + (load_size - 1); - /* Catch overflow/wrap-around. */ - ASSERT_RETURN(end_offs >= offs); - ASSERT_WITHIN_PKT_BOUNDS(end_offs); - val = 0; - while (load_size--) - val = (val << 8) | packet[offs++]; - REG = val; - break; + case NXP_LDWX_OPCODE: { + offs = imm; + if (opcode >= NXP_LDBX_OPCODE) { + /* Note: this can overflow and actually decrease + * offs. + */ + offs += reg[1]; } + ASSERT_WITHIN_PKT_BOUNDS(offs); + switch (opcode) { + case NXP_LDB_OPCODE: + case NXP_LDBX_OPCODE: + load_size = 1; + break; + case NXP_LDH_OPCODE: + case NXP_LDHX_OPCODE: + load_size = 2; + break; + case NXP_LDW_OPCODE: + case NXP_LDWX_OPCODE: + load_size = 4; + break; + /* Immediately enclosing switch statement + * guarantees + * opcode cannot be any other value. + */ + } + end_offs = offs + (load_size - 1); + /* Catch overflow/wrap-around. */ + ASSERT_RETURN(end_offs >= offs); + ASSERT_WITHIN_PKT_BOUNDS(end_offs); + val = 0; + while (load_size--) + val = (val << 8) | packet[offs++]; + REG = val; + break; + } case NXP_JMP_OPCODE: /* This can jump backwards. Infinite looping prevented * by instructions_remaining. @@ -2656,103 +2572,90 @@ case NXP_JGT_OPCODE: case NXP_JLT_OPCODE: case NXP_JSET_OPCODE: - case NXP_JNEBS_OPCODE:{ - /* Load second immediate field. */ - t_u32 cmp_imm = 0; + case NXP_JNEBS_OPCODE: { + /* Load second immediate field. */ + t_u32 cmp_imm = 0; - if (reg_num == 1) { - cmp_imm = reg[1]; - } else if (len_field != 0) { - t_u32 cmp_imm_len = - 1 << (len_field - 1); + if (reg_num == 1) { + cmp_imm = reg[1]; + } else if (len_field != 0) { + t_u32 cmp_imm_len = 1 << (len_field - 1); - ASSERT_FORWARD_WITHIN_PROGRAM(pc + - cmp_imm_len - - 1); - for (i = 0; i < cmp_imm_len; i++) - cmp_imm = - (cmp_imm << 8) | - program[pc++]; - } - switch (opcode) { - case NXP_JEQ_OPCODE: - if (reg[0] == cmp_imm) - pc += imm; - break; - case NXP_JNE_OPCODE: - if (reg[0] != cmp_imm) - pc += imm; - break; - case NXP_JGT_OPCODE: - if (reg[0] > cmp_imm) - pc += imm; - break; - case NXP_JLT_OPCODE: - if (reg[0] < cmp_imm) - pc += imm; - break; - case NXP_JSET_OPCODE: - if (reg[0] & cmp_imm) - pc += imm; - break; - case NXP_JNEBS_OPCODE:{ - /* cmp_imm is size in bytes of data to compare. - * pc is offset of program bytes to compare. - * imm is jump target offset. - * REG is offset of packet bytes to compare. - */ - ASSERT_FORWARD_WITHIN_PROGRAM(pc - + - cmp_imm - - - 1); - ASSERT_WITHIN_PKT_BOUNDS(REG); - last_pkt_offs = - REG + cmp_imm - 1; - ASSERT_RETURN(last_pkt_offs >= - REG); - ASSERT_WITHIN_PKT_BOUNDS - (last_pkt_offs); - if (memcmp - (program + pc, packet + REG, - cmp_imm)) - pc += imm; - /* skip past comparison bytes */ - pc += cmp_imm; - break; - } - } + ASSERT_FORWARD_WITHIN_PROGRAM(pc + cmp_imm_len - + 1); + for (i = 0; i < cmp_imm_len; i++) + cmp_imm = + (cmp_imm << 8) | program[pc++]; + } + switch (opcode) { + case NXP_JEQ_OPCODE: + if (reg[0] == cmp_imm) + pc += imm; + break; + case NXP_JNE_OPCODE: + if (reg[0] != cmp_imm) + pc += imm; + break; + case NXP_JGT_OPCODE: + if (reg[0] > cmp_imm) + pc += imm; + break; + case NXP_JLT_OPCODE: + if (reg[0] < cmp_imm) + pc += imm; + break; + case NXP_JSET_OPCODE: + if (reg[0] & cmp_imm) + pc += imm; + break; + case NXP_JNEBS_OPCODE: { + /* cmp_imm is size in bytes of data to compare. + * pc is offset of program bytes to compare. + * imm is jump target offset. + * REG is offset of packet bytes to compare. + */ + ASSERT_FORWARD_WITHIN_PROGRAM(pc + cmp_imm - 1); + ASSERT_WITHIN_PKT_BOUNDS(REG); + last_pkt_offs = REG + cmp_imm - 1; + ASSERT_RETURN(last_pkt_offs >= REG); + ASSERT_WITHIN_PKT_BOUNDS(last_pkt_offs); + if (memcmp(program + pc, packet + REG, cmp_imm)) + pc += imm; + /* skip past comparison bytes */ + pc += cmp_imm; break; } + } + break; + } case NXP_ADD_OPCODE: reg[0] += reg_num ? reg[1] : imm; break; case NXP_MUL_OPCODE: reg[0] *= reg_num ? reg[1] : imm; break; - case NXP_DIV_OPCODE:{ - const t_u32 div_operand = - reg_num ? reg[1] : imm; + case NXP_DIV_OPCODE: { + const t_u32 div_operand = reg_num ? reg[1] : imm; - ASSERT_RETURN(div_operand); - reg[0] /= div_operand; - break; - } + ASSERT_RETURN(div_operand); + reg[0] /= div_operand; + break; + } case NXP_AND_OPCODE: reg[0] &= reg_num ? reg[1] : imm; break; case NXP_OR_OPCODE: reg[0] |= reg_num ? reg[1] : imm; break; - case NXP_SH_OPCODE:{ - const int32_t shift_val = - reg_num ? (int32_t) reg[1] : sign_imm; - if (shift_val > 0) - reg[0] <<= shift_val; - else - reg[0] >>= -shift_val; - break; - } + case NXP_SH_OPCODE: { + const int32_t shift_val = + reg_num ? (int32_t)reg[1] : sign_imm; + if (shift_val > 0) + reg[0] <<= shift_val; + else + reg[0] >>= -shift_val; + break; + } case NXP_LI_OPCODE: REG = sign_imm; break; @@ -2764,11 +2667,11 @@ * 0). */ #if NXP_LDM_EXT_OPCODE == 0 - ENFORCE_UNSIGNED(imm) && + ENFORCE_UNSIGNED(imm) && #else - imm >= NXP_LDM_EXT_OPCODE && + imm >= NXP_LDM_EXT_OPCODE && #endif - imm < (NXP_LDM_EXT_OPCODE + MEM_ITEMS)) { + imm < (NXP_LDM_EXT_OPCODE + MEM_ITEMS)) { REG = mem[imm - NXP_LDM_EXT_OPCODE]; } else if (imm >= NXP_STM_EXT_OPCODE && imm < (NXP_STM_EXT_OPCODE + MEM_ITEMS)) { @@ -2781,23 +2684,23 @@ case NXP_NEG_EXT_OPCODE: REG = -REG; break; - case NXP_SWAP_EXT_OPCODE:{ - t_u32 tmp = REG; + case NXP_SWAP_EXT_OPCODE: { + t_u32 tmp = REG; - REG = OTHER_REG; - OTHER_REG = tmp; - break; - } + REG = OTHER_REG; + OTHER_REG = tmp; + break; + } case NXP_MOV_EXT_OPCODE: REG = OTHER_REG; break; - /* Unknown extended opcode */ + /* Unknown extended opcode */ default: /* Bail out */ return PASS_PKT; } break; - /* Unknown opcode */ + /* Unknown opcode */ default: /* Bail out */ return PASS_PKT; @@ -2816,8 +2719,8 @@ * @return non-zero if packet should be passed to AP, zero if * packet should be dropped. */ -int -woal_filter_packet(moal_private *priv, t_u8 *data, t_u32 len, t_u32 filter_age) +int woal_filter_packet(moal_private *priv, t_u8 *data, t_u32 len, + t_u32 filter_age) { packet_filter *pkt_filter = NULL; int ret = PASS_PKT; @@ -2856,8 +2759,7 @@ * * @return 0: success 1: fail */ -int -woal_init_wifi_hal(moal_private *priv) +int woal_init_wifi_hal(moal_private *priv) { ENTER(); woal_init_ring_buffer(priv); @@ -2875,8 +2777,7 @@ * * @return 0: success 1: fail */ -int -woal_deinit_wifi_hal(moal_private *priv) +int woal_deinit_wifi_hal(moal_private *priv) { ENTER(); woal_deinit_ring_buffer(priv); @@ -2897,10 +2798,9 @@ * * @return 0: success -1: fail */ -static int -woal_cfg80211_subcmd_link_statistic_get(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_link_statistic_get(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { struct net_device *dev = wdev->netdev; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -2942,8 +2842,8 @@ ioctl_link_stats_buf = info->param.link_statistic; num_radio = *((t_u32 *)info->param.link_statistic); - radio_stat = (wifi_radio_stat *) (info->param.link_statistic + - sizeof(num_radio)); + radio_stat = (wifi_radio_stat *)(info->param.link_statistic + + sizeof(num_radio)); radio_stat_len = num_radio * sizeof(wifi_radio_stat); /* Re-write on_time/tx_time/rx_time/on_time_scan from moal handle */ @@ -2979,21 +2879,21 @@ radio_stat_tmp++; } - iface_stat = (wifi_iface_stat *) (info->param.link_statistic + - sizeof(num_radio) + radio_stat_len); + iface_stat = (wifi_iface_stat *)(info->param.link_statistic + + sizeof(num_radio) + radio_stat_len); iface_stat_len = sizeof(wifi_iface_stat); /* could get peer info with separate cmd */ for (i = 0; i < iface_stat->num_peers; i++) { - /* no need copy, just increase iface_stat length */ + /* no need copy, just increase iface_stat length*/ iface_stat_len += sizeof(wifi_peer_info) + - sizeof(wifi_rate_stat) * - iface_stat->peer_info[i].num_rate; + sizeof(wifi_rate_stat) * + iface_stat->peer_info[i].num_rate; } /* Here the length doesn't contain addition 2 attribute header length */ length = NLA_HDRLEN * 2 + sizeof(num_radio) + radio_stat_len + - iface_stat_len; + iface_stat_len; /* Alloc the SKB for vendor_event */ skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, length); @@ -3067,10 +2967,9 @@ * * @return 0: success -1: fail */ -static int -woal_cfg80211_subcmd_link_statistic_set(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_link_statistic_set(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev); struct nlattr *tb[ATTR_LL_STATS_MAX + 1]; @@ -3082,9 +2981,10 @@ err = nla_parse(tb, ATTR_LL_STATS_MAX, data, len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (err) return err; @@ -3142,10 +3042,9 @@ * * @return 0: success -1: fail */ -static int -woal_cfg80211_subcmd_link_statistic_clr(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_link_statistic_clr(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev); struct nlattr *tb[ATTR_LL_STATS_MAX + 1]; @@ -3159,9 +3058,10 @@ err = nla_parse(tb, ATTR_LL_STATS_MAX, data, len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (err) return err; @@ -3251,10 +3151,9 @@ * * @return 0: success -1: fail */ -static int -woal_cfg80211_subcmd_rssi_monitor(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_rssi_monitor(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { struct nlattr *tb[ATTR_RSSI_MONITOR_MAX + 1]; moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev); @@ -3274,9 +3173,10 @@ ret = nla_parse(tb, ATTR_RSSI_MONITOR_MAX, data, len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (ret) goto done; @@ -3304,7 +3204,12 @@ priv->cqm_rssi_high_thold = rssi_max; priv->cqm_rssi_thold = rssi_min; priv->cqm_rssi_hyst = 4; - woal_set_rssi_threshold(priv, 0, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != + woal_set_rssi_threshold(priv, 0, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, "set rssi threhold fail\n"); + ret = -EFAULT; + goto done; + } } else if (rssi_monitor_control == RSSI_MONOTOR_STOP) { /* stop rssi monitor */ PRINTM(MEVENT, "stop rssi monitor\n"); @@ -3314,7 +3219,12 @@ priv->cqm_rssi_high_thold = 0; priv->cqm_rssi_thold = 0; priv->cqm_rssi_hyst = 0; - woal_set_rssi_threshold(priv, 0, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != + woal_set_rssi_threshold(priv, 0, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, "set rssi threhold fail\n"); + ret = -EFAULT; + goto done; + } } else { PRINTM(MERROR, "invalid rssi_monitor control request\n"); ret = -EINVAL; @@ -3348,8 +3258,7 @@ * * @return N/A */ -void -woal_cfg80211_rssi_monitor_event(moal_private *priv, t_s16 rssi) +void woal_cfg80211_rssi_monitor_event(moal_private *priv, t_s16 rssi) { struct sk_buff *skb = NULL; t_s8 rssi_value = 0; @@ -3359,7 +3268,7 @@ skb = dev_alloc_skb(NLA_HDRLEN * 2 + ETH_ALEN + sizeof(t_s8)); if (!skb) goto done; - /* convert t_s16 to t_s8 */ + /* convert t_s16 to t_s8*/ rssi_value = -abs(rssi); if (nla_put(skb, ATTR_RSSI_MONITOR_CUR_BSSID, ETH_ALEN, priv->conn_bssid) || @@ -3377,6 +3286,170 @@ #endif /** + * @brief vendor command to key_mgmt_set_key + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success fail otherwise + */ +static int +woal_cfg80211_subcmd_set_roaming_offload_key(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + moal_private *priv; + struct net_device *dev; + struct sk_buff *skb = NULL; + t_u8 *pos = (t_u8 *)data; + int ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + if (data) + DBG_HEXDUMP(MCMD_D, "Vendor pmk", (t_u8 *)data, data_len); + + if (!wdev || !wdev->netdev) { + LEAVE(); + return -EFAULT; + } + + dev = wdev->netdev; + priv = (moal_private *)woal_get_netdev_priv(dev); + if (!priv || !pos) { + LEAVE(); + return -EFAULT; + } + + if (data_len > MLAN_MAX_KEY_LENGTH) { + moal_memcpy_ext(priv->phandle, &priv->pmk.pmk_r0, pos, + MLAN_MAX_KEY_LENGTH, MLAN_MAX_KEY_LENGTH); + pos += MLAN_MAX_KEY_LENGTH; + moal_memcpy_ext(priv->phandle, &priv->pmk.pmk_r0_name, pos, + data_len - MLAN_MAX_KEY_LENGTH, + MLAN_MAX_PMKR0_NAME_LENGTH); + } else { + moal_memcpy_ext(priv->phandle, &priv->pmk.pmk, data, data_len, + MLAN_MAX_KEY_LENGTH); + } + priv->pmk_saved = MTRUE; + + /** Allocate skb for cmd reply*/ + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, data_len); + if (!skb) { + PRINTM(MERROR, "allocate memory fail for vendor cmd\n"); + LEAVE(); + return -EFAULT; + } + pos = skb_put(skb, data_len); + moal_memcpy_ext(priv->phandle, pos, data, data_len, data_len); + ret = cfg80211_vendor_cmd_reply(skb); + + LEAVE(); + return ret; +} + +/** + * @brief vendor command to supplicant to update AP info + * + * @param priv A pointer to moal_private + * @param data a pointer to data + * @param len data length + * + * @return 0: success 1: fail + */ +int woal_roam_ap_info(moal_private *priv, t_u8 *data, int len) +{ + struct wiphy *wiphy = priv->wdev->wiphy; + struct sk_buff *skb = NULL; + int ret = MLAN_STATUS_SUCCESS; + key_info *pkey = NULL; + apinfo *pinfo = NULL; + apinfo *req_tlv = NULL; + MrvlIEtypesHeader_t *tlv = NULL; + t_u16 tlv_type = 0, tlv_len = 0, tlv_buf_left = 0; + int event_id = 0; + t_u8 authorized = 1; + + ENTER(); + + event_id = woal_get_event_id(event_fw_roam_success); + if (event_max == event_id) { + PRINTM(MERROR, "Not find this event %d\n", event_id); + ret = 1; + LEAVE(); + return ret; + } + /**allocate skb*/ +#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE + skb = cfg80211_vendor_event_alloc(wiphy, priv->wdev, len + 50, +#else + skb = cfg80211_vendor_event_alloc(wiphy, len + 50, +#endif + event_id, GFP_ATOMIC); + + if (!skb) { + PRINTM(MERROR, "allocate memory fail for vendor event\n"); + ret = 1; + LEAVE(); + return ret; + } + + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_BSSID, + MLAN_MAC_ADDR_LENGTH, (t_u8 *)data); + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_AUTHORIZED, + sizeof(authorized), &authorized); + tlv = (MrvlIEtypesHeader_t *)(data + MLAN_MAC_ADDR_LENGTH); + tlv_buf_left = len - MLAN_MAC_ADDR_LENGTH; + while (tlv_buf_left >= sizeof(MrvlIEtypesHeader_t)) { + tlv_type = woal_le16_to_cpu(tlv->type); + tlv_len = woal_le16_to_cpu(tlv->len); + + if (tlv_buf_left < (tlv_len + sizeof(MrvlIEtypesHeader_t))) { + PRINTM(MERROR, + "Error processing firmware roam success TLVs, bytes left < TLV length\n"); + break; + } + + switch (tlv_type) { + case TLV_TYPE_APINFO: + pinfo = (apinfo *)tlv; + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_RESP_IE, + pinfo->header.len, pinfo->rsp_ie); + break; + case TLV_TYPE_ASSOC_REQ_IE: + req_tlv = (apinfo *)tlv; + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_REQ_IE, + req_tlv->header.len, req_tlv->rsp_ie); + break; + case TLV_TYPE_KEYINFO: + pkey = (key_info *)tlv; + nla_put(skb, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_KEY_REPLAY_CTR, + MLAN_REPLAY_CTR_LEN, pkey->key.replay_ctr); + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KCK, + MLAN_KCK_LEN, pkey->key.kck); + nla_put(skb, MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KEK, + MLAN_KEK_LEN, pkey->key.kek); + break; + default: + break; + } + tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); + tlv = (MrvlIEtypesHeader_t *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); + } + + /**send event*/ + cfg80211_vendor_event(skb, GFP_ATOMIC); + + LEAVE(); + return ret; +} + +/** * @brief vendor command to get fw roaming capability * * @param wiphy A pointer to wiphy struct @@ -3407,10 +3480,8 @@ capa.max_whitelist_size = MAX_SSID_NUM; /* Alloc the SKB for vendor_event */ - skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, - sizeof - (wifi_roaming_capabilities) + - 50); + skb = cfg80211_vendor_cmd_alloc_reply_skb( + wiphy, sizeof(wifi_roaming_capabilities) + 50); if (unlikely(!skb)) { PRINTM(MERROR, "skb alloc failed\n"); goto done; @@ -3439,10 +3510,9 @@ * * @return 0: success fail otherwise */ -static int -woal_cfg80211_subcmd_fw_roaming_enable(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_fw_roaming_enable(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv; struct net_device *dev; @@ -3451,6 +3521,11 @@ const struct nlattr *iter; int type, rem, err; t_u32 fw_roaming_enable = 0; +#ifdef STA_CFG80211 +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE + t_u8 enable = 0; +#endif +#endif ENTER(); @@ -3466,7 +3541,7 @@ return -EFAULT; } - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONTROL: @@ -3481,12 +3556,7 @@ PRINTM(MMSG, "FW roaming set enable=%d from wifi hal.\n", fw_roaming_enable); -#if defined(STA_CFG80211) - if (fw_roaming_enable) - priv->roaming_enabled = MTRUE; - else - priv->roaming_enabled = MFALSE; -#endif + ret = woal_enable_fw_roaming(priv, fw_roaming_enable); /* Alloc the SKB for vendor_event */ skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(t_u32) + 50); if (unlikely(!skb)) { @@ -3500,6 +3570,14 @@ if (unlikely(err)) PRINTM(MERROR, "Vendor Command reply failed ret:%d\n", err); +#ifdef STA_CFG80211 +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE + if (!fw_roaming_enable) + woal_cfg80211_vendor_event(priv, event_set_key_mgmt_offload, + &enable, sizeof(enable)); +#endif +#endif + done: LEAVE(); return ret; @@ -3515,16 +3593,16 @@ * * @return 0: success fail otherwise */ -static int -woal_cfg80211_subcmd_fw_roaming_config(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_fw_roaming_config(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv; struct net_device *dev; int ret = MLAN_STATUS_SUCCESS; const struct nlattr *iter; int type, rem; + woal_roam_offload_cfg *roam_offload_cfg = NULL; wifi_bssid_params blacklist; wifi_ssid_params whitelist; @@ -3544,7 +3622,7 @@ memset((char *)&blacklist, 0, sizeof(wifi_bssid_params)); memset((char *)&whitelist, 0, sizeof(wifi_ssid_params)); - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_BSSID: @@ -3564,7 +3642,64 @@ } } + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) { + /*save blacklist and whitelist in driver*/ + priv->phandle->fw_roam_params.black_list.ap_num = + blacklist.num_bssid; + moal_memcpy_ext( + priv->phandle, + (t_u8 *)priv->phandle->fw_roam_params.black_list.ap_mac, + (t_u8 *)blacklist.mac_addr, + sizeof(wifi_bssid_params) - sizeof(blacklist.num_bssid), + sizeof(mlan_ds_misc_roam_offload_aplist) - + sizeof(priv->phandle->fw_roam_params.black_list + .ap_num)); + priv->phandle->fw_roam_params.ssid_list.ssid_num = + whitelist.num_ssid; + moal_memcpy_ext( + priv->phandle, + (t_u8 *)priv->phandle->fw_roam_params.ssid_list.ssids, + (t_u8 *)whitelist.whitelist_ssid, + sizeof(wifi_ssid_params) - sizeof(whitelist.num_ssid), + MAX_SSID_NUM * sizeof(mlan_802_11_ssid)); + } else { + roam_offload_cfg = (woal_roam_offload_cfg *)kmalloc( + sizeof(woal_roam_offload_cfg), GFP_KERNEL); + if (!roam_offload_cfg) { + PRINTM(MERROR, "kmalloc failed!\n"); + ret = -ENOMEM; + goto done; + } + /*download parameters directly to fw*/ + memset((char *)roam_offload_cfg, 0, + sizeof(woal_roam_offload_cfg)); + roam_offload_cfg->black_list.ap_num = blacklist.num_bssid; + moal_memcpy_ext(priv->phandle, + (t_u8 *)&roam_offload_cfg->black_list.ap_mac, + (t_u8 *)blacklist.mac_addr, + sizeof(wifi_bssid_params) - + sizeof(blacklist.num_bssid), + sizeof(mlan_ds_misc_roam_offload_aplist) - + sizeof(priv->phandle->fw_roam_params + .black_list.ap_num)); + roam_offload_cfg->ssid_list.ssid_num = whitelist.num_ssid; + moal_memcpy_ext(priv->phandle, + (t_u8 *)&roam_offload_cfg->ssid_list.ssids, + (t_u8 *)whitelist.whitelist_ssid, + sizeof(wifi_ssid_params) - + sizeof(whitelist.num_ssid), + MAX_SSID_NUM * sizeof(mlan_802_11_ssid)); + if (woal_config_fw_roaming(priv, ROAM_OFFLOAD_PARAM_CFG, + roam_offload_cfg)) { + PRINTM(MERROR, "%s: config fw roaming failed \n", + __func__); + ret = -EFAULT; + } + } + done: + if (roam_offload_cfg) + kfree(roam_offload_cfg); LEAVE(); return ret; } @@ -3579,10 +3714,9 @@ * * @return 0: success <0: fail */ -static int -woal_cfg80211_subcmd_11k_cfg(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_11k_cfg(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = NULL; moal_private *priv = NULL; @@ -3603,9 +3737,10 @@ nla_parse(tb_vendor, ATTR_ND_OFFLOAD_MAX, (struct nlattr *)data, data_len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (!tb_vendor[ATTR_ND_OFFLOAD_CONTROL]) { PRINTM(MINFO, "%s: ATTR_ND_OFFLOAD not found\n", __func__); ret = -EFAULT; @@ -3629,10 +3764,9 @@ * * @return 0: success <0: fail */ -static int -woal_cfg80211_subcmd_set_scan_mac_oui(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_set_scan_mac_oui(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct net_device *dev = NULL; moal_private *priv = NULL; @@ -3652,9 +3786,10 @@ nla_parse(tb_vendor, ATTR_WIFI_MAX, (struct nlattr *)data, data_len, NULL #if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE - , NULL + , + NULL #endif - ); + ); if (!tb_vendor[ATTR_SCAN_MAC_OUI_SET]) { PRINTM(MINFO, "%s: ATTR_SCAN_MAC_OUI_SET not found\n", __func__); @@ -3684,10 +3819,9 @@ * * @return 0: success fail otherwise */ -static int -woal_cfg80211_subcmd_start_keep_alive(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_start_keep_alive(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv; struct net_device *dev; @@ -3718,7 +3852,7 @@ return -EFAULT; } - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case MKEEP_ALIVE_ATTRIBUTE_ID: @@ -3736,6 +3870,10 @@ break; case MKEEP_ALIVE_ATTRIBUTE_IP_PKT: if (ip_pkt_len) { + if (ip_pkt) { + kfree(ip_pkt); + ip_pkt = NULL; + } ip_pkt = (u8 *)kzalloc(ip_pkt_len, GFP_ATOMIC); if (ip_pkt == NULL) { ret = -ENOMEM; @@ -3772,11 +3910,9 @@ } } - ret = woal_priv_save_cloud_keep_alive_params(priv, mkeep_alive_id, true, - ether_type, ip_pkt, - ip_pkt_len, src_mac, - dst_mac, period_msec, - retry_interval, retry_cnt); + ret = woal_priv_save_cloud_keep_alive_params( + priv, mkeep_alive_id, true, ether_type, ip_pkt, ip_pkt_len, + src_mac, dst_mac, period_msec, retry_interval, retry_cnt); if (ret < 0) PRINTM(MERROR, "start_mkeep_alive is failed ret: %d\n", ret); @@ -3798,10 +3934,9 @@ * * @return 0: success fail otherwise */ -static int -woal_cfg80211_subcmd_stop_keep_alive(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int len) +static int woal_cfg80211_subcmd_stop_keep_alive(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) { moal_private *priv; struct net_device *dev; @@ -3824,7 +3959,7 @@ return -EFAULT; } - nla_for_each_attr(iter, data, len, rem) { + nla_for_each_attr (iter, data, len, rem) { type = nla_type(iter); switch (type) { case MKEEP_ALIVE_ATTRIBUTE_ID: @@ -3854,9 +3989,8 @@ * @return 0: success fail otherwise */ -int -woal_mkeep_alive_vendor_event(moal_private *priv, - mlan_ds_misc_keep_alive * mkeep_alive) +int woal_mkeep_alive_vendor_event(moal_private *priv, + mlan_ds_misc_keep_alive *mkeep_alive) { struct wiphy *wiphy = priv->wdev->wiphy; struct sk_buff *skb = NULL; @@ -3914,10 +4048,9 @@ * * @return 0: success 1: fail */ -static int -woal_cfg80211_subcmd_set_dfs_offload(struct wiphy *wiphy, - struct wireless_dev *wdev, - const void *data, int data_len) +static int woal_cfg80211_subcmd_set_dfs_offload(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) { struct sk_buff *skb = NULL; moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); @@ -3942,345 +4075,774 @@ return ret; } +#define CSI_DUMP_FILE_MAX 1200000 + +/** + * @brief vendor command to set CSI params + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * @param csi_enable enable/disable CSI + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_set_csi(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len, + int csi_enable) +{ + struct net_device *dev = NULL; + moal_private *priv = NULL; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + struct nlattr *tb_vendor[ATTR_CSI_MAX + 1]; + int ret = 0; + int status = MLAN_STATUS_SUCCESS; + + ENTER(); + + if (!wdev || !wdev->netdev) { + LEAVE(); + return -EFAULT; + } + dev = wdev->netdev; + priv = (moal_private *)woal_get_netdev_priv(dev); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + PRINTM(MERROR, "Could not allocate mlan ioctl request!\n"); + ret = -EFAULT; + goto done; + } + req->req_id = MLAN_IOCTL_MISC_CFG; + cfg = (mlan_ds_misc_cfg *)req->pbuf; + cfg->sub_command = MLAN_OID_MISC_CSI; + + priv->csi_enable = csi_enable; + if (csi_enable == 1) { + nla_parse(tb_vendor, ATTR_CSI_MAX, (struct nlattr *)data, len, + NULL +#if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE + , + NULL +#endif + ); + if (!tb_vendor[ATTR_CSI_CONFIG]) { + ret = -EFAULT; + goto done; + } + moal_memcpy_ext(priv->phandle, &cfg->param.csi_params, + (mlan_ds_csi_params *)nla_data( + tb_vendor[ATTR_CSI_CONFIG]), + sizeof(mlan_ds_csi_params), + sizeof(mlan_ds_csi_params)); + moal_memcpy_ext(priv->phandle, &priv->csi_config, + &cfg->param.csi_params, + sizeof(mlan_ds_csi_params), + sizeof(mlan_ds_csi_params)); + if (tb_vendor[ATTR_CSI_DUMP_FORMAT]) + priv->csi_dump_format = + nla_get_u8(tb_vendor[ATTR_CSI_DUMP_FORMAT]); + } else if (csi_enable == 0) { + nla_parse(tb_vendor, ATTR_CSI_MAX, (struct nlattr *)data, len, + NULL +#if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE + , + NULL +#endif + ); + if (!tb_vendor[ATTR_PEER_MAC_ADDR]) { + ret = -EFAULT; + goto done; + } + memset(&cfg->param.csi_params, 0, sizeof(mlan_ds_csi_params)); + moal_memcpy_ext(priv->phandle, + cfg->param.csi_params.csi_filter[0].mac_addr, + (t_u8 *)nla_data(tb_vendor[ATTR_PEER_MAC_ADDR]), + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief vendor command to enable CSI + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_csi_enable(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) +{ + int ret = 0; + + ENTER(); + + ret = woal_cfg80211_subcmd_set_csi(wiphy, wdev, data, len, 1); + + LEAVE(); + return ret; +} + +/** + * @brief vendor command to disable CSI + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_csi_disable(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) +{ + int ret = 0; + + ENTER(); + + ret = woal_cfg80211_subcmd_set_csi(wiphy, wdev, data, len, 0); + + LEAVE(); + return ret; +} + +/** + * @brief vendor command to get CSI dump path + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_get_csi_dump_path(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) +{ + int ret = 0; + struct net_device *dev = NULL; + moal_private *priv = NULL; + struct sk_buff *skb = NULL; + + ENTER(); + + if (!wdev || !wdev->netdev) { + LEAVE(); + return -EFAULT; + } + dev = wdev->netdev; + priv = (moal_private *)woal_get_netdev_priv(dev); + + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, + sizeof(priv->csi_dump_path)); + if (unlikely(!skb)) { + PRINTM(MERROR, "skb alloc failed\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + /* Push the data to the skb */ + nla_put(skb, ATTR_CSI_DUMP_PATH, sizeof(priv->csi_dump_path), + (t_u8 *)priv->csi_dump_path); + + ret = cfg80211_vendor_cmd_reply(skb); + if (unlikely(ret)) { + PRINTM(MERROR, "Vendor Command reply failed ret:%d\n", ret); + goto done; + } + +done: + LEAVE(); + return ret; +} + +/** + * @brief vendor command to get CSI config + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_get_csi_config(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) +{ + int ret = 0; + struct net_device *dev = NULL; + moal_private *priv = NULL; + struct sk_buff *skb = NULL; + + ENTER(); + + if (!wdev || !wdev->netdev) { + LEAVE(); + return -EFAULT; + } + dev = wdev->netdev; + priv = (moal_private *)woal_get_netdev_priv(dev); + + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, + sizeof(priv->csi_config)); + if (unlikely(!skb)) { + PRINTM(MERROR, "skb alloc failed\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + /* Push the data to the skb */ + nla_put(skb, ATTR_CSI_CONFIG, sizeof(mlan_ds_csi_params), + (t_u8 *)&priv->csi_config); + + ret = cfg80211_vendor_cmd_reply(skb); + if (unlikely(ret)) { + PRINTM(MERROR, "Vendor Command reply failed ret:%d\n", ret); + goto done; + } + +done: + LEAVE(); + return ret; +} + +/** + * @brief vendor command to get CSI capability + * + * @param wiphy A pointer to wiphy struct + * @param wdev A pointer to wireless_dev struct + * @param data a pointer to data + * @param len data length + * + * @return 0: success -1: fail + */ +static int woal_cfg80211_subcmd_get_csi_capa(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int len) +{ + ENTER(); + LEAVE(); + return 0; +} + +/** + * @brief Save CSI dump to file + * + * @param dir_name Directory name + * @param file_name File name + * @param buf Pointer to dump buffer + * @param buf_len Length of buf + * @param name Full path name of CSI dump + * + * @return 0: success -1: fail + */ +static mlan_status woal_save_csi_dump_to_file(char *dir_name, char *file_name, + t_u8 *buf, int buf_len, + t_u8 format, char *name) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + ENTER(); + + if (!dir_name || !file_name || !buf) { + PRINTM(MERROR, "Can't save dump info to file\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } +done: + LEAVE(); + return ret; +} + +/** + * @brief vendor event to upload csi dump + * + * @param priv A pointer to moal_private + * @param data a pointer to data + * @param len data length + * + * @return mlan_status + */ +mlan_status woal_cfg80211_event_csi_dump(moal_private *priv, t_u8 *data, + int len) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + char path_name[20]; + char file_name[20]; + + ENTER(); + + DBG_HEXDUMP(MCMD_D, "CSI dump data", data, len); + sprintf(path_name, "/data"); + if (priv->csi_dump_format == 1) + sprintf(file_name, "csi_dump.bin"); + else + sprintf(file_name, "csi_dump.txt"); + priv->csi_dump_len += len; + if (priv->csi_dump_len > CSI_DUMP_FILE_MAX) { + PRINTM(MERROR, + "Reached file maximum size. Not saving CSI records.\n"); + goto done; + } + /* Save CSI dump to file */ + ret = woal_save_csi_dump_to_file(path_name, file_name, data, len, + priv->csi_dump_format, + priv->csi_dump_path); + if (ret != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to save CSI dump to file\n"); + goto done; + } + +done: + LEAVE(); + return ret; +} + // clang-format off static const struct wiphy_vendor_command vendor_commands[] = { { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_set_drvdbg, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_set_drvdbg, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_set_drvdbg, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_set_drvdbg, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, + .policy = VENDOR_CMD_RAW_DATA, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_valid_channels, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_valid_channels, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_valid_channels, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_valid_channels, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_attr_policy, - .maxattr = ATTR_WIFI_MAX, + .policy = woal_attr_policy, + .maxattr = ATTR_WIFI_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_set_scan_mac_oui, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_set_scan_mac_oui, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_set_scan_mac_oui, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_set_scan_mac_oui, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_attr_policy, - .maxattr = ATTR_WIFI_MAX, + .policy = woal_attr_policy, + .maxattr = ATTR_WIFI_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_link_statistic_set, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_link_statistic_set, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_link_statistic_set, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_link_statistic_set, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_ll_stat_policy, - .maxattr = ATTR_LL_STATS_MAX, + .policy = woal_ll_stat_policy, + .maxattr = ATTR_LL_STATS_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_link_statistic_get, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_link_statistic_get, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_link_statistic_get, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_link_statistic_get, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, + .policy = VENDOR_CMD_RAW_DATA, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_link_statistic_clr, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_link_statistic_clr, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_link_statistic_clr, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_link_statistic_clr, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_ll_stat_policy, - .maxattr = ATTR_LL_STATS_MAX, + .policy = woal_ll_stat_policy, + .maxattr = ATTR_LL_STATS_MAX, #endif - }, + }, #ifdef STA_CFG80211 { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_rssi_monitor, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_rssi_monitor, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_rssi_monitor, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_rssi_monitor, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_rssi_monitor_policy, - .maxattr = ATTR_RSSI_MONITOR_MAX, + .policy = woal_rssi_monitor_policy, + .maxattr = ATTR_RSSI_MONITOR_MAX, #endif - }, + }, #endif { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_roaming_capability, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_roaming_capability, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_set_roaming_offload_key, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_set_roaming_offload_key, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, + .policy = VENDOR_CMD_RAW_DATA, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_fw_roaming_enable, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_fw_roaming_enable, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_roaming_capability, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_roaming_capability, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_fw_roaming_policy, - .maxattr = MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX, + .policy = VENDOR_CMD_RAW_DATA, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_fw_roaming_config, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_fw_roaming_config, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_fw_roaming_enable, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_fw_roaming_enable, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_fw_roaming_policy, - .maxattr = MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX, + .policy = woal_fw_roaming_policy, + .maxattr = MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_start_keep_alive, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_start_keep_alive, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_fw_roaming_config, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_fw_roaming_config, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_keep_alive_policy, - .maxattr = MKEEP_ALIVE_ATTRIBUTE_MAX, + .policy = woal_fw_roaming_policy, + .maxattr = MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_stop_keep_alive, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_stop_keep_alive, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_start_keep_alive, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_start_keep_alive, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, + .policy = woal_keep_alive_policy, + .maxattr = MKEEP_ALIVE_ATTRIBUTE_MAX, #endif - }, + }, { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_dfs_capability, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_set_dfs_offload, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_stop_keep_alive, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_stop_keep_alive, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, + .policy = VENDOR_CMD_RAW_DATA, #endif - }, + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_dfs_capability, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_set_dfs_offload, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_nd_offload}, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_11k_cfg, + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_nd_offload + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_11k_cfg, #if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_nd_offload_policy, - .maxattr = ATTR_ND_OFFLOAD_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_drv_version, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_drv_version, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_fw_version, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_fw_version, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_wifi_supp_feature_set, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_supp_feature_set, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_set_country_code, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_set_country_code, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_wifi_logger_supp_feature_set, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_get_wifi_logger_supp_feature_set, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_logger_policy, - .maxattr = ATTR_WIFI_LOGGER_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_ring_buff_status, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_get_ring_buff_status, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_logger_policy, - .maxattr = ATTR_WIFI_LOGGER_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_start_logging, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_start_logging, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_logger_policy, - .maxattr = ATTR_WIFI_LOGGER_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_ring_buff_data, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_get_ring_data, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_logger_policy, - .maxattr = ATTR_WIFI_LOGGER_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_start_packet_fate_monitor, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_start_packet_fate_monitor, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_fw_mem_dump, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_get_fw_dump, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_drv_mem_dump, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_get_drv_dump, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_set_packet_filter, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_set_packet_filter, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_packet_filter_policy, - .maxattr = ATTR_PACKET_FILTER_MAX, -#endif - }, - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_get_packet_filter_capability, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | - WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, - .doit = woal_cfg80211_subcmd_get_packet_filter_capability, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = VENDOR_CMD_RAW_DATA, -#endif - }, -#if defined(WIFI_LATENCY_MODE_SUPPORT) - { - .info = { - .vendor_id = MRVL_VENDOR_ID, - .subcmd = sub_cmd_set_latency_mode, - }, - .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .doit = woal_cfg80211_subcmd_set_wifi_latency_mode, -#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE - .policy = woal_attr_policy, - .maxattr = ATTR_WIFI_MAX, + .policy = woal_nd_offload_policy, + .maxattr = ATTR_ND_OFFLOAD_MAX, #endif }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_drv_version, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_drv_version, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, #endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_fw_version, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_fw_version, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_wifi_supp_feature_set, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_supp_feature_set, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_set_country_code, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_set_country_code, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = + sub_cmd_get_wifi_logger_supp_feature_set, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_wifi_logger_supp_feature_set, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = woal_logger_policy, + .maxattr = ATTR_WIFI_LOGGER_MAX, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_ring_buff_status, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_get_ring_buff_status, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = woal_logger_policy, + .maxattr = ATTR_WIFI_LOGGER_MAX, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_start_logging, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_start_logging, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = woal_logger_policy, + .maxattr = ATTR_WIFI_LOGGER_MAX, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_ring_buff_data, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_get_ring_data, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = woal_logger_policy, + .maxattr = ATTR_WIFI_LOGGER_MAX, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_start_packet_fate_monitor, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_start_packet_fate_monitor, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_fw_mem_dump, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_get_fw_dump, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_drv_mem_dump, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_get_drv_dump, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_set_packet_filter, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_set_packet_filter, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = woal_packet_filter_policy, + .maxattr = ATTR_PACKET_FILTER_MAX, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = sub_cmd_get_packet_filter_capability, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = woal_cfg80211_subcmd_get_packet_filter_capability, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = subcmd_cfr_request, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_csi_enable, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = subcmd_cfr_cancel, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_csi_disable, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = subcmd_get_csi_dump_path, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_csi_dump_path, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = subcmd_get_csi_config, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_csi_config, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, + { + .info = { + .vendor_id = MRVL_VENDOR_ID, + .subcmd = subcmd_get_csi_capa, + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = woal_cfg80211_subcmd_get_csi_capa, +#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE + .policy = VENDOR_CMD_RAW_DATA, +#endif + }, }; - // clang-format on /** @@ -4290,8 +4852,7 @@ * * @return */ -void -woal_register_cfg80211_vendor_command(struct wiphy *wiphy) +void woal_register_cfg80211_vendor_command(struct wiphy *wiphy) { ENTER(); wiphy->vendor_commands = vendor_commands;
diff --git a/wlan_sd8987/mlinux/moal_cfg80211_util.h b/wlan_sd8987/mlinux/moal_cfg80211_util.h index f681482..7578665 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211_util.h +++ b/wlan_sd8987/mlinux/moal_cfg80211_util.h
@@ -3,7 +3,7 @@ * @brief This file contains the CFG80211 vendor specific defines. * * - * Copyright 2015-2020 NXP + * Copyright 2015-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -25,6 +25,26 @@ #include "moal_main.h" +#define TLV_TYPE_APINFO (PROPRIETARY_TLV_BASE_ID + 249) +#define TLV_TYPE_KEYINFO (PROPRIETARY_TLV_BASE_ID + 250) +#define TLV_TYPE_ASSOC_REQ_IE (PROPRIETARY_TLV_BASE_ID + 292) + +/** Key Info structure */ +typedef struct _key_info_tlv { + /** Header */ + MrvlIEtypesHeader_t header; + /** kck, kek, key_replay*/ + mlan_ds_misc_gtk_rekey_data key; +} key_info; + +/** APinfo TLV structure */ +typedef struct _apinfo_tlv { + /** Header */ + MrvlIEtypesHeader_t header; + /** Assoc response buffer */ + t_u8 rsp_ie[1]; +} apinfo; + #if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE #define RING_NAME_MAX 32 typedef int wifi_ring_buffer_id; @@ -89,27 +109,27 @@ #define TLV_LOG_HEADER_LEN 4 -#define WIFI_LOGGER_MEMORY_DUMP_SUPPORTED MBIT(0) /* Memory dump of Fw */ -#define WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORT MBIT(1) /*PKT status */ -#define WIFI_LOGGER_CONNECT_EVENT_SUPPORTED MBIT(2) /* connectivity event */ -#define WIFI_LOGGER_POWER_EVENT_SUPPORTED MBIT(3) /* Power of driver */ -#define WIFI_LOGGER_WAKE_LOCK_SUPPORTED MBIT(4) /* Wake lock of driver */ -#define WIFI_LOGGER_VERBOSE_SUPPORTED MBIT(5) /*verbose log of Fw */ +#define WIFI_LOGGER_MEMORY_DUMP_SUPPORTED MBIT(0) /* Memory dump of Fw*/ +#define WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORT MBIT(1) /*PKT status*/ +#define WIFI_LOGGER_CONNECT_EVENT_SUPPORTED MBIT(2) /* connectivity event*/ +#define WIFI_LOGGER_POWER_EVENT_SUPPORTED MBIT(3) /* Power of driver*/ +#define WIFI_LOGGER_WAKE_LOCK_SUPPORTED MBIT(4) /* Wake lock of driver*/ +#define WIFI_LOGGER_VERBOSE_SUPPORTED MBIT(5) /*verbose log of Fw*/ #define WIFI_LOGGER_WATCHDOG_TIMER_SUPPORTED \ - MBIT(6) /*monitor the health of Fw */ + MBIT(6) /*monitor the health of Fw*/ /** * Parameters of wifi logger events are TLVs * Event parameters tags are defined as: */ -#define WIFI_TAG_VENDOR_SPECIFIC 0 // take a byte stream as parameter -#define WIFI_TAG_BSSID 1 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_ADDR 2 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_SSID 3 // takes a 32 bytes SSID address as parameter -#define WIFI_TAG_STATUS 4 // takes an integer as parameter -#define WIFI_TAG_REASON_CODE 14 // take a reason code as per 802.11 as parameter -#define WIFI_TAG_RSSI 21 // take an integer as parameter -#define WIFI_TAG_CHANNEL 22 // take an integer as parameter +#define WIFI_TAG_VENDOR_SPECIFIC 0 // take a byte stream as parameter +#define WIFI_TAG_BSSID 1 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_ADDR 2 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_SSID 3 // takes a 32 bytes SSID address as parameter +#define WIFI_TAG_STATUS 4 // takes an integer as parameter +#define WIFI_TAG_REASON_CODE 14 // take a reason code as per 802.11 as parameter +#define WIFI_TAG_RSSI 21 // take an integer as parameter +#define WIFI_TAG_CHANNEL 22 // take an integer as parameter #define RING_ENTRY_SIZE (sizeof(wifi_ring_buffer_entry)) #define ENTRY_LENGTH(hdr) (hdr->entry_size + RING_ENTRY_SIZE) @@ -174,7 +194,7 @@ t_u8 type; /** present if has_timestamp bit is set. */ t_u64 timestamp; -} __attribute__ ((packed)) wifi_ring_buffer_entry; +} __attribute__((packed)) wifi_ring_buffer_entry; /** WiFi ring buffer status structure*/ typedef struct _wifi_ring_buffer_status { @@ -204,7 +224,7 @@ u16 length; /** Value */ u8 value[]; -} __attribute__ ((packed)) tlv_log; +} __attribute__((packed)) tlv_log; /** WiFi ring buffer driver structure */ typedef struct { @@ -218,7 +238,7 @@ * found etc... as well, event_data can include a vendor proprietary * part which is understood by the developer only */ -} __attribute__ ((packed)) wifi_ring_buffer_driver_connectivity_event; +} __attribute__((packed)) wifi_ring_buffer_driver_connectivity_event; /** Assoc logger data structure */ typedef struct _assoc_logger { @@ -530,36 +550,35 @@ (VENDOR_ID_OVERHEAD + VENDOR_SUBCMD_OVERHEAD + VENDOR_DATA_OVERHEAD) /* Features Enums*/ -#define WLAN_FEATURE_INFRA 0x0001 // Basic infrastructure mode support -#define WLAN_FEATURE_INFRA_5G 0x0002 // 5 GHz Band support -#define WLAN_FEATURE_HOTSPOT 0x0004 // GAS/ANQP support -#define WLAN_FEATURE_P2P 0x0008 // Wifi-Direct/P2P -#define WLAN_FEATURE_SOFT_AP 0x0010 // Soft AP support -#define WLAN_FEATURE_GSCAN 0x0020 // Google-Scan APIsi support -#define WLAN_FEATURE_NAN 0x0040 // Neighbor Awareness Networking (NAN) -#define WLAN_FEATURE_D2D_RTT 0x0080 // Device-to-device RTT support -#define WLAN_FEATURE_D2AP_RTT 0x0100 // Device-to-AP RTT support -#define WLAN_FEATURE_BATCH_SCAN 0x0200 // Batched Scan (legacy) support -#define WLAN_FEATURE_PNO 0x0400 // Preferred network offload support -#define WLAN_FEATURE_ADDITIONAL_STA 0x0800 // Two STAs support -#define WLAN_FEATURE_TDLS 0x1000 // Tunnel directed link setup (TDLS) -#define WLAN_FEATURE_TDLS_OFFCHANNEL 0x2000 // TDLS off channel support -#define WLAN_FEATURE_EPR 0x4000 // Enhanced power reporting support -#define WLAN_FEATURE_AP_STA 0x8000 // AP STA Concurrency support +#define WLAN_FEATURE_INFRA 0x0001 // Basic infrastructure mode support +#define WLAN_FEATURE_INFRA_5G 0x0002 // 5 GHz Band support +#define WLAN_FEATURE_HOTSPOT 0x0004 // GAS/ANQP support +#define WLAN_FEATURE_P2P 0x0008 // Wifi-Direct/P2P +#define WLAN_FEATURE_SOFT_AP 0x0010 // Soft AP support +#define WLAN_FEATURE_GSCAN 0x0020 // Google-Scan APIsi support +#define WLAN_FEATURE_NAN 0x0040 // Neighbor Awareness Networking (NAN) +#define WLAN_FEATURE_D2D_RTT 0x0080 // Device-to-device RTT support +#define WLAN_FEATURE_D2AP_RTT 0x0100 // Device-to-AP RTT support +#define WLAN_FEATURE_BATCH_SCAN 0x0200 // Batched Scan (legacy) support +#define WLAN_FEATURE_PNO 0x0400 // Preferred network offload support +#define WLAN_FEATURE_ADDITIONAL_STA 0x0800 // Two STAs support +#define WLAN_FEATURE_TDLS 0x1000 // Tunnel directed link setup (TDLS) +#define WLAN_FEATURE_TDLS_OFFCHANNEL 0x2000 // TDLS off channel support +#define WLAN_FEATURE_EPR 0x4000 // Enhanced power reporting support +#define WLAN_FEATURE_AP_STA 0x8000 // AP STA Concurrency support #define WLAN_FEATURE_LINK_LAYER_STATS \ - 0x10000 // Link layer stats collection support -#define WLAN_FEATURE_LOGGER 0x20000 // WiFi Logger support -#define WLAN_FEATURE_HAL_EPNO 0x40000 // WiFi enhanced PNO support -#define WLAN_FEATURE_RSSI_MONITOR 0x80000 // RSSI Monitor support -#define WLAN_FEATURE_MKEEP_ALIVE 0x100000 // WiFi mkeep_alive support -#define WLAN_FEATURE_CONFIG_NDO 0x200000 // ND offload configure support + 0x10000 // Link layer stats collection support +#define WLAN_FEATURE_LOGGER 0x20000 // WiFi Logger support +#define WLAN_FEATURE_HAL_EPNO 0x40000 // WiFi enhanced PNO support +#define WLAN_FEATURE_RSSI_MONITOR 0x80000 // RSSI Monitor support +#define WLAN_FEATURE_MKEEP_ALIVE 0x100000 // WiFi mkeep_alive support +#define WLAN_FEATURE_CONFIG_NDO 0x200000 // ND offload configure support #define WLAN_FEATURE_TX_TRANSMIT_POWER \ - 0x400000 // Capture Tx transmit power levels -#define WLAN_FEATURE_CONTROL_ROAMING 0x800000 // Enable/Disable firmware roaming -#define WLAN_FEATURE_IE_WHITELIST 0x1000000 // Probe IE white listing support + 0x400000 // Capture Tx transmit power levels +#define WLAN_FEATURE_CONTROL_ROAMING 0x800000 // Enable/Disable firmware roaming +#define WLAN_FEATURE_IE_WHITELIST 0x1000000 // Probe IE white listing support #define WLAN_FEATURE_SCAN_RAND \ - 0x2000000 // MAC & Probe Sequence Number randomization Support -#define WLAN_FEATURE_SET_LATENCY_MODE 0x40000000 // Support Latency mode setting + 0x2000000 // MAC & Probe Sequence Number randomization Support // Add more features here #define MAX_CHANNEL_NUM 200 @@ -597,7 +616,6 @@ ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE_MAX = 8, ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE = 9, ATTR_GET_CONCURRENCY_MATRIX_SET = 10, - ATTR_WIFI_LATENCY_MODE = 11, ATTR_WIFI_AFTER_LAST, ATTR_WIFI_MAX = ATTR_WIFI_AFTER_LAST - 1 } wifi_attr_t; @@ -610,7 +628,12 @@ enum vendor_event { event_hang = 0, event_fw_dump_done = 1, + event_fw_reset_success = 2, + event_fw_reset_failure = 3, + event_fw_reset_start = 4, event_rssi_monitor = 0x1501, + event_set_key_mgmt_offload = 0x10001, + event_fw_roam_success = 0x10002, event_cloud_keep_alive = 0x10003, event_dfs_radar_detected = 0x10004, event_dfs_cac_started = 0x10005, @@ -673,6 +696,7 @@ /**vendor sub command*/ enum vendor_sub_command { sub_cmd_set_drvdbg = 0, + sub_cmd_set_roaming_offload_key = 0x0002, sub_cmd_start_keep_alive = 0x0003, sub_cmd_stop_keep_alive = 0x0004, sub_cmd_dfs_capability = 0x0005, @@ -686,7 +710,6 @@ sub_cmd_get_valid_channels = 0x1009, sub_cmd_get_wifi_supp_feature_set = 0x100a, sub_cmd_set_country_code = 0x100d, - sub_cmd_set_latency_mode = 0x1015, sub_cmd_get_fw_version = 0x1404, sub_cmd_get_drv_version = 0x1406, sub_cmd_start_logging = 0x1400, @@ -697,16 +720,21 @@ sub_cmd_get_drv_mem_dump = 0x1407, sub_cmd_start_packet_fate_monitor = 0x1408, sub_cmd_rssi_monitor = 0x1500, - /*Sub-command for wifi hal */ + /*Sub-command for wifi hal*/ sub_cmd_get_roaming_capability = 0x1700, sub_cmd_fw_roaming_enable = 0x1701, sub_cmd_fw_roaming_config = 0x1702, + subcmd_cfr_request = 0x1900, + subcmd_cfr_cancel, + subcmd_get_csi_dump_path, + subcmd_get_csi_config, + subcmd_get_csi_capa, sub_cmd_max, }; void woal_register_cfg80211_vendor_command(struct wiphy *wiphy); -int woal_cfg80211_vendor_event(moal_private *priv, int event, - t_u8 *data, int len); +int woal_cfg80211_vendor_event(moal_private *priv, int event, t_u8 *data, + int len); enum mrvl_wlan_vendor_attr { MRVL_WLAN_VENDOR_ATTR_INVALID = 0, @@ -740,6 +768,25 @@ MKEEP_ALIVE_ATTRIBUTE_MAX = MKEEP_ALIVE_ATTRIBUTE_AFTER_LAST - 1 }; +int woal_roam_ap_info(moal_private *priv, t_u8 *data, int len); + +/*Attribute for wpa_supplicant*/ +enum mrvl_wlan_vendor_attr_roam_auth { + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_INVALID = 0, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_BSSID, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_REQ_IE, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_RESP_IE, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_AUTHORIZED, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_KEY_REPLAY_CTR, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KCK, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KEK, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_SUBNET_STATUS, + /* keep last */ + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_AFTER_LAST, + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_MAX = + MRVL_WLAN_VENDOR_ATTR_ROAM_AUTH_AFTER_LAST - 1 +}; + /** WiFi roaming capabilities structure */ typedef struct { /** max blacklist size */ @@ -785,5 +832,28 @@ MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_AFTER_LAST - 1 }; +enum attr_csi { + ATTR_CSI_INVALID = 0, + ATTR_CSI_CONFIG, + ATTR_PEER_MAC_ADDR, + ATTR_CSI_DUMP_PATH, + ATTR_CSI_CAPA, + ATTR_CSI_DUMP_FORMAT, + ATTR_CSI_AFTER_LAST, + ATTR_CSI_MAX = ATTR_CSI_AFTER_LAST - 1, +}; + +/** CSI capability structure */ +typedef struct { + /**Bit mask indicates what BW is supported */ + t_u8 bw_support; + /** Bit mask indicates what capturing method is supported */ + t_u8 method_support; + /** Max number of capture peers supported */ + t_u8 max_peer; +} wifi_csi_capabilities; + +mlan_status woal_cfg80211_event_csi_dump(moal_private *priv, t_u8 *data, + int len); #endif #endif /* _MOAL_CFGVENDOR_H_ */
diff --git a/wlan_sd8987/mlinux/moal_debug.c b/wlan_sd8987/mlinux/moal_debug.c index baa7fa6..1252ab5 100755 --- a/wlan_sd8987/mlinux/moal_debug.c +++ b/wlan_sd8987/mlinux/moal_debug.c
@@ -3,7 +3,7 @@ * @brief This file contains functions for debug proc file. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -117,6 +117,7 @@ item_addr(bypass_pkt_count), INFO_ADDR}, {"scan_processing", item_size(scan_processing), item_addr(scan_processing), INFO_ADDR}, + {"scan_state", item_size(scan_state), item_addr(scan_state), INFO_ADDR}, {"num_cmd_timeout", item_size(num_cmd_timeout), item_addr(num_cmd_timeout), INFO_ADDR}, {"timeout_cmd_id", item_size(timeout_cmd_id), item_addr(timeout_cmd_id), @@ -260,7 +261,7 @@ {"hs_force_count", item_handle_size(hs_force_count), item_handle_addr(hs_force_count), HANDLE_ADDR}, #ifdef STA_CFG80211 - {"scan_timeout", item_handle_size(scan_timeout), + {"scan_timeout", item_handle_size(scan_timeout), item_handle_addr(scan_timeout), HANDLE_ADDR}, #endif }; @@ -454,8 +455,7 @@ * * @return N/A */ -void -woal_hist_do_reset(moal_private *priv, void *data) +void woal_hist_do_reset(moal_private *priv, void *data) { hgm_data *phist_data = (hgm_data *)data; int ix; @@ -481,14 +481,12 @@ * * @return N/A */ -void -woal_hist_data_reset(moal_private *priv) +void woal_hist_data_reset(moal_private *priv) { int i = 0; for (i = 0; i < priv->phandle->card_info->histogram_table_num; i++) woal_hist_do_reset(priv, priv->hist_data[i]); } - /** * @brief This function reset histogram data according to antenna * @@ -496,8 +494,7 @@ * * @return N/A */ -void -woal_hist_reset_table(moal_private *priv, t_u8 antenna) +void woal_hist_reset_table(moal_private *priv, t_u8 antenna) { hgm_data *phist_data = priv->hist_data[antenna]; @@ -519,9 +516,8 @@ * * @return N/A */ -static void -woal_hist_data_set(moal_private *priv, t_u16 rx_rate, t_s8 snr, - t_s8 nflr, t_u8 antenna) +static void woal_hist_data_set(moal_private *priv, t_u16 rx_rate, t_s8 snr, + t_s8 nflr, t_u8 antenna) { hgm_data *phist_data = priv->hist_data[antenna]; t_s8 nf = CAL_NF(nflr); @@ -545,9 +541,8 @@ * * @return N/A */ -void -woal_hist_data_add(moal_private *priv, t_u16 rx_rate, t_s8 snr, t_s8 nflr, - t_u8 antenna) +void woal_hist_data_add(moal_private *priv, t_u16 rx_rate, t_s8 snr, t_s8 nflr, + t_u8 antenna) { hgm_data *phist_data = NULL; unsigned long curr_size; @@ -560,7 +555,6 @@ woal_hist_reset_table(priv, antenna); woal_hist_data_set(priv, rx_rate, snr, nflr, antenna); } - #define MAX_MCS_NUM_SUPP 16 #define MAX_MCS_NUM_AC 10 #define MAX_MCS_NUM_AX 12 @@ -572,8 +566,7 @@ * * @return Number of output data or MLAN_STATUS_FAILURE */ -static int -woal_histogram_info(struct seq_file *sfp, void *data) +static int woal_histogram_info(struct seq_file *sfp, void *data) { hgm_data *phist_data = (hgm_data *)data; int i = 0; @@ -583,7 +576,7 @@ t_u8 mcs_index = 0; t_u8 nss = 0; t_u8 gi = 0; - wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *) sfp->private; + wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *)sfp->private; moal_private *priv = (moal_private *)hist_data->priv; t_u16 rx_rate_max_size = priv->phandle->card_info->rx_rate_max; @@ -598,40 +591,57 @@ seq_printf(sfp, "rx rates (in Mbps):\n"); seq_printf(sfp, "\t0-3: B-MCS 0-3\n"); seq_printf(sfp, "\t4-11: G-MCS 0-7\n"); - seq_printf(sfp, - "\t12-27: N-MCS 0-15(BW20) 28-43: N-MCS 0-15(BW40)\n"); - seq_printf(sfp, - "\t44-59: N-MCS 0-15(BW20:SGI) 60-75: N-MCS 0-15(BW40:SGI)\n"); - seq_printf(sfp, - "\t76-85: AC-MCS 0-9(VHT:BW20:NSS1) 86-95: AC-MCS 0-9(VHT:BW20:NSS2)\n"); - seq_printf(sfp, - "\t96-105: AC-MCS 0-9(VHT:BW40:NSS1) 106-115: AC-MCS 0-9(VHT:BW40:NSS2)\n"); - seq_printf(sfp, - "\t116-125: AC-MCS 0-9(VHT:BW80:NSS1) 126-135: AC-MCS 0-9(VHT:BW80:NSS2)\n"); - seq_printf(sfp, - "\t136-145: AC-MCS 0-9(VHT:BW20:NSS1:SGI) 146-155: AC-MCS 0-9(VHT:BW20:NSS2:SGI)\n"); - seq_printf(sfp, - "\t156-165: AC-MCS 0-9(VHT:BW40:NSS1:SGI) 166-175: AC-MCS 0-9(VHT:BW40:NSS2:SGI)\n"); - seq_printf(sfp, - "\t176-185: AC-MCS 0-9(VHT:BW80:NSS1:SGI) 186-195: AC-MCS 0-9(VHT:BW80:NSS2:SGI)\n\n"); - seq_printf(sfp, - "\t196-207: AX-MCS 0-11(BW20:NSS1) 208-219: AX-MCS 0-11(BW20:NSS2)\n"); - seq_printf(sfp, - "\t220-231: AX-MCS 0-11(BW40:NSS1) 232-243: AX-MCS 0-11(BW40:NSS2)\n"); - seq_printf(sfp, - "\t244-255: AX-MCS 0-11(BW80:NSS1) 256-267: AX-MCS 0-11(BW80:NSS2)\n"); - seq_printf(sfp, - "\t268-279: AX-MCS 0-11(BW20:NSS1:GI1) 280-291: AX-MCS 0-11(BW20:NSS2:GI1)\n"); - seq_printf(sfp, - "\t292-303: AX-MCS 0-11(BW40:NSS1:GI1) 304-315: AX-MCS 0-11(BW40:NSS2:GI1)\n"); - seq_printf(sfp, - "\t316-327: AX-MCS 0-11(BW80:NSS1:GI1) 328-339: AX-MCS 0-11(BW80:NSS2:GI1)\n"); - seq_printf(sfp, - "\t340-351: AX-MCS 0-11(BW20:NSS1:GI2) 352-363: AX-MCS 0-11(BW20:NSS2:GI2)\n"); - seq_printf(sfp, - "\t364-375: AX-MCS 0-11(BW40:NSS1:GI2) 376-387: AX-MCS 0-11(BW40:NSS2:GI2)\n"); - seq_printf(sfp, - "\t388-399: AX-MCS 0-11(BW80:NSS1:GI2) 400-411: AX-MCS 0-11(BW80:NSS2:GI2)\n"); + seq_printf( + sfp, + "\t12-27: N-MCS 0-15(BW20) 28-43: N-MCS 0-15(BW40)\n"); + seq_printf( + sfp, + "\t44-59: N-MCS 0-15(BW20:SGI) 60-75: N-MCS 0-15(BW40:SGI)\n"); + seq_printf( + sfp, + "\t76-85: AC-MCS 0-9(VHT:BW20:NSS1) 86-95: AC-MCS 0-9(VHT:BW20:NSS2)\n"); + seq_printf( + sfp, + "\t96-105: AC-MCS 0-9(VHT:BW40:NSS1) 106-115: AC-MCS 0-9(VHT:BW40:NSS2)\n"); + seq_printf( + sfp, + "\t116-125: AC-MCS 0-9(VHT:BW80:NSS1) 126-135: AC-MCS 0-9(VHT:BW80:NSS2)\n"); + seq_printf( + sfp, + "\t136-145: AC-MCS 0-9(VHT:BW20:NSS1:SGI) 146-155: AC-MCS 0-9(VHT:BW20:NSS2:SGI)\n"); + seq_printf( + sfp, + "\t156-165: AC-MCS 0-9(VHT:BW40:NSS1:SGI) 166-175: AC-MCS 0-9(VHT:BW40:NSS2:SGI)\n"); + seq_printf( + sfp, + "\t176-185: AC-MCS 0-9(VHT:BW80:NSS1:SGI) 186-195: AC-MCS 0-9(VHT:BW80:NSS2:SGI)\n\n"); + seq_printf( + sfp, + "\t196-207: AX-MCS 0-11(BW20:NSS1) 208-219: AX-MCS 0-11(BW20:NSS2)\n"); + seq_printf( + sfp, + "\t220-231: AX-MCS 0-11(BW40:NSS1) 232-243: AX-MCS 0-11(BW40:NSS2)\n"); + seq_printf( + sfp, + "\t244-255: AX-MCS 0-11(BW80:NSS1) 256-267: AX-MCS 0-11(BW80:NSS2)\n"); + seq_printf( + sfp, + "\t268-279: AX-MCS 0-11(BW20:NSS1:GI1) 280-291: AX-MCS 0-11(BW20:NSS2:GI1)\n"); + seq_printf( + sfp, + "\t292-303: AX-MCS 0-11(BW40:NSS1:GI1) 304-315: AX-MCS 0-11(BW40:NSS2:GI1)\n"); + seq_printf( + sfp, + "\t316-327: AX-MCS 0-11(BW80:NSS1:GI1) 328-339: AX-MCS 0-11(BW80:NSS2:GI1)\n"); + seq_printf( + sfp, + "\t340-351: AX-MCS 0-11(BW20:NSS1:GI2) 352-363: AX-MCS 0-11(BW20:NSS2:GI2)\n"); + seq_printf( + sfp, + "\t364-375: AX-MCS 0-11(BW40:NSS1:GI2) 376-387: AX-MCS 0-11(BW40:NSS2:GI2)\n"); + seq_printf( + sfp, + "\t388-399: AX-MCS 0-11(BW80:NSS1:GI2) 400-411: AX-MCS 0-11(BW80:NSS2:GI2)\n"); for (i = 0; i < rx_rate_max_size; i++) { value = atomic_read(&(phist_data->rx_rate[i])); @@ -640,37 +650,49 @@ seq_printf(sfp, "rx_rate[%03d] = %d\n", i, value); else if (i <= 75) { - sgi_enable = (i - 12) / (MAX_MCS_NUM_SUPP * 2); // 0:LGI, - // 1:SGI - bw = ((i - 12) % (MAX_MCS_NUM_SUPP * 2)) / MAX_MCS_NUM_SUPP; // 0:20MHz, 1:40MHz + sgi_enable = (i - 12) / + (MAX_MCS_NUM_SUPP * 2); // 0:LGI, + // 1:SGI + bw = ((i - 12) % (MAX_MCS_NUM_SUPP * 2)) / + MAX_MCS_NUM_SUPP; // 0:20MHz, 1:40MHz mcs_index = (i - 12) % MAX_MCS_NUM_SUPP; - seq_printf(sfp, - "rx_rate[%03d] = %d (MCS:%d HT BW:%dMHz%s)\n", - i, value, mcs_index, (1 << bw) * 20, - sgi_enable ? " SGI" : ""); + seq_printf( + sfp, + "rx_rate[%03d] = %d (MCS:%d HT BW:%dMHz%s)\n", + i, value, mcs_index, (1 << bw) * 20, + sgi_enable ? " SGI" : ""); } else if (i <= 195) { - sgi_enable = (i - 76) / (MAX_MCS_NUM_AC * 6); // 0:LGI, - // 1:SGI - bw = ((i - 76) % (MAX_MCS_NUM_AC * 6)) / (MAX_MCS_NUM_AC * 2); // 0:20MHz, 1:40MHz, - // 2:80MHz - nss = (((i - 76) % (MAX_MCS_NUM_AC * 6)) % (MAX_MCS_NUM_AC * 2)) / MAX_MCS_NUM_AC; // 0:NSS1, 1:NSS2 + sgi_enable = (i - 76) / + (MAX_MCS_NUM_AC * 6); // 0:LGI, + // 1:SGI + bw = ((i - 76) % (MAX_MCS_NUM_AC * 6)) / + (MAX_MCS_NUM_AC * 2); // 0:20MHz, 1:40MHz, + // 2:80MHz + nss = (((i - 76) % (MAX_MCS_NUM_AC * 6)) % + (MAX_MCS_NUM_AC * 2)) / + MAX_MCS_NUM_AC; // 0:NSS1, 1:NSS2 mcs_index = (i - 76) % MAX_MCS_NUM_AC; - seq_printf(sfp, - "rx_rate[%03d] = %d (MCS:%d VHT BW:%dMHz NSS:%d%s)\n", - i, value, mcs_index, (1 << bw) * 20, - nss + 1, sgi_enable ? " SGI" : ""); + seq_printf( + sfp, + "rx_rate[%03d] = %d (MCS:%d VHT BW:%dMHz NSS:%d%s)\n", + i, value, mcs_index, (1 << bw) * 20, + nss + 1, sgi_enable ? " SGI" : ""); } else if (i <= 411) { - gi = (i - 196) / (MAX_MCS_NUM_AX * 6); // 0,1,2 - bw = ((i - 196) % (MAX_MCS_NUM_AX * 6)) / (MAX_MCS_NUM_AX * 2); // 0:20MHz, 1:40MHz, - // 2:80MHz - nss = (((i - 196) % (MAX_MCS_NUM_AX * 6)) % (MAX_MCS_NUM_AX * 2)) / MAX_MCS_NUM_AX; // 0:NSS1, 1:NSS2 + gi = (i - 196) / (MAX_MCS_NUM_AX * 6); // 0,1,2 + bw = ((i - 196) % (MAX_MCS_NUM_AX * 6)) / + (MAX_MCS_NUM_AX * 2); // 0:20MHz, 1:40MHz, + // 2:80MHz + nss = (((i - 196) % (MAX_MCS_NUM_AX * 6)) % + (MAX_MCS_NUM_AX * 2)) / + MAX_MCS_NUM_AX; // 0:NSS1, 1:NSS2 mcs_index = (i - 196) % MAX_MCS_NUM_AX; - seq_printf(sfp, - "rx_rate[%03d] = %d (MCS:%d AX BW:%dMHz NSS:%d GI:%d)\n", - i, value, mcs_index, (1 << bw) * 20, - nss + 1, gi); + seq_printf( + sfp, + "rx_rate[%03d] = %d (MCS:%d AX BW:%dMHz NSS:%d GI:%d)\n", + i, value, mcs_index, (1 << bw) * 20, + nss + 1, gi); } } } @@ -706,10 +728,9 @@ * * @return Number of output data or MLAN_STATUS_FAILURE */ -static int -woal_histogram_read(struct seq_file *sfp, void *data) +static int woal_histogram_read(struct seq_file *sfp, void *data) { - wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *) sfp->private; + wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *)sfp->private; moal_private *priv = (moal_private *)hist_data->priv; ENTER(); @@ -725,10 +746,11 @@ return 0; } -static int -woal_histogram_proc_open(struct inode *inode, struct file *file) +static int woal_histogram_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_histogram_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_histogram_read, PDE_DATA(inode)); #else return single_open(file, woal_histogram_read, PDE(inode)->data); @@ -745,12 +767,11 @@ * * @return number of data */ -static ssize_t -woal_histogram_write(struct file *f, const char __user * buf, - size_t count, loff_t * off) +static ssize_t woal_histogram_write(struct file *f, const char __user *buf, + size_t count, loff_t *off) { struct seq_file *sfp = f->private_data; - wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *) sfp->private; + wlan_hist_proc_data *hist_data = (wlan_hist_proc_data *)sfp->private; moal_private *priv = (moal_private *)hist_data->priv; woal_hist_reset_table(priv, hist_data->ant_idx); return count; @@ -764,8 +785,7 @@ * * @return Number of output data or MLAN_STATUS_FAILURE */ -static int -woal_log_read(struct seq_file *sfp, void *data) +static int woal_log_read(struct seq_file *sfp, void *data) { moal_private *priv = (moal_private *)sfp->private; mlan_ds_get_stats stats; @@ -927,10 +947,11 @@ * * @return number of data */ -static int -woal_log_proc_open(struct inode *inode, struct file *file) +static int woal_log_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_log_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_log_read, PDE_DATA(inode)); #else return single_open(file, woal_log_read, PDE(inode)->data); @@ -948,8 +969,7 @@ * * @return Number of output data or MLAN_STATUS_FAILURE */ -static int -woal_debug_read(struct seq_file *sfp, void *data) +static int woal_debug_read(struct seq_file *sfp, void *data) { int val = 0; unsigned int i; @@ -1011,7 +1031,7 @@ #ifdef PCIE || strstr(d[i].name, "ptr") #endif - ) + ) seq_printf(sfp, "%s=0x%x\n", d[i].name, val); else seq_printf(sfp, "%s=%d\n", d[i].name, val); @@ -1025,16 +1045,17 @@ "last_recv_rd_bitmap=0x%x mp_data_port_mask=0x%x\n", info->last_recv_rd_bitmap, info->mp_data_port_mask); for (i = 0; i < SDIO_MP_DBG_NUM; i++) { - seq_printf(sfp, - "mp_wr_bitmap: 0x%x mp_wr_ports=0x%x len=%d curr_wr_port=0x%x\n", - info->last_mp_wr_bitmap[i], - info->last_mp_wr_ports[i], - info->last_mp_wr_len[i], - info->last_curr_wr_port[i]); + seq_printf( + sfp, + "mp_wr_bitmap: 0x%x mp_wr_ports=0x%x len=%d curr_wr_port=0x%x\n", + info->last_mp_wr_bitmap[i], + info->last_mp_wr_ports[i], + info->last_mp_wr_len[i], + info->last_curr_wr_port[i]); for (j = 0; j < mp_aggr_pkt_limit; j++) { seq_printf(sfp, "0x%02x ", info->last_mp_wr_info - [i * mp_aggr_pkt_limit + j]); + [i * mp_aggr_pkt_limit + j]); } seq_printf(sfp, "\n"); } @@ -1076,28 +1097,30 @@ if (info->tx_tbl_num) { seq_printf(sfp, "Tx BA stream table:\n"); for (i = 0; i < info->tx_tbl_num; i++) { - seq_printf(sfp, - "tid = %d, ra = %02x:%02x:%02x:%02x:%02x:%02x amsdu=%d\n", - (int)info->tx_tbl[i].tid, - info->tx_tbl[i].ra[0], info->tx_tbl[i].ra[1], - info->tx_tbl[i].ra[2], info->tx_tbl[i].ra[3], - info->tx_tbl[i].ra[4], info->tx_tbl[i].ra[5], - (int)info->tx_tbl[i].amsdu); + seq_printf( + sfp, + "tid = %d, ra = %02x:%02x:%02x:%02x:%02x:%02x amsdu=%d\n", + (int)info->tx_tbl[i].tid, info->tx_tbl[i].ra[0], + info->tx_tbl[i].ra[1], info->tx_tbl[i].ra[2], + info->tx_tbl[i].ra[3], info->tx_tbl[i].ra[4], + info->tx_tbl[i].ra[5], + (int)info->tx_tbl[i].amsdu); } } if (info->rx_tbl_num) { seq_printf(sfp, "Rx reorder table:\n"); for (i = 0; i < info->rx_tbl_num; i++) { - seq_printf(sfp, - "tid = %d, ta = %02x:%02x:%02x:%02x:%02x:%02x, start_win = %d, " - "win_size = %d, amsdu=%d", - (int)info->rx_tbl[i].tid, - info->rx_tbl[i].ta[0], info->rx_tbl[i].ta[1], - info->rx_tbl[i].ta[2], info->rx_tbl[i].ta[3], - info->rx_tbl[i].ta[4], info->rx_tbl[i].ta[5], - (int)info->rx_tbl[i].start_win, - (int)info->rx_tbl[i].win_size, - (int)info->rx_tbl[i].amsdu); + seq_printf( + sfp, + "tid = %d, ta = %02x:%02x:%02x:%02x:%02x:%02x, start_win = %d, " + "win_size = %d, amsdu=%d", + (int)info->rx_tbl[i].tid, info->rx_tbl[i].ta[0], + info->rx_tbl[i].ta[1], info->rx_tbl[i].ta[2], + info->rx_tbl[i].ta[3], info->rx_tbl[i].ta[4], + info->rx_tbl[i].ta[5], + (int)info->rx_tbl[i].start_win, + (int)info->rx_tbl[i].win_size, + (int)info->rx_tbl[i].amsdu); seq_printf(sfp, "\n"); seq_printf(sfp, "buffer: "); @@ -1111,26 +1134,28 @@ } } for (i = 0; i < info->ralist_num; i++) { - seq_printf(sfp, - "ralist ra: %02x:%02x:%02x:%02x:%02x:%02x tid=%d pkts=%d pause=%d\n", - info->ralist[i].ra[0], info->ralist[i].ra[1], - info->ralist[i].ra[2], info->ralist[i].ra[3], - info->ralist[i].ra[4], info->ralist[i].ra[5], - info->ralist[i].tid, info->ralist[i].total_pkts, - info->ralist[i].tx_pause); + seq_printf( + sfp, + "ralist ra: %02x:%02x:%02x:%02x:%02x:%02x tid=%d pkts=%d pause=%d\n", + info->ralist[i].ra[0], info->ralist[i].ra[1], + info->ralist[i].ra[2], info->ralist[i].ra[3], + info->ralist[i].ra[4], info->ralist[i].ra[5], + info->ralist[i].tid, info->ralist[i].total_pkts, + info->ralist[i].tx_pause); } for (i = 0; i < info->tdls_peer_num; i++) { - seq_printf(sfp, - "tdls peer: %02x:%02x:%02x:%02x:%02x:%02x snr=%d nf=%d\n", - info->tdls_peer_list[i].mac_addr[0], - info->tdls_peer_list[i].mac_addr[1], - info->tdls_peer_list[i].mac_addr[2], - info->tdls_peer_list[i].mac_addr[3], - info->tdls_peer_list[i].mac_addr[4], - info->tdls_peer_list[i].mac_addr[5], - info->tdls_peer_list[i].snr, - -info->tdls_peer_list[i].nf); + seq_printf( + sfp, + "tdls peer: %02x:%02x:%02x:%02x:%02x:%02x snr=%d nf=%d\n", + info->tdls_peer_list[i].mac_addr[0], + info->tdls_peer_list[i].mac_addr[1], + info->tdls_peer_list[i].mac_addr[2], + info->tdls_peer_list[i].mac_addr[3], + info->tdls_peer_list[i].mac_addr[4], + info->tdls_peer_list[i].mac_addr[5], + info->tdls_peer_list[i].snr, + -info->tdls_peer_list[i].nf); seq_printf(sfp, "htcap: "); for (j = 0; j < sizeof(IEEEtypes_HTCap_t); j++) seq_printf(sfp, "%02x ", @@ -1162,9 +1187,8 @@ * * @return number of data */ -static ssize_t -woal_debug_write(struct file *f, const char __user * buf, - size_t count, loff_t * off) +static ssize_t woal_debug_write(struct file *f, const char __user *buf, + size_t count, loff_t *off) { int r, i; char *pdata; @@ -1189,7 +1213,7 @@ LEAVE(); return MLAN_STATUS_FAILURE; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; pdata = kzalloc(count + 1, flag); if (pdata == NULL) { MODULE_PUT; @@ -1249,10 +1273,11 @@ return count; } -static int -woal_debug_proc_open(struct inode *inode, struct file *file) +static int woal_debug_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_debug_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_debug_read, PDE_DATA(inode)); #else return single_open(file, woal_debug_read, PDE(inode)->data); @@ -1323,8 +1348,7 @@ * * @return N/A */ -void -woal_debug_entry(moal_private *priv) +void woal_debug_entry(moal_private *priv) { struct proc_dir_entry *r; int i; @@ -1337,6 +1361,7 @@ LEAVE(); return; } + #ifdef STA_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { priv->items_priv.items = kmalloc(sizeof(items), GFP_KERNEL); @@ -1372,7 +1397,7 @@ d = priv->items_priv.items; for (i = 0; i < priv->items_priv.num_of_items; i++) { if (IS_INFO_ADDR(d[i].attr)) - d[i].addr += (t_ptr)&(priv->phandle->debug_info); + d[i].addr += (t_ptr) & (priv->phandle->debug_info); else if (IS_HANDLE_ADDR(d[i].attr)) d[i].addr += (t_ptr)(priv->phandle); else if (IS_PRIV_ADDR(d[i].attr)) @@ -1434,6 +1459,7 @@ } } } + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) r = proc_create_data("log", 0644, priv->proc_entry, &log_proc_fops, priv); @@ -1461,8 +1487,7 @@ * * @return N/A */ -void -woal_debug_remove(moal_private *priv) +void woal_debug_remove(moal_private *priv) { char hist_entry[50]; int i;
diff --git a/wlan_sd8987/mlinux/moal_eth_ioctl.c b/wlan_sd8987/mlinux/moal_eth_ioctl.c index 58e4aa7..3081f33 100755 --- a/wlan_sd8987/mlinux/moal_eth_ioctl.c +++ b/wlan_sd8987/mlinux/moal_eth_ioctl.c
@@ -4,7 +4,7 @@ * @brief This file contains private ioctl functions * - * Copyright 2014-2021 NXP + * Copyright 2014-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -56,6 +56,9 @@ #include "moal_cfg80211_util.h" #endif #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +#include <linux/compat.h> +#endif /******************************************************** Local Variables @@ -94,7 +97,7 @@ }; /** Bands supported in Ad-Hoc mode */ -static t_u8 SupportedAdhocBand[] = { +static t_u16 SupportedAdhocBand[] = { BAND_B, BAND_B | BAND_G, BAND_G, @@ -116,7 +119,7 @@ #endif /******************************************************** - Local Functions + Global Functions ********************************************************/ /** * @brief Parse a string to extract numerical arguments @@ -128,8 +131,8 @@ * * @return MLAN_STATUS_SUCCESS */ -static mlan_status -parse_arguments(t_u8 *pos, int *data, int datalen, int *user_data_len) +mlan_status parse_arguments(t_u8 *pos, int *data, int datalen, + int *user_data_len) { int i, j, k; char cdata[10]; @@ -178,6 +181,10 @@ return MLAN_STATUS_SUCCESS; } +/******************************************************** + Local Functions +********************************************************/ + #if defined(STA_CFG80211) && defined(UAP_CFG80211) /** * @brief Set wps & p2p ie in AP mode @@ -188,8 +195,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_ap_wps_p2p_ie(moal_private *priv, t_u8 *ie, size_t len) +mlan_status woal_set_ap_wps_p2p_ie(moal_private *priv, t_u8 *ie, size_t len) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 *pos = ie; @@ -213,10 +219,9 @@ /* set the beacon wps/p2p ies */ pos += 2; if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, pos, ie_len, NULL, 0, - NULL, 0, NULL, 0, - MGMT_MASK_BEACON_WPS_P2P, - MOAL_IOCTL_WAIT)) { + woal_cfg80211_mgmt_frame_ie( + priv, pos, ie_len, NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); ret = -EFAULT; goto done; @@ -225,10 +230,9 @@ /* set the probe resp ies */ pos += 2; if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, pos, ie_len, - NULL, 0, NULL, 0, - MGMT_MASK_PROBE_RESP, - MOAL_IOCTL_WAIT)) { + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, pos, ie_len, NULL, 0, NULL, 0, + MGMT_MASK_PROBE_RESP, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Failed to set probe resp ie\n"); ret = -EFAULT; goto done; @@ -237,10 +241,9 @@ /* set the assoc resp ies */ pos += 2; if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, pos, - ie_len, NULL, 0, - MGMT_MASK_ASSOC_RESP, - MOAL_IOCTL_WAIT)) { + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, pos, ie_len, NULL, 0, + MGMT_MASK_ASSOC_RESP, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Failed to set assoc resp ie\n"); ret = -EFAULT; goto done; @@ -264,8 +267,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -static mlan_status -woal_set_miracast_mode(moal_private *priv, t_u8 *pdata, size_t len) +static mlan_status woal_set_miracast_mode(moal_private *priv, t_u8 *pdata, + size_t len) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 *pos = pdata; @@ -313,9 +316,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_get_priv_driver_version(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_get_priv_driver_version(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int len = 0, ret = -1; char buf[MLAN_MAX_VER_STR_LEN]; @@ -347,7 +349,6 @@ LEAVE(); return ret; } - /** * @brief Hostcmd interface from application * @@ -358,9 +359,8 @@ * * @return Number of bytes written, negative for failure. */ -int -woal_priv_hostcmd(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, - t_u8 wait_option) +int woal_priv_hostcmd(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, + t_u8 wait_option) { int ret = 0; t_u8 *data_ptr; @@ -405,17 +405,16 @@ goto error; } ret = misc_cfg->param.hostcmd.len + sizeof(buf_len) + strlen(CMD_NXP) + - strlen(PRIV_CMD_HOSTCMD); + strlen(PRIV_CMD_HOSTCMD); if (ret > (int)respbuflen) { ret = -EFAULT; goto error; } - moal_memcpy_ext(priv->phandle, data_ptr + sizeof(buf_len), - misc_cfg->param.hostcmd.cmd, - misc_cfg->param.hostcmd.len, - respbuflen - (strlen(CMD_NXP) + - strlen(PRIV_CMD_HOSTCMD) + - sizeof(buf_len))); + moal_memcpy_ext( + priv->phandle, data_ptr + sizeof(buf_len), + misc_cfg->param.hostcmd.cmd, misc_cfg->param.hostcmd.len, + respbuflen - (strlen(CMD_NXP) + strlen(PRIV_CMD_HOSTCMD) + + sizeof(buf_len))); moal_memcpy_ext(priv->phandle, data_ptr, (t_u8 *)&misc_cfg->param.hostcmd.len, sizeof(t_u32), sizeof(t_u32)); @@ -439,16 +438,15 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_setget_priv_11axcmdcfg(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen, t_u8 wait_option) +static int woal_setget_priv_11axcmdcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_11ax_cmd_cfg *cfg = NULL; int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; int header_len = 0, user_data_len = 0; - int data[3] = { 0 }; + int data[4] = {0}; ENTER(); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11ax_cmd_cfg)); @@ -460,7 +458,7 @@ req->req_id = MLAN_IOCTL_11AX_CFG; req->action = MLAN_ACT_SET; - cfg = (mlan_ds_11ax_cmd_cfg *) req->pbuf; + cfg = (mlan_ds_11ax_cmd_cfg *)req->pbuf; cfg->sub_command = MLAN_OID_11AX_CMD_CFG; parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), @@ -468,7 +466,7 @@ PRINTM(MINFO, "data_len=%d,data=%d,%d,%d\n", user_data_len, data[0], data[1], data[2]); - if (user_data_len > 3 || user_data_len == 0) { + if (user_data_len > 4 || user_data_len == 0) { PRINTM(MERROR, "Invalid parameters\n"); ret = -EFAULT; goto done; @@ -505,6 +503,8 @@ case MLAN_11AXCMD_CFG_ID_TX_OMI: cfg->sub_id = MLAN_11AXCMD_TXOMI_SUBID; cfg->param.txomi_cfg.omi = data[1]; + cfg->param.txomi_cfg.tx_option = data[2]; + cfg->param.txomi_cfg.num_data_pkts = data[3]; break; case MLAN_11AXCMD_CFG_ID_OBSSNBRU_TOLTIME: cfg->sub_id = MLAN_11AXCMD_OBSS_TOLTIME_SUBID; @@ -525,7 +525,7 @@ sizeof(req->action), sizeof(req->action)); respbuf += sizeof(req->action); - cfg = (mlan_ds_11ax_cmd_cfg *) respbuf; + cfg = (mlan_ds_11ax_cmd_cfg *)respbuf; moal_memcpy_ext(priv->phandle, cfg, req->pbuf, sizeof(mlan_ds_11ax_cmd_cfg), respbuflen); @@ -549,8 +549,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_setget_priv_range_ext(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_range_ext(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -629,8 +629,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_customie(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_customie(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; t_u8 *data_ptr; @@ -671,7 +671,7 @@ moal_memcpy_ext(priv->phandle, pcustom_ie, &misc->param.cust_ie, sizeof(mlan_ds_misc_custom_ie), respbuflen - - (strlen(CMD_NXP) + strlen(PRIV_CMD_CUSTOMIE))); + (strlen(CMD_NXP) + strlen(PRIV_CMD_CUSTOMIE))); ret = sizeof(mlan_ds_misc_custom_ie); if (ioctl_req->status_code == MLAN_ERROR_IOCTL_FAIL) { /* send a separate error code to indicate error from driver */ @@ -693,8 +693,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; unsigned int i; @@ -717,7 +717,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_BANDCFG), + strlen(PRIV_CMD_BANDCFG), data, ARRAY_SIZE(data), &user_data_len); } @@ -751,8 +751,10 @@ } else { /* To support only <b/bg/bgn/n/aac/gac> */ infra_band = data[0]; + for (i = 0; i < (sizeof(SupportedInfraBand) / - sizeof(SupportedInfraBand[0])); i++) + sizeof(SupportedInfraBand[0])); + i++) if (infra_band == SupportedInfraBand[i]) break; if (i == sizeof(SupportedInfraBand)) { @@ -763,7 +765,9 @@ /* Set Adhoc band */ if (user_data_len >= 2) { adhoc_band = data[1]; - for (i = 0; i < sizeof(SupportedAdhocBand); i++) + for (i = 0; i < (sizeof(SupportedAdhocBand) / + sizeof(SupportedAdhocBand[0])); + i++) if (adhoc_band == SupportedAdhocBand[i]) break; if (i == sizeof(SupportedAdhocBand)) { @@ -819,8 +823,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_httxcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_httxcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[2]; mlan_ioctl_req *req = NULL; @@ -838,7 +842,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_HTTXCFG), + strlen(PRIV_CMD_HTTXCFG), data, ARRAY_SIZE(data), &user_data_len); } @@ -918,8 +922,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_htcapinfo(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_htcapinfo(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[2]; mlan_ioctl_req *req = NULL; @@ -938,7 +942,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_HTCAPINFO), + strlen(PRIV_CMD_HTCAPINFO), data, ARRAY_SIZE(data), &user_data_len); } @@ -1020,8 +1024,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_addbapara(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_addbapara(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[5]; mlan_ioctl_req *req = NULL; @@ -1040,7 +1044,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_ADDBAPARA), + strlen(PRIV_CMD_ADDBAPARA), data, ARRAY_SIZE(data), &user_data_len); if (user_data_len != ARRAY_SIZE(data)) { @@ -1126,10 +1130,9 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_delba(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_delba(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { - t_u32 data[2] = { 0xFF, 0xFF }; + t_u32 data[2] = {0xFF, 0xFF}; mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; mlan_ds_11n_delba *del_ba = NULL; @@ -1137,7 +1140,7 @@ int user_data_len = 0; int header_len = 0; t_u8 *mac_pos = NULL; - t_u8 peer_mac[ETH_ALEN] = { 0 }; + t_u8 peer_mac[ETH_ALEN] = {0}; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -1223,8 +1226,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_rejectaddbareq(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_rejectaddbareq(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[1]; mlan_ioctl_req *req = NULL; @@ -1243,7 +1246,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_REJECTADDBAREQ), + strlen(PRIV_CMD_REJECTADDBAREQ), data, ARRAY_SIZE(data), &user_data_len); } @@ -1264,7 +1267,7 @@ req->req_id = MLAN_IOCTL_11N_CFG; if (user_data_len == 0) { - /* Get the reject addba req conditions */ + /* Get the reject addba req conditions*/ req->action = MLAN_ACT_GET; } else { /* Set the reject addba req conditions */ @@ -1303,8 +1306,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_ioctl_addba_reject(moal_private *priv, t_u32 action, t_u8 *addba_reject) +static mlan_status woal_ioctl_addba_reject(moal_private *priv, t_u32 action, + t_u8 *addba_reject) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; @@ -1353,9 +1356,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_ioctl_aggr_prio_tbl(moal_private *priv, t_u32 action, - mlan_ds_11n_aggr_prio_tbl *aggr_prio_tbl) +mlan_status woal_ioctl_aggr_prio_tbl(moal_private *priv, t_u32 action, + mlan_ds_11n_aggr_prio_tbl *aggr_prio_tbl) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; @@ -1405,9 +1407,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_ioctl_addba_param(moal_private *priv, t_u32 action, - mlan_ds_11n_addba_param *addba_param) +static mlan_status woal_ioctl_addba_param(moal_private *priv, t_u32 action, + mlan_ds_11n_addba_param *addba_param) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; @@ -1455,8 +1456,8 @@ * * @return 0 --success, otherwise failure */ -static int -woal_set_rx_ba_winsize(moal_private *priv, t_u8 *respbuf, int respbuflen) +static int woal_set_rx_ba_winsize(moal_private *priv, t_u8 *respbuf, + int respbuflen) { int data[2]; t_u8 addba_reject[MAX_NUM_TID]; @@ -1519,14 +1520,13 @@ if (MLAN_STATUS_SUCCESS != woal_ioctl_addba_param(priv, MLAN_ACT_SET, &addba_param)) - ret = -EFAULT; + ret = -EFAULT; } } done: LEAVE(); return ret; } - /** * @brief Configuring trx block-ack window size * @@ -1536,15 +1536,14 @@ * * @return 0 --success, otherwise failure */ -static int -woal_set_tx_ba_winsize(moal_private *priv, t_u8 *respbuf, int respbuflen) +static int woal_set_tx_ba_winsize(moal_private *priv, t_u8 *respbuf, + int respbuflen) { int data[2]; mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl; mlan_ds_11n_addba_param addba_param; - t_u8 tos_to_tid_inv[] = { 0x02, 0x00, 0x01, 0x03, - 0x04, 0x05, 0x06, 0x07 - }; + t_u8 tos_to_tid_inv[] = {0x02, 0x00, 0x01, 0x03, + 0x04, 0x05, 0x06, 0x07}; int ret = 0; int user_data_len = 0; @@ -1583,7 +1582,7 @@ if (MLAN_STATUS_SUCCESS != woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, &aggr_prio_tbl)) - ret = -EFAULT; + ret = -EFAULT; } } else { if (aggr_prio_tbl.ampdu[data[0]] == 0xff) { @@ -1606,7 +1605,7 @@ if (MLAN_STATUS_SUCCESS != woal_ioctl_addba_param(priv, MLAN_ACT_SET, &addba_param)) - ret = -EFAULT; + ret = -EFAULT; } } done: @@ -1623,9 +1622,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_aggrpriotbl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_setget_priv_aggrpriotbl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[MAX_NUM_TID * 2], i, j; mlan_ioctl_req *req = NULL; @@ -1636,14 +1634,15 @@ ENTER(); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_AGGRPRIOTBL))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_AGGRPRIOTBL))) { /* GET operation */ user_data_len = 0; } else { /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_AGGRPRIOTBL), + strlen(PRIV_CMD_AGGRPRIOTBL), data, ARRAY_SIZE(data), &user_data_len); if (user_data_len != ARRAY_SIZE(data)) { @@ -1711,9 +1710,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_addbareject(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_setget_priv_addbareject(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[MAX_NUM_TID], i; mlan_ioctl_req *req = NULL; @@ -1724,14 +1722,15 @@ ENTER(); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_ADDBAREJECT))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_ADDBAREJECT))) { /* GET operation */ user_data_len = 0; } else { /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_ADDBAREJECT), + strlen(PRIV_CMD_ADDBAREJECT), data, ARRAY_SIZE(data), &user_data_len); if (user_data_len != ARRAY_SIZE(data)) { @@ -1794,8 +1793,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_vhtcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_vhtcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[6]; mlan_ioctl_req *req = NULL; @@ -1950,9 +1949,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_opermodecfg(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_setget_priv_opermodecfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[2]; mlan_ioctl_req *req = NULL; @@ -1966,7 +1964,7 @@ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_OPERMODECFG), + strlen(PRIV_CMD_OPERMODECFG), data, ARRAY_SIZE(data), &user_data_len); if ((user_data_len != 0) && (user_data_len != 2)) { @@ -2012,7 +2010,7 @@ ret = -EFAULT; goto done; } - opermodecfg = (mlan_ds_11ac_opermode_cfg *) respbuf; + opermodecfg = (mlan_ds_11ac_opermode_cfg *)respbuf; moal_memcpy_ext(priv->phandle, opermodecfg, &(cfg_11ac->param.opermode_cfg), sizeof(*opermodecfg), respbuflen); @@ -2034,8 +2032,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_get_priv_datarate(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_get_priv_datarate(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_rate *rate = NULL; @@ -2085,8 +2083,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_txratecfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_txratecfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[4]; mlan_ioctl_req *req = NULL; @@ -2106,7 +2104,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_TXRATECFG), + strlen(PRIV_CMD_TXRATECFG), data, ARRAY_SIZE(data), &user_data_len); } @@ -2146,8 +2144,7 @@ /* fixed rate */ PRINTM(MINFO, "SET: txratefg format: 0x%x\n", data[0]); if ((data[0] != AUTO_RATE) && - (data[0] > MLAN_RATE_FORMAT_HE) - ) { + (data[0] > MLAN_RATE_FORMAT_HE)) { PRINTM(MERROR, "Invalid format selection\n"); ret = -EINVAL; goto done; @@ -2161,13 +2158,11 @@ if (((data[0] == MLAN_RATE_FORMAT_LG) && (data[1] > MLAN_RATE_INDEX_OFDM7)) || ((data[0] == MLAN_RATE_FORMAT_HT) && - (data[1] != 32) && (data[1] > 15) - ) - || ((data[0] == MLAN_RATE_FORMAT_VHT) && - (data[1] > MLAN_RATE_INDEX_MCS9)) - || ((data[0] == MLAN_RATE_FORMAT_HE) && - (data[1] > MLAN_RATE_INDEX_MCS11)) - ) { + (data[1] != 32) && (data[1] > 15)) || + ((data[0] == MLAN_RATE_FORMAT_VHT) && + (data[1] > MLAN_RATE_INDEX_MCS9)) || + ((data[0] == MLAN_RATE_FORMAT_HE) && + (data[1] > MLAN_RATE_INDEX_MCS11))) { PRINTM(MERROR, "Invalid index selection\n"); ret = -EINVAL; @@ -2206,31 +2201,29 @@ #define HE_ER_SU_BANDWIDTH_TONE242 0 #define HE_ER_SU_BANDWIDTH_TONE106 1 - rate_setting = (txrate_setting *) & data[3]; + rate_setting = (txrate_setting *)&data[3]; if (data[0] == MLAN_RATE_FORMAT_HE) { if (rate_setting->preamble == HE_ER_PREAMBLE) { if (rate_setting->bandwidth == - HE_ER_SU_BANDWIDTH_TONE242) - { + HE_ER_SU_BANDWIDTH_TONE242) { if ((data[1] > - MLAN_RATE_INDEX_MCS2) - || data[2] > - MLAN_RATE_NSS1) { + MLAN_RATE_INDEX_MCS2) || + data[2] > + MLAN_RATE_NSS1) { PRINTM(MERROR, "Invalid rate and MCS or NSS configuration for 242 tone\n"); ret = -EINVAL; goto done; } - } else if (rate_setting-> - bandwidth == - HE_ER_SU_BANDWIDTH_TONE106) - { + } else if (rate_setting + ->bandwidth == + HE_ER_SU_BANDWIDTH_TONE106) { if ((data[1] != - MLAN_RATE_INDEX_MCS0) - || data[2] != - MLAN_RATE_NSS1) { + MLAN_RATE_INDEX_MCS0) || + data[2] != + MLAN_RATE_NSS1) { PRINTM(MERROR, "Invalid rate and MCS or NSS configuration\n for 106 tone"); ret = -EINVAL; @@ -2275,8 +2268,8 @@ /* fixed rate */ ratecfg->rate_format = rate->param.rate_cfg.rate_format; ratecfg->rate_index = rate->param.rate_cfg.rate; - if (rate->param.rate_cfg.rate_format == MLAN_RATE_FORMAT_VHT - || rate->param.rate_cfg.rate_format == MLAN_RATE_FORMAT_HE) + if (rate->param.rate_cfg.rate_format == MLAN_RATE_FORMAT_VHT || + rate->param.rate_cfg.rate_format == MLAN_RATE_FORMAT_HE) ratecfg->nss = rate->param.rate_cfg.nss; ratecfg->rate_setting = rate->param.rate_cfg.rate_setting; } @@ -2301,9 +2294,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_stats_info(moal_private *priv, t_u8 wait_option, - mlan_ds_get_stats *stats) +mlan_status woal_get_stats_info(moal_private *priv, t_u8 wait_option, + mlan_ds_get_stats *stats) { mlan_ds_get_info *info = NULL; mlan_ioctl_req *req = NULL; @@ -2356,8 +2348,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_get_priv_getlog(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_get_priv_getlog(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_get_stats *stats; @@ -2397,8 +2389,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_esuppmode(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_esuppmode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[3]; mlan_ioctl_req *req = NULL; @@ -2422,7 +2414,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_ESUPPMODE), + strlen(PRIV_CMD_ESUPPMODE), data, ARRAY_SIZE(data), &user_data_len); } @@ -2487,15 +2479,15 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_setget_priv_passphrase(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_setget_priv_passphrase(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; int ret = 0, action = -1, i = 0; char *begin, *end, *opt; t_u16 len = 0; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u8 *mac = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -2507,7 +2499,8 @@ goto done; } - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_PASSPHRASE))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_PASSPHRASE))) { PRINTM(MERROR, "No arguments provided\n"); ret = -EINVAL; goto done; @@ -2568,9 +2561,9 @@ ret = -EINVAL; break; } - woal_ascii2hex((t_u8 *)(sec->param.passphrase.psk.pmk. - pmk), end, - MLAN_PMK_HEXSTR_LENGTH / 2); + woal_ascii2hex( + (t_u8 *)(sec->param.passphrase.psk.pmk.pmk), + end, MLAN_PMK_HEXSTR_LENGTH / 2); sec->param.passphrase.psk_type = MLAN_PSK_PMK; } else if (!strnicmp(opt, "passphrase", strlen(opt)) && req->action == MLAN_ACT_SET) { @@ -2582,19 +2575,20 @@ break; } sec->param.passphrase.psk_type = MLAN_PSK_PASSPHRASE; - moal_memcpy_ext(priv->phandle, - sec->param.passphrase.psk.passphrase. - passphrase, end, - sizeof(sec->param.passphrase.psk. - passphrase.passphrase), - sizeof(sec->param.passphrase.psk. - passphrase.passphrase)); + moal_memcpy_ext( + priv->phandle, + sec->param.passphrase.psk.passphrase.passphrase, + end, + sizeof(sec->param.passphrase.psk.passphrase + .passphrase), + sizeof(sec->param.passphrase.psk.passphrase + .passphrase)); sec->param.passphrase.psk.passphrase.passphrase_len = strlen(end); PRINTM(MINFO, "passphrase=%s, len=%d\n", sec->param.passphrase.psk.passphrase.passphrase, - (int)sec->param.passphrase.psk.passphrase. - passphrase_len); + (int)sec->param.passphrase.psk.passphrase + .passphrase_len); } else if (!strnicmp(opt, "sae_password", strlen(opt)) && req->action == MLAN_ACT_SET) { if (strlen(end) < MLAN_MIN_SAE_PASSWORD_LENGTH || @@ -2605,20 +2599,22 @@ break; } sec->param.passphrase.psk_type = MLAN_PSK_SAE_PASSWORD; - moal_memcpy_ext(priv->phandle, - sec->param.passphrase.psk.sae_password. - sae_password, end, - sizeof(sec->param.passphrase.psk. - sae_password.sae_password), - sizeof(sec->param.passphrase.psk. - sae_password.sae_password)); - sec->param.passphrase.psk.sae_password. - sae_password_len = strlen(end); + moal_memcpy_ext( + priv->phandle, + sec->param.passphrase.psk.sae_password + .sae_password, + end, + sizeof(sec->param.passphrase.psk.sae_password + .sae_password), + sizeof(sec->param.passphrase.psk.sae_password + .sae_password)); + sec->param.passphrase.psk.sae_password.sae_password_len = + strlen(end); PRINTM(MINFO, "sae_password=%s, len=%d\n", - sec->param.passphrase.psk.sae_password. - sae_password, - (int)sec->param.passphrase.psk.sae_password. - sae_password_len); + sec->param.passphrase.psk.sae_password + .sae_password, + (int)sec->param.passphrase.psk.sae_password + .sae_password_len); } else { PRINTM(MERROR, "Invalid option %s\n", opt); ret = -EINVAL; @@ -2667,9 +2663,9 @@ len += sprintf(respbuf + len, "passphrase:%s\n", sec->param.passphrase.psk.passphrase.passphrase); if (sec->param.passphrase.psk_type == MLAN_PSK_SAE_PASSWORD) - len += sprintf(respbuf + len, "sae_password:%s\n", - sec->param.passphrase.psk.sae_password. - sae_password); + len += sprintf( + respbuf + len, "sae_password:%s\n", + sec->param.passphrase.psk.sae_password.sae_password); ret = len; done: @@ -2688,8 +2684,7 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_deauth(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_deauth(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { int ret = 0; t_u8 mac[ETH_ALEN]; @@ -2699,7 +2694,7 @@ if (strlen(respbuf) > (strlen(CMD_NXP) + strlen(PRIV_CMD_DEAUTH))) { /* Deauth mentioned BSSID */ woal_mac2u8(mac, respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_DEAUTH)); + strlen(PRIV_CMD_DEAUTH)); if (MLAN_STATUS_SUCCESS != woal_disconnect(priv, MOAL_IOCTL_WAIT, mac, DEF_DEAUTH_REASON_CODE)) { @@ -2728,8 +2723,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_ap_deauth(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_ap_deauth(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u8 *data_ptr; mlan_ioctl_req *ioctl_req = NULL; @@ -2767,10 +2762,9 @@ goto done; } - moal_memcpy_ext(priv->phandle, data_ptr, &ioctl_req->status_code, - sizeof(t_u32), - respbuflen - (strlen(CMD_NXP) + - strlen(PRIV_CMD_AP_DEAUTH))); + moal_memcpy_ext( + priv->phandle, data_ptr, &ioctl_req->status_code, sizeof(t_u32), + respbuflen - (strlen(CMD_NXP) + strlen(PRIV_CMD_AP_DEAUTH))); ret = sizeof(t_u32); done: if (status != MLAN_STATUS_PENDING) @@ -2786,8 +2780,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_priv_get_sta_list(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_sta_list(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_get_info *info = NULL; @@ -2798,9 +2792,8 @@ ENTER(); /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2819,12 +2812,12 @@ sta_list = (mlan_ds_sta_list *)(respbuf + strlen(CMD_NXP) + strlen(PRIV_CMD_GET_STA_LIST)); - moal_memcpy_ext(priv->phandle, sta_list, &info->param.sta_list, - ioctl_req->data_read_written, - respbuflen - (strlen(CMD_NXP) + - strlen(PRIV_CMD_GET_STA_LIST))); + moal_memcpy_ext( + priv->phandle, sta_list, &info->param.sta_list, + ioctl_req->data_read_written, + respbuflen - (strlen(CMD_NXP) + strlen(PRIV_CMD_GET_STA_LIST))); ret = ioctl_req->data_read_written + strlen(CMD_NXP) + - strlen(PRIV_CMD_GET_STA_LIST); + strlen(PRIV_CMD_GET_STA_LIST); done: if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); @@ -2839,8 +2832,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_priv_bss_config(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_bss_config(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_bss *bss = NULL; @@ -2857,9 +2850,8 @@ offset += sizeof(action); /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_bss)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2910,8 +2902,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_bssrole(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_bssrole(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[1]; int ret = 0; @@ -2927,7 +2919,7 @@ } else { /* SET operation */ parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_BSSROLE), + strlen(PRIV_CMD_BSSROLE), data, ARRAY_SIZE(data), &user_data_len); } @@ -2953,7 +2945,13 @@ } action = MLAN_ACT_SET; /* Reset interface */ - woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE); + if (MLAN_STATUS_SUCCESS != + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE)) { + PRINTM(MERROR, "%s: woal_reset_intf failed \n", + __func__); + ret = -EFAULT; + goto error; + } } if (MLAN_STATUS_SUCCESS != @@ -2992,28 +2990,36 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_setuserscan(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_setuserscan(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - wlan_user_scan_cfg scan_cfg; + wlan_user_scan_cfg *scan_cfg; int ret = 0; ENTER(); + scan_cfg = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_cfg) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + /* Create the scan_cfg structure */ - memset(&scan_cfg, 0, sizeof(scan_cfg)); + memset(scan_cfg, 0, sizeof(wlan_user_scan_cfg)); /* We expect the scan_cfg structure to be passed in respbuf */ - moal_memcpy_ext(priv->phandle, (char *)&scan_cfg, + moal_memcpy_ext(priv->phandle, (char *)scan_cfg, respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_SETUSERSCAN), + strlen(PRIV_CMD_SETUSERSCAN), sizeof(wlan_user_scan_cfg), sizeof(wlan_user_scan_cfg)); - moal_memcpy_ext(priv->phandle, scan_cfg.random_mac, priv->random_mac, + moal_memcpy_ext(priv->phandle, scan_cfg->random_mac, priv->random_mac, ETH_ALEN, MLAN_MAC_ADDR_LENGTH); /* Call for scan */ - if (MLAN_STATUS_FAILURE == woal_do_scan(priv, &scan_cfg)) + if (MLAN_STATUS_FAILURE == woal_do_scan(priv, scan_cfg)) ret = -EFAULT; - + kfree(scan_cfg); LEAVE(); return ret; } @@ -3027,8 +3033,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_chanstats(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_chanstats(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_scan_resp scan_resp; chan_stats *stats = NULL; @@ -3040,6 +3046,7 @@ ret = -EINVAL; goto done; } + mdelay(10); memset(&scan_resp, 0, sizeof(scan_resp)); if (MLAN_STATUS_SUCCESS != woal_get_scan_table(priv, MOAL_IOCTL_WAIT, &scan_resp)) { @@ -3047,7 +3054,7 @@ goto done; } memset(respbuf, 0, respbuflen); - stats = (chan_stats *) respbuf; + stats = (chan_stats *)respbuf; stats->num_in_chan_stats = scan_resp.num_in_chan_stats; ret = sizeof(ChanStatistics_t) * stats->num_in_chan_stats; moal_memcpy_ext(priv->phandle, (t_u8 *)stats->stats, @@ -3068,9 +3075,9 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -moal_ret_get_scan_table_ioctl(t_u8 *respbuf, t_u32 respbuflen, - mlan_scan_resp *scan_resp, t_u32 scan_start) +static int moal_ret_get_scan_table_ioctl(t_u8 *respbuf, t_u32 respbuflen, + mlan_scan_resp *scan_resp, + t_u32 scan_start) { pBSSDescriptor_t pbss_desc, scan_table; wlan_ioctl_get_scan_table_info *prsp_info; @@ -3122,10 +3129,8 @@ "GetScanTable: get current BSS Descriptor [%d]\n", scan_start + num_scans_done); - ret_code = - wlan_get_scan_table_ret_entry(pbss_desc, - &pcurrent, - &space_left); + ret_code = wlan_get_scan_table_ret_entry( + pbss_desc, &pcurrent, &space_left); if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done++; @@ -3148,8 +3153,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_getscantable(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_getscantable(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -3181,7 +3186,7 @@ /* Get the whole command from user */ moal_memcpy_ext(handle, &scan_start, respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_GETSCANTABLE), + strlen(PRIV_CMD_GETSCANTABLE), sizeof(scan_start), sizeof(scan_start)); if (scan_start) scan->sub_command = MLAN_OID_SCAN_NORMAL; @@ -3201,7 +3206,6 @@ LEAVE(); return ret; } - /** * @brief Extended capabilities configuration * @@ -3211,8 +3215,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_extcapcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_extcapcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret, header; mlan_ioctl_req *req = NULL; @@ -3288,8 +3292,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_setgetdeepsleep(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_setgetdeepsleep(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u32 data[2]; int ret = 0; @@ -3304,7 +3308,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_DEEPSLEEP), + strlen(PRIV_CMD_DEEPSLEEP), data, ARRAY_SIZE(data), &user_data_len); } @@ -3362,8 +3366,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_setgetipaddr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_setgetipaddr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -3389,7 +3393,7 @@ } misc = (mlan_ds_misc_cfg *)req->pbuf; - if (data_length < 1) { /* GET */ + if (data_length < 1) { /* GET */ req->action = MLAN_ACT_GET; } else { /* Make sure we have the operation argument */ @@ -3457,8 +3461,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_setwpssession(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_setwpssession(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wps_cfg *pwps = NULL; @@ -3470,13 +3474,14 @@ ENTER(); memset((char *)data, 0, sizeof(data)); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_WPSSESSION))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_WPSSESSION))) { /* GET operation */ user_data_len = 0; } else { /* SET operation */ parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_WPSSESSION), + strlen(PRIV_CMD_WPSSESSION), data, ARRAY_SIZE(data), &user_data_len); } @@ -3525,8 +3530,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_otpuserdata(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_otpuserdata(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[1]; int user_data_len = 0; @@ -3538,14 +3543,15 @@ ENTER(); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_OTPUSERDATA))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_OTPUSERDATA))) { PRINTM(MERROR, "Invalid number of arguments\n"); ret = -EINVAL; goto done; } memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_OTPUSERDATA), + strlen(PRIV_CMD_OTPUSERDATA), data, ARRAY_SIZE(data), &user_data_len); if (user_data_len != 1) { @@ -3595,13 +3601,12 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_countrycode(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_set_get_countrycode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; /* char data[COUNTRY_CODE_LEN] = {0, 0, 0}; */ - int header = 0, data_length = 0; /* wrq->u.data.length; */ + int header = 0, data_length = 0; /* wrq->u.data.length; */ mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *pcfg_misc = NULL; mlan_ds_misc_country_code *country_code = NULL; @@ -3665,6 +3670,53 @@ } /** + * @brief Get country code + * + * @param priv A pointer to moal_private structure + * @param country A pointer to country string + * + * @return 0--success, otherwise failure + */ +static int woal_get_countrycode(moal_private *priv, t_u8 *country) +{ + int ret = 0; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *pcfg_misc = NULL; + mlan_ds_misc_country_code *country_code = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + /* Allocate an IOCTL request buffer */ + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + /* Fill request buffer */ + pcfg_misc = (mlan_ds_misc_cfg *)req->pbuf; + country_code = &pcfg_misc->param.country_code; + pcfg_misc->sub_command = MLAN_OID_MISC_COUNTRY_CODE; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_GET; + + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + moal_memcpy_ext(priv->phandle, country, country_code->country_code, + COUNTRY_CODE_LEN, COUNTRY_CODE_LEN); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + + LEAVE(); + return ret; +} + +/** * @brief Get cfp information * * @param priv A pointer to moal_private structure @@ -3673,8 +3725,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_cfpinfo(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_cfpinfo(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -3733,10 +3785,10 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_setgettcpackenh(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_setgettcpackenh(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - t_u32 data[2] = { 0, 0 }; + t_u32 data[2] = {0, 0}; int ret = 0; int user_data_len = 0; @@ -3754,7 +3806,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_TCPACKENH), + strlen(PRIV_CMD_TCPACKENH), data, ARRAY_SIZE(data), &user_data_len); } @@ -3813,9 +3865,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, - t_u8 bBSSID) +static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen, t_u8 bBSSID) { mlan_ssid_bssid ssid_bssid; moal_handle *handle = priv->phandle; @@ -3918,14 +3969,22 @@ if (MTRUE == woal_is_connected(priv, &ssid_bssid)) { PRINTM(MIOCTL, "Already connect to the network\n"); ret = sprintf(respbuf, - "Has already connected to this ESSID!\n") + 1; + "Has already connected to this ESSID!\n") + + 1; goto setessid_ret; } moal_memcpy_ext(handle, &priv->prev_ssid_bssid, &ssid_bssid, sizeof(mlan_ssid_bssid), sizeof(mlan_ssid_bssid)); - /* disconnect before driver assoc */ - woal_disconnect(priv, MOAL_IOCTL_WAIT, NULL, DEF_DEAUTH_REASON_CODE); - priv->set_asynced_essid_flag = MTRUE; + priv->auto_assoc_priv.drv_reconnect.status = MFALSE; + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_DRV_ASSOC; + priv->auto_assoc_priv.drv_assoc.status = MTRUE; + if (priv->auto_assoc_priv.auto_assoc_type_on & + (0x1 << (AUTO_ASSOC_TYPE_DRV_ASSOC - 1))) { + PRINTM(MINFO, " auto assoc: trigger driver auto re-assoc\n"); + } else { + PRINTM(MINFO, " Set Asynced ESSID: trigger auto re-assoc\n"); + } priv->reassoc_required = MTRUE; priv->phandle->is_reassoc_timer_set = MTRUE; woal_mod_timer(&priv->phandle->reassoc_timer, 0); @@ -3941,6 +4000,328 @@ #endif /** + * @brief Set/Get deep auto assoc configurations + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_setgetautoassoc(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ +#ifdef REASSOCIATION + moal_handle *handle = priv->phandle; +#endif + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + t_u32 data[5]; + int ret = 0; + int user_data_len = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_AUTOASSOC))) { + PRINTM(MERROR, "No argument, invalid operation!\n"); + ret = -EINVAL; + goto done; + } else { + /* GET/SET operation */ + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf + strlen(CMD_NXP) + + strlen(PRIV_CMD_AUTOASSOC), + data, ARRAY_SIZE(data), &user_data_len); + } + + if (sizeof(t_u32) * user_data_len > sizeof(data)) { + PRINTM(MERROR, "Too many arguments\n"); + ret = -EINVAL; + goto done; + } + + if (data[0] != AUTO_ASSOC_TYPE_DRV_ASSOC && + data[0] != AUTO_ASSOC_TYPE_DRV_RECONN && + data[0] != AUTO_ASSOC_TYPE_FW_RECONN) { + PRINTM(MERROR, "Invalid auto assoc type option = %u\n", + data[0]); + ret = -EINVAL; + goto done; + } + + if (user_data_len == 1) { + /* Get operation */ + if (data[0] == AUTO_ASSOC_TYPE_FW_RECONN) { + /* Get fw auto re-connect parameters */ + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + LEAVE(); + return -ENOMEM; + } + + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_AUTO_ASSOC; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_GET; + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + if (status != MLAN_STATUS_PENDING) + kfree(req); + goto done; + } else { + data[2] = misc->param.fw_auto_reconnect + .fw_reconn_counter; + if (data[2] == 0) { + data[1] = 0; + sprintf(respbuf, "%d %d", data[0], + data[1]); + ret = strlen(respbuf) + 1; + } else { + data[1] = 1; + data[3] = misc->param.fw_auto_reconnect + .fw_reconn_interval; + data[4] = misc->param.fw_auto_reconnect + .fw_reconn_flags; + sprintf(respbuf, "%d %d 0x%x 0x%x 0x%x", + data[0], data[1], data[2], + data[3], data[4]); + ret = strlen(respbuf) + 1; + } + kfree(req); + } + } else { + if (priv->auto_assoc_priv.auto_assoc_type_on & + (0x1 << (data[0] - 1))) { + data[1] = 1; + if (data[0] == AUTO_ASSOC_TYPE_DRV_RECONN) { + /* Get driver auto re-connect parameters + */ + data[2] = priv->auto_assoc_priv + .drv_reconnect + .retry_count; + data[3] = priv->auto_assoc_priv + .drv_reconnect + .retry_interval; + } else { + /* Get driver auto assoc parameters */ + data[2] = + priv->auto_assoc_priv.drv_assoc + .retry_count; + data[3] = + priv->auto_assoc_priv.drv_assoc + .retry_interval; + } + sprintf(respbuf, "%d %d 0x%x 0x%x", data[0], + data[1], data[2], data[3]); + ret = strlen(respbuf) + 1; + } else { + data[1] = 0; + sprintf(respbuf, "%d %d", data[0], data[1]); + ret = strlen(respbuf) + 1; + } + } + } else { + /* Set operation */ + if (data[1] == MFALSE) { + /* Set Disable */ + if (user_data_len > 2) { + PRINTM(MERROR, + "Invalid number of arguments for setting Disable\n"); + ret = -EINVAL; + goto done; + } + priv->auto_assoc_priv.auto_assoc_type_on &= + ~(0x1 << (data[0] - 1)); + } else if (data[1] == MTRUE) { + /* Set Enable */ + if (user_data_len > 2) { + if (data[2] == 0 || data[2] > 0xFF) { + PRINTM(MERROR, + "Invalid auto assoc retry count option = %u\n", + data[2]); + ret = -EINVAL; + goto done; + } + if (user_data_len > 3) { + if (data[3] > 0xFF) { + PRINTM(MERROR, + "Invalid auto assoc interval option = %u\n", + data[3]); + ret = -EINVAL; + goto done; + } + } else { + data[3] = 0xa; /* Default retry + interval: 10 seconds + */ + } + } else { + data[2] = 0xff; /* Default retry count: retry + forever */ + data[3] = 0xa; /* Default retry interval: 10 + seconds */ + } + priv->auto_assoc_priv.auto_assoc_type_on |= + 0x1 << (data[0] - 1); + } else { + PRINTM(MERROR, + "Invalid auto assoc on/off option = %u\n", + data[1]); + ret = -EINVAL; + goto done; + } + + if (data[0] == AUTO_ASSOC_TYPE_FW_RECONN) { + /* Set fw auto re-connect operation */ + if (user_data_len == 5) { + if (data[4] > 0x1) { + PRINTM(MERROR, + "Invalid fw auto re-connect flag option = %u\n", + data[4]); + ret = -EINVAL; + goto done; + } + } else { + data[4] = 0; /* Default fw auto re-connect flags + */ + } + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + LEAVE(); + return -ENOMEM; + } + + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_AUTO_ASSOC; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_SET; + + if (data[1] == MFALSE) { + /* Set fw auto re-connect Disable */ + misc->param.fw_auto_reconnect.fw_reconn_counter = + 0; + misc->param.fw_auto_reconnect + .fw_reconn_interval = 0; + misc->param.fw_auto_reconnect.fw_reconn_flags = + 0; + } else { + /* Set fw auto re-connect Enable */ + misc->param.fw_auto_reconnect.fw_reconn_counter = + data[2]; + misc->param.fw_auto_reconnect + .fw_reconn_interval = data[3]; + misc->param.fw_auto_reconnect.fw_reconn_flags = + data[4]; + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + if (status != MLAN_STATUS_PENDING) + kfree(req); + goto done; + } else { + kfree(req); + } + } else { + if (user_data_len == 5) { + PRINTM(MERROR, + "The fifth parameter is only used for FW auto re-connect!\n"); + ret = -EINVAL; + goto done; + } + if (data[0] == AUTO_ASSOC_TYPE_DRV_RECONN) { + /* Set driver auto re-connect operation */ + if (data[1] == MFALSE) { + if (!(priv->auto_assoc_priv + .auto_assoc_type_on & + (0x1 + << (AUTO_ASSOC_TYPE_DRV_ASSOC - + 1)))) { + priv->auto_assoc_priv + .drv_reconnect.status = + MFALSE; +#ifdef REASSOCIATION + handle->reassoc_on &= + ~MBIT(priv->bss_index); + priv->reassoc_on = MFALSE; + priv->reassoc_required = MFALSE; + if (!handle->reassoc_on && + handle->is_reassoc_timer_set == + MTRUE) { + woal_cancel_timer( + &handle->reassoc_timer); + handle->is_reassoc_timer_set = + MFALSE; + } +#endif + } + } +#ifdef REASSOCIATION + else { + handle->reassoc_on |= + MBIT(priv->bss_index); + priv->reassoc_on = MTRUE; + } +#endif + priv->auto_assoc_priv.drv_reconnect.retry_count = + data[2]; + priv->auto_assoc_priv.drv_reconnect + .retry_interval = data[3]; + } + if (data[0] == AUTO_ASSOC_TYPE_DRV_ASSOC) { + /* Set driver auto assoc operation */ + if (data[1] == MFALSE) { + if (!(priv->auto_assoc_priv + .auto_assoc_type_on & + (0x1 + << (AUTO_ASSOC_TYPE_DRV_RECONN - + 1)))) { + priv->auto_assoc_priv.drv_assoc + .status = MFALSE; +#ifdef REASSOCIATION + handle->reassoc_on &= + ~MBIT(priv->bss_index); + priv->reassoc_on = MFALSE; + priv->reassoc_required = MFALSE; + if (!handle->reassoc_on && + handle->is_reassoc_timer_set == + MTRUE) { + woal_cancel_timer( + &handle->reassoc_timer); + handle->is_reassoc_timer_set = + MFALSE; + } +#endif + } + } +#ifdef REASSOCIATION + else { + handle->reassoc_on |= + MBIT(priv->bss_index); + priv->reassoc_on = MTRUE; + } +#endif + priv->auto_assoc_priv.drv_assoc.retry_count = + data[2]; + priv->auto_assoc_priv.drv_assoc.retry_interval = + data[3]; + } + } + ret = sprintf(respbuf, "OK\n") + 1; + } + +done: + LEAVE(); + return ret; +} + +/** * @brief Get wakeup reason * * @param priv A pointer to moal_private structure @@ -3949,8 +4330,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_getwakeupreason(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_getwakeupreason(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -4007,9 +4388,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_listeninterval(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_set_get_listeninterval(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[1]; int user_data_len = 0; @@ -4028,7 +4408,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_LISTENINTERVAL), + strlen(PRIV_CMD_LISTENINTERVAL), data, ARRAY_SIZE(data), &user_data_len); } @@ -4089,8 +4469,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_drvdbg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_drvdbg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[4]; int user_data_len = 0; @@ -4105,7 +4485,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_DRVDBG), + strlen(PRIV_CMD_DRVDBG), data, ARRAY_SIZE(data), &user_data_len); } @@ -4187,8 +4567,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_mgmt_filter(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_mgmt_filter(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -4225,9 +4605,8 @@ /* SET operation */ argument = (t_u8 *)(respbuf + header_len); data_len = respbuflen - header_len; - if (data_len > - (int)(MAX_MGMT_FRAME_FILTER * - sizeof(mlan_mgmt_frame_wakeup))) { + if (data_len > (int)(MAX_MGMT_FRAME_FILTER * + sizeof(mlan_mgmt_frame_wakeup))) { PRINTM(MERROR, "%d: Invalid arguments\n", __LINE__); ret = -EINVAL; goto done; @@ -4256,6 +4635,7 @@ #define PARAMETER_GPIO_INDICATION 1 #define PARAMETER_EXTEND_HSCFG 2 #define PARAMETER_HS_WAKEUP_INTERVAL 3 +#define PARAMETER_MIN_WAKE_HOLDOFF 4 /** * @brief Set/Get Host Sleep configuration * @@ -4266,11 +4646,10 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_hscfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, - BOOLEAN invoke_hostcmd) +static int woal_priv_hscfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, + BOOLEAN invoke_hostcmd) { - int data[13] = { 0 }; + int data[15] = {0}; int *temp_data, type; int user_data_len = 0; int ret = 0; @@ -4320,7 +4699,7 @@ if (user_data_len == 0) { action = MLAN_ACT_GET; } else { - if (user_data_len >= 1 && user_data_len <= 13) { + if (user_data_len >= 1 && user_data_len <= 15) { action = MLAN_ACT_SET; } else { PRINTM(MERROR, "Invalid arguments\n"); @@ -4330,9 +4709,8 @@ } /* HS config is blocked if HS is already activated */ - if (user_data_len && - (data[0] != (int)HOST_SLEEP_CFG_CANCEL || - invoke_hostcmd == MFALSE)) { + if (user_data_len && (data[0] != (int)HOST_SLEEP_CFG_CANCEL || + invoke_hostcmd == MFALSE)) { memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); if (bss_info.is_hs_configured) { @@ -4427,6 +4805,18 @@ user_data_len = user_data_len - 2; temp_data++; break; + case PARAMETER_MIN_WAKE_HOLDOFF: + if (user_data_len >= 2) + hscfg.min_wake_holdoff = *(++temp_data); + else { + PRINTM(MERROR, + "Invaild number of parameters\n"); + ret = -EINVAL; + goto done; + } + user_data_len = user_data_len - 2; + temp_data++; + break; default: PRINTM(MERROR, "Unsupported type\n"); ret = -EINVAL; @@ -4464,6 +4854,43 @@ } /** + * @brief Process Set Host Sleep parameters from proc buffer + * + * @param handle A pointer to moal_handle structure + * @param pbuf A pointer to buffer for host sleep parameters + * @param respbuflen Available length of response buffer + * + * @return 0 --success, otherwise fail + */ +int woal_process_proc_hssetpara(moal_handle *handle, t_u8 *buf) +{ + int data[15] = {0}; + int user_data_len = 0; + int ret = 0; + t_u8 respbuf[500]; + moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + + ENTER(); + if (!priv) { + LEAVE(); + return ret; + } + memset((char *)data, 0, sizeof(data)); + parse_arguments(buf, data, ARRAY_SIZE(data), &user_data_len); + if (sizeof(int) * user_data_len > sizeof(data)) { + PRINTM(MERROR, "Too many arguments\n"); + LEAVE(); + return -EINVAL; + } + if (user_data_len >= 1 && user_data_len <= 15) { + sprintf(respbuf, "%s%s%s", CMD_NXP, PRIV_CMD_HSCFG, buf); + ret = woal_priv_hscfg(priv, respbuf, sizeof(respbuf), MFALSE); + } + LEAVE(); + return ret; +} + +/** * @brief Set Host Sleep parameters * * @param priv A pointer to moal_private structure @@ -4472,10 +4899,10 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - int data[13] = { 0 }; + int data[15] = {0}; int user_data_len = 0; int ret = 0; @@ -4489,7 +4916,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_HSSETPARA), + strlen(PRIV_CMD_HSSETPARA), data, ARRAY_SIZE(data), &user_data_len); } @@ -4499,10 +4926,10 @@ return -EINVAL; } - if (user_data_len >= 1 && user_data_len <= 13) { + if (user_data_len >= 1 && user_data_len <= 15) { sprintf(respbuf, "%s%s%s", CMD_NXP, PRIV_CMD_HSCFG, respbuf + - (strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA))); + (strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA))); respbuflen = strlen(respbuf); ret = woal_priv_hscfg(priv, respbuf, respbuflen, MFALSE); goto done; @@ -4521,8 +4948,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_set_get_scancfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_scancfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0; @@ -4541,7 +4968,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_SCANCFG), + strlen(PRIV_CMD_SCANCFG), data, ARRAY_SIZE(data), &user_data_len); } @@ -4561,48 +4988,53 @@ req->req_id = MLAN_IOCTL_SCAN; if (user_data_len) { - if ((data[0] < 0) || (data[0] > MLAN_SCAN_TYPE_PASSIVE)) { + moal_memcpy_ext(priv->phandle, &scan->param.scan_cfg, data, + sizeof(data), sizeof(scan->param.scan_cfg)); + if (scan->param.scan_cfg.scan_type > MLAN_SCAN_TYPE_PASSIVE) { PRINTM(MERROR, "Invalid argument for scan type\n"); ret = -EINVAL; goto done; } - if ((data[1] < 0) || (data[1] > MLAN_SCAN_MODE_ANY)) { + if (scan->param.scan_cfg.scan_mode > MLAN_SCAN_MODE_ANY) { PRINTM(MERROR, "Invalid argument for scan mode\n"); ret = -EINVAL; goto done; } - if ((data[2] < 0) || (data[2] > MAX_PROBES)) { + if (scan->param.scan_cfg.scan_probe > MAX_PROBES) { PRINTM(MERROR, "Invalid argument for scan probes\n"); ret = -EINVAL; goto done; } - if (((data[3] < 0) || - (data[3] > MRVDRV_MAX_ACTIVE_SCAN_CHAN_TIME)) || - ((data[4] < 0) || - (data[4] > MRVDRV_MAX_ACTIVE_SCAN_CHAN_TIME)) || - ((data[5] < 0) || - (data[5] > MRVDRV_MAX_PASSIVE_SCAN_CHAN_TIME))) { + if ((scan->param.scan_cfg.scan_time.specific_scan_time > + MRVDRV_MAX_ACTIVE_SCAN_CHAN_TIME) || + (scan->param.scan_cfg.scan_time.active_scan_time > + MRVDRV_MAX_ACTIVE_SCAN_CHAN_TIME) || + (scan->param.scan_cfg.scan_time.passive_scan_time > + MRVDRV_MAX_PASSIVE_SCAN_CHAN_TIME)) { PRINTM(MERROR, "Invalid argument for scan time\n"); ret = -EINVAL; goto done; } - if ((data[6] < 0) || (data[6] > MLAN_PASS_TO_ACT_SCAN_DIS)) { + if (scan->param.scan_cfg.passive_to_active_scan > + MLAN_PASS_TO_ACT_SCAN_DIS) { PRINTM(MERROR, "Invalid argument for Passive to Active Scan\n"); ret = -EINVAL; goto done; } - if ((data[7] < 0) || (data[7] > 3)) { + if (scan->param.scan_cfg.ext_scan > MLAN_EXT_SCAN_ENH) { PRINTM(MERROR, "Invalid argument for extended scan\n"); ret = -EINVAL; goto done; } - if ((data[8] < 0) || (data[8] > MRVDRV_MAX_SCAN_CHAN_GAP_TIME)) { + if (scan->param.scan_cfg.scan_chan_gap > + MRVDRV_MAX_SCAN_CHAN_GAP_TIME) { PRINTM(MERROR, "Invalid argument for scan channel gap\n"); ret = -EINVAL; goto done; } + req->action = MLAN_ACT_SET; moal_memcpy_ext(priv->phandle, &scan->param.scan_cfg, data, sizeof(data), sizeof(scan->param.scan_cfg)); @@ -4633,8 +5065,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_getnlnum(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_getnlnum(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int data = 0; @@ -4666,8 +5098,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_aggrctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_aggrctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[1]; int user_data_len = 0; @@ -4698,7 +5130,7 @@ } /* SET operation */ parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_AGGRCTRL), + strlen(PRIV_CMD_AGGRCTRL), data, ARRAY_SIZE(data), &user_data_len); if (sizeof(int) * user_data_len > sizeof(data)) { @@ -4762,9 +5194,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_usbaggrctrl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_set_get_usbaggrctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[8]; int user_data_len = 0; @@ -4786,13 +5217,14 @@ cardp = (struct usb_card_rec *)handle->card; memset((char *)data, 0, sizeof(data)); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_USBAGGRCTRL))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_USBAGGRCTRL))) { /* GET operation */ user_data_len = 0; } else { /* SET operation */ parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_USBAGGRCTRL), + strlen(PRIV_CMD_USBAGGRCTRL), data, ARRAY_SIZE(data), &user_data_len); if (sizeof(int) * user_data_len > sizeof(data)) { @@ -4866,8 +5298,8 @@ goto done; } if (cardp->rx_deaggr_ctrl.enable && - pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl. - aggr_align != (t_u16)data[5]) + pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl.aggr_align != + (t_u16)data[5]) usb_resubmit_urbs = 1; pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl.aggr_align = (t_u16)data[5]; @@ -4885,12 +5317,12 @@ case 4: if ((data[3] == 2) || (data[3] == 4) || (data[3] == 8) || (data[3] == 16)) { - pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl. - aggr_mode = MLAN_USB_AGGR_MODE_NUM; + pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl + .aggr_mode = MLAN_USB_AGGR_MODE_NUM; } else if ((data[3] == 4096) || (data[3] == 8192) || (data[3] == 16384) || (data[3] == 32768)) { - pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl. - aggr_mode = MLAN_USB_AGGR_MODE_LEN; + pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl + .aggr_mode = MLAN_USB_AGGR_MODE_LEN; } else { PRINTM(MERROR, "Invalid Rx max size/num value (%d)\n", data[3]); @@ -4899,7 +5331,7 @@ } if (cardp->rx_deaggr_ctrl.enable && pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl.aggr_max != - (t_u16)data[3]) + (t_u16)data[3]) usb_resubmit_urbs = 1; pcfg_misc->param.usb_aggr_params.rx_deaggr_ctrl.aggr_max = (t_u16)data[3]; @@ -4907,12 +5339,12 @@ case 3: if ((data[2] == 2) || (data[2] == 4) || (data[2] == 8) || (data[2] == 16)) { - pcfg_misc->param.usb_aggr_params.tx_aggr_ctrl. - aggr_mode = MLAN_USB_AGGR_MODE_NUM; + pcfg_misc->param.usb_aggr_params.tx_aggr_ctrl.aggr_mode = + MLAN_USB_AGGR_MODE_NUM; } else if ((data[2] == 4096) || (data[2] == 8192) || (data[2] == 16384) || (data[2] == 32768)) { - pcfg_misc->param.usb_aggr_params.tx_aggr_ctrl. - aggr_mode = MLAN_USB_AGGR_MODE_LEN; + pcfg_misc->param.usb_aggr_params.tx_aggr_ctrl.aggr_mode = + MLAN_USB_AGGR_MODE_LEN; } else { PRINTM(MERROR, "Invalid Tx max size/num value (%d)\n", data[2]); @@ -4978,10 +5410,10 @@ if (atomic_read(&cardp->rx_data_urb_pending)) { for (i = 0; i < MVUSB_RX_DATA_URB; i++) { if (cardp->rx_data_list[i].urb) { - usb_kill_urb(cardp->rx_data_list[i]. - urb); - usb_init_urb(cardp->rx_data_list[i]. - urb); + usb_kill_urb( + cardp->rx_data_list[i].urb); + usb_init_urb( + cardp->rx_data_list[i].urb); } } } @@ -5020,14 +5452,12 @@ * * @return Number of bytes written if successful, otherwise fail */ -static int -woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { int ret = 0; t_u8 *data_ptr; - const t_u8 bcast[MLAN_MAC_ADDR_LENGTH] = - { 255, 255, 255, 255, 255, 255 }; - const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + const t_u8 bcast[MLAN_MAC_ADDR_LENGTH] = {255, 255, 255, 255, 255, 255}; + const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; mlan_ssid_bssid ssid_bssid; mlan_bss_info bss_info; struct mwreq *mwr; @@ -5053,6 +5483,7 @@ ret = -EFAULT; goto done; } + #ifdef REASSOCIATION /* Cancel re-association */ priv->reassoc_required = MFALSE; @@ -5092,6 +5523,7 @@ ret = -EFAULT; goto done; } + #ifdef REASSOCIATION memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != @@ -5122,8 +5554,8 @@ * * @return Number of bytes written if successful, otherwise fail */ -static int -woal_priv_set_bss_mode(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_bss_mode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_bss *bss = NULL; @@ -5187,8 +5619,8 @@ * * @return Number of bytes written if successful, otherwise fail */ -static int -woal_priv_set_power(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_power(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { struct mwreq *mwr; t_u8 *data_ptr; @@ -5225,13 +5657,13 @@ * * @return Number of bytes written if successful, otherwise fail */ -static int -woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_802_11_ssid req_ssid; mlan_ssid_bssid ssid_bssid; -#ifdef REASSOCIATION moal_handle *handle = priv->phandle; +#ifdef REASSOCIATION mlan_bss_info bss_info; #endif int ret = 0; @@ -5306,6 +5738,38 @@ goto setessid_ret; } + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = MFALSE; +#ifdef REASSOCIATION + if (priv->reassoc_on == MTRUE) { + if (priv->auto_assoc_priv.auto_assoc_type_on & + (0x1 << (AUTO_ASSOC_TYPE_DRV_ASSOC - 1))) { + if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) + woal_set_scan_type( + priv, MLAN_SCAN_TYPE_PASSIVE); + MOAL_REL_SEMAPHORE(&handle->reassoc_sem); + moal_memcpy_ext(handle, + &priv->prev_ssid_bssid.ssid, + &req_ssid, + sizeof(mlan_802_11_ssid), + sizeof(mlan_802_11_ssid)); + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_DRV_ASSOC; + priv->auto_assoc_priv.drv_assoc.status = MTRUE; + priv->reassoc_required = MTRUE; + priv->phandle->is_reassoc_timer_set = MTRUE; + PRINTM(MINFO, + " auto assoc: trigger driver auto re-assoc\n"); + woal_mod_timer(&priv->phandle->reassoc_timer, + 0); + ret = MLAN_STATUS_SUCCESS; + + LEAVE(); + return ret; + } + } +#endif + if (mwr->u.essid.flags != 0xFFFF) { if (MLAN_STATUS_SUCCESS != woal_find_essid(priv, &ssid_bssid, @@ -5346,6 +5810,7 @@ ret = -EFAULT; goto setessid_ret; } + #ifdef REASSOCIATION memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != @@ -5378,8 +5843,8 @@ * * @return Number of bytes written if successful, otherwise fail */ -static int -woal_priv_set_auth(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_auth(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { struct mwreq *mwr; t_u8 *data_ptr; @@ -5478,8 +5943,7 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_get_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { struct mwreq *mwr; t_u8 *data_ptr; @@ -5521,8 +5985,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_get_power(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_power(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { struct mwreq *mwr; t_u8 *data_ptr; @@ -5547,7 +6011,7 @@ mwr->u.power.value = 0; ret = strlen(CMD_NXP) + strlen(PRIV_CMD_GET_POWER) + - sizeof(struct mwreq); + sizeof(struct mwreq); LEAVE(); return ret; } @@ -5561,8 +6025,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_set_get_psmode(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_psmode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int data = 0; @@ -5627,8 +6091,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_warmreset(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_warmreset(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; moal_handle *handle = priv->phandle; @@ -5665,8 +6129,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_txpowercfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_txpowercfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[5]; int user_data_len; @@ -5682,7 +6146,8 @@ memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); - if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_TXPOWERCFG))) { + if (strlen(respbuf) == + (strlen(CMD_NXP) + strlen(PRIV_CMD_TXPOWERCFG))) { /* GET operation */ user_data_len = 0; } else { @@ -5723,60 +6188,60 @@ case 3: case 5: switch (data[0]) { - case 0: /* LG */ + case 0: /* LG */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_LG; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW20; break; - case 1: /* 20 MHz HT */ + case 1: /* 20 MHz HT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_HT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW20; break; - case 2: /* 40 MHz HT */ + case 2: /* 40 MHz HT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_HT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW40; break; - case 3: /* 1 NSS 20 MHZ VHT */ + case 3: /* 1 NSS 20 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW20; pcfg->param.power_ext.power_group[0].nss = 1; break; - case 4: /* 2 NSS 20 MHZ VHT */ + case 4: /* 2 NSS 20 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW20; pcfg->param.power_ext.power_group[0].nss = 2; break; - case 5: /* 1 NSS 40 MHZ VHT */ + case 5: /* 1 NSS 40 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW40; pcfg->param.power_ext.power_group[0].nss = 1; break; - case 6: /* 2 NSS 40 MHZ VHT */ + case 6: /* 2 NSS 40 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_HT_BW40; pcfg->param.power_ext.power_group[0].nss = 2; break; - case 7: /* 1 NSS 80 MHZ VHT */ + case 7: /* 1 NSS 80 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = MLAN_VHT_BW80; pcfg->param.power_ext.power_group[0].nss = 1; break; - case 8: /* 2 NSS 80 MHZ VHT */ + case 8: /* 2 NSS 80 MHZ VHT */ pcfg->param.power_ext.power_group[0] .rate_format = MLAN_RATE_FORMAT_VHT; pcfg->param.power_ext.power_group[0].bandwidth = @@ -5832,12 +6297,13 @@ moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)&pcfg->param.power_ext, sizeof(pcfg->param.power_ext.num_pwr_grp) + - (MIN(pcfg->param.power_ext.num_pwr_grp, - MAX_POWER_GROUP) * - sizeof(mlan_power_group)), respbuflen); + (MIN(pcfg->param.power_ext.num_pwr_grp, + MAX_POWER_GROUP) * + sizeof(mlan_power_group)), + respbuflen); ret = sizeof(pcfg->param.power_ext.num_pwr_grp) + - (MIN(pcfg->param.power_ext.num_pwr_grp, MAX_POWER_GROUP) - * sizeof(mlan_power_group)); + (MIN(pcfg->param.power_ext.num_pwr_grp, MAX_POWER_GROUP) * + sizeof(mlan_power_group)); } done: if (status != MLAN_STATUS_PENDING) @@ -5855,10 +6321,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_pscfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_pscfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { - int data[7] = { 0 }, ret = 0; + int data[7] = {0}, ret = 0; mlan_ds_pm_cfg *pm_cfg = NULL; mlan_ioctl_req *req = NULL; int allowed = 3; @@ -5868,8 +6333,8 @@ ENTER(); - allowed++; /* For beacon missing timeout parameter */ - allowed += 2; /* For delay to PS and PS mode parameters */ + allowed++; /* For beacon missing timeout parameter */ + allowed += 2; /* For delay to PS and PS mode parameters */ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_pm_cfg)); if (req == NULL) { ret = -ENOMEM; @@ -5959,7 +6424,8 @@ } moal_memcpy_ext(priv->phandle, data, &pm_cfg->param.ps_cfg, MIN((sizeof(int) * allowed), - sizeof(pm_cfg->param.ps_cfg)), sizeof(data)); + sizeof(pm_cfg->param.ps_cfg)), + sizeof(data)); moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)data, sizeof(int) * allowed, respbuflen); ret = sizeof(int) * allowed; @@ -5988,10 +6454,10 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_bcntimeoutcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_bcntimeoutcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - int data[4] = { 0 }, ret = 0; + int data[4] = {0}, ret = 0; mlan_ds_pm_cfg *pm_cfg = NULL; mlan_ioctl_req *req = NULL; int allowed = 4; @@ -6056,8 +6522,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_sleeppd(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_sleeppd(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -6096,9 +6562,7 @@ if (user_data_len) { if ((data <= MAX_SLEEP_PERIOD && data >= MIN_SLEEP_PERIOD) || - (data == 0) - || (data == SLEEP_PERIOD_RESERVED_FF) - ) { + (data == 0) || (data == SLEEP_PERIOD_RESERVED_FF)) { req->action = MLAN_ACT_SET; pm_cfg->param.sleep_period = data; } else { @@ -6136,8 +6600,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_txcontrol(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_txcontrol(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_misc_cfg *misc_cfg = NULL; @@ -6209,8 +6673,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_regrdwr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_regrdwr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[3]; int ret = 0; @@ -6242,7 +6706,7 @@ } /* SET operation */ memset((char *)data, 0, sizeof(data)); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; arguments = kzalloc(strlen(respbuf) * sizeof(char), flag); if (arguments == NULL) { ret = -ENOMEM; @@ -6306,8 +6770,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_rdeeprom(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_rdeeprom(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[2]; int ret = 0; @@ -6378,8 +6842,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_memrdwr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_memrdwr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[2]; int ret = 0; @@ -6455,8 +6919,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_priv_sdcmd52rw(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_sdcmd52rw(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u8 rw = 0, func, data = 0; int buf[3], reg, ret = MLAN_STATUS_SUCCESS; @@ -6489,11 +6953,11 @@ } reg = (t_u32)buf[1]; if (user_data_len == 2) { - rw = 0; /* CMD52 read */ + rw = 0; /* CMD52 read */ PRINTM(MINFO, "Cmd52 read, func=%d, reg=0x%08X\n", func, reg); } if (user_data_len == 3) { - rw = 1; /* CMD52 write */ + rw = 1; /* CMD52 write */ data = (t_u8)buf[2]; PRINTM(MINFO, "Cmd52 write, func=%d, reg=0x%08X, data=0x%02X\n", func, reg, data); @@ -6501,18 +6965,20 @@ if (!rw) { #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - data = sdio_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); + data = sdio_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); else - data = sdio_f0_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + data = sdio_f0_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -6520,7 +6986,8 @@ goto done; } #else - if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < 0) { + if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < + 0) { PRINTM(MERROR, "sdio_read_ioreg: reading register 0x%X failed\n", reg); @@ -6530,18 +6997,20 @@ #endif /* SDIO_MMC */ } else { #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - sdio_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); + sdio_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); else - sdio_f0_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_f0_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", @@ -6549,7 +7018,8 @@ goto done; } #else - if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < 0) { + if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < + 0) { PRINTM(MERROR, "sdio_write_ioreg: writing register 0x%X failed\n", reg); @@ -6581,8 +7051,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_arpfilter(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_arpfilter(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_misc_cfg *misc = NULL; @@ -6632,8 +7102,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_auto_arp(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_auto_arp(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[4]; int user_data_len = 0; @@ -6655,7 +7125,7 @@ /* SET operation */ memset((char *)data, 0, sizeof(data)); parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_AUTO_ARP), + strlen(PRIV_CMD_AUTO_ARP), data, ARRAY_SIZE(data), &user_data_len); } @@ -6690,8 +7160,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_deauth_ctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_deauth_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ds_snmp_mib *cfg = NULL; mlan_ioctl_req *req = NULL; @@ -6702,7 +7172,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_snmp_mib)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -6757,8 +7227,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_per_pkt_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_per_pkt_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ds_misc_cfg *misc = NULL; mlan_ioctl_req *req = NULL; @@ -6782,7 +7252,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -6794,7 +7264,7 @@ /* GET operation */ pos++; if (priv->tx_protocols.protocol_num) { - perpkt = (mlan_per_pkt_cfg *) pos; + perpkt = (mlan_per_pkt_cfg *)pos; perpkt->type = TLV_TYPE_PER_PKT_CFG; perpkt->tx_rx_control = TX_PKT_CTRL; perpkt->proto_type_num = @@ -6808,7 +7278,7 @@ pos += perpkt->len + MRVL_TLV_HEADER_SIZE; } if (priv->rx_protocols.protocol_num) { - perpkt = (mlan_per_pkt_cfg *) pos; + perpkt = (mlan_per_pkt_cfg *)pos; perpkt->type = TLV_TYPE_PER_PKT_CFG; perpkt->tx_rx_control = RX_PKT_INFO; perpkt->proto_type_num = @@ -6829,19 +7299,19 @@ pos++; left_len--; while (*pos == TLV_TYPE_PER_PKT_CFG && (left_len > 2)) { - perpkt = (mlan_per_pkt_cfg *) pos; + perpkt = (mlan_per_pkt_cfg *)pos; if (perpkt->tx_rx_control & TX_PKT_CTRL) { priv->tx_protocols.protocol_num = perpkt->proto_type_num; if (perpkt->proto_type_num <= MAX_NUM_ETHER_TYPE) - moal_memcpy_ext(priv->phandle, - priv->tx_protocols. - protocols, - perpkt->ether_type, - perpkt->proto_type_num * + moal_memcpy_ext( + priv->phandle, + priv->tx_protocols.protocols, + perpkt->ether_type, + perpkt->proto_type_num * sizeof(t_u16), - MAX_NUM_ETHER_TYPE * + MAX_NUM_ETHER_TYPE * sizeof(t_u16)); } if (perpkt->tx_rx_control & RX_PKT_INFO) { @@ -6849,13 +7319,13 @@ perpkt->proto_type_num; if (perpkt->proto_type_num <= MAX_NUM_ETHER_TYPE) - moal_memcpy_ext(priv->phandle, - priv->rx_protocols. - protocols, - perpkt->ether_type, - perpkt->proto_type_num * + moal_memcpy_ext( + priv->phandle, + priv->rx_protocols.protocols, + perpkt->ether_type, + perpkt->proto_type_num * sizeof(t_u16), - MAX_NUM_ETHER_TYPE * + MAX_NUM_ETHER_TYPE * sizeof(t_u16)); } if (!perpkt->tx_rx_control) { @@ -6894,8 +7364,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_chnrgpwr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_chnrgpwr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -6941,8 +7411,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_txpwrlimit(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_txpwrlimit(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -6954,7 +7424,7 @@ ENTER(); header_len = strlen(PRIV_CMD_GET_TXPWR_LIMIT); - trpc_cfg = (mlan_ds_misc_chan_trpc_cfg *) (respbuf + header_len); + trpc_cfg = (mlan_ds_misc_chan_trpc_cfg *)(respbuf + header_len); if ((trpc_cfg->sub_band != 0) && (trpc_cfg->sub_band != 0x10) && (trpc_cfg->sub_band != 0x11) && (trpc_cfg->sub_band != 0x12) && (trpc_cfg->sub_band != 0x13)) { @@ -6978,11 +7448,12 @@ goto done; } ret = header_len + sizeof(t_u16) + sizeof(t_u16) + - misc->param.trpc_cfg.length; + misc->param.trpc_cfg.length; pos = respbuf + header_len; moal_memcpy_ext(priv->phandle, pos, &misc->param.trpc_cfg, sizeof(t_u16) + sizeof(t_u16) + - misc->param.trpc_cfg.length, respbuflen - header_len); + misc->param.trpc_cfg.length, + respbuflen - header_len); done: if (status != MLAN_STATUS_PENDING) kfree(req); @@ -7000,8 +7471,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_getcfgchanlist(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_getcfgchanlist(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int num_chan = 0; @@ -7018,7 +7489,7 @@ ret = -EFAULT; goto done; } - plist = (wlan_ieee80211_chan_list *) respbuf; + plist = (wlan_ieee80211_chan_list *)respbuf; sband = wiphy->bands[NL80211_BAND_2GHZ]; if (sband) { num_chan += sband->n_channels; @@ -7043,7 +7514,7 @@ sband->channels[i].flags; plist->chan_list[i + num_chan].max_power = sband->channels[i].max_power; -#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 8, 13) +#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) plist->chan_list[i + num_chan].dfs_state = sband->channels[i].dfs_state; #endif @@ -7052,7 +7523,7 @@ } plist->num_chan = num_chan; ret = sizeof(wlan_ieee80211_chan_list) + - sizeof(wlan_ieee80211_chan) * num_chan; + sizeof(wlan_ieee80211_chan) * num_chan; done: LEAVE(); return ret; @@ -7068,9 +7539,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_rx_tx_histogram(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_get_rx_tx_histogram(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -7082,7 +7552,7 @@ ENTER(); header_len = strlen(PRIV_CMD_TX_RX_HISTOGRAM); - tx_rx_info = (tx_rx_histogram *) (respbuf + header_len); + tx_rx_info = (tx_rx_histogram *)(respbuf + header_len); if (tx_rx_info->enable > 2 || (tx_rx_info->enable == GET_TX_RX_HISTOGRAM && (tx_rx_info->action > 3 || tx_rx_info->action <= 0))) { @@ -7123,10 +7593,10 @@ respbuflen - (header_len + 2 * sizeof(t_u8))); ret += sizeof(misc->param.tx_rx_histogram.size); pos += sizeof(misc->param.tx_rx_histogram.size); - moal_memcpy_ext(priv->phandle, pos, - &misc->param.tx_rx_histogram.value, - misc->param.tx_rx_histogram.size, - respbuflen - (header_len + 2 * sizeof(t_u8)) - + moal_memcpy_ext( + priv->phandle, pos, &misc->param.tx_rx_histogram.value, + misc->param.tx_rx_histogram.size, + respbuflen - (header_len + 2 * sizeof(t_u8)) - sizeof(misc->param.tx_rx_histogram.size)); ret += misc->param.tx_rx_histogram.size; } @@ -7147,8 +7617,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_hotspotcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_hotspotcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -7215,9 +7685,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_mgmt_frame_passthru_ctrl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_mgmt_frame_passthru_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int data = 0; @@ -7250,9 +7719,9 @@ req->req_id = MLAN_IOCTL_MISC_CFG; mgmt_cfg->sub_command = MLAN_OID_MISC_RX_MGMT_IND; - if (user_data_len == 0) { /* Get */ + if (user_data_len == 0) { /* Get */ req->action = MLAN_ACT_GET; - } else { /* Set */ + } else { /* Set */ mgmt_cfg->param.mgmt_subtype_mask = data; req->action = MLAN_ACT_SET; } @@ -7311,9 +7780,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_wmm_addts_req_ioctl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_wmm_addts_req_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *cfg = NULL; @@ -7396,9 +7864,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_wmm_delts_req_ioctl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_wmm_delts_req_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *cfg = NULL; @@ -7471,8 +7938,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_qconfig(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_qconfig(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -7516,7 +7983,7 @@ moal_memcpy_ext(priv->phandle, data_ptr, (t_u8 *)&qcfg_ioctl, sizeof(qcfg_ioctl), respbuflen - - (strlen(CMD_NXP) + strlen(PRIV_CMD_QCONFIG))); + (strlen(CMD_NXP) + strlen(PRIV_CMD_QCONFIG))); ret = strlen(CMD_NXP) + strlen(PRIV_CMD_QCONFIG) + sizeof(qcfg_ioctl); done: if (status != MLAN_STATUS_PENDING) @@ -7542,9 +8009,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_wmm_queue_status_ioctl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_wmm_queue_status_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -7597,9 +8063,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_wmm_ts_status_ioctl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_wmm_ts_status_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -7660,8 +8125,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_macctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_macctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ioctl_req *req = NULL; @@ -7729,8 +8194,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_getwap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_getwap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { int ret = 0; #ifdef STA_SUPPORT @@ -7779,8 +8243,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_region_code(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_region_code(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ioctl_req *req = NULL; @@ -7839,9 +8303,8 @@ return ret; } -#ifdef RX_PACKET_COALESCE /** - * @brief Set/Get RX packet coalesceing setting + * @brief Set/Get channel time and buffer weight * * @param priv A pointer to moal_private structure * @param respbuf A pointer to response buffer @@ -7849,41 +8312,26 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_rx_pkt_coalesce_cfg(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_multi_chan_config(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - int ret = 0; - t_u32 data[2]; - int user_data_len = 0, header_len = 0; + mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *cfg = NULL; t_u8 *data_ptr; - mlan_ioctl_req *req = NULL; + int ret = 0; + int user_data_len = 0, header_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); - data_ptr = respbuf + strlen(CMD_NXP) + strlen(PRIV_CMD_RX_COAL_CFG); - header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_RX_COAL_CFG); + data_ptr = respbuf + strlen(CMD_NXP) + strlen(PRIV_CMD_MULTI_CHAN_CFG); + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_MULTI_CHAN_CFG); if ((int)strlen(respbuf) == header_len) { /* GET operation */ user_data_len = 0; } else { /* SET operation */ - parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), - &user_data_len); - } - - if (sizeof(int) * user_data_len > sizeof(data)) { - PRINTM(MERROR, "Too many arguments\n"); - ret = -EINVAL; - goto done; - } - - if ((user_data_len != 0) && (user_data_len != 2)) { - PRINTM(MERROR, "Invalid arguments\n"); - ret = -EINVAL; - goto done; + user_data_len = sizeof(mlan_ds_multi_chan_cfg); } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); @@ -7893,15 +8341,16 @@ } cfg = (mlan_ds_misc_cfg *)req->pbuf; - cfg->sub_command = MLAN_OID_MISC_RX_PACKET_COALESCE; + cfg->sub_command = MLAN_OID_MISC_MULTI_CHAN_CFG; req->req_id = MLAN_IOCTL_MISC_CFG; if (user_data_len == 0) { req->action = MLAN_ACT_GET; } else { req->action = MLAN_ACT_SET; - cfg->param.rx_coalesce.packet_threshold = data[0]; - cfg->param.rx_coalesce.delay = data[1]; + moal_memcpy_ext(priv->phandle, &cfg->param.multi_chan_cfg, + data_ptr, sizeof(mlan_ds_multi_chan_cfg), + sizeof(mlan_ds_multi_chan_cfg)); } status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); @@ -7911,15 +8360,159 @@ } moal_memcpy_ext(priv->phandle, respbuf, - (mlan_ds_misc_rx_packet_coalesce *)&cfg->param. - rx_coalesce, req->buf_len, respbuflen); + (mlan_ds_multi_chan_cfg *)&cfg->param.multi_chan_cfg, + req->buf_len, respbuflen); ret = req->buf_len; done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief Set/Get multi_channel policy setting + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_multi_chan_policy(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int user_data_len = 0, header_len = 0; + int data = 0; + t_u16 enable; + t_u8 action; + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_MULTI_CHAN_POLICY); + if ((int)strlen(respbuf) == header_len) { + /* GET operation */ + user_data_len = 0; + } else { + /* SET operation */ + parse_arguments(respbuf + header_len, &data, 1, &user_data_len); + } + + if (user_data_len > 1) { + PRINTM(MERROR, "Invalid number of arguments\n"); + ret = -EINVAL; + goto done; + } + + if (user_data_len == 0) { + action = MLAN_ACT_GET; + } else { + action = MLAN_ACT_SET; + enable = (t_u16)data; + } + + if (MLAN_STATUS_SUCCESS != + woal_mc_policy_cfg(priv, &enable, MOAL_IOCTL_WAIT, action)) { + ret = -EFAULT; + goto done; + } + moal_memcpy_ext(priv->phandle, respbuf, &enable, sizeof(t_u16), + respbuflen); + ret = sizeof(t_u16); + +done: LEAVE(); return ret; } -#endif + +/** + * @brief Set/Get drcs time slicing parameters + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_drcs_time_slicing_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + mlan_ds_drcs_cfg *drcs_cfg = NULL; + t_u8 *data_ptr; + int ret = 0; + int user_data_len = 0, header_len = 0; + int data[8]; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + data_ptr = respbuf + strlen(CMD_NXP) + strlen(PRIV_CMD_DRCS_CFG); + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_DRCS_CFG); + if ((int)strlen(respbuf) == header_len) { + /* GET operation */ + user_data_len = 0; + } else { + /* SET operation */ + memset((char *)data, 0, sizeof(data)); + parse_arguments(data_ptr, data, ARRAY_SIZE(data), + &user_data_len); + } + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg = (mlan_ds_misc_cfg *)req->pbuf; + cfg->sub_command = MLAN_OID_MISC_DRCS_CFG; + req->req_id = MLAN_IOCTL_MISC_CFG; + + if (user_data_len == 0) { + req->action = MLAN_ACT_GET; + } else { + req->action = MLAN_ACT_SET; + drcs_cfg = (mlan_ds_drcs_cfg *)&cfg->param.drcs_cfg[0]; + drcs_cfg->chantime = (t_u8)data[0]; + drcs_cfg->switchtime = (t_u8)data[1]; + drcs_cfg->undozetime = (t_u8)data[2]; + drcs_cfg->mode = (t_u8)data[3]; + /* Set the same parameters for two channels*/ + if (user_data_len < (int)ARRAY_SIZE(data)) + drcs_cfg->chan_idx = 0x03; + else { + /* Set the different parameters for two channels*/ + drcs_cfg->chan_idx = 0x1; + drcs_cfg = (mlan_ds_drcs_cfg *)&cfg->param.drcs_cfg[1]; + drcs_cfg->chan_idx = 0x2; + drcs_cfg->chantime = (t_u8)data[4]; + drcs_cfg->switchtime = (t_u8)data[5]; + drcs_cfg->undozetime = (t_u8)data[6]; + drcs_cfg->mode = (t_u8)data[7]; + } + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + + moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)&cfg->param.drcs_cfg, + req->buf_len, respbuflen); + ret = req->buf_len; + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + /** * @brief Set/Get FW side mac address * @@ -7929,8 +8522,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_fwmacaddr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_fwmacaddr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { t_u8 data[ETH_ALEN]; int ret = 0; @@ -7996,8 +8589,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_offchannel(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_offchannel(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[4]; int ret = 0; @@ -8016,11 +8609,12 @@ if (priv->phandle->remain_on_channel) ret = sprintf(respbuf, "There is pending remain on channel from bss %d\n", - priv->phandle->remain_bss_index) + 1; + priv->phandle->remain_bss_index) + + 1; else ret = sprintf(respbuf, - "There is no pending remain on channel\n") - + 1; + "There is no pending remain on channel\n") + + 1; goto done; } else parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), @@ -8066,9 +8660,8 @@ if (user_data_len == 4) { if (data[3] && (data[3] != CHANNEL_BW_40MHZ_ABOVE) && - (data[3] != CHANNEL_BW_40MHZ_BELOW) - && (data[3] != CHANNEL_BW_80MHZ) - ) { + (data[3] != CHANNEL_BW_40MHZ_BELOW) && + (data[3] != CHANNEL_BW_80MHZ)) { PRINTM(MERROR, "invalid bandwidth"); ret = -EINVAL; goto done; @@ -8093,8 +8686,8 @@ if (data[0] == 0) { if (!priv->phandle->remain_on_channel) { ret = sprintf(respbuf, - "There is no pending remain on channel to be canceled\n") - + 1; + "There is no pending remain on channel to be canceled\n") + + 1; goto done; } if (woal_cfg80211_remain_on_channel_cfg(priv, MOAL_IOCTL_WAIT, @@ -8107,22 +8700,20 @@ if (status == MLAN_STATUS_SUCCESS) priv->phandle->remain_on_channel = MFALSE; } else if (data[0] == 1) { - if (woal_cfg80211_remain_on_channel_cfg - (priv, MOAL_IOCTL_WAIT, MFALSE, &status, - ieee80211_get_channel(priv->wdev->wiphy, - ieee80211_channel_to_frequency(data - [1] + if (woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, &status, + ieee80211_get_channel( + priv->wdev->wiphy, + ieee80211_channel_to_frequency( + data[1] #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - , - (data - [1] - <= - 14 ? - IEEE80211_BAND_2GHZ - : - IEEE80211_BAND_5GHZ) + , + (data[1] <= 14 ? + IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ) #endif - )), chan_type, (t_u32)data[2])) { + )), + chan_type, (t_u32)data[2])) { PRINTM(MERROR, "remain_on_channel: Failed to start\n"); ret = -EFAULT; goto done; @@ -8154,8 +8745,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_set_get_dscp_map(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_dscp_map(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = MLAN_STATUS_SUCCESS; t_u8 *pos = NULL; @@ -8189,8 +8780,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_driver_verext(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_driver_verext(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_get_info *info = NULL; @@ -8204,7 +8795,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8270,8 +8861,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_enter_usb_suspend(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_enter_usb_suspend(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; @@ -8293,8 +8884,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_exit_usb_suspend(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_exit_usb_suspend(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; @@ -8319,8 +8910,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_radio_ctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_radio_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0, option = 0; int user_data_len = 0, header_len = 0; @@ -8378,8 +8969,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_wmm_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_wmm_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_wmm_cfg *wmm = NULL; @@ -8392,7 +8983,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_wmm_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8453,9 +9044,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_min_ba_threshold_cfg(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_min_ba_threshold_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_11n_cfg *cfg_11n = NULL; @@ -8468,7 +9058,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } cfg_11n = (mlan_ds_11n_cfg *)req->pbuf; @@ -8528,8 +9118,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_11d_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_11d_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_11d_cfg *pcfg_11d = NULL; @@ -8542,7 +9132,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11d_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8602,8 +9192,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_priv_11d_clr_chan_tbl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_11d_clr_chan_tbl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ds_11d_cfg *pcfg_11d = NULL; mlan_ioctl_req *req = NULL; @@ -8615,7 +9205,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11d_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8655,8 +9245,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_wws_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_wws_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_misc_cfg *wws = NULL; @@ -8669,7 +9259,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8729,8 +9319,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_reassoc(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_reassoc(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { moal_handle *handle = priv->phandle; int data = 0; @@ -8758,8 +9348,8 @@ priv->reassoc_required = MFALSE; if (!handle->reassoc_on && handle->is_reassoc_timer_set == MTRUE) { - woal_cancel_timer(&handle-> - reassoc_timer); + woal_cancel_timer( + &handle->reassoc_timer); handle->is_reassoc_timer_set = MFALSE; } } else if (data == 1) { @@ -8789,8 +9379,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_txbuf_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_txbuf_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ds_11n_cfg *cfg_11n = NULL; mlan_ioctl_req *req = NULL; @@ -8802,7 +9392,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8849,8 +9439,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_auth_type(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_auth_type(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int auth_type = 0; t_u32 auth_mode; @@ -8881,9 +9471,8 @@ if (user_data_len == 1) { PRINTM(MINFO, "SET: auth_type %d\n", auth_type); if (((auth_type < MLAN_AUTH_MODE_OPEN) || - (auth_type > MLAN_AUTH_MODE_SAE)) - && (auth_type != MLAN_AUTH_MODE_AUTO) - ) { + (auth_type > MLAN_AUTH_MODE_OWE)) && + (auth_type != MLAN_AUTH_MODE_AUTO)) { ret = -EINVAL; goto done; } @@ -8915,9 +9504,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_11h_local_pwr_constraint(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_11h_local_pwr_constraint(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_11h_cfg *ds_11hcfg = NULL; @@ -8930,7 +9518,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -8986,8 +9574,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_ht_stream_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_ht_stream_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_11n_cfg *cfg = NULL; @@ -9000,7 +9588,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -9059,10 +9647,10 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_mimo_switch(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_mimo_switch(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - int data[2] = { 0 }; + int data[2] = {0}; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *req = NULL; int ret = 0; @@ -9073,7 +9661,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -9122,8 +9710,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_thermal(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_thermal(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ds_misc_cfg *cfg = NULL; mlan_ioctl_req *req = NULL; @@ -9134,7 +9722,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -9178,8 +9766,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_beacon_interval(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_beacon_interval(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data = 0; mlan_ds_bss *bss = NULL; @@ -9192,7 +9780,7 @@ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { - ret = ENOMEM; + ret = -ENOMEM; goto done; } @@ -9252,8 +9840,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_signal(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_signal(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { /** Input data size */ #define IN_DATA_SIZE 2 @@ -9292,15 +9880,15 @@ } switch (user_data_len) { - case 0: /* No checking, get everything */ + case 0: /* No checking, get everything */ break; - case 2: /* Check subtype range */ + case 2: /* Check subtype range */ if (in_data[1] < 1 || in_data[1] > 4) { ret = -EINVAL; goto done; } /* Fall through */ - case 1: /* Check type range */ + case 1: /* Check type range */ if (in_data[0] < 1 || in_data[0] > 3) { ret = -EINVAL; goto done; @@ -9332,7 +9920,7 @@ /* Check type */ switch (in_data[0]) { - case 0: /* Send everything */ + case 0: /* Send everything */ out_data[data_length++] = signal.bcn_rssi_last; out_data[data_length++] = signal.bcn_rssi_avg; out_data[data_length++] = signal.data_rssi_last; @@ -9346,75 +9934,75 @@ out_data[data_length++] = signal.data_nf_last; out_data[data_length++] = signal.data_nf_avg; break; - case 1: /* RSSI */ + case 1: /* RSSI */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_rssi_last; out_data[data_length++] = signal.bcn_rssi_avg; out_data[data_length++] = signal.data_rssi_last; out_data[data_length++] = signal.data_rssi_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_rssi_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_rssi_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_rssi_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_rssi_avg; break; default: break; } break; - case 2: /* SNR */ + case 2: /* SNR */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_snr_last; out_data[data_length++] = signal.bcn_snr_avg; out_data[data_length++] = signal.data_snr_last; out_data[data_length++] = signal.data_snr_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_snr_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_snr_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_snr_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_snr_avg; break; default: break; } break; - case 3: /* NF */ + case 3: /* NF */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_nf_last; out_data[data_length++] = signal.bcn_nf_avg; out_data[data_length++] = signal.data_nf_last; out_data[data_length++] = signal.data_nf_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_nf_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_nf_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_nf_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_nf_avg; break; default: @@ -9434,8 +10022,7 @@ return ret; } -static int -woal_signal_ext_enable(moal_private *priv, t_u8 enable) +static int woal_signal_ext_enable(moal_private *priv, t_u8 enable) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -9478,14 +10065,14 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_signal_ext(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_signal_ext(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { #define PATH_SIZE 13 int ret = 0; int data = 0, path = 0, data_len = 0; int user_data_len = 0, header_len = 0; - int out_data[PATH_SIZE * MAX_PATH_NUM] = { 0 }; + int out_data[PATH_SIZE * MAX_PATH_NUM] = {0}; mlan_ioctl_req *req = NULL; mlan_ds_get_info *info = NULL; mlan_ds_get_signal signal_get[MAX_PATH_NUM]; @@ -9608,9 +10195,10 @@ out_data[data_len++] = (int)signal_get[path].data_nf_last; out_data[data_len++] = (int)signal_get[path].data_nf_avg; } - moal_memcpy_ext(priv->phandle, respbuf, out_data, - (MIN((PATH_SIZE * MAX_PATH_NUM), data_len) * - sizeof(int)), respbuflen); + moal_memcpy_ext( + priv->phandle, respbuf, out_data, + (MIN((PATH_SIZE * MAX_PATH_NUM), data_len) * sizeof(int)), + respbuflen); ret = data_len * sizeof(int); done: if (status != MLAN_STATUS_PENDING) @@ -9628,14 +10216,14 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_signal_ext_v2(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_signal_ext_v2(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { #define PATH_SIZE 13 int ret = 0; int data = 0, path = 0, data_len = 0; int user_data_len = 0, header_len = 0; - int out_data[PATH_SIZE * MAX_PATH_NUM] = { 0 }; + int out_data[PATH_SIZE * MAX_PATH_NUM] = {0}; mlan_ioctl_req *req = NULL; mlan_ds_get_info *info = NULL; mlan_ds_get_signal signal_get[MAX_PATH_NUM]; @@ -9749,9 +10337,10 @@ out_data[data_len++] = (int)signal_get[path].data_nf_last; out_data[data_len++] = (int)signal_get[path].data_nf_avg; } - moal_memcpy_ext(priv->phandle, respbuf, out_data, - (MIN((PATH_SIZE * MAX_PATH_NUM), data_len) * - sizeof(int)), respbuflen); + moal_memcpy_ext( + priv->phandle, respbuf, out_data, + (MIN((PATH_SIZE * MAX_PATH_NUM), data_len) * sizeof(int)), + respbuflen); ret = data_len * sizeof(int); done: if (status != MLAN_STATUS_PENDING) @@ -9769,8 +10358,8 @@ * * @return The result of this processing. */ -static int -woal_priv_signalext_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_signalext_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int enable = 0; int ret = 0; @@ -9813,10 +10402,10 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_priv_set_get_pmfcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_pmfcfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - int data[2] = { 0, 0 }; + int data[2] = {0, 0}; mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *cfg = NULL; mlan_ds_misc_pmfcfg *pmfcfg; @@ -9892,9 +10481,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_inactivity_timeout_ext(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_inactivity_timeout_ext(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[4]; mlan_ioctl_req *req = NULL; @@ -9980,13 +10568,12 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_11n_amsdu_aggr_ctrl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_11n_amsdu_aggr_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; - int ret = 0, data[2] = { 0 }; + int ret = 0, data[2] = {0}; int user_data_len = 0, header_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -10049,8 +10636,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_tx_bf_cap_ioctl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_tx_bf_cap_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *bf_cfg = NULL; @@ -10118,8 +10705,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_sdio_clock_ioctl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_sdio_clock_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int data = 2; @@ -10178,8 +10765,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_sdio_mpa_ctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_sdio_mpa_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -10296,24 +10883,22 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_sleep_params_ioctl(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_sleep_params_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; mlan_ds_pm_cfg *pm = NULL; mlan_ds_sleep_params *psleep_params = NULL; - int data[6] = { 0 }, i; + int data[6] = {0}, i; int user_data_len = 0, header_len = 0; #ifdef DEBUG_LEVEL1 - char err_str[][36] = { {"sleep clock error in ppm"}, - {"wakeup offset in usec"}, - {"clock stabilization time in usec"}, - {"control periodic calibration(0-2)"}, - {"control of external sleepClock(0-2)"}, - {"value of reserved for debug"} - }; + char err_str[][36] = {{"sleep clock error in ppm"}, + {"wakeup offset in usec"}, + {"clock stabilization time in usec"}, + {"control periodic calibration(0-2)"}, + {"control of external sleepClock(0-2)"}, + {"value of reserved for debug"}}; #endif mlan_status status = MLAN_STATUS_SUCCESS; @@ -10404,6 +10989,376 @@ return ret; } +#ifdef UAP_SUPPORT +/** + * @brief Set/Get network monitor configurations + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_net_monitor_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int user_data_len = 0, header_len = 0; + int data_length = 0; + int data[5] = {0}; + int ret = 0; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_net_monitor *net_mon = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + moal_handle *handle = priv->phandle; + monitor_iface *mon_if = NULL; + struct net_device *ndev = NULL; +#endif + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_NET_MON); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + LEAVE(); + return -ENOMEM; + } + misc = (mlan_ds_misc_cfg *)req->pbuf; + net_mon = (mlan_ds_misc_net_monitor *)&misc->param.net_mon; + misc->sub_command = MLAN_OID_MISC_NET_MONITOR; + req->req_id = MLAN_IOCTL_MISC_CFG; + if ((int)strlen(respbuf) == header_len) { + /* GET operation */ + user_data_len = 0; + req->action = MLAN_ACT_GET; + } else { + /* SET operation */ + parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), + &user_data_len); + if (user_data_len == 1 || user_data_len == 2 || + user_data_len == 4 || user_data_len == 5) { + if (data[0] != MTRUE && data[0] != MFALSE) { + PRINTM(MERROR, + "NET_MON: Activity should be enable(=1)/" + "disable(=0)\n"); + ret = -EINVAL; + goto done; + } + net_mon->enable_net_mon = data[0]; + if (data[0] == MTRUE) { + int i; + if (user_data_len != 2 && user_data_len != 4 && + user_data_len != 5) { + PRINTM(MERROR, + "NET_MON: Invalid number of args!\n"); + ret = -EINVAL; + goto done; + } + /* Supported filter flags */ + if (!data[1] || + data[1] & ~(MLAN_NETMON_DATA | + MLAN_NETMON_MANAGEMENT | + MLAN_NETMON_CONTROL)) { + PRINTM(MERROR, + "NET_MON: Invalid filter flag\n"); + ret = -EINVAL; + goto done; + } + + if (user_data_len > 2) { + /* Supported bands */ + + for (i = 0; + i < + (int)(sizeof(SupportedInfraBand) / + sizeof(SupportedInfraBand[0])); + i++) + if (data[2] == + SupportedInfraBand[i]) + break; + if (i == sizeof(SupportedInfraBand)) { + PRINTM(MERROR, + "NET_MON: Invalid band\n"); + ret = -EINVAL; + goto done; + } + } + /* Supported channel */ + if (user_data_len > 3 && + (data[3] < 1 || + data[3] > MLAN_MAX_CHANNEL)) { + PRINTM(MERROR, + "NET_MON: Invalid channel number\n"); + ret = -EINVAL; + goto done; + } + if (user_data_len == 5) { + /* Secondary channel offset */ + if (!(data[2] & (BAND_GN | BAND_AN))) { + PRINTM(MERROR, + "No 11n in band, can not set " + "secondary channel offset\n"); + ret = -EINVAL; + goto done; + } + if ((data[4] != CHANNEL_BW_20MHZ) && + (data[4] != + CHANNEL_BW_40MHZ_ABOVE) && + (data[4] != + CHANNEL_BW_40MHZ_BELOW) && + (data[4] != CHANNEL_BW_80MHZ)) { + PRINTM(MERROR, + "Invalid secondary channel bandwidth, " + "only allowed 0, 1, 3 or 4\n"); + ret = -EINVAL; + goto done; + } + net_mon->chan_bandwidth = data[4]; + } + + net_mon->filter_flag = data[1]; + net_mon->band = data[2]; + net_mon->channel = data[3]; + } + req->action = MLAN_ACT_SET; + } else { + PRINTM(MERROR, "NET_MON: Invalid number of args!\n"); + ret = -EINVAL; + goto done; + } + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "NET_MON: woal_request_ioctl fail\n"); + ret = -EFAULT; + goto done; + } + +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + if (req->action == MLAN_ACT_SET) { + if (data[0]) { /** Enable sniffer mode: 1/2 */ + if (!handle->mon_if) { + mon_if = woal_prepare_mon_if(priv, "rtap", 0); + if (!mon_if) { + PRINTM(MFATAL, + "Prepare mon_if fail.\n"); + ret = -EFAULT; + goto done; + } + ndev = mon_if->mon_ndev; + ret = register_netdevice(ndev); + if (ret) { + PRINTM(MFATAL, + "register net_device failed, ret=%d\n", + ret); + free_netdev(ndev); + ret = -EFAULT; + goto done; + } + handle->mon_if = mon_if; + } + /* Save band channel config */ + handle->mon_if->band_chan_cfg.band = net_mon->band; + handle->mon_if->band_chan_cfg.channel = + net_mon->channel; + handle->mon_if->band_chan_cfg.chan_bandwidth = + net_mon->chan_bandwidth; + handle->mon_if->flag = net_mon->filter_flag; + } else { /** Disable sniffer mode: 0 */ + if (handle->mon_if) { + ndev = handle->mon_if->mon_ndev; + handle->mon_if = NULL; + unregister_netdevice(ndev); + } + } + } +#endif + + data[0] = net_mon->enable_net_mon; + data[1] = net_mon->filter_flag; + data[2] = net_mon->band; + data[3] = net_mon->channel; + data[4] = net_mon->chan_bandwidth; + data_length = 5; + moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)data, + sizeof(int) * data_length, respbuflen); + ret = sizeof(int) * data_length; + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + + LEAVE(); + return ret; +} +#endif + +/** + * @brief This function get nop list. + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_nop_list(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11h_cfg *ds_11hcfg = NULL; + + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_11H_CFG; + req->action = MLAN_ACT_GET; + + ds_11hcfg = (mlan_ds_11h_cfg *)req->pbuf; + ds_11hcfg->sub_command = MLAN_OID_11H_NOP_CHAN_LIST; + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status == MLAN_STATUS_FAILURE) { + ret = -EFAULT; + goto done; + } + moal_memcpy_ext(priv->phandle, respbuf, + (t_u8 *)&ds_11hcfg->param.nop_chan_list, + sizeof(mlan_ds_11h_nop_chan_list), respbuflen); + ret = sizeof(mlan_ds_11h_nop_chan_list); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief clear NOP list + * + * @param priv A pointer to moal_private structure + * @return 0 --success, otherwise fail + */ +static int woal_uap_clear_nop(moal_private *priv) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11h_cfg *ds_11hcfg = NULL; + + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_11H_CFG; + req->action = MLAN_ACT_CLEAR; + + ds_11hcfg = (mlan_ds_11h_cfg *)req->pbuf; + ds_11hcfg->sub_command = MLAN_OID_11H_CHAN_NOP_INFO; + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status == MLAN_STATUS_FAILURE) { + ret = -EFAULT; + goto done; + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief This function clear nop flags. + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_clear_nop(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + struct wiphy *wiphy = priv->phandle->wiphy; +#endif + + ENTER(); + PRINTM(MCMND, "clear nop\n"); + ret = woal_uap_clear_nop(priv); +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + if (IS_STA_OR_UAP_CFG80211(priv->phandle->params.cfg80211_wext)) { + if (wiphy) + woal_clear_wiphy_dfs_state(wiphy); + } +#endif + ret = sizeof(int); + LEAVE(); + return ret; +} + +/** + * @brief This function detects fake RADAR. + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return positive for success, negative for failure. + */ +static int woal_priv_fake_radar(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_snmp_mib *snmp = NULL; + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + ENTER(); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (priv && priv->chan.chan && + !(priv->chan.chan->flags & IEEE80211_CHAN_RADAR)) { + PRINTM(MERROR, "Current op channel NOT DFS\n"); + LEAVE(); + return -EINVAL; + } +#endif +#endif + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_snmp_mib)); + if (ioctl_req == NULL) { + LEAVE(); + return -ENOMEM; + } + snmp = (mlan_ds_snmp_mib *)ioctl_req->pbuf; + ioctl_req->req_id = MLAN_IOCTL_SNMP_MIB; + snmp->sub_command = MLAN_OID_SNMP_MIB_DOT11H_FAKERADAR; + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + LEAVE(); + return ret; +} + /** * @brief Set/Get DFS Testing settings * @@ -10413,13 +11368,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dfs_testing(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_dfs_testing(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_11h_cfg *ds_11hcfg = NULL; int ret = 0; - int data[5] = { 0 }; + int data[5] = {0}; int user_data_len = 0, header_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -10528,8 +11483,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dfs53cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_dfs53cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_11h_cfg *ds_11hcfg = NULL; @@ -10603,6 +11558,88 @@ } /** + * @brief Set/Get DFS mode settings + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_dfs_mode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11h_cfg *ds_11hcfg = NULL; + int ret = 0; + int data = 0; + int user_data_len = 0, header_len = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_DFS_MODE); + /* Allocate an IOCTL request buffer */ + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + /* Fill request buffer */ + ds_11hcfg = (mlan_ds_11h_cfg *)req->pbuf; + ds_11hcfg->sub_command = MLAN_OID_11H_DFS_MODE; + req->req_id = MLAN_IOCTL_11H_CFG; + + if ((int)strlen(respbuf) == header_len) { + /* GET operation */ + user_data_len = 0; + req->action = MLAN_ACT_GET; + } else { + /* SET operation */ + parse_arguments(respbuf + header_len, &data, + sizeof(data) / sizeof(int), &user_data_len); + if (user_data_len != 1) { + PRINTM(MERROR, "Invalid number of args !\n"); + ret = -EINVAL; + goto done; + } + if (data > DFS_MODE_ENH) { + PRINTM(MERROR, "Invalid config for dfs_mode!\n"); + ret = -EINVAL; + goto done; + } + + ds_11hcfg->param.dfs_mode = (t_u8)data; + req->action = MLAN_ACT_SET; + } + + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + + if (!user_data_len) { + moal_memcpy_ext(priv->phandle, respbuf, + (t_u8 *)&ds_11hcfg->param.dfs_mode, + sizeof(ds_11hcfg->param.dfs_mode), respbuflen); + ret = sizeof(t_u8); + } + + PRINTM(MIOCTL, "dfs_mode %d\n", ds_11hcfg->param.dfs_mode); + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + + LEAVE(); + return ret; +} + +#ifdef UAP_SUPPORT +/** * @brief determine the center frquency center index for bandwidth * of 80 MHz and 160 MHz * @@ -10614,9 +11651,8 @@ * @return channel center frequency center, if found; O, otherwise */ -static t_u8 -woal_get_center_freq_idx(moal_private *priv, t_u8 band, - t_u32 pri_chan, t_u8 chan_bw) +static t_u8 woal_get_center_freq_idx(moal_private *priv, t_u16 band, + t_u32 pri_chan, t_u8 chan_bw) { t_u8 center_freq_idx = 0; @@ -10813,12 +11849,13 @@ break; } /* fall through */ - default: /* error. go to the default */ + default: /* error. go to the default */ center_freq_idx = 42; } } return center_freq_idx; } +#endif #if defined(UAP_SUPPORT) /** @@ -10834,9 +11871,9 @@ * * @return channel center frequency center, if found; O, otherwise */ -static int -woal_channel_switch(moal_private *priv, t_u8 block_tx, t_u8 oper_class, - t_u8 channel, t_u8 switch_count, t_u8 band_width, t_u8 ecsa) +static int woal_channel_switch(moal_private *priv, t_u8 block_tx, + t_u8 oper_class, t_u8 channel, t_u8 switch_count, + t_u8 band_width, t_u8 ecsa) { IEEEtypes_ExtChanSwitchAnn_t *ext_chan_switch = NULL; IEEEtypes_ChanSwitchAnn_t *chan_switch = NULL; @@ -10867,10 +11904,11 @@ misc->param.cust_ie.len = (sizeof(custom_ie) - MAX_IE_SIZE); pcust_chansw_ie = (custom_ie *)&misc->param.cust_ie.ie_data_list[0]; - pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ + pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ pcust_chansw_ie->ie_length = sizeof(IEEEtypes_ChanSwitchAnn_t); - pcust_chansw_ie->mgmt_subtype_mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP; /*Add IE for - BEACON/probe resp */ + pcust_chansw_ie->mgmt_subtype_mask = + MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP; /*Add IE for + BEACON/probe resp*/ chan_switch = (IEEEtypes_ChanSwitchAnn_t *)pcust_chansw_ie->ie_buffer; chan_switch->element_id = CHANNEL_SWITCH_ANN; chan_switch->len = 3; @@ -10895,17 +11933,15 @@ break; } if (!new_oper_class && ecsa) - woal_priv_get_nonglobal_operclass_by_bw_channel(priv, bw, - channel, - &new_oper_class); + woal_priv_get_nonglobal_operclass_by_bw_channel( + priv, bw, channel, &new_oper_class); if (new_oper_class) { pcust_chansw_ie->ie_length += sizeof(IEEEtypes_ExtChanSwitchAnn_t); ext_chan_switch = - (IEEEtypes_ExtChanSwitchAnn_t *) (pcust_chansw_ie-> - ie_buffer + - sizeof - (IEEEtypes_ChanSwitchAnn_t)); + (IEEEtypes_ExtChanSwitchAnn_t + *)(pcust_chansw_ie->ie_buffer + + sizeof(IEEEtypes_ChanSwitchAnn_t)); ext_chan_switch->element_id = EXTEND_CHANNEL_SWITCH_ANN; ext_chan_switch->len = 4; ext_chan_switch->chan_switch_mode = block_tx; @@ -10916,7 +11952,7 @@ (t_u8 *)(pcust_chansw_ie->ie_buffer + sizeof(IEEEtypes_ChanSwitchAnn_t)), pcust_chansw_ie->ie_length - - sizeof(IEEEtypes_ChanSwitchAnn_t)); + sizeof(IEEEtypes_ChanSwitchAnn_t)); } /* bandwidth 40/80/160 should set channel switch wrapper ie for 11ac 5G * channel*/ @@ -10928,8 +11964,8 @@ pChanSwWrap_ie->len = sizeof(IEEEtypes_WideBWChanSwitch_t); pbwchansw_ie = (IEEEtypes_WideBWChanSwitch_t - *)((t_u8 *)pChanSwWrap_ie + - sizeof(IEEEtypes_Header_t)); + *)((t_u8 *)pChanSwWrap_ie + + sizeof(IEEEtypes_Header_t)); pbwchansw_ie->ieee_hdr.element_id = BW_CHANNEL_SWITCH; pbwchansw_ie->ieee_hdr.len = sizeof(IEEEtypes_WideBWChanSwitch_t) - @@ -10958,12 +11994,12 @@ PRINTM(MERROR, "Invalid bandwidth.Support value 1/3/4/5 for 40+/40-/80/160MHZ\n"); - /*prepare the VHT Transmit Power Envelope IE */ + /*prepare the VHT Transmit Power Envelope IE*/ pvhttpcEnv_ie = (IEEEtypes_VhtTpcEnvelope_t - *)((t_u8 *)pChanSwWrap_ie + - sizeof(IEEEtypes_Header_t) + - sizeof(IEEEtypes_WideBWChanSwitch_t)); + *)((t_u8 *)pChanSwWrap_ie + + sizeof(IEEEtypes_Header_t) + + sizeof(IEEEtypes_WideBWChanSwitch_t)); pvhttpcEnv_ie->ieee_hdr.element_id = VHT_TX_POWER_ENV; pvhttpcEnv_ie->ieee_hdr.len = sizeof(IEEEtypes_VhtTpcEnvelope_t) - @@ -10998,12 +12034,11 @@ priv->phandle->chsw_wait_q_woken = MFALSE; /* wait for channel switch to complete */ - wait_event_interruptible_timeout(priv->phandle->chsw_wait_q, - priv->phandle->chsw_wait_q_woken, - (u32)HZ * (switch_count + - 2) * 110 / 1000); + wait_event_interruptible_timeout( + priv->phandle->chsw_wait_q, priv->phandle->chsw_wait_q_woken, + (u32)HZ * (switch_count + 2) * 110 / 1000); - pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ + pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ pcust_chansw_ie->mgmt_subtype_mask = 0; status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_SUCCESS) { @@ -11015,7 +12050,777 @@ LEAVE(); return ret; +} +#endif +#ifdef UAP_SUPPORT +/** + * @brief Given bandwidth and channel, create Band_Config + * + * @param priv A pointer to moal_private + * @param bandcfg A pointer to Band_Config_t structure + * @param channel A pointer to cfg80211_chan_def structure + * @param bandwidth 0/1/3/4 + * + * @return N/A + */ +static void woal_convert_chanbw_to_bandconfig(moal_private *priv, + Band_Config_t *bandcfg, + t_u8 channel, t_u8 bandwidth) +{ + ENTER(); + + if (channel <= MAX_BG_CHANNEL) + bandcfg->chanBand = BAND_2GHZ; + else + bandcfg->chanBand = BAND_5GHZ; + switch (bandwidth) { + case CHANNEL_BW_40MHZ_ABOVE: + bandcfg->chanWidth = CHAN_BW_40MHZ; + bandcfg->chan2Offset = SEC_CHAN_ABOVE; + break; + case CHANNEL_BW_40MHZ_BELOW: + bandcfg->chanWidth = CHAN_BW_40MHZ; + bandcfg->chan2Offset = SEC_CHAN_BELOW; + break; + case CHANNEL_BW_80MHZ: + bandcfg->chanWidth = CHAN_BW_80MHZ; + bandcfg->chan2Offset = + woal_get_second_channel_offset(priv, channel); + break; + case CHANNEL_BW_20MHZ: + default: + bandcfg->chanWidth = CHAN_BW_20MHZ; + break; + } + LEAVE(); + return; +} + +/** + * @brief Get DFS channel list + * + * @param priv A pointer to moal_private + * + * @return N/A + */ +static void woal_get_dfs_chan_list(moal_private *priv) +{ +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + struct wiphy *wiphy = priv->phandle->wiphy; + struct ieee80211_supported_band *sband; +#endif + int i; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfp_misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + if (IS_STA_OR_UAP_CFG80211(priv->phandle->params.cfg80211_wext) && + wiphy) { + sband = wiphy->bands[NL80211_BAND_5GHZ]; + if (sband) { + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & + IEEE80211_CHAN_RADAR) { + priv->auto_dfs_cfg.dfs_chan_list + [priv->auto_dfs_cfg.num_of_chan] = + sband->channels[i].hw_value; + priv->auto_dfs_cfg.num_of_chan++; + } + } + return; + } + } +#endif + /* Allocate an IOCTL request buffer */ + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) + goto done; + + /* Fill request buffer */ + cfp_misc = (mlan_ds_misc_cfg *)req->pbuf; + cfp_misc->sub_command = MLAN_OID_MISC_CFP_TABLE; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_GET; + cfp_misc->param.cfp.band = BAND_A; + + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) + goto done; + + for (i = 0; i < cfp_misc->param.cfp.num_chan; i++) { + if (cfp_misc->param.cfp.cfp_tbl[i].dynamic.flags & + NXP_CHANNEL_DISABLED) + continue; + if (cfp_misc->param.cfp.cfp_tbl[i].passive_scan_or_radar_detect) { + priv->auto_dfs_cfg + .dfs_chan_list[priv->auto_dfs_cfg.num_of_chan] = + cfp_misc->param.cfp.cfp_tbl[i].channel; + priv->auto_dfs_cfg.num_of_chan++; + } + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + + LEAVE(); + return; +} + +/** + * @brief Process dfs cac command + * + * @param priv a pointer to moal_private structure + * @param ch_rpt_req a pointer to mlan_ds_11h_chan_rep_req structure + * + * @return MLAN_STATUS_FAILRUE or MLAN_STATUS_SUCCESS + */ +mlan_status woal_do_dfs_cac(moal_private *priv, + mlan_ds_11h_chan_rep_req *ch_rpt_req) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11h_cfg *p11h_cfg = NULL; + mlan_ds_11h_chan_rep_req *pchan_rpt_req = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (NULL == req) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + p11h_cfg = (mlan_ds_11h_cfg *)req->pbuf; + pchan_rpt_req = &p11h_cfg->param.chan_rpt_req; + + moal_memcpy_ext(priv->phandle, pchan_rpt_req, ch_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + + if (priv->bss_type == MLAN_BSS_TYPE_DFS) + p11h_cfg->sub_command = MLAN_OID_11H_CHAN_REPORT_REQUEST; + else + p11h_cfg->sub_command = MLAN_OID_11H_CHANNEL_CHECK; + + req->req_id = MLAN_IOCTL_11H_CFG; + + req->action = MLAN_ACT_SET; + /* Send Channel Check command and wait until the report is ready */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} + +/** + * @brief Get Next DFS channel from dfs_chan_list + * + * @param priv a pointer to moal_private structure + * + * @return N/A + * + */ +static t_u8 woal_get_next_dfs_chan(moal_private *priv) +{ + int i; + int idx = priv->curr_cac_idx; + mlan_ds_11h_chan_dfs_state ch_dfs_state; + t_u8 chan = 0; + ENTER(); + idx++; + if (idx >= priv->auto_dfs_cfg.num_of_chan) + idx = 0; + for (i = 0; i < priv->auto_dfs_cfg.num_of_chan; i++) { + if (priv->chan_rpt_req.chanNum != + priv->auto_dfs_cfg.dfs_chan_list[idx]) { + memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); + ch_dfs_state.channel = + priv->auto_dfs_cfg.dfs_chan_list[idx]; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, + &ch_dfs_state)) { + PRINTM(MERROR, + "%s: woal_11h_chan_dfs_state failed \n", + __func__); + continue; + } + if (ch_dfs_state.dfs_state != DFS_UNAVAILABLE) { + chan = priv->auto_dfs_cfg.dfs_chan_list[idx]; + priv->curr_cac_idx = idx; + break; + } + } + idx++; + if (idx >= priv->auto_dfs_cfg.num_of_chan) + idx = 0; + } + LEAVE(); + return chan; +} + +/** + * @brief Process auto dfs cac + * + * @param priv a pointer to moal_private structure + * + * @return N/A + * + */ +static void woal_do_auto_dfs(moal_private *priv) +{ + mlan_ds_11h_chan_rep_req chan_rpt_req; + ENTER(); + if (priv->auto_dfs_cfg.multi_chan_dfs && + priv->auto_dfs_cfg.num_of_chan) { + memset(&chan_rpt_req, 0, sizeof(chan_rpt_req)); + chan_rpt_req.startFreq = START_FREQ_11A_BAND; + chan_rpt_req.chanNum = woal_get_next_dfs_chan(priv); + if (priv->chan_rpt_req.chanNum) { + if (woal_11h_cancel_chan_report_ioctl(priv, + MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + } + if (chan_rpt_req.chanNum) { + chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; + chan_rpt_req.bandcfg.chanWidth = priv->auto_dfs_cfg.bw; + chan_rpt_req.millisec_dwell_time = + priv->auto_dfs_cfg.cac_timer; + moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, + &chan_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, + "ZeroDFS: AUTO DFS Start Radar detect on channel=%d, bandwidth=%d, cac time=%d\n", + chan_rpt_req.chanNum, + (int)(chan_rpt_req.bandcfg.chanWidth), + chan_rpt_req.millisec_dwell_time); + if (MLAN_STATUS_SUCCESS != + woal_do_dfs_cac(priv, &chan_rpt_req)) + PRINTM(MERROR, "%s: woal_do_dfs_cac failed \n", + __func__); + } + } + LEAVE(); + return; +} + +/* + * @brief prepare and send WOAL_EVENT_CHAN_RPT/WOAL_EVENT_RADAR + * + * @param priv A pointer moal_private structure + * @param type WOAL_EVENT_CHAN_RPT/WOAL_EVENT_RADAR + * @param channel channel + * @param radar MTRUE/MFALSE + * + * @return N/A + */ +void woal_chan_event(moal_private *priv, t_u8 type, t_u8 channel, t_u8 radar) +{ + struct woal_event *evt; + unsigned long flags; + moal_handle *handle = priv->phandle; + + evt = kzalloc(sizeof(struct woal_event), GFP_ATOMIC); + if (!evt) { + PRINTM(MERROR, "Fail to alloc memory for deauth event\n"); + LEAVE(); + return; + } + evt->priv = priv; + evt->type = type; + evt->radar_info.channel = channel; + evt->radar_info.radar = radar; + INIT_LIST_HEAD(&evt->link); + spin_lock_irqsave(&handle->evt_lock, flags); + list_add_tail(&evt->link, &handle->evt_queue); + spin_unlock_irqrestore(&handle->evt_lock, flags); + queue_work(handle->evt_workqueue, &handle->evt_work); +} + +/** + * @brief Get active UAP handler + * + * @param handle a pointer to moal_handle structure + * + * @return N/A + * + */ +static moal_private *woal_get_active_uap_interface(moal_handle *handle) +{ + int i; + moal_private *priv = NULL; + for (i = 0; i < handle->priv_num; i++) { + if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_UAP) { + if (handle->priv[i]->bss_started == MTRUE) { + priv = handle->priv[i]; + break; + } + } + } + return priv; +} + +/** + * @brief handle auto uap channel switch + * + * @param priv a pointer to moal_private structure + * @param channel channel + * + * @return N/A + * + */ +static void woal_auto_uap_channel_switch(moal_private *priv, t_u8 channel) +{ + moal_private *pmpriv = NULL; + chan_band_info chaninfo; + moal_handle *ref_handle; + t_u8 band_width = CHANNEL_BW_20MHZ; + + memset(&chaninfo, 0, sizeof(chaninfo)); + + pmpriv = woal_get_active_uap_interface(priv->phandle); + if (!pmpriv) { + ref_handle = (moal_handle *)priv->phandle->pref_mac; + pmpriv = woal_get_active_uap_interface(ref_handle); + } + if (pmpriv) { + if (MLAN_STATUS_SUCCESS != + woal_set_get_ap_channel(pmpriv, MLAN_ACT_GET, + MOAL_IOCTL_WAIT, &chaninfo)) { + PRINTM(MERROR, "Fail to get ap channel \n"); + return; + } + if (chaninfo.channel != channel) { + switch (chaninfo.bandcfg.chanWidth) { + case CHAN_BW_40MHZ: + if (chaninfo.bandcfg.chan2Offset == + SEC_CHAN_BELOW) + band_width = CHANNEL_BW_40MHZ_BELOW; + else if (chaninfo.bandcfg.chan2Offset == + SEC_CHAN_ABOVE) + band_width = CHANNEL_BW_40MHZ_ABOVE; + break; + case CHAN_BW_80MHZ: + band_width = CHANNEL_BW_80MHZ; + break; + default: + band_width = CHANNEL_BW_20MHZ; + break; + } +#define DEF_SWITCH_COUNT 10 + woal_channel_switch(pmpriv, MTRUE, 0, channel, + DEF_SWITCH_COUNT, band_width, + MTRUE); + } + } +} + +/** + * @brief Process channel event + * + * @param priv a pointer to moal_private structure + * @param type WOAL_EVENT_CHAN_RPT/WOAL_EVENT_RADAR + * @param channel channel + * @param radar radar + * + * @return N/A + * + */ +void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, + t_u8 radar) +{ + mlan_ds_11h_chan_rep_req chan_rpt_req; + + if (!priv->auto_dfs_cfg.start_auto_zero_dfs) + return; + if (type == WOAL_EVENT_CHAN_RPT) { + if (priv->auto_dfs_cfg.uap_chan_switch && !radar) { + priv->auto_dfs_cfg.uap_chan_switch = MFALSE; + PRINTM(MCMND, "Trying uap_chan_switch to %d\n", + channel); + woal_auto_uap_channel_switch(priv, channel); + } + woal_do_auto_dfs(priv); + } else if (type == WOAL_EVENT_RADAR) { + memset(&chan_rpt_req, 0, sizeof(chan_rpt_req)); + chan_rpt_req.startFreq = START_FREQ_11A_BAND; + chan_rpt_req.chanNum = woal_get_next_dfs_chan(priv); + if (priv->chan_rpt_req.chanNum) { + if (woal_11h_cancel_chan_report_ioctl(priv, + MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + } + if (chan_rpt_req.chanNum) { + chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; + chan_rpt_req.bandcfg.chanWidth = priv->auto_dfs_cfg.bw; + chan_rpt_req.millisec_dwell_time = + priv->auto_dfs_cfg.cac_timer; + moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, + &chan_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, + "ZeroDFS: AUTO DFS Start Radar detect on channel=%d, bandwidth=%d, cac time=%d\n", + chan_rpt_req.chanNum, + (int)(chan_rpt_req.bandcfg.chanWidth), + chan_rpt_req.millisec_dwell_time); + if (MLAN_STATUS_SUCCESS != + woal_do_dfs_cac(priv, &chan_rpt_req)) + PRINTM(MERROR, "%s: woal_do_dfs_cac failed \n", + __func__); + } + } +} + +/** + * @brief check if channel under nop + * + * @param priv a pointer to moal_private structure + * @param channel WIFI channel + * + * @return length + */ +static t_u8 woal_is_channel_under_nop(moal_private *priv, t_u8 channel) +{ + mlan_ds_11h_chan_nop_info chan_nop_info; + t_u8 ret = MFALSE; + ENTER(); + memset(&chan_nop_info, 0, sizeof(chan_nop_info)); + chan_nop_info.curr_chan = channel; + woal_uap_get_channel_nop_info(priv, MOAL_IOCTL_WAIT, &chan_nop_info); + if (chan_nop_info.chan_under_nop) + ret = MTRUE; + LEAVE(); + return ret; +} + +/** + * @brief Process dfs cac command + * + * @param priv a pointer to moal_private structure + * @param respbuf respbuf buffer + * @param respbuflen respbuf length + * + * @return length + */ +static int woal_priv_do_dfs_cac(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int data[3] = {0}; + int user_data_len = 0, header_len = 0; + mlan_ds_11h_chan_rep_req chan_rpt_req; + mlan_status status = MLAN_STATUS_SUCCESS; + mlan_ds_11h_chan_dfs_state ch_dfs_state; + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_DFS_CAC); + + if ((int)strlen(respbuf) >= header_len) { + memset(&chan_rpt_req, 0, sizeof(chan_rpt_req)); + /* SET operation */ + parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), + &user_data_len); + if (user_data_len >= 1) { + if (!data[0] || + (priv->chan_rpt_req.chanNum && + (priv->chan_rpt_req.chanNum != data[0]))) { + if (priv->chan_rpt_pending || + (priv->bss_type == MLAN_BSS_TYPE_DFS)) { + if (woal_11h_cancel_chan_report_ioctl( + priv, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + LEAVE(); + return -EFAULT; + } + priv->chan_rpt_pending = MFALSE; + } +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (!data[0] && priv->chan_rpt_req.chanNum) { + woal_update_channels_dfs_state( + priv, + priv->chan_rpt_req.chanNum, + priv->chan_rpt_req.bandcfg + .chanWidth, + DFS_USABLE); + } +#endif +#endif + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, "DFS: Stop Radar detect\n"); + if (!data[0]) { + if (priv->bss_type == MLAN_BSS_TYPE_UAP) + woal_uap_11h_ctrl(priv, MFALSE); + LEAVE(); + return ret; + } + } + if (data[0] == priv->chan_rpt_req.chanNum && + priv->bss_type == MLAN_BSS_TYPE_UAP) + woal_uap_11h_ctrl(priv, MFALSE); + memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); + ch_dfs_state.channel = data[0]; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, + &ch_dfs_state)) { + PRINTM(MERROR, + "%s: woal_11h_chan_dfs_state failed \n", + __func__); + LEAVE(); + return -EFAULT; + } + if (!ch_dfs_state.dfs_required || + ch_dfs_state.dfs_state == DFS_UNAVAILABLE) { + PRINTM(MCMND, + "DFS: This channel=%d under NOP or not DFS channel\n", + data[0]); + LEAVE(); + return -EINVAL; + } + if (woal_is_channel_under_nop(priv, data[0])) { + PRINTM(MCMND, + "DFS: This channel=%d under NOP\n", + data[0]); + LEAVE(); + return -EINVAL; + } + chan_rpt_req.startFreq = START_FREQ_11A_BAND; + chan_rpt_req.chanNum = data[0]; + chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; + chan_rpt_req.bandcfg.chanWidth = CHAN_BW_20MHZ; + chan_rpt_req.millisec_dwell_time = DEF_CAC_DWELL_TIME; + chan_rpt_req.host_based = MTRUE; + } + if (user_data_len >= 2) { + if (data[1] < 0 || data[1] > CHANNEL_BW_80MHZ) { + PRINTM(MERROR, "Inavalid bandwidth %d\n", + data[1]); + LEAVE(); + return -EINVAL; + } + woal_convert_chanbw_to_bandconfig(priv, + &chan_rpt_req.bandcfg, + chan_rpt_req.chanNum, + data[1]); + } + if (user_data_len >= 3) + chan_rpt_req.millisec_dwell_time = + MIN(MAX_CAC_DWELL_TIME, data[2] * 1000); +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + else { + if ((woal_is_etsi_country( + priv->phandle->country_code) == MTRUE)) { + if (chan_rpt_req.chanNum == 120 || + chan_rpt_req.chanNum == 124 || + chan_rpt_req.chanNum == 128) { + chan_rpt_req.millisec_dwell_time = + DEF_CAC_DWELL_TIME * 10; + } + if (chan_rpt_req.chanNum == 116 && + user_data_len >= 2 && data[1] > 0) + chan_rpt_req.millisec_dwell_time = + DEF_CAC_DWELL_TIME * 10; + } + } +#endif + moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, + &chan_rpt_req, sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, + "DFS: Start Radar detect on channel=%d, bandwidth=%d, cac time=%d\n", + chan_rpt_req.chanNum, + (int)(chan_rpt_req.bandcfg.chanWidth), + chan_rpt_req.millisec_dwell_time); + status = woal_do_dfs_cac(priv, &chan_rpt_req); + if (status != MLAN_STATUS_SUCCESS) + ret = -EFAULT; + else + priv->chan_rpt_pending = MTRUE; + } + LEAVE(); + return ret; +} + +/** + * @brief Set Auto Zero DFS configure + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_auto_dfs_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int header_len = 0; + auto_zero_dfs_cfg *auto_dfs_cfg = NULL; + int i; + int idx = 0; + mlan_ds_11h_chan_dfs_state ch_dfs_state; + mlan_ds_11h_chan_rep_req chan_rpt_req; + + ENTER(); + if (priv->bss_type != MLAN_BSS_TYPE_DFS) { + PRINTM(MWARN, "Invalid BSS type\n"); + ret = -EINVAL; + goto done; + } + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_AUTODFS); + auto_dfs_cfg = (auto_zero_dfs_cfg *)(respbuf + header_len); + /** Auto DFS is enabled and save config to moal_private structure */ + if (auto_dfs_cfg->start_auto_zero_dfs) { + if (priv->auto_dfs_cfg.start_auto_zero_dfs || + priv->chan_rpt_req.chanNum) { + if (woal_11h_cancel_chan_report_ioctl( + priv, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + ret = -EFAULT; + goto done; + } + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + } + memset(&priv->auto_dfs_cfg, 0, sizeof(auto_zero_dfs_cfg)); + if (auto_dfs_cfg->cac_start_chan) { + memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); + ch_dfs_state.channel = auto_dfs_cfg->cac_start_chan; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, + &ch_dfs_state)) { + PRINTM(MERROR, + "%s: woal_11h_chan_dfs_state failed \n", + __func__); + ret = -EFAULT; + goto done; + } + if (!ch_dfs_state.dfs_required || + ch_dfs_state.dfs_state == DFS_UNAVAILABLE) { + PRINTM(MCMND, + "ZeroDFS: This channel=%d under NOP or not DFS channel\n", + auto_dfs_cfg->cac_start_chan); + LEAVE(); + return -EINVAL; + } + } + priv->auto_dfs_cfg.cac_start_chan = + auto_dfs_cfg->cac_start_chan; + if (auto_dfs_cfg->cac_timer) + priv->auto_dfs_cfg.cac_timer = + MIN(MAX_CAC_DWELL_TIME, + auto_dfs_cfg->cac_timer * 1000); + else + priv->auto_dfs_cfg.cac_timer = DEF_CAC_DWELL_TIME; + if ((auto_dfs_cfg->bw != CHANNEL_BW_20MHZ) && + (auto_dfs_cfg->bw != CHANNEL_BW_40MHZ_ABOVE) && + (auto_dfs_cfg->bw != CHANNEL_BW_40MHZ_BELOW) && + (auto_dfs_cfg->bw != CHANNEL_BW_80MHZ)) { + PRINTM(MERROR, "ZeroDFS: Invalid bw = %d\n", + auto_dfs_cfg->bw); + LEAVE(); + return -EINVAL; + } + priv->auto_dfs_cfg.bw = auto_dfs_cfg->bw; + priv->auto_dfs_cfg.uap_chan_switch = + auto_dfs_cfg->uap_chan_switch; + priv->auto_dfs_cfg.multi_chan_dfs = + auto_dfs_cfg->multi_chan_dfs; + if (auto_dfs_cfg->num_of_chan) { + for (i = 0; i < auto_dfs_cfg->num_of_chan; i++) { + memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); + ch_dfs_state.channel = + auto_dfs_cfg->dfs_chan_list[i]; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, + &ch_dfs_state)) { + PRINTM(MERROR, + "%s: woal_11h_chan_dfs_state failed \n", + __func__); + ret = -EFAULT; + goto done; + } + if (!ch_dfs_state.dfs_required) + continue; + priv->auto_dfs_cfg.dfs_chan_list[idx] = + auto_dfs_cfg->dfs_chan_list[i]; + idx++; + } + priv->auto_dfs_cfg.num_of_chan = idx; + } + if (!priv->auto_dfs_cfg.num_of_chan) + woal_get_dfs_chan_list(priv); + priv->curr_cac_idx = -1; + if (!priv->auto_dfs_cfg.cac_start_chan) + priv->auto_dfs_cfg.cac_start_chan = + woal_get_next_dfs_chan(priv); + PRINTM(MCMND, "Start Auto ZeroDFS\n"); + PRINTM(MCMND, "cac_start_chan=%d\n", + priv->auto_dfs_cfg.cac_start_chan); + PRINTM(MCMND, "cac_timer=%d\n", priv->auto_dfs_cfg.cac_timer); + PRINTM(MCMND, "bw=%d\n", priv->auto_dfs_cfg.bw); + PRINTM(MCMND, "uap_chan_switch=%d\n", + priv->auto_dfs_cfg.uap_chan_switch); + PRINTM(MCMND, "multi_chan_dfs=%d\n", + priv->auto_dfs_cfg.multi_chan_dfs); + PRINTM(MCMND, "num of chan=%d\n", + priv->auto_dfs_cfg.num_of_chan); + DBG_HEXDUMP(MCMD_D, "dfs chan list", + priv->auto_dfs_cfg.dfs_chan_list, + priv->auto_dfs_cfg.num_of_chan); + if (priv->auto_dfs_cfg.cac_start_chan) { + priv->auto_dfs_cfg.start_auto_zero_dfs = MTRUE; + memset(&chan_rpt_req, 0, sizeof(chan_rpt_req)); + chan_rpt_req.startFreq = START_FREQ_11A_BAND; + chan_rpt_req.chanNum = + priv->auto_dfs_cfg.cac_start_chan; + chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; + chan_rpt_req.bandcfg.chanWidth = priv->auto_dfs_cfg.bw; + chan_rpt_req.millisec_dwell_time = + priv->auto_dfs_cfg.cac_timer; + moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, + &chan_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, + "ZeroDFS: AUTO DFS Start Radar detect on channel=%d, bandwidth=%d, cac time=%d\n", + chan_rpt_req.chanNum, + (int)(chan_rpt_req.bandcfg.chanWidth), + chan_rpt_req.millisec_dwell_time); + if (MLAN_STATUS_SUCCESS != + woal_do_dfs_cac(priv, &chan_rpt_req)) { + PRINTM(MERROR, "%s: woal_do_dfs_cac failed \n", + __func__); + ret = -EFAULT; + } + } + } else { + PRINTM(MCMND, "Stop Auto ZeroDFS\n"); + if (woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + memset(&priv->auto_dfs_cfg, 0, sizeof(auto_zero_dfs_cfg)); + } +done: + LEAVE(); + return ret; } #endif @@ -11028,12 +12833,12 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cfp_code(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cfp_code(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0; - int data[2] = { 0 }; + int data[2] = {0}; mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc_cfg = NULL; mlan_ds_misc_cfp_code *cfp_code = NULL; @@ -11099,6 +12904,304 @@ } /** + * @brief mcast aggr group configure + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_mcast_aggr_group_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int header_len = 0; + mcast_aggr_group *mcast_cfg = NULL; + int index = 0; + struct mcast_node *node = NULL; + unsigned long flags; + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_MCAST_AGGR_GROUP); + mcast_cfg = (mcast_aggr_group *)(respbuf + header_len); + if (mcast_cfg->action == ACTION_ADD) { + if (priv->num_mcast_addr >= MLAN_MAX_MULTICAST_LIST_SIZE) { + PRINTM(MERROR, "mcast_aggr_group already full!\n"); + ret = -EINVAL; + goto done; + } + woal_add_mcast_node(priv, mcast_cfg->mcast_addr); + } else if (mcast_cfg->action == ACTION_REMOVE) { + woal_remove_mcast_node(priv, mcast_cfg->mcast_addr); + } + memset(mcast_cfg, 0, sizeof(mcast_aggr_group)); + + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry (node, &priv->mcast_list, link) { + moal_memcpy_ext(priv->phandle, &mcast_cfg->mac_list[index], + node->mcast_addr, ETH_ALEN, ETH_ALEN); + index++; + } + spin_unlock_irqrestore(&priv->mcast_lock, flags); + mcast_cfg->num_mcast_addr = index; + priv->num_mcast_addr = index; + ret = header_len + sizeof(mcast_aggr_group); +done: + LEAVE(); + return ret; +} + +/** + * @brief mcast aggr configure + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_mc_aggr_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + mlan_ds_mc_aggr_cfg *mc_cfg; + int ret = 0; + int header_len = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_MC_AGGR_CFG; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_MC_AGGR_CFG); + mc_cfg = (mlan_ds_mc_aggr_cfg *)(respbuf + header_len); + ioctl_req->action = mc_cfg->action; + misc->param.mc_aggr_cfg.enable_bitmap = mc_cfg->enable_bitmap; + misc->param.mc_aggr_cfg.mask_bitmap = mc_cfg->mask_bitmap; + misc->param.mc_aggr_cfg.cts2self_offset = mc_cfg->cts2self_offset; + + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + + mc_cfg->enable_bitmap = misc->param.mc_aggr_cfg.enable_bitmap; + mc_cfg->mask_bitmap = misc->param.mc_aggr_cfg.mask_bitmap; + mc_cfg->cts2self_offset = misc->param.mc_aggr_cfg.cts2self_offset; + ret = header_len + sizeof(misc->param.mc_aggr_cfg); + + if (mc_cfg->mask_bitmap & MC_AGGR_CTRL) { + if (mc_cfg->enable_bitmap & MC_AGGR_CTRL) + priv->enable_mc_aggr = MTRUE; + else + priv->enable_mc_aggr = MFALSE; + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} + +/** + * @brief per peer stats configure + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_stats(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_stats *stats; + mlan_status status = MLAN_STATUS_SUCCESS; + int ret = 0; + int header_len = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_STATS; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_STATS); + stats = (mlan_ds_stats *)(respbuf + header_len); + ioctl_req->action = stats->action; + + moal_memcpy_ext(priv->phandle, &misc->param.stats, stats, + sizeof(mlan_ds_stats) + stats->tlv_len - 1, + sizeof(mlan_ds_stats) + stats->tlv_len - 1); + + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + + moal_memcpy_ext(priv->phandle, respbuf + header_len, + (mlan_ds_stats *)&misc->param.stats, ioctl_req->buf_len, + respbuflen - header_len); + ret = header_len + ioctl_req->buf_len; + +done: + LEAVE(); + return ret; +} +/** + * @brief get channel load results + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_get_ch_load_results(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + mlan_ds_ch_load *cl_cfg; + int ret = 0; + int header_len = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_CH_LOAD_RESULTS; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_CH_LOAD_RESULTS); + cl_cfg = (mlan_ds_ch_load *)(respbuf + header_len); + ioctl_req->action = cl_cfg->action; + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EAGAIN; + goto done; + } + + cl_cfg->ch_load_param = misc->param.ch_load.ch_load_param; + cl_cfg->noise = misc->param.ch_load.noise; + cl_cfg->rx_quality = misc->param.ch_load.rx_quality; + ret = header_len + sizeof(misc->param.ch_load); + +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} + +/** + * @brief get channel load + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return 0 --success, otherwise fail + */ +static int woal_priv_get_ch_load(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + mlan_ds_ch_load *cl_cfg; + int ret = 0; + int header_len = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_CH_LOAD; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_CH_LOAD); + cl_cfg = (mlan_ds_ch_load *)(respbuf + header_len); + ioctl_req->action = cl_cfg->action; + misc->param.ch_load.ch_load_param = cl_cfg->ch_load_param; + misc->param.ch_load.noise = cl_cfg->noise; + misc->param.ch_load.rx_quality = cl_cfg->rx_quality; + misc->param.ch_load.duration = cl_cfg->duration; + misc->param.ch_load.cca_th = cl_cfg->cca_th; + status = woal_request_ioctl(priv, ioctl_req, MOAL_NO_WAIT); + if (status != MLAN_STATUS_SUCCESS && status != MLAN_STATUS_PENDING) { + ret = -EFAULT; + goto done; + } + + ret = header_len + sizeof(misc->param.ch_load); + +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} + +/** * @brief Set/Get Tx/Rx antenna * * @param priv Pointer to moal_private structure @@ -11107,14 +13210,14 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_tx_rx_ant(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_tx_rx_ant(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *req = NULL; - int data[3] = { 0 }; + int data[3] = {0}; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -11150,9 +13253,8 @@ #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type)) { - woal_cfg80211_notify_antcfg(priv, - priv->phandle-> - wiphy, radio); + woal_cfg80211_notify_antcfg( + priv, priv->phandle->wiphy, radio); } #endif } else { @@ -11203,8 +13305,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_cwmode(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_cwmode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -11239,8 +13341,8 @@ /* SET operation */ ioctl_req->action = MLAN_ACT_SET; - cwmode = (mlan_ds_cw_mode_ctrl *) (respbuf + header_len + - sizeof(t_u8)); + cwmode = (mlan_ds_cw_mode_ctrl *)(respbuf + header_len + + sizeof(t_u8)); misc->param.cwmode.mode = cwmode->mode; misc->param.cwmode.txPower = cwmode->txPower; misc->param.cwmode.rateInfo = cwmode->rateInfo; @@ -11276,14 +13378,14 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_ind_rst_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_ind_rst_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0; mlan_ds_misc_cfg *misc = NULL; mlan_ioctl_req *req = NULL; - int data[2] = { 0 }; + int data[2] = {0}; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -11363,8 +13465,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_sysclock(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_sysclock(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int data[65]; mlan_ioctl_req *req = NULL; @@ -11486,8 +13588,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_key(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_key(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0, copy_len = 0; int header_len = 0; @@ -11603,9 +13705,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0, copy_len = 0; int header_len = 0; @@ -11637,8 +13738,8 @@ "Associate: Insufficient length in IOCTL input\n"); /* buffer should be at least 3 characters per BSSID octet "00:" - ** plus a space separater and at least 1 char in the SSID - */ + ** plus a space separater and at least 1 char in the SSID + */ ret = -EINVAL; goto done; } @@ -11647,7 +13748,8 @@ sizeof(buf)); /* Skip white space */ - for (i = 0; (i < buflen) && (buf[i] == ' '); i++) ; + for (i = 0; (i < buflen) && (buf[i] == ' '); i++) + ; /* Copy/Convert the BSSID */ for (; (i < buflen) && (mac_idx < ETH_ALEN) && (buf[i] != ' '); i++) { @@ -11680,6 +13782,7 @@ ret = -EFAULT; goto done; } + #ifdef REASSOCIATION memset(&bss_info, 0x00, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS == @@ -11718,8 +13821,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_tx_bf_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_tx_bf_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0; int ret = 0, copy_len = 0; @@ -11967,8 +14070,8 @@ sizeof(mlan_snr_thr_args), respbuflen); ret = sizeof(mlan_snr_thr_args); break; - default: - ret = 0; + /** Default case not required as bf_action value already + * sanitized */ } done: @@ -11985,8 +14088,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cmd53rdwr(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cmd53rdwr(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0; int ret = 0; @@ -12003,7 +14106,7 @@ header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_SD_CMD53_RW); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; data = kzalloc(WOAL_2K_BYTES, flag); if (!data) { PRINTM(MERROR, "Cannot allocate buffer for command!\n"); @@ -12014,15 +14117,15 @@ sizeof(cmd_len), sizeof(cmd_len)); buf = respbuf + header_len + sizeof(cmd_len); - rw = buf[0]; /* read/write (0/1) */ - reg = buf[5]; /* address */ + rw = buf[0]; /* read/write (0/1) */ + reg = buf[5]; /* address */ reg = (reg << 8) | buf[4]; reg = (reg << 8) | buf[3]; reg = (reg << 8) | buf[2]; - mode = buf[6]; /* byte mode/block mode (0/1) */ - blklen = buf[8]; /* block size */ + mode = buf[6]; /* byte mode/block mode (0/1) */ + blklen = buf[8]; /* block size */ blklen = (blklen << 8) | buf[7]; - blknum = buf[10]; /* block number or byte number */ + blknum = buf[10]; /* block number or byte number */ blknum = (blknum << 8) | buf[9]; if (mode == BYTE_MODE) @@ -12042,18 +14145,18 @@ reg, mode, blklen, blknum); if (!rw) { - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); - if (sdio_readsb - (((struct sdio_mmc_card *)priv->phandle->card)->func, - respbuf, reg, total_len)) { + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_readsb( + ((struct sdio_mmc_card *)priv->phandle->card)->func, + respbuf, reg, total_len)) { PRINTM(MERROR, "sdio_readsb: reading memory 0x%x failed\n", reg); goto done; } - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); ret = total_len; } else { int pos = 0; @@ -12064,16 +14167,16 @@ /* Copy/duplicate the pattern to data buffer */ for (pos = 0; pos < (int)total_len; pos++) data[pos] = buf[11 + (pos % pattern_len)]; - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); - if (sdio_writesb - (((struct sdio_mmc_card *)priv->phandle->card)->func, reg, - data, total_len)) + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_writesb( + ((struct sdio_mmc_card *)priv->phandle->card)->func, + reg, data, total_len)) PRINTM(MERROR, "sdio_writesb: writing memory 0x%x failed\n", reg); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); } done: @@ -12091,8 +14194,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_port_ctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_port_ctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; mlan_ioctl_req *req = NULL; @@ -12163,8 +14266,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_bypassed_packet(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_bypassed_packet(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0; int ret = 0; @@ -12178,7 +14281,7 @@ header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_PB_BYPASS); copyLen = strlen(respbuf) - header_len; moreLen = MLAN_MIN_DATA_HEADER_LEN + MLAN_BYPASS_PKT_EXTRA_OFFSET + - sizeof(mlan_buffer); + sizeof(mlan_buffer); skb = alloc_skb(copyLen + moreLen, GFP_KERNEL); if (skb == NULL) { @@ -12212,11 +14315,11 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_robustcoex(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_robustcoex(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; - int ret = 0, data[3] = { 0 }; + int ret = 0, data[3] = {0}; mlan_ds_misc_cfg *robust_coex_cfg = NULL; mlan_ioctl_req *req = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -12302,11 +14405,10 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dmcs(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_dmcs(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { int header_len = 0, user_data_len = 0; - int ret = 0, data[2] = { 0 }; + int ret = 0, data[2] = {0}; mlan_ds_misc_cfg *dmcs_cfg = NULL; mlan_ioctl_req *req = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -12373,14 +14475,14 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_bootsleep(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_bootsleep(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = MLAN_STATUS_SUCCESS; int user_data_len = 0; int header_len = 0; int allowed = 1; - int data[1] = { 0 }; + int data[1] = {0}; mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -12439,6 +14541,63 @@ return ret; } +/** + * * @brief Set and get txwatchdog check + * * @param priv Pointer to moal_private structure + * * @param respbuf Pointer to response buffer + * * @param resplen Response buffer length + * * + * * @return Number of bytes written, negative for failure. + * */ +static int woal_priv_txwatchdog(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int header_len = 0; + int user_data_len = 0; + int data[1] = {0}; + int allowed = 1; + t_u32 action; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_TXWATCHDOG); + + if (strlen(respbuf) == header_len) { + action = MLAN_ACT_GET; + ret = sizeof(t_u32); + } else { + action = MLAN_ACT_SET; + parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), + &user_data_len); + if (user_data_len != allowed) { + PRINTM(MERROR, "Invalid number of args! %d\n", + user_data_len); + ret = -EINVAL; + goto done; + } + } + + if (action == MLAN_ACT_SET) { + priv->txwatchdog_disable = ((*data == 0) ? MTRUE : MFALSE); + } else { + *data = ((priv->txwatchdog_disable == MTRUE) ? 0 : 1); + } + memcpy(respbuf, data, sizeof(t_u32)); + PRINTM(MINFO, "priv->txwatchdog_disable:%u, action:%u, data[0]=%d\n", + priv->txwatchdog_disable, action, data[0]); + +done: + LEAVE(); + return ret; +} + #if defined(PCIE) /** * @brief Enable SSU support @@ -12449,9 +14608,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_ssu_cmd(moal_private *priv, t_u8 used_len, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_ssu_cmd(moal_private *priv, t_u8 used_len, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ds_misc_cfg *ssu_cfg = NULL; @@ -12476,7 +14634,7 @@ ssu_cfg->param.ssu_params.mask_adc_pkt = 0; ssu_cfg->param.ssu_params.out_16bits = 1; } else { - ssu_params = (ssu_params_cfg *) respbuf; + ssu_params = (ssu_params_cfg *)respbuf; DBG_HEXDUMP(MCMD_D, "User SSU params:", respbuf, sizeof(mlan_ds_ssu_params)); if (ssu_params->ssu_mode == 2) @@ -12529,8 +14687,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_hal_phy_cfg_cmd(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_hal_phy_cfg_cmd(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *cfg = NULL; @@ -12540,7 +14698,7 @@ ENTER(); - data_ptr = (mlan_ds_hal_phy_cfg_params *) respbuf; + data_ptr = (mlan_ds_hal_phy_cfg_params *)respbuf; req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { ret = -ENOMEM; @@ -12568,6 +14726,70 @@ } /** + * @brief Enable/disable CSI support + * + * The command structure contains the following parameters + * csi_enable: 1: enable, 0: diable + * csi_filter_cnt: Number of CSI filters + * csi_filter: CSI filters + * + * @param priv Pointer to the mlan_private driver data struct + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written if successful else negative value + */ +static int woal_priv_csi_cmd(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + int ret = 0; + mlan_ds_csi_params *data_ptr; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + data_ptr = (mlan_ds_csi_params *)respbuf; + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_MISC_CFG; + cfg = (mlan_ds_misc_cfg *)req->pbuf; + cfg->sub_command = MLAN_OID_MISC_CSI; + + cfg->param.csi_params.csi_enable = data_ptr->csi_enable; + if (data_ptr->csi_enable == 1) { + cfg->param.csi_params.head_id = data_ptr->head_id; + cfg->param.csi_params.tail_id = data_ptr->tail_id; + cfg->param.csi_params.csi_filter_cnt = data_ptr->csi_filter_cnt; + cfg->param.csi_params.chip_id = data_ptr->chip_id; + if (cfg->param.csi_params.csi_filter_cnt > CSI_FILTER_MAX) + cfg->param.csi_params.csi_filter_cnt = CSI_FILTER_MAX; + moal_memcpy_ext(priv->phandle, cfg->param.csi_params.csi_filter, + data_ptr->csi_filter, + sizeof(mlan_csi_filter_t) * + cfg->param.csi_params.csi_filter_cnt, + sizeof(mlan_csi_filter_t) * CSI_FILTER_MAX); + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** * @brief configure 11ax HE capability or HE operation * * @@ -12578,9 +14800,8 @@ * * @return Number of bytes written if successful else negative value */ -static int -woal_priv_11axcfg_cmd(moal_private *priv, t_u8 *respbuf, t_u8 len, - t_u32 respbuflen) +static int woal_priv_11axcfg_cmd(moal_private *priv, t_u8 *respbuf, t_u8 len, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_11ax_cfg *cfg = NULL; @@ -12597,7 +14818,7 @@ req->req_id = MLAN_IOCTL_11AX_CFG; req->action = MLAN_ACT_SET; - cfg = (mlan_ds_11ax_cfg *) req->pbuf; + cfg = (mlan_ds_11ax_cfg *)req->pbuf; cfg->sub_command = MLAN_OID_11AX_HE_CFG; if (len) moal_memcpy_ext(priv->phandle, (t_u8 *)&cfg->param.he_cfg, @@ -12618,7 +14839,6 @@ LEAVE(); return ret; } - /** * @brief Configure TWT Setup parameters * @@ -12630,9 +14850,8 @@ * @return Number of bytes written if successful else negative * value */ -static int -woal_priv_twt_setup(moal_private *priv, t_u8 *respbuf, t_u8 len, - t_u32 respbuflen) +static int woal_priv_twt_setup(moal_private *priv, t_u8 *respbuf, t_u8 len, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_twtcfg *cfg = NULL; @@ -12650,7 +14869,7 @@ req->req_id = MLAN_IOCTL_11AX_CFG; req->action = MLAN_ACT_SET; - cfg = (mlan_ds_twtcfg *) req->pbuf; + cfg = (mlan_ds_twtcfg *)req->pbuf; cfg->sub_command = MLAN_OID_11AX_TWT_CFG; cfg->sub_id = MLAN_11AX_TWT_SETUP_SUBID; @@ -12686,9 +14905,8 @@ * @return Number of bytes written if successful else negative * value */ -static int -woal_priv_twt_teardown(moal_private *priv, t_u8 *respbuf, t_u8 len, - t_u32 respbuflen) +static int woal_priv_twt_teardown(moal_private *priv, t_u8 *respbuf, t_u8 len, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_twtcfg *cfg = NULL; @@ -12706,7 +14924,7 @@ req->req_id = MLAN_IOCTL_11AX_CFG; req->action = MLAN_ACT_SET; - cfg = (mlan_ds_twtcfg *) req->pbuf; + cfg = (mlan_ds_twtcfg *)req->pbuf; cfg->sub_command = MLAN_OID_11AX_TWT_CFG; cfg->sub_id = MLAN_11AX_TWT_TEARDOWN_SUBID; @@ -12741,8 +14959,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cfg_noa(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cfg_noa(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; int ret = 0, data[7]; @@ -12814,7 +15032,11 @@ default: break; } - woal_p2p_config(priv, MLAN_ACT_SET, &noa_cfg); + if (woal_p2p_config(priv, MLAN_ACT_SET, &noa_cfg) != + MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "woal_p2p_config fail\n"); + ret = -EFAULT; + } } done: @@ -12831,8 +15053,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cfg_opp_ps(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cfg_opp_ps(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; int ret = 0, data[7]; @@ -12884,11 +15106,14 @@ default: break; } - woal_p2p_config(priv, MLAN_ACT_SET, &opp_ps_cfg); + if (woal_p2p_config(priv, MLAN_ACT_SET, &opp_ps_cfg) != + MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "woal_p2p_config fail\n"); + ret = -EINVAL; + } } done: - LEAVE(); return ret; } @@ -12903,8 +15128,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cfg_clock_sync(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cfg_clock_sync(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; int ret = 0, data[5]; @@ -13020,8 +15245,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cfg_get_tsf_info(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cfg_get_tsf_info(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; int ret = 0, data[1]; @@ -13081,17 +15306,17 @@ return ret; } +#ifdef UAP_SUPPORT /** - * @brief Set/Get transition channel + * @brief Set/Get target channel * @param priv Pointer to moal_private structure * @param respbuf Pointer to response buffer * @param resplen Response buffer length * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_transition_channel(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_target_channel(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int header_len = 0, user_data_len = 0; int ret = 0, data[1]; @@ -13104,7 +15329,7 @@ return ret; } - header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_TRANSITION_CHANNEL); + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_TARGET_CHANNEL); if ((int)strlen(respbuf) == header_len) { /* GET operation */ user_data_len = 0; @@ -13118,9 +15343,9 @@ goto done; } if (user_data_len) - priv->trans_chan = data[0]; + priv->target_chan = data[0]; } - data[0] = priv->trans_chan; + data[0] = priv->target_chan; moal_memcpy_ext(priv->phandle, respbuf, &data, sizeof(data), respbuflen); ret = sizeof(int); @@ -13130,6 +15355,55 @@ return ret; } +/** + * @brief Set/Get backup channel + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_backup_channel(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int header_len = 0, user_data_len = 0; + int ret = 0, data[1]; + + ENTER(); + if (!priv || (priv->bss_type != MLAN_BSS_TYPE_UAP)) { + PRINTM(MERROR, "priv is null or interface is not AP"); + ret = -EFAULT; + LEAVE(); + return ret; + } + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_BACKUP_CHANNEL); + if ((int)strlen(respbuf) == header_len) { + /* GET operation */ + user_data_len = 0; + } else { + /* SET operation */ + parse_arguments(respbuf + header_len, data, + sizeof(data) / sizeof(int), &user_data_len); + if (user_data_len > 1) { + PRINTM(MERROR, "Invalid parameter number\n"); + ret = -EINVAL; + goto done; + } + if (user_data_len) + priv->backup_chan = data[0]; + } + data[0] = priv->backup_chan; + moal_memcpy_ext(priv->phandle, respbuf, &data, sizeof(data), + respbuflen); + ret = sizeof(int); +done: + + LEAVE(); + return ret; +} +#endif + #if defined(STA_CFG80211) || defined(UAP_CFG80211) #ifdef WIFI_DIRECT_SUPPORT #define DEF_NOA_INTERVAL 100 @@ -13141,8 +15415,7 @@ ** ** @return Number of bytes written, negative for failure. **/ -static int -woal_p2p_ps_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_p2p_ps_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { int user_data_len = 0; int ret = 0, data[2]; @@ -13165,7 +15438,7 @@ interval = DEF_NOA_INTERVAL; else interval = (data[0] + DEF_NOA_INTERVAL - 1) / DEF_NOA_INTERVAL * - DEF_NOA_INTERVAL; + DEF_NOA_INTERVAL; if (user_data_len == 2) duration = data[1]; @@ -13196,11 +15469,11 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dfs_repeater_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_dfs_repeater_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; - int user_data_len = 0, header_len = 0, data[1] = { 0 }; + int user_data_len = 0, header_len = 0, data[1] = {0}; mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc_cfg = NULL; mlan_ds_misc_dfs_repeater *dfs_repeater = NULL; @@ -13286,11 +15559,11 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_miracast_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_miracast_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; - int user_data_len = 0, header_len = 0, data[3] = { 0, 0, 0 }; + int user_data_len = 0, header_len = 0, data[3] = {0, 0, 0}; ENTER(); @@ -13350,8 +15623,8 @@ * * @return 0 --success, otherwise failure */ -static int -woal_set_scan_chan_gap(moal_private *priv, t_u8 *respbuf, int respbuflen) +static int woal_set_scan_chan_gap(moal_private *priv, t_u8 *respbuf, + int respbuflen) { t_u32 data[2]; int ret = 0; @@ -13388,8 +15661,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_coex_rx_winsize(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_coex_rx_winsize(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0, data = 0; @@ -13475,8 +15748,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_txaggrctrl(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_txaggrctrl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0, data = 0; @@ -13561,8 +15834,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_auto_tdls(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_auto_tdls(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0, data = 0; @@ -13616,8 +15889,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_pcie_reg_rw(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_pcie_reg_rw(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { moal_handle *handle = priv->phandle; int data[3]; @@ -13676,8 +15949,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_pcie_bar0_reg_rw(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_pcie_bar0_reg_rw(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { moal_handle *handle = priv->phandle; pcie_service_card *card = (pcie_service_card *)handle->card; @@ -13736,8 +16009,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_get_sensor_temp(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_get_sensor_temp(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *pcfg = NULL; @@ -13788,23 +16061,20 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dfs_offload_enable(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_dfs_offload_enable(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { - struct wiphy *wiphy = NULL; int ret = 0, dfs_offload_en = 0, user_data_len = 0, header_len = 0, - dfs_offload; + dfs_offload; ENTER(); - if (priv && priv->wdev) - wiphy = priv->wdev->wiphy; - if (!wiphy) { - PRINTM(MERROR, "wiphy is NULL\n"); + if (!priv) { + PRINTM(MERROR, "priv is NULL\n"); ret = -EFAULT; goto done; } + dfs_offload = moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD); if (woal_is_any_interface_active(priv->phandle)) { PRINTM(MERROR, @@ -13832,7 +16102,6 @@ moal_extflg_set(priv->phandle, EXT_DFS_OFFLOAD); else moal_extflg_clear(priv->phandle, EXT_DFS_OFFLOAD); - woal_update_radar_chans_dfs_state(wiphy); } done: LEAVE(); @@ -13850,8 +16119,8 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_tdls_cs_chan(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_tdls_cs_chan(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -13902,7 +16171,8 @@ } ret = sprintf(respbuf, "off channel %d\n", - misc->param.tdls_cs_channel) + 1; + misc->param.tdls_cs_channel) + + 1; PRINTM(MIOCTL, "tdls CS channel %d\n", misc->param.tdls_cs_channel); done: @@ -13912,7 +16182,6 @@ LEAVE(); return ret; } - /** * @brief Set/Get TDLS idle timeout value * @@ -13922,8 +16191,8 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_tdls_idle_time(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_tdls_idle_time(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -13996,8 +16265,8 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_config_dyn_bw(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_config_dyn_bw(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -14070,9 +16339,8 @@ * @return SUCCESS/FAIL */ -static int -woal_check_valid_channel_operclass(moal_private *priv, int channel, - int oper_class) +static int woal_check_valid_channel_operclass(moal_private *priv, int channel, + int oper_class) { int ret = 0; mlan_ioctl_req *ioctl_req = NULL; @@ -14109,6 +16377,45 @@ } /** + * @brief Enable radar detect for DFS channel + * + * @param priv A pointer to moal private structure + * @param chan channel + * @return N/A + */ +static void woal_enable_dfs(moal_private *priv, t_u8 channel, t_u8 wait_option) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11h_chan_rep_req *pchan_rpt_req = NULL; + mlan_ds_11h_cfg *p11h_cfg = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + ENTER(); + PRINTM(MCMND, "Enable Radar detect, chan %d\n", channel); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (NULL == req) { + PRINTM(MIOCTL, "No Memory to allocate ioctl buffer\n"); + LEAVE(); + return; + } + p11h_cfg = (mlan_ds_11h_cfg *)req->pbuf; + pchan_rpt_req = &p11h_cfg->param.chan_rpt_req; + pchan_rpt_req->startFreq = 5000; + pchan_rpt_req->chanNum = channel; + pchan_rpt_req->host_based = MTRUE; + pchan_rpt_req->millisec_dwell_time = 0; + + p11h_cfg->sub_command = MLAN_OID_11H_CHANNEL_CHECK; + req->req_id = MLAN_IOCTL_11H_CFG; + req->action = MLAN_ACT_SET; + /* Send Channel Check command and wait until the report is ready */ + status = woal_request_ioctl(priv, req, wait_option); + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return; +} + +/** * @brief send CSA/ECSA action frame * ** @param priv Pointer to moal_private structure @@ -14120,9 +16427,9 @@ * * @return channel center frequency center, if found; O, otherwise */ -static int -woal_action_channel_switch(moal_private *priv, t_u8 block_tx, t_u8 oper_class, - t_u8 channel, t_u8 switch_count, t_u8 wait_option) +static int woal_action_channel_switch(moal_private *priv, t_u8 block_tx, + t_u8 oper_class, t_u8 channel, + t_u8 switch_count, t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -14142,19 +16449,52 @@ req->action = MLAN_ACT_SET; bss->param.chanswitch.chan_switch_mode = block_tx; bss->param.chanswitch.new_channel_num = channel; - bss->param.chanswitch.chan_switch_count = switch_count; + if (!switch_count) + bss->param.chanswitch.chan_switch_count = DEF_NUM_PKTS; + else + bss->param.chanswitch.chan_switch_count = + MIN(switch_count, MAX_NUM_PKTS); bss->param.chanswitch.new_oper_class = oper_class; ret = woal_request_ioctl(priv, req, wait_option); - if (ret != MLAN_STATUS_SUCCESS) - goto done; done: if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; - } +#ifdef UAP_SUPPORT +/** + * @brief move the uAP to transition channel + * + * @param priv Pointer to moal_private structure + * + * @return N/A + */ +void woal_move_to_next_channel(moal_private *priv) +{ + mlan_ds_11h_chan_dfs_state ch_dfs; + t_u8 next_chan = 0; + if (priv->target_chan) { + next_chan = priv->target_chan; + priv->target_chan = 0; + } else if (priv->backup_chan) { + next_chan = priv->backup_chan; + } + if (!next_chan) + return; + memset(&ch_dfs, 0, sizeof(ch_dfs)); + ch_dfs.channel = next_chan; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, &ch_dfs)) + PRINTM(MERROR, "%s: woal_11h_chan_dfs_state failed \n", + __func__); + if (ch_dfs.dfs_required) + woal_enable_dfs(priv, next_chan, MOAL_NO_WAIT); + woal_action_channel_switch(priv, MTRUE, 0, next_chan, 0, MOAL_NO_WAIT); + return; +} +#endif + /** * @brief Set extended channel switch ie * @@ -14164,17 +16504,17 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_extend_channel_switch(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_extend_channel_switch(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0; - int data[5] = { 0 }; + int data[5] = {0}; + t_u8 channel; + mlan_ds_11h_chan_dfs_state ch_dfs; ENTER(); - if (!priv || !priv->phandle || - (priv->bss_role != MLAN_BSS_ROLE_UAP) || + if (!priv || !priv->phandle || (priv->bss_role != MLAN_BSS_ROLE_UAP) || (priv->bss_started != MTRUE)) { PRINTM(MERROR, "priv or handle is null or interface is not AP/GO" @@ -14185,7 +16525,7 @@ } parse_arguments(respbuf + strlen(CMD_NXP) + - strlen(PRIV_CMD_EXTEND_CHAN_SWITCH), + strlen(PRIV_CMD_EXTEND_CHAN_SWITCH), data, ARRAY_SIZE(data), &user_data_len); if (sizeof(int) * user_data_len > sizeof(data)) { @@ -14200,8 +16540,38 @@ LEAVE(); return ret; } + + /* For 2.4G channels skip the DFS checks */ + channel = data[2]; + if (channel > MAX_BG_CHANNEL) { + memset(&ch_dfs, 0, sizeof(ch_dfs)); + ch_dfs.channel = data[2]; + + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, &ch_dfs)) { + PRINTM(MERROR, "%s: woal_11h_chan_dfs_state failed \n", + __func__); + ret = -EFAULT; + LEAVE(); + return ret; + } + + if (ch_dfs.dfs_required && + (ch_dfs.dfs_state == DFS_UNAVAILABLE || + ch_dfs.dfs_state == DFS_USABLE)) { + PRINTM(MERROR, + "DFS: Channel=%d is not Available, cannot switch to this channel\n", + data[2]); + ret = -EFAULT; + LEAVE(); + return ret; + } + + if (ch_dfs.dfs_required) + woal_enable_dfs(priv, data[2], MOAL_IOCTL_WAIT); + } if (data[1]) { - if (woal_check_valid_channel_operclass(priv, data[2], data[1])) { + if (woal_check_valid_channel_operclass(priv, data[2], + data[1])) { PRINTM(MERROR, "Wrong channel switch parameters!\n"); ret = -EINVAL; goto done; @@ -14212,7 +16582,7 @@ data[4], MFALSE); else woal_action_channel_switch(priv, data[0], data[1], data[2], - data[3], MOAL_IOCTL_WAIT); + data[4], MOAL_IOCTL_WAIT); done: LEAVE(); return ret; @@ -14227,12 +16597,12 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_p2p_ecsa(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_p2p_ecsa(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int user_data_len = 0, header_len = 0; - int data[2] = { 0 }; + int data[2] = {0}; t_u8 bw = 0, oper_class = 0, channel = 0; IEEEtypes_ExtChanSwitchAnn_t *ext_chan_switch = NULL; custom_ie *pcust_chansw_ie = NULL; @@ -14275,12 +16645,13 @@ misc->param.cust_ie.len = (sizeof(custom_ie) - MAX_IE_SIZE); pcust_chansw_ie = (custom_ie *)&misc->param.cust_ie.ie_data_list[0]; - pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ + pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ pcust_chansw_ie->ie_length = sizeof(IEEEtypes_ExtChanSwitchAnn_t); - pcust_chansw_ie->mgmt_subtype_mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP; /*Add IE for - BEACON/probe resp */ + pcust_chansw_ie->mgmt_subtype_mask = + MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP; /*Add IE for + BEACON/probe resp*/ ext_chan_switch = - (IEEEtypes_ExtChanSwitchAnn_t *) pcust_chansw_ie->ie_buffer; + (IEEEtypes_ExtChanSwitchAnn_t *)pcust_chansw_ie->ie_buffer; header_len = strlen("P2P_ECSA"); parse_arguments(respbuf + header_len + 1, data, ARRAY_SIZE(data), @@ -14293,7 +16664,7 @@ } channel = data[0]; - /* bandwidth 20:20M 40:40M 80:80M */ + /* bandwidth 20:20M 40:40M 80:80M*/ bw = data[1]; if (bw != 20 && bw != 40 && bw != 80) { PRINTM(MERROR, "Unsupported bandwidth\n"); @@ -14338,13 +16709,12 @@ priv->phandle->chsw_wait_q_woken = MFALSE; /* wait for channel switch to complete */ - wait_event_interruptible_timeout(priv->phandle->chsw_wait_q, - priv->phandle->chsw_wait_q_woken, - (u32)HZ * - (ext_chan_switch->chan_switch_count + - 2) * 110 / 1000); + wait_event_interruptible_timeout( + priv->phandle->chsw_wait_q, priv->phandle->chsw_wait_q_woken, + (u32)HZ * (ext_chan_switch->chan_switch_count + 2) * 110 / + 1000); - pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ + pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ pcust_chansw_ie->mgmt_subtype_mask = 0; status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_SUCCESS) { @@ -14368,13 +16738,13 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_config_random_mac(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_config_random_mac(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; int header_len = 0, space_len = 0, i; t_u8 rand_data[3]; - const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -14397,7 +16767,8 @@ if (memcmp(priv->random_mac, zero_mac, MLAN_MAC_ADDR_LENGTH)) { ret = sprintf(respbuf, - "FAKEMAC has been On\n") + 1; + "FAKEMAC has been On\n") + + 1; goto done; } moal_memcpy_ext(priv->phandle, priv->random_mac, @@ -14428,6 +16799,728 @@ } /** + * @brief enable/disable roaming offload to firmware + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_set_roam_offload(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int user_data_len = 0, header_len = 0, ret = 0; + int data = 0; +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + t_u8 enable = 0; +#endif +#endif + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { + ret = -EFAULT; + goto done; + } +#endif +#endif + + header_len = strlen("SETROAMOFFLOAD"); + parse_arguments(respbuf + header_len + 1, &data, 1, &user_data_len); + + if (data < 0 || data > 5) { + PRINTM(MERROR, "Invalid parameters\n"); + ret = -EFAULT; + goto done; + } + +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (!data) { + woal_cfg80211_vendor_event(priv, event_set_key_mgmt_offload, + &enable, sizeof(enable)); + } +#endif +#endif + + ret = woal_enable_fw_roaming(priv, data); +done: + + LEAVE(); + return ret; +} + +/** + * @brief set roaming offload aplist to firmware + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_set_roam_offload_aplist(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_roam_offload *roam = NULL; + mlan_ds_misc_roam_offload_aplist *aplist = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + int ret = 0, i = 0; + int user_data_len = 0, header_len = 0; + int ap_count = 0; + char *begin = NULL, *end = NULL; + t_u8 mac_addr[6]; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { + ret = -EFAULT; + goto done; + } +#endif +#endif + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_ROAM_OFFLOAD_APLIST; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + roam = (mlan_ds_misc_roam_offload *)&misc->param.roam_offload; + /*Set enable to invalid value(valid: 0, 1, 2)*/ + roam->enable = 3; + aplist = &roam->aplist; + + header_len = strlen("SETROAMOFFLAPLIST"); + user_data_len = strlen(respbuf) - header_len; + if (!user_data_len) { + /* GET operation */ + ioctl_req->action = MLAN_ACT_GET; + } else { + begin = &respbuf[header_len + 1]; + end = begin; + while (begin && *begin == ' ') { + begin++; + end++; + } + while (end && *end != ' ') + end++; + if (end != NULL) + *end = '\0'; + end++; + if (begin) { + if (woal_atoi(&ap_count, begin) != + MLAN_STATUS_SUCCESS) { + ret = -EINVAL; + goto done; + } + } + aplist->ap_num = ap_count; + if (ap_count > 0 && ap_count <= MAX_AP_LIST) { + /* SET operation */ + ioctl_req->action = MLAN_ACT_SET; + for (i = 0; i < ap_count; i++) { + begin = end; + while (begin && *begin == ' ') { + begin++; + end++; + } + while (end && *end != ' ' && *end != '\0') + end++; + if (end == begin) { + PRINTM(MERROR, + "AP number %d is wrong\n", + ap_count); + ret = -EINVAL; + goto done; + } + if (end != NULL) + *end = '\0'; + end++; + woal_mac2u8(mac_addr, begin); + moal_memcpy_ext(priv->phandle, + aplist->ap_mac[i], mac_addr, + MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + } + } else { + PRINTM(MERROR, + "AP number is wrong.Support max 8 APs\n"); + ret = -EINVAL; + goto done; + } + } + + DBG_HEXDUMP(MERROR, "APLIST", (t_u8 *)aplist->ap_mac, + aplist->ap_num * MLAN_MAC_ADDR_LENGTH); + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} +/** + * @brief Configure roaming offload to firmware + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_roam_offload_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0, user_data_len = 0, header_len = 0, data = 0; + char *begin = NULL, *end = NULL, *pvariable_name = NULL; + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + woal_roam_offload_cfg roam_offload_cfg; + t_u8 len = 0; + int count = 0, i = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { + ret = -EFAULT; + goto done; + } +#endif +#endif + + memset((char *)&roam_offload_cfg, 0, sizeof(roam_offload_cfg)); + header_len = strlen("CFGROAMOFFLOAD"); + user_data_len = strlen(respbuf) - header_len; + if (!user_data_len) { + PRINTM(MERROR, "Invalid number of parameters\n"); + ret = -EINVAL; + goto done; + } + roam_offload_cfg.band_rssi.band_preferred = 0xff; + roam_offload_cfg.trigger_condition = 0xff; + end = &respbuf[header_len]; + while (((t_u8 *)end - &respbuf[header_len]) < user_data_len - 1) { + end++; + begin = end; + while (begin && *begin == ' ') { + begin++; + end++; + } + while (end && *end != ' ' && *end != '\0' && *end != '=') + end++; + if (end == begin) { + PRINTM(MERROR, "Invalid command specified!\n"); + ret = -EINVAL; + goto done; + } + if (end) + *end = '\0'; + pvariable_name = begin; + + if (((t_u8 *)end - &respbuf[header_len]) >= user_data_len) { + PRINTM(MERROR, "Invalid command length!\n"); + ret = -EINVAL; + goto done; + } + end++; + begin = end; + while (begin && (*begin == ' ' || *begin == '=')) { + begin++; + end++; + } + while (end && *end != ' ' && *end != '\0' && *end != '=') + end++; + if (end == begin) { + PRINTM(MERROR, "Invalid command specified!\n"); + ret = -EINVAL; + goto done; + } + if (end != NULL) + *end = '\0'; + if (pvariable_name && begin) { + if (strcmp(pvariable_name, "AUTO_RECONNECT") == 0) { + woal_atoi(&data, begin); + } else if (strcmp(pvariable_name, "BSSID") == 0) { + woal_mac2u8(mac_addr, begin); + moal_memcpy_ext(priv->phandle, + roam_offload_cfg.bssid, + mac_addr, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + } else if (strcmp(pvariable_name, "BLACKLIST") == 0) { + if (woal_atoi(&count, begin) != + MLAN_STATUS_SUCCESS) { + ret = -EINVAL; + goto done; + } + if (count > 0 && count <= MAX_AP_LIST) { + roam_offload_cfg.black_list.ap_num = + count; + for (i = 0; i < count; i++) { + end++; + begin = end; + while (begin && *begin == ' ') { + begin++; + end++; + } + while (end && *end != ' ' && + *end != '\0') + end++; + if (end == begin) { + PRINTM(MERROR, + "BSSID %d is wrong\n", + count); + ret = -EINVAL; + goto done; + } + if (end != NULL) + *end = '\0'; + woal_mac2u8(mac_addr, begin); + moal_memcpy_ext( + priv->phandle, + roam_offload_cfg + .black_list + .ap_mac[i], + mac_addr, + MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + } + } else { + PRINTM(MERROR, + "BSSID number is wrong.Support max %d BSSIDs\n", + MAX_AP_LIST); + ret = -EINVAL; + goto done; + } + } else if (strcmp(pvariable_name, "SSID") == 0) { + if (woal_atoi(&count, begin) != + MLAN_STATUS_SUCCESS) { + ret = -EINVAL; + goto done; + } + if (count > 0 && count <= MAX_SSID_NUM) { + roam_offload_cfg.ssid_list.ssid_num = + count; + for (i = 0; i < count; i++) { + end++; + begin = end; + while (begin && *begin == ' ') { + begin++; + end++; + } + while (end && *end != ' ' && + *end != '\0') { + end++; + len++; + } + if ((end == begin) || + len >= MLAN_MAX_SSID_LENGTH) { + PRINTM(MERROR, + "SSID %d is wrong\n", + count); + ret = -EINVAL; + goto done; + } + if (end != NULL) + *end = '\0'; + roam_offload_cfg.ssid_list + .ssids[i] + .ssid_len = len + 1; + moal_memcpy_ext( + priv->phandle, + (t_u8 *)&roam_offload_cfg + .ssid_list + .ssids[i] + .ssid, + begin, len + 1, + MLAN_MAX_SSID_LENGTH); + len = 0; + } + } else { + PRINTM(MERROR, + "SSID number is wrong.Support max %d SSIDs\n", + MAX_SSID_NUM); + ret = -EINVAL; + goto done; + } + } else if (strcmp(pvariable_name, "RETRY_COUNT") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.retry_count = (t_u8)data; + } else if (strcmp(pvariable_name, + "TRIGGER_CONDITION") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.trigger_condition = + (t_u16)data; + } else if (strcmp(pvariable_name, "MAX_RSSI") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.max_rssi = (t_u8)data; + roam_offload_cfg.rssi_param_set_flag = 1; + } else if (strcmp(pvariable_name, "MIN_RSSI") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.min_rssi = (t_u8)data; + roam_offload_cfg.rssi_param_set_flag = 1; + } else if (strcmp(pvariable_name, "STEP_RSSI") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.step_rssi = (t_u8)data; + roam_offload_cfg.rssi_param_set_flag = 1; + } else if (strcmp(pvariable_name, "BAND_PREFER") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.band_rssi.band_preferred = + (t_u8)data; + roam_offload_cfg.band_rssi_flag = 1; + } else if (strcmp(pvariable_name, "RSSI_HYSTERESIS") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.band_rssi.rssi_hysteresis = + (t_u8)data; + roam_offload_cfg.band_rssi_flag = 1; + } + + else if (strcmp(pvariable_name, "BSSTYPE") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.bgscan_cfg.bss_type = + (t_u8)data; + roam_offload_cfg.bgscan_set_flag++; + } else if (strcmp(pvariable_name, "CHANSPERSCAN") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.bgscan_cfg.channels_per_scan = + (t_u8)data; + roam_offload_cfg.bgscan_set_flag++; + } else if (strcmp(pvariable_name, "BGRPTCONDITION") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.bgscan_cfg.bg_rpt_condition = + (t_u32)data; + roam_offload_cfg.bgscan_set_flag++; + } else if (strcmp(pvariable_name, "SCANINTERVAL") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.bgscan_cfg.scan_interval = + (t_u32)data; + roam_offload_cfg.bgscan_set_flag++; + } + + else if (strcmp(pvariable_name, "EESMODE") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.ees_mode = (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "EESRPTCONDITION") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.ees_rpt_condition = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "HIGHSCANPERIOD") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.high_scan_period = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "HIGHSCANCOUNT") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.high_scan_count = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "MIDSCANPERIOD") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.mid_scan_period = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "MIDSCANCOUNT") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.mid_scan_count = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "LOWSCANPERIOD") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.low_scan_period = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } else if (strcmp(pvariable_name, "LOWSCANCOUNT") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.ees_cfg.low_scan_count = + (t_u16)data; + roam_offload_cfg.ees_param_set_flag++; + } + + else if (strcmp(pvariable_name, "BCNMISSTHRESHOLD") == + 0) { + woal_atoi(&data, begin); + roam_offload_cfg.bcn_miss_threshold = + (t_u8)data; + } + + else if (strcmp(pvariable_name, + "PREBCNMISSTHRESHOLD") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.pre_bcn_miss_threshold = + (t_u8)data; + } else if (strcmp(pvariable_name, "REPEATCOUNT") == 0) { + woal_atoi(&data, begin); + roam_offload_cfg.repeat_count = (t_u16)data; + } else { + PRINTM(MERROR, "Un-support parameter: %s\n", + pvariable_name); + ret = -EINVAL; + goto done; + } + } + } + if (priv->phandle->fw_roam_enable == AUTO_RECONNECT) { + moal_memcpy_ext(priv->phandle, + priv->phandle->auto_reconnect_bssid, + roam_offload_cfg.bssid, MLAN_MAC_ADDR_LENGTH, + sizeof(mlan_802_11_mac_addr)); + moal_memcpy_ext(priv->phandle, + &priv->phandle->auto_reconnect_ssid, + &roam_offload_cfg.ssid_list.ssids[0], + sizeof(mlan_802_11_ssid), + sizeof(mlan_802_11_ssid)); + priv->phandle->auto_reconnect_retry_count = (t_u8)data; + } else { + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) + moal_memcpy_ext(priv->phandle, + (void *)&priv->phandle->fw_roam_params, + (void *)&roam_offload_cfg, + sizeof(roam_offload_cfg), + sizeof(priv->phandle->fw_roam_params)); + else { + if (woal_config_fw_roaming(priv, ROAM_OFFLOAD_PARAM_CFG, + &roam_offload_cfg)) { + PRINTM(MERROR, + "%s: config fw roaming failed \n", + __func__); + ret = -EFAULT; + } + } + } +done: + LEAVE(); + return ret; +} + +/** + * @brief Configure roaming SSID passphrase + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_set_roam_passphrase(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_sec_cfg *sec = NULL; + int ret = 0, action = -1; + int user_data_len = 0, header_len = 0; + char *begin, *end, *opt, *item; + mlan_status status = MLAN_STATUS_SUCCESS; + woal_roam_offload_cfg roam_offload_cfg; + mlan_ds_passphrase *ssid_passphrase = NULL; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { + ret = -EFAULT; + goto done; + } +#endif +#endif + + memset((char *)&roam_offload_cfg, 0, sizeof(roam_offload_cfg)); + header_len = strlen("SETROAMPASSPHRASE"); + user_data_len = strlen(respbuf) - header_len; + if (!user_data_len) { + PRINTM(MERROR, "Invalid number of parameters\n"); + ret = -EINVAL; + goto done; + } + + /* Parse the buf to get the cmd_action */ + begin = respbuf + header_len; + while (begin && *begin == ' ') + begin++; + end = woal_strsep(&begin, ';', '/'); + if (end) + action = woal_atox(end); + PRINTM(MMSG, "action= %d\n", action); + if (action != 1 || end[1] != '\0') { + PRINTM(MERROR, "Invalid action argument %s\n", end); + ret = -EINVAL; + goto done; + } + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_sec_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_SEC_CFG; + sec = (mlan_ds_sec_cfg *)req->pbuf; + sec->sub_command = MLAN_OID_SEC_CFG_PASSPHRASE; + sec->multi_passphrase = 1; + req->action = MLAN_ACT_SET; + + /*Parse the buffer like "ssid=xxx passphrase=xxxx;ssid=xxx + * passphrase=xxx"*/ + while (begin) { + while (begin && *begin == ' ') + begin++; + end = woal_strsep(&begin, ';', '/'); + item = woal_strsep(&end, ' ', '/'); + opt = woal_strsep(&item, '=', '/'); + while (opt) { + if (roam_offload_cfg.userset_passphrase >= + MAX_SEC_SSID_NUM - 1) { + PRINTM(MERROR, + "Support max %d security SSIDs!\n", + MAX_SEC_SSID_NUM); + break; + } + ssid_passphrase = + &sec->param.roam_passphrase + [roam_offload_cfg.userset_passphrase]; + if (!opt || !item || !end) { + PRINTM(MERROR, "Invalid option\n"); + ret = -EINVAL; + goto done; + } else if (!strnicmp(opt, "ssid", strlen(opt))) { + if (strlen(end) > MLAN_MAX_SSID_LENGTH) { + PRINTM(MERROR, + "SSID length exceeds max length\n"); + ret = -EFAULT; + goto done; + } + ssid_passphrase->ssid.ssid_len = strlen(item); + strncpy((char *)ssid_passphrase->ssid.ssid, + item, + MIN(strlen(item), + MLAN_MAX_SSID_LENGTH)); + PRINTM(MINFO, "ssid=%s, len=%d\n", + ssid_passphrase->ssid.ssid, + (int)ssid_passphrase->ssid.ssid_len); + } else if (!strnicmp(opt, "passphrase", strlen(opt)) && + req->action == MLAN_ACT_SET) { + if (strlen(item) < MLAN_MIN_PASSPHRASE_LENGTH || + strlen(item) > MLAN_MAX_PASSPHRASE_LENGTH) { + PRINTM(MERROR, + "Invalid length for passphrase\n"); + ret = -EINVAL; + goto done; + } + ssid_passphrase->psk_type = MLAN_PSK_PASSPHRASE; + moal_memcpy_ext(priv->phandle, + ssid_passphrase->psk.passphrase + .passphrase, + item, strlen(item), + MLAN_MAX_PASSPHRASE_LENGTH); + ssid_passphrase->psk.passphrase.passphrase_len = + strlen(item); + PRINTM(MINFO, "passphrase=%s, len=%d\n", + ssid_passphrase->psk.passphrase + .passphrase, + (int)ssid_passphrase->psk.passphrase + .passphrase_len); + } else { + PRINTM(MERROR, "Invalid option %s\n", opt); + ret = -EINVAL; + goto done; + } + if (!end || *end == '\0') + break; + while (end && *end == ' ') + end++; + item = woal_strsep(&end, ' ', '/'); + opt = woal_strsep(&item, '=', '/'); + } + roam_offload_cfg.userset_passphrase++; + } + + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) { + moal_memcpy_ext(priv->phandle, + (char *)priv->phandle->ssid_passphrase, + (char *)sec->param.roam_passphrase, + MAX_SEC_SSID_NUM * sizeof(mlan_ds_passphrase), + MAX_SEC_SSID_NUM * sizeof(mlan_ds_passphrase)); + priv->phandle->fw_roam_params.userset_passphrase = + roam_offload_cfg.userset_passphrase; + goto done; + } + + if (woal_config_fw_roaming(priv, ROAM_OFFLOAD_ENABLE, + &roam_offload_cfg)) { + PRINTM(MERROR, "%s: config fw roaming failed \n", __func__); + ret = -EFAULT; + goto done; + } + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** * @brief Download start keep alive parameters * * @param priv Pointer to moal_private structure @@ -14440,11 +17533,10 @@ * @return 0: success fail otherwise */ -int -woal_start_mkeep_alive(moal_private *priv, t_u8 mkeep_alive_id, - t_u8 *ip_pkt, t_u16 ip_pkt_len, t_u8 *src_mac, - t_u8 *dst_mac, t_u32 period_msec, - t_u32 retry_interval, t_u8 retry_cnt) +int woal_start_mkeep_alive(moal_private *priv, t_u8 mkeep_alive_id, + t_u8 *ip_pkt, t_u16 ip_pkt_len, t_u8 *src_mac, + t_u8 *dst_mac, t_u32 period_msec, + t_u32 retry_interval, t_u8 retry_cnt) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -14515,9 +17607,8 @@ * @return 0: success fail otherwise */ -int -woal_stop_mkeep_alive(moal_private *priv, t_u8 mkeep_alive_id, t_u8 reset, - t_u8 *ip_pkt, t_u8 *pkt_len) +int woal_stop_mkeep_alive(moal_private *priv, t_u8 mkeep_alive_id, t_u8 reset, + t_u8 *ip_pkt, t_u8 *pkt_len) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -14579,6 +17670,7 @@ ret = -EFAULT; goto done; } + #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (IS_STA_CFG80211(priv->phandle->params.cfg80211_wext)) { @@ -14615,13 +17707,13 @@ * @return Number of bytes written, negative for failure. */ -int -woal_priv_save_cloud_keep_alive_params(moal_private *priv, - t_u8 mkeep_alive_id, t_u8 enable, - t_u16 ether_type, t_u8 *ip_pkt, - t_u16 ip_pkt_len, t_u8 *src_mac, - t_u8 *dst_mac, t_u32 period_msec, - t_u32 retry_interval, t_u8 retry_cnt) +int woal_priv_save_cloud_keep_alive_params(moal_private *priv, + t_u8 mkeep_alive_id, t_u8 enable, + t_u16 ether_type, t_u8 *ip_pkt, + t_u16 ip_pkt_len, t_u8 *src_mac, + t_u8 *dst_mac, t_u32 period_msec, + t_u32 retry_interval, t_u8 retry_cnt) + { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -14709,8 +17801,8 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cloud_keep_alive(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cloud_keep_alive(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; cloud_keep_alive *keep_alive = NULL; @@ -14720,26 +17812,15 @@ header_len = strlen(PRIV_CMD_CLOUD_KEEP_ALIVE); - keep_alive = (cloud_keep_alive *) (respbuf + header_len); + keep_alive = (cloud_keep_alive *)(respbuf + header_len); if (keep_alive->enable) { - ret = woal_priv_save_cloud_keep_alive_params(priv, - keep_alive-> - mkeep_alive_id, - keep_alive->enable, - 0, keep_alive->pkt, - keep_alive-> - pkt_len, - keep_alive-> - src_mac, - keep_alive-> - dst_mac, - keep_alive-> - sendInterval, - keep_alive-> - retryInterval, - keep_alive-> - retryCount); + ret = woal_priv_save_cloud_keep_alive_params( + priv, keep_alive->mkeep_alive_id, keep_alive->enable, 0, + keep_alive->pkt, keep_alive->pkt_len, + keep_alive->src_mac, keep_alive->dst_mac, + keep_alive->sendInterval, keep_alive->retryInterval, + keep_alive->retryCount); } else { if (0 != woal_stop_mkeep_alive(priv, keep_alive->mkeep_alive_id, keep_alive->reset, @@ -14764,13 +17845,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_rx_abort_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_rx_abort_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[2] = { 0 }; + int data[2] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -14848,13 +17929,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_rx_abort_cfg_ext(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_rx_abort_cfg_ext(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[3] = { 0 }; + int data[3] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -14945,14 +18026,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_dot11mc_unassoc_ftm_cfg(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_dot11mc_unassoc_ftm_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[1] = { 0 }; + int data[1] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -15026,14 +18106,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_tx_ampdu_prot_mode(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) +static int woal_priv_tx_ampdu_prot_mode(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[1] = { 0 }; + int data[1] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -15107,13 +18186,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_rate_adapt_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_rate_adapt_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[4] = { 0 }; + int data[4] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -15213,13 +18292,13 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_cck_desense_cfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_cck_desense_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int ret = 0; - int data[5] = { 0 }; + int data[5] = {0}; int header_len = 0, user_data_len = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -15350,8 +18429,8 @@ * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_get_lpm(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_get_lpm(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -15378,8 +18457,8 @@ ret = -EINVAL; goto done; } else { - req = woal_alloc_mlan_ioctl_req(sizeof - (mlan_ds_power_cfg)); + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_power_cfg)); if (req == NULL) { ret = -ENOMEM; goto done; @@ -15425,8 +18504,7 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_arbcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_arbcfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -15502,8 +18580,7 @@ * * @return N/A */ -void -woal_tp_acnt_timer_func(void *context) +void woal_tp_acnt_timer_func(void *context) { moal_handle *phandle = (moal_handle *)context; int i = 0; @@ -15548,9 +18625,8 @@ phandle->tp_acnt.rx_intr_rate = phandle->tp_acnt.rx_intr_cnt - phandle->tp_acnt.rx_intr_last; phandle->tp_acnt.rx_intr_last = phandle->tp_acnt.rx_intr_cnt; - phandle->tp_acnt.rx_amsdu_cnt_rate = - phandle->tp_acnt.rx_amsdu_cnt - - phandle->tp_acnt.rx_amsdu_cnt_last; + phandle->tp_acnt.rx_amsdu_cnt_rate = phandle->tp_acnt.rx_amsdu_cnt - + phandle->tp_acnt.rx_amsdu_cnt_last; phandle->tp_acnt.rx_amsdu_cnt_last = phandle->tp_acnt.rx_amsdu_cnt; phandle->tp_acnt.rx_amsdu_pkt_cnt_rate = @@ -15559,9 +18635,8 @@ phandle->tp_acnt.rx_amsdu_pkt_cnt_last = phandle->tp_acnt.rx_amsdu_pkt_cnt; - phandle->tp_acnt.tx_amsdu_cnt_rate = - phandle->tp_acnt.tx_amsdu_cnt - - phandle->tp_acnt.tx_amsdu_cnt_last; + phandle->tp_acnt.tx_amsdu_cnt_rate = phandle->tp_acnt.tx_amsdu_cnt - + phandle->tp_acnt.tx_amsdu_cnt_last; phandle->tp_acnt.tx_amsdu_cnt_last = phandle->tp_acnt.tx_amsdu_cnt; phandle->tp_acnt.tx_amsdu_pkt_cnt_rate = @@ -15581,8 +18656,7 @@ * * @return N/A */ -void -woal_set_tp_state(moal_private *priv) +void woal_set_tp_state(moal_private *priv) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -15614,8 +18688,8 @@ * * @return Number of bytes written, negative for failure. */ -static int -woal_priv_set_tp_state(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) +static int woal_priv_set_tp_state(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) { moal_handle *handle = priv->phandle; int ret = 0; @@ -15672,6 +18746,85 @@ return ret; } +static int woal_priv_ips_cfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + moal_handle *handle = priv->phandle; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + t_u32 data[1]; + int ret = 0; + int user_data_len = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + if (strlen(respbuf) == (strlen(CMD_NXP) + strlen(PRIV_CMD_IPS_CFG))) { + /* GET operation */ + user_data_len = 0; + } else { + /* SET operation */ + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf + strlen(CMD_NXP) + + strlen(PRIV_CMD_IPS_CFG), + data, ARRAY_SIZE(data), &user_data_len); + } + if (user_data_len) { + /* Allocate an IOCTL request buffer */ + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + /* Fill request buffer */ + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_IPS_CFG; + req->req_id = MLAN_IOCTL_MISC_CFG; + misc->param.ips_ctrl = data[0]; + req->action = MLAN_ACT_SET; + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + handle->ips_ctrl = data[0]; + } else { + data[0] = handle->ips_ctrl; + moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)data, + sizeof(data), respbuflen); + } + ret = sizeof(data); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +static int woal_priv_get_uuid(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = -1; + mlan_fw_info fw_info; + + ENTER(); + + if (!respbuf) { + PRINTM(MERROR, "response buffer is not available!\n"); + ret = -1; + } else { + fw_info.uuid_lo = fw_info.uuid_hi = 0x0ULL; + + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + snprintf(respbuf, MLAN_MAX_UUID_LEN + 1, "%016llx%016llx", + fw_info.uuid_lo, fw_info.uuid_hi); + ret = strlen(respbuf); + } + + LEAVE(); + return ret; +} + /** * @brief Set priv command for Android * @param dev A pointer to net_device structure @@ -15679,8 +18832,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) +int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) { int ret = 0; android_wifi_priv_cmd priv_cmd; @@ -15700,7 +18852,7 @@ int len = 0; gfp_t flag; char *cmd_buf = NULL; -#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if defined(STA_CFG80211) || defined(UAP_CFG80211) int cfg80211_wext; #endif @@ -15710,7 +18862,7 @@ ret = -EFAULT; goto done; } -#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if defined(STA_CFG80211) || defined(UAP_CFG80211) cfg80211_wext = priv->phandle->params.cfg80211_wext; #endif if (copy_from_user(&priv_cmd, req->ifr_data, @@ -15730,7 +18882,7 @@ if (priv_cmd.total_len + 1 > CMD_BUF_LEN) priv_cmd.total_len = CMD_BUF_LEN - 1; - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; buf = kzalloc(CMD_BUF_LEN, flag); if (!buf) { PRINTM(MERROR, "%s: failed to allocate memory\n", __FUNCTION__); @@ -15787,7 +18939,7 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_11AXCMDCFG); len = priv_cmd.total_len - strlen(CMD_NXP) + - strlen(PRIV_CMD_11AXCMDCFG); + strlen(PRIV_CMD_11AXCMDCFG); len = woal_setget_priv_11axcmdcfg(priv, pdata, len, MOAL_IOCTL_WAIT); len += strlen(CMD_NXP) + strlen(PRIV_CMD_11AXCMDCFG); @@ -15835,7 +18987,7 @@ } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_REJECTADDBAREQ, strlen(PRIV_CMD_REJECTADDBAREQ)) == 0) { - /* Set/Get the reject addba requst conditions */ + /* Set/Get the reject addba requst conditions*/ len = woal_priv_rejectaddbareq(priv, buf, priv_cmd.total_len); goto handled; @@ -16013,6 +19165,12 @@ priv_cmd.total_len, 0); goto handled; #endif + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_AUTOASSOC, + strlen(PRIV_CMD_AUTOASSOC)) == 0) { + /* Auto assoc */ + len = woal_priv_setgetautoassoc(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_WAKEUPREASON, strlen(PRIV_CMD_WAKEUPREASON)) == 0) { @@ -16025,9 +19183,8 @@ PRIV_CMD_LISTENINTERVAL, strlen(PRIV_CMD_LISTENINTERVAL)) == 0) { /* Listen Interval */ - len = woal_priv_set_get_listeninterval(priv, buf, - priv_cmd. - total_len); + len = woal_priv_set_get_listeninterval( + priv, buf, priv_cmd.total_len); goto handled; #endif #ifdef DEBUG_LEVEL1 @@ -16166,10 +19323,10 @@ PRIV_CMD_DOT11MC_UNASSOC_FTM_CFG, strlen(PRIV_CMD_DOT11MC_UNASSOC_FTM_CFG)) == 0) { - /* setting for dot11mc un-associated case FTM frame exchange */ - len = woal_priv_dot11mc_unassoc_ftm_cfg(priv, buf, - priv_cmd. - total_len); + /* setting for dot11mc un-associated case FTM frame + * exchange */ + len = woal_priv_dot11mc_unassoc_ftm_cfg( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_RATE_ADAPT_CFG, @@ -16256,7 +19413,7 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_ROBUSTCOEX); len = priv_cmd.total_len - strlen(PRIV_CMD_ROBUSTCOEX) - - strlen(CMD_NXP); + strlen(CMD_NXP); len = woal_priv_robustcoex(priv, pdata, len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DMCS, @@ -16270,7 +19427,7 @@ /* Set SSU config */ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_SSU); len = priv_cmd.used_len - strlen(PRIV_CMD_SSU) - - strlen(CMD_NXP); + strlen(CMD_NXP); len = woal_priv_ssu_cmd(priv, len, pdata, priv_cmd.total_len); goto handled; @@ -16281,9 +19438,18 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_HAL_PHY_CFG); len = priv_cmd.total_len - - strlen(PRIV_CMD_HAL_PHY_CFG) - strlen(CMD_NXP); + strlen(PRIV_CMD_HAL_PHY_CFG) - strlen(CMD_NXP); len = woal_priv_hal_phy_cfg_cmd(priv, pdata, len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_CSI, + strlen(PRIV_CMD_CSI)) == 0) { + /* Set CSI config */ + pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_CSI); + len = priv_cmd.total_len - strlen(PRIV_CMD_CSI) - + strlen(CMD_NXP); + priv->csi_seq = 0; + len = woal_priv_csi_cmd(priv, pdata, len); + goto handled; #ifdef STA_SUPPORT } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_ARPFILTER, strlen(PRIV_CMD_ARPFILTER)) == 0) { @@ -16304,22 +19470,13 @@ len = woal_priv_hotspotcfg(priv, buf, priv_cmd.total_len); goto handled; -#ifdef RX_PACKET_COALESCE - } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_RX_COAL_CFG, - strlen(PRIV_CMD_RX_COAL_CFG)) == 0) { - /* RX packet coalescing Configuration */ - len = woal_priv_rx_pkt_coalesce_cfg(priv, buf, - priv_cmd.total_len); - goto handled; -#endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_MGMT_FRAME_CTRL, strlen(PRIV_CMD_MGMT_FRAME_CTRL)) == 0) { /* Mgmt Frame Passthrough Ctrl */ - len = woal_priv_mgmt_frame_passthru_ctrl(priv, buf, - priv_cmd. - total_len); + len = woal_priv_mgmt_frame_passthru_ctrl( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_QCONFIG, strlen(PRIV_CMD_QCONFIG)) == 0) { @@ -16341,9 +19498,8 @@ } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_QSTATUS, strlen(PRIV_CMD_QSTATUS)) == 0) { /* Get the status of the WMM queues */ - len = woal_priv_wmm_queue_status_ioctl(priv, buf, - priv_cmd. - total_len); + len = woal_priv_wmm_queue_status_ioctl( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_TS_STATUS, strlen(PRIV_CMD_TS_STATUS)) == 0) { @@ -16357,11 +19513,11 @@ t_u32 action = MLAN_ACT_GET; if (strlen(buf) == strlen(CMD_NXP) + strlen(PRIV_CMD_QOS_CFG)) { - pdata = buf; /* GET operation */ + pdata = buf; /* GET operation */ } else { pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_QOS_CFG); - action = MLAN_ACT_SET; /* SET operation */ + action = MLAN_ACT_SET; /* SET operation */ } if (MLAN_STATUS_SUCCESS != woal_priv_qos_cfg(priv, action, pdata)) { @@ -16388,6 +19544,26 @@ len = woal_priv_region_code(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DRCS_CFG, + strlen(PRIV_CMD_DRCS_CFG)) == 0) { + /* DRCS configuration for mc_cfg_ext*/ + len = woal_priv_drcs_time_slicing_cfg( + priv, buf, priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_MULTI_CHAN_CFG, + strlen(PRIV_CMD_MULTI_CHAN_CFG)) == 0) { + /* Channel time and buffer weight configuration */ + len = woal_priv_multi_chan_config(priv, buf, + priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_MULTI_CHAN_POLICY, + strlen(PRIV_CMD_MULTI_CHAN_POLICY)) == 0) { + /* Multi-channel Policy enable/disable */ + len = woal_priv_multi_chan_policy(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_FWMACADDR, strlen(PRIV_CMD_FWMACADDR)) == 0) { /* Set FW MAC address */ @@ -16404,7 +19580,8 @@ priv_cmd.total_len); } else len = sprintf(buf, - "CFG80211 is not enabled\n") + 1; + "CFG80211 is not enabled\n") + + 1; goto handled; #endif #endif @@ -16455,9 +19632,8 @@ strlen(PRIV_CMD_MIN_BA_THRESH_CFG)) == 0) { /* Implement Minimum BA threshold configuration command */ - len = woal_priv_min_ba_threshold_cfg(priv, buf, - priv_cmd. - total_len); + len = woal_priv_min_ba_threshold_cfg( + priv, buf, priv_cmd.total_len); goto handled; #if defined(STA_SUPPORT) } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_11D_CFG, @@ -16504,9 +19680,8 @@ } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_POWER_CONS, strlen(PRIV_CMD_POWER_CONS)) == 0) { /* Set/get user provisioned local power constraint */ - len = woal_priv_11h_local_pwr_constraint(priv, buf, - priv_cmd. - total_len); + len = woal_priv_11h_local_pwr_constraint( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_HT_STREAM_CFG, @@ -16574,9 +19749,8 @@ PRIV_CMD_INACTIVITYTO, strlen(PRIV_CMD_INACTIVITYTO)) == 0) { /* Get/Set inactivity timeout extend */ - len = woal_priv_inactivity_timeout_ext(priv, buf, - priv_cmd. - total_len); + len = woal_priv_inactivity_timeout_ext( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_AMSDU_AGGR_CTRL, @@ -16585,6 +19759,37 @@ len = woal_priv_11n_amsdu_aggr_ctrl(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_MCAST_AGGR_GROUP, + strlen(PRIV_CMD_MCAST_AGGR_GROUP)) == 0) { + /* mcast_aggr_group cfg*/ + len = woal_priv_mcast_aggr_group_cfg( + priv, buf, priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_MC_AGGR_CFG, + strlen(PRIV_CMD_MC_AGGR_CFG)) == 0) { + /* mc_aggr_cfg*/ + len = woal_priv_mc_aggr_cfg(priv, buf, + priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_STATS, + strlen(PRIV_CMD_STATS)) == 0) { + /* stats */ + len = woal_priv_stats(priv, buf, priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_CH_LOAD, + strlen(PRIV_CMD_CH_LOAD)) == 0) { + /* mc_aggr_cfg*/ + len = woal_priv_get_ch_load(priv, buf, + priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_CH_LOAD_RESULTS, + strlen(PRIV_CMD_CH_LOAD_RESULTS)) == 0) { + /* mc_aggr_cfg*/ + len = woal_priv_get_ch_load_results(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_TX_BF_CAP, strlen(PRIV_CMD_TX_BF_CAP)) == 0) { /* Set/Get Transmit beamforming capabilities */ @@ -16598,17 +19803,60 @@ len = woal_priv_sleep_params_ioctl(priv, buf, priv_cmd.total_len); goto handled; +#ifdef UAP_SUPPORT + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_NET_MON, + strlen(PRIV_CMD_NET_MON)) == 0) { + /* Set/Get network monitor configurations */ + len = woal_priv_net_monitor_ioctl(priv, buf, + priv_cmd.total_len); + goto handled; +#endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DFS_TESTING, strlen(PRIV_CMD_DFS_TESTING)) == 0) { /* Set/Get DFS Testing settings */ len = woal_priv_dfs_testing(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_CLEAR_NOP, + strlen(PRIV_CMD_CLEAR_NOP)) == 0) { + /* Set/Get DFS Testing settings */ + len = woal_priv_clear_nop(priv, buf, + priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_NOP_LIST, + strlen(PRIV_CMD_NOP_LIST)) == 0) { + /* Set/Get DFS Testing settings */ + len = woal_priv_nop_list(priv, buf, priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_FAKE_RADAR, + strlen(PRIV_CMD_FAKE_RADAR)) == 0) { + /* mcast_aggr_group cfg*/ + len = woal_priv_fake_radar(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DFS53_CFG, strlen(PRIV_CMD_DFS53_CFG)) == 0) { /* Set/Get DFS W53 settings */ len = woal_priv_dfs53cfg(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DFS_MODE, + strlen(PRIV_CMD_DFS_MODE)) == 0) { + /* Set/Get DFS mode settings */ + len = woal_priv_dfs_mode(priv, buf, priv_cmd.total_len); + goto handled; +#ifdef UAP_SUPPORT + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DFS_CAC, + strlen(PRIV_CMD_DFS_CAC)) == 0) { + /* perform CAC */ + len = woal_priv_do_dfs_cac(priv, buf, + priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_AUTODFS, + strlen(PRIV_CMD_AUTODFS)) == 0) { + len = woal_priv_auto_dfs_cfg(priv, buf, + priv_cmd.total_len); + goto handled; +#endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_ARB_CFG, strlen(PRIV_CMD_ARB_CFG)) == 0) { /* Set/Get CFP table codes */ @@ -16645,9 +19893,8 @@ strlen(PRIV_CMD_ASSOCIATE)) == 0) { /* Associate to a specific indexed entry in the * ScanTable */ - len = woal_priv_associate_ssid_bssid(priv, buf, - priv_cmd. - total_len); + len = woal_priv_associate_ssid_bssid( + priv, buf, priv_cmd.total_len); goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_TX_BF_CFG, strlen(PRIV_CMD_TX_BF_CFG)) == 0) { @@ -16666,6 +19913,11 @@ len = woal_priv_port_ctrl(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_TXWATCHDOG, + strlen(PRIV_CMD_TXWATCHDOG)) == 0) { + len = woal_priv_txwatchdog(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_PB_BYPASS, strlen(PRIV_CMD_PB_BYPASS)) == 0) { /* Private IOCTL entry to get the By-passed TX packet @@ -16688,28 +19940,36 @@ goto handled; #endif #endif - } else if (strnicmp - (buf + strlen(CMD_NXP), PRIV_CMD_CFG_CLOCK_SYNC, - strlen(PRIV_CMD_CFG_CLOCK_SYNC)) == 0) { + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_CFG_CLOCK_SYNC, + strlen(PRIV_CMD_CFG_CLOCK_SYNC)) == 0) { /* Set/Get P2P NoA (Notice of Absence) parameters */ len = woal_priv_cfg_clock_sync(priv, buf, priv_cmd.total_len); goto handled; - } else if (strnicmp - (buf + strlen(CMD_NXP), PRIV_CMD_CFG_GET_TSF_INFO, - strlen(PRIV_CMD_CFG_GET_TSF_INFO)) == 0) { + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_CFG_GET_TSF_INFO, + strlen(PRIV_CMD_CFG_GET_TSF_INFO)) == 0) { /* Get TSF info */ len = woal_priv_cfg_get_tsf_info(priv, buf, priv_cmd.total_len); goto handled; - } else if (strnicmp - (buf + strlen(CMD_NXP), PRIV_CMD_TRANSITION_CHANNEL, - strlen(PRIV_CMD_TRANSITION_CHANNEL)) == 0) { - /* Get/Set Transition channel */ - len = woal_priv_transition_channel(priv, buf, - priv_cmd.total_len); +#ifdef UAP_SUPPORT + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_TARGET_CHANNEL, + strlen(PRIV_CMD_TARGET_CHANNEL)) == 0) { + /* Get/Set Target channel*/ + len = woal_priv_target_channel(priv, buf, + priv_cmd.total_len); goto handled; - + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_BACKUP_CHANNEL, + strlen(PRIV_CMD_BACKUP_CHANNEL)) == 0) { + /* Get/Set Backup channel*/ + len = woal_priv_backup_channel(priv, buf, + priv_cmd.total_len); + goto handled; +#endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DFS_REPEATER_CFG, strlen(PRIV_CMD_DFS_REPEATER_CFG)) == 0) { @@ -16783,12 +20043,12 @@ strlen(PRIV_CMD_DFS_OFFLOAD)) == 0) { /* Enable/disable DFS offload */ if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) - len = woal_priv_dfs_offload_enable(priv, buf, - priv_cmd. - total_len); + len = woal_priv_dfs_offload_enable( + priv, buf, priv_cmd.total_len); else len = sprintf(buf, - "CFG80211 is not enabled\n") + 1; + "CFG80211 is not enabled\n") + + 1; goto handled; #endif #endif @@ -16797,9 +20057,8 @@ PRIV_CMD_EXTEND_CHAN_SWITCH, strlen(PRIV_CMD_EXTEND_CHAN_SWITCH)) == 0) { /* Extended channel switch */ - len = woal_priv_extend_channel_switch(priv, buf, - priv_cmd. - total_len); + len = woal_priv_extend_channel_switch( + priv, buf, priv_cmd.total_len); goto handled; #endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_DYN_BW, @@ -16830,7 +20089,7 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_11AXCFG); len = priv_cmd.used_len - strlen(PRIV_CMD_11AXCFG) - - strlen(CMD_NXP); + strlen(CMD_NXP); len = woal_priv_11axcfg_cmd(priv, pdata, len, priv_cmd.total_len); len += strlen(PRIV_CMD_11AXCFG) + strlen(CMD_NXP); @@ -16840,7 +20099,7 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_TWT_SETUP); len = priv_cmd.used_len - strlen(PRIV_CMD_TWT_SETUP) - - strlen(CMD_NXP); + strlen(CMD_NXP); len = woal_priv_twt_setup(priv, pdata, len, priv_cmd.total_len); len += strlen(PRIV_CMD_TWT_SETUP) + strlen(CMD_NXP); @@ -16852,7 +20111,7 @@ pdata = buf + strlen(CMD_NXP) + strlen(PRIV_CMD_TWT_TEARDOWN); len = priv_cmd.used_len - - strlen(PRIV_CMD_TWT_TEARDOWN) - strlen(CMD_NXP); + strlen(PRIV_CMD_TWT_TEARDOWN) - strlen(CMD_NXP); len = woal_priv_twt_teardown(priv, pdata, len, priv_cmd.total_len); len += strlen(PRIV_CMD_TWT_TEARDOWN) + strlen(CMD_NXP); @@ -16863,12 +20122,12 @@ strlen(PRIV_CMD_GET_CFG_CHAN_LIST)) == 0) { /* Get txpwrlimit */ if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) - len = woal_priv_getcfgchanlist(priv, buf, - priv_cmd. - total_len); + len = woal_priv_getcfgchanlist( + priv, buf, priv_cmd.total_len); else len = sprintf(buf, - "CFG80211 is not enabled\n") + 1; + "CFG80211 is not enabled\n") + + 1; goto handled; #endif } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_LPM, @@ -16883,6 +20142,14 @@ len = woal_priv_set_tp_state(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_IPS_CFG, + strlen(PRIV_CMD_IPS_CFG)) == 0) { + len = woal_priv_ips_cfg(priv, buf, priv_cmd.total_len); + goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_GET_SB_UUID, + strlen(PRIV_CMD_GET_SB_UUID)) == 0) { + len = woal_priv_get_uuid(priv, buf, priv_cmd.total_len); + goto handled; } else { PRINTM(MERROR, "Unknown NXP PRIVATE command %s, ignored\n", @@ -16892,7 +20159,8 @@ } } #ifdef STA_SUPPORT - if (strncmp(buf, "RSSILOW-THRESHOLD", strlen("RSSILOW-THRESHOLD")) == 0) { + if (strncmp(buf, "RSSILOW-THRESHOLD", strlen("RSSILOW-THRESHOLD")) == + 0) { pdata = buf + strlen("RSSILOW-THRESHOLD") + 1; if (MLAN_STATUS_SUCCESS != woal_set_rssi_low_threshold(priv, pdata, MOAL_IOCTL_WAIT)) { @@ -16923,7 +20191,7 @@ } len = sprintf(buf, "%.32s rssi %d\n", bss_info.ssid.ssid, signal.bcn_rssi_avg) + - 1; + 1; } else { len = sprintf(buf, "OK\n") + 1; } @@ -16935,14 +20203,16 @@ } PRINTM(MIOCTL, "tx rate=%d\n", (int)rate.rate); len = sprintf(buf, "LinkSpeed %d\n", - (int)(rate.rate * 500000 / 1000000)) + 1; + (int)(rate.rate * 500000 / 1000000)) + + 1; } else #endif - if (strncmp(buf, "MACADDR", strlen("MACADDR")) == 0) { + if (strncmp(buf, "MACADDR", strlen("MACADDR")) == 0) { len = sprintf(buf, "Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n", priv->current_addr[0], priv->current_addr[1], priv->current_addr[2], priv->current_addr[3], - priv->current_addr[4], priv->current_addr[5]) + 1; + priv->current_addr[4], priv->current_addr[5]) + + 1; } #ifdef STA_SUPPORT else if (strncmp(buf, "GETPOWER", strlen("GETPOWER")) == 0) { @@ -17016,6 +20286,14 @@ } #endif len = sprintf(buf, "OK\n") + 1; + } else if (strncmp(buf, "COUNTRYCODE", strlen("COUNTRYCODE")) == 0) { + memset(country_code, 0, sizeof(country_code)); + if (MLAN_STATUS_SUCCESS != + woal_get_countrycode(priv, country_code)) { + ret = -EFAULT; + goto done; + } + len = sprintf(buf, "%s\n", country_code) + 1; } else if (strncmp(buf, "COUNTRY", strlen("COUNTRY")) == 0) { copy_len = strlen(buf) - strlen("COUNTRY") - 1; if (copy_len > COUNTRY_CODE_LEN || copy_len <= 0) { @@ -17038,14 +20316,16 @@ } #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { - PRINTM(MIOCTL, "Notify country code=%s\n", - country_code); if (!moal_extflg_isset(priv->phandle, - EXT_DISABLE_REGD_BY_DRIVER)) + EXT_DISABLE_REGD_BY_DRIVER)) { + PRINTM(MIOCTL, "Notify country code=%s\n", + country_code); + regulatory_hint(priv->wdev->wiphy, country_code); - len = sprintf(buf, "OK\n") + 1; - goto done; + len = sprintf(buf, "OK\n") + 1; + goto done; + } } #endif if (MLAN_STATUS_SUCCESS != @@ -17054,7 +20334,8 @@ goto done; } len = sprintf(buf, "OK\n") + 1; - } else if (memcmp(buf, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) == 0) { + } else if (memcmp(buf, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) == + 0) { PRINTM(MIOCTL, "Set Combo Scan\n"); if (MLAN_STATUS_SUCCESS != woal_set_combo_scan(priv, buf, priv_cmd.total_len)) { @@ -17099,7 +20380,7 @@ pdata = buf + strlen("AP_SET_CFG") + 1; ret = woal_uap_set_ap_cfg(priv, pdata, priv_cmd.total_len - - strlen("AP_SET_CFG") - 1); + strlen("AP_SET_CFG") - 1); if (ret) goto done; len = sprintf(buf, "OK\n") + 1; @@ -17130,7 +20411,8 @@ #ifdef STA_SUPPORT else if (strncmp(buf, "BGSCAN-START", strlen("BGSCAN-START")) == 0) { len = sprintf(buf, "OK\n") + 1; - } else if (strncmp(buf, "BGSCAN-CONFIG", strlen("BGSCAN-CONFIG")) == 0) { + } else if (strncmp(buf, "BGSCAN-CONFIG", strlen("BGSCAN-CONFIG")) == + 0) { if (MLAN_STATUS_SUCCESS != woal_set_bg_scan(priv, buf, priv_cmd.total_len)) { ret = -EFAULT; @@ -17141,7 +20423,7 @@ len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "BGSCAN-STOP", strlen("BGSCAN-STOP")) == 0) { if (priv->bg_scan_start && !priv->scan_cfg.rssi_threshold) { - if (MLAN_STATUS_SUCCESS != + if (MLAN_STATUS_FAILURE == woal_stop_bg_scan(priv, MOAL_NO_WAIT)) { ret = -EFAULT; goto done; @@ -17158,7 +20440,8 @@ goto done; #endif len = sprintf(buf, "OK\n") + 1; - } else if (strncmp(buf, "RXFILTER-STOP", strlen("RXFILTER-STOP")) == 0) { + } else if (strncmp(buf, "RXFILTER-STOP", strlen("RXFILTER-STOP")) == + 0) { #ifdef MEF_CFG_RX_FILTER ret = woal_set_rxfilter(priv, MFALSE); if (ret) @@ -17170,8 +20453,8 @@ else if (strncmp(buf, "GET_EVENT", strlen("GET_EVENT")) == 0) { if (IS_STA_CFG80211(cfg80211_wext)) { if (priv->last_event & EVENT_BG_SCAN_REPORT) - woal_inform_bss_from_scan_result(priv, NULL, - MOAL_IOCTL_WAIT); + woal_inform_bss_from_scan_result( + priv, NULL, MOAL_IOCTL_WAIT); } len = sprintf(buf, "EVENT=%d\n", priv->last_event) + 1; priv->last_event = 0; @@ -17224,7 +20507,8 @@ if (MLAN_STATUS_SUCCESS != woal_set_ap_wps_p2p_ie(priv, (t_u8 *)pdata, priv_cmd.used_len - - strlen("SET_AP_WPS_P2P_IE") - 1)) { + strlen("SET_AP_WPS_P2P_IE") - + 1)) { ret = -EFAULT; goto done; } @@ -17234,7 +20518,7 @@ } #endif else if (strncmp(buf, "P2P_DEV_ADDR", strlen("P2P_DEV_ADDR")) == 0) { - memset(buf, 0x0, (size_t) priv_cmd.total_len); + memset(buf, 0x0, (size_t)priv_cmd.total_len); moal_memcpy_ext(priv->phandle, buf, priv->current_addr, ETH_ALEN, (t_u32)priv_cmd.total_len); len = ETH_ALEN; @@ -17242,7 +20526,7 @@ /* TODO * Just return '\0' */ - memset(buf, 0x0, (size_t) priv_cmd.total_len); + memset(buf, 0x0, (size_t)priv_cmd.total_len); *buf = 0; len = 1; } else if (strnicmp(buf, "MIRACAST", strlen("MIRACAST")) == 0) { @@ -17257,7 +20541,7 @@ if (MLAN_STATUS_SUCCESS != woal_set_miracast_mode(priv, (t_u8 *)pdata, priv_cmd.used_len - - strlen("MIRACAST"))) { + strlen("MIRACAST"))) { ret = -EFAULT; goto done; } @@ -17334,6 +20618,20 @@ else if (strncmp(buf, "FAKEMAC", strlen("FAKEMAC")) == 0) { len = woal_priv_config_random_mac(priv, buf, priv_cmd.total_len); + } else if (strncmp(buf, "SETROAMOFFLOAD", strlen("SETROAMOFFLOAD")) == + 0) { + len = woal_priv_set_roam_offload(priv, buf, priv_cmd.total_len); + } else if (strncmp(buf, "SETROAMOFFLAPLIST", + strlen("SETROAMOFFLAPLIST")) == 0) { + len = woal_priv_set_roam_offload_aplist(priv, buf, + priv_cmd.total_len); + } else if (strncmp(buf, "CFGROAMOFFLOAD", strlen("CFGROAMOFFLOAD")) == + 0) { + len = woal_priv_roam_offload_cfg(priv, buf, priv_cmd.total_len); + } else if (strncmp(buf, "SETROAMPASSPHRASE", + strlen("SETROAMPASSPHRASE")) == 0) { + len = woal_priv_set_roam_passphrase(priv, buf, + priv_cmd.total_len); } else if (strncmp(buf, PRIV_CMD_CLOUD_KEEP_ALIVE, strlen(PRIV_CMD_CLOUD_KEEP_ALIVE)) == 0) { len = woal_priv_cloud_keep_alive(priv, buf, priv_cmd.total_len); @@ -17366,7 +20664,7 @@ priv_cmd.used_len = len; if (priv_cmd.used_len <= priv_cmd.total_len) { memset(buf + priv_cmd.used_len, 0, - (size_t) (CMD_BUF_LEN - priv_cmd.used_len)); + (size_t)(CMD_BUF_LEN - priv_cmd.used_len)); if (copy_to_user((void __user *)cmd_buf, buf, priv_cmd.total_len)) { PRINTM(MERROR, @@ -17419,8 +20717,8 @@ * * @return N/A */ -void -wlan_scan_create_brief_table_entry(t_u8 **ppbuffer, BSSDescriptor_t *pbss_desc) +void wlan_scan_create_brief_table_entry(t_u8 **ppbuffer, + BSSDescriptor_t *pbss_desc) { t_u8 *ptmp_buf = *ppbuffer; t_u8 tmp_ssid_hdr[2]; @@ -17443,7 +20741,7 @@ sizeof(pbss_desc->cap_info)); ptmp_buf += sizeof(pbss_desc->cap_info); - tmp_ssid_hdr[0] = 0; /* Element ID for SSID is zero */ + tmp_ssid_hdr[0] = 0; /* Element ID for SSID is zero */ tmp_ssid_hdr[1] = pbss_desc->ssid.ssid_len; moal_memcpy_ext(NULL, ptmp_buf, tmp_ssid_hdr, sizeof(tmp_ssid_hdr), sizeof(tmp_ssid_hdr)); @@ -17455,7 +20753,7 @@ if (pbss_desc->wmm_ie.vend_hdr.element_id == WMM_IE) { ie_len = sizeof(IEEEtypes_Header_t) + - pbss_desc->wmm_ie.vend_hdr.len; + pbss_desc->wmm_ie.vend_hdr.len; moal_memcpy_ext(NULL, ptmp_buf, &pbss_desc->wmm_ie, ie_len, ie_len); ptmp_buf += ie_len; @@ -17464,7 +20762,7 @@ if (pbss_desc->pwpa_ie) { if ((*(pbss_desc->pwpa_ie)).vend_hdr.element_id == WPA_IE) { ie_len = sizeof(IEEEtypes_Header_t) + - (*(pbss_desc->pwpa_ie)).vend_hdr.len; + (*(pbss_desc->pwpa_ie)).vend_hdr.len; moal_memcpy_ext(NULL, ptmp_buf, pbss_desc->pwpa_ie, ie_len, ie_len); } @@ -17474,7 +20772,7 @@ if (pbss_desc->prsn_ie) { if ((*(pbss_desc->prsn_ie)).ieee_hdr.element_id == RSN_IE) { ie_len = sizeof(IEEEtypes_Header_t) + - (*(pbss_desc->prsn_ie)).ieee_hdr.len; + (*(pbss_desc->prsn_ie)).ieee_hdr.len; moal_memcpy_ext(NULL, ptmp_buf, pbss_desc->prsn_ie, ie_len, ie_len); } @@ -17500,9 +20798,8 @@ * * @return MLAN_STATUS_SUCCESS, or < 0 with IOCTL error code */ -int -wlan_get_scan_table_ret_entry(BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer, - int *pspace_left) +int wlan_get_scan_table_ret_entry(BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer, + int *pspace_left) { wlan_ioctl_get_scan_table_entry *prsp_entry; wlan_ioctl_get_scan_table_entry tmp_rsp_entry; @@ -17618,22 +20915,24 @@ * @return 0 --success, otherwise fail */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) -int -woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user * data, - int cmd) +int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, + int cmd) #else -int -woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) #endif + { int ret = 0; ENTER(); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) - if (in_compat_syscall()) /* not implemented yet */ +#ifdef CONFIG_COMPAT +// TODO: Android 14 accepts to use the same implementation as Android 12 for now. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) && !IMX_ANDROID_14) + if (in_compat_syscall()) /* not implemented yet */ return -EOPNOTSUPP; #endif +#endif PRINTM(MINFO, "woal_do_ioctl: ioctl cmd = 0x%x\n", cmd); switch (cmd) {
diff --git a/wlan_sd8987/mlinux/moal_eth_ioctl.h b/wlan_sd8987/mlinux/moal_eth_ioctl.h index ca5a5a2..3013769 100755 --- a/wlan_sd8987/mlinux/moal_eth_ioctl.h +++ b/wlan_sd8987/mlinux/moal_eth_ioctl.h
@@ -4,7 +4,7 @@ * @brief This file contains definition for private IOCTL call. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -110,6 +110,7 @@ #define PRIV_CMD_ASSOCESSID "assocessid" #define PRIV_CMD_ASSOCBSSID "assocessid_bssid" #endif +#define PRIV_CMD_AUTOASSOC "assocctrl" #define PRIV_CMD_WAKEUPREASON "wakeupreason" #ifdef STA_SUPPORT #define PRIV_CMD_LISTENINTERVAL "listeninterval" @@ -213,8 +214,15 @@ #define PRIV_CMD_MPA_CTRL "mpactrl" #endif #define PRIV_CMD_SLEEP_PARAMS "sleepparams" +#define PRIV_CMD_NET_MON "netmon" #define PRIV_CMD_DFS_TESTING "dfstesting" +#define PRIV_CMD_CLEAR_NOP "clear_nop" +#define PRIV_CMD_NOP_LIST "nop_list" +#define PRIV_CMD_FAKE_RADAR "fake_radar" #define PRIV_CMD_DFS53_CFG "dfs53cfg" +#define PRIV_CMD_DFS_MODE "dfs_mode" +#define PRIV_CMD_DFS_CAC "dfs_cac" +#define PRIV_CMD_AUTODFS "autodfs" #define PRIV_CMD_CFP_CODE "cfpcode" #define PRIV_CMD_CWMODE "cwmode" #define PRIV_CMD_ANT_CFG "antcfg" @@ -227,9 +235,9 @@ #ifdef SDIO #define PRIV_CMD_SD_CMD53_RW "sdcmd53rw" #endif -#ifdef RX_PACKET_COALESCE -#define PRIV_CMD_RX_COAL_CFG "rxpktcoal_cfg" -#endif +#define PRIV_CMD_MULTI_CHAN_CFG "mc_cfg" +#define PRIV_CMD_MULTI_CHAN_POLICY "mc_policy" +#define PRIV_CMD_DRCS_CFG "mc_cfg_ext" #ifdef WIFI_DIRECT_SUPPORT #if defined(UAP_CFG80211) #define PRIV_CMD_CFG_NOA "cfg_noa" @@ -238,7 +246,8 @@ #endif #define PRIV_CMD_CFG_CLOCK_SYNC "clocksync" #define PRIV_CMD_CFG_GET_TSF_INFO "gettsfinfo" -#define PRIV_CMD_TRANSITION_CHANNEL "transchan" +#define PRIV_CMD_TARGET_CHANNEL "targetchan" +#define PRIV_CMD_BACKUP_CHANNEL "backupchan" #define PRIV_CMD_DFS_REPEATER_CFG "dfs_repeater" #ifdef WIFI_DIRECT_SUPPORT @@ -283,6 +292,12 @@ /**Private command ID to set/get independent reset*/ #define PRIV_CMD_IND_RST_CFG "indrstcfg" +#define PRIV_CMD_MCAST_AGGR_GROUP "mcast_aggr_group" +#define PRIV_CMD_MC_AGGR_CFG "mc_aggr_cfg" +#define PRIV_CMD_STATS "stats" +#define PRIV_CMD_CH_LOAD "getchload" +#define PRIV_CMD_CH_LOAD_RESULTS "getloadresults" + #define PRIV_CMD_ARB_CFG "arb" /**Private command to configure static rx abort config */ @@ -304,6 +319,7 @@ #define PRIV_CMD_CCK_DESENSE_CFG "cck_desense_cfg" #define PRIV_CMD_DOT11MC_UNASSOC_FTM_CFG "dot11mc_unassoc_ftm_cfg" #define PRIV_CMD_HAL_PHY_CFG "hal_phy_cfg" +#define PRIV_CMD_IPS_CFG "ips_cfg" /** Private command ID for Android default commands */ #define WOAL_ANDROID_DEF_CMD (SIOCDEVPRIVATE + 1) @@ -334,11 +350,11 @@ typedef struct _ssu_params_cfg { /* ssu mode */ t_u8 ssu_mode; - /* 0-3; # of FFT samples to skip */ + /* 0-3; # of FFT samples to skip*/ t_u32 nskip; /* 0-3: # of FFT samples selected to dump */ t_u32 nsel; - /* 0-3: Down sample ADC input for buffering */ + /* 0-3: Down sample ADC input for buffering*/ t_u32 adcdownsample; /* 0-1: Mask out ADC Data from spectral packet */ t_u32 mask_adc_pkt; @@ -351,11 +367,19 @@ /* 0-7: Number of spectral packets over which spectral data is to be * averaged. */ t_u32 n_pkt_avg; -} __attribute__ ((packed)) ssu_params_cfg; +} __attribute__((packed)) ssu_params_cfg; #endif +#define PRIV_CMD_CSI "csi" + #define PRIV_CMD_BOOTSLEEP "bootsleep" +/** Private command ID to config txwatchdog enable/disable */ +#define PRIV_CMD_TXWATCHDOG "txwatchdog" + +/** Private command to get secure boot uuid */ +#define PRIV_CMD_GET_SB_UUID "getuuid" + /** Private command: 11AX Cfg */ #define PRIV_CMD_11AXCFG "11axcfg" /** Private command: 11AX Cmd */ @@ -370,7 +394,7 @@ #define PRIV_CMD_LPM "lpm" #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) -int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user * data, +int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, int cmd); #else int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); @@ -391,8 +415,7 @@ int used_len; /** buffer sent by application */ int total_len; -} __attribute__ ((packed)) - android_wifi_priv_cmd; +} __attribute__((packed)) android_wifi_priv_cmd; #else typedef struct _android_wifi_priv_cmd { /** Buffer pointer */ @@ -412,18 +435,18 @@ #define MW_ESSID_MAX_SIZE 32 /* Modes of operation */ -#define MW_MODE_AUTO 0 /* Let the driver decides */ -#define MW_MODE_ADHOC 1 /* Single cell network */ -#define MW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ -#define MW_MODE_MASTER 3 /* Synchronisation master or Access Point */ -#define MW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ -#define MW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ -#define MW_MODE_MONITOR 6 /* Passive monitor (listen only) */ -#define MW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ +#define MW_MODE_AUTO 0 /* Let the driver decides */ +#define MW_MODE_ADHOC 1 /* Single cell network */ +#define MW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ +#define MW_MODE_MASTER 3 /* Synchronisation master or Access Point */ +#define MW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ +#define MW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ +#define MW_MODE_MONITOR 6 /* Passive monitor (listen only) */ +#define MW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ -#define MW_POWER_TYPE 0xF000 /* Type of parameter */ -#define MW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ -#define MW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ +#define MW_POWER_TYPE 0xF000 /* Type of parameter */ +#define MW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ +#define MW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ #define MW_AUTH_INDEX 0x0FFF #define MW_AUTH_FLAGS 0xF000 @@ -454,10 +477,10 @@ /* Generic format for most parameters that fit in an int */ struct mw_param { - t_s32 value; /* The value of the parameter itself */ - t_u8 fixed; /* Hardware should not use auto select */ - t_u8 disabled; /* Disable the feature */ - t_u16 flags; /* Various specifc flags (if any) */ + t_s32 value; /* The value of the parameter itself */ + t_u8 fixed; /* Hardware should not use auto select */ + t_u8 disabled; /* Disable the feature */ + t_u16 flags; /* Various specifc flags (if any) */ }; /* @@ -465,9 +488,9 @@ * pointer to memory allocated in user space. */ struct mw_point { - t_u8 *pointer; /* Pointer to the data (in user space) */ - t_u16 length; /* number of fields or size in bytes */ - t_u16 flags; /* Optional params */ + t_u8 *pointer; /* Pointer to the data (in user space) */ + t_u16 length; /* number of fields or size in bytes */ + t_u16 flags; /* Optional params */ }; /* @@ -478,18 +501,18 @@ /* Config - generic */ char name[IFNAMSIZ]; - struct mw_point essid; /* Extended network name */ - t_u32 mode; /* Operation mode */ - struct mw_param power; /* PM duration/timeout */ - struct sockaddr ap_addr; /* Access point address */ - struct mw_param param; /* Other small parameters */ - struct mw_point data; /* Other large parameters */ + struct mw_point essid; /* Extended network name */ + t_u32 mode; /* Operation mode */ + struct mw_param power; /* PM duration/timeout */ + struct sockaddr ap_addr; /* Access point address */ + struct mw_param param; /* Other small parameters */ + struct mw_point data; /* Other large parameters */ }; /* The structure to exchange data for ioctl */ struct mwreq { union { - char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ } ifr_ifrn; /* Data part */ @@ -509,83 +532,103 @@ t_u32 rx_amsdu; } woal_addba; +/** Action field value : get */ +#define ACTION_GET 0 +/** Action field value : set */ +#define ACTION_SET 1 +/** Action field value: add */ +#define ACTION_ADD 2 +/** Action field value: remove */ +#define ACTION_REMOVE 3 + +#define MC_AGGR_CTRL MBIT(0) +/* mcast_aggr_group */ +typedef struct _mcast_aggr_group { + /** action */ + t_u32 action; + /** mcast addr */ + t_u8 mcast_addr[ETH_ALEN]; + /** Number of multicast addresses in the list */ + t_u32 num_mcast_addr; + /** Multicast address list */ + mlan_802_11_mac_addr mac_list[MLAN_MAX_MULTICAST_LIST_SIZE]; +} mcast_aggr_group, *pmcast_aggr_group; + typedef struct _txrate_setting { - t_u16 preamble:2; /*BIT1-BIT0: - * For legacy 11b: preamble type - * 00 = long - * 01 = short - * 10/11 = reserved - * For legacy 11g: reserved - * For 11n: Green field PPDU indicator - * 00 = HT-mix - * 01 = HT-GF - * 10/11 = reserved. - * For 11ac: reserved. - * For 11ax: - * 00 = HE-SU - * 01 = HE-EXT-SU - * 10 = HE-MU - * 11 = HE trigger based - */ - t_u16 bandwidth:3; /* BIT2- BIT4 - * For 11n and 11ac traffic: Bandwidth - * 0 = 20Mhz - * 1 = 40Mhz - * 2 = 80 Mhz - * 3 = 160 Mhz - * 4-7 = reserved - * For legacy rate : BW>0 implies non-HT duplicates. - * For HE SU PPDU: - * 0 = 20Mhz - * 1 = 40Mhz - * 2 = 80 Mhz - * 3 = 160 Mhz - * 4-7 = reserved - * For HE ER SU PPDU: - * 0 = 242-tone RU - * 1 = upper frequency 106 tone RU within the primary 20 Mhz. - * For HE MU PPDU: - * 0 = 20Mhz. - * 1 = 40Mhz. - * 2 = 80Mhz non-preamble puncturing mode - * 3 = 160Mhz and 80+80 Mhz non-preamble. - * 4 = for preemble puncturing in 80 Mhz , - * where in the preamble only the secondary 20Mhz is punctured. - * 5 = for preemble puncturing in 80 Mhz , - * where in the preamble only one of the two 20Mhz subchannels in the secondary 40Mhz is punctured. - * 6 = for preemble puncturing in 160 Mhz or 80 Mhz + 80 Mhz, - * where in the primary 80 Mhz of the preamble only the secondary 20 Mhz is punctured. - * 7 = for preemble puncturing in 160 Mhz or 80 Mhz + 80 Mhz, - * where in the primary 80 Mhz of the preamble the primary 40 Mhz is present. - */ - t_u16 shortGI:2; /*BIT5- BIT6 - * For legacy: not used - * For 11n: 00 = normal, 01 =shortGI, 10/11 = reserved - * For 11ac: SGI map to VHT-SIG-A2[0] - * VHT-SIG-A2[1] is set to 1 if short guard interval is used - * and NSYM mod 10 = 9, otherwise set to 0. - * For 11ax: - * 00 = 1xHELTF+GI0.8usec - * 01 = 2xHELTF+GI0.8usec - * 10 = 2xHELTF+GI1.6usec - * 11 = 4xHELTF+GI0.8 usec if both DCM and STBC are 1 - * 4xHELTF+GI3.2 usec otherwise - */ - t_u16 stbc:1; // BIT7, 0: no STBC; 1: STBC - t_u16 dcm:1; // BIT8, 0: no DCM; 1: DCM used. - t_u16 adv_coding:1; // BIT9, 0: BCC; 1: LDPC. - t_u16 doppler:2; /* BIT11-BIT10, - 00: Doppler0 - 01: Doppler 1 with Mma =10 - 10: Doppler 1 with Mma =20 - */ - t_u16 max_pktext:2; /*BIT12-BIT13: - * Max packet extension - * 0 - 0 usec - * 1 - 8 usec - * 2 - 16 usec. - */ - t_u16 reserverd:2; // BIT14-BIT15 + t_u16 preamble : 2; /*BIT1-BIT0: + * For legacy 11b: preamble type + * 00 = long + * 01 = short + * 10/11 = reserved + * For legacy 11g: reserved + * For 11n: Green field PPDU indicator + * 00 = HT-mix + * 01 = HT-GF + * 10/11 = reserved. + * For 11ac: reserved. + * For 11ax: + * 00 = HE-SU + * 01 = HE-EXT-SU + * 10 = HE-MU + * 11 = HE trigger based + */ + t_u16 bandwidth : 3; /* BIT2- BIT4 + * For 11n and 11ac traffic: Bandwidth + * 0 = 20Mhz + * 1 = 40Mhz + * 2 = 80 Mhz + * 3 = 160 Mhz + * 4-7 = reserved + * For legacy rate : BW>0 implies non-HT + * duplicates. For HE SU PPDU: 0 = 20Mhz 1 = 40Mhz + * 2 = 80 Mhz + * 3 = 160 Mhz + * 4-7 = reserved + * For HE ER SU PPDU: + * 0 = 242-tone RU + * 1 = upper frequency 106 tone RU within the + * primary 20 Mhz. For HE MU PPDU: 0 = 20Mhz. 1 = + * 40Mhz. 2 = 80Mhz non-preamble puncturing mode 3 + * = 160Mhz and 80+80 Mhz non-preamble. 4 = for + * preemble puncturing in 80 Mhz , where in the + * preamble only the secondary 20Mhz is punctured. + * 5 = for preemble puncturing in 80 Mhz , + * where in the preamble only one of the two + * 20Mhz subchannels in the secondary 40Mhz is + * punctured. 6 = for preemble puncturing in 160 + * Mhz or 80 Mhz + 80 Mhz, where in the primary 80 + * Mhz of the preamble only the secondary 20 Mhz is + * punctured. 7 = for preemble puncturing in 160 + * Mhz or 80 Mhz + 80 Mhz, where in the primary 80 + * Mhz of the preamble the primary 40 Mhz is + * present. + */ + t_u16 shortGI : 2; /*BIT5- BIT6 + * For legacy: not used + * For 11n: 00 = normal, 01 =shortGI, 10/11 = + * reserved For 11ac: SGI map to VHT-SIG-A2[0] + * VHT-SIG-A2[1] is set to 1 if short guard + * interval is used and NSYM mod 10 = 9, otherwise + * set to 0. For 11ax: 00 = 1xHELTF+GI0.8usec 01 = + * 2xHELTF+GI0.8usec 10 = 2xHELTF+GI1.6usec 11 = + * 4xHELTF+GI0.8 usec if both DCM and STBC are 1 + * 4xHELTF+GI3.2 usec otherwise + */ + t_u16 stbc : 1; // BIT7, 0: no STBC; 1: STBC + t_u16 dcm : 1; // BIT8, 0: no DCM; 1: DCM used. + t_u16 adv_coding : 1; // BIT9, 0: BCC; 1: LDPC. + t_u16 doppler : 2; /* BIT11-BIT10, + 00: Doppler0 + 01: Doppler 1 with Mma =10 + 10: Doppler 1 with Mma =20 + */ + t_u16 max_pktext : 2; /*BIT12-BIT13: + * Max packet extension + * 0 - 0 usec + * 1 - 8 usec + * 2 - 16 usec. + */ + t_u16 reserverd : 2; // BIT14-BIT15 } __ATTRIB_PACK__ txrate_setting; /** data structure for cmd txratecfg */
diff --git a/wlan_sd8987/mlinux/moal_init.c b/wlan_sd8987/mlinux/moal_init.c index 628e792..cdc57a3 100755 --- a/wlan_sd8987/mlinux/moal_init.c +++ b/wlan_sd8987/mlinux/moal_init.c
@@ -4,7 +4,7 @@ * driver. * * - * Copyright 2018-2021 NXP + * Copyright 2018-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -29,6 +29,7 @@ static char *fw_name; static int req_fw_nowait; int fw_reload; +int auto_fw_reload; static char *hw_name; @@ -41,6 +42,7 @@ /** Mfg mode */ int mfg_mode; #endif +int rf_test_mode; #if defined(SDIO) /** SDIO interrupt mode (0: INT_MODE_SDIO, 1: INT_MODE_GPIO) */ @@ -58,13 +60,18 @@ static int beacon_hints; #endif #endif +static int cfg80211_drcs; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -static int host_mlme; +static int host_mlme = 1; #endif #endif +static int roamoffload_in_hs; + +static int drcs_chantime_mode; + /** Auto deep sleep */ static int auto_ds; @@ -127,7 +134,24 @@ static int slew_rate = 3; #endif int tx_work = 0; + +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) +/** + * RPS to steer packets to specific CPU + * Default value of 0 keeps rps disabled by default + */ static int rps = 0; + +/** + * rps cpu mask + * rps can be configure to any value between 0x1 - 0xf + * ex: value of 0x3(0011) indicates to use cpu-0 and cpu-1 + */ +#define RPS_CPU_MASK 0xf +#endif +#endif + static int tx_skb_clone = 0; #ifdef IMX_SUPPORT static int pmqos = 1; @@ -135,6 +159,9 @@ static int pmqos = 0; #endif +static int chan_track = 0; +static int mcs32 = 1; + #if defined(STA_SUPPORT) /** 802.11d configuration */ static int cfg_11d; @@ -301,6 +328,9 @@ #ifdef SD9177 {CARD_TYPE_SD9177, 0, CARD_SD9177}, #endif +#ifdef SDNW62X + {CARD_TYPE_SDNW62X, 0, CARD_SDNW62X}, +#endif #ifdef PCIE8897 {CARD_TYPE_PCIE8897, 0, CARD_PCIE8897}, #endif @@ -313,6 +343,9 @@ #ifdef PCIE9098 {CARD_TYPE_PCIE9098, 0, CARD_PCIE9098}, #endif +#ifdef PCIENW62X + {CARD_TYPE_PCIENW62X, 0, CARD_PCIENW62X}, +#endif #ifdef USB8801 {CARD_TYPE_USB8801, 0, CARD_USB8801}, #endif @@ -332,10 +365,16 @@ #ifdef USB9097 {CARD_TYPE_USB9097, 0, CARD_USB9097}, #endif +#ifdef USBNW62X + {CARD_TYPE_USBNW62X, 0, CARD_USBNW62X}, +#endif + }; static int dfs53cfg = DFS_W53_DEFAULT_FW; +static int keep_previous_scan = 1; + /** * @brief This function read a line in module parameter file * @@ -344,16 +383,15 @@ * @param line_pos A pointer to offset of current line * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static t_size -parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos) +static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos) { t_u8 *src, *dest; static t_s32 pos; ENTER(); - if (pos >= (t_s32)size) { /* reach the end */ - pos = 0; /* Reset position for rfkill */ + if (pos >= (t_s32)size) { /* reach the end */ + pos = 0; /* Reset position for rfkill */ LEAVE(); return -1; } @@ -362,7 +400,7 @@ dest = line_pos; while (pos < (t_s32)size && *src != '\x0A' && *src != '\0') { - if (*src != ' ' && *src != '\t') /* parse space */ + if (*src != ' ' && *src != '\t') /* parse space */ *dest++ = *src++; else src++; @@ -383,8 +421,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static void -woal_dup_string(char **dst, char *src) +static void woal_dup_string(char **dst, char *src) { size_t len = 0; if (src) { @@ -412,8 +449,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -parse_line_read_int(t_u8 *line, int *out_data) +static mlan_status parse_line_read_int(t_u8 *line, int *out_data) { t_u8 *p = NULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -443,8 +479,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -parse_line_read_string(t_u8 *line, char **out_str) +static mlan_status parse_line_read_string(t_u8 *line, char **out_str) { t_u8 *p = NULL, *pstr = NULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -481,8 +516,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -parse_line_read_card_info(t_u8 *line, char **type, char **if_id) +static mlan_status parse_line_read_card_info(t_u8 *line, char **type, + char **if_id) { t_u8 *p = NULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -520,8 +555,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -parse_cfg_read_block(t_u8 *data, t_u32 size, moal_handle *handle) +static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, + moal_handle *handle) { int out_data = 0, end = 0; char *out_str = NULL; @@ -546,10 +581,11 @@ moal_extflg_clear(handle, EXT_HW_TEST); PRINTM(MMSG, "hw_test %s\n", moal_extflg_isset(handle, EXT_HW_TEST) ? "on" : - "off"); + "off"); } #ifdef CONFIG_OF - else if (strncmp(line, "dts_enable", strlen("dts_enable")) == 0) { + else if (strncmp(line, "dts_enable", strlen("dts_enable")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -559,7 +595,8 @@ moal_extflg_clear(handle, EXT_DTS_ENABLE); PRINTM(MMSG, "dts_enable %s\n", moal_extflg_isset(handle, EXT_DTS_ENABLE) ? - "on" : "off"); + "on" : + "off"); } #endif else if (strncmp(line, "fw_name", strlen("fw_name")) == 0) { @@ -579,14 +616,25 @@ moal_extflg_clear(handle, EXT_REQ_FW_NOWAIT); PRINTM(MMSG, "req fw nowait %s\n", moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT) ? - "on" : "off"); - } else if (strncmp(line, "fw_reload", strlen("fw_reload")) == 0) { + "on" : + "off"); + } else if (strncmp(line, "fw_reload", strlen("fw_reload")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; params->fw_reload = out_data; PRINTM(MMSG, "fw_reload %d\n", params->fw_reload); - } else if (strncmp(line, "fw_serial", strlen("fw_serial")) == 0) { + } else if (strncmp(line, "auto_fw_reload", + strlen("auto_fw_reload")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->auto_fw_reload = out_data; + PRINTM(MMSG, "auto_fw_reload %d\n", + params->auto_fw_reload); + } else if (strncmp(line, "fw_serial", strlen("fw_serial")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -596,7 +644,8 @@ moal_extflg_clear(handle, EXT_FW_SERIAL); PRINTM(MMSG, "fw_serial %s\n", moal_extflg_isset(handle, EXT_FW_SERIAL) ? - "on" : "off"); + "on" : + "off"); } else if (strncmp(line, "hw_name", strlen("hw_name")) == 0) { if (parse_line_read_string(line, &out_str) != MLAN_STATUS_SUCCESS) @@ -619,7 +668,15 @@ PRINTM(MMSG, "mfg_mode = %d\n", params->mfg_mode); } #endif - else if (strncmp(line, "drv_mode", strlen("drv_mode")) == 0) { + else if (strncmp(line, "rf_test_mode", + strlen("rf_test_mode")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->rf_test_mode = out_data; + PRINTM(MMSG, "rf_test_mode = %d\n", + params->rf_test_mode); + } else if (strncmp(line, "drv_mode", strlen("drv_mode")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -698,8 +755,8 @@ goto err; params->net_rx = out_data; PRINTM(MMSG, "net_rx = %d\n", params->net_rx); - } else if (strncmp(line, "amsdu_deaggr", strlen("amsdu_deaggr")) - == 0) { + } else if (strncmp(line, "amsdu_deaggr", + strlen("amsdu_deaggr")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -758,7 +815,7 @@ moal_extflg_clear(handle, EXT_INTMODE); PRINTM(MMSG, "intmode %s\n", moal_extflg_isset(handle, EXT_INTMODE) ? "on" : - "off"); + "off"); } else if (strncmp(line, "gpiopin", strlen("gpiopin")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) @@ -778,11 +835,12 @@ moal_extflg_clear(handle, EXT_PM_KEEP_POWER); PRINTM(MMSG, "pm_keep_power %s\n", moal_extflg_isset(handle, EXT_PM_KEEP_POWER) ? - "on" : "off"); + "on" : + "off"); } #if defined(SDIO) && defined(SDIO_SUSPEND_RESUME) - else if (strncmp(line, "shutdown_hs", - strlen("shutdown_hs")) == 0) { + else if (strncmp(line, "shutdown_hs", strlen("shutdown_hs")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -792,7 +850,8 @@ moal_extflg_clear(handle, EXT_SHUTDOWN_HS); PRINTM(MMSG, "shutdown_hs %s\n", moal_extflg_isset(handle, EXT_SHUTDOWN_HS) ? - "on" : "off"); + "on" : + "off"); } #endif #if defined(STA_SUPPORT) @@ -876,7 +935,7 @@ #if defined(USB) else if (IS_USB(handle->card_type) && strncmp(line, "skip_fwdnld", strlen("skip_fwdnld")) == - 0) { + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -886,7 +945,8 @@ moal_extflg_clear(handle, EXT_SKIP_FWDNLD); PRINTM(MMSG, "skip_fwdnld %s\n", moal_extflg_isset(handle, EXT_SKIP_FWDNLD) ? - "on" : "off"); + "on" : + "off"); } #endif else if (strncmp(line, "wq_sched_prio", @@ -921,7 +981,8 @@ moal_extflg_clear(handle, EXT_AGGR_CTRL); PRINTM(MMSG, "aggrctrl %s\n", moal_extflg_isset(handle, EXT_AGGR_CTRL) ? - "on" : "off"); + "on" : + "off"); } #ifdef USB else if (IS_USB(handle->card_type) && @@ -944,8 +1005,8 @@ PRINTM(MMSG, "pcie_int_mode=%d\n", params->pcie_int_mode); } else if (IS_PCIE(handle->card_type) && - strncmp(line, "ring_size", - strlen("ring_size")) == 0) { + strncmp(line, "ring_size", strlen("ring_size")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -964,7 +1025,8 @@ moal_extflg_clear(handle, EXT_LOW_PW_MODE); PRINTM(MMSG, "low_power_mode_enable %s\n", moal_extflg_isset(handle, EXT_LOW_PW_MODE) ? - "on" : "off"); + "on" : + "off"); } #ifdef ANDROID_KERNEL else if (strncmp(line, "wakelock_timeout", @@ -997,10 +1059,10 @@ moal_extflg_clear(handle, EXT_SDIO_RX_AGGR); PRINTM(MMSG, "sdio_rx_aggr %s\n", moal_extflg_isset(handle, EXT_SDIO_RX_AGGR) ? - "on" : "off"); + "on" : + "off"); } #endif -#if defined(SD8997) || defined(PCIE8997) || defined(USB8997) || defined(SD8977) || defined(SD8987) || defined(SD9098) || defined(USB9098) || defined(PCIE9098) || defined(SD9097) || defined(USB9097) || defined(PCIE9097) || defined(SD8978) || defined(SD9177) else if (strncmp(line, "pmic", strlen("pmic")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) @@ -1011,10 +1073,8 @@ moal_extflg_clear(handle, EXT_PMIC); PRINTM(MMSG, "pmic %s\n", moal_extflg_isset(handle, EXT_PMIC) ? "on" : - "off"); - } -#endif - else if (strncmp(line, "antcfg", strlen("antcfg")) == 0) { + "off"); + } else if (strncmp(line, "antcfg", strlen("antcfg")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1058,7 +1118,8 @@ PRINTM(MMSG, "disconnect_on_suspend %s\n", moal_extflg_isset(handle, EXT_DISCONNECT_ON_SUSPEND) ? - "on" : "off"); + "on" : + "off"); } else if (strncmp(line, "hs_mimo_switch", strlen("hs_mimo_switch")) == 0) { if (parse_line_read_int(line, &out_data) != @@ -1070,8 +1131,10 @@ moal_extflg_clear(handle, EXT_HS_MIMO_SWITCH); PRINTM(MMSG, "hs_mimo_switch %s\n", moal_extflg_isset(handle, EXT_HS_MIMO_SWITCH) ? - "on" : "off"); - } else if (strncmp(line, "indrstcfg", strlen("indrstcfg")) == 0) { + "on" : + "off"); + } else if (strncmp(line, "indrstcfg", strlen("indrstcfg")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1088,7 +1151,8 @@ moal_extflg_clear(handle, EXT_FIX_BCN_BUF); PRINTM(MMSG, "fixed_beacon_buffer %s\n", moal_extflg_isset(handle, EXT_FIX_BCN_BUF) ? - "on" : "off"); + "on" : + "off"); } #ifdef WIFI_DIRECT_SUPPORT else if (strncmp(line, "GoAgeoutTime", @@ -1115,7 +1179,8 @@ goto err; params->multi_dtim = out_data; PRINTM(MMSG, "multi_dtim=%d\n", params->multi_dtim); - } else if (strncmp(line, "inact_tmo", strlen("inact_tmo")) == 0) { + } else if (strncmp(line, "inact_tmo", strlen("inact_tmo")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1131,7 +1196,7 @@ moal_extflg_clear(handle, EXT_NAPI); PRINTM(MMSG, "napi %s\n", moal_extflg_isset(handle, EXT_NAPI) ? "on" : - "off"); + "off"); } else if (strncmp(line, "tx_work", strlen("tx_work")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) @@ -1142,20 +1207,23 @@ moal_extflg_clear(handle, EXT_TX_WORK); PRINTM(MMSG, "tx_work %s\n", moal_extflg_isset(handle, EXT_TX_WORK) ? "on" : - "off"); - } else if (strncmp(line, "rps", strlen("rps")) == 0) { + "off"); + } +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + else if (strncmp(line, "rps", strlen("rps")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; - if (out_data) - moal_extflg_set(handle, EXT_RPS); - else - moal_extflg_clear(handle, EXT_RPS); - PRINTM(MMSG, "rps %s\n", - moal_extflg_isset(handle, EXT_RPS) ? "on" : - "off"); - } else if (strncmp(line, "tx_skb_clone", strlen("tx_skb_clone")) - == 0) { + + handle->params.rps = out_data & RPS_CPU_MASK; + PRINTM(MMSG, "rps set to %x from cfg\n", + handle->params.rps); + } +#endif +#endif + else if (strncmp(line, "tx_skb_clone", + strlen("tx_skb_clone")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1164,9 +1232,9 @@ else moal_extflg_clear(handle, EXT_TX_SKB_CLONE); PRINTM(MMSG, "tx_skb_clone %s\n", - moal_extflg_isset(handle, - EXT_TX_SKB_CLONE) ? "on" : - "off"); + moal_extflg_isset(handle, EXT_TX_SKB_CLONE) ? + "on" : + "off"); } else if (strncmp(line, "pmqos", strlen("pmqos")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) @@ -1177,7 +1245,7 @@ moal_extflg_clear(handle, EXT_PMQOS); PRINTM(MMSG, "pmqos %s\n", moal_extflg_isset(handle, EXT_PMQOS) ? "on" : - "off"); + "off"); } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) else if (strncmp(line, "dfs_offload", strlen("dfs_offload")) == @@ -1191,9 +1259,47 @@ moal_extflg_clear(handle, EXT_DFS_OFFLOAD); PRINTM(MMSG, "dfs_offload %s\n", moal_extflg_isset(handle, EXT_DFS_OFFLOAD) ? - "on" : "off"); + "on" : + "off"); } #endif + else if (strncmp(line, "cfg80211_drcs", + strlen("cfg80211_drcs")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + if (out_data) + moal_extflg_set(handle, EXT_CFG80211_DRCS); + else + moal_extflg_clear(handle, EXT_CFG80211_DRCS); + PRINTM(MMSG, "cfg80211_drcs %s\n", + moal_extflg_isset(handle, EXT_CFG80211_DRCS) ? + "on" : + "off"); + } else if (strncmp(line, "drcs_chantime_mode", + strlen("drcs_chantime_mode")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->drcs_chantime_mode = out_data; + PRINTM(MMSG, "drcs_chantime_mode=%d\n", + params->drcs_chantime_mode); + } else if (strncmp(line, "roamoffload_in_hs", + strlen("roamoffload_in_hs")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + if (out_data) + moal_extflg_set(handle, EXT_ROAMOFFLOAD_IN_HS); + else + moal_extflg_clear(handle, + EXT_ROAMOFFLOAD_IN_HS); + PRINTM(MMSG, "roamoffload_in_hs %s\n", + moal_extflg_isset(handle, + EXT_ROAMOFFLOAD_IN_HS) ? + "on" : + "off"); + } #if defined(STA_CFG80211) || defined(UAP_CFG80211) else if (strncmp(line, "disable_regd_by_driver", strlen("disable_regd_by_driver")) == 0) { @@ -1209,7 +1315,8 @@ PRINTM(MMSG, "reg domain set by driver=%s\n", moal_extflg_isset(handle, EXT_DISABLE_REGD_BY_DRIVER) ? - "enable" : "disable"); + "enable" : + "disable"); } else if (strncmp(line, "reg_alpha2", strlen("reg_alpha2")) == 0) { if (parse_line_read_string(line, &out_str) != @@ -1232,7 +1339,8 @@ PRINTM(MMSG, "country_ie_ignore=%s\n", moal_extflg_isset(handle, EXT_COUNTRY_IE_IGNORE) ? - "on" : "off"); + "on" : + "off"); } else if (strncmp(line, "beacon_hints", strlen("beacon_hints")) == 0) { if (parse_line_read_int(line, &out_data) != @@ -1244,7 +1352,8 @@ moal_extflg_clear(handle, EXT_BEACON_HINTS); PRINTM(MMSG, "beacon_hints=%s\n", moal_extflg_isset(handle, EXT_BEACON_HINTS) ? - "enable" : "disable"); + "enable" : + "disable"); } #endif #endif @@ -1256,7 +1365,8 @@ goto err; params->uap_max_sta = out_data; PRINTM(MMSG, "uap_max_sta=%d\n", params->uap_max_sta); - } else if (strncmp(line, "wacp_mode", strlen("wacp_mode")) == 0) { + } else if (strncmp(line, "wacp_mode", strlen("wacp_mode")) == + 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1264,6 +1374,13 @@ PRINTM(MMSG, "wacp_moe=%d\n", params->wacp_mode); } #endif + else if (strncmp(line, "mcs32", strlen("mcs32")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->mcs32 = out_data; + PRINTM(MMSG, "mcs32=%d\n", params->mcs32); + } #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) else if (strncmp(line, "host_mlme", strlen("host_mlme")) == 0) { @@ -1276,7 +1393,8 @@ moal_extflg_clear(handle, EXT_HOST_MLME); PRINTM(MMSG, "host_mlme=%s\n", moal_extflg_isset(handle, EXT_HOST_MLME) ? - "enable" : "disable"); + "enable" : + "disable"); } #endif #endif @@ -1286,6 +1404,25 @@ goto err; params->dfs53cfg = out_data; PRINTM(MMSG, "dfs53cfg= %d\n", params->dfs53cfg); + } else if (strncmp(line, "chan_track", strlen("chan_track")) == + 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + if (out_data) + moal_extflg_set(handle, EXT_CHAN_TRACK); + + PRINTM(MMSG, "chan_track= %s\n", + moal_extflg_isset(handle, EXT_PMQOS) ? "on" : + "off"); + } else if (strncmp(line, "keep_previous_scan", + strlen("keep_previous_scan")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->keep_previous_scan = out_data; + PRINTM(MMSG, "keep_previous_scan=%d\n", + params->keep_previous_scan); } } if (end) @@ -1304,8 +1441,7 @@ * * @return N/A */ -static void -woal_setup_module_param(moal_handle *handle, moal_mod_para * params) +static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) { if (hw_test) moal_extflg_set(handle, EXT_HW_TEST); @@ -1327,6 +1463,10 @@ } if (params) handle->params.fw_reload = params->fw_reload; + + handle->params.auto_fw_reload = auto_fw_reload; + if (params) + handle->params.auto_fw_reload = params->auto_fw_reload; if (fw_serial) moal_extflg_set(handle, EXT_FW_SERIAL); woal_dup_string(&handle->params.hw_name, hw_name); @@ -1341,6 +1481,10 @@ if (params) handle->params.mfg_mode = params->mfg_mode; #endif + handle->params.rf_test_mode = rf_test_mode; + if (params) + handle->params.rf_test_mode = params->rf_test_mode; + handle->params.drv_mode = drv_mode; if (params) handle->params.drv_mode = params->drv_mode; @@ -1363,11 +1507,13 @@ woal_dup_string(&handle->params.uap_name, uap_name); handle->params.uap_max_sta = uap_max_sta; handle->params.wacp_mode = wacp_mode; + handle->params.mcs32 = mcs32; if (params) { handle->params.max_uap_bss = params->max_uap_bss; woal_dup_string(&handle->params.uap_name, params->uap_name); handle->params.uap_max_sta = params->uap_max_sta; handle->params.wacp_mode = params->wacp_mode; + handle->params.mcs32 = params->mcs32; } #endif /* UAP_SUPPORT */ #ifdef WIFI_DIRECT_SUPPORT @@ -1505,10 +1651,8 @@ if (sdio_rx_aggr) moal_extflg_set(handle, EXT_SDIO_RX_AGGR); #endif -#if defined(SD8997) || defined(PCIE8997) || defined(USB8997) || defined(SD8977) || defined(SD8987) || defined(SD9098) || defined(USB9098) || defined(PCIE9098) || defined(SD9097) || defined(USB9097) || defined(PCIE9097) || defined(SD8978) || defined(SD9177) if (pmic) moal_extflg_set(handle, EXT_PMIC); -#endif handle->params.antcfg = antcfg; if (params) handle->params.antcfg = params->antcfg; @@ -1548,23 +1692,39 @@ moal_extflg_set(handle, EXT_NAPI); if (tx_work) moal_extflg_set(handle, EXT_TX_WORK); - if (rps) - moal_extflg_set(handle, EXT_RPS); + +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + handle->params.rps = rps & RPS_CPU_MASK; + PRINTM(MMSG, "rps set to %x from module param\n", handle->params.rps); +#endif +#endif + if (tx_skb_clone) moal_extflg_set(handle, EXT_TX_SKB_CLONE); if (pmqos) moal_extflg_set(handle, EXT_PMQOS); + if (chan_track) + moal_extflg_set(handle, EXT_CHAN_TRACK); + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (dfs_offload) moal_extflg_set(handle, EXT_DFS_OFFLOAD); #endif + if (roamoffload_in_hs) + moal_extflg_set(handle, EXT_ROAMOFFLOAD_IN_HS); #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (host_mlme) moal_extflg_set(handle, EXT_HOST_MLME); #endif #endif + if (cfg80211_drcs) + moal_extflg_set(handle, EXT_CFG80211_DRCS); + handle->params.drcs_chantime_mode = drcs_chantime_mode; + if (params) + handle->params.drcs_chantime_mode = params->drcs_chantime_mode; #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (disable_regd_by_driver) moal_extflg_set(handle, EXT_DISABLE_REGD_BY_DRIVER); @@ -1584,7 +1744,7 @@ params->ext_flgs, sizeof(params->ext_flgs), sizeof(handle->params.ext_flgs)); - /* do some special handle for MFG mode */ + /* do some special handle for MFG mode */ #ifdef MFG_CMD_SUPPORT if (handle->params.mfg_mode) { #if defined(STA_WEXT) || defined(UAP_WEXT) @@ -1603,6 +1763,7 @@ if (params) handle->params.dfs53cfg = params->dfs53cfg; } + handle->params.keep_previous_scan = keep_previous_scan; } /** @@ -1612,8 +1773,7 @@ * * @return N/A */ -void -woal_free_module_param(moal_handle *handle) +void woal_free_module_param(moal_handle *handle) { moal_mod_para *params = &handle->params; PRINTM(MMSG, "Free module params\n"); @@ -1686,8 +1846,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_req_mod_param(moal_handle *handle, char *mod_file) +static mlan_status woal_req_mod_param(moal_handle *handle, char *mod_file) { mlan_status ret = MLAN_STATUS_SUCCESS; struct device *dev = handle->hotplug_device; @@ -1714,8 +1873,7 @@ * * @return N/A */ -void -woal_init_from_dev_tree(void) +void woal_init_from_dev_tree(void) { struct device_node *dt_node = NULL; struct property *prop; @@ -1734,7 +1892,7 @@ LEAVE(); return; } - for_each_property_of_node(dt_node, prop) { + for_each_property_of_node (dt_node, prop) { if (!strncmp(prop->name, "drv_mode", strlen("drv_mode"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "drv_mode=0x%x\n", data); @@ -1762,7 +1920,8 @@ } } #if defined(SDIO) - else if (!strncmp(prop->name, "slew_rate", strlen("slew_rate"))) { + else if (!strncmp(prop->name, "slew_rate", + strlen("slew_rate"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "slew_rate=0x%x\n", data); slew_rate = data; @@ -1774,13 +1933,19 @@ PRINTM(MIOCTL, "tx_work=0x%x\n", data); tx_work = data; } - } else if (!strncmp(prop->name, "rps", strlen("rps"))) { + } +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + else if (!strncmp(prop->name, "rps", strlen("rps"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "rps=0x%x\n", data); rps = data; } - } else if (!strncmp(prop->name, "tx_skb_clone", - strlen("tx_skb_clone"))) { + } +#endif +#endif + else if (!strncmp(prop->name, "tx_skb_clone", + strlen("tx_skb_clone"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "tx_skb_clone=0x%x\n", data); tx_skb_clone = data; @@ -1790,6 +1955,11 @@ PRINTM(MIOCTL, "pmqos=0x%x\n", data); pmqos = data; } + } else if (!strncmp(prop->name, "mcs32", strlen("mcs32"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MIOCTL, "mcs32=0x%x\n", data); + mcs32 = data; + } } #ifdef MFG_CMD_SUPPORT else if (!strncmp(prop->name, "mfg_mode", strlen("mfg_mode"))) { @@ -1799,7 +1969,14 @@ } } #endif - else if (!strncmp(prop->name, "mac_addr", strlen("mac_addr"))) { + else if (!strncmp(prop->name, "rf_test_mode", + strlen("rf_test_mode"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MIOCTL, "rf_test_mode=0x%x\n", data); + rf_test_mode = data; + } + } else if (!strncmp(prop->name, "mac_addr", + strlen("mac_addr"))) { if (!of_property_read_string(dt_node, prop->name, &string_data)) { mac_addr = (char *)string_data; @@ -1886,6 +2063,12 @@ PRINTM(MIOCTL, "max_vir_bss=0x%x\n", data); max_vir_bss = data; } + } else if (!strncmp(prop->name, "cfg80211_drcs", + strlen("cfg80211_drcs"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MIOCTL, "cfg80211_drcs=0x%x\n", data); + cfg80211_drcs = data; + } } #endif #endif @@ -1897,7 +2080,8 @@ PRINTM(MIOCTL, "dpd_data_cfg=%s\n", dpd_data_cfg); } - } else if (!strncmp(prop->name, "init_cfg", strlen("init_cfg"))) { + } else if (!strncmp(prop->name, "init_cfg", + strlen("init_cfg"))) { if (!of_property_read_string(dt_node, prop->name, &string_data)) { init_cfg = (char *)string_data; @@ -1983,11 +2167,19 @@ } } #endif - else if (!strncmp(prop->name, "indrstcfg", strlen("indrstcfg"))) { + else if (!strncmp(prop->name, "indrstcfg", + strlen("indrstcfg"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { indrstcfg = data; PRINTM(MIOCTL, "indrstcfg=%d\n", indrstcfg); } + } else if (!strncmp(prop->name, "drcs_chantime_mode", + strlen("drcs_chantime_mode"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + drcs_chantime_mode = data; + PRINTM(MIOCTL, "drcs_chantime_mode=%d\n", + drcs_chantime_mode); + } } else if (!strncmp(prop->name, "fixed_beacon_buffer", strlen("fixed_beacon_buffer"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { @@ -2017,8 +2209,15 @@ } } #endif - else if (!strncmp(prop->name, "gtk_rekey_offload", - strlen("gtk_rekey_offload"))) { + else if (!strncmp(prop->name, "roamoffload_in_hs", + strlen("roamoffload_in_hs"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + roamoffload_in_hs = data; + PRINTM(MIOCTL, "roamoffload_in_hs=%d\n", + roamoffload_in_hs); + } + } else if (!strncmp(prop->name, "gtk_rekey_offload", + strlen("gtk_rekey_offload"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { gtk_rekey_offload = data; PRINTM(MIOCTL, "gtk_rekey_offload=%d\n", @@ -2027,7 +2226,8 @@ } #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - else if (!strncmp(prop->name, "host_mlme", strlen("host_mlme"))) { + else if (!strncmp(prop->name, "host_mlme", + strlen("host_mlme"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "host_mlme=0x%x\n", data); host_mlme = data; @@ -2050,12 +2250,30 @@ } } #endif - else if (!strncmp(prop->name, "sched_scan", - strlen("sched_scan"))) { + else if (!strncmp(prop->name, "mcs32", strlen("mcs32"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MERROR, "mcs32=0x%x\n", data); + mcs32 = data; + } + } else if (!strncmp(prop->name, "sched_scan", + strlen("sched_scan"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "sched_scan=%d\n", data); sched_scan = data; } + } else if (!strncmp(prop->name, "chan_track", + strlen("chan_track"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + chan_track = data; + PRINTM(MIOCTL, "chan_track=%d\n", chan_track); + } + } else if (!strncmp(prop->name, "keep_previous_scan", + strlen("keep_previous_scan"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MERROR, "keep_previous_scan=0x%x\n", + data); + keep_previous_scan = data; + } } } LEAVE(); @@ -2070,8 +2288,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_validate_cfg_id(moal_handle *handle) +static mlan_status woal_validate_cfg_id(moal_handle *handle) { int i; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2095,8 +2312,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -parse_skip_cfg_block(t_u8 *data, t_u32 size) +static mlan_status parse_skip_cfg_block(t_u8 *data, t_u32 size) { int end = 0; t_u8 line[MAX_LINE_LEN]; @@ -2119,8 +2335,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_cfg_fallback_process(moal_handle *handle) +static mlan_status woal_cfg_fallback_process(moal_handle *handle) { int i, blk_id = 0x7fffffff, idx = -1; mlan_status ret = MLAN_STATUS_FAILURE; @@ -2153,8 +2368,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_init_module_param(moal_handle *handle) +mlan_status woal_init_module_param(moal_handle *handle) { int no_match = 1; t_u32 size, i, tbl_size; @@ -2191,8 +2405,8 @@ if (line[0] == '#') continue; if (strstr(line, "={")) { - ret = parse_line_read_card_info(line, - &card_type, &blk_id); + ret = parse_line_read_card_info(line, &card_type, + &blk_id); if (ret != MLAN_STATUS_SUCCESS) goto out; PRINTM(MINFO, @@ -2260,14 +2474,19 @@ module_param(fw_name, charp, 0660); MODULE_PARM_DESC(fw_name, "Firmware name"); module_param(req_fw_nowait, int, 0); -MODULE_PARM_DESC(req_fw_nowait, - "0: Use request_firmware API; 1: Use request_firmware_nowait API"); +MODULE_PARM_DESC( + req_fw_nowait, + "0: Use request_firmware API; 1: Use request_firmware_nowait API"); module_param(fw_reload, int, 0); MODULE_PARM_DESC(fw_reload, "0: disable fw_reload; 1: enable fw reload feature"); +module_param(auto_fw_reload, int, 0); +MODULE_PARM_DESC(auto_fw_reload, + "0: disable auto_fw_reload; 1: enable auto fw reload feature"); module_param(fw_serial, int, 0); -MODULE_PARM_DESC(fw_serial, - "0: support parallel download FW; 1: support serial download FW"); +MODULE_PARM_DESC( + fw_serial, + "0: support parallel download FW; 1: support serial download FW"); module_param(mac_addr, charp, 0660); MODULE_PARM_DESC(mac_addr, "MAC address"); #ifdef MFG_CMD_SUPPORT @@ -2275,8 +2494,13 @@ MODULE_PARM_DESC(mfg_mode, "0: Download normal firmware; 1: Download MFG firmware"); #endif /* MFG_CMD_SUPPORT */ +module_param(rf_test_mode, int, 0660); +MODULE_PARM_DESC( + rf_test_mode, + "0: Download normal firmware; 1: Download RF_TEST_MODE firmware"); module_param(drv_mode, int, 0660); -MODULE_PARM_DESC(drv_mode, "Bit 0: STA; Bit 1: uAP; Bit 2: WIFIDIRECT"); +MODULE_PARM_DESC(drv_mode, + "Bit 0: STA; Bit 1: uAP; Bit 2: WIFIDIRECT; Bit 7: ZERO_DFS"); #ifdef STA_SUPPORT module_param(max_sta_bss, int, 0); @@ -2305,20 +2529,25 @@ MODULE_PARM_DESC(drvdbg, "Driver debug"); #endif /* DEBUG_LEVEL1 */ module_param(auto_ds, int, 0660); -MODULE_PARM_DESC(auto_ds, - "0: MLAN default; 1: Enable auto deep sleep; 2: Disable auto deep sleep"); +MODULE_PARM_DESC( + auto_ds, + "0: MLAN default; 1: Enable auto deep sleep; 2: Disable auto deep sleep"); module_param(ext_scan, int, 0660); -MODULE_PARM_DESC(ext_scan, - "0: MLAN default; 1: Enable Extended Scan; 2: Enable Enhanced Extended Scan"); +MODULE_PARM_DESC( + ext_scan, + "0: MLAN default; 1: Enable Extended Scan; 2: Enable Enhanced Extended Scan"); module_param(ps_mode, int, 0660); -MODULE_PARM_DESC(ps_mode, - "0: MLAN default; 1: Enable IEEE PS mode; 2: Disable IEEE PS mode"); +MODULE_PARM_DESC( + ps_mode, + "0: MLAN default; 1: Enable IEEE PS mode; 2: Disable IEEE PS mode"); module_param(p2a_scan, int, 0660); -MODULE_PARM_DESC(p2a_scan, - "0: MLAN default; 1: Enable passive to active scan for DFS channel; 2: Disable passive to active scan for DFS channel"); +MODULE_PARM_DESC( + p2a_scan, + "0: MLAN default; 1: Enable passive to active scan for DFS channel; 2: Disable passive to active scan for DFS channel"); module_param(scan_chan_gap, int, 0660); -MODULE_PARM_DESC(scan_chan_gap, - "Time gap between two scans in milliseconds when connected to AP(max value 500ms)"); +MODULE_PARM_DESC( + scan_chan_gap, + "Time gap between two scans in milliseconds when connected to AP(max value 500ms)"); module_param(sched_scan, int, 0); MODULE_PARM_DESC(sched_scan, "0: disable sched_scan; 1: enable sched_scan default"); @@ -2346,18 +2575,27 @@ #endif #if defined(SDIO) module_param(slew_rate, int, 0); -MODULE_PARM_DESC(slew_rate, - "0:has the slowest slew rate, then 01, then 02, and 03 has the highest slew rate"); +MODULE_PARM_DESC( + slew_rate, + "0:has the slowest slew rate, then 01, then 02, and 03 has the highest slew rate"); #endif module_param(tx_work, uint, 0660); MODULE_PARM_DESC(tx_work, "1: Enable tx_work; 0: Disable tx_work"); +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) module_param(rps, uint, 0660); -MODULE_PARM_DESC(rps, "1: Enable rps; 0: Disable rps"); +MODULE_PARM_DESC( + rps, + "bit0-bit4(0x1 - 0xf): Enables rps on specific cpu ; 0: Disables rps"); +#endif +#endif module_param(tx_skb_clone, uint, 0660); MODULE_PARM_DESC(tx_skb_clone, "1: Enable tx_skb_clone; 0: Disable tx_skb_clone"); module_param(pmqos, uint, 0660); MODULE_PARM_DESC(pmqos, "1: Enable pmqos; 0: Disable pmqos"); +module_param(mcs32, uint, 0660); +MODULE_PARM_DESC(mcs32, "1: Enable mcs32; 0: Disable mcs32"); module_param(dpd_data_cfg, charp, 0); MODULE_PARM_DESC(dpd_data_cfg, "DPD data file name"); @@ -2369,16 +2607,18 @@ MODULE_PARM_DESC(txpwrlimit_cfg, "Set configuration data of Tx power limitation"); module_param(cntry_txpwr, int, 0); -MODULE_PARM_DESC(cntry_txpwr, - "0: disable (default), 1: enable set country txpower table 2: enable set country rgpower table"); +MODULE_PARM_DESC( + cntry_txpwr, + "0: disable (default), 1: enable set country txpower table 2: enable set country rgpower table"); module_param(init_hostcmd_cfg, charp, 0); MODULE_PARM_DESC(init_hostcmd_cfg, "Init hostcmd file name"); module_param(band_steer_cfg, charp, 0); MODULE_PARM_DESC(band_steer_cfg, "band steer cfg file name"); module_param(cfg80211_wext, int, 0660); #if defined(STA_CFG80211) || defined(UAP_CFG80211) -MODULE_PARM_DESC(cfg80211_wext, - "Bit 0: STA WEXT Bit 1: UAP WEXT Bit 2: STA CFG80211 Bit 3: UAP CFG80211"); +MODULE_PARM_DESC( + cfg80211_wext, + "Bit 0: STA WEXT Bit 1: UAP WEXT Bit 2: STA CFG80211 Bit 3: UAP CFG80211"); #else MODULE_PARM_DESC(cfg80211_wext, "Bit 0: STA WEXT Bit 1: UAP WEXT Bit 2"); #endif @@ -2389,11 +2629,13 @@ module_param(wq_sched_prio, int, 0); module_param(wq_sched_policy, int, 0); MODULE_PARM_DESC(wq_sched_prio, "Priority of work queue"); -MODULE_PARM_DESC(wq_sched_policy, - "0: SCHED_NORMAL; 1: SCHED_FIFO; 2: SCHED_RR; 3: SCHED_BATCH; 5: SCHED_IDLE"); +MODULE_PARM_DESC( + wq_sched_policy, + "0: SCHED_NORMAL; 1: SCHED_FIFO; 2: SCHED_RR; 3: SCHED_BATCH; 5: SCHED_IDLE"); module_param(rx_work, int, 0); -MODULE_PARM_DESC(rx_work, - "0: default; 1: Enable rx_work_queue; 2: Disable rx_work_queue"); +MODULE_PARM_DESC( + rx_work, + "0: default; 1: Enable rx_work_queue; 2: Disable rx_work_queue"); module_param(aggrctrl, int, 0); MODULE_PARM_DESC(aggrctrl, "1: Enable Tx aggregation; 0: Disable Tx aggregation"); @@ -2433,36 +2675,44 @@ #endif module_param(pmic, int, 0); -MODULE_PARM_DESC(pmic, - "1: Send pmic configure cmd to firmware; 0: No pmic configure cmd sent to firmware"); +MODULE_PARM_DESC( + pmic, + "1: Send pmic configure cmd to firmware; 0: No pmic configure cmd sent to firmware"); module_param(antcfg, int, 0660); -MODULE_PARM_DESC(antcfg, - "0:default; SD8887/SD8987-[1:Tx/Rx antenna 1, 2:Tx/Rx antenna 2, 0xffff:enable antenna diversity];SD8897/SD8997-[Bit0:Rx Path A, Bit1:Rx Path B, Bit 4:Tx Path A, Bit 5:Tx Path B];9098/9097-[Bit 0: 2G Tx/Rx path A, Bit 1: 2G Tx/Rx path B,Bit 8: 5G Tx/Rx path A, Bit 9: 5G Tx/Rx path B]"); +MODULE_PARM_DESC( + antcfg, + "0:default; SD8887/SD8987-[1:Tx/Rx antenna 1, 2:Tx/Rx antenna 2, 0xffff:enable antenna diversity];SD8897/SD8997-[Bit0:Rx Path A, Bit1:Rx Path B, Bit 4:Tx Path A, Bit 5:Tx Path B];9098/9097-[Bit 0: 2G Tx/Rx path A, Bit 1: 2G Tx/Rx path B,Bit 8: 5G Tx/Rx path A, Bit 9: 5G Tx/Rx path B]"); module_param(uap_oper_ctrl, uint, 0); MODULE_PARM_DESC(uap_oper_ctrl, "0:default; 0x20001:uap restarts on channel 6"); module_param(hs_wake_interval, int, 0660); -MODULE_PARM_DESC(hs_wake_interval, - "Host sleep wakeup interval,it will round to nearest multiple dtim*beacon_period in fw"); +MODULE_PARM_DESC( + hs_wake_interval, + "Host sleep wakeup interval,it will round to nearest multiple dtim*beacon_period in fw"); module_param(indication_gpio, int, 0); -MODULE_PARM_DESC(indication_gpio, - "GPIO to indicate wakeup source; high four bits: level for normal wakeup; low four bits: GPIO pin number."); +MODULE_PARM_DESC( + indication_gpio, + "GPIO to indicate wakeup source; high four bits: level for normal wakeup; low four bits: GPIO pin number."); module_param(disconnect_on_suspend, int, 0); -MODULE_PARM_DESC(disconnect_on_suspend, - "1: Enable disconnect wifi on suspend; 0: Disable disconnect wifi on suspend"); +MODULE_PARM_DESC( + disconnect_on_suspend, + "1: Enable disconnect wifi on suspend; 0: Disable disconnect wifi on suspend"); module_param(hs_mimo_switch, int, 0660); -MODULE_PARM_DESC(hs_mimo_switch, - "Dynamic MIMO-SISO switch during host sleep; 0: disable (default), 1: enable"); +MODULE_PARM_DESC( + hs_mimo_switch, + "Dynamic MIMO-SISO switch during host sleep; 0: disable (default), 1: enable"); module_param(indrstcfg, int, 0); -MODULE_PARM_DESC(indrstcfg, - "Independent reset configuration; high byte: GPIO pin number; low byte: IR mode"); +MODULE_PARM_DESC( + indrstcfg, + "Independent reset configuration; high byte: GPIO pin number; low byte: IR mode"); module_param(fixed_beacon_buffer, int, 0); -MODULE_PARM_DESC(fixed_beacon_buffer, - "0: allocate default buffer size; 1: allocate max buffer size."); +MODULE_PARM_DESC( + fixed_beacon_buffer, + "0: allocate default buffer size; 1: allocate max buffer size."); #ifdef WIFI_DIRECT_SUPPORT module_param(GoAgeoutTime, int, 0); @@ -2471,8 +2721,9 @@ #endif module_param(gtk_rekey_offload, int, 0); -MODULE_PARM_DESC(gtk_rekey_offload, - "0: disable gtk_rekey_offload; 1: enable gtk_rekey_offload (default); 2: enable gtk_rekey_offload in suspend mode only;"); +MODULE_PARM_DESC( + gtk_rekey_offload, + "0: disable gtk_rekey_offload; 1: enable gtk_rekey_offload (default); 2: enable gtk_rekey_offload in suspend mode only;"); module_param(multi_dtim, ushort, 0); MODULE_PARM_DESC(multi_dtim, "DTIM interval"); @@ -2488,31 +2739,48 @@ MODULE_PARM_DESC(dfs_offload, "1: enable dfs offload; 0: disable dfs offload."); #endif +module_param(drcs_chantime_mode, int, 0); +MODULE_PARM_DESC( + drcs_chantime_mode, + "0: use default value;Bit31~Bit24:Channel time for channel index0;Bit23~Bit16:mode for channel index0;Bit15~Bit8:Channel time for channel index1;Bit7~Bit0:mode for channel index1; mode:0--PM1,1--Null2Self."); +module_param(cfg80211_drcs, int, 0); +MODULE_PARM_DESC(cfg80211_drcs, + "1: Enable DRCS support; 0: Disable DRCS support"); + +module_param(roamoffload_in_hs, int, 0); +MODULE_PARM_DESC( + roamoffload_in_hs, + "1: enable fw roaming only when host suspend; 0: always enable fw roaming."); + #ifdef UAP_SUPPORT module_param(uap_max_sta, int, 0); MODULE_PARM_DESC(uap_max_sta, "Maximum station number for UAP/GO."); module_param(wacp_mode, int, 0); -MODULE_PARM_DESC(wacp_mode, - "WACP mode for UAP/GO 0: WACP_MODE_DEFAULT; 1: WACP_MODE_1; 2: WACP_MODE_2"); +MODULE_PARM_DESC( + wacp_mode, + "WACP mode for UAP/GO 0: WACP_MODE_DEFAULT; 1: WACP_MODE_1; 2: WACP_MODE_2"); #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) module_param(host_mlme, int, 0); -MODULE_PARM_DESC(host_mlme, - "1: Enable Host MLME Support; 0: Disable Host MLME support"); +MODULE_PARM_DESC( + host_mlme, + "1: Enable Host MLME Support (Default); 0: Disable Host MLME support"); #endif #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) module_param(disable_regd_by_driver, int, 0); -MODULE_PARM_DESC(disable_regd_by_driver, - "0: reg domain set by driver enable(default); 1: reg domain set by driver disable"); +MODULE_PARM_DESC( + disable_regd_by_driver, + "0: reg domain set by driver enable(default); 1: reg domain set by driver disable"); module_param(reg_alpha2, charp, 0660); MODULE_PARM_DESC(reg_alpha2, "Regulatory alpha2"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) module_param(country_ie_ignore, int, 0); -MODULE_PARM_DESC(country_ie_ignore, - "0: Follow countryIE from AP and beacon hint enable; 1: Ignore countryIE from AP and beacon hint disable"); +MODULE_PARM_DESC( + country_ie_ignore, + "0: Follow countryIE from AP and beacon hint enable; 1: Ignore countryIE from AP and beacon hint disable"); module_param(beacon_hints, int, 0); MODULE_PARM_DESC(beacon_hints, "0: enable beacon hints(default); 1: disable beacon hints"); @@ -2521,3 +2789,13 @@ module_param(dfs53cfg, int, 0); MODULE_PARM_DESC(dfs53cfg, "0: fw default; 1: new w53 dfs; 2: old w53 dfs"); + +module_param(chan_track, int, 0); +MODULE_PARM_DESC( + chan_track, + "1: Set channel tracking; 0: Restore channel tracking for 9098 only"); + +module_param(keep_previous_scan, int, 0); +MODULE_PARM_DESC( + keep_previous_scan, + "1: keep previous scan result; 0: flush previous scan result before start scan ");
diff --git a/wlan_sd8987/mlinux/moal_ioctl.c b/wlan_sd8987/mlinux/moal_ioctl.c index 7593db2..848bfea 100755 --- a/wlan_sd8987/mlinux/moal_ioctl.c +++ b/wlan_sd8987/mlinux/moal_ioctl.c
@@ -3,7 +3,7 @@ * @brief This file contains ioctl function to MLAN * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -49,7 +49,7 @@ ********************************************************/ #define MRVL_TLV_HEADER_SIZE 4 /* NXP Channel config TLV ID */ -#define MRVL_CHANNELCONFIG_TLV_ID (0x0100 + 0x2a) /* 0x012a */ +#define MRVL_CHANNELCONFIG_TLV_ID (0x0100 + 0x2a) /* 0x012a */ typedef struct _hostcmd_header { /** Command Header : Command */ @@ -76,43 +76,48 @@ /** Region code mapping table */ static region_code_mapping_t region_code_mapping[] = { - {"00", 0x00}, /* World */ - {"US", 0x10}, /* US FCC */ - {"CA", 0x20}, /* IC Canada */ - {"SG", 0x10}, /* Singapore */ - {"EU", 0x30}, /* ETSI */ - {"AU", 0x30}, /* Australia */ - {"KR", 0x30}, /* Republic Of Korea */ - {"JP", 0x40}, /* Japan */ - {"CN", 0x50}, /* China */ - {"BR", 0x09}, /* Brazil */ - {"RU", 0x0f}, /* Russia */ - {"IN", 0x06}, /* India */ - {"MY", 0x06}, /* Malaysia */ - {"MX", 0x07}, /* Mexico */ - {"NE", 0x30}, /* New Zeland */ + {"00", 0x00}, /* World */ + {"US", 0x10}, /* US FCC */ + {"CA", 0x20}, /* IC Canada */ + {"SG", 0x10}, /* Singapore */ + {"EU", 0x30}, /* ETSI */ + {"AU", 0x30}, /* Australia */ + {"KR", 0x30}, /* Republic Of Korea */ + {"JP", 0x40}, /* Japan */ + {"CN", 0x50}, /* China */ + {"BR", 0x09}, /* Brazil */ + {"RU", 0x0f}, /* Russia */ + {"IN", 0x06}, /* India */ + {"MY", 0x06}, /* Malaysia */ + {"MX", 0x07}, /* Mexico */ + {"NE", 0x30}, /* New Zeland */ }; /** EEPROM Region code mapping table */ static region_code_mapping_t hw_region_code_mapping[] = { - {"00 ", 0x00}, /* World */ - {"US ", 0x10}, /* US FCC */ - {"CA ", 0x20}, /* IC Canada */ - {"KR ", 0x30}, /* Korea */ - {"CN ", 0x50}, /* China */ - {"ES ", 0x31}, /* Spain */ - {"FR ", 0x32}, /* France */ - {"JP ", 0x40}, /* Japan */ - {"JP ", 0x41}, /* Japan */ + {"00 ", 0x00}, /* World */ + {"US ", 0x10}, /* US FCC */ + {"CA ", 0x20}, /* IC Canada */ + {"KR ", 0x30}, /* Korea */ + {"CN ", 0x50}, /* China */ + {"ES ", 0x31}, /* Spain */ + {"FR ", 0x32}, /* France */ + {"JP ", 0x40}, /* Japan */ + {"JP ", 0x41}, /* Japan */ }; /** Country code for ETSI */ static t_u8 eu_country_code_table[][COUNTRY_CODE_LEN] = { - "AL", "AD", "AT", "AU", "BY", "BE", "BA", "BG", "HR", "CY", "CZ", "DK", - "EE", "FI", "FR", "MK", "DE", "GR", "HU", "IS", "IE", "IT", "KR", "LV", - "LI", "LT", "LU", "MT", "MD", "MC", "ME", "NL", "NO", "PL", "RO", "RU", - "SM", "RS", "SI", "SK", "ES", "SE", "CH", "TR", "UA", "UK", "GB", "NE" -}; + "AL", "AD", "AT", "AU", "BE", "BA", "BG", "HR", "CY", "CZ", "DK", "EE", + "FI", "FR", "MK", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", + "LU", "MT", "MD", "MC", "ME", "NL", "NO", "PL", "RO", "SM", "RS", "SI", + "SK", "ES", "SE", "CH", "TR", "UA", "UK", "GB", "NE", "NZ", "DZ", "AO", + "AM", "AW", "BH", "BD", "BT", "BO", "BQ", "BW", "VG", "BF", "BI", "KH", + "CL", "KM", "CG", "CD", "CW", "EG", "FO", "GF", "PF", "GE", "GI", "GP", + "HK", "IN", "ID", "IM", "IL", "JE", "KE", "XK", "KW", "LA", "LR", "MW", + "MV", "MQ", "MR", "YT", "MA", "MZ", "MM", "NA", "NC", "NG", "OM", "PS", + "PT", "QA", "RW", "RE", "BL", "MF", "VC", "SA", "SC", "ZA", "SZ", "SY", + "TZ", "TG", "TN", "AE", "VA", "EH", "YE", "ZM", "ZW"}; /******************************************************** Global Variables @@ -139,8 +144,7 @@ * * @return Region code */ -static t_bool -woal_is_country_code_supported(t_u8 *country_code) +static t_bool woal_is_country_code_supported(t_u8 *country_code) { t_u8 i; ENTER(); @@ -158,7 +162,6 @@ LEAVE(); return MFALSE; } - /** * @brief This function converts region string to region code * @@ -166,8 +169,7 @@ * * @return Region code */ -static t_u8 -region_string_2_region_code(char *region_string) +static t_u8 region_string_2_region_code(char *region_string) { t_u8 i; @@ -203,8 +205,7 @@ * * @return Region code */ -t_bool -woal_is_etsi_country(t_u8 *country_code) +t_bool woal_is_etsi_country(t_u8 *country_code) { t_u8 i; ENTER(); @@ -230,8 +231,7 @@ * * @return Region string or NULL */ -char * -region_code_2_string(t_u8 region_code) +char *region_code_2_string(t_u8 region_code) { t_u8 i; @@ -246,8 +246,7 @@ return NULL; } -t_u8 -woal_is_valid_alpha2(char *alpha2) +t_u8 woal_is_valid_alpha2(char *alpha2) { if (!alpha2 || strlen(alpha2) < 2) return MFALSE; @@ -263,15 +262,15 @@ * @param chan channel num * @return second channel offset */ -t_u8 -woal_get_second_channel_offset(moal_private *priv, int chan) +t_u8 woal_get_second_channel_offset(moal_private *priv, int chan) { t_u8 chan2Offset = SEC_CHAN_NONE; mlan_bss_info bss_info; + memset(&bss_info, 0, sizeof(bss_info)); /* Special Case: 20Mhz-only Channel */ woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); - if (chan == 165) + if (bss_info.region_code != COUNTRY_CODE_US && chan == 165) return chan2Offset; switch (chan) { @@ -287,6 +286,8 @@ case 140: case 149: case 157: + case 165: + case 173: chan2Offset = SEC_CHAN_ABOVE; break; case 40: @@ -301,6 +302,8 @@ case 144: case 153: case 161: + case 169: + case 177: chan2Offset = SEC_CHAN_BELOW; break; } @@ -315,8 +318,8 @@ * * @return N/A */ -static inline void -woal_copy_mc_addr(mlan_multicast_list *mlist, mlan_802_11_mac_addr mac) +static inline void woal_copy_mc_addr(mlan_multicast_list *mlist, + mlan_802_11_mac_addr mac) { t_u32 i = 0; for (i = 0; i < mlist->num_multicast_addr; i++) { @@ -339,8 +342,8 @@ * * @return Number of multicast addresses */ -static inline int -woal_copy_mcast_addr(mlan_multicast_list *mlist, struct net_device *dev) +static inline int woal_copy_mcast_addr(mlan_multicast_list *mlist, + struct net_device *dev) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) struct dev_mc_list *mcptr = dev->mc_list; @@ -356,7 +359,7 @@ mcptr = mcptr->next; } #else - netdev_for_each_mc_addr(mcptr, dev) + netdev_for_each_mc_addr (mcptr, dev) woal_copy_mc_addr(mlist, mcptr->addr); #endif /* < 2.6.35 */ LEAVE(); @@ -371,8 +374,8 @@ * * @return total_mc_count */ -static int -woal_copy_all_mc_list(moal_handle *handle, mlan_multicast_list *mlist) +static int woal_copy_all_mc_list(moal_handle *handle, + mlan_multicast_list *mlist) { int i; moal_private *priv = NULL; @@ -410,8 +413,8 @@ * * @return N/A */ -static inline void -woal_fill_wait_queue(moal_private *priv, wait_queue *wait, t_u8 wait_option) +static inline void woal_fill_wait_queue(moal_private *priv, wait_queue *wait, + t_u8 wait_option) { ENTER(); wait->start_time = jiffies; @@ -441,9 +444,9 @@ * * @return N/A */ -static inline mlan_status -woal_wait_ioctl_complete(moal_private *priv, - mlan_ioctl_req *req, t_u8 wait_option) +static inline mlan_status woal_wait_ioctl_complete(moal_private *priv, + mlan_ioctl_req *req, + t_u8 wait_option) { mlan_status status; wait_queue *wait = (wait_queue *)req->reserved_1; @@ -457,8 +460,8 @@ case MOAL_NO_WAIT: break; case MOAL_IOCTL_WAIT: - while (wait_event_interruptible_exclusive - (wait->wait, wait->condition) == -ERESTARTSYS && + while (wait_event_interruptible_exclusive( + wait->wait, wait->condition) == -ERESTARTSYS && wait->retry < MAX_RETRY_CNT) { wait->retry++; } @@ -501,8 +504,8 @@ * * @return MTRUE/MFALSE */ -static inline t_bool -woal_cac_period_block_cmd(moal_private *priv, pmlan_ioctl_req req) +static inline t_bool woal_cac_period_block_cmd(moal_private *priv, + pmlan_ioctl_req req) { mlan_status ret = MFALSE; t_u32 sub_command; @@ -523,7 +526,7 @@ case MLAN_IOCTL_BSS: if (sub_command == MLAN_OID_BSS_STOP || sub_command == MLAN_OID_BSS_CHANNEL - /* sub_command == MLAN_OID_BSS_ROLE */ ) + /* sub_command == MLAN_OID_BSS_ROLE */) ret = MTRUE; #ifdef UAP_SUPPORT else if (sub_command == MLAN_OID_UAP_BSS_CONFIG) { @@ -570,7 +573,7 @@ phostcmd = (phostcmd_header)((pmlan_ds_misc_cfg)req->pbuf) - ->param.hostcmd.cmd; + ->param.hostcmd.cmd; ptlv_buf = (t_u8 *)phostcmd + sizeof(hostcmd_header); if (phostcmd->action == MLAN_ACT_SET) { while (ptlv_buf < @@ -618,8 +621,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING * -- success, otherwise fail */ -mlan_status -woal_request_ioctl(moal_private *priv, mlan_ioctl_req *req, t_u8 wait_option) +mlan_status woal_request_ioctl(moal_private *priv, mlan_ioctl_req *req, + t_u8 wait_option) { wait_queue *wait = NULL; mlan_status status; @@ -628,7 +631,7 @@ ENTER(); - if (!priv || !priv->phandle || !priv->phandle->pmlan_adapter ||!req) { + if (!priv || !priv->phandle || !priv->phandle->pmlan_adapter || !req) { PRINTM(MINFO, "priv or priv->phandle or priv->phandle->pmlan_adapter or req is null\n"); LEAVE(); @@ -694,9 +697,9 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (priv->uap_host_based && moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) - woal_cfg80211_dfs_vendor_event(priv, - event_dfs_cac_aborted, - &priv->chan); + woal_cfg80211_dfs_vendor_event( + priv, event_dfs_cac_aborted, + &priv->chan); #endif #endif #endif @@ -719,12 +722,12 @@ "Received BSS Start command during CAC period, delay executing %ld seconds\n", cac_left_jiffies / HZ); priv->phandle->delay_bss_start = MTRUE; - moal_memcpy_ext(priv->phandle, - &priv->phandle-> - delay_ssid_bssid, - &bss->param.ssid_bssid, - sizeof(mlan_ssid_bssid), - sizeof(mlan_ssid_bssid)); + moal_memcpy_ext( + priv->phandle, + &priv->phandle->delay_ssid_bssid, + &bss->param.ssid_bssid, + sizeof(mlan_ssid_bssid), + sizeof(mlan_ssid_bssid)); /* TODO: return success to allow the half below * of routines of which calling BSS start to * execute @@ -746,12 +749,10 @@ cac_left_jiffies / HZ); /* blocking timeout set to 1.5 * CAC checking period * left time */ - wait_event_interruptible_timeout(priv->phandle-> - meas_wait_q, - priv->phandle-> - meas_wait_q_woken, - cac_left_jiffies * 3 / - 2); + wait_event_interruptible_timeout( + priv->phandle->meas_wait_q, + priv->phandle->meas_wait_q_woken, + cac_left_jiffies * 3 / 2); } } #ifdef UAP_CFG80211 @@ -828,8 +829,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING * -- success, otherwise fail */ -mlan_status -woal_request_set_mac_address(moal_private *priv, t_u8 wait_option) +mlan_status woal_request_set_mac_address(moal_private *priv, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -859,8 +859,12 @@ "set mac address failed! status=%d, error_code=0x%x\n", status, req->status_code); } else { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(priv->netdev, priv->current_addr); +#else moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr, priv->current_addr, ETH_ALEN, ETH_ALEN); +#endif HEXDUMP("priv->MacAddr:", priv->current_addr, ETH_ALEN); } done: @@ -878,8 +882,7 @@ * * @return N/A */ -void -woal_request_set_multicast_list(moal_private *priv, struct net_device *dev) +void woal_request_set_multicast_list(moal_private *priv, struct net_device *dev) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -932,9 +935,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_disconnect(moal_private *priv, t_u8 wait_option, t_u8 *mac, - t_u16 reason_code) +mlan_status woal_disconnect(moal_private *priv, t_u8 wait_option, t_u8 *mac, + t_u16 reason_code) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -970,6 +972,8 @@ #ifdef REASSOCIATION priv->reassoc_required = MFALSE; #endif /* REASSOCIATION */ + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = MFALSE; LEAVE(); return status; } @@ -985,10 +989,10 @@ * @return non-global operclass */ -int -woal_priv_get_nonglobal_operclass_by_bw_channel(moal_private *priv, - t_u8 bandwidth, - t_u8 channel, t_u8 *oper_class) +int woal_priv_get_nonglobal_operclass_by_bw_channel(moal_private *priv, + t_u8 bandwidth, + t_u8 channel, + t_u8 *oper_class) { int ret = 0; mlan_ioctl_req *ioctl_req = NULL; @@ -1026,6 +1030,202 @@ } #endif +#ifdef UAP_SUPPORT +/** + * @brief Check current uap/go connection status + * Need handle channel switch if current channel is DFS channel + * + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param new channel new channel + * @return N/A + */ +static void woal_check_uap_dfs_status(moal_private *priv, t_u8 wait_option, + t_u8 new_channel) +{ + chan_band_info channel; + mlan_bss_info bss_info; +#if defined(UAP_SUPPORT) + IEEEtypes_ChanSwitchAnn_t *chan_switch = NULL; + IEEEtypes_ExtChanSwitchAnn_t *ext_chan_switch = NULL; + custom_ie *pcust_chansw_ie = NULL; + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + t_u8 bw = 0, oper_class = 0; +#endif + + /* Get BSS information */ + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, wait_option, &bss_info)) + goto done; + if (MLAN_STATUS_SUCCESS != + woal_set_get_ap_channel(priv, MLAN_ACT_GET, wait_option, &channel)) + goto done; + PRINTM(MCMND, "is_11h_active=%d dfs_check_channel=%d\n", + bss_info.is_11h_active, bss_info.dfs_check_channel); + PRINTM(MCMND, "uap current channel=%d new_channel=%d\n", + channel.channel, new_channel); +#if defined(UAP_SUPPORT) + if (new_channel == channel.channel) + goto done; + if (bss_info.is_11h_active && + (bss_info.dfs_check_channel == channel.channel)) { + if (new_channel < MAX_BG_CHANNEL) { + bw = 20; + } else { + switch (channel.bandcfg.chanWidth) { + case CHAN_BW_20MHZ: + bw = 20; + break; + case CHAN_BW_40MHZ: + bw = 40; + break; + case CHAN_BW_80MHZ: + bw = 80; + break; + default: + break; + } + } + woal_priv_get_nonglobal_operclass_by_bw_channel( + priv, bw, new_channel, &oper_class); + PRINTM(MCMND, + "Switch the uap channel from %d to %d, oper_class=%d bw=%d\n", + channel.channel, new_channel, oper_class, bw); + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req) { + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_CUSTOM_IE; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.cust_ie.type = TLV_TYPE_MGMT_IE; + misc->param.cust_ie.len = + sizeof(custom_ie) - MAX_IE_SIZE; + pcust_chansw_ie = (custom_ie *)&misc->param.cust_ie + .ie_data_list[0]; + pcust_chansw_ie->ie_index = 0xffff; /*Auto index */ + if (!oper_class) { + pcust_chansw_ie->ie_length = + sizeof(IEEEtypes_ChanSwitchAnn_t); + pcust_chansw_ie->mgmt_subtype_mask = + MGMT_MASK_BEACON | + MGMT_MASK_PROBE_RESP; /*Add IE for + BEACON/probe + resp*/ + chan_switch = + (IEEEtypes_ChanSwitchAnn_t *) + pcust_chansw_ie->ie_buffer; + chan_switch->element_id = CHANNEL_SWITCH_ANN; + chan_switch->len = + sizeof(IEEEtypes_ChanSwitchAnn_t) - + sizeof(IEEEtypes_Header_t); + chan_switch->chan_switch_mode = 1; /* STA should + not + transmit + */ + chan_switch->new_channel_num = new_channel; + chan_switch->chan_switch_count = + DEF_CHAN_SWITCH_COUNT; + DBG_HEXDUMP(MCMD_D, "CSA IE", + (t_u8 *)pcust_chansw_ie->ie_buffer, + pcust_chansw_ie->ie_length); + } else { + pcust_chansw_ie->ie_length = + sizeof(IEEEtypes_ExtChanSwitchAnn_t); + pcust_chansw_ie->mgmt_subtype_mask = + MGMT_MASK_BEACON | + MGMT_MASK_PROBE_RESP; /*Add IE for + BEACON/probe + resp*/ + ext_chan_switch = + (IEEEtypes_ExtChanSwitchAnn_t *) + pcust_chansw_ie->ie_buffer; + ext_chan_switch->element_id = + EXTEND_CHANNEL_SWITCH_ANN; + ext_chan_switch->len = + sizeof(IEEEtypes_ExtChanSwitchAnn_t) - + sizeof(IEEEtypes_Header_t); + ext_chan_switch->chan_switch_mode = + 1; /* STA should not transmit */ + ext_chan_switch->new_channel_num = new_channel; + ext_chan_switch->chan_switch_count = + DEF_CHAN_SWITCH_COUNT; + ext_chan_switch->new_oper_class = oper_class; + DBG_HEXDUMP(MCMD_D, "ECSA IE", + (t_u8 *)pcust_chansw_ie->ie_buffer, + pcust_chansw_ie->ie_length); + } + status = woal_request_ioctl(priv, ioctl_req, + wait_option); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to set CSA IE\n"); + goto done; + } + PRINTM(MCMND, "CSA/ECSA ie index=%d\n", + pcust_chansw_ie->ie_index); + priv->phandle->chsw_wait_q_woken = MFALSE; + /* wait for channel switch to complete */ + wait_event_interruptible_timeout( + priv->phandle->chsw_wait_q, + priv->phandle->chsw_wait_q_woken, + (u32)HZ * (DEF_CHAN_SWITCH_COUNT + 2) * 110 / + 1000); + + pcust_chansw_ie->ie_index = 0xffff; + pcust_chansw_ie->mgmt_subtype_mask = + MLAN_CUSTOM_IE_DELETE_MASK; + status = woal_request_ioctl(priv, ioctl_req, + MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to clear CSA/ECSA IE\n"); + } + } + } +#endif +done: +#if defined(UAP_SUPPORT) + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); +#endif + return; +} + +/** + * @brief Check current multi-channel connections + * + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param new channel new channel + * + * @return N/A + */ +void woal_check_mc_connection(moal_private *priv, t_u8 wait_option, + t_u8 new_channel) +{ + moal_handle *handle = priv->phandle; +#ifdef UAP_SUPPORT + int i; +#endif + t_u16 enable = 0; + + woal_mc_policy_cfg(priv, &enable, wait_option, MLAN_ACT_GET); + if (!enable) + return; +#ifdef UAP_SUPPORT + for (i = 0; i < handle->priv_num; i++) { + if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_UAP) { + if (handle->priv[i]->bss_started == MTRUE) + woal_check_uap_dfs_status(handle->priv[i], + wait_option, + new_channel); + } + } +#endif + return; +} +#endif + /** * @brief Send bss_start command to MLAN * @@ -1036,13 +1236,15 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_bss_start(moal_private *priv, t_u8 wait_option, - mlan_ssid_bssid *ssid_bssid) +mlan_status woal_bss_start(moal_private *priv, t_u8 wait_option, + mlan_ssid_bssid *ssid_bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; mlan_status status; +#ifdef UAP_SUPPORT + mlan_ssid_bssid temp_ssid_bssid; +#endif ENTER(); @@ -1052,6 +1254,18 @@ if (netif_carrier_ok(priv->netdev)) netif_carrier_off(priv->netdev); } +#ifdef UAP_SUPPORT + if (!ssid_bssid) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + moal_memcpy_ext(priv->phandle, &temp_ssid_bssid, ssid_bssid, + sizeof(mlan_ssid_bssid), sizeof(mlan_ssid_bssid)); + if (MLAN_STATUS_SUCCESS == + woal_find_best_network(priv, wait_option, &temp_ssid_bssid)) + woal_check_mc_connection(priv, wait_option, + temp_ssid_bssid.channel); +#endif /* Allocate an IOCTL request buffer */ req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); @@ -1098,8 +1312,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_bss_info(moal_private *priv, t_u8 wait_option, mlan_bss_info *bss_info) +mlan_status woal_get_bss_info(moal_private *priv, t_u8 wait_option, + mlan_bss_info *bss_info) { mlan_ioctl_req *req = NULL; mlan_ds_get_info *info = NULL; @@ -1148,9 +1362,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_get_gen_ie(moal_private *priv, t_u32 action, t_u8 *ie, - int *ie_len, t_u8 wait_option) +mlan_status woal_set_get_gen_ie(moal_private *priv, t_u32 action, t_u8 *ie, + int *ie_len, t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = NULL; @@ -1219,9 +1432,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_get_retry(moal_private *priv, t_u32 action, - t_u8 wait_option, int *value) +mlan_status woal_set_get_retry(moal_private *priv, t_u32 action, + t_u8 wait_option, int *value) { mlan_ioctl_req *req = NULL; mlan_ds_snmp_mib *mib = NULL; @@ -1280,8 +1492,7 @@ * * @return 0 if successful else negative value */ -int -woal_pre_warmreset(moal_private *priv) +int woal_pre_warmreset(moal_private *priv) { moal_handle *handle = priv->phandle; int ret = 0; @@ -1307,7 +1518,7 @@ #endif woal_cancel_cac_block(priv); /* Reset all interfaces */ - ret = woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE); + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE); /* Initialize private structures */ for (intf_num = 0; intf_num < handle->priv_num; intf_num++) { woal_init_priv(handle->priv[intf_num], MOAL_IOCTL_WAIT); @@ -1349,8 +1560,7 @@ * * @return 0 success, otherwise failure */ -int -woal_warmreset(moal_private *priv) +int woal_warmreset(moal_private *priv) { moal_handle *handle = priv->phandle; mlan_ioctl_req *req = NULL; @@ -1418,8 +1628,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_get_rts(moal_private *priv, t_u32 action, t_u8 wait_option, int *value) +mlan_status woal_set_get_rts(moal_private *priv, t_u32 action, t_u8 wait_option, + int *value) { mlan_ioctl_req *req = NULL; mlan_ds_snmp_mib *mib = NULL; @@ -1441,7 +1651,8 @@ req->action = action; if (action == MLAN_ACT_SET) { - if (*value < MLAN_RTS_MIN_VALUE || *value > MLAN_RTS_MAX_VALUE) { + if (*value < MLAN_RTS_MIN_VALUE || + *value > MLAN_RTS_MAX_VALUE) { ret = MLAN_STATUS_FAILURE; goto done; } @@ -1480,9 +1691,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_get_frag(moal_private *priv, t_u32 action, - t_u8 wait_option, int *value) +mlan_status woal_set_get_frag(moal_private *priv, t_u32 action, + t_u8 wait_option, int *value) { mlan_ioctl_req *req = NULL; mlan_ds_snmp_mib *mib = NULL; @@ -1543,9 +1753,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_get_tx_power(moal_private *priv, t_u32 action, - mlan_power_cfg_t *power_cfg) +mlan_status woal_set_get_tx_power(moal_private *priv, t_u32 action, + mlan_power_cfg_t *power_cfg) { mlan_ds_power_cfg *pcfg = NULL; mlan_ioctl_req *req = NULL; @@ -1594,9 +1803,9 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_get_power_mgmt(moal_private *priv, t_u32 action, - int *disabled, int power_type, t_u8 wait_option) +mlan_status woal_set_get_power_mgmt(moal_private *priv, t_u32 action, + int *disabled, int power_type, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -1674,8 +1883,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise * fail */ -static int -woal_set_countrycode(moal_private *priv, char *country) +static int woal_set_countrycode(moal_private *priv, char *country) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -1726,8 +1934,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise * fail */ -mlan_status -woal_set_region_code(moal_private *priv, char *region) +mlan_status woal_set_region_code(moal_private *priv, char *region) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *cfg = NULL; @@ -1765,9 +1972,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_get_data_rate(moal_private *priv, t_u8 action, - mlan_rate_cfg_t *datarate) +mlan_status woal_set_get_data_rate(moal_private *priv, t_u8 action, + mlan_rate_cfg_t *datarate) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_rate *rate = NULL; @@ -1814,9 +2020,9 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_get_assoc_rsp(moal_private *priv, - mlan_ds_misc_assoc_rsp *assoc_rsp, t_u8 wait_option) +mlan_status woal_get_assoc_rsp(moal_private *priv, + mlan_ds_misc_assoc_rsp *assoc_rsp, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = NULL; @@ -1849,6 +2055,53 @@ LEAVE(); return ret; } + +/** + * @brief Get assoc_req IEs buffer + * + * @param priv A pointer to moal_private structure + * @param assoc_rsp A pointer to mlan_ds_misc_assoc_rsp structure + * @param wait_option wait option + * + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + */ +mlan_status woal_get_assoc_req(moal_private *priv, + mlan_ds_misc_assoc_req *assoc_req, + t_u8 wait_option) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = NULL; + mlan_ioctl_req *req = NULL; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + PRINTM(MERROR, + "Fail to allocate buffer for get assoc request\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + req->req_id = MLAN_IOCTL_MISC_CFG; + misc = (pmlan_ds_misc_cfg)req->pbuf; + misc->sub_command = MLAN_OID_MISC_ASSOC_REQ; + req->action = MLAN_ACT_GET; + + ret = woal_request_ioctl(priv, req, wait_option); + if (ret == MLAN_STATUS_SUCCESS && assoc_req) + moal_memcpy_ext(priv->phandle, assoc_req, + &misc->param.assoc_req, + sizeof(mlan_ds_misc_assoc_req), + sizeof(mlan_ds_misc_assoc_req)); + +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + #endif /** @@ -1861,9 +2114,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_request_get_fw_info(moal_private *priv, t_u8 wait_option, - mlan_fw_info *fw_info) +mlan_status woal_request_get_fw_info(moal_private *priv, t_u8 wait_option, + mlan_fw_info *fw_info) { mlan_ioctl_req *req = NULL; mlan_ds_get_info *info; @@ -1872,8 +2124,8 @@ memset(priv->current_addr, 0xff, ETH_ALEN); /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (req == NULL) { status = MLAN_STATUS_FAILURE; goto done; @@ -1892,14 +2144,21 @@ priv->phandle->fw_hotfix_version = info->param.fw_info.hotfix_version; priv->phandle->fw_ecsa_enable = info->param.fw_info.ecsa_enable; + priv->phandle->fw_bands = info->param.fw_info.fw_bands; priv->phandle->fw_getlog_enable = info->param.fw_info.getlog_enable; + priv->phandle->fw_roaming_support = + info->param.fw_info.fw_roaming_support; if (priv->current_addr[0] == 0xff) moal_memcpy_ext(priv->phandle, priv->current_addr, &info->param.fw_info.mac_addr, sizeof(mlan_802_11_mac_addr), ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(priv->netdev, priv->current_addr); +#else moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr, priv->current_addr, ETH_ALEN, ETH_ALEN); +#endif if (fw_info) moal_memcpy_ext(priv->phandle, fw_info, &info->param.fw_info, @@ -1925,8 +2184,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_get_active_intf_channel(moal_private *priv, chan_band_info * channel) +mlan_status woal_get_active_intf_channel(moal_private *priv, + chan_band_info *channel) { moal_handle *handle = priv->phandle; int i; @@ -1963,8 +2222,7 @@ * @return number of bytes of extended capability -- success, * otherwise error */ -int -woal_request_extcap(moal_private *priv, t_u8 *buf, t_u8 len) +int woal_request_extcap(moal_private *priv, t_u8 *buf, t_u8 len) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -2012,9 +2270,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_debug_info(moal_private *priv, t_u8 wait_option, - mlan_debug_info *debug_info) +mlan_status woal_get_debug_info(moal_private *priv, t_u8 wait_option, + mlan_debug_info *debug_info) { mlan_ioctl_req *req = NULL; mlan_ds_get_info *info = NULL; @@ -2060,8 +2317,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -int -woal_host_command(moal_private *priv, struct iwreq *wrq) +int woal_host_command(moal_private *priv, struct iwreq *wrq) { HostCmd_Header cmd_header; int ret = 0; @@ -2148,8 +2404,7 @@ /* to application */ /* Hostcmd_body */ /*******************************************/ -int -woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) +int woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u32 buf_len = 0; @@ -2245,8 +2500,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -int -woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req) +int woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -2265,7 +2519,7 @@ goto done; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; pcustom_ie = kzalloc(sizeof(mlan_ds_misc_custom_ie), flag); if (!pcustom_ie) { ret = -ENOMEM; @@ -2331,8 +2585,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -int -woal_send_host_packet(struct net_device *dev, struct ifreq *req) +int woal_send_host_packet(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u32 packet_len = 0; @@ -2367,10 +2620,9 @@ ret = -EFAULT; goto done; } - pmbuf = woal_alloc_mlan_buffer(priv->phandle, - (int)(MLAN_MIN_DATA_HEADER_LEN + - (int)packet_len + - PACKET_HEADER_LEN)); + pmbuf = woal_alloc_mlan_buffer( + priv->phandle, (int)(MLAN_MIN_DATA_HEADER_LEN + + (int)packet_len + PACKET_HEADER_LEN)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); ret = -ENOMEM; @@ -2422,8 +2674,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_get_custom_ie(moal_private *priv, t_u16 mask, t_u8 *ie, int ie_len) +int woal_set_get_custom_ie(moal_private *priv, t_u16 mask, t_u8 *ie, int ie_len) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -2473,8 +2724,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -int -woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req) +int woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -2492,7 +2742,7 @@ ret = -EFAULT; goto done; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; tdls_data = kzalloc(sizeof(mlan_ds_misc_tdls_config), flag); if (!tdls_data) { ret = -ENOMEM; @@ -2531,8 +2781,8 @@ goto done; } - if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ - || tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) { + if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ || + tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) { if (copy_to_user(req->ifr_data, &misc->param.tdls_config, sizeof(mlan_ds_misc_tdls_config))) { PRINTM(MERROR, "Copy to user failed!\n"); @@ -2556,8 +2806,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -int -woal_get_bss_type(struct net_device *dev, struct ifreq *req) +int woal_get_bss_type(struct net_device *dev, struct ifreq *req) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -2586,9 +2835,8 @@ * * @return 0 --success, otherwise fail */ -mlan_status -woal_bss_role_cfg(moal_private *priv, t_u8 action, t_u8 wait_option, - t_u8 *bss_role) +mlan_status woal_bss_role_cfg(moal_private *priv, t_u8 action, t_u8 wait_option, + t_u8 *bss_role) { int ret = 0; mlan_ds_bss *bss = NULL; @@ -2648,7 +2896,7 @@ #endif dev->wireless_handlers = (struct iw_handler_def - *)&woal_uap_handler_def; + *)&woal_uap_handler_def; } #endif /* UAP_WEXT */ } else if (*bss_role == MLAN_BSS_ROLE_STA) { @@ -2668,7 +2916,7 @@ #endif dev->wireless_handlers = (struct iw_handler_def - *)&woal_handler_def; + *)&woal_handler_def; } #endif /* STA_WEXT */ } @@ -2690,8 +2938,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_get_bss_role(moal_private *priv, struct iwreq *wrq) +int woal_set_get_bss_role(moal_private *priv, struct iwreq *wrq) { int ret = 0; int bss_role = 0; @@ -2700,7 +2947,8 @@ ENTER(); if (wrq->u.data.length) { - if (copy_from_user(&bss_role, wrq->u.data.pointer, sizeof(int))) { + if (copy_from_user(&bss_role, wrq->u.data.pointer, + sizeof(int))) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; @@ -2710,7 +2958,7 @@ #ifdef WIFI_DIRECT_SUPPORT || (priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT) #endif - ) { + ) { PRINTM(MWARN, "Invalid BSS role\n"); ret = -EINVAL; goto done; @@ -2722,7 +2970,12 @@ } action = MLAN_ACT_SET; /* Reset interface */ - woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE); + if (MLAN_STATUS_SUCCESS != + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MFALSE)) { + PRINTM(MERROR, "%s: reset_intf failed \n", __func__); + ret = -EFAULT; + goto done; + } } if (MLAN_STATUS_SUCCESS != woal_bss_role_cfg(priv, action, @@ -2758,6 +3011,7 @@ #endif /* STA_WEXT || UAP_WEXT */ #endif /* STA_SUPPORT && UAP_SUPPORT */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) /** * @brief Enable IPv6 Router Advertisement offload * @@ -2767,8 +3021,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise * fail */ -static mlan_status -woal_set_ipv6_ra_offload(moal_handle *handle, t_u8 enable) +static mlan_status woal_set_ipv6_ra_offload(moal_handle *handle, t_u8 enable) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = NULL; @@ -2814,7 +3067,93 @@ LEAVE(); return ret; } +#endif +static mlan_status woal_set_wake_on_mdns(moal_handle *handle, t_u8 enable) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = NULL; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_mef_flt_cfg *mef_cfg = NULL; + mef_entry_t *entry = NULL; + mef_filter_t *filter = NULL; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + PRINTM(MIOCTL, "IOCTL req allocated failed!\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_MEF_FLT_CFG; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_SET; + + mef_cfg = (mlan_ds_misc_mef_flt_cfg *)(&misc->param.mef_flt_cfg); + mef_cfg->mef_act_type = MEF_ACT_WOWLAN; + mef_cfg->criteria = MBIT(3); + + entry = (mef_entry_t *)&mef_cfg->mef_entry; + entry->mode = MBIT(0); + entry->action = 3; + + filter = (mef_filter_t *)entry->filter_item; + filter->fill_flag = (FILLING_TYPE | FILLING_REPEAT | FILLING_OFFSET | + FILLING_BYTE_SEQ); + filter->type = TYPE_BYTE_EQ; + filter->repeat = 1; + filter->offset = 20; + filter->num_byte_seq = 2; + moal_memcpy_ext(handle, filter->byte_seq, "\x08\x00", 2, + sizeof(filter->byte_seq)); + entry->rpn[1] = RPN_TYPE_AND; + + filter++; + filter->fill_flag = (FILLING_TYPE | FILLING_REPEAT | FILLING_OFFSET | + FILLING_BYTE_SEQ); + filter->type = TYPE_BYTE_EQ; + filter->repeat = 1; + filter->offset = 38; + filter->num_bytes = 4; + moal_memcpy_ext(handle, filter->byte_seq, "\xe0\x00\x00\xfb", 4, + sizeof(filter->byte_seq)); + entry->rpn[2] = RPN_TYPE_AND; + filter++; + filter->fill_flag = (FILLING_TYPE | FILLING_PATTERN | FILLING_OFFSET | + FILLING_NUM_BYTES); + filter->type = TYPE_BYTE_EQ + 1; + filter->pattern = 17; + filter->offset = 31; + filter->num_bytes = 1; + entry->rpn[3] = RPN_TYPE_AND; + filter++; + filter->fill_flag = (FILLING_TYPE | FILLING_PATTERN | FILLING_OFFSET | + FILLING_NUM_BYTES); + filter->type = TYPE_BYTE_EQ + 1; + filter->pattern = 5353; + filter->offset = 44; + filter->num_bytes = 2; + filter++; + entry->filter_num = 4; + if (enable) { + mef_cfg->op_code = MLAN_OP_ADD_MDNS; + } else { + mef_cfg->op_code = MLAN_IPADDR_OP_IP_REMOVE; + } + ret = woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req, + MOAL_NO_WAIT); + if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) + PRINTM(MIOCTL, "Set Mdns wake up failed! ret=%d\n", ret); +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) /** * @brief Enable IPv6 Neighbor Solicitation offload * @@ -2824,8 +3163,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise * fail */ -static mlan_status -woal_set_ipv6_ns_offload(moal_handle *handle) +static mlan_status woal_set_ipv6_ns_offload(moal_handle *handle, t_u8 enable) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misc = NULL; @@ -2854,7 +3192,6 @@ entry = (mef_entry_t *)&mef_cfg->mef_entry; entry->mode = MBIT(0); entry->action = 0x40; - filter = (mef_filter_t *)entry->filter_item; filter->fill_flag = (FILLING_TYPE | FILLING_REPEAT | FILLING_OFFSET | FILLING_BYTE_SEQ); @@ -2875,9 +3212,12 @@ filter->num_byte_seq = 1; moal_memcpy_ext(handle, filter->byte_seq, "\x87", 1, sizeof(filter->byte_seq)); - entry->filter_num = 2; - + if (enable) { + mef_cfg->op_code = MLAN_OP_ADD_IPV6_NS; + } else { + mef_cfg->op_code = MLAN_IPADDR_OP_IP_REMOVE; + } ret = woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req, MOAL_NO_WAIT); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) @@ -2889,6 +3229,7 @@ LEAVE(); return ret; } +#endif /** * @brief Set auto arp resp @@ -2899,8 +3240,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_set_auto_arp(moal_handle *handle, t_u8 enable) +static mlan_status woal_set_auto_arp(moal_handle *handle, t_u8 enable) { mlan_status ret = MLAN_STATUS_SUCCESS; int i = 0; @@ -2914,10 +3254,10 @@ memset(&ipaddr_cfg, 0, sizeof(ipaddr_cfg)); for (i = 0; i < handle->priv_num && (priv = handle->priv[i]); i++) { if (priv && priv->ip_addr_type != IPADDR_TYPE_NONE) { - moal_memcpy_ext(handle, - ipaddr_cfg.ip_addr[ipaddr_cfg. - ip_addr_num], - priv->ip_addr, IPADDR_LEN, IPADDR_LEN); + moal_memcpy_ext( + handle, + ipaddr_cfg.ip_addr[ipaddr_cfg.ip_addr_num], + priv->ip_addr, IPADDR_LEN, IPADDR_LEN); ipaddr_cfg.ip_addr_num++; } } @@ -2940,7 +3280,7 @@ sizeof(ipaddr_cfg), sizeof(misc->param.ipaddr_cfg)); if (enable) { misc->param.ipaddr_cfg.op_code = MLAN_IPADDR_OP_ARP_FILTER | - MLAN_IPADDR_OP_AUTO_ARP_RESP; + MLAN_IPADDR_OP_AUTO_ARP_RESP; misc->param.ipaddr_cfg.ip_addr_type = IPADDR_TYPE_IPV4; } else { /** remove ip */ @@ -2966,8 +3306,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_auto_arp_ext(moal_handle *handle, t_u8 enable) +mlan_status woal_set_auto_arp_ext(moal_handle *handle, t_u8 enable) { mlan_status ret = MLAN_STATUS_SUCCESS; int i = 0, ip_addr_num = 0; @@ -3041,7 +3380,7 @@ if (enable) mef_cfg->op_code = MLAN_IPADDR_OP_ARP_FILTER | - MLAN_IPADDR_OP_AUTO_ARP_RESP; + MLAN_IPADDR_OP_AUTO_ARP_RESP; else /** remove ip */ mef_cfg->op_code = MLAN_IPADDR_OP_IP_REMOVE; @@ -3067,9 +3406,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_get_dtim_period(moal_private *priv, t_u32 action, - t_u8 wait_option, t_u8 *value) +mlan_status woal_set_get_dtim_period(moal_private *priv, t_u32 action, + t_u8 wait_option, t_u8 *value) { mlan_ioctl_req *req = NULL; mlan_ds_snmp_mib *mib = NULL; @@ -3116,9 +3454,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_get_hs_params(moal_private *priv, t_u16 action, - t_u8 wait_option, mlan_ds_hs_cfg *hscfg) +mlan_status woal_set_get_hs_params(moal_private *priv, t_u16 action, + t_u8 wait_option, mlan_ds_hs_cfg *hscfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pmcfg = NULL; @@ -3129,7 +3466,7 @@ /* Allocate an IOCTL request buffer */ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_pm_cfg)); if (req == NULL) { - ret = -ENOMEM; + ret = MLAN_STATUS_FAILURE; goto done; } @@ -3168,9 +3505,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_wakeup_reason(moal_private *priv, - mlan_ds_hs_wakeup_reason *wakeup_reason) +mlan_status woal_get_wakeup_reason(moal_private *priv, + mlan_ds_hs_wakeup_reason *wakeup_reason) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pmcfg = NULL; @@ -3214,9 +3550,9 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE */ -mlan_status -woal_set_get_wowlan_config(moal_private *priv, t_u16 action, - t_u8 wait_option, mlan_ds_misc_mef_flt_cfg *mefcfg) +mlan_status woal_set_get_wowlan_config(moal_private *priv, t_u16 action, + t_u8 wait_option, + mlan_ds_misc_mef_flt_cfg *mefcfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_misc_cfg *misccfg = NULL; @@ -3266,8 +3602,7 @@ * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING, * or MLAN_STATUS_FAILURE */ -mlan_status -woal_cancel_hs(moal_private *priv, t_u8 wait_option) +mlan_status woal_cancel_hs(moal_private *priv, t_u8 wait_option) { #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) @@ -3291,14 +3626,42 @@ hscfg.conditions = HOST_SLEEP_CFG_CANCEL; hscfg.is_invoke_hostcmd = MTRUE; ret = woal_set_get_hs_params(priv, MLAN_ACT_SET, wait_option, &hscfg); + if (ret != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "%s: woal_set_get_hs_params failed \n", + __func__); + LEAVE(); + return ret; + } + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) { + /*Disable firmware roaming*/ + woal_enable_fw_roaming(priv, 0); + } + if (priv->phandle->fw_roam_enable == ROAM_OFFLOAD_WITH_BSSID || + priv->phandle->fw_roam_enable == ROAM_OFFLOAD_WITH_SSID || + priv->phandle->fw_roam_enable == AUTO_RECONNECT) + woal_config_fw_roaming(priv, ROAM_OFFLOAD_RESUME_CFG, NULL); +#ifdef STA_CFG80211 + if (priv->phandle->fw_roam_enable == AUTO_RECONNECT) + woal_set_clear_pmk(priv, MLAN_ACT_CLEAR); +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) if (priv->phandle->hs_auto_arp) { - PRINTM(MIOCTL, "Canecl Host Sleep... remove ipv6 offload\n"); + PRINTM(MIOCTL, "Cancel Host Sleep... remove ipv6 offload\n"); /** Set ipv6 router advertisement message offload */ woal_set_ipv6_ra_offload(priv->phandle, MFALSE); } + /** Set Neighbor Solitation message offload */ + woal_set_ipv6_ns_offload(priv->phandle, MFALSE); #endif +#endif + + if (priv->phandle->hs_auto_arp) { + PRINTM(MIOCTL, "Cancel Host Sleep... remove Mdns wake up\n"); + /** Set ipv6 router advertisement message offload */ + woal_set_wake_on_mdns(priv->phandle, MFALSE); + } if (priv->phandle->hs_auto_arp) { PRINTM(MIOCTL, "Cancel Host Sleep... remove FW auto arp\n"); @@ -3307,6 +3670,7 @@ /* remove auto arp from FW */ woal_set_auto_arp_ext(priv->phandle, MFALSE); } + #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) handle = priv->phandle; @@ -3314,11 +3678,16 @@ PRINTM(MIOCTL, "Cancel Host Sleep... clear gtk rekey offload of FW\n"); for (i = 0; i < handle->priv_num; i++) { - if (handle->priv[i] && handle->priv[i]->gtk_data_ready) { + if (handle->priv[i] && + handle->priv[i]->gtk_data_ready) { PRINTM(MCMND, "clear GTK in resume\n"); - woal_set_rekey_data(handle->priv[i], NULL, - MLAN_ACT_CLEAR, - wait_option); + if (MLAN_STATUS_SUCCESS != + woal_set_rekey_data(handle->priv[i], NULL, + MLAN_ACT_CLEAR, + wait_option)) + PRINTM(MERROR, + "%s: clear GTK in resume failed \n", + __func__); } } } @@ -3329,13 +3698,160 @@ return ret; } +/** @brief This function config fw roaming parameters + * + * @param priv A Pointer to the moal_private structure + * @return MTRUE or MFALSE + */ +static int woal_set_fw_roaming_params(moal_private *priv) +{ + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + mlan_ioctl_req *req = NULL; + mlan_ds_sec_cfg *sec = NULL; + woal_roam_offload_cfg roam_offload_cfg; +#ifdef STA_CFG80211 + t_u8 zero[MLAN_MAX_KEY_LENGTH] = {0}; +#endif + + /*Enable fw roaming*/ + woal_config_fw_roaming(priv, ROAM_OFFLOAD_ENABLE, NULL); + /*Download fw roaming parameters*/ + woal_config_fw_roaming(priv, ROAM_OFFLOAD_PARAM_CFG, + &priv->phandle->fw_roam_params); + + /*Download userset passphrase key and current connection's PMK*/ +#ifdef STA_CFG80211 + if (!priv->phandle->fw_roam_params.userset_passphrase) { + woal_set_clear_pmk(priv, MLAN_ACT_SET); + goto done; + } +#endif + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_sec_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_SEC_CFG; + sec = (mlan_ds_sec_cfg *)req->pbuf; + sec->sub_command = MLAN_OID_SEC_CFG_PASSPHRASE; + sec->multi_passphrase = 1; + req->action = MLAN_ACT_SET; + + /*Copy user set passphrase*/ + moal_memcpy_ext(priv->phandle, (char *)sec->param.roam_passphrase, + (char *)priv->phandle->ssid_passphrase, + MAX_SEC_SSID_NUM * sizeof(mlan_ds_passphrase), + MAX_SEC_SSID_NUM * sizeof(mlan_ds_passphrase)); + roam_offload_cfg.userset_passphrase = + priv->phandle->fw_roam_params.userset_passphrase; +#ifdef STA_CFG80211 + if (memcmp(priv->pmk.pmk, zero, MLAN_MAX_KEY_LENGTH)) { + /*Download current connection PMK*/ + if (priv->pmk_saved) { + woal_set_clear_pmk(priv, MLAN_ACT_SET); + priv->pmk_saved = false; + } + } +#endif + /*Set userset to mlan adapter*/ + woal_config_fw_roaming(priv, ROAM_OFFLOAD_ENABLE, &roam_offload_cfg); + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** @brief This function enable/disable fw roaming + * + * @param priv A Pointer to the moal_private structure + * @param enable Enable/disable fw roaming + * @return MTRUE or MFALSE + */ +int woal_enable_fw_roaming(moal_private *priv, int data) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_roam_offload *roam = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + int ret = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + if (!data && !priv->phandle->fw_roam_enable) { + PRINTM(MIOCTL, "Fw roaming already disabled\n"); + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_ROAM_OFFLOAD; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + roam = (mlan_ds_misc_roam_offload *)&misc->param.roam_offload; + roam->aplist.ap_num = 0; + /* SET operation */ + ioctl_req->action = MLAN_ACT_SET; + roam->enable = data; + roam->config_mode = ROAM_OFFLOAD_ENABLE; + + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS) && data) { + priv->phandle->fw_roam_enable = data; + goto done; + } + + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + priv->phandle->fw_roam_enable = data; + if (!data) { + memset((char *)&priv->phandle->fw_roam_params, 0, + sizeof(woal_roam_offload_cfg)); + memset((char *)&priv->phandle->ssid_passphrase, 0, + MAX_SEC_SSID_NUM * sizeof(mlan_ds_passphrase)); + } +#ifdef STA_CFG80211 + else if (priv->media_connected && priv->pmk_saved) { + woal_set_clear_pmk(priv, MLAN_ACT_SET); + priv->pmk_saved = false; + } +#endif +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} + /** @brief This function enables the host sleep * * @param priv A Pointer to the moal_private structure * @return MTRUE or MFALSE */ -int -woal_enable_hs(moal_private *priv) +int woal_enable_hs(moal_private *priv) { mlan_ds_hs_cfg hscfg; moal_handle *handle = NULL; @@ -3396,24 +3912,16 @@ if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle-> - chan, + priv->phandle->cookie, + &priv->phandle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } } @@ -3426,16 +3934,38 @@ woal_reconfig_bgscan(priv->phandle); #endif + if (moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS) && + handle->fw_roam_enable) { + woal_set_fw_roaming_params(priv); + } + if (handle->fw_roam_enable == ROAM_OFFLOAD_WITH_BSSID || + handle->fw_roam_enable == ROAM_OFFLOAD_WITH_SSID || + handle->fw_roam_enable == AUTO_RECONNECT) { + woal_config_fw_roaming(priv, ROAM_OFFLOAD_SUSPEND_CFG, NULL); +#ifdef STA_CFG80211 + if (priv->phandle->fw_roam_enable == AUTO_RECONNECT) + woal_set_clear_pmk(priv, MLAN_ACT_SET); +#endif + } media_connected = woal_check_media_connected(handle); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) if (handle->hs_auto_arp && media_connected) { PRINTM(MIOCTL, "Host Sleep enabled... set ipv6 offload\n"); /** Set ipv6 router advertisement message offload */ woal_set_ipv6_ra_offload(handle, MTRUE); /** Set Neighbor Solitation message offload */ - woal_set_ipv6_ns_offload(handle); + woal_set_ipv6_ns_offload(handle, MTRUE); } #endif +#endif + + if (handle->hs_auto_arp) { + PRINTM(MIOCTL, "Host Sleep enabled... set mdns wake up\n"); + /**MDNS wake up**/ + woal_set_wake_on_mdns(handle, MTRUE); + } + if (handle->hs_auto_arp && media_connected) { PRINTM(MIOCTL, "Host Sleep enabled... set FW auto arp\n"); /* Set auto arp response configuration to Fw */ @@ -3443,18 +3973,24 @@ /* Set auto arp response configuration to Fw */ woal_set_auto_arp_ext(handle, MTRUE); } + #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) if (GTK_REKEY_OFFLOAD_SUSPEND == handle->params.gtk_rekey_offload) { PRINTM(MIOCTL, "Host Sleep enabled... set gtk rekey offload to FW\n"); for (i = 0; i < handle->priv_num; i++) { - if (handle->priv[i] && handle->priv[i]->gtk_data_ready) { + if (handle->priv[i] && + handle->priv[i]->gtk_data_ready) { PRINTM(MCMND, "set GTK before suspend\n"); - woal_set_rekey_data(handle->priv[i], - &handle->priv[i]-> - gtk_rekey_data, - MLAN_ACT_SET, MOAL_NO_WAIT); + if (MLAN_STATUS_SUCCESS != + woal_set_rekey_data( + handle->priv[i], + &handle->priv[i]->gtk_rekey_data, + MLAN_ACT_SET, MOAL_NO_WAIT)) + PRINTM(MERROR, + "%s: set GTR before suspend failed \n", + __func__); } } } @@ -3465,16 +4001,13 @@ keep_alive = &handle->keep_alive[i]; if (keep_alive && keep_alive->cached && keep_alive->enable) { keep_alive->cached = false; - woal_start_mkeep_alive(woal_get_priv - (handle, MLAN_BSS_ROLE_ANY), - keep_alive->mkeep_alive_id, - keep_alive->packet, - keep_alive->pkt_len, - keep_alive->src_mac, - keep_alive->dst_mac, - keep_alive->send_interval, - keep_alive->retry_interval, - keep_alive->retry_count); + woal_start_mkeep_alive( + woal_get_priv(handle, MLAN_BSS_ROLE_ANY), + keep_alive->mkeep_alive_id, keep_alive->packet, + keep_alive->pkt_len, keep_alive->src_mac, + keep_alive->dst_mac, keep_alive->send_interval, + keep_alive->retry_interval, + keep_alive->retry_count); keep_alive->pkt_len = 0; memset(keep_alive->packet, 0, MKEEP_ALIVE_IP_PKT_MAX); } @@ -3500,7 +4033,8 @@ #ifdef SDIO_SUSPEND_RESUME memset(&pm_info, 0, sizeof(mlan_ds_ps_info)); #endif - if ((handle->hs_activated == MTRUE) || (handle->is_suspended == MTRUE)) { + if ((handle->hs_activated == MTRUE) || + (handle->is_suspended == MTRUE)) { PRINTM(MCMND, "suspend success! force=%u skip=%u\n", handle->hs_force_count, handle->hs_skip_count); hs_actived = MTRUE; @@ -3519,7 +4053,7 @@ hs_actived = MTRUE; } } -#endif /* SDIO_SUSPEND_RESUME */ +#endif /* SDIO_SUSPEND_RESUME*/ #ifdef SDIO_MMC if (IS_SD(handle->card_type)) { sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); @@ -3553,8 +4087,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, * otherwise failure code */ -mlan_status -woal_request_soft_reset(moal_handle *handle) +mlan_status woal_request_soft_reset(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -3591,8 +4124,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_wapi_enable(moal_private *priv, t_u8 wait_option, t_u32 enable) +mlan_status woal_set_wapi_enable(moal_private *priv, t_u8 wait_option, + t_u32 enable) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -3631,8 +4164,7 @@ * * @return N/A */ -void -woal_get_version(moal_handle *handle, char *version, int max_len) +void woal_get_version(moal_handle *handle, char *version, int max_len) { t_u8 hotfix_ver = 0; union { @@ -3669,8 +4201,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_get_driver_version(moal_private *priv, struct ifreq *req) +int woal_get_driver_version(moal_private *priv, struct ifreq *req) { struct iwreq *wrq = (struct iwreq *)req; int len; @@ -3701,8 +4232,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_get_driver_verext(moal_private *priv, struct ifreq *ireq) +int woal_get_driver_verext(moal_private *priv, struct ifreq *ireq) { struct iwreq *wrq = (struct iwreq *)ireq; mlan_ds_get_info *info = NULL; @@ -3727,15 +4257,16 @@ info->param.ver_ext.version_str_sel = *((int *)(wrq->u.name + SUBCMD_OFFSET)); } else { - if (copy_from_user(&info->param.ver_ext.version_str_sel, - wrq->u.data.pointer, - sizeof(info->param.ver_ext. - version_str_sel))) { + if (copy_from_user( + &info->param.ver_ext.version_str_sel, + wrq->u.data.pointer, + sizeof(info->param.ver_ext.version_str_sel))) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; } else { - if (((t_s32)(info->param.ver_ext.version_str_sel)) < 0) { + if (((t_s32)(info->param.ver_ext.version_str_sel)) < + 0) { PRINTM(MERROR, "Invalid arguments!\n"); ret = -EINVAL; goto done; @@ -3780,8 +4311,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_drvdbg(moal_private *priv, t_u32 drv_dbg) +int woal_set_drvdbg(moal_private *priv, t_u32 drv_dbg) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -3821,9 +4351,8 @@ * * @return 0 --success, otherwise fail */ -int -woal_reg_rx_mgmt_ind(moal_private *priv, t_u16 action, - t_u32 *pmgmt_subtype_mask, t_u8 wait_option) +int woal_reg_rx_mgmt_ind(moal_private *priv, t_u16 action, + t_u32 *pmgmt_subtype_mask, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -3872,8 +4401,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_get_tx_bf_cap(moal_private *priv, t_u16 action, t_u32 *tx_bf_cap) +mlan_status woal_set_get_tx_bf_cap(moal_private *priv, t_u16 action, + t_u32 *tx_bf_cap) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *bf_cfg = NULL; @@ -3925,9 +4454,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_get_tx_bf_cfg(moal_private *priv, t_u16 action, - mlan_ds_11n_tx_bf_cfg *tx_bf_cfg) +mlan_status woal_set_get_tx_bf_cfg(moal_private *priv, t_u16 action, + mlan_ds_11n_tx_bf_cfg *tx_bf_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -3983,8 +4511,7 @@ * * @return N/A */ -void -woal_process_ioctl_resp(moal_private *priv, mlan_ioctl_req *req) +void woal_process_ioctl_resp(moal_private *priv, mlan_ioctl_req *req) { int cfg80211_wext; @@ -4009,9 +4536,8 @@ #ifdef UAP_SUPPORT if (IS_UAP_WEXT(cfg80211_wext) && GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) - woal_ioctl_get_uap_info_resp(priv, - (mlan_ds_get_info *)req-> - pbuf); + woal_ioctl_get_uap_info_resp( + priv, (mlan_ds_get_info *)req->pbuf); #endif #endif break; @@ -4043,8 +4569,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_pm_info(moal_private *priv, mlan_ds_ps_info *pm_info) +mlan_status woal_get_pm_info(moal_private *priv, mlan_ds_ps_info *pm_info) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pmcfg = NULL; @@ -4091,8 +4616,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_get_deep_sleep(moal_private *priv, t_u32 *data) +int woal_get_deep_sleep(moal_private *priv, t_u32 *data) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -4136,9 +4660,8 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_deep_sleep(moal_private *priv, t_u8 wait_option, - BOOLEAN bdeep_sleep, t_u16 idletime) +int woal_set_deep_sleep(moal_private *priv, t_u8 wait_option, + BOOLEAN bdeep_sleep, t_u16 idletime) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -4189,15 +4712,17 @@ * * @return N/A */ -void -woal_cancel_cac_block(moal_private *priv) +void woal_cancel_cac_block(moal_private *priv) { ENTER(); /* if during CAC period, wake up wait queue */ if (priv->phandle->cac_period == MTRUE) { priv->phandle->cac_period = MFALSE; /* Make sure Chan Report is cancelled */ - woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + if (woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: Cancelling CAC chan report in FW failed \n", + __func__); priv->phandle->meas_start_jiffies = 0; if (priv->phandle->delay_bss_start == MTRUE) priv->phandle->delay_bss_start = MFALSE; @@ -4210,9 +4735,8 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (priv->uap_host_based && moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) - woal_cfg80211_dfs_vendor_event(priv, - event_dfs_cac_aborted, - &priv->chan); + woal_cfg80211_dfs_vendor_event( + priv, event_dfs_cac_aborted, &priv->chan); #endif #endif #endif @@ -4230,13 +4754,16 @@ * * @return 0 --success, otherwise fail */ -int -woal_11h_channel_check_ioctl(moal_private *priv, t_u8 wait_option) +int woal_11h_channel_check_ioctl(moal_private *priv, t_u8 wait_option) { int ret = 0; mlan_ioctl_req *req = NULL; mlan_ds_11h_cfg *ds_11hcfg = NULL; mlan_status status = MLAN_STATUS_SUCCESS; +#ifdef UAP_SUPPORT + chan_band_info chan; + chan_band_info uapchan; +#endif ENTER(); @@ -4257,6 +4784,41 @@ } if (woal_is_any_interface_active(priv->phandle)) { +#ifdef UAP_SUPPORT + /* When any other interface is active + * Get rid of CAC timer when drcs is disabled */ + t_u16 enable = 0; + if (priv->phandle->card_info->drcs) + ret = woal_mc_policy_cfg(priv, &enable, wait_option, + MLAN_ACT_GET); + if (!enable) { + LEAVE(); + return ret; + } else { + woal_get_active_intf_channel(priv, &chan); + woal_set_get_ap_channel(priv, MLAN_ACT_GET, + MOAL_IOCTL_WAIT, &uapchan); + if (chan.channel != uapchan.channel) { + if (uapchan.is_dfs_chan) { + PRINTM(MERROR, + "DFS channel is not allowed when another connection exists on different channel\n"); + PRINTM(MERROR, + "Another connection's channel=%d, dfs channel=%d\n", + chan.channel, uapchan.channel); + return -EINVAL; + } else { + // check if we need move first uap0 from + // DFS channel to new non dfs channel + woal_check_mc_connection( + priv, wait_option, + uapchan.channel); + } + } + } +#else + LEAVE(); + return status; +#endif } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); @@ -4307,8 +4869,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_11h_cancel_chan_report_ioctl(moal_private *priv, t_u8 wait_option) +int woal_11h_cancel_chan_report_ioctl(moal_private *priv, t_u8 wait_option) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -4351,9 +4912,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_remain_channel_ioctl(moal_private *priv, t_u8 wait_option, - mlan_ds_remain_chan *pchan) +mlan_status woal_set_remain_channel_ioctl(moal_private *priv, t_u8 wait_option, + mlan_ds_remain_chan *pchan) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -4400,8 +4960,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_wifi_direct_mode_cfg(moal_private *priv, t_u16 action, t_u16 *mode) +mlan_status woal_wifi_direct_mode_cfg(moal_private *priv, t_u16 action, + t_u16 *mode) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -4441,9 +5001,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_p2p_config(moal_private *priv, t_u32 action, - mlan_ds_wifi_direct_config *p2p_config) +mlan_status woal_p2p_config(moal_private *priv, t_u32 action, + mlan_ds_wifi_direct_config *p2p_config) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -4493,9 +5052,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_sta_channel(moal_private *priv, t_u8 wait_option, - chan_band_info * channel) +mlan_status woal_get_sta_channel(moal_private *priv, t_u8 wait_option, + chan_band_info *channel) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -4540,9 +5098,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_signal_info(moal_private *priv, t_u8 wait_option, - mlan_ds_get_signal *signal) +mlan_status woal_get_signal_info(moal_private *priv, t_u8 wait_option, + mlan_ds_get_signal *signal) { mlan_ds_get_info *info = NULL; mlan_ioctl_req *req = NULL; @@ -4600,9 +5157,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_scan_table(moal_private *priv, t_u8 wait_option, - mlan_scan_resp *scan_resp) +mlan_status woal_get_scan_table(moal_private *priv, t_u8 wait_option, + mlan_scan_resp *scan_resp) { mlan_ioctl_req *req = NULL; mlan_ds_scan *scan = NULL; @@ -4657,9 +5213,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_request_scan(moal_private *priv, t_u8 wait_option, - mlan_802_11_ssid *req_ssid) +mlan_status woal_request_scan(moal_private *priv, t_u8 wait_option, + mlan_802_11_ssid *req_ssid) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_handle *handle = priv->phandle; @@ -4733,8 +5288,8 @@ * * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail */ -mlan_status -woal_change_adhoc_chan(moal_private *priv, int channel, t_u8 wait_option) +mlan_status woal_change_adhoc_chan(moal_private *priv, int channel, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_bss_info bss_info; @@ -4786,7 +5341,7 @@ goto done; } - /* Do disonnect */ + /* Do disonnect*/ bss->sub_command = MLAN_OID_BSS_STOP; memset((t_u8 *)&bss->param.bssid, 0, ETH_ALEN); @@ -4828,9 +5383,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_find_best_network(moal_private *priv, t_u8 wait_option, - mlan_ssid_bssid *ssid_bssid) +mlan_status woal_find_best_network(moal_private *priv, t_u8 wait_option, + mlan_ssid_bssid *ssid_bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -4887,8 +5441,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_find_bssid(moal_private *priv, mlan_802_11_mac_addr bssid) +mlan_status woal_find_bssid(moal_private *priv, mlan_802_11_mac_addr bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -4931,9 +5484,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_11d_check_ap_channel(moal_private *priv, t_u8 wait_option, - mlan_ssid_bssid *ssid_bssid) +mlan_status woal_11d_check_ap_channel(moal_private *priv, t_u8 wait_option, + mlan_ssid_bssid *ssid_bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -4985,8 +5537,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_auth_mode(moal_private *priv, t_u8 wait_option, t_u32 *auth_mode) +mlan_status woal_get_auth_mode(moal_private *priv, t_u8 wait_option, + t_u32 *auth_mode) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5027,8 +5579,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_encrypt_mode(moal_private *priv, t_u8 wait_option, t_u32 *encrypt_mode) +mlan_status woal_get_encrypt_mode(moal_private *priv, t_u8 wait_option, + t_u32 *encrypt_mode) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5070,8 +5622,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_get_wpa_enable(moal_private *priv, t_u8 wait_option, t_u32 *enable) +mlan_status woal_get_wpa_enable(moal_private *priv, t_u8 wait_option, + t_u32 *enable) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5113,8 +5665,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_auth_mode(moal_private *priv, t_u8 wait_option, t_u32 auth_mode) +mlan_status woal_set_auth_mode(moal_private *priv, t_u8 wait_option, + t_u32 auth_mode) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5154,8 +5706,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_encrypt_mode(moal_private *priv, t_u8 wait_option, t_u32 encrypt_mode) +mlan_status woal_set_encrypt_mode(moal_private *priv, t_u8 wait_option, + t_u32 encrypt_mode) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5195,8 +5747,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_set_wpa_enable(moal_private *priv, t_u8 wait_option, t_u32 enable) +mlan_status woal_set_wpa_enable(moal_private *priv, t_u8 wait_option, + t_u32 enable) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5235,8 +5787,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_enable_wep_key(moal_private *priv, t_u8 wait_option) +mlan_status woal_enable_wep_key(moal_private *priv, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5277,9 +5828,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_request_userscan(moal_private *priv, t_u8 wait_option, - wlan_user_scan_cfg *scan_cfg) +mlan_status woal_request_userscan(moal_private *priv, t_u8 wait_option, + wlan_user_scan_cfg *scan_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *ioctl_req = NULL; @@ -5341,8 +5891,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_get_scan_config(moal_private *priv, mlan_scan_cfg *scan_cfg) +mlan_status woal_get_scan_config(moal_private *priv, mlan_scan_cfg *scan_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_scan *scan = NULL; @@ -5382,9 +5931,9 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_scan_time(moal_private *priv, t_u16 active_scan_time, - t_u16 passive_scan_time, t_u16 specific_scan_time) +mlan_status woal_set_scan_time(moal_private *priv, t_u16 active_scan_time, + t_u16 passive_scan_time, + t_u16 specific_scan_time) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_scan *scan = NULL; @@ -5433,8 +5982,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_do_scan(moal_private *priv, wlan_user_scan_cfg *scan_cfg) +mlan_status woal_do_scan(moal_private *priv, wlan_user_scan_cfg *scan_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_handle *handle = priv->phandle; @@ -5472,8 +6020,7 @@ * @param priv A pointer to moal_private structure * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_cancel_scan(moal_private *priv, t_u8 wait_option) +mlan_status woal_cancel_scan(moal_private *priv, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5529,9 +6076,8 @@ * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE */ -int -woal_find_essid(moal_private *priv, mlan_ssid_bssid *ssid_bssid, - t_u8 wait_option) +int woal_find_essid(moal_private *priv, mlan_ssid_bssid *ssid_bssid, + t_u8 wait_option) { int ret = 0; mlan_scan_resp scan_resp; @@ -5564,6 +6110,136 @@ } /** + * @brief auto reconnection configure + * + * @param priv Pointer to moal_private structure + * @param cfg_mode configure mode + * @param roam_offload_cfg Pointer to woal_roam_offload_cfg structure + * + * @return 0-success, negative for failure. + */ +int woal_config_fw_roaming(moal_private *priv, t_u8 cfg_mode, + woal_roam_offload_cfg *roam_offload_cfg) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_roam_offload *roam = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + int ret = 0; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is null\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_ROAM_OFFLOAD; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + + roam = (mlan_ds_misc_roam_offload *)&misc->param.roam_offload; + roam->aplist.ap_num = 0; + ioctl_req->action = MLAN_ACT_SET; + roam->enable = priv->phandle->fw_roam_enable; + roam->config_mode = cfg_mode; + + if ((roam->config_mode == ROAM_OFFLOAD_ENABLE) && roam_offload_cfg) { + roam->userset_passphrase = roam_offload_cfg->userset_passphrase; + if (roam->userset_passphrase) + roam->enable = 0; + } + if (roam->config_mode == ROAM_OFFLOAD_PARAM_CFG) { + moal_memcpy_ext(priv->phandle, (t_u8 *)&roam->bssid_reconnect, + (t_u8 *)&roam_offload_cfg->bssid, + MLAN_MAC_ADDR_LENGTH, + sizeof(roam->bssid_reconnect)); + if (roam_offload_cfg->ssid_list.ssid_num) { + moal_memcpy_ext(priv->phandle, (t_u8 *)&roam->ssid_list, + (t_u8 *)&roam_offload_cfg->ssid_list, + sizeof(mlan_ds_misc_ssid_list), + sizeof(mlan_ds_misc_ssid_list)); + } + if (roam_offload_cfg->black_list.ap_num) { + moal_memcpy_ext( + priv->phandle, (t_u8 *)&roam->black_list, + (t_u8 *)&roam_offload_cfg->black_list, + sizeof(mlan_ds_misc_roam_offload_aplist), + sizeof(mlan_ds_misc_roam_offload_aplist)); + } + roam->trigger_condition = roam_offload_cfg->trigger_condition; + roam->retry_count = roam_offload_cfg->retry_count; + if (roam_offload_cfg->rssi_param_set_flag) { + roam->para_rssi.set_flag = 1; + roam->para_rssi.max_rssi = roam_offload_cfg->max_rssi; + roam->para_rssi.min_rssi = roam_offload_cfg->min_rssi; + roam->para_rssi.step_rssi = roam_offload_cfg->step_rssi; + } + if (roam_offload_cfg->band_rssi_flag) { + roam->band_rssi_flag = roam_offload_cfg->band_rssi_flag; + moal_memcpy_ext(priv->phandle, (t_u8 *)&roam->band_rssi, + (t_u8 *)&roam_offload_cfg->band_rssi, + sizeof(mlan_ds_misc_band_rssi), + sizeof(mlan_ds_misc_band_rssi)); + } + if (roam_offload_cfg->bgscan_set_flag) { + roam->bgscan_set_flag = + roam_offload_cfg->bgscan_set_flag; + moal_memcpy_ext(priv->phandle, + (t_u8 *)&roam->bgscan_cfg, + (t_u8 *)&roam_offload_cfg->bgscan_cfg, + sizeof(mlan_ds_misc_bgscan_cfg), + sizeof(mlan_ds_misc_bgscan_cfg)); + } + if (roam_offload_cfg->ees_param_set_flag) { + roam->ees_param_set_flag = + roam_offload_cfg->ees_param_set_flag; + moal_memcpy_ext(priv->phandle, (t_u8 *)&roam->ees_cfg, + (t_u8 *)&roam_offload_cfg->ees_cfg, + sizeof(mlan_ds_misc_ees_cfg), + sizeof(mlan_ds_misc_ees_cfg)); + } + roam->bcn_miss_threshold = roam_offload_cfg->bcn_miss_threshold; + roam->pre_bcn_miss_threshold = + roam_offload_cfg->pre_bcn_miss_threshold; + roam->repeat_count = roam_offload_cfg->repeat_count; + } + if (roam->config_mode == ROAM_OFFLOAD_SUSPEND_CFG) { + moal_memcpy_ext(priv->phandle, roam->bssid_reconnect, + priv->phandle->auto_reconnect_bssid, + MLAN_MAC_ADDR_LENGTH, + sizeof(roam->bssid_reconnect)); + roam->ssid_list.ssid_num = 1; + moal_memcpy_ext( + priv->phandle, (t_u8 *)&roam->ssid_list.ssids[0].ssid, + (t_u8 *)&priv->phandle->auto_reconnect_ssid.ssid, + priv->phandle->auto_reconnect_ssid.ssid_len, + MLAN_MAX_SSID_LENGTH); + roam->retry_count = priv->phandle->auto_reconnect_retry_count; + } + + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + + LEAVE(); + return ret; +} + +/** * @brief Request user scan * * @param priv A pointer to moal_private structure @@ -5572,9 +6248,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_request_bgscan(moal_private *priv, t_u8 wait_option, - wlan_bgscan_cfg *scan_cfg) +mlan_status woal_request_bgscan(moal_private *priv, t_u8 wait_option, + wlan_bgscan_cfg *scan_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *ioctl_req = NULL; @@ -5620,8 +6295,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_bg_scan(moal_private *priv, char *buf, int length) +mlan_status woal_set_bg_scan(moal_private *priv, char *buf, int length) { t_u8 *ptr = buf + strlen("BGSCAN-CONFIG") + 1; int buf_left = length - (strlen("BGSCAN-CONFIG") + 1); @@ -5736,8 +6410,7 @@ * * @return N/A */ -void -woal_config_bgscan_and_rssi(moal_private *priv, t_u8 set_rssi) +void woal_config_bgscan_and_rssi(moal_private *priv, t_u8 set_rssi) { char rssi_low[11]; mlan_bss_info bss_info; @@ -5765,7 +6438,11 @@ priv->scan_cfg.rssi_threshold = priv->rssi_low - RSSI_HYSTERESIS; priv->scan_cfg.repeat_count = DEF_REPEAT_COUNT; priv->scan_cfg.scan_interval = MIN_BGSCAN_INTERVAL; - woal_get_band(priv, &band); + if (MLAN_STATUS_SUCCESS != woal_get_band(priv, &band)) { + PRINTM(MERROR, "woal get band fail\n"); + LEAVE(); + return; + } switch (band) { case WIFI_FREQUENCY_BAND_2GHZ: priv->scan_cfg.chan_list[0].radio_type = 0 | BAND_SPECIFIED; @@ -5782,12 +6459,19 @@ moal_memcpy_ext(priv->phandle, priv->scan_cfg.random_mac, priv->random_mac, ETH_ALEN, sizeof(priv->scan_cfg.random_mac)); - woal_request_bgscan(priv, MOAL_NO_WAIT, &priv->scan_cfg); + if (MLAN_STATUS_FAILURE == + woal_request_bgscan(priv, MOAL_NO_WAIT, &priv->scan_cfg)) { + PRINTM(MERROR, "request bgscan fail\n"); + LEAVE(); + return; + } if (set_rssi && ((priv->rssi_low + RSSI_HYSTERESIS) <= LOWEST_RSSI_THRESHOLD)) { priv->rssi_low += RSSI_HYSTERESIS; snprintf(rssi_low, sizeof(rssi_low), "%d", priv->rssi_low); - woal_set_rssi_low_threshold(priv, rssi_low, MOAL_NO_WAIT); + if (MLAN_STATUS_FAILURE == + woal_set_rssi_low_threshold(priv, rssi_low, MOAL_NO_WAIT)) + PRINTM(MERROR, "set_rssi_low_threshold fail\n"); } LEAVE(); } @@ -5801,8 +6485,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_stop_bg_scan(moal_private *priv, t_u8 wait_option) +mlan_status woal_stop_bg_scan(moal_private *priv, t_u8 wait_option) { wlan_bgscan_cfg scan_cfg; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -5817,47 +6500,6 @@ return ret; } -#if defined(WIFI_LATENCY_MODE_SUPPORT) -/** - * @brief Enable/disable WiFi low-latency mode - * - * If low-latency mode is set to WIFI_LATENCY_MODE_LOW, this function - * will cancel existing pending Wi-Fi scans and suppress future Wi-Fi scans - * via setting |priv->scan_suppressed| to |MTRUE|. Future scans will be supressed - * until low-latency mode is set back to WIFI_LATENCY_MODE_NORMAL. - * If low-latency mode is set to WIFI_LATENCY_MODE_NORMAL, this function - * will set |priv-scan_suppressed| to |MFALSE| and any future will be run as - * normal. - * - * @param priv A pointer to moal_private structure - * @param mode 1 -- low-latency mode, 0 -- normal mode - * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail - */ -mlan_status -woal_set_wifi_low_latency_mode(moal_private *priv, t_u8 mode) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - /** WIFI_LATENCY_MODE_NORMAL : 0, WIFI_LATENCY_MODE_LOW : 1,*/ - t_bool low_latency_mode_enabled = (mode == 1 ? MTRUE : MFALSE); - PRINTM(MMSG, "wlan: enter %s.\n", __FUNCTION__); - if (MTRUE == low_latency_mode_enabled) { - PRINTM(MINFO, "Setting Wi-Fi latency mode to low-latency mode."); - /** Cancel pending Wi-Fi scanning if exist. */ - if (priv->phandle->scan_request) { - woal_cancel_scan(priv, MOAL_NO_WAIT); - PRINTM(MINFO, "Cancel existing scan due to low-latency mode."); - } - /** Suppress future Wi-Fi scan requests. */ - priv->scan_suppressed = MTRUE; - } else { - PRINTM(MINFO, "Setting Wi-Fi latency mode to normal mode."); - priv->scan_suppressed = MFALSE; - } - return ret; -} -#endif // defined(WIFI_LATENCY_MODE_SUPPORT) - /** * @brief set bgscan config * @@ -5865,8 +6507,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -void -woal_reconfig_bgscan(moal_handle *handle) +void woal_reconfig_bgscan(moal_handle *handle) { int i; for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM); i++) { @@ -5893,8 +6534,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_rssi_low_threshold(moal_private *priv, char *rssi, t_u8 wait_option) +mlan_status woal_set_rssi_low_threshold(moal_private *priv, char *rssi, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -5950,8 +6591,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_rssi_threshold(moal_private *priv, t_u32 event_id, t_u8 wait_option) +mlan_status woal_set_rssi_threshold(moal_private *priv, t_u32 event_id, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -6016,8 +6657,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_get_powermode(moal_private *priv, int *powermode) +mlan_status woal_get_powermode(moal_private *priv, int *powermode) { mlan_status ret = MLAN_STATUS_SUCCESS; int ps_mode; @@ -6049,8 +6689,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_scan_type(moal_private *priv, t_u32 scan_type) +mlan_status woal_set_scan_type(moal_private *priv, t_u32 scan_type) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_scan *scan = NULL; @@ -6095,8 +6734,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_enable_ext_scan(moal_private *priv, t_u8 enable) +mlan_status woal_enable_ext_scan(moal_private *priv, t_u8 enable) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_scan *scan = NULL; @@ -6141,8 +6779,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_powermode(moal_private *priv, char *powermode) +mlan_status woal_set_powermode(moal_private *priv, char *powermode) { mlan_status ret = MLAN_STATUS_SUCCESS; int disabled; @@ -6180,11 +6817,10 @@ * * @return 0 -- success, otherwise fail */ -int -woal_set_combo_scan(moal_private *priv, char *buf, int length) +int woal_set_combo_scan(moal_private *priv, char *buf, int length) { int ret = 0; - wlan_user_scan_cfg scan_cfg; + wlan_user_scan_cfg *scan_cfg; t_u8 *ptr = buf + WEXT_CSCAN_HEADER_SIZE; int buf_left = length - WEXT_CSCAN_HEADER_SIZE; int num_ssid = 0; @@ -6195,7 +6831,16 @@ t_u16 specific_scan_time = 0; ENTER(); - memset(&scan_cfg, 0, sizeof(scan_cfg)); + + scan_cfg = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_cfg) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + + memset(scan_cfg, 0, sizeof(wlan_user_scan_cfg)); while (buf_left >= 2) { switch (*ptr) { case WEXT_CSCAN_SSID_SECTION: @@ -6210,11 +6855,11 @@ } if (ssid_len && (num_ssid < (MRVDRV_MAX_SSID_LIST_LENGTH - 1))) { - strncpy(scan_cfg.ssid_list[num_ssid].ssid, + strncpy(scan_cfg->ssid_list[num_ssid].ssid, ptr + 2, ssid_len); - scan_cfg.ssid_list[num_ssid].max_len = 0; + scan_cfg->ssid_list[num_ssid].max_len = 0; PRINTM(MIOCTL, "Combo scan: ssid=%s\n", - scan_cfg.ssid_list[num_ssid].ssid); + scan_cfg->ssid_list[num_ssid].ssid); num_ssid++; } buf_left -= ssid_len + 2; @@ -6231,9 +6876,9 @@ break; } for (i = 0; i < num_chan; i++) { - scan_cfg.chan_list[i].chan_number = ptr[2 + i]; + scan_cfg->chan_list[i].chan_number = ptr[2 + i]; PRINTM(MIOCTL, "Combo scan: chan=%d\n", - scan_cfg.chan_list[i].chan_number); + scan_cfg->chan_list[i].chan_number); } buf_left -= 2 + num_chan; ptr += 2 + num_chan; @@ -6281,11 +6926,11 @@ if (num_ssid || num_chan) { if (num_ssid) { /* Add broadcast scan to ssid_list */ - scan_cfg.ssid_list[num_ssid].max_len = 0xff; + scan_cfg->ssid_list[num_ssid].max_len = 0xff; if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_ACTIVE); } - if (MLAN_STATUS_FAILURE == woal_do_scan(priv, &scan_cfg)) + if (MLAN_STATUS_FAILURE == woal_do_scan(priv, scan_cfg)) ret = -EFAULT; if (num_ssid && (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE)) woal_set_scan_type(priv, MLAN_SCAN_TYPE_PASSIVE); @@ -6295,6 +6940,7 @@ ret = -EFAULT; } done: + kfree(scan_cfg); LEAVE(); return ret; } @@ -6307,8 +6953,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_get_band(moal_private *priv, int *band) +mlan_status woal_get_band(moal_private *priv, int *band) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -6355,8 +7000,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_band(moal_private *priv, char *pband) +mlan_status woal_set_band(moal_private *priv, char *pband) { mlan_status ret = MLAN_STATUS_SUCCESS; int band = 0; @@ -6459,15 +7103,14 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_add_rxfilter(moal_private *priv, char *rxfilter) +mlan_status woal_add_rxfilter(moal_private *priv, char *rxfilter) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); /* Android command: - "DRIVER RXFILTER-ADD 0" - "DRIVER RXFILTER-ADD 1" - "DRIVER RXFILTER-ADD 3" */ + "DRIVER RXFILTER-ADD 0" + "DRIVER RXFILTER-ADD 1" + "DRIVER RXFILTER-ADD 3" */ if (*rxfilter == '0') { PRINTM(MIOCTL, "Add IPV4 multicast filter\n"); priv->rx_filter |= RX_FILTER_IPV4_MULTICAST; @@ -6498,8 +7141,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_remove_rxfilter(moal_private *priv, char *rxfilter) +mlan_status woal_remove_rxfilter(moal_private *priv, char *rxfilter) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -6534,8 +7176,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_priv_qos_cfg(moal_private *priv, t_u32 action, char *qos_cfg) +mlan_status woal_priv_qos_cfg(moal_private *priv, t_u32 action, char *qos_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_wmm_cfg *cfg = NULL; @@ -6585,8 +7226,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_set_sleeppd(moal_private *priv, char *psleeppd) +mlan_status woal_set_sleeppd(moal_private *priv, char *psleeppd) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -6609,9 +7249,7 @@ pm_cfg->sub_command = MLAN_OID_PM_CFG_SLEEP_PD; req->req_id = MLAN_IOCTL_PM_CFG; if ((sleeppd <= MAX_SLEEP_PERIOD && sleeppd >= MIN_SLEEP_PERIOD) || - (sleeppd == 0) - || (sleeppd == SLEEP_PERIOD_RESERVED_FF) - ) { + (sleeppd == 0) || (sleeppd == SLEEP_PERIOD_RESERVED_FF)) { req->action = MLAN_ACT_SET; pm_cfg->param.sleep_period = sleeppd; } else { @@ -6637,8 +7275,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -int -woal_set_scan_cfg(moal_private *priv, char *buf, int length) +int woal_set_scan_cfg(moal_private *priv, char *buf, int length) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 *ptr = buf + NL80211_SCANCFG_HEADER_SIZE; @@ -6715,8 +7352,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_radio(moal_private *priv, t_u8 option) +int woal_set_radio(moal_private *priv, t_u8 option) { int ret = 0; mlan_ds_radio_cfg *radio = NULL; @@ -6758,8 +7394,7 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -mlan_status -woal_usb_aggr_init(moal_handle *handle) +mlan_status woal_usb_aggr_init(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = NULL; @@ -6798,7 +7433,8 @@ } else { PRINTM(MWARN, "Invalid module param (usb_aggr) value %d, " - "using MLAN default\n", handle->params.usb_aggr); + "using MLAN default\n", + handle->params.usb_aggr); handle->params.usb_aggr = 0; usb_aggr_enable = MFALSE; } @@ -6861,10 +7497,10 @@ if (atomic_read(&cardp->rx_data_urb_pending)) { for (i = 0; i < MVUSB_RX_DATA_URB; i++) { if (cardp->rx_data_list[i].urb) { - usb_kill_urb(cardp->rx_data_list[i]. - urb); - usb_init_urb(cardp->rx_data_list[i]. - urb); + usb_kill_urb( + cardp->rx_data_list[i].urb); + usb_init_urb( + cardp->rx_data_list[i].urb); } } } @@ -6892,6 +7528,50 @@ #endif /** + * @brief Set/Get configure multi-channel policy + * + * @param priv A pointer to moal_private structure + * @param enable A pointer to enable + * @param wait_option wait_option of ioctl + * @param action action of ioctl + * + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + */ +mlan_status woal_mc_policy_cfg(moal_private *priv, t_u16 *enable, + t_u8 wait_option, t_u8 action) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + status = MLAN_STATUS_FAILURE; + goto done; + } + + cfg = (mlan_ds_misc_cfg *)req->pbuf; + cfg->sub_command = MLAN_OID_MISC_MULTI_CHAN_POLICY; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = action; + if (MLAN_ACT_SET == action) + cfg->param.multi_chan_policy = *enable; + status = woal_request_ioctl(priv, req, wait_option); + if (status != MLAN_STATUS_SUCCESS) + goto done; + if (MLAN_ACT_GET == action) + *enable = cfg->param.multi_chan_policy; + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} + +/** * @brief Set hotspot configuration value to mlan layer * * @param priv A pointer to moal_private structure @@ -6901,8 +7581,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_hotspotcfg(moal_private *priv, t_u8 wait_option, t_u32 hotspotcfg) +mlan_status woal_set_hotspotcfg(moal_private *priv, t_u8 wait_option, + t_u32 hotspotcfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; @@ -6934,6 +7614,73 @@ return ret; } +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +/** + * @brief Set/Get network monitor configurations + * + * @param priv Pointer to moal_private structure + * @param wait_option wait option + * @param enable Enable/Disable + * @param filter Filter flag - Management/Control/Data + * @param band_chan_cfg Network monitor band channel config + * + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + */ +mlan_status woal_set_net_monitor(moal_private *priv, t_u8 wait_option, + t_u8 enable, t_u8 filter, + netmon_band_chan_cfg *band_chan_cfg) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_net_monitor *net_mon = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = MLAN_STATUS_FAILURE; + goto done; + } + misc = (mlan_ds_misc_cfg *)req->pbuf; + net_mon = (mlan_ds_misc_net_monitor *)&misc->param.net_mon; + misc->sub_command = MLAN_OID_MISC_NET_MONITOR; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_SET; + net_mon->enable_net_mon = enable; + if (net_mon->enable_net_mon) { + net_mon->filter_flag = filter; + if (band_chan_cfg && band_chan_cfg->channel) { + net_mon->band = band_chan_cfg->band; + net_mon->channel = band_chan_cfg->channel; + net_mon->chan_bandwidth = band_chan_cfg->chan_bandwidth; + } + } + + status = woal_request_ioctl(priv, req, wait_option); + if (status != MLAN_STATUS_SUCCESS) { + ret = MLAN_STATUS_FAILURE; + goto done; + } + + /* update chan band values from response in band_chan_cfg */ + if (net_mon->enable_net_mon) { + if (band_chan_cfg) { + band_chan_cfg->band = net_mon->band; + band_chan_cfg->channel = net_mon->channel; + band_chan_cfg->chan_bandwidth = net_mon->chan_bandwidth; + } + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + + LEAVE(); + return ret; +} +#endif + /** * @brief Send delelte all BA command to MLAN * @@ -6943,18 +7690,17 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_delba_all(moal_private *priv, t_u8 wait_option) +mlan_status woal_delba_all(moal_private *priv, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; mlan_ds_11n_delba *del_ba = NULL; - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0 }; + t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0}; mlan_status status = MLAN_STATUS_SUCCESS; int ret = 0; - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_11n_cfg)); if (req == NULL) { ret = -ENOMEM; goto done; @@ -6994,8 +7740,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_11d(moal_private *priv, t_u8 wait_option, t_u8 enable) +mlan_status woal_set_11d(moal_private *priv, t_u8 wait_option, t_u8 enable) { mlan_ioctl_req *req = NULL; mlan_ds_snmp_mib *snmp = NULL; @@ -7032,8 +7777,7 @@ * * @return N/A */ -void -woal_ioctl_get_misc_conf(moal_private *priv, mlan_ds_misc_cfg *info) +void woal_ioctl_get_misc_conf(moal_private *priv, mlan_ds_misc_cfg *info) { ENTER(); switch (info->sub_command) { @@ -7044,9 +7788,10 @@ #ifdef CONFIG_PROC_FS #define RADIO_MODE_STR_LEN 20 -#define TX_PWR_STR_LEN 20 -#define TX_CONT_STR_LEN 50 +#define TX_PWR_STR_LEN 20 +#define TX_CONT_STR_LEN 50 #define TX_FRAME_STR_LEN 200 +#define TRIGGER_FRAME_STR_LEN 250 #define HE_TB_TX_STR_LEN 30 /* @@ -7057,9 +7802,8 @@ * @param d A pointer to mfg_cmd_generic_cfg struct * @return 0 on success, -EINVAL otherwise */ -static int -parse_radio_mode_string(const char *s, size_t len, - struct mfg_cmd_generic_cfg *d) +static int parse_radio_mode_string(const char *s, size_t len, + struct mfg_cmd_generic_cfg *d) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; @@ -7072,7 +7816,7 @@ LEAVE(); return -EINVAL; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(RADIO_MODE_STR_LEN, flag); if (string == NULL) { LEAVE(); @@ -7095,7 +7839,7 @@ if (pos) d->data2 = (t_u32)woal_string_to_number(pos); - if ((d->data1 > 14 || d->data1 < 0) || (d->data2 > 14 || d->data2 < 0)) + if ((d->data1 > 14) || (d->data2 > 14)) ret = -EINVAL; kfree(tmp); @@ -7103,29 +7847,66 @@ return ret; } +#ifdef SD9177 +/* + * @brief PowerLevelToDUT11Bits + * + * @param Pwr A user txpwr values of type int + * @param PowerLevel A Pointer of uint32 type for converted txpwr vals + * @return nothing just exit + */ + +static void PowerLevelToDUT11Bits(int Pwr, t_u32 *PowerLevel) +{ + int Z = 0; + + if ((Pwr > 64) || (Pwr < -64)) + return; + + Z = (int)(Pwr * 16); + if (Z < 0) { + Z = Z + (1 << 11); + } + (*PowerLevel) = (t_u32)Z; + + return; +} +#endif + /* * @brief Parse mfg cmd tx pwr string * + * @param handle A pointer to moal_handle structure * @param s A pointer to user buffer * @param len Length of user buffer * @param d A pointer to mfg_cmd_generic_cfg struct * @return 0 on success, -EINVAL otherwise */ -static int -parse_tx_pwr_string(const char *s, size_t len, struct mfg_cmd_generic_cfg *d) + +static int parse_tx_pwr_string(moal_handle *handle, const char *s, size_t len, + struct mfg_cmd_generic_cfg *d) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; char *tmp = NULL; char *pos = NULL; gfp_t flag; +#ifdef SD9177 + t_u32 tx_pwr_converted = 0xffffffff; + int tx_pwr_local = 0; + t_u8 fc_card = MFALSE; +#endif ENTER(); if (!s || !d) { LEAVE(); return -EINVAL; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; +#ifdef SD9177 + if (IS_SD9177(handle->card_type)) + fc_card = MTRUE; +#endif + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(TX_PWR_STR_LEN, flag); if (string == NULL) { LEAVE(); @@ -7140,9 +7921,18 @@ /* tx power value */ pos = strsep(&string, " \t"); - if (pos) +#ifdef SD9177 + if (fc_card && pos) { + /* for sd9177 we need to convert user power vals including -ve + * vals as per labtool */ + tx_pwr_local = woal_string_to_number(pos); + PowerLevelToDUT11Bits(tx_pwr_local, &tx_pwr_converted); + d->data1 = tx_pwr_converted; + } else +#endif + if (pos) { d->data1 = (t_u32)woal_string_to_number(pos); - + } /* modulation */ pos = strsep(&string, " \t"); if (pos) @@ -7153,14 +7943,17 @@ if (pos) d->data3 = (t_u32)woal_string_to_number(pos); +#ifdef SD9177 + if (((!fc_card) && (d->data1 > 24)) || (d->data2 > 2)) +#else if ((d->data1 > 24) || (d->data2 > 2)) +#endif ret = -EINVAL; kfree(tmp); LEAVE(); return ret; } - /* * @brief Parse mfg cmd tx cont string * @@ -7169,8 +7962,8 @@ * @param d A pointer to mfg_cmd_tx_cont struct * @return 0 on success, -EINVAL otherwise */ -static int -parse_tx_cont_string(const char *s, size_t len, struct mfg_cmd_tx_cont *d) +static int parse_tx_cont_string(const char *s, size_t len, + struct mfg_cmd_tx_cont *d) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; @@ -7183,7 +7976,7 @@ LEAVE(); return -EINVAL; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(TX_CONT_STR_LEN, flag); if (string == NULL) { LEAVE(); @@ -7200,13 +7993,13 @@ if (pos) d->enable_tx = (t_u32)woal_string_to_number(pos); - if (d->enable_tx == MFALSE) - goto done; - pos = strsep(&string, " \t"); if (pos) d->cw_mode = (t_u32)woal_string_to_number(pos); + if (d->enable_tx == MFALSE) + goto done; + pos = strsep(&string, " \t"); if (pos) d->payload_pattern = (t_u32)woal_string_to_number(pos); @@ -7223,14 +8016,217 @@ if (pos) d->tx_rate = (t_u32)woal_string_to_number(pos); - if ((d->enable_tx > 1) || (d->cw_mode > 1) || (d->cs_mode > 1) - || (d->act_sub_ch == 2 || d->act_sub_ch > 3)) + if ((d->enable_tx > 1) || (d->cw_mode > 1) || (d->cs_mode > 1) || + (d->act_sub_ch == 2 || d->act_sub_ch > 3)) ret = -EINVAL; done: kfree(tmp); LEAVE(); return ret; } +/* + * @brief Parse mfg cmd trigger string + * + * @param s A pointer to user buffer + * @param len Length of user buffer + * @param d A pointer to mfg_cmd_tx_frame2 struct + * @return 0 on success, -EINVAL otherwise + */ +static int parse_trigger_frame_string(const char *s, size_t len, + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t *d) +{ + int ret = MLAN_STATUS_SUCCESS; + char *string = NULL; + char *tmp = NULL; + char *pos = NULL; + gfp_t flag; + + ENTER(); + if (!s || !d) { + LEAVE(); + return -EINVAL; + } + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; + string = kzalloc(TRIGGER_FRAME_STR_LEN, flag); + if (string == NULL) + return -ENOMEM; + + moal_memcpy_ext(NULL, string, s + strlen("trigger_frame="), + len - strlen("trigger_frame="), + TRIGGER_FRAME_STR_LEN - 1); + + tmp = string; + string = strstrip(string); + + pos = strsep(&string, " \t"); + if (pos) + d->enable_tx = (t_u32)woal_string_to_number(pos); + + if (d->enable_tx == MFALSE) + goto done; + + pos = strsep(&string, " \t"); + if (pos) + d->standalone_hetb = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->frmCtl.type = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->frmCtl.sub_type = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->duration = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.trigger_type = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ul_len = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.more_tf = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.cs_required = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ul_bw = (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ltf_type = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ltf_mode = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ltf_symbol = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ul_stbc = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ldpc_ess = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.ap_tx_pwr = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.pre_fec_pad_fct = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.pe_disambig = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.spatial_reuse = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.doppler = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_common_field.he_sig2 = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.aid12 = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ru_alloc_reg = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ru_alloc = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ul_coding_type = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ul_mcs = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ul_dcm = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ss_alloc = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->trig_user_info_field.ul_target_rssi = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->basic_trig_user_info.mpdu_mu_sf = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->basic_trig_user_info.tid_al = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->basic_trig_user_info.ac_pl = + (t_u32)woal_string_to_number(pos); + + pos = strsep(&string, " \t"); + if (pos) + d->basic_trig_user_info.pref_ac = + (t_u32)woal_string_to_number(pos); + + if (d->enable_tx > 1) + ret = -EINVAL; + +done: + kfree(tmp); + LEAVE(); + return ret; +} /* * @brief Parse mfg cmd tx frame string @@ -7240,8 +8236,8 @@ * @param d A pointer to mfg_cmd_tx_frame2 struct * @return 0 on success, -EINVAL otherwise */ -static int -parse_tx_frame_string(const char *s, size_t len, struct mfg_cmd_tx_frame2 *d) +static int parse_tx_frame_string(const char *s, size_t len, + struct mfg_cmd_tx_frame2 *d) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; @@ -7255,7 +8251,7 @@ LEAVE(); return -EINVAL; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(TX_FRAME_STR_LEN, flag); if (string == NULL) return -ENOMEM; @@ -7351,19 +8347,21 @@ pos = strsep(&string, " \t"); if (pos) { + char *begin, *end; + begin = pos; for (i = 0; i < ETH_ALEN; i++) { - pos = strsep(&string, ":"); - if (pos) - d->bssid[i] = woal_atox(pos); + end = woal_strsep(&begin, ':', '/'); + if (end) + d->bssid[i] = woal_atox(end); } } - if ((d->enable > 1) - || (d->frame_length == 0) || (d->adjust_burst_sifs > 1) - || (d->burst_sifs_in_us > 255) || (d->short_preamble > 1) - || (d->act_sub_ch == 2 || d->act_sub_ch > 3) - || (d->short_gi > 1) || (d->adv_coding > 1) || (d->tx_bf > 1) - || (d->gf_mode > 1) || (d->stbc > 1)) + if ((d->enable > 1) || (d->frame_length == 0) || + (d->adjust_burst_sifs > 1) || (d->burst_sifs_in_us > 255) || + (d->short_preamble > 1) || + (d->act_sub_ch == 2 || d->act_sub_ch > 3) || (d->short_gi > 1) || + (d->adv_coding > 1) || (d->tx_bf > 1) || (d->gf_mode > 1) || + (d->stbc > 1)) ret = -EINVAL; done: kfree(tmp); @@ -7379,12 +8377,11 @@ * @param d A pointer to mfg_Cmd_HE_TBTx_t struct * @return 0 on success, -EINVAL otherwise */ -static int -parse_he_tb_tx_string(const char *s, size_t len, struct mfg_Cmd_HE_TBTx_t *d) +static int parse_he_tb_tx_string(const char *s, size_t len, + struct mfg_Cmd_HE_TBTx_t *d) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; - char *tmp = NULL; char *pos = NULL; gfp_t flag; @@ -7393,7 +8390,7 @@ LEAVE(); return -EINVAL; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(HE_TB_TX_STR_LEN, flag); if (string == NULL) return -ENOMEM; @@ -7427,11 +8424,10 @@ ret = -EINVAL; done: - kfree(tmp); + kfree(string); LEAVE(); return ret; } - /* * @brief This function enables/disables RF test mode in firmware * @@ -7439,8 +8435,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, * otherwise failure code */ -mlan_status -woal_process_rf_test_mode(moal_handle *handle, t_u32 mode) +mlan_status woal_process_rf_test_mode(moal_handle *handle, t_u32 mode) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_ioctl_req *req = NULL; @@ -7473,13 +8468,13 @@ req, MOAL_IOCTL_WAIT); } - if (ret == MLAN_STATUS_SUCCESS && mode == MFG_CMD_SET_TEST_MODE - && handle->rf_data == NULL) { - flag = (in_atomic() || irqs_disabled())? - GFP_ATOMIC : GFP_KERNEL; + if (ret == MLAN_STATUS_SUCCESS && mode == MFG_CMD_SET_TEST_MODE && + handle->rf_data == NULL) { + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : + GFP_KERNEL; /* Allocate memory to hold RF test mode data */ - handle->rf_data = kzalloc(sizeof(struct rf_test_mode_data), - flag); + handle->rf_data = + kzalloc(sizeof(struct rf_test_mode_data), flag); if (!handle->rf_data) PRINTM(MERROR, "Couldn't allocate memory for RF test mode\n"); @@ -7510,10 +8505,9 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, * otherwise failure code */ -mlan_status -woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd, - const char *buffer, size_t len, - t_u32 action, t_u32 val) +mlan_status woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd, + const char *buffer, size_t len, + t_u32 action, t_u32 val) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_ioctl_req *req = NULL; @@ -7549,11 +8543,9 @@ err = MTRUE; break; case MFG_CMD_RF_CHANNELBW: - if (val != 0 - && val != 1 - && (val != 4 - || (val == 4 && handle->rf_data->band == BAND_2GHZ)) - ) + if (val != 0 && val != 1 && + (val != 4 || + (val == 4 && handle->rf_data->band == BAND_2GHZ))) err = MTRUE; break; case MFG_CMD_RF_CHAN: @@ -7566,7 +8558,7 @@ err = MTRUE; break; case MFG_CMD_RFPWR: - if (parse_tx_pwr_string(buffer, len, + if (parse_tx_pwr_string(handle, buffer, len, &misc->param.mfg_generic_cfg)) err = MTRUE; break; @@ -7587,6 +8579,12 @@ &misc->param.mfg_he_power)) err = MTRUE; break; + case MFG_CMD_CONFIG_TRIGGER_FRAME: + misc->sub_command = MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME; + if (parse_trigger_frame_string( + buffer, len, &misc->param.mfg_tx_trigger_config)) + err = MTRUE; + break; default: err = MTRUE; } @@ -7714,9 +8712,27 @@ handle->rf_data->he_tb_tx[2] = misc->param.mfg_he_power.aid; handle->rf_data->he_tb_tx[3] = misc->param.mfg_he_power.axq_mu_timer; - handle->rf_data->he_tb_tx[4] = + handle->rf_data->he_tb_tx_power[0] = misc->param.mfg_he_power.tx_power; break; + case MFG_CMD_CONFIG_TRIGGER_FRAME: + handle->rf_data->mfg_tx_trigger_config.enable_tx = + misc->param.mfg_tx_trigger_config.enable_tx; + handle->rf_data->mfg_tx_trigger_config.standalone_hetb = + misc->param.mfg_tx_trigger_config.standalone_hetb; + handle->rf_data->mfg_tx_trigger_config.frmCtl.type = + misc->param.mfg_tx_trigger_config.frmCtl.type; + handle->rf_data->mfg_tx_trigger_config.frmCtl.sub_type = + misc->param.mfg_tx_trigger_config.frmCtl.sub_type; + handle->rf_data->mfg_tx_trigger_config.duration = + misc->param.mfg_tx_trigger_config.duration; + handle->rf_data->mfg_tx_trigger_config.trig_common_field = + misc->param.mfg_tx_trigger_config.trig_common_field; + handle->rf_data->mfg_tx_trigger_config.trig_user_info_field = + misc->param.mfg_tx_trigger_config.trig_user_info_field; + handle->rf_data->mfg_tx_trigger_config.basic_trig_user_info = + misc->param.mfg_tx_trigger_config.basic_trig_user_info; + break; } done: if (err || ret != MLAN_STATUS_PENDING)
diff --git a/wlan_sd8987/mlinux/moal_main.c b/wlan_sd8987/mlinux/moal_main.c index fe3a894..8d3c16d 100755 --- a/wlan_sd8987/mlinux/moal_main.c +++ b/wlan_sd8987/mlinux/moal_main.c
@@ -60,14 +60,20 @@ #include <linux/tcp.h> #include <net/tcp.h> #include <net/dsfield.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#include <linux/mpls.h> +#endif +#include <linux/if_vlan.h> #ifdef CONFIG_OF #include <linux/of.h> #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) #include <net/addrconf.h> #endif +#endif /******************************************************** Global Variables @@ -82,7 +88,6 @@ **/ moal_handle *m_handle[MAX_MLAN_ADAPTER]; static int reg_work; - /******************************************************** Local Variables ********************************************************/ @@ -119,6 +124,7 @@ .slew_rate_reg = 0x8000231C, .slew_rate_bit_offset = 14, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 0, }; #endif @@ -154,6 +160,7 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 0, .per_pkt_cfg_support = 0, }; #endif @@ -189,6 +196,7 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 0, .per_pkt_cfg_support = 0, }; #endif @@ -208,6 +216,7 @@ .rev_id_reg = 0x0c58, .fw_name = PCIE8897_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = PCIE8897_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 0, .per_pkt_cfg_support = 0, }; #endif @@ -226,6 +235,7 @@ .feature_control = FEATURE_CTRL_DEFAULT, .fw_name = USB8897_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = USB8897_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 0, .per_pkt_cfg_support = 0, }; #endif @@ -264,6 +274,7 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -302,6 +313,7 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -340,6 +352,7 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -379,6 +392,7 @@ .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -418,6 +432,47 @@ .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, + .per_pkt_cfg_support = 1, +}; +#endif + +#ifdef SDNW62X +static struct _card_info card_info_SDNW62X = { + .embedded_supp = 1, + .drcs = 1, + .go_noa = 1, + .v16_fw_api = 1, + .v17_fw_api = 1, + .pmic = 1, + .cal_data_cfg = 0, + .low_power_enable = 0, + .rx_rate_max = 412, + .histogram_table_num = 3, + .feature_control = FEATURE_CTRL_DEFAULT, + .rev_id_reg = 0xc8, + .host_strap_reg = 0xf4, + .magic_reg = 0xf0, + .fw_name = SDNW62X_DEFAULT_COMBO_FW_NAME, + .fw_name_wlan = SDNW62X_DEFAULT_WLAN_FW_NAME, +#ifdef SDIO + .dump_fw_info = DUMP_FW_SDIO_V3, + .dump_fw_ctrl_reg = 0xf9, + .dump_fw_start_reg = 0xf1, + .dump_fw_end_reg = 0xf8, + .dump_fw_host_ready = 0xcc, + .dump_reg.reg_table = {0x08, 0x58, 0x5C, 0x5D, 0x60, 0x61, 0x62, 0x64, + 0x65, 0x66, 0x68, 0x69, 0x6a}, + .dump_reg.reg_table_size = 13, + .scratch_reg = 0xe8, + .func1_reg_start = 0x10, + .func1_reg_end = 0x17, + .fw_reset_reg = 0x0EE, + .fw_reset_val = 0x99, + .slew_rate_reg = 0x90002328, + .slew_rate_bit_offset = 12, +#endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -434,7 +489,7 @@ .low_power_enable = 0, .rx_rate_max = 412, .histogram_table_num = 3, - .feature_control = FEATURE_CTRL_DEFAULT, + .feature_control = FEATURE_CTRL_DEFAULT & (~FEATURE_CTRL_STREAM_2X2), .rev_id_reg = 0xc8, .host_strap_reg = 0xf4, .magic_reg = 0xf0, @@ -457,6 +512,7 @@ .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -478,6 +534,7 @@ .magic_reg = 0x0cd4, .fw_name = PCIE8997_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = PCIE8997_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -500,6 +557,7 @@ .magic_reg = 0x1c74, .fw_name = PCIE9097_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = PCIE9097_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -522,6 +580,30 @@ .magic_reg = 0x1c74, .fw_name = PCIE9098_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = PCIE9098_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, + .per_pkt_cfg_support = 1, +}; +#endif + +#ifdef PCIENW62X +static struct _card_info card_info_PCIENW62X = { + .embedded_supp = 1, + .drcs = 1, + .go_noa = 1, + .v16_fw_api = 1, + .v17_fw_api = 1, + .pmic = 1, + .cal_data_cfg = 0, + .low_power_enable = 0, + .rx_rate_max = 412, + .histogram_table_num = 3, + .feature_control = FEATURE_CTRL_DEFAULT, + .rev_id_reg = 0x8, + .host_strap_reg = 0x1c70, + .magic_reg = 0x1c74, + .fw_name = PCIENW62X_DEFAULT_COMBO_FW_NAME, + .fw_name_wlan = PCIENW62X_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -542,6 +624,7 @@ .histogram_table_num = 1, .fw_name = USB8801_DEFAULT_WLAN_FW_NAME, .fw_name_wlan = USB8801_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 0, }; #endif @@ -560,6 +643,7 @@ .histogram_table_num = 1, .fw_name = USB8978_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = USB8978_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -578,6 +662,7 @@ .histogram_table_num = 3, .fw_name = USB8997_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = USB8997_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -597,6 +682,7 @@ .histogram_table_num = 3, .fw_name = USB9098_DEFAULT_COMBO_FW_NAME, .fw_name_wlan = USB9098_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif @@ -616,9 +702,31 @@ .histogram_table_num = 3, .fw_name = USBUSB9097_COMBO_V1_FW_NAME, .fw_name_wlan = USB9097_WLAN_V1_FW_NAME, + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif + +#ifdef USBNW62X +static struct _card_info card_info_USBNW62X = { + .embedded_supp = 1, + .drcs = 1, + .go_noa = 1, + .v16_fw_api = 1, + .v17_fw_api = 1, + .pmic = 1, + .cal_data_cfg = 0, + .low_power_enable = 0, + .rx_rate_max = 412, + .feature_control = FEATURE_CTRL_DEFAULT, + .histogram_table_num = 3, + .fw_name = USBNW62X_DEFAULT_COMBO_FW_NAME, + .fw_name_wlan = USBNW62X_DEFAULT_WLAN_FW_NAME, + .sniffer_support = 1, + .per_pkt_cfg_support = 1, +}; +#endif + #ifdef SD8987 static struct _card_info card_info_SD8987 = { .embedded_supp = 1, @@ -652,17 +760,20 @@ .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif + .sniffer_support = 1, .per_pkt_cfg_support = 1, }; #endif /** Driver version */ -char driver_version[] = INTF_CARDTYPE KERN_VERSION "--" MLAN_RELEASE_VERSION - "-GPL" "-(" "FP" FPNUM ")" +char driver_version[] = + INTF_CARDTYPE KERN_VERSION "--" MLAN_RELEASE_VERSION "-GPL" + "-(" + "FP" FPNUM ")" #ifdef DEBUG_LEVEL2 - "-dbg" + "-dbg" #endif - " "; + " "; /** woal_callbacks */ static mlan_callbacks woal_callbacks = { @@ -734,11 +845,13 @@ int woal_open(struct net_device *dev); int woal_close(struct net_device *dev); int woal_set_mac_address(struct net_device *dev, void *addr); +int woal_change_mtu(struct net_device *dev, int new_mtu); void woal_tx_timeout(struct net_device *dev #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) - , unsigned int txqueue + , + unsigned int txqueue #endif - ); +); struct net_device_stats *woal_get_stats(struct net_device *dev); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) @@ -782,8 +895,7 @@ * * @return N/A */ -void -woal_send_fw_dump_complete_event(moal_private *priv) +void woal_send_fw_dump_complete_event(moal_private *priv) { int cfg80211_wext = priv->phandle->params.cfg80211_wext; #ifdef STA_WEXT @@ -791,44 +903,131 @@ woal_send_iwevcustom_event(priv, CUS_EVT_FW_DUMP_DONE); #endif #ifdef STA_CFG80211 +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE if (IS_STA_CFG80211(cfg80211_wext)) woal_cfg80211_vendor_event_fw_dump(priv); #endif - woal_broadcast_event(priv, CUS_EVT_FW_DUMP_DONE, - strlen(CUS_EVT_FW_DUMP_DONE)); +#endif + if (MLAN_STATUS_SUCCESS != + woal_broadcast_event(priv, CUS_EVT_FW_DUMP_DONE, + strlen(CUS_EVT_FW_DUMP_DONE))) + PRINTM(MINFO, "%s: woal_broadcast_event failed \n", __func__); return; } /** + * @brief This function clean up adapter + * + * @param handle Pointer to structure moal_handle + * + * @return N/A + */ +void woal_clean_up(moal_handle *handle) +{ + int i; + moal_private *priv; + int cfg80211_wext = 0; + cfg80211_wext = handle->params.cfg80211_wext; +#ifdef STA_CFG80211 + if (IS_STA_CFG80211(cfg80211_wext) && handle->scan_request && + handle->scan_priv) { + moal_private *scan_priv = handle->scan_priv; + /** some supplicant can not handle SCAN abort event */ + if (scan_priv->bss_type == MLAN_BSS_TYPE_STA) + woal_cfg80211_scan_done(handle->scan_request, MTRUE); + else + woal_cfg80211_scan_done(handle->scan_request, MFALSE); + handle->scan_request = NULL; + handle->scan_priv = NULL; + cancel_delayed_work_sync(&handle->scan_timeout_work); + handle->scan_pending_on_block = MFALSE; + MOAL_REL_SEMAPHORE(&handle->async_sem); + } +#endif + for (i = 0; i < handle->priv_num; i++) { + if (handle->priv[i]) { + priv = handle->priv[i]; + woal_stop_queue(priv->netdev); + if (netif_carrier_ok(priv->netdev)) + netif_carrier_off(priv->netdev); + priv->media_connected = MFALSE; + // disconnect + moal_connection_status_check_pmqos(priv->phandle); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev && +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + priv->wdev->connected) { +#else + priv->wdev->current_bss) { +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (priv->host_mlme) + woal_host_mlme_disconnect( + priv, + MLAN_REASON_DEAUTH_LEAVING, + NULL); + else +#endif + cfg80211_disconnected(priv->netdev, 0, + NULL, 0, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) + true, +#endif + GFP_KERNEL); + } +#endif +#endif + // stop bgscan +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + if (IS_STA_CFG80211(cfg80211_wext) && + priv->sched_scanning) { + priv->bg_scan_start = MFALSE; + priv->bg_scan_reported = MFALSE; + cfg80211_sched_scan_stopped(priv->wdev->wiphy +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + , + priv->bg_scan_reqid +#endif + ); + priv->sched_scanning = MFALSE; + } +#endif +#endif + } + } + return; +} + +/** * @brief This function process FW hang * * @param handle Pointer to structure moal_handle * * @return N/A */ -static void -woal_hang_work_queue(struct work_struct *work) +static void woal_hang_work_queue(struct work_struct *work) { int i; moal_private *priv; int cfg80211_wext = 0; - + int ret = 0; ENTER(); if (!reset_handle) { LEAVE(); return; } - mlan_ioctl(reset_handle->pmlan_adapter, NULL); + mlan_ioctl(reset_handle->pmlan_adapter, NULL); cfg80211_wext = reset_handle->params.cfg80211_wext; - //stop pending scan + // stop pending scan #ifdef STA_CFG80211 - if (IS_STA_CFG80211(cfg80211_wext) && reset_handle->scan_request - && reset_handle->scan_priv) { + if (IS_STA_CFG80211(cfg80211_wext) && reset_handle->scan_request && + reset_handle->scan_priv) { moal_private *scan_priv = reset_handle->scan_priv; - - /** some supplicant can not handle SCAN abort event */ + /** some supplicant can not handle SCAN abort event */ if (scan_priv->bss_type == MLAN_BSS_TYPE_STA) woal_cfg80211_scan_done(reset_handle->scan_request, MTRUE); @@ -850,16 +1049,22 @@ if (netif_carrier_ok(priv->netdev)) netif_carrier_off(priv->netdev); priv->media_connected = MFALSE; - //disconnect + // disconnect + moal_connection_status_check_pmqos(priv->phandle); #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) - if (IS_STA_CFG80211(cfg80211_wext) && + if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev && +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + priv->wdev->connected) { +#else priv->wdev->current_bss) { +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) - woal_host_mlme_disconnect(priv, - MLAN_REASON_DEAUTH_LEAVING, - NULL); + woal_host_mlme_disconnect( + priv, + MLAN_REASON_DEAUTH_LEAVING, + NULL); else #endif cfg80211_disconnected(priv->netdev, 0, @@ -871,7 +1076,7 @@ } #endif #endif - //stop bgscan + // stop bgscan #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) if (IS_STA_CFG80211(cfg80211_wext) && @@ -883,7 +1088,7 @@ , priv->bg_scan_reqid #endif - ); + ); priv->sched_scanning = MFALSE; } #endif @@ -891,7 +1096,78 @@ } } woal_flush_workqueue(reset_handle); - + if (reset_handle->params.auto_fw_reload) { + priv = woal_get_priv(reset_handle, MLAN_BSS_ROLE_ANY); + if (priv) { + woal_broadcast_event(priv, CUS_EVT_FW_RECOVER_START, + strlen(CUS_EVT_FW_RECOVER_START)); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) + woal_cfg80211_vendor_event( + priv, event_fw_reset_start, + CUS_EVT_FW_RECOVER_START, + strlen(CUS_EVT_FW_RECOVER_START)); +#endif +#endif + } + if (IS_SD(reset_handle->card_type)) { + PRINTM(MMSG, "WIFI auto_fw_reload: fw_reload=1\n"); + ret = woal_request_fw_reload( + reset_handle, FW_RELOAD_SDIO_INBAND_RESET); + } +#ifdef PCIE + else if (IS_PCIE(reset_handle->card_type)) { + reset_handle->init_wait_q_woken = MFALSE; + PRINTM(MMSG, "WIFI auto_fw_reload: fw_reload=4\n"); + ret = woal_request_fw_reload(reset_handle, + FW_RELOAD_PCIE_RESET); + if (!ret) { + /* Wait for FLR to complete */ + wait_event_timeout( + reset_handle->init_wait_q, + reset_handle->init_wait_q_woken, + 10 * HZ); + if (reset_handle->hardware_status != + HardwareStatusReady) + ret = -1; + } + } +#endif + priv = woal_get_priv(reset_handle, MLAN_BSS_ROLE_ANY); + if (priv) { + if (ret) { + woal_broadcast_event( + priv, CUS_EVT_FW_RECOVER_FAIL, + strlen(CUS_EVT_FW_RECOVER_FAIL)); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) + woal_cfg80211_vendor_event( + priv, event_fw_reset_failure, + CUS_EVT_FW_RECOVER_FAIL, + strlen(CUS_EVT_FW_RECOVER_FAIL)); +#endif +#endif + } else { + woal_broadcast_event( + priv, CUS_EVT_FW_RECOVER_SUCCESS, + strlen(CUS_EVT_FW_RECOVER_SUCCESS)); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) + woal_cfg80211_vendor_event( + priv, event_fw_reset_success, + CUS_EVT_FW_RECOVER_SUCCESS, + strlen(CUS_EVT_FW_RECOVER_SUCCESS)); +#endif +#endif + } + } + reset_handle = NULL; + LEAVE(); + return; + } priv = woal_get_priv(reset_handle, MLAN_BSS_ROLE_ANY); if (priv) { woal_broadcast_event(priv, CUS_EVT_DRIVER_HANG, @@ -916,8 +1192,7 @@ * * @return N/A */ -void -woal_process_hang(moal_handle *handle) +void woal_process_hang(moal_handle *handle) { ENTER(); if (reset_handle == NULL) { @@ -945,8 +1220,7 @@ * * @return MTRUE/MFALSE; */ -t_u8 -woal_is_any_interface_active(moal_handle *handle) +t_u8 woal_is_any_interface_active(moal_handle *handle) { int i; for (i = 0; i < handle->priv_num; i++) { @@ -968,6 +1242,75 @@ return MFALSE; } +#ifdef STA_CFG80211 +/** @brief This function set/clear pmk to FW + * + * @param priv A Pointer to the moal_private structure + * @param action set/clear action + * + * @return 0: success fail otherwise + */ +int woal_set_clear_pmk(moal_private *priv, t_u8 action) +{ + mlan_ioctl_req *req; + mlan_ds_sec_cfg *sec; + mlan_status status; + int ret = 0; + t_u8 zero[MLAN_MAX_KEY_LENGTH] = {0}; + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_sec_cfg)); + + if (req == NULL) { + ret = -ENOMEM; + } else { + sec = (mlan_ds_sec_cfg *)req->pbuf; + sec->sub_command = MLAN_OID_SEC_CFG_PASSPHRASE; + req->req_id = MLAN_IOCTL_SEC_CFG; + req->action = action; + + if (action == MLAN_ACT_SET) { + sec->param.passphrase.psk_type = MLAN_PSK_PMK; + if (memcmp(priv->pmk.pmk, zero, MLAN_MAX_KEY_LENGTH)) + moal_memcpy_ext( + priv->phandle, + &sec->param.passphrase.psk.pmk.pmk, + priv->pmk.pmk, MLAN_MAX_KEY_LENGTH, + sizeof(sec->param.passphrase.psk.pmk + .pmk)); + if (memcmp(priv->pmk.pmk_r0, zero, + MLAN_MAX_KEY_LENGTH) && + memcmp(priv->pmk.pmk_r0_name, zero, + MLAN_MAX_PMKR0_NAME_LENGTH)) { + moal_memcpy_ext( + priv->phandle, + &sec->param.passphrase.psk.pmk.pmk_r0, + priv->pmk.pmk_r0, MLAN_MAX_KEY_LENGTH, + sizeof(sec->param.passphrase.psk.pmk + .pmk_r0)); + moal_memcpy_ext( + priv->phandle, + &sec->param.passphrase.psk.pmk + .pmk_r0_name, + priv->pmk.pmk_r0_name, + MLAN_MAX_PMKR0_NAME_LENGTH, + sizeof(sec->param.passphrase.psk.pmk + .pmk_r0_name)); + } + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) + ret = -EFAULT; + if (status != MLAN_STATUS_PENDING) + kfree(req); + } + + LEAVE(); + return ret; +} +#endif + /** * @brief This function handle the net interface ipaddr change event * @@ -977,8 +1320,8 @@ * * @return NOTIFY_DONE or NOTIFY_OK */ -static int -woal_netdevice_event(struct notifier_block *nb, unsigned long event, void *ptr) +static int woal_netdevice_event(struct notifier_block *nb, unsigned long event, + void *ptr) { struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; struct net_device *ndev; @@ -1009,7 +1352,7 @@ #ifdef WIFI_DIRECT_SUPPORT && priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT #endif - ) { + ) { PRINTM(MIOCTL, "Bss type [%d] is not STA/P2P, ignore\n", (int)priv->bss_type); ret = NOTIFY_DONE; @@ -1026,12 +1369,37 @@ sizeof(priv->ip_addr)); priv->ip_addr_type = IPADDR_TYPE_IPV4; #ifdef STA_CFG80211 - if (!moal_extflg_isset(priv->phandle, EXT_HW_TEST) && - priv->roaming_enabled) { + if (!moal_extflg_isset(priv->phandle, EXT_HW_TEST)) { snprintf(rssi_low, sizeof(rssi_low), "%d", priv->rssi_low); - woal_set_rssi_low_threshold(priv, rssi_low, - MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != + woal_set_rssi_low_threshold(priv, rssi_low, + MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "%s: woal_set_rssi_low_threshold failed \n", + __func__); + goto done; + } + } +#endif +#ifdef STA_CFG80211 + if (priv->phandle->fw_roam_enable && + (priv->phandle->fw_roam_enable != AUTO_RECONNECT) && + !moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) { + snprintf(rssi_low, sizeof(rssi_low), "%d", + priv->rssi_low); + if (MLAN_STATUS_SUCCESS != + woal_set_rssi_low_threshold(priv, rssi_low, + MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "%s: woal_set_rssi_low_threshold failed \n", + __func__); + goto done; + } + if (priv->pmk_saved) { + woal_set_clear_pmk(priv, MLAN_ACT_SET); + priv->pmk_saved = false; + } } #endif break; @@ -1052,6 +1420,7 @@ return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) /** * @brief This function handle the net interface ipv6 address change event @@ -1062,9 +1431,8 @@ * * @return NOTIFY_DONE or NOTIFY_OK */ -static int -woal_inet6_netdeive_event(struct notifier_block *nb, - unsigned long event, void *ptr) +static int woal_inet6_netdeive_event(struct notifier_block *nb, + unsigned long event, void *ptr) { struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; struct net_device *ndev = ifa->idev->dev; @@ -1095,7 +1463,7 @@ #ifdef WIFI_DIRECT_SUPPORT && priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT #endif - ) { + ) { PRINTM(MIOCTL, "Bss type [%d] is not STA/P2P, ignore\n", (int)priv->bss_type); ret = NOTIFY_DONE; @@ -1126,6 +1494,7 @@ return ret; } #endif +#endif /** * @brief This function validates a SSID as being able to be printed @@ -1134,8 +1503,7 @@ * * @return MTRUE or MFALSE */ -BOOLEAN -woal_ssid_valid(mlan_802_11_ssid *pssid) +BOOLEAN woal_ssid_valid(mlan_802_11_ssid *pssid) { #ifdef ASCII_SSID_CHECK unsigned int ssid_idx; @@ -1162,8 +1530,7 @@ * @param context A pointer to context * @return N/A */ -void -woal_remain_timer_func(void *context) +void woal_remain_timer_func(void *context) { moal_handle *handle = (moal_handle *)context; moal_private *priv = handle->priv[handle->remain_bss_index]; @@ -1174,16 +1541,15 @@ if (handle->cookie) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - priv->netdev, + priv->netdev, #else - priv->wdev, + priv->wdev, #endif - handle->cookie, - &handle->chan, + handle->cookie, &handle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - handle->channel_type, + handle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); handle->cookie = 0; } handle->is_remain_timer_set = MFALSE; @@ -1202,8 +1568,7 @@ * @param context A pointer to context * @return N/A */ -void -woal_go_timer_func(void *context) +void woal_go_timer_func(void *context) { moal_handle *handle = (moal_handle *)context; @@ -1226,12 +1591,11 @@ * * @return MTRUE/MFALSE; */ -int -woal_is_connected(moal_private *priv, mlan_ssid_bssid *ssid_bssid) +int woal_is_connected(moal_private *priv, mlan_ssid_bssid *ssid_bssid) { mlan_bss_info bss_info; int ret = MFALSE; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; ENTER(); memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != @@ -1239,8 +1603,8 @@ goto done; if (bss_info.media_connected) { if (memcmp(ssid_bssid->bssid, zero_mac, sizeof(zero_mac))) { - if (ssid_bssid->ssid.ssid_len) { /* compare ssid and - bssid */ + if (ssid_bssid->ssid.ssid_len) { /* compare ssid and + bssid */ if ((ssid_bssid->ssid.ssid_len == bss_info.ssid.ssid_len) && !memcmp(ssid_bssid->ssid.ssid, @@ -1249,19 +1613,19 @@ !memcmp(ssid_bssid->bssid, bss_info.bssid, MLAN_MAC_ADDR_LENGTH)) ret = MTRUE; - } else { /* compare bssid */ + } else { /* compare bssid */ if (!memcmp(ssid_bssid->bssid, bss_info.bssid, MLAN_MAC_ADDR_LENGTH)) { - moal_memcpy_ext(priv->phandle, - &ssid_bssid->ssid, - &bss_info.ssid, - sizeof(bss_info.ssid), - sizeof(ssid_bssid-> - ssid)); + moal_memcpy_ext( + priv->phandle, + &ssid_bssid->ssid, + &bss_info.ssid, + sizeof(bss_info.ssid), + sizeof(ssid_bssid->ssid)); ret = MTRUE; } } - } else { /* compare ssid */ + } else { /* compare ssid */ if (ssid_bssid->ssid.ssid_len && (ssid_bssid->ssid.ssid_len == bss_info.ssid.ssid_len) && @@ -1290,8 +1654,7 @@ * * @return Pointer of the specific IE -- success, NULL -- fail */ -const t_u8 * -woal_parse_ie_tlv(const t_u8 *ie, int len, t_u8 id) +const t_u8 *woal_parse_ie_tlv(const t_u8 *ie, int len, t_u8 id) { int left_len = len; const t_u8 *pos = ie; @@ -1323,8 +1686,7 @@ * @return Pointer of the specific Extended IE -- success, NULL * -- fail */ -const t_u8 * -woal_parse_ext_ie_tlv(const t_u8 *ie, int len, t_u8 ext_id) +const t_u8 *woal_parse_ext_ie_tlv(const t_u8 *ie, int len, t_u8 ext_id) { int left_len = len; const t_u8 *pos = ie; @@ -1356,8 +1718,7 @@ * * @return Wireless mode */ -t_u32 -woal_get_mode(moal_private *priv, t_u8 wait_option) +t_u32 woal_get_mode(moal_private *priv, t_u8 wait_option) { mlan_ds_bss *bss = NULL; mlan_ioctl_req *req = NULL; @@ -1414,22 +1775,19 @@ * * @return N/A */ -void -woal_update_firmware_name(moal_handle *handle) +void woal_update_firmware_name(moal_handle *handle) { if (handle->params.fw_name) { handle->drv_mode.fw_name = handle->params.fw_name; } else { - if (!moal_extflg_isset(handle, EXT_FW_SERIAL) - || handle->fw_reload || handle->params.fw_reload) { + if (!moal_extflg_isset(handle, EXT_FW_SERIAL) || + handle->fw_reload || handle->params.fw_reload) { handle->drv_mode.fw_name = handle->card_info->fw_name_wlan; } else handle->drv_mode.fw_name = handle->card_info->fw_name; - } } - /** * @brief This function dynamically populates the driver mode table * @@ -1438,8 +1796,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_update_drv_tbl(moal_handle *handle, int drv_mode_local) +mlan_status woal_update_drv_tbl(moal_handle *handle, int drv_mode_local) { mlan_status ret = MLAN_STATUS_SUCCESS; unsigned int intf_num = 0; @@ -1460,6 +1817,7 @@ #ifdef WIFI_DIRECT_SUPPORT int max_wfd_bss = handle->params.max_wfd_bss; #endif + int max_dfs_bss = MAX_DFS_BSS; ENTER(); @@ -1504,8 +1862,11 @@ intf_num += max_vir_bss; #endif } + #endif /* WIFI_DIRECT_SUPPORT */ + if (drv_mode_local & DRV_MODE_DFS) + intf_num += max_dfs_bss; /* Create BSS attribute table */ if ((intf_num == 0) || (intf_num > MLAN_MAX_BSS_NUM)) { PRINTM(MERROR, "Unsupported number of BSS %d\n", intf_num); @@ -1574,6 +1935,20 @@ } #endif /* WIFI_DIRECT_SUPPORT */ + if (drv_mode_local & DRV_MODE_DFS) { + for (j = 0; j < max_dfs_bss; j++) { + if (i >= (int)intf_num) + break; + bss_tbl[i].bss_type = MLAN_BSS_TYPE_DFS; + bss_tbl[i].frame_type = MLAN_DATA_FRAME_TYPE_ETH_II; + bss_tbl[i].active = MTRUE; + bss_tbl[i].bss_priority = 0; + bss_tbl[i].bss_num = j; + bss_tbl[i].bss_virtual = MFALSE; + i++; + } + } + #ifdef WIFI_DIRECT_SUPPORT #if defined(STA_CFG80211) && defined(UAP_CFG80211) /** append virtual interface at the end of table */ @@ -1614,8 +1989,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_init_sw(moal_handle *handle) +mlan_status woal_init_sw(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; unsigned int i; @@ -1640,7 +2014,7 @@ #ifdef MFG_CMD_SUPPORT && !handle->params.mfg_mode #endif - ) { + ) { PRINTM(MERROR, "STA without WEXT or CFG80211 bit definition!\n"); LEAVE(); @@ -1683,7 +2057,7 @@ handle->is_suspended = MFALSE; handle->hs_activated = MFALSE; - handle->hs_auto_arp = MTRUE; + handle->hs_auto_arp = MFALSE; handle->suspend_fail = MFALSE; handle->hs_skip_count = 0; handle->hs_force_count = 0; @@ -1742,6 +2116,9 @@ handle->cac_bss_index = 0xff; #endif #endif +#if defined(STA_CFG80211) && defined(UAP_CFG80211) + handle->mon_if = NULL; +#endif #ifdef REASSOCIATION MOAL_INIT_SEMAPHORE(&handle->reassoc_sem); @@ -1754,7 +2131,7 @@ handle->is_reassoc_timer_set = MFALSE; #endif /* REASSOCIATION */ - /* Initialize the timer for the FW dump */ + /* Initialize the timer for the FW dump*/ woal_initialize_timer(&handle->fw_dump_timer, woal_fw_dump_timer_func, handle); handle->is_fw_dump_timer_set = MFALSE; @@ -1792,6 +2169,7 @@ device.rx_cmd_ep = cardp->rx_cmd_ep; device.tx_data_ep = cardp->tx_data_ep; device.rx_data_ep = cardp->rx_data_ep; + device.tx_data2_ep = cardp->tx_data2_ep; } #endif #ifdef MFG_CMD_SUPPORT @@ -1811,6 +2189,7 @@ device.cfg_11d = (t_u32)handle->params.cfg_11d; #endif device.indrstcfg = (t_u32)handle->params.indrstcfg; + device.drcs_chantime_mode = (t_u32)handle->params.drcs_chantime_mode; #ifdef PCIE if (IS_PCIE(handle->card_type)) device.ring_size = handle->params.ring_size; @@ -1824,9 +2203,9 @@ #ifdef SDIO_MMC #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36) device.max_segs = ((struct sdio_mmc_card *)handle->card) - ->func->card->host->max_segs; + ->func->card->host->max_segs; device.max_seg_size = ((struct sdio_mmc_card *)handle->card) - ->func->card->host->max_seg_size; + ->func->card->host->max_seg_size; #endif PRINTM(MMSG, "SDIO: max_segs=%d max_seg_size=%d\n", device.max_segs, device.max_seg_size); @@ -1869,11 +2248,15 @@ #ifdef UAP_SUPPORT device.uap_max_sta = handle->params.uap_max_sta; #endif + device.mcs32 = handle->params.mcs32; device.hs_wake_interval = handle->params.hs_wake_interval; device.indication_gpio = handle->params.indication_gpio; device.hs_mimo_switch = moal_extflg_isset(handle, EXT_HS_MIMO_SWITCH); device.dfs53cfg = handle->params.dfs53cfg; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + device.dfs_offload = moal_extflg_isset(handle, EXT_DFS_OFFLOAD); +#endif for (i = 0; i < handle->drv_mode.intf_num; i++) { device.bss_attr[i].bss_type = @@ -1909,8 +2292,7 @@ * * @return N/A */ -void -woal_free_moal_handle(moal_handle *handle) +void woal_free_moal_handle(moal_handle *handle) { moal_handle *ref_handle = NULL; @@ -1924,9 +2306,7 @@ /* Unregister wiphy device and free */ if (handle->wiphy) { wiphy_unregister(handle->wiphy); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - woal_cfg80211_free_iftype_data(handle->wiphy); -#endif + woal_cfg80211_free_bands(handle->wiphy); wiphy_free(handle->wiphy); handle->wiphy = NULL; } @@ -1994,16 +2374,15 @@ * @param line_pos Destination data * @return routnine status */ -static t_size -parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos) +static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos) { t_u8 *src, *dest; static t_s32 pos; ENTER(); - if (pos >= (t_s32)size) { /* reach the end */ - pos = 0; /* Reset position for rfkill */ + if (pos >= (t_s32)size) { /* reach the end */ + pos = 0; /* Reset position for rfkill */ LEAVE(); return -1; } @@ -2013,7 +2392,7 @@ while ((dest - line_pos < MAX_LINE_LEN - 1) && pos < (t_s32)size && *src != '\x0A' && *src != '\0') { - if (*src != ' ' && *src != '\t') /* parse space */ + if (*src != ' ' && *src != '\t') /* parse space */ *dest++ = *src++; else src++; @@ -2033,9 +2412,8 @@ * @param value_string String format Pointer to value * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -woal_process_regrdwr(moal_handle *handle, t_u8 *type_string, - t_u8 *offset_string, t_u8 *value_string) +static t_u32 woal_process_regrdwr(moal_handle *handle, t_u8 *type_string, + t_u8 *offset_string, t_u8 *value_string) { mlan_status ret = MLAN_STATUS_FAILURE; int type, offset, value; @@ -2100,9 +2478,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_getset_regrdwr(moal_private *priv, t_u32 action, t_u32 type, - t_u32 offset, t_u32 *value) +static int woal_getset_regrdwr(moal_private *priv, t_u32 action, t_u32 type, + t_u32 offset, t_u32 *value) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -2149,13 +2526,13 @@ * @param handle MOAL handle * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -woal_set_sdio_slew_rate(moal_handle *handle) +static t_u32 woal_set_sdio_slew_rate(moal_handle *handle) { t_u32 value = 0; mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = NULL; t_u32 new_value = 0; + t_u32 reg_type = MLAN_REG_MAC; priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (!priv) @@ -2164,8 +2541,13 @@ if ((handle->card_info->slew_rate_reg != 0) && (handle->params.slew_rate > 3 || handle->params.slew_rate < 0)) return MLAN_STATUS_FAILURE; +#if defined(SD9098) || defined(SD9097) || defined(SDNW62X) || defined(SD9177) + if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || + IS_SDNW62X(handle->card_type) || IS_SD9177(handle->card_type)) + reg_type = MLAN_REG_CIU; +#endif - ret = woal_getset_regrdwr(priv, MLAN_ACT_GET, MLAN_REG_MAC, + ret = woal_getset_regrdwr(priv, MLAN_ACT_GET, reg_type, handle->card_info->slew_rate_reg, &value); if (ret < 0) { PRINTM(MERROR, "woal_getset_regrdwr get REG_MAC failed\n"); @@ -2174,13 +2556,13 @@ } new_value = value & ~(0x3 << handle->card_info->slew_rate_bit_offset); new_value |= (t_u32)handle->params.slew_rate - << handle->card_info->slew_rate_bit_offset; + << handle->card_info->slew_rate_bit_offset; if (value != new_value) { PRINTM(MMSG, "Set REG 0x%8x: 0x%x slew_rate=%d\n", handle->card_info->slew_rate_reg, new_value, handle->params.slew_rate); - ret = woal_getset_regrdwr(priv, MLAN_ACT_SET, MLAN_REG_MAC, + ret = woal_getset_regrdwr(priv, MLAN_ACT_SET, reg_type, handle->card_info->slew_rate_reg, &new_value); if (ret < 0) { @@ -2201,8 +2583,7 @@ * @param handle MOAL handle * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_set_uap_operation_ctrl(moal_handle *handle) +static mlan_status woal_set_uap_operation_ctrl(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = NULL; @@ -2256,13 +2637,12 @@ * @param size data length * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -woal_process_init_cfg(moal_handle *handle, t_u8 *data, t_size size) +static t_u32 woal_process_init_cfg(moal_handle *handle, t_u8 *data, t_size size) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 *pos; t_u8 *intf_s, *intf_e; - t_u8 s[MAX_LINE_LEN]; /* 1 line data */ + t_u8 s[MAX_LINE_LEN]; /* 1 line data */ t_size line_len; t_u8 index = 0; t_u32 i; @@ -2281,7 +2661,7 @@ if (*pos == '#' || (*pos == '\r' && *(pos + 1) == '\n') || *pos == '\n' || *pos == '\0') - continue; /* Needn't process this line */ + continue; /* Needn't process this line */ /* Process MAC addr */ if (strncmp(pos, "mac_addr", 8) == 0) { @@ -2304,58 +2684,65 @@ intf_e - intf_s - 1); bss_mac_name[intf_e - intf_s - 1] = '\0'; for (i = 0; i < handle->priv_num; i++) { - if (strcmp(bss_mac_name, handle->priv[i] - ->netdev->name) == 0) { + if (strcmp(bss_mac_name, + handle->priv[i] + ->netdev->name) == + 0) { memset(handle->priv[i] - ->current_addr, + ->current_addr, 0, ETH_ALEN); PRINTM(MINFO, "Interface name: %s mac: %s\n", bss_mac_name, bss_mac_addr); - woal_mac2u8(handle->priv[i] - ->current_addr, - bss_mac_addr); + woal_mac2u8( + handle->priv[i] + ->current_addr, + bss_mac_addr); #ifdef WIFI_DIRECT_SUPPORT #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION if (handle->priv[i]->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { handle->priv[i] - -> - current_addr[0] - |= 0x02; + ->current_addr[0] |= + 0x02; PRINTM(MCMND, - "Set WFD device addr: " - MACSTR "\n", - MAC2STR(handle-> - priv[i] - -> - current_addr)); + "Set WFD device addr: " MACSTR + "\n", + MAC2STR(handle->priv[i] + ->current_addr)); } #endif #endif #endif /* Set WLAN MAC addresses */ if (MLAN_STATUS_SUCCESS != - woal_request_set_mac_address - (handle->priv[i], - MOAL_IOCTL_WAIT)) { + woal_request_set_mac_address( + handle->priv[i], + MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Set MAC address failed\n"); goto done; } - moal_memcpy_ext(handle, - handle->priv[i] - ->netdev-> - dev_addr, - handle->priv[i] +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set( + handle->priv[i]->netdev, + handle->priv[i] + ->current_addr); +#else + moal_memcpy_ext( + handle, + handle->priv[i] + ->netdev + ->dev_addr, + handle->priv[i] ->current_addr, - ETH_ALEN, - ETH_ALEN); - index++; /* Mark found one - interface matching - */ + ETH_ALEN, ETH_ALEN); +#endif + index++; /* Mark found one + interface matching + */ } } } else { @@ -2435,9 +2822,8 @@ * @param wait_option wait option * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -woal_process_hostcmd_cfg(moal_handle *handle, t_u8 *data, - t_size size, t_u8 wait_option) +static mlan_status woal_process_hostcmd_cfg(moal_handle *handle, t_u8 *data, + t_size size, t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; t_u8 *pos = data; @@ -2452,10 +2838,11 @@ #define CMD_BUF_LEN 2048 ENTER(); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; buf = kzalloc(CMD_BUF_LEN, flag); if (!buf) { PRINTM(MERROR, "Could not allocate buffer space!\n"); + ret = MLAN_STATUS_FAILURE; goto done; } ptr = buf; @@ -2464,7 +2851,7 @@ while ((pos - data) < size) { while (*pos == ' ' || *pos == '\t') pos++; - if (*pos == '#') { /* Line comment */ + if (*pos == '#') { /* Line comment */ while (*pos != '\n') pos++; pos++; @@ -2472,7 +2859,7 @@ if ((*pos == '\r' && *(pos + 1) == '\n') || *pos == '\n' || *pos == '\0') { pos++; - continue; /* Needn't process this line */ + continue; /* Needn't process this line */ } if (*pos == '}') { @@ -2526,7 +2913,6 @@ LEAVE(); return ret; } - #define INIT_CFG_DATA 0x00 #define INIT_HOSTCMD_CFG_DATA 0x02 #define COUNTRY_POWER_TABLE 0x04 @@ -2575,9 +2961,8 @@ * * @return N/A */ -static void -woal_request_init_dpd_conf_callback(const struct firmware *firmware, - void *context) +static void woal_request_init_dpd_conf_callback(const struct firmware *firmware, + void *context) { moal_handle *handle; @@ -2609,8 +2994,8 @@ * * @return N/A */ -static void -woal_request_vdll_fw_callback(const struct firmware *firmware, void *context) +static void woal_request_vdll_fw_callback(const struct firmware *firmware, + void *context) { moal_handle *handle; @@ -2640,8 +3025,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_vdll_req_fw(moal_handle *handle) +mlan_status woal_vdll_req_fw(moal_handle *handle) { int ret = MLAN_STATUS_SUCCESS; t_u8 req_fw_nowait = moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT); @@ -2652,28 +3036,27 @@ PRINTM(MMSG, "VDLL: Request firmware: %s\n", vdll_fw); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, vdll_fw, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_vdll_fw_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, vdll_fw, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_vdll_fw_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, vdll_fw, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_vdll_fw_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, vdll_fw, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_vdll_fw_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, vdll_fw, - handle->hotplug_device, handle, - woal_request_vdll_fw_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, vdll_fw, + handle->hotplug_device, handle, + woal_request_vdll_fw_callback)) < 0) { #else - if ((request_firmware_nowait(THIS_MODULE, vdll_fw, - handle->hotplug_device, - handle, - woal_request_vdll_fw_callback)) - < 0) { + if ((request_firmware_nowait( + THIS_MODULE, vdll_fw, + handle->hotplug_device, handle, + woal_request_vdll_fw_callback)) < 0) { #endif #endif #endif @@ -2683,9 +3066,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->firmware, vdll_fw, handle->hotplug_device)) < 0) { @@ -2744,9 +3127,8 @@ * * @return N/A */ -static void -woal_request_init_cfg_data_callback(const struct firmware *firmware, - void *context) +static void woal_request_init_cfg_data_callback(const struct firmware *firmware, + void *context) { moal_handle *handle; @@ -2778,9 +3160,8 @@ * @param country_txpwrlimit Configure Tx Power Limit * @return MLAN_STATUS_SUCCESS--success, otherwise--fail */ -static t_u32 -woal_set_user_init_data(moal_handle *handle, int type, - t_u8 wait_option, char *country_txpwrlimit) +static t_u32 woal_set_user_init_data(moal_handle *handle, int type, + t_u8 wait_option, char *country_txpwrlimit) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 *cfg_data = NULL; @@ -2796,28 +3177,27 @@ PRINTM(MMSG, "Request firmware: %s\n", init_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, init_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_cfg_data_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, init_cfg, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_init_cfg_data_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, init_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_cfg_data_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, init_cfg, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_init_cfg_data_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, init_cfg, - handle->hotplug_device, handle, - woal_request_init_cfg_data_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, init_cfg, + handle->hotplug_device, handle, + woal_request_init_cfg_data_callback)) < 0) { #else - if ((request_firmware_nowait(THIS_MODULE, init_cfg, - handle->hotplug_device, - handle, - woal_request_init_cfg_data_callback)) - < 0) { + if ((request_firmware_nowait( + THIS_MODULE, init_cfg, + handle->hotplug_device, handle, + woal_request_init_cfg_data_callback)) < 0) { #endif #endif #endif @@ -2826,9 +3206,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->init_cfg_data, init_cfg, handle->hotplug_device)) < 0) { @@ -2849,29 +3229,34 @@ * Limit */ if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, country_txpwrlimit, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, + country_txpwrlimit, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, - country_txpwrlimit, handle->hotplug_device, - GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + country_txpwrlimit, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, - country_txpwrlimit, handle->hotplug_device, - handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + country_txpwrlimit, handle->hotplug_device, + handle, + woal_request_init_user_conf_callback)) < + 0) { #else - if ((request_firmware_nowait - (THIS_MODULE, country_txpwrlimit, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, country_txpwrlimit, + handle->hotplug_device, handle, + woal_request_init_user_conf_callback)) < + 0) { #endif #endif #endif @@ -2880,15 +3265,15 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - int status = request_firmware_direct(&handle->user_data, - country_txpwrlimit, - handle-> - hotplug_device); + int status = + request_firmware_direct(&handle->user_data, + country_txpwrlimit, + handle->hotplug_device); #else int status = request_firmware(&handle->user_data, country_txpwrlimit, @@ -2910,27 +3295,34 @@ PRINTM(MMSG, "Request firmware: %s\n", init_hostcmd_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, init_hostcmd_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, + init_hostcmd_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, init_hostcmd_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + init_hostcmd_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, init_hostcmd_cfg, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + init_hostcmd_cfg, handle->hotplug_device, + handle, + woal_request_init_user_conf_callback)) < + 0) { #else - if ((request_firmware_nowait - (THIS_MODULE, init_hostcmd_cfg, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, init_hostcmd_cfg, + handle->hotplug_device, handle, + woal_request_init_user_conf_callback)) < + 0) { #endif #endif #endif @@ -2939,9 +3331,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->user_data, init_hostcmd_cfg, @@ -2956,27 +3348,34 @@ PRINTM(MMSG, "Request firmware: %s\n", band_steer_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, band_steer_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, + band_steer_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, band_steer_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + band_steer_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, band_steer_cfg, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + band_steer_cfg, handle->hotplug_device, + handle, + woal_request_init_user_conf_callback)) < + 0) { #else - if ((request_firmware_nowait - (THIS_MODULE, band_steer_cfg, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, band_steer_cfg, + handle->hotplug_device, handle, + woal_request_init_user_conf_callback)) < + 0) { #endif #endif #endif @@ -2985,9 +3384,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->user_data, band_steer_cfg, @@ -3001,8 +3400,9 @@ if (handle->user_data) { cfg_data = (t_u8 *)(handle->user_data)->data; len = (handle->user_data)->size; - if (type == INIT_HOSTCMD_CFG_DATA || type == BAND_STEER_CFG_DATA - || type == COUNTRY_POWER_TABLE) { + if (type == INIT_HOSTCMD_CFG_DATA || + type == BAND_STEER_CFG_DATA || + type == COUNTRY_POWER_TABLE) { if (MLAN_STATUS_SUCCESS != woal_process_hostcmd_cfg(handle, cfg_data, len, wait_option)) { @@ -3039,10 +3439,9 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_wacp_mode(moal_private *priv, t_u8 wait_option) +mlan_status woal_set_wacp_mode(moal_private *priv, t_u8 wait_option) { - //moal_private *priv = NULL; + // moal_private *priv = NULL; mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *pcfg_misc = NULL; mlan_status status; @@ -3082,8 +3481,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_init_aggr_ctrl(moal_handle *handle, t_u8 wait_option) +mlan_status woal_init_aggr_ctrl(moal_handle *handle, t_u8 wait_option) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; @@ -3121,6 +3519,87 @@ return status; } +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) +static ssize_t woal_set_rps_map(struct netdev_rx_queue *queue, const char *buf, + size_t len) +{ + struct rps_map *old_map, *map; + cpumask_var_t mask; + int err, cpu, i; + static DEFINE_MUTEX(local_rps_map_mutex); + + if (!queue || !queue->dev) { + PRINTM(MERROR, "%s: queue=%px or queue->dev is NULL\n", + __func__, queue); + return -EINVAL; + } + + if (!alloc_cpumask_var(&mask, GFP_KERNEL)) { + PRINTM(MERROR, "%s: alloc_cpumask_var fail.\n", __func__); + return -ENOMEM; + } + + err = bitmap_parse(buf, len, cpumask_bits(mask), nr_cpumask_bits); + if (err) { + PRINTM(MERROR, "%s: bitmap_parse fail err=%d.\n", __func__, + err); + free_cpumask_var(mask); + return err; + } + + map = kzalloc(max_t(unsigned int, RPS_MAP_SIZE(cpumask_weight(mask)), + L1_CACHE_BYTES), + GFP_KERNEL); + if (!map) { + PRINTM(MERROR, "%s: kzalloc map fail.\n", __func__); + free_cpumask_var(mask); + return -ENOMEM; + } + + i = 0; + for_each_cpu_and (cpu, mask, cpu_online_mask) { + PRINTM(MCMND, "map->cpus[%d]=%d\n", i, cpu); + map->cpus[i++] = cpu; + } + + if (i) { + map->len = i; + PRINTM(MCMND, "map->len=%d\n", map->len); + } else { + kfree(map); + map = NULL; + } + + mutex_lock(&local_rps_map_mutex); + old_map = rcu_dereference_protected( + queue->rps_map, mutex_is_locked(&local_rps_map_mutex)); + rcu_assign_pointer(queue->rps_map, map); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) + if (map) + static_branch_inc(&rps_needed); + if (old_map) + static_branch_dec(&rps_needed); +#else + if (map) + static_key_slow_inc(&rps_needed); + if (old_map) + static_key_slow_dec(&rps_needed); + +#endif + mutex_unlock(&local_rps_map_mutex); + + if (old_map) + kfree_rcu(old_map, rcu); + + PRINTM(MMSG, "%s on %s: buf=%s(%u) (%d i=%d)\n", __func__, + queue->dev->name, buf, (t_u32)len, nr_cpumask_bits, i); + free_cpumask_var(mask); + return len; +} +#endif +#endif + /** * @brief Add interfaces DPC * @@ -3128,12 +3607,19 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_add_card_dpc(moal_handle *handle) +static mlan_status woal_add_card_dpc(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; int i; char str_buf[MLAN_MAX_VER_STR_LEN]; + +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + moal_private *priv_rps = NULL; + t_u8 rps_buf[2]; +#endif +#endif + ENTER(); #if defined(USB) @@ -3154,8 +3640,7 @@ if (handle->drv_mode.bss_attr[i].bss_virtual) continue; if (!woal_add_interface(handle, handle->priv_num, - handle->drv_mode.bss_attr[i]. - bss_type)) { + handle->drv_mode.bss_attr[i].bss_type)) { ret = MLAN_STATUS_FAILURE; goto err; } @@ -3192,6 +3677,7 @@ goto err; } } + #ifdef USB if (handle->params.usb_aggr == 1) { /* Enable USB aggregation in FW */ @@ -3208,6 +3694,10 @@ /* Proceed with Warning */ PRINTM(MERROR, "Unable to set Low Power Mode\n"); } + + /* Add channel tracking check */ + woal_set_chan_track_mode(handle, MOAL_IOCTL_WAIT); + #if defined(SDIO) if (IS_SD(handle->card_type)) woal_set_sdio_slew_rate(handle); @@ -3230,11 +3720,13 @@ goto err; } } + #ifdef UAP_SUPPORT if (handle->params.uap_oper_ctrl) woal_set_uap_operation_ctrl(handle); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) handle->woal_inet6_notifier.notifier_call = woal_inet6_netdeive_event; if (register_inet6addr_notifier(&handle->woal_inet6_notifier)) { @@ -3243,6 +3735,29 @@ goto err; } #endif +#endif + +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + if (handle->params.rps) { + priv_rps = woal_get_priv_bss_type(handle, MLAN_BSS_TYPE_STA); + sprintf(rps_buf, "%x", handle->params.rps); + if (priv_rps) { + PRINTM(MCMND, + "num_rx_queues=%u real_num_rx_queues=%u\n", + priv_rps->netdev->num_rx_queues, + priv_rps->netdev->real_num_rx_queues); + for (i = 0; + i < (int)MIN(priv_rps->netdev->num_rx_queues, + priv_rps->netdev->real_num_rx_queues); + i++) { + woal_set_rps_map(&(priv_rps->netdev->_rx[i]), + rps_buf, strlen(rps_buf)); + } + } + } +#endif +#endif #ifdef MFG_CMD_SUPPORT done: @@ -3255,9 +3770,11 @@ if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Failed to add interface\n"); unregister_inetaddr_notifier(&handle->woal_notifier); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) unregister_inet6addr_notifier(&handle->woal_inet6_notifier); #endif +#endif for (i = 0; i < MIN(MLAN_MAX_BSS_NUM, handle->priv_num); i++) woal_remove_interface(handle, i); @@ -3277,8 +3794,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_req_dpd_data(moal_handle *handle, mlan_init_param *param) +static mlan_status woal_req_dpd_data(moal_handle *handle, + mlan_init_param *param) { int ret = MLAN_STATUS_SUCCESS; t_u8 req_fw_nowait = moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT); @@ -3291,28 +3808,29 @@ PRINTM(MMSG, "Request firmware: %s\n", dpd_data_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, dpd_data_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_dpd_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, dpd_data_cfg, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_init_dpd_conf_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, dpd_data_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_dpd_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + dpd_data_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_dpd_conf_callback)) < 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, dpd_data_cfg, - handle->hotplug_device, handle, - woal_request_init_dpd_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + dpd_data_cfg, handle->hotplug_device, + handle, + woal_request_init_dpd_conf_callback)) < 0) { #else - if ((request_firmware_nowait(THIS_MODULE, dpd_data_cfg, - handle->hotplug_device, - handle, - woal_request_init_dpd_conf_callback)) - < 0) { + if ((request_firmware_nowait( + THIS_MODULE, dpd_data_cfg, + handle->hotplug_device, handle, + woal_request_init_dpd_conf_callback)) < 0) { #endif #endif #endif @@ -3322,9 +3840,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { status = request_firmware(&handle->dpd_data, dpd_data_cfg, @@ -3356,8 +3874,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_req_txpwr_data(moal_handle *handle, mlan_init_param *param) +static mlan_status woal_req_txpwr_data(moal_handle *handle, + mlan_init_param *param) { int ret = MLAN_STATUS_SUCCESS; t_u8 req_fw_nowait = moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT); @@ -3370,27 +3888,34 @@ handle->params.txpwrlimit_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, txpwrlimit_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_txpwr_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, + txpwrlimit_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_txpwr_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, txpwrlimit_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_txpwr_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + txpwrlimit_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_txpwr_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, txpwrlimit_cfg, - handle->hotplug_device, handle, - woal_request_init_txpwr_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + txpwrlimit_cfg, handle->hotplug_device, + handle, + woal_request_init_txpwr_conf_callback)) < + 0) { #else - if ((request_firmware_nowait - (THIS_MODULE, txpwrlimit_cfg, - handle->hotplug_device, handle, - woal_request_init_txpwr_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, txpwrlimit_cfg, + handle->hotplug_device, handle, + woal_request_init_txpwr_conf_callback)) < + 0) { #endif #endif #endif @@ -3401,15 +3926,15 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->txpwr_data, txpwrlimit_cfg, handle->hotplug_device)) < 0) { PRINTM(MERROR, "Region txpwrlimit cfg data " - "request_firmware() failed\n"); + "request_firmware() failed\n"); ret = MLAN_STATUS_FAILURE; goto done; } @@ -3433,8 +3958,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_req_cal_data(moal_handle *handle, mlan_init_param *param) +static mlan_status woal_req_cal_data(moal_handle *handle, + mlan_init_param *param) { int ret = MLAN_STATUS_SUCCESS; t_u8 req_fw_nowait = moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT); @@ -3446,28 +3971,33 @@ PRINTM(MMSG, "Request firmware: %s\n", cal_data_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_UEVENT, cal_data_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_UEVENT, cal_data_cfg, + handle->hotplug_device, GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, cal_data_cfg, - handle->hotplug_device, GFP_KERNEL, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + cal_data_cfg, handle->hotplug_device, + GFP_KERNEL, handle, + woal_request_init_user_conf_callback)) < + 0) { #else #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13) - if ((request_firmware_nowait - (THIS_MODULE, FW_ACTION_HOTPLUG, cal_data_cfg, - handle->hotplug_device, handle, - woal_request_init_user_conf_callback)) < 0) { + if ((request_firmware_nowait( + THIS_MODULE, FW_ACTION_HOTPLUG, + cal_data_cfg, handle->hotplug_device, + handle, + woal_request_init_user_conf_callback)) < + 0) { #else - if ((request_firmware_nowait(THIS_MODULE, cal_data_cfg, - handle->hotplug_device, - handle, - woal_request_init_user_conf_callback)) - < 0) { + if ((request_firmware_nowait( + THIS_MODULE, cal_data_cfg, + handle->hotplug_device, handle, + woal_request_init_user_conf_callback)) < + 0) { #endif #endif #endif @@ -3477,9 +4007,9 @@ goto done; } handle->init_user_conf_wait_flag = MFALSE; - wait_event_interruptible(handle->init_user_conf_wait_q, - handle-> - init_user_conf_wait_flag); + wait_event_interruptible( + handle->init_user_conf_wait_q, + handle->init_user_conf_wait_flag); } else { if ((request_firmware(&handle->user_data, cal_data_cfg, handle->hotplug_device)) < 0) { @@ -3511,8 +4041,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_reset_usb_dev(moal_handle *handle) +static mlan_status woal_reset_usb_dev(moal_handle *handle) { int ret = MLAN_STATUS_SUCCESS; struct usb_device *udev = ((struct usb_card_rec *)(handle->card))->udev; @@ -3528,13 +4057,14 @@ #define USB_WAIT_FW_READY (500) mdelay(USB_WAIT_FW_READY); usbRstDev_ret = usb_reset_device(udev); - if ((usbRstDev_ret == 0) || (usbRstDev_ret == -ENODEV) || /* expected - since - chip - re-enumerates - */ - (usbRstDev_ret == -EINVAL)) { /* expected if USB FW detaches - first */ + if ((usbRstDev_ret == 0) || + (usbRstDev_ret == -ENODEV) || /* expected + since + chip + re-enumerates + */ + (usbRstDev_ret == -EINVAL)) { /* expected if USB FW detaches + first */ PRINTM(MMSG, "usb_reset_device() successful.\n"); } else { PRINTM(MERROR, @@ -3559,8 +4089,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_init_fw_dpc(moal_handle *handle) +static mlan_status woal_init_fw_dpc(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_fw_image fw; @@ -3576,10 +4105,10 @@ fw.fw_reload = handle->params.fw_reload; else fw.fw_reload = 0; - wifi_status = 0; + wifi_status = WIFI_STATUS_FW_DNLD; ret = mlan_dnld_fw(handle->pmlan_adapter, &fw); if (ret == MLAN_STATUS_FAILURE) { - wifi_status = 1; + wifi_status = WIFI_STATUS_DNLD_FW_FAIL; PRINTM(MERROR, "WLAN: Fail download FW with nowwait: %u\n", moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT)); @@ -3587,13 +4116,14 @@ handle->ops.reg_dbg(handle); goto done; } - wifi_status = 0; + wifi_status = WIFI_STATUS_FW_DNLD_COMPLETE; #if defined(USB) if (handle->boot_state == USB_FW_DNLD) { if (!IS_USB8997(handle->card_type) && !IS_USB9098(handle->card_type) && !IS_USB9097(handle->card_type) && + !IS_USBNW62X(handle->card_type) && !IS_USB8978(handle->card_type)) ret = woal_reset_usb_dev(handle); goto done; @@ -3640,11 +4170,13 @@ return ret; } handle->init_wait_q_woken = MFALSE; + wifi_status = WIFI_STATUS_INIT_FW; ret = mlan_init_fw(handle->pmlan_adapter); if (ret == MLAN_STATUS_FAILURE) { - wifi_status = 2; + wifi_status = WIFI_STATUS_INIT_FW_FAIL; goto done; } else if (ret == MLAN_STATUS_SUCCESS) { + wifi_status = WIFI_STATUS_OK; handle->hardware_status = HardwareStatusReady; goto done; } @@ -3652,11 +4184,20 @@ wait_event_timeout(handle->init_wait_q, handle->init_wait_q_woken, 10 * HZ); if (handle->hardware_status != HardwareStatusReady) { - woal_moal_debug_info(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), - handle, MTRUE); + wifi_status = WIFI_STATUS_INIT_FW_FAIL; + if (handle->ops.reg_dbg) + handle->ops.reg_dbg(handle); +#ifdef DEBUG_LEVEL1 + if (drvdbg & MFW_D) { + drvdbg &= ~MFW_D; + if (handle->ops.dump_fw_info) + handle->ops.dump_fw_info(handle); + } +#endif ret = MLAN_STATUS_FAILURE; goto done; } + wifi_status = WIFI_STATUS_OK; ret = MLAN_STATUS_SUCCESS; done: if (handle->dpd_data) { @@ -3684,8 +4225,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_request_fw_dpc(moal_handle *handle, const struct firmware *firmware) +static mlan_status woal_request_fw_dpc(moal_handle *handle, + const struct firmware *firmware) { mlan_status ret = MLAN_STATUS_SUCCESS; wifi_timeval tstamp; @@ -3704,7 +4245,10 @@ "request_firmware_nowait failed for %s. Retrying..\n", handle->drv_mode.fw_name); woal_sched_timeout(MOAL_TIMER_1S); - woal_request_fw(handle); + ret = woal_request_fw(handle); + if (ret != MLAN_STATUS_SUCCESS) + PRINTM(MERROR, "%s: woal_request_fw failed!\n", + __func__); LEAVE(); return ret; } @@ -3733,8 +4277,8 @@ * * @return N/A */ -static void -woal_request_fw_callback(const struct firmware *firmware, void *context) +static void woal_request_fw_callback(const struct firmware *firmware, + void *context) { moal_handle *handle; @@ -3742,7 +4286,9 @@ handle = (moal_handle *)context; handle->firmware = firmware; - woal_request_fw_dpc((moal_handle *)context, firmware); + if (MLAN_STATUS_SUCCESS != + woal_request_fw_dpc((moal_handle *)context, firmware)) + PRINTM(MERROR, "woal_request_fw_dpc failed\n"); if (firmware) { release_firmware(firmware); handle->firmware = NULL; @@ -3758,8 +4304,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_request_fw(moal_handle *handle) +mlan_status woal_request_fw(moal_handle *handle) { int err; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3833,8 +4378,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_init_fw(moal_handle *handle) +mlan_status woal_init_fw(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -3846,7 +4390,7 @@ #if defined(USB) || (handle->boot_state == USB_FW_READY) #endif /* USB_NEW_FW_DNLD */ - ) { + ) { PRINTM(MMSG, "WLAN FW is active\n"); /* Set it to NULL to skip downloading firmware to card */ @@ -3859,7 +4403,7 @@ goto done; /* Release semaphore if download is not required */ MOAL_REL_SEMAPHORE(&AddRemoveCardSem); -done: + done: LEAVE(); return ret; } @@ -3884,85 +4428,75 @@ * * @return N/A */ -void -woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, - struct sk_buff *skb) +void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, + struct sk_buff *skb) { wifi_timeval tstamp; struct ethhdr *eth; - t_u8 tid = 0; dot11_txcontrol *txcontrol; t_u8 tx_ctrl_flag = MFALSE; int i = 0; ENTER(); - /* - * skb->priority values from 256->263 are magic values to - * directly indicate a specific 802.1d priority. This is used - * to allow 802.1d priority to be passed directly in from VLAN - * tags, etc. - */ - if (IS_SKB_MAGIC_VLAN(skb)) { - tid = GET_VLAN_PRIO(skb); - } else { - eth = (struct ethhdr *)skb->data; - switch (eth->h_proto) { - case __constant_htons(ETH_P_IP): - tid = priv->dscp_map[SKB_TOS(skb) >> DSCP_OFFSET]; - if (tid == 0xFF) - tid = (IPTOS_PREC(SKB_TOS(skb)) >> - IPTOS_OFFSET); - PRINTM(MDAT_D, - "packet type ETH_P_IP: dscp[%x], map[%x], tid=%d\n", - SKB_TOS(skb) >> DSCP_OFFSET, - priv->dscp_map[SKB_TOS(skb) >> DSCP_OFFSET], - tid); - break; - case __constant_htons(ETH_P_IPV6): - tid = SKB_TIDV6(skb); - PRINTM(MDAT_D, - "packet type ETH_P_IPV6: %04x, tid=%#x prio=%#x\n", - eth->h_proto, tid, skb->priority); - break; - case __constant_htons(ETH_P_ARP): - tid = 0; - PRINTM(MDATA, "ARP packet %04x\n", eth->h_proto); - break; - default: - tid = 0; - if (priv->tx_protocols.protocol_num) { - for (i = 0; i < priv->tx_protocols.protocol_num; - i++) { - if (eth->h_proto == - __constant_htons(priv->tx_protocols. - protocols[i])) - tx_ctrl_flag = MTRUE; - } + eth = (struct ethhdr *)skb->data; + + switch (eth->h_proto) { + case __constant_htons(ETH_P_IP): + PRINTM(MINFO, "packet type ETH_P_IP: %04x, prio=%#x\n", + eth->h_proto, skb->priority); + break; + case __constant_htons(ETH_P_IPV6): + PRINTM(MINFO, "packet type ETH_P_IPV6: %04x, prio=%#x\n", + eth->h_proto, skb->priority); + break; + case __constant_htons(ETH_P_ARP): + skb->priority = 0; + PRINTM(MINFO, "ARP packet %04x prio=%#x\n", eth->h_proto, + skb->priority); + break; + default: + skb->priority = 0; + if (priv->tx_protocols.protocol_num) { + for (i = 0; i < priv->tx_protocols.protocol_num; i++) { + if (eth->h_proto == + __constant_htons( + priv->tx_protocols.protocols[i])) + tx_ctrl_flag = MTRUE; } - if (tx_ctrl_flag) { - txcontrol = (dot11_txcontrol - *) (skb->data + - sizeof(struct ethhdr)); - pmbuf->u.tx_info.data_rate = - txcontrol->datarate; - pmbuf->u.tx_info.channel = txcontrol->channel; - pmbuf->u.tx_info.bw = txcontrol->bw; - pmbuf->u.tx_info.tx_power.val = - txcontrol->power; - pmbuf->u.tx_info.retry_limit = - txcontrol->retry_limit; - tid = txcontrol->priority; - memmove(skb->data + sizeof(dot11_txcontrol), - skb->data, sizeof(struct ethhdr)); - skb_pull(skb, sizeof(dot11_txcontrol)); - pmbuf->flags |= MLAN_BUF_FLAG_TX_CTRL; - } - break; + } + if (tx_ctrl_flag) { + txcontrol = (dot11_txcontrol *)(skb->data + + sizeof(struct ethhdr)); + pmbuf->u.tx_info.data_rate = txcontrol->datarate; + pmbuf->u.tx_info.channel = txcontrol->channel; + pmbuf->u.tx_info.bw = txcontrol->bw; + pmbuf->u.tx_info.tx_power.val = txcontrol->power; + pmbuf->u.tx_info.retry_limit = txcontrol->retry_limit; + skb->priority = txcontrol->priority; + memmove(skb->data + sizeof(dot11_txcontrol), skb->data, + sizeof(struct ethhdr)); + skb_pull(skb, sizeof(dot11_txcontrol)); + pmbuf->flags |= MLAN_BUF_FLAG_TX_CTRL; + } + break; + } + PRINTM(MDAT_D, "packet %04x prio=%#x\n", eth->h_proto, skb->priority); + + if (priv->enable_mc_aggr && priv->num_mcast_addr) { + if (woal_find_mcast_node_tx(priv, skb)) { + mc_txcontrol *tx_ctrl = + (mc_txcontrol *)(skb->data + skb->len - + sizeof(mc_txcontrol)); + moal_memcpy_ext(priv->phandle, + (t_u8 *)&pmbuf->u.mc_tx_info, + (t_u8 *)tx_ctrl, sizeof(mc_txcontrol), + sizeof(mc_txcontrol)); + pmbuf->flags |= MLAN_BUF_FLAG_MC_AGGR_PKT; + // use AC_VO + skb->priority = 6; } } - skb->priority = tid; - /* Record the current time the packet was queued; used to determine * the amount of time the packet was queued in the driver before it * was sent to the firmware. The delay is then sent along with the @@ -3990,6 +4524,280 @@ return; } +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +/** + * @brief This function opens the network device for monitor interface + * + * @param dev A pointer to net_device structure + * + * @return 0 -- success, otherwise fail + */ +static int woal_mon_open(struct net_device *ndev) +{ + ENTER(); + LEAVE(); + return 0; +} + +/** + * @brief This function closes the network device for monitor interface + * + * @param dev A pointer to net_device structure + * + * @return 0 -- success, otherwise fail + */ +static int woal_mon_close(struct net_device *ndev) +{ + ENTER(); + LEAVE(); + return 0; +} + +/** + * @brief This function sets the MAC address to firmware for monitor interface + * + * @param dev A pointer to net_device structure + * @param addr MAC address to set + * + * @return 0 -- success, otherwise fail + */ +static int woal_mon_set_mac_address(struct net_device *ndev, void *addr) +{ + ENTER(); + LEAVE(); + return 0; +} + +/** + * @brief This function sets multicast address to firmware for monitor interface + * + * @param dev A pointer to net_device structure + * + * @return 0 -- success, otherwise fail + */ +static void woal_mon_set_multicast_list(struct net_device *ndev) +{ + ENTER(); + LEAVE(); +} + +/** + * @brief This function handles packet transmission for monitor interface + * + * @param skb A pointer to sk_buff structure + * @param dev A pointer to net_device structure + * + * @return 0 -- success, otherwise fail + */ +static netdev_tx_t woal_mon_hard_start_xmit(struct sk_buff *skb, + struct net_device *ndev) +{ + int len_rthdr; + int qos_len = 0; + int dot11_hdr_len = 24; + int snap_len = 6; + unsigned char *pdata; + unsigned short fc; + unsigned char src_mac_addr[6]; + unsigned char dst_mac_addr[6]; + struct ieee80211_hdr *dot11_hdr; + struct ieee80211_radiotap_header *prthdr = + (struct ieee80211_radiotap_header *)skb->data; + monitor_iface *mon_if = netdev_priv(ndev); + + ENTER(); + + if (mon_if == NULL || mon_if->base_ndev == NULL) { + goto fail; + } + + /* check for not even having the fixed radiotap header part */ + if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) { + PRINTM(MERROR, + "Invalid radiotap hdr length," + "skb->len: %d\n", + skb->len); + goto fail; /* too short to be possibly valid */ + } + + /* is it a header version we can trust to find length from? */ + if (unlikely(prthdr->it_version)) + goto fail; /* only version 0 is supported */ + + /* then there must be a radiotap header with a length we can use */ + len_rthdr = ieee80211_get_radiotap_len(skb->data); + + /* does the skb contain enough to deliver on the alleged length? */ + if (unlikely((int)skb->len < len_rthdr)) { + PRINTM(MERROR, + "Invalid data length," + "skb->len: %d\n", + skb->len); + goto fail; /* skb too short for claimed rt header extent */ + } + + /* Skip the ratiotap header */ + skb_pull(skb, len_rthdr); + + dot11_hdr = (struct ieee80211_hdr *)skb->data; + fc = le16_to_cpu(dot11_hdr->frame_control); + if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) { + /* Check if this ia a Wireless Distribution System (WDS) frame + * which has 4 MAC addresses + */ + if (dot11_hdr->frame_control & (__force __le16)0x0080) + qos_len = 2; + if ((dot11_hdr->frame_control & (__force __le16)0x0300) == + (__force __le16)0x0300) + dot11_hdr_len += 6; + + moal_memcpy_ext(NULL, dst_mac_addr, dot11_hdr->addr1, + sizeof(dst_mac_addr), sizeof(dst_mac_addr)); + moal_memcpy_ext(NULL, src_mac_addr, dot11_hdr->addr2, + sizeof(src_mac_addr), sizeof(src_mac_addr)); + + /* Skip the 802.11 header, QoS (if any) and SNAP, but leave + * spaces for for two MAC addresses + */ + skb_pull(skb, dot11_hdr_len + qos_len + snap_len - + sizeof(src_mac_addr) * 2); + pdata = (unsigned char *)skb->data; + moal_memcpy_ext(NULL, pdata, dst_mac_addr, sizeof(dst_mac_addr), + (t_u32)skb->len); + moal_memcpy_ext(NULL, pdata + sizeof(dst_mac_addr), + src_mac_addr, sizeof(src_mac_addr), + (t_u32)skb->len - sizeof(dst_mac_addr)); + + LEAVE(); + return woal_hard_start_xmit(skb, mon_if->base_ndev); + } + +fail: + dev_kfree_skb(skb); + LEAVE(); + return NETDEV_TX_OK; +} + +/** + * @brief This function returns the network statistics + * + * @param dev A pointer to net_device structure + * + * @return A pointer to net_device_stats structure + */ +static struct net_device_stats *woal_mon_get_stats(struct net_device *dev) +{ + monitor_iface *mon_if = (monitor_iface *)netdev_priv(dev); + return &mon_if->stats; +} + +static const struct net_device_ops woal_cfg80211_mon_if_ops = { + .ndo_open = woal_mon_open, + .ndo_start_xmit = woal_mon_hard_start_xmit, + .ndo_stop = woal_mon_close, + .ndo_get_stats = woal_mon_get_stats, + .ndo_set_mac_address = woal_mon_set_mac_address, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + .ndo_set_rx_mode = woal_mon_set_multicast_list, +#else + .ndo_set_multicast_list = woal_mon_set_multicast_list, +#endif +}; + +/** + * @brief This function setup monitor interface + * + * @param dev A pointer to net_device structure + * + * @return 0 -- success, otherwise fail + */ +static void woal_mon_if_setup(struct net_device *dev) +{ + ENTER(); + ether_setup(dev); + dev->netdev_ops = &woal_cfg80211_mon_if_ops; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 11, 9) + dev->needs_free_netdev = true; +#else + dev->destructor = free_netdev; +#endif + LEAVE(); +} + +/** + * @brief Request the driver to add a monitor interface + * + * @param priv A pointer to moal_private + * @param name Virtual interface name + * @param name_assign_type Interface name assignment type + * + * @return A pointer to monitor_iface + */ +monitor_iface *woal_prepare_mon_if(moal_private *priv, const char *name, + unsigned char name_assign_type) +{ + int ret = 0; + moal_handle *handle = priv->phandle; + struct net_device *ndev = NULL; + monitor_iface *mon_if = NULL; + + ENTER(); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + ndev = alloc_netdev_mq(sizeof(*mon_if), name, name_assign_type, + woal_mon_if_setup, 1); +#else + ndev = alloc_netdev_mq(sizeof(*mon_if), name, NET_NAME_UNKNOWN, + woal_mon_if_setup, 1); +#endif +#else + ndev = alloc_netdev_mq(sizeof(*mon_if), name, woal_mon_if_setup, 1); +#endif +#else + ndev = alloc_netdev_mq(sizeof(*mon_if), name, woal_mon_if_setup); +#endif + if (!ndev) { + PRINTM(MFATAL, "Init virtual ethernet device failed\n"); + ret = -EFAULT; + goto fail; + } + + ret = dev_alloc_name(ndev, ndev->name); + if (ret < 0) { + PRINTM(MFATAL, "Net device alloc name fail.\n"); + ret = -EFAULT; + goto fail; + } + + //?memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); + + mon_if = netdev_priv(ndev); + moal_memcpy_ext(handle, mon_if->ifname, ndev->name, IFNAMSIZ, IFNAMSIZ); + + ndev->type = ARPHRD_IEEE80211_RADIOTAP; + ndev->netdev_ops = &woal_cfg80211_mon_if_ops; + + mon_if->priv = priv; + mon_if->mon_ndev = ndev; + mon_if->base_ndev = priv->netdev; + mon_if->radiotap_enabled = 1; + mon_if->flag = 1; + +fail: + if (ret) { + if (ndev) + free_netdev(ndev); + LEAVE(); + return NULL; + } + + LEAVE(); + return mon_if; +} +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) static struct device_type wlan_type = { .name = "wlan", @@ -4009,6 +4817,7 @@ .ndo_do_ioctl = woal_do_ioctl, #endif .ndo_set_mac_address = woal_set_mac_address, + .ndo_change_mtu = woal_change_mtu, .ndo_tx_timeout = woal_tx_timeout, .ndo_get_stats = woal_get_stats, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) @@ -4021,6 +4830,7 @@ }; #endif +#define MAX_MTU_SIZE 2000 /** * @brief This function initializes the private structure * and dev structure for station mode @@ -4030,11 +4840,33 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -woal_init_sta_dev(struct net_device *dev, moal_private *priv) +mlan_status woal_init_sta_dev(struct net_device *dev, moal_private *priv) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + mlan_fw_info fw_info; +#endif ENTER(); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef MFG_CMD_SUPPORT + if (priv->phandle->params.mfg_mode != MLAN_INIT_PARA_ENABLED) { +#endif + memset(&fw_info, 0, sizeof(mlan_fw_info)); + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info)) { + PRINTM(MERROR, "%s: get_fw_info failed \n", __func__); + return MLAN_STATUS_FAILURE; + } + if (fw_info.tx_buf_size > + (MAX_MTU_SIZE + MLAN_MIN_DATA_HEADER_LEN + + priv->extra_tx_head_len)) { + dev->max_mtu = MAX_MTU_SIZE; + PRINTM(MINFO, "wlan: %s set max_mtu %d\n", dev->name, + dev->max_mtu); + } +#ifdef MFG_CMD_SUPPORT + } +#endif +#endif /* Setup the OS Interface to our functions */ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 29) dev->open = woal_open; @@ -4051,10 +4883,10 @@ dev->watchdog_timeo = MRVDRV_DEFAULT_WATCHDOG_TIMEOUT; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) dev->needed_headroom += MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + - priv->extra_tx_head_len; + priv->extra_tx_head_len; #else dev->hard_header_len += MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + - priv->extra_tx_head_len; + priv->extra_tx_head_len; #endif #ifdef STA_WEXT if (IS_STA_WEXT(priv->phandle->params.cfg80211_wext)) { @@ -4089,6 +4921,7 @@ .ndo_do_ioctl = woal_uap_do_ioctl, #endif .ndo_set_mac_address = woal_set_mac_address, + .ndo_change_mtu = woal_change_mtu, .ndo_tx_timeout = woal_tx_timeout, .ndo_get_stats = woal_get_stats, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) @@ -4110,13 +4943,28 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -woal_init_uap_dev(struct net_device *dev, moal_private *priv) +mlan_status woal_init_uap_dev(struct net_device *dev, moal_private *priv) { mlan_status status = MLAN_STATUS_SUCCESS; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + mlan_fw_info fw_info; +#endif ENTER(); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + memset(&fw_info, 0, sizeof(mlan_fw_info)); + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info)) { + PRINTM(MERROR, "%s: get_fw_info failed \n", __func__); + return MLAN_STATUS_FAILURE; + } + if (fw_info.tx_buf_size > (MAX_MTU_SIZE + MLAN_MIN_DATA_HEADER_LEN + + priv->extra_tx_head_len)) { + dev->max_mtu = MAX_MTU_SIZE; + PRINTM(MMSG, "wlan: %s set max_mtu %d\n", dev->name, + dev->max_mtu); + } +#endif /* Setup the OS Interface to our functions */ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 29) dev->open = woal_open; @@ -4133,11 +4981,16 @@ dev->watchdog_timeo = MRVDRV_DEFAULT_UAP_WATCHDOG_TIMEOUT; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) dev->needed_headroom += MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + - priv->extra_tx_head_len; + priv->extra_tx_head_len; #else dev->hard_header_len += MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + - priv->extra_tx_head_len; + priv->extra_tx_head_len; #endif + /** don't need register to wext */ + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { + LEAVE(); + return status; + } #ifdef UAP_WEXT if (IS_UAP_WEXT(priv->phandle->params.cfg80211_wext)) { #if WIRELESS_EXT < 21 @@ -4164,16 +5017,13 @@ * * @return A pointer to the new priv structure */ -moal_private * -woal_add_interface(moal_handle *handle, t_u8 bss_index, t_u8 bss_type) +moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, + t_u8 bss_type) { struct net_device *dev = NULL; moal_private *priv = NULL; char name[256]; int i = 0; -#ifdef STA_CFG80211 - char sched_scan_str[256]; -#endif #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) char csa_str[256]; @@ -4181,59 +5031,67 @@ #endif ENTER(); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) -#define MAX_WMM_QUEUE 4 - /* Allocate an Ethernet device */ - dev = alloc_etherdev_mq(sizeof(moal_private), MAX_WMM_QUEUE); -#else - dev = alloc_etherdev(sizeof(moal_private)); -#endif - if (!dev) { - PRINTM(MFATAL, "Init virtual ethernet device failed\n"); - goto error; - } - /* Allocate device name */ -#ifdef STA_SUPPORT memset(name, 0, sizeof(name)); - if (handle->params.sta_name) - snprintf(name, sizeof(name), "%s%%d", handle->params.sta_name); - else if (handle->second_mac) - snprintf(name, sizeof(name), "m%s", default_mlan_name); - else - snprintf(name, sizeof(name), "%s", default_mlan_name); - - if ((bss_type == MLAN_BSS_TYPE_STA) && (dev_alloc_name(dev, name) < 0)) { - PRINTM(MERROR, "Could not allocate mlan device name\n"); - goto error; - } + switch (bss_type) { +#ifdef STA_SUPPORT + case MLAN_BSS_TYPE_STA: + if (handle->params.sta_name) + snprintf(name, sizeof(name), "%s%%d", + handle->params.sta_name); + else if (handle->second_mac) + snprintf(name, sizeof(name), "m%s", default_mlan_name); + else + snprintf(name, sizeof(name), "%s", default_mlan_name); + break; #endif #ifdef UAP_SUPPORT - memset(name, 0, sizeof(name)); - if (handle->params.uap_name) - snprintf(name, sizeof(name), "%s%%d", handle->params.uap_name); - else if (handle->second_mac) - snprintf(name, sizeof(name), "m%s", default_uap_name); - else - snprintf(name, sizeof(name), "%s", default_uap_name); - if ((bss_type == MLAN_BSS_TYPE_UAP) && (dev_alloc_name(dev, name) < 0)) { - PRINTM(MERROR, "Could not allocate uap device name\n"); - goto error; - } + case MLAN_BSS_TYPE_UAP: + if (handle->params.uap_name) + snprintf(name, sizeof(name), "%s%%d", + handle->params.uap_name); + else if (handle->second_mac) + snprintf(name, sizeof(name), "m%s", default_uap_name); + else + snprintf(name, sizeof(name), "%s", default_uap_name); + break; #endif #ifdef WIFI_DIRECT_SUPPORT - memset(name, 0, sizeof(name)); - if (handle->params.wfd_name) - snprintf(name, sizeof(name), "%s%%d", handle->params.wfd_name); - else if (handle->second_mac) - snprintf(name, sizeof(name), "m%s", default_wfd_name); - else - snprintf(name, sizeof(name), "%s", default_wfd_name); - if ((bss_type == MLAN_BSS_TYPE_WIFIDIRECT) && - (dev_alloc_name(dev, name) < 0)) { - PRINTM(MERROR, "Could not allocate wifidirect device name\n"); + case MLAN_BSS_TYPE_WIFIDIRECT: + if (handle->params.wfd_name) + snprintf(name, sizeof(name), "%s%%d", + handle->params.wfd_name); + else if (handle->second_mac) + snprintf(name, sizeof(name), "m%s", default_wfd_name); + else + snprintf(name, sizeof(name), "%s", default_wfd_name); + break; +#endif + case MLAN_BSS_TYPE_DFS: + if (handle->second_mac) + snprintf(name, sizeof(name), "m%s", default_dfs_name); + else + snprintf(name, sizeof(name), "%s", default_dfs_name); + break; + default: + PRINTM(MERROR, "woal_add_interface: invalid bss_type=%d\n", + bss_type); + return NULL; + } + +#define MAX_WMM_QUEUE 4 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + /* Allocate an net device */ + dev = alloc_netdev_mq(sizeof(moal_private), name, NET_NAME_UNKNOWN, + ether_setup, MAX_WMM_QUEUE); +#else + dev = alloc_netdev_mq(sizeof(moal_private), name, ether_setup, + MAX_WMM_QUEUE); +#endif + + if (!dev) { + PRINTM(MERROR, "alloc_netdev failed\n"); goto error; } -#endif priv = (moal_private *)netdev_priv(dev); /* Save the priv to handle */ handle->priv[bss_index] = priv; @@ -4253,6 +5111,8 @@ else if (bss_type == MLAN_BSS_TYPE_WIFIDIRECT) priv->bss_role = MLAN_BSS_ROLE_STA; #endif + else if (bss_type == MLAN_BSS_TYPE_DFS) + priv->bss_role = MLAN_BSS_ROLE_UAP; INIT_LIST_HEAD(&priv->tcp_sess_queue); spin_lock_init(&priv->tcp_sess_lock); @@ -4263,6 +5123,8 @@ INIT_LIST_HEAD(&priv->tx_stat_queue); spin_lock_init(&priv->tx_stat_lock); + INIT_LIST_HEAD(&priv->mcast_list); + spin_lock_init(&priv->mcast_lock); #ifdef STA_CFG80211 #ifdef STA_SUPPORT @@ -4290,11 +5152,11 @@ #ifdef WIFI_DIRECT_SUPPORT || bss_type == MLAN_BSS_TYPE_WIFIDIRECT #endif - ) + ) woal_init_sta_dev(dev, priv); #endif #ifdef UAP_SUPPORT - if (bss_type == MLAN_BSS_TYPE_UAP) { + if (bss_type == MLAN_BSS_TYPE_UAP || bss_type == MLAN_BSS_TYPE_DFS) { if (MLAN_STATUS_SUCCESS != woal_init_uap_dev(dev, priv)) goto error; } @@ -4303,7 +5165,7 @@ #ifdef MFG_CMD_SUPPORT && (handle->params.mfg_mode != MLAN_INIT_PARA_ENABLED) #endif - ) { + ) { if (handle->params.init_cfg) { if (MLAN_STATUS_SUCCESS != woal_set_user_init_data(handle, INIT_CFG_DATA, @@ -4362,7 +5224,7 @@ || bss_type == MLAN_BSS_TYPE_WIFIDIRECT #endif #endif - ) + ) /* Register cfg80211 for STA or Wifi direct */ if (woal_register_sta_cfg80211(dev, bss_type)) { PRINTM(MERROR, @@ -4370,24 +5232,14 @@ goto error; } } - strcpy(sched_scan_str, "SCHED_SCAN"); - strcat(sched_scan_str, name); - priv->sched_scan_workqueue = - alloc_workqueue(sched_scan_str, - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); - if (!priv->sched_scan_workqueue) { - PRINTM(MERROR, "cannot alloc sched_scan workqueue \n"); - goto error; - } - INIT_DELAYED_WORK(&priv->sched_scan_work, woal_sched_scan_work_queue); #endif /* STA_SUPPORT */ #endif /* STA_CFG80211 */ #ifdef UAP_CFG80211 #ifdef UAP_SUPPORT if ((priv->bss_role == MLAN_BSS_ROLE_UAP) && - IS_UAP_CFG80211(handle->params.cfg80211_wext) - ) { + IS_UAP_CFG80211(handle->params.cfg80211_wext) && + bss_type != MLAN_BSS_TYPE_DFS) { /* Register cfg80211 for UAP */ if (woal_register_uap_cfg80211(dev, bss_type)) { PRINTM(MERROR, "Cannot register UAP with cfg80211\n"); @@ -4397,9 +5249,8 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) strcpy(csa_str, "CSA"); strcat(csa_str, name); - priv->csa_workqueue = - alloc_workqueue(csa_str, - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); + priv->csa_workqueue = alloc_workqueue( + csa_str, WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); if (!priv->csa_workqueue) { PRINTM(MERROR, "cannot alloc csa workqueue \n"); goto error; @@ -4423,7 +5274,6 @@ } MLAN_INIT_WORK(&priv->mclist_work, woal_mclist_work_queue); - /* Initialize priv structure */ woal_init_priv(priv, MOAL_IOCTL_WAIT); @@ -4443,14 +5293,18 @@ netif_carrier_off(dev); woal_stop_queue(dev); - PRINTM(MINFO, "%s: NXP 802.11 Adapter\n", dev->name); + PRINTM(MMSG, "Register NXP 802.11 Adapter %s\n", dev->name); if (bss_type == MLAN_BSS_TYPE_STA || priv->bss_type == MLAN_BSS_TYPE_UAP) { #if defined(SD8887) || defined(SD8987) mlan_fw_info fw_info; memset(&fw_info, 0, sizeof(mlan_fw_info)); - woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info)) { + PRINTM(MERROR, "%s: get_fw_info failed \n", __func__); + goto error; + } if (MFALSE #ifdef SD8887 || IS_SD8887(handle->card_type) @@ -4458,8 +5312,8 @@ #ifdef SD8987 || IS_SD8987(handle->card_type) #endif - ) { - if ((fw_info.antinfo & ANT_DIVERSITY_2G)&& + ) { + if ((fw_info.antinfo & ANT_DIVERSITY_2G) && (fw_info.antinfo & ANT_DIVERSITY_5G)) handle->card_info->histogram_table_num = 4; } @@ -4468,8 +5322,9 @@ for (i = 0; i < handle->card_info->histogram_table_num; i++) { priv->hist_data[i] = kmalloc(sizeof(hgm_data) + - handle->card_info->rx_rate_max * - sizeof(atomic_t), GFP_KERNEL); + handle->card_info->rx_rate_max * + sizeof(atomic_t), + GFP_KERNEL); if (!(priv->hist_data[i])) { PRINTM(MERROR, "kmalloc priv->hist_data[%d] failed\n", @@ -4495,12 +5350,6 @@ destroy_workqueue(priv->mclist_workqueue); priv->mclist_workqueue = NULL; } -#ifdef STA_CFG80211 - if (priv->sched_scan_workqueue) { - destroy_workqueue(priv->sched_scan_workqueue); - priv->sched_scan_workqueue = NULL; - } -#endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (priv->wdev && IS_STA_OR_UAP_CFG80211(handle->params.cfg80211_wext)) @@ -4531,8 +5380,7 @@ * * @return N/A */ -void -woal_remove_interface(moal_handle *handle, t_u8 bss_index) +void woal_remove_interface(moal_handle *handle, t_u8 bss_index) { struct net_device *dev = NULL; moal_private *priv = handle->priv[bss_index]; @@ -4549,6 +5397,7 @@ if (priv->media_connected == MTRUE) { priv->media_connected = MFALSE; + moal_connection_status_check_pmqos(handle); #if defined(STA_WEXT) || defined(UAP_WEXT) if (IS_STA_OR_UAP_WEXT(handle->params.cfg80211_wext) && GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { @@ -4567,11 +5416,14 @@ if (priv->bss_type == MLAN_BSS_TYPE_STA) woal_flush_tdls_list(priv); #endif + woal_flush_mcast_list(priv); #ifdef STA_CFG80211 if (priv->bss_type == MLAN_BSS_TYPE_STA && IS_STA_CFG80211(handle->params.cfg80211_wext)) { - woal_flush_pmksa_list(priv); + if (woal_flush_pmksa_list(priv)) + PRINTM(MERROR, "%s: woal_flush_pmksa_list failed!\n", + __func__); if (priv->okc_roaming_ie) { kfree(priv->okc_roaming_ie); priv->okc_roaming_ie = NULL; @@ -4609,12 +5461,6 @@ destroy_workqueue(priv->mclist_workqueue); priv->mclist_workqueue = NULL; } -#ifdef STA_CFG80211 - if (priv->sched_scan_workqueue) { - destroy_workqueue(priv->sched_scan_workqueue); - priv->sched_scan_workqueue = NULL; - } -#endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) /* Unregister wiphy device and free */ @@ -4630,13 +5476,15 @@ #endif #endif #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA || GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) woal_deinit_wifi_hal(priv); #endif +#endif - /* Clear the priv in handle */ + /* Clear the priv in handle */ #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 8, 13) if (IS_STA_OR_UAP_CFG80211(handle->params.cfg80211_wext)) @@ -4661,8 +5509,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_pmic_configure(moal_handle *handle, t_u8 wait_option) +mlan_status woal_pmic_configure(moal_handle *handle, t_u8 wait_option) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; @@ -4678,8 +5525,8 @@ } /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_misc_cfg)); if (req == NULL) { status = MLAN_STATUS_FAILURE; goto done; @@ -4708,8 +5555,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_user_antcfg(moal_handle *handle, t_u8 wait_option) +mlan_status woal_set_user_antcfg(moal_handle *handle, t_u8 wait_option) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; @@ -4725,8 +5571,8 @@ } antcfg = handle->params.antcfg; /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_radio_cfg)); if (req == NULL) { status = MLAN_STATUS_FAILURE; goto done; @@ -4771,8 +5617,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_set_low_pwr_mode(moal_handle *handle, t_u8 wait_option) +mlan_status woal_set_low_pwr_mode(moal_handle *handle, t_u8 wait_option) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; @@ -4788,8 +5633,8 @@ } /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_misc_cfg)); if (req == NULL) { status = MLAN_STATUS_FAILURE; goto done; @@ -4811,6 +5656,53 @@ } /** + * @brief Configure MLAN for channel tracking mode + * + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, + * otherwise fail + */ +mlan_status woal_set_chan_track_mode(moal_handle *handle, t_u8 wait_option) +{ + moal_private *priv = NULL; + mlan_ioctl_req *req = NULL; + mlan_ds_snmp_mib *mib = NULL; + mlan_status status; + + ENTER(); + + priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + if (!priv) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Allocate an IOCTL request buffer */ + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_snmp_mib)); + if (req == NULL) { + status = MLAN_STATUS_FAILURE; + goto done; + } + + /* Fill request buffer */ + mib = (mlan_ds_snmp_mib *)req->pbuf; + mib->sub_command = MLAN_OID_SNMP_MIB_CHAN_TRACK; + mib->param.chan_track = moal_extflg_isset(handle, EXT_CHAN_TRACK); + req->req_id = MLAN_IOCTL_SNMP_MIB; + req->action = MLAN_ACT_SET; + + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, wait_option); +done: + kfree(req); + LEAVE(); + return status; +} + +/** * @brief Send FW shutdown command to MLAN * * @param priv A pointer to moal_private structure @@ -4819,8 +5711,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_shutdown_fw(moal_private *priv, t_u8 wait_option) +mlan_status woal_shutdown_fw(moal_private *priv, t_u8 wait_option) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -4829,8 +5720,8 @@ ENTER(); /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_misc_cfg)); if (req == NULL) { status = MLAN_STATUS_FAILURE; goto done; @@ -4861,8 +5752,7 @@ * * @return The converted character if chr is a valid hex, else 0 */ -int -woal_hexval(char chr) +int woal_hexval(char chr) { if (chr >= '0' && chr <= '9') return chr - '0'; @@ -4884,13 +5774,12 @@ * * @return N/A */ -static void -woal_flush_evt_queue(moal_handle *handle) +static void woal_flush_evt_queue(moal_handle *handle) { struct woal_event *evt = NULL, *tmp_node; unsigned long flags; spin_lock_irqsave(&handle->evt_lock, flags); - list_for_each_entry_safe(evt, tmp_node, &handle->evt_queue, link) { + list_for_each_entry_safe (evt, tmp_node, &handle->evt_queue, link) { list_del(&evt->link); spin_unlock_irqrestore(&handle->evt_lock, flags); kfree(evt); @@ -4907,8 +5796,7 @@ * * @return N/A */ -void -woal_flush_workqueue(moal_handle *handle) +void woal_flush_workqueue(moal_handle *handle) { ENTER(); @@ -4932,8 +5820,7 @@ * * @return N/A */ -void -woal_terminate_workqueue(moal_handle *handle) +void woal_terminate_workqueue(moal_handle *handle) { ENTER(); @@ -4973,8 +5860,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_open(struct net_device *dev) +int woal_open(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); #if defined(USB) @@ -4982,7 +5868,8 @@ struct usb_interface *intf = ((struct usb_card_rec *)priv->phandle->card)->intf; #else - // struct usb_device *udev = ((struct usb_card_rec *)(priv->phandle->card))->udev; + // struct usb_device *udev = ((struct usb_card_rec + // *)(priv->phandle->card))->udev; #endif /* < 2.6.34 */ #endif /* USB_SUSPEND_RESUME */ t_u8 carrier_on = MFALSE; @@ -5012,7 +5899,7 @@ #if defined(USB) || defined(SYSKT) /* On some systems the device open handler will be called before HW ready. - Use the following flag check and wait function to work around + Use the following flag check and wait function to work around the issue. */ if (MTRUE #ifdef SDIO @@ -5021,7 +5908,7 @@ #ifdef PCIE && !IS_PCIE(priv->phandle->card_type) #endif - ) { + ) { int i = 0; while ((priv->phandle->hardware_status != @@ -5073,8 +5960,7 @@ * * @return 0 */ -int -woal_close(struct net_device *dev) +int woal_close(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); #if defined(USB) @@ -5082,7 +5968,8 @@ struct usb_interface *intf = ((struct usb_card_rec *)priv->phandle->card)->intf; #else - // struct usb_device *udev = ((struct usb_card_rec *)(priv->phandle->card))->udev; + // struct usb_device *udev = ((struct usb_card_rec + // *)(priv->phandle->card))->udev; #endif /* < 2.6.34 */ #endif /* USB_SUSPEND_RESUME */ #ifdef STA_CFG80211 @@ -5092,15 +5979,32 @@ woal_flush_tx_stat_queue(priv); + if ((priv->media_connected == MTRUE) +#ifdef UAP_SUPPORT + || (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) +#endif + ) { + if (MLAN_STATUS_SUCCESS != + woal_disconnect(priv, MOAL_IOCTL_WAIT, NULL, + DEF_DEAUTH_REASON_CODE)) { + PRINTM(MERROR, "%s: woal_disconnect failed \n", + __func__); + } + priv->media_connected = MFALSE; + } + #ifdef STA_SUPPORT #ifdef STA_CFG80211 - if (IS_STA_CFG80211(cfg80211_wext) && - (priv->bss_type == MLAN_BSS_TYPE_STA)) + if (IS_STA_CFG80211(cfg80211_wext)) woal_clear_conn_params(priv); woal_cancel_scan(priv, MOAL_IOCTL_WAIT); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->connected) { +#else if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->current_bss) { +#endif priv->cfg_disconnect = MTRUE; cfg80211_disconnected(priv->netdev, 0, NULL, 0, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) @@ -5117,9 +6021,10 @@ priv->bg_scan_reported = MFALSE; cfg80211_sched_scan_stopped(priv->wdev->wiphy #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - , priv->bg_scan_reqid + , + priv->bg_scan_reqid #endif - ); + ); priv->sched_scanning = MFALSE; } #endif @@ -5142,6 +6047,54 @@ return 0; } +#define DEF_MTU_SIZE 1500 +/** + * @brief This function disable the ampdu + * + * @param priv A pointer to mlan_private structure + * @param new_mtu new mtu size + * + * @return 0 --success, otherwise fail + */ +void woal_disable_ampdu(moal_private *priv) +{ + mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl; + int i; + memset(&aggr_prio_tbl, 0, sizeof(aggr_prio_tbl)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_GET, &aggr_prio_tbl)) { + goto done; + } + for (i = 0; i < MAX_NUM_TID; i++) + aggr_prio_tbl.ampdu[i] = 0xff; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, &aggr_prio_tbl)) { + goto done; + } +done: + return; +} + +/** + * @brief This function change the MTU size + * + * @param dev A pointer to mlan_private structure + * @param new_mtu new mtu size + * + * @return 0 --success, otherwise fail + */ +int woal_change_mtu(struct net_device *dev, int new_mtu) +{ + moal_private *priv = (moal_private *)netdev_priv(dev); + dev->mtu = new_mtu; + // disable AMPDU with mtu size > 1500 + if (new_mtu > DEF_MTU_SIZE) + woal_disable_ampdu(priv); + PRINTM(MCMND, "wlan: change_mtu to %d\n", new_mtu); + + return 0; +} + /** * @brief This function sets the MAC address to firmware. * @@ -5150,8 +6103,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_mac_address(struct net_device *dev, void *addr) +int woal_set_mac_address(struct net_device *dev, void *addr) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -5171,7 +6123,7 @@ ETH_ALEN); memset(priv->current_addr, 0, ETH_ALEN); /* dev->dev_addr is 6 bytes */ - HEXDUMP("dev->dev_addr:", dev->dev_addr, ETH_ALEN); + HEXDUMP("dev->dev_addr:", (t_u8 *)dev->dev_addr, ETH_ALEN); HEXDUMP("addr:", (t_u8 *)phw_addr->sa_data, ETH_ALEN); moal_memcpy_ext(priv->phandle, priv->current_addr, phw_addr->sa_data, @@ -5197,8 +6149,12 @@ goto done; } HEXDUMP("priv->MacAddr:", priv->current_addr, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(dev, priv->current_addr); +#else moal_memcpy_ext(priv->phandle, dev->dev_addr, priv->current_addr, ETH_ALEN, ETH_ALEN); +#endif done: LEAVE(); return ret; @@ -5211,8 +6167,7 @@ * * @return MTRUE/MFALSE */ -t_u8 -woal_check_driver_status(moal_handle *handle) +t_u8 woal_check_driver_status(moal_handle *handle) { moal_private *priv = NULL; wifi_timeval t; @@ -5307,15 +6262,14 @@ * * @return N/A */ -void -woal_mlan_debug_info(moal_private *priv) +void woal_mlan_debug_info(moal_private *priv) { int i; #ifdef SDIO int j; t_u8 mp_aggr_pkt_limit = 0; #endif - char str[512] = { 0 }; + char str[512] = {0}; char *s; mlan_debug_info *info = NULL; @@ -5396,9 +6350,10 @@ info->last_recv_wr_bitmap, info->last_mp_index); for (i = 0; i < SDIO_MP_DBG_NUM; i++) { for (s = str, j = 0; j < mp_aggr_pkt_limit; j++) - s += sprintf(s, "0x%02x ", - info->last_mp_wr_info - [i * mp_aggr_pkt_limit + j]); + s += sprintf( + s, "0x%02x ", + info->last_mp_wr_info + [i * mp_aggr_pkt_limit + j]); PRINTM(MERROR, "mp_wr_bitmap: 0x%x mp_wr_ports=0x%x len=%d curr_wr_port=0x%x\n%s\n", @@ -5456,6 +6411,7 @@ PRINTM(MERROR, "tx_lock_flag = %d\n", info->tx_lock_flag); PRINTM(MERROR, "port_open = %d\n", info->port_open); PRINTM(MERROR, "scan_processing = %d\n", info->scan_processing); + PRINTM(MERROR, "scan_state = 0x%x\n", info->scan_state); for (i = 0; i < (int)info->ralist_num; i++) { PRINTM(MERROR, "ralist ra: %02x:%02x:%02x:%02x:%02x:%02x tid=%d pkts=%d pause=%d\n", @@ -5487,8 +6443,7 @@ * * @return N/A */ -static void -woal_ioctl_timeout(moal_handle *handle) +static void woal_ioctl_timeout(moal_handle *handle) { moal_private *priv = NULL; @@ -5512,12 +6467,12 @@ * * @return N/A */ -void -woal_tx_timeout(struct net_device *dev +void woal_tx_timeout(struct net_device *dev #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) - , unsigned int txqueue + , + unsigned int txqueue #endif - ) +) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u8 auto_fw_dump = MFALSE; @@ -5528,16 +6483,19 @@ dev->name, priv->bss_index, priv->num_tx_timeout); woal_set_trans_start(dev); - if (priv->num_tx_timeout == NUM_TX_TIMEOUT_THRESHOLD) { + if (priv->num_tx_timeout == NUM_TX_TIMEOUT_THRESHOLD && + priv->txwatchdog_disable == MFALSE) { +#ifdef DEBUG_LEVEL1 if (drvdbg & MFW_D) auto_fw_dump = MTRUE; +#endif woal_mlan_debug_info(priv); woal_moal_debug_info(priv, NULL, MFALSE); priv->phandle->driver_status = MTRUE; if (!auto_fw_dump && !priv->phandle->fw_dump) woal_process_hang(priv->phandle); - wifi_status = 3; + wifi_status = WIFI_STATUS_TX_TIMEOUT; } LEAVE(); @@ -5550,13 +6508,83 @@ * * @return A pointer to net_device_stats structure */ -struct net_device_stats * -woal_get_stats(struct net_device *dev) +struct net_device_stats *woal_get_stats(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); return &priv->stats; } +#if !defined(STA_CFG80211) && !defined(UAP_CFG80211) +/** + * @brief This function determine the 802.1p/1d tag to use + * + * @param skb + * + * @return tid + */ +unsigned int woal_classify8021d(struct sk_buff *skb) +{ + unsigned int dscp; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + unsigned char vlan_priority; +#endif + unsigned int tid; + + /* skb->priority values from 256->263 are magic values to + * directly indicate a specific 802.1d priority. This is used + * to allow 802.1d priority to be passed directly in from VLAN + * tags, etc. + */ + if (skb->priority >= 256 && skb->priority <= 263) { + tid = skb->priority - 256; + goto out; + } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + if (skb_vlan_tag_present(skb)) { + vlan_priority = (skb_vlan_tag_get(skb) & VLAN_PRIO_MASK) >> + VLAN_PRIO_SHIFT; + if (vlan_priority > 0) { + tid = vlan_priority; + goto out; + } + } +#endif + switch (skb->protocol) { + case htons(ETH_P_IP): + dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + case htons(ETH_P_IPV6): + dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc; + break; +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) + case htons(ETH_P_MPLS_UC): + case htons(ETH_P_MPLS_MC): { + struct mpls_label mpls_tmp, *mpls; + + mpls = skb_header_pointer(skb, sizeof(struct ethhdr), + sizeof(*mpls), &mpls_tmp); + if (!mpls) + return 0; + + tid = (ntohl(mpls->entry) & MPLS_LS_TC_MASK) >> + MPLS_LS_TC_SHIFT; + goto out; + } + case htons(ETH_P_80221): + /* 802.21 is always network control traffic */ + return 7; +#endif + default: + return 0; + } + tid = dscp >> 5; +out: + return tid; +} +#endif + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) /** * @brief This function handles wmm queue select @@ -5566,23 +6594,24 @@ * * @return tx_queue index (0-3) */ -u16 -woal_select_queue(struct net_device *dev, struct sk_buff *skb +u16 woal_select_queue(struct net_device *dev, struct sk_buff *skb #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) - , struct net_device *sb_dev + , + struct net_device *sb_dev #else - , void *accel_priv + , + void *accel_priv #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) && \ LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - , select_queue_fallback_t fallback + , + select_queue_fallback_t fallback #endif #endif - ) +) { moal_private *priv = (moal_private *)netdev_priv(dev); - struct ethhdr *eth = NULL; t_u8 tid = 0; t_u8 index = 0; @@ -5591,32 +6620,27 @@ LEAVE(); return index; } - /* - * skb->priority values from 256->263 are magic values to - * directly indicate a specific 802.1d priority. This is used - * to allow 802.1d priority to be passed directly in from VLAN - * tags, etc. - */ - if (IS_SKB_MAGIC_VLAN(skb)) { - tid = GET_VLAN_PRIO(skb); - } else { - eth = (struct ethhdr *)skb->data; - switch (eth->h_proto) { - case __constant_htons(ETH_P_IP): - tid = priv->dscp_map[SKB_TOS(skb) >> DSCP_OFFSET]; - if (tid == 0xFF) - tid = (IPTOS_PREC(SKB_TOS(skb)) >> - IPTOS_OFFSET); - break; - case __constant_htons(ETH_P_IPV6): - tid = SKB_TIDV6(skb); - break; - case __constant_htons(ETH_P_ARP): - default: - break; - } +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + tid = skb->priority = cfg80211_classify8021d(skb, NULL); +#else + tid = skb->priority = cfg80211_classify8021d(skb); +#endif +#else + tid = skb->priority = woal_classify8021d(skb); +#endif +#define NXP_ETH_P_EAPOL 0x888E +#define NXP_ETH_P_WAPI 0x8884 + switch (skb->protocol) { + case htons(ETH_P_ARP): +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + case htons(ETH_P_TDLS): +#endif + case htons(NXP_ETH_P_EAPOL): + case htons(NXP_ETH_P_WAPI): + tid = skb->priority = 7; + break; } - index = mlan_select_wmm_queue(priv->phandle->pmlan_adapter, priv->bss_index, tid); PRINTM(MDATA, "select queue: tid=%d, index=%d\n", tid, index); @@ -5632,14 +6656,14 @@ * * @return N/A */ -void -woal_flush_tx_stat_queue(moal_private *priv) +void woal_flush_tx_stat_queue(moal_private *priv) { struct tx_status_info *tx_info = NULL, *tmp_node; unsigned long flags; struct sk_buff *skb = NULL; spin_lock_irqsave(&priv->tx_stat_lock, flags); - list_for_each_entry_safe(tx_info, tmp_node, &priv->tx_stat_queue, link) { + list_for_each_entry_safe (tx_info, tmp_node, &priv->tx_stat_queue, + link) { list_del(&tx_info->link); spin_unlock_irqrestore(&priv->tx_stat_lock, flags); skb = (struct sk_buff *)tx_info->tx_skb; @@ -5678,13 +6702,12 @@ * @return A pointer to the tcp tx_status_info structure, if found. * Otherwise, null */ -struct tx_status_info * -woal_get_tx_info(moal_private *priv, t_u8 tx_seq_num) +struct tx_status_info *woal_get_tx_info(moal_private *priv, t_u8 tx_seq_num) { struct tx_status_info *tx_info = NULL; ENTER(); - list_for_each_entry(tx_info, &priv->tx_stat_queue, link) { + list_for_each_entry (tx_info, &priv->tx_stat_queue, link) { if (tx_info->tx_seq_num == tx_seq_num) { LEAVE(); return tx_info; @@ -5702,15 +6725,14 @@ * * @return N/A */ -void -woal_remove_tx_info(moal_private *priv, t_u8 tx_seq_num) +void woal_remove_tx_info(moal_private *priv, t_u8 tx_seq_num) { struct tx_status_info *tx_info, *tmp = NULL; unsigned long flags; ENTER(); spin_lock_irqsave(&priv->tx_stat_lock, flags); - list_for_each_entry_safe(tx_info, tmp, &priv->tx_stat_queue, link) { + list_for_each_entry_safe (tx_info, tmp, &priv->tx_stat_queue, link) { if (tx_info->tx_seq_num == tx_seq_num) { list_del(&tx_info->link); dev_kfree_skb_any((struct sk_buff *)tx_info->tx_skb); @@ -5723,6 +6745,123 @@ LEAVE(); } +/** + * @brief This function flush mcast list + * + * @param priv A pointer to moal_private structure + * + * @return N/A + */ +void woal_flush_mcast_list(moal_private *priv) +{ + struct mcast_node *node = NULL, *tmp_node; + unsigned long flags; + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry_safe (node, tmp_node, &priv->mcast_list, link) { + list_del(&node->link); + kfree(node); + } + INIT_LIST_HEAD(&priv->mcast_list); + priv->num_mcast_addr = 0; + spin_unlock_irqrestore(&priv->mcast_lock, flags); +} + +/** + * @brief find mcast node from tx packet + * + * @param priv A pointer to moal_private structure + * @param skb A pointer to skb buffer. + * + * @return N/A + */ +t_u8 woal_find_mcast_node_tx(moal_private *priv, struct sk_buff *skb) +{ + struct mcast_node *node = NULL; + unsigned long flags; + t_u8 ret = MFALSE; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + ENTER(); + moal_memcpy_ext(priv->phandle, ra, skb->data, MLAN_MAC_ADDR_LENGTH, + sizeof(ra)); + if (ra[0] & 0x01) { + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry (node, &priv->mcast_list, link) { + if (!memcmp(node->mcast_addr, ra, ETH_ALEN)) { + ret = MTRUE; + break; + } + } + spin_unlock_irqrestore(&priv->mcast_lock, flags); + } + LEAVE(); + return ret; +} + +/** + * @brief add mcast node + * + * @param priv A pointer to moal_private structure + * @param peer A point to peer address + * + * @return N/A + */ +t_void woal_add_mcast_node(moal_private *priv, t_u8 *mcast_addr) +{ + struct mcast_node *node = NULL; + unsigned long flags; + t_u8 find_node = MFALSE; + if (priv) { + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry (node, &priv->mcast_list, link) { + if (!memcmp(node->mcast_addr, mcast_addr, ETH_ALEN)) { + find_node = MTRUE; + break; + } + } + if (!find_node) { + /* create new mcast node */ + node = kzalloc(sizeof(struct mcast_node), GFP_ATOMIC); + if (node) { + moal_memcpy_ext(priv->phandle, node->mcast_addr, + mcast_addr, ETH_ALEN, ETH_ALEN); + INIT_LIST_HEAD(&node->link); + list_add_tail(&node->link, &priv->mcast_list); + PRINTM(MCMND, + "Add to mcast list: node=" MACSTR "\n", + MAC2STR(mcast_addr)); + } + } + spin_unlock_irqrestore(&priv->mcast_lock, flags); + } +} + +/** + * @brief This function remove mcast node + * + * @param priv A pointer to moal_private structure + * @param mcast_addr mcast address + * + * @return N/A + */ +void woal_remove_mcast_node(moal_private *priv, t_u8 *mcast_addr) +{ + struct mcast_node *node, *tmp = NULL; + unsigned long flags; + ENTER(); + + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry_safe (node, tmp, &priv->mcast_list, link) { + if (!memcmp(node->mcast_addr, mcast_addr, ETH_ALEN)) { + list_del(&node->link); + kfree(node); + break; + } + } + spin_unlock_irqrestore(&priv->mcast_lock, flags); + + LEAVE(); +} + #ifdef STA_CFG80211 /** * @brief This function flush tcp session queue @@ -5731,13 +6870,12 @@ * * @return N/A */ -void -woal_flush_tdls_list(moal_private *priv) +void woal_flush_tdls_list(moal_private *priv) { struct tdls_peer *peer = NULL, *tmp_node; unsigned long flags; spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry_safe(peer, tmp_node, &priv->tdls_list, link) { + list_for_each_entry_safe (peer, tmp_node, &priv->tdls_list, link) { list_del(&peer->link); kfree(peer); } @@ -5755,17 +6893,16 @@ * * @return N/A */ -static void -woal_tdls_check_tx(moal_private *priv, struct sk_buff *skb) +static void woal_tdls_check_tx(moal_private *priv, struct sk_buff *skb) { struct tdls_peer *peer = NULL; unsigned long flags; - t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + t_u8 ra[MLAN_MAC_ADDR_LENGTH] = {0}; ENTER(); moal_memcpy_ext(priv->phandle, ra, skb->data, MLAN_MAC_ADDR_LENGTH, sizeof(ra)); spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry(peer, &priv->tdls_list, link) { + list_for_each_entry (peer, &priv->tdls_list, link) { if (!memcmp(peer->peer_addr, ra, ETH_ALEN)) { if (peer->rssi && (peer->rssi <= TDLS_RSSI_HIGH_THRESHOLD)) { @@ -5775,16 +6912,14 @@ peer->link_status = TDLS_SETUP_INPROGRESS; PRINTM(MMSG, - "Wlan: Set up TDLS link,peer=" - MACSTR " rssi=%d\n", + "Wlan: Set up TDLS link,peer=" MACSTR + " rssi=%d\n", MAC2STR(peer->peer_addr), -peer->rssi); - cfg80211_tdls_oper_request(priv->netdev, - peer-> - peer_addr, - NL80211_TDLS_SETUP, - 0, - GFP_ATOMIC); + cfg80211_tdls_oper_request( + priv->netdev, peer->peer_addr, + NL80211_TDLS_SETUP, 0, + GFP_ATOMIC); priv->tdls_check_tx = MFALSE; } } @@ -5804,17 +6939,16 @@ * * @return N/A */ -void -woal_flush_tcp_sess_queue(moal_private *priv) +void woal_flush_tcp_sess_queue(moal_private *priv) { struct tcp_sess *tcp_sess = NULL, *tmp_node; unsigned long flags; struct sk_buff *skb; spin_lock_irqsave(&priv->tcp_sess_lock, flags); - list_for_each_entry_safe(tcp_sess, tmp_node, &priv->tcp_sess_queue, - link) { + list_for_each_entry_safe (tcp_sess, tmp_node, &priv->tcp_sess_queue, + link) { list_del(&tcp_sess->link); - if (tcp_sess->is_timer_set) + if (atomic_read(&tcp_sess->is_timer_set)) woal_cancel_timer(&tcp_sess->ack_timer); skb = (struct sk_buff *)tcp_sess->ack_skb; if (skb) @@ -5839,14 +6973,14 @@ * @return A pointer to the tcp session data structure, if found. * Otherwise, null */ -static inline struct tcp_sess * -woal_get_tcp_sess(moal_private *priv, - t_u32 src_ip, t_u16 src_port, t_u32 dst_ip, t_u16 dst_port) +static inline struct tcp_sess *woal_get_tcp_sess(moal_private *priv, + t_u32 src_ip, t_u16 src_port, + t_u32 dst_ip, t_u16 dst_port) { struct tcp_sess *tcp_sess = NULL; ENTER(); - list_for_each_entry(tcp_sess, &priv->tcp_sess_queue, link) { + list_for_each_entry (tcp_sess, &priv->tcp_sess_queue, link) { if ((tcp_sess->src_ip_addr == src_ip) && (tcp_sess->src_tcp_port == src_port) && (tcp_sess->dst_ip_addr == dst_ip) && @@ -5859,6 +6993,37 @@ return NULL; } +#define TCP_SESS_AGEOUT 300 +/** + * @brief This function flush tcp session queue + * + * @param priv A pointer to moal_private structure + * + * @return N/A + */ +static void woal_ageout_tcp_sess_queue(moal_private *priv) +{ + struct tcp_sess *tcp_sess = NULL, *tmp_node; + wifi_timeval t; + struct sk_buff *skb; + woal_get_monotonic_time(&t); + list_for_each_entry_safe (tcp_sess, tmp_node, &priv->tcp_sess_queue, + link) { + if (t.time_sec > + (tcp_sess->update_time.time_sec + TCP_SESS_AGEOUT)) { + PRINTM(MDATA, "wlan: ageout TCP seesion %p\n", + tcp_sess); + list_del(&tcp_sess->link); + if (atomic_read(&tcp_sess->is_timer_set)) + woal_cancel_timer(&tcp_sess->ack_timer); + skb = (struct sk_buff *)tcp_sess->ack_skb; + if (skb) + dev_kfree_skb_any(skb); + kfree(tcp_sess); + } + } +} + /** * @brief This function send the holding tcp ack packet * re-assoc thread. @@ -5866,8 +7031,7 @@ * @param context A pointer to context * @return N/A */ -static void -woal_tcp_ack_timer_func(void *context) +static void woal_tcp_ack_timer_func(void *context) { struct tcp_sess *tcp_session = (struct tcp_sess *)context; moal_private *priv = (moal_private *)tcp_session->priv; @@ -5880,28 +7044,29 @@ #endif ENTER(); spin_lock_irqsave(&priv->tcp_sess_lock, flags); - tcp_session->is_timer_set = MFALSE; + atomic_set(&tcp_session->is_timer_set, MFALSE); skb = (struct sk_buff *)tcp_session->ack_skb; pmbuf = (mlan_buffer *)tcp_session->pmbuf; tcp_session->ack_skb = NULL; tcp_session->pmbuf = NULL; spin_unlock_irqrestore(&priv->tcp_sess_lock, flags); if (skb && pmbuf) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + index = skb_get_queue_mapping(skb); +#endif status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - index = skb_get_queue_mapping(skb); atomic_inc(&priv->wmm_tx_pending[index]); if (atomic_read(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { - struct netdev_queue *txq = - netdev_get_tx_queue(priv->netdev, - index); + struct netdev_queue *txq = netdev_get_tx_queue( + priv->netdev, index); netif_tx_stop_queue(txq); - moal_tp_accounting_rx_param((t_void *)priv-> - phandle, 8, 0); + moal_tp_accounting_rx_param( + (t_void *)priv->phandle, 8, 0); PRINTM(MINFO, "Stop Kernel Queue : %d\n", index); } @@ -5909,7 +7074,7 @@ if (atomic_read(&priv->phandle->tx_pending) >= MAX_TX_PENDING) woal_stop_queue(priv->netdev); -#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) */ +#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)*/ queue_work(priv->phandle->workqueue, &priv->phandle->main_work); break; @@ -5937,8 +7102,7 @@ * @param tcp_session A pointer to tcp_session * @return N/A */ -static void -woal_send_tcp_ack(moal_private *priv, struct tcp_sess *tcp_session) +static void woal_send_tcp_ack(moal_private *priv, struct tcp_sess *tcp_session) { mlan_status status; struct sk_buff *skb = (struct sk_buff *)tcp_session->ack_skb; @@ -5947,20 +7111,22 @@ t_u32 index = 0; #endif ENTER(); - if (tcp_session->is_timer_set) { + if (atomic_cmpxchg(&tcp_session->is_timer_set, MTRUE, MFALSE)) { woal_cancel_timer(&tcp_session->ack_timer); - tcp_session->is_timer_set = MFALSE; } tcp_session->ack_skb = NULL; tcp_session->pmbuf = NULL; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + index = skb_get_queue_mapping(skb); +#endif status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - index = skb_get_queue_mapping(skb); atomic_inc(&priv->wmm_tx_pending[index]); - if (atomic_read(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { + if (atomic_read(&priv->wmm_tx_pending[index]) >= + MAX_TX_PENDING) { struct netdev_queue *txq = netdev_get_tx_queue(priv->netdev, index); netif_tx_stop_queue(txq); @@ -5971,7 +7137,7 @@ #else if (atomic_read(&priv->phandle->tx_pending) >= MAX_TX_PENDING) woal_stop_queue(priv->netdev); -#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) */ +#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)*/ queue_work(priv->phandle->workqueue, &priv->phandle->main_work); break; case MLAN_STATUS_SUCCESS: @@ -5994,10 +7160,11 @@ * @param priv A pointer to moal_private structure * @param pmbuf A pointer to mlan_buffer associated with a skb * - * @return 1, if it's dropped; 0, if not dropped + * @return 1, if it's dropped; 2, if it's hold 0, if not dropped and + * not hold + * */ -static int -woal_process_tcp_ack(moal_private *priv, mlan_buffer *pmbuf) +static int woal_process_tcp_ack(moal_private *priv, mlan_buffer *pmbuf) { int ret = 0; unsigned long flags; @@ -6034,12 +7201,14 @@ } priv->tcp_ack_cnt++; spin_lock_irqsave(&priv->tcp_sess_lock, flags); - tcp_session = - woal_get_tcp_sess(priv, (__force t_u32)iph->saddr, - (__force t_u16)tcph->source, - (__force t_u32)iph->daddr, - (__force t_u16)tcph->dest); + tcp_session = woal_get_tcp_sess(priv, (__force t_u32)iph->saddr, + (__force t_u16)tcph->source, + (__force t_u32)iph->daddr, + (__force t_u16)tcph->dest); if (!tcp_session) { + /* check any aging out sessions can be removed */ + woal_ageout_tcp_sess_queue(priv); + tcp_session = kmalloc(sizeof(struct tcp_sess), GFP_ATOMIC); if (!tcp_session) { @@ -6048,6 +7217,10 @@ flags); goto done; } + woal_get_monotonic_time(&tcp_session->update_time); + PRINTM(MDATA, "wlan: create TCP seesion %p\n", + tcp_session); + tcp_session->ack_skb = pmbuf->pdesc; tcp_session->pmbuf = pmbuf; pmbuf->flags |= MLAN_BUF_FLAG_TCP_ACK; @@ -6063,7 +7236,7 @@ woal_initialize_timer(&tcp_session->ack_timer, woal_tcp_ack_timer_func, tcp_session); - tcp_session->is_timer_set = MTRUE; + atomic_set(&tcp_session->is_timer_set, MTRUE); woal_mod_timer(&tcp_session->ack_timer, MOAL_TIMER_1MS); list_add_tail(&tcp_session->link, &priv->tcp_sess_queue); @@ -6072,6 +7245,7 @@ LEAVE(); return ret; } else if (!tcp_session->ack_skb) { + woal_get_monotonic_time(&tcp_session->update_time); tcp_session->ack_skb = pmbuf->pdesc; tcp_session->pmbuf = pmbuf; pmbuf->flags |= MLAN_BUF_FLAG_TCP_ACK; @@ -6079,13 +7253,14 @@ tcp_session->priv = (void *)priv; skb = (struct sk_buff *)pmbuf->pdesc; skb->cb[0] = 0; - tcp_session->is_timer_set = MTRUE; + atomic_set(&tcp_session->is_timer_set, MTRUE); woal_mod_timer(&tcp_session->ack_timer, MOAL_TIMER_1MS); spin_unlock_irqrestore(&priv->tcp_sess_lock, flags); ret = HOLD_TCP_ACK; LEAVE(); return ret; } + woal_get_monotonic_time(&tcp_session->update_time); ack_seq = ntohl(tcph->ack_seq); skb = (struct sk_buff *)tcp_session->ack_skb; if (likely(ack_seq > tcp_session->ack_seq) && @@ -6109,6 +7284,7 @@ return ret; } } + done: LEAVE(); return ret; @@ -6120,10 +7296,9 @@ * @param skb A pointer to sk_buff structure * @param dev A pointer to net_device structure * - * @return 0 --success + * @return N/A */ -static int -woal_start_xmit(moal_private *priv, struct sk_buff *skb) +static void woal_start_xmit(moal_private *priv, struct sk_buff *skb) { mlan_buffer *pmbuf = NULL; mlan_status status; @@ -6136,18 +7311,18 @@ ENTER(); priv->num_tx_timeout = 0; - if (!skb->len || (skb->len > ETH_FRAME_LEN)) { + if (!skb->len || + (skb->len > (priv->netdev->mtu + sizeof(struct ethhdr)))) { PRINTM(MERROR, "Tx Error: Bad skb length %d : %d\n", skb->len, - ETH_FRAME_LEN); + priv->netdev->mtu); dev_kfree_skb_any(skb); priv->stats.tx_dropped++; goto done; } - //kernel crash with cloned skb without copy - //2 AGO case - //uap0 <-->muap0 bridge - if (moal_extflg_isset(priv->phandle, EXT_TX_SKB_CLONE) || - skb->cloned || + // kernel crash with cloned skb without copy + // 2 AGO case + // uap0 <-->muap0 bridge + if (moal_extflg_isset(priv->phandle, EXT_TX_SKB_CLONE) || skb->cloned || (skb_headroom(skb) < (MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + priv->extra_tx_head_len))) { @@ -6156,11 +7331,9 @@ skb->cloned, skb_headroom(skb), moal_extflg_isset(priv->phandle, EXT_TX_SKB_CLONE)); /* Insufficient skb headroom - allocate a new skb */ - new_skb = - skb_realloc_headroom(skb, - MLAN_MIN_DATA_HEADER_LEN + - sizeof(mlan_buffer) + - priv->extra_tx_head_len); + new_skb = skb_realloc_headroom( + skb, MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + + priv->extra_tx_head_len); moal_tp_accounting_rx_param((t_void *)priv->phandle, 7, 0); if (unlikely(!new_skb)) { PRINTM(MERROR, "Tx: Cannot allocate skb\n"); @@ -6192,25 +7365,25 @@ #endif #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) index = skb_get_queue_mapping(skb); + index = MIN(index, 3); #endif + if (is_zero_timeval(priv->phandle->tx_time_start)) { + priv->phandle->tx_time_start.time_sec = pmbuf->in_ts_sec; + priv->phandle->tx_time_start.time_usec = pmbuf->in_ts_usec; + PRINTM(MINFO, "%s : start_timeval=%d:%d \n", __func__, + priv->phandle->tx_time_start.time_sec, + priv->phandle->tx_time_start.time_usec); + } status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { case MLAN_STATUS_PENDING: - if (is_zero_timeval(priv->phandle->tx_time_start)) { - priv->phandle->tx_time_start.time_sec = - pmbuf->in_ts_sec; - priv->phandle->tx_time_start.time_usec = - pmbuf->in_ts_usec; - PRINTM(MINFO, "%s : start_timeval=%d:%d \n", __func__, - priv->phandle->tx_time_start.time_sec, - priv->phandle->tx_time_start.time_usec); - } atomic_inc(&priv->phandle->tx_pending); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) atomic_inc(&priv->wmm_tx_pending[index]); - if (atomic_read(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { + if (atomic_read(&priv->wmm_tx_pending[index]) >= + MAX_TX_PENDING) { struct netdev_queue *txq = netdev_get_tx_queue(priv->netdev, index); netif_tx_stop_queue(txq); @@ -6221,11 +7394,11 @@ #else if (atomic_read(&priv->phandle->tx_pending) >= MAX_TX_PENDING) woal_stop_queue(priv->netdev); -#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) */ +#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)*/ if (!mlan_is_main_process_running(priv->phandle->pmlan_adapter)) - queue_work(priv->phandle->workqueue, - &priv->phandle->main_work); + queue_work(priv->phandle->workqueue, + &priv->phandle->main_work); break; case MLAN_STATUS_SUCCESS: priv->stats.tx_packets++; @@ -6240,7 +7413,7 @@ } done: LEAVE(); - return 0; + return; } /** @@ -6251,8 +7424,7 @@ * * @return 0 --success */ -netdev_tx_t -woal_hard_start_xmit(struct sk_buff * skb, struct net_device * dev) +netdev_tx_t woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); ENTER(); @@ -6274,7 +7446,6 @@ goto done; } if (moal_extflg_isset(priv->phandle, EXT_TX_WORK)) { - spin_lock_bh(&(priv->tx_q.lock)); __skb_queue_tail(&(priv->tx_q), skb); spin_unlock_bh(&(priv->tx_q.lock)); @@ -6298,8 +7469,7 @@ * * @return Number of integer */ -int -woal_ascii2hex(t_u8 *d, char *s, t_u32 dlen) +int woal_ascii2hex(t_u8 *d, char *s, t_u32 dlen) { unsigned int i; t_u8 n; @@ -6334,8 +7504,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_atoi(int *data, char *a) +mlan_status woal_atoi(int *data, char *a) { int i, val = 0, len; int mul = 1; @@ -6358,6 +7527,9 @@ } else { if ((i == 0) && (a[i] == '-')) { mul = -1; + } else if (a[i] == 0xa) { + // line feed + break; } else { PRINTM(MERROR, "Invalid char %c in string %s\n", a[i], a); @@ -6379,8 +7551,7 @@ * * @return The converted character if a is a valid hex, else 0 */ -int -woal_atox(char *a) +int woal_atox(char *a) { int i = 0; @@ -6403,8 +7574,7 @@ * * @return Pointer to the separated string if delim found, else NULL */ -char * -woal_strsep(char **s, char delim, char esc) +char *woal_strsep(char **s, char delim, char esc) { char *se = *s, *sb; @@ -6455,8 +7625,7 @@ * * @return N/A */ -void -woal_mac2u8(t_u8 *mac_addr, char *buf) +void woal_mac2u8(t_u8 *mac_addr, char *buf) { char *begin, *end, *mac_buff; int i; @@ -6494,8 +7663,7 @@ * * @return N/A */ -void -woal_set_multicast_list(struct net_device *dev) +void woal_set_multicast_list(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); ENTER(); @@ -6513,10 +7681,8 @@ * * @return N/A */ -void -woal_init_priv(moal_private *priv, t_u8 wait_option) +void woal_init_priv(moal_private *priv, t_u8 wait_option) { - ENTER(); #ifdef STA_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { @@ -6540,13 +7706,23 @@ priv->reassoc_on = MFALSE; priv->set_asynced_essid_flag = MFALSE; #endif + priv->auto_assoc_priv.auto_assoc_type_on = 2; + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_DRV_RECONN; + memset(&priv->auto_assoc_priv.drv_assoc, 0, + sizeof(drv_auto_assoc)); + memset(&priv->auto_assoc_priv.drv_reconnect, 0, + sizeof(drv_auto_assoc)); + priv->auto_assoc_priv.drv_reconnect.retry_count = 0xff; #ifdef STA_CFG80211 memset(&priv->sme_current, 0, sizeof(struct cfg80211_connect_params)); #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) woal_init_wifi_hal(priv); #endif +#endif } #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT @@ -6563,11 +7739,12 @@ memset(&priv->beacon_after, 0, sizeof(struct cfg80211_beacon_data)); #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) woal_init_wifi_hal(priv); #endif #endif - +#endif } #endif @@ -6592,6 +7769,10 @@ priv->cfg_connect = MFALSE; #endif #ifdef STA_SUPPORT +#ifdef STA_CFG80211 + priv->pmk_saved = MFALSE; + memset(&priv->pmk, 0, sizeof(mlan_pmk_t)); +#endif #endif priv->enable_tcp_ack_enh = MTRUE; @@ -6606,14 +7787,19 @@ priv->gtk_data_ready = MFALSE; memset(&priv->gtk_rekey_data, 0, sizeof(mlan_ds_misc_gtk_rekey_data)); - woal_request_get_fw_info(priv, wait_option, NULL); - + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, wait_option, NULL)) { + PRINTM(MERROR, "%s: get_fw_info failed \n", __func__); + return; + } /* Set MAC address from the insmod command line */ - if (priv->phandle->set_mac_addr) { + if (priv->phandle->set_mac_addr && + priv->bss_type != MLAN_BSS_TYPE_DFS) { memset(priv->current_addr, 0, ETH_ALEN); moal_memcpy_ext(priv->phandle, priv->current_addr, priv->phandle->mac_addr, ETH_ALEN, ETH_ALEN); } + #ifdef WIFI_DIRECT_SUPPORT #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION @@ -6623,11 +7809,11 @@ if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { if (priv->bss_virtual) { if (priv->pa_netdev) { - moal_memcpy_ext(priv->phandle, - priv->current_addr, - priv->pa_netdev-> - dev_addr, ETH_ALEN, - ETH_ALEN); + moal_memcpy_ext( + priv->phandle, + priv->current_addr, + priv->pa_netdev->dev_addr, + ETH_ALEN, ETH_ALEN); priv->current_addr[4] ^= 0x80; if (priv->phandle->second_mac) priv->current_addr[5] ^= 0x80; @@ -6647,20 +7833,33 @@ #endif #endif - /* Set MAC address for UAPx/MLANx/WFDx/OCBx and let them - * different with each other */ + /* Set MAC address for UAPx/MLANx/WFDx/OCBx and let them + * different with each other */ #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT) #endif { - priv->current_addr[4] += priv->bss_index; + if (priv->bss_index) { + priv->current_addr[0] |= 0x02; + priv->current_addr[4] += priv->bss_index; + } PRINTM(MCMND, "Set %s interface addr: " MACSTR "\n", priv->netdev->name, MAC2STR(priv->current_addr)); } - woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT); + /* ZeroDFS interface doesn't need to set mac address to fw */ + if (priv->bss_type != MLAN_BSS_TYPE_DFS) { + if (MLAN_STATUS_SUCCESS != + woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, "%s: set mac address failed \n", + __func__); + } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(priv->netdev, priv->current_addr); +#else moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr, priv->current_addr, ETH_ALEN, ETH_ALEN); +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) priv->host_mlme = 0; priv->auth_flag = 0; @@ -6668,7 +7867,8 @@ #endif #ifdef UAP_SUPPORT - priv->trans_chan = 0; + priv->target_chan = 0; + priv->backup_chan = 0; priv->user_cac_period_msec = 0; priv->chan_under_nop = MFALSE; #endif @@ -6686,8 +7886,7 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -int -woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) +mlan_status woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) { int ret = MLAN_STATUS_SUCCESS; int intf_num; @@ -6702,10 +7901,35 @@ } handle = priv->phandle; +#if defined(STA_CFG80211) && defined(UAP_CFG80211) + /* Unregister and detach connected radiotap net device */ + if (handle->mon_if) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (MLAN_STATUS_SUCCESS != + woal_set_net_monitor(handle->mon_if->priv, wait_option, + MFALSE, 0, NULL)) { + PRINTM(MERROR, "%s: stop net monitor failed \n", + __func__); + ret = MLAN_STATUS_FAILURE; + goto done; + } +#endif + netif_device_detach(handle->mon_if->mon_ndev); + if (handle->mon_if->mon_ndev->reg_state == NETREG_REGISTERED) + unregister_netdev(handle->mon_if->mon_ndev); + handle->mon_if = NULL; + } +#endif if (handle->rf_test_mode) woal_process_rf_test_mode(handle, MFG_CMD_UNSET_TEST_MODE); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +#endif #ifdef STA_SUPPORT - woal_cancel_scan(priv, wait_option); + if (MLAN_STATUS_SUCCESS != woal_cancel_scan(priv, wait_option)) { + PRINTM(MERROR, "%s: cancel scan failed \n", __func__); + ret = MLAN_STATUS_FAILURE; + goto done; + } #endif /* Stop queue and detach device */ @@ -6721,7 +7945,12 @@ /* Get BSS info */ memset(&bss_info, 0, sizeof(bss_info)); - woal_get_bss_info(priv, wait_option, &bss_info); + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, wait_option, &bss_info)) { + PRINTM(MERROR, "%s: get bss info failed \n", __func__); + ret = MLAN_STATUS_FAILURE; + goto done; + } /* Cancel host sleep */ if (bss_info.is_hs_configured) { @@ -6738,9 +7967,15 @@ #ifdef UAP_SUPPORT || (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) #endif - ) { - woal_disconnect(priv, wait_option, NULL, - DEF_DEAUTH_REASON_CODE); + ) { + if (MLAN_STATUS_SUCCESS != + woal_disconnect(priv, wait_option, NULL, + DEF_DEAUTH_REASON_CODE)) { + PRINTM(MERROR, "%s: woal_disconnect failed \n", + __func__); + ret = MLAN_STATUS_FAILURE; + goto done; + } priv->media_connected = MFALSE; } } else { @@ -6751,10 +7986,17 @@ || (GET_BSS_ROLE(handle->priv[intf_num]) == MLAN_BSS_ROLE_UAP) #endif - ) { - woal_disconnect(handle->priv[intf_num], - wait_option, NULL, - DEF_DEAUTH_REASON_CODE); + ) { + if (MLAN_STATUS_SUCCESS != + woal_disconnect(handle->priv[intf_num], + wait_option, NULL, + DEF_DEAUTH_REASON_CODE)) { + PRINTM(MERROR, + "%s: woal_disconnect failed \n", + __func__); + ret = MLAN_STATUS_FAILURE; + goto done; + } handle->priv[intf_num]->media_connected = MFALSE; } @@ -6766,11 +8008,17 @@ if (!all_intf) { handle->reassoc_on &= ~MBIT(priv->bss_index); priv->reassoc_on = MFALSE; + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = MFALSE; priv->set_asynced_essid_flag = MFALSE; } else { handle->reassoc_on = 0; for (intf_num = 0; intf_num < handle->priv_num; intf_num++) { handle->priv[intf_num]->reassoc_on = MFALSE; + handle->priv[intf_num] + ->auto_assoc_priv.drv_assoc.status = MFALSE; + handle->priv[intf_num] + ->auto_assoc_priv.drv_reconnect.status = MFALSE; handle->priv[intf_num]->set_asynced_essid_flag = MFALSE; } } @@ -6816,13 +8064,12 @@ * * @return moal_private pointer or NULL */ -moal_private * -woal_bss_index_to_priv(moal_handle *handle, t_u8 bss_index) +moal_private *woal_bss_index_to_priv(moal_handle *handle, t_u8 bss_index) { int i; ENTER(); - if (!handle) { + if (!handle || !handle->priv_num) { LEAVE(); return NULL; } @@ -6845,8 +8092,7 @@ * * @return mlan_buffer pointer or NULL */ -pmlan_buffer -woal_alloc_mlan_buffer(moal_handle *handle, int size) +pmlan_buffer woal_alloc_mlan_buffer(moal_handle *handle, int size) { mlan_buffer *pmbuf = NULL; struct sk_buff *skb; @@ -6854,7 +8100,7 @@ ENTER(); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; if (size <= 0) { PRINTM(MERROR, "Buffer size must be positive\n"); LEAVE(); @@ -6884,17 +8130,17 @@ * * @return mlan_ioctl_req pointer or NULL */ -pmlan_ioctl_req -woal_alloc_mlan_ioctl_req(int size) +pmlan_ioctl_req woal_alloc_mlan_ioctl_req(int size) { mlan_ioctl_req *req = NULL; gfp_t flag; ENTER(); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; req = kzalloc((sizeof(mlan_ioctl_req) + size + sizeof(int) + - sizeof(wait_queue)), flag); + sizeof(wait_queue)), + flag); if (!req) { PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", __func__); LEAVE(); @@ -6915,8 +8161,7 @@ * * @return N/A */ -void -woal_free_mlan_buffer(moal_handle *handle, pmlan_buffer pmbuf) +void woal_free_mlan_buffer(moal_handle *handle, pmlan_buffer pmbuf) { ENTER(); if (!pmbuf) { @@ -6937,10 +8182,9 @@ * * @param phandle A pointer to moal_handle * - * @return N/A + * @return 0-success , otherwise failure. */ -static int -woal_get_card_info(moal_handle *phandle) +static int woal_get_card_info(moal_handle *phandle) { int ret = 0; @@ -6997,6 +8241,11 @@ phandle->card_info = &card_info_SD9097; break; #endif +#ifdef SDNW62X + case CARD_TYPE_SDNW62X: + phandle->card_info = &card_info_SDNW62X; + break; +#endif #ifdef SD9177 case CARD_TYPE_SD9177: phandle->card_info = &card_info_SD9177; @@ -7013,6 +8262,11 @@ phandle->card_info = &card_info_PCIE9097; break; #endif +#ifdef PCIENW62X + case CARD_TYPE_PCIENW62X: + phandle->card_info = &card_info_PCIENW62X; + break; +#endif #ifdef PCIE9098 case CARD_TYPE_PCIE9098: phandle->card_info = &card_info_PCIE9098; @@ -7044,6 +8298,11 @@ phandle->card_info = &card_info_USB9097; break; #endif +#ifdef USBNW62X + case CARD_TYPE_USBNW62X: + phandle->card_info = &card_info_USBNW62X; + break; +#endif #ifdef SD8987 case CARD_TYPE_SD8987: phandle->card_info = &card_info_SD8987; @@ -7071,8 +8330,7 @@ * @param len Length of the payload * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_broadcast_event(moal_private *priv, t_u8 *payload, t_u32 len) +mlan_status woal_broadcast_event(moal_private *priv, t_u8 *payload, t_u32 len) { mlan_status ret = MLAN_STATUS_SUCCESS; struct sk_buff *skb = NULL; @@ -7084,40 +8342,20 @@ ENTER(); /* interface name to be prepended to event */ - if ((len + IFNAMSIZ) > NL_MAX_PAYLOAD -#ifdef WIFI_DIRECT_SUPPORT - * 2 -#endif - ) { + /* NL_MAX_PAYLOAD = 3 * 1024 */ + if ((len + IFNAMSIZ) > NL_MAX_PAYLOAD) { PRINTM(MERROR, "event size is too big, len=%d\n", (int)len); ret = MLAN_STATUS_FAILURE; goto done; } if (sk) { /* Allocate skb */ -#ifdef WIFI_DIRECT_SUPPORT - if ((len + IFNAMSIZ) > NL_MAX_PAYLOAD) { - skb = alloc_skb(NLMSG_SPACE(NL_MAX_PAYLOAD * 2), - GFP_ATOMIC); - if (!skb) { - PRINTM(MERROR, - "Could not allocate skb for netlink\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - } else { -#endif - skb = alloc_skb(NLMSG_SPACE(NL_MAX_PAYLOAD), - GFP_ATOMIC); - if (!skb) { - PRINTM(MERROR, - "Could not allocate skb for netlink\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } -#ifdef WIFI_DIRECT_SUPPORT + skb = alloc_skb(NLMSG_SPACE(NL_MAX_PAYLOAD), GFP_ATOMIC); + if (!skb) { + PRINTM(MERROR, "Could not allocate skb for netlink\n"); + ret = MLAN_STATUS_FAILURE; + goto done; } -#endif memset(skb->data, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); nlh = (struct nlmsghdr *)skb->data; @@ -7182,8 +8420,7 @@ * @param data A pointer to wlan_thread structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -int -woal_reassociation_thread(void *data) +int woal_reassociation_thread(void *data) { moal_thread *pmoal_thread = data; moal_private *priv = NULL; @@ -7196,12 +8433,19 @@ int i; BOOLEAN reassoc_timer_req; mlan_802_11_ssid req_ssid; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; mlan_status status; mlan_bss_info bss_info; t_u32 timer_val = MOAL_TIMER_10S; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u32 retry_count = 0; + t_u32 retry_interval = 0; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; ENTER(); + ssid_bssid = kmalloc(sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!ssid_bssid) { + LEAVE(); + return 0; + } woal_activate_thread(pmoal_thread); init_waitqueue_entry(&wait, current); @@ -7219,8 +8463,8 @@ #if defined(USB) if (IS_USB(handle->card_type)) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) - try_to_freeze(0); /* Argument is not used by the kernel - */ + try_to_freeze(0); /* Argument is not used by the kernel + */ #else try_to_freeze(); #endif @@ -7248,7 +8492,8 @@ reassoc_timer_req = MFALSE; #ifdef STA_CFG80211 for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM) && - (priv = handle->priv[i]); i++) { + (priv = handle->priv[i]); + i++) { if (priv->roaming_required) { priv->roaming_required = MFALSE; PRINTM(MEVENT, "Try to roaming......\n"); @@ -7259,9 +8504,90 @@ #endif for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM) && - (priv = handle->priv[i]); i++) { + (priv = handle->priv[i]); + i++) { if (priv->reassoc_required == MFALSE) { - priv->set_asynced_essid_flag = MFALSE; + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; + continue; + } + + if (priv->auto_assoc_priv.auto_assoc_trigger_flag == + AUTO_ASSOC_TYPE_DRV_RECONN || + priv->auto_assoc_priv.auto_assoc_trigger_flag == + AUTO_ASSOC_TYPE_DRV_ASSOC) { + if (priv->auto_assoc_priv + .auto_assoc_trigger_flag == + AUTO_ASSOC_TYPE_DRV_RECONN) { + retry_count = priv->auto_assoc_priv + .drv_reconnect + .retry_count; + retry_interval = + priv->auto_assoc_priv + .drv_reconnect + .retry_interval * + 1000; + if (retry_count == 0xff) + retry_count = + AUTO_ASSOC_RETRY_FOREVER; + priv->auto_assoc_priv.drv_reconnect + .status = MTRUE; + PRINTM(MINFO, + "Auto assoc: driver auto re-connect triggered\n"); + } + if (priv->auto_assoc_priv + .auto_assoc_trigger_flag == + AUTO_ASSOC_TYPE_DRV_ASSOC) { + /* disconnect before driver + * assoc */ + woal_disconnect(priv, MOAL_IOCTL_WAIT, + NULL, + DEF_DEAUTH_REASON_CODE); + if (priv->auto_assoc_priv + .auto_assoc_type_on & + (0x1 << (AUTO_ASSOC_TYPE_DRV_ASSOC - + 1))) { + retry_count = + priv->auto_assoc_priv + .drv_assoc + .retry_count; + retry_interval = + priv->auto_assoc_priv + .drv_assoc + .retry_interval * + 1000; + if (retry_count == 0xff) + retry_count = + AUTO_ASSOC_RETRY_FOREVER; + else + retry_count = + retry_count + 1; + PRINTM(MINFO, + "Auto assoc: driver auto assoc triggered\n"); + } else { + retry_count = 1; + retry_interval = 0; + PRINTM(MINFO, + "Auto assoc: set asynced essid with drv auto assoc disable\n"); + } + priv->reassoc_required = MTRUE; + priv->auto_assoc_priv.drv_assoc.status = + MTRUE; + } + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_NONE; + } + + if (retry_count == 0 && + (priv->auto_assoc_priv.drv_assoc.status == MTRUE || + priv->auto_assoc_priv.drv_reconnect.status == + MTRUE)) { + PRINTM(MINFO, + "Auto assoc: stop driver auto assoc: the retry count is 0\n"); + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; continue; } @@ -7272,7 +8598,9 @@ &bss_info)) { PRINTM(MINFO, "Ressoc: Fail to get bss info\n"); priv->reassoc_required = MFALSE; - priv->set_asynced_essid_flag = MFALSE; + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; continue; } @@ -7281,7 +8609,9 @@ PRINTM(MINFO, "Reassoc: ad-hoc mode or media connected\n"); priv->reassoc_required = MFALSE; - priv->set_asynced_essid_flag = MFALSE; + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; continue; } /** avoid on going scan from other thread */ @@ -7296,7 +8626,7 @@ be disabled completely by application if wlan_set_user_scan_ioctl/wlan_set_wap is used. - */ + */ if (MOAL_ACQ_SEMAPHORE_BLOCK(&handle->reassoc_sem)) { PRINTM(MERROR, "Acquire semaphore error, reassociation thread\n"); @@ -7330,52 +8660,53 @@ break; } - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); - if (priv->set_asynced_essid_flag == MTRUE) { + if (priv->auto_assoc_priv.drv_assoc.status == MTRUE) { if (priv->assoc_with_mac && memcmp(priv->prev_ssid_bssid.bssid, zero_mac, MLAN_MAC_ADDR_LENGTH)) { /* Search AP by BSSID & SSID */ PRINTM(MINFO, "Reassoc: Search AP by BSSID & SSID\n"); - moal_memcpy_ext(priv->phandle, - &ssid_bssid.bssid, - &priv->prev_ssid_bssid. - bssid, - MLAN_MAC_ADDR_LENGTH, - sizeof - (mlan_802_11_mac_addr)); + moal_memcpy_ext( + priv->phandle, + &ssid_bssid->bssid, + &priv->prev_ssid_bssid.bssid, + MLAN_MAC_ADDR_LENGTH, + sizeof(mlan_802_11_mac_addr)); } else { - /* Search AP by ESSID for asynced essid - * setting */ + /* Search AP by ESSID for driver + * auto reassoc */ PRINTM(MINFO, - "Set asynced essid: Search AP by ESSID\n"); + "Reassoc: Search AP by ESSID\n"); } - moal_memcpy_ext(priv->phandle, &ssid_bssid.ssid, + moal_memcpy_ext(priv->phandle, + &ssid_bssid->ssid, &priv->prev_ssid_bssid.ssid, sizeof(mlan_802_11_ssid), sizeof(mlan_802_11_ssid)); + } else { /* Search AP by BSSID first */ PRINTM(MINFO, "Reassoc: Search AP by BSSID first\n"); moal_memcpy_ext(priv->phandle, - &ssid_bssid.bssid, + &ssid_bssid->bssid, &priv->prev_ssid_bssid.bssid, MLAN_MAC_ADDR_LENGTH, sizeof(mlan_802_11_mac_addr)); } status = woal_find_best_network(priv, MOAL_IOCTL_WAIT, - &ssid_bssid); + ssid_bssid); #ifdef STA_WEXT if (status == MLAN_STATUS_SUCCESS) { if (MLAN_STATUS_SUCCESS != woal_11d_check_ap_channel(priv, MOAL_IOCTL_WAIT, - &ssid_bssid)) { + ssid_bssid)) { PRINTM(MERROR, "Reassoc: The AP's channel is invalid for current region\n"); status = MLAN_STATUS_FAILURE; @@ -7385,33 +8716,32 @@ /** The find AP without ssid, we need re-search */ if (status == MLAN_STATUS_SUCCESS && - !ssid_bssid.ssid.ssid_len) { + !ssid_bssid->ssid.ssid_len) { PRINTM(MINFO, "Reassoc: Skip AP without ssid\n"); status = MLAN_STATUS_FAILURE; } - if (priv->set_asynced_essid_flag != MTRUE && + if (priv->auto_assoc_priv.drv_assoc.status != MTRUE && MLAN_STATUS_SUCCESS != status) { PRINTM(MINFO, "Reassoc: AP not found in scan list\n"); PRINTM(MINFO, "Reassoc: Search AP by SSID\n"); /* Search AP by SSID */ - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); - moal_memcpy_ext(priv->phandle, &ssid_bssid.ssid, + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + moal_memcpy_ext(priv->phandle, + &ssid_bssid->ssid, &priv->prev_ssid_bssid.ssid, sizeof(mlan_802_11_ssid), sizeof(mlan_802_11_ssid)); - status = woal_find_best_network(priv, - MOAL_IOCTL_WAIT, - &ssid_bssid); + status = woal_find_best_network( + priv, MOAL_IOCTL_WAIT, ssid_bssid); #ifdef STA_WEXT if (status == MLAN_STATUS_SUCCESS) { if (MLAN_STATUS_SUCCESS != - woal_11d_check_ap_channel(priv, - MOAL_IOCTL_WAIT, - &ssid_bssid)) - { + woal_11d_check_ap_channel( + priv, MOAL_IOCTL_WAIT, + ssid_bssid)) { PRINTM(MERROR, "Reassoc: The AP's channel is invalid for current region\n"); status = MLAN_STATUS_FAILURE; @@ -7422,15 +8752,24 @@ if (status == MLAN_STATUS_SUCCESS) { /* set the wep key */ - if (bss_info.wep_status) - woal_enable_wep_key(priv, - MOAL_IOCTL_WAIT); + if (bss_info.wep_status) { + if (MLAN_STATUS_SUCCESS != + woal_enable_wep_key( + priv, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "Reassoc: woal_enable_wep_key failed\n"); + status = MLAN_STATUS_FAILURE; + } + } /* Zero SSID implies use BSSID to * connect */ - memset(&ssid_bssid.ssid, 0, + memset(&ssid_bssid->ssid, 0, sizeof(mlan_802_11_ssid)); status = woal_bss_start(priv, MOAL_IOCTL_WAIT, - &ssid_bssid); + ssid_bssid); + if (status != MLAN_STATUS_SUCCESS) + PRINTM(MERROR, + "Reassoc: woal_bss_start failed\n"); } if (priv->media_connected == MFALSE) @@ -7440,39 +8779,40 @@ mlan_ioctl_req *req = NULL; reassoc_timer_req = MFALSE; - if (priv->set_asynced_essid_flag == MTRUE) { + if (priv->auto_assoc_priv.drv_assoc.status == + MTRUE) { memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { PRINTM(MINFO, - "Set asynced essid: Fail to get bss info after assoc\n"); + "Ressoc: Fail to get bss info after driver auto reassoc\n"); } else { - moal_memcpy_ext(priv->phandle, - &priv-> - prev_ssid_bssid. - ssid, - &bss_info.ssid, - sizeof - (mlan_802_11_ssid), - sizeof - (mlan_802_11_ssid)); - moal_memcpy_ext(priv->phandle, - &priv-> - prev_ssid_bssid. - bssid, - &bss_info.bssid, - MLAN_MAC_ADDR_LENGTH, - sizeof(priv-> - prev_ssid_bssid. - bssid)); + moal_memcpy_ext( + priv->phandle, + &priv->prev_ssid_bssid + .ssid, + &bss_info.ssid, + sizeof(mlan_802_11_ssid), + sizeof(mlan_802_11_ssid)); + moal_memcpy_ext( + priv->phandle, + &priv->prev_ssid_bssid + .bssid, + &bss_info.bssid, + MLAN_MAC_ADDR_LENGTH, + sizeof(priv->prev_ssid_bssid + .bssid)); } - priv->set_asynced_essid_flag = MFALSE; + priv->auto_assoc_priv.drv_assoc.status = + MFALSE; } + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; if (priv->rate_index != AUTO_RATE) { - req = woal_alloc_mlan_ioctl_req(sizeof - (mlan_ds_rate)); + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_rate)); if (req == NULL) { LEAVE(); @@ -7490,8 +8830,8 @@ rate->param.rate_cfg.rate = priv->rate_index; - status = woal_request_ioctl(priv, req, - MOAL_IOCTL_WAIT); + status = woal_request_ioctl( + priv, req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_SUCCESS) { if (status != MLAN_STATUS_PENDING) @@ -7511,10 +8851,18 @@ if (reassoc_timer_req == MTRUE) { handle->is_reassoc_timer_set = MTRUE; - if (priv && (priv->set_asynced_essid_flag == MTRUE)) { - PRINTM(MERROR, - "Set Async ESSID: No AP found or assoc failed.\n"); - priv->set_asynced_essid_flag = MFALSE; + if (priv && + (priv->auto_assoc_priv.drv_assoc.status == MTRUE || + priv->auto_assoc_priv.drv_reconnect.status == + MTRUE)) { + PRINTM(MEVENT, + "Auto assoc: No AP found or assoc failed. " + "Restarting re-assoc Timer: %d\n", + (int)retry_interval); + if (retry_count != AUTO_ASSOC_RETRY_FOREVER) + retry_count--; + woal_mod_timer(&handle->reassoc_timer, + retry_interval); } else { PRINTM(MEVENT, "Reassoc: No AP found or assoc failed. " @@ -7525,12 +8873,15 @@ } } else { if (priv) { + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = + MFALSE; priv->set_asynced_essid_flag = MFALSE; } } } woal_deactivate_thread(pmoal_thread); - + kfree(ssid_bssid); LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -7542,8 +8893,7 @@ * @param context A pointer to context * @return N/A */ -void -woal_reassoc_timer_func(void *context) +void woal_reassoc_timer_func(void *context) { moal_handle *handle = (moal_handle *)context; @@ -7567,8 +8917,7 @@ * @param context A pointer to context * @return N/A */ -void -woal_fw_dump_timer_func(void *context) +void woal_fw_dump_timer_func(void *context) { moal_handle *handle = (moal_handle *)context; @@ -7576,7 +8925,8 @@ PRINTM(MMSG, "fw_dump_timer fired.\n"); handle->is_fw_dump_timer_set = MFALSE; - woal_process_hang(handle); + if (handle->priv_num) + woal_process_hang(handle); LEAVE(); return; } @@ -7589,10 +8939,9 @@ * * @return N/A */ -void -woal_update_dscp_mapping(moal_private *priv) +void woal_update_dscp_mapping(moal_private *priv) { - mlan_ds_misc_assoc_rsp assoc_rsp; + mlan_ds_misc_assoc_rsp *assoc_rsp = NULL; IEEEtypes_AssocRsp_t *passoc_rsp = NULL; IEEEtypes_Header_t *qos_mapping_ie = NULL; DSCP_Range_t *pdscp_range = NULL; @@ -7600,41 +8949,48 @@ DSCP_Exception_t dscp_except[MAX_DSCP_EXCEPTION_NUM]; int i, j; ENTER(); + assoc_rsp = kmalloc(sizeof(mlan_ds_misc_assoc_rsp), GFP_KERNEL); + if (!assoc_rsp) { + LEAVE(); + return; + } + memset(assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); + if (MLAN_STATUS_FAILURE == + woal_get_assoc_rsp(priv, assoc_rsp, MOAL_NO_WAIT)) { + PRINTM(MERROR, "woal_get_assoc_rsp failed\n"); + kfree(assoc_rsp); + LEAVE(); + return; + } - memset(&assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); - woal_get_assoc_rsp(priv, &assoc_rsp, MOAL_NO_WAIT); - passoc_rsp = (IEEEtypes_AssocRsp_t *)assoc_rsp.assoc_resp_buf; + passoc_rsp = (IEEEtypes_AssocRsp_t *)assoc_rsp->assoc_resp_buf; memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map)); - qos_mapping_ie = - (IEEEtypes_Header_t *)woal_parse_ie_tlv(passoc_rsp->ie_buffer, - assoc_rsp. - assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, - QOS_MAPPING); + qos_mapping_ie = (IEEEtypes_Header_t *)woal_parse_ie_tlv( + passoc_rsp->ie_buffer, + assoc_rsp->assoc_resp_len - ASSOC_RESP_FIXED_SIZE, QOS_MAPPING); if (qos_mapping_ie && (qos_mapping_ie->len >= (sizeof(DSCP_Range_t) * MAX_NUM_TID))) { - dscp_except_num = - (qos_mapping_ie->len - - sizeof(DSCP_Range_t) * MAX_NUM_TID) / - sizeof(DSCP_Exception_t); + dscp_except_num = (qos_mapping_ie->len - + sizeof(DSCP_Range_t) * MAX_NUM_TID) / + sizeof(DSCP_Exception_t); if (dscp_except_num > MAX_DSCP_EXCEPTION_NUM) { PRINTM(MERROR, "dscp_except_num exceeds MAX limit\n"); + kfree(assoc_rsp); LEAVE(); return; } moal_memcpy_ext(priv->phandle, dscp_except, (t_u8 *)qos_mapping_ie + - sizeof(IEEEtypes_Header_t), - dscp_except_num * - sizeof(DSCP_Exception_t), sizeof(dscp_except)); + sizeof(IEEEtypes_Header_t), + dscp_except_num * sizeof(DSCP_Exception_t), + sizeof(dscp_except)); pdscp_range = - (DSCP_Range_t - *)((t_u8 *)qos_mapping_ie + - sizeof(IEEEtypes_Header_t) + - dscp_except_num * sizeof(DSCP_Exception_t)); + (DSCP_Range_t *)((t_u8 *)qos_mapping_ie + + sizeof(IEEEtypes_Header_t) + + dscp_except_num * + sizeof(DSCP_Exception_t)); for (i = 0; i < MAX_NUM_TID; i++) { - PRINTM(MEVENT, - "TID %d: dscp_low=%d, dscp_high=%d\n", i, + PRINTM(MEVENT, "TID %d: dscp_low=%d, dscp_high=%d\n", i, pdscp_range->dscp_low_value, pdscp_range->dscp_high_value); if (pdscp_range->dscp_low_value != 0xff && @@ -7653,12 +9009,12 @@ "dscp excpt: value=%d priority=%d\n", dscp_except[i].dscp_value, dscp_except[i].user_priority); - priv->dscp_map[dscp_except[i] - .dscp_value] = + priv->dscp_map[dscp_except[i].dscp_value] = dscp_except[i].user_priority; } } } + kfree(assoc_rsp); LEAVE(); } @@ -7669,8 +9025,8 @@ * @param disconnect_reason disconnect reason code * @return N/A */ -t_void -woal_send_disconnect_to_system(moal_private *priv, t_u16 disconnect_reason) +t_void woal_send_disconnect_to_system(moal_private *priv, + t_u16 disconnect_reason) { int custom_len = 0; t_u8 event_buf[32]; @@ -7707,11 +9063,14 @@ priv->gtk_data_ready = MFALSE; memset(&zero_gtk, 0x00, sizeof(zero_gtk)); if (priv->phandle->params.gtk_rekey_offload == - GTK_REKEY_OFFLOAD_ENABLE && + GTK_REKEY_OFFLOAD_ENABLE && memcmp(&priv->gtk_rekey_data, &zero_gtk, sizeof(priv->gtk_rekey_data)) != 0) { PRINTM(MCMND, "clear GTK in woal_send_disconnect_to_system\n"); - woal_set_rekey_data(priv, NULL, MLAN_ACT_CLEAR, MOAL_NO_WAIT); + if (MLAN_STATUS_FAILURE == woal_set_rekey_data(priv, NULL, + MLAN_ACT_CLEAR, + MOAL_NO_WAIT)) + PRINTM(MERROR, "%s: clear GTK failed!\n", __func__); } memset(&priv->gtk_rekey_data, 0, sizeof(mlan_ds_misc_gtk_rekey_data)); #endif @@ -7721,10 +9080,13 @@ if (priv->bss_type == MLAN_BSS_TYPE_STA) woal_flush_tdls_list(priv); #endif + woal_flush_mcast_list(priv); #ifdef STA_CFG80211 if (priv->bss_type == MLAN_BSS_TYPE_STA && IS_STA_CFG80211(cfg80211_wext)) { - woal_flush_pmksa_list(priv); + if (woal_flush_pmksa_list(priv)) + PRINTM(MERROR, "%s: woal_flush_pmksa_list failed!\n", + __func__); if (priv->okc_roaming_ie) { kfree(priv->okc_roaming_ie); priv->okc_roaming_ie = NULL; @@ -7740,13 +9102,17 @@ memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->netdev, SIOCGIWAP, &wrqu, NULL); -} + } #endif #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { spin_lock_irqsave(&priv->connect_lock, flags); - if (!priv->cfg_disconnect && !priv->cfg_connect && - priv->wdev && priv->wdev->current_bss) { + if (!priv->cfg_disconnect && !priv->cfg_connect && priv->wdev && +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + priv->wdev->connected) { +#else + priv->wdev->current_bss) { +#endif PRINTM(MMSG, "wlan: Disconnected from " MACSTR ": Reason code %d\n", @@ -7763,8 +9129,8 @@ NULL); else #endif - cfg80211_disconnected(priv->netdev, - reason_code, NULL, 0, + cfg80211_disconnected(priv->netdev, reason_code, + NULL, 0, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) false, #endif @@ -7772,10 +9138,14 @@ } else { spin_unlock_irqrestore(&priv->connect_lock, flags); } - if (!woal_is_any_interface_active(priv->phandle)) - woal_set_scan_time(priv, ACTIVE_SCAN_CHAN_TIME, - PASSIVE_SCAN_CHAN_TIME, - SPECIFIC_SCAN_CHAN_TIME); + if (!woal_is_any_interface_active(priv->phandle)) { + if (MLAN_STATUS_SUCCESS != + woal_set_scan_time(priv, ACTIVE_SCAN_CHAN_TIME, + PASSIVE_SCAN_CHAN_TIME, + SPECIFIC_SCAN_CHAN_TIME)) + PRINTM(MERROR, "%s: set scan time failed \n", + __func__); + } priv->ft_ie_len = 0; priv->ft_pre_connect = MFALSE; priv->ft_md = 0; @@ -7788,24 +9158,25 @@ custom_len = strlen(CUS_EVT_AP_CONNECTED); memcpy(event_buf, CUS_EVT_AP_CONNECTED, MIN((int)(sizeof(event_buf) - 1), custom_len)); - woal_broadcast_event(priv, event_buf, custom_len + ETH_ALEN); + if (MLAN_STATUS_SUCCESS != + woal_broadcast_event(priv, event_buf, custom_len + ETH_ALEN)) + PRINTM(MINFO, "%s: woal_broadcast_event failed!\n", __func__); LEAVE(); } #endif /* STA_SUPPORT */ #define OFFSET_SEQNUM 4 -#define OFFSET_TYPE 8 -#define DUMP_TYPE_ENDE 2 +#define OFFSET_TYPE 8 +#define DUMP_TYPE_ENDE 2 /** -* @brief This function stores the FW dumps received from events -* -* @param phandle A pointer to moal_handle -* @param pmevent A pointer to mlan_event structure -* -* @return N/A -*/ -t_void -woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) + * @brief This function stores the FW dumps received from events + * + * @param phandle A pointer to moal_handle + * @param pmevent A pointer to mlan_event structure + * + * @return N/A + */ +t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) { int ret = 0; t_u16 seqnum; @@ -7819,13 +9190,15 @@ LEAVE(); return; } - seqnum = woal_le16_to_cpu(*(t_u16 *) - (pmevent->event_buf + OFFSET_SEQNUM)); + seqnum = woal_le16_to_cpu( + *(t_u16 *)(pmevent->event_buf + OFFSET_SEQNUM)); type = woal_le16_to_cpu(*(t_u16 *)(pmevent->event_buf + OFFSET_TYPE)); if (seqnum == 1) { +#ifdef DEBUG_LEVEL1 if (drvdbg & MFW_D) - drvdbg &= ~MFW_D; + phandle->fw_dump_status = MTRUE; +#endif if (phandle->fw_dump == MFALSE) { PRINTM(MMSG, "=====FW trigger dump====\n"); phandle->fw_dump = MTRUE; @@ -7836,7 +9209,8 @@ if (!phandle->fw_dump_buf) { ret = moal_vmalloc(phandle, FW_DUMP_INFO_LEN, &phandle->fw_dump_buf); - if (ret != MLAN_STATUS_SUCCESS || !phandle->fw_dump_buf) { + if (ret != MLAN_STATUS_SUCCESS || + !phandle->fw_dump_buf) { PRINTM(MERROR, "Failed to vmalloc fw dump buffer\n"); LEAVE(); @@ -7868,18 +9242,16 @@ (long int)phandle->fw_dump_len); woal_append_end_block(phandle); phandle->fw_dump = MFALSE; - woal_send_fw_dump_complete_event(woal_get_priv - (phandle, MLAN_BSS_ROLE_ANY)); - mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); if (phandle->is_fw_dump_timer_set) { woal_cancel_timer(&phandle->fw_dump_timer); phandle->is_fw_dump_timer_set = MFALSE; } -#ifdef USB - if (IS_USB(phandle->card_type)) - phandle->driver_status = MTRUE; -#endif - woal_process_hang(phandle); + if (phandle->priv_num) { + woal_send_fw_dump_complete_event( + woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); + mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); + woal_process_hang(phandle); + } } LEAVE(); @@ -7902,9 +9274,8 @@ * * @return The length of this log */ -static int -woal_save_hex_dump(int rowsize, const void *buf, size_t len, - bool ascii, t_u8 *save_buf) +static int woal_save_hex_dump(int rowsize, const void *buf, size_t len, + bool ascii, t_u8 *save_buf) { const u8 *ptr = buf; int i, linelen, remaining = len; @@ -7918,8 +9289,8 @@ linelen = min(remaining, rowsize); remaining -= rowsize; - hex_dump_to_buffer(ptr + i, linelen, rowsize, 1, - linebuf, sizeof(linebuf), false); + hex_dump_to_buffer(ptr + i, linelen, rowsize, 1, linebuf, + sizeof(linebuf), false); pos += sprintf(pos, "%s\n", linebuf); } @@ -7935,8 +9306,7 @@ * * @return The length of this log */ -static int -woal_dump_priv_drv_info(moal_handle *handle, t_u8 *buf) +static int woal_dump_priv_drv_info(moal_handle *handle, t_u8 *buf) { char *ptr = (char *)buf; int index; @@ -7969,23 +9339,28 @@ #endif ptr += sprintf(ptr, "Media state = \"%s\"\n", ((priv->media_connected == MFALSE) ? - "Disconnected" : "Connected")); + "Disconnected" : + "Connected")); ptr += sprintf(ptr, "carrier %s\n", ((netif_carrier_ok(priv->netdev)) ? - "on" : "off")); + "on" : + "off")); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - for (i = 0; i < (int)(priv->netdev->num_tx_queues); i++) { - ptr += sprintf(ptr, "tx queue %d: %s\n", i, - ((netif_tx_queue_stopped - (netdev_get_tx_queue - (priv->netdev, - i))) ? "stopped" : - "started")); + for (i = 0; i < (int)(priv->netdev->num_tx_queues); + i++) { + ptr += sprintf( + ptr, "tx queue %d: %s\n", i, + ((netif_tx_queue_stopped( + netdev_get_tx_queue( + priv->netdev, i))) ? + "stopped" : + "started")); } #else ptr += sprintf(ptr, "tx queue %s\n", ((netif_queue_stopped(priv->netdev)) ? - "stopped" : "started")); + "stopped" : + "started")); #endif ptr += sprintf(ptr, "%s: num_tx_timeout = %d\n", priv->netdev->name, @@ -8005,8 +9380,7 @@ * * @return The length of this log */ -static int -woal_dump_moal_drv_info(moal_handle *phandle, t_u8 *buf) +static int woal_dump_moal_drv_info(moal_handle *phandle, t_u8 *buf) { char *ptr; #ifdef USB @@ -8035,6 +9409,8 @@ atomic_read(&cardp->tx_cmd_urb_pending)); ptr += sprintf(ptr, "tx_data_urb_pending = %d\n", atomic_read(&cardp->tx_data_urb_pending)); + ptr += sprintf(ptr, "tx_data2_urb_pending = %d\n", + atomic_read(&cardp->tx_data2_urb_pending)); #ifdef USB_CMD_DATA_EP ptr += sprintf(ptr, "rx_cmd_urb_pending = %d\n", atomic_read(&cardp->rx_cmd_urb_pending)); @@ -8082,8 +9458,7 @@ * * @return The length of this log */ -static int -woal_dump_mlan_drv_info(moal_private *priv, t_u8 *buf) +static int woal_dump_mlan_drv_info(moal_private *priv, t_u8 *buf) { char *ptr = (char *)buf; int i; @@ -8091,7 +9466,7 @@ int j; t_u8 mp_aggr_pkt_limit = 0; #endif - char str[11 * DBG_CMD_NUM + 1] = { 0 }; + char str[11 * DBG_CMD_NUM + 1] = {0}; char *s; mlan_debug_info *info = NULL; @@ -8158,36 +9533,35 @@ info->num_int_read_failure); ptr += sprintf(ptr, "last_int_status = %d\n", info->last_int_status); - ptr += sprintf(ptr, - "mp_rd_bitmap=0x%x curr_rd_port=0x%x\n", + ptr += sprintf(ptr, "mp_rd_bitmap=0x%x curr_rd_port=0x%x\n", (unsigned int)info->mp_rd_bitmap, info->curr_rd_port); - ptr += sprintf(ptr, - "mp_wr_bitmap=0x%x curr_wr_port=0x%x\n", + ptr += sprintf(ptr, "mp_wr_bitmap=0x%x curr_wr_port=0x%x\n", (unsigned int)info->mp_wr_bitmap, info->curr_wr_port); ptr += sprintf(ptr, "mp_data_port_mask=0x%x\n", info->mp_data_port_mask); - ptr += sprintf(ptr, - "last_recv_rd_bitmap=0x%x mp_invalid_update=%d\n", - info->last_recv_rd_bitmap, - info->mp_invalid_update); + ptr += sprintf( + ptr, "last_recv_rd_bitmap=0x%x mp_invalid_update=%d\n", + info->last_recv_rd_bitmap, info->mp_invalid_update); mp_aggr_pkt_limit = info->mp_aggr_pkt_limit; ptr += sprintf(ptr, "last_recv_wr_bitmap=0x%x last_mp_index = %d\n", info->last_recv_wr_bitmap, info->last_mp_index); for (i = 0; i < SDIO_MP_DBG_NUM; i++) { for (s = str, j = 0; j < mp_aggr_pkt_limit; j++) - s += sprintf(s, "0x%02x ", - info->last_mp_wr_info - [i * mp_aggr_pkt_limit + j]); + s += sprintf( + s, "0x%02x ", + info->last_mp_wr_info + [i * mp_aggr_pkt_limit + j]); - ptr += sprintf(ptr, - "mp_wr_bitmap: 0x%x mp_wr_ports=0x%x len=%d curr_wr_port=0x%x\n%s\n", - info->last_mp_wr_bitmap[i], - info->last_mp_wr_ports[i], - info->last_mp_wr_len[i], - info->last_curr_wr_port[i], str); + ptr += sprintf( + ptr, + "mp_wr_bitmap: 0x%x mp_wr_ports=0x%x len=%d curr_wr_port=0x%x\n%s\n", + info->last_mp_wr_bitmap[i], + info->last_mp_wr_ports[i], + info->last_mp_wr_len[i], + info->last_curr_wr_port[i], str); } } #endif @@ -8197,8 +9571,7 @@ info->txbd_rdptr, info->txbd_wrptr); ptr += sprintf(ptr, "rxbd_rdptr=0x%x rxbd_wrptr=0x%x\n", info->rxbd_rdptr, info->rxbd_wrptr); - ptr += sprintf(ptr, - "eventbd_rdptr=0x%x event_wrptr=0x%x\n", + ptr += sprintf(ptr, "eventbd_rdptr=0x%x event_wrptr=0x%x\n", info->eventbd_rdptr, info->eventbd_wrptr); ptr += sprintf(ptr, "last_wr_index:%d\n", info->txbd_wrptr & (info->txrx_bd_size - 1)); @@ -8225,15 +9598,15 @@ ptr += sprintf(ptr, "curr_tx_buf_size = %d\n", info->curr_tx_buf_size); ptr += sprintf(ptr, "bypass_pkt_count=%d\n", info->bypass_pkt_count); - ptr += sprintf(ptr, "data_sent=%d cmd_sent=%d\n", - info->data_sent, info->cmd_sent); + ptr += sprintf(ptr, "data_sent=%d cmd_sent=%d\n", info->data_sent, + info->cmd_sent); ptr += sprintf(ptr, "data_sent_cnt=%u\n", info->data_sent_cnt); ptr += sprintf(ptr, "ps_mode=%d ps_state=%d\n", info->ps_mode, info->ps_state); - ptr += sprintf(ptr, - "wakeup_dev_req=%d wakeup_tries=%d pm_wakeup_timeout=%d\n", - info->pm_wakeup_card_req, info->pm_wakeup_fw_try, - info->pm_wakeup_timeout); + ptr += sprintf( + ptr, "wakeup_dev_req=%d wakeup_tries=%d pm_wakeup_timeout=%d\n", + info->pm_wakeup_card_req, info->pm_wakeup_fw_try, + info->pm_wakeup_timeout); ptr += sprintf(ptr, "hs_configured=%d hs_activated=%d\n", info->is_hs_configured, info->hs_activated); ptr += sprintf(ptr, "pps_uapsd_mode=%d sleep_pd=%d\n", @@ -8241,6 +9614,7 @@ ptr += sprintf(ptr, "tx_lock_flag = %d\n", info->tx_lock_flag); ptr += sprintf(ptr, "port_open = %d\n", info->port_open); ptr += sprintf(ptr, "scan_processing = %d\n", info->scan_processing); + ptr += sprintf(ptr, "scan_state = %d\n", info->scan_state); #ifdef PCIE if (IS_PCIE(priv->phandle->card_type)) { @@ -8251,16 +9625,13 @@ ptr += sprintf(ptr, "eventbd: rdptr=0x%x wrptr=0x%x\n", info->eventbd_rdptr, info->eventbd_wrptr); ptr += sprintf(ptr, "TXBD Ring:\n"); - ptr += woal_save_hex_dump(ROW_SIZE_16, - info->txbd_ring_vbase, + ptr += woal_save_hex_dump(ROW_SIZE_16, info->txbd_ring_vbase, info->txbd_ring_size, MTRUE, ptr); ptr += sprintf(ptr, "RXBD Ring:\n"); - ptr += woal_save_hex_dump(ROW_SIZE_16, - info->rxbd_ring_vbase, + ptr += woal_save_hex_dump(ROW_SIZE_16, info->rxbd_ring_vbase, info->rxbd_ring_size, MTRUE, ptr); ptr += sprintf(ptr, "EVTBD Ring:\n"); - ptr += woal_save_hex_dump(ROW_SIZE_16, - info->evtbd_ring_vbase, + ptr += woal_save_hex_dump(ROW_SIZE_16, info->evtbd_ring_vbase, info->evtbd_ring_size, MTRUE, ptr); } #endif @@ -8278,8 +9649,7 @@ * * @return The length of this log */ -static int -woal_dump_moal_hex(moal_handle *phandle, t_u8 *buf) +static int woal_dump_moal_hex(moal_handle *phandle, t_u8 *buf) { char *ptr = (char *)buf; int i; @@ -8292,11 +9662,11 @@ } ptr += sprintf(ptr, "<--moal_handle-->\n"); - ptr += sprintf(ptr, "moal_handle=%p, size=%ld(0x%lx)\n", - phandle, (long int)sizeof(*phandle), + ptr += sprintf(ptr, "moal_handle=%p, size=%ld(0x%lx)\n", phandle, + (long int)sizeof(*phandle), (long unsigned int)sizeof(*phandle)); - ptr += woal_save_hex_dump(ROW_SIZE_16, phandle, - sizeof(*phandle), MTRUE, ptr); + ptr += woal_save_hex_dump(ROW_SIZE_16, phandle, sizeof(*phandle), MTRUE, + ptr); ptr += sprintf(ptr, "<--moal_handle End-->\n"); for (i = 0; i < phandle->priv_num; i++) { @@ -8309,8 +9679,8 @@ (long int)sizeof(*(phandle->priv[i])), (long unsigned int)sizeof(*(phandle->priv[i]))); ptr += woal_save_hex_dump(ROW_SIZE_16, phandle->priv[i], - sizeof(*(phandle->priv[i])), - MTRUE, ptr); + sizeof(*(phandle->priv[i])), MTRUE, + ptr); ptr += sprintf(ptr, "<--moal_private(%d) End-->\n", i); } LEAVE(); @@ -8325,8 +9695,7 @@ * * @return The length of this log */ -static int -woal_dump_mlan_hex(moal_private *priv, t_u8 *buf) +static int woal_dump_mlan_hex(moal_private *priv, t_u8 *buf) { char *ptr = (char *)buf; int i; @@ -8368,11 +9737,9 @@ for (i = 0; i < info->mlan_priv_num; i++) { ptr += sprintf(ptr, "<--mlan_private(%d)-->\n", i); ptr += sprintf(ptr, "mlan_private=%p, size=%d(0x%x)\n", - info->mlan_priv[i], - info->mlan_priv_size[i], + info->mlan_priv[i], info->mlan_priv_size[i], info->mlan_priv_size[i]); - ptr += woal_save_hex_dump(ROW_SIZE_16, - info->mlan_priv[i], + ptr += woal_save_hex_dump(ROW_SIZE_16, info->mlan_priv[i], info->mlan_priv_size[i], MTRUE, ptr); ptr += sprintf(ptr, "<--mlan_private(%d) End-->\n", i); } @@ -8389,14 +9756,15 @@ * * @return A pointer to drv_info memory */ -t_u8 * -woal_dump_drv_info(moal_handle *phandle, t_u32 *dump_len) +t_u8 *woal_dump_drv_info(moal_handle *phandle, t_u32 *dump_len) { t_u8 *drv_buf = NULL; t_u32 len = 0; t_u32 total_len = 0; t_u32 drv_info_size = DRV_INFO_SIZE; int ret; + if (!phandle->priv_num) + return NULL; if (phandle->priv_num > 3) drv_info_size += (phandle->priv_num - 3) * DRV_INFO_PER_INTF; PRINTM(MERROR, "=== START DRIVER INFO DUMP==="); @@ -8408,14 +9776,12 @@ len = woal_dump_moal_drv_info(phandle, drv_buf); total_len += len; - len = woal_dump_mlan_drv_info(woal_get_priv(phandle, - MLAN_BSS_ROLE_ANY), + len = woal_dump_mlan_drv_info(woal_get_priv(phandle, MLAN_BSS_ROLE_ANY), drv_buf + total_len); total_len += len; len = woal_dump_moal_hex(phandle, drv_buf + total_len); total_len += len; - len = woal_dump_mlan_hex(woal_get_priv(phandle, - MLAN_BSS_ROLE_ANY), + len = woal_dump_mlan_hex(woal_get_priv(phandle, MLAN_BSS_ROLE_ANY), drv_buf + total_len); total_len += len; @@ -8437,11 +9803,10 @@ * * return Total len of buf */ -int -woal_save_dump_info_to_buf(moal_handle *phandle, t_u8 *src, - t_u32 len, t_u32 type) +int woal_save_dump_info_to_buf(moal_handle *phandle, t_u8 *src, t_u32 len, + t_u32 type) { - mem_dump_header header; + mem_dump_header header = {0}; t_u32 left_len = 0; t_u32 len_to_copy = 0; int total_len = 0; @@ -8463,8 +9828,8 @@ FW_DUMP_INFO_LEN - phandle->fw_dump_len); dest += sizeof(mem_dump_header); moal_memcpy_ext(phandle, dest, src, len_to_copy, - FW_DUMP_INFO_LEN - - phandle->fw_dump_len - sizeof(mem_dump_header)); + FW_DUMP_INFO_LEN - phandle->fw_dump_len - + sizeof(mem_dump_header)); dest += len_to_copy; src += len_to_copy; left_len -= len_to_copy; @@ -8475,8 +9840,8 @@ count++; } phandle->fw_dump_len += total_len; - PRINTM(MMSG, "type=%d, len=%d block=%d total=%d\n", type, len, - count, total_len); + PRINTM(MMSG, "type=%d, len=%d block=%d total=%d\n", type, len, count, + total_len); return total_len; } @@ -8487,8 +9852,7 @@ * * return N/A */ -void -woal_append_end_block(moal_handle *phandle) +void woal_append_end_block(moal_handle *phandle) { mem_dump_header header; t_u8 *pos = phandle->fw_dump_buf + phandle->fw_dump_len; @@ -8514,8 +9878,7 @@ * * @return N/A */ -void -woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag) +void woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag) { moal_handle *phandle = NULL; #ifdef USB @@ -8545,6 +9908,8 @@ atomic_read(&cardp->tx_cmd_urb_pending)); PRINTM(MERROR, "tx_data_urb_pending = %d\n", atomic_read(&cardp->tx_data_urb_pending)); + PRINTM(MERROR, "tx_data2_urb_pending = %d\n", + atomic_read(&cardp->tx_data2_urb_pending)); #ifdef USB_CMD_DATA_EP PRINTM(MERROR, "rx_cmd_urb_pending = %d\n", atomic_read(&cardp->rx_cmd_urb_pending)); @@ -8589,21 +9954,22 @@ if (priv && priv->netdev) { PRINTM(MERROR, "Media state = \"%s\"\n", - ((priv->media_connected == MFALSE) ? - "Disconnected" : "Connected")); + ((priv->media_connected == MFALSE) ? "Disconnected" : + "Connected")); PRINTM(MERROR, "carrier %s\n", ((netif_carrier_ok(priv->netdev)) ? "on" : "off")); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) for (i = 0; i < (int)(priv->netdev->num_tx_queues); i++) { PRINTM(MERROR, "tx queue %d: %s\n", i, - ((netif_tx_queue_stopped - (netdev_get_tx_queue(priv->netdev, i))) ? - "stopped" : "started")); + ((netif_tx_queue_stopped( + netdev_get_tx_queue(priv->netdev, i))) ? + "stopped" : + "started")); } #else PRINTM(MERROR, "tx queue %s\n", ((netif_queue_stopped(priv->netdev)) ? "stopped" : - "started")); + "started")); #endif } @@ -8618,24 +9984,30 @@ LEAVE(); return; } + #ifdef PCIE if (IS_PCIE(phandle->card_type)) { +#ifdef DEBUG_LEVEL1 if (phandle->ops.reg_dbg && (drvdbg & (MREG_D | MFW_D))) { if (!phandle->event_fw_dump) phandle->ops.reg_dbg(phandle); } +#endif } #endif #ifdef SDIO if (IS_SD(phandle->card_type)) { - if (flag && - ((phandle->main_state == MOAL_END_MAIN_PROCESS) || - (phandle->main_state == MOAL_STATE_IDLE))) { - if (phandle->ops.reg_dbg && (drvdbg & (MREG_D | MFW_D))) { + if (flag && ((phandle->main_state == MOAL_END_MAIN_PROCESS) || + (phandle->main_state == MOAL_STATE_IDLE))) { +#ifdef DEBUG_LEVEL1 + if (phandle->ops.reg_dbg && + (drvdbg & (MREG_D | MFW_D))) { if (!phandle->event_fw_dump) phandle->ops.reg_dbg(phandle); } +#endif } else { +#ifdef DEBUG_LEVEL1 if (drvdbg & (MREG_D | MFW_D)) { if (!phandle->event_fw_dump) { phandle->reg_dbg = MTRUE; @@ -8643,12 +10015,13 @@ &phandle->main_work); } } +#endif } } #endif #ifdef DEBUG_LEVEL1 - if (drvdbg & MFW_D) { - drvdbg &= ~MFW_D; + if ((drvdbg & MFW_D) && !phandle->fw_dump_status) { + phandle->fw_dump_status = MTRUE; phandle->fw_dbg = MTRUE; queue_work(phandle->workqueue, &phandle->main_work); } @@ -8665,8 +10038,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_request_country_power_table(moal_private *priv, char *country) +mlan_status woal_request_country_power_table(moal_private *priv, char *country) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_handle *handle = NULL; @@ -8711,17 +10083,17 @@ #endif /* Replace XX with ISO 3166-1 alpha-2 country code */ - memcpy(strstr(country_name, "XX"), country, COUNTRY_CODE_LEN - 1); + memcpy(strstr(country_name, "XX"), country, strlen(country)); fw_name = handle->params.fw_name; memset(file_path, 0, sizeof(file_path)); /* file_path should be Null terminated */ if (fw_name) { - strncpy(file_path, fw_name, sizeof(file_path) - 1); + moal_memcpy(handle, file_path, fw_name, sizeof(file_path) - 1); last_slash = strrchr(file_path, '/'); if (last_slash) memset(last_slash + 1, 0, sizeof(file_path) - 1 - - (last_slash - file_path)); + (last_slash - file_path)); else memset(file_path, 0, sizeof(file_path)); } else { @@ -8732,7 +10104,7 @@ if ((strlen(file_path) + strlen(country_name)) < (sizeof(file_path) - 1)) strncpy(file_path + strlen(file_path), country_name, - sizeof(file_path) - strlen(file_path)); + sizeof(file_path) - strlen(file_path) - 1); else { PRINTM(MERROR, "file path buffer too small, fail to dnld power table\n"); @@ -8746,8 +10118,8 @@ #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) /* Try download WW rgpowertable */ - if ((handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE) - && (ret == MLAN_STATUS_FILE_ERR)) { + if ((handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE) && + (ret == MLAN_STATUS_FILE_ERR)) { memset(country_name, 0, sizeof(country_name)); if (handle->params.hw_name) sprintf(country_name, "%s_rgpower_WW.bin", @@ -8759,16 +10131,22 @@ if (last_slash) memset(last_slash + 1, 0, sizeof(file_path) - 1 - - (last_slash - file_path)); + (last_slash - file_path)); else memset(file_path, 0, sizeof(file_path)); - strncpy(file_path + strlen(file_path), country_name, - strlen(country_name)); - PRINTM(MMSG, - "Trying again download country_power_tble: %s\n", + if ((strlen(file_path) + strlen(country_name)) < + (sizeof(file_path) - 1)) + strncpy(file_path + strlen(file_path), country_name, + sizeof(file_path) - strlen(file_path) - 1); + else { + PRINTM(MERROR, + "file path buffer too small, fail to dnld power table\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + PRINTM(MMSG, "Trying again download country_power_tble: %s\n", file_path); - ret = woal_set_user_init_data(handle, - COUNTRY_POWER_TABLE, + ret = woal_set_user_init_data(handle, COUNTRY_POWER_TABLE, MOAL_IOCTL_WAIT, file_path); if (!ret) { handle->country_code[0] = '0'; @@ -8789,21 +10167,35 @@ * * @return packets received */ -static int -woal_netdev_poll_rx(struct napi_struct *napi, int budget) +static int woal_netdev_poll_rx(struct napi_struct *napi, int budget) { moal_handle *handle = container_of(napi, moal_handle, napi_rx); t_u8 recv = budget; ENTER(); if (handle->surprise_removed == MTRUE) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + if (false == napi_complete(napi)) + PRINTM(MINFO, "%s: napi_complete with false \n", + __func__); +#else napi_complete(napi); +#endif LEAVE(); return 0; } - mlan_rx_process(handle->pmlan_adapter, &recv); - if (recv < budget) + if (MLAN_STATUS_SUCCESS != + mlan_rx_process(handle->pmlan_adapter, &recv)) + PRINTM(MERROR, "%s: mlan_rx_process failed \n", __func__); + if (recv < budget) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + if (false == napi_complete(napi)) + PRINTM(MINFO, "%s: napi_complete with false \n", + __func__); +#else napi_complete(napi); +#endif + } LEAVE(); return recv; } @@ -8815,15 +10207,15 @@ * * @return N/A */ -t_void -woal_mclist_work_queue(struct work_struct *work) +t_void woal_mclist_work_queue(struct work_struct *work) { moal_private *priv = container_of(work, moal_private, mclist_work); woal_request_set_multicast_list(priv, priv->netdev); } + #ifdef STA_CFG80211 /** - * @brief This workqueue function handles woal scan timeout work + * @brief This workqueue function handles woal scan timeout work * * @param work A pointer to work_struct * @@ -8831,45 +10223,43 @@ */ t_void woal_scan_timeout_handler(struct work_struct *work) { - struct delayed_work *delayed_work = to_delayed_work(work); - moal_handle *handle = container_of(delayed_work, moal_handle, scan_timeout_work); - unsigned long flags; + struct delayed_work *delayed_work = to_delayed_work(work); + moal_handle *handle = + container_of(delayed_work, moal_handle, scan_timeout_work); + unsigned long flags; moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_STA); - t_u8 auto_fw_dump = MFALSE; + t_u8 auto_fw_dump = MFALSE; - ENTER(); - + ENTER(); + if (IS_STA_CFG80211(handle->params.cfg80211_wext)) { if (handle->scan_request && handle->fake_scan_complete) { PRINTM(MMSG, "wlan: Send fake scan result\n"); - if(priv) - woal_inform_bss_from_scan_result(priv, NULL, MOAL_NO_WAIT); + if (priv) + woal_inform_bss_from_scan_result(priv, NULL, + MOAL_NO_WAIT); spin_lock_irqsave(&handle->scan_req_lock, flags); woal_cfg80211_scan_done(handle->scan_request, MFALSE); handle->scan_request = NULL; - spin_unlock_irqrestore(&priv->phandle->scan_req_lock, flags); - } - else if(handle->scan_request){ - PRINTM(MMSG,"wlan: scan timeout!\n"); - if(drvdbg & MFW_D) + spin_unlock_irqrestore(&handle->scan_req_lock, flags); + } else if (handle->scan_request) { + PRINTM(MMSG, "wlan: scan timeout!\n"); +#ifdef DEBUG_LEVEL1 + if (drvdbg & MFW_D) auto_fw_dump = MTRUE; - if(priv){ +#endif + if (priv) { woal_mlan_debug_info(priv); woal_moal_debug_info(priv, NULL, MFALSE); -#ifdef DEBUG_LOG -#ifdef DEBUG_LEVEL1 - woal_set_get_log_config(priv, "lock", NULL, MOAL_SMEM_WRITE); -#endif -#endif } handle->driver_status = MTRUE; - if(!auto_fw_dump && !handle->fw_dump) + if (!auto_fw_dump && !handle->fw_dump && priv) woal_process_hang(priv->phandle); - wifi_status = 3; - } - } + wifi_status = WIFI_STATUS_SCAN_TIMEOUT; + } + } - LEAVE(); + LEAVE(); } #endif @@ -8880,8 +10270,7 @@ * * @return N/A */ -t_void -woal_evt_work_queue(struct work_struct *work) +t_void woal_evt_work_queue(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, evt_work); struct woal_event *evt; @@ -8898,8 +10287,8 @@ } spin_lock_irqsave(&handle->evt_lock, flags); while (!list_empty(&handle->evt_queue)) { - evt = list_first_entry(&handle->evt_queue, - struct woal_event, link); + evt = list_first_entry(&handle->evt_queue, struct woal_event, + link); list_del(&evt->link); spin_unlock_irqrestore(&handle->evt_lock, flags); switch (evt->type) { @@ -8918,8 +10307,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) priv = evt->priv; mutex_lock(&priv->wdev->mtx); - cfg80211_rx_mlme_mgmt(priv->netdev, - evt->evt.event_buf, + cfg80211_rx_mlme_mgmt(priv->netdev, evt->evt.event_buf, evt->evt.event_len); mutex_unlock(&priv->wdev->mtx); #endif @@ -8928,8 +10316,8 @@ case WOAL_EVENT_BGSCAN_STOP: #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - woal_cfg80211_notify_sched_scan_stop((moal_private *) - evt->priv); + woal_cfg80211_notify_sched_scan_stop( + (moal_private *)evt->priv); #endif #endif break; @@ -8942,20 +10330,35 @@ break; case WOAL_EVENT_ASSOC_RESP: - woal_host_mlme_process_assoc_resp((moal_private *)evt-> - priv, - &evt->assoc_resp); + woal_host_mlme_process_assoc_resp( + (moal_private *)evt->priv, &evt->assoc_info); break; #endif #endif +#ifdef UAP_SUPPORT + case WOAL_EVENT_CHAN_RPT: + woal_process_chan_event((moal_private *)evt->priv, + WOAL_EVENT_CHAN_RPT, + evt->radar_info.channel, + evt->radar_info.radar); + break; + case WOAL_EVENT_RADAR: + woal_process_chan_event((moal_private *)evt->priv, + WOAL_EVENT_RADAR, + evt->radar_info.channel, + evt->radar_info.radar); + break; +#endif #ifdef UAP_CFG80211 #if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE case WOAL_EVENT_CANCEL_CHANRPT: - woal_process_cancel_chanrpt_event((moal_private *)evt-> - priv); + woal_process_cancel_chanrpt_event( + (moal_private *)evt->priv); break; #endif #endif + default: + break; } kfree(evt); spin_lock_irqsave(&handle->evt_lock, flags); @@ -8963,7 +10366,6 @@ spin_unlock_irqrestore(&handle->evt_lock, flags); LEAVE(); } - /** * @brief This workqueue function handles rx_process * @@ -8971,17 +10373,9 @@ * * @return N/A */ -t_void -woal_rx_work_queue(struct work_struct *work) +t_void woal_rx_work_queue(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, rx_work); -#ifdef STA_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) -#if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 14, 6) - moal_private *priv; -#endif -#endif -#endif wifi_timeval start_timeval; wifi_timeval end_timeval; @@ -8990,20 +10384,28 @@ LEAVE(); return; } - +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) + if (handle->cfg80211_suspend == MTRUE) { + LEAVE(); + return; + } +#endif +#endif woal_get_monotonic_time(&start_timeval); - mlan_rx_process(handle->pmlan_adapter, NULL); + if (MLAN_STATUS_SUCCESS != mlan_rx_process(handle->pmlan_adapter, NULL)) + PRINTM(MERROR, "%s: mlan_rx_process failed \n", __func__); woal_get_monotonic_time(&end_timeval); handle->rx_time += (t_u64)(timeval_to_usec(end_timeval) - timeval_to_usec(start_timeval)); PRINTM(MINFO, "%s : start_timeval=%d:%d end_timeval=%d:%d inter=%llu rx_time=%llu\n", - __func__, start_timeval.time_sec, - start_timeval.time_usec, end_timeval.time_sec, - end_timeval.time_usec, + __func__, start_timeval.time_sec, start_timeval.time_usec, + end_timeval.time_sec, end_timeval.time_usec, (t_u64)(timeval_to_usec(end_timeval) - - timeval_to_usec(start_timeval)), handle->rx_time); + timeval_to_usec(start_timeval)), + handle->rx_time); LEAVE(); } @@ -9015,8 +10417,7 @@ * @return skb buffer */ -struct sk_buff * -woal_skb_dequeue_spinlock(struct sk_buff_head *list) +struct sk_buff *woal_skb_dequeue_spinlock(struct sk_buff_head *list) { struct sk_buff *result; @@ -9033,8 +10434,7 @@ * * @return N/A */ -t_void -woal_tx_work_handler(struct work_struct *work) +t_void woal_tx_work_handler(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, tx_work); moal_private *priv = NULL; @@ -9064,15 +10464,14 @@ * * @return N/A */ -t_void -woal_main_work_queue(struct work_struct *work) +t_void woal_main_work_queue(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, main_work); #ifdef USB struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) - struct sched_param sp = {.sched_priority = wq_sched_prio }; + struct sched_param sp = {.sched_priority = wq_sched_prio}; #endif ENTER(); @@ -9088,7 +10487,8 @@ } if (handle->fw_dbg == MTRUE) { handle->fw_dbg = MFALSE; - handle->ops.dump_fw_info(handle); + if (handle->ops.dump_fw_info) + handle->ops.dump_fw_info(handle); LEAVE(); return; } @@ -9101,16 +10501,15 @@ "Set work queue priority %d and scheduling policy %d\n", handle->params.wq_sched_prio, handle->params.wq_sched_policy); - sched_setscheduler(current, - handle->params.wq_sched_policy, &sp); + sched_setscheduler(current, handle->params.wq_sched_policy, + &sp); } #endif handle->main_state = MOAL_ENTER_WORK_QUEUE; #ifdef USB /* WAR for no free skb issue */ - if (IS_USB(handle->card_type) && - !atomic_read(&handle->rx_pending) && + if (IS_USB(handle->card_type) && !atomic_read(&handle->rx_pending) && atomic_read(&cardp->rx_data_urb_pending) < MVUSB_RX_DATA_URB) { PRINTM(MWARN, "Try to resubmit Rx data URBs\n"); woal_usb_submit_rx_data_urbs(handle); @@ -9133,8 +10532,7 @@ * * @return N/A */ -void -woal_regist_oob_wakeup_irq(moal_handle *handle) +void woal_regist_oob_wakeup_irq(moal_handle *handle) { int ret; struct device *dev = handle->hotplug_device; @@ -9152,10 +10550,10 @@ goto err_exit; } - ret = devm_request_irq(dev, handle->irq_oob_wakeup, - woal_oob_wakeup_irq_handler, - IRQF_TRIGGER_LOW | IRQF_SHARED, - "wifi_oob_wakeup", handle); + ret = devm_request_threaded_irq(dev, handle->irq_oob_wakeup, NULL, + woal_oob_wakeup_irq_handler, + IRQF_SHARED | IRQF_ONESHOT, + "wifi_oob_wakeup", handle); if (ret) { dev_err(dev, "Failed to request irq_oob_wakeup %d (%d)\n", handle->irq_oob_wakeup, ret); @@ -9178,8 +10576,7 @@ * * @return N/A */ -void -woal_unregist_oob_wakeup_irq(moal_handle *handle) +void woal_unregist_oob_wakeup_irq(moal_handle *handle) { struct device *dev = handle->hotplug_device; @@ -9197,8 +10594,7 @@ * * @return N/A */ -void -woal_disable_oob_wakeup_irq(moal_handle *handle) +void woal_disable_oob_wakeup_irq(moal_handle *handle) { ENTER(); @@ -9209,7 +10605,6 @@ disable_irq_wake(handle->irq_oob_wakeup); disable_irq(handle->irq_oob_wakeup); } - } LEAVE(); @@ -9222,8 +10617,7 @@ * * @return N/A */ -void -woal_enable_oob_wakeup_irq(moal_handle *handle) +void woal_enable_oob_wakeup_irq(moal_handle *handle) { ENTER(); @@ -9245,8 +10639,7 @@ * * @return Returns status of interrupt handler. */ -irqreturn_t -woal_oob_wakeup_irq_handler(int irq, void *priv) +irqreturn_t woal_oob_wakeup_irq_handler(int irq, void *priv) { moal_handle *handle = priv; struct device *dev = handle->hotplug_device; @@ -9277,9 +10670,8 @@ * * @return A pointer to moal_handle structure */ -moal_handle * -woal_add_card(void *card, struct device *dev, - moal_if_ops * if_ops, t_u16 card_type) +moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, + t_u16 card_type) { moal_handle *handle = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -9320,8 +10712,7 @@ handle->hotplug_device = dev; handle->card_type = card_type; /* Attach moal handle ops */ - PRINTM(MMSG, - "Attach moal handle ops, card interface type: 0x%x\n", + PRINTM(MMSG, "Attach moal handle ops, card interface type: 0x%x\n", handle->card_type); moal_memcpy_ext(handle, &handle->ops, if_ops, sizeof(*if_ops), sizeof(handle->ops)); @@ -9334,7 +10725,15 @@ } /* Init module parameters */ - woal_init_module_param(handle); + if (woal_init_module_param(handle)) { + PRINTM(MERROR, "Fail to load module parameter file\n"); + goto err_kmalloc; + } + if (!handle->params.drv_mode) { + PRINTM(MMSG, "wlan: stop init_adapter, drv_mode=%d\n", + handle->params.drv_mode); + goto err_kmalloc; + } #ifdef IMX_SUPPORT #ifdef SDIO if (IS_SD(handle->card_type)) { @@ -9344,17 +10743,20 @@ #endif #endif +#ifdef DEBUG_LEVEL1 + drvdbg = handle->params.drvdbg; +#endif + if (handle->params.mac_addr #ifdef MFG_CMD_SUPPORT && handle->params.mfg_mode != MLAN_INIT_PARA_ENABLED #endif - ) { + ) { t_u8 temp[20]; t_u8 len = strlen(handle->params.mac_addr) + 1; if (len < sizeof(temp)) { - moal_memcpy_ext(handle, temp, - handle->params.mac_addr, len, - sizeof(temp)); + moal_memcpy_ext(handle, temp, handle->params.mac_addr, + len, sizeof(temp)); handle->set_mac_addr = 1; /* note: the following function overwrites the * temp buffer */ @@ -9363,7 +10765,10 @@ } /* Get card info */ - woal_get_card_info(handle); + if (woal_get_card_info(handle)) { + PRINTM(MERROR, "Fail to get card info\n"); + goto err_kmalloc; + } /** Get card revision */ handle->ops.get_fw_name(handle); #ifdef STA_SUPPORT @@ -9386,9 +10791,8 @@ handle->nl_sk = netlink_kernel_create(netlink_num, NULL); #else #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) - handle->nl_sk = - netlink_kernel_create(netlink_num, NL_MULTICAST_GROUP, - NULL, THIS_MODULE); + handle->nl_sk = netlink_kernel_create( + netlink_num, NL_MULTICAST_GROUP, NULL, THIS_MODULE); #else #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) handle->nl_sk = @@ -9432,9 +10836,8 @@ handle->workqueue = create_workqueue("MOAL_WORKQ"); #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - handle->workqueue = - alloc_workqueue("MOAL_WORK_QUEUE", - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); + handle->workqueue = alloc_workqueue( + "MOAL_WORK_QUEUE", WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); #else handle->workqueue = create_workqueue("MOAL_WORK_QUEUE"); #endif @@ -9475,7 +10878,7 @@ #ifdef STA_CFG80211 INIT_DELAYED_WORK(&handle->scan_timeout_work, - woal_scan_timeout_handler); + woal_scan_timeout_handler); #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) @@ -9492,10 +10895,9 @@ handle->rx_workqueue = create_workqueue("MOAL_RX_WORKQ"); #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - handle->rx_workqueue = - alloc_workqueue("MOAL_RX_WORK_QUEUE", - WQ_HIGHPRI | WQ_MEM_RECLAIM | - WQ_UNBOUND, 1); + handle->rx_workqueue = alloc_workqueue( + "MOAL_RX_WORK_QUEUE", + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); #else handle->rx_workqueue = create_workqueue("MOAL_RX_WORK_QUEUE"); #endif @@ -9509,8 +10911,13 @@ #define NAPI_BUDGET 64 if (moal_extflg_isset(handle, EXT_NAPI)) { init_dummy_netdev(&handle->napi_dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) + netif_napi_add(&handle->napi_dev, &handle->napi_rx, + woal_netdev_poll_rx); +#else netif_napi_add(&handle->napi_dev, &handle->napi_rx, woal_netdev_poll_rx, NAPI_BUDGET); +#endif napi_enable(&handle->napi_rx); } @@ -9520,10 +10927,9 @@ handle->tx_workqueue = create_workqueue("MOAL_TX_WORKQ"); #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - handle->tx_workqueue = alloc_workqueue("MOAL_TX_WORK_QUEUE", - WQ_HIGHPRI | - WQ_MEM_RECLAIM | - WQ_UNBOUND, 1); + handle->tx_workqueue = alloc_workqueue( + "MOAL_TX_WORK_QUEUE", + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); #else handle->tx_workqueue = create_workqueue("MOAL_TX_WORK_QUEUE"); #endif @@ -9538,8 +10944,8 @@ #ifdef REASSOCIATION PRINTM(MINFO, "Starting re-association thread...\n"); handle->reassoc_thread.handle = handle; - woal_create_thread(woal_reassociation_thread, - &handle->reassoc_thread, "woal_reassoc_service"); + woal_create_thread(woal_reassociation_thread, &handle->reassoc_thread, + "woal_reassoc_service"); while (!handle->reassoc_thread.pid) woal_sched_timeout(2); @@ -9635,8 +11041,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -woal_remove_card(void *card) +mlan_status woal_remove_card(void *card) { moal_handle *handle = NULL; moal_private *priv = NULL; @@ -9663,7 +11068,7 @@ #if defined(USB) && handle->boot_state == USB_FW_READY #endif - ) { + ) { if (handle->params.fw_name) { kfree(handle->params.fw_name); handle->params.fw_name = NULL; @@ -9719,9 +11124,11 @@ atomic_read(&handle->ioctl_pending)); } unregister_inetaddr_notifier(&handle->woal_notifier); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) unregister_inet6addr_notifier(&handle->woal_inet6_notifier); #endif +#endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) @@ -9757,6 +11164,16 @@ for (i = 0; i < MIN(MLAN_MAX_BSS_NUM, handle->priv_num); i++) woal_remove_interface(handle, i); +#if defined(STA_CFG80211) && defined(UAP_CFG80211) + /* Unregister and detach connected radiotap net device */ + if (handle->mon_if) { + netif_device_detach(handle->mon_if->mon_ndev); + if (handle->mon_if->mon_ndev->reg_state == NETREG_REGISTERED) + unregister_netdev(handle->mon_if->mon_ndev); + handle->mon_if = NULL; + } +#endif + woal_terminate_workqueue(handle); #ifdef UAP_CFG80211 @@ -9786,6 +11203,7 @@ woal_cancel_timer(&handle->fw_dump_timer); handle->is_fw_dump_timer_set = MFALSE; } + #ifdef CONFIG_PROC_FS woal_proc_exit(handle); #endif @@ -9826,8 +11244,7 @@ * @return MLAN_STATUS_SUCCESS /MLAN_STATUS_FAILURE * /MLAN_STATUS_PENDING */ -mlan_status -woal_switch_drv_mode(moal_handle *handle, t_u32 mode) +mlan_status woal_switch_drv_mode(moal_handle *handle, t_u32 mode) { unsigned int i; mlan_status status = MLAN_STATUS_SUCCESS; @@ -9846,7 +11263,11 @@ /* Reset all interfaces */ priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); - woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE); + if (MLAN_STATUS_SUCCESS != + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE)) { + PRINTM(MERROR, "woal_reset_inf failed!\n"); + goto exit; + } status = woal_shutdown_fw(priv, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_SUCCESS) { @@ -9881,9 +11302,11 @@ } unregister_inetaddr_notifier(&handle->woal_notifier); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) unregister_inet6addr_notifier(&handle->woal_inet6_notifier); #endif +#endif /* Remove interface */ for (i = 0; i < MIN(MLAN_MAX_BSS_NUM, handle->priv_num); i++) @@ -9901,8 +11324,7 @@ #ifdef PCIE if (IS_PCIE(handle->card_type) && atomic_read(&handle->malloc_cons_count)) { - PRINTM(MERROR, - "mlan has memory leak: malloc_cons_count=%d\n", + PRINTM(MERROR, "mlan has memory leak: malloc_cons_count=%d\n", atomic_read(&handle->malloc_cons_count)); } #endif @@ -9940,8 +11362,7 @@ * * @return 0--success, otherwise failure */ -static int -woal_reset_and_reload_fw(moal_handle *handle, t_u8 mode) +static int woal_reset_and_reload_fw(moal_handle *handle, t_u8 mode) { int ret = 0, tries = 0; t_u32 value = 1; @@ -9954,21 +11375,18 @@ woal_sdio_reset_hw(handle); goto reload_fw; } - if (!IS_SD9098(handle->card_type) && - !IS_SD9097(handle->card_type) && !IS_SD9177(handle->card_type)) { - mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); - /** wait SOC fully wake up */ - for (tries = 0; tries < FW_POLL_TRIES; ++tries) { - ret = handle->ops.write_reg(handle, reset_reg, 0xba); - if (ret == MLAN_STATUS_SUCCESS) { - handle->ops.read_reg(handle, reset_reg, &value); - if (value == 0xba) { - PRINTM(MMSG, "FW wake up\n"); - break; - } + mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); + /** wait SOC fully wake up */ + for (tries = 0; tries < FW_POLL_TRIES; ++tries) { + ret = handle->ops.write_reg(handle, reset_reg, 0xba); + if (ret == MLAN_STATUS_SUCCESS) { + handle->ops.read_reg(handle, reset_reg, &value); + if (value == 0xba) { + PRINTM(MMSG, "FW wake up\n"); + break; } - udelay(1000); } + udelay(1000); } /* Write register to notify FW */ if (handle->ops.write_reg(handle, reset_reg, reset_val) != @@ -9977,9 +11395,9 @@ ret = -EFAULT; goto done; } -#if defined(SD9098) || defined(SD9097) || defined(SD9177) - if (IS_SD9098(handle->card_type) || - IS_SD9097(handle->card_type) || IS_SD9177(handle->card_type)) +#if defined(SD9098) || defined(SD9097) || defined(SDNW62X) || defined(SD9177) + if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || + IS_SDNW62X(handle->card_type) || IS_SD9177(handle->card_type)) handle->ops.write_reg(handle, 0x00, 0x10); #endif /* Poll register around 100 ms */ @@ -9992,15 +11410,12 @@ } if (value) { - PRINTM(MERROR, - "Failed to poll FW reset register %X=0x%x\n", + PRINTM(MERROR, "Failed to poll FW reset register %X=0x%x\n", reset_reg, value); ret = -EFAULT; goto done; } - if (!IS_SD9098(handle->card_type) && - !IS_SD9097(handle->card_type) && !IS_SD9177(handle->card_type)) - mlan_pm_wakeup_card(handle->pmlan_adapter, MFALSE); + mlan_pm_wakeup_card(handle->pmlan_adapter, MFALSE); reload_fw: /* Download FW */ ret = woal_request_fw(handle); @@ -10022,8 +11437,7 @@ * * @return 0--success, otherwise failure */ -static int -woal_reload_fw(moal_handle *handle) +static int woal_reload_fw(moal_handle *handle) { int ret = 0; ENTER(); @@ -10046,10 +11460,8 @@ * * @return NULL; */ -static void -woal_pre_reset(moal_handle *handle) +static void woal_pre_reset(moal_handle *handle) { - int intf_num; t_u8 driver_status = handle->driver_status; t_u8 i; moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_STA); @@ -10064,10 +11476,12 @@ if (!driver_status) woal_sched_timeout_uninterruptible(MOAL_TIMER_1S); - //wait for IOCTL return + // wait for IOCTL return if (!driver_status && priv) { for (i = 0; i < 5; i++) { - woal_get_debug_info(priv, MOAL_IOCTL_WAIT, info); + if (woal_get_debug_info(priv, MOAL_IOCTL_WAIT, info)) + PRINTM(MERROR, + "Could not retrieve debug information from MLAN\n"); ioctl_pending = atomic_read(&handle->ioctl_pending); if (!info->pending_cmd && !ioctl_pending) { PRINTM(MCMND, @@ -10077,14 +11491,16 @@ woal_sched_timeout_uninterruptible(MOAL_TIMER_1S); } } - /** detach network interface */ - for (intf_num = 0; intf_num < handle->priv_num; intf_num++) { - if (handle->priv[intf_num]) { - woal_stop_queue(handle->priv[intf_num]->netdev); - netif_device_detach(handle->priv[intf_num]->netdev); - } - } - /** mask host interrupt from firmware */ +#ifdef WIFI_DIRECT_SUPPORT +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + /* Remove virtual interface */ + woal_remove_virtual_interface(handle); +#endif +#endif +#endif + woal_clean_up(handle); + /** mask host interrupt from firmware */ mlan_disable_host_int(handle->pmlan_adapter); /** cancel all pending commands */ mlan_ioctl(handle->pmlan_adapter, NULL); @@ -10106,14 +11522,15 @@ * * @return NULL; */ -static void -woal_post_reset(moal_handle *handle) +static void woal_post_reset(moal_handle *handle) { mlan_ioctl_req *req = NULL; mlan_ds_misc_cfg *misc = NULL; int intf_num; -#if defined(STA_CFG80211) || defined(UAP_CFG80211) + char str_buf[MLAN_MAX_VER_STR_LEN]; + mlan_fw_info fw_info; moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); +#if defined(STA_CFG80211) || defined(UAP_CFG80211) t_u8 country_code[COUNTRY_CODE_LEN]; #endif #ifdef WIFI_DIRECT_SUPPORT @@ -10136,9 +11553,9 @@ req->req_id = MLAN_IOCTL_MISC_CFG; req->action = MLAN_ACT_SET; if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(woal_get_priv(handle, - MLAN_BSS_ROLE_ANY), + woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req, MOAL_IOCTL_WAIT_TIMEOUT)) { + PRINTM(MERROR, "%s: warm reset failed \n", __func__); kfree(req); goto done; } @@ -10147,11 +11564,57 @@ #ifdef DEBUG_LEVEL1 drvdbg = handle->params.drvdbg; #endif + handle->fw_dump_status = MFALSE; handle->driver_status = MFALSE; handle->hardware_status = HardwareStatusReady; + handle->remain_on_channel = MFALSE; #ifdef STA_CFG80211 handle->scan_timeout = SCAN_TIMEOUT_25S; #endif + if (MLAN_STATUS_SUCCESS != + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info)) { + PRINTM(MERROR, "%s: get_fw_info failed \n", __func__); + } + woal_get_version(handle, str_buf, sizeof(str_buf) - 1); + PRINTM(MMSG, "wlan: version = %s\n", str_buf); + if (!handle->wifi_hal_flag) { + PRINTM(MMSG, "wlan: post_reset remove/add interface\n"); + handle->surprise_removed = MTRUE; + for (intf_num = 0; + intf_num < MIN(MLAN_MAX_BSS_NUM, handle->priv_num); + intf_num++) + woal_remove_interface(handle, intf_num); + handle->priv_num = 0; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + /* Unregister wiphy device and free */ + if (handle->wiphy) { + wiphy_unregister(handle->wiphy); + woal_cfg80211_free_bands(handle->wiphy); + wiphy_free(handle->wiphy); + handle->wiphy = NULL; + } +#endif + handle->surprise_removed = MFALSE; + + for (intf_num = 0; intf_num < handle->drv_mode.intf_num; + intf_num++) { + if (handle->drv_mode.bss_attr[intf_num].bss_virtual) + continue; + if (!woal_add_interface(handle, handle->priv_num, + handle->drv_mode + .bss_attr[intf_num] + .bss_type)) { + PRINTM(MERROR, "%s: add interface %d failed \n", + __func__, handle->priv_num); + goto done; + } + } + PRINTM(MMSG, "wlan: post_reset remove/add interface done\n"); + goto done; + } + + PRINTM(MMSG, "wlan: start interfaces reset\n"); + /* Reset all interfaces */ woal_reset_intf(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MOAL_IOCTL_WAIT, MTRUE); @@ -10234,8 +11697,7 @@ * * @return 0--success, otherwise failure */ -void -woal_request_fw_reload(moal_handle *phandle, t_u8 mode) +int woal_request_fw_reload(moal_handle *phandle, t_u8 mode) { int ret = 0; @@ -10247,13 +11709,18 @@ moal_handle *ref_handle = NULL; ENTER(); + wifi_status = WIFI_STATUS_FW_RELOAD; #ifdef PCIE if (mode == FW_RELOAD_PCIE_RESET) { card = (pcie_service_card *)handle->card; pdev = card->dev; - pci_reset_function(pdev); + if (pci_reset_function(pdev)) { + PRINTM(MERROR, "%s: pci_reset_function failed \n", + __func__); + ret = -1; + } LEAVE(); - return; + return ret; } #endif @@ -10271,23 +11738,41 @@ fw_reload = FW_RELOAD_WITH_EMULATION; PRINTM(MMSG, "FW reload with re-emulation...\n"); LEAVE(); - return; + return ret; } woal_pre_reset(handle); if (ref_handle) woal_pre_reset(ref_handle); if (mode == FW_RELOAD_NO_EMULATION) { ret = woal_reload_fw(handle); - if (ref_handle) - woal_reload_fw(ref_handle); + if (ret) { + PRINTM(MERROR, "woal_reload_fw fail\n"); + goto done; + } + if (ref_handle) { + ret = woal_reload_fw(ref_handle); + if (ret) { + PRINTM(MERROR, "woal_reload_fw fail\n"); + goto done; + } + } } #ifdef SDIO_MMC else if ((mode == FW_RELOAD_SDIO_INBAND_RESET || mode == FW_RELOAD_SDIO_HW_RESET) && IS_SD(handle->card_type)) { ret = woal_reset_and_reload_fw(handle, mode); - if (ref_handle) - woal_reload_fw(ref_handle); + if (ret) { + PRINTM(MERROR, "woal_reset_and_reload_fw fail\n"); + goto done; + } + if (ref_handle) { + ret = woal_reload_fw(ref_handle); + if (ret) { + PRINTM(MERROR, "woal_reload_fw fail\n"); + goto done; + } + } } #endif else @@ -10299,9 +11784,10 @@ woal_post_reset(handle); if (ref_handle) woal_post_reset(ref_handle); + wifi_status = WIFI_STATUS_OK; done: LEAVE(); - return; + return ret; } /** @@ -10311,8 +11797,7 @@ * * @return N/A */ -static void -woal_bus_register(struct work_struct *work) +static void woal_bus_register(struct work_struct *work) { mlan_status ret = MLAN_STATUS_SUCCESS; PRINTM(MMSG, "wlan: Register to Bus Driver...\n"); @@ -10359,8 +11844,7 @@ * * @return N/A */ -static void -woal_bus_unregister(void) +static void woal_bus_unregister(void) { #ifdef SDIO #ifdef SDIO_MMC @@ -10385,8 +11869,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static int -woal_init_module(void) +static int woal_init_module(void) { int ret = (int)MLAN_STATUS_SUCCESS; int index = 0; @@ -10410,6 +11893,7 @@ #ifdef CONFIG_OF woal_init_from_dev_tree(); #endif + /* Create workqueue for hang process */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) /* For kernel less than 2.6.14 name can not be greater than 10 @@ -10426,25 +11910,26 @@ #endif MLAN_INIT_WORK(&hang_work, woal_hang_work_queue); - if(reg_work) { - /* Create workqueue for hang process */ + if (reg_work) { + /* Create workqueue for hang process */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) - /* For kernel less than 2.6.14 name can not be greater than 10 - characters */ + /* For kernel less than 2.6.14 name can not be greater than 10 + characters */ register_workqueue = create_workqueue("MOAL_REGISTER_WORKQ"); #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - register_workqueue = - alloc_workqueue("MOAL_REGISTER_WORK_QUEUE", - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); + register_workqueue = alloc_workqueue( + "MOAL_REGISTER_WORK_QUEUE", + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); #else - register_workqueue = create_workqueue("MOAL_REGISTER_WORK_QUEUE"); + register_workqueue = + create_workqueue("MOAL_REGISTER_WORK_QUEUE"); #endif #endif + MLAN_INIT_WORK(®ister_work, woal_bus_register); queue_work(register_workqueue, ®ister_work); - } - else { + } else { woal_bus_register(NULL); } PRINTM(MMSG, "wlan: Driver loaded successfully\n"); @@ -10457,8 +11942,7 @@ * * @return N/A */ -static void -woal_cleanup_module(void) +static void woal_cleanup_module(void) { moal_handle *handle = NULL; int index = 0; @@ -10476,6 +11960,7 @@ handle = m_handle[index]; if (!handle) continue; + handle->params.auto_fw_reload = MFALSE; if (!handle->priv_num) goto exit; if (MTRUE == woal_check_driver_status(handle)) @@ -10483,7 +11968,8 @@ #ifdef USB #ifdef CONFIG_USB_SUSPEND - if (IS_USB(handle->card_type) && handle->is_suspended == MTRUE) { + if (IS_USB(handle->card_type) && + handle->is_suspended == MTRUE) { woal_exit_usb_suspend(handle); } #endif /* CONFIG_USB_SUSPEND */ @@ -10493,10 +11979,9 @@ #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER if (handle->is_suspended == MTRUE) { - woal_sdio_resume(& - (((struct sdio_mmc_card *)handle->card) - ->func) -->dev); + woal_sdio_resume( + &(((struct sdio_mmc_card *)handle->card)->func) + ->dev); } #endif /* MMC_PM_KEEP_POWER */ #endif /* SDIO_SUSPEND_RESUME */ @@ -10505,10 +11990,39 @@ if (handle->rf_test_mode) woal_process_rf_test_mode(handle, MFG_CMD_UNSET_TEST_MODE); +#if defined(STA_CFG80211) && defined(UAP_CFG80211) + /* Unregister all connected radiotap net devices */ + if (handle->mon_if) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + woal_set_net_monitor(handle->mon_if->priv, + MOAL_IOCTL_WAIT, MFALSE, 0, NULL); + if (handle->ioctl_timeout) { + woal_ioctl_timeout(handle); + goto exit; + } +#endif + netif_device_detach(handle->mon_if->mon_ndev); + if (handle->mon_if->mon_ndev->reg_state == + NETREG_REGISTERED) + unregister_netdev(handle->mon_if->mon_ndev); + handle->mon_if = NULL; + } +#endif for (i = 0; i < handle->priv_num; i++) { + /** cancel dfs monitor on deinit */ + if (handle->priv[i] && + handle->priv[i]->bss_type == MLAN_BSS_TYPE_DFS) { + if (woal_11h_cancel_chan_report_ioctl( + handle->priv[i], MOAL_IOCTL_WAIT)) + PRINTM(MERROR, + "%s: woal_11h_cancel_chan_report_ioctl failed \n", + __func__); + continue; + } #ifdef STA_SUPPORT - if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_STA) { + if (GET_BSS_ROLE(handle->priv[i]) == + MLAN_BSS_ROLE_STA) { if (handle->priv[i]->media_connected == MTRUE) { woal_disconnect(handle->priv[i], MOAL_IOCTL_WAIT_TIMEOUT, @@ -10520,51 +12034,44 @@ } } #ifdef STA_CFG80211 - if (IS_STA_CFG80211 - (handle->params.cfg80211_wext) && - (handle->priv[i]->bss_type == - MLAN_BSS_TYPE_STA)) + if (IS_STA_CFG80211( + handle->params.cfg80211_wext)) woal_clear_conn_params(handle->priv[i]); spin_lock_irqsave(&handle->scan_req_lock, flags); - if (IS_STA_CFG80211 - (handle->params.cfg80211_wext) && + if (IS_STA_CFG80211( + handle->params.cfg80211_wext) && handle->scan_request) { cancel_delayed_work( &handle->scan_timeout_work); - woal_cfg80211_scan_done(handle-> - scan_request, - MTRUE); + woal_cfg80211_scan_done( + handle->scan_request, MTRUE); handle->scan_request = NULL; handle->scan_priv = NULL; } spin_unlock_irqrestore(&handle->scan_req_lock, flags); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - if (IS_STA_CFG80211 - (handle->params.cfg80211_wext) && + if (IS_STA_CFG80211( + handle->params.cfg80211_wext) && handle->priv[i]->sched_scanning) { - woal_stop_bg_scan(handle->priv[i], - MOAL_IOCTL_WAIT_TIMEOUT); + woal_stop_bg_scan( + handle->priv[i], + MOAL_IOCTL_WAIT_TIMEOUT); if (handle->ioctl_timeout) { woal_ioctl_timeout(handle); goto exit; } handle->priv[i]->bg_scan_start = MFALSE; - handle->priv[i] - ->bg_scan_reported = MFALSE; - cfg80211_sched_scan_stopped(handle-> - priv[i] - ->wdev-> - wiphy + handle->priv[i]->bg_scan_reported = + MFALSE; + cfg80211_sched_scan_stopped( + handle->priv[i]->wdev->wiphy #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - , - handle-> - priv[i] - -> - bg_scan_reqid + , + handle->priv[i]->bg_scan_reqid #endif - ); + ); handle->priv[i]->sched_scanning = MFALSE; } @@ -10573,7 +12080,8 @@ } #endif #ifdef UAP_SUPPORT - if (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_UAP) { + if (GET_BSS_ROLE(handle->priv[i]) == + MLAN_BSS_ROLE_UAP) { #ifdef MFG_CMD_SUPPORT if (handle->params.mfg_mode != MLAN_INIT_PARA_ENABLED) @@ -10599,7 +12107,6 @@ } woal_flush_tx_stat_queue(handle->priv[i]); #endif - } #ifdef MFG_CMD_SUPPORT @@ -10610,6 +12117,7 @@ MLAN_BSS_ROLE_ANY), MOAL_IOCTL_WAIT_TIMEOUT, MFALSE, 0); } + #ifdef MFG_CMD_SUPPORT if (handle->params.mfg_mode != MLAN_INIT_PARA_ENABLED) #endif @@ -10654,8 +12162,7 @@ * @param str buffer for mfg_mode * @return N/A */ -static int __init -mfg_mode_setup(char *str) +static int __init mfg_mode_setup(char *str) { int val = -1; get_option(&str, &val); @@ -10664,7 +12171,6 @@ PRINTM(MMSG, "mfg_mode=%d\n", mfg_mode); return 1; } - __setup("mfg_mode=", mfg_mode_setup); #endif #endif @@ -10673,9 +12179,12 @@ module_exit(woal_cleanup_module); module_param(reg_work, int, 0); -MODULE_PARM_DESC(reg_work, "0: disable register work_queue; 1: enable register work_queue"); +MODULE_PARM_DESC( + reg_work, + "0: disable register work_queue; 1: enable register work_queue"); MODULE_DESCRIPTION("M-WLAN Driver"); MODULE_AUTHOR("NXP"); MODULE_VERSION(MLAN_RELEASE_VERSION); MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL");
diff --git a/wlan_sd8987/mlinux/moal_main.h b/wlan_sd8987/mlinux/moal_main.h index 33dada0..12c47b0 100755 --- a/wlan_sd8987/mlinux/moal_main.h +++ b/wlan_sd8987/mlinux/moal_main.h
@@ -3,7 +3,7 @@ * @brief This file contains wlan driver specific defines etc. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -113,6 +113,8 @@ #endif #endif +#include <net/ieee80211_radiotap.h> + #include "mlan.h" #include "moal_shim.h" /* Wireless header */ @@ -135,8 +137,10 @@ #include <linux/suspend.h> #endif /* IMX_SUPPORT */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) #include <linux/pm_qos.h> +#else +#include <linux/pm_qos_params.h> #endif #ifndef MIN @@ -152,6 +156,16 @@ #define COMPAT_VERSION_CODE KERNEL_VERSION(0, 0, 0) #define CFG80211_VERSION_CODE MAX(LINUX_VERSION_CODE, COMPAT_VERSION_CODE) +#define IMX_ANDROID_13 0 +#define IMX_ANDROID_14 0 + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 15, 41) +#undef IMX_ANDROID_13 +#undef IMX_ANDROID_14 +#define IMX_ANDROID_13 1 +#define IMX_ANDROID_14 1 +#endif + /** * Reason Code 3: STA is leaving (or has left) IBSS or ESS */ @@ -210,6 +224,10 @@ #define IEEE80211_NUM_BANDS NUM_NL80211_BANDS #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0) +#define IEEE80211_BAND_6GHZ NL80211_BAND_6GHZ +#endif + /** * interface name */ @@ -219,17 +237,18 @@ #define default_nan_name "nan%d" #define default_mpl_name "mpl%d" #define default_11p_name "ocb%d" +#define default_dfs_name "dfs%d" #define mwiphy_name "mwiphy%d" /** country txpower mode */ -#define CNTRY_TXPOWER_MODE 1 +#define CNTRY_TXPOWER_MODE 1 /** country rgpower mode */ -#define CNTRY_RGPOWER_MODE 2 +#define CNTRY_RGPOWER_MODE 2 /** Define BOOLEAN */ typedef t_u8 BOOLEAN; -#define INTF_CARDTYPE "----------%s-MXM" +#define INTF_CARDTYPE "----------%s-MM" #define KERN_VERSION "5X" @@ -255,6 +274,8 @@ #define CARD_TYPE_USB_USB 6 /** card type PCIE_USB */ #define CARD_TYPE_PCIE_USB 7 +/** card type SD9177_UART */ +#define CARD_TYPE_SD9177_UART 1 // As per datasheet/SoC design /** Driver version */ extern char driver_version[]; @@ -284,6 +305,9 @@ extern int mfg_mode; #endif +/** rf_test mode */ +extern int rf_test_mode; + #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) extern int fw_region; @@ -315,8 +339,22 @@ HardwareStatusNotReady } MOAL_HARDWARE_STATUS; +#define WIFI_STATUS_OK 0 +#define WIFI_STATUS_FW_DNLD 1 +#define WIFI_STATUS_FW_DNLD_COMPLETE 2 +#define WIFI_STATUS_INIT_FW 3 +#define WIFI_STATUS_DNLD_FW_FAIL 4 +#define WIFI_STATUS_INIT_FW_FAIL 5 +#define WIFI_STATUS_TX_TIMEOUT 6 +#define WIFI_STATUS_WIFI_HANG 7 +#define WIFI_STATUS_SCAN_TIMEOUT 8 +#define WIFI_STATUS_FW_DUMP 9 +#define WIFI_STATUS_FW_RELOAD 10 + /** fw cap info 11p */ #define FW_CAPINFO_80211P MBIT(24) +/** fw cap info bit26 for 0-DFS support */ +#define FW_CAPINFO_ZERO_DFS MBIT(31) /** fw cap info disable nan */ #define FW_CAPINFO_DISABLE_NAN MBIT(29) /** fw cap info BGA */ @@ -326,7 +364,8 @@ enum { MOAL_NO_WAIT, MOAL_IOCTL_WAIT, MOAL_IOCTL_WAIT_TIMEOUT }; /** moal_main_state */ -enum { MOAL_STATE_IDLE, +enum { + MOAL_STATE_IDLE, MOAL_RECV_INT, MOAL_ENTER_WORK_QUEUE, MOAL_START_MAIN_PROCESS, @@ -350,7 +389,7 @@ /** Timer list */ struct timer_list tl; /** Timer function */ - void (*timer_function) (void *context); + void (*timer_function)(void *context); /** Timer function context */ void *function_context; /** Time period */ @@ -369,20 +408,19 @@ * @return N/A */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) -static inline void -woal_timer_handler(struct timer_list *t) +static inline void woal_timer_handler(struct timer_list *t) { pmoal_drv_timer timer = from_timer(timer, t, tl); #else -static inline void -woal_timer_handler(unsigned long fcontext) +static inline void woal_timer_handler(unsigned long fcontext) { pmoal_drv_timer timer = (pmoal_drv_timer)fcontext; #endif - timer->timer_function(timer->function_context); + if (!timer->timer_is_canceled) + timer->timer_function(timer->function_context); - if (timer->timer_is_periodic == MTRUE) { + if (timer->timer_is_periodic == MTRUE && !timer->timer_is_canceled) { mod_timer(&timer->tl, jiffies + ((timer->time_period * HZ) / 1000)); } else { @@ -400,10 +438,9 @@ * * @return N/A */ -static inline void -woal_initialize_timer(pmoal_drv_timer timer, - void (*TimerFunction) (void *context), - void *FunctionContext) +static inline void woal_initialize_timer(pmoal_drv_timer timer, + void (*TimerFunction)(void *context), + void *FunctionContext) { /* First, setup the timer to trigger the wlan_timer_handler proxy */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) @@ -430,8 +467,8 @@ * * @return N/A */ -static inline void -woal_mod_timer(pmoal_drv_timer timer, t_u32 millisecondperiod) +static inline void woal_mod_timer(pmoal_drv_timer timer, + t_u32 millisecondperiod) { timer->time_period = millisecondperiod; mod_timer(&timer->tl, jiffies + (millisecondperiod * HZ) / 1000); @@ -445,8 +482,7 @@ * * @return N/A */ -static inline void -woal_cancel_timer(moal_drv_timer *timer) +static inline void woal_cancel_timer(moal_drv_timer *timer) { if (timer->timer_is_periodic || in_atomic() || irqs_disabled()) del_timer(&timer->tl); @@ -481,8 +517,7 @@ * @param thr Thread structure * @return N/A */ -static inline void -woal_activate_thread(moal_thread *thr) +static inline void woal_activate_thread(moal_thread *thr) { /** Initialize the wait queue */ init_waitqueue_head(&thr->wait_q); @@ -497,8 +532,7 @@ * @param thr Thread structure * @return N/A */ -static inline void -woal_deactivate_thread(moal_thread *thr) +static inline void woal_deactivate_thread(moal_thread *thr) { /* Reset the pid */ thr->pid = 0; @@ -512,8 +546,8 @@ * @param name Thread name * @return N/A */ -static inline void -woal_create_thread(int (*threadfunc) (void *), moal_thread *thr, char *name) +static inline void woal_create_thread(int (*threadfunc)(void *), + moal_thread *thr, char *name) { /* Create and run the thread */ thr->task = kthread_run(threadfunc, thr, "%s", name); @@ -553,8 +587,7 @@ * * @return N/A */ -static inline void -woal_sched_timeout(t_u32 millisec) +static inline void woal_sched_timeout(t_u32 millisec) { set_current_state(TASK_INTERRUPTIBLE); @@ -568,8 +601,7 @@ * * @return N/A */ -static inline void -woal_sched_timeout_uninterruptible(t_u32 millisec) +static inline void woal_sched_timeout_uninterruptible(t_u32 millisec) { set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible((millisec * HZ) / 1000); @@ -579,16 +611,15 @@ #define IN6PTON_XDIGIT 0x00010000 #define IN6PTON_DIGIT 0x00020000 #define IN6PTON_COLON_MASK 0x00700000 -#define IN6PTON_COLON_1 0x00100000 /* single : requested */ -#define IN6PTON_COLON_2 0x00200000 /* second : requested */ -#define IN6PTON_COLON_1_2 0x00400000 /* :: requested */ -#define IN6PTON_DOT 0x00800000 /* . */ +#define IN6PTON_COLON_1 0x00100000 /* single : requested */ +#define IN6PTON_COLON_2 0x00200000 /* second : requested */ +#define IN6PTON_COLON_1_2 0x00400000 /* :: requested */ +#define IN6PTON_DOT 0x00800000 /* . */ #define IN6PTON_DELIM 0x10000000 -#define IN6PTON_NULL 0x20000000 /* first/tail */ +#define IN6PTON_NULL 0x20000000 /* first/tail */ #define IN6PTON_UNKNOWN 0x40000000 -static inline int -xdigit2bin(char c, int delim) +static inline int xdigit2bin(char c, int delim) { if (c == delim || c == '\0') return IN6PTON_DELIM; @@ -607,8 +638,8 @@ return IN6PTON_UNKNOWN; } -static inline int -in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end) +static inline int in4_pton(const char *src, int srclen, u8 *dst, int delim, + const char **end) { const char *s; u8 *d; @@ -645,7 +676,7 @@ w = (w * 10) + c; if ((w & 0xffff) > 255) goto out; -cont: + cont: if (i >= 4) goto out; s++; @@ -730,6 +761,10 @@ #define CUS_EVT_DRIVER_HANG "EVENT=DRIVER_HANG" /** Custom event : FW_DUMP */ #define CUS_EVT_FW_DUMP "EVENT=FW_DUMP" +/** Custom event : START FW RESET */ +#define CUS_EVT_FW_RECOVER_START "EVENT=FW_RECOVER_START" +#define CUS_EVT_FW_RECOVER_SUCCESS "EVENT=FW_RECOVER_SUCCESS" +#define CUS_EVT_FW_RECOVER_FAIL "EVENT=FW_RECOVER_FAILURE" /** TDLS connected event */ #define CUS_EVT_TDLS_CONNECTED "EVENT=TDLS_CONNECTED" @@ -795,27 +830,43 @@ /** Wakeup Reason */ typedef enum { - NO_HSWAKEUP_REASON = 0, // 0.unknown - BCAST_DATA_MATCHED, // 1. Broadcast data matched - MCAST_DATA_MATCHED, // 2. Multicast data matched - UCAST_DATA_MATCHED, // 3. Unicast data matched - MASKTABLE_EVENT_MATCHED, // 4. Maskable event matched - NON_MASKABLE_EVENT_MATCHED, // 5. Non-maskable event matched - NON_MASKABLE_CONDITION_MATCHED, // 6. Non-maskable condition matched - // (EAPoL rekey) - MAGIC_PATTERN_MATCHED, // 7. Magic pattern matched - CONTROL_FRAME_MATCHED, // 8. Control frame matched - MANAGEMENT_FRAME_MATCHED, // 9. Management frame matched - GTK_REKEY_FAILURE, // 10. GTK rekey failure - RESERVED // Others: reserved + NO_HSWAKEUP_REASON = 0, // 0.unknown + BCAST_DATA_MATCHED, // 1. Broadcast data matched + MCAST_DATA_MATCHED, // 2. Multicast data matched + UCAST_DATA_MATCHED, // 3. Unicast data matched + MASKTABLE_EVENT_MATCHED, // 4. Maskable event matched + NON_MASKABLE_EVENT_MATCHED, // 5. Non-maskable event matched + NON_MASKABLE_CONDITION_MATCHED, // 6. Non-maskable condition matched + // (EAPoL rekey) + MAGIC_PATTERN_MATCHED, // 7. Magic pattern matched + CONTROL_FRAME_MATCHED, // 8. Control frame matched + MANAGEMENT_FRAME_MATCHED, // 9. Management frame matched + GTK_REKEY_FAILURE, // 10. GTK rekey failure + RESERVED // Others: reserved } HSWakeupReason_t; +/** Custom event : Radar Detected */ +#define CUS_EVT_RADAR_DETECTED "EVENT=RADAR_DETECTED" +/** Custom event : CAC finished */ +#define CUS_EVT_CAC_FINISHED "EVENT=CAC_FINISHED" +#ifdef UAP_SUPPORT +void woal_move_to_next_channel(moal_private *priv); +void woal_chan_event(moal_private *priv, t_u8 type, t_u8 channel, t_u8 radar); +void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, + t_u8 radar); +mlan_status woal_do_dfs_cac(moal_private *priv, + mlan_ds_11h_chan_rep_req *ch_rpt_req); +#endif + /** Custom event : WEP ICV error */ #define CUS_EVT_WEP_ICV_ERR "EVENT=WEP_ICV_ERR" /** Custom event : Channel Switch Announcment */ #define CUS_EVT_CHANNEL_SWITCH_ANN "EVENT=CHANNEL_SWITCH_ANN" +/** Custom event : Channel Switch complete */ +#define CUS_EVT_CHAN_SWITCH_COMPLETE "EVENT=CHANNEL_SWITCH_COMPLETE" + /** Custom indiciation message sent to the application layer for WMM changes */ #define WMM_CONFIG_CHANGE_INDICATION "WMM_CONFIG_CHANGE.indication" @@ -829,6 +880,8 @@ #endif #define FW_DEBUG_INFO "EVENT=FW_DEBUG_INFO" +#define CUS_EVT_CSI "EVENT=MLAN_CSI" + /** 10 seconds */ #define MOAL_TIMER_10S 10000 /** 5 seconds */ @@ -838,7 +891,7 @@ /** 1 milisecond */ #define MOAL_TIMER_1MS 1 /** scan timeout set to 25 seconds */ -#define SCAN_TIMEOUT_25S 25000 +#define SCAN_TIMEOUT_25S 25000 /** passive scan time */ #define PASSIVE_SCAN_CHAN_TIME 110 @@ -861,7 +914,7 @@ /** Netlink protocol number */ #define NETLINK_NXP (MAX_LINKS - 1) /** Netlink maximum payload size */ -#define NL_MAX_PAYLOAD 1024 +#define NL_MAX_PAYLOAD (3 * 1024) /** Netlink multicast group number */ #define NL_MULTICAST_GROUP 1 @@ -888,22 +941,6 @@ /** GAP value is optional */ #define GAP_FLAG_OPTIONAL MBIT(15) -/** Macro to extract the TOS field from a skb */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) -#define SKB_TOS(skb) (ip_hdr(skb)->tos) -#else -#define SKB_TOS(skb) (skb->nh.iph->tos) -#endif -#define SKB_TIDV6(skb) (ipv6_get_dsfield(ipv6_hdr(skb))) -#define IS_SKB_MAGIC_VLAN(skb) (skb->priority >= 256 && skb->priority <= 263) -#define GET_VLAN_PRIO(skb) (skb->priority - 256) - -/** Offset for TOS field in the IP header */ -#define IPTOS_OFFSET 5 - -/** Offset for DSCP in the tos field */ -#define DSCP_OFFSET 2 - /** max retry count for wait_event_interupptible_xx while loop */ #define MAX_RETRY_CNT 100 /** wait_queue structure */ @@ -971,14 +1008,14 @@ /** Driver mode uAP bit */ #define DRV_MODE_UAP MBIT(1) /** Maximum uAP BSS */ -#define MAX_UAP_BSS 1 +#define MAX_UAP_BSS 3 /** Default uAP BSS */ #define DEF_UAP_BSS 1 /** WACP Modes for uAP */ -#define WACP_MODE_DEFAULT 0 -#define WACP_MODE_1 1 -#define WACP_MODE_2 2 +#define WACP_MODE_DEFAULT 0 +#define WACP_MODE_1 1 +#define WACP_MODE_2 2 #endif #ifdef WIFI_DIRECT_SUPPORT /** Driver mode WIFIDIRECT bit */ @@ -992,6 +1029,13 @@ #endif #endif /* WIFI_DIRECT_SUPPORT */ +/**Driver mode 0DFS bit**/ +#define DRV_MODE_DFS MBIT(7) +/**Maxinmum DFS BSS**/ +#define MAX_DFS_BSS 1 +/**Default DFS BSS**/ +#define DEF_DFS_BSS 1 + #define DRV_MODE_WLAN (MBIT(0) | MBIT(1) | MBIT(2) | MBIT(3) | MBIT(4)) /** @@ -1056,7 +1100,7 @@ /** IP address operation: Remove */ #define IPADDR_OP_REMOVE 0 -#define TCP_ACK_MAX_HOLD 9 +#define TCP_ACK_MAX_HOLD 9 #define DROP_TCP_ACK 1 #define HOLD_TCP_ACK 2 struct tcp_sess { @@ -1077,7 +1121,9 @@ /** timer for ack */ moal_drv_timer ack_timer __ATTRIB_ALIGN__; /** timer is set */ - BOOLEAN is_timer_set; + atomic_t is_timer_set; + /** last update time*/ + wifi_timeval update_time; }; struct tx_status_info { @@ -1103,6 +1149,8 @@ WOAL_EVENT_ASSOC_RESP, #endif #endif + WOAL_EVENT_CHAN_RPT, + WOAL_EVENT_RADAR, #ifdef UAP_CFG80211 #if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE WOAL_EVENT_CANCEL_CHANRPT, @@ -1110,11 +1158,19 @@ #endif }; +/** chan_rpt_info */ +typedef struct _chan_radar_info { + /** channel */ + t_u8 channel; + /** radar */ + t_u8 radar; +} chan_radar_info; + typedef struct _woal_evt_buf { /** Event len */ t_u16 event_len; /** Event buffer */ - t_u8 event_buf[1024]; + t_u8 event_buf[1500]; } woal_evt_buf; /** woal event */ @@ -1128,8 +1184,9 @@ union { chan_band_info chan_info; woal_evt_buf evt; - mlan_ds_misc_assoc_rsp assoc_resp; + mlan_ds_assoc_info assoc_info; int reason_code; + chan_radar_info radar_info; }; }; @@ -1216,6 +1273,43 @@ t_u8 num_failure; }; +/** mcast node */ +struct mcast_node { + struct list_head link; + /** mcast address information */ + t_u8 mcast_addr[ETH_ALEN]; +}; + +/** This is a flag for auto assoc/re-connect retry forever */ +#define AUTO_ASSOC_RETRY_FOREVER 0xFFFF + +typedef enum { + AUTO_ASSOC_TYPE_NONE = 0, + AUTO_ASSOC_TYPE_DRV_ASSOC, + AUTO_ASSOC_TYPE_DRV_RECONN, + AUTO_ASSOC_TYPE_FW_RECONN, +} AUTO_ASSOC_TYPE; + +typedef struct { + /** driver auto assoc retry count */ + t_u8 retry_count; + /** driver auto assoc retry interval */ + t_u8 retry_interval; + /** driver auto assoc status */ + t_u8 status; +} drv_auto_assoc; + +typedef struct { + /** Bitmap for auto assoc type on/off */ + t_u8 auto_assoc_type_on; + /** flag of being triggered by drv auto assoc/re-connect */ + t_u8 auto_assoc_trigger_flag; + /** driver auto assoc info*/ + drv_auto_assoc drv_assoc; + /** driver auto re-connect info*/ + drv_auto_assoc drv_reconnect; +} auto_assoc; + struct rf_test_mode_data { /* tx antenna num */ t_u32 tx_antenna; @@ -1242,9 +1336,12 @@ /* Tx frame config values */ t_u32 tx_frame_data[20]; /* HE TB Tx values */ - t_u32 he_tb_tx[5]; + t_u32 he_tb_tx[4]; + t_s32 he_tb_tx_power[1]; /* BSSID */ t_u8 bssid[ETH_ALEN]; + /* Trigger frame config values */ + mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; }; /** Number of samples in histogram (/proc/mwlan/adapterX/mlan0/histogram).*/ @@ -1288,6 +1385,30 @@ RING_ID_MAX, }; +#define AUTO_DFS_ENABLE 0x1 +#define AUTO_DFS_DISABLE 0x0 +#define MAX_DFS_CHAN_LIST 16 + +/** Auto Zero DFS config structure */ +typedef struct _auto_zero_dfs_cfg { + /** 1: start 0: stop */ + t_u8 start_auto_zero_dfs; + /** start channel for ZeroDFS */ + t_u8 cac_start_chan; + /** cac timer */ + t_u32 cac_timer; + /** bw: 0: 20MHz 1: 40Mz above 3: 40MHz below 4: Bandwidth 80MHz */ + t_u8 bw; + /** enable uap chan switch after first CAC finished*/ + t_u8 uap_chan_switch; + /** enable auto zero dfs */ + t_u8 multi_chan_dfs; + /** num of chan */ + t_u8 num_of_chan; + /** dfs channel list */ + t_u8 dfs_chan_list[MAX_DFS_CHAN_LIST]; +} __ATTRIB_PACK__ auto_zero_dfs_cfg; + /** Private structure for MOAL */ struct _moal_private { /** Handle structure */ @@ -1306,7 +1427,7 @@ t_u8 current_addr[ETH_ALEN]; /** Media connection status */ BOOLEAN media_connected; - /** mclist work queue */ + /** mclist work queue */ struct workqueue_struct *mclist_workqueue; /** mclist work */ struct work_struct mclist_work; @@ -1321,8 +1442,10 @@ BOOLEAN bss_started; /** host based uap flag */ BOOLEAN uap_host_based; - /** transition channel */ - t_u8 trans_chan; + /** target channel */ + t_u8 target_chan; + /** backup channel */ + t_u8 backup_chan; /** uAP skip CAC*/ BOOLEAN skip_cac; /** tx block flag */ @@ -1331,6 +1454,22 @@ t_u32 user_cac_period_msec; /** channel under nop */ BOOLEAN chan_under_nop; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + /** radar background */ + t_u8 radar_background; + /** radar background channel */ + struct cfg80211_chan_def radar_background_chan; +#endif +#endif + /** chan_rpt_req on Zero DFS interface */ + mlan_ds_11h_chan_rep_req chan_rpt_req; + /** chan_rpt pending */ + t_u8 chan_rpt_pending; + /** auto dfs cfg */ + auto_zero_dfs_cfg auto_dfs_cfg; + /** index of cac */ + int curr_cac_idx; #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /** current working channel */ @@ -1367,10 +1506,6 @@ wlan_bgscan_cfg scan_cfg; /** sched scaning flag */ t_u8 sched_scanning; - /** sched_scan work queue */ - struct workqueue_struct *sched_scan_workqueue; - /** sched_scan work */ - struct delayed_work sched_scan_work; /** bgscan request id */ t_u64 bg_scan_reqid; #ifdef STA_CFG80211 @@ -1394,7 +1529,7 @@ t_u8 conn_wep_key[MAX_WEP_KEY_SIZE]; /** connection param */ struct cfg80211_connect_params sme_current; - /** station info */ + /** station info */ struct station_info *sinfo; /* associcate bss */ struct cfg80211_bss *assoc_bss; @@ -1426,6 +1561,10 @@ /** cipher */ t_u32 cipher; #endif + /** pmk saved flag */ + t_u8 pmk_saved; + /** pmk */ + mlan_pmk_t pmk; /** beacon ie index */ t_u16 beacon_index; /** proberesp ie index */ @@ -1495,8 +1634,8 @@ wait_queue_head_t ft_wait_q __ATTRIB_ALIGN__; /** ft wait condition */ t_bool ft_wait_condition; -#endif /* STA_SUPPORT */ -#endif /* STA_CFG80211 */ +#endif /* STA_SUPPORT */ +#endif /* STA_CFG80211 */ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /** flag for host_mlme */ t_u8 host_mlme; @@ -1504,6 +1643,10 @@ t_u8 auth_flag; /** flag for auth algorithm */ t_u16 auth_alg; + /** auth tx cnt */ + t_u8 auth_tx_cnt; + /** deauth evt cnt */ + t_u8 deauth_evt_cnt; #endif #ifdef CONFIG_PROC_FS /** Proc entry */ @@ -1514,7 +1657,7 @@ struct proc_dir_entry *hist_entry; /** ant_hist_proc_data */ wlan_hist_proc_data hist_proc[MAX_ANTENNA_NUM]; -#endif /* CONFIG_PROC_FS */ +#endif /* CONFIG_PROC_FS */ #ifdef STA_SUPPORT /** Nickname */ t_u8 nick_name[16]; @@ -1530,7 +1673,7 @@ BOOLEAN reassoc_on; /** Set asynced essid flag */ BOOLEAN set_asynced_essid_flag; -#endif /* REASSOCIATION */ +#endif /* REASSOCIATION */ /** Report scan result */ t_u8 report_scan_result; /** wpa_version */ @@ -1539,7 +1682,7 @@ t_u8 key_mgmt; /** rx_filter */ t_u8 rx_filter; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ /** Rate index */ t_u16 rate_index; #if defined(STA_WEXT) || defined(UAP_WEXT) @@ -1574,6 +1717,14 @@ t_u8 tcp_ack_max_hold; /** TCP session spin lock */ spinlock_t tcp_sess_lock; + /** mcast spin lock */ + spinlock_t mcast_lock; + /** mcast list */ + struct list_head mcast_list; + /** num_mcast_addr */ + t_u32 num_mcast_addr; + /** enable mc_aggr */ + t_u8 enable_mc_aggr; /** tcp list */ struct list_head tdls_list; /** tdls spin lock */ @@ -1582,6 +1733,7 @@ t_u8 enable_auto_tdls; /** check tx packet for tdls peer */ t_u8 tdls_check_tx; + auto_assoc auto_assoc_priv; #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 29) atomic_t wmm_tx_pending[4]; #endif @@ -1602,6 +1754,17 @@ mlan_ds_misc_gtk_rekey_data gtk_rekey_data; dot11_protocol tx_protocols; dot11_protocol rx_protocols; + t_u16 csi_seq; + /** 0-disable, 1-enable */ + t_u16 csi_enable; + /** default-ASCII, 1-binary */ + t_u8 csi_dump_format; + /** total length of csi dump */ + t_u32 csi_dump_len; + /** path name of csi dump */ + char csi_dump_path[64]; + /** CSI config */ + mlan_ds_csi_params csi_config; #if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT) /** hostcmd_wait_q */ wait_queue_head_t hostcmd_wait_q __ATTRIB_ALIGN__; @@ -1611,12 +1774,12 @@ void *rings[RING_ID_MAX]; t_u8 pkt_fate_monitor_enable; void *packet_filter; -#if defined(WIFI_LATENCY_MODE_SUPPORT) - /** If |MTRUE|, suppress Wi-Fi scan requests. */ - t_bool scan_suppressed; -#endif // defined(WIFI_LATENCY_MODE_SUPPORT) - t_u8 auth_tx_cnt; - t_u8 deauth_evt_cnt; + /** txwatchdog disable */ + t_u8 txwatchdog_disable; + + /** secure boot uuid lower and higher 8 bytes */ + t_u64 uuid_lo; + t_u64 uuid_hi; }; #ifdef SDIO @@ -1662,7 +1825,7 @@ t_u32 feature_control; /* Revision id register */ t_u32 rev_id_reg; - /* host interface selection reg */ + /* host interface selection reg*/ t_u32 host_strap_reg; /* Chip Magic Register */ t_u32 magic_reg; @@ -1684,30 +1847,252 @@ t_u32 slew_rate_reg; t_u8 slew_rate_bit_offset; #endif + t_u8 sniffer_support; t_u8 per_pkt_cfg_support; } card_info; +/** channel_field.flags */ +#define CHANNEL_FLAGS_TURBO 0x0010 +#define CHANNEL_FLAGS_CCK 0x0020 +#define CHANNEL_FLAGS_OFDM 0x0040 +#define CHANNEL_FLAGS_2GHZ 0x0080 +#define CHANNEL_FLAGS_5GHZ 0x0100 +#define CHANNEL_FLAGS_ONLY_PASSIVSCAN_ALLOW 0x0200 +#define CHANNEL_FLAGS_DYNAMIC_CCK_OFDM 0x0400 +#define CHANNEL_FLAGS_GFSK 0x0800 +struct channel_field { + /** frequency */ + t_u16 frequency; + /** flags */ + t_u16 flags; +} __packed; + +/** mcs_field.known */ +#define MCS_KNOWN_BANDWIDTH 0x01 +#define MCS_KNOWN_MCS_INDEX_KNOWN 0x02 +#define MCS_KNOWN_GUARD_INTERVAL 0x04 +#define MCS_KNOWN_HT_FORMAT 0x08 +#define MCS_KNOWN_FEC_TYPE 0x10 +#define MCS_KNOWN_STBC_KNOWN 0x20 +#define MCS_KNOWN_NESS_KNOWN 0x40 +#define MCS_KNOWN_NESS_DATA 0x80 +/** bandwidth */ +#define RX_BW_20 0 +#define RX_BW_40 1 +#define RX_BW_20L 2 +#define RX_BW_20U 3 +#define RX_BW_80 4 +/** mcs_field.flags +The flags field is any combination of the following: +0x03 bandwidth - 0: 20, 1: 40, 2: 20L, 3: 20U +0x04 guard interval - 0: long GI, 1: short GI +0x08 HT format - 0: mixed, 1: greenfield +0x10 FEC type - 0: BCC, 1: LDPC +0x60 Number of STBC streams +0x80 Ness - bit 0 (LSB) of Number of extension spatial streams */ +struct mcs_field { + /** known */ + t_u8 known; + /** flags */ + t_u8 flags; + /** mcs */ + t_u8 mcs; +} __packed; + +/** vht_field.known */ +#define VHT_KNOWN_STBC 0x0001 +#define VHT_KNOWN_TXOP_PS_NA 0x0002 +#define VHT_KNOWN_GI 0x0004 +#define VHT_KNOWN_SGI_NSYM_DIS 0x0008 +#define VHT_KNOWN_LDPC_EXTRA_OFDM_SYM 0x0010 +#define VHT_KNOWN_BEAMFORMED 0x0020 +#define VHT_KNOWN_BANDWIDTH 0x0040 +#define VHT_KNOWN_GROUP_ID 0x0080 +#define VHT_KNOWN_PARTIAL_AID 0x0100 + +/** vht_field.flags */ +#define VHT_FLAG_STBC 0x01 +#define VHT_FLAG_TXOP_PS_NA 0x02 +#define VHT_FLAG_SGI 0x04 +#define VHT_FLAG_SGI_NSYM_M10_9 0x08 +#define VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10 +#define VHT_FLAG_BEAMFORMED 0x20 + +/** vht_field.coding */ +#define VHT_CODING_LDPC_USER0 0x01 +#define VHT_CODING_LDPC_USER1 0x02 +#define VHT_CODING_LDPC_USER2 0x04 +#define VHT_CODING_LDPC_USER3 0x08 + +/** vht_field */ +struct vht_field { + /** pad: for vht field require 2 bytes alignment */ + t_u8 pad; + /** known */ + t_u16 known; + /** flags */ + t_u8 flags; + /** bandwidth */ + t_u8 bandwidth; + /** mcs_nss for up to 4 users */ + t_u8 mcs_nss[4]; + /** coding for up to 4 users */ + t_u8 coding; + /** group_id */ + t_u8 group_id; + /** partial_aid */ + t_u16 partial_aid; +} __packed; + +/** radiotap_body.flags */ +#define RADIOTAP_FLAGS_DURING_CFG 0x01 +#define RADIOTAP_FLAGS_SHORT_PREAMBLE 0x02 +#define RADIOTAP_FLAGS_WEP_ENCRYPTION 0x04 +#define RADIOTAP_FLAGS_WITH_FRAGMENT 0x08 +#define RADIOTAP_FLAGS_INCLUDE_FCS 0x10 +#define RADIOTAP_FLAGS_PAD_BTW_HEADER_PAYLOAD 0x20 +#define RADIOTAP_FLAGS_FAILED_FCS_CHECK 0x40 +#define RADIOTAP_FLAGS_USE_SGI_HT 0x80 +struct radiotap_body { + /** timestamp */ + t_u64 timestamp; + /** flags */ + t_u8 flags; + /** rate for LG pkt, RATE flag will be present, it shows datarate in + * 500Kbps. For HT/VHT pkt, RATE flag will not be present, it is not + * used. */ + t_u8 rate; + /** channel */ + struct channel_field channel; + /** antenna_signal */ + t_s8 antenna_signal; + /** antenna_noise */ + t_s8 antenna_noise; + /** antenna */ + t_u8 antenna; + /** union for HT/VHT pkt */ + union { + /** mcs field */ + struct mcs_field mcs; + /** vht field */ + struct vht_field vht; + } u; +} __packed; + +struct radiotap_header { + struct ieee80211_radiotap_header hdr; + struct radiotap_body body; +} __packed; + +/** Roam offload config parameters */ +typedef struct woal_priv_fw_roam_offload_cfg { + /* User set passphrase*/ + t_u8 userset_passphrase; + /* BSSID for fw roaming/auto_reconnect*/ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /* Retry_count for fw roaming/auto_reconnect*/ + t_u8 retry_count; + /* Condition to trigger roaming + * Bit0 : RSSI low trigger + * Bit1 : Pre-beacon lost trigger + * Bit2 : Link Lost trigger + * Bit3 : Deauth by ext-AP trigger + * Bit4 ~ Bit15 : Reserved + * value 0 : no trigger + * value 0xff : invalid + */ + t_u16 trigger_condition; + /* SSID List(White list)*/ + mlan_ds_misc_ssid_list ssid_list; + /* Black list(BSSID list)*/ + mlan_ds_misc_roam_offload_aplist black_list; + + /* RSSI paramters set flag*/ + t_u8 rssi_param_set_flag; + /* MAX_RSSI for fw roaming*/ + t_u8 max_rssi; + /* MIN_RSSI for fw roaming*/ + t_u8 min_rssi; + /* Step_RSSI for fw roaming*/ + t_u8 step_rssi; + + /* BAND and RSSI_HYSTERESIS set flag*/ + t_u8 band_rssi_flag; + mlan_ds_misc_band_rssi band_rssi; + + /* BGSCAN params set flag*/ + t_u8 bgscan_set_flag; + mlan_ds_misc_bgscan_cfg bgscan_cfg; + + /* EES mode params set flag*/ + t_u8 ees_param_set_flag; + mlan_ds_misc_ees_cfg ees_cfg; + + /* Beacon miss threshold*/ + t_u8 bcn_miss_threshold; + + /* Beacon miss threshold*/ + t_u8 pre_bcn_miss_threshold; + + /* scan repeat count*/ + t_u16 repeat_count; +} woal_roam_offload_cfg; +#ifdef STA_CFG80211 +int woal_set_clear_pmk(moal_private *priv, t_u8 action); +#endif +int woal_config_fw_roaming(moal_private *priv, t_u8 cfg_mode, + woal_roam_offload_cfg *roam_offload_cfg); +int woal_enable_fw_roaming(moal_private *priv, int data); + #define GTK_REKEY_OFFLOAD_DISABLE 0 #define GTK_REKEY_OFFLOAD_ENABLE 1 #define GTK_REKEY_OFFLOAD_SUSPEND 2 +/** Monitor Band Channel Config */ +typedef struct _netmon_band_chan_cfg { + t_u32 band; + t_u32 channel; + t_u32 chan_bandwidth; +} netmon_band_chan_cfg; + +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +typedef struct _monitor_iface { + /* The priv data of interface on which the monitor iface is based */ + moal_private *priv; + struct wireless_dev wdev; + int radiotap_enabled; + /* The net_device on which the monitor iface is based. */ + struct net_device *base_ndev; + struct net_device *mon_ndev; + char ifname[IFNAMSIZ]; + int flag; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + struct cfg80211_chan_def chandef; +#endif + /** Netmon Band Channel Config */ + netmon_band_chan_cfg band_chan_cfg; + /** Monitor device statistics structure */ + struct net_device_stats stats; +} monitor_iface; +#endif + #define MAX_KEEP_ALIVE_ID 4 /** Operation data structure for MOAL bus interfaces */ typedef struct _moal_if_ops { - mlan_status (*register_dev) (moal_handle *handle); - void (*unregister_dev) (moal_handle *handle); - mlan_status (*read_reg) (moal_handle *handle, t_u32 reg, t_u32 *data); - mlan_status (*write_reg) (moal_handle *handle, t_u32 reg, t_u32 data); - mlan_status (*read_data_sync) (moal_handle *handle, mlan_buffer *pmbuf, + mlan_status (*register_dev)(moal_handle *handle); + void (*unregister_dev)(moal_handle *handle); + mlan_status (*read_reg)(moal_handle *handle, t_u32 reg, t_u32 *data); + mlan_status (*write_reg)(moal_handle *handle, t_u32 reg, t_u32 data); + mlan_status (*read_data_sync)(moal_handle *handle, mlan_buffer *pmbuf, + t_u32 port, t_u32 timeout); + mlan_status (*write_data_sync)(moal_handle *handle, mlan_buffer *pmbuf, t_u32 port, t_u32 timeout); - mlan_status (*write_data_sync) (moal_handle *handle, mlan_buffer *pmbuf, - t_u32 port, t_u32 timeout); - mlan_status (*get_fw_name) (moal_handle *handle); - void (*dump_fw_info) (moal_handle *handle); - int (*dump_reg_info) (moal_handle *handle, t_u8 *buf); - void (*reg_dbg) (moal_handle *handle); - t_u8 (*is_second_mac) (moal_handle *handle); + mlan_status (*get_fw_name)(moal_handle *handle); + void (*dump_fw_info)(moal_handle *handle); + int (*dump_reg_info)(moal_handle *handle, t_u8 *buf); + void (*reg_dbg)(moal_handle *handle); + t_u8 (*is_second_mac)(moal_handle *handle); } moal_if_ops; #define WIFI_DIRECT_KERNEL_VERSION KERNEL_VERSION(2, 6, 39) @@ -1743,20 +2128,22 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) EXT_DFS_OFFLOAD, #endif + EXT_CFG80211_DRCS, EXT_DISABLE_REGD_BY_DRIVER, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) EXT_COUNTRY_IE_IGNORE, EXT_BEACON_HINTS, #endif + EXT_ROAMOFFLOAD_IN_HS, #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) EXT_HOST_MLME, #endif #endif EXT_TX_WORK, - EXT_RPS, EXT_TX_SKB_CLONE, EXT_PMQOS, + EXT_CHAN_TRACK, EXT_MAX_PARAM, }; @@ -1767,10 +2154,12 @@ t_u8 flag; char *fw_name; int fw_reload; + int auto_fw_reload; char *mac_addr; #ifdef MFG_CMD_SUPPORT int mfg_mode; -#endif /* MFG_CMD_SUPPORT */ +#endif /* MFG_CMD_SUPPORT */ + int rf_test_mode; char *hw_name; int drv_mode; #ifdef DEBUG_LEVEL1 @@ -1779,20 +2168,20 @@ #ifdef STA_SUPPORT int max_sta_bss; char *sta_name; -#endif /* STA_SUPPORT */ +#endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT int max_uap_bss; char *uap_name; int uap_max_sta; int wacp_mode; -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT */ #ifdef WIFI_DIRECT_SUPPORT int max_wfd_bss; char *wfd_name; #if defined(STA_CFG80211) && defined(UAP_CFG80211) int max_vir_bss; #endif -#endif /* WIFI_DIRECT_SUPPORT */ +#endif /* WIFI_DIRECT_SUPPORT */ int auto_ds; int net_rx; int amsdu_deaggr; @@ -1829,14 +2218,12 @@ #ifdef PCIE int pcie_int_mode; int ring_size; -#endif /* PCIE */ +#endif /* PCIE */ #ifdef ANDROID_KERNEL int wakelock_timeout; #endif unsigned int dev_cap_mask; -#if defined(SD8997) || defined(PCIE8997) || defined(USB8997) || defined(SD8977) || defined(SD8987) || defined(SD9098) || defined(USB9098) || defined(PCIE9098) || defined(SD9097) || defined(USB9097) || defined(PCIE9097) || defined(SD8978) || defined(SD9177) int pmic; -#endif int antcfg; unsigned int uap_oper_ctrl; int hs_wake_interval; @@ -1848,21 +2235,31 @@ int gtk_rekey_offload; t_u16 multi_dtim; t_u16 inact_tmo; + int drcs_chantime_mode; char *reg_alpha2; int dfs53cfg; + t_u8 mcs32; + +#if defined(CONFIG_RPS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) + /* rps module param */ + int rps; +#endif +#endif + int keep_previous_scan; } moal_mod_para; void woal_tp_acnt_timer_func(void *context); void woal_set_tp_state(moal_private *priv); #define MAX_TP_ACCOUNT_DROP_POINT_NUM 5 -#define RX_DROP_P1 (MAX_TP_ACCOUNT_DROP_POINT_NUM) -#define RX_DROP_P2 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 1) -#define RX_DROP_P3 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 2) -#define RX_DROP_P4 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 3) -#define RX_DROP_P5 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 4) +#define RX_DROP_P1 (MAX_TP_ACCOUNT_DROP_POINT_NUM) +#define RX_DROP_P2 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 1) +#define RX_DROP_P3 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 2) +#define RX_DROP_P4 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 3) +#define RX_DROP_P5 (MAX_TP_ACCOUNT_DROP_POINT_NUM + 4) #define TXRX_MAX_SAMPLE 60 -#define RX_TIME_PKT (MAX_TP_ACCOUNT_DROP_POINT_NUM + 5) -#define TX_TIME_PKT (MAX_TP_ACCOUNT_DROP_POINT_NUM + 6) +#define RX_TIME_PKT (MAX_TP_ACCOUNT_DROP_POINT_NUM + 5) +#define TX_TIME_PKT (MAX_TP_ACCOUNT_DROP_POINT_NUM + 6) typedef struct _moal_tp_acnt_t { /* TX accounting */ @@ -1932,6 +2329,11 @@ /** Bss attr */ moal_drv_mode drv_mode; +#if defined(STA_CFG80211) && defined(UAP_CFG80211) + /** Monitor interface */ + monitor_iface *mon_if; +#endif + /** set mac address flag */ t_u8 set_mac_addr; /** MAC address */ @@ -1945,7 +2347,7 @@ #ifdef USB /** Firmware download skip flag */ t_u8 skip_fw_dnld; -#endif /* USB */ +#endif /* USB */ /** Firmware */ const struct firmware *firmware; /** Firmware request start time */ @@ -1973,8 +2375,25 @@ t_u32 fw_release_number; /** Firmware Hotfix version */ t_u8 fw_hotfix_version; + /** Firmware support bands */ + t_u16 fw_bands; /** ECSA support */ t_u8 fw_ecsa_enable; + /** FW ROAMING support */ + t_u8 fw_roam_enable; + /** FW ROAMING capability in fw */ + t_u8 fw_roaming_support; + /** Retry count for auto reconnect based on FW ROAMING*/ + t_u16 auto_reconnect_retry_count; + /** The SSID for auto reconnect FW ROAMING*/ + mlan_802_11_ssid auto_reconnect_ssid; + /** The BSSID for auto reconnect FW ROAMING*/ + mlan_802_11_mac_addr auto_reconnect_bssid; + /** The parameters for FW ROAMING*/ + woal_roam_offload_cfg fw_roam_params; + /** The keys for FW ROAMING*/ + mlan_ds_passphrase ssid_passphrase[MAX_SEC_SSID_NUM]; + /** Getlog support */ t_u8 fw_getlog_enable; /** Init wait queue token */ @@ -2006,7 +2425,7 @@ int irq_oob_wakeup; /** wakeup notify flag */ bool wake_by_wifi; -#endif /* IMX_SUPPORT */ +#endif /* IMX_SUPPORT */ /** Card pointer */ t_void *card; /** Rx pending in MLAN */ @@ -2044,7 +2463,7 @@ struct semaphore reassoc_sem; /** Bitmap for re-association on/off */ t_u8 reassoc_on; -#endif /* REASSOCIATION */ +#endif /* REASSOCIATION */ /** Driver workqueue */ struct workqueue_struct *workqueue; /** main work */ @@ -2075,12 +2494,16 @@ t_u8 remain_on_channel; /** bss index for remain on channel */ t_u8 remain_bss_index; + /** wifi hal enabled flag */ + t_u8 wifi_hal_flag; #if defined(STA_CFG80211) || defined(UAP_CFG80211) struct wiphy *wiphy; /** Country code for regulatory domain */ t_u8 country_code[COUNTRY_CODE_LEN]; + /** dfs_region */ + t_u8 dfs_region; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - /** regulatory work */ + /** regulatory work */ struct work_struct regulatory_work; #endif /** band */ @@ -2126,7 +2549,7 @@ /** reg debug flag */ t_u8 reg_dbg; #ifdef SDIO -#endif /* SDIO */ +#endif /* SDIO */ /** Netlink kernel socket */ struct sock *nl_sk; /** Netlink kernel socket number */ @@ -2151,7 +2574,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /* CAC channel info */ struct cfg80211_chan_def dfs_channel; - /* time set flag */ + /* time set flag*/ BOOLEAN is_cac_timer_set; /** cac_timer */ moal_drv_timer cac_timer __ATTRIB_ALIGN__; @@ -2174,7 +2597,7 @@ #if defined(USB) /** Flag to indicate boot state */ t_u8 boot_state; -#endif /* USB_NEW_FW_DNLD */ +#endif /* USB_NEW_FW_DNLD */ #ifdef SDIO_MMC_DEBUG /** cmd53 write state */ u8 cmd53w; @@ -2197,8 +2620,8 @@ u8 fake_scan_complete; /** Scan timeout work*/ struct delayed_work scan_timeout_work; - /** scan timeout time */ - t_u32 scan_timeout; + /** scan timeout time */ + t_u32 scan_timeout; #endif #endif /** main state */ @@ -2215,14 +2638,16 @@ t_u32 drv_dump_len; /** FW dump state */ t_u8 fw_dump; - /** event fw dump */ + /** event fw dump */ t_u8 event_fw_dump; /** Re-association timer set flag */ BOOLEAN is_fw_dump_timer_set; /** Re-association timer */ moal_drv_timer fw_dump_timer __ATTRIB_ALIGN__; - /** fw dump buffer total len */ + /** fw dump buffer total len */ t_u64 fw_dump_len; + /** fw dump status for each chip, useful in multichip drive */ + BOOLEAN fw_dump_status; /** Pointer of fw dump buffer */ t_u8 *fw_dump_buf; /** FW dump full name */ @@ -2266,9 +2691,11 @@ /* feature_control */ t_u32 feature_control; struct notifier_block woal_notifier; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) struct notifier_block woal_inet6_notifier; #endif +#endif mlan_ds_misc_keep_alive keep_alive[MAX_KEEP_ALIVE_ID]; struct net_device napi_dev; struct napi_struct napi_rx; @@ -2312,14 +2739,11 @@ t_u8 request_pm; #ifdef IMX_SUPPORT -#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 6, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - struct dev_pm_qos_request woal_pm_qos_req; -#endif -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) struct pm_qos_request woal_pm_qos_req; #endif #endif + t_u32 ips_ctrl; }; /** @@ -2329,8 +2753,7 @@ * @param idx extended flags id * @return N/A */ -static inline void -moal_extflg_set(moal_handle *handle, enum ext_mod_params idx) +static inline void moal_extflg_set(moal_handle *handle, enum ext_mod_params idx) { t_u8 *ext_fbyte; ext_fbyte = &handle->params.ext_flgs[idx / 8]; @@ -2344,8 +2767,8 @@ * @param idx extended flags id * @return N/A */ -static inline void -moal_extflg_clear(moal_handle *handle, enum ext_mod_params idx) +static inline void moal_extflg_clear(moal_handle *handle, + enum ext_mod_params idx) { t_u8 *ext_fbyte; ext_fbyte = &handle->params.ext_flgs[idx / 8]; @@ -2359,8 +2782,8 @@ * @param idx extended flags id * @return value of extended flag */ -static inline t_u8 -moal_extflg_isset(moal_handle *handle, enum ext_mod_params idx) +static inline t_u8 moal_extflg_isset(moal_handle *handle, + enum ext_mod_params idx) { t_u8 ext_fbyte; ext_fbyte = handle->params.ext_flgs[idx / 8]; @@ -2374,8 +2797,7 @@ * * @return N/A */ -static inline void -woal_set_trans_start(struct net_device *dev) +static inline void woal_set_trans_start(struct net_device *dev) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) unsigned int i; @@ -2396,8 +2818,7 @@ * * @return N/A */ -static inline void -woal_start_queue(struct net_device *dev) +static inline void woal_start_queue(struct net_device *dev) { #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 29) netif_start_queue(dev); @@ -2416,8 +2837,7 @@ * * @return N/A */ -static inline void -woal_stop_queue(struct net_device *dev) +static inline void woal_stop_queue(struct net_device *dev) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) unsigned long flags; @@ -2441,8 +2861,7 @@ * * @return N/A */ -static inline void -woal_wake_queue(struct net_device *dev) +static inline void woal_wake_queue(struct net_device *dev) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) unsigned long flags; @@ -2568,8 +2987,7 @@ printk(KERN_ALERT msg); \ } while (0) -static inline void -woal_print(t_u32 level, char *fmt, ...) +static inline void woal_print(t_u32 level, char *fmt, ...) { } @@ -2602,8 +3020,7 @@ #define DBG_DUMP_BUF_LEN 64 #define MAX_DUMP_PER_LINE 16 -static inline void -hexdump(t_u32 level, char *prompt, t_u8 *buf, int len) +static inline void hexdump(t_u32 level, char *prompt, t_u8 *buf, int len) { int i; char dbgdumpbuf[DBG_DUMP_BUF_LEN]; @@ -2717,8 +3134,8 @@ * * @return Pointer to moal_private */ -static inline moal_private * -woal_get_priv(moal_handle *handle, mlan_bss_role bss_role) +static inline moal_private *woal_get_priv(moal_handle *handle, + mlan_bss_role bss_role) { int i; @@ -2741,8 +3158,8 @@ * * @return Pointer to moal_private */ -static inline moal_private * -woal_get_priv_bss_type(moal_handle *handle, mlan_bss_type bss_type) +static inline moal_private *woal_get_priv_bss_type(moal_handle *handle, + mlan_bss_type bss_type) { int i; @@ -2756,8 +3173,8 @@ return NULL; } -static inline moal_private * -woal_get_vir_priv_bss_type(moal_handle *handle, mlan_bss_type bss_type) +static inline moal_private *woal_get_vir_priv_bss_type(moal_handle *handle, + mlan_bss_type bss_type) { int i; @@ -2772,10 +3189,21 @@ } #if defined(STA_CFG80211) || defined(UAP_CFG80211) +/** get any cfg80211 priv */ +static inline moal_private *woal_get_priv_with_wdev(moal_handle *handle) +{ + int i; + for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM); i++) { + if (handle->priv[i]) { + if (handle->priv[i]->wdev) + return handle->priv[i]; + } + } + return NULL; +} #endif -static inline void -woal_get_monotonic_time(wifi_timeval * tv) +static inline void woal_get_monotonic_time(wifi_timeval *tv) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) struct timespec64 ts; @@ -2935,8 +3363,8 @@ /* Functions in interface module */ #ifdef ANDROID_KERNEL #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0) -static inline void -wakeup_source_init(struct wakeup_source *ws, const char *name) +static inline void wakeup_source_init(struct wakeup_source *ws, + const char *name) { ENTER(); @@ -2949,8 +3377,7 @@ LEAVE(); } -static inline void -wakeup_source_trash(struct wakeup_source *ws) +static inline void wakeup_source_trash(struct wakeup_source *ws) { ENTER(); @@ -2966,7 +3393,7 @@ #endif #endif /** Add card */ -moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops * if_ops, +moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, t_u16 card_type); /** Remove card */ mlan_status woal_remove_card(void *card); @@ -3015,7 +3442,7 @@ #ifdef CONFIG_PROC_FS mlan_status woal_request_soft_reset(moal_handle *handle); #endif -void woal_request_fw_reload(moal_handle *phandle, t_u8 mode); +int woal_request_fw_reload(moal_handle *phandle, t_u8 mode); /** Get debug information */ mlan_status woal_get_debug_info(moal_private *priv, t_u8 wait_option, @@ -3034,7 +3461,7 @@ mlan_fw_info *fw_info); /** Get channel of active intf */ mlan_status woal_get_active_intf_channel(moal_private *priv, - chan_band_info * channel); + chan_band_info *channel); #ifdef STA_SUPPORT /** Request Exented Capability information */ int woal_request_extcap(moal_private *priv, t_u8 *buf, t_u8 len); @@ -3053,6 +3480,7 @@ /** Get wakeup reason */ mlan_status woal_get_wakeup_reason(moal_private *priv, mlan_ds_hs_wakeup_reason *wakeup_reason); +int woal_process_proc_hssetpara(moal_handle *handle, t_u8 *buf); #define FW_DUMP_INFO_LEN 0x280000 /** mem dump header */ typedef struct { @@ -3115,13 +3543,17 @@ mlan_status woal_get_assoc_rsp(moal_private *priv, mlan_ds_misc_assoc_rsp *assoc_rsp, t_u8 wait_option); +mlan_status woal_get_assoc_req(moal_private *priv, + mlan_ds_misc_assoc_req *assoc_req, + t_u8 wait_option); + /** Get signal information */ mlan_status woal_get_signal_info(moal_private *priv, t_u8 wait_option, mlan_ds_get_signal *signal); /** Get mode */ t_u32 woal_get_mode(moal_private *priv, t_u8 wait_option); mlan_status woal_get_sta_channel(moal_private *priv, t_u8 wait_option, - chan_band_info * channel); + chan_band_info *channel); #ifdef STA_WEXT /** Get data rates */ mlan_status woal_get_data_rates(moal_private *priv, t_u8 wait_option, @@ -3210,7 +3642,7 @@ /** Initialize priv */ void woal_init_priv(moal_private *priv, t_u8 wait_option); /** Reset interface(s) */ -int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf); +mlan_status woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf); #define TLV_TYPE_MGMT_IE (0x169) #define MGMT_MASK_ASSOC_REQ 0x01 #define MGMT_MASK_REASSOC_REQ 0x04 @@ -3330,9 +3762,13 @@ struct sk_buff *skb); moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_num, t_u8 bss_type); +void woal_clean_up(moal_handle *handle); void woal_remove_interface(moal_handle *handle, t_u8 bss_index); void woal_set_multicast_list(struct net_device *dev); mlan_status woal_request_fw(moal_handle *handle); +mlan_status woal_ioctl_aggr_prio_tbl(moal_private *priv, t_u32 action, + mlan_ds_11n_aggr_prio_tbl *aggr_prio_tbl); + int woal_11h_channel_check_ioctl(moal_private *priv, t_u8 wait_option); void woal_cancel_cac_block(moal_private *priv); void woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag); @@ -3374,10 +3810,6 @@ #define EVENT_BG_SCAN_REPORT 0x0004 mlan_status woal_set_bg_scan(moal_private *priv, char *buf, int length); mlan_status woal_stop_bg_scan(moal_private *priv, t_u8 wait_option); -#if defined(WIFI_LATENCY_MODE_SUPPORT) -mlan_status -woal_set_wifi_low_latency_mode(moal_private *priv, t_u8 mode); -#endif // defined(WIFI_LATENCY_MODE_SUPPORT) void woal_reconfig_bgscan(moal_handle *handle); #ifdef STA_CFG80211 void woal_config_bgscan_and_rssi(moal_private *priv, t_u8 set_rssi); @@ -3408,12 +3840,20 @@ struct tx_status_info *woal_get_tx_info(moal_private *priv, t_u8 tx_seq_num); void woal_remove_tx_info(moal_private *priv, t_u8 tx_seq_num); +void woal_flush_mcast_list(moal_private *priv); +t_void woal_add_mcast_node(moal_private *priv, t_u8 *mcast_addr); +void woal_remove_mcast_node(moal_private *priv, t_u8 *mcast_addr); +t_u8 woal_find_mcast_node_tx(moal_private *priv, struct sk_buff *skb); + mlan_status woal_request_country_power_table(moal_private *priv, char *region); -#ifdef RX_PACKET_COALESCE -mlan_status woal_rx_pkt_coalesce_cfg(moal_private *priv, t_u16 *enable, - t_u8 wait_option, t_u8 action); +mlan_status woal_mc_policy_cfg(moal_private *priv, t_u16 *enable, + t_u8 wait_option, t_u8 action); +#ifdef UAP_SUPPORT +void woal_check_mc_connection(moal_private *priv, t_u8 wait_option, + t_u8 new_channel); #endif mlan_status woal_set_low_pwr_mode(moal_handle *handle, t_u8 wait_option); +mlan_status woal_set_chan_track_mode(moal_handle *handle, t_u8 wait_option); int woal_hexval(char chr); mlan_status woal_pmic_configure(moal_handle *handle, t_u8 wait_option); mlan_status woal_set_user_antcfg(moal_handle *handle, t_u8 wait_option); @@ -3429,6 +3869,11 @@ t_u8 wait_option, mlan_ds_misc_mef_flt_cfg *mefcfg); mlan_status woal_set_auto_arp_ext(moal_handle *handle, t_u8 enable); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +mlan_status woal_set_net_monitor(moal_private *priv, t_u8 wait_option, + t_u8 enable, t_u8 filter, + netmon_band_chan_cfg *band_chan_cfg); +#endif mlan_status woal_delba_all(moal_private *priv, t_u8 wait_option); #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) @@ -3442,26 +3887,30 @@ t_u32 retry_interval, t_u8 retry_cnt); int woal_stop_mkeep_alive(moal_private *priv, t_u8 mkeep_alive_id, t_u8 reset, t_u8 *ip_pkt, t_u8 *pkt_len); -int woal_priv_save_cloud_keep_alive_params(moal_private *priv, - t_u8 mkeep_alive_id, t_u8 enable, - t_u16 ether_type, t_u8 *ip_pkt, - t_u16 ip_pkt_len, t_u8 *src_mac, - t_u8 *dst_mac, t_u32 period_msec, - t_u32 retry_interval, - t_u8 retry_cnt); +int woal_priv_save_cloud_keep_alive_params( + moal_private *priv, t_u8 mkeep_alive_id, t_u8 enable, t_u16 ether_type, + t_u8 *ip_pkt, t_u16 ip_pkt_len, t_u8 *src_mac, t_u8 *dst_mac, + t_u32 period_msec, t_u32 retry_interval, t_u8 retry_cnt); #ifdef UAP_SUPPORT mlan_status woal_set_wacp_mode(moal_private *priv, t_u8 wait_option); #endif mlan_status woal_init_aggr_ctrl(moal_handle *handle, t_u8 wait_option); +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +monitor_iface *woal_prepare_mon_if(moal_private *priv, const char *name, + unsigned char name_assign_type); +#endif + #if defined(STA_CFG80211) || defined(UAP_CFG80211) +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE void woal_cfg80211_vendor_event_fw_dump(moal_private *priv); #endif +#endif #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) mlan_status woal_set_rekey_data(moal_private *priv, - mlan_ds_misc_gtk_rekey_data * gtk_rekey, + mlan_ds_misc_gtk_rekey_data *gtk_rekey, t_u8 action, t_u8 wait_option); #endif #endif
diff --git a/wlan_sd8987/mlinux/moal_pcie.c b/wlan_sd8987/mlinux/moal_pcie.c index dda7701..8d9ea7f 100755 --- a/wlan_sd8987/mlinux/moal_pcie.c +++ b/wlan_sd8987/mlinux/moal_pcie.c
@@ -4,7 +4,7 @@ * related functions. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -28,6 +28,10 @@ #include <linux/firmware.h> +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#include "moal_cfg80211.h" +#endif + #include "moal_pcie.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 70) @@ -36,9 +40,11 @@ #endif #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) #include <net/addrconf.h> #endif +#endif /******************************************************** Local Variables @@ -56,63 +62,73 @@ static const struct pci_device_id wlan_ids[] = { #ifdef PCIE8897 { - PCIE_VENDOR_ID_NXP, - PCIE_DEVICE_ID_NXP_88W8897P, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_MRVL, + PCIE_DEVICE_ID_88W8897P, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, #endif #ifdef PCIE8997 { - PCIE_VENDOR_ID_NXP, - PCIE_DEVICE_ID_NXP_88W8997P, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_MRVL, + PCIE_DEVICE_ID_88W8997P, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, { - PCIE_VENDOR_ID_V2_NXP, - PCIE_DEVICE_ID_NXP_88W8997P, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_V2_MRVL, + PCIE_DEVICE_ID_88W8997P, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, #endif #ifdef PCIE9097 { - PCIE_VENDOR_ID_V2_NXP, - PCIE_DEVICE_ID_NXP_88W9097, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_V2_MRVL, + PCIE_DEVICE_ID_88W9097, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, #endif #ifdef PCIE9098 { - PCIE_VENDOR_ID_V2_NXP, - PCIE_DEVICE_ID_NXP_88W9098P_FN0, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_V2_MRVL, + PCIE_DEVICE_ID_88W9098P_FN0, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, { - PCIE_VENDOR_ID_V2_NXP, - PCIE_DEVICE_ID_NXP_88W9098P_FN1, - PCI_ANY_ID, - PCI_ANY_ID, - 0, - 0, - }, + PCIE_VENDOR_ID_V2_MRVL, + PCIE_DEVICE_ID_88W9098P_FN1, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, #endif +#ifdef PCIENW62X + { + PCIE_VENDOR_ID_NXP, + PCIE_DEVICE_ID_88WNW62X, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, +#endif + {}, }; - /* moal interface ops */ static moal_if_ops pcie_ops; @@ -127,6 +143,11 @@ ********************************************************/ static mlan_status woal_pcie_preinit(struct pci_dev *pdev); +#if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || \ + defined(PCIE9097) || defined(PCIENW62X) +static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, + t_u8 resetflag); +#endif /** @brief This function updates the card types * @@ -135,66 +156,79 @@ * * @return N/A */ -static t_u16 -woal_update_card_type(t_void *card) +static t_u16 woal_update_card_type(t_void *card) { pcie_service_card *cardp_pcie = (pcie_service_card *)card; t_u16 card_type = 0; /* Update card type */ #ifdef PCIE8897 - if (cardp_pcie->dev->device == PCIE_DEVICE_ID_NXP_88W8897P) { + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88W8897P) { card_type = CARD_TYPE_PCIE8897; moal_memcpy_ext(NULL, driver_version, CARD_PCIE8897, strlen(CARD_PCIE8897), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V15, strlen(V15), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef PCIE8997 - if (cardp_pcie->dev->device == PCIE_DEVICE_ID_NXP_88W8997P) { + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88W8997P) { card_type = CARD_TYPE_PCIE8997; moal_memcpy_ext(NULL, driver_version, CARD_PCIE8997, strlen(CARD_PCIE8997), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V16, strlen(V16), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef PCIE9097 - if (cardp_pcie->dev->device == PCIE_DEVICE_ID_NXP_88W9097) { + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88W9097) { card_type = CARD_TYPE_PCIE9097; - moal_memcpy_ext(NULL, driver_version, CARD_PCIEIW620, - strlen(CARD_PCIEIW620), strlen(driver_version)); + moal_memcpy_ext(NULL, driver_version, CARD_PCIE9097, + strlen(CARD_PCIE9097), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V17, strlen(V17), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef PCIE9098 - if (cardp_pcie->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN0 || - cardp_pcie->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN1) { + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88W9098P_FN0 || + cardp_pcie->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) { card_type = CARD_TYPE_PCIE9098; moal_memcpy_ext(NULL, driver_version, CARD_PCIE9098, strlen(CARD_PCIE9098), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V17, strlen(V17), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif +#ifdef PCIENW62X + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88WNW62X) { + card_type = CARD_TYPE_PCIENW62X; + moal_memcpy_ext(NULL, driver_version, CARD_PCIENW62X, + strlen(CARD_PCIENW62X), strlen(driver_version)); + moal_memcpy_ext(NULL, + driver_version + strlen(INTF_CARDTYPE) + + strlen(KERN_VERSION), + V17, strlen(V17), + strlen(driver_version) - strlen(INTF_CARDTYPE) - + strlen(KERN_VERSION)); + } +#endif + return card_type; } @@ -214,8 +248,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_do_flr(moal_handle *handle, bool prepare, bool flr_flag) +static mlan_status woal_do_flr(moal_handle *handle, bool prepare, bool flr_flag) { unsigned int i; int index = 0; @@ -242,6 +275,7 @@ if (!IS_PCIE8997(handle->card_type) && !IS_PCIE9097(handle->card_type) && + !IS_PCIENW62X(handle->card_type) && !IS_PCIE9098(handle->card_type)) { LEAVE(); return status; @@ -256,6 +290,7 @@ /* Reset all interfaces */ priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE); + woal_clean_up(handle); /* Shutdown firmware */ handle->init_wait_q_woken = MFALSE; @@ -276,10 +311,20 @@ } unregister_inetaddr_notifier(&handle->woal_notifier); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #if IS_ENABLED(CONFIG_IPV6) unregister_inet6addr_notifier(&handle->woal_inet6_notifier); #endif +#endif +#ifdef WIFI_DIRECT_SUPPORT +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + /* Remove virtual interface */ + woal_remove_virtual_interface(handle); +#endif +#endif +#endif /* Remove interface */ for (i = 0; i < handle->priv_num; i++) woal_remove_interface(handle, i); @@ -315,8 +360,9 @@ PRINTM(MFATAL, "Software Init Failed\n"); goto err_init_fw; } + #ifdef PCIE9098 - if (card->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN1) + if (card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) mlan_set_int_mode(handle->pmlan_adapter, pcie_int_mode, 1); else #endif @@ -404,8 +450,7 @@ * * @return error code */ -static int -woal_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) +static int woal_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) { pcie_service_card *card = NULL; t_u16 card_type = 0; @@ -438,14 +483,20 @@ ret = MLAN_STATUS_FAILURE; goto err; } - woal_pcie_init(card); + if (MLAN_STATUS_SUCCESS != woal_pcie_init(card)) { + PRINTM(MERROR, "woal_pcie_init failed\n"); + ret = -EFAULT; + goto err; + } - if (woal_add_card(card, &card->dev->dev, &pcie_ops, card_type) == NULL) { + if (woal_add_card(card, &card->dev->dev, &pcie_ops, card_type) == + NULL) { woal_pcie_cleanup(card); PRINTM(MERROR, "%s: failed\n", __func__); ret = -EFAULT; goto err; } + #ifdef IMX_SUPPORT woal_regist_oob_wakeup_irq(card->handle); #endif /* IMX_SUPPORT */ @@ -468,8 +519,7 @@ * * @return error code */ -static void -woal_pcie_remove(struct pci_dev *dev) +static void woal_pcie_remove(struct pci_dev *dev) { pcie_service_card *card; moal_handle *handle; @@ -502,6 +552,46 @@ } /** + * @brief This function handles PCIE driver remove + * + * @param pdev A pointer to pci_dev structure + * + * @return error code + */ +static void woal_pcie_shutdown(struct pci_dev *dev) +{ + pcie_service_card *card; + moal_handle *handle; + + ENTER(); + PRINTM(MCMND, "<--- Enter woal_pcie_shutdown --->\n"); + + card = pci_get_drvdata(dev); + if (!card) { + PRINTM(MINFO, "PCIE card removed from slot\n"); + LEAVE(); + return; + } + handle = card->handle; + if (handle->second_mac) + goto done; +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(handle->card_type) || IS_PCIENW62X(handle->card_type) || + IS_PCIE9097(handle->card_type)) { + if (RDWR_STATUS_FAILURE != + woal_pcie_rdwr_firmware(handle, 0, 1)) + PRINTM(MMSG, "wlan: start in-bound IR...\n"); + } +#endif +done: + handle->surprise_removed = MTRUE; + pci_disable_device(dev); + PRINTM(MCMND, "<--- Leave woal_pcie_shutdown --->\n"); + LEAVE(); + return; +} + +/** * @brief Handle suspend * * @param pdev A pointer to pci_dev structure @@ -509,8 +599,7 @@ * * @return error code */ -static int -woal_pcie_suspend(struct pci_dev *pdev, pm_message_t state) +static int woal_pcie_suspend(struct pci_dev *pdev, pm_message_t state) { pcie_service_card *cardp; moal_handle *handle = NULL; @@ -584,9 +673,8 @@ if (keep_power) { /* Enable Host Sleep */ - hs_actived = - woal_enable_hs(woal_get_priv - (handle, MLAN_BSS_ROLE_ANY)); + hs_actived = woal_enable_hs( + woal_get_priv(handle, MLAN_BSS_ROLE_ANY)); if (hs_actived == MTRUE) { /* Indicate device suspended */ handle->is_suspended = MTRUE; @@ -601,7 +689,9 @@ } woal_flush_workqueue(handle); if (!keep_power) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) woal_do_flr(handle, true, false); +#endif handle->surprise_removed = MTRUE; handle->is_suspended = MTRUE; } @@ -626,8 +716,7 @@ * * @return error code */ -static int -woal_pcie_resume(struct pci_dev *pdev) +static int woal_pcie_resume(struct pci_dev *pdev) { moal_handle *handle; pcie_service_card *cardp; @@ -668,7 +757,9 @@ pci_enable_wake(pdev, PCI_D0, 0); if (!keep_power) { handle->surprise_removed = MFALSE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) woal_do_flr(handle, false, false); +#endif } else { if (woal_check_driver_status(handle)) { PRINTM(MERROR, "Resuem, device is in hang state\n"); @@ -698,8 +789,7 @@ * * @param pdev A pointer to pci_dev structure */ -static void -woal_pcie_reset_prepare(struct pci_dev *pdev) +static void woal_pcie_reset_prepare(struct pci_dev *pdev) { pcie_service_card *card; moal_handle *handle; @@ -748,14 +838,12 @@ LEAVE(); } - /** * @brief Pcie reset done handler * * @param pdev A pointer to pci_dev structure */ -static void -woal_pcie_reset_done(struct pci_dev *pdev) +static void woal_pcie_reset_done(struct pci_dev *pdev) { pcie_service_card *card; moal_handle *handle; @@ -803,8 +891,7 @@ LEAVE(); } #else -static void -woal_pcie_reset_notify(struct pci_dev *pdev, bool prepare) +static void woal_pcie_reset_notify(struct pci_dev *pdev, bool prepare) { pcie_service_card *card; moal_handle *handle; @@ -872,13 +959,13 @@ static const struct pci_error_handlers woal_pcie_err_handler[] = { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) { - .reset_prepare = woal_pcie_reset_prepare, - .reset_done = woal_pcie_reset_done, - }, + .reset_prepare = woal_pcie_reset_prepare, + .reset_done = woal_pcie_reset_done, + }, #else { - .reset_notify = woal_pcie_reset_notify, - }, + .reset_notify = woal_pcie_reset_notify, + }, #endif }; #endif // KERNEL_VERSION(3.18.0) @@ -889,6 +976,7 @@ .id_table = wlan_ids, .probe = woal_pcie_probe, .remove = woal_pcie_remove, + .shutdown = woal_pcie_shutdown, #ifdef CONFIG_PM /* Power Management Hooks */ .suspend = woal_pcie_suspend, @@ -912,8 +1000,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_write_reg(moal_handle *handle, t_u32 reg, t_u32 data) +static mlan_status woal_pcie_write_reg(moal_handle *handle, t_u32 reg, + t_u32 data) { pcie_service_card *card = (pcie_service_card *)handle->card; @@ -931,8 +1019,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_read_reg(moal_handle *handle, t_u32 reg, t_u32 *data) +static mlan_status woal_pcie_read_reg(moal_handle *handle, t_u32 reg, + t_u32 *data) { pcie_service_card *card = (pcie_service_card *)handle->card; *data = ioread32(card->pci_mmap1 + reg); @@ -953,9 +1041,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_write_data_sync(moal_handle *handle, mlan_buffer *pmbuf, - t_u32 port, t_u32 timeout) +static mlan_status woal_pcie_write_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 port, + t_u32 timeout) { return MLAN_STATUS_SUCCESS; } @@ -970,9 +1058,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_read_data_sync(moal_handle *handle, mlan_buffer *pmbuf, - t_u32 port, t_u32 timeout) +static mlan_status woal_pcie_read_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 port, + t_u32 timeout) { return MLAN_STATUS_SUCCESS; } @@ -985,8 +1073,7 @@ * * @return IRQ_HANDLED */ -static irqreturn_t -woal_pcie_interrupt(int irq, void *dev_id) +static irqreturn_t woal_pcie_interrupt(int irq, void *dev_id) { struct pci_dev *pdev; pcie_service_card *card; @@ -1039,13 +1126,12 @@ * * @return IRQ_HANDLED */ -static irqreturn_t -woal_pcie_msix_interrupt(int irq, void *dev_id) +static irqreturn_t woal_pcie_msix_interrupt(int irq, void *dev_id) { struct pci_dev *pdev; pcie_service_card *card; moal_handle *handle; - msix_context *ctx = (msix_context *) dev_id; + msix_context *ctx = (msix_context *)dev_id; mlan_status ret = MLAN_STATUS_SUCCESS; if (!ctx) { @@ -1086,7 +1172,6 @@ else return IRQ_NONE; } - /** * @brief This function pre-initializes the PCI-E host * memory space, etc. @@ -1095,8 +1180,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_preinit(struct pci_dev *pdev) +static mlan_status woal_pcie_preinit(struct pci_dev *pdev) { int ret; @@ -1111,13 +1195,21 @@ pci_set_master(pdev); PRINTM(MINFO, "Try set_consistent_dma_mask(32)\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); +#else ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); +#endif if (ret) { PRINTM(MERROR, "set_dma_mask(32) failed\n"); goto err_set_dma_mask; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); +#else ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); +#endif if (ret) { PRINTM(MERROR, "set_consistent_dma_mask(64) failed\n"); goto err_set_dma_mask; @@ -1138,8 +1230,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_init(pcie_service_card *card) +static mlan_status woal_pcie_init(pcie_service_card *card) { struct pci_dev *pdev = NULL; int ret; @@ -1154,13 +1245,21 @@ pci_set_master(pdev); PRINTM(MINFO, "Try set_consistent_dma_mask(32)\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); +#else ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); +#endif if (ret) { PRINTM(MERROR, "set_dma_mask(32) failed\n"); goto err_set_dma_mask; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); +#else ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); +#endif if (ret) { PRINTM(MERROR, "set_consistent_dma_mask(64) failed\n"); goto err_set_dma_mask; @@ -1188,9 +1287,10 @@ goto err_iomap2; } - PRINTM(MINFO, + PRINTM(MMSG, "PCI memory map Virt0: %p PCI memory map Virt2: " - "%p\n", card->pci_mmap, card->pci_mmap1); + "%p\n", + card->pci_mmap, card->pci_mmap1); return MLAN_STATUS_SUCCESS; @@ -1219,8 +1319,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_pcie_register_dev(moal_handle *handle) +static mlan_status woal_pcie_register_dev(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; pcie_service_card *card = NULL; @@ -1272,9 +1371,9 @@ ret); for (j = 0; j < i; j++) free_irq(card->msix_entries[j] - .vector, + .vector, &(card->msix_contexts - [i])); + [i])); pci_disable_msix(pdev); break; } @@ -1322,7 +1421,7 @@ } #ifdef PCIE9098 - if (card->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN1) + if (card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) mlan_set_int_mode(handle->pmlan_adapter, pcie_int_mode, 1); else #endif @@ -1340,8 +1439,7 @@ * * @return N/A */ -static void -woal_pcie_cleanup(pcie_service_card *card) +static void woal_pcie_cleanup(pcie_service_card *card) { struct pci_dev *pdev = NULL; pdev = card->dev; @@ -1367,8 +1465,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static void -woal_pcie_unregister_dev(moal_handle *handle) +static void woal_pcie_unregister_dev(moal_handle *handle) { pcie_service_card *card = handle ? (pcie_service_card *)handle->card : NULL; @@ -1420,8 +1517,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_pcie_bus_register(void) +mlan_status woal_pcie_bus_register(void) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -1441,8 +1537,7 @@ * * @return N/A */ -void -woal_pcie_bus_unregister(void) +void woal_pcie_bus_unregister(void) { ENTER(); @@ -1452,7 +1547,7 @@ LEAVE(); } -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) #define PCIE9098_DUMP_CTRL_REG 0x1C94 #define PCIE9098_DUMP_START_REG 0x1C98 #define PCIE9098_DUMP_END_REG 0x1C9F @@ -1463,7 +1558,7 @@ #define DEBUG_DUMP_END_REG 0xCFF #endif -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) #define PCIE9098_SCRATCH_12_REG 0x1C90 #define PCIE9098_SCRATCH_14_REG 0x1C98 #define PCIE9098_SCRATCH_15_REG 0x1C9C @@ -1486,25 +1581,22 @@ * * @return The length of this log */ -static int -woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) +static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) { char *drv_ptr = (char *)buffer; t_u32 reg = 0, value = 0; t_u8 i; char buf[256], *ptr; pcie_service_card *card = (pcie_service_card *)phandle->card; - int config_reg_table[] = { 0x00, 0x04, 0x10, 0x18, 0x2c, - 0x3c, 0x44, 0x80, 0x98, 0x170 - }; + int config_reg_table[] = {0x00, 0x04, 0x10, 0x18, 0x2c, + 0x3c, 0x44, 0x80, 0x98, 0x170}; t_u32 dump_start_reg = 0; t_u32 dump_end_reg = 0; t_u32 scratch_14_reg = 0; t_u32 scratch_15_reg = 0; -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /* Tx/Rx/Event AMDA start address */ - t_u32 adma_reg_table[] = - { 0x10000, 0x10800, 0x10880, 0x11000, 0x11080 }; + t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; #endif ENTER(); @@ -1520,7 +1612,8 @@ drv_ptr += sprintf(drv_ptr, "FW Scrach Registers:\n"); #if defined(PCIE8897) || defined(PCIE8997) - if (IS_PCIE8897(phandle->card_type) || IS_PCIE8997(phandle->card_type)) { + if (IS_PCIE8897(phandle->card_type) || + IS_PCIE8997(phandle->card_type)) { reg = PCIE_SCRATCH_12_REG; dump_start_reg = PCIE_DUMP_START_REG; dump_end_reg = PCIE_DUMP_END_REG; @@ -1529,8 +1622,10 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { reg = PCIE9098_SCRATCH_12_REG; dump_start_reg = PCIE9098_DUMP_REG_START; dump_end_reg = PCIE9098_DUMP_REG_END; @@ -1571,10 +1666,13 @@ } i++; } -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { - drv_ptr += sprintf(drv_ptr, - "PCIE registers from offset 0x1c20 to 0x1c9c:\n"); +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { + drv_ptr += sprintf( + drv_ptr, + "PCIE registers from offset 0x1c20 to 0x1c9c:\n"); memset(buf, 0, sizeof(buf)); ptr = buf; i = 1; @@ -1590,14 +1688,16 @@ } drv_ptr += sprintf(drv_ptr, "%s\n", buf); } - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { drv_ptr += sprintf(drv_ptr, "ADMA Tx/Rx/Event/Cmd/CmdResp registers:\n"); for (j = 0; j < ARRAY_SIZE(adma_reg_table); j++) { - drv_ptr += sprintf(drv_ptr, - "ADMA registers dump from offset 0x%x to 0x%x\n", - adma_reg_table[j], - adma_reg_table[j] + 0x68); + drv_ptr += sprintf( + drv_ptr, + "ADMA registers dump from offset 0x%x to 0x%x\n", + adma_reg_table[j], adma_reg_table[j] + 0x68); memset(buf, 0, sizeof(buf)); ptr = buf; i = 1; @@ -1631,24 +1731,21 @@ * * @return N/A */ -static void -woal_pcie_reg_dbg(moal_handle *phandle) +static void woal_pcie_reg_dbg(moal_handle *phandle) { t_u32 reg = 0, value = 0; t_u8 i; char buf[256], *ptr; pcie_service_card *card = (pcie_service_card *)phandle->card; - int config_reg_table[] = { 0x00, 0x04, 0x10, 0x18, 0x2c, - 0x3c, 0x44, 0x80, 0x98, 0x170 - }; + int config_reg_table[] = {0x00, 0x04, 0x10, 0x18, 0x2c, + 0x3c, 0x44, 0x80, 0x98, 0x170}; t_u32 dump_start_reg = 0; t_u32 dump_end_reg = 0; t_u32 scratch_14_reg = 0; t_u32 scratch_15_reg = 0; -#if defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) /* Tx/Rx/Event AMDA start address */ - t_u32 adma_reg_table[] = - { 0x10000, 0x10800, 0x10880, 0x11000, 0x11080 }; + t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; #endif mlan_pm_wakeup_card(phandle->pmlan_adapter, MTRUE); @@ -1660,7 +1757,8 @@ } PRINTM(MMSG, "FW Scrach Registers:\n"); #if defined(PCIE8897) || defined(PCIE8997) - if (IS_PCIE8897(phandle->card_type) || IS_PCIE8997(phandle->card_type)) { + if (IS_PCIE8897(phandle->card_type) || + IS_PCIE8997(phandle->card_type)) { reg = PCIE_SCRATCH_12_REG; dump_start_reg = PCIE_DUMP_START_REG; dump_end_reg = PCIE_DUMP_END_REG; @@ -1669,8 +1767,10 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { reg = PCIE9098_SCRATCH_12_REG; dump_start_reg = PCIE9098_DUMP_START_REG; dump_end_reg = PCIE9098_DUMP_END_REG; @@ -1706,8 +1806,10 @@ } i++; } -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { PRINTM(MMSG, "PCIE registers from offset 0x1c20 to 0x1c9c:\n"); memset(buf, 0, sizeof(buf)); ptr = buf; @@ -1724,7 +1826,9 @@ } PRINTM(MMSG, "%s\n", buf); } - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { PRINTM(MMSG, "ADMA Tx/Rx/Event/Cmd/CmdResp registers:\n"); for (j = 0; j < ARRAY_SIZE(adma_reg_table); j++) { PRINTM(MMSG, @@ -1790,17 +1894,18 @@ }; #endif -#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIENW62X) #define DEBUG_HOST_READY_8997 0xCC #define DEBUG_HOST_EVENT_READY 0xAA -static memory_type_mapping mem_type_mapping_tbl_8997 = - { "DUMP", NULL, NULL, 0xDD, - 0x00 -}; +#define DEBUG_HOST_RESET_READY 0x99 +static memory_type_mapping mem_type_mapping_tbl_8997 = {"DUMP", NULL, NULL, + 0xDD, 0x00}; #endif -#if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || \ + defined(PCIE9097) || defined(PCIENW62X) /** * @brief This function reads data by 8 bit from card register * @@ -1810,8 +1915,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_read_reg_eight_bit(moal_handle *handle, t_u32 reg, t_u8 *data) +static mlan_status woal_read_reg_eight_bit(moal_handle *handle, t_u32 reg, + t_u8 *data) { pcie_service_card *card = (pcie_service_card *)handle->card; *data = ioread8(card->pci_mmap1 + reg); @@ -1823,11 +1928,12 @@ * * @param phandle A pointer to moal_handle * @param doneflag done flag + * @param resetflag reset flag; * * @return MLAN_STATUS_SUCCESS */ -static rdwr_status -woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag) +static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, + t_u8 resetflag) { int ret = 0; int tries = 0; @@ -1849,37 +1955,46 @@ } #endif -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { if (phandle->event_fw_dump) debug_host_ready = DEBUG_HOST_EVENT_READY; else debug_host_ready = DEBUG_HOST_READY_8997; + if (resetflag) + debug_host_ready = DEBUG_HOST_RESET_READY; dump_ctrl_reg = PCIE9098_DUMP_CTRL_REG; } #endif ret = woal_pcie_write_reg(phandle, dump_ctrl_reg, debug_host_ready); if (ret) { - PRINTM(MERROR, "PCIE Write ERR\n"); + PRINTM(MERROR, "PCIE Write ERR, reg=0x%x debug_reay=0x%x\n", + dump_ctrl_reg, debug_host_ready); return RDWR_STATUS_FAILURE; } -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { - if (phandle->event_fw_dump) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { + if (phandle->event_fw_dump || resetflag) return RDWR_STATUS_SUCCESS; } #endif ret = woal_pcie_read_reg(phandle, dump_ctrl_reg, ®_data); if (ret) { - PRINTM(MERROR, "PCIE Read DEBUG_DUMP_CTRL_REG fail\n"); + PRINTM(MERROR, "PCIE Read DEBUG_DUMP_CTRL_REG 0x%x fail\n", + dump_ctrl_reg); return RDWR_STATUS_FAILURE; } for (tries = 0; tries < MAX_POLL_TRIES; tries++) { ret = woal_read_reg_eight_bit(phandle, dump_ctrl_reg, &ctrl_data); if (ret) { - PRINTM(MERROR, "PCIE READ ERR\n"); + PRINTM(MERROR, "PCIE READ reg 0x%x 8bit ERR\n", + dump_ctrl_reg); return RDWR_STATUS_FAILURE; } if (ctrl_data == DEBUG_FW_DONE) @@ -1887,7 +2002,9 @@ if (doneflag && ctrl_data == doneflag) return RDWR_STATUS_DONE; if (ctrl_data != debug_host_ready) { - PRINTM(MMSG, "The ctrl reg was changed, try again!\n"); + PRINTM(MMSG, + "The ctrl reg was changed, ctrl_data=0x%x, host_ready:0x%x try again!\n", + ctrl_data, debug_host_ready); ret = woal_pcie_write_reg(phandle, dump_ctrl_reg, debug_host_ready); if (ret) { @@ -1902,7 +2019,8 @@ #endif } if (ctrl_data == debug_host_ready) { - PRINTM(MERROR, "Fail to pull ctrl_data\n"); + PRINTM(MERROR, "Fail to pull ctrl_data=0x%x host_ready=0x%x\n", + ctrl_data, debug_host_ready); return RDWR_STATUS_FAILURE; } return RDWR_STATUS_SUCCESS; @@ -1917,8 +2035,7 @@ * * @return N/A */ -static void -woal_pcie_dump_fw_info_v1(moal_handle *phandle) +static void woal_pcie_dump_fw_info_v1(moal_handle *phandle) { int ret = 0; unsigned int reg, reg_start, reg_end; @@ -1950,12 +2067,13 @@ memset(phandle->fw_dump_buf, 0x00, FW_DUMP_INFO_LEN); } phandle->fw_dump_len = 0; - /* start dump fw memory */ + /* start dump fw memory */ moal_get_system_time(phandle, &sec, &usec); PRINTM(MMSG, "====PCIE DEBUG MODE OUTPUT START: %u.%06u ====\n", sec, usec); /* read the number of the memories which will dump */ - if (RDWR_STATUS_FAILURE == woal_pcie_rdwr_firmware(phandle, doneflag)) + if (RDWR_STATUS_FAILURE == + woal_pcie_rdwr_firmware(phandle, doneflag, 0)) goto done; reg = DEBUG_DUMP_START_REG; ret = woal_read_reg_eight_bit(phandle, reg, &dump_num); @@ -1969,7 +2087,7 @@ idx < dump_num && idx < ARRAY_SIZE(mem_type_mapping_tbl_8897); idx++) { if (RDWR_STATUS_FAILURE == - woal_pcie_rdwr_firmware(phandle, doneflag)) + woal_pcie_rdwr_firmware(phandle, doneflag, 0)) goto done; memory_size = 0; reg = DEBUG_DUMP_START_REG; @@ -1995,9 +2113,9 @@ } else { PRINTM(MMSG, "%s_SIZE=0x%x\n", mem_type_mapping_tbl[idx].mem_name, memory_size); - ret = moal_vmalloc(phandle, memory_size + 1, - (t_u8 **)&mem_type_mapping_tbl[idx]. - mem_Ptr); + ret = moal_vmalloc( + phandle, memory_size + 1, + (t_u8 **)&mem_type_mapping_tbl[idx].mem_Ptr); if ((ret != MLAN_STATUS_SUCCESS) || !mem_type_mapping_tbl[idx].mem_Ptr) { PRINTM(MERROR, @@ -2013,7 +2131,7 @@ PRINTM(MMSG, "Start %s output %u.%06u, please wait...\n", mem_type_mapping_tbl[idx].mem_name, sec, usec); do { - stat = woal_pcie_rdwr_firmware(phandle, doneflag); + stat = woal_pcie_rdwr_firmware(phandle, doneflag, 0); if (RDWR_STATUS_FAILURE == stat) goto done; @@ -2037,13 +2155,12 @@ mem_type_mapping_tbl[idx].mem_name, (unsigned int)(dbg_ptr - mem_type_mapping_tbl[idx] - .mem_Ptr)); - woal_save_dump_info_to_buf(phandle, - mem_type_mapping_tbl - [idx].mem_Ptr, - memory_size, - mem_type_mapping_tbl - [idx].type); + .mem_Ptr)); + woal_save_dump_info_to_buf( + phandle, + mem_type_mapping_tbl[idx].mem_Ptr, + memory_size, + mem_type_mapping_tbl[idx].type); moal_vfree(phandle, mem_type_mapping_tbl[idx].mem_Ptr); mem_type_mapping_tbl[idx].mem_Ptr = NULL; @@ -2070,7 +2187,8 @@ } #endif -#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIENW62X) /** * @brief This function dump firmware memory to file * @@ -2078,8 +2196,7 @@ * * @return N/A */ -static void -woal_pcie_dump_fw_info_v2(moal_handle *phandle) +static void woal_pcie_dump_fw_info_v2(moal_handle *phandle) { int ret = 0; unsigned int reg, reg_start, reg_end; @@ -2099,11 +2216,13 @@ PRINTM(MERROR, "Could not dump firmwware info\n"); return; } -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { if (phandle->event_fw_dump) { if (RDWR_STATUS_FAILURE != - woal_pcie_rdwr_firmware(phandle, doneflag)) { + woal_pcie_rdwr_firmware(phandle, doneflag, 0)) { PRINTM(MMSG, "====PCIE FW DUMP EVENT MODE START ====\n"); return; @@ -2112,15 +2231,18 @@ } #endif - /* start dump fw memory */ + /* start dump fw memory */ moal_get_system_time(phandle, &sec, &usec); PRINTM(MMSG, "====PCIE DEBUG MODE OUTPUT START: %u.%06u ====\n", sec, usec); /* read the number of the memories which will dump */ - if (RDWR_STATUS_FAILURE == woal_pcie_rdwr_firmware(phandle, doneflag)) + if (RDWR_STATUS_FAILURE == + woal_pcie_rdwr_firmware(phandle, doneflag, 0)) goto done; -#if defined(PCIE9098) || defined(PCIE9097) - if (IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) + if (IS_PCIE9098(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || + IS_PCIE9097(phandle->card_type)) { dump_start_reg = PCIE9098_DUMP_START_REG; dump_end_reg = PCIE9098_DUMP_END_REG; } @@ -2154,7 +2276,7 @@ PRINTM(MMSG, "Start %s output %u.%06u, please wait...\n", mem_type_mapping_tbl->mem_name, sec, usec); do { - stat = woal_pcie_rdwr_firmware(phandle, doneflag); + stat = woal_pcie_rdwr_firmware(phandle, doneflag, 0); if (RDWR_STATUS_FAILURE == stat) goto done; @@ -2187,10 +2309,10 @@ mem_type_mapping_tbl->mem_Ptr = tmp_ptr; tmp_ptr = NULL; dbg_ptr = mem_type_mapping_tbl->mem_Ptr + - memory_size; + memory_size; memory_size += 0x4000; end_ptr = mem_type_mapping_tbl->mem_Ptr + - memory_size; + memory_size; } } if (RDWR_STATUS_DONE == stat) { @@ -2240,19 +2362,17 @@ * @return MTRUE/MFALSE * */ -static t_u8 -woal_pcie_is_second_mac(moal_handle *handle) +static t_u8 woal_pcie_is_second_mac(moal_handle *handle) { #ifdef PCIE9098 pcie_service_card *card = (pcie_service_card *)handle->card; - if (card->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN1) + if (card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) return MTRUE; #endif return MFALSE; } -static void -woal_pcie_dump_fw_info(moal_handle *phandle) +static void woal_pcie_dump_fw_info(moal_handle *phandle) { mlan_pm_wakeup_card(phandle->pmlan_adapter, MTRUE); phandle->fw_dump = MTRUE; @@ -2260,8 +2380,10 @@ if (IS_PCIE8897(phandle->card_type)) woal_pcie_dump_fw_info_v1(phandle); #endif -#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIENW62X) if (IS_PCIE8997(phandle->card_type) || + IS_PCIENW62X(phandle->card_type) || IS_PCIE9098(phandle->card_type) || IS_PCIE9097(phandle->card_type)) { woal_pcie_dump_fw_info_v2(phandle); @@ -2274,16 +2396,17 @@ } } #endif - woal_send_fw_dump_complete_event(woal_get_priv - (phandle, MLAN_BSS_ROLE_ANY)); phandle->fw_dump = MFALSE; + if (!phandle->priv_num) + return; + woal_send_fw_dump_complete_event( + woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); queue_work(phandle->workqueue, &phandle->main_work); woal_process_hang(phandle); } -static mlan_status -woal_pcie_get_fw_name(moal_handle *handle) +static mlan_status woal_pcie_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef PCIE9098 @@ -2291,12 +2414,14 @@ moal_handle *ref_handle = NULL; #endif -#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIENW62X) t_u32 rev_id_reg = handle->card_info->rev_id_reg; t_u32 revision_id = 0; #endif -#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIENW62X) t_u32 host_strap_reg = handle->card_info->host_strap_reg; t_u32 magic_reg = handle->card_info->magic_reg; t_u32 strap = 0; @@ -2325,6 +2450,7 @@ #endif goto done; } + #ifdef PCIE8997 if (IS_PCIE8997(handle->card_type)) { woal_pcie_read_reg(handle, rev_id_reg, &revision_id); @@ -2335,7 +2461,8 @@ magic &= 0xff; PRINTM(MCMND, "magic=0x%x, strap=0x%x, revision_id=0x%x\n", magic, strap, revision_id); - if ((revision_id == PCIE8997_A1) && (magic == CHIP_MAGIC_VALUE)) { + if ((revision_id == PCIE8997_A1) && + (magic == CHIP_MAGIC_VALUE)) { if (strap == CARD_TYPE_PCIE_UART) strcpy(handle->card_info->fw_name, PCIEUART8997_DEFAULT_COMBO_FW_NAME); @@ -2347,7 +2474,7 @@ #endif #ifdef PCIE9098 if (IS_PCIE9098(handle->card_type)) { - if (card->dev->device == PCIE_DEVICE_ID_NXP_88W9098P_FN0) { + if (card->dev->device == PCIE_DEVICE_ID_88W9098P_FN0) { woal_pcie_read_reg(handle, rev_id_reg, &revision_id); woal_pcie_read_reg(handle, host_strap_reg, &strap); woal_pcie_read_reg(handle, magic_reg, &magic); @@ -2361,16 +2488,16 @@ case PCIE9098_Z1Z2: if (magic == CHIP_MAGIC_VALUE) { if (strap == CARD_TYPE_PCIE_UART) - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEUART9098_DEFAULT_COMBO_FW_NAME); else if (strap == CARD_TYPE_PCIE_PCIE) - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEPCIE9098_DEFAULT_COMBO_FW_NAME); else - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEUSB9098_DEFAULT_COMBO_FW_NAME); } strcpy(handle->card_info->fw_name_wlan, @@ -2381,16 +2508,16 @@ case PCIE9098_A2: if (magic == CHIP_MAGIC_VALUE) { if (strap == CARD_TYPE_PCIE_UART) - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEUART9098_COMBO_V1_FW_NAME); else if (strap == CARD_TYPE_PCIE_PCIE) - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEPCIE9098_COMBO_V1_FW_NAME); else - strcpy(handle->card_info-> - fw_name, + strcpy(handle->card_info + ->fw_name, PCIEUSB9098_COMBO_V1_FW_NAME); } strcpy(handle->card_info->fw_name_wlan, @@ -2452,6 +2579,26 @@ } } #endif +#ifdef PCIENW62X + if (IS_PCIENW62X(handle->card_type)) { + woal_pcie_read_reg(handle, rev_id_reg, &revision_id); + woal_pcie_read_reg(handle, host_strap_reg, &strap); + woal_pcie_read_reg(handle, magic_reg, &magic); + revision_id &= 0xff; + strap &= 0x7; + magic &= 0xff; + PRINTM(MCMND, "magic=0x%x, strap=0x%x, revision_id=0x%x\n", + magic, strap, revision_id); + if (magic == CHIP_MAGIC_VALUE) { + if (strap == CARD_TYPE_PCIE_UART) + strcpy(handle->card_info->fw_name, + PCIEUARTNW62X_DEFAULT_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + PCIEUSBNW62X_DEFAULT_COMBO_FW_NAME); + } + } +#endif done: PRINTM(MCMND, "combo fw:%s wlan fw:%s \n", handle->card_info->fw_name, handle->card_info->fw_name_wlan);
diff --git a/wlan_sd8987/mlinux/moal_pcie.h b/wlan_sd8987/mlinux/moal_pcie.h index 58f3055..dfa1e2e 100755 --- a/wlan_sd8987/mlinux/moal_pcie.h +++ b/wlan_sd8987/mlinux/moal_pcie.h
@@ -4,7 +4,7 @@ * driver. * * - * Copyright 2014-2020 NXP + * Copyright 2014-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -29,27 +29,34 @@ #ifndef _MOAL_PCIE_H_ #define _MOAL_PCIE_H_ -#define PCIE_VENDOR_ID_NXP (0x11ab) -#define PCIE_VENDOR_ID_V2_NXP (0x1b4b) +#define PCIE_VENDOR_ID_MRVL (0x11ab) +#define PCIE_VENDOR_ID_V2_MRVL (0x1b4b) +#define PCIE_VENDOR_ID_NXP (0x1131) + #ifdef PCIE8997 /** PCIE device ID for 8997 card */ -#define PCIE_DEVICE_ID_NXP_88W8997P (0x2b42) +#define PCIE_DEVICE_ID_88W8997P (0x2b42) #endif #ifdef PCIE8897 /** PCIE device ID for 8897 card */ -#define PCIE_DEVICE_ID_NXP_88W8897P (0x2b38) +#define PCIE_DEVICE_ID_88W8897P (0x2b38) #endif #ifdef PCIE9097 /** PCIE device ID for 9097 card */ -#define PCIE_DEVICE_ID_NXP_88W9097 (0x2b56) +#define PCIE_DEVICE_ID_88W9097 (0x2b56) #endif #ifdef PCIE9098 /** PCIE device ID for 9098 card FN0 */ -#define PCIE_DEVICE_ID_NXP_88W9098P_FN0 (0x2b43) +#define PCIE_DEVICE_ID_88W9098P_FN0 (0x2b43) /** PCIE device ID for 9098 card FN1 */ -#define PCIE_DEVICE_ID_NXP_88W9098P_FN1 (0x2b44) +#define PCIE_DEVICE_ID_88W9098P_FN1 (0x2b44) +#endif + +#ifdef PCIENW62X +/** PCIE device ID for NW62X card FN0 */ +#define PCIE_DEVICE_ID_88WNW62X (0x3000) #endif #include <linux/version.h> @@ -75,7 +82,7 @@ #ifdef PCIE8897 #define PCIE8897_DEFAULT_COMBO_FW_NAME "nxp/pcie8897_uapsta.bin" #define PCIE8897_DEFAULT_WLAN_FW_NAME "nxp/pcie8897_wlan.bin" -#endif /* PCIE8897 */ +#endif /* PCIE8897*/ #ifdef PCIE9098 #define PCIE9098_Z1Z2 0x00 @@ -106,7 +113,14 @@ #define PCIE9097_WLAN_V1_FW_NAME "nxp/pcieiw620_wlan_v1.bin" #endif /* PCIE9097 */ -#if defined(PCIE9098) || defined(PCIE9097) +#ifdef PCIENW62X +#define PCIENW62X_DEFAULT_COMBO_FW_NAME "nxp/pcieusbnw62x_combo.bin" +#define PCIEUARTNW62X_DEFAULT_COMBO_FW_NAME "nxp/pcieuartnw62x_combo.bin" +#define PCIEUSBNW62X_DEFAULT_COMBO_FW_NAME "nxp/pcieusbnw62x_combo.bin" +#define PCIENW62X_DEFAULT_WLAN_FW_NAME "nxp/pcienw62x_wlan.bin" +#endif /* PCIENW62X */ + +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIENW62X) #define PCIE_NUM_MSIX_VECTORS 32 #else #define PCIE_NUM_MSIX_VECTORS 4
diff --git a/wlan_sd8987/mlinux/moal_priv.c b/wlan_sd8987/mlinux/moal_priv.c index b1d6f6c..fdab5cd 100755 --- a/wlan_sd8987/mlinux/moal_priv.c +++ b/wlan_sd8987/mlinux/moal_priv.c
@@ -81,8 +81,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) +static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) { mlan_ssid_bssid ssid_bssid; #ifdef REASSOCIATION @@ -105,8 +104,8 @@ "Associate: Insufficient length in IOCTL input\n"); /* buffer should be at least 3 characters per BSSID octet "00:" - ** plus a space separater and at least 1 char in the SSID - */ + ** plus a space separater and at least 1 char in the SSID + */ LEAVE(); return -EINVAL; } @@ -156,6 +155,7 @@ LEAVE(); return -EFAULT; } + #ifdef REASSOCIATION memset(&bss_info, 0x00, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS == @@ -183,8 +183,7 @@ * * @return Number of rates copied */ -static inline int -woal_copy_rates(t_u8 *dest, int pos, t_u8 *src, int len) +static inline int woal_copy_rates(t_u8 *dest, int pos, t_u8 *src, int len) { int i; @@ -203,8 +202,7 @@ * * @return 0/MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_warm_reset(moal_private *priv) +static int woal_warm_reset(moal_private *priv) { int ret = 0; moal_handle *handle = priv->phandle; @@ -240,8 +238,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_signal(moal_private *priv, struct iwreq *wrq) +static int woal_get_signal(moal_private *priv, struct iwreq *wrq) { /** Input data size */ #define IN_DATA_SIZE 2 @@ -281,15 +278,15 @@ } switch (wrq->u.data.length) { - case 0: /* No checking, get everything */ + case 0: /* No checking, get everything */ break; - case 2: /* Check subtype range */ + case 2: /* Check subtype range */ if (in_data[1] < 1 || in_data[1] > 4) { ret = -EINVAL; goto done; } /* Fall through */ - case 1: /* Check type range */ + case 1: /* Check type range */ if (in_data[0] < 1 || in_data[0] > 3) { ret = -EINVAL; goto done; @@ -321,7 +318,7 @@ /* Check type */ switch (in_data[0]) { - case 0: /* Send everything */ + case 0: /* Send everything */ out_data[data_length++] = signal.bcn_rssi_last; out_data[data_length++] = signal.bcn_rssi_avg; out_data[data_length++] = signal.data_rssi_last; @@ -335,75 +332,75 @@ out_data[data_length++] = signal.data_nf_last; out_data[data_length++] = signal.data_nf_avg; break; - case 1: /* RSSI */ + case 1: /* RSSI */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_rssi_last; out_data[data_length++] = signal.bcn_rssi_avg; out_data[data_length++] = signal.data_rssi_last; out_data[data_length++] = signal.data_rssi_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_rssi_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_rssi_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_rssi_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_rssi_avg; break; default: break; } break; - case 2: /* SNR */ + case 2: /* SNR */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_snr_last; out_data[data_length++] = signal.bcn_snr_avg; out_data[data_length++] = signal.data_snr_last; out_data[data_length++] = signal.data_snr_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_snr_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_snr_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_snr_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_snr_avg; break; default: break; } break; - case 3: /* NF */ + case 3: /* NF */ /* Check subtype */ switch (in_data[1]) { - case 0: /* Everything */ + case 0: /* Everything */ out_data[data_length++] = signal.bcn_nf_last; out_data[data_length++] = signal.bcn_nf_avg; out_data[data_length++] = signal.data_nf_last; out_data[data_length++] = signal.data_nf_avg; break; - case 1: /* bcn last */ + case 1: /* bcn last */ out_data[data_length++] = signal.bcn_nf_last; break; - case 2: /* bcn avg */ + case 2: /* bcn avg */ out_data[data_length++] = signal.bcn_nf_avg; break; - case 3: /* data last */ + case 3: /* data last */ out_data[data_length++] = signal.data_nf_last; break; - case 4: /* data avg */ + case 4: /* data avg */ out_data[data_length++] = signal.data_nf_avg; break; default: @@ -434,13 +431,12 @@ * * @return 0 --success, otherwise fail */ -static int -woal_deep_sleep_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_deep_sleep_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; int user_data_len; t_u32 deep_sleep = DEEP_SLEEP_OFF; - t_u32 data[2] = { 0 }; + t_u32 data[2] = {0}; int copy_len; t_u16 idletime = DEEP_SLEEP_IDLE_TIME; @@ -485,7 +481,7 @@ user_data_len); LEAVE(); return -EINVAL; - } else { /* Display Deep Sleep settings */ + } else { /* Display Deep Sleep settings */ PRINTM(MINFO, "Get Deep Sleep Mode\n"); if (MLAN_STATUS_SUCCESS != woal_get_deep_sleep(priv, data)) { LEAVE(); @@ -517,8 +513,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11n_htcap_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_11n_htcap_cfg(moal_private *priv, struct iwreq *wrq) { int data[2], copy_len; mlan_ioctl_req *req = NULL; @@ -625,8 +620,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11n_amsdu_aggr_ctrl(moal_private *priv, struct iwreq *wrq) +static int woal_11n_amsdu_aggr_ctrl(moal_private *priv, struct iwreq *wrq) { int data[2], copy_len; mlan_ioctl_req *req = NULL; @@ -695,10 +689,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11n_tx_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_11n_tx_cfg(moal_private *priv, struct iwreq *wrq) { - int data[2], copy_len; + int data[2] = {0}, copy_len; mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; int ret = 0; @@ -799,10 +792,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11n_prio_tbl(moal_private *priv, struct iwreq *wrq) +static int woal_11n_prio_tbl(moal_private *priv, struct iwreq *wrq) { - int data[MAX_NUM_TID * 2], i, j, copy_len; + int data[MAX_NUM_TID * 2] = {0}, i, j, copy_len; mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; int ret = 0; @@ -892,8 +884,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_addba_reject(moal_private *priv, struct iwreq *wrq) +static int woal_addba_reject(moal_private *priv, struct iwreq *wrq) { int data[MAX_NUM_TID], ret = 0, i, copy_len; mlan_ioctl_req *req = NULL; @@ -975,10 +966,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_addba_para_updt(moal_private *priv, struct iwreq *wrq) +static int woal_addba_para_updt(moal_private *priv, struct iwreq *wrq) { - int data[5], ret = 0, copy_len; + int data[5] = {0}, ret = 0, copy_len; mlan_ioctl_req *req = NULL; mlan_ds_11n_cfg *cfg_11n = NULL; int data_length = wrq->u.data.length; @@ -1077,8 +1067,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_txbuf_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_txbuf_cfg(moal_private *priv, struct iwreq *wrq) { int buf_size; mlan_ioctl_req *req = NULL; @@ -1133,8 +1122,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_hs_cfg(moal_private *priv, struct iwreq *wrq, BOOLEAN invoke_hostcmd) +static int woal_hs_cfg(moal_private *priv, struct iwreq *wrq, + BOOLEAN invoke_hostcmd) { int data[3], copy_len; int ret = 0; @@ -1154,7 +1143,8 @@ } else { action = MLAN_ACT_SET; if (data_length >= 1 && data_length <= 3) { - if (copy_from_user(data, wrq->u.data.pointer, copy_len)) { + if (copy_from_user(data, wrq->u.data.pointer, + copy_len)) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; @@ -1167,9 +1157,8 @@ } /* HS config is blocked if HS is already activated */ - if (data_length && - (data[0] != (int)HOST_SLEEP_CFG_CANCEL || - invoke_hostcmd == MFALSE)) { + if (data_length && (data[0] != (int)HOST_SLEEP_CFG_CANCEL || + invoke_hostcmd == MFALSE)) { memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); if (bss_info.is_hs_configured) { @@ -1234,8 +1223,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_hs_setpara(moal_private *priv, struct iwreq *wrq) +static int woal_hs_setpara(moal_private *priv, struct iwreq *wrq) { int ret = 0; int data_length = wrq->u.data.length; @@ -1263,8 +1251,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_inactivity_timeout_ext(moal_private *priv, struct iwreq *wrq) +static int woal_inactivity_timeout_ext(moal_private *priv, struct iwreq *wrq) { int data[4], copy_len; int ret = 0; @@ -1347,8 +1334,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_ecl_sys_clock(moal_private *priv, struct iwreq *wrq) +static int woal_ecl_sys_clock(moal_private *priv, struct iwreq *wrq) { int data[64], copy_len; int ret = 0; @@ -1465,8 +1451,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_band_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_band_cfg(moal_private *priv, struct iwreq *wrq) { int ret = 0; unsigned int i; @@ -1592,8 +1577,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_reg_read_write(moal_private *priv, struct iwreq *wrq) +static int woal_reg_read_write(moal_private *priv, struct iwreq *wrq) { int data[3], copy_len; int ret = 0; @@ -1666,8 +1650,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_read_eeprom(moal_private *priv, struct iwreq *wrq) +static int woal_read_eeprom(moal_private *priv, struct iwreq *wrq) { int data[2], copy_len; int ret = 0; @@ -1738,8 +1721,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_mem_read_write(moal_private *priv, struct iwreq *wrq) +static int woal_mem_read_write(moal_private *priv, struct iwreq *wrq) { t_u32 data[2]; int ret = 0; @@ -1811,6 +1793,144 @@ } /** + * @brief Set/Get network monitor configurations + * + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure + * + * @return 0 --success, otherwise fail + */ +static int woal_net_monitor_ioctl(moal_private *priv, struct iwreq *wrq) +{ + int user_data_len = wrq->u.data.length; + int data[5] = {0}, copy_len; + int ret = 0; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_net_monitor *net_mon = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + copy_len = MIN(sizeof(data), sizeof(int) * user_data_len); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + LEAVE(); + return -ENOMEM; + } + misc = (mlan_ds_misc_cfg *)req->pbuf; + net_mon = (mlan_ds_misc_net_monitor *)&misc->param.net_mon; + misc->sub_command = MLAN_OID_MISC_NET_MONITOR; + req->req_id = MLAN_IOCTL_MISC_CFG; + + if (!user_data_len) { + req->action = MLAN_ACT_GET; + } else if (user_data_len == 1 || user_data_len == 4 || + user_data_len == 5) { + if (copy_from_user(data, wrq->u.data.pointer, copy_len)) { + PRINTM(MERROR, "Copy from user failed\n"); + ret = -EFAULT; + goto done; + } + if (data[0] != MTRUE && data[0] != MFALSE) { + PRINTM(MERROR, + "NET_MON: Activity should be enable(=1)/disable(=0)\n"); + ret = -EINVAL; + goto done; + } + net_mon->enable_net_mon = data[0]; + if (data[0] == MTRUE) { + int i; + if (user_data_len != 4 && user_data_len != 5) { + PRINTM(MERROR, + "NET_MON: Invalid number of args!\n"); + ret = -EINVAL; + goto done; + } + /* Supported filter flags */ + if (!data[1] || data[1] & ~(MLAN_NETMON_DATA | + MLAN_NETMON_MANAGEMENT | + MLAN_NETMON_CONTROL)) { + PRINTM(MERROR, + "NET_MON: Invalid filter flag\n"); + ret = -EINVAL; + goto done; + } + /* Supported bands */ + for (i = 0; i < (int)sizeof(SupportedInfraBand); i++) + if (data[2] == SupportedInfraBand[i]) + break; + if (i == sizeof(SupportedInfraBand)) { + PRINTM(MERROR, "NET_MON: Invalid band\n"); + ret = -EINVAL; + goto done; + } + /* Supported channel */ + if (data[3] < 1 || data[3] > MLAN_MAX_CHANNEL) { + PRINTM(MERROR, + "NET_MON: Invalid channel number\n"); + ret = -EINVAL; + goto done; + } + if (user_data_len == 5) { + /* Secondary channel offset */ + if (!(data[2] & (BAND_GN | BAND_AN))) { + PRINTM(MERROR, + "No 11n in band, can not set " + "secondary channel offset\n"); + ret = -EINVAL; + goto done; + } + if ((data[4] != CHANNEL_BW_20MHZ) && + (data[4] != CHANNEL_BW_40MHZ_ABOVE) && + (data[4] != CHANNEL_BW_40MHZ_BELOW) && + (data[4] != CHANNEL_BW_80MHZ)) { + PRINTM(MERROR, + "Invalid secondary channel bandwidth, " + "only allowed 0, 1, 3 or 4\n"); + ret = -EINVAL; + goto done; + } + net_mon->chan_bandwidth = data[4]; + } + net_mon->filter_flag = data[1]; + net_mon->band = data[2]; + net_mon->channel = data[3]; + } + req->action = MLAN_ACT_SET; + } else { + PRINTM(MERROR, "NET_MON: Invalid number of args!\n"); + ret = -EINVAL; + goto done; + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + + data[0] = net_mon->enable_net_mon; + data[1] = net_mon->filter_flag; + data[2] = net_mon->band; + data[3] = net_mon->channel; + data[4] = net_mon->chan_bandwidth; + wrq->u.data.length = 5; + if (copy_to_user(wrq->u.data.pointer, data, + sizeof(int) * wrq->u.data.length)) { + PRINTM(MERROR, "Copy to user failed\n"); + ret = -EFAULT; + goto done; + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** * @brief Get LOG * * @param priv A pointer to moal_private structure @@ -1818,8 +1938,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_log(moal_private *priv, struct iwreq *wrq) +static int woal_get_log(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_get_stats stats; @@ -1970,7 +2089,8 @@ stats.ampdu_delimiter_crc_error_cnt); } wrq->u.data.length = MIN(GETLOG_BUFSIZE - 1, strlen(buf) + 1); - if (copy_to_user(wrq->u.data.pointer, buf, wrq->u.data.length)) { + if (copy_to_user(wrq->u.data.pointer, buf, + wrq->u.data.length)) { PRINTM(MERROR, "Copy to user failed\n"); ret = -EFAULT; } @@ -1989,8 +2109,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_deauth(moal_private *priv, struct iwreq *wrq) +static int woal_deauth(moal_private *priv, struct iwreq *wrq) { int ret = 0; struct sockaddr saddr; @@ -1998,7 +2117,8 @@ ENTER(); if (wrq->u.data.length) { /* Deauth mentioned BSSID */ - if (copy_from_user(&saddr, wrq->u.data.pointer, sizeof(saddr))) { + if (copy_from_user(&saddr, wrq->u.data.pointer, + sizeof(saddr))) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; @@ -2029,8 +2149,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_tx_power_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_tx_power_cfg(moal_private *priv, struct iwreq *wrq) { int data[5], user_data_len, copy_len; int ret = 0; @@ -2174,8 +2293,8 @@ data[1]; pcfg->param.power_ext.power_group[0].power_max = data[2]; - pcfg->param.power_ext.power_group[0]. - power_step = data[3]; + pcfg->param.power_ext.power_group[0].power_step = + data[3]; } pcfg->param.power_ext.num_pwr_grp = 1; } @@ -2241,8 +2360,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_txrx_rate(moal_private *priv, struct iwreq *wrq) +static int woal_get_txrx_rate(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_rate *rate = NULL; @@ -2289,8 +2407,7 @@ * * @return 0/MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_sdio_clock_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_sdio_clock_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; int data = 2; @@ -2346,8 +2463,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_beacon_interval(moal_private *priv, struct iwreq *wrq) +static int woal_beacon_interval(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_bss *bss = NULL; @@ -2412,8 +2528,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_txrate(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_txrate(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_rate *rate = NULL; @@ -2489,8 +2604,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_regioncode(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_regioncode(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_misc_cfg *cfg = NULL; @@ -2551,8 +2665,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_radio(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_radio(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_bss_info bss_info; @@ -2595,8 +2708,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_drv_dbg(moal_private *priv, struct iwreq *wrq) +static int woal_drv_dbg(moal_private *priv, struct iwreq *wrq) { int data[4], copy_len; int ret = 0; @@ -2682,8 +2794,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_qos_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_qos_cfg(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_wmm_cfg *cfg = NULL; @@ -2741,8 +2852,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_wws_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_wws_cfg(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_misc_cfg *wws = NULL; @@ -2802,8 +2912,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_sleep_pd(moal_private *priv, struct iwreq *wrq) +static int woal_sleep_pd(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -2828,9 +2937,7 @@ goto done; } if ((data <= MAX_SLEEP_PERIOD && data >= MIN_SLEEP_PERIOD) || - (data == 0) - || (data == SLEEP_PERIOD_RESERVED_FF) - ) { + (data == 0) || (data == SLEEP_PERIOD_RESERVED_FF)) { req->action = MLAN_ACT_SET; pm_cfg->param.sleep_period = data; } else { @@ -2869,23 +2976,21 @@ * * @return 0 --success, otherwise fail */ -static int -woal_sleep_params_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_sleep_params_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ioctl_req *req = NULL; mlan_ds_pm_cfg *pm = NULL; mlan_ds_sleep_params *psleep_params = NULL; - int data[6] = { 0 }, i, copy_len; + int data[6] = {0}, i, copy_len; int data_length = wrq->u.data.length; #ifdef DEBUG_LEVEL1 - char err_str[][36] = { {"sleep clock error in ppm"}, - {"wakeup offset in usec"}, - {"clock stabilization time in usec"}, - {"control periodic calibration(0-2)"}, - {"control of external sleepClock(0-2)"}, - {"value of reserved for debug"} - }; + char err_str[][36] = {{"sleep clock error in ppm"}, + {"wakeup offset in usec"}, + {"clock stabilization time in usec"}, + {"control periodic calibration(0-2)"}, + {"control of external sleepClock(0-2)"}, + {"value of reserved for debug"}}; #endif mlan_status status = MLAN_STATUS_SUCCESS; @@ -2912,6 +3017,7 @@ ret = -EINVAL; goto done; } + #define MIN_VAL 0x0000 #define MAX_VAL 0xFFFF for (i = 0; i < 6; i++) { @@ -2985,8 +3091,8 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_set_get_11h_local_pwr_constraint(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_11h_local_pwr_constraint(moal_private *priv, + struct iwreq *wrq) { int ret = 0, data = 0; mlan_ioctl_req *req = NULL; @@ -3046,8 +3152,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_ht_stream_cfg_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_ht_stream_cfg_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data = 0; mlan_ioctl_req *req = NULL; @@ -3110,8 +3215,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_mac_control_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_mac_control_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data = 0; mlan_ioctl_req *req = NULL; @@ -3170,8 +3274,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_thermal_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_thermal_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data = 0; mlan_ioctl_req *req = NULL; @@ -3226,8 +3329,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_cfg_hotspot(moal_private *priv, struct iwreq *wrq) +static int woal_cfg_hotspot(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -3293,8 +3395,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_reassoc(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_reassoc(moal_private *priv, struct iwreq *wrq) { moal_handle *handle = priv->phandle; int ret = 0; @@ -3344,8 +3445,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_wmm_enable_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_enable_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_wmm_cfg *wmm = NULL; @@ -3415,8 +3515,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11d_enable_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_11d_enable_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_11d_cfg *pcfg_11d = NULL; @@ -3486,8 +3585,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_11d_clr_chan_table(moal_private *priv, struct iwreq *wrq) +static int woal_11d_clr_chan_table(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_11d_cfg *pcfg_11d = NULL; @@ -3528,8 +3626,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_wps_cfg_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wps_cfg_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_wps_cfg *pwps = NULL; @@ -3586,8 +3683,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_passphrase(moal_private *priv, struct iwreq *wrq) +static int woal_passphrase(moal_private *priv, struct iwreq *wrq) { t_u16 len = 0; char buf[256]; @@ -3595,7 +3691,7 @@ int ret = 0, action = -1, i; mlan_ds_sec_cfg *sec = NULL; mlan_ioctl_req *req = NULL; - t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u8 *mac = NULL; int data_length = wrq->u.data.length, copy_len; mlan_status status = MLAN_STATUS_SUCCESS; @@ -3679,9 +3775,9 @@ ret = -EINVAL; break; } - woal_ascii2hex((t_u8 *)(sec->param.passphrase.psk.pmk. - pmk), end, - MLAN_PMK_HEXSTR_LENGTH / 2); + woal_ascii2hex( + (t_u8 *)(sec->param.passphrase.psk.pmk.pmk), + end, MLAN_PMK_HEXSTR_LENGTH / 2); sec->param.passphrase.psk_type = MLAN_PSK_PMK; } else if (!strnicmp(opt, "passphrase", strlen(opt)) && req->action == MLAN_ACT_SET) { @@ -3693,19 +3789,20 @@ break; } sec->param.passphrase.psk_type = MLAN_PSK_PASSPHRASE; - moal_memcpy_ext(priv->phandle, - sec->param.passphrase.psk.passphrase. - passphrase, end, - sizeof(sec->param.passphrase.psk. - passphrase.passphrase), - sizeof(sec->param.passphrase.psk. - passphrase.passphrase)); + moal_memcpy_ext( + priv->phandle, + sec->param.passphrase.psk.passphrase.passphrase, + end, + sizeof(sec->param.passphrase.psk.passphrase + .passphrase), + sizeof(sec->param.passphrase.psk.passphrase + .passphrase)); sec->param.passphrase.psk.passphrase.passphrase_len = strlen(end); PRINTM(MINFO, "passphrase=%s, len=%d\n", sec->param.passphrase.psk.passphrase.passphrase, - (int)sec->param.passphrase.psk.passphrase. - passphrase_len); + (int)sec->param.passphrase.psk.passphrase + .passphrase_len); } else { PRINTM(MERROR, "Invalid option %s\n", opt); ret = -EINVAL; @@ -3747,15 +3844,15 @@ if (sec->param.passphrase.psk_type == MLAN_PSK_PMK) { len += sprintf(buf + len, "psk:"); for (i = 0; i < MLAN_MAX_KEY_LENGTH; ++i) - len += sprintf(buf + len, "%02x", - sec->param.passphrase.psk.pmk. - pmk[i]); + len += sprintf( + buf + len, "%02x", + sec->param.passphrase.psk.pmk.pmk[i]); len += sprintf(buf + len, "\n"); } if (sec->param.passphrase.psk_type == MLAN_PSK_PASSPHRASE) { - len += sprintf(buf + len, "passphrase:%s\n", - sec->param.passphrase.psk.passphrase. - passphrase); + len += sprintf( + buf + len, "passphrase:%s\n", + sec->param.passphrase.psk.passphrase.passphrase); } if (wrq->u.data.pointer) { if (copy_to_user(wrq->u.data.pointer, buf, @@ -3783,8 +3880,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_esupp_mode(moal_private *priv, struct iwreq *wrq) +static int woal_get_esupp_mode(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_sec_cfg *sec = NULL; @@ -3835,8 +3931,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_key_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_get_key_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; unsigned int i; @@ -3948,8 +4043,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_arp_filter(moal_private *priv, struct iwreq *wrq) +static int woal_arp_filter(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_misc_cfg *misc = NULL; @@ -4000,8 +4094,7 @@ * @param wrq A pointer to iwreq structure * @return 0 --success, otherwise fail */ -static int -woal_set_get_ip_addr(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_ip_addr(moal_private *priv, struct iwreq *wrq) { char buf[IPADDR_MAX_BUF]; mlan_ioctl_req *ioctl_req = NULL; @@ -4019,7 +4112,7 @@ } misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; - if (data_length <= 1) { /* GET */ + if (data_length <= 1) { /* GET */ ioctl_req->action = MLAN_ACT_GET; } else { if (copy_from_user(buf, wrq->u.data.pointer, @@ -4090,8 +4183,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_tx_bf_cap_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_tx_bf_cap_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data_length = wrq->u.data.length; mlan_ioctl_req *req = NULL; @@ -4118,7 +4210,7 @@ req->req_id = MLAN_IOCTL_11N_CFG; bf_cfg->sub_command = MLAN_OID_11N_CFG_TX_BF_CAP; req->action = MLAN_ACT_GET; - if (data_length) { /* SET */ + if (data_length) { /* SET */ if (copy_from_user(&bf_cap, wrq->u.data.pointer, sizeof(int))) { PRINTM(MERROR, "copy from user failed\n"); ret = -EFAULT; @@ -4169,8 +4261,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_tx_bf_cfg_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_tx_bf_cfg_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data_length = wrq->u.data.length; int bf_action = 0, interval = 0; @@ -4494,9 +4585,9 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -moal_ret_get_scan_table_ioctl(struct iwreq *wrq, - mlan_scan_resp *scan_resp, t_u32 scan_start) +static int moal_ret_get_scan_table_ioctl(struct iwreq *wrq, + mlan_scan_resp *scan_resp, + t_u32 scan_start) { pBSSDescriptor_t pbss_desc, scan_table; wlan_ioctl_get_scan_table_info *prsp_info; @@ -4549,10 +4640,8 @@ "GetScanTable: get current BSS Descriptor [%d]\n", scan_start + num_scans_done); - ret_code = - wlan_get_scan_table_ret_entry(pbss_desc, - &pcurrent, - &space_left); + ret_code = wlan_get_scan_table_ret_entry( + pbss_desc, &pcurrent, &space_left); if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done++; @@ -4580,8 +4669,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_get_scan_table_ioctl(moal_private *priv, struct iwreq *wrq) +static mlan_status woal_get_scan_table_ioctl(moal_private *priv, + struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_scan *scan = NULL; @@ -4615,9 +4704,8 @@ /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status == MLAN_STATUS_SUCCESS) { - status = moal_ret_get_scan_table_ioctl(wrq, - &scan->param.scan_resp, - scan_start); + status = moal_ret_get_scan_table_ioctl( + wrq, &scan->param.scan_resp, scan_start); } done: if (status != MLAN_STATUS_PENDING) @@ -4634,21 +4722,30 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_set_user_scan_ext_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_set_user_scan_ext_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; - wlan_user_scan_cfg scan_req; + wlan_user_scan_cfg *scan_req; ENTER(); - memset(&scan_req, 0x00, sizeof(scan_req)); - if (copy_from_user(&scan_req, wrq->u.data.pointer, - MIN(wrq->u.data.length, sizeof(scan_req)))) { + scan_req = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + memset(scan_req, 0x00, sizeof(wlan_user_scan_cfg)); + if (copy_from_user(scan_req, wrq->u.data.pointer, + MIN(wrq->u.data.length, + sizeof(wlan_user_scan_cfg)))) { PRINTM(MINFO, "Copy from user failed\n"); + kfree(scan_req); LEAVE(); return -EFAULT; } - if (MLAN_STATUS_FAILURE == woal_do_scan(priv, &scan_req)) + if (MLAN_STATUS_FAILURE == woal_do_scan(priv, scan_req)) ret = -EFAULT; + kfree(scan_req); LEAVE(); return ret; } @@ -4662,8 +4759,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_set_user_scan_ioctl(moal_private *priv, struct iwreq *wrq) +static mlan_status woal_set_user_scan_ioctl(moal_private *priv, + struct iwreq *wrq) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -4733,8 +4830,7 @@ * @param wrq A pointer to iwreq structure * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_cmd52rdwr_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_cmd52rdwr_ioctl(moal_private *priv, struct iwreq *wrq) { t_u8 rw = 0, func, data = 0; int buf[3], reg, ret = MLAN_STATUS_SUCCESS; @@ -4748,7 +4844,8 @@ goto done; } - if (copy_from_user(buf, wrq->u.data.pointer, sizeof(int) * data_length)) { + if (copy_from_user(buf, wrq->u.data.pointer, + sizeof(int) * data_length)) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; @@ -4762,11 +4859,11 @@ } reg = (t_u32)buf[1]; if (data_length == 2) { - rw = 0; /* CMD52 read */ + rw = 0; /* CMD52 read */ PRINTM(MINFO, "Cmd52 read, func=%d, reg=0x%08X\n", func, reg); } if (data_length == 3) { - rw = 1; /* CMD52 write */ + rw = 1; /* CMD52 write */ data = (t_u8)buf[2]; PRINTM(MINFO, "Cmd52 write, func=%d, reg=0x%08X, data=0x%02X\n", func, reg, data); @@ -4774,18 +4871,20 @@ if (!rw) { #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - data = sdio_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); + data = sdio_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); else - data = sdio_f0_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + data = sdio_f0_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -4793,7 +4892,8 @@ goto done; } #else - if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < 0) { + if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < + 0) { PRINTM(MERROR, "sdio_read_ioreg: reading register 0x%X failed\n", reg); @@ -4803,18 +4903,20 @@ #endif } else { #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - sdio_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); + sdio_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); else - sdio_f0_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_f0_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", @@ -4822,7 +4924,8 @@ goto done; } #else - if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < 0) { + if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < + 0) { PRINTM(MERROR, "sdio_write_ioreg: writing register 0x%X failed\n", reg); @@ -4852,8 +4955,7 @@ * @param wrq A pointer to iwreq structure * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_cmd53rdwr_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_cmd53rdwr_ioctl(moal_private *priv, struct iwreq *wrq) { t_u8 *buf = NULL; t_u8 rw, mode; @@ -4887,15 +4989,15 @@ goto done; } - rw = buf[0]; /* read/write (0/1) */ - reg = buf[5]; /* address */ + rw = buf[0]; /* read/write (0/1) */ + reg = buf[5]; /* address */ reg = (reg << 8) + buf[4]; reg = (reg << 8) + buf[3]; reg = (reg << 8) + buf[2]; - mode = buf[6]; /* byte mode/block mode (0/1) */ - blklen = buf[8]; /* block size */ + mode = buf[6]; /* byte mode/block mode (0/1) */ + blklen = buf[8]; /* block size */ blklen = (blklen << 8) + buf[7]; - blknum = buf[10]; /* block number or byte number */ + blknum = buf[10]; /* block number or byte number */ blknum = (blknum << 8) + buf[9]; if (mode != BYTE_MODE) @@ -4911,16 +5013,16 @@ reg, mode, blklen, blknum); if (!rw) { - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); - if (sdio_readsb - (((struct sdio_mmc_card *)priv->phandle->card)->func, data, - reg, total_len)) + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_readsb( + ((struct sdio_mmc_card *)priv->phandle->card)->func, + data, reg, total_len)) PRINTM(MERROR, "sdio_readsb: reading memory 0x%x failed\n", reg); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (copy_to_user(wrq->u.data.pointer, data, total_len)) { PRINTM(MINFO, "Copy to user failed\n"); @@ -4938,16 +5040,16 @@ for (pos = 0; pos < (int)total_len; pos++) data[pos] = buf[11 + (pos % pattern_len)]; - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); - if (sdio_writesb - (((struct sdio_mmc_card *)priv->phandle->card)->func, reg, - data, total_len)) + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_writesb( + ((struct sdio_mmc_card *)priv->phandle->card)->func, + reg, data, total_len)) PRINTM(MERROR, "sdio_writesb: writing memory 0x%x failed\n", reg); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); } done: @@ -4967,8 +5069,7 @@ * * @return 0/MLAN_STATUS_PENDING --success, otherwise fail */ -static int -woal_do_sdio_mpa_ctrl(moal_private *priv, struct iwreq *wrq) +static int woal_do_sdio_mpa_ctrl(moal_private *priv, struct iwreq *wrq) { int data[6], data_length = wrq->u.data.length, copy_len; int ret = 0; @@ -5086,8 +5187,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_scan_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_scan_cfg(moal_private *priv, struct iwreq *wrq) { int ret = 0; int data[7], copy_len; @@ -5185,8 +5285,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_ps_cfg(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_ps_cfg(moal_private *priv, struct iwreq *wrq) { int data[7], copy_len, ret = 0; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -5198,8 +5297,8 @@ ENTER(); - allowed++; /* For beacon missing timeout parameter */ - allowed += 2; /* For delay to PS and PS mode parameters */ + allowed++; /* For beacon missing timeout parameter */ + allowed += 2; /* For delay to PS and PS mode parameters */ copy_len = MIN(sizeof(data), sizeof(int) * data_length); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_pm_cfg)); @@ -5284,7 +5383,8 @@ } moal_memcpy_ext(priv->phandle, data, &pm_cfg->param.ps_cfg, MIN((sizeof(int) * allowed), - sizeof(pm_cfg->param.ps_cfg)), sizeof(data)); + sizeof(pm_cfg->param.ps_cfg)), + sizeof(data)); if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * allowed)) { ret = -EFAULT; goto done; @@ -5342,8 +5442,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_addts_req_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_addts_req_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *cfg = NULL; @@ -5444,8 +5543,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_delts_req_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_delts_req_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *cfg = NULL; @@ -5530,8 +5628,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_queue_config_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_queue_config_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -5609,8 +5706,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_queue_stats_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_queue_stats_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -5693,8 +5789,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_queue_status_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_queue_status_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -5753,8 +5848,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_wmm_ts_status_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_wmm_ts_status_ioctl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_wmm_cfg *pwmm = NULL; @@ -5826,8 +5920,7 @@ * * @return 0 if successful; IOCTL error code otherwise */ -static int -woal_bypassed_packet_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_bypassed_packet_ioctl(moal_private *priv, struct iwreq *wrq) { int ret = 0; struct sk_buff *skb = NULL; @@ -5839,7 +5932,7 @@ copyLen = wrq->u.data.length; moreLen = MLAN_MIN_DATA_HEADER_LEN + MLAN_BYPASS_PKT_EXTRA_OFFSET + - sizeof(mlan_buffer); + sizeof(mlan_buffer); skb = alloc_skb(copyLen + moreLen, GFP_KERNEL); if (skb == NULL) { @@ -5850,7 +5943,8 @@ skb_reserve(skb, moreLen); - if (copy_from_user(skb_put(skb, copyLen), wrq->u.data.pointer, copyLen)) { + if (copy_from_user(skb_put(skb, copyLen), wrq->u.data.pointer, + copyLen)) { PRINTM(MERROR, "PortBlock: copy from user failed\n"); dev_kfree_skb_any(skb); ret = -EFAULT; @@ -5877,8 +5971,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_auth_type(moal_private *priv, struct iwreq *wrq) +static int woal_auth_type(moal_private *priv, struct iwreq *wrq) { int auth_type; t_u32 auth_mode; @@ -5933,8 +6026,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_port_ctrl(moal_private *priv, struct iwreq *wrq) +static int woal_port_ctrl(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -5998,8 +6090,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_dfs_testing(moal_private *priv, struct iwreq *wrq) +static int woal_dfs_testing(moal_private *priv, struct iwreq *wrq) { mlan_ioctl_req *req = NULL; mlan_ds_11h_cfg *ds_11hcfg = NULL; @@ -6096,8 +6187,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_mgmt_frame_passthru_ctrl(moal_private *priv, struct iwreq *wrq) +static int woal_mgmt_frame_passthru_ctrl(moal_private *priv, struct iwreq *wrq) { int ret = 0, data_length = wrq->u.data.length; mlan_ioctl_req *req = NULL; @@ -6124,7 +6214,7 @@ req->req_id = MLAN_IOCTL_MISC_CFG; mgmt_cfg->sub_command = MLAN_OID_MISC_RX_MGMT_IND; - if (data_length) { /* SET */ + if (data_length) { /* SET */ if (copy_from_user(&mask, wrq->u.data.pointer, sizeof(int))) { PRINTM(MERROR, "copy from user failed\n"); ret = -EFAULT; @@ -6165,8 +6255,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_cfp_code(moal_private *priv, struct iwreq *wrq) +static int woal_cfp_code(moal_private *priv, struct iwreq *wrq) { int ret = 0; int data[2], copy_len; @@ -6247,13 +6336,12 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_get_tx_rx_ant(moal_private *priv, struct iwreq *wrq) +static int woal_set_get_tx_rx_ant(moal_private *priv, struct iwreq *wrq) { int ret = 0; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *req = NULL; - int data[3] = { 0 }; + int data[3] = {0}; mlan_status status = MLAN_STATUS_SUCCESS; int copy_len; @@ -6342,10 +6430,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_ind_rst_ioctl(moal_private *priv, struct iwreq *wrq) +static int woal_ind_rst_ioctl(moal_private *priv, struct iwreq *wrq) { - int data[2], data_length = wrq->u.data.length, copy_len; + int data[2] = {0}, data_length = wrq->u.data.length, copy_len; int ret = 0; mlan_ds_misc_cfg *misc = NULL; mlan_ioctl_req *req = NULL; @@ -6442,8 +6529,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_wext_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +int woal_wext_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iwreq *wrq = (struct iwreq *)req; @@ -6458,10 +6544,10 @@ switch (cmd) { case WOAL_SETONEINT_GETWORDCHAR: switch (wrq->u.data.flags) { - case WOAL_VERSION: /* Get driver version */ + case WOAL_VERSION: /* Get driver version */ ret = woal_get_driver_version(priv, req); break; - case WOAL_VEREXT: /* Get extended driver version */ + case WOAL_VEREXT: /* Get extended driver version */ ret = woal_get_driver_verext(priv, req); break; default: @@ -6640,6 +6726,9 @@ case WOAL_SLEEP_PARAMS: ret = woal_sleep_params_ioctl(priv, wrq); break; + case WOAL_NET_MONITOR: + ret = woal_net_monitor_ioctl(priv, wrq); + break; case WOAL_DFS_TESTING: ret = woal_dfs_testing(priv, wrq); break; @@ -6802,8 +6891,8 @@ case WOAL_FROYO_STOP: if (IS_UAP_WEXT(priv->phandle->params.cfg80211_wext) && MLAN_STATUS_SUCCESS != - woal_disconnect(priv, MOAL_IOCTL_WAIT, NULL, - DEF_DEAUTH_REASON_CODE)) { + woal_disconnect(priv, MOAL_IOCTL_WAIT, NULL, + DEF_DEAUTH_REASON_CODE)) { ret = -EFAULT; } break; @@ -6827,9 +6916,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_data_rates(moal_private *priv, t_u8 wait_option, - moal_802_11_rates *m_rates) +mlan_status woal_get_data_rates(moal_private *priv, t_u8 wait_option, + moal_802_11_rates *m_rates) { mlan_ds_rate *rate = NULL; mlan_ioctl_req *req = NULL; @@ -6853,11 +6941,9 @@ status = woal_request_ioctl(priv, req, wait_option); if (status == MLAN_STATUS_SUCCESS) { if (m_rates) - m_rates->num_of_rates = - woal_copy_rates(m_rates->rates, - m_rates->num_of_rates, - rate->param.rates, - MLAN_SUPPORTED_RATES); + m_rates->num_of_rates = woal_copy_rates( + m_rates->rates, m_rates->num_of_rates, + rate->param.rates, MLAN_SUPPORTED_RATES); } done: if (status != MLAN_STATUS_PENDING) @@ -6876,9 +6962,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -mlan_status -woal_get_channel_list(moal_private *priv, t_u8 wait_option, - mlan_chan_list *chan_list) +mlan_status woal_get_channel_list(moal_private *priv, t_u8 wait_option, + mlan_chan_list *chan_list) { mlan_ds_bss *bss = NULL; mlan_ioctl_req *req = NULL; @@ -6923,8 +7008,7 @@ * * @return N/A */ -void -woal_ioctl_get_info_resp(moal_private *priv, mlan_ds_get_info *info) +void woal_ioctl_get_info_resp(moal_private *priv, mlan_ds_get_info *info) { ENTER(); switch (info->sub_command) { @@ -6955,8 +7039,7 @@ * * @return N/A */ -void -woal_ioctl_get_bss_resp(moal_private *priv, mlan_ds_bss *bss) +void woal_ioctl_get_bss_resp(moal_private *priv, mlan_ds_bss *bss) { t_u32 mode = 0;
diff --git a/wlan_sd8987/mlinux/moal_priv.h b/wlan_sd8987/mlinux/moal_priv.h index 7f6d2f6..c35ef67 100755 --- a/wlan_sd8987/mlinux/moal_priv.h +++ b/wlan_sd8987/mlinux/moal_priv.h
@@ -4,7 +4,7 @@ * @brief This file contains definition for extended private IOCTL call. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -33,7 +33,7 @@ #define WOAL_2K_BYTES 2000 /** PRIVATE CMD ID */ -#define WOAL_IOCTL (SIOCIWFIRSTPRIV) /* 0x8BE0 defined in wireless.h */ +#define WOAL_IOCTL (SIOCIWFIRSTPRIV) /* 0x8BE0 defined in wireless.h */ /** Private command ID to set one int/get word char */ #define WOAL_SETONEINT_GETWORDCHAR (WOAL_IOCTL + 1) @@ -130,6 +130,8 @@ #define WOAL_ADDBA_REJECT 27 /** Private command ID to set/get sleep parameters */ #define WOAL_SLEEP_PARAMS 28 +/** Private command ID to set/get network monitor */ +#define WOAL_NET_MONITOR 30 /** Private command ID to set/get TX BF capabilities */ #define WOAL_TX_BF_CAP 31 /** Private command ID to set/get dfs testing settings */
diff --git a/wlan_sd8987/mlinux/moal_proc.c b/wlan_sd8987/mlinux/moal_proc.c index 72efd84..8cff3c5 100755 --- a/wlan_sd8987/mlinux/moal_proc.c +++ b/wlan_sd8987/mlinux/moal_proc.c
@@ -3,7 +3,7 @@ * @brief This file contains functions for proc file. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -29,6 +29,10 @@ #ifdef UAP_SUPPORT #include "moal_uap.h" #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#include "moal_cfg80211.h" +#include "moal_cfg80211_util.h" +#endif #ifdef SDIO #include "moal_sdio.h" #endif @@ -60,6 +64,9 @@ }; #endif +mlan_status parse_arguments(t_u8 *pos, int *data, int datalen, + int *user_data_len); + /******************************************************** Global Variables ********************************************************/ @@ -76,12 +83,12 @@ * * @return Number of output data */ -static int -woal_info_proc_read(struct seq_file *sfp, void *data) +static int woal_info_proc_read(struct seq_file *sfp, void *data) { struct net_device *netdev = (struct net_device *)sfp->private; char fmt[MLAN_MAX_VER_STR_LEN]; moal_private *priv = (moal_private *)netdev_priv(netdev); + mlan_fw_info fw_info; #ifdef STA_SUPPORT int i = 0; moal_handle *handle = NULL; @@ -106,6 +113,8 @@ t_u8 c[4]; } ver; + fw_info.uuid_lo = fw_info.uuid_hi = 0x0ULL; + ENTER(); if (priv == NULL) @@ -125,7 +134,8 @@ #ifdef UAP_SUPPORT memset(&ustats, 0, sizeof(ustats)); if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { - seq_printf(sfp, "driver_name = " "\"uap\"\n"); + seq_printf(sfp, "driver_name = " + "\"uap\"\n"); woal_uap_get_version(priv, fmt, sizeof(fmt) - 1); if (MLAN_STATUS_SUCCESS != woal_uap_get_stats(priv, MOAL_IOCTL_WAIT, &ustats)) { @@ -134,7 +144,7 @@ return -EFAULT; } } -#endif /* UAP_SUPPORT */ +#endif /* UAP_SUPPORT*/ #ifdef STA_SUPPORT memset(&info, 0, sizeof(info)); if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { @@ -145,7 +155,8 @@ LEAVE(); return -EFAULT; } - seq_printf(sfp, "driver_name = " "\"wlan\"\n"); + seq_printf(sfp, "driver_name = " + "\"wlan\"\n"); } #endif seq_printf(sfp, "driver_version = %s", fmt); @@ -153,6 +164,11 @@ ver.l = handle->fw_release_number; seq_printf(sfp, "firmware_major_version=%u.%u.%u\n", ver.c[2], ver.c[1], ver.c[0]); + + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + if (fw_info.uuid_lo || fw_info.uuid_hi) + seq_printf(sfp, "uuid = %llx%llx\n", fw_info.uuid_lo, + fw_info.uuid_hi); #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) @@ -167,7 +183,7 @@ #endif seq_printf(sfp, "media_state=\"%s\"\n", ((priv->media_connected == MFALSE) ? "Disconnected" : - "Connected")); + "Connected")); seq_printf(sfp, "mac_address=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2], netdev->dev_addr[3], @@ -188,21 +204,23 @@ */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) for (i = 0; i < netdev->mc_count; i++) { - seq_printf(sfp, - "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", - i, mcptr->dmi_addr[0], mcptr->dmi_addr[1], - mcptr->dmi_addr[2], mcptr->dmi_addr[3], - mcptr->dmi_addr[4], mcptr->dmi_addr[5]); + seq_printf( + sfp, + "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", + i, mcptr->dmi_addr[0], mcptr->dmi_addr[1], + mcptr->dmi_addr[2], mcptr->dmi_addr[3], + mcptr->dmi_addr[4], mcptr->dmi_addr[5]); mcptr = mcptr->next; } #else - netdev_for_each_mc_addr(mcptr, netdev) - seq_printf(sfp, - "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", - i++, mcptr->addr[0], mcptr->addr[1], - mcptr->addr[2], mcptr->addr[3], - mcptr->addr[4], mcptr->addr[5]); + netdev_for_each_mc_addr (mcptr, netdev) + seq_printf( + sfp, + "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", + i++, mcptr->addr[0], mcptr->addr[1], + mcptr->addr[2], mcptr->addr[3], mcptr->addr[4], + mcptr->addr[5]); #endif /* < 2.6.35 */ } #endif @@ -219,14 +237,15 @@ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) for (i = 0; i < (int)netdev->num_tx_queues; i++) { seq_printf(sfp, "tx queue %d: %s\n", i, - ((netif_tx_queue_stopped - (netdev_get_tx_queue(netdev, 0))) ? "stopped" : - "started")); + ((netif_tx_queue_stopped( + netdev_get_tx_queue(netdev, 0))) ? + "stopped" : + "started")); } #else seq_printf(sfp, "tx queue %s\n", ((netif_queue_stopped(priv->netdev)) ? "stopped" : - "started")); + "started")); #endif #ifdef UAP_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { @@ -352,10 +371,11 @@ return 0; } -static int -woal_info_proc_open(struct inode *inode, struct file *file) +static int woal_info_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_info_proc_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_info_proc_read, PDE_DATA(inode)); #else return single_open(file, woal_info_proc_read, PDE(inode)->data); @@ -391,23 +411,24 @@ * @param val Parsed value to set * @return BT_STATUS_SUCCESS */ -static int -parse_cmd52_string(const char *buffer, size_t len, int *func, - int *reg, int *val) +static int parse_cmd52_string(const char *buffer, size_t len, int *func, + int *reg, int *val) { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; + char *tmp; char *pos = NULL; gfp_t flag; ENTER(); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(CMD52_STR_LEN, flag); if (string == NULL) return -ENOMEM; moal_memcpy_ext(NULL, string, buffer + strlen("sdcmd52rw="), len - strlen("sdcmd52rw="), CMD52_STR_LEN - 1); + tmp = string; string = strstrip(string); *func = -1; @@ -428,12 +449,139 @@ pos = strsep(&string, " \t"); if (pos) *val = woal_string_to_number(pos); - kfree(string); + kfree(tmp); LEAVE(); return ret; } #endif +void woal_priv_get_tx_rx_ant(struct seq_file *sfp, moal_private *priv) +{ + int ret = 0; + int data[4] = {0}; + mlan_ds_radio_cfg *radio = NULL; + mlan_ioctl_req *req = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + if (sfp == NULL) { + PRINTM(MERROR, "Sequence file pointer null\n"); + LEAVE(); + return; + } + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg)); + if (req == NULL) { + PRINTM(MERROR, "Memory allocation failure \n"); + LEAVE(); + return; + } + radio = (mlan_ds_radio_cfg *)req->pbuf; + radio->sub_command = MLAN_OID_ANT_CFG; + req->req_id = MLAN_IOCTL_RADIO_CFG; + req->action = MLAN_ACT_GET; + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status == MLAN_STATUS_FAILURE) { + PRINTM(MERROR, "Failed to send IOCTL request to firmware\n"); + kfree(req); + LEAVE(); + return; + } + if (priv->phandle->feature_control & FEATURE_CTRL_STREAM_2X2) { + data[0] = radio->param.ant_cfg.tx_antenna; + data[1] = radio->param.ant_cfg.rx_antenna; + if (data[0] && data[1]) + ret = sizeof(int) * 2; + else + ret = sizeof(int) * 1; + if (ret == sizeof(int) * 1) + seq_printf(sfp, "antcfg=0x%x\n", data[0]); + else if (ret == sizeof(int) * 2) + seq_printf(sfp, "antcfg=0x%x 0x%x\n", data[0], data[1]); + + } else { + if (radio->param.ant_cfg_1x1.antenna == 0xffff) { + seq_printf( + sfp, "antcfg=0x%x %d %d\n", + (int)radio->param.ant_cfg_1x1.antenna, + (int)radio->param.ant_cfg_1x1.evaluate_time, + (int)radio->param.ant_cfg_1x1.current_antenna); + } else { + seq_printf(sfp, "antcfg=0x%x\n", + (int)radio->param.ant_cfg_1x1.antenna); + } + } + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return; +} + +mlan_status woal_priv_set_tx_rx_ant(moal_handle *handle, char *line) +{ + moal_private *priv = NULL; + mlan_ioctl_req *req = NULL; + mlan_ds_radio_cfg *radio = NULL; + mlan_status status; + int data[5] = {0}; + int user_data_len = 0; + + ENTER(); + memset((char *)data, 0, sizeof(data)); + parse_arguments(line, data, ARRAY_SIZE(data), &user_data_len); + + if (user_data_len > 2) { + PRINTM(MERROR, "Invalid number of args!\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + if (!priv) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Allocate an IOCTL request buffer */ + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_radio_cfg)); + if (req == NULL) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + /* Fill request buffer */ + radio = (mlan_ds_radio_cfg *)req->pbuf; + radio->sub_command = MLAN_OID_ANT_CFG; + req->req_id = MLAN_IOCTL_RADIO_CFG; + req->action = MLAN_ACT_SET; + + if (handle->feature_control & FEATURE_CTRL_STREAM_2X2) { + radio->param.ant_cfg.tx_antenna = data[0]; + radio->param.ant_cfg.rx_antenna = data[0]; + if (user_data_len == 2) + radio->param.ant_cfg.rx_antenna = data[1]; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + if (IS_CARD9098(priv->phandle->card_type) || + IS_CARD9097(priv->phandle->card_type)) { + woal_cfg80211_notify_antcfg(priv, priv->phandle->wiphy, + radio); + } +#endif + } else + radio->param.ant_cfg_1x1.antenna = data[0]; + if (user_data_len == 2) + radio->param.ant_cfg_1x1.evaluate_time = data[1]; + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} + /** * @brief config proc write function * @@ -444,11 +592,10 @@ * * @return number of data */ -static ssize_t -woal_config_write(struct file *f, const char __user * buf, - size_t count, loff_t * off) +static ssize_t woal_config_write(struct file *f, const char __user *buf, + size_t count, loff_t *off) { - char databuf[101]; + char databuf[200]; char *line = NULL; t_u32 config_data = 0; struct seq_file *sfp = f->private_data; @@ -504,8 +651,8 @@ if (IS_SD(handle->card_type)) { if (!strncmp(databuf, "sdcmd52rw=", strlen("sdcmd52rw=")) && count > strlen("sdcmd52rw=")) { - parse_cmd52_string((const char *)databuf, - (size_t) count, &func, ®, &val); + parse_cmd52_string((const char *)databuf, (size_t)count, + &func, ®, &val); woal_sdio_read_write_cmd52(handle, func, reg, val); } } @@ -520,18 +667,14 @@ if (ref_handle) { priv = woal_get_priv(ref_handle, MLAN_BSS_ROLE_ANY); if (priv) { -#ifdef DEBUG_LEVEL1 - drvdbg &= ~MFW_D; -#endif + handle->fw_dump_status = MTRUE; woal_mlan_debug_info(priv); woal_moal_debug_info(priv, NULL, MFALSE); } } priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (priv) { -#ifdef DEBUG_LEVEL1 - drvdbg &= ~MFW_D; -#endif + handle->fw_dump_status = MTRUE; woal_mlan_debug_info(priv); woal_moal_debug_info(priv, NULL, MFALSE); handle->ops.dump_fw_info(handle); @@ -543,13 +686,13 @@ gfp_t flag; if (len) { kfree(handle->fwdump_fname); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : - GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : + GFP_KERNEL; handle->fwdump_fname = kzalloc(len, flag); if (handle->fwdump_fname) moal_memcpy_ext(handle, handle->fwdump_fname, databuf + - strlen("fwdump_file="), + strlen("fwdump_file="), len - 1, len - 1); } } @@ -592,6 +735,11 @@ PRINTM(MMSG, "on=%d drop_point=%d\n", handle->tp_acnt.on, handle->tp_acnt.drop_point); } + if (!strncmp(databuf, "hssetpara=", strlen("hssetpara="))) { + line += strlen("hssetpara") + 1; + PRINTM(MCMND, "hssetpara=%s\n", line); + woal_process_proc_hssetpara(handle, line); + } if (!strncmp(databuf, "rf_test_mode", strlen("rf_test_mode"))) { line += strlen("rf_test_mode") + 1; config_data = (t_u32)woal_string_to_number(line); @@ -633,30 +781,37 @@ } if (!strncmp(databuf, "get_and_reset_per", strlen("get_and_reset_per"))) cmd = MFG_CMD_CLR_RX_ERR; - if (!strncmp(databuf, "tx_power=", strlen("tx_power=")) - && count > strlen("tx_power=")) + if (!strncmp(databuf, "tx_power=", strlen("tx_power=")) && + count > strlen("tx_power=")) cmd = MFG_CMD_RFPWR; - if (!strncmp(databuf, "tx_frame=", strlen("tx_frame=")) - && count > strlen("tx_frame=")) + if (!strncmp(databuf, "tx_frame=", strlen("tx_frame=")) && + count > strlen("tx_frame=")) cmd = MFG_CMD_TX_FRAME; - if (!strncmp(databuf, "tx_continuous=", strlen("tx_continuous=")) - && count > strlen("tx_continuous=")) + if (!strncmp(databuf, "tx_continuous=", strlen("tx_continuous=")) && + count > strlen("tx_continuous=")) cmd = MFG_CMD_TX_CONT; - if (!strncmp(databuf, "he_tb_tx=", strlen("he_tb_tx=")) - && count > strlen("he_tb_tx=")) + if (!strncmp(databuf, "he_tb_tx=", strlen("he_tb_tx=")) && + count > strlen("he_tb_tx=")) cmd = MFG_CMD_CONFIG_MAC_HE_TB_TX; - - if (cmd && handle->rf_test_mode - && (woal_process_rf_test_mode_cmd(handle, cmd, - (const char *)databuf, - (size_t) count, - MLAN_ACT_SET, - config_data) != - MLAN_STATUS_SUCCESS)) { + if (!strncmp(databuf, "trigger_frame=", strlen("trigger_frame=")) && + count > strlen("trigger_frame=")) + cmd = MFG_CMD_CONFIG_TRIGGER_FRAME; + if (cmd && handle->rf_test_mode && + (woal_process_rf_test_mode_cmd( + handle, cmd, (const char *)databuf, (size_t)count, + MLAN_ACT_SET, config_data) != MLAN_STATUS_SUCCESS)) { PRINTM(MERROR, "RF test mode cmd error\n"); } if (cmd && !handle->rf_test_mode) PRINTM(MERROR, "RF test mode is disabled\n"); + + if (!strncmp(databuf, "antcfg", strlen("antcfg"))) { + line += strlen("antcfg") + 1; + if (woal_priv_set_tx_rx_ant(handle, line) != + MLAN_STATUS_SUCCESS) + PRINTM(MERROR, "Could not set Antenna Diversity!!\n"); + } + MODULE_PUT; LEAVE(); return (int)count; @@ -670,11 +825,12 @@ * * @return number of output data */ -static int -woal_config_read(struct seq_file *sfp, void *data) +static int woal_config_read(struct seq_file *sfp, void *data) { moal_handle *handle = (moal_handle *)sfp->private; int i; + moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + mlan_ds_hs_cfg hscfg; ENTER(); @@ -686,6 +842,13 @@ seq_printf(sfp, "hardware_status=%d\n", (int)handle->hardware_status); seq_printf(sfp, "netlink_num=%d\n", (int)handle->netlink_num); seq_printf(sfp, "drv_mode=%d\n", (int)handle->params.drv_mode); + if (priv) { + memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg)); + woal_set_get_hs_params(priv, MLAN_ACT_GET, MOAL_IOCTL_WAIT, + &hscfg); + seq_printf(sfp, "hssetpara=%d,0x%x,%d,%d\n", hscfg.conditions, + hscfg.gpio, hscfg.gap, hscfg.hs_wake_interval); + } #ifdef SDIO if (IS_SD(handle->card_type)) { seq_printf(sfp, "sdcmd52rw=%d 0x%0x 0x%02X\n", @@ -752,7 +915,7 @@ seq_printf(sfp, " %u", handle->rf_data->tx_frame_data[i]); for (i = 13; i < 20; i++) - seq_printf(sfp, " %u", + seq_printf(sfp, " %d", handle->rf_data->tx_frame_data[i]); seq_printf(sfp, " %02x:%02x:%02x:%02x:%02x:%02x", handle->rf_data->bssid[0], @@ -761,7 +924,6 @@ handle->rf_data->bssid[3], handle->rf_data->bssid[4], handle->rf_data->bssid[5]); - } seq_printf(sfp, "\n"); seq_printf(sfp, "he_tb_tx=%u", handle->rf_data->he_tb_tx[0]); @@ -769,20 +931,127 @@ seq_printf(sfp, " %u", handle->rf_data->he_tb_tx[1]); seq_printf(sfp, " %u", handle->rf_data->he_tb_tx[2]); seq_printf(sfp, " %u", handle->rf_data->he_tb_tx[3]); - seq_printf(sfp, " %u", handle->rf_data->he_tb_tx[4]); + seq_printf(sfp, " %d", + handle->rf_data->he_tb_tx_power[0]); } seq_printf(sfp, "\n"); - + seq_printf(sfp, "trigger_frame=%u", + handle->rf_data->mfg_tx_trigger_config.enable_tx); + if (handle->rf_data->mfg_tx_trigger_config.enable_tx == MTRUE) { + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .standalone_hetb); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config.frmCtl + .type); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config.frmCtl + .sub_type); + seq_printf( + sfp, " %u", + handle->rf_data->mfg_tx_trigger_config.duration); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.trigger_type); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ul_len); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.more_tf); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.cs_required); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ul_bw); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ltf_type); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ltf_mode); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ltf_symbol); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ul_stbc); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ldpc_ess); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.ap_tx_pwr); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.pre_fec_pad_fct); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.pe_disambig); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.spatial_reuse); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.doppler); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_common_field.he_sig2); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.aid12); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ru_alloc_reg); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ru_alloc); + seq_printf( + sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ul_coding_type); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ul_mcs); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ul_dcm); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ss_alloc); + seq_printf( + sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .trig_user_info_field.ul_target_rssi); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .basic_trig_user_info.mpdu_mu_sf); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .basic_trig_user_info.tid_al); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .basic_trig_user_info.ac_pl); + seq_printf(sfp, " %u", + handle->rf_data->mfg_tx_trigger_config + .basic_trig_user_info.pref_ac); + } + seq_printf(sfp, "\n"); } + // Read current antcfg configuration + woal_priv_get_tx_rx_ant(sfp, priv); + MODULE_PUT; LEAVE(); return 0; } -static int -woal_config_proc_open(struct inode *inode, struct file *file) +static int woal_config_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_config_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_config_read, PDE_DATA(inode)); #else return single_open(file, woal_config_read, PDE(inode)->data); @@ -808,8 +1077,7 @@ }; #endif -static int -woal_drv_dump_read(struct seq_file *sfp, void *data) +static int woal_drv_dump_read(struct seq_file *sfp, void *data) { moal_handle *handle = (moal_handle *)sfp->private; int ret = 0; @@ -856,10 +1124,11 @@ return 0; } -static int -woal_drv_dump_proc_open(struct inode *inode, struct file *file) +static int woal_drv_dump_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_drv_dump_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_drv_dump_read, PDE_DATA(inode)); #else return single_open(file, woal_drv_dump_read, PDE(inode)->data); @@ -883,8 +1152,7 @@ }; #endif -static int -woal_fw_dump_read(struct seq_file *sfp, void *data) +static int woal_fw_dump_read(struct seq_file *sfp, void *data) { moal_handle *handle = (moal_handle *)sfp->private; int ret = 0; @@ -935,10 +1203,11 @@ return 0; } -static int -woal_fw_dump_proc_open(struct inode *inode, struct file *file) +static int woal_fw_dump_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_fw_dump_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_fw_dump_read, PDE_DATA(inode)); #else return single_open(file, woal_fw_dump_read, PDE(inode)->data); @@ -970,8 +1239,7 @@ * * @return number of output data */ -static int -woal_wifi_status_read(struct seq_file *sfp, void *data) +static int woal_wifi_status_read(struct seq_file *sfp, void *data) { ENTER(); @@ -987,10 +1255,11 @@ return 0; } -static int -woal_wifi_status_proc_open(struct inode *inode, struct file *file) +static int woal_wifi_status_proc_open(struct inode *inode, struct file *file) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + return single_open(file, woal_wifi_status_read, pde_data(inode)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) return single_open(file, woal_wifi_status_read, PDE_DATA(inode)); #else return single_open(file, woal_wifi_status_read, PDE(inode)->data); @@ -1024,8 +1293,7 @@ * * @return Converted number from string s */ -int -woal_string_to_number(char *s) +int woal_string_to_number(char *s) { int r = 0; int base = 0; @@ -1061,8 +1329,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_root_proc_init(void) +mlan_status woal_root_proc_init(void) { ENTER(); @@ -1090,8 +1357,7 @@ * * @return N/A */ -void -woal_root_proc_remove(void) +void woal_root_proc_remove(void) { ENTER(); @@ -1110,8 +1376,7 @@ * * @return N/A */ -void -woal_proc_init(moal_handle *handle) +void woal_proc_init(moal_handle *handle) { struct proc_dir_entry *r; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) @@ -1136,7 +1401,8 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) /* Check if directory already exists */ for (pde = pde->subdir; pde; pde = pde->next) { - if (pde->namelen && !strcmp(handle->proc_wlan_name, pde->name)) { + if (pde->namelen && + !strcmp(handle->proc_wlan_name, pde->name)) { /* Directory exists */ PRINTM(MWARN, "proc interface already exists!\n"); handle->proc_wlan = pde; @@ -1213,8 +1479,7 @@ * * @return N/A */ -void -woal_proc_exit(moal_handle *handle) +void woal_proc_exit(moal_handle *handle) { char config_proc_dir[20]; char drv_dump_dir[20]; @@ -1267,8 +1532,7 @@ * * @return N/A */ -void -woal_create_proc_entry(moal_private *priv) +void woal_create_proc_entry(moal_private *priv) { struct proc_dir_entry *r; struct net_device *dev = priv->netdev; @@ -1308,9 +1572,8 @@ } else { /* Failure. adapterX/ may not exist. Try to create that * first */ - priv->phandle->proc_wlan = - proc_mkdir(priv->phandle->proc_wlan_name, - proc_mwlan); + priv->phandle->proc_wlan = proc_mkdir( + priv->phandle->proc_wlan_name, proc_mwlan); if (!priv->phandle->proc_wlan) { /* Failure. Something broken */ LEAVE(); @@ -1359,8 +1622,7 @@ * * @return N/A */ -void -woal_proc_remove(moal_private *priv) +void woal_proc_remove(moal_private *priv) { ENTER(); if (priv->phandle->proc_wlan && priv->proc_entry) {
diff --git a/wlan_sd8987/mlinux/moal_sdio.h b/wlan_sd8987/mlinux/moal_sdio.h index a5d25ba..139a45e 100755 --- a/wlan_sd8987/mlinux/moal_sdio.h +++ b/wlan_sd8987/mlinux/moal_sdio.h
@@ -4,7 +4,7 @@ * driver. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -74,7 +74,7 @@ #endif /* SD8887_MULTI_FW */ #ifdef SD8801 -#define SD8801_DEFAULT_WLAN_FW_NAME "nxp/sd8801_uapsta.bin" +#define SD8801_DEFAULT_WLAN_FW_NAME "nxp/sd8801_uapsta.bin" #endif /* SD8801 */ /** Default firmware name */ @@ -139,15 +139,29 @@ #define SD9097_WLAN_V1_FW_NAME "nxp/sdiw620_wlan_v1.bin" #endif /* SD9097 */ +#ifdef SDNW62X +#define SDNW62X_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw62x.bin" +#define SDUARTNW62X_COMBO_FW_NAME "nxp/sduart_nw62x.bin" +#define SDSDNW62X_COMBO_FW_NAME "sdsd_nw62x.bin" +#define SDNW62X_DEFAULT_WLAN_FW_NAME "nxp/sd_nw62x.bin" +#endif /* SDNW62X */ + #ifdef SD9177 -#define SD9177_A0 0x01 +#define SD9177_A0 0x00 +#define SD9177_A1 0x01 #define SD9177_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw61x.bin" +#define SD9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sduart_nw61x_v1.bin" #define SDUART9177_DEFAULT_COMBO_FW_NAME "nxp/sduart_nw61x.bin" -#define SDSD9177_DEFAULT_COMBO_FW_NAME "sdsd_nw61x.bin" +#define SDSD9177_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw61x.bin" #define SD9177_DEFAULT_WLAN_FW_NAME "nxp/sd_w61x.bin" -/** Device ID for SD9177 */ -#define SD_DEVICE_ID_9177 (0x0205) +#define SDUART9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sduart_nw61x_v1.bin" +#define SDSD9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sdsd_nw61x_v1.bin" +#define SD9177_DEFAULT_WLAN_V1_FW_NAME "nxp/sd_w61x_v1.bin" +#define SDUART9177_DEFAULT_RFTM_COMBO_V1_FW_NAME "nxp/sduart_nw61x_rftm_v1.bin" +#define SDSD9177_DEFAULT_RFTM_COMBO_V1_FW_NAME "nxp/sdsd_nw61x_rftm_v1.bin" +#define SD9177_DEFAULT_RFTM_WLAN_V1_FW_NAME "nxp/sd_w61x_rftm_v1.bin" #endif /* SD9177 */ + /******************************************************** Global Functions ********************************************************/
diff --git a/wlan_sd8987/mlinux/moal_sdio_mmc.c b/wlan_sd8987/mlinux/moal_sdio_mmc.c index 02019a6..0e9cd4a 100755 --- a/wlan_sd8987/mlinux/moal_sdio_mmc.c +++ b/wlan_sd8987/mlinux/moal_sdio_mmc.c
@@ -4,7 +4,7 @@ * related functions. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -31,9 +31,7 @@ #include "moal_sdio.h" /** define nxp vendor id */ -#ifdef SD9177 #define NXP_VENDOR_ID 0x0471 -#endif #define MRVL_VENDOR_ID 0x02df /******************************************************** @@ -83,6 +81,14 @@ /** Device ID for SD9097 */ #define SD_DEVICE_ID_9097 (0x9155) #endif +#ifdef SD9177 +/** Device ID for SD9177 */ +#define SD_DEVICE_ID_9177 (0x0205) +#endif +#ifdef SDNW62X +/** Device ID for SDNW62X */ +#define SD_DEVICE_ID_NW62X (0x020D) +#endif /** WLAN IDs */ static const struct sdio_device_id wlan_ids[] = { @@ -117,6 +123,9 @@ #ifdef SD9177 {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_9177)}, #endif +#ifdef SDNW62X + {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_NW62X)}, +#endif {}, }; @@ -158,19 +167,18 @@ #endif #endif - } + } #else #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER .drv = { .pm = &wlan_sdio_pm_ops, .shutdown = woal_sdio_shutdown, - } + } #endif #endif #endif }; - // clang-format on /******************************************************** @@ -183,22 +191,22 @@ * @param handle A Pointer to the moal_handle structure * @return N/A */ -static void -woal_dump_sdio_reg(moal_handle *handle) +static void woal_dump_sdio_reg(moal_handle *handle) { int ret = 0; t_u8 data, i; - int fun0_reg[] = { 0x05, 0x04 }; + int fun0_reg[] = {0x05, 0x04}; t_u8 array_size = 0; #ifdef SD8897 - int fun1_reg_8897[] = { 0x03, 0x04, 0x05, 0x06, 0x07, 0xC0, 0xC1 }; + int fun1_reg_8897[] = {0x03, 0x04, 0x05, 0x06, 0x07, 0xC0, 0xC1}; #endif - int fun1_reg_other[] = { 0x03, 0x04, 0x05, 0x60, 0x61 }; + int fun1_reg_other[] = {0x03, 0x04, 0x05, 0x60, 0x61}; int *fun1_reg = NULL; for (i = 0; i < ARRAY_SIZE(fun0_reg); i++) { - data = sdio_f0_readb(((struct sdio_mmc_card *)handle->card)-> - func, fun0_reg[i], &ret); + data = sdio_f0_readb( + ((struct sdio_mmc_card *)handle->card)->func, + fun0_reg[i], &ret); PRINTM(MMSG, "fun0: reg 0x%02x=0x%02x ret=%d\n", fun0_reg[i], data, ret); } @@ -232,8 +240,7 @@ * @param func A pointer to the sdio_func structure * @return N/A */ -static void -woal_sdio_interrupt(struct sdio_func *func) +static void woal_sdio_interrupt(struct sdio_func *func) { moal_handle *handle; struct sdio_mmc_card *card; @@ -280,8 +287,7 @@ * * @return N/A */ -static t_u16 -woal_update_card_type(t_void *card) +static t_u16 woal_update_card_type(t_void *card) { struct sdio_mmc_card *cardp_sd = (struct sdio_mmc_card *)card; t_u16 card_type = 0; @@ -292,11 +298,12 @@ card_type = CARD_TYPE_SD8887; moal_memcpy_ext(NULL, driver_version, CARD_SD8887, strlen(CARD_SD8887), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V15, strlen(V15), - strlen(driver_version) - + V15, strlen(V15), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -305,11 +312,12 @@ card_type = CARD_TYPE_SD8801; moal_memcpy_ext(NULL, driver_version, CARD_SD8801, strlen(CARD_SD8801), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V14, strlen(V14), - strlen(driver_version) - + V14, strlen(V14), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -319,11 +327,12 @@ card_type = CARD_TYPE_SD8897; moal_memcpy_ext(NULL, driver_version, CARD_SD8897, strlen(CARD_SD8897), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V15, strlen(V15), - strlen(driver_version) - + V15, strlen(V15), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -332,11 +341,12 @@ card_type = CARD_TYPE_SD8977; moal_memcpy_ext(NULL, driver_version, CARD_SD8977, strlen(CARD_SD8977), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V16, strlen(V16), - strlen(driver_version) - + V16, strlen(V16), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -345,11 +355,12 @@ card_type = CARD_TYPE_SD8978; moal_memcpy_ext(NULL, driver_version, "SDIW416", strlen("SDIW416"), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V16, strlen(V16), - strlen(driver_version) - + V16, strlen(V16), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -358,11 +369,12 @@ card_type = CARD_TYPE_SD8997; moal_memcpy_ext(NULL, driver_version, CARD_SD8997, strlen(CARD_SD8997), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V16, strlen(V16), - strlen(driver_version) - + V16, strlen(V16), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -371,11 +383,26 @@ card_type = CARD_TYPE_SD8987; moal_memcpy_ext(NULL, driver_version, CARD_SD8987, strlen(CARD_SD8987), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V16, strlen(V16), - strlen(driver_version) - + V16, strlen(V16), + strlen(driver_version) - + (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); + } +#endif +#ifdef SDNW62X + if (cardp_sd->func->device == SD_DEVICE_ID_NW62X) { + card_type = CARD_TYPE_SDNW62X; + moal_memcpy_ext(NULL, driver_version, CARD_SDNW62X, + strlen(CARD_SDNW62X), strlen(driver_version)); + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + + strlen(KERN_VERSION), + V17, strlen(V17), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -384,11 +411,12 @@ card_type = CARD_TYPE_SD9097; moal_memcpy_ext(NULL, driver_version, CARD_SD9097, strlen(CARD_SD9097), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V17, strlen(V17), - strlen(driver_version) - + V17, strlen(V17), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -398,11 +426,12 @@ card_type = CARD_TYPE_SD9098; moal_memcpy_ext(NULL, driver_version, CARD_SD9098, strlen(CARD_SD9098), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V17, strlen(V17), - strlen(driver_version) - + V17, strlen(V17), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -411,11 +440,12 @@ card_type = CARD_TYPE_SD9177; moal_memcpy_ext(NULL, driver_version, CARD_SD9177, strlen(CARD_SD9177), strlen(driver_version)); - moal_memcpy_ext(NULL, - driver_version + strlen(INTF_CARDTYPE) + + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + strlen(KERN_VERSION), - V18, strlen(V18), - strlen(driver_version) - + V18, strlen(V18), + strlen(driver_version) - (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif @@ -428,8 +458,7 @@ * @param id A pointer to sdio_device_id structure. * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code */ -int -woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) +int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { int ret = MLAN_STATUS_SUCCESS; struct sdio_mmc_card *card = NULL; @@ -485,10 +514,11 @@ if (NULL == woal_add_card(card, &card->func->dev, &sdiommc_ops, card_type)) { - PRINTM(MERROR, "woal_add_card failed\n"); + PRINTM(MMSG, "woal_add_card failed\n"); ret = MLAN_STATUS_FAILURE; goto err; } + #ifdef IMX_SUPPORT woal_regist_oob_wakeup_irq(card->handle); #endif /* IMX_SUPPORT */ @@ -510,8 +540,7 @@ * @param func A pointer to sdio_func structure. * @return N/A */ -void -woal_sdio_remove(struct sdio_func *func) +void woal_sdio_remove(struct sdio_func *func) { struct sdio_mmc_card *card; @@ -540,14 +569,13 @@ * @param handle A Pointer to the moal_handle structure * @return N/A */ -void -woal_wlan_is_suspended(moal_handle *handle) +void woal_wlan_is_suspended(moal_handle *handle) { ENTER(); if (handle->suspend_notify_req == MTRUE) { handle->is_suspended = MTRUE; - sdio_func_suspended(((struct sdio_mmc_card *)handle->card)-> - func); + sdio_func_suspended( + ((struct sdio_mmc_card *)handle->card)->func); } LEAVE(); } @@ -558,8 +586,7 @@ * @param dev A pointer to device structure * @return N/A */ -void -woal_sdio_shutdown(struct device *dev) +void woal_sdio_shutdown(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); moal_handle *handle = NULL; @@ -601,10 +628,9 @@ } woal_enable_hs(woal_get_priv(handle, MLAN_BSS_ROLE_ANY)); - wait_event_interruptible_timeout(handle->hs_activate_wait_q, - handle-> - hs_activate_wait_q_woken, - HS_ACTIVE_TIMEOUT); + wait_event_interruptible_timeout( + handle->hs_activate_wait_q, + handle->hs_activate_wait_q_woken, HS_ACTIVE_TIMEOUT); if (handle->hs_activated == MTRUE) PRINTM(MMSG, "HS actived in shutdown\n"); else @@ -617,7 +643,7 @@ || (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_UAP) #endif - ) { + ) { PRINTM(MIOCTL, "disconnect on suspend\n"); woal_disconnect(handle->priv[i], @@ -639,8 +665,7 @@ * @param dev A pointer to device structure * @return MLAN_STATUS_SUCCESS or error code */ -int -woal_sdio_suspend(struct device *dev) +int woal_sdio_suspend(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); mmc_pm_flag_t pm_flags = 0; @@ -718,17 +743,16 @@ #ifdef MMC_PM_FUNC_SUSPENDED handle->suspend_notify_req = MTRUE; #endif - hs_actived = - woal_enable_hs(woal_get_priv - (handle, MLAN_BSS_ROLE_ANY)); + hs_actived = woal_enable_hs( + woal_get_priv(handle, MLAN_BSS_ROLE_ANY)); #ifdef MMC_PM_FUNC_SUSPENDED handle->suspend_notify_req = MFALSE; #endif if (hs_actived) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 4) if (pm_flags & MMC_PM_WAKE_SDIO_IRQ) { - ret = sdio_set_host_pm_flags(func, - MMC_PM_WAKE_SDIO_IRQ); + ret = sdio_set_host_pm_flags( + func, MMC_PM_WAKE_SDIO_IRQ); PRINTM(MCMND, "suspend with MMC_PM_WAKE_SDIO_IRQ ret=%d\n", ret); @@ -737,9 +761,9 @@ #ifdef MMC_PM_SKIP_RESUME_PROBE PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER and MMC_PM_SKIP_RESUME_PROBE\n"); - ret = sdio_set_host_pm_flags(func, - MMC_PM_KEEP_POWER | - MMC_PM_SKIP_RESUME_PROBE); + ret = sdio_set_host_pm_flags( + func, + MMC_PM_KEEP_POWER | MMC_PM_SKIP_RESUME_PROBE); #else PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER\n"); ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); @@ -770,8 +794,7 @@ * @param dev A pointer to device structure * @return MLAN_STATUS_SUCCESS */ -int -woal_sdio_resume(struct device *dev) +int woal_sdio_resume(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); mmc_pm_flag_t pm_flags = 0; @@ -827,8 +850,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdiommc_write_reg(moal_handle *handle, t_u32 reg, t_u32 data) +static mlan_status woal_sdiommc_write_reg(moal_handle *handle, t_u32 reg, + t_u32 data) { mlan_status ret = MLAN_STATUS_FAILURE; sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); @@ -847,8 +870,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdiommc_read_reg(moal_handle *handle, t_u32 reg, t_u32 *data) +static mlan_status woal_sdiommc_read_reg(moal_handle *handle, t_u32 reg, + t_u32 *data) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; @@ -870,8 +893,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdio_writeb(moal_handle *handle, t_u32 reg, t_u8 data) +static mlan_status woal_sdio_writeb(moal_handle *handle, t_u32 reg, t_u8 data) { mlan_status ret = MLAN_STATUS_FAILURE; sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); @@ -890,8 +912,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdio_readb(moal_handle *handle, t_u32 reg, t_u8 *data) +static mlan_status woal_sdio_readb(moal_handle *handle, t_u32 reg, t_u8 *data) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; @@ -913,8 +934,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdio_f0_readb(moal_handle *handle, t_u32 reg, t_u8 *data) +static mlan_status woal_sdio_f0_readb(moal_handle *handle, t_u32 reg, + t_u8 *data) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; @@ -937,9 +958,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdio_rw_mb(moal_handle *handle, pmlan_buffer pmbuf_list, - t_u32 port, t_u8 write) +static mlan_status woal_sdio_rw_mb(moal_handle *handle, pmlan_buffer pmbuf_list, + t_u32 port, t_u8 write) { struct scatterlist sg_list[SDIO_MP_AGGR_DEF_PKT_LIMIT_MAX]; int num_sg = pmbuf_list->use_count; @@ -981,8 +1001,8 @@ mmc_cmd.opcode = SD_IO_RW_EXTENDED; mmc_cmd.arg = write ? 1 << 31 : 0; mmc_cmd.arg |= (func->num & 0x7) << 28; - mmc_cmd.arg |= 1 << 27; /* block basic */ - mmc_cmd.arg |= 0; /* fix address */ + mmc_cmd.arg |= 1 << 27; /* block basic */ + mmc_cmd.arg |= 0; /* fix address */ mmc_cmd.arg |= (ioport & 0x1FFFF) << 9; mmc_cmd.arg |= blkcnt & 0x1FF; mmc_cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; @@ -991,17 +1011,17 @@ mmc_req.data = &mmc_dat; sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - mmc_set_data_timeout(&mmc_dat, - ((struct sdio_mmc_card *)handle->card)->func-> - card); - mmc_wait_for_req(((struct sdio_mmc_card *)handle->card)->func->card-> - host, &mmc_req); + mmc_set_data_timeout( + &mmc_dat, ((struct sdio_mmc_card *)handle->card)->func->card); + mmc_wait_for_req( + ((struct sdio_mmc_card *)handle->card)->func->card->host, + &mmc_req); if (mmc_cmd.error || mmc_dat.error) { PRINTM(MERROR, "CMD53 %s cmd_error = %d data_error=%d\n", write ? "write" : "read", mmc_cmd.error, mmc_dat.error); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - /* issue abort cmd52 command through F0 */ + /* issue abort cmd52 command through F0*/ sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, 0x01, SDIO_CCCR_ABORT, &status); #endif @@ -1022,9 +1042,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdiommc_write_data_sync(moal_handle *handle, - mlan_buffer *pmbuf, t_u32 port, t_u32 timeout) +static mlan_status woal_sdiommc_write_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 port, + t_u32 timeout) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 *buffer = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); @@ -1032,7 +1052,8 @@ (port & MLAN_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE; t_u32 blksz = (blkmode == BLOCK_MODE) ? MLAN_SDIO_BLOCK_SIZE : 1; t_u32 blkcnt = (blkmode == BLOCK_MODE) ? - (pmbuf->data_len / MLAN_SDIO_BLOCK_SIZE) : pmbuf->data_len; + (pmbuf->data_len / MLAN_SDIO_BLOCK_SIZE) : + pmbuf->data_len; t_u32 ioport = (port & MLAN_SDIO_IO_PORT_MASK); int status = 0; if (pmbuf->use_count > 1) @@ -1048,7 +1069,7 @@ else { PRINTM(MERROR, "cmd53 write error=%d\n", status); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - /* issue abort cmd52 command through F0 */ + /* issue abort cmd52 command through F0*/ sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, 0x01, SDIO_CCCR_ABORT, &status); #endif @@ -1070,9 +1091,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdiommc_read_data_sync(moal_handle *handle, - mlan_buffer *pmbuf, t_u32 port, t_u32 timeout) +static mlan_status woal_sdiommc_read_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 port, + t_u32 timeout) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 *buffer = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); @@ -1080,7 +1101,8 @@ (port & MLAN_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE; t_u32 blksz = (blkmode == BLOCK_MODE) ? MLAN_SDIO_BLOCK_SIZE : 1; t_u32 blkcnt = (blkmode == BLOCK_MODE) ? - (pmbuf->data_len / MLAN_SDIO_BLOCK_SIZE) : pmbuf->data_len; + (pmbuf->data_len / MLAN_SDIO_BLOCK_SIZE) : + pmbuf->data_len; t_u32 ioport = (port & MLAN_SDIO_IO_PORT_MASK); int status = 0; if (pmbuf->use_count > 1) @@ -1096,7 +1118,7 @@ } else { PRINTM(MERROR, "cmd53 read error=%d\n", status); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) - /* issue abort cmd52 command through F0 */ + /* issue abort cmd52 command through F0*/ sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, 0x01, SDIO_CCCR_ABORT, &status); #endif @@ -1113,8 +1135,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_sdiommc_bus_register(void) +mlan_status woal_sdiommc_bus_register(void) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1136,8 +1157,7 @@ * * @return N/A */ -void -woal_sdiommc_bus_unregister(void) +void woal_sdiommc_bus_unregister(void) { ENTER(); @@ -1153,20 +1173,26 @@ * @param handle A pointer to moal_handle structure * @return N/A */ -static void -woal_sdiommc_unregister_dev(moal_handle *handle) +static void woal_sdiommc_unregister_dev(moal_handle *handle) { ENTER(); if (handle->card) { struct sdio_mmc_card *card = handle->card; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) struct sdio_func *func = card->func; - +#endif /* Release the SDIO IRQ */ sdio_claim_host(card->func); sdio_release_irq(card->func); sdio_disable_func(card->func); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) if (handle->driver_status) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + mmc_hw_reset(func->card); +#else mmc_hw_reset(func->card->host); +#endif +#endif sdio_release_host(card->func); sdio_set_drvdata(card->func, NULL); @@ -1184,8 +1210,7 @@ * @param handle A pointer to moal_handle structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_sdiommc_register_dev(moal_handle *handle) +static mlan_status woal_sdiommc_register_dev(moal_handle *handle) { int ret = MLAN_STATUS_SUCCESS; struct sdio_mmc_card *card = handle->card; @@ -1236,8 +1261,7 @@ * @param option TRUE--on , FALSE--off * @return MLAN_STATUS_SUCCESS */ -int -woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option) +int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option) { struct sdio_mmc_card *cardp = (struct sdio_mmc_card *)handle->card; struct mmc_host *host = cardp->func->card->host; @@ -1269,8 +1293,7 @@ * @param val A pointer to store val variable * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -int -woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val) +int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val) { int ret = MLAN_STATUS_SUCCESS; struct sdio_mmc_card *card = (struct sdio_mmc_card *)handle->card; @@ -1323,8 +1346,7 @@ * @return MTRUE/MFALSE * */ -static t_u8 -woal_sdiommc_is_second_mac(moal_handle *handle) +static t_u8 woal_sdiommc_is_second_mac(moal_handle *handle) { #ifdef SD9098 struct sdio_mmc_card *card = (struct sdio_mmc_card *)handle->card; @@ -1334,8 +1356,7 @@ return MFALSE; } -static mlan_status -woal_sdiommc_get_fw_name(moal_handle *handle) +static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef SD9098 @@ -1344,7 +1365,9 @@ t_u32 revision_id = 0; t_u32 rev_id_reg = handle->card_info->rev_id_reg; -#if defined(SD8987) || defined(SD8997) || defined(SD9098) || defined(SD9097) || defined(SD8978) || defined(SD9177) +#if defined(SD8987) || defined(SD8997) || defined(SD9098) || \ + defined(SD9097) || defined(SDNW62X) || defined(SD8978) || \ + defined(SD9177) t_u32 magic_reg = handle->card_info->magic_reg; t_u32 magic = 0; t_u32 host_strap_reg = handle->card_info->host_strap_reg; @@ -1363,7 +1386,9 @@ woal_sdiommc_read_reg(handle, rev_id_reg, &revision_id); PRINTM(MCMND, "revision_id=0x%x\n", revision_id); -#if defined(SD8987) || defined(SD8997) || defined(SD9098) || defined(SD9097) || defined(SD8978) || defined(SD9177) +#if defined(SD8987) || defined(SD8997) || defined(SD9098) || \ + defined(SD9097) || defined(SDNW62X) || defined(SD8978) || \ + defined(SD9177) /** Revision ID register */ woal_sdiommc_read_reg(handle, magic_reg, &magic); /** Revision ID register */ @@ -1511,12 +1536,25 @@ } } #endif +#ifdef SDNW62X + if (IS_SDNW62X(handle->card_type)) { + if (magic == CHIP_MAGIC_VALUE) { + if (strap == CARD_TYPE_SD_UART) + strcpy(handle->card_info->fw_name, + SDUARTNW62X_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + SDSDNW62X_COMBO_FW_NAME); + } + } +#endif + #ifdef SD9177 if (IS_SD9177(handle->card_type)) { switch (revision_id) { case SD9177_A0: if (magic == CHIP_MAGIC_VALUE) { - if (strap == CARD_TYPE_SD_UART) + if (strap == CARD_TYPE_SD9177_UART) strcpy(handle->card_info->fw_name, SDUART9177_DEFAULT_COMBO_FW_NAME); else @@ -1526,6 +1564,35 @@ strcpy(handle->card_info->fw_name_wlan, SD9177_DEFAULT_WLAN_FW_NAME); break; + case SD9177_A1: + if (magic == CHIP_MAGIC_VALUE) { + if (strap == CARD_TYPE_SD9177_UART) { + if (handle->params.rf_test_mode) + strcpy(handle->card_info + ->fw_name, + SDUART9177_DEFAULT_RFTM_COMBO_V1_FW_NAME); + else + strcpy(handle->card_info + ->fw_name, + SDUART9177_DEFAULT_COMBO_V1_FW_NAME); + } else { + if (handle->params.rf_test_mode) + strcpy(handle->card_info + ->fw_name, + SDSD9177_DEFAULT_RFTM_COMBO_V1_FW_NAME); + else + strcpy(handle->card_info + ->fw_name, + SDSD9177_DEFAULT_COMBO_V1_FW_NAME); + } + } + if (handle->params.rf_test_mode) + strcpy(handle->card_info->fw_name, + SD9177_DEFAULT_RFTM_WLAN_V1_FW_NAME); + else + strcpy(handle->card_info->fw_name_wlan, + SD9177_DEFAULT_WLAN_V1_FW_NAME); + break; default: break; } @@ -1587,11 +1654,8 @@ {"EXT13", NULL, NULL, 0xFD, 0}, {"EXTLAST", NULL, NULL, 0xFE, 0}, }; - -static memory_type_mapping mem_type_mapping_tbl_8977_8997 = { "DUMP", NULL, - NULL, 0xDD, 0 -}; - +static memory_type_mapping mem_type_mapping_tbl_8977_8997 = {"DUMP", NULL, NULL, + 0xDD, 0}; /** * @brief This function read/write firmware via cmd52 * @@ -1600,8 +1664,7 @@ * * @return MLAN_STATUS_SUCCESS */ -static rdwr_status -woal_cmd52_rdwr_firmware(moal_handle *phandle, t_u8 doneflag) +static rdwr_status woal_cmd52_rdwr_firmware(moal_handle *phandle, t_u8 doneflag) { int ret = 0; int tries = 0; @@ -1656,21 +1719,21 @@ } #ifdef SD8801 -#define DEBUG_HOST_READY 0xEE -#define DEBUG_FW_DONE 0xFF -#define DEBUG_MEMDUMP_FINISH 0xFE -#define MAX_POLL_TRIES 100 -#define DEBUG_ITCM_DONE 0xaa -#define DEBUG_DTCM_DONE 0xbb -#define DEBUG_SQRAM_DONE 0xcc +#define DEBUG_HOST_READY 0xEE +#define DEBUG_FW_DONE 0xFF +#define DEBUG_MEMDUMP_FINISH 0xFE +#define MAX_POLL_TRIES 100 +#define DEBUG_ITCM_DONE 0xaa +#define DEBUG_DTCM_DONE 0xbb +#define DEBUG_SQRAM_DONE 0xcc -#define DEBUG_DUMP_CTRL_REG 0x63 -#define DEBUG_DUMP_FIRST_REG 0x62 -#define DEBUG_DUMP_START_REG 0x64 -#define DEBUG_DUMP_END_REG 0x6a -#define ITCM_SIZE 0x60000 -#define SQRAM_SIZE 0x33500 -#define DTCM_SIZE 0x14000 +#define DEBUG_DUMP_CTRL_REG 0x63 +#define DEBUG_DUMP_FIRST_REG 0x62 +#define DEBUG_DUMP_START_REG 0x64 +#define DEBUG_DUMP_END_REG 0x6a +#define ITCM_SIZE 0x60000 +#define SQRAM_SIZE 0x33500 +#define DTCM_SIZE 0x14000 /** * @brief This function dump firmware memory to file @@ -1679,10 +1742,8 @@ * * @return N/A */ -void -woal_dump_firmware_info(moal_handle *phandle) +void woal_dump_firmware_info(moal_handle *phandle) { - int ret = 0; unsigned int reg, reg_start, reg_end; t_u8 *ITCM_Ptr = NULL; @@ -1715,7 +1776,7 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) sdio_claim_host(((struct sdio_mmc_card *)phandle->card)->func); #endif - /* start dump fw memory */ + /* start dump fw memory */ moal_get_system_time(phandle, &sec, &usec); PRINTM(MMSG, "==== DEBUG MODE OUTPUT START: %u.%06u ====\n", sec, usec); ret = moal_vmalloc(phandle, ITCM_SIZE + 1, (t_u8 **)&ITCM_Ptr); @@ -1756,8 +1817,8 @@ goto done; } if ((ctrl_data == DEBUG_FW_DONE) || - (ctrl_data == DEBUG_ITCM_DONE) - || (ctrl_data == DEBUG_DTCM_DONE) || + (ctrl_data == DEBUG_ITCM_DONE) || + (ctrl_data == DEBUG_DTCM_DONE) || (ctrl_data == DEBUG_SQRAM_DONE)) break; if (ctrl_data != DEBUG_HOST_READY) { @@ -1784,7 +1845,7 @@ if (dbg_ptr < end_ptr) dbg_ptr++; else { - PRINTM(MERROR, "pre-allocced buf is not enough\n"); + PRINTM(MINFO, "pre-allocced buf is not enough\n"); goto done; } for (reg = reg_start; reg <= reg_end; reg++) { @@ -1796,7 +1857,7 @@ if (dbg_ptr < end_ptr) dbg_ptr++; else - PRINTM(MMSG, + PRINTM(MINFO, "pre-allocced buf is not enough\n"); } switch (ctrl_data) { @@ -1880,8 +1941,7 @@ * * @return N/A */ -void -woal_dump_firmware_info_v2(moal_handle *phandle) +void woal_dump_firmware_info_v2(moal_handle *phandle) { int ret = 0; unsigned int reg, reg_start, reg_end; @@ -1962,9 +2022,9 @@ } else { PRINTM(MMSG, "%s_SIZE=0x%x\n", mem_type_mapping_tbl[idx].mem_name, memory_size); - ret = moal_vmalloc(phandle, memory_size + 1, - (t_u8 **)&mem_type_mapping_tbl[idx]. - mem_Ptr); + ret = moal_vmalloc( + phandle, memory_size + 1, + (t_u8 **)&mem_type_mapping_tbl[idx].mem_Ptr); if ((ret != MLAN_STATUS_SUCCESS) || !mem_type_mapping_tbl[idx].mem_Ptr) { PRINTM(MERROR, @@ -1994,7 +2054,7 @@ if (dbg_ptr < end_ptr) dbg_ptr++; else - PRINTM(MMSG, + PRINTM(MINFO, "pre-allocced buf is not enough\n"); } if (RDWR_STATUS_DONE == stat) { @@ -2004,21 +2064,20 @@ "size = 0x%lx\n", mem_type_mapping_tbl[idx].mem_name, dbg_ptr - mem_type_mapping_tbl[idx] - .mem_Ptr); + .mem_Ptr); #else PRINTM(MMSG, "%s done:" "size = 0x%x\n", mem_type_mapping_tbl[idx].mem_name, dbg_ptr - mem_type_mapping_tbl[idx] - .mem_Ptr); + .mem_Ptr); #endif - woal_save_dump_info_to_buf(phandle, - mem_type_mapping_tbl - [idx].mem_Ptr, - memory_size, - mem_type_mapping_tbl - [idx].type); + woal_save_dump_info_to_buf( + phandle, + mem_type_mapping_tbl[idx].mem_Ptr, + memory_size, + mem_type_mapping_tbl[idx].type); moal_vfree(phandle, mem_type_mapping_tbl[idx].mem_Ptr); mem_type_mapping_tbl[idx].mem_Ptr = NULL; @@ -2048,8 +2107,7 @@ * * @return N/A */ -void -woal_dump_firmware_info_v3(moal_handle *phandle) +void woal_dump_firmware_info_v3(moal_handle *phandle) { int ret = 0; int tries = 0; @@ -2142,29 +2200,32 @@ } dbg_ptr++; if (dbg_ptr >= end_ptr) { - PRINTM(MMSG, + PRINTM(MINFO, "pre-allocced buf is not enough\n"); + ret = moal_vmalloc(phandle, - memory_size + 0x4000 + 1, + memory_size + 0x2000 + 1, (t_u8 **)&temp_Ptr); if ((ret != MLAN_STATUS_SUCCESS) || !temp_Ptr) { PRINTM(MERROR, "Error: vmalloc buffer failed!!!\n"); goto done; } + moal_memcpy_ext(phandle, temp_Ptr, pmem_type_mapping_tbl->mem_Ptr, memory_size, - memory_size + 0x4000); + memory_size + 0x2000); moal_vfree(phandle, pmem_type_mapping_tbl->mem_Ptr); pmem_type_mapping_tbl->mem_Ptr = temp_Ptr; temp_Ptr = NULL; dbg_ptr = pmem_type_mapping_tbl->mem_Ptr + - memory_size; - memory_size += 0x4000; + memory_size; + + memory_size += 0x2000; end_ptr = pmem_type_mapping_tbl->mem_Ptr + - memory_size; + memory_size; } } if (RDWR_STATUS_DONE == stat) { @@ -2213,8 +2274,7 @@ * * @return N/A */ -static void -woal_sdiommc_reg_dbg(moal_handle *phandle) +static void woal_sdiommc_reg_dbg(moal_handle *phandle) { int ret = 0; t_u8 loop, index = 0, func, data; @@ -2287,13 +2347,15 @@ * * @return N/A */ -static void -woal_sdiommc_dump_fw_info(moal_handle *phandle) +static void woal_sdiommc_dump_fw_info(moal_handle *phandle) { if (!phandle) { PRINTM(MERROR, "Could not dump firmwware info\n"); return; } + /** cancel all pending commands */ + mlan_ioctl(phandle->pmlan_adapter, NULL); + mlan_pm_wakeup_card(phandle->pmlan_adapter, MTRUE); phandle->fw_dump = MTRUE; if (phandle->card_info->dump_fw_info == DUMP_FW_SDIO_V2) { @@ -2313,9 +2375,11 @@ woal_dump_firmware_info(phandle); } #endif - woal_send_fw_dump_complete_event(woal_get_priv - (phandle, MLAN_BSS_ROLE_ANY)); phandle->fw_dump = MFALSE; + if (!phandle->priv_num) + return; + woal_send_fw_dump_complete_event( + woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); queue_work(phandle->workqueue, &phandle->main_work); woal_process_hang(phandle); @@ -2330,8 +2394,7 @@ * * @return The length of this log */ -static int -woal_sdiommc_dump_reg_info(moal_handle *phandle, t_u8 *drv_buf) +static int woal_sdiommc_dump_reg_info(moal_handle *phandle, t_u8 *drv_buf) { char *drv_ptr = (char *)drv_buf; int ret = 0; @@ -2427,8 +2490,7 @@ * * @return N/A */ -void -woal_sdio_reset_hw(moal_handle *handle) +void woal_sdio_reset_hw(moal_handle *handle) { struct sdio_mmc_card *card = handle->card; struct sdio_func *func = card->func; @@ -2436,7 +2498,14 @@ sdio_claim_host(func); sdio_release_irq(card->func); sdio_disable_func(card->func); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + mmc_hw_reset(func->card); +#else mmc_hw_reset(func->card->host); +#endif +#endif + #ifdef MMC_QUIRK_BLKSZ_FOR_BYTE_MODE /* The byte mode patch is available in kernel MMC driver * which fixes one issue in MP-A transfer.
diff --git a/wlan_sd8987/mlinux/moal_shim.c b/wlan_sd8987/mlinux/moal_shim.c index 4a0db86..00127a1 100755 --- a/wlan_sd8987/mlinux/moal_shim.c +++ b/wlan_sd8987/mlinux/moal_shim.c
@@ -3,7 +3,7 @@ * @brief This file contains the callback functions registered to MLAN * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -41,9 +41,6 @@ #if defined(STA_CFG80211) || defined(UAP_CFG80211) #include "moal_cfg80211.h" #include "moal_cfg80211_util.h" -#ifdef STA_SUPPORT -#include "moal_sta_cfg80211.h" -#endif #endif #include <asm/div64.h> @@ -56,7 +53,7 @@ #include <linux/etherdevice.h> -#endif /*defined(PCIE) || defined(SDIO) */ +#endif /*defined(PCIE) || defined(SDIO)*/ /******************************************************** Local Variables @@ -93,12 +90,15 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_malloc(t_void *pmoal, t_u32 size, t_u32 flag, t_u8 **ppbuf) +mlan_status moal_malloc(t_void *pmoal, t_u32 size, t_u32 flag, t_u8 **ppbuf) { moal_handle *handle = (moal_handle *)pmoal; - gfp_t mem_flag = - (in_interrupt() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + gfp_t mem_flag = (in_interrupt() || in_atomic() || irqs_disabled()) ? + GFP_ATOMIC : + GFP_KERNEL; + + if (flag & MLAN_MEM_FLAG_ATOMIC) + mem_flag = GFP_ATOMIC; #ifdef USB if (!IS_USB(handle->card_type)) @@ -126,8 +126,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_mfree(t_void *pmoal, t_u8 *pbuf) +mlan_status moal_mfree(t_void *pmoal, t_u8 *pbuf) { moal_handle *handle = (moal_handle *)pmoal; @@ -148,8 +147,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_vmalloc(t_void *pmoal, t_u32 size, t_u8 **ppbuf) +mlan_status moal_vmalloc(t_void *pmoal, t_u32 size, t_u8 **ppbuf) { moal_handle *handle = (moal_handle *)pmoal; @@ -172,8 +170,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_vfree(t_void *pmoal, t_u8 *pbuf) +mlan_status moal_vfree(t_void *pmoal, t_u8 *pbuf) { moal_handle *handle = (moal_handle *)pmoal; @@ -196,8 +193,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_malloc_consistent(t_void *pmoal, t_u32 size, t_u8 **ppbuf, t_pu64 pbuf_pa) +mlan_status moal_malloc_consistent(t_void *pmoal, t_u32 size, t_u8 **ppbuf, + t_pu64 pbuf_pa) { moal_handle *handle = (moal_handle *)pmoal; pcie_service_card *card = (pcie_service_card *)handle->card; @@ -207,8 +204,13 @@ if (!card) return MLAN_STATUS_FAILURE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + *ppbuf = (t_u8 *)dma_alloc_coherent(&card->dev->dev, size, + (dma_addr_t *)&dma, GFP_KERNEL); +#else *ppbuf = (t_u8 *)pci_alloc_consistent(card->dev, size, - (dma_addr_t *) & dma); + (dma_addr_t *)&dma); +#endif if (*ppbuf == NULL) { PRINTM(MERROR, "%s: allocate consistent memory (%d bytes) failed!\n", @@ -231,8 +233,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf, t_u64 buf_pa) +mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf, + t_u64 buf_pa) { moal_handle *handle = (moal_handle *)pmoal; pcie_service_card *card = handle->card; @@ -240,7 +242,11 @@ if (!pbuf || !card) return MLAN_STATUS_FAILURE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + dma_free_coherent(&card->dev->dev, size, pbuf, buf_pa); +#else pci_free_consistent(card->dev, size, pbuf, buf_pa); +#endif atomic_dec(&handle->malloc_cons_count); return MLAN_STATUS_SUCCESS; } @@ -256,9 +262,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_map_memory(t_void *pmoal, t_u8 *pbuf, - t_u64 *pbuf_pa, t_u32 size, t_u32 flag) +mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa, + t_u32 size, t_u32 flag) { moal_handle *handle = (moal_handle *)pmoal; pcie_service_card *card = (pcie_service_card *)handle->card; @@ -268,14 +273,18 @@ if (!card) return MLAN_STATUS_FAILURE; - /* Init memory to device */ + /* Init memory to device */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + dma = dma_map_single(&card->dev->dev, pbuf, size, flag); + if (dma_mapping_error(&card->dev->dev, dma)) { +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) dma = pci_map_single(card->dev, pbuf, size, flag); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) if (pci_dma_mapping_error(card->dev, dma)) { #else + dma = pci_map_single(card->dev, pbuf, size, flag); if (pci_dma_mapping_error(dma)) { #endif - PRINTM(MERROR, "Tx ring: failed to pci_map_single\n"); + PRINTM(MERROR, "Tx ring: failed to dma_map_single\n"); return MLAN_STATUS_FAILURE; } @@ -294,9 +303,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, - t_u64 buf_pa, t_u32 size, t_u32 flag) +mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, t_u64 buf_pa, + t_u32 size, t_u32 flag) { moal_handle *handle = (moal_handle *)pmoal; pcie_service_card *card = (pcie_service_card *)handle->card; @@ -304,7 +312,11 @@ if (!card) return MLAN_STATUS_FAILURE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + dma_unmap_single(&card->dev->dev, buf_pa, size, flag); +#else pci_unmap_single(card->dev, buf_pa, size, flag); +#endif return MLAN_STATUS_SUCCESS; } @@ -320,8 +332,7 @@ * * @return Pointer to the memory area */ -t_void * -moal_memset(t_void *pmoal, t_void *pmem, t_u8 byte, t_u32 num) +t_void *moal_memset(t_void *pmoal, t_void *pmem, t_u8 byte, t_u32 num) { t_void *p = pmem; @@ -341,8 +352,7 @@ * * @return Pointer to the dest memory */ -t_void * -moal_memcpy(t_void *pmoal, t_void *pdest, const t_void *psrc, t_u32 num) +t_void *moal_memcpy(t_void *pmoal, t_void *pdest, const t_void *psrc, t_u32 num) { t_void *p = pdest; @@ -363,9 +373,8 @@ * * @return Pointer to the dest memory */ -t_void * -moal_memcpy_ext(t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num, t_u32 dest_size) +t_void *moal_memcpy_ext(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num, t_u32 dest_size) { t_void *p = pdest; if (pdest && psrc && num && dest_size) @@ -384,8 +393,8 @@ * * @return Pointer to the dest memory */ -t_void * -moal_memmove(t_void *pmoal, t_void *pdest, const t_void *psrc, t_u32 num) +t_void *moal_memmove(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num) { t_void *p = pdest; @@ -405,8 +414,8 @@ * * @return Compare result returns by memcmp */ -t_s32 -moal_memcmp(t_void *pmoal, const t_void *pmem1, const t_void *pmem2, t_u32 num) +t_s32 moal_memcmp(t_void *pmoal, const t_void *pmem1, const t_void *pmem2, + t_u32 num) { t_s32 result; @@ -423,8 +432,7 @@ * * @return N/A */ -t_void -moal_udelay(t_void *pmoal, t_u32 delay) +t_void moal_udelay(t_void *pmoal, t_u32 delay) { if (delay >= 1000) msleep(delay / 1000); @@ -445,14 +453,12 @@ * * @return N/A */ -t_void -moal_usleep_range(t_void *pmoal, t_u32 min_delay, t_u32 max_delay) +t_void moal_usleep_range(t_void *pmoal, t_u32 min_delay, t_u32 max_delay) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) usleep_range(min_delay, max_delay); #endif } - /** * @brief Retrieves the current system time * @@ -462,8 +468,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_get_system_time(t_void *pmoal, t_u32 *psec, t_u32 *pusec) +mlan_status moal_get_system_time(t_void *pmoal, t_u32 *psec, t_u32 *pusec) { wifi_timeval t; @@ -482,8 +487,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_get_boot_ktime(t_void *pmoal, t_u64 *pnsec) +mlan_status moal_get_boot_ktime(t_void *pmoal, t_u64 *pnsec) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) ktime_t time; @@ -504,13 +508,14 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_init_timer(t_void *pmoal, t_void **pptimer, - IN t_void (*callback) (t_void *pcontext), t_void *pcontext) +mlan_status moal_init_timer(t_void *pmoal, t_void **pptimer, + IN t_void (*callback)(t_void *pcontext), + t_void *pcontext) { moal_drv_timer *timer = NULL; - gfp_t mem_flag = - (in_interrupt() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + gfp_t mem_flag = (in_interrupt() || in_atomic() || irqs_disabled()) ? + GFP_ATOMIC : + GFP_KERNEL; timer = kmalloc(sizeof(moal_drv_timer), mem_flag); if (timer == NULL) @@ -529,13 +534,13 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_free_timer(t_void *pmoal, t_void *ptimer) +mlan_status moal_free_timer(t_void *pmoal, t_void *ptimer) { moal_drv_timer *timer = (moal_drv_timer *)ptimer; if (timer) { - if ((timer->timer_is_canceled == MFALSE) && timer->time_period) { + if ((timer->timer_is_canceled == MFALSE) && + timer->time_period) { PRINTM(MWARN, "mlan try to free timer without stop timer!\n"); woal_cancel_timer(timer); @@ -556,8 +561,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_start_timer(t_void *pmoal, t_void *ptimer, t_u8 periodic, t_u32 msec) +mlan_status moal_start_timer(t_void *pmoal, t_void *ptimer, t_u8 periodic, + t_u32 msec) { if (!ptimer) return MLAN_STATUS_FAILURE; @@ -576,8 +581,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_stop_timer(t_void *pmoal, t_void *ptimer) +mlan_status moal_stop_timer(t_void *pmoal, t_void *ptimer) { if (!ptimer) return MLAN_STATUS_FAILURE; @@ -594,8 +598,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_init_lock(t_void *pmoal, t_void **pplock) +mlan_status moal_init_lock(t_void *pmoal, t_void **pplock) { moal_handle *handle = (moal_handle *)pmoal; moal_lock *mlock = NULL; @@ -619,8 +622,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_free_lock(t_void *pmoal, t_void *plock) +mlan_status moal_free_lock(t_void *pmoal, t_void *plock) { moal_handle *handle = (moal_handle *)pmoal; moal_lock *mlock = plock; @@ -640,9 +642,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_spin_lock(t_void *pmoal, t_void *plock) -__acquires(&plock->lock) +mlan_status moal_spin_lock(t_void *pmoal, t_void *plock) + __acquires(&plock->lock) { moal_lock *mlock = plock; unsigned long flags = 0; @@ -659,9 +660,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_spin_unlock(t_void *pmoal, t_void *plock) -__releases(&plock->lock) +mlan_status moal_spin_unlock(t_void *pmoal, t_void *plock) + __releases(&plock->lock) { moal_lock *mlock = (moal_lock *)plock; spin_unlock_irqrestore(&mlock->lock, mlock->flags); @@ -677,9 +677,8 @@ * * @return N/A */ -void -moal_amsdu_tp_accounting(t_void *pmoal, t_s32 amsdu_process_delay, - t_s32 amsdu_copy_delay) +void moal_amsdu_tp_accounting(t_void *pmoal, t_s32 amsdu_process_delay, + t_s32 amsdu_copy_delay) { moal_handle *handle = (moal_handle *)pmoal; handle->tp_acnt.rx_amsdu_delay[handle->tp_acnt.rx_amsdu_index] = @@ -700,8 +699,7 @@ * * @return N/A */ -void -moal_tp_accounting(t_void *pmoal, void *buf, t_u32 drop_point) +void moal_tp_accounting(t_void *pmoal, void *buf, t_u32 drop_point) { struct sk_buff *skb = NULL; moal_handle *handle = (moal_handle *)pmoal; @@ -720,29 +718,31 @@ } else if (drop_point <= RX_DROP_P5) { t_u16 rx_len = 0; if (drop_point == RX_DROP_P1 || drop_point == RX_DROP_P2) - rx_len = pmbuf->data_len - *((t_u16 *)(pmbuf->pbuf + pmbuf->data_offset) + 2); //remove rx_pkt_offset - else if (drop_point == RX_DROP_P3) //aggr pkt + rx_len = pmbuf->data_len - + *((t_u16 *)(pmbuf->pbuf + pmbuf->data_offset) + + 2); // remove rx_pkt_offset + else if (drop_point == RX_DROP_P3) // aggr pkt rx_len = pmbuf->data_len; - else if (drop_point == RX_DROP_P4) { //before to kernel + else if (drop_point == RX_DROP_P4) { // before to kernel skb = (struct sk_buff *)buf; rx_len = skb->len; } - handle->tp_acnt.rx_bytes[drop_point - - MAX_TP_ACCOUNT_DROP_POINT_NUM] += + handle->tp_acnt + .rx_bytes[drop_point - MAX_TP_ACCOUNT_DROP_POINT_NUM] += rx_len; handle->tp_acnt.rx_packets[drop_point - MAX_TP_ACCOUNT_DROP_POINT_NUM]++; } else if (drop_point == RX_TIME_PKT) { woal_get_monotonic_time(&t); /* deque - pcie receive */ - delay = (t_s32)(pmbuf->extra_ts_sec - - pmbuf->in_ts_sec) * 1000000; + delay = (t_s32)(pmbuf->extra_ts_sec - pmbuf->in_ts_sec) * + 1000000; delay += (t_s32)(pmbuf->extra_ts_usec - pmbuf->in_ts_usec); handle->tp_acnt.rx_delay1_driver[handle->tp_acnt.rx_index] = delay; /* before netif_rx - deque */ - delay = (t_s32)(pmbuf->out_ts_sec - - pmbuf->extra_ts_sec) * 1000000; + delay = (t_s32)(pmbuf->out_ts_sec - pmbuf->extra_ts_sec) * + 1000000; delay += (t_s32)(pmbuf->out_ts_usec - pmbuf->extra_ts_usec); handle->tp_acnt.rx_delay2_driver[handle->tp_acnt.rx_index] = delay; @@ -765,39 +765,38 @@ } } -void -moal_tp_accounting_rx_param(t_void *pmoal, unsigned int type, - unsigned int rsvd1) +void moal_tp_accounting_rx_param(t_void *pmoal, unsigned int type, + unsigned int rsvd1) { moal_handle *phandle = (moal_handle *)pmoal; switch (type) { - case 0: //Rx interrupt + case 0: // Rx interrupt phandle->tp_acnt.rx_intr_cnt++; break; - case 1: //rx_pkts_queued + case 1: // rx_pkts_queued phandle->tp_acnt.rx_pending = rsvd1; break; - case 2: //paused + case 2: // paused phandle->tp_acnt.rx_paused_cnt++; break; - case 3: //tx interrupt count + case 3: // tx interrupt count phandle->tp_acnt.tx_intr_cnt++; break; - case 4: //rx amsdu count + case 4: // rx amsdu count phandle->tp_acnt.rx_amsdu_cnt++; phandle->tp_acnt.rx_amsdu_pkt_cnt += rsvd1; break; - case 5: //tx amsdu count + case 5: // tx amsdu count phandle->tp_acnt.tx_amsdu_cnt++; phandle->tp_acnt.tx_amsdu_pkt_cnt += rsvd1; break; - case 6: //rxbd rdptr full count + case 6: // rxbd rdptr full count phandle->tp_acnt.rx_rdptr_full_cnt++; break; - case 7: //tx hard xmit skb realloc count + case 7: // tx hard xmit skb realloc count phandle->tp_acnt.tx_xmit_skb_realloc_cnt++; break; - case 8: //tx stop queue count + case 8: // tx stop queue count phandle->tp_acnt.tx_stop_queue_cnt++; break; @@ -816,8 +815,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_get_fw_data(t_void *pmoal, t_u32 offset, t_u32 len, t_u8 *pbuf) +mlan_status moal_get_fw_data(t_void *pmoal, t_u32 offset, t_u32 len, t_u8 *pbuf) { moal_handle *handle = (moal_handle *)pmoal; @@ -842,8 +840,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_get_vdll_data(t_void *pmoal, t_u32 len, t_u8 *pbuf) +mlan_status moal_get_vdll_data(t_void *pmoal, t_u32 len, t_u8 *pbuf) { moal_handle *handle = (moal_handle *)pmoal; mlan_status status = MLAN_STATUS_FAILURE; @@ -884,22 +881,20 @@ * @param ptbl pointer to mplan_bss_tbl * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_get_hw_spec_complete(t_void *pmoal, - mlan_status status, - mlan_hw_info * phw, pmlan_bss_tbl ptbl) +mlan_status moal_get_hw_spec_complete(t_void *pmoal, mlan_status status, + mlan_hw_info *phw, pmlan_bss_tbl ptbl) { -#if defined(PCIE9098) moal_handle *handle = (moal_handle *)pmoal; -#endif + int i; + t_u32 drv_mode = handle->params.drv_mode; ENTER(); if (status == MLAN_STATUS_SUCCESS) { PRINTM(MCMND, "Get Hw Spec done, fw_cap=0x%x\n", phw->fw_cap); #ifdef PCIE9098 - /** Special/Temporary handling to manage the driver version string - * to identify Seahawk/AW690 (skyhawk based) based on fw_cap_ext - * value set by Fw */ + /** Special/Temporary handling to manage the driver version + * string to identify Seahawk/AW690 (skyhawk based) based on + * fw_cap_ext value set by Fw */ if (phw->fw_cap_ext & MBIT(31) && IS_PCIE9098(handle->card_type)) { moal_memcpy_ext(handle, driver_version, CARD_PCIEAW690, @@ -907,15 +902,48 @@ strlen(driver_version)); moal_memcpy_ext(handle, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), V17, strlen(V17), + strlen(KERN_VERSION), + V17, strlen(V17), strlen(driver_version) - - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(INTF_CARDTYPE) - + strlen(KERN_VERSION)); moal_memcpy_ext(handle, handle->driver_version, driver_version, strlen(driver_version), MLAN_MAX_VER_STR_LEN - 1); } #endif + /** FW should only enable DFS on one mac */ + if (!(phw->fw_cap & FW_CAPINFO_ZERO_DFS)) + handle->params.drv_mode &= ~DRV_MODE_DFS; + + if (!(phw->fw_cap & FW_CAPINFO_80211BGA)) + handle->params.drv_mode &= ~DRV_MODE_WLAN; + if (!handle->params.drv_mode || + MLAN_STATUS_SUCCESS != + woal_update_drv_tbl(handle, + handle->params.drv_mode)) { + PRINTM(MERROR, + "Get_hw_spec_complete: Fail to update drv_tbl\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + memset(ptbl, 0, sizeof(mlan_bss_tbl)); + for (i = 0; i < handle->drv_mode.intf_num; i++) { + ptbl->bss_attr[i].bss_type = + handle->drv_mode.bss_attr[i].bss_type; + ptbl->bss_attr[i].frame_type = + handle->drv_mode.bss_attr[i].frame_type; + ptbl->bss_attr[i].active = + handle->drv_mode.bss_attr[i].active; + ptbl->bss_attr[i].bss_priority = + handle->drv_mode.bss_attr[i].bss_priority; + ptbl->bss_attr[i].bss_num = + handle->drv_mode.bss_attr[i].bss_num; + ptbl->bss_attr[i].bss_virtual = + handle->drv_mode.bss_attr[i].bss_virtual; + } + PRINTM(MCMND, "org_drv_mode=0x%x drv_mode=0x%x\n", drv_mode, + handle->params.drv_mode); } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -930,8 +958,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_init_fw_complete(t_void *pmoal, mlan_status status) +mlan_status moal_init_fw_complete(t_void *pmoal, mlan_status status) { moal_handle *handle = (moal_handle *)pmoal; ENTER(); @@ -951,8 +978,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_shutdown_fw_complete(t_void *pmoal, mlan_status status) +mlan_status moal_shutdown_fw_complete(t_void *pmoal, mlan_status status) { moal_handle *handle = (moal_handle *)pmoal; ENTER(); @@ -972,9 +998,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_ioctl_complete(t_void *pmoal, - pmlan_ioctl_req pioctl_req, mlan_status status) +mlan_status moal_ioctl_complete(t_void *pmoal, pmlan_ioctl_req pioctl_req, + mlan_status status) { moal_handle *handle = (moal_handle *)pmoal; moal_private *priv = NULL; @@ -1046,8 +1071,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_alloc_mlan_buffer(t_void *pmoal, t_u32 size, pmlan_buffer *pmbuf) +mlan_status moal_alloc_mlan_buffer(t_void *pmoal, t_u32 size, + pmlan_buffer *pmbuf) { *pmbuf = woal_alloc_mlan_buffer((moal_handle *)pmoal, size); if (NULL == *pmbuf) @@ -1063,8 +1088,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_free_mlan_buffer(t_void *pmoal, pmlan_buffer pmbuf) +mlan_status moal_free_mlan_buffer(t_void *pmoal, pmlan_buffer pmbuf) { if (!pmbuf) return MLAN_STATUS_FAILURE; @@ -1081,8 +1105,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_send_packet_complete(t_void *pmoal, pmlan_buffer pmbuf, mlan_status status) +mlan_status moal_send_packet_complete(t_void *pmoal, pmlan_buffer pmbuf, + mlan_status status) { moal_private *priv = NULL; moal_handle *handle = (moal_handle *)pmoal; @@ -1106,78 +1130,82 @@ if (status == MLAN_STATUS_SUCCESS) { priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, - PACKET_TYPE_TX, - TX_PKT_FATE_SENT, - FRAME_TYPE_ETHERNET_II, - 0, 0, - skb->data, - skb->data_len); + woal_packet_fate_monitor( + priv, PACKET_TYPE_TX, + TX_PKT_FATE_SENT, + FRAME_TYPE_ETHERNET_II, 0, 0, + skb->data, skb->data_len); +#endif #endif } else { priv->stats.tx_errors++; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, - PACKET_TYPE_TX, - TX_PKT_FATE_DRV_DROP_OTHER, - FRAME_TYPE_ETHERNET_II, - 0, 0, - skb->data, - skb->data_len); + woal_packet_fate_monitor( + priv, PACKET_TYPE_TX, + TX_PKT_FATE_DRV_DROP_OTHER, + FRAME_TYPE_ETHERNET_II, 0, 0, + skb->data, skb->data_len); +#endif #endif } #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) index = skb_get_queue_mapping(skb); - atomic_dec(&handle->tx_pending); - if (atomic_dec_return - (&priv->wmm_tx_pending[index]) == - LOW_TX_PENDING) { - struct netdev_queue *txq = - netdev_get_tx_queue(priv-> - netdev, - index); - if (netif_tx_queue_stopped(txq)) { - netif_tx_wake_queue(txq); - PRINTM(MINFO, - "Wakeup Kernel Queue:%d\n", - index); + if (index < 4) { + atomic_dec(&handle->tx_pending); + if (atomic_dec_return( + &priv->wmm_tx_pending[index]) == + LOW_TX_PENDING) { + struct netdev_queue *txq = + netdev_get_tx_queue( + priv->netdev, + index); + if (netif_tx_queue_stopped( + txq)) { + netif_tx_wake_queue( + txq); + PRINTM(MINFO, + "Wakeup Kernel Queue:%d\n", + index); + } } + } else { + PRINTM(MERROR, + "Invalid queue index for skb\n"); } -#else /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) */ +#else /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)*/ if (atomic_dec_return(&handle->tx_pending) < LOW_TX_PENDING) { int i; for (i = 0; i < handle->priv_num; i++) { #ifdef STA_SUPPORT - if ((GET_BSS_ROLE - (handle->priv[i]) == + if ((GET_BSS_ROLE( + handle->priv[i]) == MLAN_BSS_ROLE_STA) && (handle->priv[i] - ->media_connected || - priv-> - is_adhoc_link_sensed)) { - woal_wake_queue(handle-> - priv[i] - -> - netdev); + ->media_connected || + priv->is_adhoc_link_sensed)) { + woal_wake_queue( + handle->priv[i] + ->netdev); } #endif #ifdef UAP_SUPPORT - if ((GET_BSS_ROLE - (handle->priv[i]) == + if ((GET_BSS_ROLE( + handle->priv[i]) == MLAN_BSS_ROLE_UAP) && (handle->priv[i] - ->media_connected)) { - woal_wake_queue(handle-> - priv[i] - -> - netdev); + ->media_connected)) { + woal_wake_queue( + handle->priv[i] + ->netdev); } #endif } } -#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) */ +#endif /*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)*/ } } if (skb) @@ -1219,9 +1247,8 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_recv_complete(t_void *pmoal, pmlan_buffer pmbuf, - t_u32 port, mlan_status status) +mlan_status moal_recv_complete(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + mlan_status status) { moal_private *priv = NULL; moal_handle *handle = (moal_handle *)pmoal; @@ -1245,13 +1272,13 @@ if ((atomic_read(&handle->rx_pending) < USB_LOW_RX_PENDING) && atomic_read(&cardp->rx_data_urb_pending) < - MVUSB_RX_DATA_URB) + MVUSB_RX_DATA_URB) woal_usb_submit_rx_data_urbs(handle); } } else if (port == cardp->rx_data_ep) { if ((atomic_read(&handle->rx_pending) < USB_LOW_RX_PENDING) && atomic_read(&cardp->rx_data_urb_pending) < - MVUSB_RX_DATA_URB) + MVUSB_RX_DATA_URB) woal_usb_submit_rx_data_urbs(handle); } LEAVE(); @@ -1268,8 +1295,7 @@ * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE or * MLAN_STATUS_PENDING or MLAN_STATUS_RESOURCE */ -mlan_status -moal_write_data_async(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port) +mlan_status moal_write_data_async(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port) { moal_handle *handle = (moal_handle *)pmoal; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1297,9 +1323,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_write_data_sync(t_void *pmoal, pmlan_buffer pmbuf, - t_u32 port, t_u32 timeout) +mlan_status moal_write_data_sync(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + t_u32 timeout) { moal_handle *handle = (moal_handle *)pmoal; return handle->ops.write_data_sync(handle, pmbuf, port, timeout); @@ -1316,9 +1341,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_read_data_sync(t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port, t_u32 timeout) +mlan_status moal_read_data_sync(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + t_u32 timeout) { moal_handle *handle = (moal_handle *)pmoal; return handle->ops.read_data_sync(handle, pmbuf, port, timeout); @@ -1334,8 +1358,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_write_reg(t_void *pmoal, t_u32 reg, t_u32 data) +mlan_status moal_write_reg(t_void *pmoal, t_u32 reg, t_u32 data) { int ret = MLAN_STATUS_FAILURE; moal_handle *handle = (moal_handle *)pmoal; @@ -1353,8 +1376,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_read_reg(t_void *pmoal, t_u32 reg, t_u32 *data) +mlan_status moal_read_reg(t_void *pmoal, t_u32 reg, t_u32 *data) { int ret = MLAN_STATUS_FAILURE; moal_handle *handle = (moal_handle *)pmoal; @@ -1365,6 +1387,270 @@ #endif /* SDIO || PCIE */ +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +/** + * @brief This function uploads the packet to the network stack monitor + * interface + * + * @param handle Pointer to the MOAL context + * @param pmbuf Pointer to mlan_buffer + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING/MLAN_STATUS_FAILURE + */ +static mlan_status moal_recv_packet_to_mon_if(moal_handle *handle, + pmlan_buffer pmbuf) +{ + mlan_status status = MLAN_STATUS_SUCCESS; + struct sk_buff *skb = NULL; + struct radiotap_header *rth = NULL; + radiotap_info rt_info = {}; + t_u8 format = 0; + t_u8 bw = 0; + t_u8 gi = 0; + t_u8 ldpc = 0; + t_u8 chan_num; + t_u8 band = 0; + struct ieee80211_hdr *dot11_hdr = NULL; + t_u8 *payload = NULL; + t_u32 vht_sig1 = 0; + t_u32 vht_sig2 = 0; + ENTER(); + if (!pmbuf->pdesc) { + LEAVE(); + return status; + } + + skb = (struct sk_buff *)pmbuf->pdesc; + + if ((handle->mon_if) && netif_running(handle->mon_if->mon_ndev)) { + if (handle->mon_if->radiotap_enabled) { + if (skb_headroom(skb) < sizeof(*rth)) { + PRINTM(MERROR, + "%s No space to add Radio TAP header\n", + __func__); + status = MLAN_STATUS_FAILURE; + handle->mon_if->stats.rx_dropped++; + goto done; + } + dot11_hdr = + (struct ieee80211_hdr *)(pmbuf->pbuf + + pmbuf->data_offset); + moal_memcpy_ext(handle, &rt_info, + pmbuf->pbuf + pmbuf->data_offset - + sizeof(rt_info), + sizeof(rt_info), sizeof(rt_info)); + ldpc = (rt_info.rate_info.rate_info & 0x20) >> 5; + format = (rt_info.rate_info.rate_info & 0x18) >> 3; + bw = (rt_info.rate_info.rate_info & 0x06) >> 1; + gi = rt_info.rate_info.rate_info & 0x01; + skb_push(skb, sizeof(*rth)); + rth = (struct radiotap_header *)skb->data; + memset(skb->data, 0, sizeof(*rth)); + rth->hdr.it_version = PKTHDR_RADIOTAP_VERSION; + rth->hdr.it_pad = 0; + rth->hdr.it_len = cpu_to_le16(sizeof(*rth)); + rth->hdr.it_present = cpu_to_le32( + (1 << IEEE80211_RADIOTAP_TSFT) | + (1 << IEEE80211_RADIOTAP_FLAGS) | + (1 << IEEE80211_RADIOTAP_CHANNEL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | + (1 << IEEE80211_RADIOTAP_ANTENNA)); + /** Timstamp */ + rth->body.timestamp = woal_cpu_to_le64(jiffies); + /** Flags */ + rth->body.flags = (rt_info.extra_info.flags & + ~(RADIOTAP_FLAGS_USE_SGI_HT | + RADIOTAP_FLAGS_WITH_FRAGMENT | + RADIOTAP_FLAGS_WEP_ENCRYPTION | + RADIOTAP_FLAGS_FAILED_FCS_CHECK)); + /** reverse fail fcs, 1 means pass FCS in FW, but means + * fail FCS in radiotap */ + rth->body.flags |= (~rt_info.extra_info.flags) & + RADIOTAP_FLAGS_FAILED_FCS_CHECK; + if ((format == MLAN_RATE_FORMAT_HT) && (gi == 1)) + rth->body.flags |= RADIOTAP_FLAGS_USE_SGI_HT; + if (ieee80211_is_mgmt(dot11_hdr->frame_control) || + ieee80211_is_data(dot11_hdr->frame_control)) { + if ((ieee80211_has_morefrags( + dot11_hdr->frame_control)) || + (!ieee80211_is_first_frag( + dot11_hdr->seq_ctrl))) { + rth->body.flags |= + RADIOTAP_FLAGS_WITH_FRAGMENT; + } + } + if (ieee80211_is_data(dot11_hdr->frame_control) && + ieee80211_has_protected(dot11_hdr->frame_control)) { + payload = (t_u8 *)dot11_hdr + + ieee80211_hdrlen( + dot11_hdr->frame_control); + if (!(*(payload + 3) & 0x20)) /** ExtIV bit + shall be 0 for + WEP frame */ + rth->body.flags |= + RADIOTAP_FLAGS_WEP_ENCRYPTION; + } + /** Rate, t_u8 only apply for LG mode */ + if (format == MLAN_RATE_FORMAT_LG) { + rth->hdr.it_present |= cpu_to_le32( + 1 << IEEE80211_RADIOTAP_RATE); + rth->body.rate = rt_info.rate_info.bitrate; + } + /** Channel */ + rth->body.channel.flags = 0; + if (rt_info.chan_num) + chan_num = rt_info.chan_num; + else + chan_num = + handle->mon_if->band_chan_cfg.channel; + band = (chan_num <= 14) ? IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ; + rth->body.channel.frequency = woal_cpu_to_le16( + ieee80211_channel_to_frequency(chan_num, band)); + rth->body.channel.flags |= + woal_cpu_to_le16((band == IEEE80211_BAND_2GHZ) ? + CHANNEL_FLAGS_2GHZ : + CHANNEL_FLAGS_5GHZ); + if (rth->body.channel.flags & + woal_cpu_to_le16(CHANNEL_FLAGS_2GHZ)) + rth->body.channel.flags |= woal_cpu_to_le16( + CHANNEL_FLAGS_DYNAMIC_CCK_OFDM); + else + rth->body.channel.flags |= + woal_cpu_to_le16(CHANNEL_FLAGS_OFDM); + if (handle->mon_if->chandef.chan && + (handle->mon_if->chandef.chan->flags & + (IEEE80211_CHAN_PASSIVE_SCAN | + IEEE80211_CHAN_RADAR))) + rth->body.channel.flags |= woal_cpu_to_le16( + CHANNEL_FLAGS_ONLY_PASSIVSCAN_ALLOW); + /** Antenna */ + rth->body.antenna_signal = -(rt_info.nf - rt_info.snr); + rth->body.antenna_noise = -rt_info.nf; + /* Convert FW antenna value to radiotap spec */ + rth->body.antenna = (t_u16)rt_info.antenna >> 1; + /** MCS */ + if (format == MLAN_RATE_FORMAT_HT) { + rth->hdr.it_present |= cpu_to_le32( + 1 << IEEE80211_RADIOTAP_MCS); + rth->body.u.mcs.known = + rt_info.extra_info.mcs_known; + rth->body.u.mcs.flags = + rt_info.extra_info.mcs_flags; + /** MCS mcs */ + rth->body.u.mcs.known |= + MCS_KNOWN_MCS_INDEX_KNOWN; + rth->body.u.mcs.mcs = + rt_info.rate_info.mcs_index; + /** MCS bw */ + rth->body.u.mcs.known |= MCS_KNOWN_BANDWIDTH; + rth->body.u.mcs.flags &= ~(0x03); /** Clear, + 20MHz as + default */ + if (bw == 1) + rth->body.u.mcs.flags |= RX_BW_40; + /** MCS gi */ + rth->body.u.mcs.known |= + MCS_KNOWN_GUARD_INTERVAL; + rth->body.u.mcs.flags &= ~(1 << 2); + if (gi) + rth->body.u.mcs.flags |= gi << 2; + /** MCS FEC */ + rth->body.u.mcs.known |= MCS_KNOWN_FEC_TYPE; + rth->body.u.mcs.flags &= ~(1 << 4); + if (ldpc) + rth->body.u.mcs.flags |= ldpc << 4; + } + /** VHT */ + if (format == MLAN_RATE_FORMAT_VHT) { + vht_sig1 = rt_info.extra_info.vht_sig1; + vht_sig2 = rt_info.extra_info.vht_sig2; + /** Present Flag */ + rth->hdr.it_present |= cpu_to_le32( + 1 << IEEE80211_RADIOTAP_VHT); + /** STBC */ + rth->body.u.vht.known |= + woal_cpu_to_le16(VHT_KNOWN_STBC); + if (vht_sig1 & MBIT(3)) + rth->body.u.vht.flags |= VHT_FLAG_STBC; + /** TXOP_PS_NA */ + /** TODO: Not support now */ + /** GI */ + rth->body.u.vht.known |= + woal_cpu_to_le16(VHT_KNOWN_GI); + if (vht_sig2 & MBIT(0)) + rth->body.u.vht.flags |= VHT_FLAG_SGI; + /** SGI NSYM DIS */ + rth->body.u.vht.known |= woal_cpu_to_le16( + VHT_KNOWN_SGI_NSYM_DIS); + if (vht_sig2 & MBIT(1)) + rth->body.u.vht.flags |= + VHT_FLAG_SGI_NSYM_M10_9; + /** LDPC_EXTRA_OFDM_SYM */ + /** TODO: Not support now */ + /** BEAMFORMED */ + rth->body.u.vht.known |= + woal_cpu_to_le16(VHT_KNOWN_BEAMFORMED); + if (vht_sig2 & MBIT(8)) + rth->body.u.vht.flags |= + VHT_FLAG_BEAMFORMED; + /** BANDWIDTH */ + rth->body.u.vht.known |= + woal_cpu_to_le16(VHT_KNOWN_BANDWIDTH); + if (bw == 1) + rth->body.u.vht.bandwidth = RX_BW_40; + else if (bw == 2) + rth->body.u.vht.bandwidth = RX_BW_80; + /** GROUP_ID */ + rth->body.u.vht.known |= + woal_cpu_to_le16(VHT_KNOWN_GROUP_ID); + rth->body.u.vht.group_id = + (vht_sig1 & (0x3F0)) >> 4; + /** PARTIAL_AID */ + /** TODO: Not support now */ + /** mcs_nss */ + rth->body.u.vht.mcs_nss[0] = vht_sig2 & (0xF0); + /* Convert FW NSS value to radiotap spec */ + rth->body.u.vht.mcs_nss[0] |= + ((vht_sig1 & (0x1C00)) >> 10) + 1; + /** coding */ + if (vht_sig2 & MBIT(2)) + rth->body.u.vht.coding |= + VHT_CODING_LDPC_USER0; + } + } + skb_set_mac_header(skb, 0); + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = htons(ETH_P_802_2); + memset(skb->cb, 0, sizeof(skb->cb)); + skb->dev = handle->mon_if->mon_ndev; + + handle->mon_if->stats.rx_bytes += skb->len; + handle->mon_if->stats.rx_packets++; + + if (in_interrupt()) + netif_rx(skb); + else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + netif_rx(skb); +#else + netif_rx_ni(skb); +#endif + + status = MLAN_STATUS_PENDING; + } + +done: + + LEAVE(); + return status; +} +#endif +#endif + /** * @brief This function uploads amsdu packet to the network stack * @@ -1373,8 +1659,7 @@ * * @return MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ -mlan_status -moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) +mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) { mlan_status status = MLAN_STATUS_FAILURE; struct sk_buff *skb = NULL; @@ -1388,8 +1673,8 @@ u8 *payload; mlan_buffer mbuf; t_u8 drop = 0; - t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; + t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03, + 0x00, 0x00, 0x00}; wifi_timeval t1, t2; t_s32 delay; @@ -1397,6 +1682,11 @@ t_u32 in_ts_usec = 0; ENTER(); + if (!pmbuf) { + PRINTM(MERROR, "%s: pmbuf is null\n", __func__); + goto done; + } + memset(&mbuf, 0, sizeof(mlan_buffer)); mbuf.bss_index = pmbuf->bss_index; @@ -1418,13 +1708,13 @@ } skb_put(skb, pmbuf->data_len); - //rx_trace 8 + // rx_trace 8 if (handle->tp_acnt.on) { moal_tp_accounting(pmoal, skb, RX_DROP_P4); woal_get_monotonic_time(&t1); in_ts_sec = t1.time_sec; in_ts_usec = t1.time_usec; - if (pmbuf && pmbuf->in_ts_sec) { + if (pmbuf->in_ts_sec) { pmbuf->out_ts_sec = t1.time_sec; pmbuf->out_ts_usec = t1.time_usec; } @@ -1473,7 +1763,12 @@ frame->dev = netdev; frame->priority = skb->priority; payload = frame->data; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) if (ether_addr_equal(payload, rfc1042_eth_hdr)) { +#else + if (!memcmp(payload, rfc1042_eth_hdr, + sizeof(rfc1042_eth_hdr))) { +#endif /* Remove RFC1042 */ skb_pull(frame, 6); memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); @@ -1505,13 +1800,17 @@ netif_receive_skb(frame); local_bh_enable(); } else { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + netif_rx(frame); +#else netif_rx_ni(frame); +#endif } } } } if (handle->tp_acnt.on) { - if (pmbuf && pmbuf->in_ts_sec) + if (pmbuf->in_ts_sec) moal_tp_accounting(handle, pmbuf, RX_TIME_PKT); woal_get_monotonic_time(&t2); @@ -1534,8 +1833,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) +mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) { mlan_status status = MLAN_STATUS_SUCCESS; moal_private *priv = NULL; @@ -1564,8 +1862,8 @@ MLAN_USB_AGGR_MODE_NUM) { max_rx_data_size *= MAX(MLAN_USB_MAX_PKT_SIZE, - cardp->rx_deaggr_ctrl. - aggr_align); + cardp->rx_deaggr_ctrl + .aggr_align); max_rx_data_size = MAX(max_rx_data_size, MLAN_RX_DATA_BUF_SIZE); @@ -1590,6 +1888,18 @@ goto done; } skb_put(skb, pmbuf->data_len); +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (pmbuf->flags & MLAN_BUF_FLAG_NET_MONITOR) { + status = moal_recv_packet_to_mon_if( + pmoal, pmbuf); + if (status == MLAN_STATUS_PENDING) + atomic_dec( + &handle->mbufalloc_count); + goto done; + } +#endif +#endif pmbuf->pdesc = NULL; pmbuf->pbuf = NULL; pmbuf->data_offset = pmbuf->data_len = 0; @@ -1598,29 +1908,39 @@ status = MLAN_STATUS_PENDING; atomic_dec(&handle->mbufalloc_count); } else { - PRINTM(MERROR, - "%s without skb attach!!!\n", __func__); - skb = dev_alloc_skb(pmbuf->data_len + - MLAN_NET_IP_ALIGN); - if (!skb) { - PRINTM(MERROR, - "%s fail to alloc skb\n", + PRINTM(MERROR, "%s without skb attach!!!\n", + __func__); +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + /** drop the packet without skb in + * monitor mode */ + if (pmbuf->flags & MLAN_BUF_FLAG_NET_MONITOR) { + PRINTM(MINFO, + "%s Drop packet without skb\n", __func__); status = MLAN_STATUS_FAILURE; priv->stats.rx_dropped++; + goto done; + } +#endif +#endif + skb = dev_alloc_skb(pmbuf->data_len + + MLAN_NET_IP_ALIGN); + if (!skb) { + PRINTM(MERROR, "%s fail to alloc skb\n", + __func__); + status = MLAN_STATUS_FAILURE; + priv->stats.rx_dropped++; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, - PACKET_TYPE_RX, - RX_PKT_FATE_DRV_DROP_NOBUFS, - FRAME_TYPE_ETHERNET_II, - 0, 0, - (t_u8 - *)(pmbuf-> - pbuf + - pmbuf-> - data_offset), - pmbuf-> - data_len); + woal_packet_fate_monitor( + priv, PACKET_TYPE_RX, + RX_PKT_FATE_DRV_DROP_NOBUFS, + FRAME_TYPE_ETHERNET_II, 0, 0, + (t_u8 *)(pmbuf->pbuf + + pmbuf->data_offset), + pmbuf->data_len); +#endif #endif goto done; } @@ -1635,11 +1955,13 @@ ethh = (struct ethhdr *)(skb->data); if (ntohs(ethh->h_proto) == ETH_P_PAE) { PRINTM(MEVENT, - "wlan: %s Rx EAPOL pkt from " MACSTR - "\n", - priv->netdev->name, - MAC2STR(ethh->h_source)); + "wlan: %s Rx EAPOL pkt from " MACSTR + "\n", + priv->netdev->name, + MAC2STR(ethh->h_source)); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) priv->deauth_evt_cnt = 0; +#endif } if (!netdev) netdev = priv->netdev; @@ -1649,19 +1971,19 @@ #if defined(USB) || defined(PCIE) /* This is only required only in case of 11n and - USB as we alloc if(skb_tailroom(skb) < - pmbuf->data_len){ PRINTM(MERROR,"skb overflow: - tail room=%d, data_len\n", skb_tailroom(skb), - pmbuf->data_len); status = MLAN_STATUS_FAILURE; - priv->stats.rx_dropped++; - goto done; - } - * a buffer of 4K only if its 11N (to be able to - receive 4K AMSDU - * packets). In case of SD we allocate buffers - based on the size - * of packet and hence this is not needed. - */ + USB as we alloc if(skb_tailroom(skb) < + pmbuf->data_len){ PRINTM(MERROR,"skb overflow: + tail room=%d, data_len\n", skb_tailroom(skb), + pmbuf->data_len); status = MLAN_STATUS_FAILURE; + priv->stats.rx_dropped++; + goto done; + } + * a buffer of 4K only if its 11N (to be able to + receive 4K AMSDU + * packets). In case of SD we allocate buffers + based on the size + * of packet and hence this is not needed. + */ /* Modifying the truesize here as our allocation * for each skb is 4K but we only receive 2K * packets and this cause the kernel to start @@ -1683,49 +2005,54 @@ (skb->len - max_rx_data_size); } #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (!woal_filter_packet(priv, skb->data, skb->len, 0)) { - PRINTM(MEVENT, - "drop filtered packet %s\n", + PRINTM(MEVENT, "drop filtered packet %s\n", priv->netdev->name); status = MLAN_STATUS_FAILURE; priv->stats.rx_dropped++; - woal_packet_fate_monitor(priv, PACKET_TYPE_RX, - RX_PKT_FATE_DRV_DROP_FILTER, - FRAME_TYPE_ETHERNET_II, - 0, 0, skb->data, - skb->len); + woal_packet_fate_monitor( + priv, PACKET_TYPE_RX, + RX_PKT_FATE_DRV_DROP_FILTER, + FRAME_TYPE_ETHERNET_II, 0, 0, skb->data, + skb->len); dev_kfree_skb(skb); goto done; } #endif +#endif priv->stats.rx_bytes += skb->len; priv->stats.rx_packets++; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) woal_packet_fate_monitor(priv, PACKET_TYPE_RX, RX_PKT_FATE_SUCCESS, - FRAME_TYPE_ETHERNET_II, - 0, 0, skb->data, skb->len); + FRAME_TYPE_ETHERNET_II, 0, 0, + skb->data, skb->len); +#endif #endif #ifdef ANDROID_KERNEL if (handle->params.wakelock_timeout) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) - __pm_wakeup_event(&handle->ws, - handle->params. - wakelock_timeout); + __pm_wakeup_event( + &handle->ws, + handle->params.wakelock_timeout); #else - wake_lock_timeout(&handle->wake_lock, - msecs_to_jiffies(handle-> - params. - wakelock_timeout)); + wake_lock_timeout( + &handle->wake_lock, + msecs_to_jiffies( + handle->params + .wakelock_timeout)); #endif } #endif if (priv->rx_protocols.protocol_num) { - for (j = 0; - j < priv->rx_protocols.protocol_num; j++) { - if (htons((__force t_u16)skb->protocol) - == priv->rx_protocols.protocols[j]) + for (j = 0; j < priv->rx_protocols.protocol_num; + j++) { + if (htons((__force t_u16) + skb->protocol) == + priv->rx_protocols.protocols[j]) rx_info_flag = MTRUE; } } @@ -1737,15 +2064,14 @@ rxcontrol.antenna = pmbuf->u.rx_info.antenna; rxcontrol.rssi = pmbuf->u.rx_info.rssi; skb_put(skb, sizeof(dot11_rxcontrol)); - memmove(skb->data + - sizeof(dot11_rxcontrol), + memmove(skb->data + sizeof(dot11_rxcontrol), skb->data, skb->len - sizeof(dot11_rxcontrol)); moal_memcpy_ext(handle, skb->data, &rxcontrol, sizeof(dot11_rxcontrol), sizeof(dot11_rxcontrol)); } - //rx_trace 8 + // rx_trace 8 if (priv->phandle->tp_acnt.on) { wifi_timeval t; moal_tp_accounting(handle, skb, RX_DROP_P4); @@ -1770,7 +2096,11 @@ netif_receive_skb(skb); local_bh_enable(); } else { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + netif_rx(skb); +#else netif_rx_ni(skb); +#endif } } } @@ -1787,8 +2117,7 @@ } #if defined(PCIE) || defined(SDIO) -void -woal_request_busfreq_pmqos_add(t_void *handle) +void woal_request_busfreq_pmqos_add(t_void *handle) { moal_handle *pmhandle = (moal_handle *)handle; #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 70) @@ -1800,25 +2129,30 @@ #endif if (moal_extflg_isset(pmhandle, EXT_PMQOS)) { #if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 6, 0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) #ifdef IMX_SUPPORT - pm_qos_add_request(&pmhandle->woal_pm_qos_req, - PM_QOS_CPU_DMA_LATENCY, 0); + if (!pm_qos_request_active(&pmhandle->woal_pm_qos_req)) + pm_qos_add_request(&pmhandle->woal_pm_qos_req, + PM_QOS_CPU_DMA_LATENCY, 0); + else + PRINTM(MERROR, "PM-QOS request already active\n"); #endif #endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) #ifdef IMX_SUPPORT - cpu_latency_qos_add_request(&pmhandle->woal_pm_qos_req, 0); + if (!cpu_latency_qos_request_active(&pmhandle->woal_pm_qos_req)) + cpu_latency_qos_add_request(&pmhandle->woal_pm_qos_req, + 0); + else + PRINTM(MERROR, "PM-QOS request already active\n"); #endif #endif } return; } -void -woal_release_busfreq_pmqos_remove(t_void *handle) +void woal_release_busfreq_pmqos_remove(t_void *handle) { - moal_handle *pmhandle = (moal_handle *)handle; #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 70) #ifdef IMX_SUPPORT @@ -1830,20 +2164,27 @@ if (moal_extflg_isset(pmhandle, EXT_PMQOS)) { #if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 6, 0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) #ifdef IMX_SUPPORT - pm_qos_remove_request(&pmhandle->woal_pm_qos_req); + if (pm_qos_request_active(&pmhandle->woal_pm_qos_req)) + pm_qos_remove_request(&pmhandle->woal_pm_qos_req); + else + PRINTM(MERROR, "PM-QOS request already removed\n"); #endif #endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) #ifdef IMX_SUPPORT - cpu_latency_qos_remove_request(&pmhandle->woal_pm_qos_req); + if (cpu_latency_qos_request_active(&pmhandle->woal_pm_qos_req)) + cpu_latency_qos_remove_request( + &pmhandle->woal_pm_qos_req); + else + PRINTM(MERROR, "PM-QOS request already removed\n"); #endif #endif } return; } -#endif /*defined(PCIE) || defined(SDIO) */ +#endif /*defined(PCIE) || defined(SDIO)*/ /** * @brief This function checks media_connected state for @@ -1852,13 +2193,13 @@ * @param pmoal Pointer to the MOAL context * */ -int -woal_check_media_connected(t_void *pmoal) +int woal_check_media_connected(t_void *pmoal) { int i; moal_handle *pmhandle = (moal_handle *)pmoal; moal_private *pmpriv = NULL; - for (i = 0; i < pmhandle->priv_num && (pmpriv = pmhandle->priv[i]); i++) { + for (i = 0; i < pmhandle->priv_num; i++) { + pmpriv = pmhandle->priv[i]; if (!pmpriv) continue; if (pmpriv->media_connected == MTRUE) { @@ -1875,12 +2216,10 @@ * @param pmoal Pointer to the MOAL context * */ -static void -moal_connection_status_check_pmqos(t_void *pmoal) +void moal_connection_status_check_pmqos(t_void *pmoal) { moal_handle *pmhandle = (moal_handle *)pmoal; if ((woal_check_media_connected(pmoal) == MTRUE)) { - if (pmhandle->request_pm == MFALSE) { pmhandle->request_pm = MTRUE; #if defined(PCIE) || defined(SDIO) @@ -1895,9 +2234,9 @@ #endif } } - } +#ifdef UAP_SUPPORT #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) /** @@ -1909,8 +2248,7 @@ * * @return N/A */ -static void -woal_rx_mgmt_pkt_event(moal_private *priv, t_u8 *pkt, t_u16 len) +static void woal_rx_mgmt_pkt_event(moal_private *priv, t_u8 *pkt, t_u16 len) { struct woal_event *evt; unsigned long flags; @@ -1932,6 +2270,7 @@ } #endif #endif +#endif /** * @brief This function handles event receive @@ -1941,8 +2280,7 @@ * * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_recv_event(t_void *pmoal, pmlan_event pmevent) +mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) { #ifdef STA_SUPPORT int custom_len = 0; @@ -1966,11 +2304,27 @@ moal_handle *ref_handle = NULL; #ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + t_u8 enable = 1; +#endif + t_u8 *req_ie = NULL; + t_u16 ie_len = 0; + apinfo *pinfo = NULL, *req_tlv = NULL; + MrvlIEtypesHeader_t *tlv = NULL; + t_u16 tlv_type = 0, tlv_len = 0, tlv_buf_left = 0; +#endif +#ifdef STA_CFG80211 t_u8 hw_test; #endif int cfg80211_wext; #ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + struct cfg80211_roam_info *roam_info = NULL; +#endif +#endif + t_u16 csi_len; +#ifdef STA_CFG80211 t_u8 channel_status; moal_private *remain_priv = NULL; #endif @@ -1978,6 +2332,19 @@ chan_band_info *pchan_info = NULL; #endif t_u8 radar_detected; + t_u8 bandwidth; + t_u8 event_buf[64]; + t_u8 radar_chan; +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + moal_private *cfg_priv = NULL; +#endif +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#ifdef UAP_CFG80211 + unsigned long wait_time, wait_time_ms, timeout; +#endif +#endif t_u8 auto_fw_dump = MFALSE; ENTER(); @@ -1989,6 +2356,7 @@ } woal_store_firmware_dump(pmoal, pmevent); handle->driver_status = MTRUE; + wifi_status = WIFI_STATUS_FW_DUMP; ref_handle = (moal_handle *)handle->pref_mac; if (ref_handle) ref_handle->driver_status = MTRUE; @@ -2109,32 +2477,34 @@ if (priv->phandle->scan_request) { PRINTM(MINFO, "Reporting scan results\n"); - woal_inform_bss_from_scan_result(priv, - NULL, - MOAL_NO_WAIT); + woal_inform_bss_from_scan_result( + priv, NULL, MOAL_NO_WAIT); if (!priv->phandle->first_scan_done) { priv->phandle->first_scan_done = MTRUE; - woal_set_scan_time(priv, - ACTIVE_SCAN_CHAN_TIME, - PASSIVE_SCAN_CHAN_TIME, - SPECIFIC_SCAN_CHAN_TIME); + woal_set_scan_time( + priv, + ACTIVE_SCAN_CHAN_TIME, + PASSIVE_SCAN_CHAN_TIME, + SPECIFIC_SCAN_CHAN_TIME); } - spin_lock_irqsave(&priv->phandle-> - scan_req_lock, flags); + spin_lock_irqsave( + &priv->phandle->scan_req_lock, + flags); if (priv->phandle->scan_request) { cancel_delayed_work( - &priv->phandle->scan_timeout_work); - woal_cfg80211_scan_done(priv-> - phandle-> - scan_request, - MFALSE); + &priv->phandle + ->scan_timeout_work); + woal_cfg80211_scan_done( + priv->phandle + ->scan_request, + MFALSE); priv->phandle->scan_request = NULL; } - spin_unlock_irqrestore(&priv->phandle-> - scan_req_lock, - flags); + spin_unlock_irqrestore( + &priv->phandle->scan_req_lock, + flags); } } #endif /* STA_CFG80211 */ @@ -2153,10 +2523,10 @@ if (!is_zero_timeval(priv->phandle->scan_time_start)) { woal_get_monotonic_time(&priv->phandle->scan_time_end); priv->phandle->scan_time += - (t_u64)(timeval_to_usec - (priv->phandle->scan_time_end) - - timeval_to_usec(priv->phandle-> - scan_time_start)); + (t_u64)(timeval_to_usec( + priv->phandle->scan_time_end) - + timeval_to_usec( + priv->phandle->scan_time_start)); PRINTM(MINFO, "%s : start_timeval=%d:%d end_timeval=%d:%d inter=%llu scan_time=%llu\n", __func__, @@ -2164,10 +2534,10 @@ priv->phandle->scan_time_start.time_usec, priv->phandle->scan_time_end.time_sec, priv->phandle->scan_time_end.time_usec, - (t_u64)(timeval_to_usec - (priv->phandle->scan_time_end) - - timeval_to_usec(priv->phandle-> - scan_time_start)), + (t_u64)(timeval_to_usec( + priv->phandle->scan_time_end) - + timeval_to_usec( + priv->phandle->scan_time_start)), priv->phandle->scan_time); priv->phandle->scan_time_start.time_sec = 0; priv->phandle->scan_time_start.time_usec = 0; @@ -2182,7 +2552,8 @@ case MLAN_EVENT_ID_DRV_OBSS_SCAN_PARAM: memmove((pmevent->event_buf + strlen(CUS_EVT_OBSS_SCAN_PARAM) + - 1), pmevent->event_buf, pmevent->event_len); + 1), + pmevent->event_buf, pmevent->event_len); moal_memcpy_ext(priv->phandle, pmevent->event_buf, (t_u8 *)CUS_EVT_OBSS_SCAN_PARAM, strlen(CUS_EVT_OBSS_SCAN_PARAM), @@ -2190,14 +2561,14 @@ pmevent->event_buf[strlen(CUS_EVT_OBSS_SCAN_PARAM)] = 0; woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len + - strlen(CUS_EVT_OBSS_SCAN_PARAM)); + strlen(CUS_EVT_OBSS_SCAN_PARAM)); #ifdef STA_WEXT if (IS_STA_WEXT(cfg80211_wext)) { memset(&wrqu, 0, sizeof(union iwreq_data)); wrqu.data.pointer = (t_u8 __user *)pmevent->event_buf; wrqu.data.length = pmevent->event_len + - strlen(CUS_EVT_OBSS_SCAN_PARAM) + 1; + strlen(CUS_EVT_OBSS_SCAN_PARAM) + 1; wireless_send_event(priv->netdev, IWEVCUSTOM, &wrqu, pmevent->event_buf); } @@ -2213,14 +2584,14 @@ pmevent->event_buf[strlen(CUS_EVT_BW_CHANGED)] = 0; woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len + - strlen(CUS_EVT_BW_CHANGED)); + strlen(CUS_EVT_BW_CHANGED)); #ifdef STA_WEXT if (IS_STA_WEXT(cfg80211_wext)) { memset(&wrqu, 0, sizeof(union iwreq_data)); wrqu.data.pointer = (t_u8 __user *)pmevent->event_buf; wrqu.data.length = pmevent->event_len + - strlen(CUS_EVT_BW_CHANGED) + 1; + strlen(CUS_EVT_BW_CHANGED) + 1; wireless_send_event(priv->netdev, IWEVCUSTOM, &wrqu, pmevent->event_buf); } @@ -2246,11 +2617,20 @@ #endif #ifdef REASSOCIATION if (priv->reassoc_on == MTRUE) { - PRINTM(MINFO, "Reassoc: trigger the timer\n"); - priv->reassoc_required = MTRUE; - priv->phandle->is_reassoc_timer_set = MTRUE; - woal_mod_timer(&priv->phandle->reassoc_timer, - REASSOC_TIMER_DEFAULT); + if (priv->auto_assoc_priv.auto_assoc_type_on & + (0x1 << (AUTO_ASSOC_TYPE_DRV_RECONN - 1))) { + PRINTM(MINFO, + " auto assoc: trigger driver auto re-connect\n"); + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_DRV_RECONN; + priv->auto_assoc_priv.drv_reconnect.status = + MTRUE; + PRINTM(MINFO, "Reassoc: trigger the timer\n"); + priv->reassoc_required = MTRUE; + priv->phandle->is_reassoc_timer_set = MTRUE; + woal_mod_timer(&priv->phandle->reassoc_timer, + REASSOC_TIMER_DEFAULT); + } } else { priv->rate_index = AUTO_RATE; } @@ -2313,20 +2693,20 @@ #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 35) - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, + cfg80211_cqm_rssi_notify( + priv->netdev, + NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - *(t_s16 *)pmevent->event_buf, + *(t_s16 *)pmevent->event_buf, #endif - GFP_KERNEL); + GFP_KERNEL); priv->last_event |= EVENT_BCN_RSSI_LOW; #endif if (!hw_test && priv->roaming_enabled) woal_config_bgscan_and_rssi(priv, MTRUE); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_cfg80211_rssi_monitor_event(priv, - *(t_s16 *)pmevent-> - event_buf); + woal_cfg80211_rssi_monitor_event( + priv, *(t_s16 *)pmevent->event_buf); #endif } #endif @@ -2343,22 +2723,21 @@ if (IS_STA_CFG80211(cfg80211_wext)) { if (!priv->mrvl_rssi_low) { #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 35) - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, + cfg80211_cqm_rssi_notify( + priv->netdev, + NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - *(t_s16 *)pmevent-> - event_buf, + *(t_s16 *)pmevent->event_buf, #endif - GFP_KERNEL); + GFP_KERNEL); #endif - woal_set_rssi_threshold(priv, - MLAN_EVENT_ID_FW_BCN_RSSI_HIGH, - MOAL_NO_WAIT); + woal_set_rssi_threshold( + priv, MLAN_EVENT_ID_FW_BCN_RSSI_HIGH, + MOAL_NO_WAIT); } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_cfg80211_rssi_monitor_event(priv, - *(t_s16 *)pmevent-> - event_buf); + woal_cfg80211_rssi_monitor_event( + priv, *(t_s16 *)pmevent->event_buf); #endif } #endif @@ -2437,7 +2816,9 @@ if (IS_STA_WEXT(cfg80211_wext)) woal_send_iwevcustom_event(priv, CUS_EVT_PORT_RELEASE); #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) priv->deauth_evt_cnt = 0; +#endif woal_broadcast_event(priv, CUS_EVT_PORT_RELEASE, strlen(CUS_EVT_PORT_RELEASE)); break; @@ -2451,23 +2832,36 @@ #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 35) if (IS_STA_CFG80211(cfg80211_wext)) { struct cfg80211_bss *bss = NULL; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + bss = cfg80211_get_bss(priv->wdev->wiphy, NULL, + priv->cfg_bssid, NULL, 0, + IEEE80211_BSS_TYPE_ESS, + IEEE80211_PRIVACY_ANY); + +#else bss = cfg80211_get_bss(priv->wdev->wiphy, NULL, priv->cfg_bssid, NULL, 0, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); +#endif if (bss) { cfg80211_unlink_bss(priv->wdev->wiphy, bss); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(priv->wdev->wiphy, bss); +#else + cfg80211_put_bss(bss); +#endif } if (!hw_test && priv->roaming_enabled) woal_config_bgscan_and_rssi(priv, MFALSE); else { - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, + cfg80211_cqm_rssi_notify( + priv->netdev, + NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - 0, + 0, #endif - GFP_KERNEL); + GFP_KERNEL); } priv->last_event |= EVENT_PRE_BCN_LOST; } @@ -2489,13 +2883,13 @@ pmevent->event_buf[strlen(FW_DEBUG_INFO)] = 0; woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len + - strlen(FW_DEBUG_INFO) + 1); + strlen(FW_DEBUG_INFO) + 1); break; case MLAN_EVENT_ID_FW_WMM_CONFIG_CHANGE: #ifdef STA_WEXT if (IS_STA_WEXT(cfg80211_wext)) - woal_send_iwevcustom_event(priv, - WMM_CONFIG_CHANGE_INDICATION); + woal_send_iwevcustom_event( + priv, WMM_CONFIG_CHANGE_INDICATION); #endif woal_broadcast_event(priv, WMM_CONFIG_CHANGE_INDICATION, strlen(WMM_CONFIG_CHANGE_INDICATION)); @@ -2547,13 +2941,15 @@ ref_handle = (moal_handle *)priv->phandle->pref_mac; if (ref_handle) ref_handle->driver_status = MTRUE; +#ifdef DEBUG_LEVEL1 if (drvdbg & MFW_D) auto_fw_dump = MTRUE; +#endif woal_moal_debug_info(priv, NULL, MFALSE); if (!auto_fw_dump && !handle->fw_dump) woal_process_hang(priv->phandle); - wifi_status = 2; + wifi_status = WIFI_STATUS_WIFI_HANG; break; case MLAN_EVENT_ID_DRV_WIFI_STATUS: wifi_status = *(t_u16 *)(pmevent->event_buf + sizeof(t_u32)); @@ -2587,29 +2983,33 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) && !priv->phandle->cfg80211_suspend #endif - ) { + ) { priv->roaming_required = MTRUE; #ifdef ANDROID_KERNEL #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) __pm_wakeup_event(&priv->phandle->ws, ROAMING_WAKE_LOCK_TIMEOUT); #else - wake_lock_timeout(&priv->phandle->wake_lock, - msecs_to_jiffies - (ROAMING_WAKE_LOCK_TIMEOUT)); + wake_lock_timeout( + &priv->phandle->wake_lock, + msecs_to_jiffies( + ROAMING_WAKE_LOCK_TIMEOUT)); #endif #endif - wake_up_interruptible(&priv->phandle-> - reassoc_thread.wait_q); +#ifdef REASSOCIATION + wake_up_interruptible( + &priv->phandle->reassoc_thread.wait_q); +#endif } else { #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 35) if (priv->mrvl_rssi_low) { - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, + cfg80211_cqm_rssi_notify( + priv->netdev, + NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - 0, + 0, #endif - GFP_KERNEL); + GFP_KERNEL); } #endif } @@ -2649,11 +3049,70 @@ case MLAN_EVENT_ID_FW_CHANNEL_REPORT_RDY: radar_detected = pmevent->event_buf[0]; + bandwidth = pmevent->event_buf[2]; +#ifdef UAP_SUPPORT + if (priv->chan_rpt_req.chanNum && priv->chan_rpt_pending) { + radar_chan = pmevent->event_buf[1]; + if (radar_detected) { + snprintf(event_buf, sizeof(event_buf) - 1, + "%s %d", CUS_EVT_RADAR_DETECTED, + radar_chan); + woal_broadcast_event(priv, event_buf, + strlen(event_buf)); + } else { + snprintf(event_buf, sizeof(event_buf) - 1, + "%s %d", CUS_EVT_CAC_FINISHED, + priv->chan_rpt_req.chanNum); + woal_broadcast_event(priv, event_buf, + strlen(event_buf)); + } + if (priv->bss_type == MLAN_BSS_TYPE_DFS) + woal_chan_event(priv, WOAL_EVENT_CHAN_RPT, + priv->chan_rpt_req.chanNum, + radar_detected); + } +#endif #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) if (!IS_STA_OR_UAP_CFG80211(cfg80211_wext)) break; + if (priv->chan_rpt_req.chanNum && priv->chan_rpt_pending) { + priv->chan_rpt_pending = MFALSE; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + if (priv->radar_background) { + PRINTM(MEVENT, + "%s radar found when background CAC \n", + radar_detected ? "" : "No"); + if (radar_detected) + cfg80211_background_radar_event( + priv->phandle->wiphy, + &priv->radar_background_chan, + GFP_ATOMIC); + break; + } +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + cfg_priv = woal_get_priv_with_wdev(priv->phandle); + if (cfg_priv) { + if (radar_detected) + woal_update_channels_dfs_state( + cfg_priv, + priv->chan_rpt_req.chanNum, + priv->chan_rpt_req.bandcfg + .chanWidth, + DFS_UNAVAILABLE); + else + woal_update_channels_dfs_state( + cfg_priv, + priv->chan_rpt_req.chanNum, + priv->chan_rpt_req.bandcfg + .chanWidth, + DFS_AVAILABLE); + } +#endif + break; + } if (priv->phandle->is_cac_timer_set) { PRINTM(MEVENT, "%s radar found when CAC \n", @@ -2672,10 +3131,39 @@ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); #endif - cfg80211_radar_event(priv->wdev->wiphy, - &priv->phandle-> - dfs_channel, GFP_KERNEL); + cfg80211_radar_event( + priv->wdev->wiphy, + &priv->phandle->dfs_channel, + GFP_KERNEL); } else { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) + if (!priv->user_cac_period_msec) { + // host and device timer isn't sync,add + // delay to avoid kernel warning + // WARN_ON(!time_after_eq(jiffies, + // timeout)); mdelay(100); Using + // optimized delay + timeout = + (priv->wdev->cac_start_time + + msecs_to_jiffies( + priv->wdev + ->cac_time_ms)); + if (!time_after_eq(jiffies, timeout)) { + /* Exact time to make host and + * device timer in sync */ + wait_time = timeout - jiffies; + wait_time_ms = + jiffies_to_msecs( + wait_time) + + 3; + PRINTM(MEVENT, + "Waiting for %ld ms for syncing\n", + wait_time_ms); + mdelay(wait_time_ms); + } + } +#endif + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel, @@ -2695,11 +3183,48 @@ #endif /* UAP_CFG80211 */ break; case MLAN_EVENT_ID_FW_RADAR_DETECTED: + radar_chan = pmevent->event_buf[0]; + bandwidth = pmevent->event_buf[1]; + snprintf(event_buf, sizeof(event_buf) - 1, "%s %d", + CUS_EVT_RADAR_DETECTED, radar_chan); + woal_broadcast_event(priv, event_buf, strlen(event_buf)); + PRINTM(MEVENT, "Radar detected on channel %d\n", radar_chan); #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) if (!IS_STA_OR_UAP_CFG80211(cfg80211_wext)) break; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + if (priv->radar_background) { + cfg80211_background_radar_event( + priv->phandle->wiphy, + &priv->radar_background_chan, GFP_ATOMIC); + break; + } +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + cfg_priv = woal_get_priv_with_wdev(priv->phandle); + if (cfg_priv) + woal_update_channels_dfs_state(cfg_priv, radar_chan, + bandwidth, + DFS_UNAVAILABLE); +#endif +#ifdef UAP_SUPPORT + if ((priv->target_chan && priv->bss_started && + (priv->target_chan != radar_chan)) || + priv->backup_chan) { + PRINTM(MEVENT, "Move to target or backup chan %d %d\n", + priv->target_chan, priv->backup_chan); + woal_move_to_next_channel(priv); + priv->target_chan = 0; + break; + } + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { + woal_chan_event(priv, WOAL_EVENT_RADAR, + priv->chan_rpt_req.chanNum, MTRUE); + break; + } +#endif if (priv->phandle->is_cac_timer_set) { if (priv->bss_index == priv->phandle->cac_bss_index) { PRINTM(MEVENT, "radar detected during CAC \n"); @@ -2720,9 +3245,10 @@ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); #endif - cfg80211_radar_event(priv->wdev->wiphy, - &priv->phandle-> - dfs_channel, GFP_KERNEL); + cfg80211_radar_event( + priv->wdev->wiphy, + &priv->phandle->dfs_channel, + GFP_KERNEL); memset(&priv->phandle->dfs_channel, 0, sizeof(priv->phandle->dfs_channel)); @@ -2734,9 +3260,9 @@ } else { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) - woal_cfg80211_dfs_vendor_event(priv, - event_dfs_radar_detected, - &priv->chan); + woal_cfg80211_dfs_vendor_event( + priv, event_dfs_radar_detected, + &priv->chan); else { #endif if (priv->uap_host_based && priv->bss_started) @@ -2762,48 +3288,7 @@ case MLAN_EVENT_ID_FW_CHAN_SWITCH_COMPLETE: #if defined(UAP_CFG80211) || defined(STA_CFG80211) - pchan_info = (chan_band_info *) pmevent->event_buf; - if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { - PRINTM(MMSG, - "CSA/ECSA: Switch to new channel %d complete!\n", - pchan_info->channel); - priv->channel = pchan_info->channel; -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - if (priv->csa_chan.chan && - (pchan_info->channel == - priv->csa_chan.chan->hw_value)) { - moal_memcpy_ext(priv->phandle, &priv->chan, - &priv->csa_chan, - sizeof(struct - cfg80211_chan_def), - sizeof(struct - cfg80211_chan_def)); - } -#endif -#endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - if (MFALSE -#ifdef UAP_CFG80211 - || priv->uap_host_based -#endif -#ifdef STA_CFG80211 - || priv->sme_current.ssid_len -#endif - ) { - PRINTM(MEVENT, - "CHAN_SWITCH: 11n=%d, chan=%d, center_chan=%d, band=%d, width=%d, 2Offset=%d\n", - pchan_info->is_11n_enabled, - pchan_info->channel, - pchan_info->center_chan, - pchan_info->bandcfg.chanBand, - pchan_info->bandcfg.chanWidth, - pchan_info->bandcfg.chan2Offset); - woal_cfg80211_notify_channel(priv, pchan_info); - } -#endif - } -#endif + pchan_info = (chan_band_info *)pmevent->event_buf; #ifdef UAP_SUPPORT if (priv->bss_role == MLAN_BSS_ROLE_UAP) { if (priv->uap_tx_blocked) { @@ -2816,6 +3301,52 @@ wake_up_interruptible(&priv->phandle->chsw_wait_q); } #endif + snprintf(event_buf, sizeof(event_buf) - 1, "%s %d", + CUS_EVT_CHAN_SWITCH_COMPLETE, pchan_info->channel); + woal_broadcast_event(priv, event_buf, strlen(event_buf)); + if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { + PRINTM(MMSG, + "CSA/ECSA: Switch to new channel %d complete!\n", + pchan_info->channel); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + if (priv->csa_chan.chan && + (pchan_info->channel == + priv->csa_chan.chan->hw_value)) { + moal_memcpy_ext( + priv->phandle, &priv->chan, + &priv->csa_chan, + sizeof(struct cfg80211_chan_def), + sizeof(struct cfg80211_chan_def)); + } +#endif +#endif + if (priv->channel == pchan_info->channel) + break; + priv->channel = pchan_info->channel; + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (MFALSE +#ifdef UAP_CFG80211 + || priv->uap_host_based +#endif +#ifdef STA_CFG80211 + || priv->sme_current.ssid_len +#endif + ) { + PRINTM(MEVENT, + "CHAN_SWITCH: 11n=%d, chan=%d, center_chan=%d, band=%d, width=%d, 2Offset=%d\n", + pchan_info->is_11n_enabled, + pchan_info->channel, + pchan_info->center_chan, + pchan_info->bandcfg.chanBand, + pchan_info->bandcfg.chanWidth, + pchan_info->bandcfg.chan2Offset); + woal_channel_switch_event(priv, pchan_info); + } +#endif + } +#endif break; case MLAN_EVENT_ID_FW_STOP_TX: woal_stop_queue(priv->netdev); @@ -2914,8 +3445,12 @@ woal_start_queue(priv->netdev); moal_memcpy_ext(priv->phandle, priv->current_addr, pmevent->event_buf + 6, ETH_ALEN, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(priv->netdev, priv->current_addr); +#else moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr, priv->current_addr, ETH_ALEN, ETH_ALEN); +#endif woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len); #ifdef STA_SUPPORT @@ -2933,7 +3468,11 @@ PRINTM(MMSG, "Channel Under Nop: notify cfg80211 new channel=%d\n", priv->channel); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0, 0); +#else cfg80211_ch_switch_notify(priv->netdev, &priv->chan); +#endif priv->chan_under_nop = MFALSE; } #endif @@ -2943,7 +3482,7 @@ case MLAN_EVENT_ID_DRV_UAP_CHAN_INFO: #ifdef UAP_CFG80211 if (IS_UAP_CFG80211(cfg80211_wext)) { - pchan_info = (chan_band_info *) pmevent->event_buf; + pchan_info = (chan_band_info *)pmevent->event_buf; PRINTM(MEVENT, "UAP: 11n=%d, chan=%d, center_chan=%d, band=%d, width=%d, 2Offset=%d\n", pchan_info->is_11n_enabled, pchan_info->channel, @@ -2973,24 +3512,23 @@ pmevent->event_len); moal_connection_status_check_pmqos(pmoal); break; - case MLAN_EVENT_ID_UAP_FW_MIC_COUNTERMEASURES:{ - t_u16 status = 0; - status = *(t_u16 *)(pmevent->event_buf + 4); - if (status) { - priv->media_connected = MFALSE; - woal_stop_queue(priv->netdev); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - } else { - priv->media_connected = MTRUE; - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - woal_wake_queue(priv->netdev); - } - woal_broadcast_event(priv, pmevent->event_buf, - pmevent->event_len); + case MLAN_EVENT_ID_UAP_FW_MIC_COUNTERMEASURES: { + t_u16 status = 0; + status = *(t_u16 *)(pmevent->event_buf + 4); + if (status) { + priv->media_connected = MFALSE; + woal_stop_queue(priv->netdev); + if (netif_carrier_ok(priv->netdev)) + netif_carrier_off(priv->netdev); + } else { + priv->media_connected = MTRUE; + if (!netif_carrier_ok(priv->netdev)) + netif_carrier_on(priv->netdev); + woal_wake_queue(priv->netdev); } - break; + woal_broadcast_event(priv, pmevent->event_buf, + pmevent->event_len); + } break; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) case MLAN_EVENT_ID_FW_REMAIN_ON_CHAN_EXPIRED: @@ -2998,35 +3536,38 @@ PRINTM(MEVENT, "FW_REMAIN_ON_CHANNEL_EXPIRED cookie = %#llx\n", priv->phandle->cookie); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme && (priv->auth_flag & HOST_MLME_AUTH_PENDING)) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + if (priv->assoc_bss) { + PRINTM(MEVENT, + "wlan: HostMlme auth timeout\n"); + cfg80211_auth_timeout( + priv->netdev, + priv->assoc_bss->bssid); + } +#endif priv->auth_flag = 0; priv->host_mlme = MFALSE; priv->auth_alg = 0xFFFF; } +#endif priv->phandle->remain_on_channel = MFALSE; if (priv->phandle->cookie && !priv->phandle->is_remain_timer_set) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - priv-> - netdev, + priv->netdev, #else - priv-> - wdev, + priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle-> - chan, + priv->phandle->cookie, + &priv->phandle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } } @@ -3048,12 +3589,7 @@ moal_memcpy_ext(priv->phandle, addr, pmevent->event_buf, ETH_ALEN, ETH_ALEN); - /** these field add in kernel 3.2, but some - * kernel do have the pacth to support it, - * like T3T and pxa978T 3.0.31 JB, these - * patch are needed to support - * wpa_supplicant 2.x */ -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 31) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) if (pmevent->event_len > ETH_ALEN) { #if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 0, 0) /* set station info filled flag */ @@ -3063,11 +3599,12 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) sinfo->pertid = NULL; #endif - /* get the assoc request ies and length */ + /* get the assoc request ies and length + */ sinfo->assoc_req_ies = - (const t_u8 *)(pmevent-> - event_buf + - ETH_ALEN); + (const t_u8 + *)(pmevent->event_buf + + ETH_ALEN); sinfo->assoc_req_ies_len = pmevent->event_len - ETH_ALEN; } @@ -3081,7 +3618,8 @@ } #endif /* UAP_CFG80211 */ memmove((pmevent->event_buf + strlen(CUS_EVT_STA_CONNECTED) + - 1), pmevent->event_buf, pmevent->event_len); + 1), + pmevent->event_buf, pmevent->event_len); moal_memcpy_ext(priv->phandle, pmevent->event_buf, (t_u8 *)CUS_EVT_STA_CONNECTED, strlen(CUS_EVT_STA_CONNECTED), @@ -3089,7 +3627,7 @@ pmevent->event_buf[strlen(CUS_EVT_STA_CONNECTED)] = 0; woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len + - strlen(CUS_EVT_STA_CONNECTED)); + strlen(CUS_EVT_STA_CONNECTED)); #ifdef UAP_WEXT if (IS_UAP_WEXT(cfg80211_wext)) { memset(&wrqu, 0, sizeof(union iwreq_data)); @@ -3115,20 +3653,18 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /**Forward Deauth, Auth and disassoc frame to Host*/ if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { - t_u16 reason_code = - woal_le16_to_cpu(*(t_u16 *)pmevent-> - event_buf); + t_u16 reason_code = woal_le16_to_cpu( + *(t_u16 *)pmevent->event_buf); PRINTM(MCMND, "deauth reason code =0x%x\n", reason_code); /** BIT 14 indicate deauth is initiated by FW */ if (reason_code & MBIT(14)) - woal_host_mlme_disconnect(priv, 0, - pmevent-> - event_buf + - 2); + woal_host_mlme_disconnect( + priv, 0, + pmevent->event_buf + 2); } else #endif - if (priv->netdev && priv->wdev) + if (priv->netdev && priv->wdev) cfg80211_del_sta(priv->netdev, pmevent->event_buf + 2, GFP_KERNEL); @@ -3137,7 +3673,8 @@ } #endif /* UAP_CFG80211 */ memmove((pmevent->event_buf + strlen(CUS_EVT_STA_DISCONNECTED) + - 1), pmevent->event_buf, pmevent->event_len); + 1), + pmevent->event_buf, pmevent->event_len); moal_memcpy_ext(priv->phandle, pmevent->event_buf, (t_u8 *)CUS_EVT_STA_DISCONNECTED, strlen(CUS_EVT_STA_DISCONNECTED), @@ -3145,14 +3682,14 @@ pmevent->event_buf[strlen(CUS_EVT_STA_DISCONNECTED)] = 0; woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len + - strlen(CUS_EVT_STA_DISCONNECTED)); + strlen(CUS_EVT_STA_DISCONNECTED)); #ifdef UAP_WEXT if (IS_UAP_WEXT(cfg80211_wext)) { memset(&wrqu, 0, sizeof(union iwreq_data)); wrqu.data.pointer = (t_u8 __user *)pmevent->event_buf; wrqu.data.length = pmevent->event_len + - strlen(CUS_EVT_STA_DISCONNECTED) + 1; + strlen(CUS_EVT_STA_DISCONNECTED) + 1; wireless_send_event(priv->netdev, IWEVCUSTOM, &wrqu, pmevent->event_buf); } @@ -3178,8 +3715,8 @@ t_u8 *pkt; int freq = priv->phandle->remain_on_channel ? - priv->phandle->chan.center_freq : - woal_get_active_intf_freq(priv); + priv->phandle->chan.center_freq : + woal_get_active_intf_freq(priv); if (!freq) { if (!priv->phandle->chan.center_freq) { PRINTM(MINFO, @@ -3196,81 +3733,68 @@ memmove(pkt + PACKET_ADDR4_POS, pkt + PACKET_ADDR4_POS + ETH_ALEN, pmevent->event_len - - sizeof(pmevent->event_id) - - PACKET_ADDR4_POS - ETH_ALEN); + sizeof(pmevent->event_id) - + PACKET_ADDR4_POS - ETH_ALEN); #ifdef WIFI_DIRECT_SUPPORT - if (ieee80211_is_action(((struct ieee80211_mgmt - *)pkt) - ->frame_control)) - woal_cfg80211_display_p2p_actframe(pkt, - pmevent-> - event_len - - - sizeof - (pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH, - ieee80211_get_channel - (priv-> - wdev-> - wiphy, - freq), - MFALSE); + if (ieee80211_is_action( + ((struct ieee80211_mgmt *)pkt) + ->frame_control)) + woal_cfg80211_display_p2p_actframe( + pkt, + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH, + ieee80211_get_channel( + priv->wdev->wiphy, + freq), + MFALSE); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /**Forward Deauth, Auth and disassoc frame to * Host*/ if (priv->host_mlme && (GET_BSS_ROLE(priv) != MLAN_BSS_ROLE_UAP) && - (ieee80211_is_deauth(((struct ieee80211_mgmt - *)pkt) - ->frame_control) || - ieee80211_is_auth(((struct ieee80211_mgmt - *)pkt) - ->frame_control) || - ieee80211_is_disassoc(((struct - ieee80211_mgmt *) - pkt) - ->frame_control))) { - if (ieee80211_is_auth(((struct - ieee80211_mgmt - *) - pkt) - ->frame_control)) { + (ieee80211_is_deauth( + ((struct ieee80211_mgmt *)pkt) + ->frame_control) || + ieee80211_is_auth( + ((struct ieee80211_mgmt *)pkt) + ->frame_control) || + ieee80211_is_disassoc( + ((struct ieee80211_mgmt *)pkt) + ->frame_control))) { + if (ieee80211_is_auth( + ((struct ieee80211_mgmt *) + pkt) + ->frame_control)) { priv->auth_tx_cnt = 0; PRINTM(MEVENT, "HostMlme %s: Received auth frame type = 0x%x\n", priv->netdev->name, priv->auth_alg); - if (priv-> - auth_flag & + if (priv->auth_flag & HOST_MLME_AUTH_PENDING) { if (priv->auth_alg != WLAN_AUTH_SAE) { - priv->auth_flag - &= + priv->auth_flag &= ~HOST_MLME_AUTH_PENDING; - priv->auth_flag - |= + priv->auth_flag |= HOST_MLME_AUTH_DONE; - priv->phandle-> - host_mlme_priv - = priv; - queue_work - (priv-> - phandle-> - evt_workqueue, - &priv-> - phandle-> - host_mlme_work); + priv->phandle + ->host_mlme_priv = + priv; + queue_work( + priv->phandle + ->evt_workqueue, + &priv->phandle + ->host_mlme_work); } } else { PRINTM(MERROR, "HostMlme %s: Drop auth frame, auth_flag=0x%x auth_alg=0x%x\n", - priv->netdev-> - name, + priv->netdev + ->name, priv->auth_flag, priv->auth_alg); break; @@ -3279,94 +3803,86 @@ PRINTM(MEVENT, "HostMlme %s: Receive deauth/disassociate\n", priv->netdev->name); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + if (!priv->wdev->connected) { +#else if (!priv->wdev->current_bss) { +#endif PRINTM(MEVENT, "HostMlme: Drop deauth/disassociate, current_bss = null\n"); break; } - if (ieee80211_is_deauth(((struct ieee80211_mgmt*)pkt)->frame_control)) - { - /* subtype 12 deauth packet */ + if (ieee80211_is_deauth( + ((struct ieee80211_mgmt + *)pkt) + ->frame_control)) { + /* subtype 12 deauth + * packet */ priv->deauth_evt_cnt++; #define MAX_DEAUTH_COUNTER 5 - if (priv->deauth_evt_cnt >= MAX_DEAUTH_COUNTER) - { - if (woal_reset_wifi(priv->phandle, priv->deauth_evt_cnt, - "EAPOL timeout") == MLAN_STATUS_SUCCESS) - { - priv->deauth_evt_cnt = 0; + if (priv->deauth_evt_cnt >= + MAX_DEAUTH_COUNTER) { + if (woal_reset_wifi( + priv->phandle, + priv->deauth_evt_cnt, + "EAPOL timeout") == + MLAN_STATUS_SUCCESS) { + priv->deauth_evt_cnt = + 0; } } } - priv->cfg_disconnect = MTRUE; - woal_mgmt_frame_register(priv, - IEEE80211_STYPE_DEAUTH, - MFALSE); - woal_mgmt_frame_register(priv, - IEEE80211_STYPE_DISASSOC, - MFALSE); - woal_send_disconnect_to_system - (priv, - DEF_DEAUTH_REASON_CODE); + woal_mgmt_frame_register( + priv, + IEEE80211_STYPE_DEAUTH, + MFALSE); + woal_mgmt_frame_register( + priv, + IEEE80211_STYPE_DISASSOC, + MFALSE); + woal_send_disconnect_to_system( + priv, + DEF_DEAUTH_REASON_CODE); priv->host_mlme = MFALSE; priv->auth_flag = 0; priv->auth_alg = 0xFFFF; } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) - woal_rx_mgmt_pkt_event(priv, pkt, - pmevent-> - event_len - - sizeof(pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH); + woal_rx_mgmt_pkt_event( + priv, pkt, + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH); #else - if (ieee80211_is_deauth(((struct - ieee80211_mgmt - *) - pkt) - -> - frame_control)) - cfg80211_send_deauth(priv-> - netdev, - pkt, - pmevent-> - event_len - - sizeof - (pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH); - else if (ieee80211_is_auth - (((struct ieee80211_mgmt *)pkt) - ->frame_control)) - cfg80211_send_rx_auth(priv-> - netdev, - pkt, - pmevent-> - event_len - - - sizeof - (pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH); - else if (ieee80211_is_disassoc - (((struct ieee80211_mgmt *)pkt) - ->frame_control)) - cfg80211_send_disassoc(priv-> - netdev, - pkt, - pmevent-> - event_len - - - sizeof - (pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH); + if (ieee80211_is_deauth( + ((struct ieee80211_mgmt *) + pkt) + ->frame_control)) + cfg80211_send_deauth( + priv->netdev, pkt, + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH); + else if (ieee80211_is_auth( + ((struct ieee80211_mgmt + *)pkt) + ->frame_control)) + cfg80211_send_rx_auth( + priv->netdev, pkt, + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH); + else if (ieee80211_is_disassoc( + ((struct ieee80211_mgmt + *)pkt) + ->frame_control)) + cfg80211_send_disassoc( + priv->netdev, pkt, + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH); #endif } else @@ -3374,54 +3890,48 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) cfg80211_rx_mgmt( #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - priv->wdev, + priv->wdev, #else - priv->netdev, + priv->netdev, #endif - freq, 0, - ((const t_u8 *) - pmevent-> - event_buf) + - sizeof(pmevent-> - event_id), - pmevent-> - event_len - - sizeof(pmevent-> - event_id) - - - MLAN_MAC_ADDR_LENGTH + freq, 0, + ((const t_u8 *) + pmevent->event_buf) + + sizeof(pmevent->event_id), + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - , 0 + , + 0 #endif #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 18, 0) - , GFP_ATOMIC + , + GFP_ATOMIC #endif - ); + ); #else - cfg80211_rx_mgmt(priv->netdev, freq, - ((const t_u8 *) - pmevent->event_buf) + - sizeof(pmevent-> - event_id), - pmevent->event_len - - sizeof(pmevent-> - event_id) - - MLAN_MAC_ADDR_LENGTH, - GFP_ATOMIC); + cfg80211_rx_mgmt( + priv->netdev, freq, + ((const t_u8 *)pmevent->event_buf) + + sizeof(pmevent->event_id), + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH, + GFP_ATOMIC); #endif +#if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, PACKET_TYPE_RX, - RX_PKT_FATE_SUCCESS, - FRAME_TYPE_80211_MGMT, - 0, 0, - ((t_u8 *)pmevent-> - event_buf) + - sizeof(pmevent-> - event_id), - pmevent->event_len - - sizeof(pmevent-> - event_id) - - MLAN_MAC_ADDR_LENGTH); + woal_packet_fate_monitor( + priv, PACKET_TYPE_RX, + RX_PKT_FATE_SUCCESS, + FRAME_TYPE_80211_MGMT, 0, 0, + ((t_u8 *)pmevent->event_buf) + + sizeof(pmevent->event_id), + pmevent->event_len - + sizeof(pmevent->event_id) - + MLAN_MAC_ADDR_LENGTH); +#endif #endif } #endif /* KERNEL_VERSION */ @@ -3455,8 +3965,8 @@ priv->phandle->cac_period = MFALSE; if (priv->phandle->meas_wait_q_woken == MFALSE) { priv->phandle->meas_wait_q_woken = MTRUE; - wake_up_interruptible(&priv->phandle-> - meas_wait_q); + wake_up_interruptible( + &priv->phandle->meas_wait_q); } /* Execute delayed BSS START command */ @@ -3470,8 +3980,8 @@ PRINTM(MMSG, "Now CAC measure period end. Execute delayed BSS Start command.\n"); - req = woal_alloc_mlan_ioctl_req(sizeof - (mlan_ds_bss)); + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_bss)); if (!req) { PRINTM(MERROR, "Failed to allocate ioctl request buffer\n"); @@ -3481,12 +3991,11 @@ req->req_id = MLAN_IOCTL_BSS; req->action = MLAN_ACT_SET; bss->sub_command = MLAN_OID_BSS_START; - moal_memcpy_ext(priv->phandle, - &bss->param.ssid_bssid, - &priv->phandle-> - delay_ssid_bssid, - sizeof(mlan_ssid_bssid), - sizeof(mlan_ssid_bssid)); + moal_memcpy_ext( + priv->phandle, &bss->param.ssid_bssid, + &priv->phandle->delay_ssid_bssid, + sizeof(mlan_ssid_bssid), + sizeof(mlan_ssid_bssid)); if (woal_request_ioctl(priv, req, MOAL_NO_WAIT) != @@ -3503,9 +4012,9 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (priv->uap_host_based && moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) - woal_cfg80211_dfs_vendor_event(priv, - event_dfs_cac_finished, - &priv->chan); + woal_cfg80211_dfs_vendor_event( + priv, event_dfs_cac_finished, + &priv->chan); #endif #endif #endif @@ -3526,90 +4035,80 @@ #endif #endif break; - case MLAN_EVENT_ID_FW_TX_STATUS:{ + case MLAN_EVENT_ID_FW_TX_STATUS: { #if defined(STA_CFG80211) || defined(UAP_CFG80211) - unsigned long flag; - tx_status_event *tx_status = - (tx_status_event *)(pmevent->event_buf + 4); - struct tx_status_info *tx_info = NULL; - PRINTM(MINFO, - "Receive Tx status: tx_token=%d, pkt_type=0x%x, status=%d tx_seq_num=%d\n", - tx_status->tx_token_id, tx_status->packet_type, - tx_status->status, priv->tx_seq_num); - spin_lock_irqsave(&priv->tx_stat_lock, flag); - tx_info = - woal_get_tx_info(priv, tx_status->tx_token_id); - if (tx_info) { - bool ack; - struct sk_buff *skb = - (struct sk_buff *)tx_info->tx_skb; - list_del(&tx_info->link); - spin_unlock_irqrestore(&priv->tx_stat_lock, - flag); - if (!tx_status->status) - ack = true; - else - ack = false; + unsigned long flag; + tx_status_event *tx_status = + (tx_status_event *)(pmevent->event_buf + 4); + struct tx_status_info *tx_info = NULL; + PRINTM(MINFO, + "Receive Tx status: tx_token=%d, pkt_type=0x%x, status=%d tx_seq_num=%d\n", + tx_status->tx_token_id, tx_status->packet_type, + tx_status->status, priv->tx_seq_num); + spin_lock_irqsave(&priv->tx_stat_lock, flag); + tx_info = woal_get_tx_info(priv, tx_status->tx_token_id); + if (tx_info) { + bool ack; + struct sk_buff *skb = (struct sk_buff *)tx_info->tx_skb; + list_del(&tx_info->link); + spin_unlock_irqrestore(&priv->tx_stat_lock, flag); + if (!tx_status->status) + ack = true; + else + ack = false; #if defined(STA_CFG80211) || defined(UAP_CFG80211) - if (priv->phandle->remain_on_channel && - tx_info->cancel_remain_on_channel) { - remain_priv = - priv->phandle->priv - [priv->phandle-> - remain_bss_index]; - if (remain_priv) { - woal_cfg80211_remain_on_channel_cfg - (remain_priv, - MOAL_NO_WAIT, MTRUE, - &channel_status, NULL, - 0, 0); - priv->phandle-> - remain_on_channel = - MFALSE; - } + if (priv->phandle->remain_on_channel && + tx_info->cancel_remain_on_channel) { + remain_priv = + priv->phandle->priv + [priv->phandle->remain_bss_index]; + if (remain_priv) { + woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_NO_WAIT, + MTRUE, &channel_status, NULL, 0, + 0); + priv->phandle->remain_on_channel = + MFALSE; } -#endif - PRINTM(MEVENT, "Wlan: Tx status=%d\n", ack); -#if defined(STA_CFG80211) || defined(UAP_CFG80211) - if (tx_info->tx_cookie) { -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) -#if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - cfg80211_mgmt_tx_status(priv->netdev, - tx_info-> - tx_cookie, - skb->data, - skb->len, ack, - GFP_ATOMIC); -#else - cfg80211_mgmt_tx_status(priv->wdev, - tx_info-> - tx_cookie, - skb->data, - skb->len, ack, - GFP_ATOMIC); -#endif -#endif - } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, PACKET_TYPE_TX, - ack ? TX_PKT_FATE_ACKED - : TX_PKT_FATE_SENT, - FRAME_TYPE_80211_MGMT, - 0, 0, skb->data, - skb->len); -#endif -#endif - dev_kfree_skb_any(skb); - kfree(tx_info); - } else { - - spin_unlock_irqrestore(&priv->tx_stat_lock, - flag); } #endif + PRINTM(MEVENT, "Wlan: Tx status=%d\n", ack); +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + if (tx_info->tx_cookie) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) +#if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) + cfg80211_mgmt_tx_status(priv->netdev, + tx_info->tx_cookie, + skb->data, skb->len, + ack, GFP_ATOMIC); +#else + cfg80211_mgmt_tx_status(priv->wdev, + tx_info->tx_cookie, + skb->data, skb->len, + ack, GFP_ATOMIC); +#endif +#endif + } +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + woal_packet_fate_monitor(priv, PACKET_TYPE_TX, + ack ? TX_PKT_FATE_ACKED : + TX_PKT_FATE_SENT, + FRAME_TYPE_80211_MGMT, 0, 0, + skb->data, skb->len); +#endif +#endif +#endif + dev_kfree_skb_any(skb); + kfree(tx_info); + } else { + spin_unlock_irqrestore(&priv->tx_stat_lock, flag); } - break; +#endif + } break; case MLAN_EVENT_ID_DRV_FT_RESPONSE: + if (priv->phandle->fw_roam_enable) + break; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { @@ -3630,7 +4129,7 @@ ft_event.ies_len = pmevent->event_len - ETH_ALEN; /*TSPEC info is needed by RIC, However the TS operation * is configured by mlanutl*/ - /*So do not add RIC temporally */ + /*So do not add RIC temporally*/ /*when add RIC, 1. query TS status, 2. copy tspec from * addts command*/ ft_event.ric_ies = NULL; @@ -3648,6 +4147,112 @@ #endif #endif break; + case MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT: +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + woal_cfg80211_vendor_event(priv, event_set_key_mgmt_offload, + &enable, sizeof(enable)); +#endif + moal_memcpy_ext(priv->phandle, priv->cfg_bssid, + pmevent->event_buf, ETH_ALEN, ETH_ALEN); + tlv = (MrvlIEtypesHeader_t *)((t_u8 *)pmevent->event_buf + + MLAN_MAC_ADDR_LENGTH); + tlv_buf_left = pmevent->event_len - MLAN_MAC_ADDR_LENGTH; + while (tlv_buf_left >= sizeof(MrvlIEtypesHeader_t)) { + tlv_type = woal_le16_to_cpu(tlv->type); + tlv_len = woal_le16_to_cpu(tlv->len); + + if (tlv_buf_left < + (tlv_len + sizeof(MrvlIEtypesHeader_t))) { + PRINTM(MERROR, + "Error processing firmware roam success TLVs, bytes left < TLV length\n"); + break; + } + + switch (tlv_type) { + case TLV_TYPE_APINFO: + pinfo = (apinfo *)tlv; + break; + case TLV_TYPE_ASSOC_REQ_IE: + req_tlv = (apinfo *)tlv; + break; + default: + break; + } + tlv_buf_left -= tlv_len + sizeof(MrvlIEtypesHeader_t); + tlv = (MrvlIEtypesHeader_t + *)((t_u8 *)tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); + } + if (!pinfo) { + PRINTM(MERROR, + "ERROR:AP info in roaming event buffer is NULL\n"); + goto done; + } + if (req_tlv) { + req_ie = req_tlv->rsp_ie; + ie_len = req_tlv->header.len; + } + woal_inform_bss_from_scan_result(priv, NULL, MOAL_NO_WAIT); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + roam_info = + kzalloc(sizeof(struct cfg80211_roam_info), GFP_ATOMIC); + if (roam_info) { +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_13) + roam_info->links[0].bssid = priv->cfg_bssid; +#else + roam_info->bssid = priv->cfg_bssid; +#endif + roam_info->req_ie = req_ie; + roam_info->req_ie_len = ie_len; + roam_info->resp_ie = pinfo->rsp_ie; + roam_info->resp_ie_len = pinfo->header.len; + cfg80211_roamed(priv->netdev, roam_info, GFP_KERNEL); + kfree(roam_info); + } +#else +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + cfg80211_roamed(priv->netdev, NULL, priv->cfg_bssid, req_ie, + ie_len, pinfo->rsp_ie, pinfo->header.len, + GFP_KERNEL); +#else + cfg80211_roamed(priv->netdev, priv->cfg_bssid, req_ie, ie_len, + pinfo->rsp_ie, pinfo->header.len, GFP_KERNEL); +#endif +#endif + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + woal_roam_ap_info(priv, pmevent->event_buf, pmevent->event_len); +#endif +#endif + PRINTM(MMSG, "FW Roamed to bssid " MACSTR " successfully\n", + MAC2STR(pmevent->event_buf)); + break; + case MLAN_EVENT_ID_CSI: + DBG_HEXDUMP(MEVT_D, "CSI dump", pmevent->event_buf, + pmevent->event_len); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (priv->csi_enable) + woal_cfg80211_event_csi_dump(priv, pmevent->event_buf, + pmevent->event_len); +#endif +#endif + /* Send Netlink event */ + custom_len = strlen(CUS_EVT_CSI) + sizeof(priv->csi_seq); + csi_len = pmevent->event_len; + memmove(pmevent->event_buf + custom_len, pmevent->event_buf, + csi_len); + moal_memcpy_ext(priv->phandle, pmevent->event_buf, CUS_EVT_CSI, + strlen(CUS_EVT_CSI), strlen(CUS_EVT_CSI)); + moal_memcpy_ext(priv->phandle, + pmevent->event_buf + strlen(CUS_EVT_CSI), + (t_u8 *)(&(priv->csi_seq)), + sizeof(priv->csi_seq), sizeof(priv->csi_seq)); + woal_broadcast_event(priv, pmevent->event_buf, + custom_len + csi_len); + priv->csi_seq++; + break; default: break; } @@ -3665,8 +4270,8 @@ * * @return N/A */ -__attribute__ ((format(printf, 3, 4))) - t_void moal_print(t_void *pmoal, t_u32 level, char *pformat, IN ...) +__attribute__((format(printf, 3, 4))) t_void +moal_print(t_void *pmoal, t_u32 level, char *pformat, IN...) { #ifdef DEBUG_LEVEL1 va_list args; @@ -3718,8 +4323,7 @@ * * @return N/A */ -t_void -moal_print_netintf(t_void *pmoal, t_u32 bss_index, t_u32 level) +t_void moal_print_netintf(t_void *pmoal, t_u32 bss_index, t_u32 level) { #ifdef DEBUG_LEVEL1 moal_handle *phandle = (moal_handle *)pmoal; @@ -3744,8 +4348,7 @@ * * @return N/A */ -t_void -moal_assert(t_void *pmoal, t_u32 cond) +t_void moal_assert(t_void *pmoal, t_u32 cond) { if (!cond) { panic("Assert failed: Panic!"); @@ -3764,9 +4367,8 @@ * * @return N/A */ -t_void -moal_hist_data_add(t_void *pmoal, t_u32 bss_index, - t_u16 rx_rate, t_s8 snr, t_s8 nflr, t_u8 antenna) +t_void moal_hist_data_add(t_void *pmoal, t_u32 bss_index, t_u16 rx_rate, + t_s8 snr, t_s8 nflr, t_u8 antenna) { moal_private *priv = NULL; priv = woal_bss_index_to_priv(pmoal, bss_index); @@ -3787,9 +4389,8 @@ * * @return N/A */ -t_void -moal_updata_peer_signal(t_void *pmoal, t_u32 bss_index, - t_u8 *peer_addr, t_s8 snr, t_s8 nflr) +t_void moal_updata_peer_signal(t_void *pmoal, t_u32 bss_index, t_u8 *peer_addr, + t_s8 snr, t_s8 nflr) { moal_private *priv = NULL; struct tdls_peer *peer = NULL; @@ -3797,7 +4398,7 @@ priv = woal_bss_index_to_priv(pmoal, bss_index); if (priv && priv->enable_auto_tdls) { spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry(peer, &priv->tdls_list, link) { + list_for_each_entry (peer, &priv->tdls_list, link) { if (!memcmp(peer->peer_addr, peer_addr, ETH_ALEN)) { peer->rssi = nflr - snr; peer->rssi_jiffies = jiffies; @@ -3819,8 +4420,7 @@ * @param base divisor * @return returns 64-bit quotient */ -t_u64 -moal_do_div(t_u64 num, t_u32 base) +t_u64 moal_do_div(t_u64 num, t_u32 base) { t_u64 val = num; do_div(val, base); @@ -3835,8 +4435,7 @@ * @param bss_index index of priv * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_wait_hostcmd_complete(t_void *pmoal, t_u32 bss_index) +mlan_status moal_wait_hostcmd_complete(t_void *pmoal, t_u32 bss_index) { mlan_status status = MLAN_STATUS_SUCCESS; moal_handle *handle = (moal_handle *)pmoal; @@ -3872,8 +4471,7 @@ * @param bss_index index of priv * @return MLAN_STATUS_SUCCESS */ -mlan_status -moal_notify_hostcmd_complete(t_void *pmoal, t_u32 bss_index) +mlan_status moal_notify_hostcmd_complete(t_void *pmoal, t_u32 bss_index) { mlan_status status = MLAN_STATUS_SUCCESS; moal_handle *handle = (moal_handle *)pmoal;
diff --git a/wlan_sd8987/mlinux/moal_shim.h b/wlan_sd8987/mlinux/moal_shim.h index 9667cd0..c7f947e 100755 --- a/wlan_sd8987/mlinux/moal_shim.h +++ b/wlan_sd8987/mlinux/moal_shim.h
@@ -4,7 +4,7 @@ * functions defined in moal module * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -28,26 +28,25 @@ #ifndef _MOAL_H #define _MOAL_H -mlan_status moal_get_fw_data(t_void *pmoal, t_u32 offset, - t_u32 len, t_u8 *pbuf); +mlan_status moal_get_fw_data(t_void *pmoal, t_u32 offset, t_u32 len, + t_u8 *pbuf); mlan_status moal_get_vdll_data(t_void *pmoal, t_u32 len, t_u8 *pbuf); -mlan_status moal_get_hw_spec_complete(t_void *pmoal, - mlan_status status, - mlan_hw_info * phw, pmlan_bss_tbl ptbl); +mlan_status moal_get_hw_spec_complete(t_void *pmoal, mlan_status status, + mlan_hw_info *phw, pmlan_bss_tbl ptbl); mlan_status moal_init_fw_complete(t_void *pmoal, mlan_status status); mlan_status moal_shutdown_fw_complete(t_void *pmoal, mlan_status status); -mlan_status moal_ioctl_complete(t_void *pmoal, - pmlan_ioctl_req pioctl_req, mlan_status status); +mlan_status moal_ioctl_complete(t_void *pmoal, pmlan_ioctl_req pioctl_req, + mlan_status status); mlan_status moal_alloc_mlan_buffer(t_void *pmoal, t_u32 size, pmlan_buffer *pmbuf); mlan_status moal_free_mlan_buffer(t_void *pmoal, pmlan_buffer pmbuf); -mlan_status moal_send_packet_complete(t_void *pmoal, - pmlan_buffer pmbuf, mlan_status status); +mlan_status moal_send_packet_complete(t_void *pmoal, pmlan_buffer pmbuf, + mlan_status status); #ifdef USB -mlan_status moal_recv_complete(t_void *pmoal, pmlan_buffer pmbuf, - t_u32 port, mlan_status status); -mlan_status moal_write_data_async(t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port); +mlan_status moal_recv_complete(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + mlan_status status); +mlan_status moal_write_data_async(t_void *pmoal, pmlan_buffer pmbuf, + t_u32 port); #endif #if defined(SDIO) || defined(PCIE) @@ -56,10 +55,10 @@ /** moal_read_reg */ mlan_status moal_read_reg(t_void *pmoal, t_u32 reg, t_u32 *data); #endif /* SDIO || PCIE */ -mlan_status moal_write_data_sync(t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port, t_u32 timeout); -mlan_status moal_read_data_sync(t_void *pmoal, - pmlan_buffer pmbuf, t_u32 port, t_u32 timeout); +mlan_status moal_write_data_sync(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + t_u32 timeout); +mlan_status moal_read_data_sync(t_void *pmoal, pmlan_buffer pmbuf, t_u32 port, + t_u32 timeout); mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf); mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf); mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent); @@ -68,25 +67,25 @@ mlan_status moal_vmalloc(t_void *pmoal, t_u32 size, t_u8 **ppbuf); mlan_status moal_vfree(t_void *pmoal, t_u8 *pbuf); #ifdef PCIE -mlan_status moal_malloc_consistent(t_void *pmoal, t_u32 size, - t_u8 **ppbuf, t_pu64 pbuf_pa); -mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, - t_u8 *pbuf, t_u64 buf_pa); -mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, - t_u64 *pbuf_pa, t_u32 size, t_u32 flag); -mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, - t_u64 buf_pa, t_u32 size, t_u32 flag); +mlan_status moal_malloc_consistent(t_void *pmoal, t_u32 size, t_u8 **ppbuf, + t_pu64 pbuf_pa); +mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf, + t_u64 buf_pa); +mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa, + t_u32 size, t_u32 flag); +mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, t_u64 buf_pa, + t_u32 size, t_u32 flag); #endif /* PCIE */ t_void *moal_memset(t_void *pmoal, t_void *pmem, t_u8 byte, t_u32 num); -t_void *moal_memcpy(t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); -t_void *moal_memcpy_ext(t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num, t_u32 dest_size); +t_void *moal_memcpy(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num); +t_void *moal_memcpy_ext(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num, t_u32 dest_size); -t_void *moal_memmove(t_void *pmoal, t_void *pdest, - const t_void *psrc, t_u32 num); -t_s32 moal_memcmp(t_void *pmoal, const t_void *pmem1, - const t_void *pmem2, t_u32 num); +t_void *moal_memmove(t_void *pmoal, t_void *pdest, const t_void *psrc, + t_u32 num); +t_s32 moal_memcmp(t_void *pmoal, const t_void *pmem1, const t_void *pmem2, + t_u32 num); /** moal_udelay */ t_void moal_udelay(t_void *pmoal, t_u32 udelay); t_void moal_usleep_range(t_void *pmoal, t_u32 min_delay, t_u32 max_delay); @@ -100,22 +99,22 @@ mlan_status moal_wait_hostcmd_complete(t_void *pmoal, t_u32 bss_index); mlan_status moal_notify_hostcmd_complete(t_void *pmoal, t_u32 bss_index); #endif -t_void moal_print(t_void *pmoal, t_u32 level, char *pformat, IN ...); +t_void moal_print(t_void *pmoal, t_u32 level, char *pformat, IN...); t_void moal_print_netintf(t_void *pmoal, t_u32 bss_index, t_u32 level); t_void moal_assert(t_void *pmoal, t_u32 cond); -t_void moal_hist_data_add(t_void *pmoal, t_u32 bss_index, - t_u16 rx_rate, t_s8 snr, t_s8 nflr, t_u8 antenna); +t_void moal_hist_data_add(t_void *pmoal, t_u32 bss_index, t_u16 rx_rate, + t_s8 snr, t_s8 nflr, t_u8 antenna); -t_void moal_updata_peer_signal(t_void *pmoal, t_u32 bss_index, - t_u8 *peer_addr, t_s8 snr, t_s8 nflr); +t_void moal_updata_peer_signal(t_void *pmoal, t_u32 bss_index, t_u8 *peer_addr, + t_s8 snr, t_s8 nflr); t_u64 moal_do_div(t_u64 num, t_u32 base); mlan_status moal_init_timer(t_void *pmoal, t_void **pptimer, - IN t_void (*callback) (t_void *pcontext), + IN t_void (*callback)(t_void *pcontext), t_void *pcontext); mlan_status moal_free_timer(t_void *pmoal, t_void *ptimer); -mlan_status moal_start_timer(t_void *pmoal, t_void *ptimer, - t_u8 periodic, t_u32 msec); +mlan_status moal_start_timer(t_void *pmoal, t_void *ptimer, t_u8 periodic, + t_u32 msec); mlan_status moal_stop_timer(t_void *pmoal, t_void *ptimer); void moal_tp_accounting(t_void *pmoal, void *buf, t_u32 drop_point); void moal_tp_accounting_rx_param(t_void *pmoal, unsigned int type, @@ -123,6 +122,7 @@ void moal_amsdu_tp_accounting(t_void *pmoal, t_s32 amsdu_process_delay, t_s32 amsdu_copy_delay); +void moal_connection_status_check_pmqos(t_void *pmoal); #if defined(PCIE) || defined(SDIO) /* pmqos busfreq add request handler*/ void woal_request_busfreq_pmqos_add(t_void *pmhandle);
diff --git a/wlan_sd8987/mlinux/moal_sta_cfg80211.c b/wlan_sd8987/mlinux/moal_sta_cfg80211.c index 9914fbc..8c86956 100755 --- a/wlan_sd8987/mlinux/moal_sta_cfg80211.c +++ b/wlan_sd8987/mlinux/moal_sta_cfg80211.c
@@ -36,13 +36,11 @@ #endif /* Supported crypto cipher suits to be advertised to cfg80211 */ static const u32 cfg80211_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_SMS4, - WLAN_CIPHER_SUITE_AES_CMAC, + WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, + WLAN_CIPHER_SUITE_TKIP, WLAN_CIPHER_SUITE_CCMP, + WLAN_CIPHER_SUITE_SMS4, WLAN_CIPHER_SUITE_AES_CMAC, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - WLAN_CIPHER_SUITE_BIP_GMAC_128, - WLAN_CIPHER_SUITE_BIP_GMAC_256, + WLAN_CIPHER_SUITE_BIP_GMAC_128, WLAN_CIPHER_SUITE_BIP_GMAC_256, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) WLAN_CIPHER_SUITE_GCMP, @@ -55,12 +53,17 @@ #endif }; +#ifdef UAP_SUPPORT +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +static int woal_cfg80211_set_monitor_channel(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef); +#endif +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) static void #else static int #endif - woal_cfg80211_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); @@ -100,6 +103,9 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) static int woal_cfg80211_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + unsigned int link_id, +#endif struct cfg80211_chan_def *chandef); #endif static int woal_cfg80211_set_power_mgmt(struct wiphy *wiphy, @@ -140,17 +146,17 @@ u64 cookie); static int - woal_cfg80211_remain_on_channel(struct wiphy *wiphy, +woal_cfg80211_remain_on_channel(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - struct wireless_dev *wdev, + struct wireless_dev *wdev, #else - struct net_device *dev, + struct net_device *dev, #endif - struct ieee80211_channel *chan, + struct ieee80211_channel *chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - enum nl80211_channel_type channel_type, + enum nl80211_channel_type channel_type, #endif - unsigned int duration, u64 * cookie); + unsigned int duration, u64 *cookie); static int woal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) @@ -175,9 +181,10 @@ struct cfg80211_sched_scan_request *request); int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - , u64 reqid + , + u64 reqid #endif - ); +); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) @@ -262,6 +269,7 @@ #endif #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) static int woal_cfg80211_deauthenticate(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_deauth_request *req); @@ -269,6 +277,14 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_disassoc_request *req); +#endif + +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) +int woal_cfg80211_set_radar_background(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef); +#endif +#endif /** cfg80211 operations */ static struct cfg80211_ops woal_cfg80211_ops = { @@ -279,8 +295,10 @@ #endif .connect = woal_cfg80211_connect, .disconnect = woal_cfg80211_disconnect, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) .deauth = woal_cfg80211_deauthenticate, .disassoc = woal_cfg80211_disassociate, +#endif .get_station = woal_cfg80211_get_station, .dump_station = woal_cfg80211_dump_station, .dump_survey = woal_cfg80211_dump_survey, @@ -335,70 +353,75 @@ .tdls_oper = woal_cfg80211_tdls_oper, .tdls_mgmt = woal_cfg80211_tdls_mgmt, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - .tdls_channel_switch = - woal_cfg80211_tdls_channel_switch,.tdls_cancel_channel_switch = - woal_cfg80211_tdls_cancel_channel_switch, + .tdls_channel_switch = woal_cfg80211_tdls_channel_switch, + .tdls_cancel_channel_switch = woal_cfg80211_tdls_cancel_channel_switch, #endif #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - .change_station = woal_cfg80211_change_station, + .change_station = woal_cfg80211_change_station, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) - .update_ft_ies = woal_cfg80211_update_ft_ies, + .update_ft_ies = woal_cfg80211_update_ft_ies, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - .set_qos_map = woal_cfg80211_set_qos_map, + .set_qos_map = woal_cfg80211_set_qos_map, #endif #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - .set_coalesce = woal_cfg80211_set_coalesce, + .set_coalesce = woal_cfg80211_set_coalesce, #endif - .add_virtual_intf = - woal_cfg80211_add_virtual_intf,.del_virtual_intf = - woal_cfg80211_del_virtual_intf, + .add_virtual_intf = woal_cfg80211_add_virtual_intf, + .del_virtual_intf = woal_cfg80211_del_virtual_intf, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - .start_ap = woal_cfg80211_add_beacon,.change_beacon = - woal_cfg80211_set_beacon,.stop_ap = woal_cfg80211_del_beacon, + .start_ap = woal_cfg80211_add_beacon, + .change_beacon = woal_cfg80211_set_beacon, + .stop_ap = woal_cfg80211_del_beacon, #else - .add_beacon = woal_cfg80211_add_beacon,.set_beacon = - woal_cfg80211_set_beacon,.del_beacon = woal_cfg80211_del_beacon, + .add_beacon = woal_cfg80211_add_beacon, + .set_beacon = woal_cfg80211_set_beacon, + .del_beacon = woal_cfg80211_del_beacon, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - .change_bss = woal_cfg80211_change_bss, + .change_bss = woal_cfg80211_change_bss, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - .add_station = woal_cfg80211_add_station, + .add_station = woal_cfg80211_add_station, #endif - .del_station = woal_cfg80211_del_station, + .del_station = woal_cfg80211_del_station, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - .set_txq_params = woal_cfg80211_set_txq_params, + .set_txq_params = woal_cfg80211_set_txq_params, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - .set_mac_acl = woal_cfg80211_set_mac_acl, + .set_mac_acl = woal_cfg80211_set_mac_acl, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - .start_radar_detection = - woal_cfg80211_start_radar_detection,.channel_switch = - woal_cfg80211_channel_switch, + .start_radar_detection = woal_cfg80211_start_radar_detection, + + .channel_switch = woal_cfg80211_channel_switch, #endif #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) - .update_mgmt_frame_registrations = - woal_cfg80211_mgmt_frame_register, + .update_mgmt_frame_registrations = woal_cfg80211_mgmt_frame_register, #else - .mgmt_frame_register = woal_cfg80211_mgmt_frame_register, + .mgmt_frame_register = woal_cfg80211_mgmt_frame_register, #endif - .mgmt_tx = woal_cfg80211_mgmt_tx, + .mgmt_tx = woal_cfg80211_mgmt_tx, #endif + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - .mgmt_tx_cancel_wait = - woal_cfg80211_mgmt_tx_cancel_wait,.remain_on_channel = - woal_cfg80211_remain_on_channel,.cancel_remain_on_channel = - woal_cfg80211_cancel_remain_on_channel, + .mgmt_tx_cancel_wait = woal_cfg80211_mgmt_tx_cancel_wait, + .remain_on_channel = woal_cfg80211_remain_on_channel, + .cancel_remain_on_channel = woal_cfg80211_cancel_remain_on_channel, +#endif + +#ifdef UAP_SUPPORT +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + .set_monitor_channel = woal_cfg80211_set_monitor_channel, +#endif #endif #ifdef CONFIG_NL80211_TESTMODE - .testmode_cmd = woal_testmode_cmd, + .testmode_cmd = woal_testmode_cmd, #endif }; @@ -412,19 +435,18 @@ .n_reg_rules = 4, .alpha2 = "99", .reg_rules = { - /* IEEE 802.11b/g, channels 1..11 */ - REG_RULE(2412 - 10, 2472 + 10, 40, 6, 20, 0), - /* If any */ - /* IEEE 802.11 channel 14 - Only JP enables - * this and for 802.11b only - */ - REG_RULE(2484 - 10, 2484 + 10, 20, 6, 20, 0), - /* IEEE 802.11a, channel 36..64 */ - REG_RULE(5150 - 10, 5350 + 10, 80, 6, 20, 0), - /* IEEE 802.11a, channel 100..165 */ - REG_RULE(5470 - 10, 5850 + 10, 80, 6, 20, 0), - } -}; + /* IEEE 802.11b/g, channels 1..11 */ + REG_RULE(2412 - 10, 2472 + 10, 40, 6, 20, 0), + /* If any */ + /* IEEE 802.11 channel 14 - Only JP enables + * this and for 802.11b only + */ + REG_RULE(2484 - 10, 2484 + 10, 20, 6, 20, 0), + /* IEEE 802.11a, channel 36..64 */ + REG_RULE(5150 - 10, 5350 + 10, 80, 6, 20, 0), + /* IEEE 802.11a, channel 100..165 */ + REG_RULE(5470 - 10, 5850 + 10, 80, 6, 20, 0), + }}; #define AUTH_TX_DEFAULT_WAIT_TIME 2400 /******************************************************** @@ -433,62 +455,61 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) // clang-format off static const struct ieee80211_txrx_stypes - ieee80211_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_AP] = { - .tx = 0xffff, - .rx = MBIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - MBIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - MBIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - MBIT(IEEE80211_STYPE_DISASSOC >> 4) | - MBIT(IEEE80211_STYPE_AUTH >> 4) | - MBIT(IEEE80211_STYPE_DEAUTH >> 4) | - MBIT(IEEE80211_STYPE_ACTION >> 4), - }, - [NL80211_IFTYPE_AP_VLAN] = { - .tx = 0x0000, - .rx = 0x0000, - }, + ieee80211_mgmt_stypes[NUM_NL80211_IFTYPES] = { + [NL80211_IFTYPE_STATION] = { + .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | + MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), + .rx = MBIT(IEEE80211_STYPE_ACTION >> 4) | + MBIT(IEEE80211_STYPE_PROBE_REQ >> 4), + }, + [NL80211_IFTYPE_AP] = { + .tx = 0xffff, + .rx = MBIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + MBIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + MBIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + MBIT(IEEE80211_STYPE_DISASSOC >> 4) | + MBIT(IEEE80211_STYPE_AUTH >> 4) | + MBIT(IEEE80211_STYPE_DEAUTH >> 4) | + MBIT(IEEE80211_STYPE_ACTION >> 4), + }, + [NL80211_IFTYPE_AP_VLAN] = { + .tx = 0x0000, + .rx = 0x0000, + }, #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_AUTH >> 4) | - MBIT(IEEE80211_STYPE_ASSOC_RESP >> 4) | - MBIT(IEEE80211_STYPE_REASSOC_RESP >> 4) | - MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = MBIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - MBIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - MBIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - MBIT(IEEE80211_STYPE_DISASSOC >> 4) | - MBIT(IEEE80211_STYPE_AUTH >> 4) | - MBIT(IEEE80211_STYPE_DEAUTH >> 4) | - MBIT(IEEE80211_STYPE_ACTION >> 4), - }, + [NL80211_IFTYPE_P2P_CLIENT] = { + .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | + MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), + .rx = MBIT(IEEE80211_STYPE_ACTION >> 4) | + MBIT(IEEE80211_STYPE_PROBE_REQ >> 4), + }, + [NL80211_IFTYPE_P2P_GO] = { + .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | + MBIT(IEEE80211_STYPE_AUTH >> 4) | + MBIT(IEEE80211_STYPE_ASSOC_RESP >> 4) | + MBIT(IEEE80211_STYPE_REASSOC_RESP >> 4) | + MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), + .rx = MBIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + MBIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + MBIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + MBIT(IEEE80211_STYPE_DISASSOC >> 4) | + MBIT(IEEE80211_STYPE_AUTH >> 4) | + MBIT(IEEE80211_STYPE_DEAUTH >> 4) | + MBIT(IEEE80211_STYPE_ACTION >> 4), + }, #endif #endif - [NL80211_IFTYPE_MESH_POINT] = { - .tx = 0x0000, - .rx = 0x0000, - }, + [NL80211_IFTYPE_MESH_POINT] = { + .tx = 0x0000, + .rx = 0x0000, + }, }; - // clang-format on #endif -#if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 0, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) /** * NOTE: types in all the sets must be equals to the * initial value of wiphy->interface_modes @@ -497,15 +518,15 @@ {.max = 4, .types = MBIT(NL80211_IFTYPE_STATION) #ifdef UAP_CFG80211 - | MBIT(NL80211_IFTYPE_AP) + | MBIT(NL80211_IFTYPE_AP) | MBIT(NL80211_IFTYPE_MONITOR) #endif #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - | MBIT(NL80211_IFTYPE_P2P_GO) | MBIT(NL80211_IFTYPE_P2P_CLIENT) + | MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT) #endif #endif - } -}; + }}; static struct ieee80211_iface_combination cfg80211_iface_comb_ap_sta = { .limits = cfg80211_ap_sta_limits, @@ -531,11 +552,10 @@ .pattern_max_len = WOWLAN_MAX_PATTERN_LEN, .max_pkt_offset = WOWLAN_MAX_OFFSET_LEN, }; - static const struct wiphy_wowlan_support wowlan_support_with_gtk = { .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_MAGIC_PKT | - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | - WIPHY_WOWLAN_GTK_REKEY_FAILURE, + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | + WIPHY_WOWLAN_GTK_REKEY_FAILURE, .n_patterns = MAX_NUM_FILTERS, .pattern_min_len = 1, .pattern_max_len = WOWLAN_MAX_PATTERN_LEN, @@ -562,6 +582,104 @@ /******************************************************** Local Functions ********************************************************/ +#ifdef UAP_SUPPORT +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +static int woal_cfg80211_set_monitor_channel(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef) +{ + moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); + moal_private *priv = + (moal_private *)woal_get_priv(handle, MLAN_BSS_ROLE_STA); + netmon_band_chan_cfg band_chan_cfg; + t_u32 bandwidth = 0; + int ret = -EFAULT; + + ENTER(); + + if (!priv) { + ret = -EFAULT; + goto done; + } + if (handle->mon_if) { + if (cfg80211_chandef_identical(&handle->mon_if->chandef, + chandef)) { + ret = 0; + goto done; + } + if (woal_is_any_interface_active(handle)) { + PRINTM(MERROR, + "Cannot change monitor channel for an active" + " interface\n"); + goto done; + } + memset(&band_chan_cfg, 0x00, sizeof(band_chan_cfg)); + /* Set channel */ + band_chan_cfg.channel = ieee80211_frequency_to_channel( + chandef->chan->center_freq); + /* Set band */ + if (chandef->chan->band == IEEE80211_BAND_2GHZ) + band_chan_cfg.band |= (BAND_B | BAND_G); + if (chandef->chan->band == IEEE80211_BAND_5GHZ) + band_chan_cfg.band |= BAND_A; + if (chandef->chan->band == IEEE80211_BAND_2GHZ) + band_chan_cfg.band |= BAND_GN; + if (chandef->chan->band == IEEE80211_BAND_5GHZ) + band_chan_cfg.band |= BAND_AN; + if (chandef->chan->band == IEEE80211_BAND_2GHZ) + band_chan_cfg.band |= BAND_GAC; + if (chandef->chan->band == IEEE80211_BAND_5GHZ) + band_chan_cfg.band |= BAND_AAC; + /* Set bandwidth */ + if (chandef->width == NL80211_CHAN_WIDTH_20) + bandwidth = CHANNEL_BW_20MHZ; + else if (chandef->width == NL80211_CHAN_WIDTH_40) + bandwidth = chandef->center_freq1 > + chandef->chan->center_freq ? + CHANNEL_BW_40MHZ_ABOVE : + CHANNEL_BW_40MHZ_BELOW; + else if (chandef->width == NL80211_CHAN_WIDTH_80) + bandwidth = CHANNEL_BW_80MHZ; + band_chan_cfg.chan_bandwidth = bandwidth; + + if (MLAN_STATUS_SUCCESS != + woal_set_net_monitor(priv, MOAL_IOCTL_WAIT, MTRUE, + handle->mon_if->flag, + &band_chan_cfg)) { + PRINTM(MERROR, "%s: woal_set_net_monitor fail\n", + __func__); + ret = -EFAULT; + goto done; + } + + moal_memcpy_ext(priv->phandle, &handle->mon_if->band_chan_cfg, + &band_chan_cfg, + sizeof(handle->mon_if->band_chan_cfg), + sizeof(handle->mon_if->band_chan_cfg)); + handle->mon_if->chandef = *chandef; + + if (handle->mon_if->chandef.chan) + PRINTM(MINFO, + "set_monitor_channel+++ chan[band=%d center_freq=%d hw_value=%d] width=%d center_freq1=%d center_freq2=%d\n", + handle->mon_if->chandef.chan->band, + handle->mon_if->chandef.chan->center_freq, + handle->mon_if->chandef.chan->hw_value, + handle->mon_if->chandef.width, + handle->mon_if->chandef.center_freq1, + handle->mon_if->chandef.center_freq2); + PRINTM(MINFO, + "set_monitor_channel+++ band=%x channel=%d bandwidth=%d\n", + handle->mon_if->band_chan_cfg.band, + handle->mon_if->band_chan_cfg.channel, + handle->mon_if->band_chan_cfg.chan_bandwidth); + ret = 0; + } + +done: + LEAVE(); + return ret; +} +#endif +#endif /** * @brief This function check cfg80211 special region code. @@ -570,13 +688,11 @@ * * @return MTRUE/MFALSE */ -t_u8 -is_cfg80211_special_region_code(t_u8 *region_string) +t_u8 is_cfg80211_special_region_code(t_u8 *region_string) { t_u8 i; region_code_t cfg80211_special_region_code[] = { - {"00 "}, {"99 "}, {"98 "}, {"97 "} - }; + {"00 "}, {"99 "}, {"98 "}, {"97 "}}; for (i = 0; i < COUNTRY_CODE_LEN && region_string[i]; i++) region_string[i] = toupper(region_string[i]); @@ -601,8 +717,7 @@ * * @return MLAN_ENCRYPTION_MODE_* */ -static int -woal_cfg80211_get_encryption_mode(t_u32 cipher, int *wpa_enabled) +static int woal_cfg80211_get_encryption_mode(t_u32 cipher, int *wpa_enabled) { int encrypt_mode; @@ -661,8 +776,7 @@ * * @return IEEE status code */ -static int -woal_get_assoc_status(moal_private *priv) +static int woal_get_assoc_status(moal_private *priv) { int ret = WLAN_STATUS_UNSPECIFIED_FAILURE; t_u16 status = (t_u16)(priv->assoc_status & 0xffff); @@ -692,8 +806,7 @@ * * @return 1 -- enable or 0 -- disable */ -static int -woal_cfg80211_is_alg_wep(t_u32 cipher) +static int woal_cfg80211_is_alg_wep(t_u32 cipher) { int alg = 0; ENTER(); @@ -713,8 +826,7 @@ * * @return Driver bss mode */ -static t_u32 -woal_nl80211_iftype_to_mode(enum nl80211_iftype iftype) +static t_u32 woal_nl80211_iftype_to_mode(enum nl80211_iftype iftype) { switch (iftype) { case NL80211_IFTYPE_STATION: @@ -733,8 +845,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_wps_cfg(moal_private *priv, int enable) +static int woal_wps_cfg(moal_private *priv, int enable) { int ret = 0; mlan_ds_wps_cfg *pwps = NULL; @@ -783,9 +894,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_assoc_ies_cfg(moal_private *priv, t_u8 *ie, int ie_len, - t_u8 wait_option) +static int woal_cfg80211_assoc_ies_cfg(moal_private *priv, t_u8 *ie, int ie_len, + t_u8 wait_option) { int bytes_left = ie_len; t_u8 *pcurrent_ptr = ie; @@ -794,8 +904,8 @@ int ret = MLAN_STATUS_SUCCESS; IEEEtypes_ElementId_e element_id; IEEEtypes_VendorSpecific_t *pvendor_ie; - t_u8 wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; - t_u8 hs20_oui[] = { 0x50, 0x6f, 0x9a, 0x10 }; + t_u8 wps_oui[] = {0x00, 0x50, 0xf2, 0x04}; + t_u8 hs20_oui[] = {0x50, 0x6f, 0x9a, 0x10}; while (bytes_left >= 2) { element_id = (IEEEtypes_ElementId_e)(*((t_u8 *)pcurrent_ptr)); @@ -825,7 +935,13 @@ sizeof(pvendor_ie->vend_hdr.oui)) && (pvendor_ie->vend_hdr.oui_type == wps_oui[3])) { PRINTM(MIOCTL, "Enable WPS session\n"); - woal_wps_cfg(priv, MTRUE); + if (woal_wps_cfg(priv, MTRUE)) { + PRINTM(MERROR, + "%s: Enable WPS session failed\n", + __func__); + ret = -EFAULT; + goto done; + } } if (!memcmp(pvendor_ie->vend_hdr.oui, hs20_oui, @@ -867,7 +983,7 @@ pcurrent_ptr, &total_ie_len, wait_option)) { PRINTM(MERROR, "Fail to set" - "FAST_BSS_TRANSITION IE\n"); + "FAST_BSS_TRANSITION IE\n"); ret = -EFAULT; goto done; } @@ -965,12 +1081,10 @@ }; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) -static int -woal_testmode_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, - void *data, int len) +static int woal_testmode_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, + void *data, int len) #else -static int -woal_testmode_cmd(struct wiphy *wiphy, void *data, int len) +static int woal_testmode_cmd(struct wiphy *wiphy, void *data, int len) #endif { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); @@ -1018,10 +1132,9 @@ err = -EFAULT; goto error; } - /* process hostcmd response */ - skb = cfg80211_testmode_alloc_reply_skb(wiphy, - misc_cfg->param.hostcmd. - len); + /* process hostcmd response*/ + skb = cfg80211_testmode_alloc_reply_skb( + wiphy, misc_cfg->param.hostcmd.len); if (!skb) { kfree(req); return -ENOMEM; @@ -1055,8 +1168,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_send_domain_info_cmd_fw(moal_private *priv, t_u8 wait_option) +static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; enum ieee80211_band band; @@ -1085,9 +1198,9 @@ goto done; } - PRINTM(MCMD_D, "Send domain info: country=%c%c band=%d\n", + PRINTM(MCMD_D, "Send domain info: country=%c%c band=%d dfs_region=%d\n", priv->phandle->country_code[0], priv->phandle->country_code[1], - band); + band, priv->phandle->dfs_region); /* Allocate an IOCTL request buffer */ req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11d_cfg)); if (req == NULL) { @@ -1098,7 +1211,7 @@ cfg_11d->sub_command = MLAN_OID_11D_DOMAIN_INFO_EXT; req->req_id = MLAN_IOCTL_11D_CFG; req->action = MLAN_ACT_SET; - + cfg_11d->param.domain_info.dfs_region = priv->phandle->dfs_region; if (is_cfg80211_special_region_code(priv->phandle->country_code)) { /* Set country code */ cfg_11d->param.domain_info.country_code[0] = 'W'; @@ -1115,7 +1228,8 @@ sband = priv->wdev->wiphy->bands[band]; for (i = 0; (i < sband->n_channels) && - (no_of_sub_band < MRVDRV_MAX_SUBBAND_802_11D); i++) { + (no_of_sub_band < MRVDRV_MAX_SUBBAND_802_11D); + i++) { channel = &sband->channels[i]; if (channel->flags & IEEE80211_CHAN_DISABLED) continue; @@ -1186,9 +1300,9 @@ * * @return 0 -- success, otherwise fail */ -int -woal_set_rf_channel(moal_private *priv, struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, t_u8 wait_option) +int woal_set_rf_channel(moal_private *priv, struct ieee80211_channel *chan, + enum nl80211_channel_type channel_type, + t_u8 wait_option) { int ret = 0; t_u32 mode, config_bands = 0; @@ -1245,10 +1359,9 @@ ieee80211_frequency_to_channel(chan->center_freq)); if (MLAN_STATUS_SUCCESS != - woal_change_adhoc_chan(priv, - ieee80211_frequency_to_channel(chan-> - center_freq), - wait_option)) { + woal_change_adhoc_chan( + priv, ieee80211_frequency_to_channel(chan->center_freq), + wait_option)) { ret = -EFAULT; goto done; } @@ -1270,9 +1383,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -static mlan_status -woal_set_ewpa_mode(moal_private *priv, t_u8 wait_option, - mlan_ssid_bssid *ssid_bssid) +static mlan_status woal_set_ewpa_mode(moal_private *priv, t_u8 wait_option, + mlan_ssid_bssid *ssid_bssid) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; @@ -1340,9 +1452,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_set_auth(moal_private *priv, int encrypt_mode, - int wpa_enabled, t_u8 wait_option) +static int woal_cfg80211_set_auth(moal_private *priv, int encrypt_mode, + int wpa_enabled, t_u8 wait_option) { int ret = 0; @@ -1363,6 +1474,35 @@ } /** + * @brief Reset the wifi + * + * @param handle A pointer to moal_handle structure + * @param cnt wifi reset count + * @param reason wifi reset reason + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING + */ +mlan_status woal_reset_wifi(moal_handle *handle, t_u8 cnt, char *reason) +{ + static wifi_timeval reset_time; + wifi_timeval ts; + t_u64 diff; + +#define MAX_WIFI_RESET_INTERVAL 15 * 60 * 1000000 // 15 minute + woal_get_monotonic_time(&ts); + diff = (t_u64)(timeval_to_usec(ts) - timeval_to_usec(reset_time)); + PRINTM(MERROR, "WiFi Reset diff %lld\n", diff); + if (reset_time.time_sec == 0 || diff >= MAX_WIFI_RESET_INTERVAL) { + reset_time = ts; + PRINTM(MERROR, "WiFi Reset due to %s cnt %d\n", reason, cnt); + /* Do wifi independent reset */ + woal_process_hang(handle); + return MLAN_STATUS_SUCCESS; + } + return MLAN_STATUS_PENDING; +} + +/** * @brief Informs the CFG802.11 subsystem of a new BSS connection. * * The following information are sent to the CFG802.11 subsystem @@ -1387,9 +1527,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_inform_bss_from_scan_result(moal_private *priv, - mlan_ssid_bssid *ssid_bssid, t_u8 wait_option) +mlan_status woal_inform_bss_from_scan_result(moal_private *priv, + mlan_ssid_bssid *ssid_bssid, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; struct ieee80211_channel *chan; @@ -1427,16 +1567,12 @@ } if (!scan_table[i].freq) { scan_table[i].freq = - ieee80211_channel_to_frequency((int) - scan_table - [i]. - channel + ieee80211_channel_to_frequency( + (int)scan_table[i].channel #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - , - woal_band_cfg_to_ieee_band - (scan_table - [i]. - bss_band) + , + woal_band_cfg_to_ieee_band( + scan_table[i].bss_band) #endif ); } @@ -1459,7 +1595,7 @@ "wlan: P2P device " MACSTR " found, channel=%d\n", MAC2STR(scan_table[i] - .mac_address), + .mac_address), (int)chan->hw_value); } } @@ -1478,21 +1614,19 @@ moal_memcpy_ext(priv->phandle, &cap_info, &scan_table[i].cap_info, sizeof(cap_info), sizeof(cap_info)); - pub = cfg80211_inform_bss(priv->wdev->wiphy, chan, + pub = cfg80211_inform_bss( + priv->wdev->wiphy, chan, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) - CFG80211_BSS_FTYPE_UNKNOWN, + CFG80211_BSS_FTYPE_UNKNOWN, #endif - scan_table[i].mac_address, ts, - cap_info, - scan_table[i].beacon_period, - scan_table[i].pbeacon_buf + - WLAN_802_11_FIXED_IE_SIZE, - scan_table[i]. - beacon_buf_size - - WLAN_802_11_FIXED_IE_SIZE, - -RSSI_DBM_TO_MDM(scan_table - [i].rssi), - GFP_KERNEL); + scan_table[i].mac_address, ts, cap_info, + scan_table[i].beacon_period, + scan_table[i].pbeacon_buf + + WLAN_802_11_FIXED_IE_SIZE, + scan_table[i].beacon_buf_size - + WLAN_802_11_FIXED_IE_SIZE, + -RSSI_DBM_TO_MDM(scan_table[i].rssi), + GFP_KERNEL); if (pub) { #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) pub->len_information_elements = @@ -1536,10 +1670,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_cfg80211_inform_ibss_bss(moal_private *priv, - struct ieee80211_channel *chan, - t_u16 beacon_interval) +static mlan_status woal_cfg80211_inform_ibss_bss(moal_private *priv, + struct ieee80211_channel *chan, + t_u16 beacon_interval) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_bss_info bss_info; @@ -1598,8 +1731,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_process_country_ie(moal_private *priv, struct cfg80211_bss *bss) +static int woal_process_country_ie(moal_private *priv, struct cfg80211_bss *bss) { u8 *country_ie, country_ie_len; int ret = 0; @@ -1653,6 +1785,7 @@ req->req_id = MLAN_IOCTL_11D_CFG; req->action = MLAN_ACT_SET; + cfg_11d->param.domain_info.dfs_region = NXP_DFS_UNKNOWN; /* Set country code */ cfg_11d->param.domain_info.country_code[0] = priv->phandle->country_code[0]; @@ -1664,15 +1797,14 @@ cfg_11d->param.domain_info.band = priv->phandle->band; country_ie_len -= COUNTRY_CODE_LEN; - cfg_11d->param.domain_info.no_of_sub_band = - MIN(MRVDRV_MAX_SUBBAND_802_11D, - (country_ie_len / - sizeof(struct ieee80211_country_ie_triplet))); + cfg_11d->param.domain_info.no_of_sub_band = MIN( + MRVDRV_MAX_SUBBAND_802_11D, + (country_ie_len / sizeof(struct ieee80211_country_ie_triplet))); moal_memcpy_ext(priv->phandle, (u8 *)cfg_11d->param.domain_info.sub_band, &country_ie[2] + COUNTRY_CODE_LEN, cfg_11d->param.domain_info.no_of_sub_band * - sizeof(mlan_ds_subband_set_t), + sizeof(mlan_ds_subband_set_t), sizeof(cfg_11d->param.domain_info.sub_band)); PRINTM(MCMND, "11D: Country IE: %c%c band=%d no_of_sub_band=%d\n", @@ -1710,7 +1842,7 @@ { moal_handle *handle = priv->phandle; int ret = 0; - wlan_user_scan_cfg scan_req; + wlan_user_scan_cfg *scan_req; enum ieee80211_band band; struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; @@ -1729,25 +1861,35 @@ return -EBUSY; } #endif /* REASSOCIATION */ + scan_req = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + priv->report_scan_result = MTRUE; - memset(&scan_req, 0x00, sizeof(scan_req)); - moal_memcpy_ext(priv->phandle, scan_req.ssid_list[0].ssid, + memset(scan_req, 0x00, sizeof(wlan_user_scan_cfg)); + moal_memcpy_ext(priv->phandle, scan_req->ssid_list[0].ssid, conn_param->ssid, conn_param->ssid_len, - sizeof(scan_req.ssid_list[0].ssid)); - scan_req.ssid_list[0].max_len = 0; + sizeof(scan_req->ssid_list[0].ssid)); + scan_req->ssid_list[0].max_len = 0; if (conn_param->channel) { - scan_req.chan_list[0].chan_number = + scan_req->chan_list[0].chan_number = conn_param->channel->hw_value; - scan_req.chan_list[0].radio_type = conn_param->channel->band; + scan_req->chan_list[0].radio_type = + woal_ieee_band_to_radio_type(conn_param->channel->band); if (conn_param->channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_req.chan_list[0].scan_type = + scan_req->chan_list[0].scan_type = MLAN_SCAN_TYPE_PASSIVE; else if (conn_param->channel->flags & IEEE80211_CHAN_RADAR) - scan_req.chan_list[0].scan_type = + scan_req->chan_list[0].scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; else - scan_req.chan_list[0].scan_type = MLAN_SCAN_TYPE_ACTIVE; - scan_req.chan_list[0].scan_time = 0; + scan_req->chan_list[0].scan_type = + MLAN_SCAN_TYPE_ACTIVE; + scan_req->chan_list[0].scan_time = 0; } else { for (band = 0; (band < IEEE80211_NUM_BANDS); band++) { if (!priv->wdev->wiphy->bands[band]) @@ -1757,25 +1899,27 @@ ch = &sband->channels[i]; if (ch->flags & IEEE80211_CHAN_DISABLED) continue; - scan_req.chan_list[chan_idx].radio_type = band; + scan_req->chan_list[chan_idx].radio_type = + woal_ieee_band_to_radio_type(band); if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_PASSIVE; else if (ch->flags & IEEE80211_CHAN_RADAR) - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; else - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_ACTIVE; - scan_req.chan_list[chan_idx].chan_number = + scan_req->chan_list[chan_idx].chan_number = (u32)ch->hw_value; chan_idx++; } } } - moal_memcpy_ext(priv->phandle, scan_req.random_mac, priv->random_mac, - ETH_ALEN, sizeof(scan_req.random_mac)); - ret = woal_request_userscan(priv, wait_option, &scan_req); + moal_memcpy_ext(priv->phandle, scan_req->random_mac, priv->random_mac, + ETH_ALEN, sizeof(scan_req->random_mac)); + ret = woal_request_userscan(priv, wait_option, scan_req); + kfree(scan_req); #ifdef REASSOCIATION MOAL_REL_SEMAPHORE(&handle->reassoc_sem); #endif @@ -1790,10 +1934,9 @@ * @param priv A pointer to moal_private * @param req A pointer to cfg80211_assoc_request structure */ -static void -woal_save_assoc_params(moal_private *priv, - struct cfg80211_assoc_request *req, - mlan_ssid_bssid *ssid_bssid) +static void woal_save_assoc_params(moal_private *priv, + struct cfg80211_assoc_request *req, + mlan_ssid_bssid *ssid_bssid) { ENTER(); @@ -1835,6 +1978,7 @@ #endif if (ssid_bssid && ssid_bssid->ssid.ssid_len) { priv->sme_current.ssid = priv->conn_ssid; + priv->sme_current.ssid_len = ssid_bssid->ssid.ssid_len; memset(priv->conn_ssid, 0, MLAN_MAX_SSID_LENGTH); moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.ssid, ssid_bssid->ssid.ssid, @@ -1842,6 +1986,10 @@ sizeof(priv->conn_ssid)); priv->conn_ssid_len = ssid_bssid->ssid.ssid_len; } + if (priv->sinfo) + memset(priv->sinfo, 0, sizeof(struct station_info)); + else + priv->sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); LEAVE(); } @@ -1851,11 +1999,12 @@ * @param priv A pointer to moal_private * @param req A pointer to struct cfg80211_auth_request */ -static void -woal_save_auth_params(moal_private *priv, struct cfg80211_auth_request *req) +static void woal_save_auth_params(moal_private *priv, + struct cfg80211_auth_request *req) { ENTER(); woal_clear_conn_params(priv); + priv->assoc_bss = req->bss; priv->sme_current.auth_type = req->auth_type; priv->sme_current.key_idx = req->key_idx; priv->sme_current.key_len = req->key_len; @@ -1877,13 +2026,13 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_auth_scan(moal_private *priv, - struct cfg80211_auth_request *req, t_u8 wait_option) +static int woal_cfg80211_auth_scan(moal_private *priv, + struct cfg80211_auth_request *req, + t_u8 wait_option) { moal_handle *handle = priv->phandle; int ret = 0; - wlan_user_scan_cfg scan_req; + wlan_user_scan_cfg *scan_req; enum ieee80211_band band; struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; @@ -1903,31 +2052,42 @@ return -EBUSY; } #endif /* REASSOCIATION */ + scan_req = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + priv->report_scan_result = MTRUE; - memset(&scan_req, 0x00, sizeof(scan_req)); + memset(scan_req, 0x00, sizeof(wlan_user_scan_cfg)); rcu_read_lock(); ssid = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); if (ssid) { - moal_memcpy_ext(priv->phandle, scan_req.ssid_list[0].ssid, + moal_memcpy_ext(priv->phandle, scan_req->ssid_list[0].ssid, ssid + 2, ssid[1], - sizeof(scan_req.ssid_list[0].ssid)); - scan_req.ssid_list[0].max_len = 0; + sizeof(scan_req->ssid_list[0].ssid)); + scan_req->ssid_list[0].max_len = 0; } rcu_read_unlock(); - moal_memcpy_ext(priv->phandle, scan_req.specific_bssid, req->bss->bssid, - ETH_ALEN, ETH_ALEN); + moal_memcpy_ext(priv->phandle, scan_req->specific_bssid, + req->bss->bssid, ETH_ALEN, ETH_ALEN); if (req->bss->channel) { - scan_req.chan_list[0].chan_number = req->bss->channel->hw_value; - scan_req.chan_list[0].radio_type = req->bss->channel->band; + scan_req->chan_list[0].chan_number = + req->bss->channel->hw_value; + scan_req->chan_list[0].radio_type = + woal_ieee_band_to_radio_type(req->bss->channel->band); if (req->bss->channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_req.chan_list[0].scan_type = + scan_req->chan_list[0].scan_type = MLAN_SCAN_TYPE_PASSIVE; else if (req->bss->channel->flags & IEEE80211_CHAN_RADAR) - scan_req.chan_list[0].scan_type = + scan_req->chan_list[0].scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; else - scan_req.chan_list[0].scan_type = MLAN_SCAN_TYPE_ACTIVE; - scan_req.chan_list[0].scan_time = 0; + scan_req->chan_list[0].scan_type = + MLAN_SCAN_TYPE_ACTIVE; + scan_req->chan_list[0].scan_time = 0; } else { for (band = 0; (band < IEEE80211_NUM_BANDS); band++) { if (!priv->wdev->wiphy->bands[band]) @@ -1937,25 +2097,27 @@ ch = &sband->channels[i]; if (ch->flags & IEEE80211_CHAN_DISABLED) continue; - scan_req.chan_list[chan_idx].radio_type = band; + scan_req->chan_list[chan_idx].radio_type = + woal_ieee_band_to_radio_type(band); if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_PASSIVE; else if (ch->flags & IEEE80211_CHAN_RADAR) - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; else - scan_req.chan_list[chan_idx].scan_type = + scan_req->chan_list[chan_idx].scan_type = MLAN_SCAN_TYPE_ACTIVE; - scan_req.chan_list[chan_idx].chan_number = + scan_req->chan_list[chan_idx].chan_number = (u32)ch->hw_value; chan_idx++; } } } - moal_memcpy_ext(priv->phandle, scan_req.random_mac, priv->random_mac, - ETH_ALEN, sizeof(scan_req.random_mac)); - ret = woal_request_userscan(priv, wait_option, &scan_req); + moal_memcpy_ext(priv->phandle, scan_req->random_mac, priv->random_mac, + ETH_ALEN, sizeof(scan_req->random_mac)); + ret = woal_request_userscan(priv, wait_option, scan_req); + kfree(scan_req); #ifdef REASSOCIATION MOAL_REL_SEMAPHORE(&handle->reassoc_sem); #endif @@ -1963,27 +2125,6 @@ return ret; } -mlan_status woal_reset_wifi(moal_handle *handle, t_u8 cnt, char *reason) -{ - static wifi_timeval reset_time; - wifi_timeval ts; - t_u64 diff; - -#define MAX_WIFI_RESET_INTERVAL 15*60*1000000 // 15 minute - woal_get_monotonic_time(&ts); - diff = (t_u64)(timeval_to_usec(ts) - timeval_to_usec(reset_time)); - PRINTM(MERROR, "WiFi Reset diff %lld\n", diff); - if (reset_time.time_sec == 0 || diff >= MAX_WIFI_RESET_INTERVAL) - { - reset_time = ts; - PRINTM(MERROR, "WiFi Reset due to %s cnt %d\n", reason, cnt); - /* Do wifi independent reset */ - woal_process_hang(handle); - return MLAN_STATUS_SUCCESS; - } - return MLAN_STATUS_PENDING; -} - /** * @brief This function is authentication handler when host MLME * enable. @@ -1997,10 +2138,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_authenticate(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_auth_request *req) +static int woal_cfg80211_authenticate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_auth_request *req) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); IEEE80211_MGMT *mgmt = NULL; @@ -2008,7 +2148,7 @@ pmlan_buffer pmbuf = NULL; t_u32 pkt_type, tx_control; t_u16 packet_len = 0, auth_alg; - t_u8 addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; int ret = 0; t_u8 trans = 1, status_code = 0; @@ -2022,7 +2162,7 @@ priv->cfg_disconnect = MFALSE; #ifdef UAP_CFG80211 if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { - PRINTM(MERROR, "Role is AP\n"); + PRINTM(MERROR, "ERR: Role is AP\n"); LEAVE(); return -EFAULT; } @@ -2030,8 +2170,9 @@ if (priv->wdev->iftype != NL80211_IFTYPE_STATION #ifdef WIFI_DIRECT_SUPPORT && priv->wdev->iftype != NL80211_IFTYPE_P2P_CLIENT + #endif /* WIFI_DIRECT_SUPPORT */ - ) { + ) { PRINTM(MERROR, "Received infra auth request when interface not in infra mode\n"); LEAVE(); @@ -2050,13 +2191,13 @@ moal_memcpy_ext(priv->phandle, ssid_bssid->bssid, req->bss->bssid, ETH_ALEN, sizeof(ssid_bssid->bssid)); /* Not allowed to connect to the same AP which is already connected - with other interface */ + with other interface */ for (i = 0; i < handle->priv_num; i++) { if (handle->priv[i] != priv && MTRUE == woal_is_connected(handle->priv[i], ssid_bssid)) { PRINTM(MMSG, - "wlan: already connected with other interface, bssid " - MACSTR "\n", + "wlan: already connected with other interface, bssid " MACSTR + "\n", MAC2STR(handle->priv[i]->cfg_bssid)); kfree(ssid_bssid); LEAVE(); @@ -2093,7 +2234,8 @@ * could not updaet iftype to init p2p client, so we have to * done it here. * */ - if (MLAN_STATUS_SUCCESS != woal_cfg80211_init_p2p_client(priv)) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_init_p2p_client(priv)) { PRINTM(MERROR, "Init p2p client for wpa_supplicant failed.\n"); ret = -EFAULT; @@ -2107,12 +2249,13 @@ } #endif - /*enable auth register frame */ + /*enable auth register frame*/ if (priv->auth_flag == 0) { woal_mgmt_frame_register(priv, IEEE80211_STYPE_AUTH, MTRUE); woal_mgmt_frame_register(priv, IEEE80211_STYPE_DEAUTH, MTRUE); woal_mgmt_frame_register(priv, IEEE80211_STYPE_DISASSOC, MTRUE); } + #define HEADER_SIZE 8 // frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 #define MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) @@ -2120,14 +2263,14 @@ #define AUTH_BODY_LEN 6 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) packet_len = (t_u16)req->ie_len + req->auth_data_len + MGMT_HEADER_LEN + - AUTH_BODY_LEN; + AUTH_BODY_LEN; #else packet_len = (t_u16)req->ie_len + req->sae_data_len + MGMT_HEADER_LEN + - AUTH_BODY_LEN; + AUTH_BODY_LEN; #endif pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); + packet_len + sizeof(packet_len)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); @@ -2175,16 +2318,16 @@ goto done; } - if (req->key && - ((auth_alg == WLAN_AUTH_OPEN) || - (auth_alg == WLAN_AUTH_SHARED_KEY))) { + if (req->key && ((auth_alg == WLAN_AUTH_OPEN) || + (auth_alg == WLAN_AUTH_SHARED_KEY))) { PRINTM(MMSG, "Setting wep encryption with key len %d\n", req->key_len); /* Set the WEP key */ if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_wep_keys(priv, req->key, req->key_len, req->key_idx, MOAL_IOCTL_WAIT)) { - PRINTM(MERROR, "Fail to set wep key idx %d\n", req->key_idx); + PRINTM(MERROR, "Fail to set wep key idx %d\n", + req->key_idx); ret = -EFAULT; goto done; } @@ -2192,16 +2335,17 @@ if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_wep_keys(priv, NULL, 0, req->key_idx, MOAL_IOCTL_WAIT)) { - PRINTM(MERROR, "Fail to enable wep key idx %d\n", req->key_idx); + PRINTM(MERROR, "Fail to enable wep key idx %d\n", + req->key_idx); ret = -EFAULT; goto done; } } if (priv->auth_flag == 0) { - if (woal_cfg80211_remain_on_channel_cfg - (priv, MOAL_IOCTL_WAIT, MFALSE, (t_u8 *)&status, - req->bss->channel, 0, AUTH_TX_DEFAULT_WAIT_TIME)) { + if (woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MFALSE, (t_u8 *)&status, + req->bss->channel, 0, AUTH_TX_DEFAULT_WAIT_TIME)) { PRINTM(MERROR, "Fail to configure remain on channel\n"); ret = -EFAULT; goto done; @@ -2250,7 +2394,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) if (req->auth_data_len >= 4) { if (req->auth_type == NL80211_AUTHTYPE_SAE) { - __le16 *pos = (__le16 *) req->auth_data; + __le16 *pos = (__le16 *)req->auth_data; trans = le16_to_cpu(pos[0]); status_code = le16_to_cpu(pos[1]); @@ -2259,13 +2403,13 @@ req->auth_data + 4, req->auth_data_len - 4, req->auth_data_len - 4); varptr = (t_u8 *)&mgmt->u.auth.variable + - (req->auth_data_len - 4); + (req->auth_data_len - 4); packet_len -= 4; } #else if (req->sae_data_len >= 4) { if (req->auth_type == NL80211_AUTHTYPE_SAE) { - __le16 *pos = (__le16 *) req->sae_data; + __le16 *pos = (__le16 *)req->sae_data; trans = le16_to_cpu(pos[0]); status_code = le16_to_cpu(pos[1]); @@ -2274,11 +2418,11 @@ req->sae_data + 4, req->sae_data_len - 4, req->sae_data_len - 4); varptr = (t_u8 *)&mgmt->u.auth.variable + - (req->sae_data_len - 4); + (req->sae_data_len - 4); packet_len -= 4; } #endif - /*Add packet len */ + /*Add packet len*/ moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, &packet_len, sizeof(packet_len), sizeof(packet_len)); @@ -2310,8 +2454,7 @@ dev->name, MAC2STR(req->bss->bssid)); DBG_HEXDUMP(MDAT_D, "Auth:", pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len); - if (priv->bss_type == MLAN_BSS_TYPE_STA) - woal_save_auth_params(priv, req); + woal_save_auth_params(priv, req); status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { @@ -2322,8 +2465,8 @@ priv->auth_tx_cnt++; if (priv->auth_tx_cnt >= MAX_AUTH_COUNTER) { if (woal_reset_wifi(priv->phandle, priv->auth_tx_cnt, - "auth timeout") == MLAN_STATUS_SUCCESS) - { + "auth timeout") == + MLAN_STATUS_SUCCESS) { priv->auth_tx_cnt = 0; } } @@ -2337,19 +2480,17 @@ priv->host_mlme = MFALSE; priv->auth_flag = 0; priv->auth_alg = 0xFFFF; - PRINTM(MERROR, "Fail to send packet status=%d\n", status); ret = -EFAULT; + PRINTM(MERROR, "Fail to send packet status=%d\n", status); break; } done: if (ret) { woal_mgmt_frame_register(priv, IEEE80211_STYPE_AUTH, MFALSE); if (priv->phandle->remain_on_channel) { - woal_cfg80211_remain_on_channel_cfg(priv, - MOAL_IOCTL_WAIT, - MTRUE, - (t_u8 *)&status, - NULL, 0, 0); + woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MTRUE, (t_u8 *)&status, + NULL, 0, 0); priv->phandle->remain_on_channel = MFALSE; } } @@ -2365,8 +2506,7 @@ * * @return N/A */ -void -woal_host_mlme_work_queue(struct work_struct *work) +void woal_host_mlme_work_queue(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, host_mlme_work); moal_private *priv = (moal_private *)handle->host_mlme_priv; @@ -2379,12 +2519,9 @@ MFALSE); if (priv->phandle->remain_on_channel) { - woal_cfg80211_remain_on_channel_cfg(priv, - MOAL_IOCTL_WAIT, - MTRUE, - (t_u8 *) - &status, - NULL, 0, 0); + woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MTRUE, + (t_u8 *)&status, NULL, 0, 0); priv->phandle->remain_on_channel = MFALSE; } PRINTM(MCMND, "wlan: HostMlme %s auth success\n", @@ -2398,16 +2535,21 @@ * case * * @param priv pointer to moal_private - * @param assoc_rsp pointer to mlan_ds_misc_assoc_rsp + * @param assoc_info pointer to mlan_ds_assoc_info * * @return N/A */ -void -woal_host_mlme_process_assoc_resp(moal_private *priv, - mlan_ds_misc_assoc_rsp *assoc_rsp) +void woal_host_mlme_process_assoc_resp(moal_private *priv, + mlan_ds_assoc_info *assoc_info) { struct cfg80211_bss *bss = NULL; unsigned long flags; + u8 *assoc_req_buf = NULL; +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + struct cfg80211_rx_assoc_resp resp = { + .uapsd_queues = -1, + }; +#endif if (priv) { if (priv->auth_flag & HOST_MLME_ASSOC_DONE) { @@ -2420,84 +2562,90 @@ return; } - if (assoc_rsp->assoc_resp_len) { + if (assoc_info->assoc_resp_len) { PRINTM(MCMND, "HostMlme: %s assoc_resp_len=%d, frame_control=0x%x\n", priv->netdev->name, - assoc_rsp->assoc_resp_len, + assoc_info->assoc_resp_len, ((struct ieee80211_mgmt *) - assoc_rsp->assoc_resp_buf) - ->frame_control); - if (ieee80211_is_assoc_resp(((struct - ieee80211_mgmt *) - assoc_rsp-> - assoc_resp_buf) - ->frame_control) || - ieee80211_is_reassoc_resp(((struct - ieee80211_mgmt - *) - assoc_rsp-> - assoc_resp_buf) - ->frame_control)) { + assoc_info->assoc_resp_buf) + ->frame_control); + if (ieee80211_is_assoc_resp( + ((struct ieee80211_mgmt *) + assoc_info->assoc_resp_buf) + ->frame_control) || + ieee80211_is_reassoc_resp( + ((struct ieee80211_mgmt *) + assoc_info->assoc_resp_buf) + ->frame_control)) { spin_lock_irqsave(&priv->connect_lock, flags); - if (le16_to_cpu(((struct ieee80211_mgmt - *)assoc_rsp-> - assoc_resp_buf) - ->u.assoc_resp. - status_code) != + if (le16_to_cpu( + ((struct ieee80211_mgmt + *)assoc_info + ->assoc_resp_buf) + ->u.assoc_resp + .status_code) != WLAN_STATUS_SUCCESS) { memset(priv->cfg_bssid, 0, ETH_ALEN); - if (priv->bss_type == - MLAN_BSS_TYPE_STA) - woal_clear_conn_params - (priv); + woal_clear_conn_params(priv); } else { priv->cfg_disconnect = MFALSE; } - spin_unlock_irqrestore(&priv-> - connect_lock, - flags); + spin_unlock_irqrestore( + &priv->connect_lock, flags); + /*Populate Assoc req buf only if len is + * non zero . i.e. we received assoc req + * buffer from fw.*/ + if (assoc_info->assoc_req_len) + assoc_req_buf = + assoc_info + ->assoc_req_buf; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + resp.links[0].bss = bss; + resp.buf = assoc_info->assoc_resp_buf; + resp.len = assoc_info->assoc_resp_len; + resp.req_ies = assoc_req_buf; + resp.req_ies_len = + assoc_info->assoc_req_len; mutex_lock(&priv->wdev->mtx); cfg80211_rx_assoc_resp(priv->netdev, - bss, - assoc_rsp-> - assoc_resp_buf, - assoc_rsp-> - assoc_resp_len, - -1, NULL, 0); + &resp); + mutex_unlock(&priv->wdev->mtx); +#else +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) + mutex_lock(&priv->wdev->mtx); + cfg80211_rx_assoc_resp( + priv->netdev, bss, + assoc_info->assoc_resp_buf, + assoc_info->assoc_resp_len, -1, + assoc_req_buf, + assoc_info->assoc_req_len); mutex_unlock(&priv->wdev->mtx); #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) mutex_lock(&priv->wdev->mtx); - cfg80211_rx_assoc_resp(priv->netdev, - bss, - assoc_rsp-> - assoc_resp_buf, - assoc_rsp-> - assoc_resp_len, - -1); + cfg80211_rx_assoc_resp( + priv->netdev, bss, + assoc_info->assoc_resp_buf, + assoc_info->assoc_resp_len, -1); mutex_unlock(&priv->wdev->mtx); #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) mutex_lock(&priv->wdev->mtx); - cfg80211_rx_assoc_resp(priv->netdev, - bss, - assoc_rsp-> - assoc_resp_buf, - assoc_rsp-> - assoc_resp_len); + cfg80211_rx_assoc_resp( + priv->netdev, bss, + assoc_info->assoc_resp_buf, + assoc_info->assoc_resp_len); mutex_unlock(&priv->wdev->mtx); #else - cfg80211_send_rx_assoc(priv->netdev, - bss, - assoc_rsp-> - assoc_resp_buf, - assoc_rsp-> - assoc_resp_len); + cfg80211_send_rx_assoc( + priv->netdev, bss, + assoc_info->assoc_resp_buf, + assoc_info->assoc_resp_len); +#endif #endif #endif #endif @@ -2516,20 +2664,31 @@ * @return N/A */ -static void -woal_assoc_resp_event(moal_private *priv, mlan_ds_misc_assoc_rsp *passoc_rsp) +static void woal_assoc_resp_event(moal_private *priv, + mlan_ds_misc_assoc_rsp *passoc_rsp) { struct woal_event *evt; unsigned long flags; moal_handle *handle = priv->phandle; + mlan_ds_misc_assoc_req assoc_req; + memset(&assoc_req, 0, sizeof(mlan_ds_misc_assoc_req)); + woal_get_assoc_req(priv, &assoc_req, MOAL_IOCTL_WAIT); evt = kzalloc(sizeof(struct woal_event), GFP_ATOMIC); if (evt) { evt->priv = priv; evt->type = WOAL_EVENT_ASSOC_RESP; - moal_memcpy_ext(priv->phandle, &evt->assoc_resp, passoc_rsp, - sizeof(mlan_ds_misc_assoc_rsp), - sizeof(mlan_ds_misc_assoc_rsp)); + moal_memcpy_ext(priv->phandle, evt->assoc_info.assoc_resp_buf, + passoc_rsp->assoc_resp_buf, + passoc_rsp->assoc_resp_len, ASSOC_RSP_BUF_SIZE); + evt->assoc_info.assoc_resp_len = + MIN(passoc_rsp->assoc_resp_len, ASSOC_RSP_BUF_SIZE); + moal_memcpy_ext(priv->phandle, evt->assoc_info.assoc_req_buf, + assoc_req.assoc_req_buf, + assoc_req.assoc_req_len, ASSOC_RSP_BUF_SIZE); + evt->assoc_info.assoc_req_len = + MIN(assoc_req.assoc_req_len, ASSOC_RSP_BUF_SIZE); + INIT_LIST_HEAD(&evt->link); spin_lock_irqsave(&handle->evt_lock, flags); list_add_tail(&evt->link, &handle->evt_queue); @@ -2551,13 +2710,12 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_assoc_request *req) +static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_assoc_request *req) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; unsigned long flags; const u8 *ssid_ie; int wpa_enabled = 0, group_enc_mode = 0, pairwise_enc_mode = 0; @@ -2566,8 +2724,13 @@ ENTER(); - if (priv->auth_alg == WLAN_AUTH_SAE) { + ssid_bssid = kmalloc(sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!ssid_bssid) { + LEAVE(); + return -EFAULT; + } + if (priv->auth_alg == WLAN_AUTH_SAE) { priv->auth_flag = HOST_MLME_AUTH_DONE; woal_mgmt_frame_register(priv, IEEE80211_STYPE_AUTH, MFALSE); @@ -2575,9 +2738,9 @@ priv->netdev->name); if (priv->phandle->remain_on_channel) { - if (woal_cfg80211_remain_on_channel_cfg - (priv, MOAL_IOCTL_WAIT, MTRUE, (t_u8 *)&status, - NULL, 0, 0)) { + if (woal_cfg80211_remain_on_channel_cfg( + priv, MOAL_IOCTL_WAIT, MTRUE, + (t_u8 *)&status, NULL, 0, 0)) { PRINTM(MERROR, "Failed to cancel remain on channel\n"); ret = -EFAULT; @@ -2588,6 +2751,7 @@ } if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) { + kfree(ssid_bssid); LEAVE(); return -EBUSY; } @@ -2599,11 +2763,11 @@ priv->assoc_status = 0; priv->auth_alg = 0xFFFF; - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); rcu_read_lock(); ssid_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); - moal_memcpy_ext(priv->phandle, ssid_bssid.bssid, req->bss->bssid, - ETH_ALEN, sizeof(ssid_bssid.bssid)); + moal_memcpy_ext(priv->phandle, ssid_bssid->bssid, req->bss->bssid, + ETH_ALEN, sizeof(ssid_bssid->bssid)); if (!ssid_ie) { rcu_read_unlock(); @@ -2611,22 +2775,23 @@ goto done; } - moal_memcpy_ext(priv->phandle, ssid_bssid.ssid.ssid, ssid_ie + 2, - ssid_ie[1], sizeof(ssid_bssid.ssid.ssid)); - ssid_bssid.ssid.ssid_len = ssid_ie[1]; + moal_memcpy_ext(priv->phandle, ssid_bssid->ssid.ssid, ssid_ie + 2, + ssid_ie[1], sizeof(ssid_bssid->ssid.ssid)); + ssid_bssid->ssid.ssid_len = ssid_ie[1]; rcu_read_unlock(); - if (ssid_bssid.ssid.ssid_len > MW_ESSID_MAX_SIZE) { + if (ssid_bssid->ssid.ssid_len > MW_ESSID_MAX_SIZE) { PRINTM(MERROR, "Invalid SSID - aborting\n"); ret = -EINVAL; goto done; } - if (!ssid_bssid.ssid.ssid_len || ssid_bssid.ssid.ssid[0] < 0x20) { + if (!ssid_bssid->ssid.ssid_len || ssid_bssid->ssid.ssid[0] < 0x20) { PRINTM(MERROR, "Invalid SSID - aborting\n"); ret = -EINVAL; goto done; } + #ifdef STA_WEXT if (IS_STA_WEXT(priv->phandle->params.cfg80211_wext)) { switch (req->crypto.wpa_versions) { @@ -2656,7 +2821,7 @@ } #endif - if (req->ie && req->ie_len) { /* Set the IE */ + if (req->ie && req->ie_len) { /* Set the IE */ if (MLAN_STATUS_SUCCESS != woal_cfg80211_assoc_ies_cfg(priv, (t_u8 *)req->ie, req->ie_len, MOAL_IOCTL_WAIT)) { @@ -2666,10 +2831,8 @@ } if (req->crypto.n_ciphers_pairwise) { - pairwise_enc_mode = - woal_cfg80211_get_encryption_mode(req->crypto. - ciphers_pairwise[0], - &wpa_enabled); + pairwise_enc_mode = woal_cfg80211_get_encryption_mode( + req->crypto.ciphers_pairwise[0], &wpa_enabled); ret = woal_cfg80211_set_auth(priv, pairwise_enc_mode, wpa_enabled, MOAL_IOCTL_WAIT); if (ret) @@ -2677,33 +2840,30 @@ } if (req->crypto.cipher_group) { - group_enc_mode = - woal_cfg80211_get_encryption_mode(req->crypto. - cipher_group, - &wpa_enabled); + group_enc_mode = woal_cfg80211_get_encryption_mode( + req->crypto.cipher_group, &wpa_enabled); ret = woal_cfg80211_set_auth(priv, group_enc_mode, wpa_enabled, MOAL_IOCTL_WAIT); if (ret) goto done; } - ssid_bssid.host_mlme = priv->host_mlme; + ssid_bssid->host_mlme = priv->host_mlme; if (req->bss->channel) { - ssid_bssid.channel_flags = req->bss->channel->flags; - ssid_bssid.channel_flags |= CHAN_FLAGS_MAX; + ssid_bssid->channel_flags = req->bss->channel->flags; + ssid_bssid->channel_flags |= CHAN_FLAGS_MAX; PRINTM(MCMND, "channel flags=0x%x\n", req->bss->channel->flags); } if (req->prev_bssid) { - moal_memcpy_ext(priv->phandle, ssid_bssid.prev_bssid, + moal_memcpy_ext(priv->phandle, ssid_bssid->prev_bssid, req->prev_bssid, ETH_ALEN, - sizeof(ssid_bssid.prev_bssid)); - + sizeof(ssid_bssid->prev_bssid)); } PRINTM(MCMND, "wlan: HostMlme %s send assoicate to bssid " MACSTR "\n", priv->netdev->name, MAC2STR(req->bss->bssid)); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT_TIMEOUT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT_TIMEOUT, ssid_bssid)) { PRINTM(MERROR, "HostMlme %s: bss_start Fails\n", priv->netdev->name); priv->host_mlme = MFALSE; @@ -2715,12 +2875,9 @@ if (!ret) { priv->rssi_low = DEFAULT_RSSI_LOW_THRESHOLD; - if (priv->bss_type == MLAN_BSS_TYPE_STA -#ifdef WIFI_DIRECT_SUPPORT - || priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT -#endif - ) - woal_save_assoc_params(priv, req, &ssid_bssid); + + woal_save_assoc_params(priv, req, ssid_bssid); + memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); priv->channel = bss_info.bss_chan; @@ -2737,33 +2894,33 @@ } else { PRINTM(MERROR, "wlan: HostMlme %s Failed to connect to bssid " MACSTR - "\n", priv->netdev->name, MAC2STR(req->bss->bssid)); - if (ssid_bssid.assoc_rsp.assoc_resp_len && - ssid_bssid.assoc_rsp.assoc_resp_len > - sizeof(IEEEtypes_MgmtHdr_t)) { + "\n", + priv->netdev->name, MAC2STR(req->bss->bssid)); + if (ssid_bssid->assoc_rsp.assoc_resp_len && + ssid_bssid->assoc_rsp.assoc_resp_len > + sizeof(IEEEtypes_MgmtHdr_t)) { // save the connection param when send assoc_resp to // kernel - woal_save_assoc_params(priv, req, &ssid_bssid); + woal_save_assoc_params(priv, req, ssid_bssid); ret = 0; } else { - ssid_bssid.assoc_rsp.assoc_resp_len = 0; + ssid_bssid->assoc_rsp.assoc_resp_len = 0; ret = -EFAULT; memset(priv->cfg_bssid, 0, ETH_ALEN); - if (priv->bss_type == MLAN_BSS_TYPE_STA) - woal_clear_conn_params(priv); + woal_clear_conn_params(priv); } priv->host_mlme = MFALSE; priv->auth_flag = 0; spin_unlock_irqrestore(&priv->connect_lock, flags); } /*Association Response should also be send when ret is non-zero. - We also need to return success when we have association response - available */ - if (ssid_bssid.assoc_rsp.assoc_resp_len) { + We also need to return success when we have association response + available*/ + if (ssid_bssid->assoc_rsp.assoc_resp_len) { priv->auth_flag |= HOST_MLME_ASSOC_DONE; - woal_assoc_resp_event(priv, &ssid_bssid.assoc_rsp); + woal_assoc_resp_event(priv, &ssid_bssid->assoc_rsp); } - + kfree(ssid_bssid); LEAVE(); return ret; } @@ -2779,14 +2936,13 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, - mlan_ds_misc_assoc_rsp *assoc_rsp) +int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, + mlan_ds_misc_assoc_rsp *assoc_rsp) { struct cfg80211_ibss_params *ibss_param = NULL; struct cfg80211_connect_params *conn_param = NULL; mlan_802_11_ssid req_ssid; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; mlan_ioctl_req *req = NULL; int ret = 0; t_u32 auth_type = 0, mode; @@ -2809,6 +2965,11 @@ LEAVE(); return -EFAULT; } + ssid_bssid = kmalloc(sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!ssid_bssid) { + LEAVE(); + return -EFAULT; + } mode = woal_nl80211_iftype_to_mode(priv->wdev->iftype); @@ -2843,9 +3004,8 @@ ie_len = conn_param->ie_len; privacy = conn_param->privacy; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) - pub = cfg80211_get_bss(priv->wdev->wiphy, channel, - bssid, ssid, ssid_len, - IEEE80211_BSS_TYPE_ESS, + pub = cfg80211_get_bss(priv->wdev->wiphy, channel, bssid, ssid, + ssid_len, IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY); #else pub = cfg80211_get_bss(priv->wdev->wiphy, channel, bssid, ssid, @@ -2854,14 +3014,13 @@ #endif if (pub) { if ((!priv->phandle->params.reg_alpha2 || - strncmp(priv->phandle->params.reg_alpha2, - "99", strlen("99"))) + strncmp(priv->phandle->params.reg_alpha2, "99", + strlen("99"))) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - && - (!moal_extflg_isset(priv->phandle, - EXT_COUNTRY_IE_IGNORE)) + && (!moal_extflg_isset(priv->phandle, + EXT_COUNTRY_IE_IGNORE)) #endif - ) + ) woal_process_country_ie(priv, pub); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(priv->wdev->wiphy, pub); @@ -2902,7 +3061,7 @@ } memset(&req_ssid, 0, sizeof(mlan_802_11_ssid)); - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); req_ssid.ssid_len = ssid_len; if (ssid_len > MW_ESSID_MAX_SIZE) { @@ -2921,7 +3080,7 @@ if (priv->phandle->card_info->embedded_supp) if (MLAN_STATUS_SUCCESS != - woal_set_ewpa_mode(priv, wait_option, &ssid_bssid)) { + woal_set_ewpa_mode(priv, wait_option, ssid_bssid)) { ret = -EFAULT; goto done; } @@ -2953,7 +3112,7 @@ ie_len = priv->ft_ie_len; priv->ft_ie_len = 0; } - if (ie && ie_len) { /* Set the IE */ + if (ie && ie_len) { /* Set the IE */ if (MLAN_STATUS_SUCCESS != woal_cfg80211_assoc_ies_cfg(priv, ie, ie_len, wait_option)) { @@ -2983,12 +3142,9 @@ } if (conn_param->crypto.n_ciphers_pairwise) { - pairwise_enc_mode = - woal_cfg80211_get_encryption_mode(conn_param-> - crypto. - ciphers_pairwise - [0], - &wpa_enabled); + pairwise_enc_mode = woal_cfg80211_get_encryption_mode( + conn_param->crypto.ciphers_pairwise[0], + &wpa_enabled); ret = woal_cfg80211_set_auth(priv, pairwise_enc_mode, wpa_enabled, wait_option); if (ret) @@ -2996,11 +3152,8 @@ } if (conn_param->crypto.cipher_group) { - group_enc_mode = - woal_cfg80211_get_encryption_mode(conn_param-> - crypto. - cipher_group, - &wpa_enabled); + group_enc_mode = woal_cfg80211_get_encryption_mode( + conn_param->crypto.cipher_group, &wpa_enabled); ret = woal_cfg80211_set_auth(priv, group_enc_mode, wpa_enabled, wait_option); if (ret) @@ -3017,22 +3170,18 @@ conn_param->key_len); /* Set the WEP key */ if (MLAN_STATUS_SUCCESS != - woal_cfg80211_set_wep_keys(priv, - conn_param->key, - conn_param-> - key_len, - conn_param-> - key_idx, - wait_option)) { + woal_cfg80211_set_wep_keys( + priv, conn_param->key, + conn_param->key_len, + conn_param->key_idx, wait_option)) { ret = -EFAULT; goto done; } /* Enable the WEP key by key index */ if (MLAN_STATUS_SUCCESS != - woal_cfg80211_set_wep_keys(priv, NULL, 0, - conn_param-> - key_idx, - wait_option)) { + woal_cfg80211_set_wep_keys( + priv, NULL, 0, conn_param->key_idx, + wait_option)) { ret = -EFAULT; goto done; } @@ -3083,20 +3232,20 @@ } wpa_enabled = 0; - ret = woal_cfg80211_set_auth(priv, - MLAN_ENCRYPTION_MODE_WEP104, - wpa_enabled, wait_option); + ret = woal_cfg80211_set_auth( + priv, MLAN_ENCRYPTION_MODE_WEP104, wpa_enabled, + wait_option); if (ret) goto done; } } - moal_memcpy_ext(priv->phandle, &ssid_bssid.ssid, &req_ssid, - sizeof(mlan_802_11_ssid), sizeof(ssid_bssid.ssid)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->ssid, &req_ssid, + sizeof(mlan_802_11_ssid), sizeof(ssid_bssid->ssid)); if (bssid) - moal_memcpy_ext(priv->phandle, &ssid_bssid.bssid, bssid, - ETH_ALEN, sizeof(ssid_bssid.bssid)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->bssid, bssid, + ETH_ALEN, sizeof(ssid_bssid->bssid)); if (MLAN_STATUS_SUCCESS != - woal_find_essid(priv, &ssid_bssid, wait_option)) { + woal_find_essid(priv, ssid_bssid, wait_option)) { /* Do specific SSID scanning */ if (mode != MLAN_BSS_MODE_IBSS) ret = woal_cfg80211_connect_scan(priv, conn_param, @@ -3116,47 +3265,46 @@ if (mode != MLAN_BSS_MODE_IBSS) { if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, wait_option, &ssid_bssid)) { + woal_find_best_network(priv, wait_option, ssid_bssid)) { ret = -EFAULT; goto done; } /* Inform the BSS information to kernel, otherwise * kernel will give a panic after successful assoc */ if (MLAN_STATUS_SUCCESS != - woal_inform_bss_from_scan_result(priv, &ssid_bssid, + woal_inform_bss_from_scan_result(priv, ssid_bssid, wait_option)) { ret = -EFAULT; goto done; } } else if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, wait_option, &ssid_bssid)) + woal_find_best_network(priv, wait_option, ssid_bssid)) /* Adhoc start, Check the channel command */ woal_11h_channel_check_ioctl(priv, wait_option); PRINTM(MINFO, "Trying to associate to %s and bssid " MACSTR "\n", - (char *)req_ssid.ssid, MAC2STR(ssid_bssid.bssid)); + (char *)req_ssid.ssid, MAC2STR(ssid_bssid->bssid)); /* Zero SSID implies use BSSID to connect */ if (bssid) - memset(&ssid_bssid.ssid, 0, sizeof(mlan_802_11_ssid)); - else /* Connect to BSS by ESSID */ - memset(&ssid_bssid.bssid, 0, MLAN_MAC_ADDR_LENGTH); + memset(&ssid_bssid->ssid, 0, sizeof(mlan_802_11_ssid)); + else /* Connect to BSS by ESSID */ + memset(&ssid_bssid->bssid, 0, MLAN_MAC_ADDR_LENGTH); if (channel) { - ssid_bssid.channel_flags = channel->flags; - ssid_bssid.channel_flags |= CHAN_FLAGS_MAX; + ssid_bssid->channel_flags = channel->flags; + ssid_bssid->channel_flags |= CHAN_FLAGS_MAX; PRINTM(MCMND, "channel flags=0x%x\n", channel->flags); } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) if (conn_param && conn_param->prev_bssid) { - moal_memcpy_ext(priv->phandle, ssid_bssid.prev_bssid, + moal_memcpy_ext(priv->phandle, ssid_bssid->prev_bssid, conn_param->prev_bssid, ETH_ALEN, - sizeof(ssid_bssid.prev_bssid)); - + sizeof(ssid_bssid->prev_bssid)); } #endif if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT_TIMEOUT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT_TIMEOUT, ssid_bssid)) { ret = -EFAULT; goto done; } @@ -3171,13 +3319,15 @@ goto done; } } else if (assoc_rsp) { - moal_memcpy_ext(priv->phandle, assoc_rsp, &ssid_bssid.assoc_rsp, + moal_memcpy_ext(priv->phandle, assoc_rsp, + &ssid_bssid->assoc_rsp, sizeof(mlan_ds_misc_assoc_rsp), sizeof(mlan_ds_misc_assoc_rsp)); PRINTM(MCMND, "assoc_rsp ie len=%d\n", assoc_rsp->assoc_resp_len); } done: + kfree(ssid_bssid); if (ret) { /* clear the encryption mode */ if (MLAN_STATUS_SUCCESS != @@ -3209,15 +3359,14 @@ * * @return 0 -- success, otherwise fail */ -static void -woal_cfg80211_fill_rate_info(moal_private *priv, struct station_info *sinfo) +static void woal_cfg80211_fill_rate_info(moal_private *priv, + struct station_info *sinfo) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ioctl_req *req = NULL; mlan_ds_rate *rate = NULL; - t_u16 Rates[12] = { 0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, - 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c - }; + t_u16 Rates[12] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, + 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c}; ENTER(); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_rate)); if (req == NULL) { @@ -3232,7 +3381,8 @@ if (ret != MLAN_STATUS_SUCCESS) goto done; if (rate->param.data_rate.tx_rate_format != MLAN_RATE_FORMAT_LG) { - if (rate->param.data_rate.tx_rate_format == MLAN_RATE_FORMAT_HT) { + if (rate->param.data_rate.tx_rate_format == + MLAN_RATE_FORMAT_HT) { sinfo->txrate.flags = RATE_INFO_FLAGS_MCS; if (rate->param.data_rate.tx_ht_bw == MLAN_HT_BW40) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) @@ -3291,13 +3441,17 @@ sinfo->txrate.mcs = rate->param.data_rate.tx_mcs_index; } else { /* Bit rate is in 500 kb/s units. Convert it to 100kb/s units */ - sinfo->txrate.legacy = - Rates[rate->param.data_rate.tx_data_rate] * 5; + if (rate->param.data_rate.tx_data_rate < 12) { + sinfo->txrate.legacy = + Rates[rate->param.data_rate.tx_data_rate] * 5; + } else + sinfo->txrate.legacy = Rates[0] * 5; } - //Fill Rx rate + // Fill Rx rate #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) if (rate->param.data_rate.rx_rate_format != MLAN_RATE_FORMAT_LG) { - if (rate->param.data_rate.rx_rate_format == MLAN_RATE_FORMAT_HT) { + if (rate->param.data_rate.rx_rate_format == + MLAN_RATE_FORMAT_HT) { sinfo->rxrate.flags = RATE_INFO_FLAGS_MCS; if (rate->param.data_rate.rx_ht_bw == MLAN_HT_BW40) sinfo->rxrate.bw = RATE_INFO_BW_40; @@ -3334,8 +3488,11 @@ sinfo->rxrate.mcs = rate->param.data_rate.rx_mcs_index; } else { /* Bit rate is in 500 kb/s units. Convert it to 100kb/s units */ - sinfo->rxrate.legacy = - Rates[rate->param.data_rate.rx_data_rate] * 5; + if (rate->param.data_rate.rx_data_rate < 12) { + sinfo->rxrate.legacy = + Rates[rate->param.data_rate.rx_data_rate] * 5; + } else + sinfo->rxrate.legacy = 0; } #endif done: @@ -3344,7 +3501,6 @@ LEAVE(); return; } - /** * @brief Request the driver to dump the station information * @@ -3353,8 +3509,8 @@ * * @return 0 -- success, otherwise fail */ -static mlan_status -woal_cfg80211_dump_station_info(moal_private *priv, struct station_info *sinfo) +static mlan_status woal_cfg80211_dump_station_info(moal_private *priv, + struct station_info *sinfo) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_get_signal signal; @@ -3376,16 +3532,16 @@ } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) sinfo->filled = MBIT(NL80211_STA_INFO_RX_BYTES) | - MBIT(NL80211_STA_INFO_TX_BYTES) | - MBIT(NL80211_STA_INFO_RX_PACKETS) | - MBIT(NL80211_STA_INFO_TX_PACKETS) | - MBIT(NL80211_STA_INFO_SIGNAL) | - MBIT(NL80211_STA_INFO_TX_BITRATE) | - MBIT(NL80211_STA_INFO_RX_BITRATE); + MBIT(NL80211_STA_INFO_TX_BYTES) | + MBIT(NL80211_STA_INFO_RX_PACKETS) | + MBIT(NL80211_STA_INFO_TX_PACKETS) | + MBIT(NL80211_STA_INFO_SIGNAL) | + MBIT(NL80211_STA_INFO_TX_BITRATE) | + MBIT(NL80211_STA_INFO_RX_BITRATE); #else sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | - STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | - STATION_INFO_SIGNAL | STATION_INFO_TX_BITRATE; + STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | + STATION_INFO_SIGNAL | STATION_INFO_TX_BITRATE; #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) @@ -3462,41 +3618,6 @@ /******************************************************** Global Functions ********************************************************/ -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) -/** - * @brief Set all radar channel's dfs_state - * - * @param wiphy A pointer to wiphy structure - * - * @return N/A - */ -void -woal_update_radar_chans_dfs_state(struct wiphy *wiphy) -{ - moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - int i; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - for (i = 0; i < sband->n_channels; i++) { - if (sband->channels[i].flags & IEEE80211_CHAN_RADAR) { - if (moal_extflg_isset(handle, EXT_DFS_OFFLOAD)) - sband->channels[i].dfs_state = - NL80211_DFS_AVAILABLE; - else - sband->channels[i].dfs_state = - NL80211_DFS_USABLE; - } - } - } - PRINTM(MCMND, "Set radar dfs_state: dfs_offload=%d\n", - moal_extflg_isset(handle, EXT_DFS_OFFLOAD)); -} -#endif - #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) /** @@ -3506,8 +3627,7 @@ * @param rhs RHS value * @return 0 */ -static int -compare(const void *lhs, const void *rhs) +static int compare(const void *lhs, const void *rhs) { const chan_freq_power_t *lhs_cfp = (const chan_freq_power_t *)(lhs); const chan_freq_power_t *rhs_cfp = (const chan_freq_power_t *)(rhs); @@ -3529,8 +3649,8 @@ * * @return N/A */ -t_u32 -woal_get_chan_rule_flags(mlan_ds_custom_reg_domain * custom_reg, t_u8 channel) +t_u32 woal_get_chan_rule_flags(mlan_ds_custom_reg_domain *custom_reg, + t_u8 channel) { t_u16 num_chan = 0; t_u32 flags = 0; @@ -3566,14 +3686,14 @@ static void woal_reg_apply_beaconing_flags(struct wiphy *wiphy, - mlan_ds_custom_reg_domain * custom_reg) + mlan_ds_custom_reg_domain *custom_reg) { struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; int band, i; t_u32 rule_flags = 0; - for (band = 0; band < NUM_NL80211_BANDS; band++) { + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { sband = wiphy->bands[band]; if (!sband) continue; @@ -3585,9 +3705,8 @@ (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_RADAR)) continue; - rule_flags = - woal_get_chan_rule_flags(custom_reg, - ch->hw_value); + rule_flags = woal_get_chan_rule_flags(custom_reg, + ch->hw_value); if (!(rule_flags & NL80211_RRF_NO_IR)) ch->flags &= ~IEEE80211_CHAN_NO_IR; @@ -3598,12 +3717,14 @@ /** * @brief This function create the custom regdomain * + * @param priv pointer to moal_private * @param custom_reg pointer to mlan_ds_custom_reg_domain * * @return pointer to ieee80211_regdomain */ static struct ieee80211_regdomain * -create_custom_regdomain(mlan_ds_custom_reg_domain * custom_reg) +create_custom_regdomain(moal_private *priv, + mlan_ds_custom_reg_domain *custom_reg) { struct ieee80211_reg_rule *rule; bool new_rule; @@ -3623,7 +3744,7 @@ custom_reg->num_a_chan, sizeof(chan_freq_power_t), &compare, NULL); regd_size = sizeof(struct ieee80211_regdomain) + - num_chan * sizeof(struct ieee80211_reg_rule); + num_chan * sizeof(struct ieee80211_reg_rule); regd = kzalloc(regd_size, GFP_KERNEL); if (!regd) { @@ -3718,7 +3839,7 @@ regd->dfs_region = NL80211_DFS_UNSET; break; } - + priv->phandle->dfs_region = regd->dfs_region; PRINTM(MCMND, "create_custom_regdomain: %c%c rules=%d dfs_region=%d\n", regd->alpha2[0], regd->alpha2[1], valid_rules, regd->dfs_region); for (idx = 0; idx < (int)regd->n_reg_rules; idx++) { @@ -3745,8 +3866,7 @@ * * @return 0-success, otherwise failure */ -static int -woal_update_custom_regdomain(moal_private *priv, struct wiphy *wiphy) +static int woal_update_custom_regdomain(moal_private *priv, struct wiphy *wiphy) { mlan_ds_misc_cfg *misc = NULL; mlan_ioctl_req *req = NULL; @@ -3788,22 +3908,22 @@ country_code[0] = priv->phandle->country_code[0]; country_code[1] = priv->phandle->country_code[1]; } - if (misc->param.custom_reg_domain.region.country_code[0] == '\0' - || misc->param.custom_reg_domain.region.country_code[1] == '\0') { + if (misc->param.custom_reg_domain.region.country_code[0] == '\0' || + misc->param.custom_reg_domain.region.country_code[1] == '\0') { PRINTM(MCMND, "FW country code not valid\n"); ret = -EFAULT; goto done; } if (misc->param.custom_reg_domain.region.country_code[0] != - country_code[0] || + country_code[0] || misc->param.custom_reg_domain.region.country_code[1] != - country_code[1]) { + country_code[1]) { PRINTM(MCMND, "FW country code %c%c not match %c%c\n", misc->param.custom_reg_domain.region.country_code[0], misc->param.custom_reg_domain.region.country_code[1], country_code[0], country_code[1]); } - regd = create_custom_regdomain(&misc->param.custom_reg_domain); + regd = create_custom_regdomain(priv, &misc->param.custom_reg_domain); if (regd) { PRINTM(MMSG, "call regulatory_set_wiphy_regd %c%c", misc->param.custom_reg_domain.region.country_code[0], @@ -3820,9 +3940,8 @@ rtnl_unlock(); kfree(regd); if (!ret) - woal_reg_apply_beaconing_flags(wiphy, - &misc->param. - custom_reg_domain); + woal_reg_apply_beaconing_flags( + wiphy, &misc->param.custom_reg_domain); } done: if (status != MLAN_STATUS_PENDING) @@ -3839,8 +3958,7 @@ * * @return N/A */ -void -woal_regulatory_work_queue(struct work_struct *work) +void woal_regulatory_work_queue(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, regulatory_work); struct wiphy *wiphy = handle->wiphy; @@ -3852,8 +3970,10 @@ band = priv->phandle->band; priv->phandle->band = IEEE80211_BAND_2GHZ; woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); - priv->phandle->band = IEEE80211_BAND_5GHZ; - woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + if (priv->phandle->fw_bands & BAND_A) { + priv->phandle->band = IEEE80211_BAND_5GHZ; + woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + } priv->phandle->band = band; } } @@ -3887,6 +4007,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) char *reg_alpha2 = NULL; #endif + t_u8 dfs_region = NXP_DFS_UNKNOWN; ENTER(); @@ -3900,11 +4021,20 @@ return; #endif } - +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + dfs_region = request->dfs_region; +#endif PRINTM(MCMND, "cfg80211 regulatory domain callback " - "%c%c initiator=%d\n", - request->alpha2[0], request->alpha2[1], request->initiator); + "%c%c initiator=%d dfs_region=%d\n", + request->alpha2[0], request->alpha2[1], request->initiator, + dfs_region); + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + if (!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)) +#endif + handle->dfs_region = dfs_region; + memset(&fw_info, 0, sizeof(mlan_fw_info)); woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); if (fw_info.force_reg) { @@ -3917,22 +4047,29 @@ return; #endif } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - if (moal_extflg_isset(handle, EXT_DFS_OFFLOAD)) - woal_update_radar_chans_dfs_state(wiphy); -#endif + memset(region, 0, sizeof(region)); moal_memcpy_ext(priv->phandle, region, request->alpha2, sizeof(request->alpha2), sizeof(region)); region[2] = ' '; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + if (request->initiator == NL80211_REGDOM_SET_BY_CORE) + moal_memcpy_ext(priv->phandle, region, priv->phandle->params.reg_alpha2, + sizeof(handle->params.reg_alpha2), sizeof(region)); +#endif if ((handle->country_code[0] != request->alpha2[0]) || (handle->country_code[1] != request->alpha2[1])) { - if (handle->params.cntry_txpwr && - !handle->params.txpwrlimit_cfg) { + if (handle->params.cntry_txpwr) { t_u8 country_code[COUNTRY_CODE_LEN]; handle->country_code[0] = request->alpha2[0]; handle->country_code[1] = request->alpha2[1]; handle->country_code[2] = ' '; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + if (request->initiator == NL80211_REGDOM_SET_BY_CORE) { + handle->country_code[0] = priv->phandle->params.reg_alpha2[0]; + handle->country_code[1] = priv->phandle->params.reg_alpha2[1]; + } +#endif memset(country_code, 0, sizeof(country_code)); if (MTRUE == is_cfg80211_special_region_code(region)) { country_code[0] = 'W'; @@ -3940,6 +4077,12 @@ } else { country_code[0] = request->alpha2[0]; country_code[1] = request->alpha2[1]; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + if (request->initiator == NL80211_REGDOM_SET_BY_CORE) { + country_code[0] = priv->phandle->params.reg_alpha2[0]; + country_code[1] = priv->phandle->params.reg_alpha2[1]; + } +#endif } if (MLAN_STATUS_SUCCESS != woal_request_country_power_table(priv, @@ -3953,25 +4096,24 @@ load_power_table = MTRUE; } } - if (MTRUE != is_cfg80211_special_region_code(region)) { - if (!handle->params.cntry_txpwr) { - handle->country_code[0] = request->alpha2[0]; - handle->country_code[1] = request->alpha2[1]; - handle->country_code[2] = ' '; + if (!handle->params.cntry_txpwr) { + handle->country_code[0] = request->alpha2[0]; + handle->country_code[1] = request->alpha2[1]; + handle->country_code[2] = ' '; + if (MTRUE != is_cfg80211_special_region_code(region)) { + if (MLAN_STATUS_SUCCESS != + woal_set_region_code(priv, handle->country_code)) + PRINTM(MERROR, "Set country code failed!\n"); } - if (MLAN_STATUS_SUCCESS != - woal_set_region_code(priv, handle->country_code)) - PRINTM(MERROR, "Set country code failed!\n"); } switch (request->initiator) { case NL80211_REGDOM_SET_BY_DRIVER: PRINTM(MCMND, "Regulatory domain BY_DRIVER\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) reg_alpha2 = priv->phandle->params.reg_alpha2; - if ((handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE) - && !handle->params.txpwrlimit_cfg - && load_power_table - && reg_alpha2 && woal_is_valid_alpha2(reg_alpha2)) + if ((handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE) && + !handle->params.txpwrlimit_cfg && load_power_table && + reg_alpha2 && woal_is_valid_alpha2(reg_alpha2)) queue_work(handle->evt_workqueue, &handle->regulatory_work); #endif @@ -3979,8 +4121,8 @@ case NL80211_REGDOM_SET_BY_CORE: PRINTM(MCMND, "Regulatory domain BY_CORE\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - if (handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE - && load_power_table && !handle->params.txpwrlimit_cfg) + if (handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE && + load_power_table && !handle->params.txpwrlimit_cfg) queue_work(handle->evt_workqueue, &handle->regulatory_work); #endif @@ -3988,8 +4130,8 @@ case NL80211_REGDOM_SET_BY_USER: PRINTM(MCMND, "Regulatory domain BY_USER\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - if (handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE - && load_power_table && !handle->params.txpwrlimit_cfg) + if (handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE && + load_power_table && !handle->params.txpwrlimit_cfg) queue_work(handle->evt_workqueue, &handle->regulatory_work); #endif @@ -3999,12 +4141,17 @@ break; } if (priv->wdev && priv->wdev->wiphy && +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) + !(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) && +#endif (request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE)) { band = priv->phandle->band; priv->phandle->band = IEEE80211_BAND_2GHZ; woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); - priv->phandle->band = IEEE80211_BAND_5GHZ; - woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + if (priv->phandle->fw_bands & BAND_A) { + priv->phandle->band = IEEE80211_BAND_5GHZ; + woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + } priv->phandle->band = band; } @@ -4024,8 +4171,8 @@ * * @return 0 --success, otherwise fail */ -static mlan_status -woal_role_switch(moal_private *priv, t_u8 wait_option, t_u8 bss_role) +static mlan_status woal_role_switch(moal_private *priv, t_u8 wait_option, + t_u8 bss_role) { int ret = 0; mlan_ds_bss *bss = NULL; @@ -4066,8 +4213,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_setget_bandcfg(moal_private *priv, t_u8 action, mlan_ds_band_cfg *band_cfg) +static int woal_setget_bandcfg(moal_private *priv, t_u8 action, + mlan_ds_band_cfg *band_cfg) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -4114,8 +4261,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -static mlan_status -woal_uap_scan(moal_private *priv, wlan_user_scan_cfg *scan_cfg) +static mlan_status woal_uap_scan(moal_private *priv, + wlan_user_scan_cfg *scan_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_handle *handle = priv->phandle; @@ -4134,13 +4281,33 @@ return MLAN_STATUS_FAILURE; } role = GET_BSS_ROLE(tmp_priv); - if (role == MLAN_BSS_ROLE_UAP) - woal_role_switch(tmp_priv, MOAL_IOCTL_WAIT, MLAN_BSS_ROLE_STA); + if (role == MLAN_BSS_ROLE_UAP) { + if (MLAN_STATUS_SUCCESS != + woal_role_switch(tmp_priv, MOAL_IOCTL_WAIT, + MLAN_BSS_ROLE_STA)) { + PRINTM(MERROR, "role switch from uap to sta fail\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + } if (tmp_priv != priv) { - woal_setget_bandcfg(priv, MLAN_ACT_GET, &bandcfg); - woal_setget_bandcfg(tmp_priv, MLAN_ACT_GET, &org_bandcfg); + if (woal_setget_bandcfg(priv, MLAN_ACT_GET, &bandcfg)) { + PRINTM(MERROR, "get bandcfg fail\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + if (woal_setget_bandcfg(tmp_priv, MLAN_ACT_GET, &org_bandcfg)) { + PRINTM(MERROR, "get bandcfg fail\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } if (bandcfg.config_bands != org_bandcfg.config_bands) { - woal_setget_bandcfg(tmp_priv, MLAN_ACT_SET, &bandcfg); + if (woal_setget_bandcfg(tmp_priv, MLAN_ACT_SET, + &bandcfg)) { + PRINTM(MERROR, "set bandcfg fail\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } band_change = MTRUE; } } @@ -4157,23 +4324,32 @@ MOAL_REL_SEMAPHORE(&handle->reassoc_sem); #endif done: - if (role == MLAN_BSS_ROLE_UAP) - woal_role_switch(tmp_priv, MOAL_IOCTL_WAIT, MLAN_BSS_ROLE_UAP); - if (band_change) - woal_setget_bandcfg(tmp_priv, MLAN_ACT_SET, &org_bandcfg); + if (role == MLAN_BSS_ROLE_UAP) { + if (MLAN_STATUS_SUCCESS != + woal_role_switch(tmp_priv, MOAL_IOCTL_WAIT, + MLAN_BSS_ROLE_UAP)) { + PRINTM(MERROR, "role switch back to uap fail\n"); + ret = MLAN_STATUS_FAILURE; + } + } + if (band_change) { + if (woal_setget_bandcfg(tmp_priv, MLAN_ACT_SET, &org_bandcfg)) { + PRINTM(MERROR, "restore bandcfg fail\n"); + ret = MLAN_STATUS_FAILURE; + } + } LEAVE(); return ret; } #endif -static int -woal_find_wps_ie_in_probereq(const t_u8 *ie, int len) +static int woal_find_wps_ie_in_probereq(const t_u8 *ie, int len) { int left_len = len; const t_u8 *pos = ie; t_u8 ie_id, ie_len; IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; - const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; + const u8 wps_oui[4] = {0x00, 0x50, 0xf2, 0x04}; while (left_len >= 2) { ie_id = *pos; @@ -4195,6 +4371,7 @@ return MFALSE; } +#ifdef UAP_CFG80211 /** scan result expired value */ #define SCAN_RESULT_EXPIRTED 1 /** @@ -4205,67 +4382,14 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -woal_is_uap_scan_result_expired(moal_private *priv) +static t_u8 woal_is_uap_scan_result_expired(moal_private *priv) { mlan_scan_resp scan_resp; wifi_timeval t; ENTER(); - if (MLAN_STATUS_SUCCESS != - woal_get_scan_table(priv, MOAL_IOCTL_WAIT, &scan_resp)) { - LEAVE(); - return MTRUE; - } - if (!scan_resp.num_in_scan_table) { - LEAVE(); - return MTRUE; - } - woal_get_monotonic_time(&t); - if (t.time_sec > (scan_resp.age_in_secs + SCAN_RESULT_EXPIRTED)) { - LEAVE(); - return MTRUE; - } - LEAVE(); - return MFALSE; -} -/** - * @brief check if the scan result expired - * - * @param priv A pointer to moal_private - * - * - * @return MTRUE/MFALSE; - */ -static t_u8 -woal_is_scan_result_expired(moal_private *priv) -{ - mlan_scan_resp scan_resp; - wifi_timeval t; - ENTER(); - // Don't block ACS scan - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { - LEAVE(); - return MTRUE; - } - //Don't block scan when non any interface active - if (!woal_is_any_interface_active(priv->phandle)) { - LEAVE(); - return MTRUE; - } -#if defined(WIFI_DIRECT_SUPPORT) -#if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - //Do not skip p2p interface connect scan - if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { - LEAVE(); - return MTRUE; - } -#endif -#endif - if (!priv->media_connected) { - LEAVE(); - return MTRUE; - } + memset(&scan_resp, 0, sizeof(scan_resp)); + if (MLAN_STATUS_SUCCESS != woal_get_scan_table(priv, MOAL_IOCTL_WAIT, &scan_resp)) { LEAVE(); @@ -4283,6 +4407,7 @@ LEAVE(); return MFALSE; } +#endif /** * @brief check if the scan result ageout @@ -4292,12 +4417,12 @@ * * @return MTRUE/MFALSE; */ -t_u8 -wlan_check_scan_table_ageout(moal_private *priv) +t_u8 wlan_check_scan_table_ageout(moal_private *priv) { mlan_scan_resp scan_resp; wifi_timeval t; ENTER(); + memset(&scan_resp, 0, sizeof(scan_resp)); if (MLAN_STATUS_SUCCESS != woal_get_scan_table(priv, MOAL_IOCTL_WAIT, &scan_resp)) { LEAVE(); @@ -4305,7 +4430,8 @@ } woal_get_monotonic_time(&t); #define CFG80211_SCAN_RESULT_AGEOUT 10 - if (t.time_sec > (scan_resp.age_in_secs + CFG80211_SCAN_RESULT_AGEOUT)) { + if (t.time_sec > + (scan_resp.age_in_secs + CFG80211_SCAN_RESULT_AGEOUT)) { LEAVE(); return MFALSE; } @@ -4326,8 +4452,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) +static int woal_cfg80211_scan(struct wiphy *wiphy, + struct cfg80211_scan_request *request) #else /** * @brief Request the driver to do a scan. Always returning @@ -4341,9 +4467,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_scan_request *request) +static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_scan_request *request) #endif { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) @@ -4365,18 +4490,10 @@ PRINTM(MINFO, "Received scan request on %s\n", dev->name); if (priv->phandle->driver_status) { PRINTM(MERROR, - "Block woal_cfg80211_scan in abnormal driver state\n"); + "Block woal_cfg80211_scan in abnormal driver state\n"); LEAVE(); return -EFAULT; } -#if defined(WIFI_LATENCY_MODE_SUPPORT) - if (MTRUE == priv->scan_suppressed) { - PRINTM(MINFO, "Suppress scan request per config\n"); - ret = -EAGAIN; - goto done; - } -#endif // defined(WIFI_LATENCY_MODE_SUPPORT) - if (priv->phandle->scan_pending_on_block == MTRUE) { PRINTM(MCMND, "scan already in processing...\n"); LEAVE(); @@ -4402,16 +4519,15 @@ #endif #endif #endif - cancel_delayed_work_sync(&priv->phandle->scan_timeout_work); + cancel_delayed_work(&priv->phandle->scan_timeout_work); priv->phandle->fake_scan_complete = priv->fake_scan_complete; - if (priv->fake_scan_complete || !woal_is_scan_result_expired(priv)) { - priv->phandle->fake_scan_complete = MTRUE; - PRINTM(MEVENT, - "fake scan complete flag is on\n"); + if (priv->fake_scan_complete) { + PRINTM(MEVENT, "fake scan complete flag is on\n"); priv->phandle->scan_request = request; queue_delayed_work(priv->phandle->evt_workqueue, - &priv->phandle->scan_timeout_work, msecs_to_jiffies(1000)); - return MLAN_STATUS_SUCCESS; + &priv->phandle->scan_timeout_work, + msecs_to_jiffies(1000)); + return ret; } memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS == @@ -4440,6 +4556,11 @@ priv->phandle->scan_time_start.time_usec); } scan_req = kmalloc(sizeof(wlan_user_scan_cfg), GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Failed to alloc memory for scan_req\n"); + LEAVE(); + return -ENOMEM; + } memset(scan_req, 0x00, sizeof(wlan_user_scan_cfg)); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) if (!is_broadcast_ether_addr(request->bssid)) { @@ -4471,10 +4592,9 @@ if (scan_req->scan_chan_gap && priv->phandle->pref_mac) scan_req->scan_chan_gap |= GAP_FLAG_OPTIONAL; - if (priv->phandle->scan_request->n_channels <= 38) { - if (scan_cfg.ext_scan == 3) - scan_req->ext_scan_type = EXT_SCAN_ENHANCE; - } + scan_req->scan_cfg_only = MTRUE; + if (scan_cfg.ext_scan == 3) + scan_req->ext_scan_type = EXT_SCAN_ENHANCE; for (i = 0; i < priv->phandle->scan_request->n_ssids; i++) { moal_memcpy_ext(priv->phandle, scan_req->ssid_list[i].ssid, @@ -4501,7 +4621,8 @@ i++) { chan = priv->phandle->scan_request->channels[i]; scan_req->chan_list[i].chan_number = chan->hw_value; - scan_req->chan_list[i].radio_type = chan->band; + scan_req->chan_list[i].radio_type = + woal_ieee_band_to_radio_type(chan->band); if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) || !priv->phandle->scan_request->n_ssids) scan_req->chan_list[i].scan_type = @@ -4557,32 +4678,36 @@ } if (priv->phandle->scan_request->ie && priv->phandle->scan_request->ie_len) { - if (woal_find_wps_ie_in_probereq((t_u8 *)priv->phandle-> - scan_request->ie, - priv->phandle->scan_request-> - ie_len)) { + if (woal_find_wps_ie_in_probereq( + (t_u8 *)priv->phandle->scan_request->ie, + priv->phandle->scan_request->ie_len)) { PRINTM(MIOCTL, "Notify firmware only keep probe response\n"); scan_req->proberesp_only = MTRUE; } if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, - (t_u8 *)priv->phandle-> - scan_request->ie, - priv->phandle->scan_request-> - ie_len, MGMT_MASK_PROBE_REQ, - MOAL_IOCTL_WAIT)) { + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, + (t_u8 *)priv->phandle->scan_request->ie, + priv->phandle->scan_request->ie_len, + MGMT_MASK_PROBE_REQ, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Fail to set scan request IE\n"); ret = -EFAULT; goto done; } } else { /** Clear SCAN IE in Firmware */ - if (priv->probereq_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, - NULL, 0, NULL, 0, - MGMT_MASK_PROBE_REQ, - MOAL_IOCTL_WAIT); + if (priv->probereq_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_PROBE_REQ, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, + "Fail to clear scan request IE\n"); + ret = -EFAULT; + goto done; + } + } } #ifdef UAP_CFG80211 if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { @@ -4605,7 +4730,7 @@ for (i = 0; i < ETH_ALEN; i++) { buf[i] &= ~request->mac_addr_mask[i]; buf[i] |= request->mac_addr[i] & - request->mac_addr_mask[i]; + request->mac_addr_mask[i]; } moal_memcpy_ext(priv->phandle, scan_req->random_mac, buf, ETH_ALEN, sizeof(scan_req->random_mac)); @@ -4617,7 +4742,9 @@ PRINTM(MCMND, "wlan:random_mac " MACSTR "\n", MAC2STR(scan_req->random_mac)); - scan_req->keep_previous_scan = wlan_check_scan_table_ageout(priv); + if (priv->phandle->params.keep_previous_scan) + scan_req->keep_previous_scan = + wlan_check_scan_table_ageout(priv); if (MLAN_STATUS_SUCCESS != woal_do_scan(priv, scan_req)) { PRINTM(MERROR, "woal_do_scan fails!\n"); @@ -4631,20 +4758,20 @@ priv->phandle->scan_request = NULL; priv->phandle->scan_priv = NULL; spin_unlock_irqrestore(&priv->phandle->scan_req_lock, flags); - } else{ + } else { PRINTM(MMSG, "wlan: %s START SCAN\n", dev->name); - queue_delayed_work(priv->phandle->evt_workqueue, + queue_delayed_work( + priv->phandle->evt_workqueue, &priv->phandle->scan_timeout_work, msecs_to_jiffies(priv->phandle->scan_timeout)); - } + } kfree(scan_req); LEAVE(); return ret; } - #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) -static void -woal_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev) +static void woal_cfg80211_abort_scan(struct wiphy *wiphy, + struct wireless_dev *wdev) { moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev); ENTER(); @@ -4664,9 +4791,8 @@ * @ * @return 0 -- success, otherwise fail */ -static int -woal_send_ft_action_requst(moal_private *priv, t_u8 *ie, t_u8 len, - t_u8 *bssid, t_u8 *target_ap) +static int woal_send_ft_action_requst(moal_private *priv, t_u8 *ie, t_u8 len, + t_u8 *bssid, t_u8 *target_ap) { IEEE80211_MGMT *mgmt = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -4674,21 +4800,21 @@ t_u32 pkt_type; t_u32 tx_control; t_u16 packet_len = 0; - t_u8 addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; int ret = 0; ENTER(); /* pkt_type + tx_control */ #define HEADER_SIZE 8 - /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 */ + /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4*/ #define MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) /* 14 = category + action + sta addr + target ap */ #define FT_REQUEST_LEN 14 packet_len = (t_u16)len + MGMT_HEADER_LEN + FT_REQUEST_LEN; pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); + packet_len + sizeof(packet_len)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); ret = -ENOMEM; @@ -4704,7 +4830,7 @@ moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type), &tx_control, sizeof(tx_control), sizeof(tx_control)); - /*Add packet len */ + /*Add packet len*/ moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, &packet_len, sizeof(packet_len), sizeof(packet_len)); @@ -4723,7 +4849,7 @@ moal_memcpy_ext(priv->phandle, mgmt->addr4, addr, ETH_ALEN, sizeof(mgmt->addr4)); - mgmt->u.ft_req.category = 0x06; /**ft action code 0x6*/ + mgmt->u.ft_req.category = 0x06; /**ft action code 0x6*/ mgmt->u.ft_req.action = 0x1; /**ft action request*/ moal_memcpy_ext(priv->phandle, mgmt->u.ft_req.sta_addr, priv->current_addr, ETH_ALEN, @@ -4762,7 +4888,6 @@ LEAVE(); return ret; } - /** * @brief construct and send ft auth request * @@ -4773,8 +4898,8 @@ * @ * @return 0 -- success, otherwise fail */ -static int -woal_send_ft_auth_requst(moal_private *priv, t_u8 *ie, t_u8 len, t_u8 *bssid) +static int woal_send_ft_auth_requst(moal_private *priv, t_u8 *ie, t_u8 len, + t_u8 *bssid) { IEEE80211_MGMT *mgmt = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -4782,20 +4907,20 @@ t_u32 pkt_type; t_u32 tx_control; t_u16 packet_len = 0; - t_u8 addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; int ret = 0; ENTER(); /* pkt_type + tx_control */ #define HEADER_SIZE 8 - /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 */ + /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4*/ #define MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) - /* 6 = auth_alg + auth_transaction +auth_status */ + /* 6 = auth_alg + auth_transaction +auth_status*/ #define AUTH_BODY_LEN 6 packet_len = (t_u16)len + MGMT_HEADER_LEN + AUTH_BODY_LEN; pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); + packet_len + sizeof(packet_len)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); ret = -ENOMEM; @@ -4811,7 +4936,7 @@ moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type), &tx_control, sizeof(tx_control), sizeof(tx_control)); - /*Add packet len */ + /*Add packet len*/ moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, &packet_len, sizeof(packet_len), sizeof(packet_len)); @@ -4873,9 +4998,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_connect_ft_over_air(moal_private *priv, t_u8 *bssid, - struct ieee80211_channel *chan) +static int woal_connect_ft_over_air(moal_private *priv, t_u8 *bssid, + struct ieee80211_channel *chan) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) t_u8 status = 0; @@ -4894,7 +5018,7 @@ return -EFAULT; } - /*enable auth register frame */ + /*enable auth register frame*/ woal_mgmt_frame_register(priv, IEEE80211_STYPE_AUTH, MTRUE); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) @@ -4902,10 +5026,10 @@ chan, 0, AUTH_TX_DEFAULT_WAIT_TIME); #endif - /*construct auth request and send out */ + /*construct auth request and send out*/ woal_send_ft_auth_requst(priv, priv->ft_ie, priv->ft_ie_len, bssid); PRINTM(MMSG, "wlan: send out FT auth,wait for auth response\n"); - /*wait until received auth response */ + /*wait until received auth response*/ priv->ft_wait_condition = MFALSE; timeout = wait_event_timeout(priv->ft_wait_q, priv->ft_wait_condition, 1 * HZ); @@ -4948,9 +5072,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_connect_ft_over_ds(moal_private *priv, t_u8 *bssid, - struct ieee80211_channel *pchan) +static int woal_connect_ft_over_ds(moal_private *priv, t_u8 *bssid, + struct ieee80211_channel *pchan) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) t_u8 status = 0; @@ -4966,12 +5089,12 @@ woal_cfg80211_remain_on_channel_cfg(priv, wait_option, MFALSE, &status, pchan, 0, 1200); #endif - /*construct ft action request and send out */ + /*construct ft action request and send out*/ woal_send_ft_action_requst(priv, priv->ft_ie, priv->ft_ie_len, (t_u8 *)priv->cfg_bssid, bssid); PRINTM(MMSG, "wlan: send out FT request,wait for FT response\n"); - /*wait until received auth response */ + /*wait until received auth response*/ priv->ft_wait_condition = MFALSE; timeout = wait_event_timeout(priv->ft_wait_q, priv->ft_wait_condition, 1 * HZ); @@ -4979,9 +5102,8 @@ /*go over air, as current AP may be unreachable */ PRINTM(MMSG, "wlan: go over air\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - woal_cfg80211_remain_on_channel_cfg(priv, wait_option, - MTRUE, &status, - NULL, 0, 0); + woal_cfg80211_remain_on_channel_cfg( + priv, wait_option, MTRUE, &status, NULL, 0, 0); #endif woal_connect_ft_over_air(priv, bssid, pchan); LEAVE(); @@ -5011,8 +5133,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_start_ft_roaming(moal_private *priv, mlan_ssid_bssid *ssid_bssid) +static int woal_start_ft_roaming(moal_private *priv, + mlan_ssid_bssid *ssid_bssid) { struct ieee80211_channel chan; int ret = 0; @@ -5021,12 +5143,13 @@ PRINTM(MEVENT, "Try to start FT roaming......\n"); chan.band = (ssid_bssid->channel < 36) ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ; + IEEE80211_BAND_5GHZ; chan.center_freq = ieee80211_channel_to_frequency(ssid_bssid->channel #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - , chan.band + , + chan.band #endif - ); + ); if (!(priv->last_event & EVENT_PRE_BCN_LOST) && (ssid_bssid->ft_cap & MBIT(0))) { @@ -5042,7 +5165,6 @@ LEAVE(); return ret; } - /** * @brief Request the driver to connect to the ESS with * the specified parameters from kernel @@ -5053,9 +5175,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) +static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_connect_params *sme) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; @@ -5063,7 +5184,9 @@ unsigned long flags; mlan_ds_misc_assoc_rsp *assoc_rsp = NULL; IEEEtypes_AssocRsp_t *passoc_rsp = NULL; - mlan_ssid_bssid ssid_bssid; + mlan_ds_misc_assoc_req assoc_req; + + mlan_ssid_bssid *ssid_bssid = NULL; moal_handle *handle = priv->phandle; int i; @@ -5083,28 +5206,34 @@ && priv->wdev->iftype != NL80211_IFTYPE_P2P_CLIENT #endif /* KERNEL_VERSION */ #endif /* WIFI_DIRECT_SUPPORT */ - ) { + ) { PRINTM(MERROR, "Received infra assoc request when station not in infra mode\n"); LEAVE(); return -EINVAL; } - memset(&ssid_bssid, 0, sizeof(ssid_bssid)); - moal_memcpy_ext(priv->phandle, &ssid_bssid.ssid.ssid, sme->ssid, - sme->ssid_len, sizeof(ssid_bssid.ssid.ssid)); - ssid_bssid.ssid.ssid_len = sme->ssid_len; + ssid_bssid = kmalloc(sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!ssid_bssid) { + LEAVE(); + return -EFAULT; + } + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->ssid.ssid, sme->ssid, + sme->ssid_len, sizeof(ssid_bssid->ssid.ssid)); + ssid_bssid->ssid.ssid_len = sme->ssid_len; if (sme->bssid) - moal_memcpy_ext(priv->phandle, &ssid_bssid.bssid, sme->bssid, - ETH_ALEN, sizeof(ssid_bssid.bssid)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->bssid, sme->bssid, + ETH_ALEN, sizeof(ssid_bssid->bssid)); /* Not allowed to connect to the same AP which is already connected - with other interface */ + with other interface */ for (i = 0; i < handle->priv_num; i++) { if (handle->priv[i] != priv && - MTRUE == woal_is_connected(handle->priv[i], &ssid_bssid)) { + MTRUE == woal_is_connected(handle->priv[i], ssid_bssid)) { PRINTM(MMSG, - "wlan: already connected with other interface, bssid " - MACSTR "\n", + "wlan: already connected with other interface, bssid " MACSTR + "\n", MAC2STR(handle->priv[i]->cfg_bssid)); + kfree(ssid_bssid); LEAVE(); return -EINVAL; } @@ -5126,11 +5255,13 @@ * could not updaet iftype to init p2p client, so we have to * done it here. * */ - if (MLAN_STATUS_SUCCESS != woal_cfg80211_init_p2p_client(priv)) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_init_p2p_client(priv)) { PRINTM(MERROR, "Init p2p client for wpa_supplicant failed.\n"); ret = -EFAULT; + kfree(ssid_bssid); LEAVE(); return ret; } @@ -5149,14 +5280,14 @@ woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); /** get target bss info */ if (MLAN_STATUS_SUCCESS != - woal_find_essid(priv, &ssid_bssid, MOAL_IOCTL_WAIT)) { + woal_find_essid(priv, ssid_bssid, MOAL_IOCTL_WAIT)) { ret = woal_cfg80211_connect_scan(priv, sme, MOAL_IOCTL_WAIT); if (!ret) { if (MLAN_STATUS_SUCCESS != woal_find_best_network(priv, MOAL_IOCTL_WAIT, - &ssid_bssid)) { + ssid_bssid)) { PRINTM(MERROR, "can't find targe AP \n"); // LEAVE(); @@ -5164,9 +5295,10 @@ } } } - if (bss_info.mdid == ssid_bssid.ft_md && - bss_info.ft_cap == ssid_bssid.ft_cap) { - ret = woal_start_ft_roaming(priv, &ssid_bssid); + if (bss_info.mdid == ssid_bssid->ft_md && + bss_info.ft_cap == ssid_bssid->ft_cap) { + ret = woal_start_ft_roaming(priv, ssid_bssid); + kfree(ssid_bssid); LEAVE(); return 0; } @@ -5180,6 +5312,7 @@ if (!assoc_rsp) { PRINTM(MERROR, "Failed to allocate memory for assoc_rsp\n"); ret = -ENOMEM; + kfree(ssid_bssid); LEAVE(); return ret; } @@ -5191,17 +5324,18 @@ if (!ret) { passoc_rsp = (IEEEtypes_AssocRsp_t *)assoc_rsp->assoc_resp_buf; priv->rssi_low = DEFAULT_RSSI_LOW_THRESHOLD; - if (priv->bss_type == MLAN_BSS_TYPE_STA) - woal_save_conn_params(priv, sme); + woal_save_conn_params(priv, sme); memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); priv->channel = bss_info.bss_chan; - if (!ssid_bssid.ft_md) { + if (!ssid_bssid->ft_md) { priv->ft_ie_len = 0; priv->ft_pre_connect = MFALSE; priv->ft_md = 0; priv->ft_cap = 0; } + memset(&assoc_req, 0, sizeof(mlan_ds_misc_assoc_req)); + woal_get_assoc_req(priv, &assoc_req, MOAL_IOCTL_WAIT); } spin_lock_irqsave(&priv->connect_lock, flags); priv->cfg_connect = MFALSE; @@ -5210,11 +5344,11 @@ "wlan: Connected to bssid " MACSTR " successfully\n", MAC2STR(priv->cfg_bssid)); spin_unlock_irqrestore(&priv->connect_lock, flags); - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0, - passoc_rsp->ie_buffer, - assoc_rsp->assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, - WLAN_STATUS_SUCCESS, GFP_KERNEL); + cfg80211_connect_result( + priv->netdev, priv->cfg_bssid, assoc_req.assoc_req_buf, + assoc_req.assoc_req_len, passoc_rsp->ie_buffer, + assoc_rsp->assoc_resp_len - ASSOC_RESP_FIXED_SIZE, + WLAN_STATUS_SUCCESS, GFP_KERNEL); } else { PRINTM(MINFO, "wlan: Failed to connect to bssid " MACSTR "\n", MAC2STR(priv->cfg_bssid)); @@ -5224,7 +5358,7 @@ NULL, 0, woal_get_assoc_status(priv), GFP_KERNEL); } - + kfree(ssid_bssid); kfree(assoc_rsp); assoc_rsp = NULL; LEAVE(); @@ -5239,8 +5373,7 @@ * received from firmware * @return N/A */ -static void -woal_print_disconnect_reason(t_u16 reason_code) +static void woal_print_disconnect_reason(t_u16 reason_code) { ENTER(); @@ -5297,9 +5430,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - t_u16 reason_code) +static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, + t_u16 reason_code) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -5324,7 +5456,11 @@ if (priv->media_connected == MFALSE) { PRINTM(MMSG, " Already disconnected\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + if (priv->wdev->connected && +#else if (priv->wdev->current_bss && +#endif (priv->wdev->iftype == NL80211_IFTYPE_STATION || priv->wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { priv->cfg_disconnect = MTRUE; @@ -5354,6 +5490,7 @@ LEAVE(); return -EFAULT; } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) if (priv->wdev->iftype == NL80211_IFTYPE_STATION || priv->wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) @@ -5365,14 +5502,14 @@ #endif memset(priv->cfg_bssid, 0, ETH_ALEN); - if (priv->bss_type == MLAN_BSS_TYPE_STA) - woal_clear_conn_params(priv); + woal_clear_conn_params(priv); priv->channel = 0; LEAVE(); return 0; } +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /** * @brief This function is deauthentication handler when host MLME * enable. @@ -5387,19 +5524,19 @@ * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_deauthenticate(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_deauth_request *req) +static int woal_cfg80211_deauthenticate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_deauth_request *req) { int ret = 0; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) { priv->host_mlme = MFALSE; priv->auth_flag = 0; priv->auth_alg = 0xFFFF; - /*send deauth packet to notify disconnection to wpa_supplicant */ + /*send deauth packet to notify disconnection to wpa_supplicant + */ woal_deauth_event(priv, req->reason_code); } #endif @@ -5410,6 +5547,8 @@ priv->wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) cfg80211_disconnected(priv->netdev, 0, NULL, 0, GFP_KERNEL); #endif + if (priv->media_connected) + woal_send_disconnect_to_system(priv, DEF_DEAUTH_REASON_CODE); return ret; } @@ -5426,19 +5565,19 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_disassociate(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_disassoc_request *req) +static int woal_cfg80211_disassociate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_disassoc_request *req) { int ret = 0; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) { priv->host_mlme = MFALSE; priv->auth_flag = 0; priv->auth_alg = 0xFFFF; - /*send deauth packet to notify disconnection to wpa_supplicant */ + /*send deauth packet to notify disconnection to wpa_supplicant + */ woal_deauth_event(priv, req->reason_code); } #endif @@ -5449,8 +5588,12 @@ priv->wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) cfg80211_disconnected(priv->netdev, 0, NULL, 0, GFP_KERNEL); #endif + if (priv->media_connected) + woal_send_disconnect_to_system(priv, DEF_DEAUTH_REASON_CODE); + return ret; } +#endif /** * @brief Request the driver to get the station information @@ -5462,14 +5605,14 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, +static int woal_cfg80211_get_station(struct wiphy *wiphy, + struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *mac, + const u8 *mac, #else - u8 *mac, + u8 *mac, #endif - struct station_info *sinfo) + struct station_info *sinfo) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -5488,7 +5631,8 @@ return -ENOENT; } - if (MLAN_STATUS_SUCCESS != woal_cfg80211_dump_station_info(priv, sinfo)) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_dump_station_info(priv, sinfo)) { PRINTM(MERROR, "cfg80211: Failed to get station info\n"); ret = -EFAULT; } @@ -5510,10 +5654,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_dump_station(struct wiphy *wiphy, - struct net_device *dev, int idx, - t_u8 *mac, struct station_info *sinfo) +static int woal_cfg80211_dump_station(struct wiphy *wiphy, + struct net_device *dev, int idx, + t_u8 *mac, struct station_info *sinfo) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -5538,7 +5681,8 @@ moal_memcpy_ext(priv->phandle, mac, priv->cfg_bssid, ETH_ALEN, ETH_ALEN); - if (MLAN_STATUS_SUCCESS != woal_cfg80211_dump_station_info(priv, sinfo)) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_dump_station_info(priv, sinfo)) { PRINTM(MERROR, "cfg80211: Failed to get station info\n"); ret = -EFAULT; } @@ -5554,8 +5698,7 @@ * * @return IEEE band type */ -static t_u8 -woal_bandcfg_to_ieee_band(Band_Config_t bandcfg) +static t_u8 woal_bandcfg_to_ieee_band(Band_Config_t bandcfg) { t_u8 ret_radio_type = 0; @@ -5584,10 +5727,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_dump_survey(struct wiphy *wiphy, - struct net_device *dev, int idx, - struct survey_info *survey) +static int woal_cfg80211_dump_survey(struct wiphy *wiphy, + struct net_device *dev, int idx, + struct survey_info *survey) { int ret = -ENOENT; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -5615,15 +5757,13 @@ ret = 0; memset(survey, 0, sizeof(*survey)); band = woal_bandcfg_to_ieee_band(pchan_stats[idx].bandcfg); - survey->channel = - ieee80211_get_channel(wiphy, - ieee80211_channel_to_frequency(pchan_stats - [idx]. - chan_num + survey->channel = ieee80211_get_channel( + wiphy, ieee80211_channel_to_frequency(pchan_stats[idx].chan_num #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - , band + , + band #endif - )); + )); survey->filled = SURVEY_INFO_NOISE_DBM; survey->noise = pchan_stats[idx].noise; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) @@ -5644,17 +5784,33 @@ } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -static int -woal_cfg80211_get_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, - struct cfg80211_chan_def *chandef) +static int woal_cfg80211_get_channel(struct wiphy *wiphy, + struct wireless_dev *wdev, +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + unsigned int link_id, +#endif + struct cfg80211_chan_def *chandef) { moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev); chan_band_info channel; +#ifdef UAP_SUPPORT + moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); +#endif memset(&channel, 0x00, sizeof(channel)); #ifdef UAP_SUPPORT + if (wdev->iftype == NL80211_IFTYPE_MONITOR) { + if ((handle->mon_if) && + (handle->mon_if->mon_ndev == wdev->netdev)) { + *chandef = handle->mon_if->chandef; + return 0; + } + return -EFAULT; + } +#endif + +#ifdef UAP_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { if (priv->bss_started == MTRUE) { if (MLAN_STATUS_SUCCESS != @@ -5670,7 +5826,7 @@ } } else #endif - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { if (priv->media_connected == MTRUE) { if (MLAN_STATUS_SUCCESS != woal_get_sta_channel(priv, MOAL_IOCTL_WAIT, @@ -5706,9 +5862,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, bool enabled, int timeout) +static int woal_cfg80211_set_power_mgmt(struct wiphy *wiphy, + struct net_device *dev, bool enabled, + int timeout) { int ret = 0, disabled; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -5763,12 +5919,11 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_get_tx_power(struct wiphy *wiphy, +static int woal_cfg80211_get_tx_power(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - struct wireless_dev *wdev, + struct wireless_dev *wdev, #endif - int *dbm) + int *dbm) { int ret = 0; moal_private *priv = NULL; @@ -5802,7 +5957,6 @@ LEAVE(); return ret; } - /** * @brief Request the driver to change the transmit power * @@ -5812,17 +5966,16 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_set_tx_power(struct wiphy *wiphy, +static int woal_cfg80211_set_tx_power(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - struct wireless_dev *wdev, + struct wireless_dev *wdev, #endif #if CFG80211_VERSION_CODE < KERNEL_VERSION(2, 6, 36) - enum tx_power_setting type, + enum tx_power_setting type, #else - enum nl80211_tx_power_setting type, + enum nl80211_tx_power_setting type, #endif - int dbm) + int dbm) { int ret = 0; moal_private *priv = NULL; @@ -5862,10 +6015,9 @@ * @param rssi_thold rssi threshold * @param rssi_hyst rssi hysteresis */ -static int -woal_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst) +static int woal_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, + struct net_device *dev, + s32 rssi_thold, u32 rssi_hyst) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); ENTER(); @@ -5895,12 +6047,11 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_remain_on_channel_cfg(moal_private *priv, t_u8 wait_option, - t_u8 remove, t_u8 *status, - struct ieee80211_channel *chan, - enum mlan_channel_type channel_type, - t_u32 duration) +int woal_cfg80211_remain_on_channel_cfg(moal_private *priv, t_u8 wait_option, + t_u8 remove, t_u8 *status, + struct ieee80211_channel *chan, + enum mlan_channel_type channel_type, + t_u32 duration) { mlan_ds_remain_chan chan_cfg; int ret = 0; @@ -5926,10 +6077,8 @@ return -EBUSY; } #endif - if (chan->band == IEEE80211_BAND_2GHZ) - chan_cfg.bandcfg.chanBand = BAND_2GHZ; - else if (chan->band == IEEE80211_BAND_5GHZ) - chan_cfg.bandcfg.chanBand = BAND_5GHZ; + chan_cfg.bandcfg.chanBand = + woal_ieee_band_to_radio_type(chan->band); switch (channel_type) { case CHAN_HT40MINUS: chan_cfg.bandcfg.chan2Offset = SEC_CHAN_BELOW; @@ -5974,9 +6123,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, - struct wireless_dev *wdev, u64 cookie) +static int woal_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, + struct wireless_dev *wdev, + u64 cookie) #else /** * @brief tx mgmt frame @@ -5987,9 +6136,8 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, - struct net_device *dev, u64 cookie) +static int woal_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, + struct net_device *dev, u64 cookie) #endif { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) @@ -6023,23 +6171,15 @@ if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle->chan, + priv->phandle->cookie, &priv->phandle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -6069,7 +6209,7 @@ #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) enum nl80211_channel_type channel_type, #endif - unsigned int duration, u64 * cookie) + unsigned int duration, u64 *cookie) #else /** * @brief Make chip remain on channel @@ -6087,7 +6227,7 @@ woal_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type, - unsigned int duration, u64 * cookie) + unsigned int duration, u64 *cookie) #endif { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) @@ -6156,9 +6296,13 @@ /* remain on channel operation success */ /* we need update the value cookie */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - *cookie = (u64) random32() | 1; + *cookie = (u64)random32() | 1; #else - *cookie = (u64) prandom_u32() | 1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) + *cookie = (u64)prandom_u32() | 1; +#else + *cookie = (u64)get_random_u32() | 1; +#endif #endif priv->phandle->remain_on_channel = MTRUE; priv->phandle->remain_bss_index = priv->bss_index; @@ -6179,15 +6323,15 @@ cfg80211_ready_on_channel( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - dev, + dev, #else - priv->wdev, + priv->wdev, #endif - *cookie, chan, + *cookie, chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - channel_type, + channel_type, #endif - duration, GFP_KERNEL); + duration, GFP_KERNEL); done: LEAVE(); @@ -6204,9 +6348,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, u64 cookie) +static int woal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, + struct wireless_dev *wdev, + u64 cookie) #else /** * @brief Cancel remain on channel @@ -6217,9 +6361,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, - struct net_device *dev, u64 cookie) +static int woal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, + struct net_device *dev, + u64 cookie) #endif { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) @@ -6267,9 +6411,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_sched_scan_request *request) +int woal_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_sched_scan_request *request) { struct ieee80211_channel *chan = NULL; int i = 0; @@ -6295,13 +6438,13 @@ return -EINVAL; } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) - PRINTM(MIOCTL, - "%s sched scan: n_ssids=%d n_match_sets=%d n_channels=%d interval=%d ie_len=%d\n", + PRINTM(MCMND, + "%s sched scan: n_ssids=%d n_match_sets=%d n_channels=%d interval=%d iterations=%d ie_len=%d\n", priv->netdev->name, request->n_ssids, request->n_match_sets, request->n_channels, request->scan_plans[0].interval, - (int)request->ie_len); + request->scan_plans[0].iterations, (int)request->ie_len); #else - PRINTM(MIOCTL, + PRINTM(MCMND, "%s sched scan: n_ssids=%d n_match_sets=%d n_channels=%d interval=%d ie_len=%d\n", priv->netdev->name, request->n_ssids, request->n_match_sets, request->n_channels, request->interval, (int)request->ie_len); @@ -6323,7 +6466,8 @@ i++) { chan = request->channels[i]; priv->scan_cfg.chan_list[i].chan_number = chan->hw_value; - priv->scan_cfg.chan_list[i].radio_type = chan->band; + priv->scan_cfg.chan_list[i].radio_type = + woal_ieee_band_to_radio_type(chan->band); if (chan->flags & (IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_RADAR)) priv->scan_cfg.chan_list[i].scan_type = @@ -6344,58 +6488,67 @@ /** set scan request IES */ if (request->ie && request->ie_len) { if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, - (t_u8 *)request->ie, - request->ie_len, - MGMT_MASK_PROBE_REQ, - MOAL_IOCTL_WAIT)) { + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, + (t_u8 *)request->ie, request->ie_len, + MGMT_MASK_PROBE_REQ, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Fail to set sched scan IE\n"); ret = -EFAULT; goto done; } } else { /** Clear SCAN IE in Firmware */ - if (priv->probereq_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, - NULL, 0, NULL, 0, - MGMT_MASK_PROBE_REQ, - MOAL_IOCTL_WAIT); + if (priv->probereq_index != MLAN_CUSTOM_IE_AUTO_IDX_MASK) { + if (MLAN_STATUS_SUCCESS != + woal_cfg80211_mgmt_frame_ie( + priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_PROBE_REQ, MOAL_IOCTL_WAIT)) { + PRINTM(MERROR, "Fail to clear sched scan IE\n"); + ret = -EFAULT; + goto done; + } + } } /* Interval between scan cycles in milliseconds,supplicant set to 10 * second */ /* We want to use 30 second for per scan cycle */ priv->scan_cfg.scan_interval = MIN_BGSCAN_INTERVAL; + priv->scan_cfg.repeat_count = 0; + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) - if (request->scan_plans[0].interval * 1000 > MIN_BGSCAN_INTERVAL) + /* interval in seconds */ + if (request->scan_plans[0].interval) priv->scan_cfg.scan_interval = request->scan_plans[0].interval * 1000; + priv->scan_cfg.repeat_count = request->scan_plans[0].iterations; if (request->n_scan_plans >= 2) { priv->scan_cfg.config_ees = MTRUE; priv->scan_cfg.ees_mode = MBIT(EES_MODE_HIGH) | MBIT(EES_MODE_MID); + /*High scan interval in milliseconds*/ priv->scan_cfg.high_period = request->scan_plans[0].interval * 1000; priv->scan_cfg.high_period_count = request->scan_plans[0].iterations; + /*Mid scan interval in seconds*/ priv->scan_cfg.mid_period = request->scan_plans[1].interval; - if (request->scan_plans[1].iterations == 0) - priv->scan_cfg.mid_period_count = DEF_REPEAT_COUNT; - else - priv->scan_cfg.mid_period_count = - request->scan_plans[1].iterations; + priv->scan_cfg.mid_period_count = + request->scan_plans[1].iterations; if (request->n_scan_plans == 3) { priv->scan_cfg.ees_mode |= MBIT(EES_MODE_LOW); + /*low scan interval in seconds*/ priv->scan_cfg.low_period = request->scan_plans[2].interval; - priv->scan_cfg.low_period_count = DEF_REPEAT_COUNT; + priv->scan_cfg.low_period_count = + request->scan_plans[2].iterations; } } #else - if (request->interval > MIN_BGSCAN_INTERVAL) + /* interval in miliseconds */ + if (request->interval) priv->scan_cfg.scan_interval = request->interval; #endif - priv->scan_cfg.repeat_count = DEF_REPEAT_COUNT; priv->scan_cfg.report_condition = BG_SCAN_SSID_MATCH | BG_SCAN_WAIT_ALL_CHAN_DONE; priv->scan_cfg.bss_type = MLAN_BSS_MODE_INFRA; @@ -6415,7 +6568,7 @@ for (i = 0; i < ETH_ALEN; i++) { buf[i] &= ~request->mac_addr_mask[i]; buf[i] |= request->mac_addr[i] & - request->mac_addr_mask[i]; + request->mac_addr_mask[i]; } moal_memcpy_ext(priv->phandle, priv->scan_cfg.random_mac, buf, ETH_ALEN, sizeof(priv->scan_cfg.random_mac)); @@ -6451,12 +6604,12 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev +int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - , u64 reqid + , + u64 reqid #endif - ) +) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); ENTER(); @@ -6478,8 +6631,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_resume(struct wiphy *wiphy) +int woal_cfg80211_resume(struct wiphy *wiphy) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); @@ -6499,13 +6651,16 @@ for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM); i++) { if (handle->priv[i] && (GET_BSS_ROLE(handle->priv[i]) == MLAN_BSS_ROLE_STA)) { - if (handle->priv[i]->last_event & EVENT_BG_SCAN_REPORT) { + if (handle->priv[i]->last_event & + EVENT_BG_SCAN_REPORT) { if (handle->priv[i]->sched_scanning) { - woal_inform_bss_from_scan_result - (handle->priv[i], NULL, - MOAL_IOCTL_WAIT); - woal_report_sched_scan_result(handle-> - priv[i]); + woal_inform_bss_from_scan_result( + handle->priv[i], NULL, + MOAL_IOCTL_WAIT); +#if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE + woal_report_sched_scan_result( + handle->priv[i]); +#endif handle->priv[i]->last_event = 0; PRINTM(MCMND, "Report sched scan result in cfg80211 resume\n"); @@ -6516,24 +6671,31 @@ MTRUE; #ifdef ANDROID_KERNEL #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) - __pm_wakeup_event(&handle->ws, - ROAMING_WAKE_LOCK_TIMEOUT); + __pm_wakeup_event( + &handle->ws, + ROAMING_WAKE_LOCK_TIMEOUT); #else - wake_lock_timeout(&handle->wake_lock, - msecs_to_jiffies - (ROAMING_WAKE_LOCK_TIMEOUT)); + wake_lock_timeout( + &handle->wake_lock, + msecs_to_jiffies( + ROAMING_WAKE_LOCK_TIMEOUT)); #endif #endif - wake_up_interruptible(&handle-> - reassoc_thread. - wait_q); +#ifdef REASSOCIATION + wake_up_interruptible( + &handle->reassoc_thread.wait_q); +#endif } } } } - woal_get_wakeup_reason(priv, &wakeup_reason); - + memset((t_u8 *)&wakeup_reason, 0, sizeof(wakeup_reason)); + if (MLAN_STATUS_SUCCESS != + woal_get_wakeup_reason(priv, &wakeup_reason)) { + PRINTM(MERROR, "%s: get_wakeup_reason failed \n", __func__); + goto done; + } #ifdef STA_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (IS_STA_CFG80211(priv->phandle->params.cfg80211_wext)) @@ -6590,6 +6752,8 @@ done: handle->cfg80211_suspend = MFALSE; + queue_work(handle->rx_workqueue, &handle->rx_work); + PRINTM(MCMND, "<--- Leave woal_cfg80211_resume --->\n"); return 0; } @@ -6603,15 +6767,14 @@ * * @return 1 -- support, 0 -- not support */ -static t_bool -is_wowlan_pattern_supported(moal_private *priv, +static t_bool is_wowlan_pattern_supported(moal_private *priv, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - struct cfg80211_pkt_pattern *pat, + struct cfg80211_pkt_pattern *pat, #else - struct cfg80211_wowlan_trig_pkt_pattern - *pat, + struct cfg80211_wowlan_trig_pkt_pattern + *pat, #endif - s8 * byte_seq) + s8 *byte_seq) { int j, k, valid_byte_cnt = 0; t_bool dont_care_byte = MFALSE; @@ -6648,8 +6811,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) +int woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); int i; @@ -6662,8 +6824,8 @@ t_bool first_pat = MTRUE; #endif t_u8 byte_seq[MAX_NUM_BYTE_SEQ + 1]; - const t_u8 ipv4_mc_mac[] = { 0x33, 0x33 }; - const t_u8 ipv6_mc_mac[] = { 0x01, 0x00, 0x5e }; + const t_u8 ipv4_mc_mac[] = {0x33, 0x33}; + const t_u8 ipv6_mc_mac[] = {0x01, 0x00, 0x5e}; moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_STA); mlan_ds_hs_cfg hscfg; @@ -6725,6 +6887,7 @@ ret = -EOPNOTSUPP; goto done; } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) if (!wow->patterns[i].pkt_offset) { #endif @@ -6751,11 +6914,11 @@ mef_entry->filter_item[filt_num].repeat = 1; mef_entry->filter_item[filt_num].offset = wow->patterns[i].pkt_offset; - moal_memcpy_ext(priv->phandle, - mef_entry->filter_item[filt_num].byte_seq, - byte_seq, MAX_NUM_BYTE_SEQ, - sizeof(mef_entry->filter_item[filt_num]. - byte_seq)); + moal_memcpy_ext( + priv->phandle, + mef_entry->filter_item[filt_num].byte_seq, byte_seq, + MAX_NUM_BYTE_SEQ, + sizeof(mef_entry->filter_item[filt_num].byte_seq)); mef_entry->filter_item[filt_num].num_byte_seq = byte_seq[MAX_NUM_BYTE_SEQ]; mef_entry->filter_item[filt_num].type = TYPE_BYTE_EQ; @@ -6771,16 +6934,16 @@ if (wow->magic_pkt) { mef_cfg.criteria |= CRITERIA_UNICAST | CRITERIA_BROADCAST | - CRITERIA_MULTICAST; + CRITERIA_MULTICAST; mef_entry->filter_item[filt_num].fill_flag = (FILLING_TYPE | FILLING_REPEAT | FILLING_BYTE_SEQ | FILLING_OFFSET); mef_entry->filter_item[filt_num].repeat = 16; - moal_memcpy_ext(priv->phandle, - mef_entry->filter_item[filt_num].byte_seq, - priv->current_addr, ETH_ALEN, - sizeof(mef_entry->filter_item[filt_num]. - byte_seq)); + moal_memcpy_ext( + priv->phandle, + mef_entry->filter_item[filt_num].byte_seq, + priv->current_addr, ETH_ALEN, + sizeof(mef_entry->filter_item[filt_num].byte_seq)); mef_entry->filter_item[filt_num].num_byte_seq = ETH_ALEN; mef_entry->filter_item[filt_num].offset = 56; mef_entry->filter_item[filt_num].type = TYPE_BYTE_EQ; @@ -6791,11 +6954,11 @@ (FILLING_TYPE | FILLING_REPEAT | FILLING_BYTE_SEQ | FILLING_OFFSET); mef_entry->filter_item[filt_num].repeat = 16; - moal_memcpy_ext(priv->phandle, - mef_entry->filter_item[filt_num].byte_seq, - priv->current_addr, ETH_ALEN, - sizeof(mef_entry->filter_item[filt_num]. - byte_seq)); + moal_memcpy_ext( + priv->phandle, + mef_entry->filter_item[filt_num].byte_seq, + priv->current_addr, ETH_ALEN, + sizeof(mef_entry->filter_item[filt_num].byte_seq)); mef_entry->filter_item[filt_num].num_byte_seq = ETH_ALEN; mef_entry->filter_item[filt_num].offset = 28; mef_entry->filter_item[filt_num].type = TYPE_BYTE_EQ; @@ -6808,7 +6971,7 @@ if (!mef_cfg.criteria) mef_cfg.criteria = CRITERIA_BROADCAST | CRITERIA_UNICAST | - CRITERIA_MULTICAST; + CRITERIA_MULTICAST; status = woal_set_get_wowlan_config(priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, &mef_cfg); @@ -6848,8 +7011,7 @@ #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) -static void -woal_cfg80211_set_wakeup(struct wiphy *wiphy, bool enabled) +static void woal_cfg80211_set_wakeup(struct wiphy *wiphy, bool enabled) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); @@ -6866,8 +7028,7 @@ * @apram action action for TDLS * @return 0 --success, otherwise fail */ -static int -woal_tdls_oper(moal_private *priv, u8 *peer, t_u8 action) +static int woal_tdls_oper(moal_private *priv, u8 *peer, t_u8 action) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -6910,9 +7071,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_tdls_get_ies(moal_private *priv, u8 *peer, - mlan_ds_misc_tdls_ies *tdls_ies, t_u16 flags) +static int woal_tdls_get_ies(moal_private *priv, u8 *peer, + mlan_ds_misc_tdls_ies *tdls_ies, t_u16 flags) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_misc_cfg *misc = NULL; @@ -6956,9 +7116,8 @@ * * @return N/A */ -static void -woal_tdls_add_ext_capab(moal_private *priv, struct sk_buff *skb, - mlan_ds_misc_tdls_ies *tdls_ies) +static void woal_tdls_add_ext_capab(moal_private *priv, struct sk_buff *skb, + mlan_ds_misc_tdls_ies *tdls_ies) { u8 *pos = NULL; if (tdls_ies->ext_cap[0] == WLAN_EID_EXT_CAPABILITY) { @@ -6980,14 +7139,12 @@ * * @return N/A */ -static void -woal_add_supported_rates_ie(moal_private *priv, struct sk_buff *skb, - enum ieee80211_band band) +static void woal_add_supported_rates_ie(moal_private *priv, struct sk_buff *skb, + enum ieee80211_band band) { - t_u8 basic_rates[] = { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24 }; - t_u8 basic_rates_5G[] = { 0x0c, 0x12, 0x18, 0x24, - 0x30, 0x48, 0x60, 0x6c - }; + t_u8 basic_rates[] = {0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24}; + t_u8 basic_rates_5G[] = {0x0c, 0x12, 0x18, 0x24, + 0x30, 0x48, 0x60, 0x6c}; t_u8 *pos; t_u8 rate_num = 0; if (band == IEEE80211_BAND_2GHZ) @@ -7019,11 +7176,11 @@ * * @return N/A */ -static void -woal_add_ext_supported_rates_ie(moal_private *priv, - struct sk_buff *skb, enum ieee80211_band band) +static void woal_add_ext_supported_rates_ie(moal_private *priv, + struct sk_buff *skb, + enum ieee80211_band band) { - t_u8 ext_rates[] = { 0x0c, 0x12, 0x18, 0x60 }; + t_u8 ext_rates[] = {0x0c, 0x12, 0x18, 0x60}; t_u8 *pos; t_u8 rate_num = sizeof(ext_rates); @@ -7050,16 +7207,15 @@ * * @return N/A */ -static void -woal_add_wmm_ie(moal_private *priv, struct sk_buff *skb, - t_u8 wmm_type, t_u8 *pQosInfo) +static void woal_add_wmm_ie(moal_private *priv, struct sk_buff *skb, + t_u8 wmm_type, t_u8 *pQosInfo) { - t_u8 wmmInfoElement[] = { 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01 }; - t_u8 wmmParamElement[] = { 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01 }; - t_u8 ac_vi[] = { 0x42, 0x43, 0x5e, 0x00 }; - t_u8 ac_vo[] = { 0x62, 0x32, 0x2f, 0x00 }; - t_u8 ac_be[] = { 0x03, 0xa4, 0x00, 0x00 }; - t_u8 ac_bk[] = { 0x27, 0xa4, 0x00, 0x00 }; + t_u8 wmmInfoElement[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; + t_u8 wmmParamElement[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; + t_u8 ac_vi[] = {0x42, 0x43, 0x5e, 0x00}; + t_u8 ac_vo[] = {0x62, 0x32, 0x2f, 0x00}; + t_u8 ac_be[] = {0x03, 0xa4, 0x00, 0x00}; + t_u8 ac_bk[] = {0x27, 0xa4, 0x00, 0x00}; t_u8 qosInfo = 0x0; t_u8 reserved = 0; t_u8 wmm_id = 221; @@ -7069,7 +7225,7 @@ t_u8 *pos; qosInfo = (pQosInfo == NULL) ? 0xf : (*pQosInfo); - /*wmm parameter */ + /*wmm parameter*/ if (wmm_type == WMM_TYPE_PARAMETER) { if (skb_tailroom(skb) < (wmmParamIe_len + 2)) return; @@ -7084,7 +7240,7 @@ *pos++ = wmm_id; *pos++ = len; - /*wmm parameter */ + /*wmm parameter*/ if (wmm_type == WMM_TYPE_PARAMETER) { moal_memcpy_ext(priv->phandle, pos, wmmParamElement, sizeof(wmmParamElement), @@ -7096,7 +7252,7 @@ pos += sizeof(wmmInfoElement); } *pos++ = qosInfo; - /*wmm parameter */ + /*wmm parameter*/ if (wmm_type == WMM_TYPE_PARAMETER) { *pos++ = reserved; moal_memcpy_ext(priv->phandle, pos, ac_be, sizeof(ac_be), @@ -7123,15 +7279,14 @@ * * @return N/A */ -static t_void -woal_updata_peer_status(moal_private *priv, t_u8 *peer_addr, - tdlsStatus_e link_status) +static t_void woal_updata_peer_status(moal_private *priv, t_u8 *peer_addr, + tdlsStatus_e link_status) { struct tdls_peer *peer = NULL; unsigned long flags; if (priv && priv->enable_auto_tdls) { spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry(peer, &priv->tdls_list, link) { + list_for_each_entry (peer, &priv->tdls_list, link) { if (!memcmp(peer->peer_addr, peer_addr, ETH_ALEN)) { if ((link_status == TDLS_NOT_SETUP) && (peer->link_status == @@ -7155,15 +7310,14 @@ * * @return N/A */ -static t_void -woal_add_tdls_peer(moal_private *priv, t_u8 *peer) +static t_void woal_add_tdls_peer(moal_private *priv, t_u8 *peer) { struct tdls_peer *tdls_peer = NULL; unsigned long flags; t_u8 find_peer = MFALSE; if (priv && priv->enable_auto_tdls) { spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry(tdls_peer, &priv->tdls_list, link) { + list_for_each_entry (tdls_peer, &priv->tdls_list, link) { if (!memcmp(tdls_peer->peer_addr, peer, ETH_ALEN)) { tdls_peer->link_status = TDLS_SETUP_INPROGRESS; tdls_peer->rssi_jiffies = jiffies; @@ -7202,10 +7356,9 @@ * * @return N/A */ -void -woal_check_auto_tdls(struct wiphy *wiphy, struct net_device *dev) +void woal_check_auto_tdls(struct wiphy *wiphy, struct net_device *dev) { - t_u8 bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; struct tdls_peer *tdls_peer = NULL; unsigned long flags; t_u8 tdls_discovery = MFALSE; @@ -7215,7 +7368,7 @@ if (priv && priv->enable_auto_tdls) { priv->tdls_check_tx = MFALSE; spin_lock_irqsave(&priv->tdls_lock, flags); - list_for_each_entry(tdls_peer, &priv->tdls_list, link) { + list_for_each_entry (tdls_peer, &priv->tdls_list, link) { if ((jiffies - tdls_peer->rssi_jiffies) > TDLS_IDLE_TIME) { tdls_peer->rssi = 0; @@ -7230,16 +7383,15 @@ TDLS_SETUP_COMPLETE) { tdls_peer->link_status = TDLS_TEAR_DOWN; PRINTM(MMSG, - "Wlan: Tear down TDLS link, peer=" - MACSTR " rssi=%d\n", + "Wlan: Tear down TDLS link, peer=" MACSTR + " rssi=%d\n", MAC2STR(tdls_peer->peer_addr), -tdls_peer->rssi); - cfg80211_tdls_oper_request(dev, - tdls_peer-> - peer_addr, - NL80211_TDLS_TEARDOWN, - TDLS_TEARN_DOWN_REASON_UNSPECIFIC, - GFP_ATOMIC); + cfg80211_tdls_oper_request( + dev, tdls_peer->peer_addr, + NL80211_TDLS_TEARDOWN, + TDLS_TEARN_DOWN_REASON_UNSPECIFIC, + GFP_ATOMIC); } } else if (tdls_peer->rssi && (tdls_peer->rssi <= @@ -7290,10 +7442,10 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_construct_tdls_data_frame(moal_private *priv, t_u8 *peer, - t_u8 action_code, t_u8 dialog_token, - t_u16 status_code, struct sk_buff *skb) +static int woal_construct_tdls_data_frame(moal_private *priv, t_u8 *peer, + t_u8 action_code, t_u8 dialog_token, + t_u16 status_code, + struct sk_buff *skb) { struct ieee80211_tdls_data *tdata; t_u16 capability; @@ -7303,12 +7455,17 @@ IEEEtypes_VHTCap_t *VHTcap; IEEEtypes_VHTOprat_t *vht_oprat; IEEEtypes_AID_t *AidInfo; + IEEEtypes_Header_t *ieee_hdr; + t_u8 *skb_data; + t_u8 len = 0; IEEEtypes_Generic_t *pSupp_chan = NULL, *pRegulatory_class = NULL; mlan_ds_misc_tdls_ies *tdls_ies = NULL; int ret = 0; mlan_bss_info bss_info; enum ieee80211_band band; mlan_fw_info fw_info; + t_u16 setup_flag = 0; + t_u16 confirm_flag = 0; ENTER(); @@ -7339,23 +7496,32 @@ tdata->payload_type = WLAN_TDLS_SNAP_RFTYPE; woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + setup_flag = TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTCAP | + TDLS_IE_FLAGS_SUPP_CS_IE; + confirm_flag = TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTINFO | + TDLS_IE_FLAGS_QOS_INFO; + if (fw_info.fw_bands & BAND_AAC) { + setup_flag |= (TDLS_IE_FLAGS_VHTCAP | TDLS_IE_FLAGS_AID); + confirm_flag |= TDLS_IE_FLAGS_VHTOPRAT; + } + if (fw_info.fw_bands & BAND_AAX) { + setup_flag |= (TDLS_IE_FLAGS_VHTCAP | TDLS_IE_FLAGS_AID | + TDLS_IE_FLAGS_HECAP); + confirm_flag |= (TDLS_IE_FLAGS_VHTOPRAT | TDLS_IE_FLAGS_HEOP); + } + if (fw_info.fw_bands & BAND_GAX) { + setup_flag |= TDLS_IE_FLAGS_HECAP; + confirm_flag |= TDLS_IE_FLAGS_HEOP; + } switch (action_code) { case WLAN_TDLS_SETUP_REQUEST: - if (fw_info.fw_bands & BAND_AAC) - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_SETUP | - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTCAP | - TDLS_IE_FLAGS_VHTCAP | - TDLS_IE_FLAGS_AID | - TDLS_IE_FLAGS_SUPP_CS_IE); - else - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_SETUP | - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTCAP | - TDLS_IE_FLAGS_SUPP_CS_IE); - + setup_flag |= TDLS_IE_FLAGS_SETUP; + if (woal_tdls_get_ies(priv, peer, tdls_ies, setup_flag)) { + PRINTM(MERROR, "%s: woal_tdls_get_ies failed \n", + __func__); + ret = -EFAULT; + goto done; + } tdata->category = WLAN_CATEGORY_TDLS; tdata->action_code = WLAN_TDLS_SETUP_REQUEST; skb_put(skb, sizeof(tdata->u.setup_req)); @@ -7365,19 +7531,12 @@ woal_add_ext_supported_rates_ie(priv, skb, band); break; case WLAN_TDLS_SETUP_RESPONSE: - if (fw_info.fw_bands & BAND_AAC) - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTCAP | - TDLS_IE_FLAGS_VHTCAP | - TDLS_IE_FLAGS_AID | - TDLS_IE_FLAGS_SUPP_CS_IE); - else - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTCAP | - TDLS_IE_FLAGS_SUPP_CS_IE); - + if (woal_tdls_get_ies(priv, peer, tdls_ies, setup_flag)) { + PRINTM(MERROR, "%s: woal_tdls_get_ies failed \n", + __func__); + ret = -EFAULT; + goto done; + } tdata->category = WLAN_CATEGORY_TDLS; tdata->action_code = WLAN_TDLS_SETUP_RESPONSE; @@ -7390,18 +7549,12 @@ woal_add_ext_supported_rates_ie(priv, skb, band); break; case WLAN_TDLS_SETUP_CONFIRM: - if (fw_info.fw_bands & BAND_AAC) - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTINFO | - TDLS_IE_FLAGS_VHTOPRAT | - TDLS_IE_FLAGS_QOS_INFO); - else - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_HTINFO | - TDLS_IE_FLAGS_QOS_INFO); - + if (woal_tdls_get_ies(priv, peer, tdls_ies, confirm_flag)) { + PRINTM(MERROR, "%s: woal_tdls_get_ies failed \n", + __func__); + ret = -EFAULT; + goto done; + } tdata->category = WLAN_CATEGORY_TDLS; tdata->action_code = WLAN_TDLS_SETUP_CONFIRM; @@ -7431,37 +7584,35 @@ if (action_code == WLAN_TDLS_SETUP_REQUEST || action_code == WLAN_TDLS_SETUP_RESPONSE) { - /* supported chanel ie */ + /* supported chanel ie*/ if (tdls_ies->supp_chan[0] == SUPPORTED_CHANNELS) { - pSupp_chan = - (void *)skb_put(skb, - sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + pSupp_chan = (void *)skb_put( + skb, sizeof(IEEEtypes_Header_t) + + tdls_ies->supp_chan[1]); memset(pSupp_chan, 0, sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + tdls_ies->supp_chan[1]); moal_memcpy_ext(priv->phandle, pSupp_chan, tdls_ies->supp_chan, sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1], + tdls_ies->supp_chan[1], sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + tdls_ies->supp_chan[1]); } - /* supported regulatory class ie */ + /* supported regulatory class ie*/ if (tdls_ies->regulatory_class[0] == REGULATORY_CLASS) { - pRegulatory_class = - (void *)skb_put(skb, - sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + pRegulatory_class = (void *)skb_put( + skb, sizeof(IEEEtypes_Header_t) + + tdls_ies->regulatory_class[1]); memset(pRegulatory_class, 0, sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + tdls_ies->regulatory_class[1]); moal_memcpy_ext(priv->phandle, pRegulatory_class, tdls_ies->regulatory_class, sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1], + tdls_ies->regulatory_class[1], sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + tdls_ies->regulatory_class[1]); } woal_tdls_add_ext_capab(priv, skb, tdls_ies); } @@ -7470,7 +7621,7 @@ switch (action_code) { case WLAN_TDLS_SETUP_REQUEST: case WLAN_TDLS_SETUP_RESPONSE: - /*HT capability */ + /*HT capability*/ if (tdls_ies->ht_cap[0] == HT_CAPABILITY) { HTcap = (void *)skb_put(skb, sizeof(IEEEtypes_HTCap_t)); memset(HTcap, 0, sizeof(IEEEtypes_HTCap_t)); @@ -7481,12 +7632,12 @@ PRINTM(MIOCTL, "No TDLS HT capability\n"); } - /*20_40_bss_coexist */ + /*20_40_bss_coexist*/ BSSCo = (void *)skb_put(skb, sizeof(IEEEtypes_2040BSSCo_t)); memset(BSSCo, 0, sizeof(IEEEtypes_2040BSSCo_t)); BSSCo->ieee_hdr.element_id = BSSCO_2040; BSSCo->ieee_hdr.len = sizeof(IEEEtypes_2040BSSCo_t) - - sizeof(IEEEtypes_Header_t); + sizeof(IEEEtypes_Header_t); BSSCo->bss_co_2040.bss_co_2040_value = 0x01; /* VHT capability */ @@ -7512,9 +7663,20 @@ } else { PRINTM(MIOCTL, "No TDLS AID info\n"); } + /* HE capability */ + if (tdls_ies->he_cap[2] == HE_CAPABILITY) { + ieee_hdr = (IEEEtypes_Header_t *)tdls_ies->he_cap; + len = sizeof(IEEEtypes_Header_t) + ieee_hdr->len; + skb_data = (void *)skb_put(skb, len); + memset(skb_data, 0, len); + moal_memcpy_ext(priv->phandle, skb_data, + tdls_ies->he_cap, len, len); + } else { + PRINTM(MIOCTL, "NO TDLS HE Capability IE\n"); + } break; case WLAN_TDLS_SETUP_CONFIRM: - /*HT information */ + /*HT information*/ if (tdls_ies->ht_info[0] == HT_OPERATION) { HTInfo = (void *)skb_put(skb, sizeof(IEEEtypes_HTInfo_t)); @@ -7527,9 +7689,8 @@ PRINTM(MIOCTL, "No TDLS HT information\n"); /** VHT operation */ if (tdls_ies->vht_oprat[0] == VHT_OPERATION) { - vht_oprat = - (void *)skb_put(skb, - sizeof(IEEEtypes_VHTOprat_t)); + vht_oprat = (void *)skb_put( + skb, sizeof(IEEEtypes_VHTOprat_t)); memset(vht_oprat, 0, sizeof(IEEEtypes_VHTOprat_t)); moal_memcpy_ext(priv->phandle, vht_oprat, tdls_ies->vht_oprat, @@ -7537,6 +7698,16 @@ sizeof(IEEEtypes_VHTOprat_t)); } else PRINTM(MIOCTL, "NO TDLS VHT Operation IE\n"); + /** HE operation */ + if (tdls_ies->he_op[2] == HE_OPERATION) { + ieee_hdr = (IEEEtypes_Header_t *)tdls_ies->he_op; + len = sizeof(IEEEtypes_Header_t) + ieee_hdr->len; + skb_data = (void *)skb_put(skb, len); + memset(skb_data, 0, len); + moal_memcpy_ext(priv->phandle, skb_data, + tdls_ies->he_op, len, len); + } else + PRINTM(MIOCTL, "NO TDLS HE Operation IE\n"); break; default: break; @@ -7544,10 +7715,10 @@ if (action_code == WLAN_TDLS_SETUP_REQUEST || action_code == WLAN_TDLS_SETUP_RESPONSE) { - /*wmm info */ + /*wmm info*/ woal_add_wmm_ie(priv, skb, WMM_TYPE_INFO, NULL); } else if (action_code == WLAN_TDLS_SETUP_CONFIRM) { - /*wmm parameter */ + /*wmm parameter*/ woal_add_wmm_ie(priv, skb, WMM_TYPE_PARAMETER, &tdls_ies->QosInfo); } @@ -7569,13 +7740,13 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_construct_tdls_action_frame(moal_private *priv, t_u8 *peer, - t_u8 action_code, t_u8 dialog_token, - t_u16 status_code, struct sk_buff *skb) +static int woal_construct_tdls_action_frame(moal_private *priv, t_u8 *peer, + t_u8 action_code, t_u8 dialog_token, + t_u16 status_code, + struct sk_buff *skb) { struct ieee80211_mgmt *mgmt; - t_u8 addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; t_u16 capability; t_u8 *pos = NULL; mlan_ds_misc_tdls_ies *tdls_ies = NULL; @@ -7614,16 +7785,23 @@ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); - /* add address 4 */ + /* add address 4*/ pos = skb_put(skb, ETH_ALEN); capability = 0x2421; switch (action_code) { case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: - woal_tdls_get_ies(priv, peer, tdls_ies, - TDLS_IE_FLAGS_EXTCAP | - TDLS_IE_FLAGS_SUPP_CS_IE); + if (woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_EXTCAP | + TDLS_IE_FLAGS_SUPP_CS_IE)) { + PRINTM(MERROR, "%s: woal_tdls_get_ies failed \n", + __func__); + if (tdls_ies) + kfree(tdls_ies); + LEAVE(); + return -EFAULT; + } skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; mgmt->u.action.u.tdls_discover_resp.action_code = @@ -7640,37 +7818,35 @@ woal_add_supported_rates_ie(priv, skb, band); woal_add_ext_supported_rates_ie(priv, skb, band); woal_tdls_add_ext_capab(priv, skb, tdls_ies); - /* supported chanel ie */ + /* supported chanel ie*/ if (tdls_ies->supp_chan[0] == SUPPORTED_CHANNELS) { - pSupp_chan = - (void *)skb_put(skb, - sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + pSupp_chan = (void *)skb_put( + skb, sizeof(IEEEtypes_Header_t) + + tdls_ies->supp_chan[1]); memset(pSupp_chan, 0, sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + tdls_ies->supp_chan[1]); moal_memcpy_ext(priv->phandle, pSupp_chan, tdls_ies->supp_chan, sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1], + tdls_ies->supp_chan[1], sizeof(IEEEtypes_Header_t) + - tdls_ies->supp_chan[1]); + tdls_ies->supp_chan[1]); } - /* supported regulatory class ie */ + /* supported regulatory class ie*/ if (tdls_ies->regulatory_class[0] == REGULATORY_CLASS) { - pRegulatory_class = - (void *)skb_put(skb, - sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + pRegulatory_class = (void *)skb_put( + skb, sizeof(IEEEtypes_Header_t) + + tdls_ies->regulatory_class[1]); memset(pRegulatory_class, 0, sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + tdls_ies->regulatory_class[1]); moal_memcpy_ext(priv->phandle, pRegulatory_class, tdls_ies->regulatory_class, sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1], + tdls_ies->regulatory_class[1], sizeof(IEEEtypes_Header_t) + - tdls_ies->regulatory_class[1]); + tdls_ies->regulatory_class[1]); } break; @@ -7693,9 +7869,8 @@ * * @return NA */ -static void -woal_tdls_add_link_ie(moal_private *priv, struct sk_buff *skb, - u8 *src_addr, u8 *peer, u8 *bssid) +static void woal_tdls_add_link_ie(moal_private *priv, struct sk_buff *skb, + u8 *src_addr, u8 *peer, u8 *bssid) { struct ieee80211_tdls_lnkie *lnkid; @@ -7727,12 +7902,11 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_send_tdls_action_frame(struct wiphy *wiphy, - struct net_device *dev, t_u8 *peer, - u8 action_code, t_u8 dialog_token, - t_u16 status_code, const t_u8 *extra_ies, - size_t extra_ies_len) +static int woal_send_tdls_action_frame(struct wiphy *wiphy, + struct net_device *dev, t_u8 *peer, + u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 *extra_ies, + size_t extra_ies_len) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); pmlan_buffer pmbuf = NULL; @@ -7746,12 +7920,16 @@ ENTER(); -#define HEADER_SIZE 8 /* pkt_type + tx_control */ +#define HEADER_SIZE 8 /* pkt_type + tx_control */ - pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + sizeof(pkt_len) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported rates */ - sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ - extra_ies_len + - sizeof(IEEEtypes_tdls_linkie)); + pmbuf = woal_alloc_mlan_buffer( + priv->phandle, + MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + sizeof(pkt_len) + + max(sizeof(struct ieee80211_mgmt), + sizeof(struct ieee80211_tdls_data)) + + 50 + /* supported rates */ + sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ + extra_ies_len + sizeof(IEEEtypes_tdls_linkie)); if (!pmbuf) { PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); ret = -ENOMEM; @@ -7841,12 +8019,11 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_send_tdls_data_frame(struct wiphy *wiphy, - struct net_device *dev, t_u8 *peer, - u8 action_code, t_u8 dialog_token, - t_u16 status_code, const t_u8 *extra_ies, - size_t extra_ies_len) +static int woal_send_tdls_data_frame(struct wiphy *wiphy, + struct net_device *dev, t_u8 *peer, + u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 *extra_ies, + size_t extra_ies_len) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); pmlan_buffer pmbuf = NULL; @@ -7859,22 +8036,25 @@ ENTER(); - skb = dev_alloc_skb(priv->extra_tx_head_len + MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported rates */ - sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ - 3 + /* Qos Info */ - sizeof(IEEEtypes_WmmParameter_t) + /*wmm ie */ - sizeof(IEEEtypes_HTCap_t) + - sizeof(IEEEtypes_2040BSSCo_t) + - sizeof(IEEEtypes_HTInfo_t) + - sizeof(IEEEtypes_VHTCap_t) + - sizeof(IEEEtypes_VHTOprat_t) + - sizeof(IEEEtypes_AID_t) + extra_ies_len + - sizeof(IEEEtypes_tdls_linkie)); + skb = dev_alloc_skb( + priv->extra_tx_head_len + MLAN_MIN_DATA_HEADER_LEN + + sizeof(mlan_buffer) + + max(sizeof(struct ieee80211_mgmt), + sizeof(struct ieee80211_tdls_data)) + + 50 + /* supported rates */ + sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ + 3 + /* Qos Info */ + sizeof(IEEEtypes_WmmParameter_t) + /*wmm ie*/ + sizeof(IEEEtypes_HTCap_t) + sizeof(IEEEtypes_2040BSSCo_t) + + sizeof(IEEEtypes_HTInfo_t) + sizeof(IEEEtypes_VHTCap_t) + + sizeof(IEEEtypes_VHTOprat_t) + sizeof(IEEEtypes_AID_t) + + sizeof(IEEEtypes_HECap_t) + sizeof(IEEEtypes_HeOp_t) + + extra_ies_len + sizeof(IEEEtypes_tdls_linkie)); if (!skb) return -ENOMEM; skb_reserve(skb, MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + - priv->extra_tx_head_len); + priv->extra_tx_head_len); woal_construct_tdls_data_frame(priv, peer, action_code, dialog_token, status_code, skb); @@ -7933,13 +8113,15 @@ DBG_HEXDUMP(MDAT_D, "TDLS data:", pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len); +#if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + index = skb_get_queue_mapping(skb); +#endif status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); #if CFG80211_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - index = skb_get_queue_mapping(skb); atomic_inc(&priv->wmm_tx_pending[index]); #endif queue_work(priv->phandle->workqueue, &priv->phandle->main_work); @@ -7986,12 +8168,11 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, - const t_u8 *peer, u8 action_code, t_u8 dialog_token, - t_u16 status_code, t_u32 peer_capability, - bool initiator, const t_u8 *extra_ies, - size_t extra_ies_len) +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + const t_u8 *peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, t_u32 peer_capability, + bool initiator, const t_u8 *extra_ies, + size_t extra_ies_len) #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) /** @@ -8009,16 +8190,15 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const t_u8 *peer, + const t_u8 *peer, #else - t_u8 *peer, + t_u8 *peer, #endif - u8 action_code, t_u8 dialog_token, - t_u16 status_code, t_u32 peer_capability, - const t_u8 *extra_ies, size_t extra_ies_len) + u8 action_code, t_u8 dialog_token, + t_u16 status_code, t_u32 peer_capability, + const t_u8 *extra_ies, size_t extra_ies_len) #else /** * @brief Tx TDLS packet @@ -8034,11 +8214,10 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, - t_u8 *peer, u8 action_code, t_u8 dialog_token, - t_u16 status_code, const t_u8 *extra_ies, - size_t extra_ies_len) +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + t_u8 *peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 *extra_ies, + size_t extra_ies_len) #endif #endif { @@ -8072,7 +8251,8 @@ woal_add_tdls_peer(priv, (t_u8 *)peer); PRINTM(MMSG, "wlan: Send TDLS Setup Request to " MACSTR - " status_code=%d\n", MAC2STR(peer), status_code); + " status_code=%d\n", + MAC2STR(peer), status_code); ret = woal_send_tdls_data_frame(wiphy, dev, (t_u8 *)peer, action_code, dialog_token, status_code, extra_ies, @@ -8081,7 +8261,8 @@ case TDLS_SETUP_RESPONSE: PRINTM(MMSG, "wlan: Send TDLS Setup Response to " MACSTR - " status_code=%d\n", MAC2STR(peer), status_code); + " status_code=%d\n", + MAC2STR(peer), status_code); ret = woal_send_tdls_data_frame(wiphy, dev, (t_u8 *)peer, action_code, dialog_token, status_code, extra_ies, @@ -8140,14 +8321,13 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, +int woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *peer, + const u8 *peer, #else - u8 *peer, + u8 *peer, #endif - enum nl80211_tdls_operation oper) + enum nl80211_tdls_operation oper) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); t_u8 action; @@ -8170,7 +8350,7 @@ oper); switch (oper) { case NL80211_TDLS_ENABLE_LINK: - /*Configure TDLS link first */ + /*Configure TDLS link first*/ woal_tdls_oper(priv, (u8 *)peer, WLAN_TDLS_CONFIG_LINK); woal_updata_peer_status(priv, (t_u8 *)peer, TDLS_SETUP_COMPLETE); @@ -8225,11 +8405,10 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_tdls_channel_switch(struct wiphy *wiphy, - struct net_device *dev, - const u8 *addr, u8 oper_class, - struct cfg80211_chan_def *chandef) +static int woal_cfg80211_tdls_channel_switch(struct wiphy *wiphy, + struct net_device *dev, + const u8 *addr, u8 oper_class, + struct cfg80211_chan_def *chandef) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -8297,9 +8476,9 @@ * @param addr A pointer to peer addr * */ -void -woal_cfg80211_tdls_cancel_channel_switch(struct wiphy *wiphy, - struct net_device *dev, const u8 *addr) +void woal_cfg80211_tdls_cancel_channel_switch(struct wiphy *wiphy, + struct net_device *dev, + const u8 *addr) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -8355,14 +8534,14 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, +static int woal_cfg80211_change_station(struct wiphy *wiphy, + struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *mac, + const u8 *mac, #else - u8 *mac, + u8 *mac, #endif - struct station_parameters *params) + struct station_parameters *params) { int ret = 0; @@ -8386,14 +8565,14 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, +static int woal_cfg80211_add_station(struct wiphy *wiphy, + struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *mac, + const u8 *mac, #else - u8 *mac, + u8 *mac, #endif - struct station_parameters *params) + struct station_parameters *params) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; @@ -8438,19 +8617,18 @@ * * @return 0 success , other failure */ -int -woal_cfg80211_update_ft_ies(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_update_ft_ies_params *ftie) +int woal_cfg80211_update_ft_ies(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_update_ft_ies_params *ftie) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); IEEEtypes_MobilityDomain_t *md_ie = NULL; int ret = 0; - mlan_ds_misc_assoc_rsp assoc_rsp; + mlan_ds_misc_assoc_rsp *assoc_rsp = NULL; IEEEtypes_AssocRsp_t *passoc_rsp = NULL; mlan_bss_info bss_info; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - struct cfg80211_roam_info roam_info = { }; + struct cfg80211_roam_info roam_info = {}; #endif ENTER(); @@ -8459,16 +8637,21 @@ LEAVE(); return ret; } + assoc_rsp = kmalloc(sizeof(mlan_ds_misc_assoc_rsp), GFP_KERNEL); + if (!assoc_rsp) { + LEAVE(); + return ret; + } #ifdef MLAN_64BIT PRINTM(MINFO, "==>woal_cfg80211_update_ft_ies %lx \n", ftie->ie_len); #else PRINTM(MINFO, "==>woal_cfg80211_update_ft_ies %x \n", ftie->ie_len); #endif - md_ie = (IEEEtypes_MobilityDomain_t *)woal_parse_ie_tlv(ftie->ie, - ftie->ie_len, - MOBILITY_DOMAIN); + md_ie = (IEEEtypes_MobilityDomain_t *)woal_parse_ie_tlv( + ftie->ie, ftie->ie_len, MOBILITY_DOMAIN); if (!md_ie) { PRINTM(MERROR, "No Mobility domain IE\n"); + kfree(assoc_rsp); LEAVE(); return ret; } @@ -8485,6 +8668,7 @@ priv->ft_md = ftie->md; if (!priv->ft_pre_connect) { + kfree(assoc_rsp); LEAVE(); return ret; } @@ -8492,6 +8676,7 @@ if (!memcmp(&priv->target_ap_bssid, priv->cfg_bssid, MLAN_MAC_ADDR_LENGTH)) { PRINTM(MMSG, "This is the same AP, no Fast bss transition\n"); + kfree(assoc_rsp); priv->ft_pre_connect = MFALSE; priv->ft_ie_len = 0; LEAVE(); @@ -8504,23 +8689,27 @@ moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.bssid, &priv->target_ap_bssid, MLAN_MAC_ADDR_LENGTH, sizeof(priv->conn_bssid)); - memset(&assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); + memset(assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); ret = woal_cfg80211_assoc(priv, (void *)&priv->sme_current, - MOAL_IOCTL_WAIT, &assoc_rsp); + MOAL_IOCTL_WAIT, assoc_rsp); if ((priv->ft_cap & MBIT(0)) || priv->ft_roaming_triggered_by_driver) { if (!ret) { woal_inform_bss_from_scan_result(priv, NULL, MOAL_IOCTL_WAIT); passoc_rsp = (IEEEtypes_AssocRsp_t *) - assoc_rsp.assoc_resp_buf; + assoc_rsp->assoc_resp_buf; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_13) + roam_info.links[0].bssid = priv->cfg_bssid; +#else roam_info.bssid = priv->cfg_bssid; +#endif roam_info.req_ie = priv->sme_current.ie; roam_info.req_ie_len = priv->sme_current.ie_len; roam_info.resp_ie = passoc_rsp->ie_buffer; - roam_info.resp_ie_len = assoc_rsp.assoc_resp_len - - ASSOC_RESP_FIXED_SIZE; + roam_info.resp_ie_len = assoc_rsp->assoc_resp_len - + ASSOC_RESP_FIXED_SIZE; cfg80211_roamed(priv->netdev, &roam_info, GFP_KERNEL); #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) @@ -8528,24 +8717,28 @@ priv->sme_current.ie, priv->sme_current.ie_len, passoc_rsp->ie_buffer, - assoc_rsp.assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, GFP_KERNEL); + assoc_rsp->assoc_resp_len - + ASSOC_RESP_FIXED_SIZE, + GFP_KERNEL); #else cfg80211_roamed(priv->netdev, priv->cfg_bssid, priv->sme_current.ie, priv->sme_current.ie_len, passoc_rsp->ie_buffer, - assoc_rsp.assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, GFP_KERNEL); + assoc_rsp->assoc_resp_len - + ASSOC_RESP_FIXED_SIZE, + GFP_KERNEL); #endif #endif PRINTM(MMSG, "Fast BSS transition to bssid " MACSTR - " successfully\n", MAC2STR(priv->cfg_bssid)); + " successfully\n", + MAC2STR(priv->cfg_bssid)); } else { PRINTM(MMSG, - "Fast BSS transition failed, keep connect to " - MACSTR " \n", MAC2STR(priv->cfg_bssid)); + "Fast BSS transition failed, keep connect to " MACSTR + " \n", + MAC2STR(priv->cfg_bssid)); moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.bssid, &priv->cfg_bssid, MLAN_MAC_ADDR_LENGTH, @@ -8559,19 +8752,20 @@ } else { if (!ret) { - memset(&assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); - woal_get_assoc_rsp(priv, &assoc_rsp, MOAL_IOCTL_WAIT); + memset(assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); + woal_get_assoc_rsp(priv, assoc_rsp, MOAL_IOCTL_WAIT); passoc_rsp = (IEEEtypes_AssocRsp_t *) - assoc_rsp.assoc_resp_buf; + assoc_rsp->assoc_resp_buf; cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0, passoc_rsp->ie_buffer, - assoc_rsp.assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, + assoc_rsp->assoc_resp_len - + ASSOC_RESP_FIXED_SIZE, WLAN_STATUS_SUCCESS, GFP_KERNEL); PRINTM(MMSG, "wlan: Fast Bss transition to bssid " MACSTR - " successfully\n", MAC2STR(priv->cfg_bssid)); + " successfully\n", + MAC2STR(priv->cfg_bssid)); memset(&bss_info, 0, sizeof(bss_info)); woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); @@ -8597,7 +8791,7 @@ // priv->ft_ie_len = 0; } } - + kfree(assoc_rsp); priv->ft_pre_connect = MFALSE; LEAVE(); return 0; @@ -8610,8 +8804,8 @@ * @param priv A pointer to moal_private * @param sme A pointer to cfg80211_connect_params structure */ -void -woal_save_conn_params(moal_private *priv, struct cfg80211_connect_params *sme) +void woal_save_conn_params(moal_private *priv, + struct cfg80211_connect_params *sme) { ENTER(); woal_clear_conn_params(priv); @@ -8659,8 +8853,7 @@ * * @param priv A pointer to moal_private */ -void -woal_clear_conn_params(moal_private *priv) +void woal_clear_conn_params(moal_private *priv) { ENTER(); if (priv->sme_current.ie_len) @@ -8675,14 +8868,15 @@ LEAVE(); } +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) /** * @brief Build new roaming connect ie for okc * * @param priv A pointer to moal_private * @param entry A pointer to pmksa_entry **/ -static int -woal_update_okc_roaming_ie(moal_private *priv, struct pmksa_entry *entry) +static int woal_update_okc_roaming_ie(moal_private *priv, + struct pmksa_entry *entry) { struct cfg80211_connect_params *sme = &priv->sme_current; int ret = MLAN_STATUS_SUCCESS; @@ -8753,9 +8947,8 @@ *(t_u16 *)(sme_pos + PAIRWISE_CIPHER_COUNT_OFFSET); akm_count = - *(t_u16 *)(sme_pos + - AKM_SUITE_COUNT_OFFSET - (pairwise_count)); + *(t_u16 *)(sme_pos + AKM_SUITE_COUNT_OFFSET( + pairwise_count)); rsn_offset = PMKID_COUNT_OFFSET(pairwise_count + akm_count); sme_ptr = (t_u8 *)(sme_pos + rsn_offset); @@ -8782,12 +8975,11 @@ if ((ie_len + 2) > rsn_offset) { sme_ptr += (sizeof(t_u16) + PMKID_LEN * pmkid_count); - moal_memcpy_ext(priv->phandle, - okc_ie_pos, sme_ptr, - (ie_len + 2 - - rsn_offset), - (ie_len + 2 - - rsn_offset)); + moal_memcpy_ext( + priv->phandle, okc_ie_pos, + sme_ptr, + (ie_len + 2 - rsn_offset), + (ie_len + 2 - rsn_offset)); okc_ie_pos += (ie_len + 2 - rsn_offset); priv->okc_ie_len += (ie_len + 2 - rsn_offset); @@ -8818,6 +9010,7 @@ LEAVE(); return ret; } +#endif /** * @brief Start roaming: driver handle roaming @@ -8826,17 +9019,16 @@ * * @return N/A */ -void -woal_start_roaming(moal_private *priv) +void woal_start_roaming(moal_private *priv) { mlan_ds_get_signal signal; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; char rssi_low[10]; int ret = 0; - mlan_ds_misc_assoc_rsp *assoc_rsp; + mlan_ds_misc_assoc_rsp *assoc_rsp = NULL; IEEEtypes_AssocRsp_t *passoc_rsp = NULL; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - struct cfg80211_roam_info roam_info = { }; + struct cfg80211_roam_info roam_info = {}; #endif ENTER(); @@ -8845,6 +9037,11 @@ LEAVE(); return; } + ssid_bssid = kmalloc(sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!ssid_bssid) { + LEAVE(); + return; + } if (priv->last_event & EVENT_BG_SCAN_REPORT) { woal_inform_bss_from_scan_result(priv, NULL, MOAL_IOCTL_WAIT); @@ -8852,6 +9049,7 @@ } if (priv->media_connected == MFALSE || !priv->sme_current.ssid_len) { PRINTM(MIOCTL, "Not connected, ignore roaming\n"); + kfree(ssid_bssid); LEAVE(); return; } @@ -8864,28 +9062,29 @@ ret = -EFAULT; goto done; } - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); - ssid_bssid.ssid.ssid_len = priv->sme_current.ssid_len; - moal_memcpy_ext(priv->phandle, ssid_bssid.ssid.ssid, + memset(ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + ssid_bssid->ssid.ssid_len = priv->sme_current.ssid_len; + moal_memcpy_ext(priv->phandle, ssid_bssid->ssid.ssid, priv->sme_current.ssid, priv->sme_current.ssid_len, - sizeof(ssid_bssid.ssid.ssid)); + sizeof(ssid_bssid->ssid.ssid)); if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { PRINTM(MIOCTL, "Can not find better network\n"); ret = -EFAULT; goto done; } /* check if we found different AP */ - if (!memcmp(&ssid_bssid.bssid, priv->cfg_bssid, MLAN_MAC_ADDR_LENGTH)) { + if (!memcmp(&ssid_bssid->bssid, priv->cfg_bssid, + MLAN_MAC_ADDR_LENGTH)) { PRINTM(MIOCTL, "This is the same AP, no roaming\n"); ret = -EFAULT; goto done; } PRINTM(MIOCTL, "Find AP: bssid=" MACSTR ", signal=%d\n", - MAC2STR(ssid_bssid.bssid), ssid_bssid.rssi); + MAC2STR(ssid_bssid->bssid), ssid_bssid->rssi); /* check signal */ if (!(priv->last_event & EVENT_PRE_BCN_LOST)) { - if ((abs(signal.bcn_rssi_avg) - abs(ssid_bssid.rssi)) < + if ((abs(signal.bcn_rssi_avg) - abs(ssid_bssid->rssi)) < DELTA_RSSI) { PRINTM(MERROR, "New AP's signal is not good too.\n"); ret = -EFAULT; @@ -8893,16 +9092,16 @@ } } /**check if need start FT Roaming*/ - if (priv->ft_ie_len && (priv->ft_md == ssid_bssid.ft_md) && - (priv->ft_cap == ssid_bssid.ft_cap)) { + if (priv->ft_ie_len && (priv->ft_md == ssid_bssid->ft_md) && + (priv->ft_cap == ssid_bssid->ft_cap)) { priv->ft_roaming_triggered_by_driver = MTRUE; - woal_start_ft_roaming(priv, &ssid_bssid); + woal_start_ft_roaming(priv, ssid_bssid); goto done; } /* start roaming to new AP */ priv->sme_current.bssid = priv->conn_bssid; moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.bssid, - &ssid_bssid.bssid, MLAN_MAC_ADDR_LENGTH, + &ssid_bssid->bssid, MLAN_MAC_ADDR_LENGTH, sizeof(priv->conn_bssid)); #ifdef STA_CFG80211 @@ -8911,7 +9110,7 @@ /** Check if current roaming support OKC offload roaming */ if (priv->sme_current.crypto.n_akm_suites && priv->sme_current.crypto.akm_suites[0] == - WLAN_AKM_SUITE_8021X) { + WLAN_AKM_SUITE_8021X) { struct pmksa_entry *entry = NULL; /** Get OKC PMK Cache entry @@ -8921,19 +9120,17 @@ cfg80211_pmksa_candidate_notify(priv->netdev, 0, priv->sme_current.bssid, MTRUE, GFP_ATOMIC); - if (wait_event_interruptible_timeout(priv->okc_wait_q, - !priv-> - wait_target_ap_pmkid, - OKC_WAIT_TARGET_PMKSA_TIMEOUT)) - { + if (wait_event_interruptible_timeout( + priv->okc_wait_q, + !priv->wait_target_ap_pmkid, + OKC_WAIT_TARGET_PMKSA_TIMEOUT)) { PRINTM(MIOCTL, "OKC Roaming is ready\n"); entry = priv->target_ap_pmksa; } else { /** Try to get pmksa from pmksa list */ priv->wait_target_ap_pmkid = MFALSE; - entry = woal_get_pmksa_entry(priv, - priv->sme_current. - bssid); + entry = woal_get_pmksa_entry( + priv, priv->sme_current.bssid); } /** Build okc roaming ie */ woal_update_okc_roaming_ie(priv, entry); @@ -8966,7 +9163,7 @@ */ if (priv->sme_current.crypto.n_akm_suites && priv->sme_current.crypto.akm_suites[0] == - WLAN_AKM_SUITE_8021X) { + WLAN_AKM_SUITE_8021X) { if (priv->okc_roaming_ie && priv->okc_ie_len) { ie = priv->okc_roaming_ie; ie_len = priv->okc_ie_len; @@ -8975,7 +9172,11 @@ } #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_13) + roam_info.links[0].bssid = priv->cfg_bssid; +#else roam_info.bssid = priv->cfg_bssid; +#endif roam_info.req_ie = ie; roam_info.req_ie_len = ie_len; roam_info.resp_ie = passoc_rsp->ie_buffer; @@ -8987,27 +9188,32 @@ cfg80211_roamed(priv->netdev, NULL, priv->cfg_bssid, ie, ie_len, passoc_rsp->ie_buffer, assoc_rsp->assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, GFP_KERNEL); + ASSOC_RESP_FIXED_SIZE, + GFP_KERNEL); #else cfg80211_roamed(priv->netdev, priv->cfg_bssid, ie, ie_len, passoc_rsp->ie_buffer, assoc_rsp->assoc_resp_len - - ASSOC_RESP_FIXED_SIZE, GFP_KERNEL); + ASSOC_RESP_FIXED_SIZE, + GFP_KERNEL); #endif #endif PRINTM(MMSG, "Roamed to bssid " MACSTR " successfully\n", MAC2STR(priv->cfg_bssid)); } else { PRINTM(MIOCTL, "Roaming to bssid " MACSTR " failed\n", - MAC2STR(ssid_bssid.bssid)); + MAC2STR(ssid_bssid->bssid)); } kfree(assoc_rsp); done: + kfree(ssid_bssid); /* config rssi low threshold again */ priv->last_event = 0; priv->rssi_low = DEFAULT_RSSI_LOW_THRESHOLD; sprintf(rssi_low, "%d", priv->rssi_low); - woal_set_rssi_low_threshold(priv, rssi_low, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_FAILURE == + woal_set_rssi_low_threshold(priv, rssi_low, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, "set_rssi_low_threshold fail\n"); LEAVE(); return; } @@ -9024,9 +9230,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_parameters *params) +int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, + u8 *mac, struct station_parameters *params) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); mlan_ioctl_req *req = NULL; @@ -9044,30 +9249,55 @@ ENTER(); req_len = sizeof(mlan_ds_bss); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) if (params->ext_capab_len) req_len += sizeof(MrvlIEtypesHeader_t) + params->ext_capab_len; #endif +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.supported_rates_len) + req_len += sizeof(MrvlIEtypesHeader_t) + + params->link_sta_params.supported_rates_len; +#else if (params->supported_rates_len) req_len += sizeof(MrvlIEtypesHeader_t) + - params->supported_rates_len; + params->supported_rates_len; +#endif if (params->uapsd_queues || params->max_sp) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(qosinfo); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.ht_capa) +#else if (params->ht_capa) +#endif req_len += sizeof(MrvlIEtypesHeader_t) + - sizeof(struct ieee80211_ht_cap); + sizeof(struct ieee80211_ht_cap); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.vht_capa) +#else if (params->vht_capa) +#endif req_len += sizeof(MrvlIEtypesHeader_t) + - sizeof(struct ieee80211_vht_cap); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + sizeof(struct ieee80211_vht_cap); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.opmode_notif_used) + req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8); +#else if (params->opmode_notif_used) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8); #endif +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.he_capa_len) + req_len += sizeof(MrvlExtIEtypesHeader_t) + + params->link_sta_params.he_capa_len; +#else if (params->he_capa_len) req_len += sizeof(MrvlExtIEtypesHeader_t) + params->he_capa_len; #endif +#endif req = woal_alloc_mlan_ioctl_req(req_len); if (req == NULL) { ret = -ENOMEM; @@ -9101,7 +9331,7 @@ params->sta_flags_set, params->listen_interval, params->aid); #endif pos = &bss->param.sta_info.tlv[0]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) if (params->ext_capab_len) { tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = EXT_CAPABILITY; @@ -9114,12 +9344,25 @@ tlv = (MrvlIEtypes_Data_t *)pos; } #endif +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.supported_rates_len) { +#else if (params->supported_rates_len) { +#endif tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = SUPPORTED_RATES; +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + tlv->header.len = params->link_sta_params.supported_rates_len; +#else tlv->header.len = params->supported_rates_len; +#endif moal_memcpy_ext(priv->phandle, tlv->data, +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + params->link_sta_params.supported_rates, + tlv->header.len, +#else params->supported_rates, tlv->header.len, +#endif tlv->header.len); pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; bss->param.sta_info.tlv_len += @@ -9138,34 +9381,61 @@ sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.ht_capa) { +#else if (params->ht_capa) { +#endif tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = HT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_ht_cap); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + moal_memcpy_ext(priv->phandle, tlv->data, + params->link_sta_params.ht_capa, +#else moal_memcpy_ext(priv->phandle, tlv->data, params->ht_capa, +#endif tlv->header.len, tlv->header.len); pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; bss->param.sta_info.tlv_len += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.vht_capa) { +#else if (params->vht_capa) { +#endif tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = VHT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_vht_cap); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + moal_memcpy_ext(priv->phandle, tlv->data, + params->link_sta_params.vht_capa, +#else moal_memcpy_ext(priv->phandle, tlv->data, params->vht_capa, +#endif tlv->header.len, tlv->header.len); pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; bss->param.sta_info.tlv_len += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.opmode_notif_used) { +#else if (params->opmode_notif_used) { +#endif tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = OPER_MODE_NTF; tlv->header.len = sizeof(u8); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + moal_memcpy_ext(priv->phandle, tlv->data, + ¶ms->link_sta_params.opmode_notif, +#else moal_memcpy_ext(priv->phandle, tlv->data, ¶ms->opmode_notif, +#endif tlv->header.len, tlv->header.len); pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len; bss->param.sta_info.tlv_len += @@ -9173,9 +9443,27 @@ tlv = (MrvlIEtypes_Data_t *)pos; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) + if (params->link_sta_params.he_capa_len) { + ext_tlv = (MrvlExtIEtypes_Data_t *)pos; + ext_tlv->header.type = EXTENSION; + ext_tlv->header.len = + params->link_sta_params.he_capa_len + sizeof(u8); + ext_tlv->header.ext_id = HE_CAPABILITY; + moal_memcpy_ext(priv->phandle, ext_tlv->data, + (u8 *)params->link_sta_params.he_capa, + params->link_sta_params.he_capa_len, + params->link_sta_params.he_capa_len); + pos += sizeof(MrvlExtIEtypesHeader_t) + + params->link_sta_params.he_capa_len; + bss->param.sta_info.tlv_len += + sizeof(MrvlExtIEtypesHeader_t) + + params->link_sta_params.he_capa_len; + tlv = (MrvlIEtypes_Data_t *)pos; + } +#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) if (params->he_capa_len) { - ext_tlv = (MrvlExtIEtypes_Data_t *) pos; + ext_tlv = (MrvlExtIEtypes_Data_t *)pos; ext_tlv->header.type = EXTENSION; ext_tlv->header.len = params->he_capa_len + sizeof(u8); ext_tlv->header.ext_id = HE_CAPABILITY; @@ -9194,6 +9482,16 @@ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_PENDING) kfree(req); +#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) { + struct station_info *sinfo = NULL; + sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); + if (sinfo) { + cfg80211_new_sta(dev, mac, sinfo, GFP_KERNEL); + kfree(sinfo); + } + } +#endif done: LEAVE(); return ret; @@ -9212,9 +9510,9 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_probe_client(struct wiphy *wiphy, - struct net_device *dev, const u8 *peer, u64 * cookie) +static int woal_cfg80211_probe_client(struct wiphy *wiphy, + struct net_device *dev, const u8 *peer, + u64 *cookie) { return -1; } @@ -9228,18 +9526,18 @@ * @param reason_code disconnect reason code * @return N/A */ -void -woal_host_mlme_disconnect(moal_private *priv, u16 reason_code, u8 *sa) +void woal_host_mlme_disconnect(moal_private *priv, u16 reason_code, u8 *sa) { - t_u8 broadcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - t_u8 frame_buf[26]; + t_u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + t_u8 frame_buf[100]; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)frame_buf; ENTER(); - mgmt->frame_control = (__force __le16) IEEE80211_STYPE_DEAUTH; + memset(frame_buf, 0, sizeof(frame_buf)); + mgmt->frame_control = (__force __le16)IEEE80211_STYPE_DEAUTH; mgmt->duration = 0; mgmt->seq_ctrl = 0; - mgmt->u.deauth.reason_code = (__force __le16) reason_code; + mgmt->u.deauth.reason_code = (__force __le16)reason_code; if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { moal_memcpy_ext(priv->phandle, mgmt->da, broadcast_addr, ETH_ALEN, sizeof(mgmt->da)); @@ -9263,7 +9561,7 @@ } if (GET_BSS_ROLE(priv) != MLAN_BSS_ROLE_UAP) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) mutex_lock(&priv->wdev->mtx); cfg80211_rx_mlme_mgmt(priv->netdev, frame_buf, 26); mutex_unlock(&priv->wdev->mtx); @@ -9272,30 +9570,31 @@ #endif } else { - int freq = ieee80211_channel_to_frequency(priv->channel + int freq = ieee80211_channel_to_frequency( + priv->channel #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - , - (priv->channel <= - 14 ? - IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ) + , + (priv->channel <= 14 ? IEEE80211_BAND_2GHZ : + IEEE80211_BAND_5GHZ) #endif - ); + ); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) cfg80211_rx_mgmt( #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - priv->wdev, + priv->wdev, #else - priv->netdev, + priv->netdev, #endif - freq, 0, frame_buf, 26 + freq, 0, frame_buf, 26 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - , 0 + , + 0 #endif #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 18, 0) - , GFP_ATOMIC + , + GFP_ATOMIC #endif - ); + ); #else cfg80211_rx_mgmt(priv->netdev, freq, frame_buf, 26, GFP_ATOMIC); #endif @@ -9314,8 +9613,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type) +mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -9361,16 +9659,18 @@ } if (priv->phandle->country_code[0] && priv->phandle->country_code[1]) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - if (priv->phandle->params.cntry_txpwr == CNTRY_RGPOWER_MODE - && !priv->phandle->params.txpwrlimit_cfg) + if (priv->phandle->params.cntry_txpwr == CNTRY_RGPOWER_MODE && + !priv->phandle->params.txpwrlimit_cfg) queue_work(priv->phandle->evt_workqueue, &priv->phandle->regulatory_work); #endif band = priv->phandle->band; priv->phandle->band = IEEE80211_BAND_2GHZ; woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); - priv->phandle->band = IEEE80211_BAND_5GHZ; - woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + if (priv->phandle->fw_bands & BAND_A) { + priv->phandle->band = IEEE80211_BAND_5GHZ; + woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); + } priv->phandle->band = band; } LEAVE(); @@ -9385,9 +9685,9 @@ * @param wait_option Wait option * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_cfg80211_init_wiphy(moal_private *priv, struct wiphy *wiphy, - t_u8 wait_option) +static mlan_status woal_cfg80211_init_wiphy(moal_private *priv, + struct wiphy *wiphy, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; int retry_count, rts_thr, frag_thr; @@ -9400,6 +9700,9 @@ #ifdef UAP_SUPPORT pmlan_uap_bss_param sys_cfg = NULL; #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + t_u16 enable = 0; +#endif int mcs_supp = 0; ENTER(); @@ -9437,15 +9740,13 @@ mcs_supp = priv->phandle->params.antcfg & 0xf; if (mcs_supp != 3 && mcs_supp != 0) cfg_11n->param.supported_mcs_set[1] = 0; - cfg_11n->param.supported_mcs_set[4] = 0; } - woal_cfg80211_setup_ht_cap(&wiphy->bands[IEEE80211_BAND_2GHZ]-> - ht_cap, hw_dev_cap, - cfg_11n->param.supported_mcs_set); + woal_cfg80211_setup_ht_cap( + &wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, hw_dev_cap, + cfg_11n->param.supported_mcs_set); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - woal_cfg80211_setup_vht_cap(priv, - &wiphy->bands[IEEE80211_BAND_2GHZ]-> - vht_cap); + woal_cfg80211_setup_vht_cap( + priv, &wiphy->bands[IEEE80211_BAND_2GHZ]->vht_cap); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) woal_cfg80211_setup_he_cap(priv, @@ -9460,19 +9761,19 @@ if (mcs_supp != 3 && mcs_supp != 0) cfg_11n->param.supported_mcs_set[1] = 0; } - woal_cfg80211_setup_ht_cap(&wiphy->bands[IEEE80211_BAND_5GHZ]-> - ht_cap, hw_dev_cap, - cfg_11n->param.supported_mcs_set); + woal_cfg80211_setup_ht_cap( + &wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, hw_dev_cap, + cfg_11n->param.supported_mcs_set); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) - woal_cfg80211_setup_vht_cap(priv, - &wiphy->bands[IEEE80211_BAND_5GHZ]-> - vht_cap); + woal_cfg80211_setup_vht_cap( + priv, &wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) woal_cfg80211_setup_he_cap(priv, wiphy->bands[IEEE80211_BAND_5GHZ]); #endif } + kfree(req); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) @@ -9490,7 +9791,13 @@ ret = woal_request_ioctl(priv, req, wait_option); if (ret != MLAN_STATUS_SUCCESS) goto done; - /* Set available antennas to wiphy */ + /* Set available antennas to wiphy */ +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + if (priv->phandle->params.drv_mode & DRV_MODE_DFS) { + radio->param.ant_cfg.tx_antenna = 0x101; + radio->param.ant_cfg.rx_antenna = 0x101; + } +#endif if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type)) { woal_cfg80211_notify_antcfg(priv, wiphy, radio); @@ -9559,6 +9866,17 @@ if (frag_thr < MLAN_RTS_MIN_VALUE || frag_thr > MLAN_RTS_MAX_VALUE) frag_thr = MLAN_FRAG_RTS_DISABLED; wiphy->frag_threshold = (t_u32)frag_thr; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + /* Enable multi-channel by default if multi-channel is supported */ + if (cfg80211_iface_comb_ap_sta.num_different_channels > 1) { + if (priv->phandle->card_info->drcs && + moal_extflg_isset(priv->phandle, EXT_CFG80211_DRCS)) { + enable = 1; + ret = woal_mc_policy_cfg(priv, &enable, wait_option, + MLAN_ACT_SET); + } + } +#endif done: LEAVE(); @@ -9575,8 +9893,7 @@ * * @return N/A */ -static void -woal_update_channel_flag(struct wiphy *wiphy, mlan_fw_info *fw_info) +static void woal_update_channel_flag(struct wiphy *wiphy, mlan_fw_info *fw_info) { enum ieee80211_band band; struct ieee80211_supported_band *sband; @@ -9605,8 +9922,7 @@ * @param priv A pointer to moal_private * */ -mlan_status -woal_register_cfg80211(moal_private *priv) +mlan_status woal_register_cfg80211(moal_private *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; struct wiphy *wiphy; @@ -9648,7 +9964,7 @@ wiphy->wowlan.flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_MAGIC_PKT; if (fw_info.fw_supplicant_support) { wiphy->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | - WIPHY_WOWLAN_GTK_REKEY_FAILURE; + WIPHY_WOWLAN_GTK_REKEY_FAILURE; } wiphy->wowlan.n_patterns = MAX_NUM_FILTERS; wiphy->wowlan.pattern_min_len = 1; @@ -9663,8 +9979,9 @@ wiphy->max_scan_ssids = MRVDRV_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len = MAX_IE_SIZE; wiphy->interface_modes = 0; - wiphy->interface_modes = MBIT(NL80211_IFTYPE_STATION) | - MBIT(NL80211_IFTYPE_AP); + wiphy->interface_modes = + MBIT(NL80211_IFTYPE_STATION) | MBIT(NL80211_IFTYPE_AP); + wiphy->interface_modes |= MBIT(NL80211_IFTYPE_MONITOR); #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION @@ -9682,25 +9999,19 @@ if (!fw_info.fw_bands) fw_info.fw_bands = BAND_B | BAND_G; if (fw_info.fw_bands & BAND_A) { - if (priv->phandle->second_mac) - wiphy->bands[IEEE80211_BAND_5GHZ] = - &mac1_cfg80211_band_5ghz; - else - - wiphy->bands[IEEE80211_BAND_5GHZ] = &cfg80211_band_5ghz; + wiphy->bands[IEEE80211_BAND_5GHZ] = + woal_setup_wiphy_bands(IEEE80211_BAND_5GHZ); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) woal_update_channel_flag(wiphy, &fw_info); #endif priv->phandle->band = IEEE80211_BAND_5GHZ; } + /* Supported bands */ if (fw_info.fw_bands & (BAND_B | BAND_G | BAND_GN | BAND_GAC)) { - if (priv->phandle->second_mac) - wiphy->bands[IEEE80211_BAND_2GHZ] = - &mac1_cfg80211_band_2ghz; - else - wiphy->bands[IEEE80211_BAND_2GHZ] = &cfg80211_band_2ghz; - /* If 2.4G enable, it will overwrite default to 2.4G */ + wiphy->bands[IEEE80211_BAND_2GHZ] = + woal_setup_wiphy_bands(IEEE80211_BAND_2GHZ); + /* If 2.4G enable, it will overwrite default to 2.4G*/ priv->phandle->band = IEEE80211_BAND_2GHZ; } @@ -9741,6 +10052,14 @@ #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if ((moal_extflg_isset(priv->phandle, EXT_CFG80211_DRCS) && + priv->phandle->card_info->drcs) || + IS_CARD9098(priv->phandle->card_type)) { + cfg80211_iface_comb_ap_sta.num_different_channels = 2; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + cfg80211_iface_comb_ap_sta.radar_detect_widths = 0; +#endif + } /* Initialize interface combinations */ wiphy->iface_combinations = &cfg80211_iface_comb_ap_sta; wiphy->n_iface_combinations = 1; @@ -9790,7 +10109,7 @@ } #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) - wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; + wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; @@ -9802,6 +10121,19 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; #endif + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) +#define WLAN_EXT_FEATURE_DFS_OFFLOAD 25 + if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) { + if (NUM_NL80211_EXT_FEATURES > WLAN_EXT_FEATURE_DFS_OFFLOAD) { + PRINTM(MCMND, + "wlan: Set NL80211_EXT_FEATURE_DFS_OFFLOAD\n"); + wiphy_ext_feature_set(wiphy, + WLAN_EXT_FEATURE_DFS_OFFLOAD); + } + } +#endif + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM); @@ -9852,11 +10184,20 @@ if (fw_info.fw_beacon_prot) { wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION); - wiphy_ext_feature_set(wiphy, - NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT); + wiphy_ext_feature_set( + wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT); } #endif - +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + if (priv->phandle->params.drv_mode & DRV_MODE_DFS) { + wiphy_ext_feature_set(wiphy, + NL80211_EXT_FEATURE_RADAR_BACKGROUND); + woal_cfg80211_ops.set_radar_background = + woal_cfg80211_set_radar_background; + } +#endif +#endif /* Set struct moal_handle pointer in wiphy_priv */ wdev_priv = wiphy_priv(wiphy); *(unsigned long *)wdev_priv = (unsigned long)priv->phandle; @@ -9864,7 +10205,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) set_wiphy_dev(wiphy, (struct device *)priv->phandle->hotplug_device); #endif - /* Set phy name */ + /* Set phy name*/ for (index = 0; index < MAX_MLAN_ADAPTER; index++) { if (m_handle[index] == priv->phandle) { dev_set_name(&wiphy->dev, mwiphy_name, index); @@ -9885,20 +10226,30 @@ PRINTM(MIOCTL, "Follow countryIE provided by AP.\n"); } #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) + /*REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make + * sure all interfaces on this wiphy reside on allowed channels. If this + * flag is not set, upon a regdomain change, the interfaces are given a + * grace period (currently 60 seconds) to disconnect or move to an + * allowed channel.*/ + wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; +#endif memset(&priv->phandle->country_code, 0, sizeof(priv->phandle->country_code)); + priv->phandle->dfs_region = NXP_DFS_UNKNOWN; if (reg_alpha2 && !strncmp(reg_alpha2, "99", strlen("99"))) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | - REGULATORY_DISABLE_BEACON_HINTS | - REGULATORY_COUNTRY_IE_IGNORE; + REGULATORY_DISABLE_BEACON_HINTS | + REGULATORY_COUNTRY_IE_IGNORE; #else wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; #endif wiphy_apply_custom_regulatory(wiphy, &mrvl_regdom); } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) if (woal_request_extcap(priv, (t_u8 *)&priv->extended_capabilities, sizeof(priv->extended_capabilities)) < 0) @@ -9920,9 +10271,7 @@ } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) - if (fw_info.force_reg || (priv->phandle->params.txpwrlimit_cfg && - priv->phandle->params.cntry_txpwr == - CNTRY_RGPOWER_MODE)) { + if (fw_info.force_reg) { PRINTM(MCMND, "FW region_code=%d force_reg=%d\n", fw_info.region_code, fw_info.force_reg); country = region_code_2_string(fw_info.region_code); @@ -9937,7 +10286,7 @@ #endif if ((!reg_alpha2 || strncmp(reg_alpha2, "99", strlen("99"))) - ) { + ) { /** we will try driver parameter first */ if (reg_alpha2 && woal_is_valid_alpha2(reg_alpha2)) { PRINTM(MIOCTL, "Notify reg_alpha2 %c%c\n", @@ -9953,8 +10302,9 @@ "Notify hw region code=%d %c%c\n", fw_info.region_code, country[0], country[1]); - if (!moal_extflg_isset(priv->phandle, - EXT_DISABLE_REGD_BY_DRIVER)) + if (!moal_extflg_isset( + priv->phandle, + EXT_DISABLE_REGD_BY_DRIVER)) regulatory_hint(wiphy, country); } } else @@ -9966,8 +10316,10 @@ priv->phandle->wiphy = wiphy; return ret; err_wiphy: - if (wiphy) + if (wiphy) { + woal_cfg80211_free_bands(wiphy); wiphy_free(wiphy); + } LEAVE(); return ret; }
diff --git a/wlan_sd8987/mlinux/moal_uap.c b/wlan_sd8987/mlinux/moal_uap.c index 8155260..8a033ba 100755 --- a/wlan_sd8987/mlinux/moal_uap.c +++ b/wlan_sd8987/mlinux/moal_uap.c
@@ -4,7 +4,7 @@ * driver. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -35,6 +35,9 @@ #if defined(STA_CFG80211) && defined(UAP_CFG80211) #include "moal_cfg80211.h" #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +#include <linux/compat.h> +#endif /******************************************************** Local Variables @@ -53,8 +56,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_addba_param(struct net_device *dev, struct ifreq *req) +static int woal_uap_addba_param(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -133,8 +135,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_aggr_priotbl(struct net_device *dev, struct ifreq *req) +static int woal_uap_aggr_priotbl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -209,8 +210,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) +static int woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -281,8 +281,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_get_fw_info(struct net_device *dev, struct ifreq *req) +static int woal_uap_get_fw_info(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); uap_fw_info fw; @@ -332,8 +331,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_deep_sleep(struct net_device *dev, struct ifreq *req) +static int woal_uap_deep_sleep(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -410,8 +408,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_band_steer(struct net_device *dev, struct ifreq *req) +static int woal_uap_band_steer(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -482,8 +479,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_beacon_stuck(struct net_device *dev, struct ifreq *req) +static int woal_uap_beacon_stuck(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -512,9 +508,8 @@ DBG_HEXDUMP(MCMD_D, "beacon_stuck_detect_para", (t_u8 *)¶m, sizeof(param)); - ioctl_req = - woal_alloc_mlan_ioctl_req(sizeof - (mlan_ds_beacon_stuck_param_cfg)); + ioctl_req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_beacon_stuck_param_cfg)); if (ioctl_req == NULL) { LEAVE(); return -ENOMEM; @@ -566,8 +561,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_txdatapause(struct net_device *dev, struct ifreq *req) +static int woal_uap_txdatapause(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -641,8 +635,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_sdcmd52_rw(struct net_device *dev, struct ifreq *req) +static int woal_uap_sdcmd52_rw(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); sdcmd52_para param; @@ -670,18 +663,20 @@ if (!param.action) { PRINTM(MINFO, "Cmd52 read, func=%d, reg=0x%08X\n", func, reg); #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - data = sdio_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); + data = sdio_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); else - data = sdio_f0_readb(((struct sdio_mmc_card *)priv-> - phandle->card) - ->func, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + data = sdio_f0_readb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -689,7 +684,8 @@ goto done; } #else - if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < 0) { + if (sdio_read_ioreg(priv->phandle->card, func, reg, &data) < + 0) { PRINTM(MERROR, "sdio_read_ioreg: reading register 0x%X failed\n", reg); @@ -703,18 +699,20 @@ PRINTM(MINFO, "Cmd52 write, func=%d, reg=0x%08X, data=0x%02X\n", func, reg, data); #ifdef SDIO_MMC - sdio_claim_host(((struct sdio_mmc_card *)priv->phandle->card)-> - func); + sdio_claim_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (func) - sdio_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); + sdio_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); else - sdio_f0_writeb(((struct sdio_mmc_card *)priv->phandle-> - card) - ->func, data, reg, &ret); - sdio_release_host(((struct sdio_mmc_card *)priv->phandle-> - card)->func); + sdio_f0_writeb( + ((struct sdio_mmc_card *)priv->phandle->card) + ->func, + data, reg, &ret); + sdio_release_host( + ((struct sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", @@ -722,7 +720,8 @@ goto done; } #else - if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < 0) { + if (sdio_write_ioreg(priv->phandle->card, func, reg, data) < + 0) { PRINTM(MERROR, "sdio_write_ioreg: writing register 0x%X failed\n", reg); @@ -743,14 +742,47 @@ #endif /** + * @brief enable/disable 11h + * + * @param enable MTRUE/MFALSE + * @return 0 --success, otherwise fail + */ +int woal_uap_11h_ctrl(moal_private *priv, t_u32 enable) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_snmp_mib *snmp = NULL; + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + ENTER(); + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_snmp_mib)); + if (ioctl_req == NULL) { + LEAVE(); + return -ENOMEM; + } + snmp = (mlan_ds_snmp_mib *)ioctl_req->pbuf; + ioctl_req->req_id = MLAN_IOCTL_SNMP_MIB; + snmp->sub_command = MLAN_OID_SNMP_MIB_DOT11H; + snmp->param.oid_value = enable; + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + LEAVE(); + return ret; +} + +/** * @brief configure snmp mib * * @param dev A pointer to net_device structure * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) +static int woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -805,6 +837,7 @@ snmp->sub_command = MLAN_OID_SNMP_MIB_DOT11H; break; default: + ret = -EINVAL; PRINTM(MERROR, "%s: Unsupported SNMP_MIB OID (%d).\n", __func__, param.oid); goto done; @@ -830,7 +863,7 @@ ret = -EFAULT; goto done; } - if (!param.action) { /* GET */ + if (!param.action) { /* GET */ if (copy_to_user(req->ifr_data + sizeof(param), &snmp->param.oid_value, MIN(param.oid_val_len, sizeof(t_u32)))) { @@ -854,21 +887,20 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_domain_info(struct net_device *dev, struct ifreq *req) +static int woal_uap_domain_info(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; mlan_ds_11d_cfg *cfg11d = NULL; domain_info_para param; - t_u8 tlv[MAX_DOMAIN_TLV_LEN]; + t_u8 tlv[MAX_DOMAIN_TLV_LEN + MAX_REG_DOMAIN_TLV_LEN]; t_u16 tlv_data_len = 0; int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); memset(¶m, 0, sizeof(param)); - memset(tlv, 0, MAX_DOMAIN_TLV_LEN); + memset(tlv, 0, MAX_DOMAIN_TLV_LEN + MAX_REG_DOMAIN_TLV_LEN); /* Sanity check */ if (req->ifr_data == NULL) { @@ -893,6 +925,7 @@ goto done; } tlv_data_len = ((t_u16 *)(tlv))[1]; + tlv_data_len += MAX_REG_DOMAIN_TLV_LEN; if ((TLV_HEADER_LEN + tlv_data_len) > (int)sizeof(tlv)) { PRINTM(MERROR, "TLV buffer is overflowed"); ret = -EINVAL; @@ -940,7 +973,7 @@ ret = -EFAULT; goto done; } - if (!param.action) { /* GET */ + if (!param.action) { /* GET */ tlv_data_len = ((t_u16 *)(cfg11d->param.domain_tlv))[1]; if (copy_to_user(req->ifr_data + sizeof(param), &cfg11d->param.domain_tlv, @@ -965,8 +998,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_dfs_testing(struct net_device *dev, struct ifreq *req) +static int woal_uap_dfs_testing(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -1028,7 +1060,7 @@ goto done; } - if (!param.action) { /* GET */ + if (!param.action) { /* GET */ param.usr_cac_period = cfg11h->param.dfs_testing.usr_cac_period_msec / 1000; param.usr_nop_period = @@ -1053,8 +1085,6 @@ return ret; } -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /** * @brief uap channel NOP status check ioctl handler * @@ -1063,9 +1093,8 @@ * @param data BSS control type * @return 0 --success, otherwise fail */ -int -woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option, - mlan_ds_11h_chan_nop_info * ch_info) +int woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option, + mlan_ds_11h_chan_nop_info *ch_info) { mlan_ioctl_req *req = NULL; mlan_ds_11h_cfg *ds_11hcfg = NULL; @@ -1109,8 +1138,6 @@ LEAVE(); return ret; } -#endif -#endif /** * @brief configure channel switch count @@ -1119,8 +1146,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_chan_switch_count_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_chan_switch_count_cfg(struct net_device *dev, + struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -1170,7 +1197,7 @@ goto done; } - if (!param.action) { /* GET */ + if (!param.action) { /* GET */ param.cs_count = cfg11h->param.cs_count; } /* Copy to user */ @@ -1194,8 +1221,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_tx_bf_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_tx_bf_cfg(struct net_device *dev, struct ifreq *req) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1259,8 +1285,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_ht_tx_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_ht_tx_cfg(struct net_device *dev, struct ifreq *req) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1341,8 +1366,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_vht_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_vht_cfg(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0, resbuf_len = 0; @@ -1359,7 +1383,7 @@ memset(¶m, 0, sizeof(vht_cfg_para_hdr)); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; respbuf = kzalloc(CMD_RESPBUF_LEN, flag); if (!respbuf) { ret = -ENOMEM; @@ -1490,9 +1514,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_hs_cfg(struct net_device *dev, struct ifreq *req, - BOOLEAN invoke_hostcmd) +static int woal_uap_hs_cfg(struct net_device *dev, struct ifreq *req, + BOOLEAN invoke_hostcmd) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ds_hs_cfg hscfg; @@ -1571,7 +1594,7 @@ } if (!(hs_cfg.flags & HS_CFG_FLAG_SET)) { hs_cfg.flags = HS_CFG_FLAG_CONDITION | HS_CFG_FLAG_GPIO | - HS_CFG_FLAG_GAP; + HS_CFG_FLAG_GAP; hs_cfg.conditions = hscfg.conditions; hs_cfg.gpio = hscfg.gpio; hs_cfg.gap = hscfg.gap; @@ -1596,8 +1619,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_hs_set_para(struct net_device *dev, struct ifreq *req) +static int woal_uap_hs_set_para(struct net_device *dev, struct ifreq *req) { int ret = 0; @@ -1623,8 +1645,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_mgmt_frame_control(struct net_device *dev, struct ifreq *req) +static int woal_uap_mgmt_frame_control(struct net_device *dev, + struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -1693,8 +1715,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_tx_rate_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_tx_rate_cfg(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0, i = 0; @@ -1752,8 +1773,8 @@ goto done; } /* rate_format sanity check */ - if ((tx_rate_config.rate_format > MLAN_RATE_FORMAT_HE) - ) { + if ((tx_rate_config.rate_format > + MLAN_RATE_FORMAT_HE)) { PRINTM(MERROR, "Invalid format selection\n"); ret = -EINVAL; goto done; @@ -1770,17 +1791,15 @@ ((tx_rate_config.rate_format == MLAN_RATE_FORMAT_HT) && (tx_rate_config.rate != 32) && - (tx_rate_config.rate > 15) - ) - || ((tx_rate_config.rate_format == - MLAN_RATE_FORMAT_VHT) && - (tx_rate_config.rate > - MLAN_RATE_INDEX_MCS9)) - || ((tx_rate_config.rate_format == - MLAN_RATE_FORMAT_HE) && - (tx_rate_config.rate > - MLAN_RATE_INDEX_MCS11)) - ) { + (tx_rate_config.rate > 15)) || + ((tx_rate_config.rate_format == + MLAN_RATE_FORMAT_VHT) && + (tx_rate_config.rate > + MLAN_RATE_INDEX_MCS9)) || + ((tx_rate_config.rate_format == + MLAN_RATE_FORMAT_HE) && + (tx_rate_config.rate > + MLAN_RATE_INDEX_MCS11))) { PRINTM(MERROR, "Invalid rate selection\n"); ret = -EINVAL; @@ -1826,9 +1845,9 @@ rate->param.rate_cfg.rate_format; tx_rate_config.rate = rate->param.rate_cfg.rate; if (rate->param.rate_cfg.rate_format == - MLAN_RATE_FORMAT_VHT - || rate->param.rate_cfg.rate_format == - MLAN_RATE_FORMAT_HE) + MLAN_RATE_FORMAT_VHT || + rate->param.rate_cfg.rate_format == + MLAN_RATE_FORMAT_HE) tx_rate_config.nss = rate->param.rate_cfg.nss; tx_rate_config.rate_setting = rate->param.rate_cfg.rate_setting; @@ -1859,8 +1878,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_antenna_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_antenna_cfg(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -1902,11 +1920,10 @@ #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type)) { - if (IS_STA_CFG80211 - (priv->phandle->params.cfg80211_wext)) - woal_cfg80211_notify_antcfg(priv, - priv->phandle-> - wiphy, radio); + if (IS_STA_CFG80211( + priv->phandle->params.cfg80211_wext)) + woal_cfg80211_notify_antcfg( + priv, priv->phandle->wiphy, radio); } #endif } @@ -1940,8 +1957,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_htstream_cfg(struct net_device *dev, struct ifreq *req) +static int woal_uap_htstream_cfg(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -2018,8 +2034,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_dfs_repeater(struct net_device *dev, struct ifreq *req) +static int woal_uap_dfs_repeater(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -2073,51 +2088,251 @@ } /** - * @brief Set/Get skip CAC mode + * @brief Issue MLAN_OID_11H_CHAN_REPORT_REQUEST ioctl to cancel dozer + * + * @param priv Pointer to the moal_private driver data struct + * @param action MLAN_ACT_SET/MLAN_ACT_GET + * @param + * + * @return 0 --success, otherwise fail + */ +int woal_11h_chan_dfs_state(moal_private *priv, t_u8 action, + mlan_ds_11h_chan_dfs_state *ch_dfs_state) +{ + int ret = 0; + mlan_ioctl_req *req = NULL; + mlan_ds_11h_cfg *ds_11hcfg = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + int cfg80211_wext = priv->phandle->params.cfg80211_wext; +#endif +#endif + + ENTER(); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (action == MLAN_ACT_GET) { + if (IS_UAP_CFG80211(cfg80211_wext)) { + ret = woal_get_wiphy_chan_dfs_state( + priv->phandle->wiphy, ch_dfs_state); + if (!ret) { + LEAVE(); + return ret; + } + } + } +#endif +#endif + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + ds_11hcfg = (mlan_ds_11h_cfg *)req->pbuf; + + ds_11hcfg->sub_command = MLAN_OID_11H_CHAN_DFS_STATE; + req->req_id = MLAN_IOCTL_11H_CFG; + req->action = action; + moal_memcpy_ext(priv->phandle, &ds_11hcfg->param.ch_dfs_state, + ch_dfs_state, sizeof(mlan_ds_11h_chan_dfs_state), + sizeof(ds_11hcfg->param.ch_dfs_state)); + /* Send Channel Check command and wait until the report is ready */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + moal_memcpy_ext(priv->phandle, ch_dfs_state, + &ds_11hcfg->param.ch_dfs_state, + sizeof(mlan_ds_11h_chan_dfs_state), + sizeof(mlan_ds_11h_chan_dfs_state)); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief find all bonded channel. + * + * @param pri_chan primary channel + * @param bw channel bandwidth + * @param ch_dfs_state a pointer to mlan_ds_11h_chan_dfs_state array + * + * @return number of channel + */ +static int woal_uap_get_dfs_chan(t_u8 pri_chan, t_u8 bw, + mlan_ds_11h_chan_dfs_state *ch_dfs_state) +{ + int ht40_plus[] = {52, 60, 100, 108, 116, 124, 132, 140}; + int ht40_minus[] = {56, 64, 104, 112, 120, 128, 136, 144}; + int vht80_dfs[4][4] = {{52, 56, 60, 64}, + {100, 104, 108, 112}, + {116, 120, 124, 128}, + {132, 136, 140, 144}}; + t_u8 find = false; + int i, j; + t_u8 sec_chan = 0; + mlan_ds_11h_chan_dfs_state *pos = ch_dfs_state; + t_u8 n_chan = 1; + + if (bw == CHAN_BW_20MHZ) { + pos->channel = pri_chan; + } else if (bw == CHAN_BW_40MHZ) { + pos->channel = pri_chan; + pos++; + for (i = 0; i < (sizeof(ht40_minus) / sizeof(int)); i++) { + if (pri_chan == (t_u8)ht40_plus[i]) { + sec_chan = pri_chan + 4; + n_chan = 2; + break; + } + } + for (i = 0; i < (sizeof(ht40_minus) / sizeof(int)); i++) { + if (pri_chan == (t_u8)ht40_minus[i]) { + sec_chan = pri_chan - 4; + n_chan = 2; + break; + } + } + pos->channel = sec_chan; + } else if (bw == CHAN_BW_80MHZ) { + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + if (pri_chan == (t_u8)vht80_dfs[i][j]) { + find = true; + break; + } + } + if (find) + break; + } + if (find) { + n_chan = 4; + for (j = 0; j < n_chan; j++) { + pos->channel = (t_u8)vht80_dfs[i][j]; + pos++; + } + } + } + return n_chan; +} + +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +/** + * @brief update channel dfs state to all wiphy + * + * @param channel given radar channel + * @param bandwidth channel's bandwidth + * @param dfs_state dfs_state + * + * @return N/A + */ +void woal_update_channels_dfs_state(moal_private *priv, t_u8 channel, + t_u8 bandwidth, t_u8 dfs_state) +{ + mlan_ds_11h_chan_dfs_state ch_dfs_state[4]; + int cfg80211_wext = priv->phandle->params.cfg80211_wext; + t_u8 n_chan; + int i; + ENTER(); + memset(ch_dfs_state, 0, sizeof(ch_dfs_state)); + n_chan = woal_uap_get_dfs_chan(channel, bandwidth, &ch_dfs_state[0]); + if (IS_UAP_CFG80211(cfg80211_wext)) { + for (i = 0; i < n_chan; i++) { + woal_update_channel_dfs_state(ch_dfs_state[i].channel, + dfs_state); + } + } + LEAVE(); + return; +} +#endif +#endif + +/** + * @brief skip cac on specific channel + * @and Wext * * @param dev A pointer to net_device structure * @param req A pointer to ifreq structure * * @return 0 --success, otherwise fail */ -static int -woal_uap_skip_cac(struct net_device *dev, struct ifreq *req) +static int woal_uap_skip_cac(struct net_device *dev, struct ifreq *req) { - moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; skip_cac_para param; - + moal_private *priv = (moal_private *)netdev_priv(dev); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + int cfg80211_wext = priv->phandle->params.cfg80211_wext; +#endif +#endif + dfs_state_t dfs_state; + mlan_ds_11h_chan_dfs_state ch_dfs_state[4]; + t_u8 n_chan; + int i = 0; ENTER(); /* Sanity check */ if (req->ifr_data == NULL) { - PRINTM(MERROR, "skip_cac() corrupt data\n"); + PRINTM(MERROR, "skip_dfs_cac() corrupt data\n"); ret = -EFAULT; goto done; } - memset(¶m, 0, sizeof(skip_cac_para)); - /* Get user data */ if (copy_from_user(¶m, req->ifr_data, sizeof(skip_cac_para))) { PRINTM(MERROR, "Copy from user failed\n"); ret = -EFAULT; goto done; } - - /* Currently default action is get */ - if (param.action == 0) { - param.skip_cac = (t_u16)priv->skip_cac; - } else { - priv->skip_cac = param.skip_cac; + if (param.skip_cac) + dfs_state = DFS_AVAILABLE; + else + dfs_state = DFS_USABLE; + memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); + n_chan = woal_uap_get_dfs_chan(param.channel, param.bw, + &ch_dfs_state[0]); + for (i = 0; i < n_chan; i++) { + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, + &ch_dfs_state[i])) + PRINTM(MERROR, "Get DFS state for chan:%d failed\n", + ch_dfs_state[i].channel); } - - if (copy_to_user(req->ifr_data, ¶m, sizeof(skip_cac_para))) { - PRINTM(MERROR, "Copy to user failed\n"); - ret = -EFAULT; + for (i = 0; i < n_chan; i++) { + if (param.skip_cac && ch_dfs_state[i].dfs_state == DFS_USABLE) + PRINTM(MMSG, + "DFS: Requst skip cac on the channel %d which hasn't do CAC before!\n", + ch_dfs_state[i].channel); + ch_dfs_state[i].dfs_state = dfs_state; + if (woal_11h_chan_dfs_state(priv, MLAN_ACT_SET, + &ch_dfs_state[i])) + PRINTM(MERROR, "Set DFS state for chan:%d failed\n", + ch_dfs_state[i].channel); + else + PRINTM(MCMND, "DFS: Skip CAC on chan %d %d\n", + ch_dfs_state[i].channel, param.skip_cac); } +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (IS_UAP_CFG80211(cfg80211_wext)) { + for (i = 0; i < n_chan; i++) { + if (param.skip_cac) + woal_update_channel_dfs_state( + ch_dfs_state[i].channel, DFS_AVAILABLE); + else + woal_update_channel_dfs_state( + ch_dfs_state[i].channel, DFS_USABLE); + } + } +#endif +#endif done: - LEAVE(); return ret; } @@ -2130,8 +2345,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_cac_timer_status(struct net_device *dev, struct ifreq *req) +static int woal_uap_cac_timer_status(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -2191,8 +2405,7 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_operation_ctrl(struct net_device *dev, struct ifreq *req) +static int woal_uap_operation_ctrl(struct net_device *dev, struct ifreq *req) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -2275,8 +2488,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_ioctl(struct net_device *dev, struct ifreq *req) { int ret = 0; t_u32 subcmd = 0; @@ -2390,8 +2602,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_sta_deauth_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_sta_deauth_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -2457,14 +2668,13 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_radio_ctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_radio_ctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *mreq = NULL; - int data[2] = { 0, 0 }; + int data[2] = {0, 0}; mlan_bss_info bss_info; mlan_status status = MLAN_STATUS_SUCCESS; @@ -2523,8 +2733,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_bss_ctrl_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_bss_ctrl_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0, data = 0; @@ -2557,8 +2766,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_report_mic_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_report_mic_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -2618,15 +2826,14 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_set_key_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_set_key_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; mlan_ds_sec_cfg *sec = NULL; encrypt_key key; int ret = 0; - t_u8 bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -2661,7 +2868,7 @@ sec = (mlan_ds_sec_cfg *)ioctl_req->pbuf; sec->sub_command = MLAN_OID_SEC_CFG_ENCRYPT_KEY, - ioctl_req->req_id = MLAN_IOCTL_SEC_CFG; + ioctl_req->req_id = MLAN_IOCTL_SEC_CFG; ioctl_req->action = MLAN_ACT_SET; moal_memcpy_ext(priv->phandle, sec->param.encrypt_key.mac_addr, @@ -2673,7 +2880,7 @@ key.key_material, key.key_len, sizeof(sec->param.encrypt_key.key_material)); if (0 == memcmp(sec->param.encrypt_key.mac_addr, bcast_addr, ETH_ALEN)) - sec->param.encrypt_key.key_flags = KEY_FLAG_GROUP_KEY; + sec->param.encrypt_key.key_flags = KEY_FLAG_GROUP_KEY; else sec->param.encrypt_key.key_flags = KEY_FLAG_SET_TX_KEY; @@ -2698,9 +2905,8 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -int -woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, - mlan_ds_ps_mgmt *ps_mgmt) +mlan_status woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, + mlan_ds_ps_mgmt *ps_mgmt) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_pm_cfg *pm_cfg = NULL; @@ -2746,8 +2952,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_power_mode_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_power_mode_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_ioctl_req *ioctl_req = NULL; @@ -2850,8 +3055,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -2879,9 +3083,8 @@ offset += sizeof(action); /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_bss)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2937,8 +3140,8 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_get_sta_list_ioctl(struct net_device *dev, struct ifreq *req) +static int woal_uap_get_sta_list_ioctl(struct net_device *dev, + struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; @@ -2956,9 +3159,8 @@ } /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2999,14 +3201,13 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_set_wapi_key_ioctl(moal_private *priv, wapi_msg *msg) +static int woal_uap_set_wapi_key_ioctl(moal_private *priv, wapi_msg *msg) { mlan_ioctl_req *req = NULL; mlan_ds_sec_cfg *sec = NULL; int ret = 0; wapi_key_msg *key_msg = NULL; - t_u8 bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u8 bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -3059,8 +3260,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_enable_wapi(moal_private *priv, t_u8 enable) +static mlan_status woal_enable_wapi(moal_private *priv, t_u8 enable) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -3106,8 +3306,10 @@ "Set AP setting failed! status=%d, error_code=0x%x\n", status, req->status_code); } - if (enable) - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START); + if (enable) { + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START)) + PRINTM(MERROR, "%s: uap bss start failed \n", __func__); + } done: if (status != MLAN_STATUS_PENDING) kfree(req); @@ -3123,17 +3325,14 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_set_wapi_flag_ioctl(moal_private *priv, wapi_msg *msg) +static int woal_uap_set_wapi_flag_ioctl(moal_private *priv, wapi_msg *msg) { - t_u8 wapi_psk_ie[] = { 0x44, 0x14, 0x01, 0x00, 0x01, 0x00, 0x00, 0x14, - 0x72, 0x02, 0x01, 0x00, 0x00, 0x14, 0x72, 0x01, - 0x00, 0x14, 0x72, 0x01, 0x00, 0x00 - }; - t_u8 wapi_cert_ie[] = { 0x44, 0x14, 0x01, 0x00, 0x01, 0x00, 0x00, 0x14, - 0x72, 0x01, 0x01, 0x00, 0x00, 0x14, 0x72, 0x01, - 0x00, 0x14, 0x72, 0x01, 0x00, 0x00 - }; + t_u8 wapi_psk_ie[] = {0x44, 0x14, 0x01, 0x00, 0x01, 0x00, 0x00, 0x14, + 0x72, 0x02, 0x01, 0x00, 0x00, 0x14, 0x72, 0x01, + 0x00, 0x14, 0x72, 0x01, 0x00, 0x00}; + t_u8 wapi_cert_ie[] = {0x44, 0x14, 0x01, 0x00, 0x01, 0x00, 0x00, 0x14, + 0x72, 0x01, 0x01, 0x00, 0x00, 0x14, 0x72, 0x01, + 0x00, 0x14, 0x72, 0x01, 0x00, 0x00}; mlan_ds_misc_cfg *misc = NULL; mlan_ioctl_req *req = NULL; int ret = 0; @@ -3141,7 +3340,11 @@ ENTER(); - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP); + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP)) { + PRINTM(MERROR, "%s: uap bss stop failed \n", __func__); + ret = -EFAULT; + goto done; + } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); if (req == NULL) { @@ -3194,8 +3397,7 @@ * @param req A pointer to ifreq structure * @return 0 --success, otherwise fail */ -static int -woal_uap_set_wapi(struct net_device *dev, struct ifreq *req) +static int woal_uap_set_wapi(struct net_device *dev, struct ifreq *req) { moal_private *priv = (moal_private *)netdev_priv(dev); wapi_msg msg; @@ -3252,9 +3454,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_uap_get_bss_param(moal_private *priv, - mlan_uap_bss_param *sys_cfg, t_u8 wait_option) +static mlan_status woal_uap_get_bss_param(moal_private *priv, + mlan_uap_bss_param *sys_cfg, + t_u8 wait_option) { mlan_ds_bss *info = NULL; mlan_ioctl_req *req = NULL; @@ -3298,9 +3500,8 @@ * * @return 0 --success, otherwise fail */ -int -woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg, - t_u16 ht_cap, t_u8 en) +int woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg, + t_u16 ht_cap, t_u8 en) { int ret = 0; mlan_ds_11n_cfg *cfg_11n = NULL; @@ -3357,9 +3558,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_uap_set_11n_status(moal_private *priv, - mlan_uap_bss_param *sys_cfg, t_u8 action) +mlan_status woal_uap_set_11n_status(moal_private *priv, + mlan_uap_bss_param *sys_cfg, t_u8 action) { mlan_status status = MLAN_STATUS_SUCCESS; mlan_fw_info fw_info; @@ -3368,9 +3568,8 @@ memset(&fw_info, 0, sizeof(mlan_fw_info)); if (action == MLAN_ACT_DISABLE) { if ((sys_cfg->supported_mcs_set[0] == 0) && - (sys_cfg->supported_mcs_set[4] == 0) - && (sys_cfg->supported_mcs_set[1] == 0) - ) { + (sys_cfg->supported_mcs_set[4] == 0) && + (sys_cfg->supported_mcs_set[1] == 0)) { goto done; } else { sys_cfg->supported_mcs_set[0] = 0; @@ -3409,9 +3608,8 @@ * * @return 0--success, otherwise failure */ -int -woal_uap_set_11ac_status(moal_private *priv, t_u8 action, t_u8 vht20_40, - IEEEtypes_VHTCap_t *vhtcap_ie) +int woal_uap_set_11ac_status(moal_private *priv, t_u8 action, t_u8 vht20_40, + IEEEtypes_VHTCap_t *vhtcap_ie) { mlan_ioctl_req *req = NULL; mlan_ds_11ac_cfg *cfg_11ac = NULL; @@ -3495,11 +3693,12 @@ * @param priv A pointer to moal_private structure * @param action MLAN_ACT_SET or MLAN_ACT_GET * @param he_cfg a pointer to mlan_ds_11ax_he_cfg + * @param wait_option wait_option * * @return 0--success, otherwise failure */ -int -woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg * he_cfg) +int woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg *he_cfg, + t_u8 wait_option) { int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; @@ -3510,21 +3709,19 @@ ret = -ENOMEM; goto done; } - cfg_11ax = (mlan_ds_11ax_cfg *) req->pbuf; + cfg_11ax = (mlan_ds_11ax_cfg *)req->pbuf; cfg_11ax->sub_command = MLAN_OID_11AX_HE_CFG; req->req_id = MLAN_IOCTL_11AX_CFG; req->action = action; moal_memcpy_ext(priv->phandle, &cfg_11ax->param.he_cfg, he_cfg, sizeof(mlan_ds_11ax_he_cfg), sizeof(mlan_ds_11ax_he_cfg)); - status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); - if (status != MLAN_STATUS_SUCCESS) { - ret = -EFAULT; - goto done; + status = woal_request_ioctl(priv, req, wait_option); + if (status == MLAN_STATUS_SUCCESS) { + moal_memcpy_ext(priv->phandle, he_cfg, &cfg_11ax->param.he_cfg, + sizeof(mlan_ds_11ax_he_cfg), + sizeof(mlan_ds_11ax_he_cfg)); } - moal_memcpy_ext(priv->phandle, he_cfg, &cfg_11ax->param.he_cfg, - sizeof(mlan_ds_11ax_he_cfg), - sizeof(mlan_ds_11ax_he_cfg)); done: if (status != MLAN_STATUS_PENDING) kfree(req); @@ -3542,9 +3739,8 @@ * * @return 0--success, otherwise failure */ -int -woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band, - IEEEtypes_HECap_t * hecap_ie) +int woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band, + IEEEtypes_HECap_t *hecap_ie) { mlan_fw_info fw_info; int ret = 0; @@ -3569,7 +3765,7 @@ ret = -EFAULT; goto done; } - if (woal_11ax_cfg(priv, MLAN_ACT_GET, &he_cfg)) { + if (woal_11ax_cfg(priv, MLAN_ACT_GET, &he_cfg, MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Fail to get 11ax cfg!\n"); ret = -EFAULT; goto done; @@ -3577,13 +3773,17 @@ if (hecap_ie) { DBG_HEXDUMP(MCMD_D, "hecap_ie", (t_u8 *)hecap_ie, hecap_ie->ieee_hdr.len + - sizeof(IEEEtypes_Header_t)); + sizeof(IEEEtypes_Header_t)); he_cfg.he_cap.id = hecap_ie->ieee_hdr.element_id; he_cfg.he_cap.len = hecap_ie->ieee_hdr.len; moal_memcpy_ext(priv->phandle, &he_cfg.he_cap.ext_id, &hecap_ie->ext_id, he_cfg.he_cap.len, he_cfg.he_cap.len); } +#define HE_MAC_CAP_TWT_REQ_SUPPORT MBIT(1) + /* uap mode clear TWT request bit */ + he_cfg.he_cap.he_mac_cap[0] &= ~HE_MAC_CAP_TWT_REQ_SUPPORT; + if (action == MLAN_ACT_DISABLE) { if (he_cfg.he_cap.len && (he_cfg.he_cap.ext_id == HE_CAPABILITY)) { @@ -3595,7 +3795,7 @@ } } DBG_HEXDUMP(MCMD_D, "HE_CFG ", (t_u8 *)&he_cfg, sizeof(he_cfg)); - ret = woal_11ax_cfg(priv, MLAN_ACT_SET, &he_cfg); + ret = woal_11ax_cfg(priv, MLAN_ACT_SET, &he_cfg, MOAL_IOCTL_WAIT); done: LEAVE(); return ret; @@ -3610,9 +3810,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_uap_ap_cfg_parse_data(moal_private *priv, mlan_uap_bss_param *ap_cfg, - char *buf) +static int woal_uap_ap_cfg_parse_data(moal_private *priv, + mlan_uap_bss_param *ap_cfg, char *buf) { int ret = 0, atoi_ret; int set_sec = 0, set_key = 0, set_chan = 0; @@ -3709,7 +3908,8 @@ ap_cfg->wpa_cfg.pairwise_cipher_wpa = CIPHER_TKIP; ap_cfg->wpa_cfg.group_cipher = CIPHER_TKIP; - } else if (!strnicmp(value, "wep128", strlen("wep128"))) { + } else if (!strnicmp(value, "wep128", + strlen("wep128"))) { ap_cfg->auth_mode = MLAN_AUTH_MODE_OPEN; if (set_key) ap_cfg->wpa_cfg.length = 0; @@ -3728,7 +3928,8 @@ PRINTM(MWARN, "Skipping KEY, found again!\n"); continue; } - if (set_sec && ap_cfg->protocol == PROTOCOL_STATIC_WEP) { + if (set_sec && + ap_cfg->protocol == PROTOCOL_STATIC_WEP) { if (strlen(value) != MAX_WEP_KEY_SIZE) { PRINTM(MERROR, "Invalid WEP KEY length\n"); @@ -3738,11 +3939,10 @@ ap_cfg->wep_cfg.key0.key_index = 0; ap_cfg->wep_cfg.key0.is_default = 1; ap_cfg->wep_cfg.key0.length = strlen(value); - moal_memcpy_ext(priv->phandle, - ap_cfg->wep_cfg.key0.key, value, - strlen(value), - sizeof(ap_cfg->wep_cfg.key0. - key)); + moal_memcpy_ext( + priv->phandle, ap_cfg->wep_cfg.key0.key, + value, strlen(value), + sizeof(ap_cfg->wep_cfg.key0.key)); set_key = 1; continue; } @@ -3778,7 +3978,8 @@ if (atoi_ret < 1 || atoi_ret > MLAN_MAX_CHANNEL) { PRINTM(MERROR, "AP_CFG: Channel must be between 1 and %d" - "(both included)\n", MLAN_MAX_CHANNEL); + "(both included)\n", + MLAN_MAX_CHANNEL); ret = -EINVAL; goto done; } @@ -3810,7 +4011,8 @@ if (atoi_ret < 1 || atoi_ret > MAX_STA_COUNT) { PRINTM(MERROR, "AP_CFG: MAX_SCB must be between 1 to %d " - "(both included)\n", MAX_STA_COUNT); + "(both included)\n", + MAX_STA_COUNT); ret = -EINVAL; goto done; } @@ -3837,8 +4039,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_uap_set_ap_cfg(moal_private *priv, t_u8 *data, int len) +int woal_uap_set_ap_cfg(moal_private *priv, t_u8 *data, int len) { int ret = 0; static char buf[MAX_BUF_LEN]; @@ -3847,7 +4048,7 @@ ENTER(); -#define MIN_AP_CFG_CMD_LEN 16 /* strlen("ASCII_CMD=AP_CFG") */ +#define MIN_AP_CFG_CMD_LEN 16 /* strlen("ASCII_CMD=AP_CFG") */ if ((len - 1) <= MIN_AP_CFG_CMD_LEN) { PRINTM(MERROR, "Invalid length of command\n"); ret = -EINVAL; @@ -3930,7 +4131,7 @@ */ static mlan_status woal_set_get_ap_scan_channels(moal_private *priv, t_u16 action, - mlan_uap_scan_channels * scan_channels) + mlan_uap_scan_channels *scan_channels) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -3979,9 +4180,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_set_get_ap_channel(moal_private *priv, t_u16 action, - t_u8 wait_option, chan_band_info * uap_channel) +mlan_status woal_set_get_ap_channel(moal_private *priv, t_u16 action, + t_u8 wait_option, + chan_band_info *uap_channel) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -4025,8 +4226,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_start_acs_scan(moal_private *priv) +static mlan_status woal_start_acs_scan(moal_private *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -4069,8 +4269,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_do_acs_check(moal_private *priv) +static mlan_status woal_do_acs_check(moal_private *priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_uap_bss_param *sys_config = NULL; @@ -4150,8 +4349,7 @@ * @param data BSS control type * @return 0 --success, otherwise fail */ -int -woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) +int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -4161,12 +4359,7 @@ ENTER(); PRINTM(MIOCTL, "ioctl bss ctrl=%d\n", data); - if ((data != UAP_BSS_START) && (data != UAP_BSS_STOP) && - (data != UAP_BSS_RESET)) { - PRINTM(MERROR, "Invalid parameter: %d\n", data); - ret = -EINVAL; - goto done; - } + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { ret = -ENOMEM; @@ -4182,8 +4375,10 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) || moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD) #endif - ) { - woal_do_acs_check(priv); + ) { + status = woal_do_acs_check(priv); + if (status) + PRINTM(MMSG, "woal_do_acs_check fails\n"); /* about to start bss: issue channel check */ status = woal_11h_channel_check_ioctl(priv, MOAL_IOCTL_WAIT); @@ -4224,6 +4419,11 @@ bss->sub_command = MLAN_OID_UAP_BSS_RESET; woal_cancel_cac_block(priv); break; + default: + PRINTM(MMSG, "We don't support this uap_bss_ctrl cmd %d\n", + data); + ret = -EFAULT; + goto done; } req->req_id = MLAN_IOCTL_BSS; req->action = MLAN_ACT_SET; @@ -4238,8 +4438,12 @@ woal_stop_queue(priv->netdev); if (netif_carrier_ok(priv->netdev)) netif_carrier_off(priv->netdev); - if (data == UAP_BSS_RESET) - woal_request_set_mac_address(priv, wait_option); + if (data == UAP_BSS_RESET) { + if (MLAN_STATUS_FAILURE == + woal_request_set_mac_address(priv, wait_option)) + PRINTM(MERROR, + "Fail to set mac address after UAP_BSS_RESET\n"); + } woal_flush_tcp_sess_queue(priv); } done: @@ -4255,8 +4459,7 @@ * @param dev A pointer to net_device structure * @return N/A */ -void -woal_uap_set_multicast_list(struct net_device *dev) +void woal_uap_set_multicast_list(struct net_device *dev) { ENTER(); @@ -4273,21 +4476,21 @@ * @return 0 --success, otherwise fail */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) -int -woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, void __user * data, - int cmd) +int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, + void __user *data, int cmd) #else -int -woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) #endif { int ret = 0; ENTER(); +#ifdef CONFIG_COMPAT #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) - if (in_compat_syscall()) /* not implemented yet */ + if (in_compat_syscall()) /* not implemented yet */ return -EOPNOTSUPP; #endif +#endif switch (cmd) { case WOAL_ANDROID_DEF_CMD: @@ -4359,8 +4562,7 @@ * * @return N/A */ -void -woal_uap_get_version(moal_private *priv, char *version, int max_len) +void woal_uap_get_version(moal_private *priv, char *version, int max_len) { mlan_ds_get_info *info = NULL; mlan_ioctl_req *req = NULL; @@ -4404,9 +4606,8 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- * success, otherwise fail */ -mlan_status -woal_uap_get_stats(moal_private *priv, t_u8 wait_option, - mlan_ds_uap_stats *ustats) +mlan_status woal_uap_get_stats(moal_private *priv, t_u8 wait_option, + mlan_ds_uap_stats *ustats) { mlan_ds_get_info *info = NULL; mlan_ioctl_req *req = NULL; @@ -4456,9 +4657,8 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_set_get_ap_wmm_para(moal_private *priv, t_u16 action, - wmm_parameter_t *ap_wmm_para) +mlan_status woal_set_get_ap_wmm_para(moal_private *priv, t_u16 action, + wmm_parameter_t *ap_wmm_para) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -4512,9 +4712,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_set_get_sys_config(moal_private *priv, t_u16 action, - t_u8 wait_option, mlan_uap_bss_param *sys_cfg) +mlan_status woal_set_get_sys_config(moal_private *priv, t_u16 action, + t_u8 wait_option, + mlan_uap_bss_param *sys_cfg) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = NULL; @@ -4562,8 +4762,7 @@ * * @return N/A */ -void -woal_set_sys_config_invalid_data(mlan_uap_bss_param *config) +void woal_set_sys_config_invalid_data(mlan_uap_bss_param *config) { ENTER();
diff --git a/wlan_sd8987/mlinux/moal_uap.h b/wlan_sd8987/mlinux/moal_uap.h index f687710..8f5b699 100755 --- a/wlan_sd8987/mlinux/moal_uap.h +++ b/wlan_sd8987/mlinux/moal_uap.h
@@ -3,7 +3,7 @@ * @brief This file contains uap driver specific defines etc. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -89,7 +89,7 @@ #define UAP_CHAN_SWITCH_COUNT_CFG 23 #define UAP_BAND_STEER 24 -#define UAP_BEACON_STUCK_DETECT 25 +#define UAP_BEACON_STUCK_DETECT 25 /** Private command ID to Power Mode */ #define UAP_POWER_MODE (SIOCDEVPRIVATE + 3) @@ -201,10 +201,14 @@ typedef struct _skip_cac_para { /** subcmd */ t_u32 subcmd; - /** Set/Get */ + /** Set */ t_u32 action; - /** enable/disable deepsleep*/ + /** enable/disable skip cac*/ t_u16 skip_cac; + /** channel */ + t_u8 channel; + /** bandwidth */ + t_u8 bw; } skip_cac_para; /** radio control command */ @@ -426,13 +430,15 @@ /** beacon stuck detect mechanism parameters */ typedef struct _beacon_stuck_detect_para { - /** subcmd */ + /** subcmd */ t_u32 subcmd; - /** Set/Get */ + /** Set/Get */ t_u8 action; - /** No of beacon interval after which firmware will check if beacon Tx is going fine */ + /** No of beacon interval after which firmware will check if beacon Tx + * is going fine */ t_u8 beacon_stuck_detect_count; - /** Upon performing MAC reset, no of beacon interval after which firmware will check if recovery was successful */ + /** Upon performing MAC reset, no of beacon interval after which + * firmware will check if recovery was successful */ t_u8 recovery_confirm_count; } beacon_stuck_detect_para; @@ -479,6 +485,8 @@ /** Oid for 802.11H enable/disable */ #define OID_80211H_ENABLE 0x000a +int woal_uap_11h_ctrl(moal_private *priv, t_u32 enable); + /** dfs_testing parameters */ typedef struct _dfs_testing_param { /** subcmd */ @@ -526,27 +534,40 @@ #define MAX_DOMAIN_TLV_LEN \ (TLV_HEADER_LEN + COUNTRY_CODE_LEN + (SUB_BAND_LEN * MAX_SUB_BANDS)) -int woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, - mlan_ds_ps_mgmt *ps_mgmt); +/** DOMAIN_INFO param size of dfs_region */ +#define DFS_REGION_LEN 1 +/** MAX reg domain TLV length*/ +#define MAX_REG_DOMAIN_TLV_LEN (TLV_HEADER_LEN + DFS_REGION_LEN) + +/** Get/Set channel DFS state */ +int woal_11h_chan_dfs_state(moal_private *priv, t_u8 action, + mlan_ds_11h_chan_dfs_state *ch_dfs_state); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +void woal_update_channels_dfs_state(moal_private *priv, t_u8 channel, + t_u8 bandwidth, t_u8 dfs_state); +#endif +#endif + +mlan_status woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, + mlan_ds_ps_mgmt *ps_mgmt); void woal_uap_set_multicast_list(struct net_device *dev); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, - void __user * data, int cmd); + void __user *data, int cmd); #else int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); #endif int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data); -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + int woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option, pmlan_ds_11h_chan_nop_info ch_info); -#endif -#endif + mlan_status woal_set_get_ap_channel(moal_private *priv, t_u16 action, t_u8 wait_option, - chan_band_info * uap_channel); + chan_band_info *uap_channel); #ifdef CONFIG_PROC_FS void woal_uap_get_version(moal_private *priv, char *version, int max_len); #endif @@ -571,10 +592,10 @@ int woal_uap_set_11ac_status(moal_private *priv, t_u8 action, t_u8 vht20_40, IEEEtypes_VHTCap_t *vhtcap_ie); -int woal_11ax_cfg(moal_private *priv, t_u8 action, - mlan_ds_11ax_he_cfg * he_cfg); +int woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg *he_cfg, + t_u8 wait_option); int woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band, - IEEEtypes_HECap_t * hecap_ie); + IEEEtypes_HECap_t *hecap_ie); int woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg, t_u16 ht_cap, t_u8 en); mlan_status woal_uap_set_11n_status(moal_private *priv,
diff --git a/wlan_sd8987/mlinux/moal_uap_cfg80211.c b/wlan_sd8987/mlinux/moal_uap_cfg80211.c index eae934f..dac5fa7 100755 --- a/wlan_sd8987/mlinux/moal_uap_cfg80211.c +++ b/wlan_sd8987/mlinux/moal_uap_cfg80211.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for uAP CFG80211. * * - * Copyright 2011-2021 NXP + * Copyright 2011-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -46,8 +46,8 @@ * @param reason_code ieee deauth reason code * @return 0 -- success, otherwise fail */ -static int -woal_deauth_station(moal_private *priv, u8 *mac_addr, u16 reason_code) +static int woal_deauth_station(moal_private *priv, u8 *mac_addr, + u16 reason_code) { mlan_ioctl_req *ioctl_req = NULL; mlan_ds_bss *bss = NULL; @@ -91,10 +91,10 @@ * @param reason_code ieee deauth reason code * @return 0 -- success, otherwise fail */ -static int -woal_deauth_assoc_station(moal_private *priv, u8 *mac_addr, u16 reason_code) +static int woal_deauth_assoc_station(moal_private *priv, u8 *mac_addr, + u16 reason_code) { - int ret = -EFAULT; + int ret = 0; int i = 0; mlan_ds_get_info *info = NULL; mlan_ioctl_req *ioctl_req = NULL; @@ -107,9 +107,8 @@ return -EINVAL; } - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { LEAVE(); return -ENOMEM; @@ -121,8 +120,10 @@ ioctl_req->action = MLAN_ACT_GET; status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); - if (status != MLAN_STATUS_SUCCESS) + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; goto done; + } if (!info->param.sta_list.sta_count) { PRINTM(MCMND, "wlan: skip deauth to station " MACSTR "\n", MAC2STR(mac_addr)); @@ -130,9 +131,18 @@ } for (i = 0; i < info->param.sta_list.sta_count; i++) { - if (!memcmp(info->param.sta_list.info[i].mac_address, - mac_addr, ETH_ALEN)) + if (!memcmp(info->param.sta_list.info[i].mac_address, mac_addr, + ETH_ALEN)) { + PRINTM(MMSG, "wlan: deauth station " MACSTR "\n", + MAC2STR(mac_addr)); ret = woal_deauth_station(priv, mac_addr, reason_code); +#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) + cfg80211_del_sta(priv->netdev, mac_addr, + GFP_KERNEL); +#endif + break; + } } done: @@ -151,8 +161,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_deauth_all_station(moal_private *priv) +static int woal_deauth_all_station(moal_private *priv) { int ret = -EFAULT; int i = 0; @@ -168,9 +177,8 @@ } PRINTM(MIOCTL, "del all station\n"); /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -189,10 +197,9 @@ for (i = 0; i < info->param.sta_list.sta_count; i++) { PRINTM(MIOCTL, "deauth station " MACSTR "\n", MAC2STR(info->param.sta_list.info[i].mac_address)); - ret = woal_deauth_station(priv, - info->param.sta_list.info[i]. - mac_address, - REASON_CODE_DEAUTH_LEAVING); + ret = woal_deauth_station( + priv, info->param.sta_list.info[i].mac_address, + REASON_CODE_DEAUTH_LEAVING); } woal_sched_timeout(200); done: @@ -209,8 +216,8 @@ * * @return MTRUE/MFALSE */ -static t_u8 -woal_check_rsn_ie(IEEEtypes_Rsn_t *rsn_ie, mlan_uap_bss_param *sys_config) +static t_u8 woal_check_rsn_ie(IEEEtypes_Rsn_t *rsn_ie, + mlan_uap_bss_param *sys_config) { int left = 0; int count = 0; @@ -288,8 +295,8 @@ * * @return MTRUE/MFALSE */ -static t_u8 -woal_check_wpa_ie(IEEEtypes_Wpa_t *wpa_ie, mlan_uap_bss_param *sys_config) +static t_u8 woal_check_wpa_ie(IEEEtypes_Wpa_t *wpa_ie, + mlan_uap_bss_param *sys_config) { int left = 0; int count = 0; @@ -356,8 +363,8 @@ * * @return MTRUE/MFALSE */ -static t_u8 -woal_find_wpa_ies(const t_u8 *ie, int len, mlan_uap_bss_param *sys_config) +static t_u8 woal_find_wpa_ies(const t_u8 *ie, int len, + mlan_uap_bss_param *sys_config) { int bytes_left = len; const t_u8 *pcurrent_ptr = ie; @@ -368,7 +375,7 @@ t_u8 ret = MFALSE; IEEEtypes_ElementId_e element_id; IEEEtypes_VendorSpecific_t *pvendor_ie; - const t_u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 }; + const t_u8 wpa_oui[4] = {0x00, 0x50, 0xf2, 0x01}; while (bytes_left >= 2) { element_id = (IEEEtypes_ElementId_e)(*((t_u8 *)pcurrent_ptr)); @@ -382,17 +389,17 @@ } switch (element_id) { case RSN_IE: - wpa2 = woal_check_rsn_ie((IEEEtypes_Rsn_t *) - pcurrent_ptr, sys_config); + wpa2 = woal_check_rsn_ie( + (IEEEtypes_Rsn_t *)pcurrent_ptr, sys_config); break; case VENDOR_SPECIFIC_221: pvendor_ie = (IEEEtypes_VendorSpecific_t *)pcurrent_ptr; if (!memcmp(pvendor_ie->vend_hdr.oui, wpa_oui, sizeof(pvendor_ie->vend_hdr.oui)) && (pvendor_ie->vend_hdr.oui_type == wpa_oui[3])) { - wpa = woal_check_wpa_ie((IEEEtypes_Wpa_t *) - pcurrent_ptr, - sys_config); + wpa = woal_check_wpa_ie( + (IEEEtypes_Wpa_t *)pcurrent_ptr, + sys_config); } break; default: @@ -424,9 +431,8 @@ * * @return N/A */ -static t_void -woal_set_wmm_ies(moal_private *priv, const t_u8 *ie, int len, - mlan_uap_bss_param *sys_config) +static t_void woal_set_wmm_ies(moal_private *priv, const t_u8 *ie, int len, + mlan_uap_bss_param *sys_config) { int bytes_left = len; const t_u8 *pcurrent_ptr = ie; @@ -434,7 +440,7 @@ t_u8 element_len; IEEEtypes_VendorSpecific_t *pvendor_ie; IEEEtypes_ElementId_e element_id; - const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; + const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; while (bytes_left >= 2) { element_id = (IEEEtypes_ElementId_e)(*((t_u8 *)pcurrent_ptr)); @@ -459,14 +465,13 @@ * it matches the size expected for the * WMM Parameter IE. */ - moal_memcpy_ext(priv->phandle, - &sys_config->wmm_para, - pcurrent_ptr + - sizeof - (IEEEtypes_Header_t), - element_len, - sizeof(sys_config-> - wmm_para)); + moal_memcpy_ext( + priv->phandle, + &sys_config->wmm_para, + pcurrent_ptr + + sizeof(IEEEtypes_Header_t), + element_len, + sizeof(sys_config->wmm_para)); /** set uap_host_based_config to true */ sys_config->uap_host_based_config = MTRUE; @@ -491,9 +496,8 @@ * @param params A pointer to cfg80211_ap_settings structure * @return 0 -- success, otherwise fail */ -static t_u8 -woal_check_11ac_capability(moal_private *priv, t_u8 band, - struct cfg80211_ap_settings *params) +static t_u8 woal_check_11ac_capability(moal_private *priv, t_u8 band, + struct cfg80211_ap_settings *params) #else /** * @brief initialize AP or GO bss config @@ -501,8 +505,7 @@ * @param priv A pointer to moal private structure * @return 0 -- success, otherwise fail */ -static t_u8 -woal_check_11ac_capability(moal_private *priv, t_u8 band) +static t_u8 woal_check_11ac_capability(moal_private *priv, t_u8 band) #endif { mlan_fw_info fw_info; @@ -545,15 +548,14 @@ * @param params A pointer to cfg80211_ap_settings structure * @return 0 -- success, otherwise fail */ -static t_u8 -woal_check_11ax_capability(moal_private *priv, t_u8 band, - struct cfg80211_ap_settings *params) +static t_u8 woal_check_11ax_capability(moal_private *priv, t_u8 band, + struct cfg80211_ap_settings *params) { mlan_fw_info fw_info; t_u8 enable_11ax = MFALSE; #if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 20, 0) mlan_ds_11ax_he_cfg he_cfg; - t_u8 he_txrx_mcs_support[4] = { 0xff, 0xff, 0xff, 0xff }; + t_u8 he_txrx_mcs_support[4] = {0xff, 0xff, 0xff, 0xff}; #endif ENTER(); memset(&fw_info, 0, sizeof(mlan_fw_info)); @@ -579,7 +581,7 @@ he_cfg.band = MBIT(1); else if (band == BAND_2GHZ) he_cfg.band = MBIT(0); - if (0 == woal_11ax_cfg(priv, MLAN_ACT_GET, &he_cfg)) { + if (0 == woal_11ax_cfg(priv, MLAN_ACT_GET, &he_cfg, MOAL_IOCTL_WAIT)) { if (he_cfg.he_cap.len && (he_cfg.he_cap.ext_id == HE_CAPABILITY)) { if (memcmp(he_cfg.he_cap.he_txrx_mcs_support, @@ -603,8 +605,7 @@ * * @return ht_cap */ -static t_u16 -woal_get_htcap_info(const t_u8 *ie, int len) +static t_u16 woal_get_htcap_info(const t_u8 *ie, int len) { t_u16 ht_cap_info = 0; IEEEtypes_HTCap_t *htcap_ie = NULL; @@ -614,7 +615,8 @@ /* hostap has converted ht_cap_info to little endian, here * conver to host endian */ ht_cap_info = woal_le16_to_cpu(htcap_ie->ht_cap.ht_cap_info); - PRINTM(MMSG, "Get ht_cap from beacon ies: 0x%x\n", ht_cap_info); + PRINTM(MINFO, "Get ht_cap from beacon ies: 0x%x\n", + ht_cap_info); } return ht_cap_info; } @@ -627,8 +629,7 @@ * * @return Pointer to vht_cap ie */ -static IEEEtypes_VHTCap_t * -woal_get_vhtcap_info(const t_u8 *ie, int len) +static IEEEtypes_VHTCap_t *woal_get_vhtcap_info(const t_u8 *ie, int len) { IEEEtypes_VHTCap_t *vhtcap_ie = NULL; vhtcap_ie = (IEEEtypes_VHTCap_t *)woal_parse_ie_tlv(ie, len, @@ -647,8 +648,7 @@ * * @return Pointer to vht_opr ie */ -static IEEEtypes_VHTOprat_t * -woal_get_vht_oprat_ie(const t_u8 *ie, int len) +static IEEEtypes_VHTOprat_t *woal_get_vht_oprat_ie(const t_u8 *ie, int len) { IEEEtypes_VHTOprat_t *vht_oprat_ie = NULL; vht_oprat_ie = (IEEEtypes_VHTOprat_t *)woal_parse_ie_tlv(ie, len, @@ -662,7 +662,7 @@ #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /** Starting Frequency for 11A band */ -#define START_FREQ_11A_BAND 5000 /* in MHz */ +#define START_FREQ_11A_BAND 5000 /* in MHz */ /** * @brief convert cfg80211_chan_def to Band_Config * @@ -672,17 +672,22 @@ * * @return N/A */ -static void -woal_convert_chan_to_bandconfig(moal_private *priv, - Band_Config_t *bandcfg, - struct cfg80211_chan_def *chandef) +static void woal_convert_chan_to_bandconfig(moal_private *priv, + Band_Config_t *bandcfg, + struct cfg80211_chan_def *chandef) { ENTER(); - - if (chandef->chan->hw_value <= MAX_BG_CHANNEL) + memset(bandcfg, 0, sizeof(Band_Config_t)); + switch (chandef->chan->band) { + case NL80211_BAND_2GHZ: bandcfg->chanBand = BAND_2GHZ; - else + break; + case NL80211_BAND_5GHZ: bandcfg->chanBand = BAND_5GHZ; + break; + default: + break; + } switch (chandef->width) { case NL80211_CHAN_WIDTH_20_NOHT: case NL80211_CHAN_WIDTH_20: @@ -696,9 +701,8 @@ bandcfg->chan2Offset = SEC_CHAN_BELOW; break; case NL80211_CHAN_WIDTH_80: - bandcfg->chan2Offset = - woal_get_second_channel_offset(priv, - chandef->chan->hw_value); + bandcfg->chan2Offset = woal_get_second_channel_offset( + priv, chandef->chan->hw_value); bandcfg->chanWidth = CHAN_BW_80MHZ; break; case NL80211_CHAN_WIDTH_80P80: @@ -706,10 +710,16 @@ default: break; } + PRINTM(MCMND, + "cfg80211 AP: channel=%d, chanBand=0x%x chanWidth=0x%x chan2Offset=0x%x\n", + chandef->chan->hw_value, bandcfg->chanBand, bandcfg->chanWidth, + bandcfg->chan2Offset); LEAVE(); return; } +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /** * @brief Enable radar detect for DFS channel * @@ -717,8 +727,8 @@ * @param chandef A pointer to cfg80211_chan_def structure * @return N/A */ -static void -woal_enable_dfs_support(moal_private *priv, struct cfg80211_chan_def *chandef) +static void woal_enable_dfs_support(moal_private *priv, + struct cfg80211_chan_def *chandef) { mlan_ioctl_req *req = NULL; mlan_ds_11h_chan_rep_req *pchan_rpt_req = NULL; @@ -770,10 +780,9 @@ * @param tail_len tail IE buffer length * * @return N/A */ -static void -woal_set_uap_rates(moal_private *priv, mlan_uap_bss_param *bss_cfg, - const t_u8 *head_ie, int head_len, - const t_u8 *tail_ie, int tail_len) +static void woal_set_uap_rates(moal_private *priv, mlan_uap_bss_param *bss_cfg, + const t_u8 *head_ie, int head_len, + const t_u8 *tail_ie, int tail_len) { pIEEEtypes_Header_t rate_ie; pIEEEtypes_Header_t ext_rate_ie; @@ -809,9 +818,8 @@ * @param params A pointer to cfg80211_ap_settings structure * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_beacon_config(moal_private *priv, - struct cfg80211_ap_settings *params) +static int woal_cfg80211_beacon_config(moal_private *priv, + struct cfg80211_ap_settings *params) #else /** * @brief initialize AP or GO bss config @@ -820,9 +828,8 @@ * @param params A pointer to beacon_parameters structure * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_beacon_config(moal_private *priv, - struct beacon_parameters *params) +static int woal_cfg80211_beacon_config(moal_private *priv, + struct beacon_parameters *params) #endif { struct wiphy *wiphy = NULL; @@ -837,16 +844,13 @@ struct ieee80211_mgmt *head = NULL; t_u16 capab_info = 0; #endif - t_u8 rates_bg[13] = { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, - 0x24, 0x30, 0x48, 0x60, 0x6c, 0x00 - }; - t_u8 rates_a[9] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00 - }; + t_u8 rates_bg[13] = {0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, + 0x24, 0x30, 0x48, 0x60, 0x6c, 0x00}; + t_u8 rates_a[9] = {0x8c, 0x12, 0x98, 0x24, 0xb0, + 0x48, 0x60, 0x6c, 0x00}; #ifdef WIFI_DIRECT_SUPPORT - t_u8 rates_wfd[9] = { 0x8c, 0x12, 0x18, 0x24, 0x30, - 0x48, 0x60, 0x6c, 0x00 - }; + t_u8 rates_wfd[9] = {0x8c, 0x12, 0x18, 0x24, 0x30, + 0x48, 0x60, 0x6c, 0x00}; #endif t_u8 chan2Offset = SEC_CHAN_NONE; t_u8 enable_11n = MTRUE; @@ -863,9 +867,11 @@ int GoAgeoutTime = priv->phandle->params.GoAgeoutTime; #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - mlan_ds_11h_chan_nop_info chan_nop_info; Band_Config_t bandcfg; #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + mlan_ds_11h_chan_nop_info chan_nop_info; +#endif ENTER(); if (!params) { @@ -902,7 +908,7 @@ #ifdef WIFI_DIRECT_SUPPORT && priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT #endif - ) { + ) { ret = -EFAULT; goto done; } @@ -960,6 +966,7 @@ if (params->dtim_period) sys_config->dtim_period = params->dtim_period; } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /** back up ap's channel */ moal_memcpy_ext(priv->phandle, &priv->chan, ¶ms->chandef, @@ -967,17 +974,20 @@ #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + woal_convert_chan_to_bandconfig(priv, &bandcfg, ¶ms->chandef); +#endif + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) if (priv->phandle->usr_nop_period_sec) { PRINTM(MCMND, "Checking if AP's channel %d is under NOP\n", priv->channel); - woal_convert_chan_to_bandconfig(priv, &bandcfg, - ¶ms->chandef); memset(&chan_nop_info, 0, sizeof(chan_nop_info)); chan_nop_info.curr_chan = priv->channel; chan_nop_info.chan_width = bandcfg.chanWidth; if (params->chandef.width >= NL80211_CHAN_WIDTH_20) chan_nop_info.new_chan.is_11n_enabled = MTRUE; chan_nop_info.new_chan.bandcfg = bandcfg; + chan_nop_info.check_new_chan = MTRUE; woal_uap_get_channel_nop_info(priv, MOAL_IOCTL_WAIT, &chan_nop_info); if (chan_nop_info.chan_under_nop) { @@ -993,6 +1003,7 @@ #endif if (priv->channel) { + woal_check_mc_connection(priv, MOAL_IOCTL_WAIT, priv->channel); memset(sys_config->rates, 0, sizeof(sys_config->rates)); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) @@ -1016,9 +1027,8 @@ case NL80211_CHAN_WIDTH_80: case NL80211_CHAN_WIDTH_80P80: case NL80211_CHAN_WIDTH_160: - chan2Offset = - woal_get_second_channel_offset(priv, - priv->channel); + chan2Offset = woal_get_second_channel_offset( + priv, priv->channel); break; default: PRINTM(MWARN, "Unknown channel width: %d\n", @@ -1064,19 +1074,16 @@ } else { sys_config->bandcfg.chanBand = BAND_5GHZ; #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - chan2Offset = - woal_get_second_channel_offset(priv, - priv->channel); + chan2Offset = woal_get_second_channel_offset( + priv, priv->channel); #endif #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) /* Force enable 40MHZ on WFD interface */ if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - chan2Offset = - woal_get_second_channel_offset(priv, - priv-> - channel); + chan2Offset = woal_get_second_channel_offset( + priv, priv->channel); #endif #endif #ifdef WIFI_DIRECT_SUPPORT @@ -1103,25 +1110,26 @@ params->head_len, params->tail, params->tail_len); #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - enable_11ac = woal_check_11ac_capability(priv, - sys_config->bandcfg. - chanBand, params); - if (enable_11ac && ((priv->chan.width == NL80211_CHAN_WIDTH_20) - || (priv->chan.width == - NL80211_CHAN_WIDTH_40))) - vht20_40 = MTRUE; -#else - enable_11ac = woal_check_11ac_capability(priv, - sys_config->bandcfg. - chanBand); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + moal_memcpy_ext(priv->phandle, &sys_config->bandcfg, &bandcfg, + sizeof(bandcfg), sizeof(bandcfg)); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - enable_11ax = - woal_check_11ax_capability(priv, - sys_config->bandcfg.chanBand, - params); + enable_11ac = woal_check_11ac_capability( + priv, sys_config->bandcfg.chanBand, params); + if (enable_11ac && + ((priv->chan.width == NL80211_CHAN_WIDTH_20) || + (priv->chan.width == NL80211_CHAN_WIDTH_40))) + vht20_40 = MTRUE; +#else + enable_11ac = woal_check_11ac_capability( + priv, sys_config->bandcfg.chanBand); +#endif + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + enable_11ax = woal_check_11ax_capability( + priv, sys_config->bandcfg.chanBand, params); #endif /* Disable GreenField by default */ @@ -1141,17 +1149,21 @@ sys_config->ht_cap_info = (ht_cap & (wiphy->bands[IEEE80211_BAND_2GHZ] - ->ht_cap.cap & 0x13ff)) | 0x0c; + ->ht_cap.cap & + 0x13ff)) | + 0x0c; else sys_config->ht_cap_info = (ht_cap & (wiphy->bands[IEEE80211_BAND_5GHZ] - ->ht_cap.cap & 0x13ff)) | 0x0c; + ->ht_cap.cap & + 0x13ff)) | + 0x0c; } PRINTM(MCMND, "11n=%d, ht_cap=0x%x, channel=%d, bandcfg:chanBand=0x%x chanWidth=0x%x chan2Offset=0x%x scanMode=0x%x\n", - enable_11n, sys_config->ht_cap_info, - priv->channel, sys_config->bandcfg.chanBand, + enable_11n, sys_config->ht_cap_info, priv->channel, + sys_config->bandcfg.chanBand, sys_config->bandcfg.chanWidth, sys_config->bandcfg.chan2Offset, sys_config->bandcfg.scanMode); @@ -1310,7 +1322,7 @@ (priv->cipher == WLAN_CIPHER_SUITE_WEP104)) { sys_config->protocol = PROTOCOL_STATIC_WEP; sys_config->key_mgmt = KEY_MGMT_NONE; - sys_config->.wpa_cfg.length = 0; + sys_config->wpa_cfg.length = 0; moal_memcpy_ext(priv->phandle, &sys_config->wep_cfg.key0, &priv->uap_wep_key[0], sizeof(wep_key), sizeof(sys_config->wep_cfg.key0)); @@ -1326,9 +1338,8 @@ } else { /** Get cipher and key_mgmt from RSN/WPA IE */ if (capab_info & WLAN_CAPABILITY_PRIVACY) { - wpa_ies = - woal_find_wpa_ies(params->tail, - params->tail_len, sys_config); + wpa_ies = woal_find_wpa_ies( + params->tail, params->tail_len, sys_config); if (wpa_ies == MFALSE) { /* hard code setting to wpa2-psk */ sys_config->protocol = PROTOCOL_WPA2; @@ -1343,7 +1354,7 @@ #endif if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { - /*find and set wmm ie */ + /*find and set wmm ie*/ woal_set_wmm_ies(priv, ie, ie_len, sys_config); } /* If the security mode is configured as WEP or WPA-PSK, @@ -1353,12 +1364,20 @@ (sys_config->protocol == PROTOCOL_WPA)) enable_11n = MFALSE; if (!enable_11n) { - woal_set_uap_ht_tx_cfg(priv, sys_config->bandcfg, ht_cap, - MFALSE); + if (woal_set_uap_ht_tx_cfg(priv, sys_config->bandcfg, ht_cap, + MFALSE)) { + PRINTM(MMSG, "woal_set_uap_ht_tx_cfg fail\n"); + ret = -EFAULT; + goto done; + } woal_uap_set_11n_status(priv, sys_config, MLAN_ACT_DISABLE); } else { - woal_set_uap_ht_tx_cfg(priv, sys_config->bandcfg, ht_cap, - MTRUE); + if (woal_set_uap_ht_tx_cfg(priv, sys_config->bandcfg, ht_cap, + MTRUE)) { + PRINTM(MMSG, "woal_set_uap_ht_tx_cfg fail\n"); + ret = -EFAULT; + goto done; + } woal_uap_set_11n_status(priv, sys_config, MLAN_ACT_ENABLE); woal_set_get_tx_bf_cap(priv, MLAN_ACT_GET, &sys_config->tx_bf_cap); @@ -1366,20 +1385,19 @@ if (enable_11ac && enable_11n) { vhtcap_ie = woal_get_vhtcap_info(ie, ie_len); vhtopr_ie = woal_get_vht_oprat_ie(ie, ie_len); - //Enable VHT80 + // Enable VHT80 if (vhtopr_ie && vhtopr_ie->chan_width) vht20_40 = 0; - woal_uap_set_11ac_status(priv, MLAN_ACT_ENABLE, - vht20_40, vhtcap_ie); + woal_uap_set_11ac_status(priv, MLAN_ACT_ENABLE, vht20_40, + vhtcap_ie); } else { - woal_uap_set_11ac_status(priv, MLAN_ACT_DISABLE, - vht20_40, NULL); + woal_uap_set_11ac_status(priv, MLAN_ACT_DISABLE, vht20_40, + NULL); } if (enable_11ax && enable_11n) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) - hecap_ie = - (IEEEtypes_HECap_t *) woal_parse_ext_ie_tlv(ie, ie_len, - HE_CAPABILITY); + hecap_ie = (IEEEtypes_HECap_t *)woal_parse_ext_ie_tlv( + ie, ie_len, HE_CAPABILITY); #endif woal_uap_set_11ax_status(priv, MLAN_ACT_ENABLE, sys_config->bandcfg.chanBand, @@ -1406,7 +1424,7 @@ goto done; } - /** Set wacp_mode for uAP/P2P-GO */ + /** Set wacp_mode for uAP/P2P-GO */ if (priv->phandle->params.wacp_mode) { PRINTM(MIOCTL, "wacp_mode: %d\n", priv->phandle->params.wacp_mode); @@ -1417,6 +1435,7 @@ goto done; } } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) woal_enable_dfs_support(priv, &priv->chan); #endif @@ -1426,6 +1445,157 @@ return ret; } +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) +/** + * @brief Request the driver to add a monitor interface + * + * @param wiphy A pointer to wiphy structure + * @param name Virtual interface name + * @param name_assign_type Interface name assignment type + * @param flags Flags for the virtual interface + * @param params A pointer to vif_params structure + * @param new_dev Netdevice to be passed out + * + * @return 0 -- success, otherwise fail + */ +static int woal_cfg80211_add_mon_if(struct wiphy *wiphy, const char *name, + unsigned char name_assign_type, u32 *flags, + struct vif_params *params, + struct net_device **new_dev) +#else +/** + * @brief Request the driver to add a monitor interface + * + * @param wiphy A pointer to wiphy structure + * @param name Virtual interface name + * @param flags Flags for the virtual interface + * @param params A pointer to vif_params structure + * @param new_dev Netdevice to be passed out + * + * @return 0 -- success, otherwise fail + */ +static int woal_cfg80211_add_mon_if(struct wiphy *wiphy, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) + const +#endif + char *name, + u32 *flags, struct vif_params *params, + struct net_device **new_dev) +#endif +{ + int ret = 0; + moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); + moal_private *priv = + (moal_private *)woal_get_priv(handle, MLAN_BSS_ROLE_STA); + monitor_iface *mon_if = NULL; + struct net_device *ndev = NULL; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + chan_band_info chan_info; +#endif + unsigned char name_assign_type_tmp = 0; + + ENTER(); + + ASSERT_RTNL(); + + if (handle->mon_if) { + PRINTM(MERROR, "%s: monitor interface exist: %s basedev %s\n", + __func__, handle->mon_if->mon_ndev->name, + handle->mon_if->base_ndev->name); + ret = -EFAULT; + goto fail; + } + if (!priv) { + PRINTM(MERROR, "add_mon_if: priv is NULL\n"); + ret = -EFAULT; + goto fail; + } + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + name_assign_type_tmp = name_assign_type; +#endif + mon_if = woal_prepare_mon_if(priv, name, name_assign_type_tmp); + if (!mon_if) { + PRINTM(MFATAL, "Prepare mon_if fail.\n"); + goto fail; + } + ndev = mon_if->mon_ndev; + dev_net_set(ndev, wiphy_net(wiphy)); + + moal_memcpy_ext(priv->phandle, ndev->perm_addr, wiphy->perm_addr, + ETH_ALEN, sizeof(ndev->perm_addr)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(ndev, ndev->perm_addr); +#else + moal_memcpy_ext(priv->phandle, ndev->dev_addr, ndev->perm_addr, + ETH_ALEN, MAX_ADDR_LEN); +#endif + SET_NETDEV_DEV(ndev, wiphy_dev(wiphy)); + ndev->ieee80211_ptr = &mon_if->wdev; + mon_if->wdev.iftype = NL80211_IFTYPE_MONITOR; + mon_if->wdev.wiphy = wiphy; + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + memset(&chan_info, 0x00, sizeof(chan_info)); + mon_if->band_chan_cfg.channel = 0; + if (!woal_is_any_interface_active(handle)) { + /* Set default band channel config */ + mon_if->band_chan_cfg.band = BAND_B | BAND_G; + mon_if->band_chan_cfg.band |= BAND_GN; + mon_if->band_chan_cfg.channel = 1; + mon_if->band_chan_cfg.chan_bandwidth = CHANNEL_BW_20MHZ; + memset(&chan_info, 0x00, sizeof(chan_info)); + chan_info.channel = 1; + chan_info.is_11n_enabled = MTRUE; + } + mon_if->flag = 0x7; + if (MLAN_STATUS_SUCCESS != + woal_set_net_monitor(priv, MOAL_IOCTL_WAIT, MTRUE, mon_if->flag, + &mon_if->band_chan_cfg)) { + PRINTM(MERROR, "%s: woal_set_net_monitor fail\n", __func__); + ret = -EFAULT; + goto fail; + } + if (woal_is_any_interface_active(handle)) { + /* set current band channel config */ + chan_info.bandcfg.chanBand = mon_if->band_chan_cfg.band; + if (mon_if->band_chan_cfg.band & + (BAND_B | BAND_G | BAND_GN | BAND_GAC)) + chan_info.bandcfg.chanBand = BAND_2GHZ; + else + /* TODO: Add support for BAND_4GHZ */ + chan_info.bandcfg.chanBand = BAND_5GHZ; + chan_info.bandcfg.chanWidth = + mon_if->band_chan_cfg.chan_bandwidth; + chan_info.channel = mon_if->band_chan_cfg.channel; + chan_info.is_11n_enabled = MTRUE; + } + if (MLAN_STATUS_FAILURE == + woal_chandef_create(priv, &mon_if->chandef, &chan_info)) { + /* stop monitor mode on error */ + woal_set_net_monitor(priv, MOAL_IOCTL_WAIT, MFALSE, 0, NULL); + ret = -EFAULT; + goto fail; + } +#endif + + ret = register_netdevice(ndev); + if (ret) { + PRINTM(MFATAL, "register net_device failed, ret=%d\n", ret); + free_netdev(ndev); + goto fail; + } + + handle->mon_if = mon_if; + + if (new_dev) + *new_dev = ndev; + +fail: + LEAVE(); + return ret; +} + #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION /** @@ -1436,8 +1606,7 @@ * * @return N/A */ -static void -woal_virt_if_setup(struct net_device *dev) +static void woal_virt_if_setup(struct net_device *dev) { ENTER(); ether_setup(dev); @@ -1461,10 +1630,10 @@ * * @return A pointer to the new priv structure */ -static moal_private * -woal_alloc_virt_interface(moal_handle *handle, t_u8 bss_index, - unsigned char name_assign_type, - t_u8 bss_type, const char *name) +static moal_private *woal_alloc_virt_interface(moal_handle *handle, + t_u8 bss_index, + unsigned char name_assign_type, + t_u8 bss_type, const char *name) #else /** * @brief This function adds a new interface. It will @@ -1476,12 +1645,12 @@ * * @return A pointer to the new priv structure */ -moal_private * -woal_alloc_virt_interface(moal_handle *handle, t_u8 bss_index, t_u8 bss_type, +moal_private *woal_alloc_virt_interface(moal_handle *handle, t_u8 bss_index, + t_u8 bss_type, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) - const + const #endif - char *name) + char *name) #endif { struct net_device *dev = NULL; @@ -1534,6 +1703,9 @@ INIT_LIST_HEAD(&priv->tx_stat_queue); spin_lock_init(&priv->tx_stat_lock); + INIT_LIST_HEAD(&priv->mcast_list); + spin_lock_init(&priv->mcast_lock); + spin_lock_init(&priv->connect_lock); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) @@ -1565,12 +1737,11 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_cfg80211_add_virt_if(struct wiphy *wiphy, const char *name, - unsigned char name_assign_type, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params, - struct net_device **new_dev) +static int woal_cfg80211_add_virt_if(struct wiphy *wiphy, const char *name, + unsigned char name_assign_type, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params, + struct net_device **new_dev) #else /** * @brief Request the driver to add a virtual interface @@ -1584,15 +1755,14 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_add_virt_if(struct wiphy *wiphy, +int woal_cfg80211_add_virt_if(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) - const + const #endif - char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params, - struct net_device **new_dev) + char *name, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params, + struct net_device **new_dev) #endif { int ret = 0; @@ -1628,7 +1798,8 @@ break; } } - if (priv->phandle->drv_mode.intf_num == priv->phandle->priv_num) { + if (priv->phandle->drv_mode.intf_num == + priv->phandle->priv_num) { LEAVE(); return -ENOMEM; } @@ -1693,7 +1864,7 @@ woal_cfg80211_init_p2p_client(new_priv); else if (type == NL80211_IFTYPE_P2P_GO) woal_cfg80211_init_p2p_go(new_priv); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) ret = cfg80211_register_netdevice(ndev); #else ret = register_netdevice(ndev); @@ -1702,7 +1873,7 @@ handle->priv[new_priv->bss_index] = NULL; handle->priv_num--; if (ndev->reg_state == NETREG_REGISTERED) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) cfg80211_unregister_netdevice(ndev); #else unregister_netdevice(ndev); @@ -1734,8 +1905,7 @@ * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, * otherwise fail */ -static mlan_status -woal_bss_remove(moal_private *priv) +static mlan_status woal_bss_remove(moal_private *priv) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -1773,8 +1943,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev) +int woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev) { int ret = 0; int i = 0; @@ -1831,42 +2000,35 @@ woal_cancel_scan(vir_priv, MOAL_IOCTL_WAIT); woal_flush_tx_stat_queue(vir_priv); + woal_flush_mcast_list(vir_priv); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) /* cancel previous remain on channel to avoid firmware hang */ if (priv->phandle->remain_on_channel) { t_u8 channel_status; remain_priv = - priv->phandle->priv[priv->phandle-> - remain_bss_index]; + priv->phandle + ->priv[priv->phandle->remain_bss_index]; if (remain_priv) { - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, - &channel_status, NULL, 0, 0)) + if (woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) PRINTM(MERROR, "del_virt_if: Fail to cancel remain on channel\n"); if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle-> - chan, + priv->phandle->cookie, + &priv->phandle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -1897,7 +2059,7 @@ vir_priv->phandle->priv[vir_priv->bss_index] = NULL; priv->phandle->priv_num--; if (dev->reg_state == NETREG_REGISTERED) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) cfg80211_unregister_netdevice(dev); #else unregister_netdevice(dev); @@ -1908,7 +2070,6 @@ #endif #endif -#if defined(WIFI_DIRECT_SUPPORT) /** * @brief This function removes an virtual interface. * @@ -1916,8 +2077,7 @@ * * @return N/A */ -void -woal_remove_virtual_interface(moal_handle *handle) +void woal_remove_virtual_interface(moal_handle *handle) { #ifdef WIFI_DIRECT_SUPPORT moal_private *priv = NULL; @@ -1941,9 +2101,9 @@ netif_device_detach(priv->netdev); if (priv->netdev->reg_state == NETREG_REGISTERED) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) - cfg80211_unregister_netdevice(priv-> - netdev); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + cfg80211_unregister_netdevice( + priv->netdev); #else unregister_netdevice(priv->netdev); #endif @@ -1953,13 +2113,18 @@ } } #endif + if (handle->mon_if) { + netif_device_detach(handle->mon_if->mon_ndev); + if (handle->mon_if->mon_ndev->reg_state == NETREG_REGISTERED) + unregister_netdevice(handle->mon_if->mon_ndev); + handle->mon_if = NULL; + } rtnl_unlock(); #ifdef WIFI_DIRECT_SUPPORT handle->priv_num -= vir_intf; #endif LEAVE(); } -#endif /** * @brief This function check if uap interface is ready @@ -1969,9 +2134,8 @@ * * @return MTRUE/MFALSE; */ -static t_u8 -woal_uap_interface_ready(struct wiphy *wiphy, char *name, - struct net_device **new_dev) +static t_u8 woal_uap_interface_ready(struct wiphy *wiphy, char *name, + struct net_device **new_dev) { moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); moal_private *priv = NULL; @@ -2005,11 +2169,11 @@ * * @return A pointer to net_device -- success, otherwise null */ -struct net_device * -woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, - char *name, - enum nl80211_iftype type, - u32 *flags, struct vif_params *params) +struct net_device *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, + char *name, + enum nl80211_iftype type, + u32 *flags, + struct vif_params *params) #else /** * @brief Request the driver to add a virtual interface @@ -2022,10 +2186,9 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) +int woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params) #endif #else #if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 1, 0) @@ -2040,14 +2203,14 @@ * * @return A pointer to wireless_dev -- success, otherwise null */ -struct wireless_dev * -woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, +struct wireless_dev *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) - const + const #endif - char *name, - enum nl80211_iftype type, - u32 *flags, struct vif_params *params) + char *name, + enum nl80211_iftype type, + u32 *flags, + struct vif_params *params) #else /** * @brief Request the driver to add a virtual interface @@ -2074,15 +2237,22 @@ { struct net_device *ndev = NULL; int ret = 0; -#if defined(WIFI_DIRECT_SUPPORT) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) u32 *flags = ¶ms->flags; #endif -#endif ENTER(); PRINTM(MIOCTL, "add virtual intf: %d name: %s\n", type, name); switch (type) { + case NL80211_IFTYPE_MONITOR: +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + ret = woal_cfg80211_add_mon_if(wiphy, name, name_assign_type, + flags, params, &ndev); +#else + ret = woal_cfg80211_add_mon_if(wiphy, name, flags, params, + &ndev); +#endif + break; #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION case NL80211_IFTYPE_P2P_CLIENT: @@ -2137,8 +2307,7 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) +int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) #else /** * @brief Request the driver to del a virtual interface @@ -2148,8 +2317,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) +int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, + struct wireless_dev *wdev) #endif { int ret = 0; @@ -2166,6 +2335,25 @@ PRINTM(MIOCTL, "del virtual intf %s\n", dev->name); ASSERT_RTNL(); + if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_MONITOR) { + if ((handle->mon_if) && (handle->mon_if->mon_ndev == dev)) { +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + if (MLAN_STATUS_SUCCESS != + woal_set_net_monitor(handle->mon_if->priv, + MOAL_IOCTL_WAIT, MFALSE, 0, + NULL)) { + PRINTM(MERROR, + "%s: woal_set_net_monitor fail\n", + __func__); + ret = -EFAULT; + } +#endif + handle->mon_if = NULL; + } + unregister_netdevice(dev); + LEAVE(); + return ret; + } if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP) { for (i = 0; i < handle->priv_num; i++) { @@ -2180,21 +2368,41 @@ } } if (vir_priv && vir_priv->bss_type == MLAN_BSS_TYPE_UAP) { - woal_cfg80211_del_beacon(wiphy, dev); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + if (woal_cfg80211_del_beacon(wiphy, dev, 0)) +#else + if (woal_cfg80211_del_beacon(wiphy, dev)) +#endif + PRINTM(MERROR, "%s: del_beacon failed\n", + __func__); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + vir_priv->wdev->links[0].ap.beacon_interval = 0; +#else vir_priv->wdev->beacon_interval = 0; +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + memset(&vir_priv->wdev->links[0].ap.chandef, 0, + sizeof(vir_priv->wdev->links[0].ap.chandef)); +#else memset(&vir_priv->wdev->chandef, 0, sizeof(vir_priv->wdev->chandef)); #endif #endif +#endif +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + vir_priv->wdev->u.ap.ssid_len = 0; +#else vir_priv->wdev->ssid_len = 0; +#endif PRINTM(MMSG, "Skip del UAP virtual interface %s", dev->name); } LEAVE(); return ret; } + #ifdef WIFI_DIRECT_SUPPORT #if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION ret = woal_cfg80211_del_virt_if(wiphy, dev); @@ -2214,9 +2422,8 @@ * @param params A pointer to cfg80211_ap_settings structure * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ap_settings *params) +int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_settings *params) #else /** * @brief initialize AP or GO parameters @@ -2227,9 +2434,8 @@ * @param params A pointer to beacon_parameters structure * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, - struct beacon_parameters *params) +int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, + struct beacon_parameters *params) #endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -2250,32 +2456,24 @@ if (remain_priv) { PRINTM(MCMND, "Cancel Remain on Channel before Starting AP\n"); - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, - &channel_status, NULL, 0, 0)) + if (woal_cfg80211_remain_on_channel_cfg( + remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) PRINTM(MERROR, "add beacon: Fail to cancel remain on channel\n"); if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 6, 0) - remain_priv-> - netdev, + remain_priv->netdev, #else - remain_priv-> - wdev, + remain_priv->wdev, #endif - priv-> - phandle-> - cookie, - &priv-> - phandle-> - chan, + priv->phandle->cookie, + &priv->phandle->chan, #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - priv-> - phandle-> - channel_type, + priv->phandle->channel_type, #endif - GFP_ATOMIC); + GFP_ATOMIC); priv->phandle->cookie = 0; } priv->phandle->remain_on_channel = MFALSE; @@ -2292,11 +2490,11 @@ LEAVE(); return -EFAULT; } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - priv->channel = - ieee80211_frequency_to_channel(params->chandef.chan-> - center_freq); + priv->channel = ieee80211_frequency_to_channel( + params->chandef.chan->center_freq); #else priv->channel = ieee80211_frequency_to_channel(params->channel->center_freq); @@ -2330,22 +2528,21 @@ #endif NULL, 0, MGMT_MASK_BEACON | - MGMT_MASK_PROBE_RESP | - MGMT_MASK_ASSOC_RESP + MGMT_MASK_PROBE_RESP | + MGMT_MASK_ASSOC_RESP #endif - , MOAL_IOCTL_WAIT); + , + MOAL_IOCTL_WAIT); if (ret) goto done; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) if (params->beacon.beacon_ies && params->beacon.beacon_ies_len) { - ret = woal_cfg80211_mgmt_frame_ie(priv, - params->beacon.beacon_ies, - params->beacon.beacon_ies_len, - NULL, 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON_WPS_P2P, - MOAL_IOCTL_WAIT); + ret = woal_cfg80211_mgmt_frame_ie( + priv, params->beacon.beacon_ies, + params->beacon.beacon_ies_len, NULL, 0, NULL, 0, NULL, + 0, MGMT_MASK_BEACON_WPS_P2P, MOAL_IOCTL_WAIT); if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); goto done; @@ -2373,8 +2570,8 @@ if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) wait_option = MOAL_NO_WAIT; #endif - if (MLAN_STATUS_SUCCESS != - woal_uap_bss_ctrl(priv, wait_option, UAP_BSS_START)) { + if (woal_uap_bss_ctrl(priv, wait_option, UAP_BSS_START)) { + PRINTM(MERROR, "%s: start uap failed \n", __func__); priv->uap_host_based = MFALSE; ret = -EFAULT; goto done; @@ -2395,9 +2592,8 @@ * @param params A pointer to cfg80211_beacon_data structure * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *params) +int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_beacon_data *params) #else /** * @brief set AP or GO parameter @@ -2407,9 +2603,8 @@ * @param params A pointer to beacon_parameters structure * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, - struct beacon_parameters *params) +int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, + struct beacon_parameters *params) #endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -2421,12 +2616,10 @@ if (params != NULL) { #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 2, 0) if (params->tail && params->tail_len) { - ret = woal_cfg80211_mgmt_frame_ie(priv, params->tail, - params->tail_len, - NULL, 0, NULL, 0, - NULL, 0, - MGMT_MASK_BEACON, - MOAL_IOCTL_WAIT); + ret = woal_cfg80211_mgmt_frame_ie( + priv, params->tail, params->tail_len, NULL, 0, + NULL, 0, NULL, 0, MGMT_MASK_BEACON, + MOAL_IOCTL_WAIT); if (ret) goto done; } @@ -2440,27 +2633,21 @@ mask |= MGMT_MASK_ASSOC_RESP; PRINTM(MIOCTL, "Set beacon: mask=0x%x\n", mask); if (mask) { - ret = woal_cfg80211_mgmt_frame_ie(priv, params->tail, - params->tail_len, - params->proberesp_ies, - params-> - proberesp_ies_len, - params->assocresp_ies, - params-> - assocresp_ies_len, - NULL, 0, mask, - MOAL_IOCTL_WAIT); + ret = woal_cfg80211_mgmt_frame_ie( + priv, params->tail, params->tail_len, + params->proberesp_ies, + params->proberesp_ies_len, + params->assocresp_ies, + params->assocresp_ies_len, NULL, 0, mask, + MOAL_IOCTL_WAIT); if (ret) goto done; } if (params->beacon_ies && params->beacon_ies_len) { - ret = woal_cfg80211_mgmt_frame_ie(priv, - params->beacon_ies, - params-> - beacon_ies_len, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON_WPS_P2P, - MOAL_IOCTL_WAIT); + ret = woal_cfg80211_mgmt_frame_ie( + priv, params->beacon_ies, + params->beacon_ies_len, NULL, 0, NULL, 0, NULL, + 0, MGMT_MASK_BEACON_WPS_P2P, MOAL_IOCTL_WAIT); if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); @@ -2483,8 +2670,12 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) +int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, + unsigned int link_id) +#else +int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) +#endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; @@ -2518,7 +2709,9 @@ woal_cancel_timer(&priv->phandle->cac_timer); priv->phandle->is_cac_timer_set = MFALSE; /* Make sure Chan Report is cancelled */ - woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + if (woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, "%s: cancel chan report failed \n", + __func__); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel, NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); @@ -2535,13 +2728,13 @@ #endif /* if the bss is still running, then stop it */ if (priv->bss_started == MTRUE) { - if ((int)MLAN_STATUS_FAILURE == - woal_uap_bss_ctrl(priv, MOAL_NO_WAIT, UAP_BSS_STOP)) { + if (woal_uap_bss_ctrl(priv, MOAL_NO_WAIT, UAP_BSS_STOP)) { + PRINTM(MERROR, "%s: stop uap failed \n", __func__); ret = -EFAULT; goto done; } - if ((int)MLAN_STATUS_FAILURE == - woal_uap_bss_ctrl(priv, MOAL_NO_WAIT, UAP_BSS_RESET)) { + if (woal_uap_bss_ctrl(priv, MOAL_NO_WAIT, UAP_BSS_RESET)) { + PRINTM(MERROR, "%s: reset uap failed \n", __func__); ret = -EFAULT; goto done; } @@ -2552,6 +2745,9 @@ ret = -EFAULT; goto done; } +#if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 20, 0) + woal_cfg80211_setup_uap_he_cap(priv, MOAL_NO_WAIT); +#endif } woal_clear_all_mgmt_ies(priv, MOAL_NO_WAIT); #ifdef STA_SUPPORT @@ -2584,9 +2780,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, - struct bss_parameters *params) +int woal_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, + struct bss_parameters *params) { int ret = 0; t_u8 change = MFALSE; @@ -2629,7 +2824,10 @@ if (change) { if (priv->bss_started == MTRUE) { bss_started = MTRUE; - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP); + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, + UAP_BSS_STOP)) + PRINTM(MERROR, "%s: stop uap failed \n", + __func__); } if (params->use_short_preamble == 1) sys_config->preamble_type = 1; @@ -2641,9 +2839,12 @@ woal_set_get_sys_config(priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, sys_config)) ret = 0; - if (bss_started) - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, - UAP_BSS_START); + if (bss_started) { + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, + UAP_BSS_START)) + PRINTM(MERROR, "%s: start uap failed \n", + __func__); + } } done: kfree(sys_config); @@ -2673,15 +2874,14 @@ * @return 0 -- success, otherwise fail */ #endif -int -woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, +int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - struct station_del_parameters *param) + struct station_del_parameters *param) #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *mac_addr) + const u8 *mac_addr) #else - u8 *mac_addr) + u8 *mac_addr) #endif #endif { @@ -2691,53 +2891,41 @@ u16 reason_code = REASON_CODE_DEAUTH_LEAVING; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); ENTER(); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) - if (priv->phandle->is_cac_timer_set && - priv->bss_index == priv->phandle->cac_bss_index) { - woal_cancel_timer(&priv->phandle->cac_timer); - priv->phandle->is_cac_timer_set = MFALSE; - /* Make sure Chan Report is cancelled */ - woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel, - NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); -#else - cfg80211_cac_event(priv->netdev, NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); -#endif - memset(&priv->phandle->dfs_channel, 0, - sizeof(struct cfg80211_chan_def)); - priv->phandle->cac_bss_index = 0xff; + +#ifdef UAP_SUPPORT + if ((priv->bss_type == MLAN_BSS_TYPE_UAP) && !priv->bss_started) { + woal_cancel_cac(priv); + LEAVE(); + return 0; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD)) - woal_cancel_cac_block(priv); -#endif if (priv->media_connected == MFALSE) { PRINTM(MINFO, "cfg80211: Media not connected!\n"); LEAVE(); return 0; } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) if (param) { mac_addr = param->mac; reason_code = param->reason_code; } #endif + /** we will not send deauth to p2p interface, it might cause WPS failure */ - if (mac_addr) { - PRINTM(MMSG, "wlan: deauth station " MACSTR "\n", - MAC2STR(mac_addr)); + if (mac_addr #ifdef WIFI_DIRECT_SUPPORT - if (!priv->phandle->is_go_timer_set) + && !priv->phandle->is_go_timer_set #endif - woal_deauth_assoc_station(priv, (u8 *)mac_addr, - reason_code); + ) { + if (woal_deauth_assoc_station(priv, (u8 *)mac_addr, + reason_code)) + PRINTM(MMSG, "wlan: deauth station " MACSTR " failed\n", + MAC2STR(mac_addr)); } else { - PRINTM(MIOCTL, "del all station\n"); + PRINTM(MIOCTL, "del station\n"); } LEAVE(); return 0; @@ -2753,14 +2941,13 @@ * * @return 0 -- success, otherwise fail */ -int -woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, +int woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) - const u8 *mac, + const u8 *mac, #else - u8 *mac, + u8 *mac, #endif - struct station_info *stainfo) + struct station_info *stainfo) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = -EFAULT; @@ -2778,9 +2965,8 @@ } /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2802,19 +2988,22 @@ (int)info->param.sta_list.info[i].rssi); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) stainfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME) | - BIT(NL80211_STA_INFO_RX_BYTES) | - BIT(NL80211_STA_INFO_TX_BYTES) | - BIT(NL80211_STA_INFO_RX_PACKETS) | - BIT(NL80211_STA_INFO_TX_PACKETS) | - BIT(NL80211_STA_INFO_SIGNAL); - - stainfo->rx_bytes = priv->stats.rx_bytes; - stainfo->tx_bytes = priv->stats.tx_bytes; - stainfo->rx_packets = priv->stats.rx_packets; - stainfo->tx_packets = priv->stats.tx_packets; + BIT(NL80211_STA_INFO_RX_BYTES) | + BIT(NL80211_STA_INFO_TX_BYTES) | + BIT(NL80211_STA_INFO_RX_PACKETS) | + BIT(NL80211_STA_INFO_TX_PACKETS) | + BIT(NL80211_STA_INFO_SIGNAL); + stainfo->rx_bytes = + info->param.sta_list.info[i].stats.rx_bytes; + stainfo->tx_bytes = + info->param.sta_list.info[i].stats.tx_bytes; + stainfo->rx_packets = + info->param.sta_list.info[i].stats.rx_packets; + stainfo->tx_packets = + info->param.sta_list.info[i].stats.tx_packets; #else stainfo->filled = STATION_INFO_INACTIVE_TIME | - STATION_INFO_SIGNAL; + STATION_INFO_SIGNAL; #endif stainfo->inactive_time = 0; stainfo->signal = info->param.sta_list.info[i].rssi; @@ -2831,8 +3020,8 @@ } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) stainfo->filled |= BIT(NL80211_STA_INFO_TX_RETRIES) | - BIT(NL80211_STA_INFO_TX_FAILED) | - BIT(NL80211_STA_INFO_RX_DROP_MISC); + BIT(NL80211_STA_INFO_TX_FAILED) | + BIT(NL80211_STA_INFO_RX_DROP_MISC); stainfo->tx_failed = stats.failed; stainfo->tx_retries = stats.retry; stainfo->rx_dropped_misc = stats.fcs_error; @@ -2855,9 +3044,9 @@ * * @return 0 -- success, otherwise fail */ -int -woal_uap_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, - int idx, t_u8 *mac, struct station_info *sinfo) +int woal_uap_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, + int idx, t_u8 *mac, + struct station_info *sinfo) { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = -EFAULT; @@ -2875,9 +3064,8 @@ } /* Allocate an IOCTL request buffer */ - ioctl_req = - (mlan_ioctl_req *) - woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_get_info)); + ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (ioctl_req == NULL) { ret = -ENOMEM; goto done; @@ -2903,16 +3091,16 @@ (int)info->param.sta_list.info[idx].rssi); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME) | - BIT(NL80211_STA_INFO_SIGNAL); + BIT(NL80211_STA_INFO_SIGNAL); #else sinfo->filled = STATION_INFO_INACTIVE_TIME | STATION_INFO_SIGNAL; #endif if (info->param.sta_list.info[idx].stats.last_rx_in_msec) { moal_get_system_time(priv->phandle, &sec, &usec); - cur_msec = (t_u64)sec *1000 + (t_u64)usec / 1000; - sinfo->inactive_time = (t_u32)(cur_msec - - info->param.sta_list.info[idx]. - stats.last_rx_in_msec); + cur_msec = (t_u64)sec * 1000 + (t_u64)usec / 1000; + sinfo->inactive_time = + (t_u32)(cur_msec - info->param.sta_list.info[idx] + .stats.last_rx_in_msec); PRINTM(MIOCTL, "cur:%llu - [%d].last_rx:%llu = inactive_time:%d\n", cur_msec, idx, @@ -2938,9 +3126,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev, - const struct cfg80211_acl_data *params) +int woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev, + const struct cfg80211_acl_data *params) { int ret = -EFAULT; mlan_uap_bss_param *sys_config = NULL; @@ -2975,14 +3162,14 @@ sys_config->filter.filter_mode = MAC_FILTER_MODE_ALLOW_MAC; else if (params->acl_policy == NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED) sys_config->filter.filter_mode = MAC_FILTER_MODE_BLOCK_MAC; - moal_memcpy_ext(priv->phandle, sys_config->filter.mac_list, - params->mac_addrs, - sys_config->filter.mac_count * - sizeof(mlan_802_11_mac_addr), - sizeof(sys_config->filter.mac_list)); + moal_memcpy_ext( + priv->phandle, sys_config->filter.mac_list, params->mac_addrs, + sys_config->filter.mac_count * sizeof(mlan_802_11_mac_addr), + sizeof(sys_config->filter.mac_list)); if (priv->bss_started == MTRUE) { bss_started = MTRUE; - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP); + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP)) + PRINTM(MERROR, "%s: stop uap failed \n", __func__); } if (MLAN_STATUS_SUCCESS == woal_set_get_sys_config(priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, @@ -2990,8 +3177,11 @@ ret = 0; done: kfree(sys_config); - if (bss_started) - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, UAP_BSS_START); + if (bss_started) { + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, + UAP_BSS_START)) + PRINTM(MERROR, "%s: start uap failed \n", __func__); + } LEAVE(); return ret; } @@ -3007,9 +3197,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_set_txq_params(struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_txq_params *params) +int woal_cfg80211_set_txq_params(struct wiphy *wiphy, struct net_device *dev, + struct ieee80211_txq_params *params) { int ret = 0; u8 ac = 0; @@ -3080,6 +3269,103 @@ } #endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) +/** + * @brief start background radar detection + * + * @param wiphy A pointer to wiphy structure + * @param chandef A pointer to cfg80211_chan_def structure + * @return 0 -- success, otherwise fail + */ +int woal_cfg80211_set_radar_background(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef) +{ + u32 cac_time_ms = DEF_CAC_DWELL_TIME; + moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy); + moal_private *priv = woal_get_priv_bss_type(handle, MLAN_BSS_TYPE_DFS); + mlan_ds_11h_chan_rep_req chan_rpt_req; + int ret = 0; + mlan_status status; + ENTER(); + if (!priv) { + PRINTM(MERROR, + "DFS interface not avalible in set_radar_background\n"); + return -EFAULT; + } + if (!chandef) { + PRINTM(MMSG, "Stop radar background\n"); + woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + priv->chan_rpt_pending = MFALSE; + priv->radar_background = MFALSE; + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + LEAVE(); + return ret; + } + if (!(chandef->chan->flags & IEEE80211_CHAN_RADAR)) { + PRINTM(MERROR, "Not radar channel in set_radar_background\n"); + LEAVE(); + return -EFAULT; + } + if ((woal_is_etsi_country(priv->phandle->country_code) == MTRUE)) { + if (chandef->chan->hw_value == 120 || + chandef->chan->hw_value == 124 || + chandef->chan->hw_value == 128) { + cac_time_ms = MAX_CAC_DWELL_TIME; + } + if (chandef->chan->hw_value == 116 && + ((chandef->width == NL80211_CHAN_WIDTH_40) || + (chandef->width == NL80211_CHAN_WIDTH_80))) { + cac_time_ms = MAX_CAC_DWELL_TIME; + } + } + if (priv->chan_rpt_req.chanNum && + (priv->chan_rpt_req.chanNum != (t_u8)chandef->chan->hw_value)) { + woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + priv->chan_rpt_pending = MFALSE; + memset(&priv->chan_rpt_req, 0, + sizeof(mlan_ds_11h_chan_rep_req)); + } + chan_rpt_req.startFreq = START_FREQ_11A_BAND; + chan_rpt_req.chanNum = (t_u8)chandef->chan->hw_value; + chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; + switch (chandef->width) { + case NL80211_CHAN_WIDTH_40: + chan_rpt_req.bandcfg.chanWidth = CHAN_BW_40MHZ; + break; + case NL80211_CHAN_WIDTH_80: + chan_rpt_req.bandcfg.chanWidth = CHAN_BW_80MHZ; + break; + case NL80211_CHAN_WIDTH_20: + case NL80211_CHAN_WIDTH_20_NOHT: + default: + chan_rpt_req.bandcfg.chanWidth = CHAN_BW_20MHZ; + break; + } + chan_rpt_req.millisec_dwell_time = cac_time_ms; + chan_rpt_req.host_based = MTRUE; + moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, &chan_rpt_req, + sizeof(mlan_ds_11h_chan_rep_req), + sizeof(mlan_ds_11h_chan_rep_req)); + PRINTM(MCMND, + "DFS: Start Background Radar detect on channel=%d, bandwidth=%d, cac time=%d\n", + chan_rpt_req.chanNum, (int)(chan_rpt_req.bandcfg.chanWidth), + chan_rpt_req.millisec_dwell_time); + status = woal_do_dfs_cac(priv, &chan_rpt_req); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + } else { + priv->chan_rpt_pending = MTRUE; + priv->radar_background = MTRUE; + moal_memcpy_ext(priv->phandle, &priv->radar_background_chan, + chandef, sizeof(struct cfg80211_chan_def), + sizeof(struct cfg80211_chan_def)); + } + LEAVE(); + return ret; +} +#endif + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /** * @brief cac timer call back function. @@ -3088,8 +3374,7 @@ * * @return N/A */ -void -woal_cac_timer_func(void *context) +void woal_cac_timer_func(void *context) { moal_handle *handle = (moal_handle *)context; moal_private *priv = handle->priv[handle->cac_bss_index]; @@ -3117,15 +3402,13 @@ * * @return N/A */ -static void -woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) +static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) { chan_band_info uap_channel; t_u8 chan2Offset = SEC_CHAN_NONE; ENTER(); woal_clear_all_mgmt_ies(priv, MOAL_IOCTL_WAIT); - if (MLAN_STATUS_SUCCESS != - woal_uap_bss_ctrl(priv, wait_option, UAP_BSS_STOP)) { + if (woal_uap_bss_ctrl(priv, wait_option, UAP_BSS_STOP)) { PRINTM(MERROR, "%s: stop uap failed \n", __func__); goto done; } @@ -3135,9 +3418,8 @@ goto done; } - uap_channel.channel = - ieee80211_frequency_to_channel(priv->csa_chan.chan-> - center_freq); + uap_channel.channel = ieee80211_frequency_to_channel( + priv->csa_chan.chan->center_freq); switch (priv->csa_chan.width) { case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: @@ -3159,19 +3441,16 @@ case NL80211_CHAN_WIDTH_80P80: case NL80211_CHAN_WIDTH_160: uap_channel.bandcfg.chanWidth = CHAN_BW_80MHZ; - chan2Offset = - woal_get_second_channel_offset(priv, - uap_channel.channel); + chan2Offset = woal_get_second_channel_offset( + priv, uap_channel.channel); break; default: PRINTM(MWARN, "Unknown channel width: %d\n", priv->csa_chan.width); break; } - if (priv->csa_chan.chan->band == IEEE80211_BAND_2GHZ) - uap_channel.bandcfg.chanBand = BAND_2GHZ; - else if (priv->csa_chan.chan->band == IEEE80211_BAND_5GHZ) - uap_channel.bandcfg.chanBand = BAND_5GHZ; + uap_channel.bandcfg.chanBand = + woal_ieee_band_to_radio_type(priv->csa_chan.chan->band); uap_channel.bandcfg.chan2Offset = chan2Offset; if (MLAN_STATUS_SUCCESS != woal_set_get_ap_channel(priv, MLAN_ACT_SET, wait_option, @@ -3179,8 +3458,7 @@ PRINTM(MERROR, "Fail to set ap channel \n"); goto done; } - if (MLAN_STATUS_SUCCESS != - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, UAP_BSS_START)) { + if (woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, UAP_BSS_START)) { PRINTM(MERROR, "%s: start uap failed \n", __func__); goto done; } @@ -3189,7 +3467,11 @@ priv->channel = uap_channel.channel; moal_memcpy_ext(priv->phandle, &priv->chan, &priv->csa_chan, sizeof(struct cfg80211_chan_def), sizeof(priv->chan)); +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13) + cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0, 0); +#else cfg80211_ch_switch_notify(priv->netdev, &priv->chan); +#endif if (priv->uap_tx_blocked) { if (!netif_carrier_ok(priv->netdev)) netif_carrier_on(priv->netdev); @@ -3208,8 +3490,7 @@ * * @return 0 -- success, otherwise fail */ -void -woal_csa_work_queue(struct work_struct *work) +void woal_csa_work_queue(struct work_struct *work) { struct delayed_work *delayed_work = container_of(work, struct delayed_work, work); @@ -3220,6 +3501,7 @@ LEAVE(); } +#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE /* * @brief handle WOAL_EVENT_CANCEL_CHANRPT * @@ -3227,16 +3509,16 @@ * * @return N/A */ -void -woal_process_cancel_chanrpt_event(moal_private *priv) +void woal_process_cancel_chanrpt_event(moal_private *priv) { -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) if (priv->phandle->is_cac_timer_set && priv->bss_index == priv->phandle->cac_bss_index) { woal_cancel_timer(&priv->phandle->cac_timer); priv->phandle->is_cac_timer_set = MFALSE; /* Make sure Chan Report is cancelled */ - woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + if (woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT)) + PRINTM(MERROR, "%s: cancel chan report failed \n", + __func__); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel, NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); @@ -3248,8 +3530,8 @@ sizeof(struct cfg80211_chan_def)); priv->phandle->cac_bss_index = 0xff; } -#endif } +#endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) /** @@ -3261,12 +3543,10 @@ * @param cac_time_ms A cac dwell time * @return 0 -- success, otherwise fail */ - -int -woal_cfg80211_start_radar_detection(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_chan_def *chandef, - u32 cac_time_ms) +int woal_cfg80211_start_radar_detection(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_chan_def *chandef, + u32 cac_time_ms) #else /** * @brief start radar detection @@ -3277,10 +3557,9 @@ * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_start_radar_detection(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_chan_def *chandef) +int woal_cfg80211_start_radar_detection(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_chan_def *chandef) #endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -3290,6 +3569,8 @@ mlan_ds_11h_cfg *p11h_cfg = NULL; int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; + chan_band_info channel; + t_u16 enable = 0; ENTER(); @@ -3312,6 +3593,25 @@ ret = -EBUSY; goto done; } + if (MLAN_STATUS_SUCCESS == + woal_mc_policy_cfg(priv, &enable, MOAL_IOCTL_WAIT, MLAN_ACT_GET)) { + if (enable) { + if (MLAN_STATUS_SUCCESS == + woal_get_active_intf_channel(priv, &channel)) { + if (channel.channel != + chandef->chan->hw_value) { + PRINTM(MERROR, + "DFS channel is not allowed when another connection exists on different channel\n"); + PRINTM(MERROR, + "Another connection's channel=%d, dfs channel=%d\n", + channel.channel, + chandef->chan->hw_value); + ret = -EINVAL; + goto done; + } + } + } + } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg)); if (NULL == req) { ret = -ENOMEM; @@ -3329,7 +3629,11 @@ pchan_rpt_req->millisec_dwell_time = cac_time_ms; #else pchan_rpt_req->millisec_dwell_time = IEEE80211_DFS_MIN_CAC_TIME_MS; - +#endif + /* Since kernel doesn't support 600sec cac_timer for channels 120, 124, + * and 128 (weather channels) in ETSI region, overwrite kernel's + * cac_timer. + */ if ((woal_is_etsi_country(priv->phandle->country_code) == MTRUE)) { if (chandef->chan->hw_value == 120 || chandef->chan->hw_value == 124 || @@ -3344,7 +3648,6 @@ IEEE80211_DFS_MIN_CAC_TIME_MS * 10; } } -#endif if (priv->user_cac_period_msec) { pchan_rpt_req->millisec_dwell_time = priv->user_cac_period_msec; PRINTM(MCMD_D, @@ -3387,9 +3690,8 @@ * * @return 0 -- success, otherwise fail */ -int -woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_csa_settings *params) +int woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_csa_settings *params) { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); @@ -3402,16 +3704,13 @@ ret = -EINVAL; goto done; } - - /* TODO: support this case in next version */ if (params->radar_required) { - PRINTM(MMSG, - " hostapd handle this case by disable and re-enable interface\n"); - ret = -ENOTSUPP; - goto done; + PRINTM(MMSG, "switch to DFS channel\n"); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + woal_enable_dfs_support(priv, ¶ms->chandef); +#endif } - - /* actually hostapd would always choose one diff channel */ + /* actually hostapd would always choose one diff channel*/ if (cfg80211_chandef_identical(¶ms->chandef, &priv->chan)) { PRINTM(MMSG, "csa channel is same with current channel, invaild\n"); @@ -3473,8 +3772,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_register_uap_cfg80211(struct net_device *dev, t_u8 bss_type) +mlan_status woal_register_uap_cfg80211(struct net_device *dev, t_u8 bss_type) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -3491,8 +3789,12 @@ return MLAN_STATUS_FAILURE; } - if (bss_type == MLAN_BSS_TYPE_UAP) + if (bss_type == MLAN_BSS_TYPE_UAP) { wdev->iftype = NL80211_IFTYPE_AP; +#if CFG80211_VERSION_CODE < KERNEL_VERSION(4, 20, 0) + woal_cfg80211_setup_uap_he_cap(priv, MOAL_IOCTL_WAIT); +#endif + } dev_net_set(dev, wiphy_net(wdev->wiphy)); dev->ieee80211_ptr = wdev;
diff --git a/wlan_sd8987/mlinux/moal_uap_cfg80211.h b/wlan_sd8987/mlinux/moal_uap_cfg80211.h index 4f607e9..7d6c805 100755 --- a/wlan_sd8987/mlinux/moal_uap_cfg80211.h +++ b/wlan_sd8987/mlinux/moal_uap_cfg80211.h
@@ -3,7 +3,7 @@ * @brief This file contains the uAP CFG80211 specific defines. * * - * Copyright 2011-2020 NXP + * Copyright 2011-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlinux/moal_uap_priv.c b/wlan_sd8987/mlinux/moal_uap_priv.c index 4c16900..b28e0db 100755 --- a/wlan_sd8987/mlinux/moal_uap_priv.c +++ b/wlan_sd8987/mlinux/moal_uap_priv.c
@@ -54,8 +54,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +int woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iwreq *wrq = (struct iwreq *)req; @@ -103,9 +102,9 @@ case WOAL_WL_FW_RELOAD: break; case WOAL_AP_SET_CFG: - ret = woal_uap_set_ap_cfg(priv, - (t_u8 __force *)wrq->u.data. - pointer, wrq->u.data.length); + ret = woal_uap_set_ap_cfg( + priv, (t_u8 __force *)wrq->u.data.pointer, + wrq->u.data.length); break; default: ret = -EINVAL; @@ -164,8 +163,7 @@ * * @return N/A */ -void -woal_ioctl_get_uap_info_resp(moal_private *priv, mlan_ds_get_info *info) +void woal_ioctl_get_uap_info_resp(moal_private *priv, mlan_ds_get_info *info) { ENTER(); switch (info->sub_command) {
diff --git a/wlan_sd8987/mlinux/moal_uap_priv.h b/wlan_sd8987/mlinux/moal_uap_priv.h index dcb391a..4eab2f5 100755 --- a/wlan_sd8987/mlinux/moal_uap_priv.h +++ b/wlan_sd8987/mlinux/moal_uap_priv.h
@@ -3,7 +3,7 @@ * @brief This file contains definition for extended private IOCTL call. * * - * Copyright 2010-2020 NXP + * Copyright 2010-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991
diff --git a/wlan_sd8987/mlinux/moal_uap_wext.c b/wlan_sd8987/mlinux/moal_uap_wext.c index 9010f8d..c74e542 100755 --- a/wlan_sd8987/mlinux/moal_uap_wext.c +++ b/wlan_sd8987/mlinux/moal_uap_wext.c
@@ -43,21 +43,21 @@ } chan_to_freq_t; static const chan_to_freq_t chan_to_freq[] = { - {1, 2412, 0}, {2, 2417, 0}, {3, 2422, 0}, {4, 2427, 0}, - {5, 2432, 0}, {6, 2437, 0}, {7, 2442, 0}, {8, 2447, 0}, - {9, 2452, 0}, {10, 2457, 0}, {11, 2462, 0}, {12, 2467, 0}, - {13, 2472, 0}, {14, 2484, 0}, {183, 4915, 1}, {184, 4920, 1}, + {1, 2412, 0}, {2, 2417, 0}, {3, 2422, 0}, {4, 2427, 0}, + {5, 2432, 0}, {6, 2437, 0}, {7, 2442, 0}, {8, 2447, 0}, + {9, 2452, 0}, {10, 2457, 0}, {11, 2462, 0}, {12, 2467, 0}, + {13, 2472, 0}, {14, 2484, 0}, {183, 4915, 1}, {184, 4920, 1}, {185, 4925, 1}, {187, 4935, 1}, {188, 4940, 1}, {189, 4945, 1}, - {192, 4960, 1}, {196, 4980, 1}, {7, 5035, 1}, {8, 5040, 1}, - {9, 5045, 1}, {11, 5055, 1}, {12, 5060, 1}, {16, 5080, 1}, - {34, 5170, 1}, {36, 5180, 1}, {38, 5190, 1}, {40, 5200, 1}, - {42, 5210, 1}, {44, 5220, 1}, {46, 5230, 1}, {48, 5240, 1}, - {52, 5260, 1}, {56, 5280, 1}, {60, 5300, 1}, {64, 5320, 1}, + {192, 4960, 1}, {196, 4980, 1}, {7, 5035, 1}, {8, 5040, 1}, + {9, 5045, 1}, {11, 5055, 1}, {12, 5060, 1}, {16, 5080, 1}, + {34, 5170, 1}, {36, 5180, 1}, {38, 5190, 1}, {40, 5200, 1}, + {42, 5210, 1}, {44, 5220, 1}, {46, 5230, 1}, {48, 5240, 1}, + {52, 5260, 1}, {56, 5280, 1}, {60, 5300, 1}, {64, 5320, 1}, {100, 5500, 1}, {104, 5520, 1}, {108, 5540, 1}, {112, 5560, 1}, {116, 5580, 1}, {120, 5600, 1}, {124, 5620, 1}, {128, 5640, 1}, {132, 5660, 1}, {136, 5680, 1}, {140, 5700, 1}, {144, 5720, 1}, {149, 5745, 1}, {153, 5765, 1}, {157, 5785, 1}, {161, 5805, 1}, - {165, 5825, 1}, + {165, 5825, 1}, {169, 5845, 1}, {173, 5865, 1}, {177, 5885, 1}, }; /** @@ -119,8 +119,7 @@ * * @return N/A */ -static inline void -woal_sort_channels(struct iw_freq *freq, int num) +static inline void woal_sort_channels(struct iw_freq *freq, int num) { int i, j; struct iw_freq temp; @@ -147,8 +146,7 @@ * * @return freq */ -static int -channel_to_frequency(t_u16 channel, t_u8 band) +static int channel_to_frequency(t_u16 channel, t_u8 band) { int i = 0; @@ -174,10 +172,9 @@ * * @return 0 --success */ -static int -woal_config_commit(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *cwrq, - char *extra) +static int woal_config_commit(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *cwrq, char *extra) { ENTER(); @@ -195,9 +192,8 @@ * * @return 0 --success */ -static int -woal_get_name(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_name(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { char *cwrq = wrqu->name; ENTER(); @@ -216,9 +212,8 @@ * * @return 0 --success */ -static int -woal_get_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_wap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct sockaddr *awrq = &wrqu->addr; @@ -248,14 +243,13 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_wap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); struct sockaddr *awrq = &wrqu->addr; - const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; ENTER(); @@ -301,9 +295,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_freq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_freq *fwrq = &wrqu->freq; @@ -382,9 +375,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_freq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_freq *fwrq = &wrqu->freq; @@ -429,10 +421,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_bss_mode(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *wrqu, - char *extra) +static int woal_set_bss_mode(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; t_u32 *uwrq = &wrqu->mode; @@ -462,10 +453,9 @@ * * @return 0 --success */ -static int -woal_get_bss_mode(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *wrqu, - char *extra) +static int woal_get_bss_mode(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { t_u32 *uwrq = &wrqu->mode; ENTER(); @@ -486,9 +476,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_encode(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_set_encode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -562,8 +551,8 @@ pkey = &sys_cfg->wep_cfg.key2; if (ap_cfg->wep_cfg.key3.is_default) pkey = &sys_cfg->wep_cfg.key3; - else { /* Something wrong, select first key as default - */ + else { /* Something wrong, select first key as default + */ PRINTM(MERROR, "No default key set! Selecting first key.\n"); pkey = &sys_cfg->wep_cfg.key0; @@ -670,9 +659,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_encode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_encode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; @@ -748,7 +736,10 @@ moal_memcpy_ext(priv->phandle, extra, ap_cfg->wpa_cfg.passphrase, ap_cfg->wpa_cfg.length, ap_cfg->wpa_cfg.length); - dwrq->length = ap_cfg->wpa_cfg.length; + if (ap_cfg->wpa_cfg.length) + dwrq->length = ap_cfg->wpa_cfg.length; + else + dwrq->length = 16; dwrq->flags |= 1; dwrq->flags &= ~IW_ENCODE_DISABLED; break; @@ -775,9 +766,8 @@ * * @return -EOPNOTSUPP */ -static int -woal_get_gen_ie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_gen_ie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { ENTER(); LEAVE(); @@ -798,9 +788,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; @@ -848,7 +837,7 @@ ((t_u8 *)tlv), sizeof(IEEEtypes_Header_t) + tlv->len, sizeof(priv->bcn_ie_buf) - - priv->bcn_ie_len); + priv->bcn_ie_len); priv->bcn_ie_len += sizeof(IEEEtypes_Header_t) + tlv->len; } @@ -872,7 +861,7 @@ ((t_u8 *)tlv), sizeof(IEEEtypes_Header_t) + tlv->len, sizeof(priv->bcn_ie_buf) - - priv->bcn_ie_len); + priv->bcn_ie_len); priv->bcn_ie_len += sizeof(IEEEtypes_Header_t) + tlv->len; } @@ -936,10 +925,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_encode_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_encode_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1042,8 +1030,9 @@ sec->param.encrypt_key.pn, SEQ_MAX_SIZE); } PRINTM(MIOCTL, - "set uap wpa key key_index=%d, key_len=%d key_flags=0x%x " - MACSTR "\n", key_index, ext->key_len, + "set uap wpa key key_index=%d, key_len=%d key_flags=0x%x " MACSTR + "\n", + key_index, ext->key_len, sec->param.encrypt_key.key_flags, MAC2STR(sec->param.encrypt_key.mac_addr)); DBG_HEXDUMP(MCMD_D, "uap wpa key", pkey_material, ext->key_len); @@ -1058,7 +1047,7 @@ /* Cipher set will be done in set generic IE */ priv->pairwise_cipher = ext->alg; priv->group_cipher = ext->alg; - goto done; /* No AP configuration */ + goto done; /* No AP configuration */ } if (MLAN_STATUS_SUCCESS != woal_set_get_sys_config(priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, @@ -1086,10 +1075,9 @@ * * @return -EOPNOTSUPP */ -static int -woal_get_encode_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_encode_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { ENTER(); LEAVE(); @@ -1106,9 +1094,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_set_mlme(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_mlme(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_mlme *mlme = (struct iw_mlme *)extra; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1116,7 +1103,7 @@ mlan_ds_get_info *pinfo = NULL; mlan_ioctl_req *req = NULL; mlan_ds_sta_list *sta_list = NULL; - const t_u8 bc_addr[] = { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF }; + const t_u8 bc_addr[] = {0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF}; t_u8 sta_addr[ETH_ALEN]; int ret = 0, i; mlan_status status = MLAN_STATUS_SUCCESS; @@ -1138,8 +1125,8 @@ /* If deauth all station, get the connected STA list first */ if (!memcmp(bc_addr, sta_addr, ETH_ALEN)) { PRINTM(MIOCTL, "Deauth all stations\n"); - req = woal_alloc_mlan_ioctl_req(sizeof - (mlan_ds_get_info)); + req = woal_alloc_mlan_ioctl_req( + sizeof(mlan_ds_get_info)); if (req == NULL) { LEAVE(); return -ENOMEM; @@ -1179,13 +1166,12 @@ if (sta_list && !memcmp(bc_addr, sta_addr, ETH_ALEN)) { for (i = 0; i < sta_list->sta_count; i++) { - moal_memcpy_ext(priv->phandle, - bss->param.deauth_param. - mac_addr, - sta_list->info[i].mac_address, - ETH_ALEN, - sizeof(bss->param.deauth_param. - mac_addr)); + moal_memcpy_ext( + priv->phandle, + bss->param.deauth_param.mac_addr, + sta_list->info[i].mac_address, ETH_ALEN, + sizeof(bss->param.deauth_param + .mac_addr)); bss->param.deauth_param.reason_code = mlme->reason_code; @@ -1197,11 +1183,10 @@ } } } else { - moal_memcpy_ext(priv->phandle, - bss->param.deauth_param.mac_addr, - sta_addr, ETH_ALEN, - sizeof(bss->param.deauth_param. - mac_addr)); + moal_memcpy_ext( + priv->phandle, bss->param.deauth_param.mac_addr, + sta_addr, ETH_ALEN, + sizeof(bss->param.deauth_param.mac_addr)); bss->param.deauth_param.reason_code = mlme->reason_code; status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); @@ -1229,9 +1214,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_auth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_auth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_param *vwrq = &wrqu->param; @@ -1371,7 +1355,7 @@ default: kfree(sys_cfg); LEAVE(); - return -EOPNOTSUPP; /* No AP configuration */ + return -EOPNOTSUPP; /* No AP configuration */ } if (!sys_cfg->key_mgmt) sys_cfg->key_mgmt = priv->uap_key_mgmt; @@ -1406,9 +1390,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_auth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_auth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_param *vwrq = &wrqu->param; @@ -1437,9 +1420,9 @@ ap_cfg->wpa_cfg.pairwise_cipher_wpa2 == CIPHER_TKIP) vwrq->value = IW_AUTH_CIPHER_TKIP; else if (ap_cfg->wpa_cfg.pairwise_cipher_wpa == - CIPHER_AES_CCMP || + CIPHER_AES_CCMP || ap_cfg->wpa_cfg.pairwise_cipher_wpa2 == - CIPHER_AES_CCMP) + CIPHER_AES_CCMP) vwrq->value = IW_AUTH_CIPHER_CCMP; else vwrq->value = IW_AUTH_CIPHER_NONE; @@ -1511,9 +1494,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_range(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_range(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; @@ -1561,8 +1543,9 @@ range->freq[i].i = (long)ap_cfg->chan_list[i].chan_number; band = (ap_cfg->chan_list[i].bandcfg.chanBand == BAND_5GHZ); range->freq[i].m = - (long)channel_to_frequency(ap_cfg->chan_list[i]. - chan_number, band) * 100000; + (long)channel_to_frequency( + ap_cfg->chan_list[i].chan_number, band) * + 100000; range->freq[i].e = 1; } @@ -1593,13 +1576,13 @@ range->max_encoding_tokens = 4; /** Minimum power period */ -#define IW_POWER_PERIOD_MIN 1000000 /* 1 sec */ +#define IW_POWER_PERIOD_MIN 1000000 /* 1 sec */ /** Maximum power period */ -#define IW_POWER_PERIOD_MAX 120000000 /* 2 min */ +#define IW_POWER_PERIOD_MAX 120000000 /* 2 min */ /** Minimum power timeout value */ -#define IW_POWER_TIMEOUT_MIN 1000 /* 1 ms */ +#define IW_POWER_TIMEOUT_MIN 1000 /* 1 ms */ /** Maximim power timeout value */ -#define IW_POWER_TIMEOUT_MAX 1000000 /* 1 sec */ +#define IW_POWER_TIMEOUT_MAX 1000000 /* 1 sec */ /* Power Management duration & timeout */ range->min_pmp = IW_POWER_PERIOD_MIN; @@ -1655,9 +1638,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_priv(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_priv(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { ENTER(); LEAVE(); @@ -1674,9 +1656,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_set_essid(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; @@ -1717,7 +1698,7 @@ } PRINTM(MINFO, "Requested new SSID = %s\n", (sys_cfg->ssid.ssid_len > 0) ? (char *)sys_cfg->ssid.ssid : - "NULL"); + "NULL"); /* Set AP configuration */ if (MLAN_STATUS_SUCCESS != woal_set_get_sys_config(priv, MLAN_ACT_SET, @@ -1744,9 +1725,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_get_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_get_essid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_uap_bss_param *ap_cfg = NULL; @@ -1785,85 +1765,85 @@ * iwconfig settable callbacks */ static const iw_handler woal_handler[] = { - (iw_handler) woal_config_commit, /* SIOCSIWCOMMIT */ - (iw_handler) woal_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) woal_set_freq, /* SIOCSIWFREQ */ - (iw_handler) woal_get_freq, /* SIOCGIWFREQ */ - (iw_handler) woal_set_bss_mode, /* SIOCSIWMODE */ - (iw_handler) woal_get_bss_mode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) woal_get_range, /* SIOCGIWRANGE */ - (iw_handler) woal_set_priv, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ + (iw_handler)woal_config_commit, /* SIOCSIWCOMMIT */ + (iw_handler)woal_get_name, /* SIOCGIWNAME */ + (iw_handler)NULL, /* SIOCSIWNWID */ + (iw_handler)NULL, /* SIOCGIWNWID */ + (iw_handler)woal_set_freq, /* SIOCSIWFREQ */ + (iw_handler)woal_get_freq, /* SIOCGIWFREQ */ + (iw_handler)woal_set_bss_mode, /* SIOCSIWMODE */ + (iw_handler)woal_get_bss_mode, /* SIOCGIWMODE */ + (iw_handler)NULL, /* SIOCSIWSENS */ + (iw_handler)NULL, /* SIOCGIWSENS */ + (iw_handler)NULL, /* SIOCSIWRANGE */ + (iw_handler)woal_get_range, /* SIOCGIWRANGE */ + (iw_handler)woal_set_priv, /* SIOCSIWPRIV */ + (iw_handler)NULL, /* SIOCGIWPRIV */ + (iw_handler)NULL, /* SIOCSIWSTATS */ + (iw_handler)NULL, /* SIOCGIWSTATS */ #if WIRELESS_EXT > 15 #ifdef CONFIG_WEXT_SPY - iw_handler_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ + iw_handler_set_spy, /* SIOCSIWSPY */ + iw_handler_get_spy, /* SIOCGIWSPY */ + iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ + iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ #else - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif #else /* WIRELESS_EXT > 15 */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif /* WIRELESS_EXT > 15 */ - (iw_handler) woal_set_wap, /* SIOCSIWAP */ - (iw_handler) woal_get_wap, /* SIOCGIWAP */ + (iw_handler)woal_set_wap, /* SIOCSIWAP */ + (iw_handler)woal_get_wap, /* SIOCGIWAP */ #if WIRELESS_EXT >= 18 - (iw_handler) woal_set_mlme, /* SIOCSIWMLME */ + (iw_handler)woal_set_mlme, /* SIOCSIWMLME */ #else - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif - /* (iw_handler) wlan_get_aplist, *//* SIOCGIWAPLIST */ - NULL, /* SIOCGIWAPLIST */ + /* (iw_handler) wlan_get_aplist, */ /* SIOCGIWAPLIST */ + NULL, /* SIOCGIWAPLIST */ #if WIRELESS_EXT > 13 - (iw_handler) NULL, /* SIOCSIWSCAN */ - (iw_handler) NULL, /* SIOCGIWSCAN */ + (iw_handler)NULL, /* SIOCSIWSCAN */ + (iw_handler)NULL, /* SIOCGIWSCAN */ #else /* WIRELESS_EXT > 13 */ - (iw_handler) NULL, /* SIOCSIWSCAN */ - (iw_handler) NULL, /* SIOCGIWSCAN */ + (iw_handler)NULL, /* SIOCSIWSCAN */ + (iw_handler)NULL, /* SIOCGIWSCAN */ #endif /* WIRELESS_EXT > 13 */ - (iw_handler) woal_set_essid, /* SIOCSIWESSID */ - (iw_handler) woal_get_essid, /* SIOCGIWESSID */ - (iw_handler) NULL, /* SIOCSIWNICKN */ - (iw_handler) NULL, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCSIWRATE */ - (iw_handler) NULL, /* SIOCGIWRATE */ - (iw_handler) NULL, /* SIOCSIWRTS */ - (iw_handler) NULL, /* SIOCGIWRTS */ - (iw_handler) NULL, /* SIOCSIWFRAG */ - (iw_handler) NULL, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) NULL, /* SIOCSIWRETRY */ - (iw_handler) NULL, /* SIOCGIWRETRY */ - (iw_handler) woal_set_encode, /* SIOCSIWENCODE */ - (iw_handler) woal_get_encode, /* SIOCGIWENCODE */ - (iw_handler) NULL, /* SIOCSIWPOWER */ - (iw_handler) NULL, /* SIOCGIWPOWER */ + (iw_handler)woal_set_essid, /* SIOCSIWESSID */ + (iw_handler)woal_get_essid, /* SIOCGIWESSID */ + (iw_handler)NULL, /* SIOCSIWNICKN */ + (iw_handler)NULL, /* SIOCGIWNICKN */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* SIOCSIWRATE */ + (iw_handler)NULL, /* SIOCGIWRATE */ + (iw_handler)NULL, /* SIOCSIWRTS */ + (iw_handler)NULL, /* SIOCGIWRTS */ + (iw_handler)NULL, /* SIOCSIWFRAG */ + (iw_handler)NULL, /* SIOCGIWFRAG */ + (iw_handler)NULL, /* SIOCSIWTXPOW */ + (iw_handler)NULL, /* SIOCGIWTXPOW */ + (iw_handler)NULL, /* SIOCSIWRETRY */ + (iw_handler)NULL, /* SIOCGIWRETRY */ + (iw_handler)woal_set_encode, /* SIOCSIWENCODE */ + (iw_handler)woal_get_encode, /* SIOCGIWENCODE */ + (iw_handler)NULL, /* SIOCSIWPOWER */ + (iw_handler)NULL, /* SIOCGIWPOWER */ #if (WIRELESS_EXT >= 18) - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) woal_set_gen_ie, /* SIOCSIWGENIE */ - (iw_handler) woal_get_gen_ie, /* SIOCGIWGENIE */ - (iw_handler) woal_set_auth, /* SIOCSIWAUTH */ - (iw_handler) woal_get_auth, /* SIOCGIWAUTH */ - (iw_handler) woal_set_encode_ext, /* SIOCSIWENCODEEXT */ - (iw_handler) woal_get_encode_ext, /* SIOCGIWENCODEEXT */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)woal_set_gen_ie, /* SIOCSIWGENIE */ + (iw_handler)woal_get_gen_ie, /* SIOCGIWGENIE */ + (iw_handler)woal_set_auth, /* SIOCSIWAUTH */ + (iw_handler)woal_get_auth, /* SIOCGIWAUTH */ + (iw_handler)woal_set_encode_ext, /* SIOCSIWENCODEEXT */ + (iw_handler)woal_get_encode_ext, /* SIOCGIWENCODEEXT */ #endif /* WIRELESSS_EXT >= 18 */ }; @@ -1871,7 +1851,7 @@ * iwpriv settable callbacks */ static const iw_handler woal_private_handler[] = { - NULL, /* SIOCIWFIRSTPRIV */ + NULL, /* SIOCIWFIRSTPRIV */ }; /******************************************************** @@ -1884,14 +1864,13 @@ .num_standard = ARRAY_SIZE(woal_handler), .num_private = ARRAY_SIZE(woal_private_handler), .num_private_args = ARRAY_SIZE(woal_uap_priv_args), - .standard = (iw_handler *) woal_handler, - .private = (iw_handler *) woal_private_handler, + .standard = (iw_handler *)woal_handler, + .private = (iw_handler *)woal_private_handler, .private_args = (struct iw_priv_args *)woal_uap_priv_args, #if WIRELESS_EXT > 20 .get_wireless_stats = woal_get_uap_wireless_stats, #endif }; - // clang-format on /** @@ -1901,8 +1880,7 @@ * * @return A pointer to iw_statistics buf */ -struct iw_statistics * -woal_get_uap_wireless_stats(struct net_device *dev) +struct iw_statistics *woal_get_uap_wireless_stats(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u16 wait_option = MOAL_IOCTL_WAIT;
diff --git a/wlan_sd8987/mlinux/moal_usb.c b/wlan_sd8987/mlinux/moal_usb.c index 0bba81b..0f5d3fd 100755 --- a/wlan_sd8987/mlinux/moal_usb.c +++ b/wlan_sd8987/mlinux/moal_usb.c
@@ -34,7 +34,8 @@ Local Variables ********************************************************/ -#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978) +#if defined(USB8997) || defined(USB9098) || defined(USB9097) || \ + defined(USB8978) || defined(USBNW62X) /** Card-type detection frame response */ typedef struct { /** 32-bit ACK+WINNER field */ @@ -94,6 +95,12 @@ {NXP_USB_DEVICE(USB9097_VID_1, USB9097_PID_1, "NXP WLAN USB Adapter")}, {NXP_USB_DEVICE(USB9097_VID_1, USB9097_PID_2, "NXP WLAN USB Adapter")}, #endif +#ifdef USBNW62X + {NXP_USB_DEVICE(USBNW62X_VID_1, USBNW62X_PID_1, + "NXP WLAN USB Adapter")}, + {NXP_USB_DEVICE(USBNW62X_VID_1, USBNW62X_PID_2, + "NXP WLAN USB Adapter")}, +#endif /* Terminating entry */ {}, }; @@ -121,6 +128,10 @@ #ifdef USB9097 {NXP_USB_DEVICE(USB9097_VID_1, USB9097_PID_2, "NXP WLAN USB Adapter")}, #endif +#ifdef USBNW62X + {NXP_USB_DEVICE(USBNW62X_VID_1, USBNW62X_PID_2, + "NXP WLAN USB Adapter")}, +#endif /* Terminating entry */ {}, }; @@ -194,8 +205,7 @@ * * @return N/A */ -static void -woal_usb_receive(struct urb *urb, struct pt_regs *regs) +static void woal_usb_receive(struct urb *urb, struct pt_regs *regs) #else /** * @brief This function receive packet of the data/cmd/event packet @@ -205,8 +215,7 @@ * * @return N/A */ -static void -woal_usb_receive(struct urb *urb) +static void woal_usb_receive(struct urb *urb) #endif { urb_context *context = NULL; @@ -344,8 +353,7 @@ * * @return N/A */ -static void -woal_usb_tx_complete(struct urb *urb, struct pt_regs *regs) +static void woal_usb_tx_complete(struct urb *urb, struct pt_regs *regs) #else /** * @brief Call back function to handle the status of the Tx data URB @@ -354,8 +362,7 @@ * * @return N/A */ -static void -woal_usb_tx_complete(struct urb *urb) +static void woal_usb_tx_complete(struct urb *urb) #endif { urb_context *context = NULL; @@ -399,6 +406,8 @@ atomic_dec(&cardp->tx_cmd_urb_pending); else if (context->ep == cardp->tx_data_ep) atomic_dec(&cardp->tx_data_urb_pending); + else if (context->ep == cardp->tx_data2_ep) + atomic_dec(&cardp->tx_data2_urb_pending); queue_work(handle->workqueue, &handle->main_work); @@ -414,8 +423,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_usb_submit_rx_urb(urb_context *ctx, int size) +static mlan_status woal_usb_submit_rx_urb(urb_context *ctx, int size) { moal_handle *handle = ctx->handle; struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; @@ -488,7 +496,8 @@ Global Functions ********************************************************/ -#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978) +#if defined(USB8997) || defined(USB9098) || defined(USB9097) || \ + defined(USB8978) || defined(USBNW62X) /** * @brief Check chip revision * @@ -498,9 +507,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_check_chip_revision(moal_handle *handle, t_u32 *usb_chip_rev, - t_u32 *usb_strap) +static mlan_status woal_check_chip_revision(moal_handle *handle, + t_u32 *usb_chip_rev, + t_u32 *usb_strap) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_buffer mbuf; @@ -564,8 +573,8 @@ ret = MLAN_STATUS_FAILURE; goto cleanup; } - moal_memcpy_ext(handle, &ack_pkt, recv_buff, - sizeof(usb_ack_pkt), sizeof(ack_pkt)); + moal_memcpy_ext(handle, &ack_pkt, recv_buff, sizeof(usb_ack_pkt), + sizeof(ack_pkt)); ack_pkt.ack_winner = woal_le32_to_cpu(ack_pkt.ack_winner); ack_pkt.seq = woal_le32_to_cpu(ack_pkt.seq); ack_pkt.extend = woal_le32_to_cpu(ack_pkt.extend); @@ -597,8 +606,7 @@ * @param handle A pointer to moal_handle structure * @return N/A */ -static void -woal_usb_unlink_urb(void *card_desc) +static void woal_usb_unlink_urb(void *card_desc) { struct usb_card_rec *cardp = (struct usb_card_rec *)card_desc; int i; @@ -613,8 +621,8 @@ if (atomic_read(&cardp->rx_data_urb_pending)) { for (i = 0; i < MVUSB_RX_DATA_URB; i++) { if (cardp->rx_data_list[i].urb) - usb_kill_urb(cardp->rx_data_list[i]. - urb); + usb_kill_urb( + cardp->rx_data_list[i].urb); } } /* Unlink Tx cmd URB */ @@ -626,8 +634,12 @@ if (atomic_read(&cardp->tx_data_urb_pending)) { for (i = 0; i < MVUSB_TX_HIGH_WMARK; i++) { if (cardp->tx_data_list[i].urb) { - usb_kill_urb(cardp->tx_data_list[i]. - urb); + usb_kill_urb( + cardp->tx_data_list[i].urb); + } + if (cardp->tx_data2_list[i].urb) { + usb_kill_urb( + cardp->tx_data2_list[i].urb); } } } @@ -642,8 +654,7 @@ * * @return N/A */ -void -woal_usb_free(struct usb_card_rec *cardp) +void woal_usb_free(struct usb_card_rec *cardp) { int i; @@ -669,6 +680,10 @@ usb_free_urb(cardp->tx_data_list[i].urb); cardp->tx_data_list[i].urb = NULL; } + if (cardp->tx_data2_list[i].urb) { + usb_free_urb(cardp->tx_data2_list[i].urb); + cardp->tx_data2_list[i].urb = NULL; + } } /* Free Tx cmd URB */ if (cardp->tx_cmd.urb) { @@ -680,8 +695,7 @@ return; } -static t_u16 -woal_update_card_type(t_void *card) +static t_u16 woal_update_card_type(t_void *card) { struct usb_card_rec *cardp_usb = (struct usb_card_rec *)card; t_u16 card_type = 0; @@ -689,107 +703,124 @@ /* Update card type */ #ifdef USB8801 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8801_PID_1 || + (__force __le16)USB8801_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8801_PID_2) { + (__force __le16)USB8801_PID_2) { card_type = CARD_TYPE_USB8801; moal_memcpy_ext(NULL, driver_version, CARD_USB8801, strlen(CARD_USB8801), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), V14, strlen(V14), + strlen(KERN_VERSION), + V14, strlen(V14), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef USB8897 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8897_PID_1 || + (__force __le16)USB8897_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8897_PID_2) { + (__force __le16)USB8897_PID_2) { card_type = CARD_TYPE_USB8897; moal_memcpy_ext(NULL, driver_version, CARD_USB8897, strlen(CARD_USB8897), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V15, strlen(V15), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef USB8997 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_1 || + (__force __le16)USB8997_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_2 || + (__force __le16)USB8997_PID_2 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_3 || + (__force __le16)USB8997_PID_3 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_4 || + (__force __le16)USB8997_PID_4 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_5 || + (__force __le16)USB8997_PID_5 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997_PID_6 || + (__force __le16)USB8997_PID_6 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8997V2_PID_1) { + (__force __le16)USB8997V2_PID_1) { card_type = CARD_TYPE_USB8997; moal_memcpy_ext(NULL, driver_version, CARD_USB8997, strlen(CARD_USB8997), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V16, strlen(V16), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef USB8978 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8978_PID_1 || + (__force __le16)USB8978_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB8978_PID_2) { + (__force __le16)USB8978_PID_2) { card_type = CARD_TYPE_USB8978; moal_memcpy_ext(NULL, driver_version, "USBIW416", strlen("USBIW416"), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V16, strlen(V16), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef USB9098 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB9098_PID_1 || + (__force __le16)USB9098_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB9098_PID_2) { + (__force __le16)USB9098_PID_2) { card_type = CARD_TYPE_USB9098; moal_memcpy_ext(NULL, driver_version, CARD_USB9098, strlen(CARD_USB9098), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V17, strlen(V17), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); } #endif #ifdef USB9097 if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB9097_PID_1 || + (__force __le16)USB9097_PID_1 || woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == - (__force __le16) USB9097_PID_2) { + (__force __le16)USB9097_PID_2) { card_type = CARD_TYPE_USB9097; - moal_memcpy_ext(NULL, driver_version, CARD_USBIW620, - strlen(CARD_USBIW620), strlen(driver_version)); + moal_memcpy_ext(NULL, driver_version, CARD_USB9097, + strlen(CARD_USB9097), strlen(driver_version)); moal_memcpy_ext(NULL, driver_version + strlen(INTF_CARDTYPE) + - strlen(KERN_VERSION), + strlen(KERN_VERSION), V17, strlen(V17), strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); + strlen(KERN_VERSION)); + } +#endif +#ifdef USBNW62X + if (woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == + (__force __le16)USBNW62X_PID_1 || + woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct) == + (__force __le16)USBNW62X_PID_2) { + card_type = CARD_TYPE_USBNW62X; + moal_memcpy_ext(NULL, driver_version, CARD_USBNW62X, + strlen(CARD_USBNW62X), strlen(driver_version)); + moal_memcpy_ext(NULL, + driver_version + strlen(INTF_CARDTYPE) + + strlen(KERN_VERSION), + V17, strlen(V17), + strlen(driver_version) - strlen(INTF_CARDTYPE) - + strlen(KERN_VERSION)); } #endif return card_type; @@ -803,8 +834,8 @@ * * @return Address of variable usb_cardp, error code otherwise */ -static int -woal_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int woal_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct usb_device *udev; struct usb_host_interface *iface_desc; @@ -831,34 +862,38 @@ /* Check probe is for our device */ for (i = 0; woal_usb_table[i].idVendor; i++) { if (woal_cpu_to_le16(udev->descriptor.idVendor) == - (__force __le16) woal_usb_table[i].idVendor && + (__force __le16)woal_usb_table[i].idVendor && woal_cpu_to_le16(udev->descriptor.idProduct) == - (__force __le16) woal_usb_table[i].idProduct) { + (__force __le16)woal_usb_table[i].idProduct) { PRINTM(MMSG, "VID/PID = %X/%X, Boot2 version = %X\n", woal_cpu_to_le16(udev->descriptor.idVendor), woal_cpu_to_le16(udev->descriptor.idProduct), woal_cpu_to_le16(udev->descriptor.bcdDevice)); switch (woal_cpu_to_le16(udev->descriptor.idProduct)) { #ifdef USB8801 - case (__force __le16) USB8801_PID_1: + case (__force __le16)USB8801_PID_1: #endif /* USB8801 */ #ifdef USB8897 - case (__force __le16) USB8897_PID_1: + case (__force __le16)USB8897_PID_1: #endif /* USB8897 */ #ifdef USB8997 - case (__force __le16) USB8997_PID_1: - case (__force __le16) USB8997V2_PID_1: + case (__force __le16)USB8997_PID_1: + case (__force __le16)USB8997V2_PID_1: #endif /* USB8997 */ #ifdef USB8978 - case (__force __le16) USB8978_PID_1: - case (__force __le16) USB8978_PID_1_BT: + case (__force __le16)USB8978_PID_1: + case (__force __le16)USB8978_PID_1_BT: #endif /* USB8978 */ #ifdef USB9098 - case (__force __le16) USB9098_PID_1: + case (__force __le16)USB9098_PID_1: #endif /* USB9098 */ #ifdef USB9097 - case (__force __le16) USB9097_PID_1: + case (__force __le16)USB9097_PID_1: #endif /* USB9097 */ +#ifdef USBNW62X + case (__force __le16)USBNW62X_PID_1: +#endif /* USBNW62X */ + /* If skip FW is set, we must return error so * the next driver can download the FW */ if (skip_fwdnld) @@ -867,36 +902,40 @@ usb_cardp->boot_state = USB_FW_DNLD; break; #ifdef USB8801 - case (__force __le16) USB8801_PID_2: + case (__force __le16)USB8801_PID_2: #endif /* USB8801 */ #ifdef USB8897 - case (__force __le16) USB8897_PID_2: + case (__force __le16)USB8897_PID_2: #endif /* USB8897 */ #ifdef USB8997 - case (__force __le16) USB8997_PID_2: + case (__force __le16)USB8997_PID_2: #endif /* USB8997 */ #ifdef USB8978 - case (__force __le16) USB8978_PID_2: - case (__force __le16) USB8978_PID_2_BT: + case (__force __le16)USB8978_PID_2: + case (__force __le16)USB8978_PID_2_BT: #endif /* USB8978 */ #ifdef USB9098 - case (__force __le16) USB9098_PID_2: + case (__force __le16)USB9098_PID_2: #endif /* USB9098 */ #ifdef USB9097 - case (__force __le16) USB9097_PID_2: + case (__force __le16)USB9097_PID_2: #endif /* USB9097 */ +#ifdef USBNW62X + case (__force __le16)USBNW62X_PID_2: +#endif /* USBNW62X */ + usb_cardp->boot_state = USB_FW_READY; break; } - /*To do, get card type */ - /* if + /*To do, get card type*/ + /* if (woal_cpu_to_le16(udev->descriptor.idProduct) == USB8897_PID_2) usb_cardp->card_type = CARD_TYPE_USB8897; else if (woal_cpu_to_le16(udev->descriptor.idProduct) == USB8997_PID_2) usb_cardp->card_type = CARD_TYPE_USB997; - */ + */ break; } } @@ -918,9 +957,10 @@ endpoint = &iface_desc->endpoint[i].desc; if ((usb_endpoint_is_bulk_in(endpoint) || usb_endpoint_is_int_in(endpoint)) && - (usb_endpoint_num(endpoint) == MLAN_USB_EP_CMD_EVENT - || usb_endpoint_num(endpoint) == - MLAN_USB_EP_CMD_EVENT_IF2)) { + (usb_endpoint_num(endpoint) == + MLAN_USB_EP_CMD_EVENT || + usb_endpoint_num(endpoint) == + MLAN_USB_EP_CMD_EVENT_IF2)) { usb_cardp->rx_cmd_ep_type = usb_endpoint_type(endpoint); usb_cardp->rx_cmd_interval = @@ -928,13 +968,12 @@ /* We found a bulk in command/event endpoint */ PRINTM(MCMND, "Rx CMD/EVT: max packet size = %d, address = %d ep_type=%d\n", - woal_le16_to_cpu(endpoint-> - wMaxPacketSize), + woal_le16_to_cpu( + endpoint->wMaxPacketSize), endpoint->bEndpointAddress, usb_cardp->rx_cmd_ep_type); usb_cardp->rx_cmd_ep = - (endpoint-> - bEndpointAddress & + (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); atomic_set(&usb_cardp->rx_cmd_urb_pending, 0); @@ -943,46 +982,62 @@ usb_cardp->second_mac = MTRUE; } if (usb_endpoint_is_bulk_in(endpoint) && - (usb_endpoint_num(endpoint) == MLAN_USB_EP_DATA - || + (usb_endpoint_num(endpoint) == MLAN_USB_EP_DATA || usb_endpoint_num(endpoint) == - MLAN_USB_EP_DATA_IF2)) { + MLAN_USB_EP_DATA_IF2)) { /* We found a bulk in data endpoint */ PRINTM(MINFO, "Bulk IN: max packet size = %d, address = %d\n", - woal_le16_to_cpu(endpoint-> - wMaxPacketSize), + woal_le16_to_cpu( + endpoint->wMaxPacketSize), endpoint->bEndpointAddress); usb_cardp->rx_data_ep = - (endpoint-> - bEndpointAddress & + (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); atomic_set(&usb_cardp->rx_data_urb_pending, 0); } if (usb_endpoint_is_bulk_out(endpoint) && - (usb_endpoint_num(endpoint) == MLAN_USB_EP_DATA - || + (usb_endpoint_num(endpoint) == MLAN_USB_EP_DATA || usb_endpoint_num(endpoint) == - MLAN_USB_EP_DATA_IF2)) { + MLAN_USB_EP_DATA_IF2)) { /* We found a bulk out data endpoint */ PRINTM(MCMND, "Bulk OUT: max packet size = %d, address = %d\n", - woal_le16_to_cpu(endpoint-> - wMaxPacketSize), + woal_le16_to_cpu( + endpoint->wMaxPacketSize), endpoint->bEndpointAddress); usb_cardp->tx_data_ep = endpoint->bEndpointAddress; atomic_set(&usb_cardp->tx_data_urb_pending, 0); usb_cardp->tx_data_maxpktsize = - (__force int)woal_le16_to_cpu(endpoint-> - wMaxPacketSize); + (__force int)woal_le16_to_cpu( + endpoint->wMaxPacketSize); + } + if (usb_endpoint_is_bulk_out(endpoint) && + (usb_endpoint_num(endpoint) == + MLAN_USB_EP_DATA_CH2 || + usb_endpoint_num(endpoint) == + MLAN_USB_EP_DATA_CH2_IF2)) { + /* We found a bulk out data endpoint */ + PRINTM(MCMND, + "Bulk OUT2: max packet size = %d, address = %d\n", + woal_le16_to_cpu( + endpoint->wMaxPacketSize), + endpoint->bEndpointAddress); + usb_cardp->tx_data2_ep = + endpoint->bEndpointAddress; + atomic_set(&usb_cardp->tx_data2_urb_pending, 0); + usb_cardp->tx_data2_maxpktsize = + (__force int)woal_le16_to_cpu( + endpoint->wMaxPacketSize); } if ((usb_endpoint_is_bulk_out(endpoint) || usb_endpoint_is_int_out(endpoint)) && - (usb_endpoint_num(endpoint) == MLAN_USB_EP_CMD_EVENT - || usb_endpoint_num(endpoint) == - MLAN_USB_EP_CMD_EVENT_IF2)) { + (usb_endpoint_num(endpoint) == + MLAN_USB_EP_CMD_EVENT || + usb_endpoint_num(endpoint) == + MLAN_USB_EP_CMD_EVENT_IF2)) { usb_cardp->tx_cmd_ep_type = usb_endpoint_type(endpoint); usb_cardp->tx_cmd_interval = @@ -990,16 +1045,16 @@ /* We found a bulk out command/event endpoint */ PRINTM(MCMND, "Tx CMD: max packet size = %d, address = %d ep_type=%d\n", - woal_le16_to_cpu(endpoint-> - wMaxPacketSize), + woal_le16_to_cpu( + endpoint->wMaxPacketSize), endpoint->bEndpointAddress, usb_cardp->tx_cmd_ep_type); usb_cardp->tx_cmd_ep = endpoint->bEndpointAddress; atomic_set(&usb_cardp->tx_cmd_urb_pending, 0); usb_cardp->tx_cmd_maxpktsize = - (__force int)woal_le16_to_cpu(endpoint-> - wMaxPacketSize); + (__force int)woal_le16_to_cpu( + endpoint->wMaxPacketSize); } } @@ -1014,6 +1069,14 @@ __FUNCTION__); goto error; } + if (!usb_cardp->tx_data2_ep) { + PRINTM(MERROR, + "%s: invalid endpoint assignment\n", + __FUNCTION__); + PRINTM(MERROR, + "%s: DATA2 endpoint is not enumarated\n", + __FUNCTION__); + } } usb_cardp->tx_aggr_ctrl.enable = MFALSE; @@ -1084,8 +1147,7 @@ * * @return N/A */ -static void -woal_usb_disconnect(struct usb_interface *intf) +static void woal_usb_disconnect(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); moal_handle *phandle = NULL; @@ -1122,8 +1184,7 @@ * * @return N/A */ -void -woal_kill_urbs(moal_handle *handle) +void woal_kill_urbs(moal_handle *handle) { ENTER(); handle->is_suspended = MTRUE; @@ -1139,8 +1200,7 @@ * * @return N/A */ -void -woal_resubmit_urbs(moal_handle *handle) +void woal_resubmit_urbs(moal_handle *handle) { struct usb_card_rec *cardp = handle->card; @@ -1170,8 +1230,7 @@ * * @return MLAN_STATUS_SUCCESS */ -static int -woal_usb_suspend(struct usb_interface *intf, pm_message_t message) +static int woal_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_card_rec *cardp = usb_get_intfdata(intf); moal_handle *handle = NULL; @@ -1231,6 +1290,9 @@ if (cardp->tx_data_list[i].urb) { usb_kill_urb(cardp->tx_data_list[i].urb); } + if (cardp->tx_data2_list[i].urb) { + usb_kill_urb(cardp->tx_data2_list[i].urb); + } } /* Unlink Tx cmd URB */ if (cardp->tx_cmd.urb) { @@ -1253,8 +1315,7 @@ * * @return MLAN_STATUS_SUCCESS */ -static int -woal_usb_resume(struct usb_interface *intf) +static int woal_usb_resume(struct usb_interface *intf) { struct usb_card_rec *cardp = usb_get_intfdata(intf); moal_handle *handle = NULL; @@ -1301,8 +1362,8 @@ MOAL_NO_WAIT); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) - /* Resume handler may be called due to remote wakeup, - force to exit suspend anyway */ + /* Resume handler may be called due to remote wakeup, + force to exit suspend anyway */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) cardp->udev->autosuspend_disabled = 1; #else @@ -1334,8 +1395,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_usb_tx_init(moal_handle *handle) +mlan_status woal_usb_tx_init(moal_handle *handle) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; int i; @@ -1364,6 +1424,15 @@ ret = MLAN_STATUS_FAILURE; goto init_exit; } + cardp->tx_data2_list[i].handle = handle; + cardp->tx_data2_list[i].ep = cardp->tx_data2_ep; + /* Allocate URB for data */ + cardp->tx_data2_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); + if (!cardp->tx_data2_list[i].urb) { + PRINTM(MERROR, "Tx data URB allocation failed\n"); + ret = MLAN_STATUS_FAILURE; + goto init_exit; + } } init_exit: @@ -1378,8 +1447,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_usb_submit_rx_data_urbs(moal_handle *handle) +mlan_status woal_usb_submit_rx_data_urbs(moal_handle *handle) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; int i; @@ -1417,8 +1485,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_usb_rx_init(moal_handle *handle) +mlan_status woal_usb_rx_init(moal_handle *handle) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; int i; @@ -1478,9 +1545,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_usb_write_data_sync(moal_handle *handle, - mlan_buffer *pmbuf, t_u32 endpoint, t_u32 timeout) +static mlan_status woal_usb_write_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 endpoint, + t_u32 timeout) { struct usb_card_rec *cardp = handle->card; t_u8 *data = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); @@ -1494,6 +1561,8 @@ bulk_out_maxpktsize = cardp->tx_cmd_maxpktsize; else if (ep == cardp->tx_data_ep) bulk_out_maxpktsize = cardp->tx_data_maxpktsize; + else if (ep == cardp->tx_data2_ep) + bulk_out_maxpktsize = cardp->tx_data2_maxpktsize; if (length % bulk_out_maxpktsize == 0) length++; @@ -1522,9 +1591,9 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_usb_read_data_sync(moal_handle *handle, - mlan_buffer *pmbuf, t_u32 endpoint, t_u32 timeout) +static mlan_status woal_usb_read_data_sync(moal_handle *handle, + mlan_buffer *pmbuf, t_u32 endpoint, + t_u32 timeout) { struct usb_card_rec *cardp = handle->card; t_u8 *data = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset); @@ -1556,8 +1625,8 @@ * @return MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE or * MLAN_STATUS_RESOURCE */ -mlan_status -woal_write_data_async(moal_handle *handle, mlan_buffer *pmbuf, t_u8 ep) +mlan_status woal_write_data_async(moal_handle *handle, mlan_buffer *pmbuf, + t_u8 ep) { struct usb_card_rec *cardp = handle->card; urb_context *context = NULL; @@ -1580,6 +1649,11 @@ (atomic_read(&cardp->tx_data_urb_pending) >= MVUSB_TX_HIGH_WMARK)) { ret = MLAN_STATUS_RESOURCE; goto tx_ret; + } else if ((ep == cardp->tx_data2_ep) && + (atomic_read(&cardp->tx_data2_urb_pending) >= + MVUSB_TX_HIGH_WMARK)) { + ret = MLAN_STATUS_RESOURCE; + goto tx_ret; } PRINTM(MINFO, "woal_write_data_async: ep=%d\n", ep); @@ -1592,6 +1666,11 @@ if (cardp->tx_data_ix >= MVUSB_TX_HIGH_WMARK) cardp->tx_data_ix = 0; context = &cardp->tx_data_list[cardp->tx_data_ix++]; + } else if (ep == cardp->tx_data2_ep) { + bulk_out_maxpktsize = cardp->tx_data2_maxpktsize; + if (cardp->tx_data2_ix >= MVUSB_TX_HIGH_WMARK) + cardp->tx_data2_ix = 0; + context = &cardp->tx_data2_list[cardp->tx_data2_ix++]; } } @@ -1633,6 +1712,8 @@ atomic_inc(&cardp->tx_cmd_urb_pending); else if (ep == cardp->tx_data_ep) atomic_inc(&cardp->tx_data_urb_pending); + else if (ep == cardp->tx_data2_ep) + atomic_inc(&cardp->tx_data2_urb_pending); if (usb_submit_urb(tx_urb, GFP_ATOMIC)) { /* Submit URB failure */ PRINTM(MERROR, "Submit EP %d Tx URB failed: %d\n", ep, ret); @@ -1645,6 +1726,13 @@ cardp->tx_data_ix--; else cardp->tx_data_ix = MVUSB_TX_HIGH_WMARK; + } else if (ep == cardp->tx_data2_ep) { + atomic_dec(&cardp->tx_data2_urb_pending); + if (cardp->tx_data2_ix) + cardp->tx_data2_ix--; + else + cardp->tx_data2_ix = + MVUSB_TX_HIGH_WMARK; } } ret = MLAN_STATUS_FAILURE; @@ -1653,6 +1741,10 @@ (atomic_read(&cardp->tx_data_urb_pending) == MVUSB_TX_HIGH_WMARK)) ret = MLAN_STATUS_PRESOURCE; + else if (ep == cardp->tx_data2_ep && + (atomic_read(&cardp->tx_data2_urb_pending) == + MVUSB_TX_HIGH_WMARK)) + ret = MLAN_STATUS_PRESOURCE; else ret = MLAN_STATUS_SUCCESS; } @@ -1673,8 +1765,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -static mlan_status -woal_usb_register_dev(moal_handle *handle) +static mlan_status woal_usb_register_dev(moal_handle *handle) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; mlan_status ret = MLAN_STATUS_SUCCESS; @@ -1686,8 +1777,7 @@ return ret; } -static void -woal_usb_unregister_dev(moal_handle *handle) +static void woal_usb_unregister_dev(moal_handle *handle) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; PRINTM(MMSG, "USB: unregister device\n"); @@ -1701,8 +1791,7 @@ * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status -woal_usb_bus_register(void) +mlan_status woal_usb_bus_register(void) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -1727,8 +1816,7 @@ * * @return N/A */ -void -woal_usb_bus_unregister(void) +void woal_usb_bus_unregister(void) { ENTER(); /* API unregisters the driver from USB subsystem */ @@ -1744,8 +1832,7 @@ * @return MTRUE/MFALSE * */ -static t_u8 -woal_usb_is_second_mac(moal_handle *handle) +static t_u8 woal_usb_is_second_mac(moal_handle *handle) { return ((struct usb_card_rec *)(handle->card))->second_mac; } @@ -1758,8 +1845,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_enter_usb_suspend(moal_handle *handle) +int woal_enter_usb_suspend(moal_handle *handle) { struct usb_device *udev = ((struct usb_card_rec *)(handle->card))->udev; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) @@ -1785,13 +1871,13 @@ /* Enter into USB suspend */ usb_lock_device(udev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) - udev->autosuspend_delay = 0; /* Autosuspend delay in jiffies */ + udev->autosuspend_delay = 0; /* Autosuspend delay in jiffies */ #else - pm_runtime_set_autosuspend_delay(&udev->dev, 0); /* Autosuspend delay in - jiffies */ + pm_runtime_set_autosuspend_delay(&udev->dev, 0); /* Autosuspend delay in + jiffies */ #endif /* < 2.6.38 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - udev->autosuspend_disabled = 0; /* /sys/bus/usb/devices/.../power/level + udev->autosuspend_disabled = 0; /* /sys/bus/usb/devices/.../power/level < auto */ #endif /* < 2.6.34 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) @@ -1828,8 +1914,7 @@ * * @return 0 --success, otherwise fail */ -int -woal_exit_usb_suspend(moal_handle *handle) +int woal_exit_usb_suspend(moal_handle *handle) { struct usb_device *udev = ((struct usb_card_rec *)(handle->card))->udev; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) @@ -1849,11 +1934,12 @@ LEAVE(); return -EFAULT; } + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) /* Exit from USB suspend */ usb_lock_device(udev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - udev->autosuspend_disabled = 1; /* /sys/bus/usb/devices/.../power/level + udev->autosuspend_disabled = 1; /* /sys/bus/usb/devices/.../power/level < on */ #endif /* < 2.6.34 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) @@ -1888,8 +1974,7 @@ * * @return N/A */ -void -woal_submit_rx_urb(moal_handle *handle, t_u8 ep) +void woal_submit_rx_urb(moal_handle *handle, t_u8 ep) { struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card; @@ -1911,8 +1996,7 @@ * * @return N/A */ -static void -woal_usb_dump_fw_info(moal_handle *phandle) +static void woal_usb_dump_fw_info(moal_handle *phandle) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; @@ -1952,11 +2036,11 @@ return; } -static mlan_status -woal_usb_get_fw_name(moal_handle *handle) +static mlan_status woal_usb_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; -#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978) +#if defined(USB8997) || defined(USB9098) || defined(USB9097) || \ + defined(USB8978) || defined(USBNW62X) t_u32 revision_id = 0; t_u32 strap = 0; #endif @@ -1975,7 +2059,8 @@ goto done; #endif -#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978) +#if defined(USB8997) || defined(USB9098) || defined(USB9097) || \ + defined(USB8978) || defined(USBNW62X) ret = woal_check_chip_revision(handle, &revision_id, &strap); if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MFATAL, "Chip revision check failure!\n"); @@ -2068,6 +2153,17 @@ } } #endif +#ifdef USBNW62X + if (IS_USBNW62X(handle->card_type)) { + if (strap == CARD_TYPE_USB_UART) + strcpy(handle->card_info->fw_name, + USBUARTNW62X_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + USBUSBNW62X_COMBO_FW_NAME); + } +#endif + done: PRINTM(MCMND, "combo fw:%s wlan fw:%s \n", handle->card_info->fw_name, handle->card_info->fw_name_wlan);
diff --git a/wlan_sd8987/mlinux/moal_usb.h b/wlan_sd8987/mlinux/moal_usb.h index 73637fc..5e10133 100755 --- a/wlan_sd8987/mlinux/moal_usb.h +++ b/wlan_sd8987/mlinux/moal_usb.h
@@ -30,11 +30,11 @@ #ifdef USB8801 /** USB VID 1 */ -#define USB8801_VID_1 0x1286 +#define USB8801_VID_1 0x1286 /** USB PID 1 */ -#define USB8801_PID_1 0x2049 +#define USB8801_PID_1 0x2049 /** USB PID 2 */ -#define USB8801_PID_2 0x204a +#define USB8801_PID_2 0x204a #endif /* USB8801 */ #ifdef USB8997 /** USB VID 1 */ @@ -89,6 +89,15 @@ #define USB9097_PID_2 0x2061 #endif /* USB9097 */ +#ifdef USBNW62X +/** USB VID 1 */ +#define USBNW62X_VID_1 0x0471 +/** USB PID 1 */ +#define USBNW62X_PID_1 0x020E +/** USB PID 2 */ +#define USBNW62X_PID_2 0x020F +#endif /* USBNW62X */ + /** Boot state: FW download */ #define USB_FW_DNLD 1 /** Boot state: FW ready */ @@ -100,7 +109,8 @@ /** Number of Rx data URB */ #define MVUSB_RX_DATA_URB 6 -#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978) || defined(USB8801) +#if defined(USB8997) || defined(USB9098) || defined(USB9097) || \ + defined(USB8978) || defined(USB8801) || defined(USBNW62X) /* Transmit buffer size for chip revision check */ #define CHIP_REV_TX_BUF_SIZE 16 /* Receive buffer size for chip revision check */ @@ -111,7 +121,7 @@ #define EXTEND_V1 (0x00000001) #define EXTEND_V2 (0x00000002) #ifdef USB8801 -#define USB8801_DEFAULT_WLAN_FW_NAME "nxp/usb8801_uapsta.bin" +#define USB8801_DEFAULT_WLAN_FW_NAME "nxp/usb8801_uapsta.bin" #endif /* USB8801 */ #endif @@ -161,6 +171,13 @@ #define USBUSB9097_COMBO_V1_FW_NAME "nxp/usbusbiw620_combo_v1.bin" #endif /* USB9097 */ +#ifdef USBNW62X +#define USBNW62X_DEFAULT_COMBO_FW_NAME "nxp/usbusbnw62x_combo.bin" +#define USBUARTNW62X_COMBO_FW_NAME "nxp/usbuartnw62x_combo.bin" +#define USBUSBNW62X_COMBO_FW_NAME "nxp/usbusbnw62x_combo.bin" +#define USBNW62X_DEFAULT_WLAN_FW_NAME "nxp/usbnw62x_wlan.bin" +#endif /* USBNW62X */ + /** urb context */ typedef struct _urb_context { /** Pointer to moal_handle structure */ @@ -226,6 +243,16 @@ t_u8 resubmit_urbs; /** USB card type */ t_u16 card_type; + /** Tx data endpoint address */ + t_u8 tx_data2_ep; + /** Tx data endpoint max pkt size */ + int tx_data2_maxpktsize; + /** Tx data2 URB pending count */ + atomic_t tx_data2_urb_pending; + /** Index to point to next data urb to use */ + int tx_data2_ix; + /** Pre-allocated urb for data */ + urb_context tx_data2_list[MVUSB_TX_HIGH_WMARK]; t_u8 second_mac; };
diff --git a/wlan_sd8987/mlinux/moal_wext.c b/wlan_sd8987/mlinux/moal_wext.c index f792e51..cf5632d 100755 --- a/wlan_sd8987/mlinux/moal_wext.c +++ b/wlan_sd8987/mlinux/moal_wext.c
@@ -32,7 +32,7 @@ #define MAX_SCAN_CELL_SIZE \ (IW_EV_ADDR_LEN + MLAN_MAX_SSID_LENGTH + IW_EV_UINT_LEN + \ IW_EV_FREQ_LEN + IW_EV_QUAL_LEN + MLAN_MAX_SSID_LENGTH + \ - IW_EV_PARAM_LEN + 40) /* 40 for WPAIE */ + IW_EV_PARAM_LEN + 40) /* 40 for WPAIE */ /******************************************************** Local Variables @@ -108,11 +108,11 @@ {WOAL_SIGNAL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "getsignal"}, { - WOAL_DEEP_SLEEP, - IW_PRIV_TYPE_INT | 16, - IW_PRIV_TYPE_INT | 16, - "deepsleep", - }, + WOAL_DEEP_SLEEP, + IW_PRIV_TYPE_INT | 16, + IW_PRIV_TYPE_INT | 16, + "deepsleep", + }, {WOAL_11N_TX_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "httxcfg"}, {WOAL_11N_HTCAP_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, @@ -153,6 +153,8 @@ #endif {WOAL_SLEEP_PARAMS, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "sleepparams"}, + {WOAL_NET_MONITOR, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, + "netmon"}, {WOAL_DFS_TESTING, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "dfstesting"}, {WOAL_MGMT_FRAME_CTRL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, @@ -245,8 +247,7 @@ * * @return 0--ssid is same, otherwise is different */ -static t_s32 -woal_ssid_cmp(mlan_802_11_ssid *ssid1, mlan_802_11_ssid *ssid2) +static t_s32 woal_ssid_cmp(mlan_802_11_ssid *ssid1, mlan_802_11_ssid *ssid2) { ENTER(); @@ -271,8 +272,7 @@ * * @return N/A */ -static inline void -woal_sort_channels(struct iw_freq *freq, int num) +static inline void woal_sort_channels(struct iw_freq *freq, int num) { int i, j; struct iw_freq temp; @@ -298,8 +298,7 @@ * * @return Quality of the link (0-5) */ -static t_u8 -woal_rssi_to_quality(t_s16 rssi) +static t_u8 woal_rssi_to_quality(t_s16 rssi) { /** Macro for RSSI range */ #define MOAL_RSSI_NO_SIGNAL -90 @@ -332,9 +331,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_set_nick(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); ENTER(); @@ -362,9 +360,8 @@ * * @return 0 --success */ -static int -woal_get_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_get_nick(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); ENTER(); @@ -395,10 +392,9 @@ * * @return 0 --success */ -static int -woal_config_commit(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *cwrq, - char *extra) +static int woal_config_commit(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *cwrq, char *extra) { ENTER(); @@ -416,9 +412,8 @@ * * @return 0 --success */ -static int -woal_get_name(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_name(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { char *cwrq = wrqu->name; ENTER(); @@ -437,9 +432,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_freq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -494,9 +488,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_freq(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -542,10 +535,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_bss_mode(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *wrqu, - char *extra) +static int woal_set_bss_mode(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -604,9 +596,8 @@ * * @return 0 --success */ -static int -woal_get_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_wap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -642,14 +633,12 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_wap(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; - const t_u8 bcast[MLAN_MAC_ADDR_LENGTH] = - { 255, 255, 255, 255, 255, 255 }; - const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; + const t_u8 bcast[MLAN_MAC_ADDR_LENGTH] = {255, 255, 255, 255, 255, 255}; + const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; moal_private *priv = (moal_private *)netdev_priv(dev); struct sockaddr *awrq = &wrqu->addr; mlan_ssid_bssid ssid_bssid; @@ -670,6 +659,7 @@ ret = -EFAULT; goto done; } + #ifdef REASSOCIATION /* Cancel re-association */ priv->reassoc_required = MFALSE; @@ -709,6 +699,7 @@ ret = -EFAULT; goto done; } + #ifdef REASSOCIATION memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != @@ -740,10 +731,9 @@ * * @return 0 --success */ -static int -woal_get_bss_mode(struct net_device *dev, - struct iw_request_info *info, union iwreq_data *wrqu, - char *extra) +static int woal_get_bss_mode(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u32 *uwrq = &wrqu->mode; @@ -763,9 +753,8 @@ * * @return 0 --success */ -static int -woal_set_sens(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_sens(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; @@ -785,9 +774,8 @@ * * @return -1 */ -static int -woal_get_sens(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_sens(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = -1; @@ -802,31 +790,31 @@ * * @param dev A pointer to net_device structure * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure + * @param vwrq A pointer to iwreq_data structure * @param extra A pointer to extra data buf * * @return 0 --success, otherwise fail */ -static int -woal_set_txpow(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_txpow(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *vwrq, char *extra) { int ret = 0; + struct iw_param *vwrq_ = (struct iw_param *)vwrq; moal_private *priv = (moal_private *)netdev_priv(dev); mlan_power_cfg_t power_cfg; ENTER(); - if (vwrq->disabled) { + if (vwrq_->disabled) { woal_set_radio(priv, 0); goto done; } woal_set_radio(priv, 1); - if (!vwrq->fixed) + if (!vwrq_->fixed) power_cfg.is_power_auto = 1; else { power_cfg.is_power_auto = 0; - power_cfg.power_level = vwrq->value; + power_cfg.power_level = vwrq_->value; } if (MLAN_STATUS_SUCCESS != @@ -845,16 +833,16 @@ * * @param dev A pointer to net_device structure * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure + * @param vwrq A pointer to iwreq_data structure * @param extra A pointer to extra data buf * * @return 0 --success, otherwise fail */ -static int -woal_get_txpow(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_txpow(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *vwrq, char *extra) { int ret = 0; + struct iw_param *vwrq_ = (struct iw_param *)vwrq; moal_private *priv = (moal_private *)netdev_priv(dev); mlan_power_cfg_t power_cfg; mlan_bss_info bss_info; @@ -871,16 +859,16 @@ goto done; } - vwrq->value = power_cfg.power_level; + vwrq_->value = power_cfg.power_level; if (power_cfg.is_power_auto) - vwrq->fixed = 0; + vwrq_->fixed = 0; else - vwrq->fixed = 1; + vwrq_->fixed = 1; if (bss_info.radio_on) { - vwrq->disabled = 0; - vwrq->flags = IW_TXPOW_DBM; + vwrq_->disabled = 0; + vwrq_->flags = IW_TXPOW_DBM; } else { - vwrq->disabled = 1; + vwrq_->disabled = 1; } done: @@ -898,9 +886,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_set_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_power(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0, disabled; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -934,9 +921,8 @@ * * @return MLAN_STATUS_SUCCESS --success, otherwise fail */ -static int -woal_get_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_power(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0, ps_mode = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -970,9 +956,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_retry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0, retry_val = vwrq->value; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1011,9 +996,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_retry(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int retry_val, ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1049,9 +1033,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_encode(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_set_encode(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1174,9 +1157,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_encode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_encode(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1273,9 +1255,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_rate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1309,9 +1290,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_rate(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1345,9 +1325,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_rts(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1385,9 +1364,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_rts(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int rthr, ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1420,9 +1398,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_frag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1460,9 +1437,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_get_frag(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0, fthr; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1496,9 +1472,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_gen_ie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_gen_ie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1538,15 +1513,14 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; int ie_len = dwrq->length; - const t_u8 wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; + const t_u8 wps_oui[] = {0x00, 0x50, 0xf2, 0x04}; mlan_ds_wps_cfg *pwps = NULL; mlan_ioctl_req *req = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -1599,10 +1573,9 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_encode_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_encode_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1686,8 +1659,9 @@ pkey_material, ext->key_len, sizeof(sec->param.encrypt_key.key_material)); PRINTM(MIOCTL, - "set wpa key key_index=%d, key_len=%d key_flags=0x%x " - MACSTR "\n", key_index, ext->key_len, + "set wpa key key_index=%d, key_len=%d key_flags=0x%x " MACSTR + "\n", + key_index, ext->key_len, sec->param.encrypt_key.key_flags, MAC2STR(sec->param.encrypt_key.mac_addr)); DBG_HEXDUMP(MCMD_D, "wpa key", pkey_material, ext->key_len); @@ -1703,11 +1677,11 @@ sec->param.encrypt_key.pn, (t_u8 *)ext->tx_seq, SEQ_MAX_SIZE, sizeof(sec->param.encrypt_key.pn)); - moal_memcpy_ext(priv->phandle, - &sec->param.encrypt_key. - pn[SEQ_MAX_SIZE], (t_u8 *)ext->rx_seq, - SEQ_MAX_SIZE, - sizeof(sec->param.encrypt_key.pn) - + moal_memcpy_ext( + priv->phandle, + &sec->param.encrypt_key.pn[SEQ_MAX_SIZE], + (t_u8 *)ext->rx_seq, SEQ_MAX_SIZE, + sizeof(sec->param.encrypt_key.pn) - SEQ_MAX_SIZE); DBG_HEXDUMP(MCMD_D, "WAPI PN", sec->param.encrypt_key.pn, PN_SIZE); @@ -1733,10 +1707,9 @@ * * @return -EOPNOTSUPP */ -static int -woal_get_encode_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_encode_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { ENTER(); LEAVE(); @@ -1753,9 +1726,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_set_mlme(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_mlme(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_mlme *mlme = (struct iw_mlme *)extra; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1763,7 +1735,6 @@ ENTER(); if ((mlme->cmd == IW_MLME_DEAUTH) || (mlme->cmd == IW_MLME_DISASSOC)) { - if (MLAN_STATUS_SUCCESS != woal_disconnect(priv, MOAL_IOCTL_WAIT, (t_u8 *)mlme->addr.sa_data, @@ -1783,9 +1754,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_auth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_auth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1881,9 +1851,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_auth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_auth(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -1962,9 +1931,8 @@ * * @return -EOPNOTSUPP */ -static int -woal_set_pmksa(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_pmksa(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { ENTER(); LEAVE(); @@ -1993,9 +1961,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_get_range(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_get_range(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int i; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -2008,7 +1975,7 @@ ENTER(); - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; pchan_list = kzalloc(sizeof(mlan_chan_list), flag); if (!pchan_list) { LEAVE(); @@ -2074,13 +2041,13 @@ range->max_encoding_tokens = 4; /** Minimum power period */ -#define IW_POWER_PERIOD_MIN 1000000 /* 1 sec */ +#define IW_POWER_PERIOD_MIN 1000000 /* 1 sec */ /** Maximum power period */ -#define IW_POWER_PERIOD_MAX 120000000 /* 2 min */ +#define IW_POWER_PERIOD_MAX 120000000 /* 2 min */ /** Minimum power timeout value */ -#define IW_POWER_TIMEOUT_MIN 1000 /* 1 ms */ +#define IW_POWER_TIMEOUT_MIN 1000 /* 1 ms */ /** Maximim power timeout value */ -#define IW_POWER_TIMEOUT_MAX 1000000 /* 1 sec */ +#define IW_POWER_TIMEOUT_MAX 1000000 /* 1 sec */ /* Power Management duration & timeout */ range->min_pmp = IW_POWER_PERIOD_MIN; @@ -2143,7 +2110,7 @@ #if (WIRELESS_EXT >= 18) range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_CCMP | IW_ENC_CAPA_CIPHER_TKIP; + IW_ENC_CAPA_CIPHER_CCMP | IW_ENC_CAPA_CIPHER_TKIP; #endif LEAVE(); return 0; @@ -2158,8 +2125,7 @@ * * @return 0 -- success, otherwise fail */ -static int -woal_set_rxfilter(moal_private *priv, BOOLEAN enable) +static int woal_set_rxfilter(moal_private *priv, BOOLEAN enable) { int ret = 0; mlan_ioctl_req *req = NULL; @@ -2205,9 +2171,8 @@ * * @return 0 --success, otherwise fail */ -static int -woal_set_priv(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_priv(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -2229,7 +2194,7 @@ ret = -EFAULT; goto done; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; buf = kzalloc(dwrq->length + 1, flag); if (!buf) { ret = -ENOMEM; @@ -2241,7 +2206,8 @@ } buf[dwrq->length] = '\0'; PRINTM(MIOCTL, "SIOCSIWPRIV request = %s\n", buf); - if (strncmp(buf, "RSSILOW-THRESHOLD", strlen("RSSILOW-THRESHOLD")) == 0) { + if (strncmp(buf, "RSSILOW-THRESHOLD", strlen("RSSILOW-THRESHOLD")) == + 0) { if (dwrq->length > strlen("RSSILOW-THRESHOLD") + 1) { pdata = buf + strlen("RSSILOW-THRESHOLD") + 1; if (MLAN_STATUS_SUCCESS != @@ -2269,7 +2235,8 @@ goto done; } len = sprintf(buf, "%s rssi %d\n", bss_info.ssid.ssid, - signal.bcn_rssi_avg) + 1; + signal.bcn_rssi_avg) + + 1; } else { len = sprintf(buf, "OK\n") + 1; } @@ -2281,12 +2248,14 @@ } PRINTM(MIOCTL, "tx rate=%d\n", (int)rate.rate); len = sprintf(buf, "LinkSpeed %d\n", - (int)(rate.rate * 500000 / 1000000)) + 1; + (int)(rate.rate * 500000 / 1000000)) + + 1; } else if (strncmp(buf, "MACADDR", strlen("MACADDR")) == 0) { len = sprintf(buf, "Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n", priv->current_addr[0], priv->current_addr[1], priv->current_addr[2], priv->current_addr[3], - priv->current_addr[4], priv->current_addr[5]) + 1; + priv->current_addr[4], priv->current_addr[5]) + + 1; } else if (strncmp(buf, "GETPOWER", strlen("GETPOWER")) == 0) { if (MLAN_STATUS_SUCCESS != woal_get_powermode(priv, &power_mode)) { @@ -2369,7 +2338,8 @@ len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "STOP", strlen("STOP")) == 0) { len = sprintf(buf, "OK\n") + 1; - } else if (strncmp(buf, "SETSUSPENDOPT", strlen("SETSUSPENDOPT")) == 0) { + } else if (strncmp(buf, "SETSUSPENDOPT", strlen("SETSUSPENDOPT")) == + 0) { /* it will be done by GUI */ len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0) { @@ -2382,7 +2352,8 @@ len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "BGSCAN-START", strlen("BGSCAN-START")) == 0) { len = sprintf(buf, "OK\n") + 1; - } else if (strncmp(buf, "BGSCAN-CONFIG", strlen("BGSCAN-CONFIG")) == 0) { + } else if (strncmp(buf, "BGSCAN-CONFIG", strlen("BGSCAN-CONFIG")) == + 0) { if (MLAN_STATUS_SUCCESS != woal_set_bg_scan(priv, buf, dwrq->length)) { ret = -EFAULT; @@ -2410,7 +2381,8 @@ goto done; #endif len = sprintf(buf, "OK\n") + 1; - } else if (strncmp(buf, "RXFILTER-STOP", strlen("RXFILTER-STOP")) == 0) { + } else if (strncmp(buf, "RXFILTER-STOP", strlen("RXFILTER-STOP")) == + 0) { #ifdef MEF_CFG_RX_FILTER ret = woal_set_rxfilter(priv, MFALSE); if (ret) @@ -2494,35 +2466,45 @@ * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ -static mlan_status -woal_wext_request_scan(moal_private *priv, t_u8 wait_option, - mlan_802_11_ssid *req_ssid) +static mlan_status woal_wext_request_scan(moal_private *priv, t_u8 wait_option, + mlan_802_11_ssid *req_ssid) { - wlan_user_scan_cfg scan_req; + wlan_user_scan_cfg *scan_req; mlan_scan_cfg scan_cfg; + mlan_status status; ENTER(); if (!woal_is_any_interface_active(priv->phandle)) { LEAVE(); return woal_request_scan(priv, wait_option, req_ssid); } + scan_req = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + memset(&scan_cfg, 0, sizeof(scan_cfg)); - memset(&scan_req, 0, sizeof(scan_req)); + memset(scan_req, 0, sizeof(wlan_user_scan_cfg)); if (req_ssid && req_ssid->ssid_len != 0) { - moal_memcpy_ext(priv->phandle, scan_req.ssid_list[0].ssid, + moal_memcpy_ext(priv->phandle, scan_req->ssid_list[0].ssid, req_ssid->ssid, req_ssid->ssid_len, MLAN_MAX_SSID_LENGTH); - scan_req.ssid_list[0].max_len = 0; + scan_req->ssid_list[0].max_len = 0; } woal_get_scan_config(priv, &scan_cfg); if (scan_cfg.scan_chan_gap) - scan_req.scan_chan_gap = scan_cfg.scan_chan_gap; + scan_req->scan_chan_gap = scan_cfg.scan_chan_gap; else - scan_req.scan_chan_gap = priv->phandle->scan_chan_gap; + scan_req->scan_chan_gap = priv->phandle->scan_chan_gap; /** indicate FW, gap is optional */ - if (scan_req.scan_chan_gap && priv->phandle->pref_mac) - scan_req.scan_chan_gap |= GAP_FLAG_OPTIONAL; + if (scan_req->scan_chan_gap && priv->phandle->pref_mac) + scan_req->scan_chan_gap |= GAP_FLAG_OPTIONAL; + status = woal_request_userscan(priv, wait_option, scan_req); + kfree(scan_req); LEAVE(); - return woal_request_userscan(priv, wait_option, &scan_req); + return status; } /** @@ -2535,9 +2517,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_set_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) +static int woal_set_scan(struct net_device *dev, struct iw_request_info *info, + struct iw_param *vwrq, char *extra) { int ret = 0; moal_private *priv = (moal_private *)netdev_priv(dev); @@ -2608,6 +2589,59 @@ } /** + * @brief Request scan based on connect parameter + * + * @param priv A pointer to moal_private structure + * @param ssid_bssid A pointer to mlan_ssid_bssid structure + * + * @return 0 -- success, otherwise fail + */ +static int woal_owe_specific_scan(moal_private *priv, + mlan_ssid_bssid *ssid_bssid) +{ + moal_handle *handle = priv->phandle; + int ret = 0; + wlan_user_scan_cfg *scan_req; + ENTER(); + if (handle->scan_pending_on_block == MTRUE) { + PRINTM(MINFO, "scan already in processing...\n"); + LEAVE(); + return ret; + } + scan_req = (wlan_user_scan_cfg *)kmalloc(sizeof(wlan_user_scan_cfg), + GFP_KERNEL); + if (!scan_req) { + PRINTM(MERROR, "Malloc buffer failed\n"); + LEAVE(); + return -ENOMEM; + } + + priv->report_scan_result = MTRUE; + memset(scan_req, 0x00, sizeof(wlan_user_scan_cfg)); + scan_req->keep_previous_scan = MTRUE; + moal_memcpy_ext(priv->phandle, scan_req->ssid_list[0].ssid, + ssid_bssid->trans_ssid.ssid, + ssid_bssid->trans_ssid.ssid_len, + sizeof(scan_req->ssid_list[0].ssid)); + scan_req->ssid_list[0].max_len = 0; + scan_req->chan_list[0].chan_number = ssid_bssid->channel; + if (ssid_bssid->bss_band == BAND_A) + scan_req->chan_list[0].radio_type = BAND_5GHZ; + else + scan_req->chan_list[0].radio_type = BAND_2GHZ; + scan_req->chan_list[0].scan_time = 0; + // TODO need set to PASSIVE TO ACTIVE on DFS channel + scan_req->chan_list[0].scan_type = MLAN_SCAN_TYPE_ACTIVE; + + moal_memcpy_ext(priv->phandle, scan_req->random_mac, priv->random_mac, + ETH_ALEN, sizeof(scan_req->random_mac)); + ret = woal_request_userscan(priv, MOAL_IOCTL_WAIT, scan_req); + kfree(scan_req); + LEAVE(); + return ret; +} + +/** * @brief Set essid * * @param dev A pointer to net_device structure @@ -2617,14 +2651,14 @@ * * @return 0--success, otherwise fail */ -static int -woal_set_essid(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; mlan_802_11_ssid req_ssid; mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *owe_ssid_bssid = NULL; #ifdef REASSOCIATION moal_handle *handle = priv->phandle; mlan_bss_info bss_info; @@ -2702,6 +2736,38 @@ goto setessid_ret; } + priv->auto_assoc_priv.drv_assoc.status = MFALSE; + priv->auto_assoc_priv.drv_reconnect.status = MFALSE; +#ifdef REASSOCIATION + if (priv->reassoc_on == MTRUE) { + if (priv->auto_assoc_priv.auto_assoc_type_on & + (0x1 << (AUTO_ASSOC_TYPE_DRV_ASSOC - 1))) { + if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) + woal_set_scan_type( + priv, MLAN_SCAN_TYPE_PASSIVE); + MOAL_REL_SEMAPHORE(&handle->reassoc_sem); + moal_memcpy_ext( + priv->phandle, + &priv->prev_ssid_bssid.ssid, &req_ssid, + sizeof(mlan_802_11_ssid), + sizeof(priv->prev_ssid_bssid.ssid)); + priv->auto_assoc_priv.auto_assoc_trigger_flag = + AUTO_ASSOC_TYPE_DRV_ASSOC; + priv->auto_assoc_priv.drv_assoc.status = MTRUE; + priv->reassoc_required = MTRUE; + priv->phandle->is_reassoc_timer_set = MTRUE; + PRINTM(MINFO, + " auto assoc: trigger driver auto assoc\n"); + woal_mod_timer(&priv->phandle->reassoc_timer, + 0); + ret = MLAN_STATUS_SUCCESS; + + LEAVE(); + return ret; + } + } +#endif + if (dwrq->flags != 0xFFFF) { if (MLAN_STATUS_SUCCESS != woal_find_essid(priv, &ssid_bssid, @@ -2730,6 +2796,34 @@ ret = -EFAULT; goto setessid_ret; } + if (ssid_bssid.trans_ssid.ssid_len && + (ssid_bssid.owe_transition_mode == OWE_TRANS_MODE_OPEN)) { + // We need scan for OWE AP + owe_ssid_bssid = (mlan_ssid_bssid *)kmalloc( + sizeof(mlan_ssid_bssid), GFP_KERNEL); + if (!owe_ssid_bssid) { + PRINTM(MERROR, "Malloc buffer failed\n"); + ret = -ENOMEM; + goto setessid_ret; + } + woal_owe_specific_scan(priv, &ssid_bssid); + memset(owe_ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + moal_memcpy_ext(priv->phandle, &owe_ssid_bssid->ssid, + &ssid_bssid.trans_ssid, + sizeof(mlan_802_11_ssid), + sizeof(owe_ssid_bssid->ssid)); + moal_memcpy_ext(priv->phandle, &owe_ssid_bssid->bssid, + &ssid_bssid.trans_bssid, + sizeof(mlan_802_11_mac_addr), + sizeof(owe_ssid_bssid->bssid)); + if (MLAN_STATUS_SUCCESS == + woal_find_essid(priv, owe_ssid_bssid, + MOAL_IOCTL_WAIT)) + moal_memcpy_ext(priv->phandle, &ssid_bssid, + owe_ssid_bssid, + sizeof(mlan_ssid_bssid), + sizeof(ssid_bssid)); + } if (MLAN_STATUS_SUCCESS != woal_11d_check_ap_channel(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { @@ -2761,6 +2855,7 @@ ret = -EFAULT; goto setessid_ret; } + #ifdef REASSOCIATION memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS != @@ -2782,6 +2877,8 @@ #ifdef REASSOCIATION MOAL_REL_SEMAPHORE(&handle->reassoc_sem); #endif + if (owe_ssid_bssid) + kfree(owe_ssid_bssid); LEAVE(); return ret; } @@ -2796,9 +2893,8 @@ * * @return 0--success, otherwise fail */ -static int -woal_get_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_get_essid(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); mlan_bss_info bss_info; @@ -2841,16 +2937,15 @@ * * @return 0--success, otherwise fail */ -static int -woal_get_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) +static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { moal_private *priv = (moal_private *)netdev_priv(dev); int ret = 0; char *current_ev = extra; char *end_buf = extra + IW_SCAN_MAX_DATA; - char *current_val; /* For rates */ - struct iw_event iwe; /* Temporary buffer */ + char *current_val; /* For rates */ + struct iw_event iwe; /* Temporary buffer */ unsigned int i; unsigned int j; mlan_scan_resp scan_resp; @@ -2875,7 +2970,7 @@ LEAVE(); return -EAGAIN; } - flag = (in_atomic() || irqs_disabled())? GFP_ATOMIC : GFP_KERNEL; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; buf = kzalloc((buf_size), flag); if (!buf) { PRINTM(MERROR, "Cannot allocate buffer!\n"); @@ -3072,21 +3167,20 @@ /* Skip time stamp, beacon interval and capability */ if (pbeacon) { pbeacon += sizeof(scan_table[i].beacon_period) + - sizeof(scan_table[i].time_stamp) + - sizeof(scan_table[i].cap_info); + sizeof(scan_table[i].time_stamp) + + sizeof(scan_table[i].cap_info); beacon_size -= sizeof(scan_table[i].beacon_period) + - sizeof(scan_table[i].time_stamp) + - sizeof(scan_table[i].cap_info); + sizeof(scan_table[i].time_stamp) + + sizeof(scan_table[i].cap_info); while ((unsigned int)beacon_size >= sizeof(IEEEtypes_Header_t)) { - element_id = - (IEEEtypes_ElementId_e)(*(t_u8 *) - pbeacon); + element_id = (IEEEtypes_ElementId_e)(*( + t_u8 *)pbeacon); element_len = *((t_u8 *)pbeacon + 1); if ((unsigned int)beacon_size < (unsigned int)element_len + - sizeof(IEEEtypes_Header_t)) { + sizeof(IEEEtypes_Header_t)) { PRINTM(MERROR, "Get scan: Error in processing IE, " "bytes left < IE length\n"); @@ -3102,37 +3196,32 @@ memset(&iwe, 0, sizeof(iwe)); memset(buf, 0, buf_size); ptr = buf; - moal_memcpy_ext(priv->phandle, buf, - praw_data, - element_len + - sizeof - (IEEEtypes_Header_t), - buf_size); + moal_memcpy_ext( + priv->phandle, buf, praw_data, + element_len + + sizeof(IEEEtypes_Header_t), + buf_size); iwe.cmd = IWEVGENIE; iwe.u.data.length = element_len + sizeof(IEEEtypes_Header_t); iwe.len = IW_EV_POINT_LEN + - iwe.u.data.length; - current_ev = - IWE_STREAM_ADD_POINT(info, - current_ev, - end_buf, - &iwe, buf); - current_val = - current_ev + IW_EV_LCP_LEN + - strlen(buf); + iwe.u.data.length; + current_ev = IWE_STREAM_ADD_POINT( + info, current_ev, end_buf, &iwe, + buf); break; #endif default: break; } pbeacon += element_len + - sizeof(IEEEtypes_Header_t); + sizeof(IEEEtypes_Header_t); beacon_size -= element_len + - sizeof(IEEEtypes_Header_t); + sizeof(IEEEtypes_Header_t); } } + #if WIRELESS_EXT > 14 memset(&iwe, 0, sizeof(iwe)); memset(buf, 0, buf_size); @@ -3140,9 +3229,9 @@ ptr += sprintf(ptr, "band="); memset(&iwe, 0, sizeof(iwe)); if (scan_table[i].bss_band == BAND_A) - ptr += sprintf(ptr, "a"); + sprintf(ptr, "a"); else - ptr += sprintf(ptr, "bg"); + sprintf(ptr, "bg"); iwe.u.data.length = strlen(buf); PRINTM(MINFO, "iwe.u.data.length %d\n", iwe.u.data.length); PRINTM(MINFO, "BUF: %s\n", buf); @@ -3150,7 +3239,6 @@ iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf, &iwe, buf); - current_val = current_ev + IW_EV_LCP_LEN + strlen(buf); #endif current_val = current_ev + IW_EV_LCP_LEN; @@ -3175,86 +3263,86 @@ * iwconfig settable callbacks */ static const iw_handler woal_handler[] = { - (iw_handler) woal_config_commit, /* SIOCSIWCOMMIT */ - (iw_handler) woal_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) woal_set_freq, /* SIOCSIWFREQ */ - (iw_handler) woal_get_freq, /* SIOCGIWFREQ */ - (iw_handler) woal_set_bss_mode, /* SIOCSIWMODE */ - (iw_handler) woal_get_bss_mode, /* SIOCGIWMODE */ - (iw_handler) woal_set_sens, /* SIOCSIWSENS */ - (iw_handler) woal_get_sens, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) woal_get_range, /* SIOCGIWRANGE */ - (iw_handler) woal_set_priv, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ + (iw_handler)woal_config_commit, /* SIOCSIWCOMMIT */ + (iw_handler)woal_get_name, /* SIOCGIWNAME */ + (iw_handler)NULL, /* SIOCSIWNWID */ + (iw_handler)NULL, /* SIOCGIWNWID */ + (iw_handler)woal_set_freq, /* SIOCSIWFREQ */ + (iw_handler)woal_get_freq, /* SIOCGIWFREQ */ + (iw_handler)woal_set_bss_mode, /* SIOCSIWMODE */ + (iw_handler)woal_get_bss_mode, /* SIOCGIWMODE */ + (iw_handler)woal_set_sens, /* SIOCSIWSENS */ + (iw_handler)woal_get_sens, /* SIOCGIWSENS */ + (iw_handler)NULL, /* SIOCSIWRANGE */ + (iw_handler)woal_get_range, /* SIOCGIWRANGE */ + (iw_handler)woal_set_priv, /* SIOCSIWPRIV */ + (iw_handler)NULL, /* SIOCGIWPRIV */ + (iw_handler)NULL, /* SIOCSIWSTATS */ + (iw_handler)NULL, /* SIOCGIWSTATS */ #if WIRELESS_EXT > 15 #ifdef CONFIG_WEXT_SPY - iw_handler_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ + iw_handler_set_spy, /* SIOCSIWSPY */ + iw_handler_get_spy, /* SIOCGIWSPY */ + iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ + iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ #else - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif #else /* WIRELESS_EXT > 15 */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif /* WIRELESS_EXT > 15 */ - (iw_handler) woal_set_wap, /* SIOCSIWAP */ - (iw_handler) woal_get_wap, /* SIOCGIWAP */ + (iw_handler)woal_set_wap, /* SIOCSIWAP */ + (iw_handler)woal_get_wap, /* SIOCGIWAP */ #if WIRELESS_EXT >= 18 - (iw_handler) woal_set_mlme, /* SIOCSIWMLME */ + (iw_handler)woal_set_mlme, /* SIOCSIWMLME */ #else - (iw_handler) NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ #endif - /* (iw_handler) wlan_get_aplist, *//* SIOCGIWAPLIST */ - NULL, /* SIOCGIWAPLIST */ + /* (iw_handler) wlan_get_aplist, */ /* SIOCGIWAPLIST */ + NULL, /* SIOCGIWAPLIST */ #if WIRELESS_EXT > 13 - (iw_handler) woal_set_scan, /* SIOCSIWSCAN */ - (iw_handler) woal_get_scan, /* SIOCGIWSCAN */ + (iw_handler)woal_set_scan, /* SIOCSIWSCAN */ + (iw_handler)woal_get_scan, /* SIOCGIWSCAN */ #else /* WIRELESS_EXT > 13 */ - (iw_handler) NULL, /* SIOCSIWSCAN */ - (iw_handler) NULL, /* SIOCGIWSCAN */ + (iw_handler)NULL, /* SIOCSIWSCAN */ + (iw_handler)NULL, /* SIOCGIWSCAN */ #endif /* WIRELESS_EXT > 13 */ - (iw_handler) woal_set_essid, /* SIOCSIWESSID */ - (iw_handler) woal_get_essid, /* SIOCGIWESSID */ - (iw_handler) woal_set_nick, /* SIOCSIWNICKN */ - (iw_handler) woal_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) woal_set_rate, /* SIOCSIWRATE */ - (iw_handler) woal_get_rate, /* SIOCGIWRATE */ - (iw_handler) woal_set_rts, /* SIOCSIWRTS */ - (iw_handler) woal_get_rts, /* SIOCGIWRTS */ - (iw_handler) woal_set_frag, /* SIOCSIWFRAG */ - (iw_handler) woal_get_frag, /* SIOCGIWFRAG */ - (iw_handler) woal_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) woal_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) woal_set_retry, /* SIOCSIWRETRY */ - (iw_handler) woal_get_retry, /* SIOCGIWRETRY */ - (iw_handler) woal_set_encode, /* SIOCSIWENCODE */ - (iw_handler) woal_get_encode, /* SIOCGIWENCODE */ - (iw_handler) woal_set_power, /* SIOCSIWPOWER */ - (iw_handler) woal_get_power, /* SIOCGIWPOWER */ + (iw_handler)woal_set_essid, /* SIOCSIWESSID */ + (iw_handler)woal_get_essid, /* SIOCGIWESSID */ + (iw_handler)woal_set_nick, /* SIOCSIWNICKN */ + (iw_handler)woal_get_nick, /* SIOCGIWNICKN */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)woal_set_rate, /* SIOCSIWRATE */ + (iw_handler)woal_get_rate, /* SIOCGIWRATE */ + (iw_handler)woal_set_rts, /* SIOCSIWRTS */ + (iw_handler)woal_get_rts, /* SIOCGIWRTS */ + (iw_handler)woal_set_frag, /* SIOCSIWFRAG */ + (iw_handler)woal_get_frag, /* SIOCGIWFRAG */ + (iw_handler)woal_set_txpow, /* SIOCSIWTXPOW */ + (iw_handler)woal_get_txpow, /* SIOCGIWTXPOW */ + (iw_handler)woal_set_retry, /* SIOCSIWRETRY */ + (iw_handler)woal_get_retry, /* SIOCGIWRETRY */ + (iw_handler)woal_set_encode, /* SIOCSIWENCODE */ + (iw_handler)woal_get_encode, /* SIOCGIWENCODE */ + (iw_handler)woal_set_power, /* SIOCSIWPOWER */ + (iw_handler)woal_get_power, /* SIOCGIWPOWER */ #if (WIRELESS_EXT >= 18) - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) woal_set_gen_ie, /* SIOCSIWGENIE */ - (iw_handler) woal_get_gen_ie, /* SIOCGIWGENIE */ - (iw_handler) woal_set_auth, /* SIOCSIWAUTH */ - (iw_handler) woal_get_auth, /* SIOCGIWAUTH */ - (iw_handler) woal_set_encode_ext, /* SIOCSIWENCODEEXT */ - (iw_handler) woal_get_encode_ext, /* SIOCGIWENCODEEXT */ - (iw_handler) woal_set_pmksa, /* SIOCSIWPMKSA */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)NULL, /* -- hole -- */ + (iw_handler)woal_set_gen_ie, /* SIOCSIWGENIE */ + (iw_handler)woal_get_gen_ie, /* SIOCGIWGENIE */ + (iw_handler)woal_set_auth, /* SIOCSIWAUTH */ + (iw_handler)woal_get_auth, /* SIOCGIWAUTH */ + (iw_handler)woal_set_encode_ext, /* SIOCSIWENCODEEXT */ + (iw_handler)woal_get_encode_ext, /* SIOCGIWENCODEEXT */ + (iw_handler)woal_set_pmksa, /* SIOCSIWPMKSA */ #endif /* WIRELESSS_EXT >= 18 */ }; @@ -3262,7 +3350,7 @@ * iwpriv settable callbacks */ static const iw_handler woal_private_handler[] = { - NULL, /* SIOCIWFIRSTPRIV */ + NULL, /* SIOCIWFIRSTPRIV */ }; #endif /* STA_SUPPORT */ @@ -3280,13 +3368,17 @@ * * @return N/A */ -void -woal_send_iwevcustom_event(moal_private *priv, char *str) +void woal_send_iwevcustom_event(moal_private *priv, char *str) { union iwreq_data iwrq; char buf[IW_CUSTOM_MAX]; ENTER(); + /* Check register_netdevice is completed before sending*/ + if (priv->netdev->reg_state != NETREG_REGISTERED) { + LEAVE(); + return; + } memset(&iwrq, 0, sizeof(union iwreq_data)); memset(buf, 0, sizeof(buf)); @@ -3314,8 +3406,7 @@ * * @return N/A */ -void -woal_send_mic_error_event(moal_private *priv, t_u32 event) +void woal_send_mic_error_event(moal_private *priv, t_u32 event) { union iwreq_data iwrq; struct iw_michaelmicfailure mic; @@ -3346,14 +3437,13 @@ .num_standard = ARRAY_SIZE(woal_handler), .num_private = ARRAY_SIZE(woal_private_handler), .num_private_args = ARRAY_SIZE(woal_private_args), - .standard = (iw_handler *) woal_handler, - .private = (iw_handler *) woal_private_handler, + .standard = (iw_handler *)woal_handler, + .private = (iw_handler *)woal_private_handler, .private_args = (struct iw_priv_args *)woal_private_args, #if WIRELESS_EXT > 20 .get_wireless_stats = woal_get_wireless_stats, #endif }; - // clang-format on /** @@ -3363,8 +3453,7 @@ * * @return A pointer to iw_statistics buf */ -struct iw_statistics * -woal_get_wireless_stats(struct net_device *dev) +struct iw_statistics *woal_get_wireless_stats(struct net_device *dev) { moal_private *priv = (moal_private *)netdev_priv(dev); t_u16 wait_option = MOAL_IOCTL_WAIT; @@ -3391,12 +3480,8 @@ if (priv->media_connected == MTRUE) { if (MLAN_STATUS_SUCCESS == woal_get_signal_info(priv, wait_option, NULL)) - priv->w_stats.qual.qual = woal_rssi_to_quality((t_s16) - (priv-> - w_stats. - qual. - level - - 0x100)); + priv->w_stats.qual.qual = woal_rssi_to_quality( + (t_s16)(priv->w_stats.qual.level - 0x100)); } #if WIRELESS_EXT > 18 priv->w_stats.qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM);
diff --git a/wlan_sd8987/mlinux/moal_wext.h b/wlan_sd8987/mlinux/moal_wext.h index c7ae47b..af13eff 100755 --- a/wlan_sd8987/mlinux/moal_wext.h +++ b/wlan_sd8987/mlinux/moal_wext.h
@@ -3,7 +3,7 @@ * @brief This file contains definition for wireless extension IOCTL call. * * - * Copyright 2008-2020 NXP + * Copyright 2008-2021 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991