mwifiex: 8997: add W16.68.10.p16 release sdk

The sdk release is from NXP offial web:
https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth/
88w8997-wi-fi-dual-band-with-bluetooth-5-for-a-v-streaming-and-digital-tv:88W8997?tab=Design_Tools_Tab

The release file is:
PCIE-WLAN-UART-BT-8997-U16-X86-W16.68.10.p16-16.26.10.p16-C4X16640_V4-MGPL

The sdk version is: W16.68.10.p16

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
This commit is contained in:
Fugang Duan 2020-01-13 10:09:32 +08:00
commit bd8827d169
176 changed files with 272625 additions and 0 deletions

580
mwifiex_8997/Makefile Executable file
View File

@ -0,0 +1,580 @@
# File: Makefile
#
# Copyright (C) 2008-2019, Marvell International Ltd.
#
# This software file (the "File") is distributed by Marvell International
# Ltd. under the terms of the GNU General Public License Version 2, June 1991
# (the "License"). You may use, redistribute and/or modify this 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.
#
# A copy of the GPL is available in file gpl-2.0.txt accompanying in this
# deliverables.
#
# 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.
COMPATDIR=/lib/modules/$(KERNELVERSION_X86)/build/compat-wireless-3.2-rc1-1/include
CC= $(CROSS_COMPILE)gcc -I$(COMPATDIR)
LD= $(CROSS_COMPILE)ld
BACKUP= /root/backup
YMD= `date +%Y%m%d%H%M`
ifneq ($(COMPAT_VERSION_CODE),)
DRV_DIR ?= $(shell pwd)
export DRV_DIR
COMPAT_VERSION=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$1}')
COMPAT_PATCHLEVEL=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$2}')
COMPAT_SUBLEVEL=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$3}')
DECL_HEADER_FILE=$(DRV_DIR)/mlinux/moal_main.h
$(shell sed -i 's/COMPAT_VERSION_CODE KERNEL_VERSION.*/COMPAT_VERSION_CODE KERNEL_VERSION(\
$(COMPAT_VERSION), $(COMPAT_PATCHLEVEL), $(COMPAT_SUBLEVEL))/g' $(DECL_HEADER_FILE))
endif
#############################################################################
# Configuration Options
#############################################################################
# Debug Option
# DEBUG LEVEL n/1/2:
# n: NO DEBUG
# 1: Only PRINTM(MMSG,...), PRINTM(MFATAL,...), ...
# 2: All PRINTM()
CONFIG_DEBUG=1
# Proc debug file
CONFIG_PROC_DEBUG=y
# Enable STA mode support
CONFIG_STA_SUPPORT=y
# Enable uAP mode support
CONFIG_UAP_SUPPORT=y
# Enable WIFIDIRECT support
CONFIG_WIFI_DIRECT_SUPPORT=y
# Enable WIFIDISPLAY support
CONFIG_WIFI_DISPLAY_SUPPORT=y
# Re-association in driver
CONFIG_REASSOCIATION=y
# Manufacturing firmware support
CONFIG_MFG_CMD_SUPPORT=y
# OpenWrt support
CONFIG_OPENWRT_SUPPORT=n
# Big-endian platform
CONFIG_BIG_ENDIAN=n
ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y)
CONFIG_EMBEDDED_SUPP_AUTH=y
else
ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR), y)
CONFIG_EMBEDDED_SUPP_AUTH=y
endif
endif
# DFS testing support
CONFIG_DFS_TESTING_SUPPORT=y
# Multi-channel support
CONFIG_MULTI_CHAN_SUPPORT=y
CONFIG_ANDROID_KERNEL=n
#32bit app over 64bit kernel support
CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=n
#############################################################################
# Select Platform Tools
#############################################################################
MODEXT = ko
ccflags-y += -I$(M)/mlan
ccflags-y += -DLINUX
KERNELVERSION_X86 := $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KERNELVERSION_X86)/build
LD += -S
BINDIR = ../bin_pcie8997
APPDIR= $(shell if test -d "mapp"; then echo mapp; fi)
#############################################################################
# Compiler Flags
#############################################################################
ccflags-y += -I$(KERNELDIR)/include
ccflags-y += -DFPNUM='"68"'
ifeq ($(CONFIG_DEBUG),1)
ccflags-y += -DDEBUG_LEVEL1
endif
ifeq ($(CONFIG_DEBUG),2)
ccflags-y += -DDEBUG_LEVEL1
ccflags-y += -DDEBUG_LEVEL2
DBG= -dbg
endif
ifeq ($(CONFIG_PROC_DEBUG),y)
ccflags-y += -DPROC_DEBUG
export CONFIG_PROC_DEBUG
endif
ifeq ($(CONFIG_64BIT), y)
ccflags-y += -DMLAN_64BIT
endif
ifeq ($(CONFIG_STA_SUPPORT),y)
ccflags-y += -DSTA_SUPPORT
ifeq ($(CONFIG_REASSOCIATION),y)
ccflags-y += -DREASSOCIATION
endif
else
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_WIFI_DISPLAY_SUPPORT=n
CONFIG_STA_WEXT=n
CONFIG_STA_CFG80211=n
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ccflags-y += -DUAP_SUPPORT
else
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_WIFI_DISPLAY_SUPPORT=n
CONFIG_UAP_WEXT=n
CONFIG_UAP_CFG80211=n
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
ccflags-y += -DWIFI_DIRECT_SUPPORT
endif
ifeq ($(CONFIG_WIFI_DISPLAY_SUPPORT),y)
ccflags-y += -DWIFI_DISPLAY_SUPPORT
endif
ifeq ($(CONFIG_MFG_CMD_SUPPORT),y)
ccflags-y += -DMFG_CMD_SUPPORT
endif
ifeq ($(CONFIG_BIG_ENDIAN),y)
ccflags-y += -DBIG_ENDIAN_SUPPORT
endif
ifeq ($(CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT),y)
ccflags-y += -DUSERSPACE_32BIT_OVER_KERNEL_64BIT
endif
ifeq ($(CONFIG_MULTI_CHAN_SUPPORT),y)
ccflags-y += -DMULTI_CHAN_SUPPORT
endif
ifeq ($(CONFIG_DFS_TESTING_SUPPORT),y)
ccflags-y += -DDFS_TESTING_SUPPORT
endif
ifeq ($(CONFIG_ANDROID_KERNEL), y)
ccflags-y += -DANDROID_KERNEL
endif
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ccflags-y += -DOPENWRT
endif
ifeq ($(CONFIG_T50), y)
ccflags-y += -DT50
ccflags-y += -DT40
ccflags-y += -DT3T
endif
# add -Wno-packed-bitfield-compat when GCC version greater than 4.4
GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc )
ifeq ($(GCC_VERSION),1)
ccflags-y += -Wno-packed-bitfield-compat
endif
#############################################################################
# Make Targets
#############################################################################
ifneq ($(KERNELRELEASE),)
ifeq ($(CONFIG_WIRELESS_EXT),y)
ifeq ($(CONFIG_WEXT_PRIV),y)
# Enable WEXT for STA
CONFIG_STA_WEXT=y
# Enable WEXT for uAP
CONFIG_UAP_WEXT=y
else
# Disable WEXT for STA
CONFIG_STA_WEXT=n
# Disable WEXT for uAP
CONFIG_UAP_WEXT=n
endif
endif
# Enable CFG80211 for STA
ifeq ($(CONFIG_CFG80211),y)
CONFIG_STA_CFG80211=y
else
ifeq ($(CONFIG_CFG80211),m)
CONFIG_STA_CFG80211=y
else
CONFIG_STA_CFG80211=n
endif
endif
# OpenWrt
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ifeq ($(CPTCFG_CFG80211),y)
CONFIG_STA_CFG80211=y
else
ifeq ($(CPTCFG_CFG80211),m)
CONFIG_STA_CFG80211=y
else
CONFIG_STA_CFG80211=n
endif
endif
endif
# Enable CFG80211 for uAP
ifeq ($(CONFIG_CFG80211),y)
CONFIG_UAP_CFG80211=y
else
ifeq ($(CONFIG_CFG80211),m)
CONFIG_UAP_CFG80211=y
else
CONFIG_UAP_CFG80211=n
endif
endif
# OpenWrt
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ifeq ($(CPTCFG_CFG80211),y)
CONFIG_UAP_CFG80211=y
else
ifeq ($(CPTCFG_CFG80211),m)
CONFIG_UAP_CFG80211=y
else
CONFIG_UAP_CFG80211=n
endif
endif
endif
ifneq ($(CONFIG_STA_SUPPORT),y)
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_WIFI_DISPLAY_SUPPORT=n
CONFIG_STA_WEXT=n
CONFIG_STA_CFG80211=n
endif
ifneq ($(CONFIG_UAP_SUPPORT),y)
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_WIFI_DISPLAY_SUPPORT=n
CONFIG_UAP_WEXT=n
CONFIG_UAP_CFG80211=n
endif
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_STA_WEXT),y)
ccflags-y += -DSTA_WEXT
endif
ifeq ($(CONFIG_STA_CFG80211),y)
ccflags-y += -DSTA_CFG80211
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ifeq ($(CONFIG_UAP_WEXT),y)
ccflags-y += -DUAP_WEXT
endif
ifeq ($(CONFIG_UAP_CFG80211),y)
ccflags-y += -DUAP_CFG80211
endif
endif
print:
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_STA_WEXT),n)
ifeq ($(CONFIG_STA_CFG80211),n)
@echo "Can not build STA without WEXT or CFG80211"
exit 2
endif
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ifeq ($(CONFIG_UAP_WEXT),n)
ifeq ($(CONFIG_UAP_CFG80211),n)
@echo "Can not build UAP without WEXT or CFG80211"
exit 2
endif
endif
endif
MOALOBJS = mlinux/moal_main.o \
mlinux/moal_ioctl.o \
mlinux/moal_shim.o \
mlinux/moal_eth_ioctl.o
MLANOBJS = mlan/mlan_shim.o mlan/mlan_init.o \
mlan/mlan_txrx.o \
mlan/mlan_cmdevt.o mlan/mlan_misc.o \
mlan/mlan_cfp.o \
mlan/mlan_module.o
MLANOBJS += mlan/mlan_wmm.o
MLANOBJS += mlan/mlan_pcie.o
MLANOBJS += mlan/mlan_11n_aggr.o
MLANOBJS += mlan/mlan_11n_rxreorder.o
MLANOBJS += mlan/mlan_11n.o
MLANOBJS += mlan/mlan_11ac.o
MLANOBJS += mlan/mlan_11d.o
MLANOBJS += mlan/mlan_11h.o
ifeq ($(CONFIG_STA_SUPPORT),y)
MLANOBJS += mlan/mlan_meas.o
MLANOBJS += mlan/mlan_scan.o \
mlan/mlan_sta_ioctl.o \
mlan/mlan_sta_rx.o \
mlan/mlan_sta_tx.o \
mlan/mlan_sta_event.o \
mlan/mlan_sta_cmd.o \
mlan/mlan_sta_cmdresp.o \
mlan/mlan_join.o
ifeq ($(CONFIG_STA_WEXT),y)
MOALOBJS += mlinux/moal_priv.o \
mlinux/moal_wext.o
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
MLANOBJS += mlan/mlan_uap_ioctl.o
MLANOBJS += mlan/mlan_uap_cmdevent.o
MLANOBJS += mlan/mlan_uap_txrx.o
MOALOBJS += mlinux/moal_uap.o
ifeq ($(CONFIG_UAP_WEXT),y)
MOALOBJS += mlinux/moal_uap_priv.o
MOALOBJS += mlinux/moal_uap_wext.o
endif
endif
ifeq ($(CONFIG_STA_CFG80211),y)
MOALOBJS += mlinux/moal_cfg80211.o
MOALOBJS += mlinux/moal_cfgvendor.o
MOALOBJS += mlinux/moal_sta_cfg80211.o
endif
ifeq ($(CONFIG_UAP_CFG80211),y)
MOALOBJS += mlinux/moal_cfg80211.o
MOALOBJS += mlinux/moal_cfgvendor.o
MOALOBJS += mlinux/moal_uap_cfg80211.o
endif
ifdef CONFIG_PROC_FS
MOALOBJS += mlinux/moal_proc.o
ifeq ($(CONFIG_PROC_DEBUG),y)
MOALOBJS += mlinux/moal_debug.o
endif
endif
ifeq ($(CONFIG_CONCURRENT_DRIVER),y)
obj-m := mlan_pcie.o
mlan_pcie-objs := $(MLANOBJS)
else
obj-m := mlan.o
mlan-objs := $(MLANOBJS)
endif
MOALOBJS += mlinux/moal_pcie.o
obj-m += pcie8xxx.o
pcie8xxx-objs := $(MOALOBJS)
# Otherwise we were called directly from the command line; invoke the kernel build system.
else
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
###############################################################
export CC LD ccflags-y KERNELDIR
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_UAP_SUPPORT),y)
.PHONY: mapp/mlanconfig mapp/mlan2040coex mapp/mlanevent mapp/uaputl mapp/mlanutl clean distclean
else
.PHONY: mapp/mlanconfig mapp/mlanevent mapp/mlan2040coex mapp/mlanutl clean distclean
endif
else
ifeq ($(CONFIG_UAP_SUPPORT),y)
.PHONY: mapp/mlanevent mapp/uaputl clean distclean
endif
endif
@echo "Finished Making Marvell Wlan Linux Driver"
ifeq ($(CONFIG_STA_SUPPORT),y)
mapp/mlanconfig:
$(MAKE) -C $@
mapp/mlanutl:
$(MAKE) -C $@
mapp/mlan2040coex:
$(MAKE) -C $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
mapp/uaputl:
$(MAKE) -C $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
mapp/wifidirectutl:
$(MAKE) -C $@
endif
mapp/mlanevent:
$(MAKE) -C $@
echo:
build: echo default
@if [ ! -d $(BINDIR) ]; then \
mkdir $(BINDIR); \
fi
ifeq ($(CONFIG_CONCURRENT_DRIVER),y)
cp -f mlan_pcie.$(MODEXT) $(BINDIR)/mlan_pcie$(DBG).$(MODEXT)
else
cp -f mlan.$(MODEXT) $(BINDIR)/mlan$(DBG).$(MODEXT)
endif
cp -f pcie8xxx.$(MODEXT) $(BINDIR)/pcie8997$(DBG).$(MODEXT)
cp -rpf script/pcie/* $(BINDIR)/
ifeq ($(CONFIG_STA_SUPPORT),y)
cp -f README $(BINDIR)
cp -f README_MLAN $(BINDIR)
cp -f README_RBC $(BINDIR)
ifeq ($(CONFIG_OPENWRT_SUPPORT),y)
cp -f README_OPENWRT $(BINDIR)
endif
ifneq ($(APPDIR),)
$(MAKE) -C mapp/mlanconfig $@ INSTALLDIR=$(BINDIR)
$(MAKE) -C mapp/mlanutl $@ INSTALLDIR=$(BINDIR)
$(MAKE) -C mapp/mlan2040coex $@ INSTALLDIR=$(BINDIR)
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
cp -f README_UAP $(BINDIR)
ifneq ($(APPDIR),)
$(MAKE) -C mapp/uaputl $@ INSTALLDIR=$(BINDIR)
endif
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
cp -f README_WIFIDIRECT $(BINDIR)
cp -rpf script/wifidirect $(BINDIR)
ifeq ($(CONFIG_WIFI_DISPLAY_SUPPORT),y)
cp -rpf script/wifidisplay $(BINDIR)
endif
ifneq ($(APPDIR),)
$(MAKE) -C mapp/wifidirectutl $@ INSTALLDIR=$(BINDIR)
endif
endif
ifneq ($(APPDIR),)
$(MAKE) -C mapp/mlanevent $@ INSTALLDIR=$(BINDIR)
endif
clean:
-find . -name "*.o" -exec rm {} \;
-find . -name "*.ko" -exec rm {} \;
-find . -name ".*.cmd" -exec rm {} \;
-find . -name "*.mod.c" -exec rm {} \;
-find . -name "Module.symvers" -exec rm {} \;
-find . -name "Module.markers" -exec rm {} \;
-find . -name "modules.order" -exec rm {} \;
-find . -name ".*.dwo" -exec rm {} \;
-find . -name "*dwo" -exec rm {} \;
-rm -rf .tmp_versions
ifneq ($(APPDIR),)
ifeq ($(CONFIG_STA_SUPPORT),y)
$(MAKE) -C mapp/mlanconfig $@
$(MAKE) -C mapp/mlanutl $@
$(MAKE) -C mapp/mlan2040coex $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
$(MAKE) -C mapp/uaputl $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
$(MAKE) -C mapp/wifidirectutl $@
endif
$(MAKE) -C mapp/mlanevent $@
endif
install: default
cp -f mlan.$(MODEXT) $(INSTALLDIR)/mlan$(DBG).$(MODEXT)
cp -f pcie8xxx.$(MODEXT) $(INSTALLDIR)/pcie8997$(DBG).$(MODEXT)
echo $(INSTALLDIR)
echo "pcie8997 Driver Installed"
distclean:
-find . -name "*.o" -exec rm {} \;
-find . -name "*.orig" -exec rm {} \;
-find . -name "*.swp" -exec rm {} \;
-find . -name "*.*~" -exec rm {} \;
-find . -name "*~" -exec rm {} \;
-find . -name "*.d" -exec rm {} \;
-find . -name "*.a" -exec rm {} \;
-find . -name "tags" -exec rm {} \;
-find . -name ".*" -exec rm -rf 2> /dev/null \;
-find . -name "*.ko" -exec rm {} \;
-find . -name ".*.cmd" -exec rm {} \;
-find . -name "*.mod.c" -exec rm {} \;
-find . -name ".*.dwo" -exec rm {} \;
-find . -name "*dwo" -exec rm {} \;
-rm -rf .tmp_versions
ifneq ($(APPDIR),)
ifeq ($(CONFIG_STA_SUPPORT),y)
$(MAKE) -C mapp/mlanconfig $@
$(MAKE) -C mapp/mlanutl $@
$(MAKE) -C mapp/mlan2040coex $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
$(MAKE) -C mapp/uaputl $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
$(MAKE) -C mapp/wifidirectutl $@
endif
$(MAKE) -C mapp/mlanevent $@
endif
# End of file

2225
mwifiex_8997/README Executable file

File diff suppressed because it is too large Load Diff

3649
mwifiex_8997/README_MLAN Executable file

File diff suppressed because it is too large Load Diff

356
mwifiex_8997/README_OPENWRT Executable file
View File

@ -0,0 +1,356 @@
=================================================================================
U S E R M A N U A L F O R OpenWrt
This section describes detailed steps to add Marvell Wireless NIC (sdio/usb/pcie)
driver to OpenWrt build system.
Add marvell driver (sdio/usb/pcie) to OpenWrt build system.
1. Go to the openwrt source code folder
2. make menuconfig
choose x86 platform
other general openwrt configurations please refer to:
https://wiki.openwrt.org/doc/howto/build
3. After make menuconfig
make sure that following configurations are set in .config
CONFIG_PACKAGE_hostapd=y
CONFIG_PACKAGE_hostapd-common=y
CONFIG_PACKAGE_kmod-cfg80211=y
4. Go to the openwrt source code folder and Compile openwrt BSP
make V=s [-j[number]]
5. After the first time compiling, openwrt/dl folder will be created
, related packages will be downloaded during compiling, so you need
network access as long as you need to compile openwrt BSP.
6. Go to the openwrt source code folder: openwrt/dl/
7. Find compat-wireless-xxxx-xx-xx.tar.bz2, and uncompress the package
8. Go to compat-wireless-xxxx-xx-xx/drivers/net/wireless/marvell/
9. Modify compat-wireless-xxxx-xx-xx/drivers/net/wireless/marvell/Kconfig
source "drivers/net/wireless/marvell/libertas/Kconfig"
source "drivers/net/wireless/marvell/libertas_tf/Kconfig"
source "drivers/net/wireless/marvell/mwifiex/Kconfig"
+source "drivers/net/wireless/marvell/mrvl-pcie/Kconfig"
+source "drivers/net/wireless/marvell/mrvl-sd8xxx/Kconfig"
+source "drivers/net/wireless/marvell/mrvl-usb/Kconfig"
10. Modify compat-wireless-xxxx-xx-xx/drivers/net/wireless/marvell/Makefile
obj-$(CPTCFG_LIBERTAS_THINFIRM) += libertas_tf/
obj-$(CPTCFG_MWIFIEX) += mwifiex/
+obj-$(CPTCFG_MRVL_PCIE) += mrvl-pcie/
+obj-$(CPTCFG_MRVL_SD8XXX) += mrvl-sd8xxx/
+obj-$(CPTCFG_MRVL_USB) += mrvl-usb/
11. Go to compat-wireless-xxxx-xx-xx/drivers/net/wireless/marvell/
12. mkdir (mrvl-pcie/mrvl-sd8xxx/mrvl-usb)
13. copy (pcie/sdio/usb)/wlan_src/* to (mrvl-pcie/mrvl-sd8xxx/mrvl-usb)
14. Go to mrvl-pcie/mrvl-sd8xxx/mrvl-usb
15. Add new Kconfig:
mrvl-pcie/Kconfig
+config MRVL_PCIE
+ tristate "Marvell Wireless Driver for PCIE 8997"
+ depends on m
+ depends on PCI
+ depends on CFG80211
+ depends on WIRELESS_EXT
+ ---help---
+ This adds support for wireless adapters based on Marvell
+ pcie 8997 chipsets with PCIe interface.
+
+ If you choose to build it as a module, it will be called
+ pcie8xxx.
mrvl-sd8xxx/Kconfig
+config MRVL_SD8XXX
+ tristate "Marvell sdio 802.11n/802.11ac Wireless cards"
+ depends on m
+ depends on MMC
+ depends on CFG80211
+ depends on WIRELESS_EXT
+ ---help---
+ A driver for Marvell sdio 802.11n/802.11ac Wireless cards.
mrvl-usb/Kconfig
+config MRVL_USB
+ tristate "Marvell sdio 802.11n/802.11ac Wireless cards"
+ depends on m
+ depends on USB
+ depends on CFG80211
+ depends on WIRELESS_EXT
+ ---help---
+ A driver for Marvell sdio 802.11n/802.11ac Wireless cards.
16. Open moal_main.h under (mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/mlinux/
find #define COMPAT_VERSION_CODE KERNEL_VERSION_CODE(x, x, x)
modify (x, x, x) to the kernel version code of backports/compat-wireless package
backported kernel version code could be found in
compat-wireless-xxxx-xx-xx/version as following
'BACKPORTED_KERNEL_VERSION="v4.4-rc5-1913-gc8fdf68"'
v4.4 means KERNEL_VERSION(4, 4, 0)
17. Modify (mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/Makefile
# OpenWrt support
-CONFIG_OPENWRT_SUPPORT=n
+CONFIG_OPENWRT_SUPPORT=y
...
#############################################################################
# Select Platform Tools
#############################################################################
MODEXT = ko
-ccflags-y += -I$(M)/mlan
+ccflags-y += -I$(M)/drivers/net/wireless/marvell/(mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/mlan
ccflags-y += -DLINUX
ifeq ($(CONFIG_EMBEDDED_SUPP_AUTH), y)
-ccflags-y += -I$(M)/mlan/esa
-ccflags-y += -I$(M)/mlan/esa/common
+ccflags-y += -I$(M)/drivers/net/wireless/marvell/(mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/mlan/esa
+ccflags-y += -I$(M)/drivers/net/wireless/marvell/(mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/mlan/esa/common
endif
18. compress compat-wireless-xxxx-xx-xx to its original .tar.bz2 format
19. Go to the openwrt source code folder: openwrt/package/kernel/mac80211/
20. Modify openwrt/package/kernel/mac80211/Makefile.
PKG_DRIVERS = \
adm8211 \
ath ath5k ath9k ath9k-common ath9k-htc ath10k \
b43 b43legacy \
carl9170 \
hermes hermes-pci hermes-pcmcia hermes-plx\
iwl-legacy iwl3945 iwl4965 iwlwifi \
lib80211 \
libipw ipw2100 ipw2200 \
libertas-sdio libertas-usb libertas-spi \
mac80211-hwsim \
mt7601u \
mwl8k mwifiex-pcie \
+mrvl-pcie \
+mrvl-sd8xxx \
+mrvl-usb \
p54-common p54-pci p54-spi p54-usb \
rt2x00-lib rt2x00-pci rt2x00-usb \
rt2400-pci rt2500-pci rt2500-usb \
...
+define KernelPackage/mrvl-pcie
+ $(call KernelPackage/mac80211/Default)
+ TITLE:=Marvell pcie wireless driver
+ URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
+ DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
+ FILES:= \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-pcie/mlan.ko \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-pcie/pcie8xxx.ko
+ AUTOLOAD:=$(call AutoProbe,mrvl-pcie)
+endef
+define KernelPackage/mrvl-pcie/description
+ Kernel modules for Marvell pcie 802.11n/802.11ac PCIe Wireless cards
+endef
+define KernelPackage/mrvl-sd8xxx
+ $(call KernelPackage/mac80211/Default)
+ DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT
+ TITLE:=Marvell sdio Wireless Driver
+ FILES:= \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-sd8xxx/mlan.ko \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-sd8xxx/sd8xxx.ko
+ AUTOLOAD:=$(call AutoProbe, mrvl-sd8xxx)
+endef
+define KernelPackage/mrvl-sd8xxx/description
+ Kernel modules for Marvell sdio 802.11n/802.11ac Wireless cards
+endef
+define KernelPackage/mrvl-usb
+ $(call KernelPackage/mac80211/Default)
+ DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
+ TITLE:=Marvell usb Wireless Driver
+ FILES:= \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-usb/mlan.ko \
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-usb/usb8xxx.ko
+ AUTOLOAD:=$(call AutoProbe, mrvl-usb)
+endef
+define KernelPackage/mrvl-usb/description
+ Kernel modules for Marvell usb 802.11n/802.11ac Wireless cards
+endef
...
config-$(call config_package,mwl8k) += MWL8K
config-$(call config_package,mwifiex-pcie) += MWIFIEX MWIFIEX_PCIE
+config-$(call config_package,mrvl-pcie) += MRVL_PCIE
+config-$(call config_package,mrvl-sd8xxx) += MRVL_SD8XXX
+config-$(call config_package,mrvl-usb) += MRVL_USB
config-$(call config_package,rtl8180) += RTL8180
config-$(call config_package,rtl8187) += RTL8187
...
$(eval $(call KernelPackage,mwl8k))
$(eval $(call KernelPackage,mwifiex-pcie))
+$(eval $(call KernelPackage,mrvl-pcie))
+$(eval $(call KernelPackage,mrvl-sd8xxx))
+$(eval $(call KernelPackage,mrvl-usb))
$(eval $(call KernelPackage,p54-common))
OpenWrt configuration
21. Go to OpenWrt srouce code folder
22. Make menuconfig
select one of the newly added marvell driver
│-> Kernel modules
│ -> Wireless Drivers
| ->mrvl-pcie
| ->mrvl-sd8xxx
| ->mrvl-usb
23. Other general configurations, please refer to the https://wiki.openwrt.org/doc/howto/build
24. after menucofig make soure that following configurations are seletect
CONFIG_PACKAGE_hostapd=y
CONFIG_PACKAGE_hostapd-common=y
CONFIG_PACKAGE_kmod-cfg80211=y
Go to openwrt folder and re-build openwrt BSP
make V=s [-j[number]]
After openwrt BSP is successfully build, kernel modules could be found
both in the build folder and the running OS once openwrt is boot up.
kernel modules will be written to u-disk while openwrt img is burned to u-disk.
kernel modules in openwrt build dir:
openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/linux-x86_64/compat-wireless-2016-01-10/
ipkg-x86_64/kmod-mrvl-(usb/sd8xxx/pcie)/lib/modules/3.18.45/
kernel modules in openwrt running OS:
/lib/modules/xx.xx.xx/
25. To support SDIO card in OpenWrt x86 platforma
Add following kernel configurations for OpenWrt
Go to OpenWrt source code foler
make kernel_menuconfig
Device Drivers---->
--- MMC/SD/SDIO card support
[ ] MMC debugging
[ ] MMC host clock gating
*** MMC/SD/SDIO Card Drivers ***
< > MMC block device driver
< > SDIO UART/GPS class support
< > MMC host test driver
*** MMC/SD/SDIO Host Controller Drivers ***
<*> Secure Digital Host Controller Interface support
<*> SDHCI support on PCI bus
[ ] Ricoh MMC Controller Disabler
< > SDHCI platform and OF driver helper
< > Winbond W83L51xD SD/MMC Card Interface support
< > TI Flash Media MMC/SD Interface support
< > ENE CB710 MMC/SD Interface support
< > VIA SD/MMC Card Reader Driver
< > Renesas USDHI6ROL0 SD/SDIO Host Controller support
Compile OpenWrt using Make V=s, then write openwrt img to u-disk and boot up
26. Bring up marvell wireless NIC on OpenWrt system
copy pcie/sdio/usb firmware to /lib/firmware/mrvl folder
On OpenWrt running OS
scp usrname@<target_pc ip address>:/path/firmware.bin /lib/firmware/mrvl
Another way is to add firmware binary to OpenWrt source code
27. load marvell pcie/sdio/usb driver modules
End with Marvell Wirelss NIC card bring up on OpenWrt
=======================================================================================================
If firmware is copied to OpenWrt via scp, following steps could be ignored.
28. Add firmware binary in OpenWrt
Copy pcie/usb/sdio firmware to folder:
openwrt/build_dir/target-x86_64_uClibc-0.9.33.2/linux-firmware-52442afee9907bc32a058f22bb3295d040677c26/mrvl/
29. Go to penwrt/package/firmware/linux-firmware
Modify marvell.mk as following
+Package/mrvl-pcie-firmware = $(call Package/firmware-default,Marvell PCIE8997 firmware)
+define Package/mrvl-pcie-firmware/install
+ $(INSTALL_DIR) $(1)/lib/firmware/mrvl
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/mrvl/pcieusb8997_combo_v4.bin \
+ $(1)/lib/firmware/mrvl/
+endef
+$(eval $(call BuildPackage,mrvl-pcie-firmware))
+Package/mrvl-sd8xxx-firmware = $(call Package/firmware-default,Marvell SDIO8997 firmware)
+define Package/mrvl-sd8xxx-firmware/install
+ $(INSTALL_DIR) $(1)/lib/firmware/mrvl
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/mrvl/sdsd8997_combo_v4.bin \
+ $(1)/lib/firmware/mrvl/
+endef
+$(eval $(call BuildPackage,mrvl-sd8xxx-firmware))
+Package/mrvl-usb-firmware = $(call Package/firmware-default,Marvell SDIO8997 firmware)
+define Package/mrvl-usb-firmware/install
+ $(INSTALL_DIR) $(1)/lib/firmware/mrvl
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/mrvl/usbusb8997_combo_v4.bin \
+ $(1)/lib/firmware/mrvl/
+endef
+$(eval $(call BuildPackage,mrvl-usb-firmware))
30. re-modify openwrt/package/kernel/mac80211/Makefile
for PCIE
+ DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mrvl-pcie-firmware
for SDIO
+ DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT +mrvl-sd8xxx-firmware
for USB
+ DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +mrvl-usb-firmware
31. Go to step 25.
=======================================================================================================
To support SDIO, USB and PCIE in one OpenWrt BSP
if no need to support multi bus types in one BSP, ignore the following steps
32. Re-modify Modify openwrt/package/kernel/mac80211/Makefile.
for PCIE
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-pcie/mlan-pcie.ko \
for SDIO
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-sd8xxx/mlan-sdio.ko \
for USB
+ $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mrvl-usb/mlan-usb.ko \
33. Re-modify (mrvl-pcie/mrvl-sd8xxx/mrvl-usb)/Makefile
for PCIE
-obj-m := mlan.o
-mlan-objs := $(MLANOBJS)
+obj-m := mlan-pcie.o
+mlan-pcie-objs := $(MLANOBJS)
for SDIO
-obj-m := mlan.o
-mlan-objs := $(MLANOBJS)
+obj-m := mlan-sdio.o
+mlan-sdio-objs := $(MLANOBJS)
for USB
-obj-m := mlan.o
-mlan-objs := $(MLANOBJS)
+obj-m := mlan-usb.o
+mlan-usb-objs := $(MLANOBJS)
34. Go to step 25.

103
mwifiex_8997/README_RBC Executable file
View File

@ -0,0 +1,103 @@
===============================================================================
U S E R M A N U A L for Robust BT-WLAN coex (RBC)
Copyright (C) 2014-2019, Marvell International Ltd.
All Rights Reserved
===============================================================================
###############################
# Abbreviations and acronyms
###############################
RBC - Robust BT-WLAN co-existence
TMD - Time Distribute
SMPS - Spatial Multiplexing Power Save
###############################
# Default RBC modes:
###############################
1. For systems where BT and WLAN have seperate antennas, RBC mode is
automatically disabled in FW after detecting this from FEM cal data. e.g.
For 1x1 Dual-Ant system and 2x2 3-Ant system RBC mode is disabled.
2. For systems where BT and WLAN share an antenna, RBC mode is automatically
enabled in FW after detecting this from FEM cal data.
Default modes:
1x1 single antenna system: TMD RBC
2x2 2-antenna system: 1x1 SMPS RBC
#################################
# 2x2 2-antenna system RBC modes
#################################
There are three mutually exclusive RBC modes for a 2x2 system.
The default RBC mode is 1x1 SMPS RBC. The required RBC mode must be
configured before starting uAP or associating in-STA. The mode cannot be
changed dynamically when any of these connections is active. The modes are
described below:
1. 1x1 SMPS RBC mode: WLAN switches to 1x1 FEM when BT is turned on. Also,
in-STA goes to SMPS mode w.r.t. ext-AP. When BT is turned off, WLAN
switches back to 2x2 FEM setting and in-STA moves out of SMPS.
uAP starts bss with only 1-stream even BT is off because it cannot
dynamically move between 1-stream and 2-stream rates like in-STA. To start
uAP with 2-stream, RBC mode has to be disabled.
2. 1x2 SMPS RBC mode: Similar as 1x1 SMPS RBC mode. WLAN switches to 1x2 FEM
when BT is turned on. In this mode, it is expected that when BT is not
actively transmitting, WLAN can receive on both the antennas to enhance
the range. Note that 1-stream rates are used for receive and transmit.
3. 2x2 TMD RBC mode: WLAN uses 2x2 antenna setting and timeshares the antenna
with BT.
###############################
# RBC mode select:
###############################
User can use robust_btc.conf and hostcmd to select different RBC mode:
hostcmd mode_get
hostcmd mode_timeshare
hostcmd mode_spatial
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)
Usage:
mlanconfig mlanX hostcmd config/robust_btc.conf mode_get
mlanconfig mlanX hostcmd config/robust_btc.conf mode_timeshare
mlanconfig mlanX hostcmd config/robust_btc.conf mode_spatial
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:
mlanconfig mlanX hostcmd config/robust_btc.conf gpio_cfg
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

2664
mwifiex_8997/README_UAP Executable file

File diff suppressed because it is too large Load Diff

448
mwifiex_8997/README_WIFIDIRECT Executable file
View File

@ -0,0 +1,448 @@
===============================================================================
S E T U P I N S T R U C T I O N S F O R *WifiDirect*
Driver,FW release:
1. Make sure, bg_scan.conf,uaputl.conf has SSID starting with "DIRECT-"
2. Download uAP configuration and BG scan configuration.
3. This version of wifidirectutl breaks the backward compatibility and will work
with following releases -
8797 >= 14.xx.16.p15
>= 14.xx.11.p138
8766 >= 14.xx.11.p138
8787 >= 14.xx.9.p89
However, In case one needs to run the utility in backward compatibility mode
he can do so by running following command before running the utility -
# export WIFIDIR_USE_FIXED_IE_INDICES=1
To disable backward comaptibility mode run following command -
# export WIFIDIR_USE_FIXED_IE_INDICES=0
WPSWIFIDIRECT release:
1. Modify the wifidirect.conf file to specify the correct HW addresses of
devices. The DUT mac address and peer mac address needs to be correctly
entered.
===============================================================================
U S E R M A N U A L F O R WIFIDIRECTUTL
NAME
wifidirectutl
This tool can be used to configure WifiDirect parameters.
------------------
Supported Commands
------------------
wifidirect_mode [MODE]
wifidirect_config [*.conf]
wifidirect_params_config [*.conf]
wifidirect_action_frame <*.conf> | [<PeerAddr> <Category> <OuiSubtype> <DialogToken>]
wifidirect_discovery_request <*.conf>
wifidirect_discovery_response <*.conf>
wifidirect_cfg_discovery_period [<MinDiscPeriod> <MaxDiscPeriod>]
wifidirect_cfg_intent [IntentValue]
wifidirect_cfg_capability [<DeviceCapability> <GroupCapability>]
wifidirect_cfg_noa <enable|disable> <index> [<counttype> <duration> <interval>]
wifidirect_cfg_opp_ps <enable|disable> [<CTWindow>]
wifidirect_cfg_invitation_list [mac_addr]
wifidirect_cfg_listen_channel [ListenChannel]
wifidirect_cfg_op_channel [OperatingChannel]
wifidirect_cfg_persistent_group_record [index] [role]
[<groupbss> <deviceId> <ssid> <psk>] [peermac1] [peermac2]
wifidirect_cfg_persistent_group_invoke [index] | <cancel>
wifidirect_cfg_presence_req_params [<type> <duration> <interval>]
wifidirect_cfg_ext_listen_time [<duration> <interval>]
wifidirect_cfg_provisioning_params [<action> <configMethods> <devicePassword>]
wifidirect_cfg_wps_params [<action>]
wifidirect_mode [mode]
----------
"./wifidirectutl <iface> wifidirect_mode [mode]"
This command is used to setup various modes for wifidirect device.
The mode 2 can be used only when wifidirect is started using mode 1.
The mode 3 should not be used for uAP.
The supported options are:
mode : 0 - stop wifidirect mode
1 - start wifidirect mode
2 - start wifidirect group owner mode
3 - start wifidirect client mode
4 - start wifidirect find phase
5 - stop wifidirect find phase
empty - Get current wifidirect mode
Example:
./wifidirectutl <iface> wifidirect_mode 0
Stop wifidirect mode.
./wifidirectutl <iface> wifidirect_mode 1
Start wifidirect mode.
./wifidirectutl <iface> wifidirect_mode
Get current WIFIDIRECT start/stop mode.
wifidirect_config
----------
"./wifidirectutl <iface> wifidirect_config [*.conf]"
This command is used to set/get the wifidirect configuration.
Example:
./wifidirectutl <iface> wifidirect_config wifidirect.conf
Read configuration from wifidirect.conf and apply it.
./wifidirectutl <iface> wifidirect_config
Read existing wifidirect configuration and display it.
wifidirect_params_config
----------
"./wifidirectutl <iface> wifidirect_params_config [*.conf]"
This command is used to set/get the wifidirect parameters configuration.
Example:
./wifidirectutl <iface> wifidirect_params_config wifidirect.conf
Read parameter configuration from wifidirect.conf and apply it.
./wifidirectutl <iface> wifidirect_params_config
Read existing wifidirect parameters's configuration and display it.
wifidirect_action_frame
----------
"./wifidirectutl <iface> wifidirect_action_frame <*.conf> | <PeerAddr> <Category> <OUISubtype> <DialogToken>"
This command is used to send action frames as specified in config file or on command line.
Example:
./wifidirectutl <iface> wifidirect_action_frame wifidirect.conf
Read action_frame from wifidirect.conf and send to peer.
./wifidirectutl <iface> wifidirect_action_frame <PeerAddr> <Category> <OUISubtype> <DialogToken>
Read action frame parameters from command line and send to peer.
wifidirect_discovery_request
----------
"./wifidirectutl <iface> wifidirect_discovery_request <*.conf>"
This command is used to send wifidirect discovery request packet.
Example:
./wifidirectutl <iface> wifidirect_discovery_request wifidirect.conf
Read discovery packet from wifidirect.conf and send to peer.
wifidirect_discovery_response
----------
"./wifidirectutl <iface> wifidirect_discovery_response <*.conf>"
This command is used to send wifidirect discovery response packet.
Example:
./wifidirectutl <iface> wifidirect_discovery_response wifidirect.conf
Read discovery packet from wifidirect.conf and send to peer.
wifidirect_cfg_discovery_period
----------
"./wifidirectutl <iface> wifidirect_cfg_discovery_period [<MinDiscPeriod> <MaxDiscPeriod>]"
This command is used to set or get minimum and maximum discovery period.
Example:
./wifidirectutl <iface> wifidirect_cfg_discovery_period 10 20
Set minimum discovery interval to 10 and maximum discovery
interval to 20.
./wifidirectutl <iface> wifidirect_cfg_discovery_period
Get minimum and maximum discovery interval.
wifidirect_cfg_intent
----------
"./wifidirectutl <iface> wifidirect_cfg_intent [IntentValue]"
This command is used to set or get intent value.
Example:
./wifidirectutl <iface> wifidirect_cfg_intent 12
Set intent value to 12.
./wifidirectutl <iface> wifidirect_cfg_intent
Get Group Owner Intent.
wifidirect_cfg_capability
----------
"./wifidirectutl <iface> wifidirect_cfg_capability [<DeviceCapability> <GroupCapability>]"
This command is used to set or get device capability and group capability.
Example:
./wifidirectutl <iface> wifidirect_cfg_capability 10 20
Set Device capability to 10 and group capability to 20
./wifidirectutl <iface> wifidirect_cfg_capability
Get Device capability and group capability.
wifidirect_cfg_noa
----------
"./wifidirectutl <iface> wifidirect_cfg_noa <enable|disable> <index> [<counttype> <duration> <interval>]"
This command is used to set or get NoA parameters like count_type, duration and
interval in ms when NoA is enabled. Valid value of index is [0, 1].
Example:
./wifidirectutl <iface> wifidirect_cfg_noa enable 0 10 50 100
Enable NoA and set count to 10, duration to 50ms and interval to 100 ms
for index 0.
./wifidirectutl <iface> wifidirect_cfg_noa disable 1
Disable NoA at index 1.
./wifidirectutl <iface> wifidirect_cfg_noa
Get NoA settings.
wifidirect_cfg_opp_ps
----------
"./wifidirectutl <iface> wifidirect_cfg_opp_ps <enable|disable> [<CTWindow>]"
This command is used to set or get Opportunistic power save and CT window.
Example:
./wifidirectutl <iface> wifidirect_cfg_opp_ps enable 50
Set OppPS and CTwindow value to 50.
./wifidirectutl <iface> wifidirect_cfg_opp_ps disable
Disable OppPS.
./wifidirectutl <iface> wifidirect_cfg_opp_ps
Get OppPS and CT window.
wifidirect_cfg_invitation_list
----------
"./wifidirectutl <iface> wifidirect_cfg_invitation_list [mac_addr]"
This command is used to set or get invitation list of peers.
Example:
./wifidirectutl <iface> wifidirect_cfg_invitation_list 00:50:43:20:23:34
Set 00:50:43:20:23:34 in invitation list of peers.
./wifidirectutl <iface> wifidirect_cfg_invitation_list
Get Invitation list of peers.
wifidirect_cfg_listen_channel
----------
"./wifidirectutl <iface> wifidirect_cfg_listen_channel [ListenChannel]"
This command is used to set or get Listen channel.
Example:
./wifidirectutl <iface> wifidirect_cfg_listen_channel 11
Set Listen channel to 11.
./wifidirectutl <iface> wifidirect_cfg_listen_channel
Get Listen channel.
wifidirect_cfg_op_channel
----------
"./wifidirectutl <iface> wifidirect_cfg_op_channel [OperatingChannel]"
This command is used to set or get Operating channel.
Example:
./wifidirectutl <iface> wifidirect_cfg_op_channel 11
Set Operating channel to 11.
./wifidirectutl <iface> wifidirect_cfg_op_channel
Get Operating channel.
wifidirect_cfg_persistent_group_record
----------
"./wifidirectutl <iface> [index] [role]
[<groupbss> <deviceId> <ssid> <psk>] [peermac1] [peermac2]"
This command is used to set or get the persistent group record
maintained in the device. Valid index is from 0 to 3. The role should be
0 for client, 1 for group-owner.
Example:
./wifidirectutl <iface> wifidirect_cfg_persistent_group_record 0 1
00:50:43:12:24:36 00:50:43:13:26:39 "DIRECT-" "1234567890"
00:50:43:20:c2:d0
Set persistent group record with index 0, role as group owner, bssId and
device Id, ssid="DIRECT-", passphrase="1234567890", and peer mac address.
The passphrase get converted to PSK.
./wifidirectutl <iface> wifidirect_cfg_persistent_group_record 1 1
00:50:43:12:24:36 00:50:43:13:26:39 "DIRECT-" "1234567890"
0x1234567890123456789012345678901234567890123456789012345678901234
Set persistent group record with index 1, role as group owner, bssId and
device Id, ssid="DIRECT-", passphrase="1234567890", and peer mac address.
The passphrase get converted to PSK.
PSK is specified with "0x" prefix and 32 bytes (64 characters).
./wifidirectutl <iface> wifidirect_cfg_persistent_group_record 1
Get persistent group record with index 1.
./wifidirectutl <iface> wifidirect_cfg_persistent_group_record
Get persistent group record for all indices.
wifidirect_cfg_persistent_group_invoke
----------
"./wifidirectutl <iface> wifidirect_cfg_persistent_group_invoke [index] | <cancel>"
This command is used to invoke a particular persistent group record
from the list. Valid index is from 0 to 3.
./wifidirectutl <iface> wifidirect_cfg_persistent_group_invoke 2
Invoke persistent group record with index 1.
./wifidirectutl <iface> wifidirect_cfg_persistent_group_invoke cancel
Cancel invokation of persistent groups.
wifidirect_cfg_presence_req_params
----------
"./wifidirectutl <iface> wifidirect_cfg_presence_req_params [<type> <duration> <interval>]"
This command is used to set/get presence request parameters. Type should
be 1 for preferred values and 2 for acceptable values.
./wifidirectutl <iface> wifidirect_cfg_presence_req_params 1 50 100
Set duration to 50ms and interval to 100ms.
./wifidirectutl <iface> wifidirect_cfg_presence_req_params
Get presence request parameters.
wifidirect_cfg_ext_listen_time
----------
"./wifidirectutl <iface> wifidirect_cfg_ext_listen_time [<duration> <interval>]"
This command is used to set/get extended listen timing parameters.
./wifidirectutl <iface> wifidirect_cfg_ext_listen_time 1200 1300
Set availability period to 1200ms and availability interval to 1300 ms.
./wifidirectutl <iface> wifidirect_cfg_ext_listen_time
Get extended listen timing parameters.
wifidirect_cfg_provisioning_params
----------
"./wifidirectutl <iface> wifidirect_cfg_provisioning_params [<action> <configMethod> <devicePassword>]"
This command is used to set/get provisioning protocol parameters. Action should
be 1 for request parameters and 2 for response parameters.
./wifidirectutl <iface> wifidirect_cfg_provisioning_params 1 0x80 0x04
Set config method to 0x86 and device password to 0x04.
./wifidirectutl <iface> wifidirect_cfg_provisioning_params
Get Provision protocol parameters.
wifidirect_cfg_wps_params
----------
"./wifidirectutl <iface> wifidirect_cfg_wps_params [<action>]"
This command is used to set WPS action. action can be "pin" (pin entered),
"pbc"(button pressed) or "none".
Example:
./wifidirectutl <iface> wifidirect_cfg_wps_params pin
Indicates pin operation
./wifidirectutl <iface> wifidirect_cfg_wps_params none
Indicates no operation
===============================================================================
U S E R M A N U A L F O R WIFIDISPLAY
wifidisplay_mode
-----------
"./wifidirectutl <iface> wifidisplay_mode [<action>]"
This command is used to enable or disable wifi-display. The possible values are either 1 or 0.
Example:
./wifidirectutl <iface> wifidisplay_mode 1
Indicates enable wifi_display
./wifidirectutl <iface> wifidisplay_mode 0
Indicates disable wifi_display
wifidisplay_config
-----------
"./wifidirectutl <iface> wifidisplay_config [*.conf]"
This command is used to set/get the wifidisplay configuration.
Example:
./wifidirectutl <iface> wifidisplay_config wifidisplay.conf
Read configuration from wifidisplay.conf and apply it.
./wifidirectutl <iface> wifidisplay_config
Read existing wifidisplay configuration and display it.
wifidisplay_update_devinfo
----------
"./wifidirectutl <iface> wifidisplay_update_devinfo [value]"
This command is used to set the device information of wifidisplay device information subelement.
This command will overwrite the new device information with user defined value.
Example:
./wifidirectutl <iface> wifidisplay_update_devinfo 10
Update device information programmed with new value 10 by overwritting existing value.
wifidisplay_discovery_request
----------
"./wifidirectutl <iface> wifidisplay_discovery_request [*.config]"
This command is used to send wifi display service discovery request.
Example:
./wifidirectutl <iface> wifidisplay_discovery_request wifidisplay.conf
Read discovery packet from wifidisplay.conf and send to peer.
wifidisplay_discovery_response
----------
"./wifidirectutl <iface> wifidisplay_discovery_response <*.conf>"
This command is used to send wifidisplay discovery response packet.
Example:
./wifidirectutl <iface> wifidisplay_discovery_response wifidisplay.conf
Read discovery packet from wifidisplay.conf and send to peer.
===============================================================================
U S E R M A N U A L F O R MLANEVENT
NAME
mlanevent.exe
This tool can be used to listen for and obtain events from the driver
through the netlink layer. This is only used for display/debugging purpose.
----------------
Supported events
----------------
WIFIDIRECT_GENERIC_EVENT
WIFIDIRECT_SERVICE_DISCOVERY
-----------------
Details of events
-----------------
WIFIDIRECT_GENERIC_EVENT
-----------------
For this event, the following information is shown:
+ Event length.
+ Event Type indicating Negociation, Invitation, Discoverability,
Provision discovery related Request or Response.
+ Event SubType indicating Client or Group owner role.
+ Peer MAC address.
+ Associated WIFIDIRECT IE elements.
WIFIDIRECT_SERVICE_DISCOVERY
---------------------
For this event, the following information is shown:
+ Peer MAC address.
+ Service discovery packet details.

339
mwifiex_8997/gpl-2.0.txt Executable file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,48 @@
#
# File : mlan2040coex/Makefile
#
# Copyright (C) 2009-2019, Marvell International Ltd. All Rights Reserved
# Path to the top directory of the mlandriver 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))
#
# List of application executables to create
#
libobjs:= mlan2040coex.o mlan2040misc.o
exectarget=mlan2040coex
TARGETS := $(exectarget)
#
# Make target rules
#
# All rule compiles list of TARGETS using builtin program target from src rule
all :
$(exectarget): $(libobjs)
$(CC) $(CFLAGS) $(libobjs) -o $(exectarget)
# Update any needed TARGETS and then copy to the install path
build install: $(TARGETS)
@cp -f $(exectarget) $(INSTALLPATH)
clean:
@rm -f $(exectarget)
@rm -f *.o
distclean: clean
@rm -f *~ core
@rm -f tags

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,233 @@
/** @file mlan2040coex.h
*
* @brief This file contains definitions for application
*
* Copyright (C) 2009-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
06/24/2009: initial version
************************************************************************/
#ifndef _COEX_H_
#define _COEX_H_
/** Marvell private command identifier */
#define CMD_MARVELL "MRVL_CMD"
/** IOCTL number */
#define MLAN_ETH_PRIV (SIOCDEVPRIVATE + 14)
#if (BYTE_ORDER == LITTLE_ENDIAN)
#undef BIG_ENDIAN_SUPPORT
#endif
/** 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)))
/** 64 bits byte swap */
#define swap_byte_64(x) \
((t_u64)((t_u64)(((t_u64)(x) & 0x00000000000000ffULL) << 56) | \
(t_u64)(((t_u64)(x) & 0x000000000000ff00ULL) << 40) | \
(t_u64)(((t_u64)(x) & 0x0000000000ff0000ULL) << 24) | \
(t_u64)(((t_u64)(x) & 0x00000000ff000000ULL) << 8) | \
(t_u64)(((t_u64)(x) & 0x000000ff00000000ULL) >> 8) | \
(t_u64)(((t_u64)(x) & 0x0000ff0000000000ULL) >> 24) | \
(t_u64)(((t_u64)(x) & 0x00ff000000000000ULL) >> 40) | \
(t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56) ))
/** Convert to correct endian format */
#ifdef BIG_ENDIAN_SUPPORT
/** CPU to little-endian convert for 16-bit */
#define cpu_to_le16(x) swap_byte_16(x)
/** CPU to little-endian convert for 32-bit */
#define cpu_to_le32(x) swap_byte_32(x)
/** CPU to little-endian convert for 64-bit */
#define cpu_to_le64(x) swap_byte_64(x)
/** Little-endian to CPU convert for 16-bit */
#define le16_to_cpu(x) swap_byte_16(x)
/** Little-endian to CPU convert for 32-bit */
#define le32_to_cpu(x) swap_byte_32(x)
/** Little-endian to CPU convert for 64-bit */
#define le64_to_cpu(x) swap_byte_64(x)
#else
/** Do nothing */
#define cpu_to_le16(x) (x)
/** Do nothing */
#define cpu_to_le32(x) (x)
/** Do nothing */
#define cpu_to_le64(x) (x)
/** Do nothing */
#define le16_to_cpu(x) (x)
/** Do nothing */
#define le32_to_cpu(x) (x)
/** Do nothing */
#define le64_to_cpu(x) (x)
#endif
#ifdef __GNUC__
/** Structure packing begins */
#define PACK_START
/** Structure packeing end */
#define PACK_END __attribute__ ((packed))
#else
/** Structure packing begins */
#define PACK_START __packed
/** Structure packeing end */
#define PACK_END
#endif
/** 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;
#ifdef FALSE
#undef FALSE
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/** Type definition: boolean */
typedef enum { FALSE, TRUE } boolean;
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** Success */
#define MLAN_STATUS_SUCCESS (0)
/** Failure */
#define MLAN_STATUS_FAILURE (-1)
/** Enumeration for host-command index */
enum COMMANDS {
CMD_2040COEX = 1,
};
/** Maximum number of channels that can be sent in a setuserscan ioctl */
#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
#ifndef ETH_ALEN
/** MAC address length */
#define ETH_ALEN 6
#endif
/** Netlink protocol number */
#define NETLINK_MARVELL (MAX_LINKS - 1)
/** Netlink maximum payload size */
#define NL_MAX_PAYLOAD 1024
/** Netlink multicast group number */
#define NL_MULTICAST_GROUP RTMGRP_LINK
/** 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
/** Event header */
typedef PACK_START struct _event_header {
/** Event ID */
t_u32 event_id;
/** Event data */
t_u8 event_data[0];
} PACK_END event_header;
/** Event ID length */
#define EVENT_ID_LEN 4
/** Custom events definitions */
/** AP connected event */
#define CUS_EVT_AP_CONNECTED "EVENT=AP_CONNECTED"
/** Custom event : BW changed */
#define CUS_EVT_BW_CHANGED "EVENT=BW_CHANGED"
/** Custom event : OBSS scan parameter */
#define CUS_EVT_OBSS_SCAN_PARAM "EVENT=OBSS_SCAN_PARAM"
/** Custom events definitions end */
/** Structure defination of chan_intol_t*/
typedef struct _chan_intol_t {
/** Channel numer */
t_u8 chan_num;
/** Flag: Is any 40MHz intolerant AP found in this channel */
t_u8 is_intol_set;
} chan_intol_t;
/** 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
/** Legacy APs channel list */
chan_intol_t leg_ap_chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
/** Total number of channel present in Legacy APs channel list */
t_u8 num_leg_ap_chan;
int get_region_code(int *reg_code);
int process_host_cmd(int cmd, t_u8 *chan_list, t_u8 chan_num, t_u8 reg_class,
t_u8 is_intol_ap_present);
int is_intolerant_sta(int *intol);
#endif /* _COEX_H_ */

View File

@ -0,0 +1,280 @@
/** @file mlan2040misc.c
*
* @brief This file contains helper functions for coex application
*
* Copyright (C) 2009-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
06/24/2009: initial version
************************************************************************/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "mlan2040coex.h"
#include "mlan2040misc.h"
/********************************************************
Local Variables
********************************************************/
/** Regulatory class and Channel mapping for various regions */
static class_chan_t us_class_chan_t[] = {
{32, {1, 2, 3, 4, 5, 6, 7}, 7},
{33, {5, 6, 7, 8, 9, 10, 11}, 7}
};
static class_chan_t europe_class_chan_t[] = {
{11, {1, 2, 3, 4, 5, 6, 7, 8, 9}, 9},
{12, {5, 6, 7, 8, 9, 10, 11, 12, 13}, 9}
};
static class_chan_t japan_class_chan_t[] = {
{56, {1, 2, 3, 4, 5, 6, 7, 8, 9}, 9},
{57, {5, 6, 7, 8, 9, 10, 11, 12, 13}, 9},
{58, {14}, 1}
};
/** Region-code(Regulatory domain) and Class-channel table mapping */
static region_class_chan_t region_class_chan_table[] = {
{0x10, us_class_chan_t, sizeof(us_class_chan_t) / sizeof(class_chan_t)} /* US */
,
{0x20, us_class_chan_t, sizeof(us_class_chan_t) / sizeof(class_chan_t)} /* CANADA */
,
{0x30, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* EUROPE */
,
{0x32, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* FRANCE */
,
{0x40, japan_class_chan_t, sizeof(japan_class_chan_t) / sizeof(class_chan_t)} /* JAPAN */
,
{0x41, japan_class_chan_t, sizeof(japan_class_chan_t) / sizeof(class_chan_t)} /* JAPAN */
,
{0x50, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* CHINA */
};
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief This function prepares the channel list for a particular
* regulatory class from channel number for legacy AP
* @param cur_class_chan_table A pointer to the class_chan_t
* @param num_entry Number of entry in cur_class_chan_table table
* @param chan_list A pointer to the output channel list
* @param chan_num total number of channel in output channel list
* @param reg_domain regulatory domain
* @param reg_class regulatory class
* @param is_intol_ap_present It sets TRUE when 40MHz intolerant AP is found
* otherwise FALSE
* @return None
*/
static void
get_channels_for_specified_reg_class(class_chan_t *cur_class_chan_table,
int num_entry, t_u8 *chan_list,
t_u8 *chan_num, t_u8 reg_domain,
t_u8 reg_class, t_u8 *is_intol_ap_present)
{
int i, j, k, idx = 0;
*is_intol_ap_present = FALSE;
/* For each regulatory class */
for (i = 0; i < num_entry; i++) {
if (cur_class_chan_table[i].reg_class == reg_class) {
/* For each channel of the regulatory class */
for (j = 0; j < cur_class_chan_table[i].total_chan; j++) {
for (k = 0; k < num_leg_ap_chan; k++) {
if (cur_class_chan_table[i].
channels[j] ==
leg_ap_chan_list[k].chan_num) {
*(chan_list + idx) =
leg_ap_chan_list[k].
chan_num;
idx++;
if (leg_ap_chan_list[k].
is_intol_set)
*is_intol_ap_present =
TRUE;
}
}
}
break;
}
}
/* update the total number of channel */
*chan_num = idx--;
return;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief Prepare 2040 coex command buffer
* @param buf A pointer to the command buffer
* @param chan_list Channel list
* @param num_of_chan Number of channel present in channel list
* @param reg_class Regulatory class
* @param is_intol_ap_present Flag: is any 40 MHz intolerant AP
* is present in these chaanel set
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
void
prepare_coex_cmd_buff(t_u8 *buf, t_u8 *chan_list, t_u8 num_of_chan,
t_u8 reg_class, t_u8 is_intol_ap_present)
{
HostCmd_DS_GEN *hostcmd;
MrvlIETypes_2040COEX_t *coex_ie = NULL;
MrvlIETypes_2040BssIntolerantChannelReport_t *bss_intol_ie = NULL;
t_u8 *pos = NULL;
int intol;
hostcmd = (HostCmd_DS_GEN *)(buf + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_11N_2040COEX);
hostcmd->size = S_DS_GEN;
pos = buf + sizeof(t_u32) + S_DS_GEN;
{
coex_ie = (MrvlIETypes_2040COEX_t *)pos;
coex_ie->header.element_id = TLV_ID_2040COEX;
coex_ie->header.len = sizeof(coex_ie->coex_elem);
/* Check STA is 40 MHz intolerant or not */
is_intolerant_sta(&intol);
if (intol)
coex_ie->coex_elem |= MBIT(1);
if (is_intol_ap_present)
coex_ie->coex_elem |= MBIT(2);
pos += sizeof(MrvlIETypes_2040COEX_t);
hostcmd->size += sizeof(MrvlIETypes_2040COEX_t);
}
{
bss_intol_ie =
(MrvlIETypes_2040BssIntolerantChannelReport_t *)pos;
bss_intol_ie->header.element_id =
TLV_ID_2040BSS_INTOL_CHAN_REPORT;
hostcmd->size +=
sizeof(MrvlIETypes_2040BssIntolerantChannelReport_t) -
sizeof(bss_intol_ie->chan_num);
bss_intol_ie->reg_class = reg_class;
memcpy(bss_intol_ie->chan_num, chan_list, num_of_chan);
bss_intol_ie->header.len =
sizeof(bss_intol_ie->reg_class) + num_of_chan;
hostcmd->size += num_of_chan;
}
hostcmd->size = cpu_to_le16(hostcmd->size);
return;
}
/**
* @brief Invoke multiple 2040Coex commands for multiple regulatory classes
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
invoke_coex_command(void)
{
int cur_reg_domain;
t_u8 chan_list[MAX_CHAN], is_intol_ap_present;
t_u8 num_of_chan;
int i, num_entry, ret = MLAN_STATUS_SUCCESS;
class_chan_t *cur_class_chan_table = NULL;
/** get region code */
ret = get_region_code(&cur_reg_domain);
if (ret != MLAN_STATUS_SUCCESS)
return ret;
/** Find region_class_chan_table for this region */
for (i = 0;
(unsigned int)i <
(sizeof(region_class_chan_table) / sizeof(region_class_chan_t));
i++) {
if (region_class_chan_table[i].reg_domain == cur_reg_domain) {
cur_class_chan_table =
region_class_chan_table[i].class_chan_list;
num_entry =
region_class_chan_table[i].num_class_chan_entry;
break;
}
}
if (cur_class_chan_table == NULL) {
printf("No region_class_chan table found for this region\n");
return MLAN_STATUS_FAILURE;
}
for (i = 0; i < num_entry; i++) {
/** Get channels for the specified regulatory class */
get_channels_for_specified_reg_class(cur_class_chan_table,
num_entry, chan_list,
&num_of_chan,
cur_reg_domain,
cur_class_chan_table[i].
reg_class,
&is_intol_ap_present);
/** If any channel found for this regulatory class, then invoke the 2040coex command */
if (num_of_chan > 0) {
ret = process_host_cmd(CMD_2040COEX, chan_list,
num_of_chan,
cur_class_chan_table[i].
reg_class, is_intol_ap_present);
if (ret)
break;
}
}
return ret;
}
/**
* @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
*/
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_MARVELL) + 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;
if (!le16_to_cpu(hostcmd->result)) {
switch (hostcmd->command) {
}
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
ret = MLAN_STATUS_FAILURE;
}
return ret;
}

View File

@ -0,0 +1,443 @@
/** @file mlan2040misc.h
*
* @brief This file contains command definitions for application
*
* Copyright (C) 2009-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
06/24/2009: initial version
************************************************************************/
#ifndef _COEX_MISC_H_
#define _COEX_MISC_H_
/** MLAN MAC Address Length */
#define MLAN_MAC_ADDR_LENGTH (6)
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
/** 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
/** TLV Id for 2040Coex IE */
#define TLV_ID_2040COEX 0x48
/** TLV Id for 2040BSS intolarent channel report IE */
#define TLV_ID_2040BSS_INTOL_CHAN_REPORT 0x49
/** Host-command for 2040coex command */
#define HostCmd_CMD_11N_2040COEX 0x00e9
/** Maximum scan response buffer size */
#define SCAN_RESP_BUF_SIZE 2000
/** Maximum length of SSID */
#define MRVDRV_MAX_SSID_LENGTH 32
/** Length of ethernet address */
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/** Maximum length of SSID list */
#define MRVDRV_MAX_SSID_LIST_LENGTH 10
/** Default scan interval in second*/
#define DEFAULT_SCAN_INTERVAL 300
/** BIT value */
#define MBIT(x) (((t_u32)1) << (x))
/** Check intolerent bit set */
#define IS_INTOL_BIT_SET(cap_info) (cap_info & MBIT(14))
/** Check OBSS non-HT STAs present bit set */
#define IS_NON_HT_STA_PRESENT(ht_info) (ht_info.field3 & MBIT(4))
/** 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,
HT_CAPABILITY = 45,
HT_OPERATION = 61,
BSSCO_2040 = 72,
OVERLAPBSSSCANPARAM = 74,
EXT_CAPABILITY = 127,
ERP_INFO = 42,
EXTENDED_SUPPORTED_RATES = 50,
VENDOR_SPECIFIC_221 = 221,
WMM_IE = VENDOR_SPECIFIC_221,
RSN_IE = 48,
} __attribute__ ((packed))
IEEEtypes_ElementId_e;
/** HT Capabilities Data */
typedef struct _HTCap_t {
/** HT Capabilities Info field */
t_u16 ht_cap_info;
/** A-MPDU Parameters field */
t_u8 ampdu_param;
/** Supported MCS Set field */
t_u8 supported_mcs_set[16];
/** HT Extended Capabilities field */
t_u16 ht_ext_cap;
/** Transmit Beamforming Capabilities field */
t_u32 tx_bf_cap;
/** Antenna Selection Capability field */
t_u8 asel;
/** Reserved set to 0 */
t_u16 reserved;
} __attribute__ ((packed))
HTCap_t, *pHTCap_t;
/** HT Information Data */
typedef struct _HTInfo_t {
/** Primary channel */
t_u8 pri_chan;
/** Field 2 */
t_u8 field2;
/** Field 3 */
t_u16 field3;
/** Field 4 */
t_u16 field4;
/** Bitmap indicating MCSs supported by all HT STAs in the BSS */
t_u8 basic_mcs_set[16];
/** Reserved set to 0 */
t_u16 reserved;
} __attribute__ ((packed))
HTInfo_t, *pHTInfo_t;
/** 20/40 BSS Coexistence Data */
typedef struct _BSSCo2040_t {
/** 20/40 BSS Coexistence value */
t_u8 bss_co_2040_value;
/** Reserve field */
t_u8 reserved[3];
} __attribute__ ((packed))
BSSCo2040_t, *pBSSCo2040_t;
/** Extended Capabilities Data */
typedef struct _ExtCap_t {
/** Extended Capabilities value */
t_u8 ext_cap_value;
/** Reserved field */
t_u8 reserved[3];
} __attribute__ ((packed))
ExtCap_t, *pExtCap_t;
/** Overlapping BSS Scan Parameters Data */
typedef struct _OverlapBSSScanParam_t {
/** OBSS Scan Passive Dwell */
t_u16 obss_scan_passive_dwell;
/** OBSS Scan Active Dwell */
t_u16 obss_scan_active_dwell;
/** BSS Channel Width Trigger Scan Interval */
t_u16 bss_chan_width_trigger_scan_int;
/** OBSS Scan Passive Total Per Channel */
t_u16 obss_scan_passive_total;
/** OBSS Scan Active Total Per Channel */
t_u16 obss_scan_active_total;
/** BSS Width Channel Transition Delay Factor */
t_u16 bss_width_chan_trans_delay;
/** OBSS Scan Activity Threshold */
t_u16 obss_scan_active_threshold;
} __attribute__ ((packed))
OBSSScanParam_t, *pOBSSScanParam_t;
/** IEEEtypes_CapInfo_t structure*/
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;
} __attribute__ ((packed))
IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t;
typedef struct {
t_u8 chan_number;
/**< Channel Number to scan */
t_u8 radio_type;
/**< Radio type: 'B/G' Band = 0, 'A' Band = 1 */
t_u8 scan_type;
/**< Scan type: Active = 1, Passive = 2 */
t_u8 reserved;
/**< Reserved */
t_u32 scan_time;
/**< Scan duration in milliseconds; if 0 default used */
} __attribute__ ((packed))
wlan_ioctl_user_scan_chan;
typedef struct {
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/**< SSID */
t_u8 max_len; /**< Maximum length of SSID */
} __attribute__ ((packed))
wlan_ioctl_user_scan_ssid;
typedef struct {
/** Flag set to keep the previous scan table intact */
t_u8 keep_previous_scan; /* Do not erase the existing scan results */
/** BSS mode to be sent in the firmware command */
t_u8 bss_mode;
/** Configure the number of probe requests for active chan scans */
t_u8 num_probes;
/** Reserved */
t_u8 reserved;
/** BSSID filter sent in the firmware command to limit the results */
t_u8 specific_bssid[ETH_ALEN];
/** SSID filter list used in the to limit the scan results */
wlan_ioctl_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH];
/** Variable number (fixed maximum) of channels to scan up */
wlan_ioctl_user_scan_chan chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
} __attribute__ ((packed))
wlan_ioctl_user_scan_cfg;
/** IEEE IE header */
typedef struct _IEEEtypes_Header_t {
/** Element ID */
t_u8 element_id;
/** Length */
t_u8 len;
} __attribute__ ((packed))
IEEEtypes_Header_t, *pIEEEtypes_Header_t;
/** HT Capabilities IE */
typedef struct _IEEEtypes_HTCap_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** HTCap struct */
HTCap_t ht_cap;
} __attribute__ ((packed))
IEEEtypes_HTCap_t, *pIEEEtypes_HTCap_t;
/** HT Information IE */
typedef struct _IEEEtypes_HTInfo_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** HTInfo struct */
HTInfo_t ht_info;
} __attribute__ ((packed))
IEEEtypes_HTInfo_t, *pIEEEtypes_HTInfo_t;
/** 20/40 BSS Coexistence IE */
typedef struct _IEEEtypes_2040BSSCo_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** BSSCo2040_t struct */
BSSCo2040_t bss_co_2040;
} __attribute__ ((packed))
IEEEtypes_2040BSSCo_t, *pIEEEtypes_2040BSSCo_t;
/** Extended Capabilities IE */
typedef struct _IEEEtypes_ExtCap_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** ExtCap_t struct */
ExtCap_t ext_cap;
} __attribute__ ((packed))
IEEEtypes_ExtCap_t, *pIEEEtypes_ExtCap_t;
/** Overlapping BSS Scan Parameters IE */
typedef struct _IEEEtypes_OverlapBSSScanParam_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** OBSSScanParam_t struct */
OBSSScanParam_t obss_scan_param;
} __attribute__ ((packed))
IEEEtypes_OverlapBSSScanParam_t, *pIEEEtypes_OverlapBSSScanParam_t;
typedef struct _wlan_get_scan_table_fixed {
/** BSSID of this network */
t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
/** Channel this beacon/probe response was detected */
t_u8 channel;
/** RSSI for the received packet */
t_u8 rssi;
/** TSF value from the firmware at packet reception */
t_u64 network_tsf;
} wlan_get_scan_table_fixed;
/**
* Structure passed in the wlan_ioctl_get_scan_table_info for each
* BSS returned in the WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_scan_table_entry {
/**
* Fixed field length included in the response.
*
* Length value is included so future fixed fields can be added to the
* response without breaking backwards compatibility. Use the length
* to find the offset for the bssInfoLength field, not a sizeof() calc.
*/
t_u32 fixed_field_length;
/**
* Length of the BSS Information (probe resp or beacon) that
* follows starting at bssInfoBuffer
*/
t_u32 bss_info_length;
/**
* Always present, fixed length data fields for the BSS
*/
wlan_get_scan_table_fixed fixed_fields;
/*
* Probe response or beacon scanned for the BSS.
*
* Field layout:
* - TSF 8 octets
* - Beacon Interval 2 octets
* - Capability Info 2 octets
*
* - IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/* t_u8 bss_info_buffer[1]; */
} wlan_ioctl_get_scan_table_entry;
/**
* Sructure to retrieve the scan table
*/
typedef struct {
/**
* - Zero based scan entry to start retrieval in command request
* - Number of scans entries returned in command response
*/
t_u32 scan_number;
/**
* Buffer marker for multiple wlan_ioctl_get_scan_table_entry structures.
* Each struct is padded to the nearest 32 bit boundary.
*/
t_u8 scan_table_entry_buf[1];
} wlan_ioctl_get_scan_table_info;
/* Define general hostcmd data structure */
/** HostCmd_DS_GEN */
typedef struct _HostCmd_DS_GEN {
/** Command */
t_u16 command;
/** Size */
t_u16 size;
/** Sequence number */
t_u16 seq_num;
/** Result */
t_u16 result;
} __attribute__ ((packed))
HostCmd_DS_GEN;
/** Size of HostCmd_DS_GEN */
#define S_DS_GEN sizeof(HostCmd_DS_GEN)
/** TLV related data structures*/
/** MrvlIEtypesHeader_t */
typedef struct _MrvlIEtypesHeader {
/** Header type */
t_u16 type;
/** Header length */
t_u16 len;
} __attribute__ ((packed))
MrvlIEtypesHeader_t;
/** _MrvlIETypes_2040BssIntolerantChannelReport_t */
typedef struct _MrvlIETypes_2040BssIntolerantChannelReport_t {
/** Header */
IEEEtypes_Header_t header;
/** regulatory class */
t_u8 reg_class;
/** channel numbers for legacy AP */
t_u8 chan_num[1];
} __attribute__ ((packed))
MrvlIETypes_2040BssIntolerantChannelReport_t;
/** MrvlIETypes_2040COEX_t */
typedef struct _MrvlIETypes_2040COEX_t {
/** Header */
IEEEtypes_Header_t header;
/** 2040 coex element */
t_u8 coex_elem;
} __attribute__ ((packed))
MrvlIETypes_2040COEX_t;
typedef struct _HostCmd_DS_CMD_11N_2040COEX {
/** 2040 coex element */
MrvlIETypes_2040COEX_t coex;
/** 2040 BSS intolerant channel report*/
MrvlIETypes_2040BssIntolerantChannelReport_t chan_intol_report;
} __attribute__ ((packed))
HostCmd_DS_CMD_11N_2040COEX;
/** Maximum number of channel per regulatory class */
#define MAX_CHAN 20
typedef struct _class_chan_t {
/** Regulatory class */
t_u8 reg_class;
/** Channel numbers */
t_u8 channels[MAX_CHAN];
/** Total number of channels */
t_u8 total_chan;
} class_chan_t;
typedef struct _region_class_chan_t {
/** Regulatory domain */
int reg_domain;
/** Channel numbers */
class_chan_t *class_chan_list;
/** Number of class channel table entry */
int num_class_chan_entry;
} region_class_chan_t;
int process_host_cmd_resp(char *cmd_name, t_u8 *buf);
void prepare_coex_cmd_buff(t_u8 *buf, t_u8 *chan_list, t_u8 num_of_chan,
t_u8 reg_class, t_u8 is_intol_ap_present);
int invoke_coex_command(void);
#endif /* _COEX_MISC_H_ */

View File

@ -0,0 +1,48 @@
#
# File : mlanconfig/Makefile
#
# Copyright (C) 2008-2019, Marvell International Ltd. All Rights Reserved
# Path to the top directory of the mlandriver 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))
#
# List of application executables to create
#
libobjs:= mlanconfig.o mlanhostcmd.o mlanmisc.o
exectarget=mlanconfig
TARGETS := $(exectarget)
#
# Make target rules
#
# All rule compiles list of TARGETS using builtin program target from src rule
all :
$(exectarget): $(libobjs)
$(CC) $(CFLAGS) $(libobjs) -o $(exectarget)
# Update any needed TARGETS and then copy to the install path
build install: $(TARGETS)
@cp -rf config $(INSTALLPATH)
clean:
@rm -f $(exectarget)
@rm -f *.o
distclean: clean
@rm -f *~ core
@rm -f tags

View File

@ -0,0 +1,21 @@
# File : 11n_2040coex.conf
######################### 20/40 Coex command ##################
2040coex={
CmdCode=0x00e9 # do NOT change this line
2040CoexTlvType:1=0x48
2040CoexTlvLen:1={
2040CoexElement:1=0x04
}
2040BssIntlChanTlvType:1=0x49
2040BssIntlChanTlvLen:1={
RegulatoryDomain:1=32 # USA: 32 (1-7), 33 (5-11)
ChannelNum:1=1
ChannelNum:1=2
# ...
}
}
##################################################################

View File

@ -0,0 +1,29 @@
# File : arpfilter.conf
######################### Host Sleep ARP/IP filtering command ##################
# add arp filter
# firmware supports 8 entries of ARP_FILTER. Each entry has 8 bytes.
# must not exceed 8x8+4=68 bytes
arpfilter={
TlvType:2=0x0115
TlvLength:2={
AddrType:2=3 # multicast
EthType:2=0xffff # Any
Ipv4Addr:4=0xffffffff # Any
AddrType:2=1 # broadcast
EthType:2=0x0608 # ARP: 0x0806
Ipv4Addr:4=0x6200a8c0 # 192.168.0.98
AddrType:2=2 # unicast
EthType:2=0xffff # Any
Ipv4Addr:4=0xffffffff # Any
}
}
# remove arp filter
#arpfilter={
# TlvType:2=0x0115
# TlvLength:2={
# }
#}
######################### Host Sleep ARP/IP filtering command ##################

View File

@ -0,0 +1,54 @@
# File : auto_tx.conf
######################### Auto-TX command ##################
auto_tx_get={
CmdCode=0x0082 # do NOT change this line
Action:2=0 # GET
}
auto_tx_unreg={
CmdCode=0x0082 # do NOT change this line
Action:2=1 # SET
}
nat_keep_alive={
CmdCode=0x0082 # do NOT change this line
Action:2=1 # SET
AutoTxTlvType:2=0x0118
AutoTxTlvLength:2={ # 58 = 6 + 52 (FrameLen)
Interval:2=2 # 1 - 3600 seconds
Priority:1=7 # Priority, ignored if non-WMM
Reserved:1=0
FrameLength:2={ # 52 = 6 (DA) + 6 (SA) + 2 + 38 (Length)
DestMacAddr:6='0x00,0x40,0xf4,0xbf,0x24,0xee'
SrcMacAddr:6='0x00,0x00,0x00,0x00,0x00,0x00'
Length:2='0x00,38' # 38 = 8 (SNAP hdr) + 29 (IP) + 1 (padding)
DSAP:1=0xaa # SNAP header
SSAP:1=0xaa
Ctrl:1=0x03
SNAP_OUI:3='0x00,0x00,0x00'
SNAP_PID:2='0x08,0x00' # IP Packet
IPv4:1=0x45
IP_TOS:1=0x00
IP_LEN:2='0x00,29' # IP hdr 20 + payload 9 = 29
IP_ID:2=0xefbe
IP_Flag_FragOffset:2=0x0000
IP_TTL:1=128
IP_Prot:1=17 # UDP protocol
IPhdr_cksum:2=0xc5f9 # may need re-calculation if changed
IPsrcAddr:4='192,168,0,201' # 192.168.0.201
IPdstAddr:4='192,168,0,1' # 192.168.0.1
UDPsrcPort:2='0x11,0x94' # 4500
UDPdstPort:2='0x11,0x94' # 4500
UDPlength:2='0x00,9' # UDP hdr 8 + payload 1 = 9
UDPcksum:2=0x985b # may need re-calculation if changed
UDPpayload:1=0xff
padding:1=0 # MAC Padding for 32bit alignment, set to 0
}
}
}
######################### Auto-TX command ##################

View File

@ -0,0 +1,157 @@
# File : bg_scan.conf
######################### BG Scan Configuration command ##################
########### Sample configuration for Get BG Scan Configuration #####################
#bgscfg={
# CmdCode=0x006b # do NOT change this line
# Action:1=0 # 0- Get, 1- Set
# ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
# Enable:1=1 # 0- Disable, 1-Enable
# BssType:1=0 # 1 - Infrastructure,2 - IBSS,3 - Any
# ChannelsPerScan:1=0 # Number of Channel to scan at one scan; maximum 14
# Reserved1:3=0
# ScanInterval:4=0 # Interval between consecutive scan (in milliseconds)
# Reserved2:4=0
# ReportConditions:4=0 # bit0 - SSID match
# bit1 - SNR above SNR threshold
# bit2 - RSSI above RSSI threshold
# bit31 - All channels scanned at least once
# Reserved3:2=0
#}
########### SET BG Scan Configuration #####################
bgscfg={
CmdCode=0x006b # do NOT change this line
Action:1=1 # 0- Get, 1- Set
ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
Enable:1=1 # 0- Disable, 1-Enable
BssType:1=3 # 1 - Infrastructure,2 - IBSS,3 - Any
ChannelsPerScan:1=14 # Number of Channel to scan at one scan; maximum 14
Reserved1:3=0
ScanInterval:4=1000 # Interval between consecutive scan (in milliseconds)
Reserved2:4=0
ReportConditions:4=1 # bit0 - SSID match
# bit1 - SNR above SNR threshold
# bit2 - RSSI above RSSI threshold
# bit31 - All channels scanned at least once
Reserved3:2=0
# SSID parameter set:
#
# MaxSSIDLen entries:
#
# 1. MaxSSIDLen:1=0x00 - to denote match AP name exactly,
# generate SSID specific probes
# 2. MaxSSIDLen:1=maxlen - to denote AP name will be use to base match the
# SSID and SSID's max length is 'maxlen',
# do not generate SSID specific probes
# 3. MaxSSIDLen:1=wildcard match char ('*' or '?')
# - to denote wildcard AP name will be use to match the SSID
# 4. MaxSSIDLen:1=0xff - to denote unix pattern matching
#
# SSID entries:
#
# SSID="AP_NAME" - to mention the SSID to match
# SSID Examples:
#
#
# Match SSID name "MarvellAP" exactly, generate SSID specific probes
#
SSIDHeaderType:2=0x0112
SSIDHeaderLen:2={
MaxSSIDLen:1=0x00
SSID:9="MarvellAP"
}
#
# MarvellAP will be use to base match the SSID and SSID's max length is 12
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1=0x0c
# SSID:9="MarvellAP"
# }
#
# Match "MarvellAP*" where '*' is a single char
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1='*'
# SSID:10="MarvellAP*"
# }
#
# Match "Mar?ell*" with unix pattern matching
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1=0xff # For unix pattern matching
# SSID:8="Mar?ell*"
# }
# Number Probe requests to be sent for broadcast and
# for each SSID specific scan required.
#
# If any SSID in the list has a non-zero modifier (wildcard match char,
# unix pattern match, maxlen), "Numprobes" of broadcast probe requests
# will be transmitted once per channel and the results matched against
# all entries.
#
# Set to 0 to use global scan probes setting
#
ProbeHeaderType:2=0x0102
ProbeHeaderLen:2={
NumProbes:2=2
}
# ChannelList contains the channels to scan
# The ChannelList should be specified in the form of
#
# RadioType, ChanNumber, ScanType, MinScanTime, ScanTime;
#
# RadioType - 0 [B/G Band], 1 [A Band]
# ScanType - 2 [Active], 3 [Passive]
#
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
Chan1_RadioType:1=0
Chan1_ChanNumber:1=10
Chan1_ScanType:1=2
Chan1_MinScanTime:2=10
Chan1_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=3
Chan2_MinScanTime:2=10
Chan2_ScanTime:2=100
}
# SNR threshold used when ReportConditions bit1 is set
SNRHeaderType:2=0x0105
SNRHeaderLen:2={
SNRValue:1=40 #SNR Thereshold Value
SNRFreq:1=0
}
# RSSI threshold used when ReportConditions bit2 is set
#
# Threshold is absolute value and match value would
# therefore be less than or equal to trigger a report
RSSIHeaderType:2=0x0104
RSSIHeaderLen:2={
RSSIValue:1=50 #RSSI Thereshold Value
RSSIFreq:1=0
}
# StartLaterValue: 0 - BGScan start immediately
# 1 - BGScan will start later after "Scan Interval"
StartLaterHeaderType:2=0x011e
StartLaterHeaderLen:2={
StartLaterValue:2=0
}
}
######################### BG Scan Configuration command ##################

View File

@ -0,0 +1,88 @@
# File : bg_scan_wifidirect.conf
######################### BG Scan Configuration command ##################
########### SET BG Scan Configuration #####################
bgscfg={
CmdCode=0x006b # do NOT change this line
Action:1=1 # 0- Get, 1- Set
ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
Enable:1=1 # 0- Disable, 1-Enable
BssType:1=3 # 1 - Infrastructure,2 - IBSS,3 - Any
ChannelsPerScan:1=3 # Number of Channel to scan at one scan; maximum 14
Reserved1:3=0
ScanInterval:4=1000 # Interval between consecutive scan (in milliseconds)
StoreCondition:4=1 # 1 - SSID match (bit 0)
# 2 - SSID match AND SNR above SNR threshold (bit 1)
ReportConditions:4=1 # 1 - SSID match (bit 0)
# 2 - SSID match AND SNR above SNR threshold (bit 1)
Reserved3:2=0
# SSID parameter set:
#
SSIDHeaderType:2=0x0112
SSIDHeaderLen:2={
MaxSSIDLen:1=0x00
SSID:7="DIRECT-"
}
# Number Probe requests to be sent for broadcast and
# for each SSID specific scan required.
#
# If any SSID in the list has a non-zero modifier (wildcard match char,
# unix pattern match, maxlen), "Numprobes" of broadcast probe requests
# will be transmitted once per channel and the results matched against
# all entries.
#
# Set to 0 to use global scan probes setting
#
ProbeHeaderType:2=0x0102
ProbeHeaderLen:2={
NumProbes:2=2
}
# ChannelList contains the channels to scan
# The ChannelList should be specified in the form of
#
# RadioType, ChanNumber, ScanType, MinScanTime, ScanTime;
#
# RadioType - 0 [B/G Band], 1 [A Band]
# ScanType - 2 [Active], 3 [Passive]
#
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
Chan1_RadioType:1=0
Chan1_ChanNumber:1=1
Chan1_ScanType:1=2
Chan1_MinScanTime:2=10
Chan1_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=2
Chan2_MinScanTime:2=10
Chan2_ScanTime:2=100
Chan3_RadioType:1=0
Chan3_ChanNumber:1=11
Chan3_ScanType:1=2
Chan3_MinScanTime:2=10
Chan3_ScanTime:2=100
}
# SNR threshold to match, when StoreCondition
# or ReportConditions been set to 2
SNRHeaderType:2=0x0105
SNRHeaderLen:2={
SNRValue:1=40 #SNR Thereshold Value
SNRFreq:1=0
}
# StartLaterValue: 0 - BGScan start immediately
# 1 - BGScan will start later after "Scan Interval"
StartLaterHeaderType:2=0x011e
StartLaterHeaderLen:2={
StartLaterValue:2=0
}
}
######################### BG Scan Configuration command ##################

View File

@ -0,0 +1,42 @@
01 00 0c 00 58 02
00 40 68 0c 00 00 00 40 00 00 00 00 00 11 00 00
00 11 00 10 00 00 00 00 00 00 00 00 00 00 00 00
10 12 00 10 10 86 40 89 01 03 02 00 01 02 05 00
01 03 05 00 17 17 00 05 00 00 00 00 00 00 00 00
00 30 1f 11 00 00 00 70 00 00 00 00 13 00 1e 01
00 1e 5e 15 29 5e 15 13 5c 1d 0d 0b 1d 0d 0b 29
0d 0b 29 5c 0b 29 5c 1d 00 5c 1d 0d 00 00 00 00
00 5c c0 0e 00 00 00 cc 00 5f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 00 00 ff
00 00 00 01 00 00 00 00 00 00 00 ff 00 00 00 01
00 00 00 00 00 00 00 ff 00 00 00 01 00 00 00 00
00 00 00 ff 00 00 00 01 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 5c dc 25 00 00 01 28 00 6f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 08 00 07
00 00 00 09 00 00 00 00 00 08 00 07 00 00 00 09
00 00 00 00 00 08 00 07 00 00 00 09 00 00 00 00
00 08 00 07 00 00 00 09 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 14 9f 1f 00 00 01 3c 03 00 00 00 00 f1 0a f1
00 fb 0d fb
00 20 dd 28 00 00 01 5c 08 86 00 88 ff 06 b1 05
24 24 3c 42 00 00 24 18 a4 24 bc bc 3d 00 a0 8f
00 14 00 2a 00 00 01 70 00 00 30 00 01 05 1b 00
00 00 00 01
00 74 2c 10 00 00 01 e4 00 00 00 00 09 6a 09 b0
0b 12 00 6c 04 0a 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 19 00 00 06 1b 00 00 07
1d 00 00 08 1f 00 00 09 21 00 00 0a 23 00 00 0b
25 00 00 0c 28 00 00 0d 2a 00 00 0e 2d 00 00 0f
2f 00 00 10 32 00 00 11 34 00 00 12 3f ff ff 13
3f ff ff 14
00 74 84 10 ff ff ff ff 01 00 00 00 09 b0 09 ba
0a 0f 00 6c 04 09 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 1a 00 00 06 1c 00 00 07
1f 00 00 08 21 00 00 09 23 00 00 0a 26 00 00 0b
2a 00 00 0c 2d 00 00 0d 31 00 00 0e 34 00 00 0f
3f ff ff 10 3f ff ff 11 3f ff ff 12 3f ff ff 13
3f ff ff 14

View File

@ -0,0 +1,58 @@
# File : crypto_test.conf
######################### crypto_test command configuration ##################
# support algorithm:1-RC4, 2-AES, 3-AES_KEY_WRAP,4-AES-CCM
crypto_test={
CmdCode=0x0078 # do NOT change this line
#EncDec: 0-Decrypt, 1-Encrypt
EncDec:2=0
#Algorithm: 1-RC4, 2-AES, 3-AES_KEY_WRAP
Algorithm:2=1
#KeyIVLength: Length of KeyIV (bytes)
KeyIVLength:2=8
#KeyIV: Key IV
KeyIV:32='0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11'
#KeyLength: Length of Key (bytes)
KeyLength:2=16
#Key: Key
Key:32='0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22'
#DataType: DataType
DataType:2=0x0111
#DataLength: Data Length
DataLength:2={
#Data: Data
Data:8='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
}
}
#####Sample crypto_test command configuration for AES-CCM algorithm #########
#crypto_test={
# CmdCode=0x0078 # do NOT change this line
# #EncDec: 0-Decrypt, 1-Encrypt
# EncDec:2=1
# #Algorithm: 4-AES-CCM
# Algorithm:2=4
# #KeyLength: Length of Key (bytes)
# KeyLength:2=16
# #Key: Key
# Key:32='0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22'
# #NonceLength: Length of Nonce (bytes)
# NonceLength:2=10
# #Nonce: Nonce
# Nonce:14='0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11'
# #AADLength: Length of AAD (bytes)
# AADLength:2=12
# #AAD: AAD
# AAD:32='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
# #DataType: DataType
# DataType:2=0x0111
# #DataLength: Data Length
# DataLength:2={
# #Data: Data
# Data:8='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
# }
#}
######################### End of crypto_test configuration command ##################

View File

@ -0,0 +1,51 @@
#CW_MODE settings configuration
#
CW_MODE={
#Mode of operation 0: Disable current Tx Mode, 1: Continuous Tx Packet, 2: Continuous Wave/Tone
Mode=1
#Channel number
Channel=6
#channel Info
#bit [3:0] - channel offset 0: no secondary channel, 1: secondary channel above, 2: reserved, 3: secondary channel below
#bit [4:7] - channel band 0: 2.4G, 1: 5G, 2: 4G, 3: reserved
Chaninfo=0x00
#Tx power for Cont Tx in dbm
TxPower=12
# Packet Length for Cont Tx
# legacy rates: upto 2312, HT/VHT rates: upto 8K
PktLength=2048
#RateInfo for Cont Tx
RateInfo=0x0000
#rateInfo = 0x0732 : format = VHT, Bandwidth = 80MHz, datarate/MCS index = MCS7
#rateInfo = 0x0000 : format = legacy, Bandwidth = 20MHz, datarate/MCS index = 1Mbps
#rateInfo = 0x0521 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS5
#rateInfo = 0x4521 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS5, NSS = 1
#rateInfo = 0x8921 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS9, NSS = 2
#bit [1:0] - Format 0: legacy, 1: 11n (HT), 2: 11ac (VHT)
#bit 2 - STBC (Not used for Cont Tx test)
#bit 3 - Beamforming (Not used for Cont Tx test)
#bit [5:4] - Bandwidth 0: 20MHz, 2: 40MHz, 3: 80MHz
#bit [7:6] - reserved
#bit [13:8] - index : data rate or MCS
#bit [15:14]- NSS (Used for 2x2 chips). Used in FW only for 2x2 chips.
#<index> can take following values.
#If <format> is 0 (LG), #If <format> is 1 (HT) #If <format> is 2 (VHT)
# NSS = 1 NSS = 1 or 2
# 0 1 Mbps 0 MCS0 0 MCS0
# 1 2 Mbps 1 MCS1 1 MCS1
# 2 5.5 Mbps 2 MCS2 2 MCS2
# 3 11 Mbps 3 MCS3 3 MCS3
# 5 6 Mbps 4 MCS4 4 MCS4
# 6 9 Mbps 5 MCS5 5 MCS5
# 7 12 Mbps 6 MCS6 6 MCS6
# 8 18 Mbps 7 MCS7 7 MCS7
# Used only for NSS = 2
# 9 24 Mbps 8 MCS8
# 10 36 Mbps 9 MCS9
# 11 48 Mbps 10 MCS10
# 12 54 Mbps 11 MCS11
# 12 MCS12
# 13 MCS13
# 14 MCS14
# 15 MCS15
}

View File

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_8997.conf
#
# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8997.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
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
}

View File

@ -0,0 +1,22 @@
# File : host_tdls.conf
######################### HOST TDLS commands configuration ##################
# starts with a command name with parameters embedded inside
host_tdls_config={
uapsd_support=1 # 1: suport uapsd, 0: uapsd not support
cs_support=1 # 1: support channel switch, 0: don't support channel switch
SupportedChannels={
FirstChannelNo=1
NumberofSubBandChannels=11
# multiple instances of First Channel No, Number of SubBand Channels
}
SupportedRegulatoryClasses={
CurrentRegulatoryClass=1
NumofRegulatoryClasses=15
ListOfRegulatoryClasses=1,2,3,4,12,22,23,24,25,27,28,29,30,32,33
}
}
######################### HOST TDLS commands configuration ##################

View File

@ -0,0 +1,11 @@
# File : init_cfg.conf
# MAC address (interface: address)
mac_addr=mlan0: 00:50:43:20:12:34
mac_addr=uap0: 00:50:43:20:12:35
mac_addr=wfd0: 00:50:43:20:12:36
# Register (type, offset, value)
# type 1:MAC/SOC, 2:BBP, 3:RF, 5:CAU
wlan_reg=1,0xA794,0x55FF55FF

View File

@ -0,0 +1,167 @@
# File : mef.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=2 # Unicast frames are received during hostsleepmode
NumEntries=1 # Number of activated MEF entries
#mef_entry_0: example filters to match TCP destination port 80 send by 192.168.0.88 pkt or magic pkt.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=3 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 || Filter_2
#Byte comparison filter's type is 0x41,Decimal comparison filter's type is 0x42,
#Bit comparison filter's type is 0x43
#Filter_0 is decimal comparison filter, it always with type=0x42
#Decimal filter always has type, pattern, offset, numbyte 4 field
#Filter_0 will match rx pkt with TCP destination port 80
Filter_0={
type=0x42 # decimal comparison filter
pattern=80 # 80 is the decimal constant to be compared
offset=44 # 44 is the byte offset of the field in RX pkt to be compare
numbyte=2 # 2 is the number of bytes of the field
}
#Filter_1 is Byte comparison filter, it always with type=0x41
#Byte filter always has type, byte, repeat, offset 4 filed
#Filter_1 will match rx pkt send by IP address 192.168.0.88
Filter_1={
type=0x41 # Byte comparison filter
repeat=1 # 1 copies of 'c0:a8:00:58'
byte=c0:a8:00:58 # 'c0:a8:00:58' is the byte sequence constant with each byte
# in hex format, with ':' as delimiter between two byte.
offset=34 # 34 is the byte offset of the equal length field of rx'd pkt.
}
#Filter_2 is Magic packet, it will looking for 16 contiguous copies of '00:50:43:20:01:02' from
# the rx pkt's offset 14
Filter_2={
type=0x41 # Byte comparison filter
repeat=16 # 16 copies of '00:50:43:20:01:02'
byte=00:50:43:20:01:02 # '00:50:43:20:01:02' is the byte sequence constant
offset=14 # 14 is the byte offset of the equal length field of rx'd pkt.
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,204 @@
# File : mef_mdns.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=8 # Multicast frames are received during hostsleepmode
NumEntries=2 # Number of activated MEF entries
#mef_entry_0: example filters to match WS-Discovery pkt for IPv4.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=08:00
offset=20
}
#Filter_1 will match dest multicast IPv4 address 224.0.0.251
Filter_1={
type=0x41
repeat=1
byte=e0:00:00:fb
offset=38
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=31
numbyte=1
}
#Filter_3 will match UDP port 5353
Filter_3={
type=0x42
pattern=5353
offset=44
numbyte=2
}
}
#mef_entry_1: example filters to match WS-Discovery pkt for IPv6.
mef_entry_1={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=86:dd
offset=20
}
#Filter_1 will match dest multicast IPv6 address FF02::FB
Filter_1={
type=0x41
repeat=1
byte=ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:fb
offset=46
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=28
numbyte=1
}
#Filter_3 will match UDP port 5353
Filter_3={
type=0x42
pattern=5353
offset=64
numbyte=2
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,204 @@
# File : mef_ws_discovery.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=8 # Multicast frames are received during hostsleepmode
NumEntries=2 # Number of activated MEF entries
#mef_entry_0: example filters to match WS-Discovery pkt for IPv4.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=08:00
offset=20
}
#Filter_1 will match dest multicast IPv4 address 239.255.255.250
Filter_1={
type=0x41
repeat=1
byte=ef:ff:ff:fa
offset=38
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=31
numbyte=1
}
#Filter_3 will match UDP port 3702
Filter_3={
type=0x42
pattern=3702
offset=44
numbyte=2
}
}
#mef_entry_1: example filters to match WS-Discovery pkt for IPv6.
mef_entry_1={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=86:dd
offset=20
}
#Filter_1 will match dest multicast IPv6 address FF02::C
Filter_1={
type=0x41
repeat=1
byte=ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:0c
offset=46
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=28
numbyte=1
}
#Filter_3 will match UDP port 3702
Filter_3={
type=0x42
pattern=3702
offset=64
numbyte=2
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
#File : memory/register update
# memory/register update file
mem_set={
CmdCode=0x0086 #do NOT change this line
Action:2=1 # 1 - SET
Rsrvd:2=0
Addr:4=0x8000a584 # memory/register address
Value:4=0x16161669 #Value
}
mem_get={
CmdCode=0x0086 #do NOT change this line
Action:2=0 # 1 - SET
Rsrvd:2=0
Addr:4=0x8000a584 # memory/register address
Result:4=0
}

View File

@ -0,0 +1,30 @@
# Format of the packet data to be sent.
# Update the TxControl value for TxPD, else zero is sent.
# all packet data is written under "Data" block
PktType=0x00 # should be zero for MGMT frames
PktSubType=0x05
# Assoc Request 0
# Assoc Response 1
# Re-Assoc Request 2
# Re-Assoc Response 3
# Probe Request 4
# Probe Response 5
# Beacon 8
# Atim 9
# Dis-assoc 10
# Auth 11
# Deauth 12
# Action Frame 13
FromDS=0
ToDS=0
Addr1=00:50:43:27:B0:41 # Destination address
Addr2=00:50:43:21:0F:84 # Source address
Addr3=00:50:43:21:0F:84 # BSSID
Data=0x01,0x01,0x00,0x0c,0x00,0x58,0x02,0x40
SeqNum=0
FragNum=0

View File

@ -0,0 +1,15 @@
##############management frame filter to wake up host ###########
##### support two entries currently ######
mgmtfilter={
entry_num=1
entry_0={
action=1 # discard and wakeup host
type=0x1 # p2p frames
frame_mask=0x7 # Go neg req & rsp & cfm frame
}
# entry_1={
# action=0 # discard and not wakeup host
# type=0xff # management frames
# frame_mask=0x3 # assoc req & rsp frame
# }
}

View File

@ -0,0 +1,7 @@
07 01 03 3A 80 00 3A 00 ff ff 00 17 03 00 07 03
09 00 0e 10 16 02 19 25 1a 04 1c ff 32 5e 33 15
35 29 36 17 4b 74 4c 64 4d 3b 50 27 61 d6 62 98
6b ae 6f 5b 77 f2 79 ff 7f 2d
07 01 12 16 c0 00 ff ff ff ff 00 05 03 10 32 5c
33 1a 6b a2 7f 20

View File

@ -0,0 +1,11 @@
# File : pad_cfg.conf
## Get CFG data for PAD OR
pad_cfg_get={
CmdCode=0x008f # do NOT change this line
Action:2=0 # 0 - GET
Type:2=5 # 5 - optimized pad reg
CfgLen:2={
}
}

View File

@ -0,0 +1,15 @@
# File : requesttpc.conf
######################### requesttpc command configuration ##################
requesttpc={
CmdCode=0x0060 # do NOT change this line
#DestMac: Destination STA address
DestMac:6='0x02,0x04,0x0e,0x06,0x01,0x12'
#RateIndex: IEEE Rate index to send request
RateIndex:1=22
#Timeout: Response timeout in ms
Timeout:2=10
}
######################### End of requesttpc command configuration ##################

View File

@ -0,0 +1,212 @@
# 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_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 enalbe
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
}
}
#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=10000 #(10ms) BTTime must be less than 65535
WlanTime:2=40000 #(40ms) WlanTime must be less than 65535
}
}
#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 ###############

View File

@ -0,0 +1,62 @@
# File : small_debug.conf
######################### DBG Config command ###############
small_debug_enable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x06 # dbgs_cfg_t
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x81 # one entry global enable
# dbgs_t
En_Mask:2=0x0000 # en_mask_id
BaseId:2=0x0000 # base_id
}
small_debug_disable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x00
}
######################### DBG Get Trace Memory ###############
# Disable Air and Host destinations to disable dbgs_drain
# Enable only the Power save ID - Host interface is a course enable - not on specific event
trace_enable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00 # dbgs_cfg_t - don't drain debug
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x02 # 2 entry
# dbgs_t
En_Mask:2=0x5fff # en_mask_id - enable single ID=0x80
BaseId:2=0x0020 # base_id
En_Mask:2=0x5fff # en_mask_id - enable single ID=0x80
BaseId:2=0x0021 # base_id
}
get_trace={
CmdCode=0x008c # do NOT change this line
startAddress:4=0x02 # read trace memeory - not a generic memory read
len:2=0x0000 # First read=0 - for next reads use the returned next start
}
trace_disable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00 # dbgs_cfg_t - don't drain debug
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x01 # one entry
# dbgs_t
En_Mask:2=0x0000 # en_mask_id
BaseId:2=0x0000 # base_id
}

View File

@ -0,0 +1,124 @@
# File : smc.conf
smc_get={
CmdCode=0x012d #do not change this
Action:2=0 # GET
}
smc_set={
CmdCode=0x012d #do not change this
Action:2=1 # SET
# SSID
SSIDHeaderType:2=0x0000
SSIDHeaderLen:2={
SSID:10="Marvell_SMC_1"
}
# Beacon Period.
# This should be smaller than than MinScanTime.
BeaconHeaderType:2=0x012c
BeaconHeaderLen:2={
beaconPeriod:2=30
}
# Channel list.
# ChanNumber, MinScanTime and ScanTime are mandatory.
# MinScanTime is minimum dwelling time for ChanNumber channel.
# ScanTime is maximum dwelling time for ChanNumber channel.
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
# Following four line define one channel.
# Please add similar four lines with different channel number for new channel.
Chan1_RadioType:1=0
Chan1_ChanNumber:1=1
Chan1_ScanType:1=2
Chan1_MinScanTime:2=40
Chan1_ScanTime:2=200
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=3
Chan2_MinScanTime:2=40
Chan2_ScanTime:2=200
Chan3_RadioType:1=0
Chan3_ChanNumber:1=9
Chan3_ScanType:1=2
Chan3_MinScanTime:2=40
Chan3_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=11
Chan2_ScanType:1=3
Chan2_MinScanTime:2=40
Chan2_ScanTime:2=200
}
#Custom IE
#Currently max size of custom IE supported is 50 bytes.
#
# CustomHeaderType:2=0x010a
# CustomHeaderLen:2={
# start:1=0xdd
# start:1=0x10
# start:1=0x00
# start:1=0x01
# start:1=0x02
# start:1=0x03
# start:1=0x04
# start:1=0x05
# start:1=0x06
# start:1=0x07
# start:1=0x08
# start:1=0x09
# start:1=0x0a
# start:1=0x0b
# start:1=0x0c
# start:1=0x0d
# start:1=0x0e
# start:1=0x0f
# }
#Multicast mac filtering address
#All the multicast packets from starting mac address to ending mac address would
#be captured and sent to the host.
MACHeaderType:2=0x01cc
MACHeaderLen:2={
#Staring Multicast mac address
start:1=0x01
start:1=0x00
start:1=0x5e
start:1=0x00
start:1=0x00
start:1=0x01
#Ending Multicast mac address
end:1=0x01
end:1=0x00
end:1=0x5e
end:1=0x7f
end:1=0xff
end:1=0xff
#FilterType
# 1 for RX AP frames
# 2 for RX STA frames
# 3 for both
Filter:2=0x3
}
}
smc_start={
CmdCode=0x012d #do not change this
Action:2=2 # START
}
smc_stop={
CmdCode=0x012d #do not change this
Action:2=3 # STOP
}

View File

@ -0,0 +1,103 @@
# File : subevent.conf
######################### Subscribe Events command ##################
subevent_get={
CmdCode=0x0075 # do NOT change this line
Action:2=0 # GET
Events:2=0
}
subevent_set={
CmdCode=0x0075 # do NOT change this line
Action:2=1 # SET
Events:2=0xbc8 # bit0 - Beacon RSSI_LOW
# bit1 - Beacon SNR_LOW
# bit2 - FAILED_COUNT
# bit3 - Beacon Missed
# bit4 - Beacon RSSI_HIGH
# bit5 - Beacon SNR_HIGH
# bit6 - Data RSSI_LOW
# bit7 - Data SNR_LOW
# bit8 - Data RSSI_HIGH
# bit9 - Data SNR_HIGH
# bit10 - LINK_QUALITY
# bit11 - PRE_BCN_LOST
# bit12-15 - Reserved
LowRssiTlvType:2=0x0104
LowRssiTlvLength:2={
Threshold:1=70
ReportingFreq:1=0
}
LowSnrTlvType:2=0x0105
LowSnrTlvLength:2={
Threshold:1=56
ReportingFreq:1=0
}
FailedCountTlvType:2=0x0106
FailedCountTlvLength:2={
Threshold:1=5
ReportingFreq:1=0
}
BeaconMissTlvType:2=0x0107
BeaconMissTlvLength:2={
BeaconMissed:1=60
Reserved:1=0
}
HighRssiTlvType:2=0x0116
HighRssiTlvLength:2={
Threshold:1=40
ReportingFreq:1=0
}
HighSnrTlvType:2=0x0117
HighSnrTlvLength:2={
Threshold:1=86
ReportingFreq:1=0
}
DataLowRssiTlvType:2=0x0126
DataLowRssiTlvLength:2={
Threshold:1=10
ReportingFreq:1=0
}
DataLowSnrTlvType:2=0x0127
DataLowSnrTlvLength:2={
Threshold:1=66
ReportingFreq:1=0
}
DataHighRssiTlvType:2=0x0128
DataHighRssiTlvLength:2={
Threshold:1=50
ReportingFreq:1=0
}
DataHighSnrTlvType:2=0x0129
DataHighSnrTlvLength:2={
Threshold:1=96
ReportingFreq:1=1
}
LinkQualityTlvType:2=0x0124
LinkQualityTlvType:2={
LinkSNRThreshold:2=0x0056
LinkSNRFrequency:2=0x0003
MinRateVal:2=0x0014
MinRateFreq:2=0x0003
TxLatencyVal:4=0x00C8
TxLatencyThreshold:4=0x0003
}
PreBcnLostTlvType:2=0x0149
PreBcnLostTlvLength:2={
PreBeaconCnt:1=30
Reserved:1=0
}
}
######################### Subscribe Events command ##################

View File

@ -0,0 +1,118 @@
# File : tdls.conf
######################### TDLS commands configuration ##################
# starts with a command name with parameters embedded inside
tdls_setinfo={
CapInfo=0x2421
Rate=0x02,0x04,0x0b,0x16,0x0C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
QosInfo=0x0F # 1 byte qos capability field. Valid values 0x00 or 0x0F
# For AMPDU over direct link, this should be 0x00
ExtendCapabilities=0x00,0x00,0x00,0x50,0x20 # Enable Peer U-APSD(Bit28), TDLS channel switch(Bit30), TDLS(Bit37)
HTCapability={
HTCapabilityInfo=0x62 # 2 byte HT capability field.
AMPDUParam=0x3
SupportedMCSSet=0xFF,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
HTExtCapability=0x00
TxBfCapability=0x00
AntennaSel=0x00
}
HTInformation={
PrimaryChannel=1
Field2=0x0
Field3=0x5
Field4=0x0
BasicMCSSet=0xFF,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
# 16 elements as per the structure.
}
2040BSSCoex=0x01 # 1 byte 2040 Coex field.
VHTCapability={
VHTCapabilityInfo=0x33C00000 # 4 byte VHT capability field.
RxMCSMap=0xFFFC
RxMaxRate=0x0000 #bit 29-31 reserved
TxMCSMap=0xFFFC
TxMaxRate=0x0000 #bit 61-63 reserved
}
VHTOper={
ChanWidth=0x01;
ChanCF1=0x01;
ChanCF2=0x01;
BasicMCSMap=0xFF, 0XFF; #Basic MCS set map, each 2 bits stands for a Nss
}
# Uncomment the RSNInfo while testing open-secure network.
RSNInfo={
GroupCipherSuite=0x00,0x0F,0xAC,0x07
PairwiseCipherCount=1
PairwiseCipherSuite=0x00,0x0F,0xAC,0x04 # CCMP
#PairwiseCipherSuite=0x00,0x0F,0xAC,0x02 # TKIP multiple Pairwise Cipher Suite if count > 1.
AKMSuiteCount=1
AKMSuite=0x00,0x0F,0xAC,0x07 # multiple AKM Suite if count > 1.
#AKMSuite=0x00,0x0F,0xAC,0x07 # multiple AKM Suite if count > 1.
RSNCapability=0x200 # Enable PeerKey
PMKIDCount=0
}
SupportedChannels={
FirstChannelNo=1
NumberofSubBandChannels=11
# multiple instances of First Channel No, Number of SubBand Channels
}
SupportedRegulatoryClasses={
CurrentRegulatoryClass=1
NumofRegulatoryClasses=15
ListOfRegulatoryClasses=1,2,3,4,12,22,23,24,25,27,28,29,30,32,33
}
# CountryInfo={
# CountryString="US" # 3 byte country string
# FirstChannel=1
# NumberofChannels=11
# TxPower=30
# # multiple instances of First Channel, Number of Channels, Tx Power
# }
}
tdls_discovery={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
}
tdls_setup={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
WaitTimems=3000 # Time in milliseconds to wait
# for setup response from peer
KeyLifetime=301 # Lifetime of security key in seconds.
}
tdls_teardown={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
ReasonCode=26 # Tear down reason code
}
tdls_channel_switch={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
Band=0 # Band
PrimaryChannel=6 # Primary channel no for channel switching
SecondaryChannelOffset=0 # Secondary channel offset
Periodicity=1 # Channel switch periodicity
ChannelSwitchTime=10 # Channel switch time in ms.
ChannelSwitchTimeout=14 # Channel switch timeout in ms
RegulatoryClass=12 # Target regulatory class
}
tdls_cs_params={
UnitTime=2 # Unit time, multiples of 10 ms
ThresholdOtherLink=10 # Threshold for other link
ThresholdDirectLink=1 # Threshold for direct link
}
tdls_stop_channel_switch={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
}
tdls_powermode={
PeerMAC=00:50:43:27:B0:41 # MAC address of Peer
PowerMode=1 # 0: Active, 1 : Power Save
}
######################### TDLS commands configuration ##################

View File

@ -0,0 +1,100 @@
# TSPEC contents for TID=0, UserPriority = 6
[tspec0]
# Element ID
dd
# Length
3d
# OUI
00 50 f2
# OUI Type
02
# OUI SubType
02
# Version
01
# TSInfo
e0 34 00
# Nominal MSDU Size
d0 80
# Maximum MSDU Size
d0 00
# Min Service Interval
20 4e 00 00
# Max Service Interval
20 4e 00 00
# Inactivity Interval
80 96 98 00
# Suspension Interval
ff ff ff ff
# Service Start Time
00 00 00 00
# Minimum Data Rate
00 45 01 00
# Mean Data Rate
00 45 01 00
# Peak Data Rate
00 45 01 00
# Max Burst Size
00 00 00 00
# Delay Bound
00 00 00 00
# Min PHY Rate
00 1b b7 00
# Surplus Bandwidth Allowance
00 30
# Medium Time
00 00
# Extra Data Bytes
[/tspec0]
# TSPEC contents for TID=1, UserPriority = 4
[tspec1]
# Element ID
dd
# Length
3d
# OUI
00 50 f2
# OUI Type
02
# OUI SubType
02
# Version
01
# TSInfo
e3 20 00
# Nominal MSDU Size
96 00
# Maximum MSDU Size
dc 05
# Min Service Interval
00 00 00 00
# Max Service Interval
00 00 00 00
# Inactivity Interval
00 00 00 00
# Suspension Interval
ff ff ff ff
# Service Start Time
00 00 00 00
# Minimum Data Rate
a0 00 00 00
# Mean Data Rate
a0 00 00 00
# Peak Data Rate
a0 00 00 00
# Max Burst Size
00 00 00 00
# Delay Bound
00 00 00 00
# Min PHY Rate
80 8d 5b 00
# Surplus Bandwidth Allowance
00 30
# Medium Time
00 00
# Extra Data Bytes
dd 04 00 50 43 ff
[/tspec1]

View File

@ -0,0 +1,9 @@
#File : turbo_mode.conf
## WMM turbo mode config command
turbo_mode_set={
CmdCode=0x0016 # do NOT change this line
Action:2=1 # 1 - SET
OID:2=0x27 # OID_WMM_TURBO_MODE
Size:2=128
Value:128=5 # 1 -- Enable turbo_mode_1; 2 -- Enable turbo_mode_2; otherwise, disable turbo_mode
}

View File

@ -0,0 +1,58 @@
#protocol
Protocol=0x88dc
# configure data rate in unit of 0.5Mbps
# 0 - auto rate determined by firmware
# Any other data rate except these data rates will
# be overwritten by default data rate.
# datarate index, unit in 0.5Mbps
# Index | 20MHz | 10MHz
# 12 | 6Mbps | 3Mbps
# 18 | 9Mbps | 4.5Mbps
# 24 | 12Mbps | 6Mbps
# 36 | 18Mbps | 9Mbps
# 48 | 24Mbps | 12Mbps
# 72 | 36Mbps | 18Mbps
# 96 | 48Mbps | 24Mbps
# 108 | 54Mbps | 27.5Mbps
Datarate=12
# configure Channel for the packet
# 0 - the channel set during the enable would be used
Channel=0
# configure Bandwith (only for 11p)
# 0: auto bandwith setting by firmware
# bit4: 1 use bit[3:0] bandwith setting
# bit[3:0]:
# 0 - 5MHz
# 1 - 10MHz
# 2 - 20MHz
# 3 - 40MHz
# 4 - 80MHz
Bandwidth=0x00
# configure power settings
# bit[7] host tx power control flag
# 0x0: use fw setting for tx power
# 0x1: value specified in bit[6] and bit[5:0] are valid
# bit[6] sign of the power specified in bit[5:0]
# 0x0: power specified in bit[5:0] is postive (+)
# 0x1: power specified in bit[5:0] is negative (-)
# bit[5:0] power to be used for transmission (in dBm)
Power=0x00
# configure Priority of the packet
# 1,2 - BK
# 0,3 - BE
# 4,5 - VI
# 6,7 - VO
Priority=0
# configure tx retry time
Retry_limit=0
# Destination MAC Address
Addr=00:50:43:22:0f:b0
Data=0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19

View File

@ -0,0 +1,759 @@
# 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)
}
#ifdef VHT2G_SUPPORT
## Set CFG data for Tx power limitation
##
## TLVStartFreq: Starting Frequency of the band for this channel
## 2407, 2414 or 2400 for 2.4 GHz
## 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) : Redundent Rates for 2G
## 19: VHT_80_QAM16 (MCS3,4) : Redundent Rates for 2G
## 20: VHT_80_QAM64 (MCS5,6,7) : Redundent Rates for 2G
## 21: VHT_80_QAM256 (MCS8,9) : Redundent Rates for 2G
## 22: VHT2_20_QAM256 (MCS8,9)
## 23: VHT2_40_QAM256 (MCS8,9)
## Power Limit in dBm
##
##
## 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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
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,16,12,17,12,18,0,19,0,20,0,21,0,22,12,23,12'
}
}
#else
## 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
##
## Note: For KF, add VHT 20/40/80 1SS/2SS mod group.
## 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'
}
}
#endif
## 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'
}
}

View File

@ -0,0 +1,171 @@
# File : txrate_cfg.conf
## Tx Rate Configuration command
txrate_cfg_get={
CmdCode=0x00d6 # do NOT change this line
Action:2=0 # 0 - GET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
}
}
txrate_cfg_set_bg={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
################# TXRATE SCOPE ######################
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 1 Mbps
# 1 2 Mbps
# 2 5.5 Mbps
# 3 11 Mbps
# 4 Reserved
HRDSSS.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 6 Mbps
# 1 9 Mbps
# 2 12 Mbps
# 3 18 Mbps
# 4 24 Mbps
# 5 36 Mbps
# 6 48 Mbps
# 7 54 Mbps
OFDM.RateScope:2=0x0080
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 MCS0
# 1 MCS1
# 2 MCS2
# 3 MCS3
# 4 MCS4
# 5 MCS5
# 6 MCS6
# 7 MCS7
# 32 MCS32
HT.RateScopeDword0:4=0x00000000
HT.RateScopeDword1:4=0x00000000
HT.RateScopeDword2:4=0x00000000
HT.RateScopeDword3:4=0x00000000
}
TxRateDrop.TlvType:2=0x0151
TxRateDrop.TlvLength:2={
RateDrop.Mode:4=0x00000001
}
}
txrate_cfg_set_bgn={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
################# TXRATE SCOPE ######################
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 1 Mbps
# 1 2 Mbps
# 2 5.5 Mbps
# 3 11 Mbps
# 4 Reserved
HRDSSS.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 6 Mbps
# 1 9 Mbps
# 2 12 Mbps
# 3 18 Mbps
# 4 24 Mbps
# 5 36 Mbps
# 6 48 Mbps
# 7 54 Mbps
OFDM.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 MCS0
# 1 MCS1
# 2 MCS2
# 3 MCS3
# 4 MCS4
# 5 MCS5
# 6 MCS6
# 7 MCS7
# 32 MCS32
HT.RateScopeDword0:4=0x00000080
HT.RateScopeDword1:4=0x00000000
HT.RateScopeDword2:4=0x00000000
HT.RateScopeDword3:4=0x00000000
}
TxRateDrop.TlvType:2=0x0151
TxRateDrop.TlvLength:2={
RateDrop.Mode:4=0x00000001
}
}
########supported BasicRate setting###########
basic_rate_get={
CmdCode=0x00d6 # do NOT change this line
Action:2=0 # 0 - GET
Index:2=0 # do NOT change this line
TlvType:2=0x21a
TlvLength:2={
}
}
basic_rate_set={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TlvType:2=0x21a
TlvLength:2={
BasicRateSupport:2=0x000f #defalt value
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit BasicRateSupport
# 0 DBPSK1Mbps
# 1 DQPSK2Mbps
# 2 CCK5_5Mbps
# 3 CCK11Mbps
# 4 Not used.
# 5 OFDM6Mbps
# 6 OFDM9Mbps
# 7 OFDM12Mbps
# 8 OFDM18Mbps
# 9 OFDM24Mbps
# 10 OFDM36Mbps
# 11 OFDM48Mbps
# 12 OFDM54Mbps
# 13-15 Reserved
#note: value0x0 represents no setting value
#For example:
#BasicRateSupport:2=0x3 set supported BasicRate to DBPSK1Mbps, DQPSK2Mbps
#BasicRateSupport:2=0x180 set supported BasicRate to OFDM18Mbps, OFDM12Mbps
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,791 @@
/** @file mlanconfig.h
*
* @brief This file contains definitions for application
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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 _MLANCONFIG_H_
#define _MLANCONFIG_H_
/** Include header files */
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <linux/if.h>
#include <linux/wireless.h>
#include <sys/types.h>
#include <linux/if_ether.h>
#include <time.h>
#if (BYTE_ORDER == LITTLE_ENDIAN)
#undef BIG_ENDIAN_SUPPORT
#endif
/** Type definition: boolean */
typedef enum { FALSE, TRUE } boolean;
/**
* This macro specifies the attribute pack used for structure packing
*/
#ifndef __ATTRIB_PACK__
#define __ATTRIB_PACK__ __attribute__((packed))
#endif
/** 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 */
#ifdef BIG_ENDIAN_SUPPORT
/** CPU to little-endian convert for 16-bit */
#define cpu_to_le16(x) swap_byte_16(x)
/** CPU to little-endian convert for 32-bit */
#define cpu_to_le32(x) swap_byte_32(x)
/** Little-endian to CPU convert for 16-bit */
#define le16_to_cpu(x) swap_byte_16(x)
/** Little-endian to CPU convert for 32-bit */
#define le32_to_cpu(x) swap_byte_32(x)
#else
/** 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)
#endif
/** Character, 1 byte */
typedef 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;
/** Success */
#define MLAN_STATUS_SUCCESS (0)
/** Failure */
#define MLAN_STATUS_FAILURE (-1)
t_s8 *mlan_config_get_line(FILE * fp, t_s8 *s, t_s32 size, int *line);
int get_priv_ioctl(char *ioctl_name, int *ioctl_val, int *subioctl_val);
int fparse_for_hex(FILE * fp, t_u8 *dst);
/**
* Hex or Decimal to Integer
* @param num string to convert into decimal or hex
*/
#define A2HEXDECIMAL(num) \
(strncasecmp("0x", (num), 2)?(unsigned int) strtoll((num),NULL,0):a2hex((num)))
/** Convert character to integer */
#define CHAR2INT(x) (((x) >= 'A') ? ((x) - 'A' + 10) : ((x) - '0'))
/** Convert TLV header from little endian format to CPU format */
#define endian_convert_tlv_header_in(x) \
{ \
(x)->tag = le16_to_cpu((x)->tag); \
(x)->length = le16_to_cpu((x)->length); \
}
/** Convert TLV header to little endian format from CPU format */
#define endian_convert_tlv_header_out(x) \
{ \
(x)->tag = cpu_to_le16((x)->tag); \
(x)->length = cpu_to_le16((x)->length); \
}
/** Private command ID to pass custom IE list */
#define CUSTOM_IE_CFG (SIOCDEVPRIVATE + 13)
/* TLV Definitions */
/** TLV header */
#define TLVHEADER /** Tag */ \
t_u16 tag; \
/** Length */ \
t_u16 length
/** Maximum IE buffer length */
#define MAX_IE_BUFFER_LEN 256
/** TLV: Management IE list */
#define MRVL_MGMT_IE_LIST_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0x69) //0x0169
/** TLV: Max Management IE */
#define MRVL_MAX_MGMT_IE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0xaa) //0x01aa
/** custom IE info */
typedef struct _custom_ie_info {
/** size of buffer */
t_u16 buf_size;
/** no of buffers of buf_size */
t_u16 buf_count;
} __ATTRIB_PACK__ custom_ie_info;
/** TLV buffer : custom IE */
typedef struct _tlvbuf_max_mgmt_ie {
/** Header */
TLVHEADER;
/** No of tuples */
t_u16 count;
/** custom IE info tuples */
custom_ie_info info[0];
} __ATTRIB_PACK__ tlvbuf_max_mgmt_ie;
/** custom IE */
typedef struct _custom_ie {
/** IE Index */
t_u16 ie_index;
/** Mgmt Subtype Mask */
t_u16 mgmt_subtype_mask;
/** IE Length */
t_u16 ie_length;
/** IE buffer */
t_u8 ie_buffer[0];
} __ATTRIB_PACK__ custom_ie;
/** TLV buffer : custom IE */
typedef struct _tlvbuf_custom_ie {
/** Header */
TLVHEADER;
/** custom IE data */
custom_ie ie_data[0];
} __ATTRIB_PACK__ tlvbuf_custom_ie;
/** Maximum length of lines in configuration file */
#define MAX_CONFIG_LINE 1024
/** Ethernet address length */
#define ETH_ALEN 6
/** MAC BROADCAST */
#define MAC_BROADCAST 0x1FF
/** MAC MULTICAST */
#define MAC_MULTICAST 0x1FE
/** pkt_header */
typedef struct _pkt_header {
/** pkt_len */
t_u32 pkt_len;
/** pkt_type */
t_u32 TxPktType;
/** tx control */
t_u32 TxControl;
} pkt_header;
/** wlan_802_11_header packet from FW with length */
typedef struct _wlan_mgmt_frame_tx {
/** Packet Length */
t_u16 frm_len;
/** Frame Control */
t_u16 frm_ctl;
/** Duration ID */
t_u16 duration_id;
/** Address1 */
t_u8 addr1[ETH_ALEN];
/** Address2 */
t_u8 addr2[ETH_ALEN];
/** Address3 */
t_u8 addr3[ETH_ALEN];
/** Sequence Control */
t_u16 seq_ctl;
/** Address4 */
t_u8 addr4[ETH_ALEN];
/** Frame payload */
t_u8 payload[0];
} __ATTRIB_PACK__ wlan_mgmt_frame_tx;
/** frame tx ioctl number */
#define FRAME_TX_IOCTL (SIOCDEVPRIVATE + 12)
/** band BG */
#define BAND_BG 0
/** band A */
#define BAND_A 1
/** secondary channel is above */
#define SECOND_CHANNEL_ABOVE 0x1
/** secondary channel is below */
#define SECOND_CHANNEL_BELOW 0x3
/** NO PERIODIC SWITCH */
#define NO_PERIODIC_SWITCH 0
/** Enable periodic channel switch */
#define ENABLE_PERIODIC_SWITCH 1
/** Min channel value for BG band */
#define MIN_BG_CHANNEL 1
/** Max channel value for BG band */
#define MAX_BG_CHANNEL 14
/** Max channel value for A band */
#define MIN_A_CHANNEL 36
/** Max channel value for A band */
#define MAX_A_CHANNEL 252
/** Host Command ioctl number */
#define TDLS_IOCTL (SIOCDEVPRIVATE + 5)
/** TDLS action definitions */
/** Action ID for TDLS config */
#define ACTION_TDLS_CONFIG 0x0000
/** Action ID for TDLS setinfo request */
#define ACTION_TDLS_SETINFO 0x0001
/** Action ID for TDLS Discovery request */
#define ACTION_TDLS_DISCOVERY 0x0002
/** Action ID for TDLS setup request */
#define ACTION_TDLS_SETUP 0x0003
/** Action ID for TDLS Teardown request */
#define ACTION_TDLS_TEARDOWN 0x0004
/** Action ID for TDLS power mode */
#define ACTION_TDLS_POWER_MODE 0x0005
/**Action ID for init TDLS Channel Switch*/
#define ACTION_TDLS_INIT_CHAN_SWITCH 0x06
/** Action ID for stop TDLS Channel Switch */
#define ACTION_TDLS_STOP_CHAN_SWITCH 0x07
/** Action ID for configure CS related parameters */
#define ACTION_TDLS_CS_PARAMS 0x08
/** Action ID for TDLS Disable Channel switch */
#define ACTION_TDLS_CS_DISABLE 0x09
/** Action ID for TDLS Link status */
#define ACTION_TDLS_LINK_STATUS 0x000A
/** Action ID for TDLS CS immediate return */
#define ACTION_TDLS_DEBUG_CS_RET_IM 0xFFF7
/** Action ID for TDLS Stop RX */
#define ACTION_TDLS_DEBUG_STOP_RX 0xFFF8
/** Action ID for TDLS Allow weak security */
#define ACTION_TDLS_DEBUG_ALLOW_WEAK_SECURITY 0xFFF9
/** Action ID for TDLS Ignore key lifetime expiry */
#define ACTION_TDLS_DEBUG_IGNORE_KEY_EXPIRY 0xFFFA
/** Action ID for TDLS Higher/Lower mac Test */
#define ACTION_TDLS_DEBUG_HIGHER_LOWER_MAC 0xFFFB
/** Action ID for TDLS Prohibited Test */
#define ACTION_TDLS_DEBUG_SETUP_PROHIBITED 0xFFFC
/** Action ID for TDLS Existing link Test */
#define ACTION_TDLS_DEBUG_SETUP_SAME_LINK 0xFFFD
/** Action ID for TDLS Fail Setup Confirm */
#define ACTION_TDLS_DEBUG_FAIL_SETUP_CONFIRM 0xFFFE
/** Action ID for TDLS WRONG BSS Test */
#define ACTION_TDLS_DEBUG_WRONG_BSS 0xFFFF
/** TLV type : Rates */
#define TLV_TYPE_RATES 0x0001
/** TLV type : Domain */
#define TLV_TYPE_DOMAIN 0x0007
/** TLV type : Supported channels */
#define TLV_TYPE_SUPPORTED_CHANNELS 0x0024
/** TLV type : HT Capabilities */
#define TLV_TYPE_HT_CAP 0x002d
/** TLV type : Qos Info */
#define TLV_TYPE_QOSINFO 0x002e
/** TLV type : RSN IE */
#define TLV_TYPE_RSN_IE 0x0030
/** TLV type : extended supported rates */
#define TLV_EXTENDED_SUPPORTED_RATES 0x0032
/** TLV type : timeout interval */
#define TLV_TIMEOUT_INTERVAL 0x0038
/** TLV type : Regulatory classes */
#define TLV_TYPE_REGULATORY_CLASSES 0x003b
/** TLV type : HT Information */
#define TLV_TYPE_HT_INFO 0x003d
/** TLV type : 20/40 BSS Coexistence */
#define TLV_TYPE_2040BSS_COEXISTENCE 0x0048
/** TLv Type : Link identifier */
#define TLV_LINK_IDENTIFIER 0x0065
/** TLV type : Extended capabilities */
#define TLV_TYPE_EXTCAP 0x007f
/** TLV type : VHT capabilities */
#define TLV_TYPE_VHT_CAP 0x00BF
/** TLV type : VHT operations */
#define TLV_TYPE_VHT_OPER 0x00C0
/** Length of Basic MCS MAP */
#define VHT_MCS_MAP_LEN 2
/** Country code length */
#define COUNTRY_CODE_LEN 3
/** Length of Group Cipher Suite */
#define GROUP_CIPHER_SUITE_LEN 4
/** Length of Pairwise Cipher Suite */
#define PAIRWISE_CIPHER_SUITE_LEN 4
/** Length of AKM Suite */
#define AKM_SUITE_LEN 4
/** PMKID length */
#define PMKID_LEN 16
/** Maximum number of pairwise_cipher_suite */
#define MAX_PAIRWISE_CIPHER_SUITE_COUNT 2
/** Maximum number of AKM suite */
#define MAX_AKM_SUITE_COUNT 2
/** Maximum number of PMKID list count */
#define MAX_PMKID_COUNT 2
/** Length of MCS set */
#define MCS_SET_LEN 16
/** Version in RSN IE */
#define VERSION_RSN_IE 0x0001
/** tdls setinfo */
typedef struct _tdls_setinfo {
/** Action */
t_u16 action;
/** (TLV + capInfo) length */
t_u16 tlv_len;
/** Capability Info */
t_u16 cap_info;
/** tdls info */
t_u8 tlv_buffer[0];
} __ATTRIB_PACK__ tdls_setinfo;
/** tdls discovery */
typedef struct _tdls_discovery {
/** Action */
t_u16 action;
/** Peer MAC address */
t_u8 peer_mac[ETH_ALEN];
} __ATTRIB_PACK__ tdls_discovery;
/** tdls link status */
typedef struct _tdls_links_status {
/** Action */
t_u16 action;
} __ATTRIB_PACK__ tdls_link_status;
/** tdls discovery response */
typedef struct _tdls_discovery_resp {
/** Action */
t_u16 action;
/** payload length */
t_u16 payload_len;
/** peer mac Address */
t_u8 peer_mac[ETH_ALEN];
/** RSSI */
signed char rssi;
/** Cap Info */
t_u16 cap_info;
/** TLV buffer */
t_u8 tlv_buffer[0];
} __ATTRIB_PACK__ tdls_discovery_resp;
/** tdls each link rate information */
typedef struct _tdls_link_rate_info {
/** Tx Data Rate */
t_u8 tx_data_rate;
/** Tx Rate HT info*/
t_u8 tx_rate_htinfo;
} __ATTRIB_PACK__ tdls_link_rate_info;
/** tdls each link status */
typedef struct _tdls_each_link_status {
/** peer mac Address */
t_u8 peer_mac[ETH_ALEN];
/** Link Flags */
t_u8 link_flags;
/** Traffic Status */
t_u8 traffic_status;
/** Tx Failure Count */
t_u8 tx_fail_count;
/** Channel Number */
t_u32 active_channel;
/** Last Data RSSI in dBm */
t_s16 data_rssi_last;
/** Last Data NF in dBm */
t_s16 data_nf_last;
/** AVG DATA RSSI in dBm */
t_s16 data_rssi_avg;
/** AVG DATA NF in dBm */
t_s16 data_nf_avg;
union {
/** tdls rate info */
tdls_link_rate_info rate_info;
/** final rate value*/
t_u16 final_data_rate;
} u;
/** Security Method */
t_u8 security_method;
/** Key Lifetime */
t_u32 key_lifetime;
/** Key Length */
t_u8 key_length;
/** actual key */
t_u8 key[0];
} __ATTRIB_PACK__ tdls_each_link_status;
/** tdls link status response */
typedef struct _tdls_link_status_resp {
/** Action */
t_u16 action;
/** payload length */
t_u16 payload_len;
/** number of links */
t_u8 active_links;
/** structure for link status */
tdls_each_link_status link_stats[1];
} __ATTRIB_PACK__ tdls_link_status_resp;
/** tdls setup */
typedef struct _tdls_setup {
/** Action */
t_u16 action;
/** Peer MAC address */
t_u8 peer_mac[ETH_ALEN];
/** Time to wait for response from peer*/
t_u32 wait_time;
/** Key Life Time */
t_u32 key_life_time;
} __ATTRIB_PACK__ tdls_setup;
/** tdls tear down */
typedef struct _tdls_tear_down {
/** Action */
t_u16 action;
/** Peer MAC address */
t_u8 peer_mac[ETH_ALEN];
/** Reason code */
t_u16 reason_code;
} __ATTRIB_PACK__ tdls_teardown;
/** tdls power mode */
typedef struct _tdls_power_mode {
/** Action */
t_u16 action;
/** Peer MAC address */
t_u8 peer_mac[ETH_ALEN];
/** Power mode */
t_u16 power_mode;
} __ATTRIB_PACK__ tdls_powermode;
/** tdls channel switch info */
typedef struct _tdls_channel_switch {
/** Action */
t_u16 action;
/** peer mac Address */
t_u8 peer_mac[ETH_ALEN];
/** Channel Switch primary channel no */
t_u8 primary_channel;
/** Channel Switch secondary channel offset */
t_u8 secondary_channel_offset;
/** Channel Switch Band */
t_u8 band;
/** Channel Switch time*/
t_u16 switch_time;
/** Channel Switch timeout*/
t_u16 switch_timeout;
/** Channel Regulatory class*/
t_u8 regulatory_class;
/** Channel Switch periodicity*/
t_u8 periodicity;
} __ATTRIB_PACK__ tdls_channel_switch;
/** tdls stop channel switch */
typedef struct _tdls_stop_chan_switch {
/** Action */
t_u16 action;
/** Peer MAC address */
t_u8 peer_mac[ETH_ALEN];
} __ATTRIB_PACK__ tdls_stop_chan_switch;
/** tdls disable channel switch */
typedef struct _tdls_disable_cs {
/** Action */
t_u16 action;
/** Data*/
t_u16 data;
} __ATTRIB_PACK__ tdls_disable_cs, tdls_config;
/** tdls channel switch parameters */
typedef struct _tdls_cs_params {
/** Action */
t_u16 action;
/** unit time, multiples of 10ms */
t_u8 unit_time;
/** threshold for other link */
t_u8 threshold_otherlink;
/** threshold for direct link */
t_u8 threshold_directlink;
} __ATTRIB_PACK__ tdls_cs_params;
/** tdls debug */
typedef struct _tdls_debug {
/** Action */
t_u16 action;
/** Data */
t_u8 data[0];
} __ATTRIB_PACK__ tdls_debug;
/** TLV header */
#define TLVHEADER /** Tag */ \
t_u16 tag; \
/** Length */ \
t_u16 length
/** Length of TLV header */
#define TLVHEADER_LEN 4
/** Data structure for subband set */
typedef struct _IEEEtypes_SubbandSet_t {
/** First channel */
t_u8 first_chan;
/** Number of channels */
t_u8 no_of_chan;
/** Maximum Tx power */
t_u8 max_tx_pwr;
} __ATTRIB_PACK__ IEEEtypes_SubbandSet_t, *pIEEEtypes_SubbandSet_t;
/** tlvbuf_DomainParamSet_t */
typedef struct _tlvbuf_DomainParamSet {
/** Header */
TLVHEADER;
/** Country code */
t_u8 country_code[COUNTRY_CODE_LEN];
/** Set of subbands */
IEEEtypes_SubbandSet_t sub_band[0];
} __ATTRIB_PACK__ tlvbuf_DomainParamSet_t;
/** Data structure of WMM QoS information */
typedef struct _IEEEtypes_WmmQosInfo_t {
#ifdef BIG_ENDIAN_SUPPORT
/** QoS UAPSD */
t_u8 qos_uapsd:1;
/** Reserved */
t_u8 reserved:3;
/** Parameter set count */
t_u8 para_set_count:4;
#else
/** Parameter set count */
t_u8 para_set_count:4;
/** Reserved */
t_u8 reserved:3;
/** QoS UAPSD */
t_u8 qos_uapsd:1;
#endif /* BIG_ENDIAN_SUPPORT */
} __ATTRIB_PACK__ IEEEtypes_WmmQosInfo_t;
/** Qos Info TLV */
typedef struct _tlvbuf_QosInfo_t {
/** Header */
TLVHEADER;
/** QosInfo */
union {
/** QosInfo bitfield */
IEEEtypes_WmmQosInfo_t qos_info;
/** QosInfo byte */
t_u8 qos_info_byte;
} u;
} __ATTRIB_PACK__ tlvbuf_QosInfo_t;
/** HT Capabilities Data */
typedef struct _HTCap_t {
/** HT Capabilities Info field */
t_u16 ht_cap_info;
/** A-MPDU Parameters field */
t_u8 ampdu_param;
/** Supported MCS Set field */
t_u8 supported_mcs_set[16];
/** HT Extended Capabilities field */
t_u16 ht_ext_cap;
/** Transmit Beamforming Capabilities field */
t_u32 tx_bf_cap;
/** Antenna Selection Capability field */
t_u8 asel;
} __ATTRIB_PACK__ HTCap_t, *pHTCap_t;
/** HT Information Data */
typedef struct _HTInfo_t {
/** Primary channel */
t_u8 pri_chan;
/** Field 2 */
t_u8 field2;
/** Field 3 */
t_u16 field3;
/** Field 4 */
t_u16 field4;
/** Bitmap indicating MCSs supported by all HT STAs in the BSS */
t_u8 basic_mcs_set[16];
} __ATTRIB_PACK__ HTInfo_t, *pHTInfo_t;
/** 20/40 BSS Coexistence Data */
typedef struct _BSSCo2040_t {
/** 20/40 BSS Coexistence value */
t_u8 bss_co_2040_value;
} __ATTRIB_PACK__ BSSCo2040_t, *pBSSCo2040_t;
/** HT Capabilities element */
typedef struct _tlvbuf_HTCap_t {
/** Header */
TLVHEADER;
/** HTCap struct */
HTCap_t ht_cap;
} __ATTRIB_PACK__ tlvbuf_HTCap_t;
/** HT Information element */
typedef struct _tlvbuf_HTInfo_t {
/** Header */
TLVHEADER;
/** HTInfo struct */
HTInfo_t ht_info;
} __ATTRIB_PACK__ tlvbuf_HTInfo_t;
/** VHT MCS rate set field, refer to 802.11ac */
typedef struct _VHT_MCS_set {
t_u16 rx_mcs_map;
t_u16 rx_max_rate; /* bit 29-31 reserved */
t_u16 tx_mcs_map;
t_u16 tx_max_rate; /* bit 61-63 reserved */
} __ATTRIB_PACK__ VHT_MCS_set_t, *pVHT_MCS_set_t;
typedef struct _VHT_capa {
t_u32 vht_cap_info;
VHT_MCS_set_t mcs_sets;
} __ATTRIB_PACK__ VHT_capa_t, *pVHT_capa_t;
/** VHT Capabilities IE */
typedef struct _IEEEtypes_VHTCap_t {
/** Header */
TLVHEADER;
/** VHTInfo struct */
VHT_capa_t vht_cap;
} __ATTRIB_PACK__ tlvbuf_VHTCap_t, *ptlvbuf_VHTCap_t;
/** VHT Operations IE */
typedef struct _IEEEtypes_VHTOprat_t {
/** Header */
TLVHEADER;
/** VHTOpra struct */
t_u8 chan_width;
t_u8 chan_cf1;
t_u8 chan_cf2;
/** Basic MCS set map, each 2 bits stands for a Nss */
t_u8 basic_mcs_map[VHT_MCS_MAP_LEN];
} __ATTRIB_PACK__ tlvbuf_VHTOpra_t, *ptlvbuf_VHTOpra_t;
/** 20/40 BSS Coexistence element */
typedef struct _tlvbuf_2040BSSCo_t {
/** Header */
TLVHEADER;
/** BSSCo2040_t struct */
BSSCo2040_t bss_co_2040;
} __ATTRIB_PACK__ tlvbuf_2040BSSCo_t;
/** Extended Capabilities element */
typedef struct _tlvbuf_ExtCap_t {
/** Header */
TLVHEADER;
/** ExtCap_t struct */
t_u8 ext_cap[0];
} __ATTRIB_PACK__ tlvbuf_ExtCap_t;
/** tlvbuf_RatesParamSet_t */
typedef struct _tlvbuf_RatesParamSet_t {
/** Header */
TLVHEADER;
/** Rates */
t_u8 rates[0];
} __ATTRIB_PACK__ tlvbuf_RatesParamSet_t;
/* IEEE Supported Channel sub-band description (7.3.2.19) */
/* Sub-band description used in the supported channels element. */
typedef struct _IEEEtypes_SupportChan_Subband_t {
t_u8 start_chan;/**< Starting channel in the subband */
t_u8 num_chans; /**< Number of channels in the subband */
} __ATTRIB_PACK__ IEEEtypes_SupportChan_Subband_t;
/* IEEE Supported Channel element (7.3.2.19) */
/**
* Sent in association requests. Details the sub-bands and number
* of channels supported in each subband
*/
typedef struct _tlvbuf_SupportedChannels_t {
/** Header */
TLVHEADER;
/**< IEEE Element ID = 36 */
/** Configured sub-bands information in the element */
IEEEtypes_SupportChan_Subband_t subband[0];
} __ATTRIB_PACK__ tlvbuf_SupportedChannels_t;
/* IEEE Supported Regulatory Classes description (7.3.2.54) */
typedef struct _IEEEtypes_RegulatoryClass_t {
/** current regulatory class */
t_u8 cur_regulatory_class;
/** supported regulatory class list */
t_u8 regulatory_classes_list[0];
} __ATTRIB_PACK__ IEEEtypes_RegulatoryClass_t;
/* IEEE Supported Regulatory Classes TLV (7.3.2.54) */
typedef struct _tlvbuf_RegulatoryClass_t {
/** Header */
TLVHEADER;
/**< IEEE Element ID = 59 */
/** supported regulatory class */
IEEEtypes_RegulatoryClass_t regulatory_class;
} __ATTRIB_PACK__ tlvbuf_RegulatoryClass_t;
/** tlvbuf_RsnParamSet_t */
typedef struct _tlvbuf_RsnParamSet_t {
/** Header */
TLVHEADER;
/** Version */
t_u16 version;
/** Group Cipher Suite */
t_u8 group_cipher_suite[4];
/** Pairwise Cipher Suite count */
t_u16 pairwise_cipher_count;
/** Pairwise Cipher Suite */
t_u8 pairwise_cipher_suite[0];
/** AKM Suite Sount */
t_u16 akm_suite_count;
/** AKM Suite */
t_u8 akm_suite[0];
/** RSN Capability */
t_u16 rsn_capability;
/** PMKID Count */
t_u16 pmkid_count;
/** PMKID list */
t_u8 pmkid_list[0];
} __ATTRIB_PACK__ tlvbuf_RsnParamSet_t;
extern t_s32 sockfd; /**< socket */
extern t_s8 dev_name[IFNAMSIZ + 1]; /**< device name */
#endif /* _MLANCONFIG_H_ */

View File

@ -0,0 +1,951 @@
/** @file mlanhostcmd.c
*
* @brief This file contains mlanconfig helper functions
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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
************************************************************************/
#include "mlanconfig.h"
#include "mlanhostcmd.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @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;
t_s8 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 > MRVDRV_SIZE_OF_CMD_BUFFER) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*size += len;
if (*pos2 == '"') {
pos2++;
if ((pos3 = strchr(pos2, '"')) == 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++;
if ((pos3 = strchr(pos2, '\'')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = ',';
for (i = 0; i < len; i++) {
if ((pos3 = strchr(pos2, ',')) != 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;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief convert char to hex integer
*
* @param chr char to convert
* @return hex integer or 0
*/
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(t_s8 *prompt, t_void *p, t_s32 len, t_s8 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(t_s8 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(t_s8 *s)
{
t_u32 val = 0;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s && isxdigit(*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(t_s8 *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *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
*/
t_s8 *
convert2hex(t_s8 *ptr, t_u8 *chr)
{
t_u8 val;
for (val = 0; *ptr && isxdigit(*ptr); ptr++) {
val = (val * 16) + hexval(*ptr);
}
*chr = val;
return ptr;
}
/**
* @brief Check the Hex String
* @param s A pointer to the string
* @return MLAN_STATUS_SUCCESS --HexString, MLAN_STATUS_FAILURE --not HexString
*/
int
ishexstring(t_s8 *s)
{
int ret = MLAN_STATUS_FAILURE;
t_s32 tmp;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s) {
tmp = toupper(*s);
if (((tmp >= 'A') && (tmp <= 'F')) ||
((tmp >= '0') && (tmp <= '9'))) {
ret = MLAN_STATUS_SUCCESS;
} else {
ret = MLAN_STATUS_FAILURE;
break;
}
s++;
}
return ret;
}
/**
* @brief Convert String to Integer
* @param buf A pointer to the string
* @return Integer
*/
int
atoval(t_s8 *buf)
{
if (!strncasecmp(buf, "0x", 2))
return a2hex(buf + 2);
else if (!ishexstring(buf))
return a2hex(buf);
else
return atoi(buf);
}
/**
* @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
*/
int
prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf)
{
t_s8 line[256], cmdname[256], *pos, cmdcode[10];
HostCmd_DS_GEN *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
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) {
cmdcode_found = 1;
hostcmd->command =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size = S_DS_GEN;
mlan_get_hostcmd_data(fp, &ln,
buf +
hostcmd->size,
&hostcmd->size);
break;
}
}
if (!cmdcode_found) {
fprintf(stderr,
"mlanconfig: CmdCode not found in conf file\n");
return MLAN_STATUS_FAILURE;
}
break;
}
}
if (!cmdname_found) {
fprintf(stderr,
"mlanconfig: 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);
return MLAN_STATUS_SUCCESS;
}
/** Config data header length */
#define CFG_DATA_HEADER_LEN 6
/**
* @brief Prepare cfg-data buffer
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param fp File handler
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf)
{
int ln = 0, type;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_802_11_CFG_DATA *pcfg_data;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA);
pcfg_data = (HostCmd_DS_802_11_CFG_DATA *)(buf + S_DS_GEN);
pcfg_data->action =
(argc == 4) ? HostCmd_ACT_GEN_GET : HostCmd_ACT_GEN_SET;
type = atoi(argv[3]);
if ((type < 1) || (type > 2)) {
fprintf(stderr, "mlanconfig: Invalid register type\n");
return MLAN_STATUS_FAILURE;
} else {
pcfg_data->type = type;
}
if (argc == 5) {
ln = fparse_for_hex(fp, pcfg_data->data);
}
pcfg_data->data_len = ln;
hostcmd->size =
cpu_to_le16(pcfg_data->data_len + S_DS_GEN +
CFG_DATA_HEADER_LEN);
pcfg_data->data_len = cpu_to_le16(pcfg_data->data_len);
pcfg_data->type = cpu_to_le16(pcfg_data->type);
pcfg_data->action = cpu_to_le16(pcfg_data->action);
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}
/**
* @brief Process host_cmd response
* @param buf A pointer to the response buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_host_cmd_resp(t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd = (HostCmd_DS_GEN *)buf;
int ret = MLAN_STATUS_SUCCESS;
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;
}
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 Prepare ARP filter buffer
* @param fp File handler
* @param buf A pointer to the buffer
* @param length A pointer to the length of buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_arp_filter_buffer(FILE * fp, t_u8 *buf, t_u16 *length)
{
t_s8 line[256], *pos;
int ln = 0;
int ret = MLAN_STATUS_SUCCESS;
int arpfilter_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) {
if (strcmp(pos, "arpfilter={") == 0) {
arpfilter_found = 1;
mlan_get_hostcmd_data(fp, &ln, buf, length);
break;
}
}
if (!arpfilter_found) {
fprintf(stderr,
"mlanconfig: 'arpfilter' not found in conf file");
ret = MLAN_STATUS_FAILURE;
}
return ret;
}
/**
* @brief Prepare the hostcmd for register access
* @param type Register type
* @param offset Register offset
* @param value Pointer to value (NULL for read)
* @param buf Pointer to hostcmd buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REG *preg;
hostcmd = (HostCmd_DS_GEN *)buf;
switch (type) {
case 1:
hostcmd->command = cpu_to_le16(HostCmd_CMD_MAC_REG_ACCESS);
break;
case 2:
hostcmd->command = cpu_to_le16(HostCmd_CMD_BBP_REG_ACCESS);
break;
case 3:
hostcmd->command = cpu_to_le16(HostCmd_CMD_RF_REG_ACCESS);
break;
case 5:
hostcmd->command = cpu_to_le16(HostCmd_CMD_CAU_REG_ACCESS);
break;
default:
printf("Invalid register set specified\n");
return -EINVAL;
}
preg = (HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = (value) ? HostCmd_ACT_GEN_SET : HostCmd_ACT_GEN_GET;
preg->action = cpu_to_le16(preg->action);
preg->offset = cpu_to_le16((t_u16)offset);
if (value)
preg->value = cpu_to_le32(*value);
else
preg->value = 0;
hostcmd->size = cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_REG));
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}

View File

@ -0,0 +1,372 @@
/** @file mlanhostcmd.h
*
* @brief This file contains command structures for mlanconfig application
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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 _MLANHOSTCMD_H_
#define _MLANHOSTCMD_H_
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** MLAN MAC Address Length */
#define MLAN_MAC_ADDR_LENGTH (6)
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
/** 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
/** Host Command ID : Memory access */
#define HostCmd_CMD_MEM_ACCESS 0x0086
/** Pre-Authenticate - 11r only */
#define HostCmd_CMD_802_11_AUTHENTICATE 0x0011
/** 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
/** Get TX Power data */
#define HostCmd_CMD_802_11_RF_TX_POWER 0x001e
/** Get the current TSF */
#define HostCmd_CMD_GET_TSF 0x0080
/** Host Command ID : CAU register access */
#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
/** Host Command ID : 802.11 BG scan configuration */
#define HostCmd_CMD_802_11_BG_SCAN_CONFIG 0x006b
/** Host Command ID : Configuration data */
#define HostCmd_CMD_CFG_DATA 0x008f
/** Host Command ID : 802.11 TPC adapt req */
#define HostCmd_CMD_802_11_TPC_ADAPT_REQ 0x0060
/** Host Command ID : 802.11 crypto */
#define HostCmd_CMD_802_11_CRYPTO 0x0078
/** Host Command ID : 802.11 auto Tx */
#define HostCmd_CMD_802_11_AUTO_TX 0x0082
/** Host Command ID : 802.11 subscribe event */
#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
/** Host Command ID : Channel TRPC config */
#define HostCmd_CMD_CHAN_TRPC_CONFIG 0x00fb
/** TLV type ID definition */
#define PROPRIETARY_TLV_BASE_ID 0x0100
/** 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 : Auto Tx */
#define TLV_TYPE_AUTO_TX (PROPRIETARY_TLV_BASE_ID + 0x18) //0x0118
/** 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
/** TLV type: Pre-Beacon Lost */
#define TLV_TYPE_PRE_BEACON_LOST (PROPRIETARY_TLV_BASE_ID + 0x49) //0x0149
/** TLV type : Channel TRPC */
#define TLV_TYPE_CHAN_TRPC (PROPRIETARY_TLV_BASE_ID + 0x89) //0x0189
/* Define general hostcmd data structure */
/** 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;
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;
/** Size of HostCmd_DS_GEN */
#define S_DS_GEN sizeof(HostCmd_DS_GEN)
/** 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;
/** 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;
/** 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;
/** 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;
/** 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)
/** 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;
/** 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;
/** 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;
/* String helper functions */
/** Convert char to hex integer */
int hexval(t_s32 chr);
/** Convert char to hex integer */
t_u8 hexc2bin(t_s8 chr);
/** Convert string to hex integer */
t_u32 a2hex(t_s8 *s);
/** Check the Hex String */
int ishexstring(t_s8 *s);
/** Convert String to integer */
t_u32 a2hex_or_atoi(t_s8 *value);
/** Convert String to Integer */
int atoval(t_s8 *buf);
/** Hump hex data */
void hexdump(t_s8 *prompt, void *p, t_s32 len, t_s8 delim);
/** Convert String to Hex */
t_s8 *convert2hex(t_s8 *ptr, t_u8 *chr);
int process_host_cmd_resp(t_u8 *buf);
int prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf);
int prepare_arp_filter_buffer(FILE * fp, t_u8 *buf, t_u16 *length);
int prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf);
int prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf);
#endif /* _MLANHOSTCMD_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,681 @@
/** @file mlanmisc.h
*
* @brief This file contains command definitions for application
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
03/10/2009: initial version
************************************************************************/
#ifndef _MLANMISC_H_
#define _MLANMISC_H_
/** Maximum size of IEEE Information Elements */
#define IEEE_MAX_IE_SIZE 256
/** Maximum scan response buffer size */
#define SCAN_RESP_BUF_SIZE 2000
#ifdef FALSE
#undef FALSE
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
#ifndef MAX
/** Find maximum value */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif /* MAX */
/** 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;
/** Maximum length of SSID */
#define MRVDRV_MAX_SSID_LENGTH 32
/** Enumeration for scan mode */
enum {
MLAN_SCAN_MODE_UNCHANGED = 0,
MLAN_SCAN_MODE_BSS,
MLAN_SCAN_MODE_IBSS,
MLAN_SCAN_MODE_ANY
};
/** Enumeration for scan type */
enum {
MLAN_SCAN_TYPE_UNCHANGED = 0,
MLAN_SCAN_TYPE_ACTIVE,
MLAN_SCAN_TYPE_PASSIVE
};
/** Length of ethernet address */
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/** Maximum length of SSID list */
#define MRVDRV_MAX_SSID_LIST_LENGTH 10
/** Maximum number of channels that can be sent in a setuserscan ioctl */
#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
/** 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,
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,
} __ATTRIB_PACK__ IEEEtypes_ElementId_e;
/** Capability Bit Map*/
#ifdef BIG_ENDIAN_SUPPORT
typedef struct _IEEEtypes_CapInfo_t {
t_u8 rsrvd1:2;
t_u8 dsss_ofdm:1;
t_u8 rsvrd2:2;
t_u8 short_slot_time:1;
t_u8 rsrvd3:1;
t_u8 spectrum_mgmt:1;
t_u8 chan_agility:1;
t_u8 pbcc:1;
t_u8 short_preamble:1;
t_u8 privacy:1;
t_u8 cf_poll_rqst:1;
t_u8 cf_pollable:1;
t_u8 ibss:1;
t_u8 ess:1;
} __ATTRIB_PACK__ IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t;
#else
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;
#endif /* BIG_ENDIAN_SUPPORT */
/** 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)
/** 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;
/** Size of a TSPEC. Used to allocate necessary buffer space in commands */
#define WMM_TSPEC_SIZE 63
/** Maximum number of AC QOS queues available in the driver/firmware */
#define MAX_AC_QUEUES 4
/** Maximum number of User Priorities */
#define MAX_USER_PRIORITIES 8
/** Extra IE bytes allocated in messages for appended IEs after a TSPEC */
#define WMM_ADDTS_EXTRA_IE_BYTES 256
/**
* @brief Enumeration for the command result from an ADDTS or DELTS command
*/
typedef enum {
TSPEC_RESULT_SUCCESS = 0,
TSPEC_RESULT_EXEC_FAILURE = 1,
TSPEC_RESULT_TIMEOUT = 2,
TSPEC_RESULT_DATA_INVALID = 3,
} __ATTRIB_PACK__ mlan_wmm_tspec_result_e;
/**
* @brief Enumeration for the action field in the Queue configure command
*/
typedef enum {
WMM_QUEUE_CONFIG_ACTION_GET = 0,
WMM_QUEUE_CONFIG_ACTION_SET = 1,
WMM_QUEUE_CONFIG_ACTION_DEFAULT = 2,
WMM_QUEUE_CONFIG_ACTION_MAX
} __ATTRIB_PACK__ mlan_wmm_queue_config_action_e;
/**
* @brief Enumeration for the action field in the queue stats command
*/
typedef enum {
WMM_STATS_ACTION_START = 0,
WMM_STATS_ACTION_STOP = 1,
WMM_STATS_ACTION_GET_CLR = 2,
WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */
WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */
WMM_STATS_ACTION_MAX
} __ATTRIB_PACK__ mlan_wmm_stats_action_e;
/** Data structure of WMM Aci/Aifsn */
typedef struct _IEEEtypes_WmmAciAifsn_t {
#ifdef BIG_ENDIAN_SUPPORT
/** Reserved */
t_u8 reserved:1;
/** Aci */
t_u8 aci:2;
/** Acm */
t_u8 acm:1;
/** Aifsn */
t_u8 aifsn:4;
#else
/** Aifsn */
t_u8 aifsn:4;
/** Acm */
t_u8 acm:1;
/** Aci */
t_u8 aci:2;
/** Reserved */
t_u8 reserved:1;
#endif
} __ATTRIB_PACK__ IEEEtypes_WmmAciAifsn_t, *pIEEEtypes_WmmAciAifsn_t;
/** Data structure of WMM ECW */
typedef struct _IEEEtypes_WmmEcw_t {
#ifdef BIG_ENDIAN_SUPPORT
/** Maximum Ecw */
t_u8 ecw_max:4;
/** Minimum Ecw */
t_u8 ecw_min:4;
#else
/** Minimum Ecw */
t_u8 ecw_min:4;
/** Maximum Ecw */
t_u8 ecw_max:4;
#endif
} __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;
/** Data structure of WMM Info IE */
typedef struct _IEEEtypes_WmmInfo_t {
/**
* WMM Info IE - Vendor Specific Header:
* element_id [221/0xdd]
* Len [7]
* Oui [00:50:f2]
* OuiType [2]
* OuiSubType [0]
* Version [1]
*/
IEEEtypes_VendorHeader_t vend_hdr;
/** QoS information */
IEEEtypes_WmmQosInfo_t qos_info;
} __ATTRIB_PACK__ IEEEtypes_WmmInfo_t, *pIEEEtypes_WmmInfo_t;
/** Data structure of WMM parameter IE */
typedef struct _IEEEtypes_WmmParameter_t {
/**
* WMM Parameter IE - Vendor Specific Header:
* element_id [221/0xdd]
* Len [24]
* Oui [00:50:f2]
* OuiType [2]
* OuiSubType [1]
* Version [1]
*/
IEEEtypes_VendorHeader_t vend_hdr;
/** QoS information */
IEEEtypes_WmmQosInfo_t qos_info;
/** Reserved */
t_u8 reserved;
/** 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__ IEEEtypes_WmmParameter_t, *pIEEEtypes_WmmParameter_t;
/**
* @brief IOCTL structure to send an ADDTS request and retrieve the response.
*
* IOCTL structure from the application layer relayed to firmware to
* instigate an ADDTS management frame with an appropriate TSPEC IE as well
* as any additional IEs appended in the ADDTS Action frame.
*
* @sa wlan_wmm_addts_req_ioctl
*/
typedef struct {
mlan_wmm_tspec_result_e commandResult;
/**< Firmware execution result */
t_u32 timeout_ms; /**< Timeout value in milliseconds */
t_u8 ieeeStatusCode; /**< IEEE status code */
t_u32 ieDataLen;
t_u8 ieData[WMM_TSPEC_SIZE
/**< TSPEC to send in the ADDTS */
+ WMM_ADDTS_EXTRA_IE_BYTES];
/**< ADDTS extra IE buf */
} wlan_ioctl_wmm_addts_req_t;
/**
* @brief IOCTL structure to send a DELTS request.
*
* IOCTL structure from the application layer relayed to firmware to
* instigate an DELTS management frame with an appropriate TSPEC IE.
*
* @sa wlan_wmm_delts_req_ioctl
*/
typedef struct {
mlan_wmm_tspec_result_e commandResult;
/**< Firmware execution result */
t_u8 ieeeReasonCode; /**< IEEE reason code sent, unused for WMM */
t_u32 ieDataLen;
t_u8 ieData[WMM_TSPEC_SIZE];
/**< TSPEC to send in the DELTS */
} wlan_ioctl_wmm_delts_req_t;
/**
* @brief IOCTL structure to configure a specific AC Queue's parameters
*
* IOCTL structure from the application layer relayed to firmware to
* get, set, or default the WMM AC queue parameters.
*
* - msduLifetimeExpiry is ignored if set to 0 on a set command
*
* @sa wlan_wmm_queue_config_ioctl
*/
typedef struct {
mlan_wmm_queue_config_action_e action;
/**< Set, Get, or Default */
mlan_wmm_ac_e accessCategory; /**< WMM_AC_BK(0) to WMM_AC_VO(3) */
t_u16 msduLifetimeExpiry; /**< lifetime expiry in TUs */
t_u8 supportedRates[10]; /**< Not supported yet */
} wlan_ioctl_wmm_queue_config_t;
/** Number of bins in the histogram for the HostCmd_DS_WMM_QUEUE_STATS */
#define WMM_STATS_PKTS_HIST_BINS 7
/**
* @brief IOCTL structure to start, stop, and get statistics for a WMM AC
*
* IOCTL structure from the application layer relayed to firmware to
* start or stop statistical collection for a given AC. Also used to
* retrieve and clear the collected stats on a given AC.
*
* @sa wlan_wmm_queue_stats_ioctl
*/
typedef struct {
mlan_wmm_stats_action_e action;
/**< Start, Stop, or Get */
t_u8 userPriority;
/**< User Priority (0 to 7) */
t_u16 pktCount; /**< Number of successful packets transmitted */
t_u16 pktLoss; /**< Packets lost; not included in pktCount */
t_u32 avgQueueDelay;
/**< Average Queue delay in microseconds */
t_u32 avgTxDelay;/**< Average Transmission delay in microseconds */
t_u16 usedTime; /**< Calculated used time - units of 32 microsec */
t_u16 policedTime;
/**< Calculated policed time - units of 32 microsec */
/** @brief Queue Delay Histogram; number of packets per queue delay range
*
* [0] - 0ms <= delay < 5ms
* [1] - 5ms <= delay < 10ms
* [2] - 10ms <= delay < 20ms
* [3] - 20ms <= delay < 30ms
* [4] - 30ms <= delay < 40ms
* [5] - 40ms <= delay < 50ms
* [6] - 50ms <= delay < msduLifetime (TUs)
*/
t_u16 delayHistogram[WMM_STATS_PKTS_HIST_BINS];
} wlan_ioctl_wmm_queue_stats_t;
/**
* @brief IOCTL and command sub structure for a Traffic stream status.
*/
typedef struct {
t_u8 tid; /**< TSID: Range: 0->7 */
t_u8 valid; /**< TSID specified is valid */
t_u8 accessCategory;/**< AC TSID is active on */
t_u8 userPriority; /**< UP specified for the TSID */
t_u8 psb; /**< Power save mode for TSID: 0 (legacy), 1 (UAPSD) */
t_u8 flowDir; /**< Upstream (0), Downlink(1), Bidirectional(3) */
t_u16 mediumTime; /**< Medium time granted for the TSID */
} __ATTRIB_PACK__ HostCmd_DS_WMM_TS_STATUS,
wlan_ioctl_wmm_ts_status_t, wlan_cmd_wmm_ts_status_t;
/**
* @brief IOCTL sub structure for a specific WMM AC Status
*/
typedef struct {
/** WMM Acm */
t_u8 wmmAcm;
/** Flow required flag */
t_u8 flowRequired;
/** Flow created flag */
t_u8 flowCreated;
/** Disabled flag */
t_u8 disabled;
/** delivery enabled */
t_u8 deliveryEnabled;
/** trigger enabled */
t_u8 triggerEnabled;
} wlan_ioctl_wmm_queue_status_ac_t;
/**
* @brief IOCTL structure to retrieve the WMM AC Queue status
*
* IOCTL structure from the application layer to retrieve:
* - ACM bit setting for the AC
* - Firmware status (flow required, flow created, flow disabled)
*
* @sa wlan_wmm_queue_status_ioctl
*/
typedef struct {
/** WMM AC queue status */
wlan_ioctl_wmm_queue_status_ac_t acStatus[MAX_AC_QUEUES];
} wlan_ioctl_wmm_queue_status_t;
typedef struct _wlan_get_scan_table_fixed {
/** BSSID of this network */
t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
/** Channel this beacon/probe response was detected */
t_u8 channel;
/** RSSI for the received packet */
t_u8 rssi;
/** TSF value from the firmware at packet reception */
t_u64 network_tsf;
} wlan_get_scan_table_fixed;
/**
* Structure passed in the wlan_ioctl_get_scan_table_info for each
* BSS returned in the WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_scan_table_entry {
/**
* Fixed field length included in the response.
*
* Length value is included so future fixed fields can be added to the
* response without breaking backwards compatibility. Use the length
* to find the offset for the bssInfoLength field, not a sizeof() calc.
*/
t_u32 fixed_field_length;
/**
* Length of the BSS Information (probe resp or beacon) that
* follows after the fixed_field_length
*/
t_u32 bss_info_length;
/**
* Always present, fixed length data fields for the BSS
*/
wlan_get_scan_table_fixed fixed_fields;
/*
* Probe response or beacon scanned for the BSS.
*
* Field layout:
* - TSF 8 octets
* - Beacon Interval 2 octets
* - Capability Info 2 octets
*
* - IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/* t_u8 bss_info_buffer[1]; */
} wlan_ioctl_get_scan_table_entry;
/**
* Structure to store BSS info (probe resp or beacon) & IEEE IE info for each
* BSS returned in WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_bss_info {
/**
* Length of the BSS Information (probe resp or beacon) that
* follows after the fixed_field
*/
t_u32 bss_info_length;
/**
* Probe response or beacon scanned for the BSS.
*
* Field layout:
*/
/** TSF 8 octets */
t_u8 tsf[8];
/** Beacon Interval 2 octets */
t_u16 beacon_interval;
/** Capability Info 2 octets */
IEEEtypes_CapInfo_t cap_info;
/**
* IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/** SSID */
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/** SSID Length */
t_u32 ssid_len;
/** WMM Capability */
char wmm_cap;
/** WPS Capability */
char wps_cap;
/** Privacy Capability - WEP/WPA/RSN */
char priv_cap;
/** HT (11N) Capability */
char ht_cap;
/** VHT (11AC) Capability */
char vht_cap[2];
/* 802.11k Capability */
char dot11k_cap;
/** 802.11r Capability */
char dot11r_cap;
} wlan_ioctl_get_bss_info;
/**
* Structure to save of scan table info for each BSS returned
* in WLAN_GET_SCAN_RESP IOCTL
*/
struct wlan_ioctl_get_scan_list {
/** fixed info */
wlan_ioctl_get_scan_table_entry fixed_buf;
/** variable info - BSS info (probe resp or beacon) & IEEE IE info */
wlan_ioctl_get_bss_info bss_info_buf;
/** pointer to next node in list */
struct wlan_ioctl_get_scan_list *next;
};
/**
* Sructure to retrieve the scan table
*/
typedef struct {
/**
* - Zero based scan entry to start retrieval in command request
* - Number of scans entries returned in command response
*/
t_u32 scan_number;
/**
* Buffer marker for multiple wlan_ioctl_get_scan_table_entry structures.
* Each struct is padded to the nearest 32 bit boundary.
*/
t_u8 scan_table_entry_buf[1];
} wlan_ioctl_get_scan_table_info;
typedef struct {
t_u8 chan_number;
/**< Channel Number to scan */
t_u8 radio_type;
/**< Radio type: 'B/G' Band = 0, 'A' Band = 1 */
t_u8 scan_type;/**< Scan type: Active = 1, Passive = 2 */
t_u8 reserved;/**< Reserved */
t_u32 scan_time;
/**< Scan duration in milliseconds; if 0 default used */
} __ATTRIB_PACK__ wlan_ioctl_user_scan_chan;
typedef struct {
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/**< SSID */
t_u8 max_len; /**< Maximum length of SSID */
} __ATTRIB_PACK__ wlan_ioctl_user_scan_ssid;
typedef struct {
/** Flag set to keep the previous scan table intact */
t_u8 keep_previous_scan; /* Do not erase the existing scan results */
/** BSS mode to be sent in the firmware command */
t_u8 bss_mode;
/** Configure the number of probe requests for active chan scans */
t_u8 num_probes;
/** Reserved */
t_u8 reserved;
/** BSSID filter sent in the firmware command to limit the results */
t_u8 specific_bssid[ETH_ALEN];
/** SSID filter list used in the to limit the scan results */
wlan_ioctl_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH];
/** Variable number (fixed maximum) of channels to scan up */
wlan_ioctl_user_scan_chan chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
} __ATTRIB_PACK__ wlan_ioctl_user_scan_cfg;
int process_setuserscan(int argc, char *argv[]);
int process_getscantable(int argc, char *argv[]);
int process_getscantable_idx(wlan_ioctl_get_scan_table_info *prsp_info_req);
#endif /* _MLANMISC_H_ */

View File

@ -0,0 +1,51 @@
# File : mlanevent/Makefile
#
# Copyright (C) 2008-2019, Marvell International Ltd. All Rights Reserved
# 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
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = mlanevent.o
HEADERS = mlanevent.h
TARGET = mlanevent.exe
build 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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
# File : mlanutl/Makefile
#
# Copyright (C) 2011-2019, Marvell International Ltd. All Rights Reserved
# 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
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = mlanutl.o
HEADERS = mlanutl.h
exectarget=mlanutl
TARGET := $(exectarget)
build 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

View File

@ -0,0 +1,922 @@
/** @file mlanhostcmd.c
*
* @brief This file contains mlanutl helper functions
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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
************************************************************************/
#include "mlanhostcmd.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @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;
t_s8 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 > MRVDRV_SIZE_OF_CMD_BUFFER) {
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;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief convert char to hex integer
*
* @param chr char to convert
* @return hex integer or 0
*/
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(t_s8 *prompt, t_void *p, t_s32 len, t_s8 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(t_s8 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(t_s8 *s)
{
t_u32 val = 0;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s && isxdigit(*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(t_s8 *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *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
*/
t_s8 *
convert2hex(t_s8 *ptr, t_u8 *chr)
{
t_u8 val;
for (val = 0; *ptr && isxdigit(*ptr); ptr++) {
val = (val * 16) + hexval(*ptr);
}
*chr = val;
return ptr;
}
/**
* @brief Check the Hex String
* @param s A pointer to the string
* @return MLAN_STATUS_SUCCESS --HexString, MLAN_STATUS_FAILURE --not HexString
*/
int
ishexstring(t_s8 *s)
{
int ret = MLAN_STATUS_FAILURE;
t_s32 tmp;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s) {
tmp = toupper(*s);
if (((tmp >= 'A') && (tmp <= 'F')) ||
((tmp >= '0') && (tmp <= '9'))) {
ret = MLAN_STATUS_SUCCESS;
} else {
ret = MLAN_STATUS_FAILURE;
break;
}
s++;
}
return ret;
}
/**
* @brief Convert String to Integer
* @param buf A pointer to the string
* @return Integer
*/
int
atoval(t_s8 *buf)
{
if (!strncasecmp(buf, "0x", 2))
return a2hex(buf + 2);
else if (!ishexstring(buf))
return a2hex(buf);
else
return atoi(buf);
}
/**
* @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
*/
int
prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf)
{
t_s8 line[256], cmdname[256], *pos, cmdcode[10];
HostCmd_DS_GEN *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
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) {
cmdcode_found = 1;
hostcmd->command =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size = S_DS_GEN;
mlan_get_hostcmd_data(fp, &ln,
buf +
hostcmd->size,
&hostcmd->size);
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);
return MLAN_STATUS_SUCCESS;
}
/** Config data header length */
#define CFG_DATA_HEADER_LEN 6
/**
* @brief Prepare cfg-data buffer
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param fp File handler
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf)
{
int ln = 0, type;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_802_11_CFG_DATA *pcfg_data;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA);
pcfg_data = (HostCmd_DS_802_11_CFG_DATA *)(buf + S_DS_GEN);
pcfg_data->action =
(argc == 4) ? HostCmd_ACT_GEN_GET : HostCmd_ACT_GEN_SET;
type = atoi(argv[3]);
if ((type < 1) || (type > 2)) {
fprintf(stderr, "mlanutl: Invalid register type\n");
return MLAN_STATUS_FAILURE;
} else {
pcfg_data->type = type;
}
if (argc == 5) {
ln = fparse_for_hex(fp, pcfg_data->data);
}
pcfg_data->data_len = ln;
hostcmd->size =
cpu_to_le16(pcfg_data->data_len + S_DS_GEN +
CFG_DATA_HEADER_LEN);
pcfg_data->data_len = cpu_to_le16(pcfg_data->data_len);
pcfg_data->type = cpu_to_le16(pcfg_data->type);
pcfg_data->action = cpu_to_le16(pcfg_data->action);
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}
/**
* @brief Process host_cmd response
* @param buf A pointer to the response buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_host_cmd_resp(t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd = (HostCmd_DS_GEN *)buf;
int ret = MLAN_STATUS_SUCCESS;
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 *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, ' ');
} else {
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,
' ');
}
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;
}
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 Prepare ARP filter buffer
* @param fp File handler
* @param buf A pointer to the buffer
* @param length A pointer to the length of buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_arp_filter_buffer(FILE * fp, t_u8 *buf, t_u16 *length)
{
t_s8 line[256], *pos;
int ln = 0;
int ret = MLAN_STATUS_SUCCESS;
int arpfilter_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) {
if (strcmp(pos, "arpfilter={") == 0) {
arpfilter_found = 1;
mlan_get_hostcmd_data(fp, &ln, buf, length);
break;
}
}
if (!arpfilter_found) {
fprintf(stderr, "mlanutl: 'arpfilter' not found in conf file");
ret = MLAN_STATUS_FAILURE;
}
return ret;
}
/**
* @brief Prepare the hostcmd for register access
* @param type Register type
* @param offset Register offset
* @param value Pointer to value (NULL for read)
* @param buf Pointer to hostcmd buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REG *preg;
hostcmd = (HostCmd_DS_GEN *)buf;
switch (type) {
case 1:
hostcmd->command = cpu_to_le16(HostCmd_CMD_MAC_REG_ACCESS);
break;
case 2:
hostcmd->command = cpu_to_le16(HostCmd_CMD_BBP_REG_ACCESS);
break;
case 3:
hostcmd->command = cpu_to_le16(HostCmd_CMD_RF_REG_ACCESS);
break;
case 5:
hostcmd->command = cpu_to_le16(HostCmd_CMD_CAU_REG_ACCESS);
break;
default:
printf("Invalid register set specified\n");
return -EINVAL;
}
preg = (HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = (value) ? HostCmd_ACT_GEN_SET : HostCmd_ACT_GEN_GET;
preg->action = cpu_to_le16(preg->action);
preg->offset = cpu_to_le16((t_u16)offset);
if (value)
preg->value = cpu_to_le32(*value);
else
preg->value = 0;
hostcmd->size = cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_REG));
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}

View File

@ -0,0 +1,119 @@
/** @file mlanhostcmd.h
*
* @brief This file contains command structures for mlanutl application
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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 _MLANHOSTCMD_H_
#define _MLANHOSTCMD_H_
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (4 * 1024)
/** Host Command ID : Memory access */
#define HostCmd_CMD_MEM_ACCESS 0x0086
/** Pre-Authenticate - 11r only */
#define HostCmd_CMD_802_11_AUTHENTICATE 0x0011
/** 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
/** Get TX Power data */
#define HostCmd_CMD_802_11_RF_TX_POWER 0x001e
/** Host Command ID : CAU register access */
#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
/** Host Command ID : 802.11 BG scan configuration */
#define HostCmd_CMD_802_11_BG_SCAN_CONFIG 0x006b
/** Host Command ID : Configuration data */
#define HostCmd_CMD_CFG_DATA 0x008f
/** Host Command ID : 802.11 TPC adapt req */
#define HostCmd_CMD_802_11_TPC_ADAPT_REQ 0x0060
/** Host Command ID : 802.11 crypto */
#define HostCmd_CMD_802_11_CRYPTO 0x0078
/** Host Command ID : 802.11 auto Tx */
#define HostCmd_CMD_802_11_AUTO_TX 0x0082
/** Host Command ID : 802.11 subscribe event */
#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
/** Host Command ID : Channel TRPC config */
#define HostCmd_CMD_CHAN_TRPC_CONFIG 0x00fb
/** TLV type ID definition */
#define PROPRIETARY_TLV_BASE_ID 0x0100
/** 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 : Auto Tx */
#define TLV_TYPE_AUTO_TX (PROPRIETARY_TLV_BASE_ID + 0x18) /* 0x0118 */
/** 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 */
/** TLV type: Pre-Beacon Lost */
#define TLV_TYPE_PRE_BEACON_LOST (PROPRIETARY_TLV_BASE_ID + 0x49) /* 0x0149 */
/** TLV type : Channel TRPC */
#define TLV_TYPE_CHAN_TRPC (PROPRIETARY_TLV_BASE_ID + 0x89) /* 0x0189 */
/** 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;
/* Define general hostcmd data structure */
/** Convert String to integer */
t_u32 a2hex_or_atoi(char *value);
char *mlan_config_get_line(FILE * fp, char *str, t_s32 size, int *lineno);
int prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf);
int prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf);
#endif /* _MLANHOSTCMD_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,441 @@
/** @file mlanoffload.h
*
* @brief This files contains mlanutl offload command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANOFFLOAD_H_
#define _MLANOFFLOAD_H_
#ifndef MAX
/** Find maximum value */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif /* MAX */
/** Key length */
#define KEY_LEN 32
/** Phrase length */
#define PHRASE_LEN 32
/** WEP Key count */
#define WEP_KEY_CNT 4
/* Bitmap for OFFLoad Enable - Feature*/
#ifdef BIG_ENDIAN_SUPPORT
/** Roaming Feature */
#define PROFILE_DB_FEATURE_ROAMING 0x8000
/** CCX Feature */
#define PROFILE_DB_FEATURE_CCX 0x4000
/** UNUSED Feature */
#define PROFILE_DB_FEATURE_UNUSED 0x2000
/** adhoc/infra mode */
#define PROFILE_DB_FEATURE_MODE 0x1000
#else
/** Roaming Feature */
#define PROFILE_DB_FEATURE_ROAMING 0x0001
/** CCX Feature */
#define PROFILE_DB_FEATURE_CCX 0x0002
/** UNUSED Feature */
#define PROFILE_DB_FEATURE_UNUSED 0x0004
/** adhoc/infra mode */
#define PROFILE_DB_FEATURE_MODE 0x0008
#endif
/* Bitmap for profile AKMP Support */
#ifdef BIG_ENDIAN_SUPPORT
/** Key Management EAP */
#define PROFILE_DB_KEY_MGMT_IEEE8021X 0x8000
/** Key Management PSK */
#define PROFILE_DB_KEY_MGMT_PSK 0x4000
/** Key Management NONE */
#define PROFILE_DB_KEY_MGMT_NONE 0x2000
/** Key Management CCKM */
#define PROFILE_DB_KEY_MGMT_CCKM 0x1000
/** Key Management UNUSED */
#define PROFILE_DB_KEY_MGMT_UNUSED 0x0800
/** Key Management FT 802.1x */
#define PROFILE_DB_KEY_MGMT_FT_IEEE8021X 0x0400
/** Key Management FT PSK */
#define PROFILE_DB_KEY_MGMT_FT_PSK 0x0200
/** Key Management SHA256 802.1x */
#define PROFILE_DB_KEY_MGMT_SHA256_IEEE8021X 0x0100
/** Key Management SHA256 PSK*/
#define PROFILE_DB_KEY_MGMT_SHA256_PSK 0x0080
#else
/** Key Management EAP */
#define PROFILE_DB_KEY_MGMT_IEEE8021X 0x0001
/** Key Management PSK */
#define PROFILE_DB_KEY_MGMT_PSK 0x0002
/** Key Management NONE */
#define PROFILE_DB_KEY_MGMT_NONE 0x0004
/** Key Management CCKM */
#define PROFILE_DB_KEY_MGMT_CCKM 0x0008
/** Key Management UNUSED */
#define PROFILE_DB_KEY_MGMT_UNUSED 0x0010
/** Key Management FT 802.1x */
#define PROFILE_DB_KEY_MGMT_FT_IEEE8021X 0x0020
/** Key Management FT PSK */
#define PROFILE_DB_KEY_MGMT_FT_PSK 0x0040
/** Key Management SHA256 802.1x */
#define PROFILE_DB_KEY_MGMT_SHA256_IEEE8021X 0x0080
/** Key Management SHA256 PSK*/
#define PROFILE_DB_KEY_MGMT_SHA256_PSK 0x0100
#endif
/* Bitmap for profile Encryption protocol support */
#ifdef BIG_ENDIAN_SUPPORT
/** Encryption protocol noRsn */
#define PROFILE_DB_PROTO_NO_RSN 0x8000
/** Encryption protocol static wep */
#define PROFILE_DB_PROTO_WEP_STATIC 0x4000
/** Encryption protocol dynamic wep */
#define PROFILE_DB_PROTO_WEP_DYNAMIC 0x2000
/** Encryption protocol WPA */
#define PROFILE_DB_PROTO_WPA 0x1000
/** Encryption protocol WPA-none
* Ad-hoc Networks */
#define PROFILE_DB_PROTO_WPA_NONE 0x0800
/** Encryption protocol WPA2 */
#define PROFILE_DB_PROTO_WPA2 0x0400
/** Encryption protocol CCKM */
#define PROFILE_DB_PROTO_CCKM 0x0200
#else
/** Encryption protocol noRsn */
#define PROFILE_DB_PROTO_NO_RSN 0x0001
/** Encryption protocol static wep */
#define PROFILE_DB_PROTO_WEP_STATIC 0x0002
/** Encryption protocol dynamic wep */
#define PROFILE_DB_PROTO_WEP_DYNAMIC 0x0004
/** Encryption protocol WPA */
#define PROFILE_DB_PROTO_WPA 0x0008
/** Encryption protocol WPA-none
* Ad-hoc Networks */
#define PROFILE_DB_PROTO_WPA_NONE 0x0010
/** Encryption protocol WPA2 */
#define PROFILE_DB_PROTO_WPA2 0x0020
/** Encryption protocol CCKM */
#define PROFILE_DB_PROTO_CCKM 0x0040
#endif
#ifdef BIG_ENDIAN_SUPPORT
/** Cipher wep40 */
#define PROFILE_DB_CIPHER_WEP40 0x80
/** Cipher wep104 */
#define PROFILE_DB_CIPHER_WEP104 0x40
/** Cipher tkip */
#define PROFILE_DB_CIPHER_TKIP 0x20
/** Cipher ccmp */
#define PROFILE_DB_CIPHER_CCMP 0x10
#else
/** Cipher wep40 */
#define PROFILE_DB_CIPHER_WEP40 0x01
/** Cipher wep104 */
#define PROFILE_DB_CIPHER_WEP104 0x02
/** Cipher tkip */
#define PROFILE_DB_CIPHER_TKIP 0x04
/** Cipher ccmp */
#define PROFILE_DB_CIPHER_CCMP 0x08
#endif
typedef struct {
/** Header */
MrvlIEtypesHeader_t header;
t_u32 mode; /**< Mode */
t_u32 max_off_channel;
/**< Maximum off-channel measurement duration (ms) */
t_u32 max_on_channel;
/**< Maximum on-channel measurement duration (ms) */
} __ATTRIB_PACK__ MrvlIETypes_MeasTiming_t;
typedef struct {
/** Action Set or get */
t_u16 action;
/** TLV buffer starts here */
t_u8 tlv_buffer[1];
/*
* MrvlIETypes_MeasTiming_t
*/
} __ATTRIB_PACK__ HostCmd_DS_MEASUREMENT_Timing;
/** helper structure for profile parsing */
typedef struct {
/** SSID name string */
t_u8 ssid[IW_ESSID_MAX_SIZE + 1];
/** SSID len */
t_u32 ssid_len;
/** BSSID network name */
t_u8 bssid[ETH_ALEN];
/** passphrase configured */
t_s8 passphrase[PHRASE_LEN];
/** passphrase length */
t_u32 passphrase_len;
/** Pre-shared key config flag */
int psk_config;
/** Pre-shared key */
t_u8 psk[KEY_LEN];
/** wep keys */
t_u8 wep_key[WEP_KEY_CNT][KEY_LEN];
/** wep keys lengths */
t_u8 wep_key_len[WEP_KEY_CNT];
/** wep key index */
int wep_key_idx;
/** protocol fields */
t_u16 protocol;
/** pairwise Cipher values */
t_u8 pairwise_cipher;
/** Group Cipher values */
t_u8 groupwise_cipher;
/** key management */
t_u16 key_mgmt;
/** offload specific parameter(roaming) */
t_u16 roaming;
/** offload specific parameter */
t_u16 reserved;
/** offload specific parameter--ccx */
t_u16 ccx;
/** offload specific parameter--mode */
t_u16 mode;
} profile_entry_t;
typedef struct {
#ifdef BIG_ENDIAN_SUPPORT
/** Reserved */
t_u8 Reserved:3;
/** Channel not measured */
t_u8 Unmeasured:1;
/** Radar detected */
t_u8 Radar:1;
/** Unidentified signal received */
t_u8 Unidentified:1;
/** OFDM Preamble received */
t_u8 OFDM_Preamble:1;
/** BSS found */
t_u8 BSS:1;
#else
/** BSS found */
t_u8 BSS:1;
/** OFDM Preamble received */
t_u8 OFDM_Preamble:1;
/** Unidentified signal received */
t_u8 Unidentified:1;
/** Radar detected */
t_u8 Radar:1;
/** Channel not measured */
t_u8 Unmeasured:1;
/** Reserved */
t_u8 Reserved:3;
#endif
} __ATTRIB_PACK__ IEEEtypes_DFS_Map_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
t_u8 scanReqId; /**< Scan request id assigned in table */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRptBcn_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
IEEEtypes_DFS_Map_t map; /**< IEEE 802.11h basic meas report */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRpt11hBasic_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
t_u8 sourceAddr[ETH_ALEN]; /**< Source MAC */
t_u8 bssid[ETH_ALEN]; /**< BSSID MAC */
t_s16 rssi; /**< Avg RSSI of frames */
t_u16 frameCnt; /**< # of frames */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRptFrame_t;
typedef struct {
t_u8 modGroup;
t_u8 txPower;
} __ATTRIB_PACK__ MrvlChanTrpcEntry_t;
typedef struct {
MrvlIEtypesHeader_t header;
/**< Header */
MrvlChannelDesc_t chanDesc;
MrvlChanTrpcEntry_t chanTrpcEntry[1];
} __ATTRIB_PACK__ MrvlIEtypes_ChanTrpcCfg_t;
typedef struct {
t_u16 action;
/**< CMD Action Get/Set*/
t_u16 reserved;
t_u8 tlv_buffer[1];/** MrvlIEtypes_ChanTrpcCfg_t TLVs */
} __ATTRIB_PACK__ HostCmd_DS_CHAN_TRPC_CONFIG;
typedef struct {
t_u8 controlSelect;
t_u8 controlBitmap[1]; /* Variable length # of byte bitmaps */
} __ATTRIB_PACK__ HostCmd_DS_OFFLOAD_FEATURE_CONTROL;
#define IAPP_DATA_MAX 1000
/**
* @brief Enumeration for the command result from an IAPP Proxy command
*/
typedef enum {
IAPP_PROXY_RESULT_SUCCESS = 0,
IAPP_PROXY_RESULT_EXEC_FAILURE = 1,
IAPP_PROXY_RESULT_TIMEOUT = 2,
IAPP_PROXY_RESULT_DATA_INVALID = 3,
} __ATTRIB_PACK__ mlan_iapp_proxy_result_e;
typedef struct {
mlan_iapp_proxy_result_e commandResult;
/**< Firmware execution result */
t_u32 timeout_ms; /**< Timeout value in milliseconds */
t_u8 iappType;
t_u8 iappSubType;
t_u32 iappDataLen;
t_u8 iappData[IAPP_DATA_MAX];
} __ATTRIB_PACK__ HostCmd_DS_IAPP_PROXY;
typedef struct {
/** Action: GET/SET */
t_u16 Action;
/** Reserved */
t_u16 Reserved;
/** Association timeout */
t_u32 AssocTimeout;
/** Reassociation timeout */
t_u32 ReassocTimeout;
/** Hand shake timeout */
t_u32 HandShakeTimeout;
/** Frame exchange timeout */
t_u32 FrameExchangeTimeout;
/** Deauth of old AP in millisec; 0 to disable */
t_u32 PriorApDeauthDelay;
/** Maximum time after a disconnect where a reassoc frame will be sent */
t_u32 ReassocDiscMax;
} __ATTRIB_PACK__ HostCmd_DS_AssociationTiming_t;
/** 16 bit unsigned integer */
typedef t_u16 IEEEtypes_AId_t;
/** 16 bit unsigned integer */
typedef t_u16 IEEEtypes_StatusCode_t;
typedef struct {
/** Capability information */
IEEEtypes_CapInfo_t Capability;
/** Association response status code */
IEEEtypes_StatusCode_t StatusCode;
/** Association ID */
IEEEtypes_AId_t AId;
/** IE data buffer */
t_u8 IEBuffer[1];
} __ATTRIB_PACK__ IEEEtypes_AssocRsp_t;
/** Maximum number of AC QOS queues available in the driver/firmware */
#define MAX_AC_QUEUES 4
/** timing select structure */
typedef struct {
char *str; /**< Timing mode string */
int match_len; /**< match length */
t_u8 sel; /**< flag */
} timing_sel_t;
/** ENUM definition: reg_chan_table */
typedef enum {
REGTABLE_DEFAULT = 0,
REGTABLE_ESS = 1,
REGTABLE_USER = 2,
REGTABLE_MULTIDOMAIN = 3,
REGTABLE_MAX = 0xFFFF,
} reg_chan_table_e;
/** Sub-command callback */
typedef int (*sub_cmd_callback_t) (int argc, char *argv[]);
/** Sub-command execution data */
typedef struct {
char *str;
/**< Command string */
int match_len;
/**< Length */
int display;
/**< display as valid cmd */
sub_cmd_callback_t callback;
/**< Sub-command callback */
} sub_cmd_exec_t;
/** HostCmd_CMD_802_11_RF_TX_POWER */
typedef struct {
t_u16 action;
t_s16 current_level;
t_s8 max_power;
t_s8 min_power;
} __ATTRIB_PACK__ HostCmd_DS_802_11_RF_TX_POWER;
/** HostCmd_CMD_802_11_AUTHENTICATE */
typedef struct {
/** MAC address */
t_u8 MacAddr[ETH_ALEN];
/** Authentication type */
t_u8 AuthType;
} __ATTRIB_PACK__ HostCmd_DS_802_11_AUTHENTICATE;
boolean reg_class_table_select(char *tableStr, reg_chan_table_e *pTable);
int process_sub_cmd(sub_cmd_exec_t *sub_cmd, int num_sub_cmds,
int argc, char *argv[]);
int process_regclass(int argc, char *argv[]);
int process_scanagent(int argc, char *argv[]);
int process_measurement(int argc, char *argv[]);
int process_profile_entry(int argc, char *argv[]);
int process_get_ra_config(int argc, char *argv[]);
int process_set_ra_config(int argc, char *argv[]);
int process_chanrpt(int argc, char *argv[]);
int process_assoc_timing(int argc, char *argv[]);
int process_get_assocrsp(int argc, char *argv[]);
int process_link_stats(int argc, char *argv[]);
int process_opchan(int argc, char *argv[]);
int process_changroup(int argc, char *argv[]);
int process_fcontrol(int argc, char *argv[]);
int process_iapp(int argc, char *argv[]);
int process_rf_tx_power(int argc, char *argv[]);
int process_authenticate(int argc, char *argv[]);
int process_txpowdisp(int argc, char *argv[]);
#endif /* _MLANOFFLOAD_H_ */

View File

@ -0,0 +1,539 @@
/** @file mlanregclass.c
*
* @brief This files contains mlanutl regclass command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#include "mlanutl.h"
#include "mlanhostcmd.h"
#include "mlanoffload.h"
#include "mlanregclass.h"
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief Convert reg domain number to string
*
* @param reg_domain Reg Domain
*
* @return Reg Domain type
*/
static char *
reg_domain_to_str(reg_domain_e reg_domain)
{
switch (reg_domain) {
case REGDOMAIN_FCC:
return "FCC";
case REGDOMAIN_ETSI:
return "ETSI";
case REGDOMAIN_MIC:
return "MIC";
case REGDOMAIN_OTHER:
return "MULTI";
default:
break;
}
return "UNKN";
}
/**
* @brief Convert reg channel table number to string
*
* @param table_select Reg channel table
*
* @return Reg channel table type
*/
static char *
table_num_to_str(reg_chan_table_e table_select)
{
switch (table_select) {
case REGTABLE_USER:
return "User";
case REGTABLE_MULTIDOMAIN:
return "MultiDomain";
case REGTABLE_ESS:
return "ESS";
case REGTABLE_DEFAULT:
return "Default";
default:
break;
}
return "UNKN";
}
/**
* @brief Regclass dump channel table
*
* @param argc Number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_dump_chan_table(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_GET_CHAN_TABLE *get_table;
int idx;
t_u16 regLimits;
boolean invalid_cmd = FALSE;
printf("ERR:Cannot allocate buffer for command!\n");
if (argv[0] == NULL) {
invalid_cmd = TRUE;
} else {
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
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");
ret = ENOMEM;
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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD,
strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd =
(HostCmd_DS_GEN *)(buffer + cmd_header_len +
sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_REGCLASS_GET_CHAN_TABLE);
hostcmd->command = cpu_to_le16(HostCmd_CMD_REGCLASS_CHAN_TABLE);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
get_table = (HostCmd_DS_REGCLASS_GET_CHAN_TABLE *)pos;
get_table->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
if (reg_class_table_select(argv[0], (reg_chan_table_e *)
&get_table->table_select) == FALSE) {
invalid_cmd = TRUE;
}
}
if (invalid_cmd) {
printf("\nValid tables table; valid [user, md, ess, default]\n\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
get_table->table_select = cpu_to_le16((t_u16)(get_table->table_select));
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[regClassIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
get_table->table_select = le16_to_cpu(get_table->table_select);
get_table->chan = le32_to_cpu(get_table->chan);
printf("---------------------------------------");
printf("---------------------------------------\n");
printf("%35s: %s [%d]\n", "Channel Table",
table_num_to_str(get_table->table_select), (int)get_table->chan);
printf("---------------------------------------");
printf("---------------------------------------\n");
printf(" chn | freq | sfrq | sp | class | maxP | behavior limits\n");
printf("---------------------------------------");
printf("---------------------------------------\n");
for (idx = 0; (unsigned int)idx < get_table->chan; idx++) {
char regDisp[8];
sprintf(regDisp, "%4s-%02u",
reg_domain_to_str(get_table->chan_entry[idx].
reg_domain),
get_table->chan_entry[idx].regulatory_class);
printf(" %03u | %04u | %04u | %02u | %-8s | %02u |",
get_table->chan_entry[idx].chan_num,
(get_table->chan_entry[idx].start_freq +
(get_table->chan_entry[idx].chan_num * 5)),
le16_to_cpu(get_table->chan_entry[idx].start_freq),
le16_to_cpu(get_table->chan_entry[idx].chan_spacing),
regDisp, get_table->chan_entry[idx].max_tx_power);
regLimits = le16_to_cpu(get_table->chan_entry[idx].reg_limits);
if (regLimits & BLIMIT_NOMADIC)
printf(" nomadic");
if (regLimits & BLIMIT_INDOOR_ONLY)
printf(" indoor");
if (regLimits & BLIMIT_TPC)
printf(" tpc");
if (regLimits & BLIMIT_DFS)
printf(" dfs");
if (regLimits & BLIMIT_IBSS_PROHIBIT)
printf(" no_ibss");
if (regLimits & BLIMIT_FOUR_MS_CS)
printf(" 4ms_cs");
if (regLimits & BLIMIT_LIC_BASE_STA)
printf(" base_sta");
if (regLimits & BLIMIT_MOBILE_STA)
printf(" mobile");
if (regLimits & BLIMIT_PUBLIC_SAFETY)
printf(" safety");
if (regLimits & BLIMIT_ISM_BANDS)
printf(" ism");
printf("\n");
}
printf("---------------------------------------");
printf("---------------------------------------\n");
printf("\n");
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Regclass configure user table
*
* @param argc Number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_config_user_table(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_CONFIG_USER_TABLE *cfg_user_table;
if (argv[0] == NULL) {
printf("\nCountry string not specified\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
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");
ret = ENOMEM;
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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_REGCLASS_CONFIG_USER_TABLE);
hostcmd->command = cpu_to_le16(HostCmd_CMD_REGCLASS_CONFIG_USER_TABLE);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
cfg_user_table = (HostCmd_DS_REGCLASS_CONFIG_USER_TABLE *)pos;
cfg_user_table->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
memcpy(cfg_user_table->regulatory_str,
argv[0],
MIN(strlen(argv[0]), sizeof(cfg_user_table->regulatory_str)));
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[regClassIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue regclass multi-domain command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_multidomain(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL *multidomain_ctrl;
boolean invalid_cmd = FALSE;
if (argv[0] == NULL) {
invalid_cmd = TRUE;
} else {
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
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");
ret = ENOMEM;
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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD,
strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd =
(HostCmd_DS_GEN *)(buffer + cmd_header_len +
sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len =
S_DS_GEN +
sizeof(HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL);
hostcmd->command =
cpu_to_le16(HostCmd_CMD_REGCLASS_MULTIDOMAIN_CONTROL);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
multidomain_ctrl =
(HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL *)pos;
if (strcmp(argv[0], "on") == 0) {
multidomain_ctrl->multidomain_enable = 1;
} else if (strcmp(argv[0], "off") == 0) {
multidomain_ctrl->multidomain_enable = 0;
} else {
invalid_cmd = TRUE;
}
}
if (invalid_cmd) {
printf("\nUnknown multiDomain command; valid [on, off]\n\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
multidomain_ctrl->multidomain_enable =
cpu_to_le32(multidomain_ctrl->multidomain_enable);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[regClass]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
} else {
printf("\nMultiDomain: %s\n",
le32_to_cpu(multidomain_ctrl->multidomain_enable) ?
"Enabled" : "Disabled");
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a regclass command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_regclass(int argc, char *argv[])
{
sub_cmd_exec_t sub_cmd[] = { {"table", 1, 1, reg_class_dump_chan_table},
{"multidomain", 1, 1, reg_class_multidomain},
{"country", 1, 1, reg_class_config_user_table}
};
return process_sub_cmd(sub_cmd, NELEMENTS(sub_cmd), argc, argv);
}

View File

@ -0,0 +1,99 @@
/** @file mlanregclass.h
*
* @brief This files contains mlanutl regclass command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANREGCLASS_H
#define _MLANREGCLASS_H
/** Nomadic */
#define BLIMIT_NOMADIC (1 << 0)
/** Indoor */
#define BLIMIT_INDOOR_ONLY (1 << 1)
/** Tpc */
#define BLIMIT_TPC (1 << 2)
/** Dfs */
#define BLIMIT_DFS (1 << 3)
/** IBSS Prohibit */
#define BLIMIT_IBSS_PROHIBIT (1 << 4)
/** Four MS CS */
#define BLIMIT_FOUR_MS_CS (1 << 5)
/** LIC Base STA */
#define BLIMIT_LIC_BASE_STA (1 << 6)
/** Mobile STA */
#define BLIMIT_MOBILE_STA (1 << 7)
/** Public Safety */
#define BLIMIT_PUBLIC_SAFETY (1 << 8)
/** ISM Bands */
#define BLIMIT_ISM_BANDS (1 << 9)
/** Enum Definitions: reg_domain */
typedef enum {
REGDOMAIN_NULL = 0x00,
REGDOMAIN_FCC = 0x01,
REGDOMAIN_ETSI = 0x02,
REGDOMAIN_MIC = 0x03,
REGDOMAIN_OTHER = 0xFF,
} reg_domain_e;
typedef struct {
t_u8 reg_domain; /**< Domain */
t_u8 regulatory_class;
/**< Regulatory class */
t_u8 chan_num; /**< Channel Number */
t_u8 reserved1; /**< Reserved */
t_u16 start_freq; /**< Start frequency */
t_u16 chan_spacing; /**< channel spacing */
t_u8 max_tx_power; /**< Max. tx power */
t_u8 coverage_class;/**< Coverage class */
t_u16 reg_limits; /**< Limits */
} __ATTRIB_PACK__ chan_entry_t;
typedef struct {
/** Action: GET/SET */
t_u16 action;
/** Reg channel table */
t_u16 table_select;
/** Channel number */
t_u32 chan;
/** Channel entry */
chan_entry_t chan_entry[75];
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_GET_CHAN_TABLE;
typedef struct {
t_u16 action;
/**< Action: GET/SET */
t_u16 reserved;
/**< Reserved */
char regulatory_str[3];/**< Regulatory String */
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_CONFIG_USER_TABLE;
typedef struct {
t_u32 multidomain_enable;
/**< Multi domain enable */
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL;
#endif /* _MLANREGCLASS_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,314 @@
/** @file mlanroamagent.h
*
* @brief This files contains mlanutl roamagent command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANROAMAGENT_H_
#define _MLANROAMAGENT_H_
/** Bit definitions */
#ifndef BIT
#define BIT(x) (1UL << (x))
#endif
/* Define actionsd for HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE */
/** Blacklist */
#define HostCmd_ACT_ADD_TO_BLACKLIST 0x0001
/** Flushing blacklisted entry */
#define HostCmd_ACT_REMOVE_FROM_BLACKLIST 0x0002
/** Roaming scanmode: discovery */
#define DISCOVERY_MODE 1
/** Roaming scanmode: tracking */
#define TRACKING_MODE 2
/** Threshold configuration: RSSI */
#define RSSI_THRESHOLD 1
/** Threshold configuration: SNR */
#define SNR_THRESHOLD 2
#ifdef BIG_ENDIAN_SUPPORT
/** Bit values for Qualified Neighbor RSSI Entry */
#define BIT_NEIGHFLAG_RSSI 0x80000000
/** Bit values for Qualified Neighbor AGE Entry */
#define BIT_NEIGHFLAG_AGE 0x40000000
/** Bit values for Qualified Neighbor Blacklist Entry */
#define BIT_NEIGHFLAG_BLACKLIST 0x20000000
/** Bit values for Qualified Neighbor Admission Capacity */
#define BIT_NEIGHFLAG_ADMISSION_CAP 0x10000000
/** Bit values for Qualified Neighbor Uplink RSSI */
#define BIT_NEIGHFLAG_UPLINK_RSSI 0x08000000
#else
/** Bit values for Qualified Neighbor RSSI Entry */
#define BIT_NEIGHFLAG_RSSI 0x01
/** Bit values for Qualified Neighbor AGE Entry */
#define BIT_NEIGHFLAG_AGE 0x02
/** Bit values for Qualified Neighbor Blacklist Entry */
#define BIT_NEIGHFLAG_BLACKLIST 0x04
/** Bit values for Qualified Neighbor Admission Capacity */
#define BIT_NEIGHFLAG_ADMISSION_CAP 0x08
/** Bit values for Qualified Neighbor Uplink RSSI */
#define BIT_NEIGHFLAG_UPLINK_RSSI 0x10
#endif
/** milliseconds time conversion data */
typedef struct exactTime {
t_u16 hrs; /**< Number of hours */
t_u16 mins; /**< Number of minutes */
t_u16 secs; /**< Number of seconds */
t_u16 msecs; /**< Number of milliseconds left */
} ExactTime_t;
/** ROAMAGENT HostEvent bitmasks */
typedef enum {
HOST_EVENT_NBOR_DISABLE = 6, /* reset bit 0 */
HOST_EVENT_NBOR_ENABLE = 1, /* set bit 0 */
HOST_EVENT_ROAM_DISABLE = 5, /* reset bit 1 */
HOST_EVENT_ROAM_ENABLE = 2, /* set bit 1 */
HOST_EVENT_STATE_DISABLE = 3, /* reset bit 2 */
HOST_EVENT_STATE_ENABLE = 4, /* reset bit 2 */
} __ATTRIB_PACK__ HostEvent_e;
/** ROAMAGENT_CONTROL command identifiers */
typedef enum {
ROAM_CONTROL_DISABLE = 6, /* reset bit 0 */
ROAM_CONTROL_ENABLE = 1, /* set bit 0 */
ROAM_CONTROL_RESUME = 5, /* reset bit 1 */
ROAM_CONTROL_SUSPEND = 2, /* set bit 1 */
CROSSBAND_DISABLE = 3, /* reset bit 2 */
CROSSBAND_ENABLE = 4 /* set bit 2 */
} __ATTRIB_PACK__ RoamControl_e;
/*
* Definitions of roaming state and other constants
*/
/** Enum Definitations: Roaming agent state */
typedef enum {
STATE_DISCONNECTED,
STATE_STABLE,
STATE_DEGRADING,
STATE_UNACCEPTABLE,
STATE_HARDROAM,
STATE_LINKLOSS,
STATE_SOFTROAM,
STATE_SUSPEND,
STATE_CMD_SUSPEND,
STATE_ASYNCASSOC_SUSPEND
} RoamingAgentState;
/** statistics threshold High RSSI */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** RSSI threshold (dBm) */
t_u8 Value;
/** reporting frequency */
t_u8 Frequency;
} __ATTRIB_PACK__ MrvlIEtypes_BeaconHighRssiThreshold_t,
MrvlIEtypes_BeaconLowRssiThreshold_t,
MrvlIEtypes_BeaconHighSnrThreshold_t,
MrvlIEtypes_BeaconLowSnrThreshold_t;
/** HostCmd_DS_CMD_ROAMAGENT_STATISTICS_THRESHOLD */
typedef struct {
/** Action */
t_u16 action;
/** roaming state */
t_u8 State;
/** active/configured user */
t_u8 Profile;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_BeaconHighRssiThreshold_t BeaconHighRssiThreshold;
* MrvlIEtypes_BeaconLowRssiThreshold_t BeaconLowRssiThreshold;
* MrvlIEtypes_BeaconHighSnrThreshold_t BeaconHighSnrThreshold;
* MrvlIEtypes_BeaconLowSnrThreshold_t BeaconLowSnrThreshold;
* MrvlIEtypes_BeaconsMissed_t PreBeaconMissed;
* MrvlIEtypes_FailureCount_t FailureCnt;
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_STATISTICS_THRESHOLD;
typedef struct {
/** */
signed char RssiHighLevel;
/** */
signed char RssiLowLevel;
/** */
signed char RssiNborDiff;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_ROAM_THRESHOLD;
#define ROAM_THRESH_MAX 4
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_ASSESSMENT */
typedef struct {
/** Action */
t_u16 action;
/** configured qualifying snr */
signed char ConfQualSignalStrength;
/** active qualifying snr */
signed char ActiveQualSignalStrength;
/** qualifying neighbor count */
t_u16 QualifyingNumNeighbor;
/** inactivity in # scans */
t_u16 StaleCount;
/** inactivity in time (ms) */
t_u32 StalePeriod;
/** blacklist duration in ms due to minor failures */
t_u32 ShortBlacklistPeriod;
/** blacklist duration in ms due to severe failures */
t_u32 LongBlacklistPeriod;
HostCmd_DS_CMD_ROAMAGENT_ROAM_THRESHOLD RoamThresh[ROAM_THRESH_MAX];
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_ASSESSMENT;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_NeighborEntry_t Neighbors[MRVL_ROAM_MAX_NEIGHBORS];
* MRVL_ROAM_MAX_NEIGHBORS = 5
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST;
/** neighbor entry details roaming agent */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** bssid of neighbor */
t_u8 Bssid[ETH_ALEN];
/** Reserved */
t_u16 Reserved;
/** neighbor snr */
t_s16 SignalStrength;
/** neighbor age */
t_u16 Age;
/** bit map for qualified neighbor */
t_u32 QualifiedNeighborBitmap;
/** blacklist duration in ms */
t_u32 BlackListDuration;
} __ATTRIB_PACK__ MrvlIEtypes_NeighborEntry_t;
/** HostCmd_DS_ROAMAGENT_ADV_METRIC_THRESHOLD */
typedef struct {
/** Action */
t_u16 action;
/** Beacon RSSI Metrics,Data RSSI Metrics or PER Metrics */
t_u16 Metrics;
/** Percentage FER Threshold value to exceed for making a roam decision */
t_u8 UcFerThresholdValue;
/** Percentage PER Threshold value to exceed for making a roam decision */
t_u8 UcPerThresholdValue;
/** Reserved for later use */
t_u8 Reserved[2];
/** Time (ms) for which FER should prevail in stable state */
t_u32 StableFERPeriod_ms;
/** Time (ms) for which FER should prevail in degrading state */
t_u32 DegradingFERPeriod_ms;
/** Time (ms) for which FER should prevail in unacceptable state */
t_u32 UnacceptableFERPeriod_ms;
/** Time (ms) for which FER should prevail in stable state */
t_u32 StablePERPeriod_ms;
/** Time (ms) for which PER should prevail in degrading state */
t_u32 DegradingPERPeriod_ms;
/** Time (ms) for which PER should prevail in unacceptable state */
t_u32 UnacceptablePERPeriod_ms;
/** Number of TX packets to exceed in period_ms ms for the FER for Roam */
t_u32 UiFerPktThreshold;
/** Number of TX packets to exceed in period_ms ms for the PER for Roam */
t_u32 UiPerPktThreshold;
/** Time in ms for which inactivity should prevail for state transition */
t_u32 InactivityPeriodThreshold_ms;
/** With Data RSSI Metrics, Roam only when RX packets in period_ms ms exceeds this */
t_u32 UiRxPktThreshold;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_ADV_METRIC_THRESHOLD;
/** scan period for each search mode and state for roaming agent */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** search mode */
t_u16 SearchMode;
/** roaming state */
t_u16 State;
/** scan period value */
t_u32 ScanPeriod;
} __ATTRIB_PACK__ MrvlIEtypes_NeighborScanPeriod_t;
/** HostCmd_DS_CMD_ROAMAGENT_CONTROL */
typedef struct {
/** Action */
t_u16 action;
/** enable control */
t_u8 Control;
/** host event control */
t_u8 HostEvent;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_CONTROL;
/** HostCmd_DS_CMD_ROAMAGENT_BACKOFF */
typedef struct {
/** Action */
t_u16 action;
/** minimum scans */
t_u16 Scans;
/** backoff period */
t_u32 Period;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_BACKOFF;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** scanPeriod TLV */
MrvlIEtypes_NeighborScanPeriod_t scanPeriod;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD_RSP */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_NeighborScanPeriod_t scanPeriod[MRVL_ROAM_SCAN_PERIODS];
* MRVL_ROAM_SCAN_PERIODS = 6
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD_RSP;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE */
typedef struct {
/** Action */
t_u16 action;
/** BSSID */
t_u8 BSSID[ETH_ALEN];
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE;
#endif /* _MLANROAMAGENT_H_ */

View File

@ -0,0 +1,840 @@
/** @file mlanscanagent.c
*
* @brief This files contains mlanutl scanagent command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#include "mlanutl.h"
#include "mlanhostcmd.h"
#include "mlanoffload.h"
#include "mlanscanagent.h"
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief scanagent configure scan table
*
* @param age_limit age limit
* @param hold_limit hold limit
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_cfg_scan_table_limits(t_u32 age_limit, t_u32 hold_limit)
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS *scan_table_limits = NULL;
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\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 -ENOMEM;
}
/* 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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_TABLE_LIMITS);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
scan_table_limits = (HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS *)pos;
scan_table_limits->table_age_limit = cpu_to_le16(age_limit);
scan_table_limits->table_hold_limit = cpu_to_le16(hold_limit);
/* 0 set values are ignored by firmware */
scan_table_limits->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
/* 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[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
printf("\nAge limit = %7d seconds\n",
le16_to_cpu(scan_table_limits->table_age_limit));
printf("Hold limit = %7d seconds\n\n",
le16_to_cpu(scan_table_limits->table_hold_limit));
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Set scanagent age limit
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_age_limit(int argc, char *argv[])
{
t_u32 age_limit = 0;
if (argc) {
age_limit = atoi(argv[0]);
}
return scanagent_cfg_scan_table_limits(age_limit, 0);
}
/**
* @brief Set scanagent hold limit
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_hold_limit(int argc, char *argv[])
{
t_u32 hold_limit = 0;
if (argc) {
hold_limit = atoi(argv[0]);
}
return scanagent_cfg_scan_table_limits(0, hold_limit);
}
/**
* @brief Set scanagent scan timing
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_timing(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
int idx;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0, sel = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_CONFIG_TIMING *cfg_timing_cmd = NULL;
MrvlIEtypes_ConfigScanTiming_t *cfg_timing_tlv = NULL;
timing_sel_t sel_str[] = { {"disconnected", 1},
{"adhoc", 1},
{"fullpower", 1},
{"ieeeps", 1},
{"periodic", 1}
};
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(t_u16);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\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 -ENOMEM;
}
/* 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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_TIMING);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cfg_timing_cmd = (HostCmd_DS_SCANAGENT_CONFIG_TIMING *)pos;
cfg_timing_cmd->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
cfg_timing_tlv
= (MrvlIEtypes_ConfigScanTiming_t *)cfg_timing_cmd->tlv_buffer;
if (argc == 5) {
cfg_timing_cmd->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
cfg_timing_tlv->header.type = cpu_to_le16(TLV_TYPE_SCAN_TIMING);
cfg_timing_tlv->header.len =
cpu_to_le16(sizeof(MrvlIEtypes_ConfigScanTiming_t)
- sizeof(cfg_timing_tlv->header));
for (idx = 0; (unsigned int)idx < NELEMENTS(sel_str); idx++) {
if (strncmp(argv[0],
sel_str[idx].str,
sel_str[idx].match_len) == 0) {
sel = idx + 1;
break;
}
}
if (idx == NELEMENTS(sel_str)) {
printf("Wrong argument for mode selected \"%s\"\n",
argv[0]);
ret = -EINVAL;
goto done;
}
/*
* HostCmd_DS_ScanagentTimingMode_e;
* TIMING_MODE_INVALID = 0,
* TIMING_MODE_DISCONNECTED = 1,
* TIMING_MODE_ADHOC = 2,
* TIMING_MODE_FULL_POWER = 3,
* TIMING_MODE_IEEE_PS = 4,
* TIMING_MODE_PERIODIC_PS = 5,
*/
cfg_timing_tlv->mode = cpu_to_le32(sel);
cfg_timing_tlv->dwell = cpu_to_le32(atoi(argv[1]));
cfg_timing_tlv->max_off = cpu_to_le32(atoi(argv[2]));
cfg_timing_tlv->min_link = cpu_to_le32(atoi(argv[3]));
cfg_timing_tlv->rsp_timeout = cpu_to_le32(atoi(argv[4]));
cmd_len += sizeof(MrvlIEtypes_ConfigScanTiming_t);
}
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
ret = process_host_cmd_resp(HOSTCMD, buffer);
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Set scanagent profile scan period
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_profile_period(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN *cfg_profile_scan = NULL;
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\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 -ENOMEM;
}
/* 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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command =
cpu_to_le16(HostCmd_CMD_SCANAGENT_CONFIG_PROFILE_SCAN);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cfg_profile_scan = (HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN *)pos;
if (argc == 1) {
cfg_profile_scan->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
cfg_profile_scan->scan_interval = cpu_to_le16(atoi(argv[0]));
} else {
cfg_profile_scan->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
}
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
cfg_profile_scan->scan_interval =
le16_to_cpu(cfg_profile_scan->scan_interval);
if ((int)cfg_profile_scan->scan_interval == 0)
printf("\nProfile Scan interval: <disabled>\n\n");
else
printf("\nProfile Scan interval: %d seconds\n\n",
(int)cfg_profile_scan->scan_interval);
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief scanagent parse entry selection
*
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param psel A pointer to scanagent entry selection
*
* @return None
*/
static void
scanAgentParseEntrySel(int argc, char *argv[],
HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *psel,
int *cmd_len)
{
int arg_idx, tmp_idx;
t_u8 *tlv_pos;
MrvlIEtypes_SsIdParamSet_t *ssid;
MrvlIEtypes_Bssid_List_t *bssid;
unsigned int mac[ETH_ALEN];
tlv_pos = (t_u8 *)psel->tlv_buffer;
for (arg_idx = 0; arg_idx < argc; arg_idx++) {
if (strncmp(argv[arg_idx], "ssid=", strlen("ssid=")) == 0) {
ssid = (MrvlIEtypes_SsIdParamSet_t *)tlv_pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len =
strlen(argv[arg_idx]) - strlen("ssid=");
strncpy((char *)ssid->ssid,
(argv[arg_idx] + strlen("ssid=")),
ssid->header.len);
tlv_pos +=
ssid->header.len + sizeof(MrvlIEtypesHeader_t);
ssid->header.len = cpu_to_le16(ssid->header.len);
} else if (strncmp(argv[arg_idx], "bssid=", strlen("bssid=")) ==
0) {
bssid = (MrvlIEtypes_Bssid_List_t *)tlv_pos;
bssid->header.type = cpu_to_le16(TLV_TYPE_BSSID);
bssid->header.len = ETH_ALEN;
/*
* "bssid" token string handler
*/
sscanf(argv[arg_idx] + strlen("bssid="),
"%2x:%2x:%2x:%2x:%2x:%2x", mac + 0, mac + 1,
mac + 2, mac + 3, mac + 4, mac + 5);
for (tmp_idx = 0;
(unsigned int)tmp_idx < NELEMENTS(mac);
tmp_idx++) {
bssid->bssid[tmp_idx] = (t_u8)mac[tmp_idx];
}
tlv_pos +=
bssid->header.len + sizeof(MrvlIEtypesHeader_t);
bssid->header.len = cpu_to_le16(bssid->header.len);
} else if (strncmp(argv[arg_idx], "age=", strlen("age=")) == 0) {
psel->age =
cpu_to_le32(atoi
(argv[arg_idx] + strlen("age=")));
} else if (strncmp(argv[arg_idx], "id=", strlen("id=")) == 0) {
psel->scan_request_id =
cpu_to_le32(atoi
(argv[arg_idx] + strlen("id=")));
}
}
*cmd_len += (tlv_pos - psel->tlv_buffer);
}
/**
* @brief scanagent execute scan
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_exec_scan(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
int arg_idx, tmp_idx;
t_u32 cmd_len = 0, cmd_header_len = 0;
t_u8 *buffer = NULL, *pos = NULL, *tlv_pos = NULL;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_SCAN_EXEC *scan_exec = NULL;
MrvlIEtypes_SsIdParamSet_t *ssid = NULL;
MrvlIEtypes_Bssid_List_t *bssid = NULL;
MrvlIEtypes_ConfigScanTiming_t *cfg_timing_tlv = NULL;
unsigned int mac[ETH_ALEN];
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
cmd_len = (S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_SCAN_EXEC)
- sizeof(scan_exec->tlv_buffer));
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\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 -ENOMEM;
}
/* 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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_EXEC);
hostcmd->size = 0;
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
scan_exec = (HostCmd_DS_SCANAGENT_SCAN_EXEC *)pos;
tlv_pos = scan_exec->tlv_buffer;
for (arg_idx = 0; arg_idx < argc; arg_idx++) {
if (strncmp(argv[arg_idx], "ssid=", strlen("ssid=")) == 0) {
/*
* "ssid" token string handler
*/
ssid = (MrvlIEtypes_SsIdParamSet_t *)tlv_pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len =
strlen(argv[arg_idx]) - strlen("ssid=");
strncpy((char *)ssid->ssid,
argv[arg_idx] + strlen("ssid="),
ssid->header.len);
tlv_pos +=
ssid->header.len + sizeof(MrvlIEtypesHeader_t);
ssid->header.len = cpu_to_le16(ssid->header.len);
} else if (strncmp(argv[arg_idx], "bssid=", strlen("bssid=")) ==
0) {
bssid = (MrvlIEtypes_Bssid_List_t *)tlv_pos;
bssid->header.type = cpu_to_le16(TLV_TYPE_BSSID);
bssid->header.len = ETH_ALEN;
/*
* "bssid" token string handler
*/
sscanf(argv[arg_idx] + strlen("bssid="),
"%2x:%2x:%2x:%2x:%2x:%2x", mac + 0, mac + 1,
mac + 2, mac + 3, mac + 4, mac + 5);
for (tmp_idx = 0;
(unsigned int)tmp_idx < NELEMENTS(mac);
tmp_idx++) {
bssid->bssid[tmp_idx] = (t_u8)mac[tmp_idx];
}
tlv_pos +=
bssid->header.len + sizeof(MrvlIEtypesHeader_t);
bssid->header.len = cpu_to_le16(bssid->header.len);
} else if (strncmp(argv[arg_idx], "type=", strlen("type=")) ==
0) {
/*
if (strcmp(argv[arg_idx] + strlen("type="), "prof") == 0) {
scan_exec->scan_type = CONFIG_PROFILE;
} else {
scan_exec->scan_type = CONFIG_SITE_SURVEY;
}
*/
scan_exec->scan_type = CONFIG_SITE_SURVEY;
scan_exec->scan_type =
cpu_to_le16(scan_exec->scan_type);
} else if (strncmp(argv[arg_idx], "group=", strlen("group=")) ==
0) {
sscanf(argv[arg_idx] + strlen("group="), "0x%x",
&tmp_idx);
scan_exec->chan_group = cpu_to_le32(tmp_idx);
} else if (strncmp(argv[arg_idx], "delay=", strlen("delay=")) ==
0) {
/*
* "delay" token string handler
*/
sscanf(argv[arg_idx] + strlen("delay="),
"%d", (int *)&scan_exec->delay);
scan_exec->delay = cpu_to_le32(scan_exec->delay);
} else if (strncmp(argv[arg_idx], "timing=", strlen("timing="))
== 0) {
cfg_timing_tlv =
(MrvlIEtypes_ConfigScanTiming_t *)tlv_pos;
cfg_timing_tlv->header.type =
cpu_to_le16(TLV_TYPE_SCAN_TIMING);
cfg_timing_tlv->header.len = ((sizeof(cfg_timing_tlv)
-
sizeof(cfg_timing_tlv->
header)));
/*
* "timing" token string handler
*/
sscanf(argv[arg_idx] + strlen("timing="), "%d,%d,%d,%d",
(int *)&cfg_timing_tlv->dwell,
(int *)&cfg_timing_tlv->max_off,
(int *)&cfg_timing_tlv->min_link,
(int *)&cfg_timing_tlv->rsp_timeout);
cfg_timing_tlv->mode = 0;
cfg_timing_tlv->dwell =
cpu_to_le32(cfg_timing_tlv->dwell);
cfg_timing_tlv->max_off =
cpu_to_le32(cfg_timing_tlv->max_off);
cfg_timing_tlv->min_link =
cpu_to_le32(cfg_timing_tlv->min_link);
cfg_timing_tlv->rsp_timeout =
cpu_to_le32(cfg_timing_tlv->rsp_timeout);
tlv_pos += sizeof(MrvlIEtypesHeader_t);
tlv_pos += cfg_timing_tlv->header.len;
cfg_timing_tlv->header.len =
cpu_to_le16(cfg_timing_tlv->header.len);
}
}
cmd_len += (tlv_pos - scan_exec->tlv_buffer);
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
} else {
printf("\nScan Scheduled, ID = %d\n\n",
(int)le32_to_cpu(scan_exec->scan_req_id_out));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a scanagent cmd_type subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param cmd_type command type
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_entry_sub_cmd(int argc, char *argv[],
HostCmd_DS_ScanagentTableMaintenance_e cmd_type)
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *table_maintenance = NULL;
cmd_header_len = strlen(CMD_MARVELL) + strlen(HOSTCMD);
cmd_len = (S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE)
- sizeof(table_maintenance->tlv_buffer));
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\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 -ENOMEM;
}
/* 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;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_MARVELL, strlen(CMD_MARVELL));
strncpy((char *)buffer + strlen(CMD_MARVELL), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_TABLE_MAINTENANCE);
hostcmd->size = 0;
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
table_maintenance = (HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *)pos;
table_maintenance->action = cpu_to_le16((t_u16)cmd_type);
scanAgentParseEntrySel(argc, argv, table_maintenance, (int *)&cmd_len);
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* 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[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a scanagent table lock subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_lock(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_LOCK);
}
/**
* @brief Issue a scanagent table unlock subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_unlock(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_UNLOCK);
}
/**
* @brief Issue a scanagent table purge subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_purge(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_PURGE);
}
/**
* @brief Issue a scanagent command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_scanagent(int argc, char *argv[])
{
sub_cmd_exec_t sub_cmd[] = {
{"timing", 2, 1, scanagent_timing},
{"scan", 2, 1, scanagent_exec_scan},
{"lock", 2, 1, scanagent_table_lock},
{"unlock", 2, 1, scanagent_table_unlock},
{"purge", 2, 1, scanagent_table_purge},
{"profile", 2, 1, scanagent_profile_period},
{"holdlimit", 2, 1, scanagent_hold_limit},
{"agelimit", 2, 1, scanagent_age_limit}
};
return process_sub_cmd(sub_cmd, NELEMENTS(sub_cmd), argc, argv);
}

View File

@ -0,0 +1,149 @@
/** @file mlanscanagent.h
*
* @brief This files contains mlanutl scanagent command handling.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
08/11/2009: initial version
************************************************************************/
#ifndef _MLAN_SCANAGENT_H_
#define _MLAN_SCANAGENT_H_
typedef struct {
/** Action GET or SET */
t_u16 action;
/** scan interval */
t_u16 scan_interval;
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN;
typedef struct {
t_u32 scan_req_id_out;
/**< Scan request id */
t_u32 delay; /**< Delay */
t_u32 chan_group; /**< Channel Group */
t_u16 scan_type; /**< Scan type */
t_u16 reserved; /**< Reserved */
t_u8 tlv_buffer[1]; /**< Rest is TLV buffer */
/* MrvlIEtypes_SsIdParamSet_t
* MrvlIEtypes_Bssid_List_t
* MrvlIEtypes_ConfigScanTiming_t
*/
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_SCAN_EXEC;
typedef struct {
/** Action Set or get */
t_u16 action;
/** Reserved */
t_u16 reserved;
/** Table age limit */
t_u16 table_age_limit;
/** Table hold limit */
t_u16 table_hold_limit;
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS;
typedef struct {
/** Action Set or get */
t_u16 action;
/** TLV buffer starts here */
t_u8 tlv_buffer[1];
/* MrvlIEtypes_ConfigScanTiming_t */
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_CONFIG_TIMING;
typedef struct {
/** HostCmd_DS_ScanagentTableMaintenance_e action */
t_u16 action;
/** Reserved */
t_u16 reserved;
/** Request Id, 0 to disable */
t_u32 scan_request_id;
/** Age, 0 to disable */
t_u32 age;
/** TLV Buffer follows */
t_u8 tlv_buffer[1];
/* MrvlIEtypes_SsIdParamSet_t
* MrvlIEtypes_Bssid_List_t
*/
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE;
/** ENUM definition: Scanagent Table Maintenance */
typedef enum {
SCAN_TABLE_OP_INVALID = 0,
SCAN_TABLE_OP_LOCK = 1,
SCAN_TABLE_OP_UNLOCK = 2,
SCAN_TABLE_OP_PURGE = 3,
} __ATTRIB_PACK__ HostCmd_DS_ScanagentTableMaintenance_e;
/** MrvlIEtypes_SsIdParamSet_t */
typedef struct _MrvlIEtypes_SsIdParamSet_t {
/** Header */
MrvlIEtypesHeader_t header;
/** SSID */
t_u8 ssid[1];
} __ATTRIB_PACK__ MrvlIEtypes_SsIdParamSet_t;
/** _MrvlIEtypes_Bssid_List_t */
typedef struct _MrvlIEtypes_Bssid_List_t {
/** Header */
MrvlIEtypesHeader_t header;
/** BSSID */
t_u8 bssid[ETH_ALEN];
} __ATTRIB_PACK__ MrvlIEtypes_Bssid_List_t;
typedef struct {
/** Header */
MrvlIEtypesHeader_t header;
t_u32 mode; /**< Mode */
t_u32 dwell; /**< Dwell */
t_u32 max_off; /**< Max. off */
t_u32 min_link;/**< Minimum Link */
t_u32 rsp_timeout;
/**< Rsp Timeout */
} __ATTRIB_PACK__ MrvlIEtypes_ConfigScanTiming_t;
/** ENUM definition: ScanAgentScanType */
typedef enum {
CONFIG_SITE_SURVEY = 0,
CONFIG_NEIGHBOR = 1,
CONFIG_PROFILE = 2,
CONFIG_ARBITRARY_CHANNEL = 3,
} __ATTRIB_PACK__ HostCmd_DS_ScanagentScanType_e;
/** ENUM definition: ScanAgentScanTimingMode */
typedef enum {
TIMING_MODE_INVALID = 0,
TIMING_MODE_DISCONNECTED = 1,
TIMING_MODE_ADHOC = 2,
TIMING_MODE_FULL_POWER = 3,
TIMING_MODE_IEEE_PS = 4,
TIMING_MODE_PERIODIC_PS = 5,
} __ATTRIB_PACK__HostCmd_DS_ScanagentTimingMode_e;
int process_host_cmd_resp(char *cmd_name, t_u8 *buf);
#endif /* _MLAN_SCANAGENT_H_ */

18720
mwifiex_8997/mapp/mlanutl/mlanutl.c Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,413 @@
/** @file timestamp.c
*
* @brief Functions for timestamping feature
*
* Copyright (C) 2011-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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.
*
*/
#include "timestamp.h"
#include "time.h"
/* GLobal Declarations */
struct timespec send_time;
struct interface_data inter;
/**
*@brief Receive Timestamps
*
*@param argc Number of arguments
*@param argv Pointer to the arguments array
*
* @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE
**/
void
receive_timestamp(int argc, char *argv[])
{
int sockfd;
int sockopt;
char ifName[IFNAMSIZ];
struct ifreq if_ip; /* get ip addr */
int so_timestamping_flags = 0;
int siocgstamp = 0;
int siocgstampns = 0;
struct timeval now;
int res;
struct ifreq if_idx;
struct ifreq if_mac;
fd_set readfs, errorfs;
/* Get interface name */
if (argc > 2)
strcpy(ifName, argv[1]);
else {
fprintf(stderr,
"invalid no. of arguments to receive_timestamp \n");
exit(1);
}
/* Header structures */
so_timestamping_flags |= SOF_TIMESTAMPING_SOFTWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
memset(&if_ip, 0, sizeof(struct ifreq));
/* Open PF_PACKET socket, listening for EtherType ETHER_TYPE */
if ((sockfd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_802_EX1))) == -1) {
perror("listener: socket");
}
/* Get the index of the interface to receive on */
memset(&if_idx, 0, sizeof(struct ifreq));
strncpy(if_idx.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0)
perror("SIOCGIFINDEX");
/* Get the MAC address of the interface to receive on */
memset(&if_mac, 0, sizeof(struct ifreq));
strncpy(if_mac.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFHWADDR, &if_mac) < 0)
perror("SIOCGIFHWADDR");
/* Allow the socket to be reused - incase connection is closed prematurely */
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt,
sizeof sockopt) == -1) {
perror("setsockopt");
close(sockfd);
exit(1);
}
/* Bind to device */
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
ifName, IFNAMSIZ - 1) == -1) {
perror("SO_BINDTODEVICE");
close(sockfd);
exit(1);
}
if (so_timestamping_flags &&
setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMPING,
&so_timestamping_flags,
sizeof(so_timestamping_flags)) < 0)
perror("setsockopt SO_TIMESTAMPING");
while (1) {
FD_ZERO(&readfs);
FD_ZERO(&errorfs);
FD_SET(sockfd, &readfs);
FD_SET(sockfd, &errorfs);
gettimeofday(&now, NULL);
res = select(sockfd + 1, &readfs, 0, &errorfs, NULL);
if (res > 0) {
recvpacket(sockfd, 0, siocgstamp, siocgstampns);
}
}
}
/**
*@brief Send Timestamps
*
*@param argc Number of arguments
*@param argv Pointer to the arguments array
*
*@return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE
**/
int
send_timestamp(int argc, char *argv[])
{
int sockfd;
struct ifreq if_idx;
struct ifreq if_mac;
int tx_len = 0, i;
char sendbuf[BUF_SIZ];
char buff[BUF_SIZ];
struct ether_header *eh = (struct ether_header *)sendbuf;
struct sockaddr_ll socket_address;
char ifName[IFNAMSIZ], ip[50];
struct timeval delta;
fd_set readfs, errorfs;
int res, siocgstamp = 1, siocgstampns = 1;
int so_timestamping_flags = SOF_TIMESTAMPING_TX_HARDWARE;
struct ifreq hwtstamp;
struct hwtstamp_config hwconfig;
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_TX_HARDWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_SYS_HARDWARE;
/* Get interface name */
if (argc > 4) {
strcpy(ifName, argv[1]);
strcpy(ip, argv[4]);
} else {
fprintf(stderr, "invalid no. of args for send_timestamp\n");
exit(1);
}
/* Open RAW socket to send on */
if ((sockfd = socket(PF_PACKET, SOCK_RAW, ETH_P_802_EX1)) == -1) {
perror("socket");
}
memset(&hwtstamp, 0, sizeof(hwtstamp));
strncpy(hwtstamp.ifr_name, ifName, sizeof(hwtstamp.ifr_name));
hwtstamp.ifr_data = (void *)&hwconfig;
memset(&hwconfig, 0, sizeof(hwconfig));
hwconfig.tx_type =
(so_timestamping_flags & SOF_TIMESTAMPING_TX_HARDWARE) ?
HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
hwconfig.rx_filter =
(so_timestamping_flags & SOF_TIMESTAMPING_RX_HARDWARE) ?
HWTSTAMP_FILTER_PTP_V1_L4_SYNC : HWTSTAMP_FILTER_NONE;
/* Get the index of the interface to send on */
memset(&if_idx, 0, sizeof(struct ifreq));
strncpy(if_idx.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0)
perror("SIOCGIFINDEX");
/* Get the MAC address of the interface to send on */
memset(&if_mac, 0, sizeof(struct ifreq));
strncpy(if_mac.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFHWADDR, &if_mac) < 0)
perror("SIOCGIFHWADDR");
if (so_timestamping_flags &&
setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMPING,
&so_timestamping_flags,
sizeof(so_timestamping_flags)) < 0)
perror("setsockopt SO_TIMESTAMPING");
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
ifName, IFNAMSIZ - 1) == -1) {
perror("bind");
exit(1);
}
/* Construct the Ethernet header */
memset(sendbuf, 0, BUF_SIZ);
/* Ethernet header */
memcpy(eh->ether_shost, (u_int8_t *) & if_mac.ifr_hwaddr.sa_data,
MLAN_MAC_ADDR_LENGTH);
eh->ether_type = htons(ETH_P_802_EX1);
tx_len += sizeof(struct ether_header);
get_mac(ifName, ip);
for (i = 0; i < MLAN_MAC_ADDR_LENGTH; i++) {
eh->ether_dhost[i] = (uint8_t) inter.mac[i];
}
/* Index of the network device */
socket_address.sll_ifindex = if_idx.ifr_ifindex;
/* Address length */
socket_address.sll_halen = ETH_ALEN;
memcpy(&socket_address.sll_addr, (uint8_t *) & inter.mac,
MLAN_MAC_ADDR_LENGTH);
clock_gettime(CLOCK_REALTIME, &send_time);
sprintf(buff, "%lld.%lld", (long long)send_time.tv_sec,
(long long)send_time.tv_nsec);
strcpy((sendbuf + tx_len), buff);
/* Send packet */
res = sendto(sockfd, sendbuf, tx_len + strlen(buff), 0,
(struct sockaddr *)&socket_address,
sizeof(struct sockaddr_ll));
if (res < 0)
perror("Send ");
fprintf(stdout, "Application time : %lld.%09lld (sent)\n",
(long long)send_time.tv_sec, (long long)send_time.tv_nsec);
delta.tv_sec = 5;
delta.tv_usec = 0;
FD_ZERO(&readfs);
FD_ZERO(&errorfs);
FD_SET(sockfd, &readfs);
FD_SET(sockfd, &errorfs);
res = select(sockfd + 1, &readfs, 0, &errorfs, &delta);
if (res > 0) {
recvpacket(sockfd, MSG_ERRQUEUE, siocgstamp, siocgstampns);
}
return MLAN_STATUS_SUCCESS;
}
/**
*@brief get destination mac address
*
*@param ifc interface from which packet has to be sent
*@param ip IP Address of destination
*
*@return N/A
**/
void
get_mac(char *ifc, char *ip)
{
char ipAddr[20];
char hwAddr[20];
char device[10], temp[3], in[50];
int i = 0, j = 0, k = 0, res = 0, retry = 0;
FILE *arpCache = fopen("/proc/net/arp", "r");
if (!arpCache) {
fprintf(stderr,
"Arp Cache: Failed to open file \"/proc/net/arp\"");
}
/* Ignore the first line, which contains the header */
char header[ARP_FILE_BUFFER_LEN];
retry_again:
if (!fgets(header, sizeof(header), arpCache))
fprintf(stderr, "error getting mac from proc files");
while (3 == fscanf(arpCache, ARP_FORMAT, ipAddr, hwAddr, device)) {
if ((!strcmp(ipAddr, ip)) && (!strcmp(ifc, device))) {
printf("Sending Packet to Peer : %s\n", hwAddr);
strcpy(inter.ip, ipAddr);
strcpy(inter.interface, device);
while (hwAddr[i] != '\0') {
if (hwAddr[i] == ':') {
inter.mac[j++] = strtol(temp, NULL, 16);
i++;
k = 0;
} else
temp[k++] = hwAddr[i++];
}
inter.mac[j] = strtol(temp, NULL, 16);
res = 1;
}
}
if (res != 1 && retry == 0) {
sprintf(in, "ping -c 2 %s > /dev/null", ip);
system(in);
retry = 1;
rewind(arpCache);
goto retry_again;
} else if (res != 1 && retry == 1) {
printf("cannot find mac address for the specified ip\n");
fclose(arpCache);
exit(1);
}
fclose(arpCache);
}
/*
*@brief Receive Sync Packets
*
*@param sock socket from which packet must be recieved
*@param recvmsg_flags flags for recvmsg
*@param siocgstamp timestamp flag
*@param siocgstampns timestamp flag for nano secs
*
*@return N/A
**/
void
recvpacket(int sock, int recvmsg_flags, int siocgstamp, int siocgstampns)
{
unsigned char data[256];
struct msghdr msg;
struct iovec entry;
struct sockaddr_in from_addr;
struct {
struct cmsghdr cm;
char control[512];
} control;
int res, i;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &entry;
msg.msg_iovlen = 1;
entry.iov_base = data;
entry.iov_len = sizeof(data);
msg.msg_name = (caddr_t) & from_addr;
msg.msg_namelen = sizeof(from_addr);
msg.msg_control = &control;
msg.msg_controllen = sizeof(control);
res = recvmsg(sock, &msg, recvmsg_flags | MSG_DONTWAIT);
if (res < 0) {
fprintf(stderr, "%s %s: %s\n",
"recvmsg",
(recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
strerror(errno));
} else {
if (!(recvmsg_flags & MSG_ERRQUEUE)) {
printf("Received Packet from Peer : ");
for (i = 6; i < 12; i++)
printf("%02x:", data[i]);
printf("\n");
}
printpacket(&msg, res, sock, recvmsg_flags, siocgstamp,
siocgstampns);
}
}
/**
* @brief Prints Sent/Received Sync packets
*
* @param msg msghdr structure variable
* @param res result of recvmsg call
* @param sock socket variable
* @param recvmsg_flags flags for receive message
* @param siocgstamp timestamp flag
* @param siocgstampns timestamp flag for nano secs
*
* @return N/A
**/
void
printpacket(struct msghdr *msg, int res,
int sock, int recvmsg_flags, int siocgstamp, int siocgstampns)
{
struct cmsghdr *cmsg;
struct timespec now;
struct timespec *stamp;
clock_gettime(CLOCK_REALTIME, &now);
if (!(recvmsg_flags & MSG_ERRQUEUE)) {
printf("Application time : %ld.%09ld (received)\n",
(long)now.tv_sec, (long)now.tv_nsec);
}
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SO_TIMESTAMPING) {
stamp = (struct timespec *)CMSG_DATA(cmsg);
stamp++;
/* skip deprecated HW transformed */
stamp++;
fprintf(stdout, "HW time : %ld.%09ld\n",
(long)stamp->tv_sec, (long)stamp->tv_nsec);
if (!(recvmsg_flags & MSG_ERRQUEUE))
fprintf(stdout, "Delta in nsecs= %lld\n",
((long long)(now.tv_sec -
stamp->tv_sec) *
1000000000L + now.tv_nsec) -
(stamp->tv_nsec));
else
fprintf(stdout, "Delta in nsecs= %lld",
((long long)(stamp->tv_sec -
send_time.tv_sec) *
1000000000L + (stamp->tv_nsec) -
send_time.tv_nsec));
}
}
fprintf(stdout, "\n");
}

View File

@ -0,0 +1,54 @@
/** @file timestamp.h
*
* @brief This file contains definitions used for application
*
* Copyright (C) 2011-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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.
*
*/
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include "mlanutl.h"
#include <linux/if_packet.h>
#include <netinet/ether.h>
#include <linux/net_tstamp.h>
#define BUF_SIZ 1024
#define ARP_FORMAT "%s %*s %*s %s %*s %s"
#define ARP_FILE_BUFFER_LEN (1024)
struct interface_data {
char ip[20];
int mac[20];
char interface[20];
};
/**
* 802.1 Local Experimental 1.
*/
#ifndef ETH_P_802_EX1
#define ETH_P_802_EX1 0x88B5
#endif
void receive_timestamp(int argc, char *argv[]);
int send_timestamp(int argc, char *argv[]);
void get_mac(char *ifc, char *ip);
void recvpacket(int sock, int recvmsg_flags, int siocgstamp, int siocgstampns);
void printpacket(struct msghdr *msg, int res, int sock,
int recvmsg_flags, int siocgstamp, int siocgstampns);
#endif //_TIMESTAMP_H_

View File

@ -0,0 +1,53 @@
# File : uaputl/Makefile
#
# Copyright (C) 2008-2019, Marvell International Ltd. All Rights Reserved
# 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
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = uaputl.o uapcmd.o uaphostcmd.o
HEADERS = uaputl.h uapcmd.h
TARGET = uaputl.exe
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
@cp -rf config $(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

View File

@ -0,0 +1,45 @@
/* Domain and country mapping are in this section */
/* Domain name followed by supported countries */
COUNTRY: DOMAIN_CODE_FCC AE AM AN AR AZ BH BL BN BR CL CN CR CS DZ EC EG GE HN HK ID IL IR JM JO KP KW KZ LB LK MA MO NP OM PE PG PH PK PT QA SA SG SV SY TH TT TN UY YE ZA ZW VN
COUNTRY: DOMAIN_CODE_FCC1 US UZ CA CO DO GT MX PA PR TW NZ BO BZ VE
COUNTRY: DOMAIN_CODE_MKK JP
COUNTRY: DOMAIN_CODE_ETSI AL AD AT AU BY BE BA BG HR CY CZ DK EE FI FR MK DE GB GR HU IS IE IT KR LV LI LT LU MT MD MC ME NL NO PL RO RU SM RS SI SK ES SE CH TR UA UK
COUNTRY: DOMAIN_CODE_IN IN
COUNTRY: DOMAIN_CODE_MY MY
/* Domain specific sub-band information */
/* Domain name followed by set of triplets separated by comma */
/* 1st number in triplet is First channel, */
/* 2nd number in triplet is Number of channels followed from the First channel */
/* 3rd number in triplet is Max-TX-power in dbm */
DOMAIN: DOMAIN_CODE_FCC 1 13 20
DOMAIN: DOMAIN_CODE_FCC1 1 11 30
DOMAIN: DOMAIN_CODE_ETSI 1 13 20
DOMAIN: DOMAIN_CODE_MKK 1 14 23
DOMAIN: DOMAIN_CODE_IN 1 11 30
DOMAIN: DOMAIN_CODE_MY 1 13 20
DOMAIN: DOMAIN_CODE_TEST 1 1 20, 2 1 16, 3 6 30, 11 1 10
DOMAIN: DOMAIN_CODE_TEST1 1 11 30, 36 1 17, 40 1 17, 44 1 17, 48 1 17, 52 1 24, 56 1 24, 60 1 24, 64 1 24, 149 1 23, 153 1 23, 157 1 23, 161 1 23, 165 1 23,
DOMAIN: DOMAIN_CODE_END
/*
* Information for channels in A Band.
*/
*** 5GHz ***
DOMAIN: DOMAIN_CODE_FCC 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 144 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_FCC1 36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 100 1 30, 104 1 30, 108 1 30, 112 1 30, 116 1 30, 120 1 30, 124 1 30, 128 1 30, 132 1 30, 136 1 30, 140 1 30, 144 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
DOMAIN: DOMAIN_CODE_MKK 8 1 24, 12 1 24, 16 1 24, 36 1 23, 40 1 23, 44 1 23, 48 1 23, 52 1 23, 56 1 23, 60 1 23, 64 1 23, 100 1 23, 104 1 23, 108 1 23, 112 1 23, 116 1 23, 120 1 23, 124 1 23, 128 1 23, 132 1 23, 136 1 23, 140 1 23,
DOMAIN: DOMAIN_CODE_ETSI 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_IN 36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
DOMAIN: DOMAIN_CODE_MY 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_5G_END

View File

@ -0,0 +1,9 @@
# File : embedded_dhcp.conf
dhcp_config={
HostIPAddr=192.168.10.1
StartIPAddr=192.168.10.10
SubMask=255.255.255.0
LeaseTime=10000
LimitCount=5
}

View File

@ -0,0 +1,42 @@
01 00 0c 00 58 02
00 40 68 0c 00 00 00 40 00 00 00 00 00 11 00 00
00 11 00 10 00 00 00 00 00 00 00 00 00 00 00 00
10 12 00 10 10 86 40 89 01 03 02 00 01 02 05 00
01 03 05 00 17 17 00 05 00 00 00 00 00 00 00 00
00 30 1f 11 00 00 00 70 00 00 00 00 13 00 1e 01
00 1e 5e 15 29 5e 15 13 5c 1d 0d 0b 1d 0d 0b 29
0d 0b 29 5c 0b 29 5c 1d 00 5c 1d 0d 00 00 00 00
00 5c c0 0e 00 00 00 cc 00 5f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 00 00 ff
00 00 00 01 00 00 00 00 00 00 00 ff 00 00 00 01
00 00 00 00 00 00 00 ff 00 00 00 01 00 00 00 00
00 00 00 ff 00 00 00 01 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 5c dc 25 00 00 01 28 00 6f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 08 00 07
00 00 00 09 00 00 00 00 00 08 00 07 00 00 00 09
00 00 00 00 00 08 00 07 00 00 00 09 00 00 00 00
00 08 00 07 00 00 00 09 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 14 9f 1f 00 00 01 3c 03 00 00 00 00 f1 0a f1
00 fb 0d fb
00 20 dd 28 00 00 01 5c 08 86 00 88 ff 06 b1 05
24 24 3c 42 00 00 24 18 a4 24 bc bc 3d 00 a0 8f
00 14 00 2a 00 00 01 70 00 00 30 00 01 05 1b 00
00 00 00 01
00 74 2c 10 00 00 01 e4 00 00 00 00 09 6a 09 b0
0b 12 00 6c 04 0a 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 19 00 00 06 1b 00 00 07
1d 00 00 08 1f 00 00 09 21 00 00 0a 23 00 00 0b
25 00 00 0c 28 00 00 0d 2a 00 00 0e 2d 00 00 0f
2f 00 00 10 32 00 00 11 34 00 00 12 3f ff ff 13
3f ff ff 14
00 74 84 10 ff ff ff ff 01 00 00 00 09 b0 09 ba
0a 0f 00 6c 04 09 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 1a 00 00 06 1c 00 00 07
1f 00 00 08 21 00 00 09 23 00 00 0a 26 00 00 0b
2a 00 00 0c 2d 00 00 0d 31 00 00 0e 34 00 00 0f
3f ff ff 10 3f ff ff 11 3f ff ff 12 3f ff ff 13
3f ff ff 14

View File

@ -0,0 +1,6 @@
# File : tdls_ext_cap.conf
tdls_config={
tdls_prohibit=1
tdls_channel_switch_prohibit=1
}

View File

@ -0,0 +1,22 @@
# File : uapcoex.conf
coex_config={
common_config={
bitmap=0x0 # bit 0: override CTS2RTS protection
APBTCoex=0 # enabled or not
}
sco_config={
protectionFromQTime0=1000
protectionFromQTime1=600
protectionFromQTime2=0
protectionFromQTime3=0
scoProtectionFromRate=9
aclFrequency=20
}
acl_config={
enabled=1
btTime=40
wlanTime=60
aclProtectionFromRate=1
}
}

View File

@ -0,0 +1,149 @@
# File : uaputl.conf
ap_config={
SSID="Marvell Micro AP" # SSID of Micro AP, use '\' as an escape character before '"' character in SSID
BeaconPeriod=100 # Beacon period in TU
Channel=6 # Radio Channel 6
# Channel=0,1 # auto channel select (MCS mode)
# Channel=6,2 # primary channel 6, secondary channel above.
# Channel=6,4 # primary channel 6, secondary channel below
ChanList=1,6,11 # Scan channel list
# AP_MAC=00:34:22:77:46:41 # MAC address of AP
Band=0 # 0 for 2.4GHz band
# 1 for 5GHz band
Rate=0x82,0x84,0x8b,0x96,0x0C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
# Set of data rate that a station
# in the BSS may use
# (in unit of 500 kilobit/s)
TxPowerLevel=13 # Transmit power level in dBm
BroadcastSSID=1 # Broadcast SSID feature
# 1: Enable 0:Disable
RTSThreshold=2347 # RTS threshold value
FragThreshold=2346 # Fragmentation threshold value
DTIMPeriod=1 # DTIM period in beacon periods
MCBCdataRate=0 # MCBC rate to use for packet transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
# TxBeaconRate=0 # Beacon rate to use for Beacon transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
PktFwdCtl=1 # Packet forwarding control
# 0: forward all packets to the host
# 1: firmware handles intr-BSS packets
StaAgeoutTimer=1800 # Inactive client station age out timer value
# in units of 100ms
PSStaAgeoutTimer=400 # Inactive client PS station age out timer value
# in units of 100ms
MaxStaNum=10 # Max number of stations allowed to connect
Retrylimit=7 # Retry limit to use for packet transmissions
AuthMode=0 # 0:Open authentication
# 1:shared key authentication
Protocol=1 # protocol to use
# 1: No security 2: Static WEP
# 8: WPA 32: WPA2 40:WPA2 Mixed Mode
RSNReplayProtection=0 # RSN replay protection 0: disabled, 1: enabled
PairwiseUpdateTimeout=100 #Pairwise Handshake update timeout: 100ms
PairwiseHandshakeRetries=3 #Pairwise Handshake retries: 3
GroupwiseUpdateTimeout=100 #Groupwise Handshake update timeout: 100ms
GroupwiseHandshakeRetries=3 #Groupwise Handshake retries: 3
# **** WEP security setting******
# KeyIndex=0 # Index of WEP key to use (0 to 3)
# Sample Key configurations are
# Key_0="55555"
# Key_1=1234567890
# Key_2="1234567890123"
# Key_3=12345678901234567890123456
# **** Pairwise Cipher setting******
# Configure both of the following for Protocol=40
# PwkCipherWPA=4 # Pairwise cipher type
# 4: TKIP 8: AES CCMP
# 12: AES CCMP + TKIP
# PwkCipherWPA2=8 # Pairwise cipher type
# 4: TKIP 8: AES CCMP
# 12: AES CCMP + TKIP
# **** Group Cipher setting******
# GwkCipher=4 # group cipher type
# 4: TKIP 8: AES CCMP
# PSK="1234567890" # WPA/WPA2 passphrase
GroupRekeyTime= 86400 # Group key re-key interval, in second.
# 0 mean never re-key
Enable11n=1 # 1 to enable, 0 to disable
HTCapInfo=0x111c # HTCapInfo
# Bit 15-13: Reserved set to 0
# Bit 12: DSS/CCK mode in 40MHz enable/disable
# Bit 11-10: Reserved set to 0
# Bit 9-8: Reserved set to 0x01
# Bit 7: Reserved set to 0
# Bit 6: Short GI in 40 Mhz enable/disable
# Bit 5: Short GI in 20 Mhz enable/disable
# Bit 4: Green field enable/disble
# Bit 3-2: Reserved set to 1
# Bit 1: 20/40 Mhz enable disable.
# Bit 0: Reserved set to 0
AMPDU=0x03 # AMPDU
# Bit 7-5: Reserved set to 0
# Bit 4-2: Minimum MPDU Start spacing
# Set to 0 for no restriction
# Set to 1 for 1/4 us
# Set to 2 for 1/2 us
# Set to 3 for 1 us
# Set to 4 for 2 us
# Set to 5 for 4 us
# Set to 6 for 8 us
# Set to 7 for 16 us
# Bit 1-0: Max A-MPDU length
HT_MCS_MAP=0x0000ffff # Bit 7-0: MCS_SET_0
# Bit 15-8:MCS_SET_1
# Enable2040Coex=1 #Enable 20/40 coex feature
#802.11D specific configuration
11d_enable=0 # 0-disable 1-enable
# country=US # country information
}
ap_mac_filter={
FilterMode=0 # Mode of filter table
# 0: filter table is disabled
# 1: allow MAC address in the filter table to associate
# 2: block MAC address in the filter table
Count=0 # Number of entries in filter table,up to 16
#Sample mac settings are
# mac_1=00:50:23:45:76:22 # mac address
# mac_2=00:34:22:77:46:34 # mac address
}
# Wmm param setting
Wmm_parameters={
Qos_info=0x80
AC_BE
Aifsn=1
Ecw_max=1
Ecw_min=1
Tx_op=1
AC_BK
Aifsn=2
Ecw_max=2
Ecw_min=2
Tx_op=2
AC_VI
Aifsn=3
Ecw_max=3
Ecw_min=3
Tx_op=3
AC_VO
Aifsn=4
Ecw_max=4
Ecw_min=4
Tx_op=4
}

View File

@ -0,0 +1,80 @@
# File : uaputl_wifidirect.conf
ap_config={
SSID="DIRECT-" # SSID for WifiDirect
BeaconPeriod=100 # Beacon period in TU
Channel=6 # Radio Channel 6
# Channel=0,1 # auto channel select (MCS mode)
# Channel=6,2 # primary channel 6, secondary channel above.
# Channel=6,4 # primary channel 6, secondary channel below
ChanList=1,6,11 # Scan channel list
# AP_MAC=00:34:22:77:46:41 # MAC address of AP
Rate=0x8C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
# Set of data rate that a station
# in the BSS may use
# (in unit of 500 kilobit/s)
TxPowerLevel=13 # Transmit power level in dBm
BroadcastSSID=1 # Broadcast SSID feature
# 1: Enable 0:Disable
RTSThreshold=2347 # RTS threshold value
FragThreshold=2346 # Fragmentation threshold value
DTIMPeriod=1 # DTIM period in beacon periods
MCBCdataRate=0 # MCBC rate to use for packet transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
PktFwdCtl=1 # Packet forwarding control
# 0: forward all packets to the host
# 1: firmware handles intr-BSS packets
StaAgeoutTimer=1800 # Inactive client station age out timer value
# in units of 100ms
PSStaAgeoutTimer=400 # Inactive client PS station age out timer value
# in units of 100ms
MaxStaNum=7 # Max number of stations allowed to connect
Retrylimit=7 # Retry limit to use for packet transmissions
AuthMode=0 # 0:Open authentication
# 1:shared key authentication
Protocol=32 # protocol to use
# 1: No security 2: Static WEP
# 8: WPA 32: WPA2 40:WPA2 Mixed Mode
RSNReplayProtection=0 # RSN replay protection 0: disabled, 1: enabled
PairwiseUpdateTimeout=2000 #Pairwise Handshake update timeout: 2000ms
PairwiseHandshakeRetries=3 #Pairwise Handshake retries: 3
GroupwiseUpdateTimeout=2000 #Groupwise Handshake update timeout: 2000ms
GroupwiseHandshakeRetries=3 #Groupwise Handshake retries: 3
PwkCipherWPA2=8 # Pairwise cipher type
GwkCipher=8 # group cipher type
PSK="1234567890" # WPA/WPA2 passphrase
GroupRekeyTime= 86400 # Group key re-key interval, in second.
# 0 mean never re-key
Enable11n=1 # 1 to enable, 0 to disable
HTCapInfo=0x111c # HTCapInfo
# Bit 15-13: Reserved set to 0
# Bit 12: DSS/CCK mode in 40MHz enable/disable
# Bit 11-10: Reserved set to 0
# Bit 9-8: Reserved set to 0x01
# Bit 7: Reserved set to 0
# Bit 6: Short GI in 40 Mhz enable/disable
# Bit 5: Short GI in 20 Mhz enable/disable
# Bit 4: Green field enable/disble
# Bit 3-2: Reserved set to 1
# Bit 1: 20/40 Mhz enable disable.
# Bit 0: Reserved set to 0
AMPDU=0x03 # AMPDU
# Bit 7-5: Reserved set to 0
# Bit 4-2: Minimum MPDU Start spacing
# Set to 0 for no restriction
# Set to 1 for 1/4 us
# Set to 2 for 1/2 us
# Set to 3 for 1 us
# Set to 4 for 2 us
# Set to 5 for 4 us
# Set to 6 for 8 us
# Set to 7 for 16 us
# Bit 1-0: Max A-MPDU length
#802.11D specific configuration
11d_enable=0 # 0-disable 1-enable
}

7424
mwifiex_8997/mapp/uaputl/uapcmd.c Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
/** @file uapcmd.h
*
* @brief This file contains declaration referring to
* functions defined in uapcmd.c
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this File in
* accordance with the terms and conditions of the License, a copy of which
* is available along with the File in the gpl.txt file or by writing to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.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:
03/01/08: Initial creation
************************************************************************/
#ifndef _UAPCMD_H
#define _UAPCMD_H
/** Function Prototype Declaration */
int apcmd_sys_cfg_ap_mac_address(int argc, char *argv[]);
int apcmd_sys_cfg_ssid(int argc, char *argv[]);
int apcmd_sys_cfg_beacon_period(int argc, char *argv[]);
int apcmd_sys_cfg_dtim_period(int argc, char *argv[]);
int apcmd_sys_cfg_bss_status(int argc, char *argv[]);
int apcmd_sys_cfg_channel(int argc, char *argv[]);
int apcmd_sys_cfg_channel_ext(int argc, char *argv[]);
int apcmd_sys_cfg_scan_channels(int argc, char *argv[]);
int apcmd_sys_cfg_rates(int argc, char *argv[]);
int apcmd_sys_cfg_rates_ext(int argc, char *argv[]);
int apcmd_sys_cfg_tx_power(int argc, char *argv[]);
int apcmd_sys_cfg_bcast_ssid_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_preamble_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_rts_threshold(int argc, char *argv[]);
int apcmd_sys_cfg_frag_threshold(int argc, char *argv[]);
int apcmd_sys_cfg_radio_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_rsn_replay_prot(int argc, char *argv[]);
int apcmd_sys_cfg_tx_beacon_rate(int argc, char *argv[]);
int apcmd_sys_cfg_mcbc_data_rate(int argc, char *argv[]);
int apcmd_sys_cfg_pkt_fwd_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_sta_ageout_timer(int argc, char *argv[]);
int apcmd_sys_cfg_ps_sta_ageout_timer(int argc, char *argv[]);
int apcmd_sys_cfg_auth(int argc, char *argv[]);
int apcmd_sys_cfg_protocol(int argc, char *argv[]);
int apcmd_sys_cfg_wep_key(int argc, char *argv[]);
int apcmd_sys_cfg_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_pwk_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_gwk_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_wpa_passphrase(int argc, char *argv[]);
int apcmd_sys_cfg_group_rekey_timer(int argc, char *argv[]);
int apcmd_sta_filter_table(int argc, char *argv[]);
int apcmd_sys_cfg_max_sta_num(int argc, char *argv[]);
int apcmd_sys_cfg_retry_limit(int argc, char *argv[]);
int apcmd_sys_cfg_sticky_tim_config(int argc, char *argv[]);
int apcmd_sys_cfg_sticky_tim_sta_mac_addr(int argc, char *argv[]);
int apcmd_sys_cfg_eapol_pwk_hsk(int argc, char *argv[]);
int apcmd_sys_cfg_eapol_gwk_hsk(int argc, char *argv[]);
int apcmd_cfg_data(int argc, char *argv[]);
int apcmd_sys_cfg_custom_ie(int argc, char *argv[]);
int apcmd_sys_cfg_wmm(int argc, char *argv[]);
int apcmd_sys_cfg_ap_wmm(int argc, char *argv[]);
int apcmd_sys_cfg_11n(int argc, char *argv[]);
#ifdef RX_PACKET_COALESCE
int apcmd_rx_pkt_coalesce(int argc, char *argv[]);
void print_rx_packet_coalesc_help(void);
#endif
int apcmd_sys_cfg_2040_coex(int argc, char *argv[]);
int apcmd_sys_cfg_restrict_client_mode(int argc, char *argv[]);
#endif /* _UAP_H */

View File

@ -0,0 +1,335 @@
/** @file uaphostcmd.c
*
* @brief This file contains uAP hostcmd functions
*
* Copyright (C) 2010-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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
************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "uaputl.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/*
* @brief convert String to integer
*
* @param value A pointer to string
* @return integer
*/
static t_u32
a2hex_or_atoi(char *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *value;
}
}
/**
* @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. */
if ((end = strstr(start, "\""))) {
if (!(end = strstr(end + 1, "\"")))
end = start;
} else
end = start;
if ((end = strstr(end + 1, "#")))
*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 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 UAP_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 > MRVDRV_SIZE_OF_CMD_BUFFER) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*size += len;
if (*pos2 == '"') {
pos2++;
if ((pos3 = strchr(pos2, '"')) == 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++;
if ((pos3 = strchr(pos2, '\'')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = ',';
for (i = 0; i < len; i++) {
if ((pos3 = strchr(pos2, ',')) != 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 UAP_SUCCESS;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief Prepare host-command buffer
* @param fname path to the config file
* @param cmd_name Command name
* @param buf A pointer to comand buffer
* @return UAP_SUCCESS--success, otherwise--fail
*/
int
prepare_host_cmd_buffer(char *fname, char *cmd_name, t_u8 *buf)
{
char line[256], cmdname[256], *pos, cmdcode[10];
apcmdbuf *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
FILE *config_fp;
int ret = UAP_SUCCESS;
config_fp = fopen(fname, "r");
if (!config_fp) {
printf("Unable to find %s. Exiting...\n", fname);
return UAP_FAILURE;
}
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (apcmdbuf *)buf;
hostcmd->cmd_code = 0xffff;
snprintf(cmdname, sizeof(cmdname), "%s={", cmd_name);
cmdname_found = 0;
while ((pos = mlan_config_get_line(config_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(config_fp, line,
sizeof(line), &ln))) {
if (strncmp(pos, cmdcode, strlen(cmdcode)) == 0) {
cmdcode_found = 1;
hostcmd->cmd_code =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size =
sizeof(apcmdbuf) -
BUF_HEADER_SIZE;
mlan_get_hostcmd_data(config_fp, &ln,
buf +
sizeof(apcmdbuf),
&hostcmd->size);
break;
}
}
if (!cmdcode_found) {
fprintf(stderr,
"uaputl: CmdCode not found in conf file\n");
ret = UAP_FAILURE;
goto done;
}
break;
}
}
if (!cmdname_found) {
fprintf(stderr,
"uaputl: cmdname '%s' is not found in conf file\n",
cmd_name);
ret = UAP_FAILURE;
goto done;
}
done:
fclose(config_fp);
return ret;
}

14266
mwifiex_8997/mapp/uaputl/uaputl.c Executable file

File diff suppressed because it is too large Load Diff

2602
mwifiex_8997/mapp/uaputl/uaputl.h Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
# File : wifidirectutl/Makefile
#
# Copyright (C) 2008-2019, Marvell International Ltd. All Rights Reserved
# 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 += -Wall
LIBS = -lrt
.PHONY: default tags all
OBJECTS = wifidirectutl.o
HEADERS = wifidirectutl.h
ifneq (,$(findstring DWIFI_DISPLAY_SUPPORT, $(CFLAGS)))
OBJECTS += wifi_display.o
HEADERS += wifi_display.h
endif
TARGET = wifidirectutl
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
@cp -rf config $(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

View File

@ -0,0 +1,415 @@
# File : wifidirect.conf
######################### WIFIDIRECT Configuration command ##################
wifidirect_config={
# Arrange in order of subelement Ids
#
# WIFIDIRECT IE parameters.
#
Capability={
DeviceCapability=33
GroupCapability=8
}
GroupOwnerIntent={
Intent=5 # 0-15. 15-> highest GO desire
}
Channel={ # Listen channel attribute.
CountryString="US"
RegulatoryClass=81
ChannelNumber=6
}
InfrastructureManageabilityInfo={
Manageability=0
}
ChannelList={
CountryString="US"
# multiple attributes channel entry list
Regulatory_Class_1=81 # Regulatory class
NumofChannels_1=11 # No of channels
ChanList_1=1,2,3,4,5,6,7,8,9,10,11 # Scan channel list
Regulatory_Class_2=115 # Regulatory class
NumofChannels_2=4 # No of channels
ChanList_2=36,40,44,48 # Scan channel list
#Regulatory_Class_3=118 # Regulatory class
#NumofChannels_3=4 # No of channels
#ChanList_3=52,56,60,64 # Scan channel list
#Regulatory_Class_4=121 # Regulatory class
#NumofChannels_4=11 # No of channels
#ChanList_4=100,104,108,112,116,120,124,128,132,136,140 # Scan channel list
# Enable only one of the country blocks at a time
#CountryString="JP"
# multiple attributes channel entry list
#Regulatory_Class_1=81 # Regulatory class
#NumofChannels_1=13 # No of channels
#ChanList_1=1,2,3,4,5,6,7,8,9,10,11,12,13 # Scan channel list
#Regulatory_Class_2=115 # Regulatory class
#NumofChannels_2=4 # No of channels
#ChanList_2=36,40,44,48 # Scan channel list
#Regulatory_Class_3=118 # Regulatory class
#NumofChannels_3=4 # No of channels
#ChanList_3=52,56,60,64 # Scan channel list
#Regulatory_Class_4=121 # Regulatory class
#NumofChannels_4=11 # No of channels
#ChanList_4=100,104,108,112,116,120,124,128,132,136,140 # Scan channel list
}
NoticeOfAbsence={
NoA_Index=0 # Instance of NoA timing
OppPS=1 # Opportunistic Power save
CTWindow=10 # Client Traffic Window
NoA_descriptor={
CountType_1=255 # Count for GO mode OR Type for client mode
Duration_1=51200 # Max absence duration for GO mode OR
# min acceptable presence period for client mode
Interval_1=102400
StartTime_1=0
#CountType_2=1 # Count for GO mode OR Type for client mode
#Duration_2=0 # Max absence duration for GO mode OR
# min acceptable presence period for client mode
#Interval_2=0
#StartTime_2=0
}
}
DeviceInfo={
DeviceAddress=00:50:43:00:00:00
# categ: 2 bytes, OUI: 4 bytes, subcateg: 2 bytes
PrimaryDeviceTypeCategory=1
PrimaryDeviceTypeOUI=0x00,0x50,0xF2,0x04
PrimaryDeviceTypeSubCategory=1
SecondaryDeviceCount=2
SecondaryDeviceType={
SecondaryDeviceTypeCategory_1=6
SecondaryDeviceTypeOUI_1=0x00,0x50,0xF2,0x04
SecondaryDeviceTypeSubCategory_1=1
SecondaryDeviceTypeCategory_2=4
SecondaryDeviceTypeOUI_2=0x00,0x50,0xF2,0x04
SecondaryDeviceTypeSubCategory_2=1
}
DeviceName="MRVL_DEFAULT_NAME"
# ConfigMethods USB= 0x01
# ConfigMethods Ethernet= 0x02
# ConfigMethods Label= 0x04
# ConfigMethods Display= 0x08
# ConfigMethods Ext_NFC_Token= 0x10
# ConfigMethods Int_NFC_Token= 0x20
# ConfigMethods NFC_Interface= 0x40
# ConfigMethods PushButton= 0x80
# ConfigMethods KeyPad= 0x100
WPSConfigMethods=0x188
}
GroupId={
GroupAddr=00:50:43:00:00:00
GroupSsId="DIRECT-"
}
GroupBSSId={
# using LAA for interface address by default
GroupBssId=02:50:43:00:00:00
}
DeviceId={
WIFIDIRECT_MAC=00:50:43:00:00:00 # MAC address of wifidirect device in Hex
}
Interface={
# using LAA for interface addresses by default
InterfaceAddress=02:50:43:00:00:00
InterfaceAddressCount=2
InterfaceAddressList=02:50:43:00:00:00,02:52:43:00:00:00
}
ConfigurationTimeout={
# units of 10 milliseconds
GroupConfigurationTimeout=250
ClientConfigurationTimeout=100
}
ExtendedListenTime={
# units of milliseconds
AvailabilityPeriod=1000
AvailabilityInterval=1500
}
IntendedIntfAddress={
# using LAA for interface address by default
GroupInterfaceAddress=02:50:43:00:00:00
}
OperatingChannel={ # Operating channel attribute.
CountryString="US"
OpRegulatoryClass=81
OpChannelNumber=6
}
InvitationFlagBitmap={
InvitationFlag=0 # bit0: Invitation type:
} # 0: request to reinvoke a persistent group
# 1: request to join an active WIFIDIRECT group
#Extra={
#Buffer=0x00,0x50,0x43,0x07,0x20,0xa1
#}
#
# WPS IE parameters.
#
WPSIE={
WPSVersion=0x10
WPSSetupState=0x1
WPSRequestType=0x0
WPSResponseType=0x0
WPSSpecConfigMethods=0x0188
WPSUUID=0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78
WPSPrimaryDeviceType=0x00,0x01,0x00,0x50,0xF2,0x04,0x00,0x01
WPSRFBand=0x01
WPSAssociationState=0x00
WPSConfigurationError=0x00
WPSDevicePassword=0x00
WPSDeviceName="MRVL_DEFAULT_NAME"
WPSManufacturer=Marvell
WPSModelName=SD-8787
WPSModelNumber=0x00,0x00,0x00,0x01
WPSSerialNumber=0x00,0x00,0x00,0x01
WPSVendorExtension=0x00,0x37,0x2A,0x00,0x01,0x20
}
}
######################### WIFIDIRECT Parameters configuration command #######
wifidirect_param_config={
MinDiscoveryInterval=1
MaxDiscoveryInterval=7
EnableScan=1
#ScanPeerDeviceId=00:50:43:77:43:47
#ScanRequestDeviceType=0x01,0x00,0x50,0xF2,0x04,0x01,0x3C,0x10
DeviceState=4
}
######################### WIFIDIRECT Action Frame command ##################
wifidirect_action_frame={
PeerAddr=00:50:43:00:00:00
Category=4 # 4 : Public action frame, 0x7F : Vendor specific
Action=0 # 0xDD : Vendor specific, Others : Reserved.
OUI=0x50,0x6F,0x9A
OUIType=9 # WFA wifidirect.
# 15 : WPSE.
# OUI SubType 0 : GO Negotiation Request
# OUI SubType 1 : GO Negotiation Response
# OUI SubType 2 : GO Negotiation Confirmation
# OUI SubType 3 : WIFIDIRECT Invitation Request
# OUI SubType 4 : WIFIDIRECT Invitation Response
# OUI SubType 5 : Device Discoverability Request
# OUI SubType 6 : Device Discoverability Response
# OUI SubType 7 : Provision Discovery Request
# OUI SubType 8 : Provision Discovery Response
#
# UPDATE LINE BELOW for APPROPRIATE SUB TYPE
#
OUISubType=0
DialogToken=1
# Arrange in order of subelement Ids
# Other parameters which can be configured from WIFIDIRECT config command.
#DeviceId={
# WIFIDIRECT_MAC=00:50:43:77:46:41 # MAC address of wifidirect device in Hex
#}
#Interface={
# InterfaceAddress=00:50:43:77:46:41
# InterfaceAddressCount=2
# InterfaceAddressList=00:50:43:77:46:41,00:50:43:78:47:42
#}
}
######################### WIFIDIRECT service discovery command ##################
wifidirect_discovery_request={
PeerAddr=00:50:43:00:00:00
Category=4
Action=10
DialogToken=1
AdvertizementProtocolIE=0x6c,0x02,0x00,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryRequestLen={
InfoId=0xDD,0xDD
RequestLen={
OUI=0x50,0x6F,0x9A
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=0 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
QueryData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
#DNSName="_afpovertcp._tcp.local."
# DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
#DNSType=12
#BonjourVersion=1
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPQueryValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPQueryValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPQueryValue="uuid:device-uuid" # Searches for a particular device
#uPnPQueryValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPQueryValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPQueryValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPQueryValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}
wifidirect_discovery_response={
PeerAddr=00:50:43:00:00:00
Category=4
Action=11
DialogToken=1
StatusCode=0
GasComebackDelay=0x0000
AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryResponseLen={
InfoId=0xDD,0xDD
ResponseLen={
OUI=0x50,0x6F,0x9A
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=0 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
ServiceStatus=0 # 0: Success
# 1: Service protocol type not available
# 2: Query data not available
# 3: Bad request.
ResponseData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
DNSName="_afpovertcp._tcp.local."
# DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
DNSType=12
BonjourVersion=1
## RecordData can be string or hexadecimal sequence of bytes.
# RecordData=""
RecordData=0x00
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPResponseValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPResponseValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPResponseValue="uuid:device-uuid" # Searches for a particular device
#uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPResponseValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPResponseValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}
### GAS Comback request and response Frame ###
wifidirect_gas_comeback_request={
PeerAddr=00:50:43:00:00:00
Category=4
Action=12
DialogToken=1
}
wifidirect_gas_comeback_response={
PeerAddr=00:50:43:00:00:00
Category=4
Action=13
DialogToken=1
StatusCode=0
GasResponseFragID=0x01
# Bit 7: More GAS fragments bit
# Bits 0-6: GAS query response fragment ID.
# 0 for initial frame and increments subsequently.
GasComebackDelay=0x0000
AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryResponseLen={
InfoId=0xDD,0xDD
ResponseLen={
OUI=0x00,0x50,0xF2
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=1 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
ServiceStatus=0 # 0: Success
# 1: Service protocol type not available
# 2: Query data not available
# 3: Bad request.
ResponseData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
# DNSName="_afpovertcp._tcp.local."
DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
DNSType=12
BonjourVersion=1
## RecordData can be string or hexadecimal sequence of bytes.
# RecordData=""
RecordData=0x00
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPResponseValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPResponseValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPResponseValue="uuid:device-uuid" # Searches for a particular device
#uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPResponseValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPResponseValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}

View File

@ -0,0 +1,93 @@
# File : wifidisplay.conf
######################### WiFiDisplay Configuration command ##################
wifidisplay_config={
# Arrange in order of subelement Ids
display_dev_info={
device_info=19
mgmt_control_port=554
device_throuput=54
}
display_assoc_bssid={
}
display_coupled_sink={
coupled_sink_bitmap=0
}
display_session_info={
}
#display_alternate_mac={
# alternate_mac=00:50:43:00:00:00
#}
}
######################### WIFIDIRECT service discovery command ##################
wifidisplay_discovery_request={
PeerAddr=00:50:43:00:00:00
Category=4
Action=10
DialogToken=1
AdvertizementProtocolIE=0x6c,0x02,0x00,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryRequestLen={
InfoId=0xDD,0xDD
RequestLen={
OUI=0x50,0x6F,0x9A
OUISubType=10
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=4 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 4: Wifi Display
# 255: Vendor specific
ServiceTransactionId=1
QueryData={
}
}
}
}
}
wifidisplay_discovery_response={
PeerAddr=00:50:43:00:00:00
Category=4
Action=11
DialogToken=1
StatusCode=0
GasComebackDelay=0x0000
AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryResponseLen={
InfoId=0xDD,0xDD
ResponseLen={
OUI=0x50,0x6F,0x9A
OUISubType=10
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=4 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 4: Wifi Display
# 255: Vendor specific
ServiceTransactionId=1
ServiceStatus=0 # 0: Success
# 1: Service protocol type not available
# 2: Query data not available
# 3: Bad request.
ResponseData={
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
/** @file wifi_display.h
*
* @brief Header file for wifidirectutl application
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this File in
* accordance with the terms and conditions of the License, a copy of which
* is available along with the File in the gpl.txt file or by writing to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.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:
09/22/11: Initial creation
************************************************************************/
#ifndef _WIFIDISPLAY_H
#define _WIFIDISPLAY_H
#include "wifidirectutl.h"
/* coupled sink capability*/
#define MAX_COUPLED_SINK_CAPABILITY 2
#define MAX_CLIENTS 5
#define VENDOR_SPECIFIC_IE_TAG 0xDD
/** TLV : WifiDisplay devie info sublement ID */
#define TLV_TYPE_WIFIDISPLAY_DEVICE_INFO 0x00
/** TLV : WifiDisplay Assoc BSSID sublement ID */
#define TLV_TYPE_WIFIDISPLAY_ASSOC_BSSID 0x01
/** TLV : WifiDisplay Coupled Sink sublement ID */
#define TLV_TYPE_WIFIDISPLAY_COUPLED_SINK 0x06
/** TLV : WifiDisplay Session Info sublement ID */
#define TLV_TYPE_SESSION_INFO_SUBELEM 0x09
/** TLV : WifiDisplay Alternate MAC sublement ID */
#define TLV_TYPE_WIFIDISPLAY_ALTERNATE_MAC 0x10
/** Host Command ID : wfd display mode config */
#define HostCmd_CMD_WFD_DISPLAY_MODE_CONFIG 0x0106
/** Maximum ie index creation allowed with custom ie commands */
#define MAX_MGMT_IE_INDEX 12
/** Define len of OUI for WFD */
#define WIFIDISPLAY_OUI_LEN 3
/** Define OUI type for WFD */
#define WIFIDISPLAY_OUI_TYPE 1
/** Level of wifidisplay parameters in the wifidisplay.conf file */
typedef enum {
DISPLAY_DEVICE_INFO = 1,
DISPLAY_ASSOCIATED_BSSID,
DISPLAY_COUPLED_SINK,
DISPLAY_SESSION_INFO,
DISPLAY_ALTERNATE_MAC_ADDR,
} display_param_level;
/** Valid Wifi display input parameters */
typedef enum {
WFD_DEVICE_INFO,
WFD_SESSION_MGMT_CONTROL_PORT,
WFD_DEVICE_THROUGHPUT,
WFD_COUPLED_SINK,
} display_valid_inputs;
/** AP CMD header */
#define WIFI_DISPLAY_CMD_HEADER /** Buf Size */ \
t_u32 buf_size; \
/** Command Code */ \
t_u16 cmd_code; \
/** Size */ \
t_u16 size; \
/** Sequence Number */ \
t_u16 seq_num; \
/** Result */ \
t_s16 result
/** TLV buffer : WifiDisplay device info parameters*/
typedef PACK_START struct tlvbuf_wfdisplay_device_info {
/** Tag */
t_u8 tag;
/** Length */
t_u16 length;
/** action */
/** Device Info Bitmap */
t_u8 display_device_info[2];
/** Control Port for WFD communication */
t_u8 session_mgmt_control_port[2];
/** WFD Maximum Device Throuput */
t_u8 wfd_device_throuput[2];
} PACK_END tlvbuf_wfdisplay_device_info;
/** TLV buffer : WifiDisplay Assoc BSSID paramenters*/
typedef PACK_START struct tlvbuf_wfdisplay_assoc_bssid {
/** Tag */
t_u8 tag;
/** Length */
t_u16 length;
/** associated BSSID */
t_u8 assoc_bssid[ETH_ALEN];
} PACK_END tlvbuf_wfdisplay_assoc_bssid;
/** TLV buffer : WifiDisplay Alaternate MAC paramenters*/
typedef PACK_START struct tlvbuf_wfdisplay_alternate_mac {
/** Tag */
t_u8 tag;
/** Length */
t_u16 length;
/** Alternate MAC */
t_u8 alternate_mac[ETH_ALEN];
} PACK_END tlvbuf_wfdisplay_alternate_mac;
/** TLV buffer : WifiDisplay coupled sink parameters*/
typedef PACK_START struct tlvbuf_wfdisplay_coupled_sink {
/** Tag */
t_u8 tag;
/** Length */
t_u16 length;
/** Coupled Sink Bitmap */
t_u8 coupled_sink;
/** Coupled Peer MAC */
t_u8 peer_mac[ETH_ALEN];
} PACK_END tlvbuf_wfdisplay_coupled_sink;
/** TLV buffer : WifiDirect Device Info parameters*/
struct WifiDisplayDeviceInfoDesc {
t_u8 length;
t_u8 dev_address[ETH_ALEN];
t_u8 AssociatedBSSID[ETH_ALEN];
t_u8 dev_info[2];
t_u8 max_throughput[2];
t_u8 coupled_sink[7];
};
/** TLV buffer : WifiDirect Session Info parameters*/
typedef PACK_START struct tlvbuf_wifi_display_session_info {
/** Tag */
t_u8 tag;
/** Length */
t_u16 length;
/** Device Info Descriptor pointer */
t_u8 *WFDDevInfoDesc;
} PACK_END tlvbuf_wifi_display_session_info;
/** TLV buffer : WifiDirect Wifi Display IE format*/
typedef PACK_START struct tlvbuf_wifidisplay_ie_format {
/** Tag */
t_u8 ElemId;
/** Length */
t_u8 length;
/** Vendor Specific OUI */
t_u8 Oui[3];
/** Vendor Specific OUI */
t_u8 OuiType;
/** Vendor Specific OUI */
t_u8 wfd_ie[1];
} PACK_END tlvbuf_wifidisplay_ie_format;
/** HostCmd_CMD_WIFI_DISPLAY_MODE_CONFIG */
typedef PACK_START struct _wifi_display_mode_config {
WIFI_DISPLAY_CMD_HEADER;
/** Action */
t_u16 action; /* 0 = ACT_GET; 1 = ACT_SET; */
/** wifi display mode data */
t_u16 mode;
} PACK_END wifi_display_mode_config;
/** HostCmd_CMD_WIFIDISPLAY_SERVICE_DISCOVERY request */
typedef PACK_START struct _wifidisplay_discovery_request {
/** Header */
WIFI_DISPLAY_CMD_HEADER;
/** Peer mac address */
t_u8 peer_mac_addr[ETH_ALEN];
/** Category */
t_u8 category;
/** Action */
t_u8 action;
/** Dialog taken */
t_u8 dialog_taken;
/** Advertize protocol IE */
t_u8 advertize_protocol_ie[4];
/** Query request Length */
t_u16 query_len;
/** Information identifier */
t_u8 info_id[2];
/** Request Length */
t_u16 request_len;
/** OUI */
t_u8 oui[3];
/** OUI sub type */
t_u8 oui_sub_type;
/** Service update indicator */
t_u16 service_update_indicator;
/** Vendor Length */
t_u16 vendor_len;
/** Service protocol */
t_u8 service_protocol;
/** Service transaction Id */
t_u8 service_transaction_id;
/** Query Data */
t_u8 disc_query[0];
} PACK_END wifidisplay_discovery_request;
/** HostCmd_CMD_WIFIDISPLAY_SERVICE_DISCOVERY response */
typedef PACK_START struct _wifidisplay_discovery_response {
/** Header */
WIFI_DISPLAY_CMD_HEADER;
/** Peer mac address */
t_u8 peer_mac_addr[ETH_ALEN];
/** Category */
t_u8 category;
/** Action */
t_u8 action;
/** Dialog taken */
t_u8 dialog_taken;
/** Status code */
t_u16 status_code;
/** GAS comback reply */
t_u16 gas_reply;
/** Advertize protocol IE */
t_u8 advertize_protocol_ie[4];
/** Query response Length */
t_u16 query_len;
/** Information identifier */
t_u8 info_id[2];
/** Response Length */
t_u16 response_len;
/** OUI */
t_u8 oui[3];
/** OUI sub type */
t_u8 oui_sub_type;
/** Service update indicator */
t_u16 service_update_indicator;
/** Vendor Length */
t_u16 vendor_len;
/** Service protocol */
t_u8 service_protocol;
/** Service transaction Id */
t_u8 service_transaction_id;
/** Discovery status code */
t_u8 disc_status_code;
/** Response Data */
t_u8 disc_resp[0];
} PACK_END wifidisplay_discovery_response;
int is_wifidisplay_input_valid(display_valid_inputs cmd, int argc,
char *argv[]);
void wifidisplaycmd_config(int argc, char *argv[]);
void wifidisplay_file_params_config(char *file_name, char *cmd_name,
t_u8 *pbuf, t_u16 *ie_len_wifidisplay);
void wifidisplay_cmd_status(int argc, char *argv[]);
void wifidisplaycmd_service_discovery(int argc, char *argv[]);
void wifidisplay_update_custom_ie(int argc, char *argv[]);
void wifidisplay_update_coupledsink_bitmap(int argc, char *argv[]);
#endif /* _WIFIDISPLAY_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

35
mwifiex_8997/mlan/mlan.h Executable file
View File

@ -0,0 +1,35 @@
/** @file mlan.h
*
* @brief This file declares all APIs that will be called from MOAL module.
* It also defines the data structures used for APIs between MLAN and MOAL.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
10/13/2008: initial version
11/07/2008: split mlan.h into mlan_decl.h & mlan_ioctl.h
******************************************************/
#ifndef _MLAN_H_
#define _MLAN_H_
#include "mlan_decl.h"
#include "mlan_ioctl.h"
#include "mlan_ieee.h"
#endif /* !_MLAN_H_ */

1332
mwifiex_8997/mlan/mlan_11ac.c Executable file

File diff suppressed because it is too large Load Diff

55
mwifiex_8997/mlan/mlan_11ac.h Executable file
View File

@ -0,0 +1,55 @@
/** @file mlan_11ac.h
*
* @brief This file contains the functions for station ioctl.
*
* Copyright (C) 2011-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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.
*/
#ifndef _MLAN_11AC_H_
#define _MLAN_11AC_H_
#include "mlan_11n_aggr.h"
#include "mlan_11n_rxreorder.h"
#include "mlan_wmm.h"
void wlan_show_dot11acdevcap(pmlan_adapter pmadapter, t_u32 cap);
void wlan_show_dot11acmcssupport(pmlan_adapter pmadapter, t_u32 support);
t_u16 wlan_convert_mcsmap_to_maxrate(mlan_private *priv, t_u8 bands,
t_u16 mcs_map);
void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap,
t_u8 bands, t_u8 flag);
void wlan_fill_vht_cap_ie(mlan_private *priv, IEEEtypes_VHTCap_t *pvht_cap,
t_u8 bands);
void wlan_fill_tdls_vht_oprat_ie(mlan_private *priv,
IEEEtypes_VHTOprat_t *vht_oprat,
sta_node *sta_ptr);
t_u8 wlan_is_ap_in_11ac_mode(mlan_private *priv);
int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
t_u8 **ppbuffer);
mlan_status wlan_11ac_cfg_ioctl(pmlan_adapter pmadapter,
pmlan_ioctl_req pioctl_req);
void wlan_update_11ac_cap(mlan_private *pmpriv);
t_u8 wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band);
mlan_status wlan_cmd_11ac_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *cmd,
IN t_u16 cmd_action, IN t_void *pdata_buf);
mlan_status wlan_ret_11ac_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *resp,
IN mlan_ioctl_req *pioctl_buf);
#endif /* _MLAN_11AC_H_ */

1639
mwifiex_8997/mlan/mlan_11d.c Executable file

File diff suppressed because it is too large Load Diff

4270
mwifiex_8997/mlan/mlan_11h.c Executable file

File diff suppressed because it is too large Load Diff

195
mwifiex_8997/mlan/mlan_11h.h Executable file
View File

@ -0,0 +1,195 @@
/** @file mlan_11h.h
*
* @brief This header file contains data structures and
* function declarations of 802.11h
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
03/26/2009: initial creation
*************************************************************/
#ifndef _MLAN_11H_
#define _MLAN_11H_
/** 11H OID bitmasks */
#define ENABLE_11H_MASK MBIT(0)
#define MASTER_RADAR_DET_MASK MBIT(1)
#define SLAVE_RADAR_DET_MASK MBIT(2)
/** DFS Master Radar Detect global enable */
#define DFS_MASTER_RADAR_DETECT_EN (MTRUE)
/** DFS Slave Radar Detect global enable */
#define DFS_SLAVE_RADAR_DETECT_EN (MFALSE)
#define CHANNEL_OFFSET_MASK 0x30
#define CHANNEL_BANDWIDTH_MASK 0x0C
/**
* 11H APIs
*/
/* Is master radar detection enabled in firmware? */
extern t_bool wlan_11h_is_master_radar_det_active(mlan_private *priv);
/** Configure master radar detection.
* Need call wlan_11h_check_update_radar_det_state() after.
*/
extern mlan_status wlan_11h_config_master_radar_det(mlan_private *priv,
t_bool enable);
/** Configure slave radar detection.
* Need call wlan_11h_check_update_radar_det_state() after.
*/
extern mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv,
t_bool enable);
/** Checks all interfaces and updates radar detect flags if necessary */
extern mlan_status wlan_11h_check_update_radar_det_state(mlan_private *pmpriv);
/** Return 1 if 11h is active in the firmware, 0 if it is inactive */
extern t_bool wlan_11h_is_active(mlan_private *priv);
/** Enable the tx interface and record the new transmit state */
extern void wlan_11h_tx_enable(mlan_private *priv);
/** Disable the tx interface and record the new transmit state */
extern void wlan_11h_tx_disable(mlan_private *priv);
/** Activate 11h extensions in the firmware */
extern mlan_status wlan_11h_activate(mlan_private *priv, t_void *pioctl_buf,
t_bool flag);
/** Initialize the 11h device structure */
extern void wlan_11h_init(mlan_adapter *pmadapter);
/** Cleanup for the 11h device structure */
extern void wlan_11h_cleanup(mlan_adapter *pmadapter);
/** Initialize the 11h interface structure */
extern void wlan_11h_priv_init(mlan_private *pmpriv);
/** Get an initial random channel to start an adhoc network on */
extern t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv);
/** Get channel that has been closed via Channel Switch Announcement */
extern t_u8 wlan_11h_get_csa_closed_channel(mlan_private *priv);
/** Check if radar detection is required on the specified channel */
extern t_bool wlan_11h_radar_detect_required(mlan_private *priv, t_u8 channel);
/** Perform a standard availibility check on the specified channel */
extern t_s32 wlan_11h_issue_radar_detect(mlan_private *priv,
pmlan_ioctl_req pioctl_req,
t_u8 channel, Band_Config_t bandcfg);
/** Check previously issued radar report for a channel */
extern mlan_status wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan);
/** Add any 11h TLVs necessary to complete an adhoc start command */
extern t_s32 wlan_11h_process_start(mlan_private *priv,
t_u8 **ppbuffer,
IEEEtypes_CapInfo_t *pcap_info,
t_u32 channel,
wlan_11h_bss_info_t *p11h_bss_info);
/** Add any 11h TLVs necessary to complete a join command (adhoc or infra) */
extern t_s32 wlan_11h_process_join(mlan_private *priv,
t_u8 **ppbuffer,
IEEEtypes_CapInfo_t *pcap_info,
t_u8 band,
t_u32 channel,
wlan_11h_bss_info_t *p11h_bss_info);
/** Complete the firmware command preparation for an 11h command function */
extern mlan_status wlan_11h_cmd_process(mlan_private *priv,
HostCmd_DS_COMMAND *pcmd_ptr,
const t_void *pinfo_buf);
/** Process the response of an 11h firmware command */
extern mlan_status wlan_11h_cmdresp_process(mlan_private *priv,
const HostCmd_DS_COMMAND *resp);
/** Receive IEs from scan processing and record any needed info for 11h */
extern mlan_status wlan_11h_process_bss_elem(mlan_adapter *pmadapter,
wlan_11h_bss_info_t *p11h_bss_info,
const t_u8 *pelement);
/** Handler for EVENT_CHANNEL_SWITCH_ANN */
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);
#ifdef DFS_TESTING_SUPPORT
/** Handler for DFS_TESTING IOCTL */
extern mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter,
pmlan_ioctl_req pioctl_req);
extern mlan_status wlan_11h_ioctl_get_channel_nop_info(pmlan_adapter pmadapter,
pmlan_ioctl_req
pioctl_req);
#endif
extern mlan_status
wlan_11h_ioctl_dfs_cancel_chan_report(mlan_private *priv,
pmlan_ioctl_req pioctl_req);
extern
mlan_status wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter,
pmlan_ioctl_req pioctl_req);
/** 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);
/** Check if RADAR_DETECTED handling is blocking data tx */
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);
/** BW_change event Handler for dfs_repeater */
void wlan_dfs_rep_bw_change(mlan_adapter *pmadapter);
/** disconnect event Handler for dfs_repeater */
void wlan_dfs_rep_disconnect(mlan_adapter *pmadapter);
/** Handler for RADAR_DETECTED */
extern mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter,
mlan_private *priv);
mlan_status wlan_11h_remove_custom_ie(mlan_adapter *pmadapter,
mlan_private *pmpriv);
/** DFS Event pre-processing */
extern mlan_status wlan_11h_dfs_event_preprocessing(mlan_adapter *pmadapter);
/** DFS switch to non-DFS channel */
extern mlan_status wlan_11h_switch_non_dfs_chan(mlan_private *priv,
Band_Config_t bandcfg,
t_u8 *chan);
extern void wlan_11h_update_bandcfg(IN Band_Config_t *uap_band_cfg,
IN t_u8 new_channel);
/** function checks if interface is active. **/
extern t_bool wlan_is_intf_active(mlan_private *pmpriv);
#endif /*_MLAN_11H_ */

3248
mwifiex_8997/mlan/mlan_11n.c Executable file

File diff suppressed because it is too large Load Diff

422
mwifiex_8997/mlan/mlan_11n.h Executable file
View File

@ -0,0 +1,422 @@
/** @file mlan_11n.h
*
* @brief Interface for the 802.11n mlan_11n module implemented in mlan_11n.c
*
* Driver interface functions and type declarations for the 11n module
* implemented in mlan_11n.c.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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:
12/01/2008: initial version
********************************************************/
#ifndef _MLAN_11N_H_
#define _MLAN_11N_H_
#include "mlan_11n_aggr.h"
#include "mlan_11n_rxreorder.h"
#include "mlan_wmm.h"
/** Print the 802.11n device capability */
void wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap);
/** Print the 802.11n device MCS */
void wlan_show_devmcssupport(pmlan_adapter pmadapter, t_u8 support);
/** Handle the command response of a delete block ack request */
mlan_status wlan_ret_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *resp);
/** Handle the command response of an add block ack request */
mlan_status wlan_ret_11n_addba_req(mlan_private *priv,
HostCmd_DS_COMMAND *resp);
/** Handle the command response of 11ncfg command */
mlan_status wlan_ret_11n_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *resp,
IN mlan_ioctl_req *pioctl_buf);
/** Prepare 11ncfg command */
mlan_status wlan_cmd_11n_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *cmd, IN t_u16 cmd_action,
IN t_void *pdata_buf);
/** Prepare reject addba requst command */
mlan_status wlan_cmd_reject_addba_req(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *cmd,
IN t_u16 cmd_action,
IN t_void *pdata_buf);
/** Handle the command response of rejecting addba request */
mlan_status wlan_ret_reject_addba_req(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *resp,
IN mlan_ioctl_req *pioctl_buf);
/** Prepare TX BF configuration command */
mlan_status wlan_cmd_tx_bf_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *cmd,
IN t_u16 cmd_action, IN t_void *pdata_buf);
/** Handle the command response TX BF configuration */
mlan_status wlan_ret_tx_bf_cfg(IN pmlan_private pmpriv,
IN HostCmd_DS_COMMAND *resp,
IN mlan_ioctl_req *pioctl_buf);
#ifdef STA_SUPPORT
t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band);
/** Append the 802_11N tlv */
int wlan_cmd_append_11n_tlv(IN mlan_private *pmpriv,
IN BSSDescriptor_t *pbss_desc, OUT t_u8 **ppbuffer);
/** wlan fill HT cap tlv */
void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap,
t_u8 band, t_u8 fill);
/** wlan fill HT cap IE */
void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap,
t_u8 bands);
#endif /* STA_SUPPORT */
/** Miscellaneous configuration handler */
mlan_status wlan_11n_cfg_ioctl(IN pmlan_adapter pmadapter,
IN pmlan_ioctl_req pioctl_req);
/** Delete Tx BA stream table entry */
void wlan_11n_delete_txbastream_tbl_entry(mlan_private *priv,
TxBAStreamTbl *ptx_tbl);
/** Delete all Tx BA stream table entries */
void wlan_11n_deleteall_txbastream_tbl(mlan_private *priv);
/** Get Tx BA stream table */
TxBAStreamTbl *wlan_11n_get_txbastream_tbl(mlan_private *priv, int tid,
t_u8 *ra, int lock);
/** Create Tx BA stream table */
void wlan_11n_create_txbastream_tbl(mlan_private *priv, t_u8 *ra, int tid,
baStatus_e ba_status);
/** Send ADD BA request */
int wlan_send_addba(mlan_private *priv, int tid, t_u8 *peer_mac);
/** Send DEL BA request */
int wlan_send_delba(mlan_private *priv, pmlan_ioctl_req pioctl_req, int tid,
t_u8 *peer_mac, int initiator);
/** This function handles the command response of delete a block ack request*/
void wlan_11n_delete_bastream(mlan_private *priv, t_u8 *del_ba);
/** get rx reorder table */
int wlan_get_rxreorder_tbl(mlan_private *priv, rx_reorder_tbl *buf);
/** get tx ba stream table */
int wlan_get_txbastream_tbl(mlan_private *priv, tx_ba_stream_tbl *buf);
/** send delba */
void wlan_11n_delba(mlan_private *priv, int tid);
/** update amdpdu tx win size */
void wlan_update_ampdu_txwinsize(pmlan_adapter pmadapter);
/** Minimum number of AMSDU */
#define MIN_NUM_AMSDU 2
/** AMSDU Aggr control cmd resp */
mlan_status wlan_ret_amsdu_aggr_ctrl(pmlan_private pmpriv,
HostCmd_DS_COMMAND *resp,
mlan_ioctl_req *pioctl_buf);
void wlan_set_tx_pause_flag(mlan_private *priv, t_u8 flag);
/** reconfigure tx buf size */
mlan_status wlan_cmd_recfg_tx_buf(mlan_private *priv,
HostCmd_DS_COMMAND *cmd,
int cmd_action, void *pdata_buf);
/** AMSDU aggr control cmd */
mlan_status wlan_cmd_amsdu_aggr_ctrl(mlan_private *priv,
HostCmd_DS_COMMAND *cmd,
int cmd_action, void *pdata_buf);
t_u8 wlan_validate_chan_offset(IN mlan_private *pmpriv,
IN t_u8 band, IN t_u32 chan, IN t_u8 chan_bw);
/** get channel offset */
t_u8 wlan_get_second_channel_offset(int chan);
void wlan_update_11n_cap(mlan_private *pmpriv);
/** clean up txbastream_tbl */
void wlan_11n_cleanup_txbastream_tbl(mlan_private *priv, t_u8 *ra);
/**
* @brief This function checks whether a station has 11N enabled or not
*
* @param priv A pointer to mlan_private
* @param mac station mac address
* @return MTRUE or MFALSE
*/
static INLINE t_u8
is_station_11n_enabled(mlan_private *priv, t_u8 *mac)
{
sta_node *sta_ptr = MNULL;
sta_ptr = wlan_get_station_entry(priv, mac);
if (sta_ptr)
return (sta_ptr->is_11n_enabled) ? MTRUE : MFALSE;
return MFALSE;
}
/**
* @brief This function get station max amsdu size
*
* @param priv A pointer to mlan_private
* @param mac station mac address
* @return max amsdu size statio supported
*/
static INLINE t_u16
get_station_max_amsdu_size(mlan_private *priv, t_u8 *mac)
{
sta_node *sta_ptr = MNULL;
sta_ptr = wlan_get_station_entry(priv, mac);
if (sta_ptr)
return sta_ptr->max_amsdu;
return 0;
}
/**
* @brief This function checks whether a station allows AMPDU or not
*
* @param priv A pointer to mlan_private
* @param ptr A pointer to RA list table
* @param tid TID value for ptr
* @return MTRUE or MFALSE
*/
static INLINE t_u8
is_station_ampdu_allowed(mlan_private *priv, raListTbl *ptr, int tid)
{
sta_node *sta_ptr = MNULL;
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
if (sta_ptr) {
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
if (priv->sec_info.wapi_enabled &&
!sta_ptr->wapi_key_on)
return MFALSE;
}
return (sta_ptr->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED)
? MTRUE : MFALSE;
}
return MFALSE;
}
/**
* @brief This function disable station ampdu for specific tid
*
* @param priv A pointer to mlan_private
* @param tid tid index
* @param ra station mac address
* @return N/A
*/
static INLINE void
disable_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra)
{
sta_node *sta_ptr = MNULL;
sta_ptr = wlan_get_station_entry(priv, ra);
if (sta_ptr)
sta_ptr->ampdu_sta[tid] = BA_STREAM_NOT_ALLOWED;
return;
}
/**
* @brief This function reset station ampdu for specific id to user setting.
*
* @param priv A pointer to mlan_private
* @param tid tid index
* @param ra station mac address
* @return N/A
*/
static INLINE void
reset_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra)
{
sta_node *sta_ptr = MNULL;
sta_ptr = wlan_get_station_entry(priv, ra);
if (sta_ptr)
sta_ptr->ampdu_sta[tid] = priv->aggr_prio_tbl[tid].ampdu_user;
return;
}
#define IS_BG_RATE (priv->bitmap_rates[0] || priv->bitmap_rates[1])
/**
* @brief This function checks whether AMPDU is allowed or not
*
* @param priv A pointer to mlan_private
* @param ptr A pointer to RA list table
* @param tid TID value for ptr
*
* @return MTRUE or MFALSE
*/
static INLINE t_u8
wlan_is_ampdu_allowed(mlan_private *priv, raListTbl *ptr, int tid)
{
if (ptr->is_tdls_link)
return is_station_ampdu_allowed(priv, ptr, tid);
if (priv->adapter->tdls_status != TDLS_NOT_SETUP && !priv->txaggrctrl)
return MFALSE;
if ((!priv->is_data_rate_auto) && IS_BG_RATE)
return MFALSE;
#ifdef UAP_SUPPORT
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)
return is_station_ampdu_allowed(priv, ptr, tid);
#endif /* UAP_SUPPORT */
if (priv->sec_info.wapi_enabled && !priv->sec_info.wapi_key_on)
return MFALSE;
return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED)
? MTRUE : MFALSE;
}
#define BA_RSSI_HIGH_THRESHOLD -70
static INLINE void
wlan_update_station_del_ba_count(mlan_private *priv, raListTbl *ptr)
{
sta_node *sta_ptr = MNULL;
t_s8 rssi;
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
if (sta_ptr) {
rssi = sta_ptr->snr - sta_ptr->nf;
if (rssi > BA_RSSI_HIGH_THRESHOLD)
ptr->del_ba_count = 0;
}
return;
}
static INLINE void
wlan_update_del_ba_count(mlan_private *priv, raListTbl *ptr)
{
t_s8 rssi;
#ifdef UAP_SUPPORT
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)
return wlan_update_station_del_ba_count(priv, ptr);
#endif /* UAP_SUPPORT */
if (ptr->is_tdls_link)
return wlan_update_station_del_ba_count(priv, ptr);
rssi = priv->snr - priv->nf;
if (rssi > BA_RSSI_HIGH_THRESHOLD)
ptr->del_ba_count = 0;
}
/**
* @brief This function checks whether AMSDU is allowed or not
*
* @param priv A pointer to mlan_private
* @param ptr A pointer to RA list table
* @param tid TID value for ptr
*
* @return MTRUE or MFALSE
*/
static INLINE t_u8
wlan_is_amsdu_allowed(mlan_private *priv, raListTbl *ptr, int tid)
{
#ifdef UAP_SUPPORT
sta_node *sta_ptr = MNULL;
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
if (sta_ptr) {
if (priv->sec_info.wapi_enabled &&
!sta_ptr->wapi_key_on)
return MFALSE;
}
}
#endif /* UAP_SUPPORT */
if (ptr->is_tdls_link)
return (priv->aggr_prio_tbl[tid].amsdu !=
BA_STREAM_NOT_ALLOWED)? MTRUE : MFALSE;
#define TXRATE_BITMAP_INDEX_MCS0_7 2
return ((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)
&&((priv->is_data_rate_auto)
||
!(((priv->bitmap_rates[TXRATE_BITMAP_INDEX_MCS0_7]) & 0x03)
|| IS_BG_RATE))) ? MTRUE : MFALSE;
}
/**
* @brief This function checks whether a BA stream is available or not
*
* @param priv A pointer to mlan_private
*
* @return MTRUE or MFALSE
*/
static INLINE t_u8
wlan_is_bastream_avail(mlan_private *priv)
{
mlan_private *pmpriv = MNULL;
t_u8 i = 0;
t_u32 bastream_num = 0;
t_u32 bastream_max = 0;
for (i = 0; i < priv->adapter->priv_num; i++) {
pmpriv = priv->adapter->priv[i];
if (pmpriv)
bastream_num +=
wlan_wmm_list_len((pmlan_list_head)&pmpriv->
tx_ba_stream_tbl_ptr);
}
bastream_max = ISSUPP_GETTXBASTREAM(priv->adapter->hw_dot_11n_dev_cap);
if (bastream_max == 0)
bastream_max = MLAN_MAX_TX_BASTREAM_DEFAULT;
return (bastream_num < bastream_max) ? MTRUE : MFALSE;
}
/**
* @brief This function finds the stream to delete
*
* @param priv A pointer to mlan_private
* @param ptr A pointer to RA list table
* @param ptr_tid TID value of ptr
* @param ptid A pointer to TID of stream to delete, if return MTRUE
* @param ra RA of stream to delete, if return MTRUE
*
* @return MTRUE or MFALSE
*/
static INLINE t_u8
wlan_find_stream_to_delete(mlan_private *priv,
raListTbl *ptr, int ptr_tid, int *ptid, t_u8 *ra)
{
int tid;
t_u8 ret = MFALSE;
TxBAStreamTbl *ptx_tbl;
ENTER();
ptx_tbl = (TxBAStreamTbl *)util_peek_list(priv->adapter->pmoal_handle,
&priv->tx_ba_stream_tbl_ptr,
MNULL, MNULL);
if (!ptx_tbl) {
LEAVE();
return ret;
}
tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user;
while (ptx_tbl != (TxBAStreamTbl *)&priv->tx_ba_stream_tbl_ptr) {
if (tid > priv->aggr_prio_tbl[ptx_tbl->tid].ampdu_user) {
tid = priv->aggr_prio_tbl[ptx_tbl->tid].ampdu_user;
*ptid = ptx_tbl->tid;
memcpy(priv->adapter, ra, ptx_tbl->ra,
MLAN_MAC_ADDR_LENGTH);
ret = MTRUE;
}
ptx_tbl = ptx_tbl->pnext;
}
LEAVE();
return ret;
}
/**
* @brief This function checks whether 11n is supported
*
* @param priv A pointer to mlan_private
* @param ra Address of the receiver STA
*
* @return MTRUE or MFALSE
*/
static INLINE int
wlan_is_11n_enabled(mlan_private *priv, t_u8 *ra)
{
int ret = MFALSE;
ENTER();
#ifdef UAP_SUPPORT
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
if ((!(ra[0] & 0x01)) && (priv->is_11n_enabled))
ret = is_station_11n_enabled(priv, ra);
}
#endif /* UAP_SUPPORT */
LEAVE();
return ret;
}
#endif /* !_MLAN_11N_H_ */

595
mwifiex_8997/mlan/mlan_11n_aggr.c Executable file
View File

@ -0,0 +1,595 @@
/** @file mlan_11n_aggr.c
*
* @brief This file contains functions for 11n Aggregation.
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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/10/2008: initial version
********************************************************/
#include "mlan.h"
#include "mlan_join.h"
#include "mlan_util.h"
#include "mlan_fw.h"
#include "mlan_main.h"
#include "mlan_wmm.h"
#include "mlan_11n.h"
#include "mlan_11n_aggr.h"
#include "mlan_pcie.h"
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief Aggregate individual packets into one AMSDU packet
*
* @param pmadapter A pointer to mlan_adapter structure
* @param amsdu_buf A pointer to packet buffer
* @param data A pointer to aggregated data packet being formed
* @param pkt_len Length of current packet to aggregate
* @param pad Pad
*
* @return Final packet size
*/
static int
wlan_11n_form_amsdu_pkt(pmlan_adapter pmadapter, t_u8 *amsdu_buf, t_u8 *data,
int pkt_len, int *pad)
{
int dt_offset, amsdu_buf_offset;
Rfc1042Hdr_t snap = {
0xaa, /* LLC DSAP */
0xaa, /* LLC SSAP */
0x03, /* LLC CTRL */
{0x00, 0x00, 0x00}, /* SNAP OUI */
0x0000 /* SNAP type */
/*
* This field will be overwritten
* later with ethertype
*/
};
ENTER();
memcpy(pmadapter, amsdu_buf, data, (MLAN_MAC_ADDR_LENGTH) * 2);
dt_offset = amsdu_buf_offset = (MLAN_MAC_ADDR_LENGTH) * 2;
snap.snap_type = *(t_u16 *)(data + dt_offset);
dt_offset += sizeof(t_u16);
*(t_u16 *)(amsdu_buf + amsdu_buf_offset) = mlan_htons(pkt_len +
LLC_SNAP_LEN -
((2 *
MLAN_MAC_ADDR_LENGTH)
+
sizeof(t_u16)));
amsdu_buf_offset += sizeof(t_u16);
memcpy(pmadapter, amsdu_buf + amsdu_buf_offset, &snap, LLC_SNAP_LEN);
amsdu_buf_offset += LLC_SNAP_LEN;
memcpy(pmadapter, amsdu_buf + amsdu_buf_offset, data + dt_offset,
pkt_len - dt_offset);
*pad = (((pkt_len + LLC_SNAP_LEN) & 3)) ? (4 -
(((pkt_len +
LLC_SNAP_LEN)) & 3)) : 0;
LEAVE();
return pkt_len + LLC_SNAP_LEN + *pad;
}
/**
* @brief Add TxPD to AMSDU header
*
* @param priv A pointer to mlan_private structure
* @param mbuf Pointer to buffer where the TxPD will be formed
*
* @return N/A
*/
static void
wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf)
{
TxPD *ptx_pd;
mlan_adapter *pmadapter = priv->adapter;
ENTER();
ptx_pd = (TxPD *)mbuf->pbuf;
memset(pmadapter, ptx_pd, 0, sizeof(TxPD));
/*
* Original priority has been overwritten
*/
ptx_pd->priority = (t_u8)mbuf->priority;
ptx_pd->pkt_delay_2ms =
wlan_wmm_compute_driver_packet_delay(priv, mbuf);
ptx_pd->bss_num = GET_BSS_NUM(priv);
ptx_pd->bss_type = priv->bss_type;
/* Always zero as the data is followed by TxPD */
ptx_pd->tx_pkt_offset = sizeof(TxPD);
ptx_pd->tx_pkt_type = PKT_TYPE_AMSDU;
if (mbuf->flags & MLAN_BUF_FLAG_TDLS)
ptx_pd->flags = MRVDRV_TxPD_FLAGS_TDLS_PACKET;
if (ptx_pd->tx_control == 0)
/* TxCtrl set by user or default */
ptx_pd->tx_control = priv->pkt_tx_ctrl;
endian_convert_TxPD(ptx_pd);
LEAVE();
}
/**
* @brief Update the TxPktLength field in TxPD after the complete AMSDU
* packet is formed
*
* @param priv A pointer to mlan_private structure
* @param mbuf TxPD buffer
*
* @return N/A
*/
static INLINE void
wlan_11n_update_pktlen_amsdu_txpd(mlan_private *priv, pmlan_buffer mbuf)
{
TxPD *ptx_pd;
ENTER();
ptx_pd = (TxPD *)mbuf->pbuf;
ptx_pd->tx_pkt_length =
(t_u16)wlan_cpu_to_le16(mbuf->data_len - sizeof(TxPD));
#ifdef STA_SUPPORT
if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
(priv->adapter->pps_uapsd_mode)) {
if (MTRUE == wlan_check_last_packet_indication(priv)) {
priv->adapter->tx_lock_flag = MTRUE;
ptx_pd->flags |= MRVDRV_TxPD_POWER_MGMT_LAST_PACKET;
}
}
#endif /* STA_SUPPORT */
LEAVE();
}
/**
* @brief Get number of aggregated packets
*
* @param data A pointer to packet data
* @param total_pkt_len Total packet length
*
* @return Number of packets
*/
static int
wlan_11n_get_num_aggrpkts(t_u8 *data, int total_pkt_len)
{
int pkt_count = 0, pkt_len, pad;
t_u8 hdr_len = sizeof(Eth803Hdr_t);
ENTER();
while (total_pkt_len >= hdr_len) {
/* Length will be in network format, change it to host */
pkt_len = mlan_ntohs((*(t_u16 *)(data + (2 *
MLAN_MAC_ADDR_LENGTH))));
if (pkt_len > total_pkt_len) {
PRINTM(MERROR, "Error in packet length.\n");
break;
}
pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ?
(4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : 0;
data += pkt_len + pad + sizeof(Eth803Hdr_t);
total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t);
++pkt_count;
}
LEAVE();
return pkt_count;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief Deaggregate the received AMSDU packet
*
* @param priv A pointer to mlan_private structure
* @param pmbuf A pointer to aggregated data packet
*
* @return MLAN_STATUS_SUCCESS --success, otherwise fail
*/
mlan_status
wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf)
{
t_u16 pkt_len;
int total_pkt_len;
t_u8 *data;
mlan_adapter *pmadapter = priv->adapter;
t_u32 max_rx_data_size = MLAN_RX_DATA_BUF_SIZE;
int pad;
mlan_status ret = MLAN_STATUS_FAILURE;
RxPacketHdr_t *prx_pkt;
mlan_buffer *daggr_mbuf = MNULL;
t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = { 0xaa, 0xaa, 0x03,
0x00, 0x00, 0x00
};
t_u8 hdr_len = sizeof(Eth803Hdr_t);
t_u8 eapol_type[2] = { 0x88, 0x8e };
t_u8 tdls_action_type[2] = { 0x89, 0x0d };
ENTER();
data = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset);
total_pkt_len = pmbuf->data_len;
/* Sanity test */
if (total_pkt_len > max_rx_data_size) {
PRINTM(MERROR, "Total packet length greater than tx buffer"
" size %d\n", total_pkt_len);
goto done;
}
pmbuf->use_count = wlan_11n_get_num_aggrpkts(data, total_pkt_len);
while (total_pkt_len >= hdr_len) {
prx_pkt = (RxPacketHdr_t *)data;
/* Length will be in network format, change it to host */
pkt_len = mlan_ntohs((*(t_u16 *)(data + (2 *
MLAN_MAC_ADDR_LENGTH))));
if (pkt_len > total_pkt_len) {
PRINTM(MERROR,
"Error in packet length: total_pkt_len = %d, pkt_len = %d\n",
total_pkt_len, pkt_len);
ret = MLAN_STATUS_FAILURE;
break;
}
pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ?
(4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) : 0;
total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t);
if (memcmp(pmadapter, &prx_pkt->rfc1042_hdr,
rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) {
memmove(pmadapter, data + LLC_SNAP_LEN, data, (2 *
MLAN_MAC_ADDR_LENGTH));
data += LLC_SNAP_LEN;
pkt_len += sizeof(Eth803Hdr_t) - LLC_SNAP_LEN;
} else {
*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH))
= (t_u16)0;
pkt_len += sizeof(Eth803Hdr_t);
}
daggr_mbuf =
wlan_alloc_mlan_buffer(pmadapter,
pkt_len + MLAN_NET_IP_ALIGN, 0,
MOAL_ALLOC_MLAN_BUFFER);
if (daggr_mbuf == MNULL) {
PRINTM(MERROR, "Error allocating daggr mlan_buffer\n");
ret = MLAN_STATUS_FAILURE;
break;
}
daggr_mbuf->data_offset += MLAN_NET_IP_ALIGN;
daggr_mbuf->bss_index = pmbuf->bss_index;
daggr_mbuf->buf_type = pmbuf->buf_type;
daggr_mbuf->data_len = pkt_len;
daggr_mbuf->in_ts_sec = pmbuf->in_ts_sec;
daggr_mbuf->in_ts_usec = pmbuf->in_ts_usec;
daggr_mbuf->pparent = pmbuf;
daggr_mbuf->priority = pmbuf->priority;
memcpy(pmadapter, daggr_mbuf->pbuf + daggr_mbuf->data_offset,
data, pkt_len);
#ifdef UAP_SUPPORT
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
ret = wlan_uap_recv_packet(priv, daggr_mbuf);
} else {
#endif /* UAP_SUPPORT */
/** send EAPOL from AMSDU pkt to firmware */
if (priv->sec_info.ewpa_enabled &&
(!memcmp
(pmadapter,
daggr_mbuf->pbuf + daggr_mbuf->data_offset +
MLAN_ETHER_PKT_TYPE_OFFSET, eapol_type,
sizeof(eapol_type)))) {
ret = wlan_prepare_cmd(priv,
HostCmd_CMD_802_11_EAPOL_PKT,
0, 0, MNULL, daggr_mbuf);
if (ret == MLAN_STATUS_SUCCESS)
wlan_recv_event(priv,
MLAN_EVENT_ID_DRV_DEFER_HANDLING,
MNULL);
wlan_free_mlan_buffer(pmadapter, daggr_mbuf);
data += pkt_len + pad;
continue;
}
/**process tdls packet*/
if (!memcmp
(pmadapter,
daggr_mbuf->pbuf + daggr_mbuf->data_offset +
MLAN_ETHER_PKT_TYPE_OFFSET, tdls_action_type,
sizeof(tdls_action_type))) {
PRINTM(MEVENT,
"Recevie AMSDU TDLS action frame\n");
wlan_process_tdls_action_frame(priv,
daggr_mbuf->
pbuf +
daggr_mbuf->
data_offset,
daggr_mbuf->
data_len);
}
ret = pmadapter->callbacks.moal_recv_packet(pmadapter->
pmoal_handle,
daggr_mbuf);
#ifdef UAP_SUPPORT
}
#endif /* UAP_SUPPORT */
switch (ret) {
case MLAN_STATUS_PENDING:
break;
case MLAN_STATUS_FAILURE:
PRINTM(MERROR, "Deaggr, send to moal failed\n");
daggr_mbuf->status_code = MLAN_ERROR_PKT_INVALID;
case MLAN_STATUS_SUCCESS:
wlan_recv_packet_complete(pmadapter, daggr_mbuf, ret);
break;
default:
break;
}
data += pkt_len + pad;
}
done:
priv->msdu_in_rx_amsdu_cnt += pmbuf->use_count;
priv->amsdu_rx_cnt++;
/** we should free the aggr buffer after deaggr */
wlan_free_mlan_buffer(pmadapter, pmbuf);
LEAVE();
return ret;
}
/**
* @brief Aggregate multiple packets into one single AMSDU packet
*
* @param priv A pointer to mlan_private structure
* @param pra_list Pointer to the RA List table containing the pointers
* to packets.
* @param headroom Any interface specific headroom that may be need. TxPD
* will be formed leaving this headroom.
* @param ptrindex Pointer index
*
* @return Final packet size or MLAN_STATUS_FAILURE
*/
int
wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list,
int headroom, int ptrindex)
{
int pkt_size = 0;
pmlan_adapter pmadapter = priv->adapter;
mlan_buffer *pmbuf_aggr, *pmbuf_src;
t_u8 *data;
int pad = 0;
mlan_status ret = MLAN_STATUS_SUCCESS;
#ifdef DEBUG_LEVEL1
t_u32 sec = 0, usec = 0;
#endif
mlan_tx_param tx_param;
#ifdef STA_SUPPORT
TxPD *ptx_pd = MNULL;
#endif
t_u32 max_amsdu_size = MIN(pra_list->max_amsdu, pmadapter->tx_buf_size);
ENTER();
PRINTM(MDAT_D, "Handling Aggr packet\n");
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);
if (!pmbuf_aggr) {
PRINTM(MERROR, "Error allocating mlan_buffer\n");
pmadapter->callbacks.moal_spin_unlock(pmadapter->
pmoal_handle,
priv->wmm.
ra_list_spinlock);
LEAVE();
return MLAN_STATUS_FAILURE;
}
data = pmbuf_aggr->pbuf + headroom;
pmbuf_aggr->bss_index = pmbuf_src->bss_index;
pmbuf_aggr->buf_type = pmbuf_src->buf_type;
pmbuf_aggr->priority = pmbuf_src->priority;
pmbuf_aggr->pbuf = data;
pmbuf_aggr->data_offset = 0;
pmbuf_aggr->in_ts_sec = pmbuf_src->in_ts_sec;
pmbuf_aggr->in_ts_usec = pmbuf_src->in_ts_usec;
if (pmbuf_src->flags & MLAN_BUF_FLAG_TDLS)
pmbuf_aggr->flags |= MLAN_BUF_FLAG_TDLS;
if (pmbuf_src->flags & MLAN_BUF_FLAG_TCP_ACK)
pmbuf_aggr->flags |= MLAN_BUF_FLAG_TCP_ACK;
/* Form AMSDU */
wlan_11n_form_amsdu_txpd(priv, pmbuf_aggr);
pkt_size = sizeof(TxPD);
#ifdef STA_SUPPORT
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA)
ptx_pd = (TxPD *)pmbuf_aggr->pbuf;
#endif
priv->msdu_in_tx_amsdu_cnt++;
} else {
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
priv->wmm.
ra_list_spinlock);
goto exit;
}
while (pmbuf_src && ((pkt_size + (pmbuf_src->data_len + LLC_SNAP_LEN)
+ headroom) <= max_amsdu_size)) {
pmbuf_src = (pmlan_buffer)
util_dequeue_list(pmadapter->pmoal_handle,
&pra_list->buf_head, MNULL, MNULL);
pra_list->total_pkts--;
/* decrement for every PDU taken from the list */
priv->wmm.pkts_queued[ptrindex]--;
util_scalar_decrement(pmadapter->pmoal_handle,
&priv->wmm.tx_pkts_queued, MNULL, MNULL);
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
priv->wmm.
ra_list_spinlock);
if (pmbuf_src) {
pkt_size += wlan_11n_form_amsdu_pkt(pmadapter,
(data + pkt_size),
pmbuf_src->pbuf +
pmbuf_src->
data_offset,
pmbuf_src->data_len,
&pad);
DBG_HEXDUMP(MDAT_D, "pmbuf_src", pmbuf_src,
sizeof(mlan_buffer));
wlan_write_data_complete(pmadapter, pmbuf_src,
MLAN_STATUS_SUCCESS);
}
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
priv->wmm.ra_list_spinlock);
if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
pmadapter->callbacks.moal_spin_unlock(pmadapter->
pmoal_handle,
priv->wmm.
ra_list_spinlock);
LEAVE();
return MLAN_STATUS_FAILURE;
}
pmbuf_src =
(pmlan_buffer)util_peek_list(pmadapter->pmoal_handle,
&pra_list->buf_head, MNULL,
MNULL);
priv->msdu_in_tx_amsdu_cnt++;
}
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
priv->wmm.ra_list_spinlock);
/* Last AMSDU packet does not need padding */
pkt_size -= pad;
pmbuf_aggr->data_len = pkt_size;
wlan_11n_update_pktlen_amsdu_txpd(priv, pmbuf_aggr);
pmbuf_aggr->data_len += headroom;
pmbuf_aggr->pbuf = data - headroom;
tx_param.next_pkt_len = ((pmbuf_src) ?
pmbuf_src->data_len + sizeof(TxPD) : 0);
ret = wlan_pcie_host_to_card(pmadapter, MLAN_TYPE_DATA,
pmbuf_aggr, &tx_param);
switch (ret) {
case MLAN_STATUS_RESOURCE:
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
priv->wmm.ra_list_spinlock);
if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
pmadapter->callbacks.moal_spin_unlock(pmadapter->
pmoal_handle,
priv->wmm.
ra_list_spinlock);
pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID;
wlan_write_data_complete(pmadapter, pmbuf_aggr,
MLAN_STATUS_FAILURE);
LEAVE();
return MLAN_STATUS_FAILURE;
}
#ifdef STA_SUPPORT
/* reset tx_lock_flag */
if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
pmadapter->pps_uapsd_mode &&
(pmadapter->tx_lock_flag == MTRUE)) {
pmadapter->tx_lock_flag = MFALSE;
ptx_pd->flags = 0;
}
#endif
util_enqueue_list_head(pmadapter->pmoal_handle,
&pra_list->buf_head,
(pmlan_linked_list)pmbuf_aggr, MNULL,
MNULL);
pra_list->total_pkts++;
/* add back only one: aggregated packet is requeued as one */
priv->wmm.pkts_queued[ptrindex]++;
util_scalar_increment(pmadapter->pmoal_handle,
&priv->wmm.tx_pkts_queued, MNULL, MNULL);
pmbuf_aggr->flags |= MLAN_BUF_FLAG_REQUEUED_PKT;
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
priv->wmm.
ra_list_spinlock);
PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n");
pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID;
break;
case MLAN_STATUS_FAILURE:
PRINTM(MERROR, "Error: host_to_card failed: 0x%X\n", ret);
pmbuf_aggr->status_code = MLAN_ERROR_DATA_TX_FAIL;
pmadapter->dbg.num_tx_host_to_card_failure++;
wlan_write_data_complete(pmadapter, pmbuf_aggr, ret);
goto exit;
case MLAN_STATUS_PENDING:
break;
case MLAN_STATUS_SUCCESS:
wlan_write_data_complete(pmadapter, pmbuf_aggr, ret);
break;
default:
break;
}
if (ret != MLAN_STATUS_RESOURCE) {
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
priv->wmm.ra_list_spinlock);
if (wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
priv->wmm.packets_out[ptrindex]++;
priv->wmm.tid_tbl_ptr[ptrindex].ra_list_curr = pra_list;
}
pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur =
pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur->
pnext;
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
priv->wmm.
ra_list_spinlock);
}
PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
PRINTM_NETINTF(MDATA, priv);
PRINTM(MDATA, "%lu.%06lu : Data => FW\n", sec, usec);
priv->amsdu_tx_cnt++;
exit:
LEAVE();
return pkt_size + headroom;
}

View File

@ -0,0 +1,37 @@
/** @file mlan_11n_aggr.h
*
* @brief This file contains related macros, enum, and struct
* of 11n aggregation functionalities
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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/10/2008: initial version
********************************************************/
#ifndef _MLAN_11N_AGGR_H_
#define _MLAN_11N_AGGR_H_
/** Aggregate 11N packets */
mlan_status wlan_11n_deaggregate_pkt(pmlan_private priv, pmlan_buffer pmbuf);
/** Deaggregate 11N packets */
int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *ptr,
int headroom, int ptrindex);
#endif /* !_MLAN_11N_AGGR_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
/** @file mlan_11n_rxreorder.h
*
* @brief This file contains related macros, enum, and struct
* of 11n RxReordering functionalities
*
* Copyright (C) 2008-2019, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this 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/10/2008: initial version
********************************************************/
#ifndef _MLAN_11N_RXREORDER_H_
#define _MLAN_11N_RXREORDER_H_
/** Max value a TID can take = 2^12 = 4096 */
#define MAX_TID_VALUE (2 << 11)
/** 2^11 = 2048 */
#define TWOPOW11 (2 << 10)
/** Tid Mask used for extracting TID from BlockAckParamSet */
#define BLOCKACKPARAM_TID_MASK 0x3C
/** Tid position in BlockAckParamSet */
#define BLOCKACKPARAM_TID_POS 2
/** WinSize Mask used for extracting WinSize from BlockAckParamSet */
#define BLOCKACKPARAM_WINSIZE_MASK 0xffc0
/** WinSize Mask used for extracting WinSize from BlockAckParamSet */
#define BLOCKACKPARAM_AMSDU_SUPP_MASK 0x1
/** WinSize position in BlockAckParamSet */
#define BLOCKACKPARAM_WINSIZE_POS 6
/** Position of TID in DelBA Param set */
#define DELBA_TID_POS 12
/** Position of INITIATOR in DelBA Param set */
#define DELBA_INITIATOR_POS 11
/** Reason code: Requested from peer STA as it does not want to
* use the mechanism */
#define REASON_CODE_STA_DONT_WANT 37
/** Reason code: Requested from peer STA due to timeout*/
#define REASON_CODE_STA_TIMEOUT 39
/** Type: send delba command */
#define TYPE_DELBA_SENT 1
/** Type: recieve delba command */
#define TYPE_DELBA_RECEIVE 2
/** Set Initiator Bit */
#define DELBA_INITIATOR(paramset) (paramset = (paramset | (1 << 11)))
/** Reset Initiator Bit for recipient */
#define DELBA_RECIPIENT(paramset) (paramset = (paramset & ~(1 << 11)))
/** Immediate block ack */
#define IMMEDIATE_BLOCK_ACK 0x2
/** The request has been declined */
#define ADDBA_RSP_STATUS_DECLINED 37
/** ADDBA response status : Reject */
#define ADDBA_RSP_STATUS_REJECT 1
/** ADDBA response status : Accept */
#define ADDBA_RSP_STATUS_ACCEPT 0
/** DEFAULT SEQ NUM */
#define DEFAULT_SEQ_NUM 0xffff
/** Indicate packet has been dropped in FW */
#define RX_PKT_DROPPED_IN_FW 0xffffffff
t_void wlan_reset_pn_value(mlan_private *pmpriv, mlan_ds_encrypt_key *key);
t_u8 wlan_is_rsn_replay_attack(mlan_private *pmpriv, t_void *payload,
RxReorderTbl *rx_reor_tbl_ptr);
mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seqNum, t_u16 tid,
t_u8 *ta, t_u8 pkttype, void *payload);
void mlan_11n_delete_bastream_tbl(mlan_private *priv, int tid,
t_u8 *PeerMACAddr, t_u8 type, int initiator,
t_u16 reason_code);
void wlan_11n_ba_stream_timeout(mlan_private *priv,
HostCmd_DS_11N_BATIMEOUT *event);
mlan_status wlan_ret_11n_addba_resp(mlan_private *priv,
HostCmd_DS_COMMAND *resp);
mlan_status wlan_cmd_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *cmd,
void *pdata_buf);
mlan_status wlan_cmd_11n_addba_rspgen(mlan_private *priv,
HostCmd_DS_COMMAND *cmd, void *pdata_buf);
mlan_status wlan_cmd_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *cmd,
void *pdata_buf);
void wlan_11n_cleanup_reorder_tbl(mlan_private *priv);
RxReorderTbl *wlan_11n_get_rxreorder_tbl(mlan_private *priv, int tid, t_u8 *ta);
void wlan_11n_rxba_sync_event(mlan_private *priv, t_u8 *event_buf, t_u16 len);
void wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag);
void wlan_flush_rxreorder_tbl(pmlan_adapter pmadapter);
void wlan_coex_ampdu_rxwinsize(pmlan_adapter pmadapter);
/** clean up reorder_tbl */
void wlan_cleanup_reorder_tbl(mlan_private *priv, t_u8 *ta);
#endif /* _MLAN_11N_RXREORDER_H_ */

Some files were not shown because too many files have changed in this diff Show More