From 5a38226a471d0bd0799e8957cb1a4276b58467d1 Mon Sep 17 00:00:00 2001 From: Sherry Sun Date: Mon, 10 Oct 2022 11:14:56 +0800 Subject: [PATCH] mxm_wifiex: update to mxm5x17362 release Driver Bug Fixes: ----------------- 1. WSW-19892: Driver compilation errors on older kernel version 2. WSW-19638: Enable RF Test Mode support for 9098 PCIE and SDIO 3. WCSWREL-370: oob irq request fail on i.MX93 9x9 qsb board 4. WSW-21756: WLAN Driver hang observed during WiFi connect/disconnect 5. WCSWREL-362: merge the L6.0.0 build errors fix patches 6. WSW-22054: STA CSA event is not propagated to cfg80211 7. WSW-21873: STA does not send probes after switching from DFS channel 8. WSW-21530: UDP Tx not able to send ARP when high bandwidth is used 9. WSW-21541: WFA Pre-Cert Channel switch test is failing 10. WSW-21072: AP stops sending CTS-to-Self in mcast Tx after issue mc_aggr_cfg Signed-off-by: Sherry Sun --- mxm_wifiex/wlan_src/Makefile | 4 +- mxm_wifiex/wlan_src/README_MLAN | 3582 ++++++++++- .../mapp/mlanconfig/config/coex_int_api.conf | 113 - .../config/ed_mac_ctrl_V1_8801.conf | 15 - .../config/ed_mac_ctrl_V2_8987.conf | 22 - .../config/ed_mac_ctrl_V2_8997.conf | 22 - .../config/ed_mac_ctrl_V2_iw416.conf | 22 - .../config/ed_mac_ctrl_V2_nw61x.conf | 22 - .../mapp/mlanconfig/config/keep_alive.conf | 24 - .../mapp/mlanconfig/config/robust_btc_MM.conf | 295 - .../config/txpwrlimit_cfg_8987.conf | 537 -- .../config/txpwrlimit_cfg_8997.conf | 621 -- .../config/txpwrlimit_cfg_iw416.conf | 497 -- .../mapp/mlanconfig/config/wifi_mod_para.conf | 204 - mxm_wifiex/wlan_src/mapp/mlanutl/Makefile | 59 - mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.c | 5353 ----------------- mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.h | 1202 ---- mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.c | 1790 ------ mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.h | 379 -- mxm_wifiex/wlan_src/mlan/mlan_11ac.c | 2 +- mxm_wifiex/wlan_src/mlan/mlan_11ax.c | 9 +- mxm_wifiex/wlan_src/mlan/mlan_11d.c | 31 +- mxm_wifiex/wlan_src/mlan/mlan_11h.c | 531 +- mxm_wifiex/wlan_src/mlan/mlan_11h.h | 21 +- mxm_wifiex/wlan_src/mlan/mlan_11n.c | 2 +- mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c | 6 +- mxm_wifiex/wlan_src/mlan/mlan_cfp.c | 55 +- mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c | 41 +- mxm_wifiex/wlan_src/mlan/mlan_decl.h | 26 +- mxm_wifiex/wlan_src/mlan/mlan_fw.h | 42 +- mxm_wifiex/wlan_src/mlan/mlan_ieee.h | 2 + mxm_wifiex/wlan_src/mlan/mlan_init.c | 2 +- mxm_wifiex/wlan_src/mlan/mlan_ioctl.h | 39 + mxm_wifiex/wlan_src/mlan/mlan_join.c | 6 +- mxm_wifiex/wlan_src/mlan/mlan_main.h | 15 +- mxm_wifiex/wlan_src/mlan/mlan_misc.c | 77 +- mxm_wifiex/wlan_src/mlan/mlan_pcie.c | 131 +- mxm_wifiex/wlan_src/mlan/mlan_scan.c | 35 +- mxm_wifiex/wlan_src/mlan/mlan_sdio.c | 2 + mxm_wifiex/wlan_src/mlan/mlan_shim.c | 15 +- mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c | 44 + mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c | 52 +- mxm_wifiex/wlan_src/mlan/mlan_sta_event.c | 24 +- mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c | 50 +- mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c | 75 +- mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c | 41 +- mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c | 4 + mxm_wifiex/wlan_src/mlan/mlan_usb.c | 10 + mxm_wifiex/wlan_src/mlan/mlan_wmm.c | 7 + mxm_wifiex/wlan_src/mlinux/mlan_decl.h | 26 +- mxm_wifiex/wlan_src/mlinux/mlan_ieee.h | 2 + mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h | 39 + mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c | 186 +- mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h | 7 +- .../wlan_src/mlinux/moal_cfg80211_util.c | 41 +- .../wlan_src/mlinux/moal_cfg80211_util.h | 2 + mxm_wifiex/wlan_src/mlinux/moal_debug.c | 4 + mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c | 750 ++- mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h | 3 + mxm_wifiex/wlan_src/mlinux/moal_init.c | 50 +- mxm_wifiex/wlan_src/mlinux/moal_ioctl.c | 78 +- mxm_wifiex/wlan_src/mlinux/moal_main.c | 771 ++- mxm_wifiex/wlan_src/mlinux/moal_main.h | 83 +- mxm_wifiex/wlan_src/mlinux/moal_pcie.c | 23 +- mxm_wifiex/wlan_src/mlinux/moal_priv.c | 1 + mxm_wifiex/wlan_src/mlinux/moal_proc.c | 4 +- mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c | 27 +- mxm_wifiex/wlan_src/mlinux/moal_shim.c | 176 +- .../wlan_src/mlinux/moal_sta_cfg80211.c | 317 +- mxm_wifiex/wlan_src/mlinux/moal_uap.c | 201 +- mxm_wifiex/wlan_src/mlinux/moal_uap.h | 23 +- .../wlan_src/mlinux/moal_uap_cfg80211.c | 263 +- mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c | 5 +- mxm_wifiex/wlan_src/mlinux/moal_wext.c | 45 +- mxm_wifiex/wlan_src/script/unload | 2 + 75 files changed, 7206 insertions(+), 12083 deletions(-) delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/coex_int_api.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V1_8801.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8987.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8997.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_iw416.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_nw61x.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/keep_alive.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/robust_btc_MM.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8987.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8997.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_iw416.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanconfig/config/wifi_mod_para.conf delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanutl/Makefile delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.c delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.h delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.c delete mode 100644 mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.h diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index 5cacdb5..50b15b1 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -604,9 +604,9 @@ appsbuild: fi cp -f README_MLAN $(BINDIR) - cp -rf mapp/mlanconfig/config $(BINDIR) ifneq ($(APPDIR),) + cp -rf mapp/mlanconfig/config $(BINDIR) $(MAKE) -C mapp/mlanutl $@ INSTALLDIR=$(BINDIR) endif @@ -623,9 +623,9 @@ build: echo default cp -rpf script/unload $(BINDIR)/ cp -f README_MLAN $(BINDIR) - cp -rf mapp/mlanconfig/config $(BINDIR) ifneq ($(APPDIR),) + cp -rf mapp/mlanconfig/config $(BINDIR) $(MAKE) -C mapp/mlanutl $@ INSTALLDIR=$(BINDIR) endif diff --git a/mxm_wifiex/wlan_src/README_MLAN b/mxm_wifiex/wlan_src/README_MLAN index b76529c..1331f5d 100644 --- a/mxm_wifiex/wlan_src/README_MLAN +++ b/mxm_wifiex/wlan_src/README_MLAN @@ -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.15. + 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") @@ -67,6 +67,10 @@ hw_test=0|1 fw_serial=0|1 req_fw_nowait=0|1 + dfs53cfg=0|1|2 + mcs32=0|1 + SD8887: antcfg=0|1|2|0xffff + SD8897/SD8997: antcfg=0x11|0x13|0x33 slew_rate: Slew Rate Control value = 0|1|2|3 (0 is the slowest slew rate and 03 has the highest slew rate (default)) init_cfg= e.g. copy init_cfg.conf to firmware directory, init_cfg=nxp/init_cfg.conf @@ -103,6 +107,7 @@ pcie_int_mode=0|1|2 pcie_int_mode=0|1 ring_size=32|64|128|256|512 + aggrctrl=1|0 usb_aggr=0|1|2 low_power_mode_enable=0|1 When low power mode is enabled, the output power will be clipped at ~+10dBm and the @@ -123,12 +128,14 @@ inact_tmo=0|x roamoffload_in_hs=0|1 uap_max_sta: Maximum number of STA for UAP/GO (default 0, max 64) - host_mlme=0|1 + host_mlme=0|1 for supplicant/authenticator running on host side, WPA3 support is available only in host_mlme mode country_ie_ignore=0|1 beacon_hints=0|1 chan_track=0|1 for 9098 only + keep_previous_scan=0|1, + Note: On some platforms (e.g. PXA910/920) double quotation marks ("") need to used for module parameters. @@ -263,6 +270,21 @@ hs_skip_count = hs_force_count = + Issue SDIO cmd52 read/write through proc. + Usage: + echo "sdcmd52rw= [data]" > /proc/mwlan/adapterX/config + where the parameters: + func: The function number to use (0-7) + reg: The address of the register + data: The value to write, read if the value is absent + For SDIO MMC driver, only function 0 and WLAN function access is allowed. + And there is a limitation for function 0 write, only vendor specific CCCR + registers (0xf0 -0xff) are permiited. + Examples: + echo "sdcmd52rw= 0 4" > /proc/mwlan/adapterX/config # read func 0 address 4 + cat /proc/mwlan/adapterX/config # display the register value + echo "sdcmd52rw= 1 3 0xf" > /proc/mwlan/adapterX/config # write 0xf to func 1 address 3 + Issue debug_dump command through proc. Usage: echo "debug_dump" > /proc/mwlan/adapterX/config @@ -388,6 +410,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 @@ -395,6 +424,11 @@ 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 + 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 =============================================================================== U S E R M A N U A L F O R MLANUTL @@ -440,6 +474,252 @@ SYNOPSIS mlanutl mlanX mefcfg mlanutl mlanX cloud_keep_alive mlanutl mlanX min_ba_threshold + mlanutl mlanX 11dcfg + mlanutl mlanX 11dclrtbl + mlanutl mlanX addts + mlanutl mlanX amsduaggrctrl + mlanutl mlanX antcfg [m] [n] + mlanutl mlanX/uapX mimoswitch [tx_antmode] [rx_antmode] + mlanutl mlanX arpfilter + mlanutl mlanX assocctrl [k] [l] [m] [n] + mlanutl mlanX assocessid <"[essid]"> + mlanutl mlanX assocessid_bssid <"[bssid] [essid]"> + mlanutl mlanX associate " " + mlanutl mlanX get_chnrgpwr [save_region_channel_power_data_file] + mlanutl mlanX comparergpwr [target_file] + mlanutl mlanX comparetrpc [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 [] + mlanutl mlanX cfpcode [m] [n] + mlanutl mlanX changraph [ ] + mlanutl mlanX coex_rx_winsize [m] + mlanutl mlanX countrycode [l] + + mlanutl mlanX cfpinfo + mlanutl uapX cfpinfo + + mlanutl mlanX customie [[[] ] ] + mlanutl mlanX deauth [l] + mlanutl uapX deauth [l] + mlanutl mlanX deepsleep [l] [m] + mlanutl mlanX delba [ ] + mlanutl uapX delba [ ] + mlanutl mlanX delts + mlanutl mlanX dfstesting [ ] + mlanutl uapX clear_nop + mlanutl uapX nop_list + mlanutl uapX fake_radar + mlanutl uapX getchload + mlanutl dfsX dfs_cac [ ] + mlanutl dfsX autodfs [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 [] + mlanutl mlanX fwmacaddr [mac_addr] + mlanutl mlanX getkey + mlanutl mlanX getscantable [ARGS] + mlanutl uapX getstalist + mlanutl uapX channel_switch + mlanutl mlanX hostcmd <11n_2040coex.conf> 2040coex + mlanutl mlanX hostcmd auto_tx_get + mlanutl mlanX hostcmd auto_tx_unreg + mlanutl mlanX hostcmd bgscfg + + mlanutl mlanX hostcmd coalesce_cfg + mlanutl mlanX hostcmd ed_mac_ctrl + mlanutl mlanX hostcmd crypto_test + mlanutl mlanX hostcmd nat_keep_alive + mlanutl mlanX hostcmd pad_cfg_get + mlanutl mlanX hostcmd pad_cfg_set + mlanutl mlanX hostcmd requesttpc + mlanutl mlanX hostcmd mode_get + mlanutl mlanX hostcmd mode_timeshare + mlanutl mlanX hostcmd mode_spatial + mlanutl mlanX hostcmd mode_none + mlanutl mlanX hostcmd mode_bca + mlanutl mlanX hostcmd gpio_cfg + mlanutl mlanX hostcmd external_coex_config + mlanutl mlanX hostcmd external_coex_pta_config + mlanutl mlanX hostcmd external_coex_uart_config + mlanutl mlanX hostcmd generictime + mlanutl mlanX hostcmd a2dptime + mlanutl mlanX hostcmd inquirytim + mlanutl mlanX hostcmd ap_generictime + mlanutl mlanX hostcmd ap_a2dptime + mlanutl mlanX hostcmd ap_inquirytime + mlanutl mlanX hostcmd get_bca_arb_config + mlanutl mlanX hostcmd set_en_bca_arb_config + mlanutl mlanX hostcmd set_dis_bca_arb_config + mlanutl mlanX hostcmd set_wlan_traffic_priority + mlanutl mlanX hostcmd get_wlan_traffic_priority + mlanutl mlanX hostcmd get_wlan_stats + mlanutl mlanX hostcmd get_15_4_stats + mlanutl mlanX hostcmd get_bt_stats + mlanutl mlanX hostcmd get_ble_stats + mlanutl mlanX hostcmd sdio_pulldown_disable + mlanutl mlanX hostcmd sdio_pulldown_get + mlanutl mlanX hostcmd sdio_pulldown_set + mlanutl mlanX hostcmd subevent_get + mlanutl mlanX hostcmd subevent_set + mlanutl mlanX hostcmd txpwrlimit_2g_cfg_set + mlanutl mlanX hostcmd txpwrlimit_5g_cfg_set + mlanutl mlanX hostcmd txpwrlimit_cfg_get + mlanutl mlanX hostcmd txrate_cfg_get + mlanutl mlanX hostcmd txrate_cfg_set_bg + mlanutl mlanX hostcmd txrate_cfg_set_bgn + mlanutl mlanX hostcmd generate_raw + mlanutl mlanX hostcmd fwdump + + mlanutl mlanX hostcmd stop_su + mlanutl mlanX hostcmd start_su + + mlanutl mlanX hotspotcfg [] + mlanutl mlanX hscfg [condition [[GPIO# [gap]]]] [ind_GPIO# [level]] + mlanutl mlanX mgmtfilter + mlanutl mlanX auto_arp [n] + mlanutl mlanX htstreamcfg [n] + mlanutl mlanX httxbfcap [cap] + mlanutl mlanX httxbfcfg "[;GlobalData/tsData/interval/txPeerData/snrData]" + mlanutl mlanX inactivityto [k] + mlanutl mlanX ipaddr [";"] + mlanutl mlanX linkstats + mlanutl mlanX listeninterval [l] + mlanutl mlanX macctrl [n] + mlanutl uapX macctrl [n] + mlanutl mlanX memrdwr
[value] + mlanutl mlanX miracastcfg [l] [m] [n] + mlanutl mlanX mgmtframectrl [] + mlanutl uapX mgmtframectrl [] + mlanutl mlanX mgmtframetx + mlanutl mlanX mpactrl [tx_ena] [rx_ena] [tx_size] [rx_size] [tx_ports] [rx_ports] + mlanutl mlanX netmon [ [ ]] + mlanutl mlanX monitormode [l] + mlanutl mlanX offchannel [ ] + mlanutl mlanX otpuserdata + mlanutl mlanX passphrase [l] + mlanutl mlanX pb_bypass [data_1, data_2, ... data_n] + mlanutl mlanX pcieregrw [value] + mlanutl mlanX pciebar0regrw [value] + mlanutl mlanX pmfcfg + 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 robustcoex [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 [Queue Id: 0-3] + mlanutl mlanX qoscfg + mlanutl mlanX qstatus + mlanutl mlanX radioctrl [n] + mlanutl mlanX rdeeprom + mlanutl mlanX reassoctrl [n] + mlanutl mlanX regioncode [n] + mlanutl mlanX regrdwr [value] + mlanutl mlanX rejectaddbareq [conditions] + mlanutl uapX rejectaddbareq [conditions] + mlanutl mlanX scancfg [t] [m] [p] [s] [a] [b] [c] [ext] [gap] + mlanutl mlanX sdcmd52rw
[data] + mlanutl mlanX sdcmd53rw
[data1] ... [dataN] + mlanutl mlanX sdioclock + mlanutl mlanX setuserscan [ARGS] + mlanutl mlanX cancelscan + mlanutl mlanX sleepparams [ ] + mlanutl mlanX sleeppd [n] + mlanutl mlanX sysclock [clk1] [clk2] [clk3] [clk4] + mlanutl mlanX tcpackenh [l] [m] + mlanutl mlanX tdls_channel_switch + mlanutl mlanX tdls_config <0/1> + mlanutl mlanX tdls_cs_params + 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 + mlanutl mlanX tdls_link_status + mlanutl mlanX tdls_powermode + mlanutl mlanX tdls_setinfo + mlanutl mlanX tdls_setup + mlanutl mlanX tdls_stop_channel_switch + mlanutl mlanX tdls_teardown + 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 per_pkt_cfg [tx_rx_control] [type_num] [ether_type1 ether_type2 ...] [tx_rx_control] [type_num] [ether_type1 ether_type2 ...] + mlanutl dot11_txrx + 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 p2pX cfg_noa [h] [i] [j] [k] [l] + mlanutl p2pX cfg_opp_ps [m] [n] + mlanutl mlanX get_sensor_temp + mlanutl indrstcfg [gpio_pin] + + + mlanutl uapX ctrldeauth + + mlanutl mlanX/uapX bootsleep <1/0> + + mlanutl mlanX ssu [mode] [ssu file] + + mlanutl mlanX csi + + mlanutl mlanX arb [mode] + + mlanutl mlanX dmcs [value] + + mlanutl mlanX/uapX range_ext [mode] + mlanutl mlanX twt_setup [config/twt.conf] + mlanutl mlanX twt_teardown [config/twt.conf] + mlanutl rx_abort_cfg [enable] [rssi_threshold] + mlanutl rx_abort_cfg_ext [enable] [margin ceil_thresh] + mlanutl tx_ampdu_prot_mode [mode] + mlanutl rate_adapt_cfg [low_thresh high_thresh timer_interval] + mlanutl cck_desense_cfg [mode] [margin ceil_thresh] [num_on_intervals num_off_intervals] + mlanutl mlanX/uapX lpm [mode] + mlanutl 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 + mlanutl getuuid DESCRIPTION Those commands are used to send additional commands to the NXP MLAN @@ -1128,6 +1408,26 @@ htcapinfo Usage: mlanutl 11axcmd [value_1] [value_2] + : spatial reuse configuration + set obss_pd offset, [value_1] = NON_SRG_OffSET, [value_2] = SRG_OFFSET + + : spatial reuse configuration + control SR, [value_1]= 1 is enable SR, [value_1] = 0 is disable SR + + : enable/disable beam change + enable beam_change when [value_1 = 0] + disable beam_change when [value_1 = 1] + + : enable/disable HTC transmission + enable transmission of HTC when [value_1 = 1] + disable transmission of HTC when [value_1 = 0] + + : 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 = ]. If = 1023, disable TXOP duration RTS + get TXOP duration RTS Threshold without value_1 and value_2 + Where is: + Bit 0-9: TXOP RTS Threshold : 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 = ], where is defined as: @@ -1145,6 +1445,13 @@ htcapinfo 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 @@ -1321,9 +1628,6 @@ hssetpara This command is used to set host sleep parameters. Usage: - echo "hssetpara=2 0xff 0xc8 3 400" > /proc/mwlan/adapter0/config - echo "hssetpara=2 1 0xc8 3 400 " > /proc/mwlan/adapter0/config - 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 @@ -1490,3 +1794,3269 @@ min_ba_threshold 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 + +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 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 + + 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 [k] [l] [m] [n] + + Where the parameters are: + : 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] + 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 [target_file] + where: + : raw data file save from get_chnrgpwr command. + : 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 [display] + where: + : raw data file save from get_txpwrlimit command. + : raw data file used by driver load parameter "txpwrlimit_cfg" which will be download to FW during driver init. + : 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 + 0: 802.11 open system authentication + 1: 802.11 shared key authentication + 3: 802.11 WPA3 SAE 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 open system or shared key authentication + mlanutl mlan0 authtype : get current setting + +autotdls + This command is used to enable/disable auto TDLS. + + Usage: + mlanutl mlanX autotdls [n] + + where + 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 + 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 + 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 + 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 + - 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 [<.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 [ ] + 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 [[[] ] ] + + Where the parameter is: + empty - Get all IE settings + : 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 + : 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 = 0 to clear the mask and the IE buffer + : 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 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 [ ] + - This is the direction of BA stream, Tx (bit 0), Rx (bit 1). + - This is the TID (0-7, 0xff for all) of BA stream. + - 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 + +dfstesting + This command is used to set/get settings for DFS testing. + + Usage: + mlanutl mlanX dfstesting [ ] + + where is user-configured Channel Availability Check in sec + 0 = disable, use default period (60 seconds) + 1-1800 = enable with that period + where is user-configured Non-Occupancy Period in sec + 0 = disable, use default period (1800) + 1-65535 = enable with that period + where is enable/disable no channel change on radar + 0 = disable, 1 = enable (overrides below) + where 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 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 and noise floor value +Usage: + mlanutl uapX getchload + can be within 1-10(specifying 10ms to 100ms), default duration will be 100ms + + Examples: + mlanutl uap0 getchload : gets channel load, noise floor and rx_quality for 100ms duration + mlanutl uap0 getchload 1 : gets channel load, noise floor and rx_quality for 10ms duration + mlanutl uap0 getchload 6 : gets channel load, noise floor and rx_quality for 60ms duration + +dfs_repeater + This command is used to get/set DFS Repeater mode. + + Usage: + mlanutl mlan0 dfs_repeater + + where the parameter is : + 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 [ ] + + where the parameters are: + 5G DFS channel to monitor for radar, when channel=0, stop CAC. + channel band-width (default 20MHZ) + 0 - Bandwidth 20MHz + 1 - Bandwidth 40MHz above + 3 - Bandwidth 40MHz below + 4 - Bandwidth 80MHz + 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: + 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: + 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 + - 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 + - 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 + - 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 [] + + where : 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 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 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 dot11_txrx + interface : mlanX or uapX + options send : + conf_file : config file name + options recv : [ 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 + 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) + 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 + +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 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 coalesce_cfg + +hostcmd ed_mac_ctrl + This command is used to control ED MAC. + + Usage: + mlanutl mlanX hostcmd 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 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 + +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 [] + + Where the parameter is: + : 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 + + where + 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 + 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 "[;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 + .. + 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 ; + + 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 [k] + + where the parameter are: + : timeout unit in microseconds. + : Inactivity timeout for unicast data. + : 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 [";"] + + where + 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 + 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
[value] + + where the parameters are, +
: 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 [] + mlanutl uapX mgmtframectrl [] + + Where the parameter is: + : 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 + + 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 netmon [ [ ]] + + Where the parameters are: + : mlanX + : (0) disable any network monitor activity + : (1) enable channel specified sniffer mode activity + : 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 + : 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 + : channel to monitor + : [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 + +monitormode + This command is used to set/get monitor mode. + Note: The enable monitor mode setting should be issued when no active interface exist. + Before we want to use sniffer mode, need enable monitor mode. + After this can only use sniffer mode, don't make STA/P2P/UAP work. + When sniffer mode using done, should disable monitor mode. + + Usage: + mlanutl mlanX monitormode [l] + + where the parameter: + [l] + 0 : Disable monitor mode + 1 : Enable monitor mode + : Get monitor mode + + Examples: + mlanutl mlan0 monitormode : Get monitor mode. + mlanutl mlan0 monitormode 1 : Enable monitor mode. + +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 [ ] + + where + + 0 : Cancel the offchannel configuration + 1 : Set the offchannel configuration + + The channel to configure + + The duration for which to configure + : 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 + is + - 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 + 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;" - 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;; + " - 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;" - 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=;sae_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 [value] + + where the parameters are, + : 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 [value] + + where the parameters are, + : 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 + + where + : Management Frame Protection Capable (MFPC) + 1: Management Frame Protection Capable + 0: Management Frame Protection not Capable + : 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 + : 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 [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 + + where the parameters are, + : multiples of 4 + : 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 [value] + + where the parameters are, + : 1:MAC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA, 8:CIU, 0x81:MAC2, 0x82:BBP2, 0x83: RF2, 0x87: BCA2 + : 1:MAC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA, 8:CIU + : 1:MAC/SOC, 2:BBP, 3:RF, 5:CAU, 6:PSU, 7:BCA + : 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 [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
[data1] ... [dataN] + + where the parameters are, + : function number (0/1/2/..) +
: data address + : byte mode/block mode (0/1) + : block size (32/64/../512, NA for byte mode) + : block number or byte number + ... : 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= 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 [ ] + + 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 [] + + 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 + + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 is + - This is the channel width setting for the opermodecfg + 1: 20MHz + 2: 40MHz + 3: 80MHz + 4: 160MHz or 80+80MHz + + where is + - 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 + +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. + +rxpktcoal_cfg + This is used to get/set RX packet coalescing paramters + Usage: + mlanutl mlanX rxpktcoal_cfg [m] [n] + + where: + [m]: pkt_threshold: count after which packets would be sent to host. Valid values 1-7 + [n]: delay: timeout in ms after which packets would be sent to host. Valid values 1-4 + Coalescing is disabled if both or either of packet_thershold and delay is zero + + RX packet coalescing parameters can be changed only when device is in + idle state i.e. all interfaces are disconnected. + +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 indrstcfg [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 + + 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 robustcoex [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 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 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 : 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 [value] + + : config mapping policy + disable dynamic mapping when [value = 0] + enable dynamic mapping when [value = 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 rx_abort_cfg [enable] [rssi_threshold] + + Where the parameters are: + : 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 rx_abort_cfg_ext [enable] [margin ceil_thresh] + + Where the parameters are: + : 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 tx_ampdu_prot_mode [mode] + + Where the parameters are: + : 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 rate_adapt_cfg + [sr_rateadapt low_thresh high_thresh timer_interval] + + Where the parameters are: + : 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 cck_desense_cfg [mode] [margin ceil_thresh] + [num_on_intervals num_off_intervals] + + Where the parameters are: + : 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 dot11mc_unassoc_ftm_cfg [enable] + + Where the parameters are: + : 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 + - This parameter use to configure GPIO TSF latch mode + 0: GPIO level + 1: GPIO toggle + 2: GPIO toggle on Next Beacon. + [k] 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 mcast_tx + where + : wifi interface name i.e. uap0 + : 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 + + Usage: + ./mlanutl 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/mxm_wifiex/wlan_src/mapp/mlanconfig/config/coex_int_api.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/coex_int_api.conf deleted file mode 100644 index 5d8bfac..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/coex_int_api.conf +++ /dev/null @@ -1,113 +0,0 @@ -# File : coex_int_api.conf - -######################### Coex API command ############### -get_bca_arb_config={ - CmdCode=0x0277 # do NOT change this line - - # BCA Arbitration TLV - BCAArbitrationTLVType:2=0x024B # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=0 # GET - Arbitration_Enable:1=0x00 # Read-back BCA Arb Settings - Grant_Policy:1=0 # Read-back Grant Policy acc to Ant and Isolation config - Priority_Remap_WLAN:16=0 # Read-back remapped WLAN priority - Priority_Remap_BT:4=0 # Read-back remapped BT priority - Priority_Remap_15_4:4=0 # Read-back remapped 15.4 priority - Priority_Ramap_ExtRadio:4=0 # Read-back remapped External Radio - } -} - -set_en_bca_arb_config={ - CmdCode=0x0277 # do NOT change this line - - # BCA Arbitration TLV - BCAArbitrationTLVType:2=0x024B # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=1 # SET - Arbitration_Enable:1=0x01 # Set BCA Arb Settings - Grant_Policy:1=0 # Set Grant Policy acc to Ant and Isolation config - Priority_Remap_WLAN:16='0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x78' # Set remapped WLAN priority - Priority_Remap_BT:4='0x80,0x88,0x90,0x98' # Set remapped BT priority - Priority_Remap_15_4:4='0xA0,0xA8,0xB0,0xB8' # Set remapped 15.4 priority - } -} - -set_dis_bca_arb_config={ - CmdCode=0x0277 # do NOT change this line - - # BCA Arbitration TLV - BCAArbitrationTLVType:2=0x024B # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=1 # SET - Arbitration_Enable:1=0x00 # Clear BCA Arb Settings - Grant_Policy:1=0 # Set Grant Policy acc to Ant and Isolation config - Priority_Remap_WLAN:16='0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x78' # Set remapped WLAN priority - Priority_Remap_BT:4='0x80,0x88,0x90,0x98' # Set remapped BT priority - Priority_Remap_15_4:4='0xA0,0xA8,0xB0,0xB8' # Set remapped 15.4 priority - } -} - -set_wlan_traffic_priority={ - CmdCode=0x0277 # do NOT change this line - - # COEX WLAN Traffic Priority TLV - BCAArbitrationTLVType:2=0x024C # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=1 # SET - Mode:1=1 # 1 - Qbased based;0-Packet type based - Mask_1:4=0xffffffff # This value will be read in little endian format in firmware,Tx_Priority_setting[t] t = 0 – 31, set bits to indicate which entry need to update priorities - Mask_2:4=0xffffffff # Tx_Priority_setting[t] t= 32 – 63, set bits to indicate which entry need to update priorities - Mask_3:4=0xffffffff # Rx_Priority_setting[t] t= 0 – 31, set bits to indicate which entry need to update priorities - Mask_4:4=0xffffffff # Rx_Priority_setting[t] t= 32 – 63, set bits to indicate which entry need to update priorities - Tx_Priority_setting:64='0xf,0xf,0xf,0xf,0xf,0xf,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x08,0x08,0x8,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40' # WLAN Tx Traffic priorities - Rx_Priority_setting:64='0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80' # WLAN Rx Traffic priorities - } -} - -get_wlan_traffic_priority={ - CmdCode=0x0277 # do NOT change this line - - # COEX WLAN Traffic Priority TLV - BCAArbitrationTLVType:2=0x024C # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=0 # GET WLAN Traffic priorities - Mode:1=0 # (Qbased based - 1) or (Packet type based - 0) - Mask_1:4=0 # GET mask 1 - Mask_2:4=0 # GET mask 2 - Mask_3:4=0 # GET mask 3 - Mask_4:4=0 # GET mask 4 - Tx_Priority_setting:64=0 # GET WLAN Tx Traffic priorities - Rx_Priority_setting:64=0 # GET WLAN Rx Traffic priorities - } -} - -get_wlan_stats={ - CmdCode=0x0277 # do NOT change this line - - # BCA Arbitration TLV - BCAArbitrationTLVType:2=0x024F # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=0 # GET WLAN Statistics - length:4=40 # Length of collected statistics - stats:40=0 # Accumulated Statistics - } -} - -get_15_4_stats={ - CmdCode=0x0277 # do NOT change this line - - # BCA Arbitration TLV - BCAArbitrationTLVType:2=0x024F # do NOT change this line - RobustCoexTlvLength:2={ - Version:2=0x1 # Firecrest - Action:2=2 # GET 15.4 Statistics - length:4=52 # Length of collected statistics - stats:52=0 # Accumulated Statistics - } -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V1_8801.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V1_8801.conf deleted file mode 100644 index c673547..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V1_8801.conf +++ /dev/null @@ -1,15 +0,0 @@ -# File : ed_mac_ctrl_V1_8801.conf -# -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V1_8801.conf ed_mac_ctrl -# -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl={ - CmdCode=0x0124 #Command code, DO NOT change this line - Enable:2=0x1 # 0 - disable EU adaptivity - # 1 - enable EU adaptivity - - Offset:2=0x1b # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8987.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8987.conf deleted file mode 100644 index c5ec4bf..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8987.conf +++ /dev/null @@ -1,22 +0,0 @@ -# File : ed_mac_ctrl_V2_8987.conf -# -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_8987.conf ed_mac_ctrl_v2 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v2={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0x6 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0x6 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8997.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8997.conf deleted file mode 100644 index 76d2dab..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_8997.conf +++ /dev/null @@ -1,22 +0,0 @@ -# File : ed_mac_ctrl_V2_8997.conf -# -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_8997.conf ed_mac_ctrl_v2 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v2={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0x0 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0x4 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_iw416.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_iw416.conf deleted file mode 100644 index 8d2cce6..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_iw416.conf +++ /dev/null @@ -1,22 +0,0 @@ -# File : ed_mac_ctrl_V2_iw416.conf -# -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_iw416.conf ed_mac_ctrl_v2 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v2={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0x9 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0xC # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_nw61x.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_nw61x.conf deleted file mode 100644 index 44bc003..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/ed_mac_ctrl_V2_nw61x.conf +++ /dev/null @@ -1,22 +0,0 @@ -# File : ed_mac_ctrl_V2_nw61x.conf -# -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_nw61x.conf ed_mac_ctrl_v2 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v2={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0xA # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0xA # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0x1e00FF #DO NOT Change this line -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/keep_alive.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/keep_alive.conf deleted file mode 100644 index 0ebac1c..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/keep_alive.conf +++ /dev/null @@ -1,24 +0,0 @@ -######################### Keep-Alive command ################## -stop={ - mkeep_alive_id=1 - enable=0 #1-enable; 0-disable -} - -reset={ - mkeep_alive_id=1 - enable=0 #1-enable; 0-disable - reset=1 #enable reset -} - -start={ - mkeep_alive_id=1 - enable=1 #1-enable; 0-disable - sendInterval=55000 # 55 seconds(The unit of sendInterval is milliseconds) - retryInterval=20000 # 20 seconds(The unit of retryInterval is milliseconds) - retryCount=3 # tcp alive retry count - destMacAddr=00:50:43:21:3b:7b # destination MAC address. need change accordingly - srcMacAddr=00:00:00:00:00:00 # source MAC address. need change accordingly - pktLen=67 #IP packet len - ipPkt=45 00 00 43 8c 9e 00 00 ff 06 ac bf c0 a8 00 7c c0 a8 00 8a c0 03 22 b7 b0 b6 60 9f 42 dd 9e 1e 50 18 80 00 d0 88 00 00 74 68 69 73 20 69 73 20 61 20 6b 65 65 70 20 61 6c 69 76 65 20 70 61 63 6b 65 74 #packet content. "c0 a8 00 7c" is the source ip address. "c0 a8 00 8a" is the destination ip address. They may need change accordingly. -} - diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/robust_btc_MM.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/robust_btc_MM.conf deleted file mode 100644 index e14bee3..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/robust_btc_MM.conf +++ /dev/null @@ -1,295 +0,0 @@ -# File : robust_btc.conf - -######################### Robust Coex command ############### -mode_get={ - CmdCode=0x00e0 # do NOT change this line - Action:2=0 # GET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - Enable:1=0x00 # Read-back Coex mode(s) - Reserved:3=0 - } -} - -mode_timeshare={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - # All the modes below are mutually exclusive of each other; - Enable:1=0x01 # Bit0: Enable 2x2 or 1x1 Time Distribute(TMD) - # Robust Coex(RBC) mode, when uAP bss start, - # uAP TMD RBC scheme is enabled, - # STA TMD RBC scheme is disabled. - Reserved:3=0 - } -} - -mode_spatial={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - # All the modes below are mutually exclusive of each other; - Enable:1=0x82 # Bit1: Enable 1x1 SMPS Spatial RBC Mode, e.g. 0x02 - # Bit7: Enable uAP+STA SMPS RBC Mode, - # when uAP bss start, uAP SMPS RBC scheme enable, - # must combined with BIT1 or BIT2, e.g. 0x82, 0x84. - Reserved:3=0 - } -} - -mode_none={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - Enable:1=0 # Concurrent Coex mode. Used for chips which has - # separate antenna for BT - Reserved:3=0 - } -} - -mode_bca={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - Enable:1=0x08 # BCA Coex mode. - # Pure HW BCA based WLAN and BT traffic arbitration. - Reserved:3=0 - } -} - - -mode_2={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x0160 - RobustCoexTlvLength:2={ - Enable:1=0x20 # Concurrent Coex mode with Tx power control and Rx De-sense. - # Used for chips which has separate antenna for BT - Reserved:3=0 - } -} - -gpio_cfg={ - CmdCode=0x00e0 # do NOT change this line - Action:2=1 # SET - RSVD:2=0 - - # Robust Coex Mode TLV - RobustCoexTlvType:2=0x021B - RobustCoexTlvLength:2={ - Enable:1=0x1 # enable GPIO cfg for external bt request - gpionum:1=4 # gpio 4 - gpiopolarity:1=1 # Polarity High - } -} - -external_coex_config={ - CmdCode=0x00e0 - Action:2=1 //0x0 get, 0x1 set - RSVD:2=0 - RobustCoexTlvType:2=0x0238 //TLV ID - RobustCoexTlvLength:2={ - Enabled:1=0x01 // 0x00 disable, 0x01 enable - - ExtHighInputPriority:1=0x02 // Input priority: 0x00 Input Low Priority, 0x01 Input Medium Priority, 0x02 Input High Priority - ExtLowInputPriority:1=0x02 - - ExtPriGPIONum:1=0x06; // Input Priority signal GPIO pin number - ExtPriGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High - - ExtReqGPIONum:1=0x07; // Input Request signal GPIO pin number - ExtReqGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High - - ExtGrntGPIONum:1=0x05; // Output Grant signal GPIO pin number - ExtGrntGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High - - } -} - -external_coex_uwb_config={ - CmdCode=0x00e0 - Action:2=1 # 0x0 get, 0x1 set - RSVD:2=0 - RobustCoexTlvType:2=0x0238 # TLV ID - RobustCoexTlvLength:2={ - Enabled:1=0x03 # 0x03 to configure UWB - } -} - -external_coex_config_2={ - CmdCode=0x00e0 - Action:2=1 //0x0 get, 0x1 set - RSVD:2=0 - RobustCoexTlvType:2=0x0238 //TLV ID - RobustCoexTlvLength:2={ - Enabled:1=0x02 // 0x00 disable, 0x02 enable (KF2, Fixed GPIO external COEX) - - ExtHighInputPriority:1=0x02 // Input priority: 0x00 Input Low Priority, 0x01 Input Medium Priority, 0x02 Input High Priority - ExtLowInputPriority:1=0x02 - } -} - -external_coex_uart_config={ - CmdCode=0x00e0 - Action:2=1 //0x0 get, 0x1 set - RSVD:2=0 - RobustCoexTlvType:2=0x0238 //TLV ID - RobustCoexTlvLength:2={ - Enabled:1=0x04 // 0x00 disable, 0x04: UART enable - Loopback:1=0x00 // 0x00 Loopback disable, 0x01 Loopback enable 0x02 UARTGPIO, 0x06 Get LTE Stats, 0x05 Clear LTE stats - BaudRate:4=4000000 // UART Baud Rate, 4000000: 4M baudrate, 3000000 = 3M baudrate - } -} - -external_coex_pta_config={ - CmdCode=0x00e0 - Action:2=1 // 0x0 get, 0x1 set - RSVD:2=0 - RobustCoexTlvType:2=0x0238 // TLV ID - RobustCoexTlvLength:2={ - Enabled:1=0x05 // 0x00 disable, 0x01 enable - ExtWifiBtArb:1=0x01 // 0x00 disable, 0x01 enable - PolGrantPin:1=0x01 // 0x00 active high, 0x01 active low - EnablePriPtaInt:1=0x01 // 0x00 disable, 0x01 enable - EnableStateFromPta:1=0x02 // 0x00 state input disable - // 0x01 state info is from state pin - // 0x02 state info is sampled on priority pin. - SetPriSampTiming:2=100 // Timing to sample Priority bit - SetStateInfoSampTiming:2=100 // Timing to sample Tx/Rx info - ExtRadioTrafficPrio:1=0x01 // 0x00 disable, 0x01 enable external traffic Tx/Rx Priority. - ExtCoexHwIntWci2:1=0x00 // 0x00 disable, 0x01 enable(wci-2 interface) - } -} - -#In Station generic case -#BT time is set as BTTime -#Wlan time is set as Wlan Time -generictime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0390 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTime:2=10 #(12.5ms)Enter value in Units (1Unit = 1.25ms), BTTime must be less than 65535 - WlanTime:2=20 #(25ms)Enter value in Units (1Unit = 1.25ms), WlanTime must be less than 65535 - } -} - -#WLAN duty low prio time is set as WlanLowPrioTime -#WLAN duty total time is set as TotalTime -wlandutytime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0390 - RobustCoexTlvLength:2={ - Enable:2=0x02 # Enable = 1 is for generic time, 0x02 for Dutycycle feature, 0x03 disables DutyCycle feature - WlanLowPrioTime:2=30 #(30ms)Enter value in Units (1Unit = 1ms), keep it less than TotalTime - TotalTime:2=100 #(100ms)Enter value in Units (1Unit = 1ms), TotalTime must be <= 100 - } -} - -#In Station A2DP case -#BT time is set as BTTime -#Wlan time is set as Wlan Time -a2dptime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0391 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTime:2=10000 #(10ms) BTTime must be less than 65535 - WlanTime:2=39500 #(39.5ms) WlanTime must be less than 65535 - } -} - -#In Station inquiry case -#BT time is set as BTTime -#Wlan time is set as Wlan Time -inquirytime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0392 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTime:2=21215 #(21.215ms) BTTime must be less than 65535 - WlanTime:2=11000 #(11ms) WlanTime must be less than 65535 - } -} - -#In Ap generic case -#BT time is BTTimeBusy when BT has traffic -#BT time is BTTimeIdle when BT is idle -#Wlan time is WlanTimeBusy when Wlan has traffic -#Wlan time is WlanTimeIdle when Wlan is idle -ap_generictime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0393 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTime_MAX:2=23000 #(23ms) BTTime(BT Busy) must be less than 28767 - BtTime_MIN:2=6500 #(6.5ms) BTTime(BT Idle) must be less than 28767 - WlanTime_MAX:2=18000 #(18ms) WlanTime(Wlan Busy) must be less than 32767 - WlanTime_MIN:2=5750 #(5.75ms) WlanTime(Wlan Idle) must be less than 32767 - } -} - -#In Ap A2DP case -#BT time is change from BTTimeMax to BTTimeMin -#Wlan time is change from WlanTimeMax to WlanTimeMin -ap_a2dptime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0394 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTimebusy:2=23000 #(23ms) Maximum BTTime must be less than 32767 - BtTimeidle:2=6500 #(6.5ms) Minimum BTTime must be less than 32767 - WlanTimebusy:2=18000 #(18ms) Maximum WlanTime must be less than 32767 - WlanTimeidle:2=5750 #(5.75ms) Minimum WlanTime must be less than 32767 - } -} - -#In Ap inquiry case -#BT time is set as BTTime -#Wlan time is set as Wlan Time -ap_inquirytime={ - CmdCode=0x00e0 - Action:2=1 - RSVD:2=0 - RobustCoexTlvType:2=0x0395 - RobustCoexTlvLength:2={ - Enable:2=0x01 - BtTime:2=28750 #(28.75ms) BTTime must less than 32767 - WlanTime:2=20000 #(20ms) WlanTime must be less than 32767 - } -} -######################### Robust Coex command ############### diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8987.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8987.conf deleted file mode 100644 index aef78cb..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8987.conf +++ /dev/null @@ -1,537 +0,0 @@ -# File : txpwrlimit_cfg.conf -## Get CFG data for Tx power limitation -txpwrlimit_2g_cfg_get={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Get Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } -} - - -txpwrlimit_5g_cfg_get_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Get Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } -} - - -txpwrlimit_5g_cfg_get_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Get Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } -} - - -txpwrlimit_5g_cfg_get_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Get Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } -} - - -txpwrlimit_5g_cfg_get_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Get Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } -} - -## Set CFG data for Tx power limitation -## -## TLVStartFreq: Starting Frequency of the band for this channel -## 2407, 2414 or 2400 for 2.4 GHz -## 5000 -## 4000 -## TLVChanWidth: Channel Width -## 20 -## TLVChanNum : Channel Number -## TLVPwr[] : ModulationGroup -## 0: CCK (1,2,5.5,11 Mbps) -## 1: OFDM (6,9,12,18 Mbps) -## 2: OFDM (24,36 Mbps) -## 3: OFDM (48,54 Mbps) -## 4: HT20 (0,1,2) -## 5: HT20 (3,4) -## 6: HT20 (5,6,7) -## 7: HT40 (0,1,2) -## 8: HT40 (3,4) -## 9: HT40 (5,6,7) -## 10: VHT_QAM256 (MCS8) -## 11: VHT_40_QAM256 (MCS8,9) -## 12: VHT_80_PSK (MCS0,1,2) -## 13: VHT_80_QAM16 (MCS3,4) -## 14: VHT_80_QAM64 (MCS5,6,7) -## 15: VHT_80_QAM256 (MCS8,9) -## Power Limit in dBm -## -## For 40MHz modulation groups, specify same Tx power value for a set of -## two consecutive channel frequencies -## Valid channel sets: -## (36, 40), (44, 48), (52, 56), (60, 64) -## (100, 104), (108, 112), (116, 120), (124, 128), (132, 136), (140, 144) -## (149, 153), (157, 161) -## -## For 80MHz modulation groups, specify same Tx power value for a set of -## four consecutive channel frequencies -## Valid channel sets: -## (36, 40, 44, 48), (52, 56, 60, 64) -## (100, 104, 108, 112), (116, 120, 124, 128), (132, 136, 140, 144) -## (149, 153, 157, 161) - -## 2G Tx power limit CFG -txpwrlimit_2g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Configure Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=1 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=2 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=3 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=4 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=5 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=6 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=9 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=10 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:24='0,16,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=13 - TLVPwr:24='0,16,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2414 - TLVChanWidth:1=20 - TLVChanNum:1=14 - TLVPwr:24='0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12' - } -} - -## 5G Tx power limit CFG -txpwrlimit_5g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0249 - ChanTRPC.TlvLength:2={ # Configure Tx Power Values for a particular antenna - TLVAntNum:1=0 # Antenna Num: 0 - Both, 1 - Main, 2 - Aux - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=36 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=40 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=44 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=48 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=52 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=56 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=60 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=64 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=100 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=104 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=108 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=112 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=116 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=120 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=124 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=128 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=132 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=136 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=140 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=144 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=149 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=153 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=157 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=161 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=165 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=183 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=184 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=185 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=187 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=188 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=189 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=192 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=196 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=16 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=34 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8997.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8997.conf deleted file mode 100644 index 0f3b71a..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_8997.conf +++ /dev/null @@ -1,621 +0,0 @@ -# File : txpwrlimit_cfg.conf -## Get CFG data for Tx power limitation -txpwrlimit_2g_cfg_get={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - -## Set CFG data for Tx power limitation -## -## TLVStartFreq: Starting Frequency of the band for this channel -## 2407, 2414 or 2400 for 2.4 GHz -## 5000 -## 4000 -## TLVChanWidth: Channel Width -## 20 -## TLVChanNum : Channel Number -## TLVPwr[] : ModulationGroup -## 0: CCK (1,2,5.5,11 Mbps) -## 1: OFDM (6,9,12,18 Mbps) -## 2: OFDM (24,36 Mbps) -## 3: OFDM (48,54 Mbps) -## 4: HT20 (MCS0,1,2) -## 5: HT20 (MCS3,4) -## 6: HT20 (MCS5,6,7) -## 7: HT40 (MCS0,1,2) -## 8: HT40 (MCS3,4) -## 9: HT40 (MCS5,6,7) -## 10: HT2_20 (MCS8,9,10) -## 11: HT2_20 (MCS11,12) -## 12: HT2_20 (MCS13,14,15) -## 13: HT2_40 (MCS8,9,10) -## 14: HT2_40 (MCS11,12) -## 15: HT2_40 (MCS13,14,15) -## 16: VHT_QAM256 (MCS8) -## 17: VHT_40_QAM256 (MCS8,9) -## 18: VHT_80_PSK (MCS0,1,2) -## 19: VHT_80_QAM16 (MCS3,4) -## 20: VHT_80_QAM64 (MCS5,6,7) -## 21: VHT_80_QAM256 (MCS8,9) -## 22: VHT2_20_QAM256 (MCS8,9) -## 23: VHT2_40_QAM256 (MCS8,9) -## 24: VHT2_80_PSK (MCS0, 1, 2) -## 25: VHT2_80_QAM16 (MCS3,4) -## 26: VHT2_80_QAM64 (MCS5,6,7) -## 27: VHT2_80_QAM256 (MCS8,9) -## Power Limit in dBm - -## For 40MHz modulation groups, specify same Tx power value for a set of -## two consecutive channel frequencies -## Valid channel sets: -## (36, 40), (44, 48), (52, 56), (60, 64) -## (100, 104), (108, 112), (116, 120), (124, 128), (132, 136), (140, 144) -## (149, 153), (157, 161) -## -## For 80MHz modulation groups, specify same Tx power value for a set of -## four consecutive channel frequencies -## Valid channel sets: -## (36, 40, 44, 48), (52, 56, 60, 64) -## (100, 104, 108, 112), (116, 120, 124, 128), (132, 136, 140, 144) -## (149, 153, 157, 161) - - -## 2G subband0 Tx power limit CFG -txpwrlimit_2g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=1 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=2 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=3 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=4 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=5 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=6 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=9 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=10 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=13 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=14 - TLVPwr:32='0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12' - } -} - -## 5G subband1 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=36 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=40 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=44 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=48 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=52 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=56 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=60 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=64 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} - -## 5G subband2 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=100 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=104 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=108 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=112 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=116 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=120 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=124 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=128 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=132 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=136 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=140 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=144 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - -} - - -## 5G subband3 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=149 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=153 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=157 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=161 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=165 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} - - -## 5G subband4 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=183 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=184 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=185 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=187 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=188 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=189 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=192 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=196 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=16 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=34 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_iw416.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_iw416.conf deleted file mode 100644 index 0bc7305..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/txpwrlimit_cfg_iw416.conf +++ /dev/null @@ -1,497 +0,0 @@ -# File : txpwrlimit_cfg_iw416.conf -## Get CFG data for Tx power limitation -txpwrlimit_2g_cfg_get={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - -## Set CFG data for Tx power limitation -## -## TLVStartFreq: Starting Frequency of the band for this channel -## 2407, 2414 or 2400 for 2.4 GHz -## 5000 -## 4000 -## TLVChanWidth: Channel Width -## 20 -## TLVChanNum : Channel Number -## TLVPwr[] : ModulationGroup -## 0: CCK (1,2,5.5,11 Mbps) -## 1: OFDM (6,9,12,18 Mbps) -## 2: OFDM (24,36 Mbps) -## 3: OFDM (48,54 Mbps) -## 4: HT20 (0,1,2) -## 5: HT20 (3,4) -## 6: HT20 (5,6,7) -## 7: HT40 (0,1,2) -## 8: HT40 (3,4) -## 9: HT40 (5,6,7) -## Power Limit in dBm -## -## For 40MHz modulation groups, specify same Tx power value for a set of -## two consecutive channel frequencies -## Valid channel sets: -## (36, 40), (44, 48), (52, 56), (60, 64) -## (100, 104), (108, 112), (116, 120), (124, 128), (132, 136), (140, 144) -## (149, 153), (157, 161) -## - -## 2G Tx power limit CFG -txpwrlimit_2g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=1 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=2 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=3 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=4 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=5 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=6 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=9 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=10 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=13 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2414 - TLVChanWidth:1=20 - TLVChanNum:1=14 - TLVPwr:20='0,16,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } -} - -## 5G Tx power limit CFG -txpwrlimit_5g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=36 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=40 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=44 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=48 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=52 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=56 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=60 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=64 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=100 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=104 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=108 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=112 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=116 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=120 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=124 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=128 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=132 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=136 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,16,8,15,9,12' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=140 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=144 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=149 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=153 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=157 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=161 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=165 - TLVPwr:20='0,0,1,16,2,16,3,13,4,16,5,16,6,12,7,15,8,15,9,10' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=183 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=184 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=185 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=187 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=188 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=189 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=192 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=196 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=16 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=34 - TLVPwr:20='0,0,1,16,2,16,3,15,4,16,5,16,6,14,7,16,8,16,9,14' - } -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/wifi_mod_para.conf b/mxm_wifiex/wlan_src/mapp/mlanconfig/config/wifi_mod_para.conf deleted file mode 100644 index 5e978b8..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanconfig/config/wifi_mod_para.conf +++ /dev/null @@ -1,204 +0,0 @@ -# Not matter how many spaces or tabs are inserted in a line, -# components and ending format must be exactly same as given -# example: -# -# [_] = { -# key=value -# } -# -# card_type : 8XXX (mandatory) -# block_id : configuration block id (optional ) -# key : module parameter name -# value : value for module parameter -# for string value, no need to add "" -# -# card_type supported: 8887/8897/8997/8977/8987/9098 -# block_id: support same chipset with -# different module parameter. -# For example to support mutiple SD8997 cards, usr can -# specify the configuration block id number [0 - 9], if not -# specified, it is taken as 0 by default. -# -# debug related module parameters could not be set via module -# configure file, ex. drvdbg could not be set in this file -# -# line started with "#" will be ignored -# refer to the USB8997_1 for parameters that could be set in -# this configuration file, and set the corresponding value -# according to your real needs - -SD8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf - drv_mode=7 -} - -#SD8997_1 = { -# cfg80211_wext=0xf -# wfd_name=wfd0 -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=5 -#} - -#SD8887 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SD8897 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SD8977 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SDIW416 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# hw_name=SDIW416 -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8978_QFN_TB.conf -# drv_mode=7 -#} - -#SD8987 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SDIW612 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# hw_name=SDIW612 -# max_vir_bss=1 -# drv_mode=7 -#} - -USB8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf - drv_mode=7 -} - -#USBIW620 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# hw_name=USBIW620 -# max_vir_bss=1 -# drv_mode=7 -#} - - -PCIE8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf - drv_mode=7 -} - -PCIE9098_0 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - mac_addr=00:50:43:20:12:34 -} - -PCIE9098_1 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - mac_addr=00:50:43:20:52:56 -} - -#USB8997 = { -# hw_test=0 -# fw_name="nxp/usbusb8997_combo_v4.bin" -# req_fw_nowait=1 -# fw_reload=3 -# fw_serial=1 -# mac_addr=00:50:43:22:1e:3d -# mfg_mode=0 -# drv_mode=0x5 -# max_sta_bss=1 -# sta_name=wlan -# max_uap_bss=1 -# uap_name=uap -# wfd_name=p2p -# max_vir_bss=1 -# max_mpl_bss=1 -# nan_name=nan -# max_nan_bss=1 -# max_11p_bss=1 -# auto_ds=0 -# ps_mode=1 -# max_tx_buf=4096 -# intmode=0 -# gpiopin=0 -# pm_keep_power=0 -# shutdown_hs=1 -# cfg_11d=1 -# start_11ai_scan=0 -# oob_mode=0 -# sdio_pd=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# txpwrtlimit_cfg=nxp/txpwr_limit.conf -# cntry_txpwrt=0 -# init_hostcmd_cfg=nxp/init_hostcmd_cfg.conf -# minicard_pwrup=0 -# cfg80211_wext=0xf -# skip_fwdnld=0 -# wq_sched_prio=0 -# wq_sched_policy=0 -# rx_work=1 -# aggrctrl=1 -# usb_aggr=1 -# pcie_int_mode=1 -# low_power_mode_enable=1 -# wakelock_timeout=10 -# dev_cap_mask=0xffffffff -# sdio_rx_aggr=1 -# pmic=1 -# antcfg=0 -# uap_oper_ctrl=0 -# hs_wake_interval=400 -# indication_gpio=0xff -# disconnect_on_suspend=0 -# hs_mimo_switch=1 -# indrstcfg=0xffffffff -# fixed_beacon_buffer=0 -# GoAgeoutTime=0 -# gtk_rekey_offload=1 -# multi_dtim=0 -# inact_tmo=0 -# usb_fw_option=1 -# napi=1 -# dfs_offload=1 -# cfg80211_drcs=1 -# drcs_chantime_mode=0 -# reg_alpha2=US -#} diff --git a/mxm_wifiex/wlan_src/mapp/mlanutl/Makefile b/mxm_wifiex/wlan_src/mapp/mlanutl/Makefile deleted file mode 100644 index 121d378..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanutl/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# File : mlanutl/Makefile -# -# Copyright 2011-2022 NXP - -# Path to the top directory of the wlan distribution -PATH_TO_TOP = ../.. - -# Determine how we should copy things to the install directory -ABSPATH := $(filter /%, $(INSTALLDIR)) -RELPATH := $(filter-out /%, $(INSTALLDIR)) -INSTALLPATH := $(ABSPATH) -ifeq ($(strip $(INSTALLPATH)),) -INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH) -endif - -# Override CFLAGS for application sources, remove __ kernel namespace defines -CFLAGS := $(filter-out -D__%, $(ccflags-y)) -# remove KERNEL include dir -CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS)) - - -#CFLAGS += -DAP22 -fshort-enums -CFLAGS += -Wall -CFLAGS += -Wno-stringop-truncation -#ECHO = @ -ifeq (,$(findstring ANDROID_KERNEL, $(CFLAGS))) -LIBS=-lrt -endif - -.PHONY: default tags all - -OBJECTS = mlanutl.o -HEADERS = mlanutl.h - - - - - -exectarget=mlanutl -TARGET := $(exectarget) - -build appsbuild default: $(TARGET) - @cp -f $(TARGET) $(INSTALLPATH) - -all : tags default - -$(TARGET): $(OBJECTS) $(HEADERS) - $(ECHO)$(CC) $(LIBS) -o $@ $(OBJECTS) - -%.o: %.c $(HEADERS) - $(ECHO)$(CC) $(CFLAGS) -c -o $@ $< - -tags: - ctags -R -f tags.txt - -distclean clean: - $(ECHO)$(RM) $(OBJECTS) $(TARGET) - $(ECHO)$(RM) tags.txt - diff --git a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.c b/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.c deleted file mode 100644 index 0c34549..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.c +++ /dev/null @@ -1,5353 +0,0 @@ -/** @file mlanutl.c - * - * @brief Program to control parameters in the mlandriver - * - * - * 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 - * (the License). You may use, redistribute and/or modify the File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - * - */ -/************************************************************************ -Change log: - 11/04/2011: initial version -************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "mlanutl.h" - -/** Supported stream modes */ -#define HT_STREAM_MODE_1X1 0x11 -#define HT_STREAM_MODE_2X2 0x22 - -/** mlanutl version number */ -#define MLANUTL_VER "M1.3.02" - -/** Termination flag */ -int terminate_flag = 0; - -/** Termination flag */ -boolean mcast_debug_flag = 0; - -/******************************************************** - Local Variables -********************************************************/ - -#define BAND_B (1U << 0) -#define BAND_G (1U << 1) -#define BAND_A (1U << 2) -#define BAND_GN (1U << 3) -#define BAND_AN (1U << 4) -#define BAND_GAC (1U << 5) -#define BAND_AAC (1U << 6) -#define BAND_GAX (1U << 8) -#define BAND_AAX (1U << 9) - -/** Stringification of rateId enumeration */ -const char *rateIdStr[] = {"1", "2", "5.5", "11", "--", "6", "9", "12", - "18", "24", "36", "48", "54", "--", "M0", "M1", - "M2", "M3", "M4", "M5", "M6", "M7", "H0", "H1", - "H2", "H3", "H4", "H5", "H6", "H7"}; - -char mod_conv_bg_1x1[10][35] = { - "CCK (1,2,5.5,11 Mbps)", "OFDM_PSK (6,9,12,18 Mbps)", - "OFDM_QAM16 (24,36 Mbps)", "OFDM_QAM64 (48,54 Mbps)", - "HT_20_PSK (MCS 0,1,2)", "HT_20_QAM16 (MCS 3,4)", - "HT_20_QAM64 (MCS 5,6,7)", "HT_40_PSK (MCS 0,1,2)", - "HT_40_QAM16 (MCS 3,4)", "HT_40_QAM64 (MCS 5,6,7)"}; -char mod_conv_a_1x1[6][35] = { - "VHT_20_QAM256 (MCS 8)", "VHT_40_QAM256 (MCS 8,9)", - "VHT_80_PSK (MCS 0,1,2)", "VHT_80_QAM16 (MCS 3,4)", - "VHT_80_QAM64 (MCS 5,6,7)", "VHT_80_QAM256 (MCS 8,9)"}; -char mod_conv_bg_2x2[6][35] = { - "HT2_20_PSK (MCS 8,9,10)", "HT2_20_QAM16 (MCS 11,12)", - "HT2_20_QAM64 (MCS 13,14,15)", "HT2_40_PSK (MCS 8,9,10)", - "HT2_40_QAM16 (MCS 11,12)", "HT2_40_QAM64 (MCS 13,14,15)"}; -char mod_conv_a_2x2[6][35] = { - "VHT2_20_QAM256 (MCS 8)", "VHT2_40_QAM256 (MCS 8,9)", - "VHT2_80_PSK (MCS 0,1,2)", "VHT2_80_QAM16 (MCS 3,4)", - "VHT2_80_QAM64 (MCS 5,6,7)", "VHT2_80_QAM256 (MCS 8,9)"}; - -#ifdef DEBUG_LEVEL1 -#define MMSG MBIT(0) -#define MFATAL MBIT(1) -#define MERROR MBIT(2) -#define MDATA MBIT(3) -#define MCMND MBIT(4) -#define MEVENT MBIT(5) -#define MINTR MBIT(6) -#define MIOCTL MBIT(7) - -#define MREG_D MBIT(9) - -#define MMPA_D MBIT(15) -#define MDAT_D MBIT(16) -#define MCMD_D MBIT(17) -#define MEVT_D MBIT(18) -#define MFW_D MBIT(19) -#define MIF_D MBIT(20) - -#ifdef DEBUG_LEVEL2 -#define MENTRY MBIT(28) -#define MWARN MBIT(29) -#define MINFO MBIT(30) -#endif -#endif - -#define MAX_CH_LOAD_DURATION 10 - -static int process_version(int argc, char *argv[]); -static int process_verext(int argc, char *argv[]); -static int process_hostcmd(int argc, char *argv[]); -#ifdef DEBUG_LEVEL1 -static int process_drvdbg(int argc, char *argv[]); -#endif -static int process_datarate(int argc, char *argv[]); -static int process_getlog(int argc, char *argv[]); -static int process_get_txpwrlimit(int argc, char *argv[]); -#ifdef STA_SUPPORT -static int process_get_signal(int argc, char *argv[]); -static int process_get_signal_ext(int argc, char *argv[]); -static int process_signalext_cfg(int argc, char *argv[]); -#endif -static int process_vhtcfg(int argc, char *argv[]); -static int process_dyn_bw(int argc, char *argv[]); -static int process_11axcfg(int argc, char *argv[]); -static int process_11axcmdcfg(int argc, char *argv[]); -static int process_txratecfg(int argc, char *argv[]); -static int process_httxcfg(int argc, char *argv[]); -static int process_htcapinfo(int argc, char *argv[]); -static int process_addbapara(int argc, char *argv[]); -static int process_aggrpriotbl(int argc, char *argv[]); -static int process_addbareject(int argc, char *argv[]); -static int process_hssetpara(int argc, char *argv[]); -static int process_mefcfg(int argc, char *argv[]); -static int process_cloud_keep_alive(int argc, char *argv[]); -static int process_min_ba_threshold_cfg(int argc, char *argv[]); -static int process_txwatchdog(int argc, char *argv[]); -static int process_getuuid(int argc, char *argv[]); - -struct command_node command_list[] = { - {"version", process_version}, - {"verext", process_verext}, - {"hostcmd", process_hostcmd}, -#ifdef DEBUG_LEVEL1 - {"drvdbg", process_drvdbg}, -#endif - {"getdatarate", process_datarate}, - {"getlog", process_getlog}, - {"get_txpwrlimit", process_get_txpwrlimit}, -#ifdef STA_SUPPORT - {"getsignal", process_get_signal}, - {"getsignalext", process_get_signal_ext}, - {"getsignalextv2", process_get_signal_ext}, - {"signalextcfg", process_signalext_cfg}, -#endif - {"vhtcfg", process_vhtcfg}, - {"dyn_bw", process_dyn_bw}, - {"11axcfg", process_11axcfg}, - {"11axcmd", process_11axcmdcfg}, - {"txratecfg", process_txratecfg}, - {"addbapara", process_addbapara}, - {"aggrpriotbl", process_aggrpriotbl}, - {"addbareject", process_addbareject}, - {"httxcfg", process_httxcfg}, - {"htcapinfo", process_htcapinfo}, - {"hssetpara", process_hssetpara}, - {"mefcfg", process_mefcfg}, - {"cloud_keep_alive", process_cloud_keep_alive}, - {"min_ba_threshold", process_min_ba_threshold_cfg}, - {"txwatchdog", process_txwatchdog}, - {"getuuid", process_getuuid}, -}; - -static char *usage[] = { - "Usage: ", - " mlanutl -v (version)", - " mlanutl [...]", - " where", - " ifname : wireless network interface name, such as mlanX or uapX", - " cmd :", - " version", - " verext", - " hostcmd", -#ifdef DEBUG_LEVEL1 - " drvdbg", -#endif - " getdatarate", - " getlog", - " get_txpwrlimit", -#ifdef STA_SUPPORT - " getsignal", - " signalextcfg", - " getsignalext", - " getsignalextv2", -#endif - " vhtcfg", - " dyn_bw", - " 11axcfg", - " 11axcmd", - " txratecfg", - " httxcfg", - " htcapinfo", - " aggrpriotbl", - " addbapara", - " addbareject", - " hssetpara", - " mefcfg", - " cloud_keep_alive", - " min_ba_threshold", -}; - -/** Socket */ -t_s32 sockfd; -/** Device name */ -char dev_name[IFNAMSIZ + 1]; -#define HOSTCMD "hostcmd" - -char *config_get_line(char *s, int size, FILE *stream, int *line, char **_pos); -#define BSSID_FILTER 1 -#define SSID_FILTER 2 -/******************************************************** - Global Variables -********************************************************/ - -int setuserscan_filter = 0; -int num_ssid_filter = 0; -/******************************************************** - Local Functions -********************************************************/ -/** - * @brief Convert char to hex integer - * - * @param chr Char to convert - * @return Hex integer or 0 - */ -static int hexval(t_s32 chr) -{ - if (chr >= '0' && chr <= '9') - return chr - '0'; - if (chr >= 'A' && chr <= 'F') - return chr - 'A' + 10; - if (chr >= 'a' && chr <= 'f') - return chr - 'a' + 10; - - return 0; -} - -/** - * @brief Hump hex data - * - * @param prompt A pointer prompt buffer - * @param p A pointer to data buffer - * @param len The len of data buffer - * @param delim Delim char - * @return Hex integer - */ -t_void hexdump(char *prompt, t_void *p, t_s32 len, char delim) -{ - t_s32 i; - t_u8 *s = p; - - if (prompt) { - printf("%s: len=%d\n", prompt, (int)len); - } - for (i = 0; i < len; i++) { - if (i != len - 1) - printf("%02x%c", *s++, delim); - else - printf("%02x\n", *s); - if ((i + 1) % 16 == 0) - printf("\n"); - } - printf("\n"); -} - -/** - * @brief Convert char to hex integer - * - * @param chr Char - * @return Hex integer - */ -t_u8 hexc2bin(char chr) -{ - if (chr >= '0' && chr <= '9') - chr -= '0'; - else if (chr >= 'A' && chr <= 'F') - chr -= ('A' - 10); - else if (chr >= 'a' && chr <= 'f') - chr -= ('a' - 10); - - return chr; -} - -/** - * @brief Convert string to hex integer - * - * @param s A pointer string buffer - * @return Hex integer - */ -t_u32 a2hex(char *s) -{ - t_u32 val = 0; - - if (!strncasecmp("0x", s, 2)) { - s += 2; - } - - while (*s && isxdigit((unsigned char)*s)) { - val = (val << 4) + hexc2bin(*s++); - } - - return val; -} - -/* - * @brief Convert String to integer - * - * @param value A pointer to string - * @return Integer - */ -t_u32 a2hex_or_atoi(char *value) -{ - if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) { - return a2hex(value + 2); - } else { - return (t_u32)atoi(value); - } -} - -/** - * @brief Convert string to hex - * - * @param ptr A pointer to data buffer - * @param chr A pointer to return integer - * @return A pointer to next data field - */ -static char *convert2hex(char *ptr, t_u8 *chr) -{ - t_u8 val; - - for (val = 0; *ptr && isxdigit((unsigned char)*ptr); ptr++) { - val = (val * 16) + hexval(*ptr); - } - - *chr = val; - - return ptr; -} - -/** - * @brief Display usage - * - * @return NA - */ -static t_void display_usage(t_void) -{ - t_u32 i; - for (i = 0; i < NELEMENTS(usage); i++) - fprintf(stderr, "%s\n", usage[i]); -} - -/** - * @brief Find and execute command - * - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS for success, otherwise failure - */ -static int process_command(int argc, char *argv[]) -{ - int i = 0, ret = MLAN_STATUS_NOTFOUND; - struct command_node *node = NULL; - - for (i = 0; i < (int)NELEMENTS(command_list); i++) { - node = &command_list[i]; - if (!strcasecmp(node->name, argv[2])) { - ret = node->handler(argc, argv); - break; - } - } - - return ret; -} - -/** - * @brief Prepare command buffer - * @param buffer Command buffer to be filled - * @param cmd Command id - * @param num Number of arguments - * @param args Arguments list - * @return MLAN_STATUS_SUCCESS - */ -static int prepare_buffer(t_u8 *buffer, char *cmd, t_u32 num, char *args[]) -{ - t_u8 *pos = NULL; - unsigned int i = 0; - - memset(buffer, 0, BUFFER_LENGTH); - - /* Flag it for our use */ - pos = buffer; - memcpy((char *)pos, CMD_NXP, strlen(CMD_NXP)); - pos += (strlen(CMD_NXP)); - - /* Insert command */ - strncpy((char *)pos, (char *)cmd, strlen(cmd)); - pos += (strlen(cmd)); - - /* Insert arguments */ - for (i = 0; i < num; i++) { - strncpy((char *)pos, args[i], strlen(args[i])); - pos += strlen(args[i]); - if (i < (num - 1)) { - memcpy((char *)pos, " ", strlen(" ")); - pos += 1; - } - } - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Trims leading and traling spaces only - * @param str A pointer to argument string - * @return pointer to trimmed string - */ -static char *trim_spaces(char *str) -{ - char *str_end = NULL; - - if (!str) - return NULL; - - /* Trim leading spaces */ - while (!*str && isspace((unsigned char)*str)) - str++; - - if (*str == 0) /* All spaces? */ - return str; - - /* Trim trailing spaces */ - str_end = str + strlen(str) - 1; - while (str_end > str && isspace((unsigned char)*str_end)) - str_end--; - - /* null terminate the string */ - *(str_end + 1) = '\0'; - - return str; -} - -/** - * @brief read current command - * @param ptr A pointer to data - * @param curCmd A pointer to the buf which will hold current command - * @return NULL or the pointer to the left command buf - */ -static t_s8 *readCurCmd(t_s8 *ptr, t_s8 *curCmd) -{ - t_s32 i = 0; -#define MAX_CMD_SIZE 64 /**< Max command size */ - - while (*ptr != ']' && i < (MAX_CMD_SIZE - 1)) - curCmd[i++] = *(++ptr); - - if (*ptr != ']') - return NULL; - - curCmd[i - 1] = '\0'; - - return ++ptr; -} - -/** - * @brief parse command and hex data - * @param fp A pointer to FILE stream - * @param dst A pointer to the dest buf - * @param cmd A pointer to command buf for search - * @return Length of hex data or MLAN_STATUS_FAILURE - */ -static int fparse_for_cmd_and_hex(FILE *fp, t_u8 *dst, t_u8 *cmd) -{ - t_s8 *ptr; - t_u8 *dptr; - t_s8 buf[256], curCmd[64] = {0}; - t_s32 isCurCmd = 0; - - dptr = dst; - while (fgets((char *)buf, sizeof(buf), fp)) { - ptr = buf; - - while (*ptr) { - /* skip leading spaces */ - while (*ptr && isspace((unsigned char)*ptr)) - ptr++; - - /* skip blank lines and lines beginning with '#' */ - if (*ptr == '\0' || *ptr == '#') - break; - - if (*ptr == '[' && *(ptr + 1) != '/') { - ptr = readCurCmd(ptr, curCmd); - if (!ptr) - return MLAN_STATUS_FAILURE; - - if (strcasecmp((char *)curCmd, - (char *)cmd)) /* Not equal */ - isCurCmd = 0; - else - isCurCmd = 1; - } - - /* Ignore the rest if it is not correct cmd */ - if (!isCurCmd) - break; - - if (*ptr == '[' && *(ptr + 1) == '/') - return dptr - dst; - - if (isxdigit((unsigned char)*ptr)) { - ptr = (t_s8 *)convert2hex((char *)ptr, dptr++); - } else { - /* Invalid character on data line */ - ptr++; - } - } - } - - return MLAN_STATUS_FAILURE; -} - -/** - * @brief Process version - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_version(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], 0, NULL); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: version fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - printf("Version string received: %s\n", buffer); - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process extended version - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_verext(int argc, char *argv[]) -{ - int ret = 0; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Sanity tests */ - if (argc < 3 || argc > 4) { - printf("Error: invalid no of arguments\n"); - printf("mlanutl mlanX verext [#]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: verext fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - if (cmd->used_len) - printf("Extended Version string received: %s\n", buffer); - -done: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return ret; -} - -int process_host_cmd_resp(char *cmd_name, t_u8 *buf); - -/** - * @brief Get one line from the File - * - * @param fp File handler - * @param str Storage location for data. - * @param size Maximum number of characters to read. - * @param lineno A pointer to return current line number - * @return returns string or NULL - */ -char *mlan_config_get_line(FILE *fp, char *str, t_s32 size, int *lineno) -{ - char *start, *end; - int out, next_line; - - if (!fp || !str) - return NULL; - - do { - read_line: - if (!fgets(str, size, fp)) - break; - start = str; - start[size - 1] = '\0'; - end = start + strlen(str); - (*lineno)++; - - out = 1; - while (out && (start < end)) { - next_line = 0; - /* Remove empty lines and lines starting with # */ - switch (start[0]) { - case ' ': /* White space */ - case '\t': /* Tab */ - start++; - break; - case '#': - case '\n': - case '\0': - next_line = 1; - break; - case '\r': - if (start[1] == '\n') - next_line = 1; - else - start++; - break; - default: - out = 0; - break; - } - if (next_line) - goto read_line; - } - - /* Remove # comments unless they are within a double quoted - * string. Remove trailing white space. */ - end = strstr(start, "\""); - if (end) { - end = strstr(end + 1, "\""); - if (!end) - end = start; - } else - end = start; - - end = strstr(end + 1, "#"); - if (end) - *end-- = '\0'; - else - end = start + strlen(start) - 1; - - out = 1; - while (out && (start < end)) { - switch (*end) { - case ' ': /* White space */ - case '\t': /* Tab */ - case '\n': - case '\r': - *end = '\0'; - end--; - break; - default: - out = 0; - break; - } - } - - if (*start == '\0') - continue; - - return start; - } while (1); - - return NULL; -} - -/** - * @brief Parse function for a configuration line - * - * @param s Storage buffer for data - * @param size Maximum size of data - * @param stream File stream pointer - * @param line Pointer to current line within the file - * @param _pos Output string or NULL - * @return String or NULL - */ -char *config_get_line(char *s, int size, FILE *stream, int *line, char **_pos) -{ - *_pos = mlan_config_get_line(stream, s, size, line); - return *_pos; -} - -/** - * @brief get hostcmd data - * - * @param ln A pointer to line number - * @param buf A pointer to hostcmd data - * @param size A pointer to the return size of hostcmd buffer - * @return MLAN_STATUS_SUCCESS - */ -static int mlan_get_hostcmd_data(FILE *fp, int *ln, t_u8 *buf, t_u16 *size) -{ - t_s32 errors = 0, i; - char line[512], *pos, *pos1, *pos2, *pos3; - t_u16 len; - - while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) { - (*ln)++; - if (strcmp(pos, "}") == 0) { - break; - } - - pos1 = strchr(pos, ':'); - if (pos1 == NULL) { - printf("Line %d: Invalid hostcmd line '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos1++ = '\0'; - - pos2 = strchr(pos1, '='); - if (pos2 == NULL) { - printf("Line %d: Invalid hostcmd line '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos2++ = '\0'; - - len = a2hex_or_atoi(pos1); - if (len < 1 || len > BUFFER_LENGTH) { - printf("Line %d: Invalid hostcmd line '%s'\n", *ln, - pos); - errors++; - continue; - } - - *size += len; - - if (*pos2 == '"') { - pos2++; - pos3 = strchr(pos2, '"'); - if (pos3 == NULL) { - printf("Line %d: invalid quotation '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos3 = '\0'; - memset(buf, 0, len); - memmove(buf, pos2, MIN(strlen(pos2), len)); - buf += len; - } else if (*pos2 == '\'') { - pos2++; - pos3 = strchr(pos2, '\''); - if (pos3 == NULL) { - printf("Line %d: invalid quotation '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos3 = ','; - for (i = 0; i < len; i++) { - pos3 = strchr(pos2, ','); - if (pos3 != NULL) { - *pos3 = '\0'; - *buf++ = (t_u8)a2hex_or_atoi(pos2); - pos2 = pos3 + 1; - } else - *buf++ = 0; - } - } else if (*pos2 == '{') { - t_u16 tlvlen = 0, tmp_tlvlen; - mlan_get_hostcmd_data(fp, ln, buf + len, &tlvlen); - tmp_tlvlen = tlvlen; - while (len--) { - *buf++ = (t_u8)(tmp_tlvlen & 0xff); - tmp_tlvlen >>= 8; - } - *size += tlvlen; - buf += tlvlen; - } else { - t_u32 value = a2hex_or_atoi(pos2); - while (len--) { - *buf++ = (t_u8)(value & 0xff); - value >>= 8; - } - } - } - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Prepare host-command buffer - * @param fp File handler - * @param cmd_name Command name - * @param buf A pointer to comand buffer - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int prepare_host_cmd_buffer(FILE *fp, char *cmd_name, t_u8 *buf) -{ - char line[256], cmdname[256], *pos, cmdcode[10]; - HostCmd_DS_GEN *hostcmd; - t_u32 hostcmd_size = 0; - int ln = 0; - int cmdname_found = 0, cmdcode_found = 0; - - hostcmd = (HostCmd_DS_GEN *)(buf + sizeof(t_u32)); - hostcmd->command = 0xffff; - - snprintf(cmdname, sizeof(cmdname), "%s={", cmd_name); - cmdname_found = 0; - while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) { - if (strcmp(pos, cmdname) == 0) { - cmdname_found = 1; - snprintf(cmdcode, sizeof(cmdcode), "CmdCode="); - cmdcode_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdcode, strlen(cmdcode)) == - 0) { - t_u16 len = 0; - cmdcode_found = 1; - hostcmd->command = a2hex_or_atoi( - pos + strlen(cmdcode)); - hostcmd->size = S_DS_GEN; - mlan_get_hostcmd_data( - fp, &ln, - buf + sizeof(t_u32) + - hostcmd->size, - &len); - hostcmd->size += len; - break; - } - } - if (!cmdcode_found) { - fprintf(stderr, - "mlanutl: CmdCode not found in conf file\n"); - return MLAN_STATUS_FAILURE; - } - break; - } - } - - if (!cmdname_found) { - fprintf(stderr, - "mlanutl: cmdname '%s' is not found in conf file\n", - cmd_name); - return MLAN_STATUS_FAILURE; - } - - hostcmd->seq_num = 0; - hostcmd->result = 0; - hostcmd->command = cpu_to_le16(hostcmd->command); - hostcmd->size = cpu_to_le16(hostcmd->size); - - hostcmd_size = (t_u32)(hostcmd->size); - memcpy(buf, (t_u8 *)&hostcmd_size, sizeof(t_u32)); - - return MLAN_STATUS_SUCCESS; -} - -#define CMDCODE_OFFSET 0 -#define SUBID_OFFSET (S_DS_GEN + 2) - -static const t_u16 debug_cmd = 0x008b; -static t_u16 supported_cmd[] = {0x0130, 0x0016, 0x00e0}; -/* If the hostcmd CmdCode is 0x008b (debug cmd), then below SUBIDs will be - * allowed */ -static t_u16 supported_8b_subcmd[] = {0x104, 0x111, 0x11b, 0x11e, 0x27, 0x101}; - -static int check_if_hostcmd_allowed(t_u8 *buf) -{ - t_u32 maxcnt_cmd = sizeof(supported_cmd) / sizeof(supported_cmd[0]); - t_u32 maxcnt_subcmd = - sizeof(supported_8b_subcmd) / sizeof(supported_8b_subcmd[0]); - - /* Check if CmdCode is 0x008b (debug cmd from debug.conf) */ - if (!memcmp(buf + CMDCODE_OFFSET, &debug_cmd, sizeof(t_u16))) { - for (int i = 0; i < maxcnt_subcmd; i++) { - /* Check if SUBID matches with allowed subcmd */ - if (!memcmp(buf + SUBID_OFFSET, - (supported_8b_subcmd + i), sizeof(t_u16))) - return MLAN_STATUS_SUCCESS; - } - return MLAN_STATUS_NOTFOUND; - } - - for (int i = 0; i < maxcnt_cmd; i++) { - /* If CmdCode is other than 0x008b, then only check the CmdCode - */ - if (!memcmp(buf + CMDCODE_OFFSET, (supported_cmd + i), - sizeof(t_u16))) - return MLAN_STATUS_SUCCESS; - } - - return MLAN_STATUS_NOTFOUND; -} - -/** - * @brief Process hostcmd command - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_hostcmd(int argc, char *argv[]) -{ - t_u8 *buffer = NULL, *raw_buf = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - FILE *fp = NULL; - FILE *fp_raw = NULL; - FILE *fp_dtsi = NULL; - char cmdname[256]; - boolean call_ioctl = TRUE; - t_u32 buf_len = 0, i, j, k; - char *line = NULL, *pos = NULL; - int li = 0, blk_count = 0, ob = 0; - int ret = MLAN_STATUS_SUCCESS; - - struct cmd_node { - char cmd_string[256]; - struct cmd_node *next; - }; - struct cmd_node *command = NULL, *header = NULL, *new_node = NULL; - - if (argc < 5) { - printf("Error: invalid no of arguments\n"); - printf("Syntax: ./mlanutl mlanX hostcmd \n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - snprintf(cmdname, sizeof(cmdname), "%s", argv[4]); - - if (!strcmp(cmdname, "generate_raw")) { - call_ioctl = FALSE; - } - if (!call_ioctl && argc != 6) { - printf("Error: invalid no of arguments\n"); - printf("Syntax: ./mlanutl mlanX hostcmd %s \n", - cmdname); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - fp = fopen(argv[3], "r"); - if (fp == NULL) { - fprintf(stderr, "Cannot open file %s\n", argv[3]); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - fclose(fp); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - if (call_ioctl) { - /* Prepare the hostcmd buffer */ - prepare_buffer(buffer, argv[2], 0, NULL); - if (MLAN_STATUS_FAILURE == - prepare_host_cmd_buffer(fp, cmdname, - buffer + strlen(CMD_NXP) + - strlen(argv[2]))) { - fclose(fp); - ret = MLAN_STATUS_FAILURE; - goto done; - } - fclose(fp); - } else { - line = (char *)malloc(MAX_CONFIG_LINE); - if (!line) { - printf("ERR:Cannot allocate memory for line\n"); - fclose(fp); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(line, 0, MAX_CONFIG_LINE); - - while (config_get_line(line, MAX_CONFIG_LINE, fp, &li, &pos)) { - line = trim_spaces(line); - if (line[strlen(line) - 1] == '{') { - if (ob == 0) { - new_node = (struct cmd_node *)malloc( - sizeof(struct cmd_node)); - if (!new_node) { - printf("ERR:Cannot allocate memory for cmd_node\n"); - fclose(fp); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(new_node, 0, - sizeof(struct cmd_node)); - new_node->next = NULL; - if (blk_count == 0) { - header = new_node; - command = new_node; - } else { - command->next = new_node; - command = new_node; - } - strncpy(command->cmd_string, line, - (strchr(line, '=') - line)); - memmove(command->cmd_string, - trim_spaces( - command->cmd_string), - strlen(trim_spaces( - command->cmd_string)) + - 1); - } - ob++; - continue; /* goto while() */ - } - if (line[strlen(line) - 1] == '}') { - ob--; - if (ob == 0) - blk_count++; - continue; /* goto while() */ - } - } - - rewind(fp); /* Set the source file pointer to the beginning - again */ - command = header; /* Set 'command' at the beginning of the - command list */ - - fp_raw = fopen(argv[5], "w"); - if (fp_raw == NULL) { - fprintf(stderr, - "Cannot open the destination raw_data file %s\n", - argv[5]); - fclose(fp); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* prepare .dtsi output */ - snprintf(cmdname, sizeof(cmdname), "%s.dtsi", argv[5]); - fp_dtsi = fopen(cmdname, "w"); - if (fp_dtsi == NULL) { - fprintf(stderr, "Cannot open the destination file %s\n", - cmdname); - fclose(fp); - fclose(fp_raw); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - for (k = 0; k < (t_u32)blk_count && command != NULL; k++) { - if (MLAN_STATUS_FAILURE == - prepare_host_cmd_buffer(fp, command->cmd_string, - buffer)) - memset(buffer, 0, BUFFER_LENGTH); - - memcpy(&buf_len, buffer, sizeof(t_u32)); - if (buf_len) { - raw_buf = buffer + sizeof(t_u32); /* raw_buf - points to - start of - actual */ - printf("buf_len = %d\n", (int)buf_len); - if (k > 0) - fprintf(fp_raw, "\n\n"); - fprintf(fp_raw, "%s={\n", command->cmd_string); - fprintf(fp_dtsi, - "/ {\n\tmarvell_cfgdata {\n\t\tmarvell,%s = /bits/ 8 <\n", - command->cmd_string); - i = j = 0; - while (i < buf_len) { - for (j = 0; j < 16; j++) { - fprintf(fp_raw, "%02x ", - *(raw_buf + i)); - if (i >= 8) { - fprintf(fp_dtsi, - "0x%02x", - *(raw_buf + i)); - if ((j < 16 - 1) && - (i < buf_len - 1)) - fprintf(fp_dtsi, - " "); - } - if (++i >= buf_len) - break; - } - fputc('\n', fp_raw); - fputc('\n', fp_dtsi); - } - fprintf(fp_raw, "}"); - fprintf(fp_dtsi, "\t\t>;\n\t};\n};\n"); - } - command = command->next; - rewind(fp); - } - - fclose(fp_dtsi); - fclose(fp_raw); - fclose(fp); - } - - if (call_ioctl) { - /* raw_buf points to start of command id */ - raw_buf = buffer + strlen(CMD_NXP) + strlen(argv[2]) + - sizeof(t_u32); - if (check_if_hostcmd_allowed(raw_buf) != MLAN_STATUS_SUCCESS) { - printf("ERR:Entered hostcmd not allowed!\n"); - goto done; - } - cmd = (struct eth_priv_cmd *)malloc( - sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: hostcmd fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - process_host_cmd_resp(argv[2], buffer); - } -done: - while (header) { - command = header; - header = header->next; - free(command); - } - if (line) - free(line); - if (buffer) - free(buffer); - if (cmd) - free(cmd); - return ret; -} - -#ifdef DEBUG_LEVEL1 -/** - * @brief Process driver debug configuration - * @param argc number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_drvdbg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - t_u32 drvdbg; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: drvdbg config fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - if (argc == 3) { - memcpy(&drvdbg, buffer, sizeof(drvdbg)); - printf("drvdbg: 0x%08x\n", drvdbg); -#ifdef DEBUG_LEVEL2 - printf("MINFO (%08x) %s\n", MINFO, - (drvdbg & MINFO) ? "X" : ""); - printf("MWARN (%08x) %s\n", MWARN, - (drvdbg & MWARN) ? "X" : ""); - printf("MENTRY (%08x) %s\n", MENTRY, - (drvdbg & MENTRY) ? "X" : ""); -#endif - printf("MMPA_D (%08x) %s\n", MMPA_D, - (drvdbg & MMPA_D) ? "X" : ""); - printf("MIF_D (%08x) %s\n", MIF_D, - (drvdbg & MIF_D) ? "X" : ""); - printf("MFW_D (%08x) %s\n", MFW_D, - (drvdbg & MFW_D) ? "X" : ""); - printf("MEVT_D (%08x) %s\n", MEVT_D, - (drvdbg & MEVT_D) ? "X" : ""); - printf("MCMD_D (%08x) %s\n", MCMD_D, - (drvdbg & MCMD_D) ? "X" : ""); - printf("MDAT_D (%08x) %s\n", MDAT_D, - (drvdbg & MDAT_D) ? "X" : ""); - printf("MREG_D (%08x) %s\n", MREG_D, - (drvdbg & MREG_D) ? "X" : ""); - printf("MIOCTL (%08x) %s\n", MIOCTL, - (drvdbg & MIOCTL) ? "X" : ""); - printf("MINTR (%08x) %s\n", MINTR, - (drvdbg & MINTR) ? "X" : ""); - printf("MEVENT (%08x) %s\n", MEVENT, - (drvdbg & MEVENT) ? "X" : ""); - printf("MCMND (%08x) %s\n", MCMND, - (drvdbg & MCMND) ? "X" : ""); - printf("MDATA (%08x) %s\n", MDATA, - (drvdbg & MDATA) ? "X" : ""); - printf("MERROR (%08x) %s\n", MERROR, - (drvdbg & MERROR) ? "X" : ""); - printf("MFATAL (%08x) %s\n", MFATAL, - (drvdbg & MFATAL) ? "X" : ""); - printf("MMSG (%08x) %s\n", MMSG, (drvdbg & MMSG) ? "X" : ""); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} -#endif - -static char *rate_format[4] = {"LG", "HT", "VHT", "HE"}; -static char *lg_rate[] = {"1 Mbps", "2 Mbps", "5.5 Mbps", "11 Mbps", - "6 Mbps", "9 Mbps", "12 Mbps", "18 Mbps", - "24 Mbps", "36 Mbps", "48 Mbps", "54 Mbps"}; - -/** - * @brief Process Get data rate - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_datarate(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct eth_priv_data_rate *datarate = NULL; - struct ifreq ifr; - char *bw[] = {"20 MHz", "40 MHz", "80 MHz", "160 MHz"}; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], 0, NULL); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: getdatarate fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - datarate = (struct eth_priv_data_rate *)buffer; - printf("Data Rate:\n"); - printf(" TX: \n"); - if (datarate->tx_rate_format <= 3) { - printf(" Type: %s\n", rate_format[datarate->tx_rate_format]); - if ((datarate->tx_rate_format == 0) && - datarate->tx_data_rate <= 11) - /* LG */ - printf(" Rate: %s\n", - lg_rate[datarate->tx_data_rate]); - else { - /* HT and VHT*/ - if (datarate->tx_bw <= 3) - printf(" BW: %s\n", bw[datarate->tx_bw]); - if (datarate->tx_rate_format < 3) { - if (datarate->tx_gi == 0) - printf(" GI: Long\n"); - else - printf(" GI: Short\n"); - } else if (datarate->tx_rate_format == 3) { - switch (datarate->tx_gi) { - case 0: - printf(" GI: 1xHELTF + GI 0.8us \n"); - break; - case 1: - printf(" GI: 2xHELTF + GI 0.8us \n"); - break; - case 2: - printf(" GI: 2xHELTF + GI 1.6us \n"); - break; - case 3: - printf(" GI: 4xHELTF + GI 0.8us DCM=0 and STBC=0 or\n" - " 4xHELTF + GI 3.2us Otherwise \n"); - break; - } - } - if (datarate->tx_rate_format >= 2) - printf(" NSS: %d\n", datarate->tx_nss + 1); - if (datarate->tx_mcs_index != 0xFF) - printf(" MCS: MCS %d\n", - (int)datarate->tx_mcs_index); - else - printf(" MCS: Auto\n"); - if (datarate->tx_rate_format < 3) - printf(" Rate: %f Mbps\n", - (float)datarate->tx_data_rate / 2); - } - } - - printf(" RX: \n"); - if (datarate->rx_rate_format <= 3) { - printf(" Type: %s\n", rate_format[datarate->rx_rate_format]); - if ((datarate->rx_rate_format == 0) && - datarate->rx_data_rate <= 11) - /* LG */ - printf(" Rate: %s\n", - lg_rate[datarate->rx_data_rate]); - else { - /* HT and VHT*/ - if (datarate->rx_bw <= 3) - printf(" BW: %s\n", bw[datarate->rx_bw]); - if (datarate->rx_rate_format < 3) { - if (datarate->rx_gi == 0) - printf(" GI: Long\n"); - else - printf(" GI: Short\n"); - } else if (datarate->rx_rate_format == 3) { - switch (datarate->rx_gi) { - case 0: - printf(" GI: 1xHELTF + GI 0.8us \n"); - break; - case 1: - printf(" GI: 2xHELTF + GI 0.8us \n"); - break; - case 2: - printf(" GI: 2xHELTF + GI 1.6us \n"); - break; - case 3: - printf(" GI: 4xHELTF + GI 0.8us DCM=0 and STBC=0 or\n" - " 4xHELTF + GI 3.2us Otherwise \n"); - break; - } - } - if (datarate->rx_rate_format >= 2) - printf(" NSS: %d\n", datarate->rx_nss + 1); - if (datarate->rx_mcs_index != 0xFF) - printf(" MCS: MCS %d\n", - (int)datarate->rx_mcs_index); - else - printf(" MCS: Auto\n"); - if (datarate->rx_rate_format < 3) - printf(" Rate: %f Mbps\n", - (float)datarate->rx_data_rate / 2); - } - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process get wireless stats - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_getlog(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct eth_priv_get_log *stats = NULL; - struct ifreq ifr; - struct timeval tv; - int i = 0; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: getlog fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - gettimeofday(&tv, NULL); - - /* Process results */ - stats = (struct eth_priv_get_log *)buffer; - printf("Get log: timestamp %d.%06d sec\n", (int)tv.tv_sec, - (int)tv.tv_usec); - printf("dot11GroupTransmittedFrameCount %u\n" - "dot11FailedCount %u\n" - "dot11RetryCount %u\n" - "dot11MultipleRetryCount %u\n" - "dot11FrameDuplicateCount %u\n" - "dot11RTSSuccessCount %u\n" - "dot11RTSFailureCount %u\n" - "dot11ACKFailureCount %u\n" - "dot11ReceivedFragmentCount %u\n" - "dot11GroupReceivedFrameCount %u\n" - "dot11FCSErrorCount %u\n" - "dot11TransmittedFrameCount %u\n" - "wepicverrcnt-1 %u\n" - "wepicverrcnt-2 %u\n" - "wepicverrcnt-3 %u\n" - "wepicverrcnt-4 %u\n" - "beaconReceivedCount %u\n" - "beaconMissedCount %u\n", - stats->mcast_tx_frame, stats->failed, stats->retry, - stats->multi_retry, stats->frame_dup, stats->rts_success, - stats->rts_failure, stats->ack_failure, stats->rx_frag, - stats->mcast_rx_frame, stats->fcs_error, stats->tx_frame, - stats->wep_icv_error[0], stats->wep_icv_error[1], - stats->wep_icv_error[2], stats->wep_icv_error[3], - stats->bcn_rcv_cnt, stats->bcn_miss_cnt); - - if (argc == 4 && !(strcmp(argv[3], "ext"))) { - printf("rxStuckIssueCount-1 %u\n" - "rxStuckIssueCount-2 %u\n" - "rxStuckRecoveryCount %u\n" - "rxStuckTsf-1 %llu\n" - "rxStuckTsf-2 %llu\n" - "txWatchdogRecoveryCount %u\n" - "txWatchdogTsf-1 %llu\n" - "txWatchdogTsf-2 %llu\n" - "channelSwitchAnnouncementSent %u\n" - "channelSwitchState %u\n" - "registerClass %u\n" - "channelNumber %u\n" - "channelSwitchMode %u\n" - "RxResetRecoveryCount %u\n" - "RxIsr2NotDoneCnt %u\n" - "gdmaAbortCnt %u\n" - "gResetRxMacCnt %u\n" - "gOwnrshpCtlErrCnt %u\n" - "gOwnrshpBcnErrCnt %u\n" - "gOwnrshpMgtErrCnt %u\n" - "gOwnrshpDatErrCnt %u\n" - "bigtk_mmeGoodCnt %u\n" - "bigtk_replayErrCnt %u\n" - "bigtk_micErrCnt %u\n" - "bigtk_mmeNotFoundCnt %u\n", - stats->rx_stuck_issue_cnt[0], - stats->rx_stuck_issue_cnt[1], - stats->rx_stuck_recovery_cnt, stats->rx_stuck_tsf[0], - stats->rx_stuck_tsf[1], stats->tx_watchdog_recovery_cnt, - stats->tx_watchdog_tsf[0], stats->tx_watchdog_tsf[1], - stats->channel_switch_ann_sent, - stats->channel_switch_state, stats->reg_class, - stats->channel_number, stats->channel_switch_mode, - stats->rx_reset_mac_recovery_cnt, - stats->rx_Isr2_NotDone_Cnt, stats->gdma_abort_cnt, - stats->g_reset_rx_mac_cnt, stats->dwCtlErrCnt, - stats->dwBcnErrCnt, stats->dwMgtErrCnt, - stats->dwDatErrCnt, stats->bigtk_mmeGoodCnt, - stats->bigtk_replayErrCnt, stats->bigtk_micErrCnt, - stats->bigtk_mmeNotFoundCnt); - } - - if (cmd->used_len == sizeof(struct eth_priv_get_log)) { - printf("dot11TransmittedFragmentCount %u\n", - stats->tx_frag_cnt); - printf("dot11QosTransmittedFragmentCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_tx_frag_cnt[i]); - } - printf("\ndot11QosFailedCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_failed_cnt[i]); - } - printf("\ndot11QosRetryCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_retry_cnt[i]); - } - printf("\ndot11QosMultipleRetryCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_multi_retry_cnt[i]); - } - printf("\ndot11QosFrameDuplicateCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_frm_dup_cnt[i]); - } - printf("\ndot11QosRTSSuccessCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_rts_suc_cnt[i]); - } - printf("\ndot11QosRTSFailureCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_rts_failure_cnt[i]); - } - printf("\ndot11QosACKFailureCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_ack_failure_cnt[i]); - } - printf("\ndot11QosReceivedFragmentCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_rx_frag_cnt[i]); - } - printf("\ndot11QosTransmittedFrameCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_tx_frm_cnt[i]); - } - printf("\ndot11QosDiscardedFrameCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_discarded_frm_cnt[i]); - } - printf("\ndot11QosMPDUsReceivedCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_mpdus_rx_cnt[i]); - } - printf("\ndot11QosRetriesReceivedCount "); - for (i = 0; i < 8; i++) { - printf("%u ", stats->qos_retries_rx_cnt[i]); - } - printf("\ndot11RSNAStatsCMACICVErrors %u\n" - "dot11RSNAStatsCMACReplays %u\n" - "dot11RSNAStatsRobustMgmtCCMPReplays %u\n" - "dot11RSNAStatsTKIPICVErrors %u\n" - "dot11RSNAStatsTKIPReplays %u\n" - "dot11RSNAStatsCCMPDecryptErrors %u\n" - "dot11RSNAstatsCCMPReplays %u\n" - "dot11TransmittedAMSDUCount %u\n" - "dot11FailedAMSDUCount %u\n" - "dot11RetryAMSDUCount %u\n" - "dot11MultipleRetryAMSDUCount %u\n" - "dot11TransmittedOctetsInAMSDUCount %llu\n" - "dot11AMSDUAckFailureCount %u\n" - "dot11ReceivedAMSDUCount %u\n" - "dot11ReceivedOctetsInAMSDUCount %llu\n" - "dot11TransmittedAMPDUCount %u\n" - "dot11TransmittedMPDUsInAMPDUCount %u\n" - "dot11TransmittedOctetsInAMPDUCount %llu\n" - "dot11AMPDUReceivedCount %u\n" - "dot11MPDUInReceivedAMPDUCount %u\n" - "dot11ReceivedOctetsInAMPDUCount %llu\n" - "dot11AMPDUDelimiterCRCErrorCount %u\n", - stats->cmacicv_errors, stats->cmac_replays, - stats->mgmt_ccmp_replays, stats->tkipicv_errors, - stats->tkip_replays, stats->ccmp_decrypt_errors, - stats->ccmp_replays, stats->tx_amsdu_cnt, - stats->failed_amsdu_cnt, stats->retry_amsdu_cnt, - stats->multi_retry_amsdu_cnt, - stats->tx_octets_in_amsdu_cnt, - stats->amsdu_ack_failure_cnt, stats->rx_amsdu_cnt, - stats->rx_octets_in_amsdu_cnt, stats->tx_ampdu_cnt, - stats->tx_mpdus_in_ampdu_cnt, - stats->tx_octets_in_ampdu_cnt, stats->ampdu_rx_cnt, - stats->mpdu_in_rx_ampdu_cnt, - stats->rx_octets_in_ampdu_cnt, - stats->ampdu_delimiter_crc_error_cnt); - } - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -#ifdef STA_SUPPORT -/** - * @brief Get signal - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_get_signal(int argc, char *argv[]) -{ -#define DATA_SIZE 12 - int ret = 0, data[DATA_SIZE], i = 0, copy_size = 0; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - memset(data, 0, sizeof(data)); - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Sanity tests */ - if (argc < 3 || argc > 5) { - printf("Error: invalid no of arguments\n"); - printf("mlanutl mlanX getsignal [m] [n]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: getsignal fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - copy_size = - (int)MIN((int)cmd->used_len, (int)(DATA_SIZE * sizeof(int))); - if (copy_size > 0) - memcpy(&data, buffer, copy_size); - printf("Get signal output is\t"); - for (i = 0; i < (int)(copy_size / sizeof(int)); i++) - printf("%d\t", data[i]); - printf("\n"); - -done: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return ret; -} - -/** - * @brief Set signalext cfg - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_signalext_cfg(int argc, char *argv[]) -{ - int ret = 0; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Sanity tests */ - if (argc != 4) { - printf("Error: invalid no of arguments\n"); - printf("mlanutl mlanX signalextcfg [#]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: signalext cfg fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - -done: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return ret; -} - -/** - * @brief Get signal - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_get_signal_ext(int argc, char *argv[]) -{ -#define MAX_NUM_PATH 3 -#define PATH_SIZE 13 -#define PATH_A 1 -#define PATH_B 2 -#define PATH_AB 3 - int ret = 0, data[PATH_SIZE * MAX_NUM_PATH] = {0}; - int i = 0, copy_size = 0; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - t_u8 num_path = 0; - - memset(data, 0, sizeof(data)); - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Sanity tests */ - if (argc != 3 && argc != 4) { - printf("Error: invalid no of arguments\n"); - if (strncmp(argv[2], "getsignalextv2", - strlen("getsignalextv2")) == 0) - printf("mlanutl mlanX getsignalextv2 [m]\n"); - else if (strncmp(argv[2], "getsignalext", - strlen("getsignalext")) == 0) - printf("mlanutl mlanX getsignalext [m]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: getsignal fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - copy_size = cmd->used_len; - if (copy_size > 0) - memcpy(&data, (int *)buffer, copy_size); - - num_path = copy_size / sizeof(int) / PATH_SIZE; - for (i = 0; i < num_path; i++) { - if (data[i * PATH_SIZE] == PATH_A) - printf("PATH A: %d %d %d %d %d %d %d %d %d %d %d %d\n", - data[i * PATH_SIZE + 1], data[i * PATH_SIZE + 2], - data[i * PATH_SIZE + 3], data[i * PATH_SIZE + 4], - data[i * PATH_SIZE + 5], data[i * PATH_SIZE + 6], - data[i * PATH_SIZE + 7], data[i * PATH_SIZE + 8], - data[i * PATH_SIZE + 9], - data[i * PATH_SIZE + 10], - data[i * PATH_SIZE + 11], - data[i * PATH_SIZE + 12]); - else if (data[i * PATH_SIZE] == PATH_B) - printf("PATH B: %d %d %d %d %d %d %d %d %d %d %d %d\n", - data[i * PATH_SIZE + 1], data[i * PATH_SIZE + 2], - data[i * PATH_SIZE + 3], data[i * PATH_SIZE + 4], - data[i * PATH_SIZE + 5], data[i * PATH_SIZE + 6], - data[i * PATH_SIZE + 7], data[i * PATH_SIZE + 8], - data[i * PATH_SIZE + 9], - data[i * PATH_SIZE + 10], - data[i * PATH_SIZE + 11], - data[i * PATH_SIZE + 12]); - else if (data[i * PATH_SIZE] == PATH_AB) - printf("PATH A+B: %d %d %d %d %d %d %d %d %d %d %d %d\n", - data[i * PATH_SIZE + 1], data[i * PATH_SIZE + 2], - data[i * PATH_SIZE + 3], data[i * PATH_SIZE + 4], - data[i * PATH_SIZE + 5], data[i * PATH_SIZE + 6], - data[i * PATH_SIZE + 7], data[i * PATH_SIZE + 8], - data[i * PATH_SIZE + 9], - data[i * PATH_SIZE + 10], - data[i * PATH_SIZE + 11], - data[i * PATH_SIZE + 12]); - } - printf("\n"); - -done: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return ret; -} -#endif /* #ifdef STA_SUPPORT */ - -/** - * @brief Get txpwrlimit - * - * @param argc Number of arguments - * @param argv Pointer to the arguments array - * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE - */ -static int get_txpwrlimit(FILE *fp_raw, char *argv[], t_u16 sub_band, - t_u8 *buffer, t_u16 len, struct eth_priv_cmd *cmd) -{ - struct ifreq ifr; - mlan_ds_misc_chan_trpc_cfg *trcp_cfg = NULL; - MrvlIETypes_ChanTRPCConfig_t *trpc_tlv = NULL; - MrvlIEtypes_Data_t *pTlvHdr; - int left_len; - int mod_num = 0; - int i = 0; - int j = 0; - t_u8 *pByte = NULL; - - memset(buffer, 0, len); - /* Insert command */ - strncpy((char *)buffer, argv[2], strlen(argv[2])); - trcp_cfg = (mlan_ds_misc_chan_trpc_cfg *)(buffer + strlen(argv[2])); - trcp_cfg->sub_band = sub_band; - if (cmd) { - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = len; - } - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: get_txpwrlimit fail\n"); - return MLAN_STATUS_FAILURE; - } - /* Process result */ - printf("------------------------------------------------------------------------------------\n"); - printf("Get txpwrlimit: sub_band=0x%x len=%d\n", trcp_cfg->sub_band, - trcp_cfg->length); - pByte = trcp_cfg->trpc_buf + S_DS_GEN + 4; - left_len = trcp_cfg->length - S_DS_GEN - 4; - while (left_len >= (int)sizeof(pTlvHdr->header)) { - pTlvHdr = (MrvlIEtypes_Data_t *)pByte; - pTlvHdr->header.len = le16_to_cpu(pTlvHdr->header.len); - - switch (le16_to_cpu(pTlvHdr->header.type)) { - case TLV_TYPE_CHAN_TRPC_CONFIG: - trpc_tlv = (MrvlIETypes_ChanTRPCConfig_t *)pTlvHdr; - printf("StartFreq: %d\n", trpc_tlv->start_freq); - printf("ChanWidth: %d\n", trpc_tlv->width); - printf("ChanNum: %d\n", trpc_tlv->chan_num); - mod_num = (pTlvHdr->header.len - 4) / - sizeof(mod_group_setting); - printf("Pwr:"); - for (i = 0; i < mod_num; i++) { - if (i == (mod_num - 1)) - printf("%d,%d", - trpc_tlv->mod_group[i].mod_group, - trpc_tlv->mod_group[i].power); - else - printf("%d,%d,", - trpc_tlv->mod_group[i].mod_group, - trpc_tlv->mod_group[i].power); - } - printf("\n"); - break; - default: - break; - } - left_len -= (pTlvHdr->header.len + sizeof(pTlvHdr->header)); - pByte += pTlvHdr->header.len + sizeof(pTlvHdr->header); - } - if (fp_raw) { - switch (sub_band) { - case 0: - fprintf(fp_raw, "txpwrlimit_2g_get={\n"); - break; - case 0x10: - fprintf(fp_raw, "txpwrlimit_5g_sub0_get={\n"); - break; - case 0x11: - fprintf(fp_raw, "txpwrlimit_5g_sub1_get={\n"); - break; - case 0x12: - fprintf(fp_raw, "txpwrlimit_5g_sub2_get={\n"); - break; - case 0x13: - fprintf(fp_raw, "txpwrlimit_5g_sub3_get={\n"); - break; - default: - break; - } - i = j = 0; - while (i < trcp_cfg->length) { - for (j = 0; j < 16; j++) { - fprintf(fp_raw, "%02x ", trcp_cfg->trpc_buf[i]); - if (++i >= trcp_cfg->length) - break; - } - fputc('\n', fp_raw); - } - fprintf(fp_raw, "}\n\n"); - } - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Get txpwrlimit - * - * @param argc Number of arguments - * @param argv Pointer to the arguments array - * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE - */ -static int process_get_txpwrlimit(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - int ret = MLAN_STATUS_SUCCESS; - t_u16 sub_band = 0; - FILE *fp_raw = NULL; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2])); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, sizeof(mlan_ds_misc_chan_trpc_cfg) + strlen(argv[2])); - /* Sanity tests */ - if (argc < 4) { - printf("Error: invalid no of arguments\n"); - printf("mlanutl mlanX/uapX get_txpwrlimit [0/0x10/0x11/0x12/0x13/0x1f/0xff]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - sub_band = a2hex_or_atoi(argv[3]); - if (argc == 5) { - fp_raw = fopen(argv[4], "w"); - if (fp_raw == NULL) { - fprintf(stderr, - "Cannot open the destination raw_data file %s\n", - argv[4]); - ret = MLAN_STATUS_FAILURE; - goto done; - } - } - switch (sub_band) { - case 0: - case 0x10: - case 0x11: - case 0x12: - case 0x13: - ret = get_txpwrlimit(fp_raw, argv, sub_band, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - break; - case 0x1f: - ret = get_txpwrlimit(fp_raw, argv, 0x10, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x11, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x12, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x13, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - break; - case 0xff: - ret = get_txpwrlimit(fp_raw, argv, 0, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x10, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x11, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x12, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - ret = get_txpwrlimit(fp_raw, argv, 0x13, buffer, - sizeof(mlan_ds_misc_chan_trpc_cfg) + - strlen(argv[2]), - cmd); - break; - default: - printf("Error: invalid arguments\n"); - printf("mlanutl mlanX/uapX get_txpwrlimit [0/0x10/0x11/0x12/0x13/0x1f/0xff]\n"); - break; - } -done: - if (fp_raw) - fclose(fp_raw); - if (buffer) - free(buffer); - if (cmd) - free(cmd); - return ret; -} - -/** - * @brief Process VHT configuration - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_vhtcfg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct eth_priv_vhtcfg vhtcfg; - struct ifreq ifr; - t_u8 i, num = 0; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - /* Sanity tests */ - if (argc < 5) { - printf("Insufficient parameters\n"); - printf("For STA interface: mlanutl mlanX vhtcfg [bwcfg] [vhtcap]\n"); - printf("For uAP interface: mlanutl uapX vhtcfg [bwcfg] [vhtcap] [vht_tx_mcs] [vht_rx_mcs]\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: vhtcfg fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - /* the first attribute is the number of vhtcfg entries */ - num = *buffer; - if (argc == 5) { - /* GET operation */ - printf("11AC VHT Configuration: \n"); - for (i = 0; i < num; i++) { - memcpy(&vhtcfg, buffer + 1 + i * sizeof(vhtcfg), - sizeof(vhtcfg)); - /* Band */ - if (vhtcfg.band == 1) - printf("Band: 2.4G\n"); - else - printf("Band: 5G\n"); - /* BW confi9 */ - - if (vhtcfg.bwcfg == 0) - printf(" BW config: Follow BW in the 11N config\n"); - else - printf(" BW config: Follow BW in VHT Capabilities\n"); - - /* Tx/Rx */ - if (vhtcfg.txrx & 0x1) - printf(" VHT operation for Tx: 0x%08x\n", - vhtcfg.vht_cap_info); - if (vhtcfg.txrx & 0x2) - /* VHT capabilities */ - printf(" VHT Capabilities Info: 0x%08x\n", - vhtcfg.vht_cap_info); - /* MCS */ - if (vhtcfg.txrx & 0x2) { - printf(" Tx MCS set: 0x%04x\n", - vhtcfg.vht_tx_mcs); - printf(" Rx MCS set: 0x%04x\n", - vhtcfg.vht_rx_mcs); - } - } - } else { - /* SET operation */ - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process dynamic bandwidth set/get - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_dyn_bw(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - int dyn_bw = 0; - - /* Check arguments */ - if (argc < 3 || argc > 4) { - printf("ERR:Incorrect number of arguments!\n"); - printf("Syntax: ./mlanutl mlanX dyn_bw \n"); - return MLAN_STATUS_FAILURE; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: dyn_bw fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - dyn_bw = *(int *)buffer; - printf("Dynamic bandwidth: 0x%02x\n", dyn_bw); - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process HT Tx configuration - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_httxcfg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - t_u32 *data = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: httxcfg fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - if (argc == 3) { - /* Get result */ - data = (t_u32 *)buffer; - printf("HT Tx cfg: \n"); - printf(" BG band: 0x%08x\n", data[0]); - printf(" A band: 0x%08x\n", data[1]); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process HT capability configuration - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_htcapinfo(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct eth_priv_htcapinfo *ht_cap = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: htcapinfo fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - if (argc == 3) { - ht_cap = (struct eth_priv_htcapinfo *)buffer; - printf("HT cap info: \n"); - printf(" BG band: 0x%08x\n", ht_cap->ht_cap_info_bg); - printf(" A band: 0x%08x\n", ht_cap->ht_cap_info_a); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process HT Add BA parameters - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_addbapara(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - struct eth_priv_addba *addba = NULL; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: addbapara fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - if (argc == 3) { - /* Get */ - addba = (struct eth_priv_addba *)buffer; - printf("Add BA configuration: \n"); - printf(" Time out : %d\n", addba->time_out); - printf(" TX window: %d\n", addba->tx_win_size); - printf(" RX window: %d\n", addba->rx_win_size); - printf(" TX AMSDU : %d\n", addba->tx_amsdu); - printf(" RX AMSDU : %d\n", addba->rx_amsdu); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process Aggregation priority table parameters - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_aggrpriotbl(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - int i; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: aggrpriotbl fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - if (argc == 3) { - /* Get */ - printf("Aggregation priority table cfg: \n"); - printf(" TID AMPDU AMSDU \n"); - for (i = 0; i < MAX_NUM_TID; i++) { - printf(" %d %3d %3d \n", i, - buffer[2 * i], buffer[2 * i + 1]); - } - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process HT Add BA reject configurations - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_addbareject(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - int i; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: addbareject fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - if (argc == 3) { - /* Get */ - printf("Add BA reject configuration: \n"); - printf(" TID Reject \n"); - for (i = 0; i < MAX_NUM_TID; i++) { - printf(" %d %d\n", i, buffer[i]); - } - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -#define MASK_11AX_OM_CONTROL 0xFFF - -/** - * @brief 11ax HE capability and operation configure - * - * @param argc Number of arguments - * @param argv Pointer to the arguments array - * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE - */ - -static int process_11axcfg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd; - struct ifreq ifr; - int id_len = 0; - FILE *fp = NULL; - int ret = 0, cmd_header_len = 0; - char config_id[20]; - char filename[256]; - - if (argc != 3 && argc != 4) { - printf("Err: Invalid number of arguments\n"); - printf("Usage: ./mlanutl 11axcfg [11axcfg.conf]\n"); - return MLAN_STATUS_FAILURE; - } - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - cmd_header_len = strlen(CMD_NXP) + strlen(argv[2]); - prepare_buffer(buffer, argv[2], 0, NULL); - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = cmd_header_len; - cmd->total_len = BUFFER_LENGTH; - - if (argc == 4) { - memset(filename, 0, sizeof(filename)); - strncpy(filename, argv[3], sizeof(filename) - 1); - - fp = fopen(filename, "r"); - if (fp == NULL) { - perror("fopen"); - fprintf(stderr, "Cannot open file %s\n", argv[3]); - ret = -EFAULT; - ; - goto done; - } - - snprintf(config_id, sizeof(config_id), "Band"); - id_len = fparse_for_cmd_and_hex(fp, buffer + cmd_header_len, - (t_u8 *)config_id); - - snprintf(config_id, sizeof(config_id), "HECap"); - id_len += - fparse_for_cmd_and_hex(fp, - buffer + cmd_header_len + id_len, - (t_u8 *)config_id); - - hexdump("Set 11axcfg", buffer + cmd_header_len, - sizeof(mlan_ds_11ax_he_cfg), ' '); - cmd->used_len = cmd_header_len + sizeof(mlan_ds_11ax_he_cfg); - } - /* Initialize the ifr structure */ - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl: 11axcfg"); - ret = -EFAULT; - goto done; - } - hexdump("11axcfg", buffer + cmd_header_len, sizeof(mlan_ds_11ax_he_cfg), - ' '); -done: - if (fp) - fclose(fp); - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - return ret; -} - -/** - * @brief Process 11ax command - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_11axcmdcfg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - mlan_ds_11ax_cmd_cfg *axcmd = NULL; - t_u32 action = 0; - t_u32 prefix_len = 0; - - if (strcmp(argv[3], "tx_omi") == 0) { - sprintf(argv[3], "%d", MLAN_11AXCMD_CFG_ID_TX_OMI); - } else if (strcmp(argv[3], "obssnbru_toltime") == 0) { - sprintf(argv[3], "%d", MLAN_11AXCMD_CFG_ID_OBSSNBRU_TOLTIME); - } else { - printf("ERR:unknown command %s!\n", argv[3]); - return MLAN_STATUS_FAILURE; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = strlen((char *)buffer); - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: 11axcmd fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - prefix_len += strlen(CMD_NXP) + strlen(argv[2]); - action = *(t_u32 *)(buffer + prefix_len); - if (action == MLAN_ACT_SET) { - if (argv[4] == 0) { - printf("Invalid OBSSNBRU tolerance time: Valid range[1..3600]\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - } - if (action == MLAN_ACT_GET) { - axcmd = (mlan_ds_11ax_cmd_cfg *)(buffer + prefix_len + - sizeof(t_u32)); - switch (axcmd->sub_id) { - case MLAN_11AXCMD_TXOMI_SUBID: - printf("tx OMI: 0x%x\n", axcmd->param.txomi_cfg.omi & - MASK_11AX_OM_CONTROL); - break; - case MLAN_11AXCMD_OBSS_TOLTIME_SUBID: - if (axcmd->param.toltime_cfg.tol_time > 3600 || - !axcmd->param.toltime_cfg.tol_time) - printf("OBSS Narrow Bandwidth RU tolerance Time: disabled\n"); - else - printf("OBSS Narrow Bandwidth RU Tolerance Time: %d sec\n", - axcmd->param.toltime_cfg.tol_time); - break; - default: - printf("Unknown sub_command 0x%x\n", axcmd->sub_id); - break; - } - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process tx rate configuration - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_txratecfg(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct eth_priv_tx_rate_cfg *txratecfg = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: txratecfg fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process result */ - txratecfg = (struct eth_priv_tx_rate_cfg *)buffer; - if (argc == 3) { - /* GET operation */ - printf("Tx Rate Configuration: \n"); - /* format */ - if (txratecfg->rate_format == 0xFF) { - printf(" Type: 0xFF (Auto)\n"); - } else if (txratecfg->rate_format <= 3) { - printf(" Type: %d (%s)\n", - txratecfg->rate_format, - rate_format[txratecfg->rate_format]); - if (txratecfg->rate_format == 0) - printf(" Rate Index: %d (%s)\n", - txratecfg->rate_index, - lg_rate[txratecfg->rate_index]); - else if (txratecfg->rate_format >= 1) - printf(" MCS Index: %d\n", - (int)txratecfg->rate_index); - if (txratecfg->rate_format == 2 || - txratecfg->rate_format == 3) - printf(" NSS: %d\n", - (int)txratecfg->nss); - if (txratecfg->rate_setting == 0xffff) - printf("Rate setting :Preamble type/BW/GI/STBC/.. : auto \n"); - else { - printf("Preamble type: %x\n", - (txratecfg->rate_setting & 0x0003)); - printf("BW: %x\n", - (txratecfg->rate_setting & 0x001C) >> 2); - printf("LTF + GI size %x\n", - (txratecfg->rate_setting & 0x0060) >> 5); - printf("STBC %x\n", - (txratecfg->rate_setting & 0x0080) >> 7); - printf("DCM %x\n", - (txratecfg->rate_setting & 0x0100) >> 8); - printf("Coding %x\n", - (txratecfg->rate_setting & 0x0200) >> 9); - printf("maxPE %x\n", - (txratecfg->rate_setting & 0x3000) >> - 12); - } - } else { - printf(" Unknown rate format.\n"); - } - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process host_cmd response - * @param cmd_name Command name - * @param buf A pointer to the response buffer - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -int process_host_cmd_resp(char *cmd_name, t_u8 *buf) -{ - t_u32 hostcmd_size = 0; - HostCmd_DS_GEN *hostcmd = NULL; - int ret = MLAN_STATUS_SUCCESS; - - buf += strlen(CMD_NXP) + strlen(cmd_name); - memcpy((t_u8 *)&hostcmd_size, buf, sizeof(t_u32)); - buf += sizeof(t_u32); - - hostcmd = (HostCmd_DS_GEN *)buf; - hostcmd->command = le16_to_cpu(hostcmd->command); - hostcmd->size = le16_to_cpu(hostcmd->size); - hostcmd->seq_num = le16_to_cpu(hostcmd->seq_num); - hostcmd->result = le16_to_cpu(hostcmd->result); - - hostcmd->command &= ~HostCmd_RET_BIT; - if (!hostcmd->result) { - switch (hostcmd->command) { - case HostCmd_CMD_CFG_DATA: { - HostCmd_DS_802_11_CFG_DATA *pstcfgData = - (HostCmd_DS_802_11_CFG_DATA *)(buf + S_DS_GEN); - pstcfgData->data_len = - le16_to_cpu(pstcfgData->data_len); - pstcfgData->action = le16_to_cpu(pstcfgData->action); - - if (pstcfgData->action == HostCmd_ACT_GEN_GET) { - hexdump("cfgdata", pstcfgData->data, - pstcfgData->data_len, ' '); - } - break; - } - case HostCmd_CMD_802_11_TPC_ADAPT_REQ: { - mlan_ioctl_11h_tpc_resp *tpcIoctlResp = - (mlan_ioctl_11h_tpc_resp *)(buf + S_DS_GEN); - if (tpcIoctlResp->status_code == 0) { - printf("tpcrequest: txPower(%d), linkMargin(%d), rssi(%d)\n", - tpcIoctlResp->tx_power, - tpcIoctlResp->link_margin, - tpcIoctlResp->rssi); - } else { - printf("tpcrequest: failure, status = %d\n", - tpcIoctlResp->status_code); - } - break; - } - case HostCmd_CMD_802_11_CRYPTO: { - t_u16 alg = le16_to_cpu( - (t_u16) * (buf + S_DS_GEN + sizeof(t_u16))); - if (alg == CIPHER_TEST_AES_CCM || - alg == CIPHER_TEST_GCMP) { - HostCmd_DS_802_11_CRYPTO_AES_CCM *cmd_aes_ccm = - (HostCmd_DS_802_11_CRYPTO_AES_CCM - *)(buf + S_DS_GEN); - - cmd_aes_ccm->encdec = - le16_to_cpu(cmd_aes_ccm->encdec); - cmd_aes_ccm->algorithm = - le16_to_cpu(cmd_aes_ccm->algorithm); - cmd_aes_ccm->key_length = - le16_to_cpu(cmd_aes_ccm->key_length); - cmd_aes_ccm->nonce_length = - le16_to_cpu(cmd_aes_ccm->nonce_length); - cmd_aes_ccm->AAD_length = - le16_to_cpu(cmd_aes_ccm->AAD_length); - cmd_aes_ccm->data.header.type = le16_to_cpu( - cmd_aes_ccm->data.header.type); - cmd_aes_ccm->data.header.len = le16_to_cpu( - cmd_aes_ccm->data.header.len); - - printf("crypto_result: encdec=%d algorithm=%d, KeyLen=%d," - " NonceLen=%d,AADLen=%d,dataLen=%d\n", - cmd_aes_ccm->encdec, - cmd_aes_ccm->algorithm, - cmd_aes_ccm->key_length, - cmd_aes_ccm->nonce_length, - cmd_aes_ccm->AAD_length, - cmd_aes_ccm->data.header.len); - - hexdump("Key", cmd_aes_ccm->key, - cmd_aes_ccm->key_length, ' '); - hexdump("Nonce", cmd_aes_ccm->nonce, - cmd_aes_ccm->nonce_length, ' '); - hexdump("AAD", cmd_aes_ccm->AAD, - cmd_aes_ccm->AAD_length, ' '); - hexdump("Data", cmd_aes_ccm->data.data, - cmd_aes_ccm->data.header.len, ' '); - } else if (alg == CIPHER_TEST_WAPI) { - HostCmd_DS_802_11_CRYPTO_WAPI *cmd_wapi = - (HostCmd_DS_802_11_CRYPTO_WAPI - *)(buf + S_DS_GEN); - - cmd_wapi->encdec = - le16_to_cpu(cmd_wapi->encdec); - cmd_wapi->algorithm = - le16_to_cpu(cmd_wapi->algorithm); - cmd_wapi->key_length = - le16_to_cpu(cmd_wapi->key_length); - cmd_wapi->nonce_length = - le16_to_cpu(cmd_wapi->nonce_length); - cmd_wapi->AAD_length = - le16_to_cpu(cmd_wapi->AAD_length); - - printf("crypto_result: encdec=%d algorithm=%d, KeyLen=%d," - " NonceLen=%d,AADLen=%d,dataLen=%d\n", - cmd_wapi->encdec, cmd_wapi->algorithm, - cmd_wapi->key_length, - cmd_wapi->nonce_length, - cmd_wapi->AAD_length, - cmd_wapi->data_length); - - hexdump("Key", cmd_wapi->key, - cmd_wapi->key_length, ' '); - hexdump("Nonce", cmd_wapi->nonce, - cmd_wapi->nonce_length, ' '); - hexdump("AAD", cmd_wapi->AAD, - cmd_wapi->AAD_length, ' '); - } else { - HostCmd_DS_802_11_CRYPTO *cmd = - (HostCmd_DS_802_11_CRYPTO *)(buf + - S_DS_GEN); - cmd->encdec = le16_to_cpu(cmd->encdec); - cmd->algorithm = le16_to_cpu(cmd->algorithm); - cmd->key_IV_length = - le16_to_cpu(cmd->key_IV_length); - cmd->key_length = le16_to_cpu(cmd->key_length); - cmd->data.header.type = - le16_to_cpu(cmd->data.header.type); - cmd->data.header.len = - le16_to_cpu(cmd->data.header.len); - - printf("crypto_result: encdec=%d algorithm=%d,KeyIVLen=%d," - " KeyLen=%d,dataLen=%d\n", - cmd->encdec, cmd->algorithm, - cmd->key_IV_length, cmd->key_length, - cmd->data.header.len); - hexdump("KeyIV", cmd->keyIV, cmd->key_IV_length, - ' '); - hexdump("Key", cmd->key, cmd->key_length, ' '); - hexdump("Data", cmd->data.data, - cmd->data.header.len, ' '); - } - break; - } - case HostCmd_CMD_802_11_AUTO_TX: { - HostCmd_DS_802_11_AUTO_TX *at = - (HostCmd_DS_802_11_AUTO_TX *)(buf + S_DS_GEN); - - if (le16_to_cpu(at->action) == HostCmd_ACT_GEN_GET) { - if (S_DS_GEN + sizeof(at->action) == - hostcmd->size) { - printf("auto_tx not configured\n"); - - } else { - MrvlIEtypesHeader_t *header = - &at->auto_tx.header; - - header->type = - le16_to_cpu(header->type); - header->len = le16_to_cpu(header->len); - - if ((S_DS_GEN + sizeof(at->action) + - sizeof(MrvlIEtypesHeader_t) + - header->len == - hostcmd->size) && - (header->type == - TLV_TYPE_AUTO_TX)) { - AutoTx_MacFrame_t *atmf = - &at->auto_tx - .auto_tx_mac_frame; - - printf("Interval: %d second(s)\n", - le16_to_cpu( - atmf->interval)); - printf("Priority: %#x\n", - atmf->priority); - printf("Frame Length: %d\n", - le16_to_cpu( - atmf->frame_len)); - printf("Dest Mac Address: " - "%02x:%02x:%02x:%02x:%02x:%02x\n", - atmf->dest_mac_addr[0], - atmf->dest_mac_addr[1], - atmf->dest_mac_addr[2], - atmf->dest_mac_addr[3], - atmf->dest_mac_addr[4], - atmf->dest_mac_addr[5]); - printf("Src Mac Address: " - "%02x:%02x:%02x:%02x:%02x:%02x\n", - atmf->src_mac_addr[0], - atmf->src_mac_addr[1], - atmf->src_mac_addr[2], - atmf->src_mac_addr[3], - atmf->src_mac_addr[4], - atmf->src_mac_addr[5]); - - hexdump("Frame Payload", - atmf->payload, - le16_to_cpu( - atmf->frame_len) - - MLAN_MAC_ADDR_LENGTH * - 2, - ' '); - } else { - printf("incorrect auto_tx command response\n"); - } - } - } - break; - } - case HostCmd_CMD_802_11_SUBSCRIBE_EVENT: { - HostCmd_DS_802_11_SUBSCRIBE_EVENT *se = - (HostCmd_DS_802_11_SUBSCRIBE_EVENT *)(buf + - S_DS_GEN); - if (le16_to_cpu(se->action) == HostCmd_ACT_GEN_GET) { - int len = - S_DS_GEN + - sizeof(HostCmd_DS_802_11_SUBSCRIBE_EVENT); - printf("\nEvent\t\tValue\tFreq\tsubscribed\n\n"); - while (len < hostcmd->size) { - MrvlIEtypesHeader_t *header = - (MrvlIEtypesHeader_t *)(buf + - len); - switch (le16_to_cpu(header->type)) { - case TLV_TYPE_RSSI_LOW: { - MrvlIEtypes_RssiThreshold_t *low_rssi = - (MrvlIEtypes_RssiThreshold_t - *)(buf + len); - printf("Beacon Low RSSI\t%d\t%d\t%s\n", - low_rssi->RSSI_value, - low_rssi->RSSI_freq, - (le16_to_cpu(se->events) & - 0x0001) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_SNR_LOW: { - MrvlIEtypes_SnrThreshold_t *low_snr = - (MrvlIEtypes_SnrThreshold_t - *)(buf + len); - printf("Beacon Low SNR\t%d\t%d\t%s\n", - low_snr->SNR_value, - low_snr->SNR_freq, - (le16_to_cpu(se->events) & - 0x0002) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_FAILCOUNT: { - MrvlIEtypes_FailureCount_t - *failure_count = - (MrvlIEtypes_FailureCount_t - *)(buf + - len); - printf("Failure Count\t%d\t%d\t%s\n", - failure_count->fail_value, - failure_count->fail_freq, - (le16_to_cpu(se->events) & - 0x0004) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_BCNMISS: { - MrvlIEtypes_BeaconsMissed_t - *bcn_missed = - (MrvlIEtypes_BeaconsMissed_t - *)(buf + - len); - printf("Beacon Missed\t%d\tN/A\t%s\n", - bcn_missed->beacon_missed, - (le16_to_cpu(se->events) & - 0x0008) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_RSSI_HIGH: { - MrvlIEtypes_RssiThreshold_t - *high_rssi = - (MrvlIEtypes_RssiThreshold_t - *)(buf + - len); - printf("Bcn High RSSI\t%d\t%d\t%s\n", - high_rssi->RSSI_value, - high_rssi->RSSI_freq, - (le16_to_cpu(se->events) & - 0x0010) ? - "yes" : - "no"); - break; - } - - case TLV_TYPE_SNR_HIGH: { - MrvlIEtypes_SnrThreshold_t *high_snr = - (MrvlIEtypes_SnrThreshold_t - *)(buf + len); - printf("Beacon High SNR\t%d\t%d\t%s\n", - high_snr->SNR_value, - high_snr->SNR_freq, - (le16_to_cpu(se->events) & - 0x0020) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_RSSI_LOW_DATA: { - MrvlIEtypes_RssiThreshold_t *low_rssi = - (MrvlIEtypes_RssiThreshold_t - *)(buf + len); - printf("Data Low RSSI\t%d\t%d\t%s\n", - low_rssi->RSSI_value, - low_rssi->RSSI_freq, - (le16_to_cpu(se->events) & - 0x0040) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_SNR_LOW_DATA: { - MrvlIEtypes_SnrThreshold_t *low_snr = - (MrvlIEtypes_SnrThreshold_t - *)(buf + len); - printf("Data Low SNR\t%d\t%d\t%s\n", - low_snr->SNR_value, - low_snr->SNR_freq, - (le16_to_cpu(se->events) & - 0x0080) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_RSSI_HIGH_DATA: { - MrvlIEtypes_RssiThreshold_t - *high_rssi = - (MrvlIEtypes_RssiThreshold_t - *)(buf + - len); - printf("Data High RSSI\t%d\t%d\t%s\n", - high_rssi->RSSI_value, - high_rssi->RSSI_freq, - (le16_to_cpu(se->events) & - 0x0100) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_SNR_HIGH_DATA: { - MrvlIEtypes_SnrThreshold_t *high_snr = - (MrvlIEtypes_SnrThreshold_t - *)(buf + len); - printf("Data High SNR\t%d\t%d\t%s\n", - high_snr->SNR_value, - high_snr->SNR_freq, - (le16_to_cpu(se->events) & - 0x0200) ? - "yes" : - "no"); - break; - } - case TLV_TYPE_LINK_QUALITY: { - MrvlIEtypes_LinkQuality_t *link_qual = - (MrvlIEtypes_LinkQuality_t - *)(buf + len); - printf("Link Quality Parameters:\n"); - printf("------------------------\n"); - printf("Link Quality Event Subscribed\t%s\n", - (le16_to_cpu(se->events) & - 0x0400) ? - "yes" : - "no"); - printf("Link SNR Threshold = %d\n", - le16_to_cpu( - link_qual - ->link_SNR_thrs)); - printf("Link SNR Frequency = %d\n", - le16_to_cpu( - link_qual - ->link_SNR_freq)); - printf("Min Rate Value = %d\n", - le16_to_cpu( - link_qual - ->min_rate_val)); - printf("Min Rate Frequency = %d\n", - le16_to_cpu( - link_qual - ->min_rate_freq)); - printf("Tx Latency Value = %d\n", - le32_to_cpu( - link_qual - ->tx_latency_val)); - printf("Tx Latency Threshold = %d\n", - le32_to_cpu( - link_qual - ->tx_latency_thrs)); - - break; - } - case TLV_TYPE_PRE_BEACON_LOST: { - MrvlIEtypes_PreBeaconLost_t - *pre_bcn_lost = - (MrvlIEtypes_PreBeaconLost_t - *)(buf + - len); - printf("------------------------\n"); - printf("Pre-Beacon Lost Event Subscribed\t%s\n", - (le16_to_cpu(se->events) & - 0x0800) ? - "yes" : - "no"); - printf("Pre-Beacon Lost: %d\n", - pre_bcn_lost - ->pre_beacon_lost); - break; - } - default: - printf("Unknown subscribed event TLV Type=%#x," - " Len=%d\n", - le16_to_cpu( - header->type), - le16_to_cpu( - header->len)); - break; - } - - len += (sizeof(MrvlIEtypesHeader_t) + - le16_to_cpu(header->len)); - } - } - break; - } - case HostCmd_CMD_MAC_REG_ACCESS: - case HostCmd_CMD_BBP_REG_ACCESS: - case HostCmd_CMD_RF_REG_ACCESS: - case HostCmd_CMD_CAU_REG_ACCESS: { - HostCmd_DS_REG *preg = - (HostCmd_DS_REG *)(buf + S_DS_GEN); - preg->action = le16_to_cpu(preg->action); - if (preg->action == HostCmd_ACT_GEN_GET) { - preg->value = le32_to_cpu(preg->value); - printf("value = 0x%08x\n", preg->value); - } - break; - } - case HostCmd_CMD_MEM_ACCESS: { - HostCmd_DS_MEM *pmem = - (HostCmd_DS_MEM *)(buf + S_DS_GEN); - pmem->action = le16_to_cpu(pmem->action); - if (pmem->action == HostCmd_ACT_GEN_GET) { - pmem->value = le32_to_cpu(pmem->value); - printf("value = 0x%08x\n", pmem->value); - } - break; - } - case HostCmd_CMD_LINK_STATS_SUMMARY: { - HostCmd_DS_LINK_STATS_SUMMARY *linkstats = - (HostCmd_DS_LINK_STATS_SUMMARY *)(buf + - S_DS_GEN); - /* GET operation */ - printf("Link Statistics: \n"); - /* format */ - printf("Duration: %u\n", - (int)le32_to_cpu( - linkstats->timeSinceLastQuery_ms)); - - printf("Beacon count: %u\n", - le16_to_cpu(linkstats->bcnCnt)); - printf("Beacon missing: %u\n", - le16_to_cpu(linkstats->bcnMiss)); - printf("Beacon RSSI avg: %d\n", - le16_to_cpu(linkstats->bcnRssiAvg)); - printf("Beacon SNR avg: %d\n", - le16_to_cpu(linkstats->bcnSnrAvg)); - - printf("Rx packets: %u\n", - (int)le32_to_cpu(linkstats->rxPkts)); - printf("Rx RSSI avg: %d\n", - le16_to_cpu(linkstats->rxRssiAvg)); - printf("Rx SNR avg: %d\n", - le16_to_cpu(linkstats->rxSnrAvg)); - - printf("Tx packets: %u\n", - (int)le32_to_cpu(linkstats->txPkts)); - printf("Tx Attempts: %u\n", - (int)le32_to_cpu(linkstats->txAttempts)); - printf("Tx Failures: %u\n", - (int)le32_to_cpu(linkstats->txFailures)); - printf("Tx Initial Rate: %s\n", - rateIdStr[linkstats->txInitRate]); - - printf("Tx AC VO: %u [ %u ]\n", - le16_to_cpu(linkstats->txQueuePktCnt[WMM_AC_VO]), - (int)le32_to_cpu( - linkstats->txQueueDelay[WMM_AC_VO]) / - 1000); - printf("Tx AC VI: %u [ %u ]\n", - le16_to_cpu(linkstats->txQueuePktCnt[WMM_AC_VI]), - (int)le32_to_cpu( - linkstats->txQueueDelay[WMM_AC_VI]) / - 1000); - printf("Tx AC BE: %u [ %u ]\n", - le16_to_cpu(linkstats->txQueuePktCnt[WMM_AC_BE]), - (int)le32_to_cpu( - linkstats->txQueueDelay[WMM_AC_BE]) / - 1000); - printf("Tx AC BK: %u [ %u ]\n", - le16_to_cpu(linkstats->txQueuePktCnt[WMM_AC_BK]), - (int)le32_to_cpu( - linkstats->txQueueDelay[WMM_AC_BK]) / - 1000); - break; - } - case HostCmd_CMD_WMM_PARAM_CONFIG: { - HostCmd_DS_WMM_PARAM_CONFIG *wmm_param = - (HostCmd_DS_WMM_PARAM_CONFIG *)(buf + S_DS_GEN); - printf("WMM Params: \n"); - printf("\tBE: AIFSN=%d, CW_MAX=%d CW_MIN=%d, TXOP=%d\n", - wmm_param->ac_params[AC_BE].aci_aifsn.aifsn, - wmm_param->ac_params[AC_BE].ecw.ecw_max, - wmm_param->ac_params[AC_BE].ecw.ecw_min, - le16_to_cpu( - wmm_param->ac_params[AC_BE].tx_op_limit)); - printf("\tBK: AIFSN=%d, CW_MAX=%d CW_MIN=%d, TXOP=%d\n", - wmm_param->ac_params[AC_BK].aci_aifsn.aifsn, - wmm_param->ac_params[AC_BK].ecw.ecw_max, - wmm_param->ac_params[AC_BK].ecw.ecw_min, - le16_to_cpu( - wmm_param->ac_params[AC_BK].tx_op_limit)); - printf("\tVI: AIFSN=%d, CW_MAX=%d CW_MIN=%d, TXOP=%d\n", - wmm_param->ac_params[AC_VI].aci_aifsn.aifsn, - wmm_param->ac_params[AC_VI].ecw.ecw_max, - wmm_param->ac_params[AC_VI].ecw.ecw_min, - le16_to_cpu( - wmm_param->ac_params[AC_VI].tx_op_limit)); - printf("\tVO: AIFSN=%d, CW_MAX=%d CW_MIN=%d, TXOP=%d\n", - wmm_param->ac_params[AC_VO].aci_aifsn.aifsn, - wmm_param->ac_params[AC_VO].ecw.ecw_max, - wmm_param->ac_params[AC_VO].ecw.ecw_min, - le16_to_cpu( - wmm_param->ac_params[AC_VO].tx_op_limit)); - break; - } - case HostCmd_ROBUST_COEX: { - host_RobustCoexLteStats_t *RobustCoexLteStat = - (host_RobustCoexLteStats_t *)(buf + S_DS_GEN); - if (RobustCoexLteStat->ResponseType == - EXT_LTE_RESP_GETSTAT) { - printf("==============LTE COEX STATS================\n"); - printf("Responsetype: %d \n", - RobustCoexLteStat->ResponseType); - printf("Count_LTE_TX_NOTIFY: %d \n", - (unsigned int)le32_to_cpu( - RobustCoexLteStat - ->Count_LTE_TX_NOTIFY)); - printf("Count_LTE_RX_PROTECT: %d \n", - (unsigned int)le32_to_cpu( - RobustCoexLteStat - ->Count_LTE_RX_PROTECT)); - printf("Count_LTE_TX_SUSPEND: %d \n", - (unsigned int)le32_to_cpu( - RobustCoexLteStat - ->Count_LTE_TX_SUSPEND)); - printf("Count_LTE_RX_NOTIFY: %d \n", - (unsigned int)le32_to_cpu( - RobustCoexLteStat - ->Count_LTE_RX_NOTIFY)); - } else if (RobustCoexLteStat->ResponseType == - EXT_LTE_RESP_RSTSTAT) { - printf("LTE STAT Counters cleared \n"); - } else // else print default cmdresp - { - printf("HOSTCMD_RESP: CmdCode=%#04x, Size=%#04x," - " SeqNum=%#04x, Result=%#04x\n", - hostcmd->command, hostcmd->size, - hostcmd->seq_num, hostcmd->result); - hexdump("payload", (t_void *)(buf + S_DS_GEN), - hostcmd->size - S_DS_GEN, ' '); - } - } break; - default: - printf("HOSTCMD_RESP: CmdCode=%#04x, Size=%#04x," - " SeqNum=%#04x, Result=%#04x\n", - hostcmd->command, hostcmd->size, - hostcmd->seq_num, hostcmd->result); - hexdump("payload", (t_void *)(buf + S_DS_GEN), - hostcmd->size - S_DS_GEN, ' '); - break; - } - } else { - printf("HOSTCMD failed: CmdCode=%#04x, Size=%#04x," - " SeqNum=%#04x, Result=%#04x\n", - hostcmd->command, hostcmd->size, hostcmd->seq_num, - hostcmd->result); - } - return ret; -} - -/** - * @brief Process hssetpara configuration - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_hssetpara(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: hssetpara fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -#define STACK_NBYTES 100 /**< Number of bytes in stack */ -#define MAX_BYTESEQ 6 /**< Maximum byte sequence */ -#define TYPE_DNUM 1 /**< decimal number */ -#define TYPE_BYTESEQ 2 /**< byte sequence */ -#define MAX_OPERAND 0x40 /**< Maximum operands */ -#define TYPE_EQ (MAX_OPERAND + 1) /**< byte comparison: == operator */ -#define TYPE_EQ_DNUM (MAX_OPERAND + 2) /**< decimal comparison: =d operator */ -#define TYPE_EQ_BIT (MAX_OPERAND + 3) /**< bit comparison: =b operator */ -#define TYPE_AND (MAX_OPERAND + 4) /**< && operator */ -#define TYPE_OR (MAX_OPERAND + 5) /**< || operator */ - -typedef struct { - t_u16 sp; /**< Stack pointer */ - t_u8 byte[STACK_NBYTES]; /**< Stack */ -} mstack_t; - -typedef struct { - t_u8 type; /**< Type */ - t_u8 reserve[3]; /**< so 4-byte align val array */ - /* byte sequence is the largest among all the operands and operators. */ - /* byte sequence format: 1 byte of num of bytes, then variable num bytes - */ - t_u8 val[MAX_BYTESEQ + 1]; /**< Value */ -} op_t; - -/** - * @brief push data to stack - * - * @param s a pointer to mstack_t structure - * - * @param nbytes number of byte to push to stack - * - * @param val a pointer to data buffer - * - * @return TRUE-- sucess , FALSE -- fail - * - */ -static int push_n(mstack_t *s, t_u8 nbytes, t_u8 *val) -{ - if ((s->sp + nbytes) < STACK_NBYTES) { - memcpy((void *)(s->byte + s->sp), (const void *)val, - (size_t)nbytes); - s->sp += nbytes; - /* printf("push: n %d sp %d\n", nbytes, s->sp); */ - return TRUE; - } else /* stack full */ - return FALSE; -} - -/** - * @brief push data to stack - * - * @param s a pointer to mstack_t structure - * - * @param op a pointer to op_t structure - * - * @return TRUE-- sucess , FALSE -- fail - * - */ -static int push(mstack_t *s, op_t *op) -{ - t_u8 nbytes; - switch (op->type) { - case TYPE_DNUM: - if (push_n(s, 4, op->val)) - return push_n(s, 1, &op->type); - return FALSE; - case TYPE_BYTESEQ: - nbytes = op->val[0]; - if (push_n(s, nbytes, op->val + 1) && push_n(s, 1, op->val) && - push_n(s, 1, &op->type)) - return TRUE; - return FALSE; - default: - return push_n(s, 1, &op->type); - } -} - -/** - * @brief parse RPN string - * - * @param s a pointer to Null-terminated string to scan. - * - * @param first_time a pointer to return first_time - * - * @return A pointer to the last token found in string. - * NULL is returned when there are no more tokens to be - * found. - * - */ -static char *getop(char *s, int *first_time) -{ - const char delim[] = " \t\n"; - char *p; - if (*first_time) { - p = strtok(s, delim); - *first_time = FALSE; - } else { - p = strtok(NULL, delim); - } - return p; -} - -/** - * @brief Verify hex digit. - * - * @param c input ascii char - * @param h a pointer to return integer value of the digit - * char. - * @return TURE -- c is hex digit, FALSE -- c is not hex - * digit. - */ -static int ishexdigit(char c, t_u8 *h) -{ - if (c >= '0' && c <= '9') { - *h = c - '0'; - return TRUE; - } else if (c >= 'a' && c <= 'f') { - *h = c - 'a' + 10; - return TRUE; - } else if (c >= 'A' && c <= 'F') { - *h = c - 'A' + 10; - return TRUE; - } - return FALSE; -} - -/** - * @brief convert hex string to integer. - * - * @param s A pointer to hex string, string length up to 2 - * digits. - * @return integer value. - */ -static t_u8 hex_atoi(char *s) -{ - int i; - t_u8 digit; /* digital value */ - t_u8 t = 0; /* total value */ - - for (i = 0, t = 0; ishexdigit(s[i], &digit) && i < 2; i++) - t = 16 * t + digit; - return t; -} - -/** - * @brief Parse byte sequence in hex format string to a byte sequence. - * - * @param opstr A pointer to byte sequence in hex format string, with - * ':' as delimiter between two byte. - * @param val A pointer to return byte sequence string - * @return NA - */ -static void parse_hex(char *opstr, t_u8 *val) -{ - char delim = ':'; - char *p; - char *q; - t_u8 i; - - /* +1 is for skipping over the preceding h character. */ - p = opstr + 1; - - /* First byte */ - val[1] = hex_atoi(p++); - - /* Parse subsequent bytes. */ - /* Each byte is preceded by the : character. */ - for (i = 1; *p; i++) { - q = strchr(p, delim); - if (!q) - break; - p = q + 1; - val[i + 1] = hex_atoi(p); - } - /* Set num of bytes */ - val[0] = i; -} - -/** - * @brief str2bin, convert RPN string to binary format - * - * @param str A pointer to rpn string - * @param stack A pointer to mstack_t structure - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int str2bin(char *str, mstack_t *stack) -{ - int first_time; - char *opstr; - op_t op; /* operator/operand */ - int dnum; - int ret = MLAN_STATUS_SUCCESS; - - memset(stack, 0, sizeof(mstack_t)); - first_time = TRUE; - while ((opstr = getop(str, &first_time)) != NULL) { - if (isdigit((unsigned char)*opstr)) { - op.type = TYPE_DNUM; - dnum = cpu_to_le32(atoi(opstr)); - memcpy((t_u8 *)op.val, &dnum, sizeof(dnum)); - if (!push(stack, &op)) { - printf("push decimal number failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (*opstr == 'h') { - op.type = TYPE_BYTESEQ; - parse_hex(opstr, op.val); - if (!push(stack, &op)) { - printf("push byte sequence failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (!strcmp(opstr, "==")) { - op.type = TYPE_EQ; - if (!push(stack, &op)) { - printf("push byte cmp operator failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (!strcmp(opstr, "=d")) { - op.type = TYPE_EQ_DNUM; - if (!push(stack, &op)) { - printf("push decimal cmp operator failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (!strcmp(opstr, "=b")) { - op.type = TYPE_EQ_BIT; - if (!push(stack, &op)) { - printf("push bit cmp operator failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (!strcmp(opstr, "&&")) { - op.type = TYPE_AND; - if (!push(stack, &op)) { - printf("push AND operator failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else if (!strcmp(opstr, "||")) { - op.type = TYPE_OR; - if (!push(stack, &op)) { - printf("push OR operator failed\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } else { - printf("Unknown operand\n"); - ret = MLAN_STATUS_FAILURE; - break; - } - } - return ret; -} - -#define FILTER_BYTESEQ TYPE_EQ /**< byte sequence */ -#define FILTER_DNUM TYPE_EQ_DNUM /**< decimal number */ -#define FILTER_BITSEQ TYPE_EQ_BIT /**< bit sequence */ -#define FILTER_TEST (FILTER_BITSEQ + 1) /**< test */ - -#define NAME_TYPE 1 /**< Field name 'type' */ -#define NAME_PATTERN 2 /**< Field name 'pattern' */ -#define NAME_OFFSET 3 /**< Field name 'offset' */ -#define NAME_NUMBYTE 4 /**< Field name 'numbyte' */ -#define NAME_REPEAT 5 /**< Field name 'repeat' */ -#define NAME_BYTE 6 /**< Field name 'byte' */ -#define NAME_MASK 7 /**< Field name 'mask' */ -#define NAME_DEST 8 /**< Field name 'dest' */ - -static struct mef_fields { - char *name; /**< Name */ - t_s8 nameid; /**< Name Id. */ -} mef_fields[] = {{"type", NAME_TYPE}, {"pattern", NAME_PATTERN}, - {"offset", NAME_OFFSET}, {"numbyte", NAME_NUMBYTE}, - {"repeat", NAME_REPEAT}, {"byte", NAME_BYTE}, - {"mask", NAME_MASK}, {"dest", NAME_DEST}}; - -/** - * @brief get filter data - * - * @param fp A pointer to file stream - * @param ln A pointer to line number - * @param buf A pointer to hostcmd data - * @param size A pointer to the return size of hostcmd buffer - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int mlan_get_filter_data(FILE *fp, int *ln, t_u8 *buf, t_u16 *size) -{ - t_s32 errors = 0, i; - char line[256], *pos = NULL, *pos1 = NULL; - t_u16 type = 0; - t_u32 pattern = 0; - t_u16 repeat = 0; - t_u16 offset = 0; - char byte_seq[50]; - char mask_seq[50]; - t_u16 numbyte = 0; - t_s8 type_find = 0; - t_s8 pattern_find = 0; - t_s8 offset_find = 0; - t_s8 numbyte_find = 0; - t_s8 repeat_find = 0; - t_s8 byte_find = 0; - t_s8 mask_find = 0; - t_s8 dest_find = 0; - char dest_seq[50]; - - *size = 0; - while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) { - if (strcmp(pos, "}") == 0) { - break; - } - pos1 = strchr(pos, '='); - if (pos1 == NULL) { - printf("Line %d: Invalid mef_filter line '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos1++ = '\0'; - for (i = 0; (t_u32)i < NELEMENTS(mef_fields); i++) { - if (strncmp(pos, mef_fields[i].name, - strlen(mef_fields[i].name)) == 0) { - switch (mef_fields[i].nameid) { - case NAME_TYPE: - type = a2hex_or_atoi(pos1); - if ((type != FILTER_DNUM) && - (type != FILTER_BYTESEQ) && - (type != FILTER_BITSEQ) && - (type != FILTER_TEST)) { - printf("Invalid filter type:%d\n", - type); - return MLAN_STATUS_FAILURE; - } - type_find = 1; - break; - case NAME_PATTERN: - pattern = a2hex_or_atoi(pos1); - pattern_find = 1; - break; - case NAME_OFFSET: - offset = a2hex_or_atoi(pos1); - offset_find = 1; - break; - case NAME_NUMBYTE: - numbyte = a2hex_or_atoi(pos1); - numbyte_find = 1; - break; - case NAME_REPEAT: - repeat = a2hex_or_atoi(pos1); - repeat_find = 1; - break; - case NAME_BYTE: - memset(byte_seq, 0, sizeof(byte_seq)); - strncpy(byte_seq, pos1, - (sizeof(byte_seq) - 1)); - byte_find = 1; - break; - case NAME_MASK: - memset(mask_seq, 0, sizeof(mask_seq)); - strncpy(mask_seq, pos1, - (sizeof(mask_seq) - 1)); - mask_find = 1; - break; - case NAME_DEST: - memset(dest_seq, 0, sizeof(dest_seq)); - strncpy(dest_seq, pos1, - (sizeof(dest_seq) - 1)); - dest_find = 1; - break; - } - break; - } - } - if (i == NELEMENTS(mef_fields)) { - printf("Line %d: unknown mef field '%s'.\n", *line, - pos); - errors++; - } - } - if (type_find == 0) { - printf("Can not find filter type\n"); - return MLAN_STATUS_FAILURE; - } - switch (type) { - case FILTER_DNUM: - if (!pattern_find || !offset_find || !numbyte_find) { - printf("Missing field for FILTER_DNUM: pattern=%d,offset=%d,numbyte=%d\n", - pattern_find, offset_find, numbyte_find); - return MLAN_STATUS_FAILURE; - } - memset(line, 0, sizeof(line)); - snprintf(line, sizeof(line), "%d %d %d =d ", pattern, offset, - numbyte); - break; - case FILTER_BYTESEQ: - if (!byte_find || !offset_find || !repeat_find) { - printf("Missing field for FILTER_BYTESEQ: byte=%d,offset=%d,repeat=%d\n", - byte_find, offset_find, repeat_find); - return MLAN_STATUS_FAILURE; - } - memset(line, 0, sizeof(line)); - snprintf(line, sizeof(line), "%d h%s %d == ", repeat, byte_seq, - offset); - break; - case FILTER_BITSEQ: - if (!byte_find || !offset_find || !mask_find) { - printf("Missing field for FILTER_BITSEQ: byte=%d,offset=%d,mask_find=%d\n", - byte_find, offset_find, mask_find); - return MLAN_STATUS_FAILURE; - } - if (strlen(byte_seq) != strlen(mask_seq)) { - printf("byte string's length is different with mask's length!\n"); - return MLAN_STATUS_FAILURE; - } - memset(line, 0, sizeof(line)); - snprintf(line, sizeof(line), "h%s %d h%s =b ", byte_seq, offset, - mask_seq); - break; - case FILTER_TEST: - if (!byte_find || !offset_find || !repeat_find || !dest_find) { - printf("Missing field for FILTER_TEST: byte=%d,offset=%d,repeat=%d,dest=%d\n", - byte_find, offset_find, repeat_find, dest_find); - return MLAN_STATUS_FAILURE; - } - memset(line, 0, sizeof(line)); - snprintf(line, sizeof(line), "h%s %d h%s %d ", dest_seq, repeat, - byte_seq, offset); - break; - } - memcpy(buf, line, strlen(line)); - *size = strlen(line); - return MLAN_STATUS_SUCCESS; -} - -#define NAME_MODE 1 /**< Field name 'mode' */ -#define NAME_ACTION 2 /**< Field name 'action' */ -#define NAME_FILTER_NUM 3 /**< Field name 'filter_num' */ -#define NAME_RPN 4 /**< Field name 'RPN' */ -static struct mef_entry_fields { - char *name; /**< Name */ - t_s8 nameid; /**< Name id */ -} mef_entry_fields[] = { - {"mode", NAME_MODE}, - {"action", NAME_ACTION}, - {"filter_num", NAME_FILTER_NUM}, - {"RPN", NAME_RPN}, -}; - -typedef struct _MEF_ENTRY { - /** Mode */ - t_u8 Mode; - /** Size */ - t_u8 Action; - /** Size of expression */ - t_u16 ExprSize; -} MEF_ENTRY; - -/** - * @brief get mef_entry data - * - * @param fp A pointer to file stream - * @param ln A pointer to line number - * @param buf A pointer to hostcmd data - * @param size A pointer to the return size of hostcmd buffer - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int mlan_get_mef_entry_data(FILE *fp, int *ln, t_u8 *buf, t_u16 *size) -{ - char line[256], *pos = NULL, *pos1 = NULL; - t_u8 mode, action, filter_num = 0; - char rpn[256]; - t_s8 mode_find = 0; - t_s8 action_find = 0; - t_s8 filter_num_find = 0; - t_s8 rpn_find = 0; - char rpn_str[256]; - int rpn_len = 0; - char filter_name[50]; - t_s8 name_found = 0; - t_u16 len = 0; - int i; - int first_time = TRUE; - char *opstr = NULL; - char filter_action[10]; - t_s32 errors = 0; - MEF_ENTRY *pMefEntry = (MEF_ENTRY *)buf; - mstack_t stack; - while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) { - if (strcmp(pos, "}") == 0) { - break; - } - pos1 = strchr(pos, '='); - if (pos1 == NULL) { - printf("Line %d: Invalid mef_entry line '%s'\n", *ln, - pos); - errors++; - continue; - } - *pos1++ = '\0'; - if (!mode_find || !action_find || !filter_num_find || - !rpn_find) { - for (i = 0; - (unsigned int)i < NELEMENTS(mef_entry_fields); - i++) { - if (strncmp(pos, mef_entry_fields[i].name, - strlen(mef_entry_fields[i].name)) == - 0) { - switch (mef_entry_fields[i].nameid) { - case NAME_MODE: - mode = a2hex_or_atoi(pos1); - if (mode & ~0x7) { - printf("invalid mode=%d\n", - mode); - return MLAN_STATUS_FAILURE; - } - pMefEntry->Mode = mode; - mode_find = 1; - break; - case NAME_ACTION: - action = a2hex_or_atoi(pos1); - if (action & ~0xff) { - printf("invalid action=%d\n", - action); - return MLAN_STATUS_FAILURE; - } - pMefEntry->Action = action; - action_find = 1; - break; - case NAME_FILTER_NUM: - filter_num = - a2hex_or_atoi(pos1); - filter_num_find = 1; - break; - case NAME_RPN: - memset(rpn, 0, sizeof(rpn)); - strncpy(rpn, pos1, - (sizeof(rpn) - 1)); - rpn_find = 1; - break; - } - break; - } - } - if (i == NELEMENTS(mef_fields)) { - printf("Line %d: unknown mef_entry field '%s'.\n", - *line, pos); - return MLAN_STATUS_FAILURE; - } - } - if (mode_find && action_find && filter_num_find && rpn_find) { - for (i = 0; i < filter_num; i++) { - opstr = getop(rpn, &first_time); - if (opstr == NULL) - break; - snprintf(filter_name, sizeof(filter_name), - "%s={", opstr); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), ln))) { - if (strncmp(pos, filter_name, - strlen(filter_name)) == 0) { - name_found = 1; - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: %s not found in file\n", - filter_name); - return MLAN_STATUS_FAILURE; - } - if (MLAN_STATUS_FAILURE == - mlan_get_filter_data( - fp, ln, (t_u8 *)(rpn_str + rpn_len), - &len)) - break; - rpn_len += len; - if (i > 0) { - memcpy(rpn_str + rpn_len, filter_action, - strlen(filter_action)); - rpn_len += strlen(filter_action); - } - opstr = getop(rpn, &first_time); - if (opstr == NULL) - break; - memset(filter_action, 0, sizeof(filter_action)); - snprintf(filter_action, sizeof(filter_action), - "%s ", opstr); - } - /* Remove the last space */ - if (rpn_len > 0) { - rpn_len--; - rpn_str[rpn_len] = 0; - } - if (MLAN_STATUS_FAILURE == str2bin(rpn_str, &stack)) { - printf("Fail on str2bin!\n"); - return MLAN_STATUS_FAILURE; - } - *size = sizeof(MEF_ENTRY); - pMefEntry->ExprSize = cpu_to_le16(stack.sp); - memmove(buf + sizeof(MEF_ENTRY), stack.byte, stack.sp); - *size += stack.sp; - break; - } else if (mode_find && action_find && filter_num_find && - (filter_num == 0)) { - pMefEntry->ExprSize = 0; - *size = sizeof(MEF_ENTRY); - break; - } - } - return MLAN_STATUS_SUCCESS; -} - -#define MEFCFG_CMDCODE 0x009a - -/** - * @brief Process mefcfg command - * @param argc number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_mefcfg(int argc, char *argv[]) -{ - char line[256], cmdname[256], *pos = NULL; - int cmdname_found = 0, name_found = 0; - int ln = 0; - int ret = MLAN_STATUS_SUCCESS; - int i; - t_u8 *buffer = NULL; - t_u16 len = 0; - HostCmd_DS_MEF_CFG *mefcmd = NULL; - HostCmd_DS_GEN *hostcmd = NULL; - FILE *fp = NULL; - t_u32 cmd_len = 0, cmd_header_len; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - if (argc < 4) { - printf("Error: invalid no of arguments\n"); - printf("Syntax: ./mlanutl mlan0 mefcfg \n"); - exit(1); - } - - cmd_header_len = strlen(CMD_NXP) + strlen("HOSTCMD"); - cmd_len = sizeof(HostCmd_DS_GEN) + sizeof(HostCmd_DS_MEF_CFG); - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return -ENOMEM; - } - - memset(buffer, 0, BUFFER_LENGTH); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - /* buf = MRVL_CMD */ - prepare_buffer(buffer, HOSTCMD, 0, NULL); - - /* buf = MRVL_CMD */ - hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32)); - hostcmd->command = cpu_to_le16(MEFCFG_CMDCODE); - hostcmd->seq_num = 0; - hostcmd->result = 0; - /* buf = MRVL_CMD - */ - mefcmd = (HostCmd_DS_MEF_CFG *)(buffer + cmd_header_len + - sizeof(t_u32) + S_DS_GEN); - - /* Host Command Population */ - snprintf(cmdname, sizeof(cmdname), "%s={", argv[2]); - cmdname_found = 0; - fp = fopen(argv[3], "r"); - if (fp == NULL) { - fprintf(stderr, "Cannot open file %s\n", argv[4]); - exit(1); - } - - while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) { - if (strcmp(pos, cmdname) == 0) { - cmdname_found = 1; - snprintf(cmdname, sizeof(cmdname), "Criteria="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, strlen(cmdname)) == - 0) { - name_found = 1; - mefcmd->Criteria = a2hex_or_atoi( - pos + strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: criteria not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), "NumEntries="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, strlen(cmdname)) == - 0) { - name_found = 1; - mefcmd->NumEntries = a2hex_or_atoi( - pos + strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: NumEntries not found in file '%s'\n", - argv[3]); - break; - } - for (i = 0; i < mefcmd->NumEntries; i++) { - snprintf(cmdname, sizeof(cmdname), - "mef_entry_%d={", i); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: %s not found in file '%s'\n", - cmdname, argv[3]); - break; - } - if (MLAN_STATUS_FAILURE == - mlan_get_mef_entry_data( - fp, &ln, (t_u8 *)hostcmd + cmd_len, - &len)) { - ret = MLAN_STATUS_FAILURE; - break; - } - cmd_len += len; - } - break; - } - } - fclose(fp); - /* buf = MRVL_CMD */ - memcpy(buffer + cmd_header_len, (t_u8 *)&cmd_len, sizeof(t_u32)); - - if (!cmdname_found) - fprintf(stderr, - "mlanutl: cmdname '%s' not found in file '%s'\n", - argv[4], argv[3]); - - if (!cmdname_found || !name_found) { - ret = MLAN_STATUS_FAILURE; - goto mef_exit; - } - hostcmd->size = cpu_to_le16(cmd_len); - mefcmd->Criteria = cpu_to_le32(mefcmd->Criteria); - mefcmd->NumEntries = cpu_to_le16(mefcmd->NumEntries); - hexdump("mefcfg", buffer + cmd_header_len, cmd_len, ' '); - - /* Initialize the ifr structure */ - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - /* Perform ioctl */ - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("ioctl[MEF_CFG]"); - printf("ERR:Command sending failed!\n"); - - if (buffer) - free(buffer); - - if (cmd) - free(cmd); - - return MLAN_STATUS_FAILURE; - } - - ret = process_host_cmd_resp(HOSTCMD, buffer); - -mef_exit: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - return ret; -} - -/** - * @brief Check the Hex String - * @param s A pointer to the string - * @return MLAN_STATUS_SUCCESS --HexString, MLAN_STATUS_FAILURE --not - * HexString - */ -static int ishexstring(char *s) -{ - int ret = MLAN_STATUS_FAILURE; - t_s32 tmp; - - if (!strncasecmp("0x", s, 2)) { - s += 2; - } - while (*s) { - tmp = toupper((unsigned char)*s); - if (((tmp >= 'A') && (tmp <= 'F')) || - ((tmp >= '0') && (tmp <= '9'))) { - ret = MLAN_STATUS_SUCCESS; - } else { - ret = MLAN_STATUS_FAILURE; - break; - } - s++; - } - - return ret; -} -/** - * @brief Converts colon separated MAC address to hex value - * - * @param mac A pointer to the colon separated MAC string - * @param raw A pointer to the hex data buffer - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - * MAC_BROADCAST - if broadcast mac - * MAC_MULTICAST - if multicast mac - */ -int mac2raw(char *mac, t_u8 *raw) -{ - unsigned int temp_raw[ETH_ALEN]; - int num_tokens = 0; - int i; - - if (strlen(mac) != ((2 * ETH_ALEN) + (ETH_ALEN - 1))) { - return MLAN_STATUS_FAILURE; - } - num_tokens = sscanf(mac, "%2x:%2x:%2x:%2x:%2x:%2x", temp_raw + 0, - temp_raw + 1, temp_raw + 2, temp_raw + 3, - temp_raw + 4, temp_raw + 5); - if (num_tokens != ETH_ALEN) { - return MLAN_STATUS_FAILURE; - } - for (i = 0; i < num_tokens; i++) - raw[i] = (t_u8)temp_raw[i]; - - if (memcmp(raw, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0) { - return MAC_BROADCAST; - } else if (raw[0] & 0x01) { - return MAC_MULTICAST; - } - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Convert String to Integer - * @param buf A pointer to the string - * @return Integer - */ -static int atoval(char *buf) -{ - if (!strncasecmp(buf, "0x", 2)) - return a2hex(buf + 2); - else if (!ishexstring(buf)) - return a2hex(buf); - else - return atoi(buf); -} - -/** - * @brief Parses a command line - * - * @param line The line to parse - * @param args Pointer to the argument buffer to be filled in - * @param args_count Max number of elements which can be filled in buffer - * 'args' - * @return Number of arguments in the line or EOF - */ -int parse_line(char *line, char *args[], t_u16 args_count) -{ - int arg_num = 0; - int is_start = 0; - int is_quote = 0; - int length = 0; - int i = 0; - - arg_num = 0; - length = strlen(line); - /* Process line */ - - /* Find number of arguments */ - is_start = 0; - is_quote = 0; - for (i = 0; (i < length) && (arg_num < args_count); i++) { - /* Ignore leading spaces */ - if (is_start == 0) { - if (line[i] == ' ') { - continue; - } else if (line[i] == '\t') { - continue; - } else if (line[i] == '\n') { - break; - } else { - is_start = 1; - args[arg_num] = &line[i]; - arg_num++; - } - } - if (is_start == 1) { - /* Ignore comments */ - if (line[i] == '#') { - if (is_quote == 0) { - line[i] = '\0'; - arg_num--; - } - break; - } - /* Separate by '=' */ - if (line[i] == '=') { - line[i] = '\0'; - is_start = 0; - continue; - } - /* Separate by ',' */ - if (line[i] == ',') { - line[i] = '\0'; - is_start = 0; - continue; - } - /* Change ',' to ' ', but not inside quotes */ - if ((line[i] == ',') && (is_quote == 0)) { - line[i] = ' '; - continue; - } - } - /* Remove newlines */ - if (line[i] == '\n') { - line[i] = '\0'; - } - /* Check for quotes */ - if (line[i] == '"') { - is_quote = (is_quote == 1) ? 0 : 1; - continue; - } - if (((line[i] == ' ') || (line[i] == '\t')) && - (is_quote == 0)) { - line[i] = '\0'; - is_start = 0; - continue; - } - } - return arg_num; -} - -/** - * @brief Process cloud keep alive command - * @param argc number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_cloud_keep_alive(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - FILE *fp = NULL; - int ret = MLAN_STATUS_SUCCESS; - char line[256], cmdname[256], *pos = NULL; - int cmdname_found = 0, name_found = 0, arg_num = 0; - int ln = 0, i = 0; - char *args[256]; - cloud_keep_alive *keep_alive = NULL; - - if (argc < 5) { - printf("Error: invalid no of arguments\n"); - printf("Syntax: ./mlanutl mlanX cloud_keep_alive \n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Insert command */ - strncpy((char *)buffer, argv[2], strlen(argv[2])); - - keep_alive = (cloud_keep_alive *)(buffer + strlen(argv[2])); - - cmdname_found = 0; - snprintf(cmdname, sizeof(cmdname), "%s={", argv[4]); - - fp = fopen(argv[3], "r"); - if (fp == NULL) { - fprintf(stderr, "Cannot open file %s\n", argv[3]); - ret = MLAN_STATUS_FAILURE; - if (buffer) - free(buffer); - goto done; - } - - while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) { - if (strcmp(pos, cmdname) == 0) { - cmdname_found = 1; - snprintf(cmdname, sizeof(cmdname), "mkeep_alive_id="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, strlen(cmdname)) == - 0) { - name_found = 1; - keep_alive->mkeep_alive_id = - a2hex_or_atoi(pos + - strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: keep alive id not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), "enable="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, strlen(cmdname)) == - 0) { - name_found = 1; - keep_alive->enable = a2hex_or_atoi( - pos + strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: enable not found in file '%s'\n", - argv[3]); - break; - } - if (strcmp(argv[4], "reset") == 0) { - snprintf(cmdname, sizeof(cmdname), "reset="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - keep_alive - ->reset = a2hex_or_atoi( - pos + strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: reset not found in file '%s'\n", - argv[3]); - break; - } - } - if (strcmp(argv[4], "start") == 0) { - snprintf(cmdname, sizeof(cmdname), - "sendInterval="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - keep_alive->sendInterval = - a2hex_or_atoi( - pos + - strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: sendInterval not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), - "retryInterval="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - keep_alive->retryInterval = - a2hex_or_atoi( - pos + - strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: retryInterval not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), - "retryCount="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - keep_alive->retryCount = - a2hex_or_atoi( - pos + - strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: retryCount not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), - "destMacAddr="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - mac2raw(pos + strlen(cmdname), - keep_alive->dst_mac); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: destination MAC address not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), - "srcMacAddr="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - mac2raw(pos + strlen(cmdname), - keep_alive->src_mac); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: source MAC address not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), "pktLen="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - keep_alive->pkt_len = - a2hex_or_atoi( - pos + - strlen(cmdname)); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: ip packet length not found in file '%s'\n", - argv[3]); - break; - } - snprintf(cmdname, sizeof(cmdname), "ipPkt="); - name_found = 0; - while ((pos = mlan_config_get_line( - fp, line, sizeof(line), &ln))) { - if (strncmp(pos, cmdname, - strlen(cmdname)) == 0) { - name_found = 1; - arg_num = parse_line(line, args, - 256); - if (arg_num < - keep_alive->pkt_len) { - fprintf(stderr, - "Invalid ipPkt or pkt_len in '%s'\n", - argv[3]); - break; - } - for (i = 0; - i < keep_alive->pkt_len; - i++) - keep_alive->pkt[i] = - (t_u8)atoval( - args[i + - 1]); - break; - } - } - if (!name_found) { - fprintf(stderr, - "mlanutl: ipPkt data not found in file '%s'\n", - argv[3]); - break; - } - } - } - } - if (!cmdname_found) { - fprintf(stderr, "mlanutl: ipPkt data not found in file '%s'\n", - argv[3]); - free(buffer); - if (fp) - fclose(fp); - return MLAN_STATUS_FAILURE; - } - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: cloud keep alive fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - /* Process result */ - keep_alive = (cloud_keep_alive *)(buffer + strlen(argv[2])); - if (strcmp(argv[4], "start") != 0) { - hexdump("Last cloud keep alive packet info", keep_alive->pkt, - keep_alive->pkt_len, ' '); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - -done: - return ret; -} - -/** - * @brief Implement Minimum BA Threshold command - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_min_ba_threshold_cfg(int argc, char *argv[]) -{ - int ret = 0; - t_u8 min_ba_thres = 0; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(buffer, 0, BUFFER_LENGTH); - - /* Sanity tests */ - if (argc < 3 || argc > 4) { - printf("Error: invalid no of arguments\n"); - printf("mlanutl mlanX min_ba_threshold [#]\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: min_ba_threshold fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - if (argc == 3) { - memcpy(&min_ba_thres, buffer, sizeof(min_ba_thres)); - printf("Min Tx BA Threshold: %d\n", min_ba_thres); - } - -done: - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return ret; -} - -/** - * * @brief Process txwatchdog check command - * * @param argc number of arguments - * * @param argv A pointer to arguments array - * * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - * */ -static int process_txwatchdog(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], (argc - 3), &argv[3]); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: txwatchdog fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Process Get result */ - if (argc == 3) { - printf("txwatchdog check: %s\n", - ((*(t_u32 *)buffer == 0) ? "Disabled" : "Enabled")); - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -static int process_getuuid(int argc, char *argv[]) -{ - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - prepare_buffer(buffer, argv[2], 0, NULL); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = BUFFER_LENGTH; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanutl"); - fprintf(stderr, "mlanutl: version fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - printf("uuid: %s\n", buffer); - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/******************************************************** - Global Functions -********************************************************/ - -/** - * @brief Entry function for mlanutl - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -int main(int argc, char *argv[]) -{ - int ret = MLAN_STATUS_SUCCESS; - - if ((argc == 2) && (strcmp(argv[1], "-v") == 0)) { - fprintf(stdout, "NXP mlanutl version %s\n", MLANUTL_VER); - exit(0); - } - if (argc < 3) { - fprintf(stderr, "Invalid number of parameters!\n"); - display_usage(); - exit(1); - } - - strncpy(dev_name, argv[1], IFNAMSIZ - 1); - - /* - * Create a socket - */ - sockfd = socket(AF_INET, SOCK_STREAM, 0); - if (sockfd < 0) { - fprintf(stderr, "mlanutl: Cannot open socket.\n"); - exit(1); - } - - ret = process_command(argc, argv); - - if (ret == MLAN_STATUS_NOTFOUND) { - if (ret) { - fprintf(stderr, "Invalid command specified!\n"); - display_usage(); - ret = 1; - } - } - - close(sockfd); - return ret; -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.h b/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.h deleted file mode 100644 index 15c6b32..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanutl.h +++ /dev/null @@ -1,1202 +0,0 @@ -/** @file mlanutl.h - * - * @brief This file contains definitions for application - * - * - * 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 - * (the License). You may use, redistribute and/or modify the File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - * - */ -/************************************************************************ -Change log: - 11/26/2008: initial version -************************************************************************/ -#ifndef _MLANUTL_H_ -#define _MLANUTL_H_ - -/** Include header files */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/** Type definition: boolean */ -typedef enum { FALSE, TRUE } boolean; - -/** 16 bits byte swap */ -#define swap_byte_16(x) \ - ((t_u16)((((t_u16)(x)&0x00ffU) << 8) | (((t_u16)(x)&0xff00U) >> 8))) - -/** 32 bits byte swap */ -#define swap_byte_32(x) \ - ((t_u32)((((t_u32)(x)&0x000000ffUL) << 24) | \ - (((t_u32)(x)&0x0000ff00UL) << 8) | \ - (((t_u32)(x)&0x00ff0000UL) >> 8) | \ - (((t_u32)(x)&0xff000000UL) >> 24))) - -/** Convert to correct endian format */ -/** Do nothing */ -#define cpu_to_le16(x) (x) -/** Do nothing */ -#define cpu_to_le32(x) (x) -/** Do nothing */ -#define le16_to_cpu(x) (x) -/** Do nothing */ -#define le32_to_cpu(x) (x) - -/** TLV header */ -#define TLVHEADER /** Tag */ \ - t_u16 tag; \ - /** Length */ \ - t_u16 length - -/** Length of TLV header */ -#define TLVHEADER_LEN 4 - -/** Character, 1 byte */ -typedef signed char t_s8; -/** Unsigned character, 1 byte */ -typedef unsigned char t_u8; - -/** Short integer */ -typedef signed short t_s16; -/** Unsigned short integer */ -typedef unsigned short t_u16; - -/** Integer */ -typedef signed int t_s32; -/** Unsigned integer */ -typedef unsigned int t_u32; - -/** Long long integer */ -typedef signed long long t_s64; -/** Unsigned long long integer */ -typedef unsigned long long t_u64; - -/** Void pointer (4-bytes) */ -typedef void t_void; - -enum _mlan_act_ioctl { - MLAN_ACT_SET = 1, - MLAN_ACT_GET, - MLAN_ACT_CANCEL, - MLAN_ACT_CLEAR, - MLAN_ACT_RESET, - MLAN_ACT_DEFAULT -}; - -/** The attribute pack used for structure packing */ -#ifndef __ATTRIB_PACK__ -#define __ATTRIB_PACK__ __attribute__((packed)) -#endif - -/** Success */ -#define MLAN_STATUS_SUCCESS (0) -/** Failure */ -#define MLAN_STATUS_FAILURE (-1) -/** Not found */ -#define MLAN_STATUS_NOTFOUND (1) - -/** IOCTL number */ -#define MLAN_ETH_PRIV (SIOCDEVPRIVATE + 14) - -/** Command buffer max length */ -#define BUFFER_LENGTH (4 * 1024) - -/** Find number of elements */ -#define NELEMENTS(x) (sizeof(x) / sizeof(x[0])) - -/** BIT value */ -#define MBIT(x) (((t_u32)1) << (x)) - -#ifndef MIN -/** Find minimum value */ -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - -/** Length of ethernet address */ -#ifndef ETH_ALEN -#define ETH_ALEN 6 -#endif - -/** 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 - -/** Maximum number of TID */ -#define MAX_NUM_TID 8 - -/** Device name */ -extern char dev_name[IFNAMSIZ + 1]; - -#define HOSTCMD "hostcmd" - -/** NXP private command identifier */ -#define CMD_NXP "MRVL_CMD" - -struct command_node { - char *name; - int (*handler)(int, char **); -}; - -/** Private command structure */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT -struct eth_priv_cmd { - /** Command buffer pointer */ - t_u64 buf; - /** buffer updated by driver */ - int used_len; - /** buffer sent by application */ - int total_len; -} __ATTRIB_PACK__; -#else -struct eth_priv_cmd { - /** Command buffer */ - t_u8 *buf; - /** Used length */ - int used_len; - /** Total length */ - int total_len; -}; -#endif - -/** data structure for cmd getdatarate */ -struct eth_priv_data_rate { - /** Tx data rate */ - t_u32 tx_data_rate; - /** Rx data rate */ - t_u32 rx_data_rate; - - /** Tx channel bandwidth */ - t_u32 tx_bw; - /** Tx guard interval */ - t_u32 tx_gi; - /** Rx channel bandwidth */ - t_u32 rx_bw; - /** Rx guard interval */ - t_u32 rx_gi; - /** MCS index */ - t_u32 tx_mcs_index; - t_u32 rx_mcs_index; - /** NSS */ - t_u32 tx_nss; - t_u32 rx_nss; - /* LG rate: 0, HT rate: 1, VHT rate: 2 */ - t_u32 tx_rate_format; - t_u32 rx_rate_format; -}; - -/** data structure for cmd getlog */ -struct eth_priv_get_log { - /** Multicast transmitted frame count */ - t_u32 mcast_tx_frame; - /** Failure count */ - t_u32 failed; - /** Retry count */ - t_u32 retry; - /** Multi entry count */ - t_u32 multi_retry; - /** Duplicate frame count */ - t_u32 frame_dup; - /** RTS success count */ - t_u32 rts_success; - /** RTS failure count */ - t_u32 rts_failure; - /** Ack failure count */ - t_u32 ack_failure; - /** Rx fragmentation count */ - t_u32 rx_frag; - /** Multicast Tx frame count */ - t_u32 mcast_rx_frame; - /** FCS error count */ - t_u32 fcs_error; - /** Tx frame count */ - t_u32 tx_frame; - /** WEP ICV error count */ - t_u32 wep_icv_error[4]; - /** beacon recv count */ - t_u32 bcn_rcv_cnt; - /** beacon miss count */ - t_u32 bcn_miss_cnt; - /** received amsdu count*/ - t_u32 amsdu_rx_cnt; - /** received msdu count in amsdu*/ - t_u32 msdu_in_rx_amsdu_cnt; - /** tx amsdu count*/ - t_u32 amsdu_tx_cnt; - /** tx msdu count in amsdu*/ - t_u32 msdu_in_tx_amsdu_cnt; - /** Tx frag count */ - t_u32 tx_frag_cnt; - /** Qos Tx frag count */ - t_u32 qos_tx_frag_cnt[8]; - /** Qos failed count */ - t_u32 qos_failed_cnt[8]; - /** Qos retry count */ - t_u32 qos_retry_cnt[8]; - /** Qos multi retry count */ - t_u32 qos_multi_retry_cnt[8]; - /** Qos frame dup count */ - t_u32 qos_frm_dup_cnt[8]; - /** Qos rts success count */ - t_u32 qos_rts_suc_cnt[8]; - /** Qos rts failure count */ - t_u32 qos_rts_failure_cnt[8]; - /** Qos ack failure count */ - t_u32 qos_ack_failure_cnt[8]; - /** Qos Rx frag count */ - t_u32 qos_rx_frag_cnt[8]; - /** Qos Tx frame count */ - t_u32 qos_tx_frm_cnt[8]; - /** Qos discarded frame count */ - t_u32 qos_discarded_frm_cnt[8]; - /** Qos mpdus Rx count */ - t_u32 qos_mpdus_rx_cnt[8]; - /** Qos retry rx count */ - t_u32 qos_retries_rx_cnt[8]; - /** CMACICV errors count */ - t_u32 cmacicv_errors; - /** CMAC replays count */ - t_u32 cmac_replays; - /** mgmt CCMP replays count */ - t_u32 mgmt_ccmp_replays; - /** TKIP ICV errors count */ - t_u32 tkipicv_errors; - /** TKIP replays count */ - t_u32 tkip_replays; - /** CCMP decrypt errors count */ - t_u32 ccmp_decrypt_errors; - /** CCMP replays count */ - t_u32 ccmp_replays; - /** Tx amsdu count */ - t_u32 tx_amsdu_cnt; - /** failed amsdu count */ - t_u32 failed_amsdu_cnt; - /** retry amsdu count */ - t_u32 retry_amsdu_cnt; - /** multi-retry amsdu count */ - t_u32 multi_retry_amsdu_cnt; - /** Tx octets in amsdu count */ - t_u64 tx_octets_in_amsdu_cnt; - /** amsdu ack failure count */ - t_u32 amsdu_ack_failure_cnt; - /** Rx amsdu count */ - t_u32 rx_amsdu_cnt; - /** Rx octets in amsdu count */ - t_u64 rx_octets_in_amsdu_cnt; - /** Tx ampdu count */ - t_u32 tx_ampdu_cnt; - /** tx mpdus in ampdu count */ - t_u32 tx_mpdus_in_ampdu_cnt; - /** tx octets in ampdu count */ - t_u64 tx_octets_in_ampdu_cnt; - /** ampdu Rx count */ - t_u32 ampdu_rx_cnt; - /** mpdu in Rx ampdu count */ - t_u32 mpdu_in_rx_ampdu_cnt; - /** Rx octets ampdu count */ - 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 */ - t_u32 rx_stuck_issue_cnt[2]; - /** Rx Stuck Recovery count */ - t_u32 rx_stuck_recovery_cnt; - /** Rx Stuck TSF */ - t_u64 rx_stuck_tsf[2]; - /** Tx Watchdog Recovery Related Info */ - /** Tx Watchdog Recovery count */ - t_u32 tx_watchdog_recovery_cnt; - /** Tx Watchdog TSF */ - t_u64 tx_watchdog_tsf[2]; - /** Channel Switch Related Info */ - /** Channel Switch Announcement Sent */ - t_u32 channel_switch_ann_sent; - /** Channel Switch State */ - t_u32 channel_switch_state; - /** Register Class */ - t_u32 reg_class; - /** Channel Number */ - t_u32 channel_number; - /** Channel Switch Mode */ - t_u32 channel_switch_mode; - /** Reset Rx Mac Recovery Count */ - t_u32 rx_reset_mac_recovery_cnt; - /** ISR2 Not Done Count*/ - t_u32 rx_Isr2_NotDone_Cnt; - /** GDMA Abort Count */ - t_u32 gdma_abort_cnt; - /** Rx Reset MAC Count */ - t_u32 g_reset_rx_mac_cnt; - // Ownership error counters - /*Error Ownership error count*/ - t_u32 dwCtlErrCnt; - /*Control Ownership error count*/ - t_u32 dwBcnErrCnt; - /*Control Ownership error count*/ - t_u32 dwMgtErrCnt; - /*Control Ownership error count*/ - t_u32 dwDatErrCnt; - /*BIGTK MME good count*/ - t_u32 bigtk_mmeGoodCnt; - /*BIGTK Replay error count*/ - t_u32 bigtk_replayErrCnt; - /*BIGTK MIC error count*/ - t_u32 bigtk_micErrCnt; - /*BIGTK MME not included count*/ - t_u32 bigtk_mmeNotFoundCnt; -}; - -/** MLAN MAC Address Length */ -#define MLAN_MAC_ADDR_LENGTH 6 -#define COUNTRY_CODE_LEN 3 -/** Type definition of eth_priv_countrycode for CMD_COUNTRYCODE */ -struct eth_priv_countrycode { - /** Country Code */ - t_u8 country_code[COUNTRY_CODE_LEN]; -}; - -/** Type enumeration of WMM AC_QUEUES */ -typedef enum _mlan_wmm_ac_e { - WMM_AC_BK, - WMM_AC_BE, - WMM_AC_VI, - WMM_AC_VO -} __ATTRIB_PACK__ mlan_wmm_ac_e; - -/** IEEE Type definitions */ -typedef enum _IEEEtypes_ElementId_e { - SSID = 0, - SUPPORTED_RATES = 1, - FH_PARAM_SET = 2, - DS_PARAM_SET = 3, - CF_PARAM_SET = 4, - - IBSS_PARAM_SET = 6, - - COUNTRY_INFO = 7, - - POWER_CONSTRAINT = 32, - POWER_CAPABILITY = 33, - TPC_REQUEST = 34, - TPC_REPORT = 35, - SUPPORTED_CHANNELS = 36, - CHANNEL_SWITCH_ANN = 37, - QUIET = 40, - IBSS_DFS = 41, - HT_CAPABILITY = 45, - HT_OPERATION = 61, - BSSCO_2040 = 72, - OVERLAPBSSSCANPARAM = 74, - EXT_CAPABILITY = 127, - - VHT_CAPABILITY = 191, - VHT_OPERATION = 192, - EXT_BSS_LOAD = 193, - BW_CHANNEL_SWITCH = 194, - VHT_TX_POWER_ENV = 195, - EXT_POWER_CONSTR = 196, - AID_INFO = 197, - QUIET_CHAN = 198, - OPER_MODE_NTF = 199, - - ERP_INFO = 42, - EXTENDED_SUPPORTED_RATES = 50, - - VENDOR_SPECIFIC_221 = 221, - WMM_IE = VENDOR_SPECIFIC_221, - - WPS_IE = VENDOR_SPECIFIC_221, - - WPA_IE = VENDOR_SPECIFIC_221, - RSN_IE = 48, - EXTENSION = 255, -} __ATTRIB_PACK__ IEEEtypes_ElementId_e; - -typedef enum _IEEEtypes_Ext_ElementId_e { - HE_CAPABILITY = 35, - HE_OPERATION = 36, - HE_6G_CAPABILITY = 59 -} IEEEtypes_Ext_ElementId_e; - -/** Capability Bit Map*/ -typedef struct _IEEEtypes_CapInfo_t { - /** Capability Bit Map : ESS */ - t_u8 ess : 1; - /** Capability Bit Map : IBSS */ - t_u8 ibss : 1; - /** Capability Bit Map : CF pollable */ - t_u8 cf_pollable : 1; - /** Capability Bit Map : CF poll request */ - t_u8 cf_poll_rqst : 1; - /** Capability Bit Map : privacy */ - t_u8 privacy : 1; - /** Capability Bit Map : Short preamble */ - t_u8 short_preamble : 1; - /** Capability Bit Map : PBCC */ - t_u8 pbcc : 1; - /** Capability Bit Map : Channel agility */ - t_u8 chan_agility : 1; - /** Capability Bit Map : Spectrum management */ - t_u8 spectrum_mgmt : 1; - /** Capability Bit Map : Reserved */ - t_u8 rsrvd3 : 1; - /** Capability Bit Map : Short slot time */ - t_u8 short_slot_time : 1; - /** Capability Bit Map : APSD */ - t_u8 apsd : 1; - /** Capability Bit Map : Reserved */ - t_u8 rsvrd2 : 1; - /** Capability Bit Map : DSS OFDM */ - t_u8 dsss_ofdm : 1; - /** Capability Bit Map : Reserved */ - t_u8 rsrvd1 : 2; -} __ATTRIB_PACK__ IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; - -/** IEEE IE header */ -typedef struct _IEEEtypes_Header_t { - /** Element ID */ - t_u8 element_id; - /** Length */ - t_u8 len; -} __ATTRIB_PACK__ IEEEtypes_Header_t, *pIEEEtypes_Header_t; - -/** IEEE IE header */ -#define IEEE_HEADER_LEN sizeof(IEEEtypes_Header_t) - -/** Maximum size of IEEE Information Elements */ -#define IEEE_MAX_IE_SIZE 256 - -/** Vendor specific IE header */ -typedef struct _IEEEtypes_VendorHeader_t { - /** Element ID */ - t_u8 element_id; - /** Length */ - t_u8 len; - /** OUI */ - t_u8 oui[3]; - /** OUI type */ - t_u8 oui_type; - /** OUI subtype */ - t_u8 oui_subtype; - /** Version */ - t_u8 version; -} __ATTRIB_PACK__ IEEEtypes_VendorHeader_t, *pIEEEtypes_VendorHeader_t; - -/** Vendor specific IE */ -typedef struct _IEEEtypes_VendorSpecific_t { - /** Vendor specific IE header */ - IEEEtypes_VendorHeader_t vend_hdr; - /** IE Max - size of previous fields */ - t_u8 data[IEEE_MAX_IE_SIZE - sizeof(IEEEtypes_VendorHeader_t)]; -} __ATTRIB_PACK__ IEEEtypes_VendorSpecific_t, *pIEEEtypes_VendorSpecific_t; - -/** IEEE IE */ -typedef struct _IEEEtypes_Generic_t { - /** Generic IE header */ - IEEEtypes_Header_t ieee_hdr; - /** IE Max - size of previous fields */ - t_u8 data[IEEE_MAX_IE_SIZE - sizeof(IEEEtypes_Header_t)]; -} __ATTRIB_PACK__ IEEEtypes_Generic_t, *pIEEEtypes_Generic_t; - -/** Convert character to integer */ -#define CHAR2INT(x) (((x) >= 'A') ? ((x) - 'A' + 10) : ((x) - '0')) - -/** Command RET code, MSB is set to 1 */ -#define HostCmd_RET_BIT 0x8000 -/** General purpose action : Get */ -#define HostCmd_ACT_GEN_GET 0x0000 -/** General purpose action : Set */ -#define HostCmd_ACT_GEN_SET 0x0001 -/** General purpose action : Clear */ -#define HostCmd_ACT_GEN_CLEAR 0x0004 -/** General purpose action : Remove */ -#define HostCmd_ACT_GEN_REMOVE 0x0004 - -/** TLV type ID definition */ -#define PROPRIETARY_TLV_BASE_ID 0x0100 - -/** MrvlIEtypesHeader_t */ -typedef struct MrvlIEtypesHeader { - /** Header type */ - t_u16 type; - /** Header length */ - t_u16 len; -} __ATTRIB_PACK__ MrvlIEtypesHeader_t; - -/** MrvlIEtypes_Data_t */ -typedef struct MrvlIEtypes_Data_t { - /** Header */ - MrvlIEtypesHeader_t header; - /** Data */ - t_u8 data[1]; -} __ATTRIB_PACK__ MrvlIEtypes_Data_t; - -/** channel band */ -enum { BAND_2GHZ = 0, - BAND_5GHZ = 1, - BAND_6GHZ = 2, - BAND_4GHZ = 3, -}; - -/** channel offset */ -enum { SEC_CHAN_NONE = 0, - SEC_CHAN_ABOVE = 1, - SEC_CHAN_5MHZ = 2, - SEC_CHAN_BELOW = 3 }; - -/** channel bandwidth */ -enum { CHAN_BW_20MHZ = 0, - CHAN_BW_10MHZ, - CHAN_BW_40MHZ, - CHAN_BW_80MHZ, -}; - -/** Band_Config_t */ -typedef struct _Band_Config_t { - /** Band Info - (00)=2.4GHz, (01)=5GHz */ - t_u8 chanBand : 2; - /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth : 2; - /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ - t_u8 chan2Offset : 2; - /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=Adoption mode*/ - t_u8 scanMode : 2; -} __ATTRIB_PACK__ Band_Config_t; - -/** Maximum length of lines in configuration file */ -#define MAX_CONFIG_LINE 1024 -/** MAC BROADCAST */ -#define MAC_BROADCAST 0x1FF -/** MAC MULTICAST */ -#define MAC_MULTICAST 0x1FE - -/** HostCmd_DS_GEN */ -typedef struct MAPP_HostCmd_DS_GEN { - /** Command */ - t_u16 command; - /** Size */ - t_u16 size; - /** Sequence number */ - t_u16 seq_num; - /** Result */ - t_u16 result; -} __ATTRIB_PACK__ HostCmd_DS_GEN; - -/** Size of HostCmd_DS_GEN */ -#define S_DS_GEN sizeof(HostCmd_DS_GEN) - -/** max mod group */ -#define MAX_MOD_GROUP 35 - -/** modulation setting */ -typedef struct _mod_group_setting { - /** modulation group */ - t_u8 mod_group; - /** power */ - t_u8 power; -} __ATTRIB_PACK__ mod_group_setting; - -/** chan trpc config */ -typedef struct _ChanTRPCConfig_t { - /** start freq */ - t_u16 start_freq; - /* channel width */ - t_u8 width; - /** channel number */ - t_u8 chan_num; - mod_group_setting mod_group[MAX_MOD_GROUP]; -} __ATTRIB_PACK__ ChanTRPCConfig_t; - -/** MrvlIETypes_ChanTRPCConfig_t */ -typedef struct _MrvlIETypes_ChanTRPCConfig_t { - /** Header */ - MrvlIEtypesHeader_t header; - /** start freq */ - t_u16 start_freq; - /* channel width */ - t_u8 width; - /** channel number */ - t_u8 chan_num; - /** mode groups */ - mod_group_setting mod_group[]; -} __ATTRIB_PACK__ MrvlIETypes_ChanTRPCConfig_t; - -/*This command gets/sets the Transmit Rate-based Power Control (TRPC) channel - * configuration.*/ -#define HostCmd_CHANNEL_TRPC_CONFIG 0x00fb - -/** TLV OF CHAN_TRPC_CONFIG */ -#define TLV_TYPE_CHAN_TRPC_CONFIG (PROPRIETARY_TLV_BASE_ID + 137) - -/** mlan_ds_misc_chan_trpc_cfg */ -typedef struct _mlan_ds_misc_chan_trpc_cfg { - /** sub_band */ - t_u16 sub_band; - /** length */ - t_u16 length; - /** trpc buf */ - t_u8 trpc_buf[BUFFER_LENGTH]; -} __ATTRIB_PACK__ mlan_ds_misc_chan_trpc_cfg; - -struct eth_priv_addba { - t_u32 time_out; - t_u32 tx_win_size; - t_u32 rx_win_size; - t_u32 tx_amsdu; - t_u32 rx_amsdu; -}; - -struct eth_priv_htcapinfo { - t_u32 ht_cap_info_bg; - t_u32 ht_cap_info_a; -}; - -/** data_structure for cmd vhtcfg */ -struct eth_priv_vhtcfg { - /** Band (1: 2.4G, 2: 5 G, 3: both 2.4G and 5G) */ - t_u32 band; - /** TxRx (1: Tx, 2: Rx, 3: both Tx and Rx) */ - t_u32 txrx; - /** BW CFG (0: 11N CFG, 1: vhtcap) */ - t_u32 bwcfg; - /** VHT capabilities. */ - t_u32 vht_cap_info; - /** VHT Tx mcs */ - t_u32 vht_tx_mcs; - /** VHT Rx mcs */ - t_u32 vht_rx_mcs; - /** VHT rx max rate */ - t_u16 vht_rx_max_rate; - /** VHT max tx rate */ - t_u16 vht_tx_max_rate; -}; - -/** data structure for cmd txratecfg */ -struct eth_priv_tx_rate_cfg { - /* LG rate: 0, HT rate: 1, VHT rate: 2 */ - t_u32 rate_format; - /** Rate/MCS index (0xFF: auto) */ - t_u32 rate_index; - /** Rate rate */ - t_u32 rate; - /** NSS */ - t_u32 nss; - /** Rate Setting */ - t_u16 rate_setting; -}; - -#define MLAN_11AXCMD_CFG_ID_TX_OMI 6 -#define MLAN_11AXCMD_CFG_ID_OBSSNBRU_TOLTIME 7 - -#define MLAN_11AXCMD_TXOMI_SUBID 0x105 -#define MLAN_11AXCMD_OBSS_TOLTIME_SUBID 0x106 - -/** Type definition of mlan_ds_11ax_he_capa for MLAN_OID_11AX_HE_CFG */ -typedef struct _mlan_ds_11ax_he_capa { - /** tlv id of he capability */ - t_u16 id; - /** length of the payload */ - t_u16 len; - /** extension id */ - t_u8 ext_id; - /** he mac capability info */ - t_u8 he_mac_cap[6]; - /** he phy capability info */ - t_u8 he_phy_cap[11]; - /** he txrx mcs support for 80MHz */ - t_u8 he_txrx_mcs_support[4]; - /** val for txrx mcs 160Mhz or 80+80, and PPE thresholds */ - t_u8 val[28]; -} __ATTRIB_PACK__ mlan_ds_11ax_he_capa, *pmlan_ds_11ax_he_capa; - -/** 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*/ - t_u8 band; - /** mlan_ds_11ax_he_capa */ - mlan_ds_11ax_he_capa he_cap; -} __ATTRIB_PACK__ mlan_ds_11ax_he_cfg, *pmlan_ds_11ax_he_cfg; - -/** Type definition of mlan_11axcmdcfg_obss_pd_offset for MLAN_OID_11AX_CMD_CFG - */ -typedef struct _mlan_11axcmdcfg_obss_pd_offset { - /** */ - t_u8 offset[2]; -} __ATTRIB_PACK__ mlan_11axcmdcfg_obss_pd_offset; - -/** Type definition of mlan_11axcmdcfg_sr_control for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_11axcmdcfg_sr_control { - /** 1 enable, 0 disable */ - t_u8 control; -} __ATTRIB_PACK__ mlan_11axcmdcfg_sr_control; - -/** Type definition of mlan_ds_11ax_sr_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_sr_cmd { - /** type*/ - t_u16 type; - /** length of TLV */ - t_u16 len; - /** value */ - union { - mlan_11axcmdcfg_obss_pd_offset obss_pd_offset; - mlan_11axcmdcfg_sr_control sr_control; - } param; -} __ATTRIB_PACK__ mlan_ds_11ax_sr_cmd, *pmlan_ds_11ax_sr_cmd; - -/** Type definition of mlan_ds_11ax_beam_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_beam_cmd { - /** command value: 1 is disable, 0 is enable*/ - t_u8 value; -} mlan_ds_11ax_beam_cmd, *pmlan_ds_11ax_beam_cmd; - -/** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_htc_cmd { - /** command value: 1 is enable, 0 is disable*/ - t_u8 value; -} mlan_ds_11ax_htc_cmd, *pmlan_ds_11ax_htc_cmd; - -/** Type definition of mlan_ds_11ax_txop_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_txop_cmd { - /** Two byte rts threshold value of which only 10 bits, bit 0 to bit 9 - * are valid */ - t_u16 rts_thres; -} mlan_ds_11ax_txop_cmd, *pmlan_ds_11ax_txop_cmd; - -/** Type definition of mlan_ds_11ax_txomi_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _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; - -/** Type definition of mlan_ds_11ax_toltime_cmd for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_toltime_cmd { - /* OBSS Narrow Bandwidth RU Tolerance Time */ - t_u32 tol_time; -} mlan_ds_11ax_toltime_cmd, *pmlan_ds_11ax_toltime_cmd; - -/** Type definition of mlan_ds_11ax_cmd_cfg for MLAN_OID_11AX_CMD_CFG */ -typedef struct _mlan_ds_11ax_cmd_cfg { - /** Sub-command */ - t_u32 sub_command; - /** Sub-id */ - t_u32 sub_id; - /** 802.11n configuration parameter */ - union { - /** SR configuration for MLAN_11AXCMD_SR_SUBID */ - mlan_ds_11ax_sr_cmd sr_cfg; - /** Beam configuration for MLAN_11AXCMD_BEAM_SUBID */ - mlan_ds_11ax_beam_cmd beam_cfg; - /** HTC configuration for MLAN_11AXCMD_HTC_SUBID */ - mlan_ds_11ax_htc_cmd htc_cfg; - /** HTC configuration for MLAN_11AXCMD_TXOPRTS_SUBID */ - mlan_ds_11ax_txop_cmd txop_cfg; - /** HTC configuration for MLAN_11AXCMD_TXOMI_SUBID */ - mlan_ds_11ax_txomi_cmd txomi_cfg; - /** HTC configuration for MLAN_11AXCMD_TXOMI_SUBID */ - mlan_ds_11ax_toltime_cmd toltime_cfg; - } param; -} mlan_ds_11ax_cmd_cfg, *pmlan_ds_11ax_cmd_cfg; - -/** Maximum number of AC QOS queues available in the driver/firmware */ -#define MAX_AC_QUEUES 4 - -/** Read/Write Mac register */ -#define HostCmd_CMD_MAC_REG_ACCESS 0x0019 -/** Read/Write BBP register */ -#define HostCmd_CMD_BBP_REG_ACCESS 0x001a -/** Read/Write RF register */ -#define HostCmd_CMD_RF_REG_ACCESS 0x001b - -/** Data structure of WMM Aci/Aifsn */ -typedef struct _IEEEtypes_WmmAciAifsn_t { - /** Aifsn */ - t_u8 aifsn : 4; - /** Acm */ - t_u8 acm : 1; - /** Aci */ - t_u8 aci : 2; - /** Reserved */ - t_u8 reserved : 1; -} __ATTRIB_PACK__ IEEEtypes_WmmAciAifsn_t, *pIEEEtypes_WmmAciAifsn_t; - -/** Data structure of WMM ECW */ -typedef struct _IEEEtypes_WmmEcw_t { - /** Minimum Ecw */ - t_u8 ecw_min : 4; - /** Maximum Ecw */ - t_u8 ecw_max : 4; -} __ATTRIB_PACK__ IEEEtypes_WmmEcw_t, *pIEEEtypes_WmmEcw_t; - -/** Data structure of WMM AC parameters */ -typedef struct _IEEEtypes_WmmAcParameters_t { - IEEEtypes_WmmAciAifsn_t aci_aifsn; /**< AciAifSn */ - IEEEtypes_WmmEcw_t ecw; /**< Ecw */ - t_u16 tx_op_limit; /**< Tx op limit */ -} __ATTRIB_PACK__ IEEEtypes_WmmAcParameters_t, *pIEEEtypes_WmmAcParameters_t; - -/** HostCmd_DS_802_11_CFG_DATA */ -typedef struct MAPP_HostCmd_DS_802_11_CFG_DATA { - /** Action */ - t_u16 action; - /** Type */ - t_u16 type; - /** Data length */ - t_u16 data_len; - /** Data */ - t_u8 data[1]; -} __ATTRIB_PACK__ HostCmd_DS_802_11_CFG_DATA; - -/** Host Command ID : Configuration data */ -#define HostCmd_CMD_CFG_DATA 0x008f - -/** mlan_ioctl_11h_tpc_resp */ -typedef struct { - int status_code; /**< Firmware command result status code */ - int tx_power; /**< Reported TX Power from the TPC Report */ - int link_margin; /**< Reported Link margin from the TPC Report */ - int rssi; /**< RSSI of the received TPC Report frame */ -} __ATTRIB_PACK__ mlan_ioctl_11h_tpc_resp; - -/** Host Command ID : 802.11 TPC adapt req */ -#define HostCmd_CMD_802_11_TPC_ADAPT_REQ 0x0060 - -/** HostCmd_DS_802_11_CRYPTO */ -typedef struct MAPP_HostCmd_DS_802_11_CRYPTO { - t_u16 encdec; /**< Decrypt=0, Encrypt=1 */ - t_u16 algorithm; /**< RC4=1 AES=2 , AES_KEY_WRAP=3 */ - t_u16 key_IV_length; /**< Length of Key IV (bytes) */ - t_u8 keyIV[32]; /**< Key IV */ - t_u16 key_length; /**< Length of Key (bytes) */ - t_u8 key[32]; /**< Key */ - MrvlIEtypes_Data_t data; /**< Plain text if encdec=Encrypt, Ciphertext - data if encdec=Decrypt*/ -} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO; - -/** HostCmd_DS_802_11_CRYPTO_AES_CCM */ -typedef struct MAPP_HostCmd_DS_802_11_CRYPTO_AES_CCM { - t_u16 encdec; /**< Decrypt=0, Encrypt=1 */ - t_u16 algorithm; /**< AES_CCM=4 */ - t_u16 key_length; /**< Length of Key (bytes) */ - t_u8 key[32]; /**< Key */ - t_u16 nonce_length; /**< Length of Nonce (bytes) */ - t_u8 nonce[14]; /**< Nonce */ - t_u16 AAD_length; /**< Length of AAD (bytes) */ - t_u8 AAD[32]; /**< AAD */ - MrvlIEtypes_Data_t data; /**< Plain text if encdec=Encrypt, Ciphertext - data if encdec=Decrypt*/ -} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO_AES_CCM; - -/** HostCmd_DS_802_11_CRYPTO_WAPI */ -typedef struct MAPP_HostCmd_DS_802_11_CRYPTO_WAPI { - t_u16 encdec; /**< Decrypt=0, Encrypt=1 */ - t_u16 algorithm; /**< WAPI =5 */ - t_u16 key_length; /**< Length of Key (bytes) */ - t_u8 key[32]; /**< Key */ - t_u16 nonce_length; /**< Length of Nonce (bytes) */ - t_u8 nonce[16]; /**< Nonce */ - t_u16 AAD_length; /**< Length of AAD (bytes) */ - t_u8 AAD[48]; /**< AAD */ - t_u16 data_length; /**< Length of data (bytes) */ -} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO_WAPI; -/** WAPI cipher test */ -#define CIPHER_TEST_WAPI (5) -/** AES CCM cipher test */ -#define CIPHER_TEST_AES_CCM (4) -/** GCMP cipher test */ -#define CIPHER_TEST_GCMP (6) -/** Host Command ID : 802.11 crypto */ -#define HostCmd_CMD_802_11_CRYPTO 0x0078 - -/** HostCmd_DS_802_11_SUBSCRIBE_EVENT */ -typedef struct MAPP_HostCmd_DS_802_11_SUBSCRIBE_EVENT { - /** Action */ - t_u16 action; - /** Events */ - t_u16 events; -} __ATTRIB_PACK__ HostCmd_DS_802_11_SUBSCRIBE_EVENT; - -/** MrvlIEtypes_RssiParamSet_t */ -typedef struct MrvlIEtypes_RssiThreshold { - /** Header */ - MrvlIEtypesHeader_t header; - /** RSSI value */ - t_u8 RSSI_value; - /** RSSI frequency */ - t_u8 RSSI_freq; -} __ATTRIB_PACK__ MrvlIEtypes_RssiThreshold_t; - -/** MrvlIEtypes_SnrThreshold_t */ -typedef struct MrvlIEtypes_SnrThreshold { - /** Header */ - MrvlIEtypesHeader_t header; - /** SNR value */ - t_u8 SNR_value; - /** SNR frequency */ - t_u8 SNR_freq; -} __ATTRIB_PACK__ MrvlIEtypes_SnrThreshold_t; - -/** MrvlIEtypes_FailureCount_t */ -typedef struct MrvlIEtypes_FailureCount { - /** Header */ - MrvlIEtypesHeader_t header; - /** Failure value */ - t_u8 fail_value; - /** Failure frequency */ - t_u8 fail_freq; -} __ATTRIB_PACK__ MrvlIEtypes_FailureCount_t; - -/** MrvlIEtypes_BeaconsMissed_t */ -typedef struct MrvlIEtypes_BeaconsMissed { - /** Header */ - MrvlIEtypesHeader_t header; - /** Number of beacons missed */ - t_u8 beacon_missed; - /** Reserved */ - t_u8 reserved; -} __ATTRIB_PACK__ MrvlIEtypes_BeaconsMissed_t; - -/** MrvlIEtypes_LinkQuality_t */ -typedef struct MrvlIEtypes_LinkQuality { - /** Header */ - MrvlIEtypesHeader_t header; - /** Link SNR threshold */ - t_u16 link_SNR_thrs; - /** Link SNR frequency */ - t_u16 link_SNR_freq; - /** Minimum rate value */ - t_u16 min_rate_val; - /** Minimum rate frequency */ - t_u16 min_rate_freq; - /** Tx latency value */ - t_u32 tx_latency_val; - /** Tx latency threshold */ - t_u32 tx_latency_thrs; -} __ATTRIB_PACK__ MrvlIEtypes_LinkQuality_t; - -/** Host Command ID : 802.11 subscribe event */ -#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075 - -/** TLV type : Beacon RSSI low */ -#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 */ -/** TLV type : Fail count */ -#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 0x06) /* 0x0106 */ -/** TLV type : BCN miss */ -#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x07) /* 0x0107 */ -/** TLV type : Beacon RSSI high */ -#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 */ - -/** TLV type :Link Quality */ -#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 */ -/** TLV type : Data SNR low */ -#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 */ -/** TLV type : Data SNR high */ -#define TLV_TYPE_SNR_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x29) /* 0x0129 */ - -/** MrvlIEtypes_PreBeaconLost_t */ -typedef struct MrvlIEtypes_PreBeaconLost { - /** Header */ - MrvlIEtypesHeader_t header; - /** Pre-Beacon Lost */ - t_u8 pre_beacon_lost; - /** Reserved */ - t_u8 reserved; -} __ATTRIB_PACK__ MrvlIEtypes_PreBeaconLost_t; - -/** TLV type: Pre-Beacon Lost */ -#define TLV_TYPE_PRE_BEACON_LOST (PROPRIETARY_TLV_BASE_ID + 0x49) /* 0x0149 */ - -/** AutoTx_MacFrame_t */ -typedef struct AutoTx_MacFrame { - t_u16 interval; /**< in seconds */ - t_u8 priority; /**< User Priority: 0~7, ignored if non-WMM */ - t_u8 reserved; /**< set to 0 */ - t_u16 frame_len; /**< Length of MAC frame payload */ - t_u8 dest_mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Destination MAC address - */ - t_u8 src_mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Source MAC address */ - t_u8 payload[]; /**< Payload */ -} __ATTRIB_PACK__ AutoTx_MacFrame_t; - -/** MrvlIEtypes_AutoTx_t */ -typedef struct MrvlIEtypes_AutoTx { - MrvlIEtypesHeader_t header; /**< Header */ - AutoTx_MacFrame_t auto_tx_mac_frame; /**< Auto Tx MAC frame */ -} __ATTRIB_PACK__ MrvlIEtypes_AutoTx_t; - -/** HostCmd_DS_802_11_AUTO_TX */ -typedef struct MAPP_HostCmd_DS_802_11_AUTO_TX { - /** Action */ - t_u16 action; /* 0 = ACT_GET; 1 = ACT_SET; */ - MrvlIEtypes_AutoTx_t auto_tx; /**< Auto Tx */ -} __ATTRIB_PACK__ HostCmd_DS_802_11_AUTO_TX; - -/** Host Command ID : 802.11 auto Tx */ -#define HostCmd_CMD_802_11_AUTO_TX 0x0082 - -/** TLV type : Auto Tx */ -#define TLV_TYPE_AUTO_TX (PROPRIETARY_TLV_BASE_ID + 0x18) /* 0x0118 */ - -/** Host Command ID : CAU register access */ -#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed - -/** Host Command ID : Memory access */ -#define HostCmd_CMD_MEM_ACCESS 0x0086 - -typedef struct { - t_u32 timeSinceLastQuery_ms; /**< Duration of stats collection */ - - t_u16 bcnCnt; /**< Number of beacons received */ - t_u16 bcnMiss; /**< Estimate of beacons missed */ - t_s16 bcnRssiAvg; /**< Avg beacon RSSI */ - t_s16 bcnSnrAvg; /**< Avg beacon SNR */ - - t_u32 rxPkts; /**< Number of packets received */ - t_s16 rxRssiAvg; /**< Avg received packet RSSI */ - t_s16 rxSnrAvg; /**< Avg received packet SNR */ - - t_u32 txPkts; /**< Number of packets transmitted */ - t_u32 txAttempts; /**< Number of attempts made */ - t_u32 txFailures; /**< Number of pkts that failed */ - t_u8 txInitRate; /**< Current rate adaptation TX rateid */ - t_u8 reserved[3]; /**< Reserved */ - - t_u16 txQueuePktCnt[MAX_AC_QUEUES]; /**< Number of packets per AC */ - t_u32 txQueueDelay[MAX_AC_QUEUES]; /**< Averge queue delay per AC*/ -} __ATTRIB_PACK__ HostCmd_DS_LINK_STATS_SUMMARY; - -#define HostCmd_CMD_LINK_STATS_SUMMARY 0x00d3 - -/** Type enumeration of WMM AC_QUEUES */ -typedef enum _wmm_ac { - AC_BE, - AC_BK, - AC_VI, - AC_VO, -} wmm_ac; - -/** Data structure of Host command WMM_PARAM_CFG */ -typedef struct _HostCmd_DS_WMM_PARAM_CONFIG { - /** action */ - t_u16 action; - /** AC Parameters Record WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, WMM_AC_VO */ - IEEEtypes_WmmAcParameters_t ac_params[MAX_AC_QUEUES]; -} __ATTRIB_PACK__ HostCmd_DS_WMM_PARAM_CONFIG; - -/** Host Command ID : Configure ADHOC_OVER_IP parameters */ -#define HostCmd_CMD_WMM_PARAM_CONFIG 0x023a - -/** HostCmd_DS_REG */ -typedef struct MAPP_HostCmd_DS_REG { - /** Read or write */ - t_u16 action; - /** Register offset */ - t_u16 offset; - /** Value */ - t_u32 value; -} __ATTRIB_PACK__ HostCmd_DS_REG; - -/** HostCmd_DS_MEM */ -typedef struct MAPP_HostCmd_DS_MEM { - /** Read or write */ - t_u16 action; - /** Reserved */ - t_u16 reserved; - /** Address */ - t_u32 addr; - /** Value */ - t_u32 value; -} __ATTRIB_PACK__ HostCmd_DS_MEM; - -typedef struct _HostCmd_DS_MEF_CFG { - /** Criteria */ - t_u32 Criteria; - /** Number of entries */ - t_u16 NumEntries; -} __ATTRIB_PACK__ HostCmd_DS_MEF_CFG; - -typedef struct _MEF_CFG_DATA { - /** Size */ - t_u16 size; - /** Data */ - HostCmd_DS_MEF_CFG data; -} __ATTRIB_PACK__ MEF_CFG_DATA; - -/** cloud keep alive parameters */ -typedef struct _cloud_keep_alive { - /** id */ - t_u8 mkeep_alive_id; - /** enable/disable of this id */ - t_u8 enable; - /** enable/disable reset*/ - t_u8 reset; - /** Reserved */ - t_u8 reserved; - /** Destination MAC address */ - t_u8 dst_mac[ETH_ALEN]; - /** Source MAC address */ - t_u8 src_mac[ETH_ALEN]; - /** packet send period */ - t_u32 sendInterval; - /** packet retry interval */ - t_u32 retryInterval; - /** packet retry count */ - t_u8 retryCount; - /** packet length */ - t_u8 pkt_len; - /** packet content */ - t_u8 pkt[255]; -} __ATTRIB_PACK__ cloud_keep_alive; - -#define EXT_LTE_RESP_GETSTAT 0xA5 -#define EXT_LTE_RESP_RSTSTAT 0x5A -/** Host Command ID: ROBUST_COEX */ -#define HostCmd_ROBUST_COEX 0x00e0 -typedef struct _host_RobustCoexLteStats_t { - unsigned int Count_LTE_TX_NOTIFY; - unsigned int Count_LTE_RX_PROTECT; - unsigned int Count_LTE_TX_SUSPEND; - unsigned int Count_LTE_RX_NOTIFY; - unsigned char ResponseType; -} __ATTRIB_PACK__ host_RobustCoexLteStats_t; - -#endif /* _MLANUTL_H_ */ diff --git a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.c b/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.c deleted file mode 100644 index 6ea6b63..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.c +++ /dev/null @@ -1,1790 +0,0 @@ -/** @file mlanwls.c - * - * @brief 11mc/11az Wifi location services application - * - * - * Copyright 2022 NXP - * - * This software file (the File) is distributed by NXP - * under the terms of the GNU General Public License Version 2, June 1991 - * (the License). You may use, redistribute and/or modify the File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - * - */ -/************************************************************************ -Change log: - 01/24/2022: initial version -************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mlanutl.h" -#include "mlanwls.h" - -/** WLS application's version number */ -#define WLS_VER "M1.0" - -/*Command arguments index*/ -#define NXP_ADDR "530 Holgerway SanJose" - -#define PROTO_DOT11AZ_NTB 1 -#define PROTO_DOT11AZ_TB 2 -#define PROTO_DOT11MC 0 - -#define FTM_SUBCMD_INDEX 3 -#define FTM_CFG_SET_CMD_LEN 6 -#define FTM_CFG_GET_CMD_LEN 4 -#define FTM_CFG_PROTOCOL_INDEX 4 -#define FTM_CFG_FILE_ARG_INDEX 5 - -#define FTM_SESSION_SUBCMD_LEN 8 -#define FTM_SESSION_SUBCMD_NONSTOP_LEN 7 -#define FTM_SESSION_ACTION_OFFSET 4 -#define FTM_SESSION_CHANNEL_OFFSET 5 -#define FTM_SESSION_PEER_ADDR_OFFSET 6 -#define FTM_SESSION_LOOP_OFFSET 7 - -#define FTM_ACTION_START 1 -#define FTM_ACTION_STOP 2 - -/******************************************************** - Functions Declarations -********************************************************/ - -t_u8 hexc2bin(char chr); -t_u32 a2hex(char *s); -t_u32 a2hex_or_atoi(char *value); -t_void hexdump(char *prompt, t_void *p, t_s32 len, char delim); -extern char *config_get_line(char *s, int size, FILE *stream, int *line, - char **_pos); -int parse_line(char *line, char *args[], t_u16 args_count); -int mac2raw(char *mac, t_u8 *raw); - -static t_void display_help(t_u32 n, char **data); -static int mlanwls_prepare_buffer(t_u8 *buffer, char *cmd, t_u32 num, - char *args[]); -static int mlanwls_send_ioctl(t_u8 *cmd_buf); -static void mlanwls_event_handler(int nl_sk); -static int mlanwls_init(void); -static int mlanwls_read_ftm_config(char *file_name); - -static int process_subcommand(int argc, char *argv[]); -static int process_ftm_session_cfg(int argc, char *argv[], void *param); -static int process_ftm_session_ctrl(int argc, char *argv[], void *param); - -static int process_dot11az_ranging_cfg(int argc, char *argv[], void *param); -static int process_dot11mc_ftm_cfg(int argc, char *argv[], void *param); -static int process_ftm_start(int argc, char *argv[], void *param); -static int process_ftm_stop(int argc, char *argv[], void *param); -static int process_ftm_hostcmd_resp(char *cmd_name, t_u8 *buf); -static int process_ftm_complete_event(t_u8 *buffer, t_u16 size, char *if_name); - -static int get_connstatus(int *data); -static void print_event_drv_connected(t_u8 *buffer, t_u16 size); -static int drv_nlevt_handler(struct nlmsghdr *nlh, int bytes_read, - int *evt_conn); -static int read_event(int nl_sk, struct msghdr *msg, struct timeval *ptv); -static int get_netlink_num(int dev_index); -static int open_netlink(int dev_index); -static t_void mlanwls_terminate_handler(int signal); - -/******************************************************** - Local Variables -********************************************************/ -/** WLS app usage */ -static char *mlanwls_help[] = { - "Usage: ", - " mlanutl mlan0 ftm []", - " where subcommand is,", - " session_cfg [ ]", - " session_ctrl [ ]", - " For help on each subcommand,", - " mlanutl mlan0 ftm -h" - ""}; - -static char *ftm_session_cfg_help[] = { - "Usage: ", - " mlanutl mlan0 ftm session_cfg [ ] ", - " where,", - " : 0:Dot11mc, 1:Dot11az_ntb, 2:Dot11az_tb", - " : Config file with Dot11mc / dot11az parameters", - "", - " eg: mlanutl mlan0 ftm session_cfg 0 config/ftm.conf - Sets dot11mc FTM session params from config file", - " mlanutl mlan0 ftm session_cfg 1 config/ftm.conf - Sets dot11az ntb session params from config file", - " mlanutl mlan0 ftm session_cfg 2 config/ftm.conf - Sets dot11az tb ranging session params from config file", - " "}; - -static char *ftm_session_ctrl_help[] = { - "Usage: ", - " mlanutl mlan0 ftm session_ctrl [ ] ", - " where,", - " : 1: Start, 2: Stop ", - " : number of ftm sessions to run repeatedly ( default:1, 0:non-stop, n>1: n times)", - " : Channel on which FTM must be started", - " : Mac address of the peer with whom FTM session is required", - " ", - " eg: mlanutl mlan0 ftm session_ctrl 1 6 00:50:43:20:bc:4 - Starts FTM session and runs it once", - " mlanutl mlan0 ftm session_ctrl 1 6 00:50:43:20:bc:4 2 - Starts FTM session and runs it for 2 cycles", - " mlanutl mlan0 ftm session_ctrl 1 6 00:50:43:20:bc:4 0 - Runs FTM session non stop until user terminate", - " mlanutl mlan0 ftm session_ctrl 2 - Stop the FTM session", - " "}; - -/** WLS app command ID */ -enum user_command_id { - FTM_SESSION_CFG_CMD_ID = 0, - FTM_SESSION_CTRL_CMD_ID, -}; - -/** WLS app command table */ -static wls_app_command_table wls_app_command[] = { - {FTM_SESSION_CFG_CMD_ID, "session_cfg", process_ftm_session_cfg, - ftm_session_cfg_help}, - {FTM_SESSION_CTRL_CMD_ID, "session_ctrl", process_ftm_session_ctrl, - ftm_session_ctrl_help}}; - -/** WLS app data*/ -wls_app_data_t gwls_data; - -/**DBG Printf*/ -#define DBG_LOG(x) \ - if (gwls_data.debug_level == 2) { \ - printf(x); \ - } -#define DBG_ERROR(x) \ - if (gwls_data.debug_level >= 0) { \ - printf(x); \ - } -#define PRINT_CFG(x, y) printf(x, y) - -/******************************************************** - Global Variables -********************************************************/ -/**< socket descriptor */ -t_s32 nl_sk = 0; /**< netlink socket descriptor to receive an event */ - -/** Flag: is associated */ -int assoc_flag = FALSE; - -/** terminate flag */ -int mlanwls_terminate_flag = FALSE; - -/******************************************************** - Local Functions -********************************************************/ -/** - * @brief Display help text - * - * @return NA - */ -static t_void display_help(t_u32 n, char **data) -{ - t_u32 i; - for (i = 0; i < n; i++) - fprintf(stderr, "%s\n", data[i]); -} - -/** - * @brief Prepare command buffer - * @param buffer Command buffer to be filled - * @param cmd Command id - * @param num Number of arguments - * @param args Arguments list - * @return MLAN_STATUS_SUCCESS - */ -static int mlanwls_prepare_buffer(t_u8 *buffer, char *cmd, t_u32 num, - char *args[]) -{ - t_u8 *pos = NULL; - unsigned int i = 0; - - memset(buffer, 0, MRVDRV_SIZE_OF_CMD_BUFFER); - - /* Flag it for our use */ - pos = buffer; - memcpy((char *)pos, CMD_NXP, strlen(CMD_NXP)); - pos += (strlen(CMD_NXP)); - - /* Insert command */ - strncpy((char *)pos, (char *)cmd, strlen(cmd)); - pos += (strlen(cmd)); - - /* Insert arguments */ - for (i = 0; i < num; i++) { - strncpy((char *)pos, args[i], strlen(args[i])); - pos += strlen(args[i]); - if (i < (num - 1)) { - memcpy((char *)pos, " ", strlen(" ")); - pos += 1; - } - } - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Process host_cmd response - * - * @param cmd_name The command string - * @param buf A pointer to the response buffer - * - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_ftm_hostcmd_resp(char *cmd_name, t_u8 *buf) -{ - t_u32 hostcmd_size = 0; - HostCmd_DS_GEN *hostcmd = NULL; - int ret = MLAN_STATUS_SUCCESS; - hostcmd_ds_ftm_session_cmd *phostcmd = NULL; - - buf += strlen(CMD_NXP) + strlen(cmd_name); - memcpy((t_u8 *)&hostcmd_size, buf, sizeof(t_u32)); - buf += sizeof(t_u32); - - hostcmd = (HostCmd_DS_GEN *)buf; - hostcmd->command = le16_to_cpu(hostcmd->command); - hostcmd->size = le16_to_cpu(hostcmd->size); - - hostcmd->command &= ~HostCmd_RET_BIT; - - switch (hostcmd->command) { - case HostCmd_CMD_FTM_SESSION_CTRL: - phostcmd = (hostcmd_ds_ftm_session_cmd *)buf; - if (!le16_to_cpu(phostcmd->cmd_hdr.result)) { - if (phostcmd->cmd.ftm_session_ctrl.action == 1) { - printf("[INFO] FTM Session Control Started on %d channel with Peer %02X:%02X:%02X:%02X:%02X:%02X \n", - phostcmd->cmd.ftm_session_ctrl.chan, - phostcmd->cmd.ftm_session_ctrl - .peer_mac[0], - phostcmd->cmd.ftm_session_ctrl - .peer_mac[1], - phostcmd->cmd.ftm_session_ctrl - .peer_mac[2], - phostcmd->cmd.ftm_session_ctrl - .peer_mac[3], - phostcmd->cmd.ftm_session_ctrl - .peer_mac[4], - phostcmd->cmd.ftm_session_ctrl - .peer_mac[5]); - } else if (phostcmd->cmd.ftm_session_ctrl.action == 2) { - printf("[INFO] FTM Session Stopped\n"); - } else { - printf("[ERROR] Hostcmd action not supported\n"); - } - } else { - printf("[ERROR] Hostcmd failed: ReturnCode=%#04x, Result=%#04x\n", - le16_to_cpu(phostcmd->cmd_hdr.command), - le16_to_cpu(phostcmd->cmd_hdr.result)); - ret = MLAN_STATUS_FAILURE; - goto done; - } - break; - - case HostCmd_CMD_FTM_SESSION_CFG: - phostcmd = (hostcmd_ds_ftm_session_cmd *)buf; - if ((le16_to_cpu(phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.type) == - FTM_NTB_RANGING_CFG_TLV_ID) || - (le16_to_cpu(phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.type) == - FTM_TB_RANGING_CFG_TLV_ID)) { - if (le16_to_cpu(phostcmd->cmd.ftm_session_cfg.action) == - MLAN_ACT_GET) { - /* Get */ - printf("\n\nGet Ranging Parameters: \n"); - } else { - /* Set */ - printf("\n\nSet Ranging Parameters: \n"); - } - printf("---------------------------------\n"); - printf("format_bw:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.format_bw); - printf("az_measurement_freq:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.az_measurement_freq); - printf("az_number_of_measurements:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.az_number_of_measurements); - printf("max_i2r_sts_upto80:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.max_i2r_sts_upto80); - printf("max_r2i_sts_upto80:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.max_r2i_sts_upto80); - printf("i2r_lmr_feedback:%d \n\n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az - .range_tlv.val.i2r_lmr_feedback); - } else if ((le16_to_cpu(phostcmd->cmd.ftm_session_cfg.tlv - .cfg_11mc.sess_tlv.type) == - FTM_SESSION_CFG_INITATOR_TLV_ID)) { - if (le16_to_cpu(phostcmd->cmd.ftm_session_cfg.action) == - MLAN_ACT_GET) { - /* Get */ - printf("\n\nGet dot11mc ftm session config: \n"); - } else { - /* Set */ - printf("\n\nSet dot11mc ftm session config: \n"); - } - printf("---------------------------------\n"); - printf("burst_exponent:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.burst_exponent); - printf("burst_duration:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.burst_duration); - printf("min_delta_FTM:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.min_delta_FTM); - printf("is_ASAP:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.is_ASAP); - printf("per_burst_FTM:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.per_burst_FTM); - printf("channel_spacing:%d \n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.channel_spacing); - printf("burst_period:%d \n\n", - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .sess_tlv.val.burst_period); - } else { - printf("[ERROR] Hostcmd failed: Invalid TLV ReturnCode=%#04x, Result=%#04x\n", - le16_to_cpu(phostcmd->cmd_hdr.command), - le16_to_cpu(phostcmd->cmd_hdr.result)); - ret = MLAN_STATUS_FAILURE; - goto done; - } - break; - - default: - ret = MLAN_STATUS_FAILURE; - printf("[ERROR] Invalid Hostcmd %x\n", - phostcmd->cmd_hdr.command); - break; - } - -done: - return ret; -} - -/** - * @brief Send hostcmd IOCTL to driver - * @param cmd_buf pointer to Host Command buffer - * - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int mlanwls_send_ioctl(t_u8 *cmd_buf) -{ - struct ifreq ifr; - struct eth_priv_cmd *cmd = NULL; - int ret = MLAN_STATUS_SUCCESS; - - /*hexdump((void *) cmd_buf, MRVDRV_SIZE_OF_CMD_BUFFER, ' ');*/ - - if (!cmd_buf) { - printf("ERR:IOCTL Failed due to null cmd buffer!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, cmd_buf, sizeof(cmd_buf)); -#else - cmd->buf = cmd_buf; -#endif - cmd->used_len = 0; - cmd->total_len = MRVDRV_SIZE_OF_CMD_BUFFER; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - perror("mlanwls"); - fprintf(stderr, "IOCTL fail\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Process result */ - ret = process_ftm_hostcmd_resp("hostcmd", cmd_buf); - -done: - if (cmd) - free(cmd); - return ret; -} - -/** - * @brief get connection status - * - * @param data Pointer to the output buffer holding connection status - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static int get_connstatus(int *data) -{ - struct ether_addr apaddr; - struct ether_addr etherzero = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(MRVDRV_SIZE_OF_CMD_BUFFER); - if (!buffer) { - DBG_ERROR("[ERROR] Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - /* buffer = CMD_NXP + */ - mlanwls_prepare_buffer(buffer, "getwap", 0, NULL); - - cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd)); - if (!cmd) { - DBG_ERROR("[ERROR] Cannot allocate buffer for command!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = MRVDRV_SIZE_OF_CMD_BUFFER; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - DBG_ERROR("[ERROR] mlanwls: getwap fail\n"); - if (cmd) - free(cmd); - if (buffer) - free(buffer); - return MLAN_STATUS_FAILURE; - } - - memset(&apaddr, 0, sizeof(struct ether_addr)); - memcpy(&apaddr, (struct ether_addr *)(buffer), - sizeof(struct ether_addr)); - memcpy(&gwls_data.ap_mac[0], (t_u8 *)(buffer), - sizeof(gwls_data.ap_mac)); - - if (!memcmp(&apaddr, ðerzero, sizeof(struct ether_addr))) { - /* not associated */ - *data = FALSE; - } else { - /* associated */ - *data = TRUE; - } - - if (buffer) - free(buffer); - if (cmd) - free(cmd); - - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Parse FTM complete event data - * - * @param buffer Pointer to received event buffer - * @param size Length of the received event data - * @return N/A - */ -static int process_ftm_complete_event(t_u8 *buffer, t_u16 size, char *if_name) -{ - wls_event_t *ftm_event = NULL; - int ret = MLAN_STATUS_SUCCESS; - float distance = 0.0; - - if (!buffer) { - DBG_ERROR("[ERROR] Event buffer null\n"); - return MLAN_STATUS_FAILURE; - } - ftm_event = (wls_event_t *)buffer; - - printf("[INFO] Event received for interface %s\n", if_name); - printf("[INFO] EventID: 0x%x SubeventID:%d\n", ftm_event->event_id, - ftm_event->sub_event_id); - hexdump("EventData:", (void *)buffer, size, ' '); - - switch (ftm_event->sub_event_id) { - case WLS_SUB_EVENT_FTM_COMPLETE: - - printf("\n\nFTM Session Complete:\n"); - printf("=====================\n"); - printf("Average RTT: %d ns\n", - ftm_event->e.ftm_complete.avg_rtt); - printf("Average Clockoffset:%d ns\n", - ftm_event->e.ftm_complete.avg_clk_offset); - - distance = ((ftm_event->e.ftm_complete.avg_clk_offset / 2) * - (0.0003)); - printf("Distance: %f meters\n\n", distance); - - gwls_data.loop_cnt--; - if ((gwls_data.loop_cnt > 0) || (gwls_data.run_nonstop)) { - /*Stop and restart the FTM*/ - process_ftm_start(0, NULL, &gwls_data); - } else { - process_ftm_stop(0, NULL, &gwls_data); - gwls_data.terminate_app = TRUE; - } - - break; - case WLS_SUB_EVENT_RADIO_RECEIVED: - printf("WLS_SUB_EVENT_RADIO_RECEIVED\n"); - break; - case WLS_SUB_EVENT_RADIO_RPT_RECEIVED: - printf("WLS_SUB_EVENT_RADIO_RPT_RECEIVED\n"); - break; - case WLS_SUB_EVENT_ANQP_RESP_RECEIVED: - printf("WLS_SUB_EVENT_ANQP_RESP_RECEIVED\n"); - break; - default: - printf("[ERROR] Unknown sub event\n"); - break; - } - return ret; -} - -/** - * @brief Print connect and disconnect event related information - * - * @param buffer Pointer to received event buffer - * @param size Length of the received event - * - * @return N/A - */ -static void print_event_drv_connected(t_u8 *buffer, t_u16 size) -{ - struct ether_addr *wap; - struct ether_addr etherzero = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; - char buf[32]; - - wap = (struct ether_addr *)(buffer + strlen(CUS_EVT_AP_CONNECTED)); - - if (!memcmp(wap, ðerzero, sizeof(struct ether_addr))) { - printf("---< Disconnected from AP >---\n"); - assoc_flag = FALSE; - - } else { - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "%02X:%02X:%02X:%02X:%02X:%02X", - wap->ether_addr_octet[0], wap->ether_addr_octet[1], - wap->ether_addr_octet[2], wap->ether_addr_octet[3], - wap->ether_addr_octet[4], wap->ether_addr_octet[5]); - printf("---< Connected to AP: %s >---\n", buf); - /** set TRUE, if connected */ - assoc_flag = TRUE; - } -} - -/** - * @brief This function parses for NETLINK events - * - * @param nlh Pointer to Netlink message header - * @param bytes_read Number of bytes to be read - * @param evt_conn A pointer to a output buffer. It sets TRUE when it gets - * the event CUS_EVT_OBSS_SCAN_PARAM, otherwise - * FALSE - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static int drv_nlevt_handler(struct nlmsghdr *nlh, int bytes_read, - int *evt_conn) -{ - int len, plen; - t_u8 *buffer = NULL; - t_u32 event_id = 0; - event_header *event = NULL; - char if_name[IFNAMSIZ + 1]; - - /* Initialize receive buffer */ - buffer = (t_u8 *)malloc(NL_MAX_PAYLOAD); - if (!buffer) { - printf("ERR: Could not alloc buffer\n"); - return MLAN_STATUS_FAILURE; - } - memset(buffer, 0, NL_MAX_PAYLOAD); - - *evt_conn = FALSE; - while ((unsigned int)bytes_read >= NLMSG_HDRLEN) { - len = nlh->nlmsg_len; /* Length of message including header */ - plen = len - NLMSG_HDRLEN; - if (len > bytes_read || plen < 0) { - free(buffer); - /* malformed netlink message */ - return MLAN_STATUS_FAILURE; - } - if ((unsigned int)len > NLMSG_SPACE(NL_MAX_PAYLOAD)) { - printf("ERR:Buffer overflow!\n"); - free(buffer); - return MLAN_STATUS_FAILURE; - } - memset(buffer, 0, NL_MAX_PAYLOAD); - memcpy(buffer, NLMSG_DATA(nlh), plen); - - if (NLMSG_OK(nlh, len)) { - memcpy(&event_id, buffer, sizeof(event_id)); - - if (((event_id & 0xFF000000) == 0x80000000) || - ((event_id & 0xFF000000) == 0)) { - event = (event_header *)buffer; - } else { - memset(if_name, 0, IFNAMSIZ + 1); - memcpy(if_name, buffer, IFNAMSIZ); - event = (event_header *)(buffer + IFNAMSIZ); - } - } - - /*Prints the events*/ - if (event) { - switch (event->event_id) { - case EVENT_WLS_FTM_COMPLETE: - process_ftm_complete_event((t_u8 *)event, - bytes_read, if_name); - break; - default: - if (!strncmp(CUS_EVT_AP_CONNECTED, - (char *)event, - strlen(CUS_EVT_AP_CONNECTED))) { - if (strlen(if_name)) - printf("EVENT for interface %s\n", - if_name); - print_event_drv_connected((t_u8 *)event, - bytes_read); - } - break; - } - } - len = NLMSG_ALIGN(len); - bytes_read -= len; - nlh = (struct nlmsghdr *)((char *)nlh + len); - } - free(buffer); - return MLAN_STATUS_SUCCESS; -} - -/** - * @brief Configure and read event data from netlink socket - * - * @param nl_sk Netlink socket handler - * @param msg Pointer to message header - * @param ptv Pointer to struct timeval - * - * @return Number of bytes read or MLAN_STATUS_FAILURE - */ -static int read_event(int nl_sk, struct msghdr *msg, struct timeval *ptv) -{ - int count = -1; - int ret = MLAN_STATUS_FAILURE; - fd_set rfds; - - /* Setup read fds and initialize event buffers */ - FD_ZERO(&rfds); - FD_SET(nl_sk, &rfds); - - /* Wait for reply */ - ret = select(nl_sk + 1, &rfds, NULL, NULL, ptv); - - if (ret == MLAN_STATUS_FAILURE) { - /* Error */ - mlanwls_terminate_flag++; - ptv->tv_sec = DEFAULT_SCAN_INTERVAL; - ptv->tv_usec = 0; - goto done; - } - if (!FD_ISSET(nl_sk, &rfds)) { - /* Unexpected error. Try again */ - ptv->tv_sec = DEFAULT_SCAN_INTERVAL; - ptv->tv_usec = 0; - goto done; - } - /* Success */ - count = recvmsg(nl_sk, msg, 0); - -done: - return count; -} - -/** - * @brief Run the application - * - * @param nl_sk Netlink socket - * - * @return N/A - */ -static void mlanwls_event_handler(int nl_sk) -{ - struct timeval tv; - int bytes_read, evt_conn; - struct msghdr msg; - struct sockaddr_nl dest_addr; - struct nlmsghdr *nlh; - struct iovec iov; - - /* Initialize timeout value */ - tv.tv_sec = DEFAULT_SCAN_INTERVAL; - tv.tv_usec = 0; - - /* Initialize netlink header */ - nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); - if (!nlh) { - printf("[ERROR] Could not allocate space for netlink header\n"); - goto done; - } - memset(nlh, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); - /* Fill the netlink message header */ - nlh->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); - nlh->nlmsg_pid = getpid(); /* self pid */ - nlh->nlmsg_flags = 0; - - /* Initialize I/O vector */ - memset(&iov, 0, sizeof(struct iovec)); - iov.iov_base = (void *)nlh; - iov.iov_len = nlh->nlmsg_len; - - /* Set destination address */ - memset(&dest_addr, 0, sizeof(struct sockaddr_nl)); - dest_addr.nl_family = AF_NETLINK; - dest_addr.nl_pid = 0; /* Kernel */ - dest_addr.nl_groups = NL_MULTICAST_GROUP; - - /* Initialize message header */ - memset(&msg, 0, sizeof(struct msghdr)); - msg.msg_name = (void *)&dest_addr; - msg.msg_namelen = sizeof(dest_addr); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - while (!gwls_data.terminate_app) { - /* event buffer is received for all the interfaces */ - bytes_read = read_event(nl_sk, &msg, &tv); - /* handle only NETLINK events here */ - drv_nlevt_handler((struct nlmsghdr *)nlh, bytes_read, - &evt_conn); - } - -done: - if (nl_sk > 0) - close(nl_sk); - if (nlh) - free(nlh); - return; -} - -/** - * @brief Process ftm session ntb ranging configuration - * @param argc Number of arguments for the ntb_ranging_cfg command - * @param argv A pointer to start of ntb_ranging_cfg cmd arguments list - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_dot11az_ranging_cfg(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - t_u8 *buffer = NULL; - wls_app_data_t *app_data = NULL; - hostcmd_ds_ftm_session_cmd *phostcmd = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(MRVDRV_SIZE_OF_CMD_BUFFER); - if (!buffer) { - DBG_ERROR("[ERROR] Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - mlanwls_prepare_buffer(buffer, "hostcmd", 0, NULL); - phostcmd = (hostcmd_ds_ftm_session_cmd *)(buffer + (strlen(CMD_NXP) + - strlen("hostcmd") + - sizeof(t_u32))); - - /*Parse the arguments*/ - phostcmd->cmd_hdr.command = cpu_to_le16(HostCmd_CMD_FTM_SESSION_CFG); - phostcmd->cmd_hdr.size = S_DS_GEN + sizeof(hostcmd_ds_ftm_session_cmd); - phostcmd->cmd_hdr.size = cpu_to_le16(phostcmd->cmd_hdr.size); - phostcmd->cmd.ftm_session_cfg.action = - cpu_to_le16(app_data->hostcmd_action); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.len = - cpu_to_le16(sizeof(ranging_cfg_t)); - - if (app_data->protocol_type == PROTO_DOT11AZ_TB) { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.type = - cpu_to_le16(FTM_TB_RANGING_CFG_TLV_ID); - } else { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.type = - cpu_to_le16(FTM_NTB_RANGING_CFG_TLV_ID); - } - - if (app_data->hostcmd_action == MLAN_ACT_SET) { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .format_bw = app_data->range_cfg.format_bw; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .max_i2r_sts_upto80 = - app_data->range_cfg.max_i2r_sts_upto80; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .max_r2i_sts_upto80 = - app_data->range_cfg.max_r2i_sts_upto80; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .az_measurement_freq = - app_data->range_cfg.az_measurement_freq; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .az_number_of_measurements = - app_data->range_cfg.az_number_of_measurements; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11az.range_tlv.val - .i2r_lmr_feedback = - app_data->range_cfg.i2r_lmr_feedback; - } - /*Perform ioctl and process response*/ - ret = mlanwls_send_ioctl(buffer); - -done: - if (buffer) - free(buffer); - return ret; -} - -/** - * @brief Process dot11mc ftm session configuration - * @param argc Number of arguments for the ntb_ranging_cfg command - * @param argv A pointer to start of ntb_ranging_cfg cmd arguments list - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_dot11mc_ftm_cfg(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - t_u8 *buffer = NULL; - wls_app_data_t *app_data = NULL; - hostcmd_ds_ftm_session_cmd *phostcmd = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(MRVDRV_SIZE_OF_CMD_BUFFER); - if (!buffer) { - DBG_ERROR("[ERROR] Cannot allocate buffer for command!\n"); - return MLAN_STATUS_FAILURE; - } - - mlanwls_prepare_buffer(buffer, "hostcmd", 0, NULL); - phostcmd = (hostcmd_ds_ftm_session_cmd *)(buffer + (strlen(CMD_NXP) + - strlen("hostcmd") + - sizeof(t_u32))); - - /*Parse the arguments*/ - phostcmd->cmd_hdr.command = cpu_to_le16(HostCmd_CMD_FTM_SESSION_CFG); - phostcmd->cmd_hdr.size = S_DS_GEN + sizeof(t_u16); - phostcmd->cmd.ftm_session_cfg.action = - cpu_to_le16(app_data->hostcmd_action); - - if (app_data->hostcmd_action == MLAN_ACT_SET) { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.type = - cpu_to_le16(FTM_SESSION_CFG_INITATOR_TLV_ID); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.len = - cpu_to_le16(sizeof(ftm_session_cfg_t) + sizeof(t_u16)); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .burst_exponent = app_data->session_cfg.burst_exponent; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .burst_duration = app_data->session_cfg.burst_duration; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .min_delta_FTM = app_data->session_cfg.min_delta_FTM; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val.is_ASAP = - app_data->session_cfg.is_ASAP; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .per_burst_FTM = app_data->session_cfg.per_burst_FTM; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .channel_spacing = - app_data->session_cfg.channel_spacing; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.val - .burst_period = - cpu_to_le16(app_data->session_cfg.burst_period); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.civic_req = - app_data->civic_request; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.sess_tlv.lci_req = - app_data->lci_request; - phostcmd->cmd_hdr.size += sizeof(ftm_session_cfg_tlv_t); - - if (app_data->lci_request) { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.type = - cpu_to_le16(FTM_SESSION_CFG_LCI_TLV_ID); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.len = - cpu_to_le16(sizeof(lci_cfg_t)); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .altitude = app_data->lci_cfg.altitude; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .alt_unc = app_data->lci_cfg.alt_unc; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .latitude = app_data->lci_cfg.latitude; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .lat_unc = app_data->lci_cfg.lat_unc; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .longitude = app_data->lci_cfg.longitude; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.lci_tlv.val - .long_unc = app_data->lci_cfg.long_unc; - phostcmd->cmd_hdr.size += sizeof(lci_tlv_t); - } - - if (app_data->civic_request) { - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv - .type = cpu_to_le16( - FTM_SESSION_CFG_LOCATION_CIVIC_TLV_ID); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv - .len = cpu_to_le16( - (sizeof(civic_loc_cfg_t) - - sizeof(app_data->civic_cfg.civic_address)) + - app_data->civic_cfg.civic_address_length); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv.val - .civic_address_type = - app_data->civic_cfg.civic_address_type; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv.val - .civic_location_type = - app_data->civic_cfg.civic_location_type; - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv.val - .country_code = - cpu_to_le16(app_data->civic_cfg.country_code); - phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc.civic_tlv.val - .civic_address_length = - app_data->civic_cfg.civic_address_length; - memcpy(&(phostcmd->cmd.ftm_session_cfg.tlv.cfg_11mc - .civic_tlv.val.civic_address[0]), - &app_data->civic_cfg.civic_address[0], - app_data->civic_cfg.civic_address_length); - phostcmd->cmd_hdr.size += - sizeof(civic_loc_tlv_t) - - sizeof(app_data->civic_cfg.civic_address) + - app_data->civic_cfg - .civic_address_length; /*copy the - variable len - addr size*/ - } - phostcmd->cmd_hdr.size = cpu_to_le16(phostcmd->cmd_hdr.size); - } - /*Perform ioctl and process response*/ - ret = mlanwls_send_ioctl(buffer); - -done: - if (buffer) - free(buffer); - return ret; -} - -/** - * @brief Process 11az/11mc ftm_start command - * @param argc Number of arguments for ftm_start command - * @param argv A pointer to first argument of ftm_start command - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_ftm_start(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - t_u8 *buffer = NULL; - wls_app_data_t *app_data = NULL; - hostcmd_ds_ftm_session_cmd *phostcmd = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - /** Get connection status */ - if (get_connstatus(&assoc_flag) == MLAN_STATUS_FAILURE) { - DBG_ERROR("[ERROR] Cannot Start FTM, STA not associated !\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - printf("ERR:Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - mlanwls_prepare_buffer(buffer, "hostcmd", 0, NULL); - phostcmd = (hostcmd_ds_ftm_session_cmd *)(buffer + (strlen(CMD_NXP) + - strlen("hostcmd") + - sizeof(t_u32))); - - /*Parse the arguments*/ - phostcmd->cmd_hdr.command = cpu_to_le16(HostCmd_CMD_FTM_SESSION_CTRL); - phostcmd->cmd_hdr.size = S_DS_GEN + sizeof(hostcmd_ftm_session_ctrl); - phostcmd->cmd_hdr.size = cpu_to_le16(phostcmd->cmd_hdr.size); - phostcmd->cmd.ftm_session_ctrl.action = cpu_to_le16(FTM_ACTION_START); - phostcmd->cmd.ftm_session_ctrl.chan = app_data->channel; - memcpy(&phostcmd->cmd.ftm_session_ctrl.peer_mac[0], - &app_data->peer_mac[0], ETH_ALEN); - - /*Perform ioctl and process response*/ - ret = mlanwls_send_ioctl(buffer); - - if (ret == MLAN_STATUS_SUCCESS) { - app_data->ftm_started = TRUE; - - DBG_LOG("[INFO] Wait for session complete event.. \n"); - /** run the application */ - mlanwls_event_handler(nl_sk); - } else { - DBG_ERROR("[ERROR] Starting FTM Session failed\n"); - app_data->ftm_started = FALSE; - } - -done: - if (buffer) - free(buffer); - return ret; -} - -/** - * @brief Handle ftm stop procedure - * @param argc Number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_ftm_stop(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - t_u8 *buffer = NULL; - wls_app_data_t *app_data = NULL; - hostcmd_ds_ftm_session_cmd *phostcmd = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - if (!app_data->ftm_started) { - DBG_LOG("[INFO] FTM Session already stopped!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Initialize buffer */ - buffer = (t_u8 *)malloc(BUFFER_LENGTH); - if (!buffer) { - DBG_ERROR("[ERROR] Cannot allocate buffer for command!\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - mlanwls_prepare_buffer(buffer, "hostcmd", 0, NULL); - phostcmd = (hostcmd_ds_ftm_session_cmd *)(buffer + (strlen(CMD_NXP) + - strlen("hostcmd") + - sizeof(t_u32))); - - /*Parse the arguments*/ - phostcmd->cmd_hdr.command = cpu_to_le16(HostCmd_CMD_FTM_SESSION_CTRL); - phostcmd->cmd_hdr.size = S_DS_GEN + sizeof(hostcmd_ftm_session_ctrl); - phostcmd->cmd_hdr.size = cpu_to_le16(phostcmd->cmd_hdr.size); - phostcmd->cmd.ftm_session_ctrl.action = cpu_to_le16(FTM_ACTION_STOP); - phostcmd->cmd.ftm_session_ctrl.chan = app_data->channel; - memcpy(&phostcmd->cmd.ftm_session_ctrl.peer_mac[0], - &app_data->peer_mac[0], ETH_ALEN); - - /*Perform ioctl and process response*/ - ret = mlanwls_send_ioctl(buffer); - app_data->ftm_started = FALSE; - - if (ret == MLAN_STATUS_FAILURE) { - DBG_ERROR("[ERROR] Hostcmd ftm stop failed\n"); - } - -done: - if (buffer) - free(buffer); - return ret; -} - -/** - * @brief Determine the netlink number - * - * @return Netlink number to use - */ -static int get_netlink_num(int dev_index) -{ - FILE *fp = NULL; - int netlink_num = -1; - char str[64]; - char *srch = "netlink_num"; - char filename[64]; - t_u8 *buffer = NULL; - struct eth_priv_cmd *cmd = NULL; - struct ifreq ifr; - - /* if dev_index is specified by user */ - if (dev_index >= 0) { - /* Try to open old driver proc: /proc/mwlan/configX first */ - if (dev_index == 0) - strcpy(filename, "/proc/mwlan/config"); - else if (dev_index > 0) - sprintf(filename, "/proc/mwlan/config%d", dev_index); - fp = fopen(filename, "r"); - if (!fp) { - /* Try to open multi-adapter driver proc: - * /proc/mwlan/adapterX/config if old proc access fail - */ - snprintf(filename, sizeof(filename), - "/proc/mwlan/adapter%d/config", dev_index); - fp = fopen(filename, "r"); - } - - if (fp) { - while (fgets(str, sizeof(str), fp)) { - if (strncmp(str, srch, strlen(srch)) == 0) { - netlink_num = - atoi(str + strlen(srch) + 1); - break; - } - } - fclose(fp); - } else { - return -1; - } - } else { - /* Start preparing the buffer */ - /* Initialize buffer */ - buffer = (t_u8 *)malloc(MRVDRV_SIZE_OF_CMD_BUFFER); - if (!buffer) { - DBG_ERROR( - "[ERROR] Cannot allocate buffer for command!\n"); - return -1; - } - /* buffer = CMD_NXP + */ - mlanwls_prepare_buffer(buffer, "getnlnum", 0, NULL); - - cmd = (struct eth_priv_cmd *)malloc( - sizeof(struct eth_priv_cmd)); - if (!cmd) { - DBG_ERROR( - "[ERROR] Cannot allocate buffer for command!\n"); - goto done; - } - - /* Fill up buffer */ -#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT - memset(cmd, 0, sizeof(struct eth_priv_cmd)); - memcpy(&cmd->buf, &buffer, sizeof(buffer)); -#else - cmd->buf = buffer; -#endif - cmd->used_len = 0; - cmd->total_len = MRVDRV_SIZE_OF_CMD_BUFFER; - - /* Perform IOCTL */ - memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name)); - ifr.ifr_ifru.ifru_data = (void *)cmd; - - if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) { - DBG_ERROR("[ERROR] mlanwls: getnlnum fail\n"); - goto done; - } - netlink_num = *(int *)(buffer); - } - -done: - if (cmd) - free(cmd); - if (buffer) - free(buffer); - printf("[INFO] Netlink number = %d\n", netlink_num); - return netlink_num; -} - -/** - * @brief opens netlink socket to receive NETLINK events - * @return socket id --success, otherwise--MLAN_STATUS_FAILURE - */ -static int open_netlink(int dev_index) -{ - int sk = -1; - struct sockaddr_nl src_addr; - int netlink_num = 0; - - netlink_num = get_netlink_num(dev_index); - if (netlink_num < 0) { - DBG_ERROR( - "[ERROR] Could not get netlink socket. Invalid device number.\n"); - return sk; - } - - /* Open netlink socket */ - sk = socket(PF_NETLINK, SOCK_RAW, netlink_num); - if (sk < 0) { - DBG_ERROR("[ERROR] Could not open netlink socket.\n"); - return sk; - } - - /* Set source address */ - memset(&src_addr, 0, sizeof(src_addr)); - src_addr.nl_family = AF_NETLINK; - src_addr.nl_pid = getpid(); - src_addr.nl_groups = NL_MULTICAST_GROUP; - - /* Bind socket with source address */ - if (bind(sk, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) { - DBG_ERROR("[ERROR] Could not bind socket!\n"); - close(sk); - return -1; - } - return sk; -} - -/** - * @brief Terminate signal handler - * @param signal Signal to handle - * @return NA - */ -static t_void mlanwls_terminate_handler(int signal) -{ - printf("[INFO] Stopping application.\n"); -#if DEBUG - printf("Process ID of process killed = %d\n", getpid()); -#endif - gwls_data.run_nonstop = 0; - gwls_data.terminate_app = 1; - process_ftm_stop(0, NULL, &gwls_data); -} - -/** - * @brief Process session ctrl cmd to send hostcmd - * @param param pointer to cmd priv data - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_ftm_session_cfg(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - wls_app_data_t *app_data = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - if ((app_data->protocol_type == PROTO_DOT11AZ_NTB) || - (app_data->protocol_type == PROTO_DOT11AZ_TB)) { - printf("[INFO] Set/Get DOT11AZ Ranging Config \n"); - ret = process_dot11az_ranging_cfg(argc, argv, param); - } else { - printf("[INFO] Set/Get DOT11MC (Legacy) Config \n"); - ret = process_dot11mc_ftm_cfg(argc, argv, param); - } - -done: - return ret; -} - -/** - * @brief Process session ctrl cmd to send hostcmd - * @param param pointer to cmd priv data - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int process_ftm_session_ctrl(int argc, char *argv[], void *param) -{ - int ret = MLAN_STATUS_SUCCESS; - wls_app_data_t *app_data = NULL; - - if (!param) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - app_data = (wls_app_data_t *)param; - - if (app_data->hostcmd_action == FTM_ACTION_START) { - ret = process_ftm_start(argc, argv, param); - } else { - ret = process_ftm_stop(argc, argv, param); - } -done: - return ret; -} - -/** - * @brief Parse the user command and process it - * @param start_idx Start of ftm command argument in user command - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int process_subcommand(int argc, char *argv[]) -{ - int i = 0; - int ret = MLAN_STATUS_SUCCESS; - - /*Parse the user command to update the priv data and call subcommand - * handlers*/ - for (i = 0; wls_app_command[i].cmd; i++) { - if (strncmp(wls_app_command[i].cmd, argv[FTM_SUBCMD_INDEX], - strlen(wls_app_command[i].cmd))) - continue; - if (strlen(wls_app_command[i].cmd) != - strlen(argv[FTM_SUBCMD_INDEX])) - continue; - - switch (wls_app_command[i].cmd_id) { - case FTM_SESSION_CFG_CMD_ID: - if (FTM_CFG_SET_CMD_LEN == argc) { - gwls_data.hostcmd_action = MLAN_ACT_SET; - gwls_data.protocol_type = - atoi(argv[FTM_CFG_PROTOCOL_INDEX]); - mlanwls_read_ftm_config( - argv[FTM_CFG_FILE_ARG_INDEX]); - - } else if (FTM_CFG_GET_CMD_LEN == argc) { - /*ToDo: FW Implemention for GET operation*/ - gwls_data.hostcmd_action = MLAN_ACT_GET; - } else { - DBG_ERROR( - "[ERROR] Invalid number of arguments\n\n"); - display_help(NELEMENTS(ftm_session_cfg_help), - ftm_session_cfg_help); - ret = MLAN_STATUS_FAILURE; - goto done; - } - break; - case FTM_SESSION_CTRL_CMD_ID: - - if (FTM_SESSION_SUBCMD_LEN == (argc) || - (FTM_SESSION_SUBCMD_NONSTOP_LEN == (argc))) { - gwls_data.channel = a2hex_or_atoi( - argv[FTM_SESSION_CHANNEL_OFFSET]); - gwls_data.hostcmd_action = a2hex_or_atoi( - argv[FTM_SESSION_ACTION_OFFSET]); - - ret = mac2raw( - argv[FTM_SESSION_PEER_ADDR_OFFSET], - &(gwls_data.peer_mac[0])); - if (ret != MLAN_STATUS_SUCCESS) { - printf("[ERROR] %s Address \n", - ret == MLAN_STATUS_FAILURE ? - "Invalid MAC" : - ret == MAC_BROADCAST ? - "Broadcast" : - "Multicast"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - if (FTM_SESSION_SUBCMD_LEN == (argc)) { - gwls_data.loop_cnt = a2hex_or_atoi( - argv[FTM_SESSION_LOOP_OFFSET]); - gwls_data.run_nonstop = - (gwls_data.loop_cnt == 0) ? 1 : - 0; - - } else { - gwls_data.loop_cnt = 1; - } - - } else { - DBG_ERROR( - "[ERROR] Invalid number of arguments\n"); - display_help(NELEMENTS(ftm_session_ctrl_help), - ftm_session_ctrl_help); - ret = MLAN_STATUS_FAILURE; - goto done; - } - break; - default: - printf("[ERROR] SubCommand %s is not supported\n", - argv[FTM_SUBCMD_INDEX]); - display_help(NELEMENTS(mlanwls_help), mlanwls_help); - ret = MLAN_STATUS_FAILURE; - goto done; - break; - } - - ret = wls_app_command[i].func(argc, argv, &gwls_data); - printf("[INFO] Command %s processed. Return:%d \n", - wls_app_command[i].cmd, ret); - break; - } - -done: - if (!wls_app_command[i].cmd) - display_help(NELEMENTS(mlanwls_help), mlanwls_help); - return ret; -} - -/** - * @brief Read ftm config param from conf file - * @param file_name config file name - * - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ - -static int mlanwls_read_ftm_config(char *file_name) -{ - int ret = MLAN_STATUS_SUCCESS; - FILE *config_file = NULL; - char *line = NULL; - char *data = NULL; - int arg_num, li; - char *args[30]; - t_u8 param = 0; - - // read config - config_file = fopen(file_name, "r"); - if (config_file == NULL) { - perror("CONFIG"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - line = (char *)malloc(MAX_CONFIG_LINE); - if (!line) { - printf("ERR:Cannot allocate memory for line\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - memset(line, 0, MAX_CONFIG_LINE); - - printf("[INFO] Read FTM config from file %s\n", file_name); - while (config_get_line(line, MAX_CONFIG_LINE, config_file, &li, - &data)) { - arg_num = parse_line(line, args, 30); - - if (arg_num > 1) - param = atoi(args[1]); - - if (gwls_data.protocol_type == PROTO_DOT11MC) { - if (strcmp(args[0], "DOT11MC_CFG") == 0) { - printf("DOT11MC_CFG\n"); - } else if (strcmp(args[0], "BURST_EXP") == 0) { - gwls_data.session_cfg.burst_exponent = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t BURST_EXP=%d\n", param); - } else if (strcmp(args[0], "BURST_DURATION") == 0) { - gwls_data.session_cfg.burst_duration = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t BURST_DURATION=%d\n", param); - } else if (strcmp(args[0], "MIN_DELTA") == 0) { - gwls_data.session_cfg.min_delta_FTM = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t MIN_DELTA=%d\n", param); - } else if (strcmp(args[0], "IS_ASAP") == 0) { - gwls_data.session_cfg.is_ASAP = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t IS_ASAP=%d\n", param); - } else if (strcmp(args[0], "FTM_PER_BURST") == 0) { - gwls_data.session_cfg.per_burst_FTM = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t FTM_PER_BURST=%d\n", param); - } else if (strcmp(args[0], "BW") == 0) { - gwls_data.session_cfg.channel_spacing = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t BW=%d\n", param); - } else if (strcmp(args[0], "BURST_PERIOD") == 0) { - gwls_data.session_cfg.burst_period = - (t_u16)(atoi(args[1])); - PRINT_CFG("\t BURST_PERIOD=%d\n", param); - - } else if (strcmp(args[0], "LCI_REQUEST") == 0) { - gwls_data.lci_request = (t_u8)(atoi(args[1])); - PRINT_CFG("\t LCI_REQUEST=%d\n", param); - - } else if (strcmp(args[0], "LATITIUDE") == 0) { - gwls_data.lci_cfg.latitude = - (double)(atof(args[1])); - PRINT_CFG("\t LATITIUDE=%lf\n", - gwls_data.lci_cfg.latitude); - - } else if (strcmp(args[0], "LONGITUDE") == 0) { - gwls_data.lci_cfg.longitude = - (double)(atof(args[1])); - PRINT_CFG("\t LATITIUDE=%lf\n", - gwls_data.lci_cfg.longitude); - - } else if (strcmp(args[0], "LATITUDE_UNCERTAINITY") == - 0) { - gwls_data.lci_cfg.lat_unc = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t LATITUDE_UNCERTAINITY=%d\n", - param); - - } else if (strcmp(args[0], "LONGITUDE_UNCERTAINITY") == - 0) { - gwls_data.lci_cfg.long_unc = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t LONGITUDE_UNCERTAINITY=%d\n", - param); - - } else if (strcmp(args[0], "ALTITUDE") == 0) { - gwls_data.lci_cfg.altitude = - (double)(atof(args[1])); - PRINT_CFG("\t ALTITUDE=%lf\n", - gwls_data.lci_cfg.altitude); - - } else if (strcmp(args[0], "ALTITUDE_UNCERTAINITY") == - 0) { - gwls_data.lci_cfg.alt_unc = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t ALTITUDE_UNCERTAINITY=%d\n", - param); - - } else if (strcmp(args[0], "CIVIC_LOCATION") == 0) { - gwls_data.civic_request = (t_u8)(atoi(args[1])); - PRINT_CFG("\t CIVIC_LOCATION=%d\n", param); - - } else if (strcmp(args[0], "CIVIC_LOCATION_TYPE") == - 0) { - gwls_data.civic_cfg.civic_location_type = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t CIVIC_LOCATION_TYPE=%d\n", param); - - } else if (strcmp(args[0], "COUNTRY_CODE") == 0) { - gwls_data.civic_cfg.country_code = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t COUNTRY_CODE=%d\n", param); - - } else if (strcmp(args[0], "CIVIC_ADDRESS_TYPE") == 0) { - gwls_data.civic_cfg.civic_address_type = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t CIVIC_ADDRESS_TYPE=%d\n", param); - - } else if (strcmp(args[0], "ADDRESS") == 0) { - if (strlen(args[1]) <= 255) { - gwls_data.civic_cfg - .civic_address_length = - strlen(args[1]); - strncpy((char *)&gwls_data.civic_cfg - .civic_address[0], - args[1], - gwls_data.civic_cfg - .civic_address_length); - PRINT_CFG("\t ADDRESS=%s\n", args[1]); - } else { - DBG_ERROR( - "\t [ERROR] Invalid Civic Address Len\n"); - } - - } else { - // printf("Invalid line entry\n %s",args[1]); - } - } - - if ((gwls_data.protocol_type == PROTO_DOT11AZ_NTB) || - (gwls_data.protocol_type == PROTO_DOT11AZ_TB)) { - if (strcmp(args[0], "DOT11AZ_RANGING_CFG") == 0) { - if (gwls_data.protocol_type == - PROTO_DOT11AZ_NTB) { - printf("DOT11AZ_NTB_RANGING_CFG\n\n"); - } else { - printf("DOT11AZ_TB_RANGING_CFG\n\n"); - } - } else if (strcmp(args[0], "FORMAT_BW") == 0) { - gwls_data.range_cfg.format_bw = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t FORMAT_BW=%d\n", param); - } else if (strcmp(args[0], "MAX_I2R_STS_UPTO80") == 0) { - gwls_data.range_cfg.max_i2r_sts_upto80 = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t MAX_I2R_STS_UPTO80=%d\n", param); - } else if (strcmp(args[0], "MAX_R2I_STS_UPTO80") == 0) { - gwls_data.range_cfg.max_r2i_sts_upto80 = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t MAX_R2I_STS_UPTO80=%d\n", param); - } else if (strcmp(args[0], "AZ_MEASUREMENT_FREQ") == - 0) { - gwls_data.range_cfg.az_measurement_freq = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t AZ_MEASUREMENT_FREQ=%d\n", param); - } else if (strcmp(args[0], - "AZ_NUMBER_OF_MEASUREMENTS") == 0) { - gwls_data.range_cfg.az_number_of_measurements = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t AZ_NUMBER_OF_MEASUREMENTS=%d\n", - param); - } else if (strcmp(args[0], "I2R_LMR_FEEDBACK") == 0) { - gwls_data.range_cfg.i2r_lmr_feedback = - (t_u8)(atoi(args[1])); - PRINT_CFG("\t I2R_LMR_FEEDBACK=%d\n\n", param); - } else { - // printf("Invalid line entry%s\n",args[1]); - } - } - } - -done: - if (line) - free(line); - if (config_file) - fclose(config_file); - return ret; -} - -/** - * @brief Initialize ftm command private data - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -static int mlanwls_init(void) -{ - int ret = MLAN_STATUS_SUCCESS; - - memset(&gwls_data, 0, sizeof(wls_app_data_t)); - - /*Initialize app private data with default values*/ - gwls_data.associated = 0; - gwls_data.bss_type = 0; - gwls_data.channel = 0; - gwls_data.loop_cnt = 1; - gwls_data.run_nonstop = 0; - gwls_data.debug_level = 1; - gwls_data.ftm_started = 0; - gwls_data.terminate_app = 0; - gwls_data.protocol_type = 0; - - /*DOT11AZ NTB/TB Ranging default config*/ - gwls_data.range_cfg.az_measurement_freq = 1; - gwls_data.range_cfg.az_number_of_measurements = 6; - gwls_data.range_cfg.format_bw = 2; - gwls_data.range_cfg.max_i2r_sts_upto80 = 0; - gwls_data.range_cfg.max_r2i_sts_upto80 = 1; - gwls_data.range_cfg.i2r_lmr_feedback = 0; - - /*DOT11MC FTM session default config*/ - gwls_data.session_cfg.burst_exponent = 0; - gwls_data.session_cfg.burst_duration = 10; - gwls_data.session_cfg.burst_period = 5; - gwls_data.session_cfg.is_ASAP = 1; - gwls_data.session_cfg.per_burst_FTM = 10; - gwls_data.session_cfg.min_delta_FTM = 10; - gwls_data.session_cfg.channel_spacing = 13; - - /*DOT11MC FTM civic location config*/ - gwls_data.civic_request = 1; - strncpy((char *)&gwls_data.civic_cfg.civic_address[0], NXP_ADDR, - strlen(NXP_ADDR)); - gwls_data.civic_cfg.civic_address_length = strlen(NXP_ADDR); - gwls_data.civic_cfg.civic_address_type = 22; - gwls_data.civic_cfg.civic_location_type = 1; - gwls_data.civic_cfg.country_code = 0; - - /*DOT11MC FTM LCI config*/ - gwls_data.lci_request = 1; - gwls_data.lci_cfg.altitude = 11.2; - gwls_data.lci_cfg.alt_unc = 15; - gwls_data.lci_cfg.latitude = -33.8570095; - gwls_data.lci_cfg.lat_unc = 18; - gwls_data.lci_cfg.longitude = +151.2152005; - gwls_data.lci_cfg.long_unc = 18; - gwls_data.lci_cfg.z_info = 0; - - return ret; -} - -/******************************************************** - Global Functions -********************************************************/ -/** - * @brief Entry function for mlan location service - * @param argc number of arguments - * @param argv A pointer to arguments array - * @return MLAN_STATUS_SUCCESS--success, otherwise--fail - */ -int mlanwls_main(int argc, char *argv[]) -{ - int dev_index = 0; //-1; /** initialise with -1 to open multiple NETLINK - //Sockets */ - int ret = MLAN_STATUS_SUCCESS; - - printf("\n\n---------------------------------------------\n"); - printf("------- NXP Wifi Location Service (WLS)------\n"); - printf("--------------------------------------------------\n\n"); - - if (argc < 4) { - display_help(NELEMENTS(mlanwls_help), mlanwls_help); - return MLAN_STATUS_FAILURE; - } - - /*Initialize private data*/ - printf("[INFO] Initializing App\n"); - ret = mlanwls_init(); - - /*Set the interface*/ - memset(dev_name, 0, sizeof(dev_name)); - strncpy(dev_name, argv[1], strlen(argv[1])); - - /* create a socket */ - if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - DBG_ERROR("[ERROR] mlanwls: Cannot open socket.\n"); - goto done; - } - /* create netlink sockets and bind them with app side addr */ - nl_sk = open_netlink(dev_index); - - if (nl_sk < 0) { - DBG_ERROR("[ERROR] mlanwls: Cannot open netlink socket.\n"); - goto done; - } - signal(SIGHUP, mlanwls_terminate_handler); /* catch hangup signal */ - signal(SIGTERM, mlanwls_terminate_handler); /* catch kill signal */ - signal(SIGINT, mlanwls_terminate_handler); /* catch kill signal */ - signal(SIGALRM, mlanwls_terminate_handler); /* catch kill signal */ - - /*Process the wlscmd sub command argument*/ - ret = process_subcommand(argc, argv); - -done: - if (sockfd > 0) - close(sockfd); - if (nl_sk > 0) - close(nl_sk); - - return ret; -} diff --git a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.h b/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.h deleted file mode 100644 index 50f7b88..0000000 --- a/mxm_wifiex/wlan_src/mapp/mlanutl/mlanwls.h +++ /dev/null @@ -1,379 +0,0 @@ -/** @file mlanwls.h - * - * @brief 11mc/11az Wifi location services application - * - * - * Copyright 2022 NXP - * - * This software file (the File) is distributed by NXP - * under the terms of the GNU General Public License Version 2, June 1991 - * (the License). You may use, redistribute and/or modify the File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - * - */ -/************************************************************************ -Change log: - 01/24/2022: initial version -************************************************************************/ -#ifndef _WLS_H_ -#define _WLS_H_ - -/** Size of command buffer */ -#define MRVDRV_SIZE_OF_CMD_BUFFER (3 * 1024) - -/** MAC BROADCAST */ -#define MAC_BROADCAST 0x1FF -/** MAC MULTICAST */ -#define MAC_MULTICAST 0x1FE -/** Default scan interval in second*/ -#define DEFAULT_SCAN_INTERVAL 300 - -/** Netlink protocol number */ -#define NETLINK_NXP (MAX_LINKS - 1) -/** Netlink maximum payload size */ -#define NL_MAX_PAYLOAD 1024 -/** Default wait time in seconds for events */ -#define UAP_RECV_WAIT_DEFAULT 10 -#ifndef NLMSG_HDRLEN -/** NL message header length */ -#define NLMSG_HDRLEN ((int)NLMSG_ALIGN(sizeof(struct nlmsghdr))) -#endif - -/** Host Command ID : FTM session config and control */ -#define HostCmd_CMD_FTM_SESSION_CFG 0x024d -#define HostCmd_CMD_FTM_SESSION_CTRL 0x024E -#define HostCmd_CMD_FTM_FEATURE_CTRL 0x024f -#define HostCmd_CMD_WLS_REQ_FTM_RANGE 0x0250 - -/** Events*/ -#define EVENT_WLS_FTM_COMPLETE 0x00000086 -#define WLS_SUB_EVENT_FTM_COMPLETE 0 -#define WLS_SUB_EVENT_RADIO_RECEIVED 1 -#define WLS_SUB_EVENT_RADIO_RPT_RECEIVED 2 -#define WLS_SUB_EVENT_ANQP_RESP_RECEIVED 3 -#define WLS_SUB_EVENT_RTT_RESULTS 4 - -/** Custom events definitions */ -/** AP connected event */ -#define CUS_EVT_AP_CONNECTED "EVENT=AP_CONNECTED" -/** Custom events definitions end */ - -/*TLVs*/ -/** TLV type ID definition */ -#define PROPRIETARY_TLV_BASE_ID 0x0100 -#define FTM_SESSION_CFG_INITATOR_TLV_ID (PROPRIETARY_TLV_BASE_ID + 273) -#define FTM_NTB_RANGING_CFG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 343) -#define FTM_TB_RANGING_CFG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 344) -#define FTM_RANGE_REPORT_TLV_ID \ - (PROPRIETARY_TLV_BASE_ID + 0x10C) /* 0x0100 + 0x10C = 0x20C */ -#define FTM_SESSION_CFG_LCI_TLV_ID (PROPRIETARY_TLV_BASE_ID + 270) -#define FTM_SESSION_CFG_LOCATION_CIVIC_TLV_ID (PROPRIETARY_TLV_BASE_ID + 271) - -/** Structure of command table*/ -typedef struct { - /** User Command ID*/ - int cmd_id; - /** Command name */ - char *cmd; - /** Command function pointer */ - int (*func)(int argc, char *argv[], void *param); - /** Command usuage */ - char **help; -} wls_app_command_table; - -/** Structure of FTM_SESSION_CFG_NTB_RANGING / FTM_SESSION_CFG_TB_RANGING TLV - * data*/ -typedef struct _ranging_cfg { - /** Indicates the channel BW for session*/ - /*0: HE20, 1: HE40, 2: HE80, 3: HE80+80, 4: HE160, 5:HE160_SRF*/ - t_u8 format_bw; - /** indicates for bandwidths less than or equal to 80 MHz the maximum - * number of space-time streams to be used in DL/UL NDP frames in the - * session*/ - t_u8 max_i2r_sts_upto80; - /**indicates for bandwidths less than or equal to 80 MHz the maximum - * number of space-time streams to be used in DL/UL NDP frames in the - * session*/ - t_u8 max_r2i_sts_upto80; - /**Specify measurement freq in Hz to calculate measurement interval*/ - t_u8 az_measurement_freq; - /**Indicates the number of measurements to be done for session*/ - t_u8 az_number_of_measurements; - /** Initator lmr feedback */ - t_u8 i2r_lmr_feedback; - /**Include location civic request (Expect location civic from - * responder)*/ - t_u8 civic_req; - /**Include LCI request (Expect LCI info from responder)*/ - t_u8 lci_req; -} __ATTRIB_PACK__ ranging_cfg_t; - -/** Structure of FTM_SESSION_CFG TLV data*/ -typedef struct _ftm_session_cfg { - /** Indicates how many burst instances are requested for the FTM - * session*/ - t_u8 burst_exponent; - /** Indicates the duration of a burst instance*/ - t_u8 burst_duration; - /**Minimum time between consecutive FTM frames*/ - t_u8 min_delta_FTM; - /**ASAP/non-ASAP casel*/ - t_u8 is_ASAP; - /**Number of FTMs per burst*/ - t_u8 per_burst_FTM; - /**FTM channel spacing: HT20/HT40/VHT80/…*/ - t_u8 channel_spacing; - /**Indicates the interval between two consecutive burst instances*/ - t_u16 burst_period; -} __ATTRIB_PACK__ ftm_session_cfg_t; - -/** Structure for FTM_SESSION_CFG_LOCATION_CIVIC TLV data*/ -typedef struct _civic_loc_cfg { - /**Civic location type*/ - t_u8 civic_location_type; - /**Country code*/ - t_u16 country_code; - /**Civic address type*/ - t_u8 civic_address_type; - /**Civic address length*/ - t_u8 civic_address_length; - /**Civic Address*/ - t_u8 civic_address[256]; -} __ATTRIB_PACK__ civic_loc_cfg_t; - -/** Structure for FTM_SESSION_CFG_LCI TLV data*/ -typedef struct _lci_cfg { - /** known longitude*/ - double longitude; - /** known Latitude*/ - double latitude; - /** known altitude*/ - double altitude; - /** known Latitude uncertainty*/ - t_u8 lat_unc; - /** known Longitude uncertainty*/ - t_u8 long_unc; - /** Known Altitude uncertainty*/ - t_u8 alt_unc; - /** 1 word for additional Z information */ - t_u32 z_info; -} __ATTRIB_PACK__ lci_cfg_t; - -/** Structure for FTM_SESSION_CFG_NTB_RANGING TLV*/ -typedef struct _ranging_cfg_tlv { - /** Type*/ - t_u16 type; - /** Length*/ - t_u16 len; - /** Value*/ - ranging_cfg_t val; -} __ATTRIB_PACK__ ranging_cfg_tlv_t; - -/** Structure for FTM_SESSION_CFG TLV*/ -typedef struct _ftm_session_cfg_tlv { - /** Type*/ - t_u16 type; - /** Length*/ - t_u16 len; - /** Value*/ - ftm_session_cfg_t val; - t_u8 civic_req; - t_u8 lci_req; -} __ATTRIB_PACK__ ftm_session_cfg_tlv_t; - -/** Structure for FTM_SESSION_CFG_LOCATION_CIVIC TLV*/ -typedef struct _civic_loc_tlv { - /** Type*/ - t_u16 type; - /** Length*/ - t_u16 len; - /** Value*/ - civic_loc_cfg_t val; -} __ATTRIB_PACK__ civic_loc_tlv_t; - -/** Structure for FTM_SESSION_CFG_LCI TLV*/ -typedef struct _lci_tlv { - /** Type*/ - t_u16 type; - /** Length*/ - t_u16 len; - /** Value*/ - lci_cfg_t val; -} __ATTRIB_PACK__ lci_tlv_t; - -/** Structure for DOT11MC FTM_SESSION_CFG */ -typedef struct _dot11mc_ftm_cfg { - /** FTM session cfg*/ - ftm_session_cfg_tlv_t sess_tlv; - /** Location Request cfg*/ - lci_tlv_t lci_tlv; - /** Civic location cfg*/ - civic_loc_tlv_t civic_tlv; - -} __ATTRIB_PACK__ dot11mc_ftm_cfg_t; - -/** Structure for DOT11AZ FTM_SESSION_CFG */ -typedef struct _dot11az_ftmcfg_ntb_t { - /** NTB session cfg */ - ranging_cfg_tlv_t range_tlv; -} __ATTRIB_PACK__ dot11az_ftm_cfg_t; - -/** Type definition for hostcmd_ftm_session_cfg */ -typedef struct _hostcmd_ftm_session_cfg { - /** 0:Get, 1:Set */ - t_u16 action; - /** FTM_SESSION_CFG_TLVs*/ - union { - /**11az cfg*/ - dot11az_ftm_cfg_t cfg_11az; - /** 11mc cfg*/ - dot11mc_ftm_cfg_t cfg_11mc; - } tlv; -} __ATTRIB_PACK__ hostcmd_ftm_session_cfg; - -/** Type definition for hostcmd_ftm_session_ctrl */ -typedef struct _hostcmd_ftm_session_ctrl { - /** 0: Not used, 1: Start, 2: Stop*/ - t_u16 action; - /*FTM for ranging*/ - t_u8 for_ranging; - /** Mac address of the peer with whom FTM session is required*/ - t_u8 peer_mac[ETH_ALEN]; - /** Channel on which FTM must be started */ - t_u8 chan; -} __ATTRIB_PACK__ hostcmd_ftm_session_ctrl; - -/** Type definition for generic Hostcmd for 11AZ FTM Session */ -typedef struct _hostcmd_ds_ftm_session_cmd { - /** HostCmd_DS_GEN */ - HostCmd_DS_GEN cmd_hdr; - /** Command Body */ - union { - /** hostcmd for session_ctrl user command */ - hostcmd_ftm_session_ctrl ftm_session_ctrl; - /** hostcmd for session_cfg user command */ - hostcmd_ftm_session_cfg ftm_session_cfg; - } cmd; -} __ATTRIB_PACK__ hostcmd_ds_ftm_session_cmd; - -/** Type definition for FTM Session Events */ - -/** Event ID length */ -#define EVENT_ID_LEN 4 - -/**Structure for RTT results subevent*/ -typedef struct _wls_subevent_rtt_results_t { - /** complete */ - t_u8 complete; - /** tlv buffer */ - /** MrvlIEtypes_RTTResult_t */ - t_u8 tlv_buffer[]; -} __ATTRIB_PACK__ wls_subevent_rtt_results_t; - -/**Structure for FTM complete subevent*/ -typedef struct _wls_subevent_ftm_complete { - /** BSS Number */ - t_u8 bssNum; - /** BSS Type */ - t_u8 bssType; - /** MAC address of the responder */ - t_u8 mac[ETH_ALEN]; - /** Average RTT */ - t_u32 avg_rtt; - /** Average Clock offset */ - t_u32 avg_clk_offset; - /** Measure start timestamp */ - t_u32 meas_start_tsf; -} __ATTRIB_PACK__ wls_subevent_ftm_complete_t; - -/** TLV for FTM Range Report */ -typedef struct _range_report_tlv_t { - /**Type*/ - t_u16 type; - /**Length*/ - t_u16 len; - /** MAC address of the responder */ - t_u8 mac[ETH_ALEN]; - /** Average RTT */ - t_u32 avg_rtt; - /** Average Clock offset */ - t_u32 avg_clk_offset; - /** LCI and Location Civic TLV */ -} __ATTRIB_PACK__ range_report_tlv_t; - -/** Structure for FTM events*/ -typedef struct _wls_event_t { - /** Event ID */ - t_u16 event_id; - /** BSS index number for multiple BSS support */ - t_u8 bss_index; - /** BSS type */ - t_u8 bss_type; - /** sub event id */ - t_u8 sub_event_id; - union { - /** FTM Complete Sub event*/ - wls_subevent_ftm_complete_t ftm_complete; - } e; -} __ATTRIB_PACK__ wls_event_t; - -/*Application Global Data*/ -typedef struct { - /** Average RTT */ - t_u32 avg_rtt; - /** Average Clock offset */ - t_u32 avg_clk_offset; - /*Range*/ - t_s64 range; -} range_results_t; - -/** Structure for ftm command private data*/ -typedef struct _wls_app_data { - /** 0 : 80211mc, 1:80211az*/ - t_u8 protocol_type; - /** num of times to run FTM*/ - t_u8 loop_cnt; - /** flag to run nonstop*/ - t_u8 run_nonstop; - /** flag is associated */ - t_u8 associated; - /** 0 - STA, 1- AP*/ - t_u8 bss_type; - /**flag for ftm started */ - t_u8 ftm_started; - /** flag for app to terminate ftm session*/ - t_u8 terminate_app; - /**flag for debug print level */ - t_u8 debug_level; - /**peer mac address */ - t_u8 peer_mac[ETH_ALEN]; - /**AP mac address */ - t_u8 ap_mac[ETH_ALEN]; - /** Channel number for FTM session*/ - t_u8 channel; - /**SET/GET action */ - t_u8 hostcmd_action; - /**Is LCI data available in cfg*/ - t_u8 lci_request; - /** Is civic data available in cfg*/ - t_u8 civic_request; - /**ntb cfg param*/ - ranging_cfg_t range_cfg; - /** 11mc session cfg param*/ - ftm_session_cfg_t session_cfg; - /** lci cfg data*/ - lci_cfg_t lci_cfg; - /** civic cfg data - this should be last field*/ - civic_loc_cfg_t civic_cfg; -} __ATTRIB_PACK__ wls_app_data_t; - -int mlanwls_main(int argc, char *argv[]); -#endif /* _WLS_H_ */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c index 0bed1d4..6ced102 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c @@ -801,7 +801,7 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, t_u16 nss; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ - defined(SDNW62X) || defined(PCIENW62X) | defined(USBNW62X) + defined(SDNW62X) || defined(PCIENW62X) || defined(USBNW62X) t_u16 rx_nss = 0, tx_nss = 0; #endif ENTER(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c index f6ea7c7..d529a21 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c @@ -188,9 +188,9 @@ t_u8 wlan_fill_he_cap_ie(mlan_private *pmpriv, IEEEtypes_HECap_t *hecap_ie, he_mcsnss = (IEEEtypes_HeMcsNss_t *)hecap_ie->he_txrx_mcs_support; - cfg_value = GET_HE_NSSMCS(user_hecap_tlv->rx_mcs_80, nss); - hw_value = GET_HE_NSSMCS(hw_hecap_tlv->rx_mcs_80, nss); 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); @@ -200,9 +200,10 @@ t_u8 wlan_fill_he_cap_ie(mlan_private *pmpriv, IEEEtypes_HECap_t *hecap_ie, } } - cfg_value = GET_HE_NSSMCS(user_hecap_tlv->tx_mcs_80, nss); - hw_value = GET_HE_NSSMCS(hw_hecap_tlv->tx_mcs_80, nss); 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); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11d.c b/mxm_wifiex/wlan_src/mlan/mlan_11d.c index a8e29de..8537a30 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11d.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11d.c @@ -1523,8 +1523,11 @@ mlan_status wlan_11d_cfg_domain_info(pmlan_adapter pmadapter, 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; @@ -1587,7 +1590,8 @@ mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, { 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; @@ -1595,6 +1599,12 @@ mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, 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) == @@ -1624,9 +1634,18 @@ mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, /* 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, - NXP_DFS_UNKNOWN); + 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/mxm_wifiex/wlan_src/mlan/mlan_11h.c b/mxm_wifiex/wlan_src/mlan/mlan_11h.c index b6a76b6..b0b809c 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.c @@ -200,6 +200,92 @@ static t_u32 wlan_11h_convert_ieee_to_mrvl_ie(mlan_adapter *pmadapter, 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 @@ -677,8 +763,9 @@ static mlan_status wlan_11h_cmd_chan_rpt_req(mlan_private *priv, 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\n", - pchan_rpt_req->chan_desc.chanNum); + 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"); @@ -695,10 +782,12 @@ static mlan_status wlan_11h_cmd_chan_rpt_req(mlan_private *priv, 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; @@ -993,6 +1082,34 @@ static t_bool wlan_11h_is_slave_active_on_dfs_chan(mlan_private *priv) return ret; } +/** + * @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. @@ -1643,6 +1760,27 @@ static mlan_status wlan_11h_add_dfs_timestamp(mlan_adapter *pmadapter, 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 ********************************************************/ @@ -1726,6 +1864,217 @@ mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv, t_bool enable) 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. @@ -1956,7 +2305,6 @@ t_void wlan_11h_cleanup(mlan_adapter *adapter) { wlan_dfs_device_state_t *pstate_dfs = &adapter->state_dfs; wlan_dfs_timestamp_t *pdfs_ts; - mlan_private *priv = MNULL; ENTER(); @@ -1967,10 +2315,6 @@ t_void wlan_11h_cleanup(mlan_adapter *adapter) util_unlink_list(adapter->pmoal_handle, &pstate_dfs->dfs_ts_head, (pmlan_linked_list)pdfs_ts, MNULL, MNULL); - priv = wlan_get_priv(adapter, MLAN_BSS_ROLE_ANY); - if (priv) - wlan_set_chan_dfs_state(priv, BAND_A, pdfs_ts->channel, - DFS_USABLE); adapter->callbacks.moal_mfree(adapter->pmoal_handle, (t_u8 *)pdfs_ts); @@ -1978,7 +2322,6 @@ t_void wlan_11h_cleanup(mlan_adapter *adapter) adapter->pmoal_handle, &pstate_dfs->dfs_ts_head, MNULL, MNULL); } - LEAVE(); } @@ -2493,8 +2836,7 @@ t_s32 wlan_11h_process_start(mlan_private *priv, t_u8 **ppbuffer, * 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_u16 band, @@ -2511,11 +2853,12 @@ t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, * 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(); @@ -2526,7 +2869,7 @@ t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, if (!wlan_fw_11d_is_enabled(priv)) { /* No use having 11h enabled without 11d enabled */ if (wlan_11d_enable(priv, MNULL, ENABLE_11D)) { - ret = MLAN_STATUS_FAILURE; + PRINTM(MERROR, "Fail to enable 11D\n"); LEAVE(); return ret; } @@ -2888,14 +3231,14 @@ mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv) } } } - 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 */ @@ -2932,7 +3275,7 @@ mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv) "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(); @@ -2986,6 +3329,53 @@ mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, return MLAN_STATUS_SUCCESS; } +/** + * @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 @@ -3015,7 +3405,8 @@ mlan_status wlan_11h_ioctl_channel_nop_info(pmlan_adapter pmadapter, 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) { + 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 || @@ -3034,6 +3425,8 @@ mlan_status wlan_11h_ioctl_channel_nop_info(pmlan_adapter pmadapter, } } 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; } @@ -3086,17 +3479,20 @@ mlan_status wlan_11h_ioctl_chan_dfs_state(pmlan_adapter pmadapter, { mlan_ds_11h_cfg *ds_11hcfg = MNULL; t_s32 ret = MLAN_STATUS_FAILURE; - pmlan_private priv = pmadapter->priv[pioctl_req->bss_index]; + 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) { - wlan_11h_is_channel_under_nop( - pmadapter, - ds_11hcfg->param.ch_dfs_state.channel); + 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, @@ -3211,12 +3607,15 @@ t_bool wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter, t_u8 channel) * * @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) + t_u8 *radar_chan, + t_u8 *bandwidth) { mlan_status ret = MLAN_STATUS_SUCCESS; HostCmd_DS_CHAN_RPT_RSP *pchan_rpt_rsp; @@ -3229,6 +3628,7 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, 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(); @@ -3236,8 +3636,10 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, 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) + 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) { @@ -3260,6 +3662,7 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, case TLV_TYPE_CHANNELBANDLIST: tlv = (MrvlIEtypes_channel_band_t *)ptlv; dfs_check_channel = tlv->channel; + dfs_check_bandwidth = tlv->bandcfg.chanWidth; break; default: break; @@ -3273,19 +3676,23 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, 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_set_chan_dfs_state(priv, BAND_A, dfs_check_channel, - DFS_UNAVAILABLE); + wlan_11h_set_chan_dfs_state(priv, dfs_check_channel, + dfs_check_bandwidth, + DFS_UNAVAILABLE); else - wlan_set_chan_dfs_state(priv, BAND_A, dfs_check_channel, - DFS_AVAILABLE); + 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( @@ -3304,28 +3711,38 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, * @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) + 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) + if (priv->bss_type == MLAN_BSS_TYPE_DFS) { *radar_chan = priv->chan_rep_req.chanNum; + dfs_check_bandwidth = + priv->chan_rep_req.bandcfg.chanWidth; + } } - wlan_11h_add_dfs_timestamp(priv->adapter, DFS_TS_REPR_NOP_START, - *radar_chan); - wlan_set_chan_dfs_state(priv, BAND_A, *radar_chan, DFS_UNAVAILABLE); - PRINTM(MEVENT, "DFS: Radar detected on %d\n", *radar_chan); + *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; } @@ -4372,14 +4789,16 @@ done: * @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(); } @@ -4413,3 +4832,29 @@ mlan_status wlan_11h_ioctl_dfs_w53_cfg(pmlan_adapter pmadapter, 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/mxm_wifiex/wlan_src/mlan/mlan_11h.h b/mxm_wifiex/wlan_src/mlan/mlan_11h.h index bcd5a32..4d0f563 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.h @@ -63,6 +63,14 @@ extern mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv, /** 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); @@ -135,12 +143,14 @@ extern mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv); /** 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 */ @@ -148,6 +158,8 @@ extern mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); 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); extern mlan_status wlan_11h_ioctl_dfs_chan_report(mlan_private *priv, pmlan_ioctl_req pioctl_req); @@ -162,6 +174,9 @@ mlan_status wlan_11h_ioctl_chan_dfs_state(pmlan_adapter pmadapter, 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); @@ -172,7 +187,7 @@ extern t_bool wlan_11h_radar_detected_tx_blocked(mlan_adapter *pmadapter); /** 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/mxm_wifiex/wlan_src/mlan/mlan_11n.c b/mxm_wifiex/wlan_src/mlan/mlan_11n.c index 785d930..7fe30fe 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n.c @@ -2888,7 +2888,7 @@ void wlan_11n_create_txbastream_tbl(mlan_private *priv, t_u8 *ra, int tid, if (pmadapter->callbacks.moal_malloc( pmadapter->pmoal_handle, sizeof(TxBAStreamTbl), - MLAN_MEM_DEF, (t_u8 **)&new_node)) { + 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(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c index 5560449..53e8543 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c @@ -474,9 +474,9 @@ int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, 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( diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c index c4b611c..3cd009f 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c @@ -159,8 +159,8 @@ static chan_freq_power_t channel_freq_power_EU_BG[] = { {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[] = { @@ -175,8 +175,8 @@ static chan_freq_power_t channel_freq_power_JPN41_BG[] = { {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[] = { @@ -211,8 +211,8 @@ static chan_freq_power_t channel_freq_power_BR_BG[] = { {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[] = { @@ -227,9 +227,9 @@ static chan_freq_power_t channel_freq_power_SPECIAL_BG[] = { {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 @@ -2579,7 +2579,7 @@ mlan_status wlan_get_curr_oper_class(mlan_private *pmpriv, t_u8 channel, } } - PRINTM(MCMND, "Operating class not find!\n"); + PRINTM(MCMND, "Operating class not found!\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -3101,6 +3101,41 @@ dfs_state_t wlan_get_chan_dfs_state(mlan_private *priv, t_u16 band, t_u8 chan) 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 * diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c index 4f9be77..0c13ae3 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c @@ -134,6 +134,7 @@ static t_u8 wlan_is_cmd_allowed_during_scan(t_u16 cmd_id) 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; @@ -2283,7 +2284,8 @@ mlan_status wlan_process_cmdresp(mlan_adapter *pmadapter) 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 = @@ -2344,6 +2346,15 @@ mlan_status wlan_process_cmdresp(mlan_adapter *pmadapter) 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; @@ -4042,9 +4053,10 @@ mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, 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 @@ -4060,7 +4072,8 @@ mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, 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) + + wlan_le16_to_cpu(rate_scope->length) + + sizeof(MrvlIEtypesHeader_t) + sizeof(MrvlRateDropPattern_t) + sizeof(MrvlIETypes_rate_setting_t)); } @@ -4102,11 +4115,7 @@ mlan_status wlan_ret_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, 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); @@ -4263,6 +4272,8 @@ 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 @@ -5381,8 +5392,8 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, 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: %llx%llx\n", pmadapter->uuid_lo, - pmadapter->uuid_hi); + PRINTM(MMSG, "uuid: %016llx%016llx\n", + pmadapter->uuid_lo, pmadapter->uuid_hi); break; default: break; @@ -9198,6 +9209,7 @@ mlan_status wlan_cmd_get_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, 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); LEAVE(); return MLAN_STATUS_SUCCESS; @@ -9215,12 +9227,7 @@ mlan_status wlan_cmd_get_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, mlan_status wlan_ret_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf) { - HostCmd_DS_GET_CH_LOAD *cfg_cmd = - (HostCmd_DS_GET_CH_LOAD *)&resp->params.ch_load; ENTER(); - - pmpriv->ch_load_param = wlan_le16_to_cpu(cfg_cmd->ch_load); - pmpriv->noise = wlan_le16_to_cpu(cfg_cmd->noise); LEAVE(); return MLAN_STATUS_SUCCESS; } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_decl.h b/mxm_wifiex/wlan_src/mlan/mlan_decl.h index 2988d16..2236e5a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_decl.h @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "344.p3" +#define MLAN_RELEASE_VERSION "362" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -129,13 +129,8 @@ typedef t_s32 t_sval; /** 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 @@ -634,6 +629,8 @@ typedef enum { /** 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 @@ -960,6 +957,14 @@ typedef enum _dfs_w53_cfg_t { 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 { /** Band Info - (00)=2.4GHz, (01)=5GHz */ @@ -2005,7 +2010,16 @@ typedef struct { /** 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 diff --git a/mxm_wifiex/wlan_src/mlan/mlan_fw.h b/mxm_wifiex/wlan_src/mlan/mlan_fw.h index 587064a..1a6af8a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_fw.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_fw.h @@ -1623,6 +1623,9 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_He_Op_t { /** 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 @@ -2082,6 +2085,8 @@ typedef enum _ENH_PS_MODES { #define EVENT_ASSOC_REQ_IE 0x00000095 +#define CHAN_LOAD_EVENT 0x00000099 + /** Event ID mask */ #define EVENT_ID_MASK 0xffff @@ -3162,6 +3167,14 @@ typedef MLAN_PACK_START struct _mef_op { 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 */ @@ -3288,14 +3301,6 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_bcn_timeout_t { 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 */ @@ -3527,6 +3532,7 @@ typedef MLAN_PACK_START struct _HostCmd_DS_GET_CH_LOAD { t_u16 action; t_u16 ch_load; t_s16 noise; + t_u16 rx_quality; t_u16 duration; } MLAN_PACK_END HostCmd_DS_GET_CH_LOAD; @@ -5961,6 +5967,25 @@ typedef MLAN_PACK_START struct _HostCmd_DS_OTP_USER_DATA { 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: @@ -7960,6 +7985,7 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { #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 diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ieee.h b/mxm_wifiex/wlan_src/mlan/mlan_ieee.h index 15a3fec..d8384ad 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ieee.h @@ -1637,6 +1637,8 @@ typedef MLAN_PACK_START struct { 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*/ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_init.c b/mxm_wifiex/wlan_src/mlan/mlan_init.c index 6f90aae..e398959 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_init.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_init.c @@ -808,9 +808,9 @@ t_void wlan_init_adapter(pmlan_adapter pmadapter) */ 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 = diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h index 9b7b739..b9192ab 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h @@ -236,6 +236,8 @@ enum _mlan_ioctl_req_id { 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, @@ -280,6 +282,7 @@ enum _mlan_ioctl_req_id { #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 @@ -403,6 +406,14 @@ enum _mlan_pass_to_act_scan { 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 @@ -4188,12 +4199,23 @@ typedef struct _mlan_ds_11h_chan_nop_info { 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; @@ -4229,6 +4251,8 @@ typedef struct _mlan_ds_11h_cfg { 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*/ @@ -4236,6 +4260,8 @@ typedef struct _mlan_ds_11h_cfg { /** 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; @@ -4644,6 +4670,16 @@ typedef struct _mlan_ds_misc_otp_user_data { 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; @@ -5524,6 +5560,7 @@ typedef struct _mlan_ds_ch_load { t_u8 action; t_u16 ch_load_param; t_s16 noise; + t_u16 rx_quality; t_u16 duration; } mlan_ds_ch_load; @@ -5598,6 +5635,8 @@ typedef struct _mlan_ds_misc_cfg { 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 */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_join.c b/mxm_wifiex/wlan_src/mlan/mlan_join.c index 5371f22..26b5f90 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_join.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_join.c @@ -282,7 +282,7 @@ static mlan_status wlan_get_common_rates(mlan_private *pmpriv, t_u8 *rate1, 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; @@ -1622,6 +1622,10 @@ mlan_status wlan_ret_802_11_associate(mlan_private *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 wlan_coex_ampdu_rxwinsize(pmpriv->adapter); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_main.h b/mxm_wifiex/wlan_src/mlan/mlan_main.h index 9e1976b..b37d8f1 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_main.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_main.h @@ -1147,6 +1147,8 @@ typedef struct _mlan_private { 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 */ @@ -1311,6 +1313,8 @@ typedef struct _mlan_private { 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 { @@ -1593,6 +1597,8 @@ typedef struct { 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, @@ -2503,6 +2509,8 @@ typedef struct _mlan_adapter { 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 */ @@ -3059,8 +3067,9 @@ t_u8 wlan_bypass_tx_list_empty(mlan_adapter *pmadapter); /** 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. */ @@ -3559,6 +3568,8 @@ t_bool wlan_set_chan_blacklist(mlan_private *priv, t_u16 band, t_u8 chan, 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); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_misc.c b/mxm_wifiex/wlan_src/mlan/mlan_misc.c index b359cac..11dec48 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_misc.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_misc.c @@ -1018,6 +1018,7 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, 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(); @@ -1029,13 +1030,12 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, #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; @@ -1049,9 +1049,7 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, 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, @@ -1067,7 +1065,6 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, (t_u32)(tmp_buf - (pmbuf->pbuf + pmbuf->data_offset)); pmbuf->data_len = data_len; pmbuf->flags = 0; - break; } exit: @@ -1244,6 +1241,10 @@ mlan_status wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, 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++) { @@ -3493,6 +3494,33 @@ mlan_status wlan_misc_otp_user_data(pmlan_adapter pmadapter, 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 * @@ -3513,7 +3541,8 @@ void wlan_check_sta_capability(pmlan_private priv, pmlan_buffer pevent, 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; @@ -3649,17 +3678,12 @@ void wlan_check_sta_capability(pmlan_private priv, pmlan_buffer pevent, } #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; @@ -3675,13 +3699,13 @@ void wlan_check_sta_capability(pmlan_private priv, pmlan_buffer pevent, 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)) @@ -6111,6 +6135,7 @@ mlan_status wlan_misc_ioctl_ch_load_results(pmlan_adapter pmadapter, } 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(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c index 213b721..a4a1a07 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c @@ -934,9 +934,9 @@ static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) (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; } @@ -1169,11 +1169,14 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) (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 @@ -1186,11 +1189,11 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) (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; } @@ -1382,8 +1385,9 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) (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 @@ -1397,11 +1401,11 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) (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; } @@ -1888,7 +1892,7 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, ENTER(); - if (!(pmadapter && pmbuf)) { + if (!pmbuf) { PRINTM(MERROR, "%s() has no buffer", __FUNCTION__); ret = MLAN_STATUS_FAILURE; goto done; @@ -1934,10 +1938,13 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, 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->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; @@ -1959,15 +1966,16 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, 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->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++; @@ -2312,11 +2320,14 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) 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->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 & @@ -2348,11 +2359,11 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) 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; + 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++; @@ -2994,8 +3005,9 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, 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->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 @@ -3004,12 +3016,12 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, 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->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; } @@ -4335,21 +4347,24 @@ mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv) 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, diff --git a/mxm_wifiex/wlan_src/mlan/mlan_scan.c b/mxm_wifiex/wlan_src/mlan/mlan_scan.c index 79eca01..ad5a165 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_scan.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_scan.c @@ -532,7 +532,7 @@ static t_u8 wlan_scan_create_channel_list( /* Passive scan on DFS channels */ if (wlan_11h_radar_detect_required( pmpriv, (t_u8)cfp->channel) && - scan_type != MLAN_SCAN_TYPE_PASSIVE) + scan_type == MLAN_SCAN_TYPE_PASSIVE) scan_type = MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE; break; @@ -808,7 +808,8 @@ wlan_scan_channel_list(mlan_private *pmpriv, t_void *pioctl_buf, ret = pcb->moal_malloc( pmadapter->pmoal_handle, MAX_SCAN_CFG_ALLOC - CHAN_TLV_MAX_SIZE, - MLAN_MEM_DEF, (t_u8 **)&ptlv_temp); + 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"); @@ -1498,17 +1499,20 @@ static mlan_status wlan_scan_setup_scan_config( return ret; } } - - 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; + 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)) { @@ -1517,6 +1521,7 @@ static mlan_status wlan_scan_setup_scan_config( } } 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( @@ -4142,7 +4147,8 @@ mlan_status wlan_scan_networks(mlan_private *pmpriv, t_void *pioctl_buf, 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"); @@ -4153,7 +4159,8 @@ mlan_status wlan_scan_networks(mlan_private *pmpriv, t_void *pioctl_buf, } 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"); @@ -6984,7 +6991,8 @@ mlan_status wlan_scan_specific_ssid(mlan_private *pmpriv, t_void *pioctl_buf, 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) { @@ -7047,7 +7055,8 @@ t_void wlan_save_curr_bcn(mlan_private *pmpriv) 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) && diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c index 9b9b414..83e6a60 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c @@ -1334,6 +1334,8 @@ static mlan_status wlan_decode_rx_packet(mlan_adapter *pmadapter, case MLAN_TYPE_CMD: PRINTM(MINFO, "--- Rx: Cmd Response ---\n"); + if (pmadapter->cmd_sent) + pmadapter->cmd_sent = MFALSE; /* take care of curr_cmd = NULL case */ if (!pmadapter->curr_cmd) { cmd_buf = pmadapter->upld_buf; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_shim.c b/mxm_wifiex/wlan_src/mlan/mlan_shim.c index 4f44112..fef623f 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_shim.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_shim.c @@ -1262,8 +1262,11 @@ process_start: } /* 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 */ @@ -1277,6 +1280,8 @@ process_start: WlanHardwareStatusInitializing; wlan_get_hw_spec_complete(pmadapter); } + } else { + wlan_release_cmd_lock(pmadapter); } /* Check for event */ @@ -1594,11 +1599,13 @@ mlan_status mlan_recv(t_void *padapter, pmlan_buffer pmbuf, t_u32 port) } 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: @@ -1744,8 +1751,12 @@ void mlan_process_deaggr_pkt(t_void *padapter, pmlan_buffer pmbuf, t_u8 *drop) 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); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c index 7e9c00f..06a1cc5 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c @@ -2489,6 +2489,46 @@ static mlan_status wlan_cmd_otp_user_data(pmlan_private pmpriv, 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 @@ -3950,6 +3990,10 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, 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; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c index 5e6dd02..79432a7 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c @@ -322,7 +322,8 @@ static mlan_status wlan_process_cmdresp_error(mlan_private *pmpriv, } } break; case HostCmd_CMD_ROAM_OFFLOAD: - wlan_clear_fw_roaming_pmk(pmpriv); + 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; @@ -628,6 +629,7 @@ static mlan_status wlan_ret_802_11_snmp_mib(pmlan_private pmpriv, /* 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); @@ -2239,6 +2241,42 @@ static mlan_status wlan_ret_otp_user_data(pmlan_private pmpriv, 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 @@ -2629,10 +2667,6 @@ mlan_status wlan_clear_fw_roaming_pmk(pmlan_private pmpriv) ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_SUPPLICANT_PMK, HostCmd_ACT_GEN_REMOVE, 0, MNULL, MNULL); - if (ret == MLAN_STATUS_SUCCESS) { - ret = MLAN_STATUS_FAILURE; - } - LEAVE(); return ret; } @@ -2669,7 +2703,10 @@ static mlan_status wlan_ret_roam_offload(pmlan_private pmpriv, pmpriv->adapter->fw_roaming = MTRUE; else { pmpriv->adapter->fw_roaming = MFALSE; - wlan_clear_fw_roaming_pmk(pmpriv); + if (MLAN_STATUS_SUCCESS != + wlan_clear_fw_roaming_pmk(pmpriv)) + PRINTM(MERROR, + "wlan_clear_fw_roaming_pmk failed\n"); } } } @@ -3323,6 +3360,9 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, 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; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c index 8c5af23..d336eb7 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c @@ -370,7 +370,12 @@ t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) 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) { @@ -919,6 +924,10 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) 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 = @@ -994,7 +1003,7 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) 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; @@ -1373,6 +1382,17 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) 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/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c index 5b570e2..6b70bed 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c @@ -3372,8 +3372,8 @@ static mlan_status wlan_sec_cfg_ioctl(pmlan_adapter pmadapter, * * @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; @@ -3956,9 +3956,9 @@ static mlan_status wlan_misc_ioctl_gen_ie(pmlan_adapter pmadapter, 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: @@ -4390,6 +4390,42 @@ static mlan_status wlan_misc_ioctl_subscribe_evt(pmlan_adapter pmadapter, return ret; } +/** + * @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 * @@ -5259,6 +5295,10 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, 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); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c index 149db99..b8df239 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c @@ -2233,6 +2233,8 @@ static mlan_status wlan_uap_ret_cmd_ap_config(pmlan_private pmpriv, 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 = @@ -2672,6 +2674,8 @@ static mlan_status wlan_uap_ret_sys_config(pmlan_private pmpriv, 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 = @@ -3166,6 +3170,7 @@ static mlan_status wlan_uap_ret_snmp_mib(pmlan_private pmpriv, 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); @@ -3878,10 +3883,11 @@ static void wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) tlv_len + sizeof(MrvlIEtypesHeader_t)); pchan_info = (MrvlIEtypes_channel_band_t *)tlv; priv->uap_channel = pchan_info->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\n", - priv->uap_channel); + 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); @@ -4980,6 +4986,7 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, 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 { @@ -5349,6 +5356,7 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) 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; @@ -5403,22 +5411,8 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) MNULL); } #endif - if (wlan_11h_radar_detect_required(pmpriv, - pmpriv->uap_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->adapter->init_para.dfs_offload) - pmpriv->intf_state_11h.is_11h_host = MTRUE; - wlan_11h_set_dfs_check_chan(pmpriv, - pmpriv->uap_channel); - } + 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"); @@ -5473,12 +5467,12 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) MAC2STR(sta_addr)); if (!sta_ptr) break; + 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 || sta_ptr->is_11ax_enabled) @@ -5619,8 +5613,10 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) pmbuf->pbuf + pmbuf->data_offset + 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); @@ -5682,11 +5678,12 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) 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); @@ -5698,6 +5695,8 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) *((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); @@ -5716,24 +5715,11 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) 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->adapter->init_para.dfs_offload) - 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 || @@ -5853,6 +5839,21 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) 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; break; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c index 42aea8e..ad6d51b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c @@ -124,10 +124,6 @@ static mlan_status wlan_uap_callback_bss_ioctl_start(t_void *priv) !wlan_can_radar_det_skip(pmpriv) && wlan_11h_radar_detect_required(pmpriv, puap_state_chan_cb->channel)) { - dfs_state = wlan_get_chan_dfs_state( - pmpriv, BAND_A, puap_state_chan_cb->channel); - if (dfs_state == DFS_AVAILABLE) - goto prep_bss_start; /* If DFS repeater mode is on then before starting the uAP * make sure that mlan0 is connected to some external AP * for DFS channel operations. @@ -154,7 +150,10 @@ static mlan_status wlan_uap_callback_bss_ioctl_start(t_void *priv) 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)) { @@ -1451,8 +1450,9 @@ static mlan_status wlan_uap_callback_11h_channel_check_req(t_void *priv) 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); + 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, @@ -1538,6 +1538,28 @@ static mlan_status wlan_uap_11h_channel_check_req(pmlan_adapter pmadapter, pmpriv->adapter->dfs_test_params .user_cac_period_msec; } + 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, @@ -2355,6 +2377,9 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) if (cfg11h->sub_command == MLAN_OID_11H_CHAN_NOP_INFO) 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); @@ -2367,6 +2392,8 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req 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; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c index a58d1a8..efb0176 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c @@ -443,6 +443,10 @@ mlan_status wlan_ops_uap_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) 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; + 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 diff --git a/mxm_wifiex/wlan_src/mlan/mlan_usb.c b/mxm_wifiex/wlan_src/mlan/mlan_usb.c index 3185ff1..c5f2c9e 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_usb.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_usb.c @@ -366,6 +366,16 @@ static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter, 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 diff --git a/mxm_wifiex/wlan_src/mlan/mlan_wmm.c b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c index 17f388c..6883401 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_wmm.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c @@ -2149,6 +2149,8 @@ t_void wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) else if (priv->bss_type == MLAN_BSS_TYPE_UAP) { sta_ptr = wlan_get_station_entry(priv, ra); if (sta_ptr) { + 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, @@ -2272,6 +2274,11 @@ mlan_status wlan_ret_wmm_get_status(pmlan_private priv, t_u8 *ptlv, 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]; diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h index 2988d16..2236e5a 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "344.p3" +#define MLAN_RELEASE_VERSION "362" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -129,13 +129,8 @@ typedef t_s32 t_sval; /** 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 @@ -634,6 +629,8 @@ typedef enum { /** 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 @@ -960,6 +957,14 @@ typedef enum _dfs_w53_cfg_t { 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 { /** Band Info - (00)=2.4GHz, (01)=5GHz */ @@ -2005,7 +2010,16 @@ typedef struct { /** 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 diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h index 15a3fec..d8384ad 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h @@ -1637,6 +1637,8 @@ typedef MLAN_PACK_START struct { 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*/ diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h index 9b7b739..b9192ab 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h @@ -236,6 +236,8 @@ enum _mlan_ioctl_req_id { 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, @@ -280,6 +282,7 @@ enum _mlan_ioctl_req_id { #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 @@ -403,6 +406,14 @@ enum _mlan_pass_to_act_scan { 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 @@ -4188,12 +4199,23 @@ typedef struct _mlan_ds_11h_chan_nop_info { 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; @@ -4229,6 +4251,8 @@ typedef struct _mlan_ds_11h_cfg { 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*/ @@ -4236,6 +4260,8 @@ typedef struct _mlan_ds_11h_cfg { /** 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; @@ -4644,6 +4670,16 @@ typedef struct _mlan_ds_misc_otp_user_data { 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; @@ -5524,6 +5560,7 @@ typedef struct _mlan_ds_ch_load { t_u8 action; t_u16 ch_load_param; t_s16 noise; + t_u16 rx_quality; t_u16 duration; } mlan_ds_ch_load; @@ -5598,6 +5635,8 @@ typedef struct _mlan_ds_misc_cfg { 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 */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c index a6a3b79..420f8c4 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c @@ -543,9 +543,11 @@ mlan_status woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key, /* 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; @@ -564,17 +566,21 @@ void woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option) /* 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 */ @@ -595,8 +601,10 @@ void woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option) 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; @@ -624,18 +632,29 @@ int woal_cfg80211_bss_role_cfg(moal_private *priv, t_u16 action, t_u8 *bss_role) 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 */ @@ -886,11 +905,22 @@ int woal_cfg80211_init_p2p_go(moal_private *priv) 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); @@ -985,7 +1015,12 @@ int woal_cfg80211_deinit_p2p(moal_private *priv) 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)) { @@ -1047,10 +1082,46 @@ int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, 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 @@ -1140,7 +1211,7 @@ int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, #endif /* WIFI_DIRECT_SUPPORT */ #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) if (priv->bss_type == MLAN_BSS_TYPE_UAP) { -#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) woal_cfg80211_del_beacon(wiphy, dev, 0); #else woal_cfg80211_del_beacon(wiphy, dev); @@ -1203,10 +1274,13 @@ int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, #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); @@ -1565,7 +1639,6 @@ mlan_status woal_set_rekey_data(moal_private *priv, { mlan_ioctl_req *req; mlan_ds_misc_cfg *misc_cfg; - int ret = 0; mlan_status status; ENTER(); @@ -1573,7 +1646,8 @@ mlan_status woal_set_rekey_data(moal_private *priv, 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; @@ -1587,14 +1661,12 @@ mlan_status woal_set_rekey_data(moal_private *priv, 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; } /** @@ -1700,7 +1772,7 @@ int woal_flush_pmksa_list(moal_private *priv) 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); @@ -2127,7 +2199,7 @@ done: * @return 0 -- success, otherwise fail */ int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, -#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(5, 19, 2) <= CFG80211_VERSION_CODE unsigned int link_id, #endif const u8 *peer, @@ -2466,7 +2538,7 @@ void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, * * @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; @@ -2684,14 +2756,6 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, break; case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_DISASSOC: - /* Need cancel the CAC when stop hostapd during - * CAC*/ -#ifdef UAP_CFG80211 -#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE - if (priv->phandle->is_cac_timer_set) - woal_cancel_chanrpt_event(priv); -#endif -#endif #ifdef UAP_SUPPORT if (!priv->bss_started) { PRINTM(MCMND, @@ -3593,8 +3657,14 @@ static t_u16 woal_filter_beacon_ies(moal_private *priv, const t_u8 *ie, int len, 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; } @@ -3756,6 +3826,7 @@ int woal_cfg80211_mgmt_frame_ie( if (beacon_wps_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid beacon wps index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -3808,6 +3879,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -3822,6 +3894,7 @@ int woal_cfg80211_mgmt_frame_ie( if (assocrep_qos_map_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid Qos map index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -3913,6 +3986,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -3969,6 +4043,7 @@ int woal_cfg80211_mgmt_frame_ie( if (beacon_index > MAX_MGMT_IE_INDEX) { PRINTM(MINFO, "Invalid beacon index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -3981,6 +4056,7 @@ int woal_cfg80211_mgmt_frame_ie( } 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; @@ -3999,6 +4075,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -4053,6 +4130,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -4075,6 +4153,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -4089,6 +4168,7 @@ int woal_cfg80211_mgmt_frame_ie( if (assocresp_index > MAX_MGMT_IE_INDEX) { PRINTM(MERROR, "Invalid assoc resp index for mgmt frame ie.\n"); + ret = -EFAULT; goto done; } @@ -4126,6 +4206,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -4151,6 +4232,7 @@ int woal_cfg80211_mgmt_frame_ie( 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; @@ -4469,7 +4551,7 @@ Bit75: 0x1 (Rx 1024-QAM Support < 242-tone RU) #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_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 @@ -4804,10 +4886,16 @@ void woal_cfg80211_notify_channel(moal_private *priv, #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE if (MLAN_STATUS_SUCCESS == woal_chandef_create(priv, &chandef, pchan_info)) { -#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE + mutex_lock(&priv->wdev->mtx); +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) cfg80211_ch_switch_notify(priv->netdev, &chandef, 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 @@ -5144,18 +5232,18 @@ int woal_get_wiphy_chan_dfs_state(struct wiphy *wiphy, LEAVE(); return ret; } - + ch_dfs_state->dfs_required = MFALSE; for (i = 0; i < sband->n_channels; i++) { - if (sband->channels[i].flags & IEEE80211_CHAN_RADAR) { - if (sband->channels[i].hw_value == channel) { + 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 = sband->channels[i].dfs_state; ch_dfs_state->dfs_required = MTRUE; - ret = 0; #endif - break; } + ret = 0; + break; } } LEAVE(); @@ -5202,7 +5290,7 @@ static void woal_update_wiphy_chan_dfs_state(struct wiphy *wiphy, t_u8 channel, } #if CFG80211_VERSION_CODE > KERNEL_VERSION(3, 8, 13) if (i < sband->n_channels) - PRINTM(MCMND, "DFS: Set channel %d dfs_state: %d\n", channel, + PRINTM(MCMD_D, "DFS: Set channel %d dfs_state: %d\n", channel, sband->channels[i].dfs_state); #endif LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h index 103209e..85c628a 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h @@ -162,7 +162,7 @@ int woal_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev); #endif int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, -#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(5, 19, 2) <= CFG80211_VERSION_CODE unsigned int link_id, #endif const u8 *peer, @@ -436,8 +436,9 @@ int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, struct beacon_parameters *params); #endif -#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE -int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id); +#if KERNEL_VERSION(5, 19, 2) <= CFG80211_VERSION_CODE +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 diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c index b77afe8..bd8468f 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c @@ -775,15 +775,22 @@ static int woal_cfg80211_subcmd_get_supp_feature_set(struct wiphy *wiphy, | 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_MKEEP_ALIVE | WLAN_FEATURE_PNO; 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*/ skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, reply_len); @@ -925,8 +932,8 @@ static void woal_get_ring_status(moal_private *priv, int ring_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; @@ -3177,7 +3184,12 @@ static int woal_cfg80211_subcmd_rssi_monitor(struct wiphy *wiphy, 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"); @@ -3187,7 +3199,12 @@ static int woal_cfg80211_subcmd_rssi_monitor(struct wiphy *wiphy, 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; @@ -3652,8 +3669,12 @@ static int woal_cfg80211_subcmd_fw_roaming_config(struct wiphy *wiphy, sizeof(wifi_ssid_params) - sizeof(whitelist.num_ssid), MAX_SSID_NUM * sizeof(mlan_802_11_ssid)); - woal_config_fw_roaming(priv, ROAM_OFFLOAD_PARAM_CFG, - roam_offload_cfg); + 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: @@ -3829,6 +3850,10 @@ static int woal_cfg80211_subcmd_start_keep_alive(struct wiphy *wiphy, 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; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h index 07ed1f7..8f4587f 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h @@ -624,6 +624,8 @@ enum mrvl_wlan_vendor_attr_wifi_logger { enum vendor_event { event_hang = 0, event_fw_dump_done = 1, + event_fw_reset_success = 2, + event_fw_reset_failure = 3, event_rssi_monitor = 0x1501, event_set_key_mgmt_offload = 0x10001, event_fw_roam_success = 0x10002, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_debug.c b/mxm_wifiex/wlan_src/mlinux/moal_debug.c index 1974e83..1252ab5 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_debug.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_debug.c @@ -260,6 +260,10 @@ static struct debug_data items[] = { item_handle_addr(hs_skip_count), HANDLE_ADDR}, {"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), + item_handle_addr(scan_timeout), HANDLE_ADDR}, +#endif }; #endif diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c index cfba82a..ab83dab 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c @@ -742,6 +742,7 @@ static int woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, } else { /* To support only */ infra_band = data[0]; + for (i = 0; i < (sizeof(SupportedInfraBand) / sizeof(SupportedInfraBand[0])); i++) @@ -755,7 +756,9 @@ static int woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, /* 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)) { @@ -2933,7 +2936,13 @@ static int woal_priv_bssrole(moal_private *priv, t_u8 *respbuf, } 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 != @@ -3910,9 +3919,16 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, } 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); @@ -3927,6 +3943,328 @@ setessid_ret: } #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 * @@ -4594,44 +4932,47 @@ static int woal_priv_set_get_scancfg(moal_private *priv, t_u8 *respbuf, 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; @@ -5341,6 +5682,38 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, 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, @@ -10707,6 +11080,53 @@ done: } #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 * @@ -11022,6 +11442,87 @@ done: return ret; } +/** + * @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 @@ -11561,8 +12062,8 @@ done: * * @return MLAN_STATUS_FAILRUE or MLAN_STATUS_SUCCESS */ -static mlan_status woal_do_dfs_cac(moal_private *priv, - mlan_ds_11h_chan_rep_req *ch_rpt_req) +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; @@ -11622,8 +12123,13 @@ static t_u8 woal_get_next_dfs_chan(moal_private *priv) memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); ch_dfs_state.channel = priv->auto_dfs_cfg.dfs_chan_list[idx]; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, - &ch_dfs_state); + 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; @@ -11656,8 +12162,11 @@ static void woal_do_auto_dfs(moal_private *priv) chan_rpt_req.startFreq = START_FREQ_11A_BAND; chan_rpt_req.chanNum = woal_get_next_dfs_chan(priv); if (priv->chan_rpt_req.chanNum) { - woal_11h_cancel_chan_report_ioctl(priv, - MOAL_IOCTL_WAIT); + 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)); } @@ -11675,7 +12184,10 @@ static void woal_do_auto_dfs(moal_private *priv) chan_rpt_req.chanNum, (int)(chan_rpt_req.bandcfg.chanWidth), chan_rpt_req.millisec_dwell_time); - woal_do_dfs_cac(priv, &chan_rpt_req); + if (MLAN_STATUS_SUCCESS != + woal_do_dfs_cac(priv, &chan_rpt_req)) + PRINTM(MERROR, "%s: woal_do_dfs_cac failed \n", + __func__); } } LEAVE(); @@ -11822,8 +12334,11 @@ void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, chan_rpt_req.startFreq = START_FREQ_11A_BAND; chan_rpt_req.chanNum = woal_get_next_dfs_chan(priv); if (priv->chan_rpt_req.chanNum) { - woal_11h_cancel_chan_report_ioctl(priv, - MOAL_IOCTL_WAIT); + 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)); } @@ -11841,11 +12356,36 @@ void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, chan_rpt_req.chanNum, (int)(chan_rpt_req.bandcfg.chanWidth), chan_rpt_req.millisec_dwell_time); - woal_do_dfs_cac(priv, &chan_rpt_req); + 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 * @@ -11855,7 +12395,6 @@ void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, * * @return length */ - static int woal_priv_do_dfs_cac(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { @@ -11881,8 +12420,14 @@ static int woal_priv_do_dfs_cac(moal_private *priv, t_u8 *respbuf, (priv->chan_rpt_req.chanNum != data[0]))) { if (priv->chan_rpt_pending || (priv->bss_type == MLAN_BSS_TYPE_DFS)) { - woal_11h_cancel_chan_report_ioctl( - priv, MOAL_IOCTL_WAIT); + 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; } memset(&priv->chan_rpt_req, 0, @@ -11900,8 +12445,14 @@ static int woal_priv_do_dfs_cac(moal_private *priv, t_u8 *respbuf, woal_uap_11h_ctrl(priv, MFALSE); memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); ch_dfs_state.channel = data[0]; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, - &ch_dfs_state); + 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, @@ -11910,6 +12461,13 @@ static int woal_priv_do_dfs_cac(moal_private *priv, t_u8 *respbuf, 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; @@ -12000,8 +12558,14 @@ static int woal_priv_auto_dfs_cfg(moal_private *priv, t_u8 *respbuf, if (auto_dfs_cfg->start_auto_zero_dfs) { if (priv->auto_dfs_cfg.start_auto_zero_dfs || priv->chan_rpt_req.chanNum) { - woal_11h_cancel_chan_report_ioctl(priv, - MOAL_IOCTL_WAIT); + 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)); } @@ -12009,8 +12573,14 @@ static int woal_priv_auto_dfs_cfg(moal_private *priv, t_u8 *respbuf, 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; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, - &ch_dfs_state); + 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, @@ -12047,8 +12617,14 @@ static int woal_priv_auto_dfs_cfg(moal_private *priv, t_u8 *respbuf, memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); ch_dfs_state.channel = auto_dfs_cfg->dfs_chan_list[i]; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, - &ch_dfs_state); + 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] = @@ -12096,11 +12672,19 @@ static int woal_priv_auto_dfs_cfg(moal_private *priv, t_u8 *respbuf, chan_rpt_req.chanNum, (int)(chan_rpt_req.bandcfg.chanWidth), chan_rpt_req.millisec_dwell_time); - woal_do_dfs_cac(priv, &chan_rpt_req); + 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"); - woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT); + 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)); @@ -12289,18 +12873,18 @@ static int woal_priv_mc_aggr_cfg(moal_private *priv, t_u8 *respbuf, ret = -EFAULT; goto done; } - 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; - } 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); @@ -12416,6 +13000,7 @@ static int woal_priv_get_ch_load_results(moal_private *priv, t_u8 *respbuf, 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: @@ -12468,6 +13053,7 @@ static int woal_priv_get_ch_load(moal_private *priv, t_u8 *respbuf, 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; status = woal_request_ioctl(priv, ioctl_req, MOAL_NO_WAIT); if (status != MLAN_STATUS_SUCCESS && status != MLAN_STATUS_PENDING) { @@ -13354,8 +13940,8 @@ static int woal_priv_tx_bf_cfg(moal_private *priv, t_u8 *respbuf, 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: @@ -14316,7 +14902,11 @@ static int woal_priv_cfg_noa(moal_private *priv, t_u8 *respbuf, 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: @@ -14386,11 +14976,14 @@ static int woal_priv_cfg_opp_ps(moal_private *priv, t_u8 *respbuf, 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; } @@ -15733,8 +16326,6 @@ static int woal_action_channel_switch(moal_private *priv, t_u8 block_tx, 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); @@ -15764,7 +16355,9 @@ void woal_move_to_next_channel(moal_private *priv) return; memset(&ch_dfs, 0, sizeof(ch_dfs)); ch_dfs.channel = next_chan; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, &ch_dfs); + 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); @@ -15818,7 +16411,13 @@ static int woal_priv_extend_channel_switch(moal_private *priv, t_u8 *respbuf, } memset(&ch_dfs, 0, sizeof(ch_dfs)); ch_dfs.channel = data[2]; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, &ch_dfs); + 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, @@ -16588,9 +17187,15 @@ static int woal_priv_roam_offload_cfg(moal_private *priv, t_u8 *respbuf, (void *)&roam_offload_cfg, sizeof(roam_offload_cfg), sizeof(priv->phandle->fw_roam_params)); - else - woal_config_fw_roaming(priv, ROAM_OFFLOAD_PARAM_CFG, - &roam_offload_cfg); + 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(); @@ -16756,7 +17361,12 @@ static int woal_priv_set_roam_passphrase(moal_private *priv, t_u8 *respbuf, goto done; } - woal_config_fw_roaming(priv, ROAM_OFFLOAD_ENABLE, &roam_offload_cfg); + 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; @@ -18066,7 +18676,7 @@ static int woal_priv_get_uuid(moal_private *priv, t_u8 *respbuf, 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, "%llx%llx", + snprintf(respbuf, MLAN_MAX_UUID_LEN + 1, "%016llx%016llx", fw_info.uuid_lo, fw_info.uuid_hi); ret = strlen(respbuf); } @@ -18415,6 +19025,12 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) 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) { @@ -19069,6 +19685,11 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) 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*/ @@ -19080,6 +19701,11 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) /* 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) { @@ -19649,7 +20275,7 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) 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; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h index 85573d8..d7bfdb1 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h @@ -110,6 +110,7 @@ typedef struct _chan_stats { #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" @@ -219,8 +220,10 @@ typedef struct _chan_stats { #endif #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" diff --git a/mxm_wifiex/wlan_src/mlinux/moal_init.c b/mxm_wifiex/wlan_src/mlinux/moal_init.c index e348fc0..95d694d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_init.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_init.c @@ -29,6 +29,7 @@ extern pmoal_handle m_handle[]; static char *fw_name; static int req_fw_nowait; int fw_reload; +int auto_fw_reload; static char *hw_name; @@ -61,12 +62,7 @@ static int beacon_hints; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -#ifdef IMX_SUPPORT static int host_mlme = 1; -#else -static int host_mlme = 0; -#endif - #endif #endif @@ -356,6 +352,8 @@ static card_type_entry card_type_map_tbl[] = { static int dfs53cfg = DFS_W53_DEFAULT_FW; +static int keep_previous_scan = 1; + /** * @brief This function read a line in module parameter file * @@ -606,6 +604,14 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, goto err; params->fw_reload = out_data; PRINTM(MMSG, "fw_reload %d\n", params->fw_reload); + } 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) != @@ -1345,6 +1351,14 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, 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) @@ -1385,6 +1399,10 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) } 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); @@ -1665,6 +1683,7 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) if (params) handle->params.dfs53cfg = params->dfs53cfg; } + handle->params.keep_previous_scan = keep_previous_scan; } /** @@ -2137,6 +2156,13 @@ void woal_init_from_dev_tree(void) 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(); @@ -2343,6 +2369,9 @@ MODULE_PARM_DESC( 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, @@ -2603,15 +2632,9 @@ MODULE_PARM_DESC( #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) module_param(host_mlme, int, 0); -#ifdef IMX_SUPPORT MODULE_PARM_DESC( host_mlme, "1: Enable Host MLME Support (Default); 0: Disable Host MLME support"); -#else -MODULE_PARM_DESC( - host_mlme, - "1: Enable Host MLME Support; 0: Disable Host MLME support (Default)"); -#endif #endif #endif @@ -2640,3 +2663,8 @@ 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/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c index 8e1d302..b18dbe0 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c @@ -971,6 +971,8 @@ done: #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; } @@ -1304,7 +1306,7 @@ int woal_pre_warmreset(moal_private *priv) #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); @@ -2756,7 +2758,12 @@ int woal_set_get_bss_role(moal_private *priv, struct iwreq *wrq) } 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, @@ -2792,6 +2799,7 @@ done: #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 * @@ -2847,6 +2855,7 @@ done: LEAVE(); return ret; } +#endif static mlan_status woal_set_wake_on_mdns(moal_handle *handle, t_u8 enable) { @@ -3243,7 +3252,7 @@ mlan_status woal_set_get_hs_params(moal_private *priv, t_u16 action, /* 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; } @@ -3403,7 +3412,12 @@ mlan_status woal_cancel_hs(moal_private *priv, t_u8 wait_option) 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); @@ -3453,9 +3467,13 @@ mlan_status woal_cancel_hs(moal_private *priv, t_u8 wait_option) 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__); } } } @@ -3751,10 +3769,14 @@ int woal_enable_hs(moal_private *priv) 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__); } } } @@ -4483,7 +4505,10 @@ void woal_cancel_cac_block(moal_private *priv) 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; @@ -5769,6 +5794,7 @@ mlan_status woal_cancel_scan(moal_private *priv, t_u8 wait_option) spin_lock_irqsave(&handle->scan_req_lock, flags); if (IS_STA_CFG80211(handle->params.cfg80211_wext) && handle->scan_request) { + cancel_delayed_work(&handle->scan_timeout_work); /** 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); @@ -5837,10 +5863,10 @@ int woal_find_essid(moal_private *priv, mlan_ssid_bssid *ssid_bssid, * @param cfg_mode configure mode * @param roam_offload_cfg Pointer to woal_roam_offload_cfg structure * - * @return Number of bytes written, negative for failure. + * @return 0-success, negative for failure. */ -mlan_status woal_config_fw_roaming(moal_private *priv, t_u8 cfg_mode, - woal_roam_offload_cfg *roam_offload_cfg) +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; @@ -6159,7 +6185,11 @@ void woal_config_bgscan_and_rssi(moal_private *priv, t_u8 set_rssi) 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; @@ -6176,12 +6206,19 @@ void woal_config_bgscan_and_rssi(moal_private *priv, t_u8 set_rssi) 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(); } @@ -7496,7 +7533,7 @@ static int parse_radio_mode_string(const char *s, size_t len, 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); @@ -7784,7 +7821,6 @@ static int parse_he_tb_tx_string(const char *s, size_t len, { int ret = MLAN_STATUS_SUCCESS; char *string = NULL; - char *tmp = NULL; char *pos = NULL; gfp_t flag; @@ -7827,7 +7863,7 @@ static int parse_he_tb_tx_string(const char *s, size_t len, ret = -EINVAL; done: - kfree(tmp); + kfree(string); LEAVE(); return ret; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.c b/mxm_wifiex/wlan_src/mlinux/moal_main.c index 98ac94c..87ff9bb 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.c @@ -489,7 +489,7 @@ static struct _card_info card_info_SD9177 = { .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, @@ -908,8 +908,10 @@ void woal_send_fw_dump_complete_event(moal_private *priv) woal_cfg80211_vendor_event_fw_dump(priv); #endif #endif - woal_broadcast_event(priv, CUS_EVT_FW_DUMP_DONE, - strlen(CUS_EVT_FW_DUMP_DONE)); + 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; } @@ -926,17 +928,20 @@ 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); cfg80211_wext = reset_handle->params.cfg80211_wext; // stop pending scan #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext) && reset_handle->scan_request) { moal_private *scan_priv = reset_handle->scan_priv; + cancel_delayed_work_sync(&reset_handle->scan_timeout_work); /** 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, @@ -963,7 +968,7 @@ static void woal_hang_work_queue(struct work_struct *work) #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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) priv->wdev->connected) { #else priv->wdev->current_bss) { @@ -1004,10 +1009,68 @@ static void woal_hang_work_queue(struct work_struct *work) #endif } } - - mlan_ioctl(reset_handle->pmlan_adapter, NULL); 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)); + } + if (IS_SD(reset_handle->card_type)) { + 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; + 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, @@ -1213,8 +1276,14 @@ static int woal_netdevice_event(struct notifier_block *nb, unsigned long event, priv->roaming_enabled) { 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 @@ -1223,8 +1292,14 @@ static int woal_netdevice_event(struct notifier_block *nb, unsigned long event, !moal_extflg_isset(priv->phandle, EXT_ROAMOFFLOAD_IN_HS)) { 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; + } if (priv->pmk_saved) { woal_set_clear_pmk(priv, MLAN_ACT_SET); priv->pmk_saved = false; @@ -1917,6 +1992,9 @@ mlan_status woal_init_sw(moal_handle *handle) #endif #endif +#ifdef STA_CFG80211 + handle->scan_timeout = SCAN_TIMEOUT_25S; +#endif if (IS_USB(handle->card_type)) init_waitqueue_head(&handle->suspend_wait_q); init_waitqueue_head(&handle->hs_activate_wait_q); @@ -2646,8 +2724,8 @@ done: * @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; @@ -2666,6 +2744,7 @@ static t_u32 woal_process_hostcmd_cfg(moal_handle *handle, t_u8 *data, buf = kzalloc(CMD_BUF_LEN, flag); if (!buf) { PRINTM(MERROR, "Could not allocate buffer space!\n"); + ret = MLAN_STATUS_FAILURE; goto done; } ptr = buf; @@ -3818,10 +3897,10 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) fw.fw_reload = handle->params.fw_reload; else fw.fw_reload = 0; - wifi_status = 0; + wifi_status = WIFI_STATUS_OK; 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)); @@ -3829,7 +3908,7 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) handle->ops.reg_dbg(handle); goto done; } - wifi_status = 0; + wifi_status = WIFI_STATUS_OK; #if defined(USB) if (handle->boot_state == USB_FW_DNLD) { @@ -3885,7 +3964,7 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) handle->init_wait_q_woken = MFALSE; 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) { handle->hardware_status = HardwareStatusReady; @@ -3895,8 +3974,16 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) 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; } @@ -3947,7 +4034,10 @@ static mlan_status woal_request_fw_dpc(moal_handle *handle, "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; } @@ -3985,7 +4075,9 @@ static void woal_request_fw_callback(const struct firmware *firmware, 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; @@ -4560,14 +4652,25 @@ mlan_status woal_init_sta_dev(struct net_device *dev, moal_private *priv) #endif ENTER(); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) - memset(&fw_info, 0, sizeof(mlan_fw_info)); - woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); - 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); +#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(MMSG, "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) @@ -4655,7 +4758,11 @@ mlan_status woal_init_uap_dev(struct net_device *dev, moal_private *priv) ENTER(); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) 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__); + 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; @@ -4976,9 +5083,6 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, } MLAN_INIT_WORK(&priv->mclist_work, woal_mclist_work_queue); - INIT_DELAYED_WORK(&priv->scan_deferred_work, - woal_scan_deferred_work_queue); - /* Initialize priv structure */ woal_init_priv(priv, MOAL_IOCTL_WAIT); @@ -5005,7 +5109,11 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, #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) @@ -5122,7 +5230,9 @@ void woal_remove_interface(moal_handle *handle, t_u8 bss_index) #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; @@ -5680,13 +5790,12 @@ int woal_close(struct net_device *dev) #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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->connected) { #else if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->current_bss) { @@ -5809,7 +5918,7 @@ int woal_set_mac_address(struct net_device *dev, void *addr) 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, @@ -6171,15 +6280,17 @@ void woal_tx_timeout(struct net_device *dev 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(); @@ -6209,7 +6320,9 @@ struct net_device_stats *woal_get_stats(struct net_device *dev) 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 @@ -6311,6 +6424,18 @@ u16 woal_select_queue(struct net_device *dev, struct sk_buff *skb #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); @@ -6831,7 +6956,9 @@ static void woal_send_tcp_ack(moal_private *priv, struct tcp_sess *tcp_session) * @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) { @@ -6988,9 +7115,9 @@ done: * @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; @@ -7104,7 +7231,7 @@ static int woal_start_xmit(moal_private *priv, struct sk_buff *skb) } done: LEAVE(); - return 0; + return; } /** @@ -7397,6 +7524,14 @@ void woal_init_priv(moal_private *priv, t_u8 wait_option) 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)); @@ -7470,8 +7605,11 @@ void woal_init_priv(moal_private *priv, t_u8 wait_option) 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 && priv->bss_type != MLAN_BSS_TYPE_DFS) { @@ -7528,8 +7666,12 @@ void woal_init_priv(moal_private *priv, t_u8 wait_option) } /* ZeroDFS interface doesn't need to set mac address to fw */ - if (priv->bss_type != MLAN_BSS_TYPE_DFS) - woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT); + 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 @@ -7562,7 +7704,7 @@ void woal_init_priv(moal_private *priv, t_u8 wait_option) * * @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; @@ -7581,8 +7723,14 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) /* Unregister and detach connected radiotap net device */ if (handle->mon_if) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) - woal_set_net_monitor(handle->mon_if->priv, wait_option, MFALSE, - 0, NULL); + 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) @@ -7595,7 +7743,11 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) #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 */ @@ -7611,7 +7763,12 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) /* 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) { @@ -7629,8 +7786,14 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) || (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 { @@ -7642,9 +7805,16 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) 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; } @@ -7656,11 +7826,17 @@ int woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf) 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; } } @@ -7711,7 +7887,7 @@ 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; } @@ -7824,7 +8000,7 @@ void woal_free_mlan_buffer(moal_handle *handle, pmlan_buffer pmbuf) * * @param phandle A pointer to moal_handle * - * @return N/A + * @return 0-success , otherwise failure. */ static int woal_get_card_info(moal_handle *phandle) { @@ -7984,40 +8160,20 @@ mlan_status woal_broadcast_event(moal_private *priv, t_u8 *payload, t_u32 len) 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; @@ -8099,6 +8255,8 @@ int woal_reassociation_thread(void *data) mlan_status status; mlan_bss_info bss_info; t_u32 timer_val = MOAL_TIMER_10S; + 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); @@ -8167,7 +8325,87 @@ int woal_reassociation_thread(void *data) (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; } @@ -8178,7 +8416,9 @@ int woal_reassociation_thread(void *data) &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; } @@ -8187,7 +8427,9 @@ int woal_reassociation_thread(void *data) 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 */ @@ -8238,7 +8480,7 @@ int woal_reassociation_thread(void *data) 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)) { @@ -8252,10 +8494,10 @@ int woal_reassociation_thread(void *data) 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, @@ -8263,6 +8505,7 @@ int woal_reassociation_thread(void *data) &priv->prev_ssid_bssid.ssid, sizeof(mlan_802_11_ssid), sizeof(mlan_802_11_ssid)); + } else { /* Search AP by BSSID first */ PRINTM(MINFO, @@ -8297,7 +8540,7 @@ int woal_reassociation_thread(void *data) 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"); @@ -8327,15 +8570,24 @@ int woal_reassociation_thread(void *data) 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, sizeof(mlan_802_11_ssid)); status = woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid); + if (status != MLAN_STATUS_SUCCESS) + PRINTM(MERROR, + "Reassoc: woal_bss_start failed\n"); } if (priv->media_connected == MFALSE) @@ -8345,14 +8597,15 @@ int woal_reassociation_thread(void *data) 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, @@ -8370,8 +8623,11 @@ int woal_reassociation_thread(void *data) 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)); @@ -8413,10 +8669,18 @@ int woal_reassociation_thread(void *data) 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. " @@ -8427,6 +8691,9 @@ int woal_reassociation_thread(void *data) } } 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; } } @@ -8476,7 +8743,8 @@ void woal_fw_dump_timer_func(void *context) 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; } @@ -8505,7 +8773,14 @@ void woal_update_dscp_mapping(moal_private *priv) return; } memset(assoc_rsp, 0, sizeof(mlan_ds_misc_assoc_rsp)); - woal_get_assoc_rsp(priv, assoc_rsp, MOAL_NO_WAIT); + 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; + } + 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( @@ -8518,6 +8793,7 @@ void woal_update_dscp_mapping(moal_private *priv) 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; } @@ -8609,7 +8885,10 @@ t_void woal_send_disconnect_to_system(moal_private *priv, 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 @@ -8623,7 +8902,9 @@ t_void woal_send_disconnect_to_system(moal_private *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; @@ -8645,7 +8926,7 @@ t_void woal_send_disconnect_to_system(moal_private *priv, if (IS_STA_CFG80211(cfg80211_wext)) { spin_lock_irqsave(&priv->connect_lock, flags); if (!priv->cfg_disconnect && !priv->cfg_connect && priv->wdev && -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) priv->wdev->connected) { #else priv->wdev->current_bss) { @@ -8675,10 +8956,14 @@ t_void woal_send_disconnect_to_system(moal_private *priv, } 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; @@ -8691,7 +8976,9 @@ t_void woal_send_disconnect_to_system(moal_private *priv, 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 */ @@ -8726,8 +9013,10 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) type = woal_le16_to_cpu(*(t_u16 *)(pmevent->event_buf + OFFSET_TYPE)); if (seqnum == 1) { +#ifdef DEBUG_LEVEL1 if (drvdbg & MFW_D) phandle->fw_dump_status = MTRUE; +#endif if (phandle->fw_dump == MFALSE) { PRINTM(MMSG, "=====FW trigger dump====\n"); phandle->fw_dump = MTRUE; @@ -8771,18 +9060,16 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) (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(); @@ -9292,6 +9579,8 @@ t_u8 *woal_dump_drv_info(moal_handle *phandle, t_u32 *dump_len) 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==="); @@ -9512,22 +9801,27 @@ void woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag) #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))) { +#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; @@ -9535,6 +9829,7 @@ void woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag) &phandle->main_work); } } +#endif } } #endif @@ -9607,7 +9902,7 @@ mlan_status woal_request_country_power_table(moal_private *priv, char *country) 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, @@ -9623,7 +9918,7 @@ mlan_status woal_request_country_power_table(moal_private *priv, char *country) 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"); @@ -9653,8 +9948,16 @@ mlan_status woal_request_country_power_table(moal_private *priv, char *country) (last_slash - file_path)); else memset(file_path, 0, sizeof(file_path)); - strncpy(file_path + strlen(file_path), country_name, - strlen(country_name)); + 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, @@ -9685,13 +9988,28 @@ static int woal_netdev_poll_rx(struct napi_struct *napi, int 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; } @@ -9709,44 +10027,55 @@ t_void woal_mclist_work_queue(struct work_struct *work) woal_request_set_multicast_list(priv, priv->netdev); } +#ifdef STA_CFG80211 /** - * @brief This workqueue function handles woal scan deferred work + * @brief This workqueue function handles woal scan timeout work * * @param work A pointer to work_struct * * @return N/A */ -t_void woal_scan_deferred_work_queue(struct work_struct *work) +t_void woal_scan_timeout_handler(struct work_struct *work) { -#ifdef STA_CFG80211 - struct delayed_work *delayed_work = - container_of(work, struct delayed_work, work); - moal_private *priv = - container_of(delayed_work, moal_private, scan_deferred_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; -#endif + moal_private *priv = woal_get_priv(handle, MLAN_BSS_ROLE_STA); + t_u8 auto_fw_dump = MFALSE; ENTER(); - PRINTM(MINFO, "Reporting scan results from scan deferred wq\n"); - -#ifdef STA_CFG80211 - if (IS_STA_CFG80211(priv->phandle->params.cfg80211_wext)) { - if (priv->phandle->scan_request) { - woal_inform_bss_from_scan_result(priv, NULL, - MOAL_NO_WAIT); - spin_lock_irqsave(&priv->phandle->scan_req_lock, flags); - woal_cfg80211_scan_done(priv->phandle->scan_request, - MFALSE); - priv->phandle->scan_request = NULL; - spin_unlock_irqrestore(&priv->phandle->scan_req_lock, - flags); + 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); + spin_lock_irqsave(&handle->scan_req_lock, flags); + woal_cfg80211_scan_done(handle->scan_request, MFALSE); + handle->scan_request = NULL; + 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; +#endif + if (priv) { + woal_mlan_debug_info(priv); + woal_moal_debug_info(priv, NULL, MFALSE); + } + handle->driver_status = MTRUE; + if (!auto_fw_dump && !handle->fw_dump && priv) + woal_process_hang(priv->phandle); + wifi_status = WIFI_STATUS_SCAN_TIMEOUT; } } -#endif LEAVE(); } +#endif /** * @brief This workqueue function handles woal event queue @@ -9861,13 +10190,6 @@ t_void woal_evt_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; @@ -9885,7 +10207,8 @@ t_void woal_rx_work_queue(struct work_struct *work) #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) - @@ -10041,16 +10364,10 @@ void woal_regist_oob_wakeup_irq(moal_handle *handle) goto err_exit; } - /* - * i.MX93 9x9 qsb board connect the out-of-band WoWLAN irq pin(M.2 pin21 - * SDIO_WAKE) to I2C IO expander pcal6524 instead of i.MX GPIO, pcal6524 - * IRQ handlers need to be threaded, the IRQ trigger type depends on the - * Devicetree setting. - */ - ret = devm_request_threaded_irq(dev, handle->irq_oob_wakeup, - NULL, woal_oob_wakeup_irq_handler, - IRQF_SHARED | IRQF_ONESHOT, - "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); @@ -10222,7 +10539,10 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, } /* 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; + } #ifdef IMX_SUPPORT #ifdef SDIO if (IS_SD(handle->card_type)) { @@ -10254,7 +10574,10 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, } /* 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 @@ -10362,6 +10685,11 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, #endif #endif +#ifdef STA_CFG80211 + INIT_DELAYED_WORK(&handle->scan_timeout_work, + woal_scan_timeout_handler); +#endif + #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) MLAN_INIT_WORK(&handle->host_mlme_work, woal_host_mlme_work_queue); @@ -10743,7 +11071,11 @@ mlan_status woal_switch_drv_mode(moal_handle *handle, t_u32 mode) /* 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) { @@ -10961,7 +11293,9 @@ static void woal_pre_reset(moal_handle *handle) // 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, @@ -10971,6 +11305,15 @@ static void woal_pre_reset(moal_handle *handle) woal_sched_timeout_uninterruptible(MOAL_TIMER_1S); } } +#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 + /** detach network interface */ for (intf_num = 0; intf_num < handle->priv_num; intf_num++) { if (handle->priv[intf_num]) { @@ -11031,6 +11374,7 @@ static void woal_post_reset(moal_handle *handle) if (MLAN_STATUS_SUCCESS != 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; } @@ -11039,8 +11383,43 @@ static void woal_post_reset(moal_handle *handle) #ifdef DEBUG_LEVEL1 drvdbg = handle->params.drvdbg; #endif + handle->fw_dump_status = MFALSE; handle->driver_status = MFALSE; handle->hardware_status = HardwareStatusReady; +#ifdef STA_CFG80211 + handle->scan_timeout = SCAN_TIMEOUT_25S; +#endif + if (!handle->wifi_hal_flag) { + PRINTM(MMSG, "wlan: post_reset remove/add interface\n"); + 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 + 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; + } + } + goto done; + } /* Reset all interfaces */ woal_reset_intf(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MOAL_IOCTL_WAIT, MTRUE); @@ -11123,7 +11502,7 @@ done: * * @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; @@ -11139,9 +11518,13 @@ void woal_request_fw_reload(moal_handle *phandle, t_u8 mode) 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 @@ -11159,23 +11542,41 @@ void woal_request_fw_reload(moal_handle *phandle, t_u8 mode) 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 @@ -11189,7 +11590,7 @@ void woal_request_fw_reload(moal_handle *phandle, t_u8 mode) woal_post_reset(ref_handle); done: LEAVE(); - return; + return ret; } /** @@ -11433,15 +11834,15 @@ static void woal_cleanup_module(void) } #ifdef STA_CFG80211 if (IS_STA_CFG80211( - handle->params.cfg80211_wext) && - (handle->priv[i]->bss_type == - MLAN_BSS_TYPE_STA)) + 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) && handle->scan_request) { + cancel_delayed_work( + &handle->scan_timeout_work); woal_cfg80211_scan_done( handle->scan_request, MTRUE); handle->scan_request = NULL; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.h b/mxm_wifiex/wlan_src/mlinux/moal_main.h index 76ea1b0..b6de43d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.h @@ -326,6 +326,14 @@ typedef enum _MOAL_HARDWARE_STATUS { HardwareStatusNotReady } MOAL_HARDWARE_STATUS; +#define WIFI_STATUS_OK 0 +#define WIFI_STATUS_DNLD_FW_FAIL 1 +#define WIFI_STATUS_INIT_FW_FAIL 2 +#define WIFI_STATUS_TX_TIMEOUT 3 +#define WIFI_STATUS_WIFI_HANG 4 +#define WIFI_STATUS_SCAN_TIMEOUT 5 +#define WIFI_STATUS_FW_DUMP 6 + /** fw cap info 11p */ #define FW_CAPINFO_80211P MBIT(24) /** fw cap info bit26 for 0-DFS support */ @@ -734,6 +742,10 @@ out: #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" @@ -823,6 +835,8 @@ 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 */ @@ -854,6 +868,8 @@ void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, #define MOAL_TIMER_1S 1000 /** 1 milisecond */ #define MOAL_TIMER_1MS 1 +/** scan timeout set to 25 seconds */ +#define SCAN_TIMEOUT_25S 25000 /** passive scan time */ #define PASSIVE_SCAN_CHAN_TIME 110 @@ -876,7 +892,7 @@ void woal_process_chan_event(moal_private *priv, t_u8 type, t_u8 channel, /** 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 @@ -970,7 +986,7 @@ typedef struct _wait_queue { /** 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 @@ -1242,6 +1258,36 @@ struct mcast_node { 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; @@ -1360,8 +1406,6 @@ struct _moal_private { struct workqueue_struct *mclist_workqueue; /** mclist work */ struct work_struct mclist_work; - /** Scan deferred work*/ - struct delayed_work scan_deferred_work; /** Statistics of tcp ack tx dropped */ t_u32 tcp_ack_drop_cnt; /** Statistics of tcp ack tx in total from kernel */ @@ -1385,6 +1429,14 @@ struct _moal_private { 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 */ @@ -1652,6 +1704,7 @@ struct _moal_private { 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 @@ -1958,8 +2011,8 @@ typedef struct woal_priv_fw_roam_offload_cfg { #ifdef STA_CFG80211 int woal_set_clear_pmk(moal_private *priv, t_u8 action); #endif -mlan_status woal_config_fw_roaming(moal_private *priv, t_u8 cfg_mode, - woal_roam_offload_cfg *roam_offload_cfg); +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 @@ -2076,6 +2129,7 @@ typedef struct _moal_mod_para { t_u8 flag; char *fw_name; int fw_reload; + int auto_fw_reload; char *mac_addr; #ifdef MFG_CMD_SUPPORT int mfg_mode; @@ -2159,6 +2213,7 @@ typedef struct _moal_mod_para { int dfs53cfg; t_u8 mcs32; + int keep_previous_scan; } moal_mod_para; void woal_tp_acnt_timer_func(void *context); @@ -2406,6 +2461,8 @@ struct _moal_handle { 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 */ @@ -2526,6 +2583,12 @@ struct _moal_handle { #ifdef STA_CFG80211 /** CFG80211 scan request description */ struct cfg80211_scan_request *scan_request; + /** fake scan flag */ + u8 fake_scan_complete; + /** Scan timeout work*/ + struct delayed_work scan_timeout_work; + /** scan timeout time */ + t_u32 scan_timeout; #endif #endif /** main state */ @@ -3331,7 +3394,7 @@ mlan_status woal_set_get_gen_ie(moal_private *priv, t_u32 action, t_u8 *ie, #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, @@ -3531,7 +3594,7 @@ mlan_status woal_set_wapi_enable(moal_private *priv, t_u8 wait_option, /** 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 @@ -3635,7 +3698,9 @@ t_void woal_main_work_queue(struct work_struct *work); t_void woal_rx_work_queue(struct work_struct *work); t_void woal_evt_work_queue(struct work_struct *work); t_void woal_mclist_work_queue(struct work_struct *work); -t_void woal_scan_deferred_work_queue(struct work_struct *work); +#ifdef STA_CFG80211 +t_void woal_scan_timeout_handler(struct work_struct *work); +#endif netdev_tx_t woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); #ifdef STA_SUPPORT diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c index 90dfd3c..c0bfbc9 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c @@ -28,6 +28,10 @@ Change log: #include +#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) @@ -308,6 +312,15 @@ static mlan_status woal_do_flr(moal_handle *handle, bool prepare, bool flr_flag) #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 */ @@ -468,7 +481,11 @@ static int woal_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) 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) { @@ -2377,9 +2394,11 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) } } #endif + phandle->fw_dump = MFALSE; + if (!phandle->priv_num) + return; woal_send_fw_dump_complete_event( woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); - phandle->fw_dump = MFALSE; mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); queue_work(phandle->workqueue, &phandle->main_work); woal_process_hang(phandle); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_priv.c b/mxm_wifiex/wlan_src/mlinux/moal_priv.c index dd9d4ad..1afc77e 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_priv.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_priv.c @@ -4740,6 +4740,7 @@ static int woal_set_user_scan_ext_ioctl(moal_private *priv, struct iwreq *wrq) MIN(wrq->u.data.length, sizeof(wlan_user_scan_cfg)))) { PRINTM(MINFO, "Copy from user failed\n"); + kfree(scan_req); LEAVE(); return -EFAULT; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_proc.c b/mxm_wifiex/wlan_src/mlinux/moal_proc.c index 252df84..4d082e1 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_proc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_proc.c @@ -459,7 +459,7 @@ static int parse_cmd52_string(const char *buffer, size_t len, int *func, 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; @@ -769,7 +769,7 @@ static int woal_config_read(struct seq_file *sfp, void *data) 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], diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c index f3d2ce0..3f19491 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c @@ -1826,7 +1826,7 @@ void woal_dump_firmware_info(moal_handle *phandle) 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++) { @@ -1838,7 +1838,7 @@ void woal_dump_firmware_info(moal_handle *phandle) if (dbg_ptr < end_ptr) dbg_ptr++; else - PRINTM(MMSG, + PRINTM(MINFO, "pre-allocced buf is not enough\n"); } switch (ctrl_data) { @@ -2035,7 +2035,7 @@ void woal_dump_firmware_info_v2(moal_handle *phandle) if (dbg_ptr < end_ptr) dbg_ptr++; else - PRINTM(MMSG, + PRINTM(MINFO, "pre-allocced buf is not enough\n"); } if (RDWR_STATUS_DONE == stat) { @@ -2181,27 +2181,30 @@ void woal_dump_firmware_info_v3(moal_handle *phandle) } 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 += 0x2000; end_ptr = pmem_type_mapping_tbl->mem_Ptr + memory_size; } @@ -2331,6 +2334,9 @@ static void woal_sdiommc_dump_fw_info(moal_handle *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) { @@ -2350,9 +2356,11 @@ static void woal_sdiommc_dump_fw_info(moal_handle *phandle) woal_dump_firmware_info(phandle); } #endif + phandle->fw_dump = MFALSE; + if (!phandle->priv_num) + return; woal_send_fw_dump_complete_event( woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); - phandle->fw_dump = MFALSE; mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); queue_work(phandle->workqueue, &phandle->main_work); woal_process_hang(phandle); @@ -2471,11 +2479,14 @@ void woal_sdio_reset_hw(moal_handle *handle) 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/mxm_wifiex/wlan_src/mlinux/moal_shim.c b/mxm_wifiex/wlan_src/mlinux/moal_shim.c index 41fa7a2..035119f 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_shim.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_shim.c @@ -97,6 +97,9 @@ mlan_status moal_malloc(t_void *pmoal, t_u32 size, t_u32 flag, t_u8 **ppbuf) GFP_ATOMIC : GFP_KERNEL; + if (flag & MLAN_MEM_FLAG_ATOMIC) + mem_flag = GFP_ATOMIC; + #ifdef USB if (!IS_USB(handle->card_type)) #endif @@ -1679,6 +1682,11 @@ mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) 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; @@ -1706,7 +1714,7 @@ mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) 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; } @@ -1802,7 +1810,7 @@ mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) } } 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); @@ -2186,8 +2194,8 @@ 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) { @@ -2320,12 +2328,18 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) 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, 12, 0) +#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; @@ -2338,6 +2352,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) } 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; @@ -2473,6 +2488,9 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) &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, @@ -2594,11 +2612,20 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #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; } @@ -2906,13 +2933,15 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) 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)); @@ -3012,6 +3041,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) 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]; @@ -3041,17 +3071,38 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) 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_channel_dfs_state( + woal_update_channels_dfs_state( + cfg_priv, priv->chan_rpt_req.chanNum, + priv->chan_rpt_req.bandcfg + .chanWidth, DFS_UNAVAILABLE); else - woal_update_channel_dfs_state( + woal_update_channels_dfs_state( + cfg_priv, priv->chan_rpt_req.chanNum, + priv->chan_rpt_req.bandcfg + .chanWidth, DFS_AVAILABLE); } +#endif break; } @@ -3077,6 +3128,34 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) &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, @@ -3097,6 +3176,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) 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)); @@ -3106,27 +3186,35 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #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_channel_dfs_state(radar_chan, - DFS_UNAVAILABLE); + 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; - } + 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) { @@ -3145,10 +3233,9 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); #else - cfg80211_cac_event( - priv->netdev, - NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); + cfg80211_cac_event(priv->netdev, + NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL); #endif cfg80211_radar_event( priv->wdev->wiphy, @@ -3229,7 +3316,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) pchan_info->bandcfg.chanBand, pchan_info->bandcfg.chanWidth, pchan_info->bandcfg.chan2Offset); - woal_cfg80211_notify_channel(priv, pchan_info); + woal_channel_switch_event(priv, pchan_info); } #endif } @@ -3367,7 +3454,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) PRINTM(MMSG, "Channel Under Nop: notify cfg80211 new channel=%d\n", priv->channel); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0); #else cfg80211_ch_switch_notify(priv->netdev, &priv->chan); @@ -3438,6 +3525,15 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #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; @@ -3692,7 +3788,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) PRINTM(MEVENT, "HostMlme %s: Receive deauth/disassociate\n", priv->netdev->name); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) if (!priv->wdev->connected) { #else if (!priv->wdev->current_bss) { @@ -4066,7 +4162,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) roam_info = kzalloc(sizeof(struct cfg80211_roam_info), GFP_ATOMIC); if (roam_info) { -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) roam_info->links[0].bssid = priv->cfg_bssid; #else roam_info->bssid = priv->cfg_bssid; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index 622f1af..6048071 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -103,7 +103,7 @@ static int woal_cfg80211_dump_survey(struct wiphy *wiphy, #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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) unsigned int link_id, #endif struct cfg80211_chan_def *chandef); @@ -279,6 +279,13 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy, 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 = { .change_virtual_intf = woal_cfg80211_change_virtual_intf, @@ -502,7 +509,7 @@ static const struct ieee80211_txrx_stypes // 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 @@ -923,7 +930,13 @@ static int woal_cfg80211_assoc_ies_cfg(moal_private *priv, t_u8 *ie, int ie_len, 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, @@ -1906,7 +1919,7 @@ static void woal_save_assoc_params(moal_private *priv, req->bss->bssid, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); if (req->ie && req->ie_len) { - priv->sme_current.ie = kzalloc(req->ie_len, GFP_KERNEL); + priv->sme_current.ie = kzalloc(req->ie_len, GFP_ATOMIC); priv->sme_current.ie_len = req->ie_len; moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.ie, req->ie, req->ie_len, priv->sme_current.ie_len); @@ -1931,6 +1944,7 @@ static void woal_save_assoc_params(moal_private *priv, #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, @@ -1952,6 +1966,7 @@ static void woal_save_auth_params(moal_private *priv, { 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; @@ -2401,8 +2416,7 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, 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) { @@ -2484,7 +2498,7 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, struct cfg80211_bss *bss = NULL; unsigned long flags; u8 *assoc_req_buf = NULL; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) struct cfg80211_rx_assoc_resp resp = { .uapsd_queues = -1, }; @@ -2528,10 +2542,7 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, 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; } @@ -2545,14 +2556,16 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, assoc_info ->assoc_req_buf; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) 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; + resp.req_ies_len = + assoc_info->assoc_req_len; mutex_lock(&priv->wdev->mtx); - cfg80211_rx_assoc_resp(priv->netdev, &resp); + cfg80211_rx_assoc_resp(priv->netdev, + &resp); mutex_unlock(&priv->wdev->mtx); #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) @@ -2691,6 +2704,7 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, } if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) { + kfree(ssid_bssid); LEAVE(); return -EBUSY; } @@ -2814,12 +2828,9 @@ done: 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; @@ -2849,8 +2860,7 @@ done: 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; @@ -4207,13 +4217,33 @@ static mlan_status woal_uap_scan(moal_private *priv, 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; } } @@ -4228,12 +4258,22 @@ static mlan_status woal_uap_scan(moal_private *priv, woal_sched_timeout(5); #ifdef REASSOCIATION MOAL_REL_SEMAPHORE(&handle->reassoc_sem); -done: #endif - 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); +done: + 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; } @@ -4405,12 +4445,13 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, #endif #endif #endif + cancel_delayed_work(&priv->phandle->scan_timeout_work); + priv->phandle->fake_scan_complete = priv->fake_scan_complete; if (priv->fake_scan_complete) { - PRINTM(MEVENT, - "scan result not expired or fake scan complete flag is on\n"); + PRINTM(MEVENT, "fake scan complete flag is on\n"); priv->phandle->scan_request = request; queue_delayed_work(priv->phandle->evt_workqueue, - &priv->scan_deferred_work, + &priv->phandle->scan_timeout_work, msecs_to_jiffies(1000)); return ret; } @@ -4441,6 +4482,11 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, 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)) { @@ -4472,6 +4518,7 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, if (scan_req->scan_chan_gap && priv->phandle->pref_mac) scan_req->scan_chan_gap |= GAP_FLAG_OPTIONAL; + scan_req->scan_cfg_only = MTRUE; if (scan_cfg.ext_scan == 3) scan_req->ext_scan_type = EXT_SCAN_ENHANCE; @@ -4576,11 +4623,17 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, } } 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) { @@ -4615,7 +4668,9 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, 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"); @@ -4629,8 +4684,13 @@ done: 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, + &priv->phandle->scan_timeout_work, + msecs_to_jiffies(priv->phandle->scan_timeout)); + } kfree(scan_req); LEAVE(); return ret; @@ -5099,6 +5159,7 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, "wlan: already connected with other interface, bssid " MACSTR "\n", MAC2STR(handle->priv[i]->cfg_bssid)); + kfree(ssid_bssid); LEAVE(); return -EINVAL; } @@ -5126,6 +5187,7 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, "Init p2p client for wpa_supplicant failed.\n"); ret = -EFAULT; + kfree(ssid_bssid); LEAVE(); return ret; } @@ -5186,8 +5248,7 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, 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; @@ -5319,7 +5380,7 @@ static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, 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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) if (priv->wdev->connected && #else if (priv->wdev->current_bss && @@ -5365,8 +5426,7 @@ static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, #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(); @@ -5651,7 +5711,7 @@ done: #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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) unsigned int link_id, #endif struct cfg80211_chan_def *chandef) @@ -6359,11 +6419,16 @@ int woal_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, } } 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 @@ -6382,18 +6447,20 @@ int woal_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, 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; - priv->scan_cfg.mid_period = - request->scan_plans[1].interval * 1000; + /*Mid scan interval in seconds*/ + priv->scan_cfg.mid_period = request->scan_plans[1].interval; 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 * 1000; + request->scan_plans[2].interval; priv->scan_cfg.low_period_count = request->scan_plans[2].iterations; } @@ -6544,8 +6611,12 @@ int woal_cfg80211_resume(struct wiphy *wiphy) } } - 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)) @@ -7366,8 +7437,12 @@ static int woal_construct_tdls_data_frame(moal_private *priv, t_u8 *peer, switch (action_code) { case WLAN_TDLS_SETUP_REQUEST: setup_flag |= TDLS_IE_FLAGS_SETUP; - woal_tdls_get_ies(priv, peer, tdls_ies, setup_flag); - + 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)); @@ -7377,8 +7452,12 @@ static int woal_construct_tdls_data_frame(moal_private *priv, t_u8 *peer, woal_add_ext_supported_rates_ie(priv, skb, band); break; case WLAN_TDLS_SETUP_RESPONSE: - woal_tdls_get_ies(priv, peer, tdls_ies, setup_flag); - + 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; @@ -7391,8 +7470,12 @@ static int woal_construct_tdls_data_frame(moal_private *priv, t_u8 *peer, woal_add_ext_supported_rates_ie(priv, skb, band); break; case WLAN_TDLS_SETUP_CONFIRM: - woal_tdls_get_ies(priv, peer, tdls_ies, confirm_flag); - + 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; @@ -7630,9 +7713,16 @@ static int woal_construct_tdls_action_frame(moal_private *priv, t_u8 *peer, 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 = @@ -8531,7 +8621,7 @@ int woal_cfg80211_update_ft_ies(struct wiphy *wiphy, struct net_device *dev, passoc_rsp = (IEEEtypes_AssocRsp_t *) assoc_rsp->assoc_resp_buf; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) roam_info.links[0].bssid = priv->cfg_bssid; #else roam_info.bssid = priv->cfg_bssid; @@ -9003,7 +9093,7 @@ void woal_start_roaming(moal_private *priv) } #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) roam_info.links[0].bssid = priv->cfg_bssid; #else roam_info.bssid = priv->cfg_bssid; @@ -9042,7 +9132,9 @@ done: 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; } @@ -9082,11 +9174,10 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, if (params->ext_capab_len) req_len += sizeof(MrvlIEtypesHeader_t) + params->ext_capab_len; #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) 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) + @@ -9094,34 +9185,39 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, #endif if (params->uapsd_queues || params->max_sp) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(qosinfo); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.ht_capa) #else if (params->ht_capa) #endif req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(struct ieee80211_ht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.vht_capa) #else if (params->vht_capa) #endif req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(struct ieee80211_vht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.opmode_notif_used) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8); -#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) +#else if (params->opmode_notif_used) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8); #endif +#endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.he_capa_len) - req_len += sizeof(MrvlExtIEtypesHeader_t) + params->link_sta_params.he_capa_len; -#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + 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) { @@ -9169,21 +9265,22 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) 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(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) 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(5, 19, 0) - params->link_sta_params.supported_rates, tlv->header.len, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + params->link_sta_params.supported_rates, + tlv->header.len, #else params->supported_rates, tlv->header.len, #endif @@ -9205,7 +9302,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.ht_capa) { #else if (params->ht_capa) { @@ -9213,8 +9310,9 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = HT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_ht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) - moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.ht_capa, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + 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 @@ -9224,7 +9322,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.vht_capa) { #else if (params->vht_capa) { @@ -9232,8 +9330,9 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = VHT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_vht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) - moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.vht_capa, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + 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 @@ -9244,7 +9343,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) if (params->link_sta_params.opmode_notif_used) { #else if (params->opmode_notif_used) { @@ -9252,8 +9351,9 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = OPER_MODE_NTF; tlv->header.len = sizeof(u8); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) - moal_memcpy_ext(priv->phandle, tlv->data, ¶ms->link_sta_params.opmode_notif, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + 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 @@ -9264,18 +9364,22 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) 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.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, + (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; + 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; + sizeof(MrvlExtIEtypesHeader_t) + + params->link_sta_params.he_capa_len; tlv = (MrvlIEtypes_Data_t *)pos; } #elif CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) @@ -9604,7 +9708,13 @@ static mlan_status woal_cfg80211_init_wiphy(moal_private *priv, 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); @@ -9976,7 +10086,16 @@ mlan_status woal_register_cfg80211(moal_private *priv) 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; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.c b/mxm_wifiex/wlan_src/mlinux/moal_uap.c index 063728b..16808fe 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.c @@ -834,6 +834,7 @@ static int woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) 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; @@ -889,14 +890,14 @@ static int woal_uap_domain_info(struct net_device *dev, struct ifreq *req) 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) { @@ -921,6 +922,7 @@ static int woal_uap_domain_info(struct net_device *dev, struct ifreq *req) 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; @@ -1080,8 +1082,6 @@ done: return ret; } -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) /** * @brief uap channel NOP status check ioctl handler * @@ -1135,8 +1135,6 @@ done: LEAVE(); return ret; } -#endif -#endif /** * @brief configure channel switch count @@ -2153,6 +2151,105 @@ done: 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 @@ -2173,7 +2270,9 @@ static int woal_uap_skip_cac(struct net_device *dev, struct ifreq *req) #endif #endif dfs_state_t dfs_state; - mlan_ds_11h_chan_dfs_state ch_dfs_state; + mlan_ds_11h_chan_dfs_state ch_dfs_state[4]; + t_u8 n_chan; + int i = 0; ENTER(); /* Sanity check */ @@ -2194,27 +2293,39 @@ static int woal_uap_skip_cac(struct net_device *dev, struct ifreq *req) else dfs_state = DFS_USABLE; memset(&ch_dfs_state, 0, sizeof(ch_dfs_state)); - ch_dfs_state.channel = param.channel; - woal_11h_chan_dfs_state(priv, MLAN_ACT_GET, &ch_dfs_state); - if (ch_dfs_state.dfs_state == dfs_state) - goto done; - if (param.skip_cac && ch_dfs_state.dfs_state == DFS_USABLE) - PRINTM(MMSG, - "DFS: Requst skip cac on the channel %d which hasn't do CAC before!\n", - param.channel); - ch_dfs_state.dfs_state = dfs_state; - woal_11h_chan_dfs_state(priv, MLAN_ACT_SET, &ch_dfs_state); - PRINTM(MCMND, "DFS: Skip CAC on chan %d %d\n", param.channel, - param.skip_cac); + 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); + } + 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)) { - if (param.skip_cac) - woal_update_channel_dfs_state(param.channel, - DFS_AVAILABLE); - else - woal_update_channel_dfs_state(param.channel, - DFS_USABLE); + 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 @@ -2791,8 +2902,8 @@ done: * * @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; @@ -3192,8 +3303,10 @@ static mlan_status woal_enable_wapi(moal_private *priv, t_u8 enable) "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); @@ -3224,7 +3337,11 @@ static int woal_uap_set_wapi_flag_ioctl(moal_private *priv, wapi_msg *msg) 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) { @@ -4235,12 +4352,7 @@ int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) 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; @@ -4257,7 +4369,9 @@ int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) || 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); @@ -4298,6 +4412,11 @@ int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) 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; @@ -4312,8 +4431,12 @@ int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data) 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: diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.h b/mxm_wifiex/wlan_src/mlinux/moal_uap.h index d0c5ff3..06415f4 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.h @@ -207,6 +207,8 @@ typedef struct _skip_cac_para { t_u16 skip_cac; /** channel */ t_u8 channel; + /** bandwidth */ + t_u8 bw; } skip_cac_para; /** radio control command */ @@ -532,12 +534,23 @@ typedef struct _domain_info_param { #define MAX_DOMAIN_TLV_LEN \ (TLV_HEADER_LEN + COUNTRY_CODE_LEN + (SUB_BAND_LEN * MAX_SUB_BANDS)) +/** 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 -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); void woal_uap_set_multicast_list(struct net_device *dev); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) @@ -548,12 +561,10 @@ 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); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c index f195b39..2c1b75a 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c @@ -94,7 +94,7 @@ done: 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; @@ -120,8 +120,10 @@ static int woal_deauth_assoc_station(moal_private *priv, u8 *mac_addr, 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)); @@ -613,7 +615,8 @@ static t_u16 woal_get_htcap_info(const t_u8 *ie, int len) /* 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; } @@ -984,6 +987,7 @@ static int woal_cfg80211_beacon_config(moal_private *priv, 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) { @@ -1359,12 +1363,20 @@ static int woal_cfg80211_beacon_config(moal_private *priv, (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); @@ -2336,26 +2348,30 @@ int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, } } if (vir_priv && vir_priv->bss_type == MLAN_BSS_TYPE_UAP) { -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) - woal_cfg80211_del_beacon(wiphy, dev, 0); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) + if (woal_cfg80211_del_beacon(wiphy, dev, 0)) #else - woal_cfg80211_del_beacon(wiphy, dev); + 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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) vir_priv->wdev->links[0].ap.beacon_interval = 0; #else vir_priv->wdev->beacon_interval = 0; #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) memset(&vir_priv->wdev->links[0].ap.chandef, 0, sizeof(vir_priv->wdev->links[0].ap.chandef)); -#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#else memset(&vir_priv->wdev->chandef, 0, sizeof(vir_priv->wdev->chandef)); #endif #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) vir_priv->wdev->u.ap.ssid_len = 0; #else vir_priv->wdev->ssid_len = 0; @@ -2534,8 +2550,8 @@ int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 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; @@ -2634,8 +2650,9 @@ done: * * @return 0 -- success, otherwise fail */ -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) -int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) +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 @@ -2672,7 +2689,9 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 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); @@ -2689,13 +2708,13 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) #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; } @@ -2782,7 +2801,10 @@ int woal_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, 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; @@ -2794,9 +2816,12 @@ int woal_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, 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); @@ -2843,29 +2868,7 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, 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; - } -#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(); @@ -2881,14 +2884,17 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, /** we will not send deauth to p2p interface, it might cause WPS failure */ - if (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; @@ -2956,11 +2962,14 @@ int woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, 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; + 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; @@ -3128,7 +3137,8 @@ int woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev, 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, @@ -3136,8 +3146,11 @@ int woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev, 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; } @@ -3225,6 +3238,103 @@ int woal_cfg80211_set_txq_params(struct wiphy *wiphy, struct net_device *dev, } #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. @@ -3267,8 +3377,7 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) 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; } @@ -3318,8 +3427,7 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) 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; } @@ -3328,7 +3436,7 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) 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, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0); #else cfg80211_ch_switch_notify(priv->netdev, &priv->chan); @@ -3377,7 +3485,9 @@ void woal_process_cancel_chanrpt_event(moal_private *priv) 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); @@ -3402,7 +3512,6 @@ void woal_process_cancel_chanrpt_event(moal_private *priv) * @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, @@ -3543,15 +3652,12 @@ int woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 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*/ if (cfg80211_chandef_identical(¶ms->chandef, &priv->chan)) { PRINTM(MMSG, @@ -3631,8 +3737,7 @@ mlan_status woal_register_uap_cfg80211(struct net_device *dev, t_u8 bss_type) return MLAN_STATUS_FAILURE; } - if (bss_type == MLAN_BSS_TYPE_UAP) - wdev->iftype = NL80211_IFTYPE_AP; + wdev->iftype = NL80211_IFTYPE_STATION; dev_net_set(dev, wiphy_net(wdev->wiphy)); dev->ieee80211_ptr = wdev; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c index 72914f8..c74e542 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c @@ -736,7 +736,10 @@ static int woal_get_encode(struct net_device *dev, struct iw_request_info *info, 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; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_wext.c b/mxm_wifiex/wlan_src/mlinux/moal_wext.c index dbdcc0f..7e91899 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_wext.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_wext.c @@ -2680,6 +2680,38 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, 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, @@ -3092,9 +3124,6 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, current_ev = IWE_STREAM_ADD_POINT( info, current_ev, end_buf, &iwe, buf); - current_val = current_ev + - IW_EV_LCP_LEN + - strlen(buf); break; #endif default: @@ -3114,9 +3143,9 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, 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); @@ -3124,7 +3153,6 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, 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; @@ -3260,6 +3288,11 @@ void woal_send_iwevcustom_event(moal_private *priv, char *str) 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)); diff --git a/mxm_wifiex/wlan_src/script/unload b/mxm_wifiex/wlan_src/script/unload index 1251e58..4f2a306 100644 --- a/mxm_wifiex/wlan_src/script/unload +++ b/mxm_wifiex/wlan_src/script/unload @@ -3,6 +3,8 @@ ifconfig mlan0 down ifconfig uap0 down ifconfig mmlan0 down ifconfig muap0 down +ifconfig uap1 down +ifconfig muap1 down ifconfig wfd0 down ifconfig wfd1 down ifconfig mwfd0 down