Initial host-common file folder cleanup and moves

Initial host-common file folder cleanup and moves
on top of baseline reference of MCL WLAN driver
SU#5.0.0.160.

Move dp, ht comm, hif, wmi and qdf folders one level up

Change-Id: I2120898024b1eafd5d651c48768dbf48bf05995d
This commit is contained in:
Prakash Dhavali
2016-03-02 00:54:45 -08:00
parent abcec8c47e
commit 142cee4bf2
549 changed files with 0 additions and 467753 deletions

View File

@@ -1,114 +0,0 @@
# Android makefile for the WLAN Module
# Assume no targets will be supported
WLAN_CHIPSET :=
ifeq ($(BOARD_HAS_QCOM_WLAN), true)
# Build/Package options for 8084/8092/8960/8992/8994 target
ifeq ($(call is-board-platform-in-list, apq8084 mpq8092 msm8960 msm8992 msm8994 msm8996 msm8998),true)
WLAN_CHIPSET := qca_cld3
WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
endif # platform
# Build/Package only in case of supported target
ifneq ($(WLAN_CHIPSET),)
LOCAL_PATH := $(call my-dir)
# This makefile is only for DLKM
ifneq ($(findstring vendor,$(LOCAL_PATH)),)
ifneq ($(findstring opensource,$(LOCAL_PATH)),)
WLAN_PROPRIETARY := 0
WLAN_BLD_DIR := vendor/qcom/opensource/wlan
else
WLAN_PROPRIETARY := 1
WLAN_BLD_DIR := vendor/qcom/proprietary/wlan-noship
endif # opensource
# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
ifeq ($(call is-platform-sdk-version-at-least,16),true)
DLKM_DIR := $(TOP)/device/qcom/common/dlkm
else
DLKM_DIR := build/dlkm
endif # platform-sdk-version
# Copy WCNSS_cfg.dat and WCNSS_qcom_cfg.ini file from firmware_bin/ folder to target out directory.
ifeq ($(call is-board-platform-in-list, msm8960),true)
$(shell rm -f $(TARGET_OUT_ETC)/firmware/wlan/qca_cld/WCNSS_cfg.dat)
$(shell rm -f $(TARGET_OUT_ETC)/firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini)
$(shell cp $(LOCAL_PATH)/firmware_bin/WCNSS_cfg.dat $(TARGET_OUT_ETC)/firmware/wlan/qca_cld)
$(shell cp $(LOCAL_PATH)/firmware_bin/WCNSS_qcom_cfg.ini $(TARGET_OUT_ETC)/firmware/wlan/qca_cld)
endif
# Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
###########################################################
# This is set once per LOCAL_PATH, not per (kernel) module
ifeq ($(WLAN_PROPRIETARY),1)
KBUILD_OPTIONS := WLAN_ROOT=../$(WLAN_BLD_DIR)/qcacld-new
else
KBUILD_OPTIONS := WLAN_ROOT=../$(WLAN_BLD_DIR)/qcacld-3.0
endif # WLAN_PROPRIETARY
# We are actually building wlan.ko here, as per the
# requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
# This means we need to rename the module to <chipset>_wlan.ko
# after wlan.ko is built.
KBUILD_OPTIONS += MODNAME=wlan
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(WLAN_SELECT)
include $(CLEAR_VARS)
ifeq ($(WLAN_PROPRIETARY),1)
LOCAL_MODULE := proprietary_$(WLAN_CHIPSET)_wlan.ko
else
LOCAL_MODULE := $(WLAN_CHIPSET)_wlan.ko
endif # WLAN_PROPRIETARY
LOCAL_MODULE_KBUILD_NAME := wlan.ko
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
# Create Symbolic link
ifeq ($(WLAN_PROPRIETARY),1)
$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) \
$(TARGET_OUT)/lib/modules/wlan.ko)
endif
$(shell ln -sf /persist/wlan_mac.bin $(TARGET_OUT_ETC)/firmware/wlan/qca_cld/wlan_mac.bin)
ifeq ($(call is-board-platform-in-list, msm8960),true)
$(shell ln -sf /firmware/image/bdwlan20.bin $(TARGET_OUT_ETC)/firmware/fakeboar.bin)
$(shell ln -sf /firmware/image/otp20.bin $(TARGET_OUT_ETC)/firmware/otp.bin)
$(shell ln -sf /firmware/image/utf20.bin $(TARGET_OUT_ETC)/firmware/utf.bin)
$(shell ln -sf /firmware/image/qwlan20.bin $(TARGET_OUT_ETC)/firmware/athwlan.bin)
$(shell ln -sf /firmware/image/bdwlan20.bin $(TARGET_OUT_ETC)/firmware/bdwlan20.bin)
$(shell ln -sf /firmware/image/otp20.bin $(TARGET_OUT_ETC)/firmware/otp20.bin)
$(shell ln -sf /firmware/image/utf20.bin $(TARGET_OUT_ETC)/firmware/utf20.bin)
$(shell ln -sf /firmware/image/qwlan20.bin $(TARGET_OUT_ETC)/firmware/qwlan20.bin)
$(shell ln -sf /firmware/image/bdwlan30.bin $(TARGET_OUT_ETC)/firmware/bdwlan30.bin)
$(shell ln -sf /firmware/image/otp30.bin $(TARGET_OUT_ETC)/firmware/otp30.bin)
$(shell ln -sf /firmware/image/utf30.bin $(TARGET_OUT_ETC)/firmware/utf30.bin)
$(shell ln -sf /firmware/image/qwlan30.bin $(TARGET_OUT_ETC)/firmware/qwlan30.bin)
endif
# Copy config ini files to target
#ifeq ($(call is-board-platform-in-list, msm8992 msm8994),false)
ifeq ($(WLAN_PROPRIETARY),1)
$(shell mkdir -p $(TARGET_OUT)/etc/firmware/wlan/$(WLAN_CHIPSET))
$(shell mkdir -p $(TARGET_OUT)/etc/wifi)
$(shell rm -f $(TARGET_OUT)/etc/wifi/WCNSS_qcom_cfg.ini)
$(shell rm -f $(TARGET_OUT)/etc/firmware/wlan/$(WLAN_SHIPSET)/WCNSS_cfg.dat)
$(shell cp $(LOCAL_PATH)/config/WCNSS_qcom_cfg.ini $(TARGET_OUT)/etc/wifi)
$(shell cp $(LOCAL_PATH)/firmware_bin/WCNSS_cfg.dat $(TARGET_OUT)/etc/firmware/wlan/$(WLAN_CHIPSET))
endif
#endif
endif # DLKM check
endif # supported target check
endif # WLAN enabled check

1345
Kbuild

File diff suppressed because it is too large Load Diff

114
Kconfig
View File

@@ -1,114 +0,0 @@
comment "Qualcomm Atheros CLD WLAN module"
config QCA_CLD_WLAN
tristate "Qualcomm Atheros CLD WLAN module"
default n
help
Add support for the Qualcomm Atheros CLD WLAN module
if QCA_CLD_WLAN != n
config QCACLD_WLAN_LFR3
bool "Enable the WLAN Legacy Fast Roaming feature Version 3"
default n
config PRIMA_WLAN_OKC
bool "Enable the Prima WLAN Opportunistic Key Caching feature"
default n
config PRIMA_WLAN_11AC_HIGH_TP
bool "Enable the Prima WLAN 802.11ac High Throughput option (depends upon kernel support)"
default n
config WLAN_FEATURE_11W
bool "Enable the WLAN 802.11w Protected Management Frames feature"
default n
config WLAN_FEATURE_LPSS
bool "Enable the WLAN LPSS feature"
default n
config QCOM_VOWIFI_11R
bool "Enable Fast Transition (11r) feature"
default n
config QCACLD_FEATURE_NAN
bool "Enable NAN feature"
default n
config QCACLD_FEATURE_GREEN_AP
bool "Enable Green AP feature"
default n
config HELIUMPLUS
bool "Enable Beeliner based descriptor structures for Helium"
default n
config 64BIT_PADDR
bool "Enable 37-bit physical/bus addresses"
depends on HELIUMPLUS
default n
config QCOM_TDLS
bool "Enable TDLS feature"
default n
config QCOM_LTE_COEX
bool "Enable QCOM LTE Coex feature"
default n
config MPC_UT_FRAMEWORK
bool "Enable Unit test framework for multiport concurrency"
default n
config WLAN_OFFLOAD_PACKETS
bool "Enable offload packets feature"
default n
config WLAN_FEATURE_MEMDUMP
bool "Enable MEMDUMP feature"
default n
config FEATURE_TSO
bool "Enable TCP Segmentation Offload"
depends on HELIUMPLUS
default n
config FEATURE_TSO_DEBUG
bool "Enable TCP Segmentation Offload with debug"
depends on FEATURE_TSO
default n
config WLAN_FASTPATH
bool "Enable fastpath for datapackets"
default n
config WLAN_NAPI
bool "Enable NAPI - datapath rx"
default n
config WLAN_NAPI_DEBUG
bool "Enable debug logging on NAPI"
depends on WLAN_NAPI
default n
config WLAN_TX_FLOW_CONTROL_V2
bool "Enable tx flow control version:2"
default n
config WLAN_LRO
bool "Enable Large Receive Offload"
depends on HELIUMPLUS
depends on CONFIG_INET_LRO
default n
config WLAN_FEATURE_RX_WAKELOCK
bool "Enable RX wake lock feature"
default n
config FEATURE_LFR_SUBNET_DETECTION
bool "Enable LFR Subnet Change Detection"
default n
endif # QCA_CLD_WLAN

View File

@@ -1,20 +0,0 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
KBUILD_OPTIONS := WLAN_ROOT=$(PWD)
KBUILD_OPTIONS += MODNAME=wlan
#By default build for CLD
WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0
KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1
KBUILD_OPTIONS += $(WLAN_SELECT)
KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any
all:
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean

View File

@@ -1,594 +0,0 @@
# This file allows user to override the factory
# defaults for the WLAN Driver
# Enable IMPS or not
gEnableImps=1
# Enable/Disable Idle Scan
gEnableIdleScan=0
# Increase sleep duration (seconds) during IMPS
# 0 implies no periodic wake up from IMPS. Periodic wakeup is
# unnecessary if Idle Scan is disabled.
gImpsModSleepTime=0
# Enable BMPS or not
gEnableBmps=1
# Enable suspend or not
# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter
gEnableSuspend=3
# Phy Mode (auto, b, g, n, etc)
# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac
# 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only
# 7 = 11b only 8 = 11ac only.
gDot11Mode=0
# CSR Roaming Enable(1) Disable(0)
gRoamingTime=0
# Assigned MAC Addresses - This will be used until NV items are in place
# Each byte of MAC address is represented in Hex format as XX
Intf0MacAddress=000AF58989FF
Intf1MacAddress=000AF58989FE
Intf2MacAddress=000AF58989FD
Intf3MacAddress=000AF58989FC
# UAPSD service interval for VO,VI, BE, BK traffic
InfraUapsdVoSrvIntv=0
InfraUapsdViSrvIntv=0
InfraUapsdBeSrvIntv=0
InfraUapsdBkSrvIntv=0
# Flag to allow STA send AddTspec even when ACM is Off
gAddTSWhenACMIsOff=1
# Make 1x1 the default antenna configuration
gNumRxAnt=1
# Beacon filtering frequency (unit in beacon intervals)
gNthBeaconFilter=50
# Enable WAPI or not
# WAPIIsEnabled=0
# Flags to filter Mcast abd Bcast RX packets.
# Value 0: No filtering, 1: Filter all Multicast.
# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast
McastBcastFilter=3
#Flag to enable HostARPOffload feature or not
hostArpOffload=1
#Flag to enable HostNSOffload feature or not
hostNSOffload=1
# This flag enables IP, TCP and UDP checksum offload
gEnableIpTcpUdpChecksumOffload=1
#SoftAP Related Parameters
# AP MAc addr
gAPMacAddr=000AF589dcab
# 802.11n Protection flag
gEnableApProt=1
#Enable OBSS protection
gEnableApOBSSProt=1
#Enable/Disable UAPSD for SoftAP
gEnableApUapsd=1
# Fixed Rate
gFixedRate=0
# Maximum Tx power
# gTxPowerCap=30
# Fragmentation Threshold
# gFragmentationThreshold=2346
# RTS threshold
RTSThreshold=1048576
# Intra-BSS forward
gDisableIntraBssFwd=0
# WMM Enable/Disable
WmmIsEnabled=0
# 802.11d support
g11dSupportEnabled=1
# 802.11h support
g11hSupportEnabled=1
# DFS Master Capability
gEnableDFSMasterCap=1
# ESE Support and fast transition
EseEnabled=1
ImplicitQosIsEnabled=0
gNeighborScanTimerPeriod=200
gNeighborLookupThreshold=76
gNeighborReassocThreshold=81
gNeighborScanChannelMinTime=20
gNeighborScanChannelMaxTime=30
gMaxNeighborReqTries=3
# Legacy (non-ESE, non-802.11r) Fast Roaming Support
# To enable, set FastRoamEnabled=1
# To disable, set FastRoamEnabled=0
FastRoamEnabled=1
#Check if the AP to which we are roaming is better than current AP in terms of RSSI.
#Checking is disabled if set to Zero.Otherwise it will use this value as to how better
#the RSSI of the new/roamable AP should be for roaming
RoamRssiDiff=3
# If the RSSI of any available candidate is better than currently associated
# AP by at least gImmediateRoamRssiDiff, then being to roam immediately (without
# registering for reassoc threshold).
# NOTE: Value of 0 means that we would register for reassoc threshold.
gImmediateRoamRssiDiff=10
# To enable, set gRoamIntraBand=1 (Roaming within band)
# To disable, set gRoamIntraBand=0 (Roaming across band)
gRoamIntraBand=0
#Short Guard Interval Enable/disable
gShortGI20Mhz=1
gShortGI40Mhz=1
#Auto Shutdown Value in seconds. A value of 0 means Auto shutoff is disabled
gAPAutoShutOff=0
#Auto Shutdown wlan : Value in Seconds. 0 means disabled. Max 1 day = 86400 sec
gWlanAutoShutdown = 0
# Not used.
gApAutoChannelSelection=0
# Listen Energy Detect Mode Configuration
# Valid values 0-128
# 128 means disable Energy Detect feature
# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled.
# 10-128 are reserved.
# The EDET threshold mapping is as follows in 3dB step:
# 0 = -60 dBm
# 1 = -63 dBm
# 2 = -66 dBm
# ...
# 7 = -81 dBm
# 8 = -84 dBm
# 9 = -87 dBm
# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as:
#
# Range Loss (dB) = EDET threshold level (dBm) + 97 dBm.
#
gEnablePhyAgcListenMode=128
#Preferred band (both or 2.4 only or 5 only)
BandCapability=0
#Beacon Early Termination (1 = enable the BET feature, 0 = disable)
enableBeaconEarlyTermination=0
beaconEarlyTerminationWakeInterval=3
#Channel Bonding
gChannelBondingMode5GHz=1
#Enable Keep alive with non-zero period value
gStaKeepAlivePeriod = 30
#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds).
#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.)
#For both active and power save clients.
#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit.
#If doesn't honor for 5 seconds then DUT remove client.
#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on
#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames.
#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod)..
#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period
#where we send NULL frame.
#gApLinkMonitorPeriod = 10
#gGoLinkMonitorPeriod = 10
#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not.
#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod.
gGoKeepAlivePeriod = 20
gApKeepAlivePeriod = 20
#If set will start with active scan after driver load, otherwise will start with
#passive scan to find out the domain
gEnableBypass11d=1
#If set to 0, will not scan DFS channels
gEnableDFSChnlScan=1
# Enable DFS channel roam
# 0: DISABLE, 1: ENABLED_NORMAL, 2: ENABLED_ACTIVE
gAllowDFSChannelRoam=1
gVhtChannelWidth=2
# Enable Automatic Tx Power control
gEnableAutomaticTxPowerControl=1
# 0 for OLPC 1 for CLPC and SCPC
gEnableCloseLoop=1
#Data Inactivity Timeout when in powersave (in ms)
gDataInactivityTimeout=200
# VHT Tx/Rx MCS values
# Valid values are 0,1,2. If commented out, the default value is 0.
# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
gVhtRxMCS=2
gVhtTxMCS=2
# VHT Tx/Rx MCS values for 2x2
# Valid values are 0,1,2. If commented out, the default value is 0.
# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
gEnable2x2=1
gVhtRxMCS2x2=2
gVhtTxMCS2x2=2
# Set txchainmask and rxchainmask
# These parameters are used only if gEnable2x2 is 0
# Valid values are 1,2
# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0.
# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1.
gSetTxChainmask1x1=1
gSetRxChainmask1x1=1
# Scan Timing Parameters
# gPassiveMaxChannelTime=110
# gPassiveMinChannelTime=60
gActiveMaxChannelTime=40
gActiveMinChannelTime=20
#If set to 0, MCC is not allowed.
gEnableMCCMode=1
# MCC to SCC Switch mode: 0-Disable 1-Enable 2-Force SCC if same band
gWlanMccToSccSwitchMode = 0
# 1=enable STBC; 0=disable STBC
gEnableRXSTBC=1
# 1=enable tx STBC; 0=disable
gEnableTXSTBC=1
# 1=enable rx LDPC; 0=disable
gEnableRXLDPC=1
#Enable/Disable Tx beamforming
gTxBFEnable=1
#Enable/Disable Tx beamformee in SAP mode
gEnableTxBFeeSAP=1
# Enable Tx beamforming in VHT20MHz
# Valid values are 0,1. If commented out, the default value is 0.
# 0=disable, 1=enable
gEnableTxBFin20MHz=1
#Enable/Disable SU Tx beamformer support.
gEnableTxSUBeamformer=1
#Enable Scan Results Aging based on timer
#Timer value is in seconds
#If Set to 0 it will not enable the feature
gScanAgingTime=30
#Enable Scan Results Aging based on number of scans
gScanResultAgeCount=1
#Enable Power saving mechanism Based on Android Framework
#If set to 0 Driver internally control the Power saving mechanism
#If set to 1 Android Framwrok control the Power saving mechanism
isAndroidPsEn=0
#Enable thermal mitigation
gThermalMitigationEnable=0
gEnableFastRoamInConcurrency=1
#Maxium Channel time in msec
gMaxMediumTime = 6000
# 802.11K support
gRrmEnable=1
gRrmOperChanMax=8
gRrmNonOperChanMax=8
gRrmRandIntvl=100
#Scan offload
gEnableDirectedScanOffload=1
#FlexConnect Power Factor
#Default is set to 0 (disable)
gFlexConnectPowerFactor=0
#Disable split scan, the FW will take care of it
gNumChanCombinedConc=60
#Enable Power Save offload
gEnablePowerSaveOffload=2
#Enable firmware uart print
gEnablefwprint=0
#IPA config
gIPAConfig=0
gIPADescSize=800
gIPAPreFilterEnable=1
gIPARMEnable=1
gIPAIPv6Enable=1
IpaUcOffloadEnabled=0
gIpaUcStaOffload=0
#P2P Listen offload
gEnableP2pListenOffload=1
# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k)
gVhtAmpduLenExponent=7
# Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets)
gVhtMpduLen=2
# Maximum number of wow filters required
#gMaxWoWFilters=22
# WOW Enable/Disable.
# 0 - Disable both magic pattern match and pattern byte match.
# 1 - Enable magic pattern match on all interfaces.
# 2 - Enable pattern byte match on all interfaces.
# 3 - Enable both magic patter and pattern byte match on all interfaces.
# Default value of gEnableWoW is 3.
# gEnableWoW=0
# Enable or Disable MCC Adaptive Scheduler at the FW
# 1=Enable (default), 0=Disable
gEnableMCCAdaptiveScheduler=1
#Enable or Disable p2p device address administered
isP2pDeviceAddrAdministrated=0
#Enable Rx thread
gEnableRxThread=1
#Enable NAPI
gEnableNAPI=1
# Set Thermal Power limit
TxPower2g=10
TxPower5g=10
# Remove Overlap channel restriction
gEnableOverLapCh=0
#Enable VHT on 2.4Ghz
gEnableVhtFor24GHzBand=1
#Enable or Disable 5G early beacon termination
gEnable5gEBT=1
#Maximum number of offload peers supported
# gMaxOffloadPeers=2
# controlling the following offload patterns
# through ini parameter. Default value is 1
# to disable set it to zero. ssdp = 0
# Setup multicast pattern for mDNS 224.0.0.251,
# SSDP 239.255.255.250 and LLMNR 224.0.0.252
ssdp = 0
#Enable Memory Deep Sleep
gEnableMemDeepSleep=1
# Bus bandwidth threshold values in terms of number of packets
gBusBandwidthHighThreshold=2000
gBusBandwidthMediumThreshold=500
gBusBandwidthLowThreshold=150
# Bus bandwidth compute timeout value in ms
gBusBandwidthComputeInterval=100
# Regulatory Setting; 0=STRICT; 1=CUSTOM
gRegulatoryChangeCountry=1
# RA filtering rate limit param, the current value would not
# help if the lifetime in RA is less than 3*60=3min. Then
# we need to change it, though it is uncommon.
# gRAFilterEnable=0
gRArateLimitInterval=600
# Maximum number of concurrent connections
gMaxConcurrentActiveSessions=2
# Disable/Enable GreenAP
# 0 to disable, 1 to enable, default: 1
gEnableGreenAp=1
# Radar PRI multiplier
gDFSradarMappingPriMultiplier=4
gPNOScanSupport=1
# Enable/Disable RX full reorder offload
gReorderOffloadSupported=1
#Enable/Disable LPASS support
# 0 to disable, 1 to enable
gEnableLpassSupport=0
# Whether userspace country code setting shld have priority
gCountryCodePriority=1
# Enable(1)/Disable(0) SIFS burst
gEnableSifsBurst=1
# Enable or Disable Multi-user MIMO
# 1=Enable (default), 0=Disable
gEnableMuBformee=1
# Enable/Disable channel avoidance for SAP in SCC scenario
# 0 - disable
# 1 - enable
gSapSccChanAvoidance=0
# Inactivity time (in ms) to end TX Service Period while in IBSS power save mode
gIbssTxSpEndInactivityTime=10
# Enable/Disable Roaming Offload Support (a.k.a Key Management Offload)
# 0 to disable, 1 to enable
gRoamOffloadEnabled=0
# Enable support for TDLS
# 0 - disable
# 1 - enable
gEnableTDLSSupport=1
# Enable support for Implicit Trigger of TDLS. That is, wlan driver shall
# initiate TDLS Discovery towards a peer whenever setup criteria (throughput
# and RSSI) is met and then will initiate teardown when teardown criteria
# (idle packet count and RSSI) is met.
# 0 - disable
# 1 - enable
gEnableTDLSImplicitTrigger=1
# Enable TDLS External Control. That is, user space application has to
# first configure a peer MAC in wlan driver towards which TDLS is desired.
# Device will establish TDLS only towards those configured peers whenever
# TDLS criteria (throughput and RSSI threshold) is met and teardown TDLS
# when teardown criteria (idle packet count and RSSI) is met. However,
# device will accept TDLS connection if it is initiated from any other peer,
# even if that peer is not configured.
# 0 - disable
# 1 - enable
# For TDLS External Control, Implicit Trigger must also be enabled.
gTDLSExternalControl=1
# Enable support for TDLS off-channel operation
# 0 - disable
# 1 - enable
# TDLS off-channel operation will be invoked when there is only one
# TDLS connection.
gEnableTDLSOffChannel=1
# Enable or Disable Random MAC (Spoofing)
# 1=Enable, 0=Disable (default)
gEnableMacAddrSpoof=0
# Enable(Tx) fastpath for data traffic.
# 0 - disable
# 1 - enable
gEnableFastPath=1
END
# Note: Configuration parser would not read anything past the END marker

View File

@@ -1,60 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* ================================================================ */
/* BMI declarations and prototypes */
/* */
/* ================================================================= */
#ifndef _BMI_H_
#define _BMI_H_
#include "bmi_msg.h"
#include "cdf_trace.h"
#include "ol_if_athvar.h"
#include "hif.h"
#ifdef HIF_PCI
void bmi_cleanup(struct ol_softc *scn);
CDF_STATUS bmi_done(struct ol_softc *scn);
CDF_STATUS bmi_download_firmware(struct ol_softc *scn);
#else
static inline void bmi_cleanup(struct ol_softc *scn)
{
return;
}
static inline CDF_STATUS bmi_done(struct ol_softc *scn)
{
return CDF_STATUS_SUCCESS;
}
static inline CDF_STATUS bmi_download_firmware(struct ol_softc *scn)
{
return CDF_STATUS_SUCCESS;
}
#endif
#endif /* _BMI_H_ */

View File

@@ -1,64 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _OL_FW_H_
#define _OL_FW_H_
#ifdef QCA_WIFI_FTM
#include "cdf_types.h"
#endif
#include "hif.h"
#define AR6004_VERSION_REV1_3 0x31c8088a
#define AR9888_REV2_VERSION 0x4100016c
#define AR6320_REV1_VERSION 0x5000000
#define AR6320_REV1_1_VERSION 0x5000001
#define AR6320_REV1_VERSION_1 AR6320_REV1_1_VERSION
#define AR6320_REV1_3_VERSION 0x5000003
#define AR6320_REV2_VERSION AR6320_REV1_1_VERSION
#define AR6320_REV2_1_VERSION 0x5010000
#define AR6320_REV3_VERSION 0x5020000
#define AR6320_REV3_2_VERSION 0x5030000
#define AR6320_REV4_VERSION AR6320_REV2_1_VERSION
#define AR6320_DEV_VERSION 0x1000000
#ifdef HIF_PCI
void ol_target_failure(void *instance, CDF_STATUS status);
uint8_t ol_get_number_of_peers_supported(struct ol_softc *scn);
#else
static inline void ol_target_failure(void *instance, CDF_STATUS status)
{
return;
}
static inline uint8_t ol_get_number_of_peers_supported(struct ol_softc *scn)
{
return 1;
}
#endif
#endif /* _OL_FW_H_ */

View File

@@ -1,87 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/*
* Defintions for the Atheros Wireless LAN controller driver.
*/
#ifndef _DEV_OL_ATH_ATHVAR_H
#define _DEV_OL_ATH_ATHVAR_H
#include <osapi_linux.h>
#include "cdf_types.h"
#include "cdf_lock.h"
#include "wmi_unified_api.h"
#include "htc_api.h"
#include "bmi_msg.h"
#include "ol_txrx_api.h"
#include "ol_txrx_ctrl_api.h"
#include "ol_txrx_osif_api.h"
#include "ol_params.h"
#include <wdi_event_api.h>
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "ol_ctrl_addba_api.h"
typedef void *hif_handle_t;
struct ol_version {
uint32_t host_ver;
uint32_t target_ver;
uint32_t wlan_ver;
uint32_t wlan_ver_1;
uint32_t abi_ver;
};
typedef enum _ol_target_status {
OL_TRGET_STATUS_CONNECTED = 0, /* target connected */
OL_TRGET_STATUS_RESET, /* target got reset */
OL_TRGET_STATUS_EJECT, /* target got ejected */
OL_TRGET_STATUS_SUSPEND /*target got suspend */
} ol_target_status;
enum ol_ath_tx_ecodes {
TX_IN_PKT_INCR = 0,
TX_OUT_HDR_COMPL,
TX_OUT_PKT_COMPL,
PKT_ENCAP_FAIL,
TX_PKT_BAD,
RX_RCV_MSG_RX_IND,
RX_RCV_MSG_PEER_MAP,
RX_RCV_MSG_TYPE_TEST
};
/*
* structure to hold the packet error count for CE and hif layer
*/
struct ol_ath_stats {
int hif_pipe_no_resrc_count;
int ce_ring_delta_fail_count;
};
#endif /* _DEV_OL_ATH_ATHVAR_H */

View File

@@ -1,469 +0,0 @@
/*
* copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#include "i_bmi.h"
/* APIs visible to the driver */
/* BMI_1 refers QCA6174 target; the ADDR is AXI addr */
#define BMI_1_TEST_ADDR (0xa0000)
/* BMI_2 ; */
#define BMI_2_TEST_ADDR (0x6E0000)
/* Enable BMI_TEST COMMANDs; The Value 0x09 is randomly choosen */
#define BMI_TEST_ENABLE (0x09)
static CDF_STATUS
bmi_command_test(uint32_t command, uint32_t address, uint8_t *data,
uint32_t length, struct ol_softc *scn)
{
switch (command) {
case BMI_NO_COMMAND:
return bmi_no_command(scn);
case BMI_WRITE_MEMORY:
return bmi_write_memory(address, data, length, scn);
case BMI_READ_MEMORY:
return bmi_read_memory(address, data, length, scn);
case BMI_EXECUTE:
return bmi_execute(address, (uint32_t *)data, scn);
default:
break;
}
return CDF_STATUS_SUCCESS;
}
CDF_STATUS bmi_init(struct ol_softc *scn)
{
if (!scn) {
BMI_ERR("Invalid scn Context");
bmi_assert(0);
return CDF_STATUS_NOT_INITIALIZED;
}
scn->bmi_done = false;
if (!scn->bmi_cmd_buff) {
scn->bmi_cmd_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
MAX_BMI_CMDBUF_SZ, &scn->bmi_cmd_da, 0);
if (!scn->bmi_cmd_buff) {
BMI_ERR("No Memory for BMI Command");
return CDF_STATUS_E_NOMEM;
}
}
if (!scn->bmi_rsp_buff) {
scn->bmi_rsp_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
MAX_BMI_CMDBUF_SZ, &scn->bmi_rsp_da, 0);
if (!scn->bmi_rsp_buff) {
BMI_ERR("No Memory for BMI Response");
goto end;
}
}
return CDF_STATUS_SUCCESS;
end:
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_cmd_buff, scn->bmi_cmd_da, 0);
scn->bmi_cmd_buff = NULL;
return CDF_STATUS_E_NOMEM;
}
void bmi_cleanup(struct ol_softc *scn)
{
if (scn->bmi_cmd_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_cmd_buff, scn->bmi_cmd_da, 0);
scn->bmi_cmd_buff = NULL;
scn->bmi_cmd_da = 0;
}
if (scn->bmi_rsp_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_rsp_buff, scn->bmi_rsp_da, 0);
scn->bmi_rsp_buff = NULL;
scn->bmi_rsp_da = 0;
}
}
CDF_STATUS bmi_done(struct ol_softc *scn)
{
CDF_STATUS status = CDF_STATUS_SUCCESS;
if (NO_BMI)
return status;
status = bmi_done_local(scn);
if (status != CDF_STATUS_SUCCESS)
BMI_ERR("BMI_DONE Failed status:%d", status);
return status;
}
CDF_STATUS
bmi_get_target_info(struct bmi_target_info *targ_info,
struct ol_softc *scn)
{
int status = 0;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
uint32_t cid, length;
if (scn->bmi_done) {
BMI_ERR("BMI Phase is Already Done");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("%s:BMI CMD/RSP Buffer is NULL", __func__);
return CDF_STATUS_NOT_INITIALIZED;
}
cid = BMI_GET_TARGET_INFO;
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(struct bmi_target_info);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
(uint8_t *)bmi_rsp_buff, &length,
BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Failed to target info: status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(targ_info, bmi_rsp_buff, length);
return CDF_STATUS_SUCCESS;
}
#ifdef FEATURE_BMI_2
static inline uint32_t bmi_get_test_addr(void)
{
return BMI_2_TEST_ADDR;
}
#else
static inline uint32_t bmi_get_test_addr(void)
{
return BMI_1_TEST_ADDR;
}
#endif
CDF_STATUS bmi_download_firmware(struct ol_softc *scn)
{
uint8_t data[10], out[10];
uint32_t address;
int32_t ret;
if (NO_BMI)
return CDF_STATUS_SUCCESS; /* no BMI for Q6 bring up */
if (!scn) {
BMI_ERR("Invalid scn context");
bmi_assert(0);
return CDF_STATUS_NOT_INITIALIZED;
}
#ifdef CONFIG_CNSS
if (BMI_TEST_ENABLE == cnss_get_bmi_setup()) {
ret = snprintf(data, 10, "ABCDEFGHI");
BMI_DBG("ret:%d writing data:%s\n", ret, data);
address = bmi_get_test_addr();
if (bmi_init(scn) != CDF_STATUS_SUCCESS) {
BMI_WARN("BMI_INIT Failed; No Memory!");
goto end;
}
bmi_command_test(BMI_NO_COMMAND, address, data, 9, scn);
bmi_command_test(BMI_WRITE_MEMORY, address, data, 9, scn);
bmi_command_test(BMI_READ_MEMORY, address, out, 9, scn);
BMI_DBG("Output:%s", out);
}
#endif
end:
return bmi_firmware_download(scn);
}
CDF_STATUS
bmi_read_soc_register(uint32_t address, uint32_t *param, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset, param_len;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
bmi_assert(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
cdf_mem_set(bmi_cmd_buff, 0, sizeof(cid) + sizeof(address));
cdf_mem_set(bmi_rsp_buff, 0, sizeof(cid) + sizeof(address));
if (scn->bmi_done) {
BMI_DBG("Command disallowed");
return CDF_STATUS_E_PERM;
}
BMI_DBG("BMI Read SOC Register:device: 0x%p, address: 0x%x",
scn, address);
cid = BMI_READ_SOC_REGISTER;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
param_len = sizeof(*param);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
bmi_rsp_buff, &param_len, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_DBG("Unable to read from the device; status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(param, bmi_rsp_buff, sizeof(*param));
BMI_DBG("BMI Read SOC Register: Exit value: %d", *param);
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_write_soc_register(uint32_t address, uint32_t param, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(param);
bmi_assert(BMI_COMMAND_FITS(size));
cdf_mem_set(bmi_cmd_buff, 0, size);
if (scn->bmi_done) {
BMI_DBG("Command disallowed");
return CDF_STATUS_E_FAILURE;
}
BMI_DBG("SOC Register Write:device:0x%p, addr:0x%x, param:%d",
scn, address, param);
cid = BMI_WRITE_SOC_REGISTER;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &param, sizeof(param));
offset += sizeof(param);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
NULL, NULL, 0);
if (status) {
BMI_ERR("Unable to write to the device: status:%d", status);
return CDF_STATUS_E_FAILURE;
}
BMI_DBG("BMI Read SOC Register: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmilz_data(uint8_t *buffer, uint32_t length, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint32_t remaining, txlen;
const uint32_t header = sizeof(cid) + sizeof(length);
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
BMI_DBG("BMI Send LZ Data: device: 0x%p, length: %d",
scn, length);
cid = BMI_LZ_DATA;
remaining = length;
while (remaining) {
txlen = (remaining < (BMI_DATASZ_MAX - header)) ?
remaining : (BMI_DATASZ_MAX - header);
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]),
&buffer[length - remaining], txlen);
offset += txlen;
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
NULL, NULL, 0);
if (status) {
BMI_ERR("Failed to write to the device: status:%d",
status);
return CDF_STATUS_E_FAILURE;
}
remaining -= txlen;
}
BMI_DBG("BMI LZ Data: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_sign_stream_start(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
const uint32_t header = sizeof(cid) + sizeof(address) + sizeof(length);
uint8_t aligned_buf[BMI_DATASZ_MAX + 4];
uint8_t *src;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint32_t remaining, txlen;
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
BMI_ERR("Sign Stream start:device:0x%p, addr:0x%x, length:%d",
scn, address, length);
cid = BMI_SIGN_STREAM_START;
remaining = length;
while (remaining) {
src = &buffer[length - remaining];
if (remaining < (BMI_DATASZ_MAX - header)) {
if (remaining & 0x3) {
remaining = remaining + (4 - (remaining & 0x3));
memcpy(aligned_buf, src, remaining);
src = aligned_buf;
}
txlen = remaining;
} else {
txlen = (BMI_DATASZ_MAX - header);
}
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address,
sizeof(address));
offset += sizeof(offset);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
status = hif_exchange_bmi_msg(scn,
bmi_cmd_buff, offset,
NULL, NULL, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to write to the device: status:%d",
status);
return CDF_STATUS_E_FAILURE;
}
remaining -= txlen;
}
BMI_DBG("BMI SIGN Stream Start: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmilz_stream_start(uint32_t address, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
bmi_assert(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
cdf_mem_set(bmi_cmd_buff, 0, sizeof(cid) + sizeof(address));
if (scn->bmi_done) {
BMI_DBG("Command disallowed");
return CDF_STATUS_E_PERM;
}
BMI_DBG("BMI LZ Stream Start: (device: 0x%p, address: 0x%x)",
scn, address);
cid = BMI_LZ_STREAM_START;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
NULL, NULL, 0);
if (status) {
BMI_ERR("Unable to Start LZ Stream to the device status:%d",
status);
return CDF_STATUS_E_FAILURE;
}
BMI_DBG("BMI LZ Stream: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_fast_download(uint32_t address, uint8_t *buffer,
uint32_t length, struct ol_softc *scn)
{
CDF_STATUS status = CDF_STATUS_E_FAILURE;
uint32_t last_word = 0;
uint32_t last_word_offset = length & ~0x3;
uint32_t unaligned_bytes = length & 0x3;
status = bmilz_stream_start(address, scn);
if (status != CDF_STATUS_SUCCESS)
goto end;
/* copy the last word into a zero padded buffer */
if (unaligned_bytes)
cdf_mem_copy(&last_word, &buffer[last_word_offset],
unaligned_bytes);
status = bmilz_data(buffer, last_word_offset, scn);
if (status != CDF_STATUS_SUCCESS)
goto end;
if (unaligned_bytes)
status = bmilz_data((uint8_t *) &last_word, 4, scn);
if (status != CDF_STATUS_SUCCESS)
/*
* Close compressed stream and open a new (fake) one.
* This serves mainly to flush Target caches.
*/
status = bmilz_stream_start(0x00, scn);
end:
return status;
}

View File

@@ -1,321 +0,0 @@
/*
* copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#include "i_bmi.h"
/* APIs visible to the driver */
CDF_STATUS
bmi_read_memory(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint32_t remaining, rxlen;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
uint32_t align;
if (scn->bmi_done) {
BMI_DBG("command disallowed");
return CDF_STATUS_E_PERM;
}
if (!scn->bmi_cmd_buff || !scn->bmi_rsp_buff) {
BMI_ERR("BMI Initialization hasn't done");
return CDF_STATUS_NOT_INITIALIZED;
}
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + sizeof(cid) +
sizeof(address) + sizeof(length)));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + sizeof(cid) +
sizeof(address) + sizeof(length));
cdf_mem_set(bmi_rsp_buff, 0, BMI_DATASZ_MAX + sizeof(cid) +
sizeof(address) + sizeof(length));
BMI_DBG("BMI Read: device: 0x%p, address: 0x%x, length: %d",
scn, address, length);
cid = BMI_READ_MEMORY;
align = 0;
remaining = length;
while (remaining) {
rxlen = (remaining < BMI_DATASZ_MAX) ?
remaining : BMI_DATASZ_MAX;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address,
sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &rxlen, sizeof(rxlen));
offset += sizeof(length);
/* note we reuse the same buffer to receive on */
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
bmi_rsp_buff, &rxlen, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to read from the device");
return CDF_STATUS_E_FAILURE;
}
if (remaining == rxlen) {
cdf_mem_copy(&buffer[length - remaining + align],
bmi_rsp_buff, rxlen - align);
/* last align bytes are invalid */
} else {
cdf_mem_copy(&buffer[length - remaining + align],
bmi_rsp_buff, rxlen);
}
remaining -= rxlen;
address += rxlen;
}
BMI_DBG("BMI Read Memory: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_write_memory(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint32_t remaining, txlen;
const uint32_t header = sizeof(cid) + sizeof(address) + sizeof(length);
uint8_t aligned_buffer[BMI_DATASZ_MAX];
uint8_t *src;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff) {
BMI_ERR("BMI initialization hasn't done");
return CDF_STATUS_E_PERM;
}
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
BMI_DBG("BMI Write Memory:device: 0x%p, address: 0x%x, length: %d",
scn, address, length);
cid = BMI_WRITE_MEMORY;
remaining = length;
while (remaining) {
src = &buffer[length - remaining];
if (remaining < (BMI_DATASZ_MAX - header)) {
if (remaining & 3) {
/* align it with 4 bytes */
remaining = remaining + (4 - (remaining & 3));
memcpy(aligned_buffer, src, remaining);
src = aligned_buffer;
}
txlen = remaining;
} else {
txlen = (BMI_DATASZ_MAX - header);
}
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address,
sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
NULL, NULL, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to write to the device; status:%d",
status);
return CDF_STATUS_E_FAILURE;
}
remaining -= txlen;
address += txlen;
}
BMI_DBG("BMI Write Memory: Exit");
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_execute(uint32_t address, A_UINT32 *param, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t offset;
uint32_t param_len;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(param);
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("%s:BMI CMD/RSP Buffer is NULL", __func__);
return CDF_STATUS_NOT_INITIALIZED;
}
bmi_assert(BMI_COMMAND_FITS(size));
cdf_mem_set(bmi_cmd_buff, 0, size);
cdf_mem_set(bmi_rsp_buff, 0, size);
BMI_DBG("BMI Execute: device: 0x%p, address: 0x%x, param: %d",
scn, address, *param);
cid = BMI_EXECUTE;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), param, sizeof(*param));
offset += sizeof(*param);
param_len = sizeof(*param);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
bmi_rsp_buff, &param_len, 0);
if (status) {
BMI_ERR("Unable to read from the device status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(param, bmi_rsp_buff, sizeof(*param));
BMI_DBG("BMI Execute: Exit (param: %d)", *param);
return CDF_STATUS_SUCCESS;
}
inline CDF_STATUS
bmi_no_command(struct ol_softc *scn)
{
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_firmware_download(struct ol_softc *scn)
{
CDF_STATUS status;
struct bmi_target_info targ_info;
cdf_mem_zero(&targ_info, sizeof(targ_info));
/* Initialize BMI */
status = bmi_init(scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("BMI Initialization Failed err:%d", status);
return status;
}
/* Get target information */
status = bmi_get_target_info(&targ_info, scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("BMI Target Info get failed: status:%d", status);
return status;
}
scn->target_type = targ_info.target_type;
scn->target_version = targ_info.target_ver;
/* Configure target */
status = ol_configure_target(scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("BMI Configure Target Failed status:%d", status);
return status;
}
status = ol_download_firmware(scn);
if (status != CDF_STATUS_SUCCESS)
BMI_ERR("BMI Download Firmware Failed Status:%d", status);
return status;
}
CDF_STATUS bmi_done_local(struct ol_softc *scn)
{
int status;
uint32_t cid;
if (!scn) {
BMI_ERR("Invalid scn context");
bmi_assert(0);
return CDF_STATUS_NOT_INITIALIZED;
}
if (scn->bmi_done) {
BMI_DBG("bmi_done_local skipped");
return CDF_STATUS_E_PERM;
}
BMI_DBG("BMI Done: Enter (device: 0x%p)", scn);
scn->bmi_done = true;
cid = BMI_DONE;
if (!scn->bmi_cmd_buff) {
BMI_ERR("Invalid scn BMICmdBuff");
bmi_assert(0);
return CDF_STATUS_NOT_INITIALIZED;
}
cdf_mem_copy(scn->bmi_cmd_buff, &cid, sizeof(cid));
status = hif_exchange_bmi_msg(scn, scn->bmi_cmd_buff,
sizeof(cid), NULL, NULL, 0);
if (status) {
BMI_ERR("Failed to write to the device; status:%d", status);
return CDF_STATUS_E_FAILURE;
}
if (scn->bmi_cmd_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_cmd_buff, scn->bmi_cmd_da, 0);
scn->bmi_cmd_buff = NULL;
scn->bmi_cmd_da = 0;
}
if (scn->bmi_rsp_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_rsp_buff, scn->bmi_rsp_da, 0);
scn->bmi_rsp_buff = NULL;
scn->bmi_rsp_da = 0;
}
return CDF_STATUS_SUCCESS;
}

View File

@@ -1,452 +0,0 @@
/*
* copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#include "i_bmi.h"
/* This need to defined in firmware interface files.
* Defining here to address compilation issues.
* Will be deleted once firmware interface files for
* target are merged
*/
#define BMI_LOAD_IMAGE 18
CDF_STATUS
bmi_no_command(struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t length;
uint8_t ret = 0;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
if (scn->bmi_done) {
BMI_ERR("Command disallowed: BMI DONE ALREADY");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("No Memory Allocated for BMI CMD/RSP Buffer");
return CDF_STATUS_NOT_INITIALIZED;
}
cid = BMI_NO_COMMAND;
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Failed to write bmi no command status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, length);
if (ret != 0) {
BMI_ERR("bmi no command response error ret 0x%x", ret);
return CDF_STATUS_E_FAILURE;
}
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_done_local(struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t length;
uint8_t ret = 0;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("No Memory Allocated for BMI CMD/RSP Buffer");
return CDF_STATUS_NOT_INITIALIZED;
}
cid = BMI_DONE;
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Failed to close BMI on target status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, length);
if (ret != 0) {
BMI_ERR("BMI DONE response failed:%d", ret);
return CDF_STATUS_E_FAILURE;
}
if (scn->bmi_cmd_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_cmd_buff, scn->bmi_cmd_da, 0);
scn->bmi_cmd_buff = NULL;
scn->bmi_cmd_da = 0;
}
if (scn->bmi_rsp_buff) {
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
scn->bmi_rsp_buff, scn->bmi_rsp_da, 0);
scn->bmi_rsp_buff = NULL;
scn->bmi_rsp_da = 0;
}
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_write_memory(uint32_t address,
uint8_t *buffer,
uint32_t length,
struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t rsp_len;
uint8_t ret = 0;
uint32_t offset;
uint32_t remaining, txlen;
const uint32_t header = sizeof(cid) + sizeof(address) + sizeof(length);
uint8_t aligned_buffer[BMI_DATASZ_MAX];
uint8_t *src;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("BMI Initialization is not happened");
return CDF_STATUS_NOT_INITIALIZED;
}
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
cid = BMI_WRITE_MEMORY;
rsp_len = sizeof(ret);
remaining = length;
while (remaining) {
src = &buffer[length - remaining];
if (remaining < (BMI_DATASZ_MAX - header)) {
if (remaining & 3) {
/* align it with 4 bytes */
remaining = remaining + (4 - (remaining & 3));
memcpy(aligned_buffer, src, remaining);
src = aligned_buffer;
}
txlen = remaining;
} else {
txlen = (BMI_DATASZ_MAX - header);
}
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address,
sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
bmi_rsp_buff, &rsp_len, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("BMI Write Memory Failed status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, rsp_len);
if (ret != 0) {
BMI_ERR("BMI Write memory response fail: %x", ret);
return CDF_STATUS_E_FAILURE;
}
remaining -= txlen; address += txlen;
}
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_read_memory(uint32_t address, uint8_t *buffer,
uint32_t length, struct ol_softc *scn)
{
uint32_t cid;
int status;
uint8_t ret = 0;
uint32_t offset;
uint32_t remaining, rxlen, rsp_len, total_len;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
/* note we reuse the same buffer to receive on */
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(length);
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("BMI Initialization is not done");
return CDF_STATUS_NOT_INITIALIZED;
}
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + size));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + size);
cdf_mem_set(bmi_rsp_buff, 0, BMI_DATASZ_MAX + size);
cid = BMI_READ_MEMORY;
rsp_len = sizeof(ret);
remaining = length;
while (remaining) {
rxlen = (remaining < BMI_DATASZ_MAX - rsp_len) ? remaining :
(BMI_DATASZ_MAX - rsp_len);
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address,
sizeof(address));
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &rxlen, sizeof(rxlen));
offset += sizeof(length);
total_len = rxlen + rsp_len;
status = hif_exchange_bmi_msg(scn,
bmi_cmd_buff,
offset,
bmi_rsp_buff,
&total_len,
BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("BMI Read memory failed status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, rsp_len);
if (ret != 0) {
BMI_ERR("bmi read memory response fail %x", ret);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&buffer[length - remaining],
(uint8_t *)bmi_rsp_buff + rsp_len, rxlen);
remaining -= rxlen; address += rxlen;
}
return CDF_STATUS_SUCCESS;
}
CDF_STATUS
bmi_execute(uint32_t address, uint32_t *param,
struct ol_softc *scn)
{
uint32_t cid;
int status;
uint32_t length;
uint8_t ret = 0;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("No Memory Allocated for bmi buffers");
return CDF_STATUS_NOT_INITIALIZED;
}
cid = BMI_EXECUTE;
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Failed to do BMI_EXECUTE status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, length);
if (ret != 0) {
BMI_ERR("%s: ret 0x%x", __func__, ret);
return CDF_STATUS_E_FAILURE;
}
return CDF_STATUS_SUCCESS;
}
static CDF_STATUS
bmi_load_image(dma_addr_t address,
uint32_t size, struct ol_softc *scn)
{
uint32_t cid;
CDF_STATUS status;
uint32_t offset;
uint32_t length;
uint8_t ret = 0;
uint8_t *bmi_cmd_buff = scn->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = scn->bmi_rsp_buff;
uint32_t addr_h, addr_l;
if (scn->bmi_done) {
BMI_ERR("Command disallowed");
return CDF_STATUS_E_PERM;
}
if (!bmi_cmd_buff || !bmi_rsp_buff) {
BMI_ERR("No Memory Allocated for BMI CMD/RSP Buffer");
return CDF_STATUS_NOT_INITIALIZED;
}
bmi_assert(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
cdf_mem_set(bmi_cmd_buff, 0, sizeof(cid) + sizeof(address));
BMI_DBG("%s: Enter device: 0x%p, size %d", __func__, scn, size);
cid = BMI_LOAD_IMAGE;
offset = 0;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
addr_l = address & 0xffffffff;
addr_h = 0x00;
cdf_mem_copy(&(bmi_cmd_buff[offset]), &addr_l, sizeof(addr_l));
offset += sizeof(addr_l);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &addr_h, sizeof(addr_h));
offset += sizeof(addr_h);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &size, sizeof(size));
offset += sizeof(size);
length = sizeof(ret);
status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("BMI Load Image Failed; status:%d", status);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_copy(&ret, bmi_rsp_buff, length);
if (ret != 0) {
BMI_ERR("%s: ret 0x%x", __func__, ret);
return CDF_STATUS_E_FAILURE;
}
return CDF_STATUS_SUCCESS;
}
static CDF_STATUS bmi_enable(struct ol_softc *scn)
{
struct bmi_target_info targ_info;
struct image_desc_info image_desc_info;
CDF_STATUS status;
if (!scn) {
BMI_ERR("Invalid scn context");
bmi_assert(0);
return CDF_STATUS_NOT_INITIALIZED;
}
if (scn->bmi_cmd_buff == NULL || scn->bmi_rsp_buff == NULL) {
BMI_ERR("bmi_open failed!");
return CDF_STATUS_NOT_INITIALIZED;
}
status = bmi_get_target_info(&targ_info, scn);
if (status != CDF_STATUS_SUCCESS)
return status;
BMI_DBG("%s: target type 0x%x, target ver 0x%x", __func__,
targ_info.target_type, targ_info.target_ver);
scn->target_type = targ_info.target_type;
scn->target_version = targ_info.target_ver;
if (cnss_get_fw_image(&image_desc_info) != 0) {
BMI_ERR("Failed to get fw image");
return CDF_STATUS_E_FAILURE;
}
status = bmi_load_image(image_desc_info.bdata_addr,
image_desc_info.bdata_size,
scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("Load board data failed! status:%d", status);
return status;
}
status = bmi_load_image(image_desc_info.fw_addr,
image_desc_info.fw_size,
scn);
if (status != CDF_STATUS_SUCCESS)
BMI_ERR("Load fw image failed! status:%d", status);
return status;
}
CDF_STATUS bmi_firmware_download(struct ol_softc *scn)
{
CDF_STATUS status;
if (NO_BMI)
return CDF_STATUS_SUCCESS;
status = bmi_init(scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("BMI_INIT Failed status:%d", status);
goto end;
}
status = bmi_enable(scn);
if (status != CDF_STATUS_SUCCESS) {
BMI_ERR("BMI_ENABLE failed status:%d\n", status);
goto err_bmi_enable;
}
return status;
err_bmi_enable:
bmi_cleanup(scn);
end:
return status;
}

View File

@@ -1,607 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _AR6320V2_DBG_REGTABLE_H_
#define _AR6320V2_DBG_REGTABLE_H_
#include "regtable.h"
#define AR6320_REV2_1_REG_SIZE 0x0007F820
#define AR6320_REV3_REG_SIZE 0x0007F820
#ifdef HIF_PCI
/*
* Redefine the register list. To minimize the size of the array, the list must
* obey the below format. {start0, end0}, {start1, end1}, {start2, end2}.......
* The value below must obey to "start0 < end0 < start1 < end1 < start2 < ...",
* otherwise we may encouter error in the dump processing.
*/
static const tgt_reg_section ar6320v2_reg_table[] = {
{0x800, 0x810},
{0x820, 0x82C},
{0x830, 0x8F4},
{0x90C, 0x91C},
{0xA14, 0xA18},
{0xA84, 0xA94},
{0xAA8, 0xAD4},
{0xADC, 0xB40},
{0x1000, 0x10A4},
{0x10BC, 0x111C},
{0x1134, 0x1138},
{0x1144, 0x114C},
{0x1150, 0x115C},
{0x1160, 0x1178},
{0x1240, 0x1260},
{0x2000, 0x207C},
{0x3000, 0x3014},
{0x4000, 0x4014},
{0x5000, 0x5124},
{0x6000, 0x6040},
{0x6080, 0x60CC},
{0x6100, 0x611C},
{0x6140, 0x61D8},
{0x6200, 0x6238},
{0x6240, 0x628C},
{0x62C0, 0x62EC},
{0x6380, 0x63E8},
{0x6400, 0x6440},
{0x6480, 0x64CC},
{0x6500, 0x651C},
{0x6540, 0x6580},
{0x6600, 0x6638},
{0x6640, 0x668C},
{0x66C0, 0x66EC},
{0x6780, 0x67E8},
{0x7080, 0x708C},
{0x70C0, 0x70C8},
{0x7400, 0x741C},
{0x7440, 0x7454},
{0x7800, 0x7818},
{0x8000, 0x8004},
{0x8010, 0x8064},
{0x8080, 0x8084},
{0x80A0, 0x80A4},
{0x80C0, 0x80C4},
{0x80E0, 0x80F4},
{0x8100, 0x8104},
{0x8110, 0x812C},
{0x9000, 0x9004},
{0x9800, 0x982C},
{0x9830, 0x9838},
{0x9840, 0x986C},
{0x9870, 0x9898},
{0x9A00, 0x9C00},
{0xD580, 0xD59C},
{0xF000, 0xF0E0},
{0xF140, 0xF190},
{0xF250, 0xF25C},
{0xF260, 0xF268},
{0xF26C, 0xF2A8},
{0x10008, 0x1000C},
{0x10014, 0x10018},
{0x1001C, 0x10020},
{0x10024, 0x10028},
{0x10030, 0x10034},
{0x10040, 0x10054},
{0x10058, 0x1007C},
{0x10080, 0x100C4},
{0x100C8, 0x10114},
{0x1012C, 0x10130},
{0x10138, 0x10144},
{0x10200, 0x10220},
{0x10230, 0x10250},
{0x10260, 0x10280},
{0x10290, 0x102B0},
{0x102C0, 0x102DC},
{0x102E0, 0x102F4},
{0x102FC, 0x1037C},
{0x10380, 0x10390},
{0x10800, 0x10828},
{0x10840, 0x10844},
{0x10880, 0x10884},
{0x108C0, 0x108E8},
{0x10900, 0x10928},
{0x10940, 0x10944},
{0x10980, 0x10984},
{0x109C0, 0x109E8},
{0x10A00, 0x10A28},
{0x10A40, 0x10A50},
{0x11000, 0x11028},
{0x11030, 0x11034},
{0x11038, 0x11068},
{0x11070, 0x11074},
{0x11078, 0x110A8},
{0x110B0, 0x110B4},
{0x110B8, 0x110E8},
{0x110F0, 0x110F4},
{0x110F8, 0x11128},
{0x11138, 0x11144},
{0x11178, 0x11180},
{0x111B8, 0x111C0},
{0x111F8, 0x11200},
{0x11238, 0x1123C},
{0x11270, 0x11274},
{0x11278, 0x1127C},
{0x112B0, 0x112B4},
{0x112B8, 0x112BC},
{0x112F0, 0x112F4},
{0x112F8, 0x112FC},
{0x11338, 0x1133C},
{0x11378, 0x1137C},
{0x113B8, 0x113BC},
{0x113F8, 0x113FC},
{0x11438, 0x11440},
{0x11478, 0x11480},
{0x114B8, 0x114BC},
{0x114F8, 0x114FC},
{0x11538, 0x1153C},
{0x11578, 0x1157C},
{0x115B8, 0x115BC},
{0x115F8, 0x115FC},
{0x11638, 0x1163C},
{0x11678, 0x1167C},
{0x116B8, 0x116BC},
{0x116F8, 0x116FC},
{0x11738, 0x1173C},
{0x11778, 0x1177C},
{0x117B8, 0x117BC},
{0x117F8, 0x117FC},
{0x17000, 0x1701C},
{0x17020, 0x170AC},
{0x18000, 0x18050},
{0x18054, 0x18074},
{0x18080, 0x180D4},
{0x180DC, 0x18104},
{0x18108, 0x1813C},
{0x18144, 0x18148},
{0x18168, 0x18174},
{0x18178, 0x18180},
{0x181C8, 0x181E0},
{0x181E4, 0x181E8},
{0x181EC, 0x1820C},
{0x1825C, 0x18280},
{0x18284, 0x18290},
{0x18294, 0x182A0},
{0x18300, 0x18304},
{0x18314, 0x18320},
{0x18328, 0x18350},
{0x1835C, 0x1836C},
{0x18370, 0x18390},
{0x18398, 0x183AC},
{0x183BC, 0x183D8},
{0x183DC, 0x183F4},
{0x18400, 0x186F4},
{0x186F8, 0x1871C},
{0x18720, 0x18790},
{0x19800, 0x19830},
{0x19834, 0x19840},
{0x19880, 0x1989C},
{0x198A4, 0x198B0},
{0x198BC, 0x19900},
{0x19C00, 0x19C88},
{0x19D00, 0x19D20},
{0x19E00, 0x19E7C},
{0x19E80, 0x19E94},
{0x19E98, 0x19EAC},
{0x19EB0, 0x19EBC},
{0x19F70, 0x19F74},
{0x19F80, 0x19F8C},
{0x19FA0, 0x19FB4},
{0x19FC0, 0x19FD8},
{0x1A000, 0x1A200},
{0x1A204, 0x1A210},
{0x1A228, 0x1A22C},
{0x1A230, 0x1A248},
{0x1A250, 0x1A270},
{0x1A280, 0x1A290},
{0x1A2A0, 0x1A2A4},
{0x1A2C0, 0x1A2EC},
{0x1A300, 0x1A3BC},
{0x1A3F0, 0x1A3F4},
{0x1A3F8, 0x1A434},
{0x1A438, 0x1A444},
{0x1A448, 0x1A468},
{0x1A580, 0x1A58C},
{0x1A644, 0x1A654},
{0x1A670, 0x1A698},
{0x1A6AC, 0x1A6B0},
{0x1A6D0, 0x1A6D4},
{0x1A6EC, 0x1A70C},
{0x1A710, 0x1A738},
{0x1A7C0, 0x1A7D0},
{0x1A7D4, 0x1A7D8},
{0x1A7DC, 0x1A7E4},
{0x1A7F0, 0x1A7F8},
{0x1A888, 0x1A89C},
{0x1A8A8, 0x1A8AC},
{0x1A8C0, 0x1A8DC},
{0x1A8F0, 0x1A8FC},
{0x1AE04, 0x1AE08},
{0x1AE18, 0x1AE24},
{0x1AF80, 0x1AF8C},
{0x1AFA0, 0x1AFB4},
{0x1B000, 0x1B200},
{0x1B284, 0x1B288},
{0x1B2D0, 0x1B2D8},
{0x1B2DC, 0x1B2EC},
{0x1B300, 0x1B340},
{0x1B374, 0x1B378},
{0x1B380, 0x1B384},
{0x1B388, 0x1B38C},
{0x1B404, 0x1B408},
{0x1B420, 0x1B428},
{0x1B440, 0x1B444},
{0x1B448, 0x1B44C},
{0x1B450, 0x1B458},
{0x1B45C, 0x1B468},
{0x1B584, 0x1B58C},
{0x1B68C, 0x1B690},
{0x1B6AC, 0x1B6B0},
{0x1B7F0, 0x1B7F8},
{0x1C800, 0x1CC00},
{0x1CE00, 0x1CE04},
{0x1CF80, 0x1CF84},
{0x1D200, 0x1D800},
{0x1E000, 0x20014},
{0x20100, 0x20124},
{0x21400, 0x217A8},
{0x21800, 0x21BA8},
{0x21C00, 0x21FA8},
{0x22000, 0x223A8},
{0x22400, 0x227A8},
{0x22800, 0x22BA8},
{0x22C00, 0x22FA8},
{0x23000, 0x233A8},
{0x24000, 0x24034},
/*
* EFUSE0,1,2 is disabled here
* because it's state may be reset
*
* {0x24800, 0x24804},
* {0x25000, 0x25004},
* {0x25800, 0x25804},
*/
{0x26000, 0x26064},
{0x27000, 0x27024},
{0x34000, 0x3400C},
{0x34400, 0x3445C},
{0x34800, 0x3485C},
{0x34C00, 0x34C5C},
{0x35000, 0x3505C},
{0x35400, 0x3545C},
{0x35800, 0x3585C},
{0x35C00, 0x35C5C},
{0x36000, 0x3605C},
{0x38000, 0x38064},
{0x38070, 0x380E0},
{0x3A000, 0x3A064},
/* DBI windows is skipped here, it can be only accessed when pcie
* is active (not in reset) and CORE_CTRL_PCIE_LTSSM_EN = 0 &&
* PCIE_CTRL_APP_LTSSM_ENALBE=0.
* {0x3C000 , 0x3C004},
*/
{0x40000, 0x400A4},
/*
* SI register is skiped here.
* Because it will cause bus hang
*
* {0x50000, 0x50018},
*/
{0x80000, 0x8000C},
{0x80010, 0x80020},
};
static const tgt_reg_section ar6320v3_reg_table[] = {
{0x800, 0x810},
{0x820, 0x82C},
{0x830, 0x8F4},
{0x90C, 0x91C},
{0xA14, 0xA18},
{0xA84, 0xA94},
{0xAA8, 0xAD4},
{0xADC, 0xB40},
{0x1000, 0x10A4},
{0x10BC, 0x111C},
{0x1134, 0x1138},
{0x1144, 0x114C},
{0x1150, 0x115C},
{0x1160, 0x1178},
{0x1240, 0x1260},
{0x2000, 0x207C},
{0x3000, 0x3014},
{0x4000, 0x4014},
{0x5000, 0x5124},
{0x6000, 0x6040},
{0x6080, 0x60CC},
{0x6100, 0x611C},
{0x6140, 0x61D8},
{0x6200, 0x6238},
{0x6240, 0x628C},
{0x62C0, 0x62EC},
{0x6380, 0x63E8},
{0x6400, 0x6440},
{0x6480, 0x64CC},
{0x6500, 0x651C},
{0x6540, 0x6580},
{0x6600, 0x6638},
{0x6640, 0x668C},
{0x66C0, 0x66EC},
{0x6780, 0x67E8},
{0x7080, 0x708C},
{0x70C0, 0x70C8},
{0x7400, 0x741C},
{0x7440, 0x7454},
{0x7800, 0x7818},
{0x8000, 0x8004},
{0x8010, 0x8064},
{0x8080, 0x8084},
{0x80A0, 0x80A4},
{0x80C0, 0x80C4},
{0x80E0, 0x80F4},
{0x8100, 0x8104},
{0x8110, 0x812C},
{0x9000, 0x9004},
{0x9800, 0x982C},
{0x9830, 0x9838},
{0x9840, 0x986C},
{0x9870, 0x9898},
{0x9A00, 0x9C00},
{0xD580, 0xD59C},
{0xF000, 0xF0E0},
{0xF140, 0xF190},
{0xF250, 0xF25C},
{0xF260, 0xF268},
{0xF26C, 0xF2A8},
{0x10008, 0x1000C},
{0x10014, 0x10018},
{0x1001C, 0x10020},
{0x10024, 0x10028},
{0x10030, 0x10034},
{0x10040, 0x10054},
{0x10058, 0x1007C},
{0x10080, 0x100C4},
{0x100C8, 0x10114},
{0x1012C, 0x10130},
{0x10138, 0x10144},
{0x10200, 0x10220},
{0x10230, 0x10250},
{0x10260, 0x10280},
{0x10290, 0x102B0},
{0x102C0, 0x102DC},
{0x102E0, 0x102F4},
{0x102FC, 0x1037C},
{0x10380, 0x10390},
{0x10800, 0x10828},
{0x10840, 0x10844},
{0x10880, 0x10884},
{0x108C0, 0x108E8},
{0x10900, 0x10928},
{0x10940, 0x10944},
{0x10980, 0x10984},
{0x109C0, 0x109E8},
{0x10A00, 0x10A28},
{0x10A40, 0x10A50},
{0x11000, 0x11028},
{0x11030, 0x11034},
{0x11038, 0x11068},
{0x11070, 0x11074},
{0x11078, 0x110A8},
{0x110B0, 0x110B4},
{0x110B8, 0x110E8},
{0x110F0, 0x110F4},
{0x110F8, 0x11128},
{0x11138, 0x11144},
{0x11178, 0x11180},
{0x111B8, 0x111C0},
{0x111F8, 0x11200},
{0x11238, 0x1123C},
{0x11270, 0x11274},
{0x11278, 0x1127C},
{0x112B0, 0x112B4},
{0x112B8, 0x112BC},
{0x112F0, 0x112F4},
{0x112F8, 0x112FC},
{0x11338, 0x1133C},
{0x11378, 0x1137C},
{0x113B8, 0x113BC},
{0x113F8, 0x113FC},
{0x11438, 0x11440},
{0x11478, 0x11480},
{0x114B8, 0x114BC},
{0x114F8, 0x114FC},
{0x11538, 0x1153C},
{0x11578, 0x1157C},
{0x115B8, 0x115BC},
{0x115F8, 0x115FC},
{0x11638, 0x1163C},
{0x11678, 0x1167C},
{0x116B8, 0x116BC},
{0x116F8, 0x116FC},
{0x11738, 0x1173C},
{0x11778, 0x1177C},
{0x117B8, 0x117BC},
{0x117F8, 0x117FC},
{0x17000, 0x1701C},
{0x17020, 0x170AC},
{0x18000, 0x18050},
{0x18054, 0x18074},
{0x18080, 0x180D4},
{0x180DC, 0x18104},
{0x18108, 0x1813C},
{0x18144, 0x18148},
{0x18168, 0x18174},
{0x18178, 0x18180},
{0x181C8, 0x181E0},
{0x181E4, 0x181E8},
{0x181EC, 0x1820C},
{0x1825C, 0x18280},
{0x18284, 0x18290},
{0x18294, 0x182A0},
{0x18300, 0x18304},
{0x18314, 0x18320},
{0x18328, 0x18350},
{0x1835C, 0x1836C},
{0x18370, 0x18390},
{0x18398, 0x183AC},
{0x183BC, 0x183D8},
{0x183DC, 0x183F4},
{0x18400, 0x186F4},
{0x186F8, 0x1871C},
{0x18720, 0x18790},
{0x19800, 0x19830},
{0x19834, 0x19840},
{0x19880, 0x1989C},
{0x198A4, 0x198B0},
{0x198BC, 0x19900},
{0x19C00, 0x19C88},
{0x19D00, 0x19D20},
{0x19E00, 0x19E7C},
{0x19E80, 0x19E94},
{0x19E98, 0x19EAC},
{0x19EB0, 0x19EBC},
{0x19F70, 0x19F74},
{0x19F80, 0x19F8C},
{0x19FA0, 0x19FB4},
{0x19FC0, 0x19FD8},
{0x1A000, 0x1A200},
{0x1A204, 0x1A210},
{0x1A228, 0x1A22C},
{0x1A230, 0x1A248},
{0x1A250, 0x1A270},
{0x1A280, 0x1A290},
{0x1A2A0, 0x1A2A4},
{0x1A2C0, 0x1A2EC},
{0x1A300, 0x1A3BC},
{0x1A3F0, 0x1A3F4},
{0x1A3F8, 0x1A434},
{0x1A438, 0x1A444},
{0x1A448, 0x1A468},
{0x1A580, 0x1A58C},
{0x1A644, 0x1A654},
{0x1A670, 0x1A698},
{0x1A6AC, 0x1A6B0},
{0x1A6D0, 0x1A6D4},
{0x1A6EC, 0x1A70C},
{0x1A710, 0x1A738},
{0x1A7C0, 0x1A7D0},
{0x1A7D4, 0x1A7D8},
{0x1A7DC, 0x1A7E4},
{0x1A7F0, 0x1A7F8},
{0x1A888, 0x1A89C},
{0x1A8A8, 0x1A8AC},
{0x1A8C0, 0x1A8DC},
{0x1A8F0, 0x1A8FC},
{0x1AE04, 0x1AE08},
{0x1AE18, 0x1AE24},
{0x1AF80, 0x1AF8C},
{0x1AFA0, 0x1AFB4},
{0x1B000, 0x1B200},
{0x1B284, 0x1B288},
{0x1B2D0, 0x1B2D8},
{0x1B2DC, 0x1B2EC},
{0x1B300, 0x1B340},
{0x1B374, 0x1B378},
{0x1B380, 0x1B384},
{0x1B388, 0x1B38C},
{0x1B404, 0x1B408},
{0x1B420, 0x1B428},
{0x1B440, 0x1B444},
{0x1B448, 0x1B44C},
{0x1B450, 0x1B458},
{0x1B45C, 0x1B468},
{0x1B584, 0x1B58C},
{0x1B68C, 0x1B690},
{0x1B6AC, 0x1B6B0},
{0x1B7F0, 0x1B7F8},
{0x1C800, 0x1CC00},
{0x1CE00, 0x1CE04},
{0x1CF80, 0x1CF84},
{0x1D200, 0x1D800},
{0x1E000, 0x20014},
{0x20100, 0x20124},
{0x21400, 0x217A8},
{0x21800, 0x21BA8},
{0x21C00, 0x21FA8},
{0x22000, 0x223A8},
{0x22400, 0x227A8},
{0x22800, 0x22BA8},
{0x22C00, 0x22FA8},
{0x23000, 0x233A8},
{0x24000, 0x24034},
/*
* EFUSE0,1,2 is disabled here
* because it's state may be reset
*
* {0x24800, 0x24804},
* {0x25000, 0x25004},
* {0x25800, 0x25804},
*/
{0x26000, 0x26064},
{0x27000, 0x27024},
{0x34000, 0x3400C},
{0x34400, 0x3445C},
{0x34800, 0x3485C},
{0x34C00, 0x34C5C},
{0x35000, 0x3505C},
{0x35400, 0x3545C},
{0x35800, 0x3585C},
{0x35C00, 0x35C5C},
{0x36000, 0x3605C},
{0x38000, 0x38064},
{0x38070, 0x380E0},
{0x3A000, 0x3A074},
/*
* DBI windows is skipped here, it can be only accessed when pcie
* is active (not in reset) and CORE_CTRL_PCIE_LTSSM_EN = 0 &&
* PCIE_CTRL_APP_LTSSM_ENALBE=0.
* {0x3C000 , 0x3C004},
*/
{0x40000, 0x400A4},
/*
* SI register is skiped here.
* Because it will cause bus hang
*
* {0x50000, 0x50018},
*/
{0x80000, 0x8000C},
{0x80010, 0x80020},
};
#endif
#endif /* #ifndef _AR6320V2_DBG_REGTABLE_H_ */

View File

@@ -1,149 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* ===================================================================
* Internal BMI Header File
*/
#ifndef _I_BMI_H_
#define _I_BMI_H_
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "hif.h"
#include "bmi_msg.h"
#include "bmi.h"
#include "ol_fw.h"
#define QCA_FIRMWARE_FILE "athwlan.bin"
#define QCA_UTF_FIRMWARE_FILE "utf.bin"
#define QCA_BOARD_DATA_FILE "fakeboar.bin"
#define QCA_OTP_FILE "otp.bin"
#define QCA_SETUP_FILE "athsetup.bin"
#define QCA_FIRMWARE_EPPING_FILE "epping.bin"
/*
* Note that not all the register locations are accessible.
* A list of accessible target registers are specified with
* their start and end addresses in a table for given target
* version. We should NOT access other locations as either
* they are invalid locations or host does not have read
* access to it or the value of the particular register
* read might change
*/
#define REGISTER_LOCATION 0x00000800
#define DRAM_LOCATION 0x00400000
#define DRAM_SIZE 0x000a8000
/* The local base addr is used to read the target dump using pcie I/O reads */
#define DRAM_LOCAL_BASE_ADDR (0x100000)
#define IRAM_LOCATION 0x00980000
#define IRAM_SIZE 0x00038000
#define AXI_LOCATION 0x000a0000
#define AXI_SIZE 0x00018000
#define CE_OFFSET 0x00000400
#define CE_USEFUL_SIZE 0x00000058
#define TOTAL_DUMP_SIZE 0x00200000
#define PCIE_READ_LIMIT 0x00005000
#define SHA256_DIGEST_SIZE 32
/* BMI LOGGING WRAPPERS */
#define BMI_LOG(level, args...) CDF_TRACE(CDF_MODULE_ID_BMI, \
level, ##args)
#define BMI_ERR(args ...) BMI_LOG(CDF_TRACE_LEVEL_ERROR, args)
#define BMI_DBG(args ...) BMI_LOG(CDF_TRACE_LEVEL_DEBUG, args)
#define BMI_WARN(args ...) BMI_LOG(CDF_TRACE_LEVEL_WARN, args)
#define BMI_INFO(args ...) BMI_LOG(CDF_TRACE_LEVEL_INFO, args)
/* End of BMI Logging Wrappers */
/* BMI Assert Wrappers */
#define bmi_assert CDF_BUG
/*
* Although we had envisioned BMI to run on top of HTC, this is not how the
* final implementation ended up. On the Target side, BMI is a part of the BSP
* and does not use the HTC protocol nor even DMA -- it is intentionally kept
* very simple.
*/
#define MAX_BMI_CMDBUF_SZ (BMI_DATASZ_MAX + \
sizeof(uint32_t) /* cmd */ + \
sizeof(uint32_t) /* addr */ + \
sizeof(uint32_t)) /* length */
#define BMI_COMMAND_FITS(sz) ((sz) <= MAX_BMI_CMDBUF_SZ)
#define BMI_EXCHANGE_TIMEOUT_MS 1000
struct hash_fw {
u8 qwlan[SHA256_DIGEST_SIZE];
u8 otp[SHA256_DIGEST_SIZE];
u8 bdwlan[SHA256_DIGEST_SIZE];
u8 utf[SHA256_DIGEST_SIZE];
};
typedef enum _ATH_BIN_FILE {
ATH_OTP_FILE,
ATH_FIRMWARE_FILE,
ATH_PATCH_FILE,
ATH_BOARD_DATA_FILE,
ATH_FLASH_FILE,
ATH_SETUP_FILE,
} ATH_BIN_FILE;
#if defined(QCA_WIFI_3_0_ADRASTEA)
#define NO_BMI 1
#else
#define NO_BMI 0
#endif
CDF_STATUS bmi_execute(uint32_t address, uint32_t *param,
struct ol_softc *scn);
CDF_STATUS bmi_init(struct ol_softc *scn);
CDF_STATUS bmi_no_command(struct ol_softc *scn);
CDF_STATUS bmi_read_memory(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn);
CDF_STATUS bmi_write_memory(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn);
CDF_STATUS bmi_fast_download(uint32_t address,
uint8_t *buffer, uint32_t length, struct ol_softc *scn);
CDF_STATUS bmi_read_soc_register(uint32_t address,
uint32_t *param, struct ol_softc *scn);
CDF_STATUS bmi_write_soc_register(uint32_t address,
uint32_t param, struct ol_softc *scn);
CDF_STATUS bmi_get_target_info(
struct bmi_target_info *targ_info, struct ol_softc *scn);
CDF_STATUS bmi_firmware_download(struct ol_softc *scn);
CDF_STATUS bmi_done_local(struct ol_softc *scn);
CDF_STATUS ol_download_firmware(struct ol_softc *scn);
CDF_STATUS ol_configure_target(struct ol_softc *scn);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,243 +0,0 @@
/*
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(__CDS_API_H)
#define __CDS_API_H
/**
* DOC: cds_api.h
*
* Connectivity driver services public API
*
*/
#include <cdf_types.h>
#include <cdf_status.h>
#include <cdf_memory.h>
#include <cdf_list.h>
#include <cdf_trace.h>
#include <cdf_event.h>
#include <cdf_lock.h>
#include <cds_reg_service.h>
#include <cds_mq.h>
#include <cds_packet.h>
#include <cds_sched.h>
#include <cdf_threads.h>
#include <cdf_mc_timer.h>
#include <cds_pack_align.h>
/* Amount of time to wait for WMA to perform an asynchronous activity.
* This value should be larger than the timeout used by WMI to wait for
* a response from target
*/
#define CDS_WMA_TIMEOUT (15000)
/**
* enum cds_driver_state - Driver state
* @CDS_DRIVER_STATE_UNINITIALIZED: Driver is in uninitialized state.
* CDS_DRIVER_STATE_LOADED: Driver is loaded and functional.
* CDS_DRIVER_STATE_LOADING: Driver probe is in progress.
* CDS_DRIVER_STATE_UNLOADING: Driver remove is in progress.
* CDS_DRIVER_STATE_RECOVERING: Recovery in progress.
*/
enum cds_driver_state {
CDS_DRIVER_STATE_UNINITIALIZED = 0,
CDS_DRIVER_STATE_LOADED = BIT(0),
CDS_DRIVER_STATE_LOADING = BIT(1),
CDS_DRIVER_STATE_UNLOADING = BIT(2),
CDS_DRIVER_STATE_RECOVERING = BIT(3),
};
#define __CDS_IS_DRIVER_STATE(_state, _mask) (((_state) & (_mask)) == (_mask))
void cds_set_driver_state(enum cds_driver_state);
void cds_clear_driver_state(enum cds_driver_state);
enum cds_driver_state cds_get_driver_state(void);
/**
* cds_is_driver_loading() - Is driver load in progress
*
* Return: true if driver is loading and false otherwise.
*/
static inline bool cds_is_driver_loading(void)
{
enum cds_driver_state state = cds_get_driver_state();
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING);
}
/**
* cds_is_driver_unloading() - Is driver unload in progress
*
* Return: true if driver is unloading and false otherwise.
*/
static inline bool cds_is_driver_unloading(void)
{
enum cds_driver_state state = cds_get_driver_state();
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING);
}
/**
* cds_is_driver_recovering() - Is recovery in progress
*
* Return: true if recovery in progress and false otherwise.
*/
static inline bool cds_is_driver_recovering(void)
{
enum cds_driver_state state = cds_get_driver_state();
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_RECOVERING);
}
/**
* cds_is_load_or_unload_in_progress() - Is driver load OR unload in progress
*
* Return: true if driver is loading OR unloading and false otherwise.
*/
static inline bool cds_is_load_or_unload_in_progress(void)
{
enum cds_driver_state state = cds_get_driver_state();
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING) ||
__CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING);
}
/**
* cds_set_recovery_in_progress() - Set recovery in progress
* @value: value to set
*
* Return: none
*/
static inline void cds_set_recovery_in_progress(uint8_t value)
{
if (value)
cds_set_driver_state(CDS_DRIVER_STATE_RECOVERING);
else
cds_clear_driver_state(CDS_DRIVER_STATE_RECOVERING);
}
/**
* cds_set_load_in_progress() - Set load in progress
* @value: value to set
*
* Return: none
*/
static inline void cds_set_load_in_progress(uint8_t value)
{
if (value)
cds_set_driver_state(CDS_DRIVER_STATE_LOADING);
else
cds_clear_driver_state(CDS_DRIVER_STATE_LOADING);
}
/**
* cds_set_driver_loaded() - Set load completed
* @value: value to set
*
* Return: none
*/
static inline void cds_set_driver_loaded(uint8_t value)
{
if (value)
cds_set_driver_state(CDS_DRIVER_STATE_LOADED);
else
cds_clear_driver_state(CDS_DRIVER_STATE_LOADED);
}
/**
* cds_set_unload_in_progress() - Set unload in progress
* @value: value to set
*
* Return: none
*/
static inline void cds_set_unload_in_progress(uint8_t value)
{
if (value)
cds_set_driver_state(CDS_DRIVER_STATE_UNLOADING);
else
cds_clear_driver_state(CDS_DRIVER_STATE_UNLOADING);
}
v_CONTEXT_t cds_init(void);
void cds_deinit(void);
CDF_STATUS cds_pre_enable(v_CONTEXT_t cds_context);
CDF_STATUS cds_open(void);
CDF_STATUS cds_enable(v_CONTEXT_t cds_context);
CDF_STATUS cds_disable(v_CONTEXT_t cds_context);
CDF_STATUS cds_close(v_CONTEXT_t cds_context);
CDF_STATUS cds_shutdown(v_CONTEXT_t cds_context);
void cds_core_return_msg(void *pVContext, p_cds_msg_wrapper pMsgWrapper);
void *cds_get_context(CDF_MODULE_ID moduleId);
v_CONTEXT_t cds_get_global_context(void);
CDF_STATUS cds_alloc_context(void *p_cds_context, CDF_MODULE_ID moduleID,
void **ppModuleContext, uint32_t size);
CDF_STATUS cds_free_context(void *p_cds_context, CDF_MODULE_ID moduleID,
void *pModuleContext);
CDF_STATUS cds_get_vdev_types(enum tCDF_ADAPTER_MODE mode, uint32_t *type,
uint32_t *subType);
void cds_flush_work(void *work);
void cds_flush_delayed_work(void *dwork);
bool cds_is_packet_log_enabled(void);
uint64_t cds_get_monotonic_boottime(void);
void cds_trigger_recovery(void);
void cds_set_wakelock_logging(bool value);
bool cds_is_wakelock_enabled(void);
void cds_set_ring_log_level(uint32_t ring_id, uint32_t log_level);
enum wifi_driver_log_level cds_get_ring_log_level(uint32_t ring_id);
void cds_set_multicast_logging(uint8_t value);
uint8_t cds_is_multicast_logging(void);
CDF_STATUS cds_set_log_completion(uint32_t is_fatal,
uint32_t type,
uint32_t sub_type);
void cds_get_log_completion(uint32_t *is_fatal,
uint32_t *type,
uint32_t *sub_type);
bool cds_is_log_report_in_progress(void);
void cds_init_log_completion(void);
void cds_deinit_log_completion(void);
CDF_STATUS cds_flush_logs(uint32_t is_fatal,
uint32_t indicator,
uint32_t reason_code);
void cds_logging_set_fw_flush_complete(void);
#endif /* if !defined __CDS_API_H */

View File

@@ -1,657 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __CDS_CONCURRENCY_H
#define __CDS_CONCURRENCY_H
/**
* DOC: cds_concurrency.h
*
* CDS Concurrenct Connection Management entity
*/
/* Include files */
#include "wlan_hdd_main.h"
#define MAX_NUMBER_OF_CONC_CONNECTIONS 3
#define MAX_NUM_CHAN 128
#define DBS_OPPORTUNISTIC_TIME 10
#define CONNECTION_UPDATE_TIMEOUT 500
/**
* enum cds_chain_mode - Chain Mask tx & rx combination.
*
* @CDS_ONE_ONE: One for Tx, One for Rx
* @CDS_TWO_TWO: Two for Tx, Two for Rx
* @CDS_MAX_NO_OF_CHAIN_MODE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_chain_mode {
CDS_ONE_ONE = 0,
CDS_TWO_TWO,
CDS_MAX_NO_OF_CHAIN_MODE
};
/**
* enum cds_conc_priority_mode - t/p, powersave, latency.
*
* @CDS_THROUGHPUT: t/p is the priority
* @CDS_POWERSAVE: powersave is the priority
* @CDS_LATENCY: latency is the priority
* @CDS_MAX_CONC_PRIORITY_MODE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_conc_priority_mode {
CDS_THROUGHPUT = 0,
CDS_POWERSAVE,
CDS_LATENCY,
CDS_MAX_CONC_PRIORITY_MODE
};
/**
* enum cds_con_mode - concurrency mode for PCL table
*
* @CDS_STA_MODE: station mode
* @CDS_SAP_MODE: SAP mode
* @CDS_P2P_CLIENT_MODE: P2P client mode
* @CDS_P2P_GO_MODE: P2P Go mode
* @CDS_IBSS_MODE: IBSS mode
* @CDS_MAX_NUM_OF_MODE: max value place holder
*/
enum cds_con_mode {
CDS_STA_MODE = 0,
CDS_SAP_MODE,
CDS_P2P_CLIENT_MODE,
CDS_P2P_GO_MODE,
CDS_IBSS_MODE,
CDS_MAX_NUM_OF_MODE
};
/**
* enum cds_pcl_type - Various types of Preferred channel list (PCL).
*
* @CDS_NONE: No channel preference
* @CDS_24G: 2.4 Ghz channels only
* @CDS_5G: 5 Ghz channels only
* @CDS_SCC_CH: SCC channel only
* @CDS_MCC_CH: MCC channels only
* @CDS_SCC_CH_24G: SCC channel & 2.4 Ghz channels
* @CDS_SCC_CH_5G: SCC channel & 5 Ghz channels
* @CDS_24G_SCC_CH: 2.4 Ghz channels & SCC channel
* @CDS_5G_SCC_CH: 5 Ghz channels & SCC channel
* @CDS_SCC_ON_5_SCC_ON_24_24G: SCC channel on 5 Ghz, SCC
* channel on 2.4 Ghz & 2.4 Ghz channels
* @CDS_SCC_ON_5_SCC_ON_24_5G: SCC channel on 5 Ghz, SCC channel
* on 2.4 Ghz & 5 Ghz channels
* @CDS_SCC_ON_24_SCC_ON_5_24G: SCC channel on 2.4 Ghz, SCC
* channel on 5 Ghz & 2.4 Ghz channels
* @CDS_SCC_ON_24_SCC_ON_5_5G: SCC channel on 2.4 Ghz, SCC
* channel on 5 Ghz & 5 Ghz channels
* @CDS_SCC_ON_5_SCC_ON_24: SCC channel on 5 Ghz, SCC channel on
* 2.4 Ghz
* @CDS_SCC_ON_24_SCC_ON_5: SCC channel on 2.4 Ghz, SCC channel
* on 5 Ghz
* @CDS_MCC_CH_24G: MCC channels & 2.4 Ghz channels
* @CDS_MCC_CH_5G: MCC channels & 5 Ghz channels
* @CDS_24G_MCC_CH: 2.4 Ghz channels & MCC channels
* @CDS_5G_MCC_CH: 5 Ghz channels & MCC channels
* @CDS_MAX_PCL_TYPE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_pcl_type {
CDS_NONE = 0,
CDS_24G,
CDS_5G,
CDS_SCC_CH,
CDS_MCC_CH,
CDS_SCC_CH_24G,
CDS_SCC_CH_5G,
CDS_24G_SCC_CH,
CDS_5G_SCC_CH,
CDS_SCC_ON_5_SCC_ON_24_24G,
CDS_SCC_ON_5_SCC_ON_24_5G,
CDS_SCC_ON_24_SCC_ON_5_24G,
CDS_SCC_ON_24_SCC_ON_5_5G,
CDS_SCC_ON_5_SCC_ON_24,
CDS_SCC_ON_24_SCC_ON_5,
CDS_MCC_CH_24G,
CDS_MCC_CH_5G,
CDS_24G_MCC_CH,
CDS_5G_MCC_CH,
CDS_MAX_PCL_TYPE
};
/**
* enum cds_one_connection_mode - Combination of first connection
* type, band & spatial stream used.
*
* @CDS_STA_24_1x1: STA connection using 1x1@2.4 Ghz
* @CDS_STA_24_2x2: STA connection using 2x2@2.4 Ghz
* @CDS_STA_5_1x1: STA connection using 1x1@5 Ghz
* @CDS_STA_5_2x2: STA connection using 2x2@5 Ghz
* @CDS_P2P_CLI_24_1x1: P2P Client connection using 1x1@2.4 Ghz
* @CDS_P2P_CLI_24_2x2: P2P Client connection using 2x2@2.4 Ghz
* @CDS_P2P_CLI_5_1x1: P2P Client connection using 1x1@5 Ghz
* @CDS_P2P_CLI_5_2x2: P2P Client connection using 2x2@5 Ghz
* @CDS_P2P_GO_24_1x1: P2P GO connection using 1x1@2.4 Ghz
* @CDS_P2P_GO_24_2x2: P2P GO connection using 2x2@2.4 Ghz
* @CDS_P2P_GO_5_1x1: P2P GO connection using 1x1@5 Ghz
* @CDS_P2P_GO_5_2x2: P2P GO connection using 2x2@5 Ghz
* @CDS_SAP_24_1x1: SAP connection using 1x1@2.4 Ghz
* @CDS_SAP_24_2x2: SAP connection using 2x2@2.4 Ghz
* @CDS_SAP_5_1x1: SAP connection using 1x1@5 Ghz
* @CDS_SAP_5_1x1: SAP connection using 2x2@5 Ghz
* @CDS_IBSS_24_1x1: IBSS connection using 1x1@2.4 Ghz
* @CDS_IBSS_24_2x2: IBSS connection using 2x2@2.4 Ghz
* @CDS_IBSS_5_1x1: IBSS connection using 1x1@5 Ghz
* @CDS_IBSS_5_2x2: IBSS connection using 2x2@5 Ghz
* @CDS_MAX_ONE_CONNECTION_MODE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_one_connection_mode {
CDS_STA_24_1x1 = 0,
CDS_STA_24_2x2,
CDS_STA_5_1x1,
CDS_STA_5_2x2,
CDS_P2P_CLI_24_1x1,
CDS_P2P_CLI_24_2x2,
CDS_P2P_CLI_5_1x1,
CDS_P2P_CLI_5_2x2,
CDS_P2P_GO_24_1x1,
CDS_P2P_GO_24_2x2,
CDS_P2P_GO_5_1x1,
CDS_P2P_GO_5_2x2,
CDS_SAP_24_1x1,
CDS_SAP_24_2x2,
CDS_SAP_5_1x1,
CDS_SAP_5_2x2,
CDS_IBSS_24_1x1,
CDS_IBSS_24_2x2,
CDS_IBSS_5_1x1,
CDS_IBSS_5_2x2,
CDS_MAX_ONE_CONNECTION_MODE
};
/**
* enum cds_two_connection_mode - Combination of first two
* connections type, concurrency state, band & spatial stream
* used.
*
* @CDS_STA_SAP_SCC_24_1x1: STA & SAP connection on SCC using
* 1x1@2.4 Ghz
* @CDS_STA_SAP_SCC_24_2x2: STA & SAP connection on SCC using
* 2x2@2.4 Ghz
* @CDS_STA_SAP_MCC_24_1x1: STA & SAP connection on MCC using
* 1x1@2.4 Ghz
* @CDS_STA_SAP_MCC_24_2x2: STA & SAP connection on MCC using
* 2x2@2.4 Ghz
* @CDS_STA_SAP_SCC_5_1x1: STA & SAP connection on SCC using
* 1x1@5 Ghz
* @CDS_STA_SAP_SCC_5_2x2: STA & SAP connection on SCC using
* 2x2@5 Ghz
* @CDS_STA_SAP_MCC_5_1x1: STA & SAP connection on MCC using
* 1x1@5 Ghz
* @CDS_STA_SAP_MCC_5_2x2: STA & SAP connection on MCC using
* 2x2@5 Ghz
* @CDS_STA_SAP_DBS_1x1,: STA & SAP connection on DBS using 1x1
* @CDS_STA_P2P_GO_SCC_24_1x1: STA & P2P GO connection on SCC
* using 1x1@2.4 Ghz
* @CDS_STA_P2P_GO_SCC_24_2x2: STA & P2P GO connection on SCC
* using 2x2@2.4 Ghz
* @CDS_STA_P2P_GO_MCC_24_1x1: STA & P2P GO connection on MCC
* using 1x1@2.4 Ghz
* @CDS_STA_P2P_GO_MCC_24_2x2: STA & P2P GO connection on MCC
* using 2x2@2.4 Ghz
* @CDS_STA_P2P_GO_SCC_5_1x1: STA & P2P GO connection on SCC
* using 1x1@5 Ghz
* @CDS_STA_P2P_GO_SCC_5_2x2: STA & P2P GO connection on SCC
* using 2x2@5 Ghz
* @CDS_STA_P2P_GO_MCC_5_1x1: STA & P2P GO connection on MCC
* using 1x1@5 Ghz
* @CDS_STA_P2P_GO_MCC_5_2x2: STA & P2P GO connection on MCC
* using 2x2@5 Ghz
* @CDS_STA_P2P_GO_DBS_1x1: STA & P2P GO connection on DBS using
* 1x1
* @CDS_STA_P2P_CLI_SCC_24_1x1: STA & P2P CLI connection on SCC
* using 1x1@2.4 Ghz
* @CDS_STA_P2P_CLI_SCC_24_2x2: STA & P2P CLI connection on SCC
* using 2x2@2.4 Ghz
* @CDS_STA_P2P_CLI_MCC_24_1x1: STA & P2P CLI connection on MCC
* using 1x1@2.4 Ghz
* @CDS_STA_P2P_CLI_MCC_24_2x2: STA & P2P CLI connection on MCC
* using 2x2@2.4 Ghz
* @CDS_STA_P2P_CLI_SCC_5_1x1: STA & P2P CLI connection on SCC
* using 1x1@5 Ghz
* @CDS_STA_P2P_CLI_SCC_5_2x2: STA & P2P CLI connection on SCC
* using 2x2@5 Ghz
* @CDS_STA_P2P_CLI_MCC_5_1x1: STA & P2P CLI connection on MCC
* using 1x1@5 Ghz
* @CDS_STA_P2P_CLI_MCC_5_2x2: STA & P2P CLI connection on MCC
* using 2x2@5 Ghz
* @CDS_STA_P2P_CLI_DBS_1x1: STA & P2P CLI connection on DBS
* using 1x1
* @CDS_P2P_GO_P2P_CLI_SCC_24_1x1: P2P GO & CLI connection on
* SCC using 1x1@2.4 Ghz
* @CDS_P2P_GO_P2P_CLI_SCC_24_2x2: P2P GO & CLI connection on
* SCC using 2x2@2.4 Ghz
* @CDS_P2P_GO_P2P_CLI_MCC_24_1x1: P2P GO & CLI connection on
* MCC using 1x1@2.4 Ghz
* @CDS_P2P_GO_P2P_CLI_MCC_24_2x2: P2P GO & CLI connection on
* MCC using 2x2@2.4 Ghz
* @CDS_P2P_GO_P2P_CLI_SCC_5_1x1: P2P GO & CLI connection on
* SCC using 1x1@5 Ghz
* @CDS_P2P_GO_P2P_CLI_SCC_5_2x2: P2P GO & CLI connection on
* SCC using 2x2@5 Ghz
* @CDS_P2P_GO_P2P_CLI_MCC_5_1x1: P2P GO & CLI connection on
* MCC using 1x1@5 Ghz
* @CDS_P2P_GO_P2P_CLI_MCC_5_2x2: P2P GO & CLI connection on
* MCC using 2x2@5 Ghz
* @CDS_P2P_GO_P2P_CLI_DBS_1x1: P2P GO & CLI connection on DBS
* using 1x1
* @CDS_P2P_GO_SAP_SCC_24_1x1: P2P GO & SAP connection on
* SCC using 1x1@2.4 Ghz
* @CDS_P2P_GO_SAP_SCC_24_2x2: P2P GO & SAP connection on
* SCC using 2x2@2.4 Ghz
* @CDS_P2P_GO_SAP_MCC_24_1x1: P2P GO & SAP connection on
* MCC using 1x1@2.4 Ghz
* @CDS_P2P_GO_SAP_MCC_24_2x2: P2P GO & SAP connection on
* MCC using 2x2@2.4 Ghz
* @CDS_P2P_GO_SAP_SCC_5_1x1: P2P GO & SAP connection on
* SCC using 1x1@5 Ghz
* @CDS_P2P_GO_SAP_SCC_5_2x2: P2P GO & SAP connection on
* SCC using 2x2@5 Ghz
* @CDS_P2P_GO_SAP_MCC_5_1x1: P2P GO & SAP connection on
* MCC using 1x1@5 Ghz
* @CDS_P2P_GO_SAP_MCC_5_2x2: P2P GO & SAP connection on
* MCC using 2x2@5 Ghz
* @CDS_P2P_GO_SAP_DBS_1x1: P2P GO & SAP connection on DBS using
* 1x1
* @CDS_P2P_CLI_SAP_SCC_24_1x1: CLI & SAP connection on SCC using
* 1x1@2.4 Ghz
* @CDS_P2P_CLI_SAP_SCC_24_2x2: CLI & SAP connection on SCC using
* 2x2@2.4 Ghz
* @CDS_P2P_CLI_SAP_MCC_24_1x1: CLI & SAP connection on MCC using
* 1x1@2.4 Ghz
* @CDS_P2P_CLI_SAP_MCC_24_2x2: CLI & SAP connection on MCC using
* 2x2@2.4 Ghz
* @CDS_P2P_CLI_SAP_SCC_5_1x1: CLI & SAP connection on SCC using
* 1x1@5 Ghz
* @CDS_P2P_CLI_SAP_SCC_5_2x2: CLI & SAP connection on SCC using
* 2x2@5 Ghz
* @CDS_P2P_CLI_SAP_MCC_5_1x1: CLI & SAP connection on MCC using
* 1x1@5 Ghz
* @CDS_P2P_CLI_SAP_MCC_5_2x2: CLI & SAP connection on MCC using
* 2x2@5 Ghz
* @CDS_P2P_STA_SAP_MCC_24_5_1x1: CLI and SAP connecting on MCC
* in 2.4 and 5GHz 1x1
* @CDS_P2P_STA_SAP_MCC_24_5_2x2: CLI and SAP connecting on MCC
in 2.4 and 5GHz 2x2
* @CDS_P2P_CLI_SAP_DBS_1x1,: CLI & SAP connection on DBS using 1x1
* @CDS_MAX_TWO_CONNECTION_MODE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_two_connection_mode {
CDS_STA_SAP_SCC_24_1x1 = 0,
CDS_STA_SAP_SCC_24_2x2,
CDS_STA_SAP_MCC_24_1x1,
CDS_STA_SAP_MCC_24_2x2,
CDS_STA_SAP_SCC_5_1x1,
CDS_STA_SAP_SCC_5_2x2,
CDS_STA_SAP_MCC_5_1x1,
CDS_STA_SAP_MCC_5_2x2,
CDS_STA_SAP_MCC_24_5_1x1,
CDS_STA_SAP_MCC_24_5_2x2,
CDS_STA_SAP_DBS_1x1,
CDS_STA_P2P_GO_SCC_24_1x1,
CDS_STA_P2P_GO_SCC_24_2x2,
CDS_STA_P2P_GO_MCC_24_1x1,
CDS_STA_P2P_GO_MCC_24_2x2,
CDS_STA_P2P_GO_SCC_5_1x1,
CDS_STA_P2P_GO_SCC_5_2x2,
CDS_STA_P2P_GO_MCC_5_1x1,
CDS_STA_P2P_GO_MCC_5_2x2,
CDS_STA_P2P_GO_MCC_24_5_1x1,
CDS_STA_P2P_GO_MCC_24_5_2x2,
CDS_STA_P2P_GO_DBS_1x1,
CDS_STA_P2P_CLI_SCC_24_1x1,
CDS_STA_P2P_CLI_SCC_24_2x2,
CDS_STA_P2P_CLI_MCC_24_1x1,
CDS_STA_P2P_CLI_MCC_24_2x2,
CDS_STA_P2P_CLI_SCC_5_1x1,
CDS_STA_P2P_CLI_SCC_5_2x2,
CDS_STA_P2P_CLI_MCC_5_1x1,
CDS_STA_P2P_CLI_MCC_5_2x2,
CDS_STA_P2P_CLI_MCC_24_5_1x1,
CDS_STA_P2P_CLI_MCC_24_5_2x2,
CDS_STA_P2P_CLI_DBS_1x1,
CDS_P2P_GO_P2P_CLI_SCC_24_1x1,
CDS_P2P_GO_P2P_CLI_SCC_24_2x2,
CDS_P2P_GO_P2P_CLI_MCC_24_1x1,
CDS_P2P_GO_P2P_CLI_MCC_24_2x2,
CDS_P2P_GO_P2P_CLI_SCC_5_1x1,
CDS_P2P_GO_P2P_CLI_SCC_5_2x2,
CDS_P2P_GO_P2P_CLI_MCC_5_1x1,
CDS_P2P_GO_P2P_CLI_MCC_5_2x2,
CDS_P2P_GO_P2P_CLI_MCC_24_5_1x1,
CDS_P2P_GO_P2P_CLI_MCC_24_5_2x2,
CDS_P2P_GO_P2P_CLI_DBS_1x1,
CDS_P2P_GO_SAP_SCC_24_1x1,
CDS_P2P_GO_SAP_SCC_24_2x2,
CDS_P2P_GO_SAP_MCC_24_1x1,
CDS_P2P_GO_SAP_MCC_24_2x2,
CDS_P2P_GO_SAP_SCC_5_1x1,
CDS_P2P_GO_SAP_SCC_5_2x2,
CDS_P2P_GO_SAP_MCC_5_1x1,
CDS_P2P_GO_SAP_MCC_5_2x2,
CDS_P2P_GO_SAP_MCC_24_5_1x1,
CDS_P2P_GO_SAP_MCC_24_5_2x2,
CDS_P2P_GO_SAP_DBS_1x1,
CDS_P2P_CLI_SAP_SCC_24_1x1,
CDS_P2P_CLI_SAP_SCC_24_2x2,
CDS_P2P_CLI_SAP_MCC_24_1x1,
CDS_P2P_CLI_SAP_MCC_24_2x2,
CDS_P2P_CLI_SAP_SCC_5_1x1,
CDS_P2P_CLI_SAP_SCC_5_2x2,
CDS_P2P_CLI_SAP_MCC_5_1x1,
CDS_P2P_CLI_SAP_MCC_5_2x2,
CDS_P2P_CLI_SAP_MCC_24_5_1x1,
CDS_P2P_CLI_SAP_MCC_24_5_2x2,
CDS_P2P_CLI_SAP_DBS_1x1,
CDS_MAX_TWO_CONNECTION_MODE
};
/**
* enum cds_conc_next_action - actions to be taken on old
* connections.
*
* @CDS_NOP: No action
* @CDS_DBS: switch to DBS mode
* @CDS_DBS_DOWNGRADE: switch to DBS mode & downgrade to 1x1
* @CDS_MCC: switch to MCC/SCC mode
* @CDS_MCC_UPGRADE: switch to MCC/SCC mode & upgrade to 2x2
* @CDS_MAX_CONC_PRIORITY_MODE: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_conc_next_action {
CDS_NOP = 0,
CDS_DBS,
CDS_DBS_DOWNGRADE,
CDS_MCC,
CDS_MCC_UPGRADE,
CDS_MAX_CONC_NEXT_ACTION
};
/**
* enum cds_band - wifi band.
*
* @CDS_BAND_24: 2.4 Ghz band
* @CDS_BAND_5: 5 Ghz band
* @CDS_MAX_BAND: Max place holder
*
* These are generic IDs that identify the various roles
* in the software system
*/
enum cds_band {
CDS_BAND_24 = 0,
CDS_BAND_5,
CDS_MAX_BAND
};
/**
* struct cds_conc_connection_info - information of all existing
* connections in the wlan system
*
* @mode: connection type
* @chan: channel of the connection
* @mac: The HW mac it is running
* @tx_spatial_stream: Tx spatial stream used by the connection
* @rx_spatial_stream: Tx spatial stream used by the connection
* @original_nss: nss negotiated at connection time
* @vdev_id: vdev id of the connection
* @in_use: if the table entry is active
*/
struct cds_conc_connection_info {
enum cds_con_mode mode;
uint8_t chan;
uint8_t mac;
enum cds_chain_mode chain_mask;
uint8_t tx_spatial_stream;
uint8_t rx_spatial_stream;
uint32_t original_nss;
uint32_t vdev_id;
bool in_use;
};
bool cds_is_connection_in_progress(void);
void cds_dump_concurrency_info(void);
void cds_set_concurrency_mode(enum tCDF_ADAPTER_MODE mode);
void cds_clear_concurrency_mode(enum tCDF_ADAPTER_MODE mode);
uint32_t cds_get_connection_count(void);
bool cds_is_sta_connection_pending(void);
void cds_change_sta_conn_pending_status(bool value);
void cds_change_sap_restart_required_status(bool value);
bool cds_set_connection_in_progress(bool value);
int cds_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
uint32_t cds_get_concurrency_mode(void);
CDF_STATUS cds_check_and_restart_sap(eCsrRoamResult roam_result,
hdd_station_ctx_t *hdd_sta_ctx);
void cds_handle_conc_rule1(hdd_adapter_t *adapter,
tCsrRoamProfile *roam_profile);
#ifdef FEATURE_WLAN_CH_AVOID
bool cds_handle_conc_rule2(hdd_adapter_t *adapter,
tCsrRoamProfile *roam_profile,
uint32_t *roam_id);
#else
static inline bool cds_handle_conc_rule2(hdd_adapter_t *adapter,
tCsrRoamProfile *roam_profile,
uint32_t *roam_id)
{
return true;
}
#endif /* FEATURE_WLAN_CH_AVOID */
uint8_t cds_search_and_check_for_session_conc(uint8_t session_id,
tCsrRoamProfile * roam_profile);
bool cds_check_for_session_conc(uint8_t session_id, uint8_t channel);
CDF_STATUS cds_handle_conc_multiport(uint8_t session_id, uint8_t channel);
#ifdef FEATURE_WLAN_FORCE_SAP_SCC
void cds_force_sap_on_scc(eCsrRoamResult roam_result,
uint8_t channel_id);
#else
static inline void cds_force_sap_on_scc(eCsrRoamResult roam_result,
uint8_t channel_id)
{
}
#endif /* FEATURE_WLAN_FORCE_SAP_SCC */
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
void cds_check_concurrent_intf_and_restart_sap(
hdd_station_ctx_t *hdd_sta_ctx,
hdd_adapter_t *adapter);
#else
static inline void cds_check_concurrent_intf_and_restart_sap(
hdd_station_ctx_t *hdd_sta_ctx,
hdd_adapter_t *adapter)
{
}
#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
uint8_t cds_is_mcc_in_24G(void);
int32_t cds_set_mas(hdd_adapter_t *adapter, uint8_t mas_value);
int cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
uint32_t set_value);
CDF_STATUS cds_change_mcc_go_beacon_interval(hdd_adapter_t *pHostapdAdapter);
int cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
uint32_t set_value);
void cds_set_mcc_latency(hdd_adapter_t *adapter, int set_value);
#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
void cds_restart_sap(hdd_adapter_t *ap_adapter);
#else
static inline void cds_restart_sap(hdd_adapter_t *ap_adapter)
{
}
#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH ||
* FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
*/
#ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
void cds_check_and_restart_sap_with_non_dfs_acs(void);
#else
static inline void cds_check_and_restart_sap_with_non_dfs_acs(void)
{
}
#endif /* FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE */
void cds_incr_active_session(enum tCDF_ADAPTER_MODE mode,
uint8_t sessionId);
void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
uint8_t sessionId);
void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
uint8_t session_id);
CDF_STATUS cds_init_policy_mgr(void);
CDF_STATUS cds_deinit_policy_mgr(void);
CDF_STATUS cds_get_pcl(enum cds_con_mode mode,
uint8_t *pcl_Channels, uint32_t *len);
bool cds_allow_concurrency(enum cds_con_mode mode,
uint8_t channel, enum hw_mode_bandwidth bw);
enum cds_conc_priority_mode cds_get_first_connection_pcl_table_index(void);
enum cds_one_connection_mode cds_get_second_connection_pcl_table_index(void);
enum cds_two_connection_mode cds_get_third_connection_pcl_table_index(void);
CDF_STATUS cds_incr_connection_count(uint32_t vdev_id);
CDF_STATUS cds_update_connection_info(uint32_t vdev_id);
CDF_STATUS cds_decr_connection_count(uint32_t vdev_id);
CDF_STATUS cds_current_connections_update(uint32_t session_id,
uint8_t channel,
enum cds_conn_update_reason);
bool cds_is_ibss_conn_exist(uint8_t *ibss_channel);
#ifdef MPC_UT_FRAMEWORK
CDF_STATUS cds_incr_connection_count_utfw(
uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t channelid, uint32_t mac_id);
CDF_STATUS cds_update_connection_info_utfw(
uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t channelid, uint32_t mac_id);
CDF_STATUS cds_decr_connection_count_utfw(
uint32_t del_all, uint32_t vdev_id);
struct cds_conc_connection_info *cds_get_conn_info(uint32_t *len);
enum cds_pcl_type get_pcl_from_first_conn_table(enum cds_con_mode type,
enum cds_conc_priority_mode sys_pref);
enum cds_pcl_type get_pcl_from_second_conn_table(
enum cds_one_connection_mode idx, enum cds_con_mode type,
enum cds_conc_priority_mode sys_pref, uint8_t dbs_capable);
enum cds_pcl_type get_pcl_from_third_conn_table(
enum cds_two_connection_mode idx, enum cds_con_mode type,
enum cds_conc_priority_mode sys_pref, uint8_t dbs_capable);
#else
static inline CDF_STATUS cds_incr_connection_count_utfw(uint32_t vdev_id,
uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t channelid, uint32_t mac_id)
{
return CDF_STATUS_SUCCESS;
}
static inline CDF_STATUS cds_update_connection_info_utfw(uint32_t vdev_id,
uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t channelid, uint32_t mac_id)
{
return CDF_STATUS_SUCCESS;
}
static inline CDF_STATUS cds_decr_connection_count_utfw(uint32_t del_all,
uint32_t vdev_id)
{
return CDF_STATUS_SUCCESS;
}
static inline struct cds_conc_connection_info *cds_get_conn_info(uint32_t *len)
{
return NULL;
}
#endif
enum cds_con_mode cds_convert_device_mode_to_hdd_type(
device_mode_t device_mode);
CDF_STATUS cds_soc_set_hw_mode(uint32_t session_id,
enum hw_mode_ss_config mac0_ss,
enum hw_mode_bandwidth mac0_bw,
enum hw_mode_ss_config mac1_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum cds_conn_update_reason reason);
enum cds_conc_next_action cds_need_opportunistic_upgrade(void);
CDF_STATUS cds_next_actions(uint32_t session_id,
enum cds_conc_next_action action,
enum cds_conn_update_reason reason);
void cds_set_dual_mac_scan_config(uint8_t dbs_val,
uint8_t dbs_plus_agile_scan_val,
uint8_t single_mac_scan_with_dbs_val);
void cds_set_dual_mac_fw_mode_config(uint8_t dbs,
uint8_t dfs);
void cds_soc_set_dual_mac_cfg_cb(enum set_hw_mode_status status,
uint32_t scan_config,
uint32_t fw_mode_config);
bool cds_map_concurrency_mode(enum tCDF_ADAPTER_MODE *old_mode,
enum cds_con_mode *new_mode);
CDF_STATUS cds_get_channel_from_scan_result(hdd_adapter_t *adapter,
tCsrRoamProfile *roam_profile, uint8_t *channel);
enum tCDF_GLOBAL_CON_MODE cds_get_conparam(void);
bool cds_concurrent_open_sessions_running(void);
bool cds_max_concurrent_connections_reached(void);
void cds_clear_concurrent_session_count(void);
bool cds_is_multiple_active_sta_sessions(void);
bool cds_is_sta_active_connection_exists(void);
bool cds_concurrent_beaconing_sessions_running(void);
CDF_STATUS cdf_wait_for_connection_update(void);
CDF_STATUS cdf_reset_connection_update(void);
CDF_STATUS cdf_set_connection_update(void);
CDF_STATUS cdf_init_connection_update(void);
#endif /* __CDS_CONCURRENCY_H */

View File

@@ -1,182 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(__CDS_CRYPTO_H)
#define __CDS_CRYPTO_H
/**
* DOC: cds_crypto.h
*
* Crypto APIs
*
*/
#include <cdf_types.h>
#include <cdf_status.h>
#include <cdf_memory.h>
#include <cdf_list.h>
#include <cdf_trace.h>
#include <cdf_event.h>
#include <cdf_lock.h>
#include <cds_reg_service.h>
#include <cds_mq.h>
#include <cds_packet.h>
#include <cds_sched.h>
#include <cdf_threads.h>
#include <cdf_mc_timer.h>
#include <cds_pack_align.h>
#include <crypto/aes.h>
#include <crypto/hash.h>
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#include <linux/qcomwlan_secif.h>
#endif
#ifdef CONFIG_CNSS
static inline struct crypto_ahash *cds_crypto_alloc_ahash(const char *alg_name,
u32 type, u32 mask)
{
return wcnss_wlan_crypto_alloc_ahash(alg_name, type, mask);
}
#else
static inline struct crypto_ahash *cds_crypto_alloc_ahash(const char *alg_name,
u32 type, u32 mask)
{
return crypto_alloc_ahash(alg_name, type, mask);
}
#endif
#ifdef CONFIG_CNSS
static inline struct crypto_cipher *
cds_crypto_alloc_cipher(const char *alg_name, u32 type, u32 mask)
{
return wcnss_wlan_crypto_alloc_cipher(alg_name, type, mask);
}
#else
static inline struct crypto_cipher *
cds_crypto_alloc_cipher(const char *alg_name, u32 type, u32 mask)
{
return crypto_alloc_cipher(alg_name, type, mask);
}
#endif
#ifdef CONFIG_CNSS
static inline void cds_cmac_calc_mic(struct crypto_cipher *tfm, u8 *m,
u16 length, u8 *mac)
{
wcnss_wlan_cmac_calc_mic(tfm, m, length, mac);
}
#endif
#ifdef CONFIG_CNSS
static inline void cds_crypto_free_cipher(struct crypto_cipher *tfm)
{
wcnss_wlan_crypto_free_cipher(tfm);
}
#else
static inline void cds_crypto_free_cipher(struct crypto_cipher *tfm)
{
crypto_free_cipher(tfm);
}
#endif
#ifdef CONFIG_CNSS
static inline void cds_crypto_free_ahash(struct crypto_ahash *tfm)
{
wcnss_wlan_crypto_free_ahash(tfm);
}
#else
static inline void cds_crypto_free_ahash(struct crypto_ahash *tfm)
{
crypto_free_ahash(tfm);
}
#endif
#ifdef CONFIG_CNSS
static inline int cds_crypto_ahash_setkey(struct crypto_ahash *tfm,
const u8 *key, unsigned int keylen)
{
return wcnss_wlan_crypto_ahash_setkey(tfm, key, keylen);
}
#else
static inline int cds_crypto_ahash_setkey(struct crypto_ahash *tfm,
const u8 *key, unsigned int keylen)
{
return crypto_ahash_setkey(tfm, key, keylen);
}
#endif
#ifdef CONFIG_CNSS
static inline int cds_crypto_ahash_digest(struct ahash_request *req)
{
return wcnss_wlan_crypto_ahash_digest(req);
}
#else
static inline int cds_crypto_ahash_digest(struct ahash_request *req)
{
return crypto_ahash_digest(req);
}
#endif
#ifdef CONFIG_CNSS
static inline struct crypto_ablkcipher *
cds_crypto_alloc_ablkcipher(const char *alg_name, u32 type, u32 mask)
{
return wcnss_wlan_crypto_alloc_ablkcipher(alg_name, type, mask);
}
#else
static inline struct crypto_ablkcipher *
cds_crypto_alloc_ablkcipher(const char *alg_name, u32 type, u32 mask)
{
return crypto_alloc_ablkcipher(alg_name, type, mask);
}
#endif
#ifdef CONFIG_CNSS
static inline void cds_ablkcipher_request_free(struct ablkcipher_request *req)
{
wcnss_wlan_ablkcipher_request_free(req);
}
#else
static inline void cds_ablkcipher_request_free(struct ablkcipher_request *req)
{
ablkcipher_request_free(req);
}
#endif
#ifdef CONFIG_CNSS
static inline void cds_crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
{
wcnss_wlan_crypto_free_ablkcipher(tfm);
}
#else
static inline void cds_crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
{
crypto_free_ablkcipher(tfm);
}
#endif
#endif /* if !defined __CDS_CRYPTO_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,238 +0,0 @@
/*
* Copyright (c) 2011, 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* #ifndef _NET_IF_ETHERSUBR_H_ */
/* #define _NET_IF_ETHERSUBR_H_ */
#ifndef _NET_IF_UPPERPROTO_H_
#define _NET_IF_UPPERPROTO_H_
#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
#define ETHER_TYPE_LEN 2 /* length of the Ethernet type field */
#define ETHER_CRC_LEN 4 /* length of the Ethernet CRC */
#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
#define ETHER_MAX_LEN 1518
#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
/*
* Structure of a 10Mb/s Ethernet header.
*/
#ifndef _NET_ETHERNET_H_
struct ether_header {
uint8_t ether_dhost[ETHER_ADDR_LEN];
uint8_t ether_shost[ETHER_ADDR_LEN];
uint16_t ether_type;
} __packed;
#endif
#ifndef ETHERTYPE_PAE
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
#endif
#ifndef ETHERTYPE_IP
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#endif
#ifndef ETHERTYPE_AARP
#define ETHERTYPE_AARP 0x80f3 /* Appletalk AARP protocol */
#endif
#ifndef ETHERTYPE_IPX
#define ETHERTYPE_IPX 0x8137 /* IPX over DIX protocol */
#endif
#ifndef ETHERTYPE_ARP
#define ETHERTYPE_ARP 0x0806 /* ARP protocol */
#endif
#ifndef ETHERTYPE_IPV6
#define ETHERTYPE_IPV6 0x86dd /* IPv6 */
#endif
#ifndef ETHERTYPE_8021Q
#define ETHERTYPE_8021Q 0x8100 /* 802.1Q vlan protocol */
#endif
#ifndef ETHERTYPE_VLAN
#define ETHERTYPE_VLAN 0x8100 /* VLAN TAG protocol */
#endif
#ifndef TX_QUEUE_FOR_EAPOL_FRAME
#define TX_QUEUE_FOR_EAPOL_FRAME 0x7 /* queue eapol frame to queue 7 to avoid aggregation disorder */
#endif
/*
* define WAI ethertype
*/
#ifndef ETHERTYPE_WAI
#define ETHERTYPE_WAI 0x88b4 /* WAI/WAPI */
#endif
#define ETHERTYPE_OCB_TX 0x8151
#define ETHERTYPE_OCB_RX 0x8152
/*
* Structure of a 48-bit Ethernet address.
*/
#if 0
#ifndef _NET_ETHERNET_H_
struct ether_addr {
uint8_t octet[ETHER_ADDR_LEN];
} __packed;
#endif
#endif
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
#define VLAN_PRI_SHIFT 13 /* Shift to find VLAN user priority */
#define VLAN_PRI_MASK 7 /* Mask for user priority bits in VLAN */
/*
* Structure of the IP frame
*/
struct ip_header {
uint8_t version_ihl;
uint8_t tos;
uint16_t tot_len;
uint16_t id;
uint16_t frag_off;
uint8_t ttl;
uint8_t protocol;
uint16_t check;
uint32_t saddr;
uint32_t daddr;
/*The options start here. */
};
#ifndef IP_PROTO_TCP
#define IP_PROTO_TCP 0x6 /* TCP protocol */
#endif
#ifndef IP_PROTO_UDP
#define IP_PROTO_UDP 17
#endif
/*
* IGMP protocol structures
*/
/* IGMP record type */
#define IGMP_QUERY_TYPE 0x11
#define IGMPV1_REPORT_TYPE 0x12
#define IGMPV2_REPORT_TYPE 0x16
#define IGMPV2_LEAVE_TYPE 0x17
#define IGMPV3_REPORT_TYPE 0x22
/* Is packet type is either leave or report */
#define IS_IGMP_REPORT_LEAVE_PACKET(type) ( \
(IGMPV1_REPORT_TYPE == type) \
|| (IGMPV2_REPORT_TYPE == type) \
|| (IGMPV2_LEAVE_TYPE == type) \
|| (IGMPV3_REPORT_TYPE == type) \
)
/*
* Header in on cable format
*/
struct igmp_header {
uint8_t type;
uint8_t code; /* For newer IGMP */
uint16_t csum;
uint32_t group;
};
/* V3 group record types [grec_type] */
#define IGMPV3_MODE_IS_INCLUDE 1
#define IGMPV3_MODE_IS_EXCLUDE 2
#define IGMPV3_CHANGE_TO_INCLUDE 3
#define IGMPV3_CHANGE_TO_EXCLUDE 4
#define IGMPV3_ALLOW_NEW_SOURCES 5
#define IGMPV3_BLOCK_OLD_SOURCES 6
/* Group record format
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Record Type | Aux Data Len | Number of Sources (N) |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Multicast Address |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address [1] |
||+- -+
| Source Address [2] |
||+- -+
. . .
. . .
. . .
||+- -+
| Source Address [N] |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Auxiliary Data .
. .
| |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct igmp_v3_grec {
uint8_t grec_type;
uint8_t grec_auxwords;
uint16_t grec_nsrcs;
uint32_t grec_mca;
};
/* IGMPv3 report format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 0x22 | Reserved | Checksum |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved | Number of Group Records (M) |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [1] .
. .
| |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [2] .
. .
| |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| . |
. . .
| . |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [M] .
. .
| |
||+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct igmp_v3_report {
uint8_t type;
uint8_t resv1;
uint16_t csum;
uint16_t resv2;
uint16_t ngrec;
};
/* Calculate the group record length*/
#define IGMPV3_GRP_REC_LEN(x) (8 + (4 * x->grec_nsrcs) + (4 * x->grec_auxwords) )
#endif /* _NET_IF_ETHERSUBR_H_ */

View File

@@ -1,165 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __CDS_MQ_H )
#define __CDS_MQ_H
/**=========================================================================
\file cds_mq.h
\brief virtual Operating System Services (CDF) message queue APIs
Message Queue Definitions and API
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include <cdf_types.h>
#include <cdf_status.h>
/*--------------------------------------------------------------------------
Preprocessor definitions and constants
------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
Type declarations
------------------------------------------------------------------------*/
/* cds Message Type.
This represnets a message that can be posted to another module through
the cds Message Queues.
\note This is mapped directly to the tSirMsgQ for backward
compatibility with the legacy MAC code */
typedef struct cds_msg_s {
uint16_t type;
/*
* This field can be used as sequence number/dialog token for matching
* requests and responses.
*/
uint16_t reserved;
/**
* Based on the type either a bodyptr pointer into
* memory or bodyval as a 32 bit data is used.
* bodyptr: is always a freeable pointer, one should always
* make sure that bodyptr is always freeable.
*
* Messages should use either bodyptr or bodyval; not both !!!.
*/
void *bodyptr;
uint32_t bodyval;
/*
* Some messages provide a callback function. The function signature
* must be agreed upon between the two entities exchanging the message
*/
void *callback;
} cds_msg_t;
/*-------------------------------------------------------------------------
Function declarations and documenation
------------------------------------------------------------------------*/
/* Message Queue IDs */
typedef enum {
/* Message Queue ID for messages bound for SME */
CDS_MQ_ID_SME = CDF_MODULE_ID_SME,
/* Message Queue ID for messages bound for PE */
CDS_MQ_ID_PE = CDF_MODULE_ID_PE,
/* Message Queue ID for messages bound for WMA */
CDS_MQ_ID_WMA = CDF_MODULE_ID_WMA,
/* Message Queue ID for messages bound for the SYS module */
CDS_MQ_ID_SYS = CDF_MODULE_ID_SYS,
} CDS_MQ_ID;
/**---------------------------------------------------------------------------
\brief cds_mq_post_message() - post a message to a message queue
This API allows messages to be posted to a specific message queue. Messages
can be posted to the following message queues:
<ul>
<li> SME
<li> PE
<li> HAL
<li> TL
</ul>
\param msgQueueId - identifies the message queue upon which the message
will be posted.
\param message - a pointer to a message buffer. Memory for this message
buffer is allocated by the caller and free'd by the CDF after the
message is posted to the message queue. If the consumer of the
message needs anything in this message, it needs to copy the contents
before returning from the message queue handler.
\return CDF_STATUS_SUCCESS - the message has been successfully posted
to the message queue.
CDF_STATUS_E_INVAL - The value specified by msgQueueId does not
refer to a valid Message Queue Id.
CDF_STATUS_E_FAULT - message is an invalid pointer.
CDF_STATUS_E_FAILURE - the message queue handler has reported
an unknown failure.
\sa
--------------------------------------------------------------------------*/
CDF_STATUS cds_mq_post_message(CDS_MQ_ID msgQueueId, cds_msg_t *message);
/**---------------------------------------------------------------------------
\brief cds_send_mb_message_to_mac() - post a message to a message queue
\param pBuf is a buffer allocated by caller. The actual structure varies
base on message type
\return CDF_STATUS_SUCCESS - the message has been successfully posted
to the message queue.
CDF_STATUS_E_FAILURE - the message queue handler has reported
an unknown failure.
\sa
--------------------------------------------------------------------------*/
CDF_STATUS cds_send_mb_message_to_mac(void *pBuf);
#endif /* if !defined __CDS_MQ_H */

View File

@@ -1,111 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __CDS_PACK_ALIGN_H )
#define __CDS_PACK_ALIGN_H
/**=========================================================================
\file cds_pack_align.h
\brief Connectivity driver services (CDS) pack and align primitives
Definitions for platform independent means of packing and aligning
data structures
========================================================================*/
/*
Place the macro CDS_PACK_START above a structure declaration to pack. We
are not going to allow modifying the pack size because pack size cannot be
specified in AMSS and GNU. Place the macro CDS_PACK_END below a structure
declaration to stop the pack. This requirement is necessitated by Windows
which need pragma based prolog and epilog.
Pack-size > 1-byte is not supported since gcc and arm do not support that.
Here are some examples
1. Pack-size 1-byte foo_t across all platforms
CDS_PACK_START
typedef CDS_PACK_PRE struct foo_s { ... } CDS_PACK_POST foo_t;
CDS_PACK_END
2. 2-byte alignment for foo_t across all platforms
typedef CDS_ALIGN_PRE(2) struct foo_s { ... } CDS_ALIGN_POST(2) foo_t;
3. Pack-size 1-byte and 2-byte alignment for foo_t across all platforms
CDS_PACK_START
typedef CDS_PACK_PRE CDS_ALIGN_PRE(2) struct foo_s { ... } CDS_ALIGN_POST(2) CDS_PACK_POST foo_t;
CDS_PACK_END
*/
#if defined __GNUC__
#define CDS_PACK_START
#define CDS_PACK_END
#define CDS_PACK_PRE
#define CDS_PACK_POST __attribute__((__packed__))
#define CDS_ALIGN_PRE(__value)
#define CDS_ALIGN_POST(__value) __attribute__((__aligned__(__value)))
#elif defined __arm
#define CDS_PACK_START
#define CDS_PACK_END
#define CDS_PACK_PRE __packed
#define CDS_PACK_POST
#define CDS_ALIGN_PRE(__value) __align(__value)
#define CDS_ALIGN_POST(__value)
#elif defined _MSC_VER
#define CDS_PACK_START __pragma(pack(push,1))
#define CDS_PACK_END __pragma(pack(pop))
#define CDS_PACK_PRE
#define CDS_PACK_POST
#define CDS_ALIGN_PRE(__value) __declspec(align(__value))
#define CDS_ALIGN_POST(__value)
#else
#error Unsupported compiler!!!
#endif
#endif /* __CDS_PACK_ALIGN_H */

View File

@@ -1,188 +0,0 @@
/*
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __CDS_PKT_H )
#define __CDS_PKT_H
/**=========================================================================
\file cds_packet.h
\brief Connectivity driver services (CDS) network Packet APIs
Network Protocol packet/buffer support interfaces
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include <cdf_types.h>
#include <cdf_status.h>
/*--------------------------------------------------------------------------
Preprocessor definitions and constants
------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
Type declarations
------------------------------------------------------------------------*/
struct cds_pkt_t;
typedef struct cds_pkt_t cds_pkt_t;
#include "cdf_nbuf.h"
#define CDS_PKT_TRAC_TYPE_EAPOL NBUF_PKT_TRAC_TYPE_EAPOL
#define CDS_PKT_TRAC_TYPE_DHCP NBUF_PKT_TRAC_TYPE_DHCP
#define CDS_PKT_TRAC_TYPE_MGMT_ACTION NBUF_PKT_TRAC_TYPE_MGMT_ACTION /* Managment action frame */
#define CDS_PKT_TRAC_DUMP_CMD 9999
/*---------------------------------------------------------------------------
* brief cds_pkt_get_proto_type() -
Find protoco type from packet contents
* skb Packet Pointer
* tracking_map packet type want to track
* dot11_type, frame type when the frame is in dot11 format
---------------------------------------------------------------------------*/
uint8_t cds_pkt_get_proto_type
(struct sk_buff *skb, uint8_t tracking_map, uint8_t dot11_type);
#ifdef QCA_PKT_PROTO_TRACE
/*---------------------------------------------------------------------------
* brief cds_pkt_trace_buf_update() -
Update storage buffer with interest event string
* event_string Event String may packet type or outstanding event
---------------------------------------------------------------------------*/
void cds_pkt_trace_buf_update(char *event_string);
/*---------------------------------------------------------------------------
* brief cds_pkt_trace_buf_dump() -
Dump stored information into kernel log
---------------------------------------------------------------------------*/
void cds_pkt_trace_buf_dump(void);
/*---------------------------------------------------------------------------
* brief cds_pkt_proto_trace_init() -
Initialize protocol trace functionality, allocate required resource
---------------------------------------------------------------------------*/
void cds_pkt_proto_trace_init(void);
/*---------------------------------------------------------------------------
* brief cds_pkt_proto_trace_close() -
Free required resource
---------------------------------------------------------------------------*/
void cds_pkt_proto_trace_close(void);
#else
static inline void cds_pkt_proto_trace_init(void) { }
static inline void cds_pkt_proto_trace_close(void) {}
#endif /* QCA_PKT_PROTO_TRACE */
/**
* cds_pkt_return_packet Free the cds Packet
* @ cds Packet
*/
CDF_STATUS cds_pkt_return_packet(cds_pkt_t *packet);
/**
* cds_pkt_get_packet_length Returns the packet length
* @ cds Packet
*/
CDF_STATUS cds_pkt_get_packet_length(cds_pkt_t *pPacket,
uint16_t *pPacketSize);
/*
* TODO: Remove later
* All the below difinitions are not
* required for Host Driver 2.0
* once corresponding references are removed
* from HDD and other layers
* below code will be removed
*/
/* The size of AMSDU frame per spec can be a max of 3839 bytes
in BD/PDUs that means 30 (one BD = 128 bytes)
we must add the size of the 802.11 header to that */
#define CDS_PKT_SIZE_BUFFER ((30 * 128) + 32)
/* cds Packet Types */
typedef enum {
/* cds Packet is used to transmit 802.11 Management frames. */
CDS_PKT_TYPE_TX_802_11_MGMT,
/* cds Packet is used to transmit 802.11 Data frames. */
CDS_PKT_TYPE_TX_802_11_DATA,
/* cds Packet is used to transmit 802.3 Data frames. */
CDS_PKT_TYPE_TX_802_3_DATA,
/* cds Packet contains Received data of an unknown frame type */
CDS_PKT_TYPE_RX_RAW,
/* Invalid sentinel value */
CDS_PKT_TYPE_MAXIMUM
} CDS_PKT_TYPE;
/* user IDs. These IDs are needed on the cds_pkt_get/set_user_data_ptr()
to identify the user area in the cds Packet. */
typedef enum {
CDS_PKT_USER_DATA_ID_TL = 0,
CDS_PKT_USER_DATA_ID_BAL,
CDS_PKT_USER_DATA_ID_WMA,
CDS_PKT_USER_DATA_ID_HDD,
CDS_PKT_USER_DATA_ID_BSL,
CDS_PKT_USER_DATA_ID_MAX
} CDS_PKT_USER_DATA_ID;
#ifdef MEMORY_DEBUG
#define cds_packet_alloc(s, d, p) \
cds_packet_alloc_debug(s, d, p, __FILE__, __LINE__)
CDF_STATUS cds_packet_alloc_debug(uint16_t size, void **data, void **ppPacket,
uint8_t *file_name, uint32_t line_num);
#else
CDF_STATUS cds_packet_alloc(uint16_t size, void **data, void **ppPacket);
#endif
void cds_packet_free(void *pPacket);
typedef CDF_STATUS (*cds_pkt_get_packet_callback)(cds_pkt_t *pPacket,
void *userData);
#endif /* !defined( __CDS_PKT_H ) */

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _CDS_QUEUE_H
#define _CDS_QUEUE_H
#include <queue.h> /* include BSD queue */
#endif /* end of _CDS_QUEUE_H */

View File

@@ -1,346 +0,0 @@
/*
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined __CDS_REG_SERVICE_H
#define __CDS_REG_SERVICE_H
/**=========================================================================
\file cds_reg_service.h
\brief Connectivity driver services (CDS): Non-Volatile storage API
========================================================================*/
#include "cdf_status.h"
#define CDS_COUNTRY_CODE_LEN 2
#define CDS_MAC_ADDRESS_LEN 6
#define CDS_CHANNEL_STATE(chan_enum) reg_channels[chan_enum].state
#define CDS_CHANNEL_NUM(chan_enum) chan_mapping[chan_enum].chan_num
#define CDS_CHANNEL_FREQ(chan_enum) chan_mapping[chan_enum].center_freq
#define CDS_IS_DFS_CH(chan_num) (cds_get_channel_state((chan_num)) == \
CHANNEL_STATE_DFS)
#define CDS_IS_PASSIVE_OR_DISABLE_CH(chan_num) \
(cds_get_channel_state(chan_num) != CHANNEL_STATE_ENABLE)
#define CDS_MIN_24GHZ_CHANNEL_NUMBER chan_mapping[MIN_24GHZ_CHANNEL].chan_num
#define CDS_MAX_24GHZ_CHANNEL_NUMBER chan_mapping[MAX_24GHZ_CHANNEL].chan_num
#define CDS_MIN_5GHZ_CHANNEL_NUMBER chan_mapping[MIN_5GHZ_CHANNEL].chan_num
#define CDS_MAX_5GHZ_CHANNEL_NUMBER chan_mapping[MAX_5GHZ_CHANNEL].chan_num
#define CDS_IS_CHANNEL_5GHZ(chan_num) \
((chan_num >= CDS_MIN_5GHZ_CHANNEL_NUMBER) && \
(chan_num <= CDS_MAX_5GHZ_CHANNEL_NUMBER))
#define CDS_IS_CHANNEL_24GHZ(chan_num) \
((chan_num >= CDS_MIN_24GHZ_CHANNEL_NUMBER) && \
(chan_num <= CDS_MAX_24GHZ_CHANNEL_NUMBER))
#define CDS_IS_SAME_BAND_CHANNELS(chan_num1, chan_num2) \
(chan_num1 && chan_num2 && \
(CDS_IS_CHANNEL_5GHZ(chan_num1) == CDS_IS_CHANNEL_5GHZ(chan_num2)))
#define CDS_MIN_11P_CHANNEL chan_mapping[MIN_59GHZ_CHANNEL].chan_num
typedef enum {
REGDOMAIN_FCC,
REGDOMAIN_ETSI,
REGDOMAIN_JAPAN,
REGDOMAIN_WORLD,
REGDOMAIN_COUNT
} v_REGDOMAIN_t;
enum channel_enum {
RF_CHAN_1 = 0,
RF_CHAN_2,
RF_CHAN_3,
RF_CHAN_4,
RF_CHAN_5,
RF_CHAN_6,
RF_CHAN_7,
RF_CHAN_8,
RF_CHAN_9,
RF_CHAN_10,
RF_CHAN_11,
RF_CHAN_12,
RF_CHAN_13,
RF_CHAN_14,
RF_CHAN_36,
RF_CHAN_40,
RF_CHAN_44,
RF_CHAN_48,
RF_CHAN_52,
RF_CHAN_56,
RF_CHAN_60,
RF_CHAN_64,
RF_CHAN_100,
RF_CHAN_104,
RF_CHAN_108,
RF_CHAN_112,
RF_CHAN_116,
RF_CHAN_120,
RF_CHAN_124,
RF_CHAN_128,
RF_CHAN_132,
RF_CHAN_136,
RF_CHAN_140,
RF_CHAN_144,
RF_CHAN_149,
RF_CHAN_153,
RF_CHAN_157,
RF_CHAN_161,
RF_CHAN_165,
RF_CHAN_170,
RF_CHAN_171,
RF_CHAN_172,
RF_CHAN_173,
RF_CHAN_174,
RF_CHAN_175,
RF_CHAN_176,
RF_CHAN_177,
RF_CHAN_178,
RF_CHAN_179,
RF_CHAN_180,
RF_CHAN_181,
RF_CHAN_182,
RF_CHAN_183,
RF_CHAN_184,
/* CHANNEL BONDED CHANNELS */
RF_CHAN_BOND_3,
RF_CHAN_BOND_4,
RF_CHAN_BOND_5,
RF_CHAN_BOND_6,
RF_CHAN_BOND_7,
RF_CHAN_BOND_8,
RF_CHAN_BOND_9,
RF_CHAN_BOND_10,
RF_CHAN_BOND_11,
RF_CHAN_BOND_38,
RF_CHAN_BOND_42,
RF_CHAN_BOND_46,
RF_CHAN_BOND_50,
RF_CHAN_BOND_54,
RF_CHAN_BOND_58,
RF_CHAN_BOND_62,
RF_CHAN_BOND_102,
RF_CHAN_BOND_106,
RF_CHAN_BOND_110,
RF_CHAN_BOND_114,
RF_CHAN_BOND_118,
RF_CHAN_BOND_122,
RF_CHAN_BOND_126,
RF_CHAN_BOND_130,
RF_CHAN_BOND_134,
RF_CHAN_BOND_138,
RF_CHAN_BOND_142,
RF_CHAN_BOND_151,
RF_CHAN_BOND_155,
RF_CHAN_BOND_159,
RF_CHAN_BOND_163,
NUM_RF_CHANNELS,
MIN_24GHZ_CHANNEL = RF_CHAN_1,
MAX_24GHZ_CHANNEL = RF_CHAN_14,
NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
MIN_5GHZ_CHANNEL = RF_CHAN_36,
MAX_5GHZ_CHANNEL = RF_CHAN_184,
NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
MIN_20MHZ_RF_CHANNEL = RF_CHAN_1,
MAX_20MHZ_RF_CHANNEL = RF_CHAN_184,
NUM_20MHZ_RF_CHANNELS =
(MAX_20MHZ_RF_CHANNEL - MIN_20MHZ_RF_CHANNEL + 1),
MIN_40MHZ_RF_CHANNEL = RF_CHAN_BOND_3,
MAX_40MHZ_RF_CHANNEL = RF_CHAN_BOND_163,
NUM_40MHZ_RF_CHANNELS =
(MAX_40MHZ_RF_CHANNEL - MIN_40MHZ_RF_CHANNEL + 1),
MIN_59GHZ_CHANNEL = RF_CHAN_170,
MAX_59GHZ_CHANNEL = RF_CHAN_184,
INVALID_RF_CHANNEL = 0xBAD,
RF_CHANNEL_INVALID_MAX_FIELD = 0x7FFFFFFF
};
/**
* enum channel_state: channel state
*
* @CHANNEL_STATE_DISABLE: channel disabled
* @CHANNEL_STATE_ENABLE: tx/rx enabled
* @CHANNEL_STATE_DFS: rx enabled, tx DFS
* @CHANNEL_STATE_INVALID: not a valid channel
*/
enum channel_state {
CHANNEL_STATE_DISABLE,
CHANNEL_STATE_ENABLE,
CHANNEL_STATE_DFS,
CHANNEL_STATE_INVALID
};
/**
* struct regulatory_channel: regulatory channel
*
* @state: channel state
* @flags: channel flags
* @pwr_limit: channel tx power limit
*/
struct regulatory_channel {
uint32_t state:4;
uint32_t flags:28;
int8_t pwr_limit;
};
/**
* struct chan_map: channel mapping
*
* @center_freq: channel center freq
* @chan_num: channel number
*/
struct chan_map {
uint16_t center_freq;
uint16_t chan_num;
};
/**
* struct channel_power: channel power
*
* @chan_num: channel number
* @power: tx power
*/
struct channel_power {
uint8_t chan_num;
int8_t power;
};
/**
* enum country_src: country source
*
* @SOURCE_QUERY: source query
* @SOURCE_CORE: source regulatory core
* @SOURCE_DRIVER: source driver
* @SOURCE_USERSPACE: source userspace
* @SOURCE_11D: source 11D
*/
enum country_src {
SOURCE_QUERY,
SOURCE_CORE,
SOURCE_DRIVER,
SOURCE_USERSPACE,
SOURCE_11D
};
/**
* struct regulatory: regulatory information
*
* @reg_domain: regulatory domain pair
* @eeprom_rd_ext: eeprom value
* @country_code: current country in integer
* @alpha2: current alpha2
* @def_country: default country alpha2
* @def_region: DFS region
* @ctl_2g: 2G CTL value
* @ctl_5g: 5G CTL value
* @reg_pair: pointer to regulatory pair
* @cc_src: country code src
* @reg_flags: kernel regulatory flags
*/
struct regulatory {
uint32_t reg_domain;
uint32_t eeprom_rd_ext;
uint16_t country_code;
uint8_t alpha2[CDS_COUNTRY_CODE_LEN + 1];
uint8_t def_country[CDS_COUNTRY_CODE_LEN + 1];
uint8_t dfs_region;
uint8_t ctl_2g;
uint8_t ctl_5g;
const void *regpair;
enum country_src cc_src;
uint32_t reg_flags;
};
/**
* enum chan_width: channel width
*
* @CHAN_WIDTH_0MHZ: channel disabled or invalid
* @CHAN_WIDTH_5MHZ: channel width 5 MHZ
* @CHAN_WIDTH_10MHZ: channel width 10 MHZ
* @CHAN_WIDTH_20MHZ: channel width 20 MHZ
* @CHAN_WIDTH_40MHZ: channel width 40 MHZ
* @CHAN_WIDTH_80MHZ: channel width 80MHZ
* @CHAN_WIDTH_160MHZ: channel width 160 MHZ
*/
enum channel_width {
CHAN_WIDTH_0MHZ,
CHAN_WIDTH_5MHZ,
CHAN_WIDTH_10MHZ,
CHAN_WIDTH_20MHZ,
CHAN_WIDTH_40MHZ,
CHAN_WIDTH_80MHZ,
CHAN_WIDTH_160MHZ
};
extern struct regulatory_channel reg_channels[NUM_RF_CHANNELS];
extern const struct chan_map chan_mapping[NUM_RF_CHANNELS];
CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *pRegDomain,
const uint8_t *country_alpha2,
enum country_src source);
CDF_STATUS cds_read_default_country(uint8_t *default_country);
CDF_STATUS cds_get_channel_list_with_power(struct channel_power
*base_channels,
uint8_t *num_base_channels,
struct channel_power
*channel_40mhz,
uint8_t *num_channels_40mhz);
CDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain);
enum channel_state cds_get_channel_state(uint32_t chan_num);
CDF_STATUS cds_regulatory_init(void);
CDF_STATUS cds_get_dfs_region(uint8_t *dfs_region);
CDF_STATUS cds_set_dfs_region(uint8_t dfs_region);
bool cds_is_dsrc_channel(uint16_t);
enum channel_state cds_get_bonded_channel_state(uint32_t chan_num,
enum channel_width chan_width);
enum channel_width cds_get_max_channel_bw(uint32_t chan_num);
#endif /* __CDS_REG_SERVICE_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,443 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __CDS_SCHED_H )
#define __CDS_SCHED_H
/**=========================================================================
\file cds_sched.h
\brief Connectivity driver services scheduler
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include <cdf_event.h>
#include "i_cdf_types.h"
#include <linux/wait.h>
#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
#include <linux/wakelock.h>
#endif
#include <cds_mq.h>
#include <cdf_types.h>
#include "cdf_lock.h"
#define TX_POST_EVENT_MASK 0x001
#define TX_SUSPEND_EVENT_MASK 0x002
#define MC_POST_EVENT_MASK 0x001
#define MC_SUSPEND_EVENT_MASK 0x002
#define RX_POST_EVENT_MASK 0x001
#define RX_SUSPEND_EVENT_MASK 0x002
#define TX_SHUTDOWN_EVENT_MASK 0x010
#define MC_SHUTDOWN_EVENT_MASK 0x010
#define RX_SHUTDOWN_EVENT_MASK 0x010
#define WD_POST_EVENT_MASK 0x001
#define WD_SHUTDOWN_EVENT_MASK 0x002
#define WD_CHIP_RESET_EVENT_MASK 0x004
#define WD_WLAN_SHUTDOWN_EVENT_MASK 0x008
#define WD_WLAN_REINIT_EVENT_MASK 0x010
/*
* Maximum number of messages in the system
* These are buffers to account for all current messages
* with some accounting of what we think is a
* worst-case scenario. Must be able to handle all
* incoming frames, as well as overhead for internal
* messaging
*
* Increased to 8000 to handle more RX frames
*/
#define CDS_CORE_MAX_MESSAGES 8000
#ifdef QCA_CONFIG_SMP
/*
** Maximum number of cds messages to be allocated for
** OL Rx thread.
*/
#define CDS_MAX_OL_RX_PKT 4000
typedef void (*cds_ol_rx_thread_cb)(void *context, void *rxpkt, uint16_t staid);
#endif
/*
** CDF Message queue definition.
*/
typedef struct _cds_mq_type {
/* Lock use to synchronize access to this message queue */
spinlock_t mqLock;
/* List of vOS Messages waiting on this queue */
struct list_head mqList;
} cds_mq_type, *p_cds_mq_type;
#ifdef QCA_CONFIG_SMP
/*
** CDS message wrapper for data rx from TXRX
*/
struct cds_ol_rx_pkt {
struct list_head list;
void *context;
/* Rx skb */
void *Rxpkt;
/* Station id to which this packet is destined */
uint16_t staId;
/* Call back to further send this packet to txrx layer */
cds_ol_rx_thread_cb callback;
};
#endif
/*
** CDS Scheduler context
** The scheduler context contains the following:
** ** the messages queues
** ** the handle to the tread
** ** pointer to the events that gracefully shutdown the MC and Tx threads
**
*/
typedef struct _cds_sched_context {
/* Place holder to the CDS Context */
void *pVContext;
/* WMA Message queue on the Main thread */
cds_mq_type wmaMcMq;
/* PE Message queue on the Main thread */
cds_mq_type peMcMq;
/* SME Message queue on the Main thread */
cds_mq_type smeMcMq;
/* SYS Message queue on the Main thread */
cds_mq_type sysMcMq;
/* Handle of Event for MC thread to signal startup */
struct completion McStartEvent;
struct task_struct *McThread;
/* completion object for MC thread shutdown */
struct completion McShutdown;
/* Wait queue for MC thread */
wait_queue_head_t mcWaitQueue;
unsigned long mcEventFlag;
/* Completion object to resume Mc thread */
struct completion ResumeMcEvent;
/* lock to make sure that McThread suspend/resume mechanism is in sync */
spinlock_t McThreadLock;
#ifdef QCA_CONFIG_SMP
spinlock_t ol_rx_thread_lock;
/* OL Rx thread handle */
struct task_struct *ol_rx_thread;
/* Handle of Event for Rx thread to signal startup */
struct completion ol_rx_start_event;
/* Completion object to suspend OL rx thread */
struct completion ol_suspend_rx_event;
/* Completion objext to resume OL rx thread */
struct completion ol_resume_rx_event;
/* Completion object for OL Rxthread shutdown */
struct completion ol_rx_shutdown;
/* Waitq for OL Rx thread */
wait_queue_head_t ol_rx_wait_queue;
unsigned long ol_rx_event_flag;
/* Rx buffer queue */
struct list_head ol_rx_thread_queue;
/* Spinlock to synchronize between tasklet and thread */
spinlock_t ol_rx_queue_lock;
/* Rx queue length */
unsigned int ol_rx_queue_len;
/* Lock to synchronize free buffer queue access */
spinlock_t cds_ol_rx_pkt_freeq_lock;
/* Free message queue for OL Rx processing */
struct list_head cds_ol_rx_pkt_freeq;
/* cpu hotplug notifier */
struct notifier_block *cpu_hot_plug_notifier;
#endif
} cds_sched_context, *p_cds_sched_context;
/**
* struct cds_log_complete - Log completion internal structure
* @is_fatal: Type is fatal or not
* @indicator: Source of bug report
* @reason_code: Reason code for bug report
* @is_report_in_progress: If bug report is in progress
*
* This structure internally stores the log related params
*/
struct cds_log_complete {
uint32_t is_fatal;
uint32_t indicator;
uint32_t reason_code;
bool is_report_in_progress;
};
/*
** CDS Sched Msg Wrapper
** Wrapper messages so that they can be chained to their respective queue
** in the scheduler.
*/
typedef struct _cds_msg_wrapper {
/* Message node */
struct list_head msgNode;
/* the Vos message it is associated to */
cds_msg_t *pVosMsg;
} cds_msg_wrapper, *p_cds_msg_wrapper;
typedef struct _cds_context_type {
/* Messages buffers */
cds_msg_t aMsgBuffers[CDS_CORE_MAX_MESSAGES];
cds_msg_wrapper aMsgWrappers[CDS_CORE_MAX_MESSAGES];
/* Free Message queue */
cds_mq_type freeVosMq;
/* Scheduler Context */
cds_sched_context cdf_sched;
/* HDD Module Context */
void *pHDDContext;
/* MAC Module Context */
void *pMACContext;
cdf_event_t ProbeEvent;
uint32_t driver_state;
cdf_event_t wmaCompleteEvent;
/* WMA Context */
void *pWMAContext;
void *pHIFContext;
void *htc_ctx;
/*
* cdf_ctx will be used by cdf
* while allocating dma memory
* to access dev information.
*/
cdf_device_t cdf_ctx;
void *pdev_txrx_ctx;
/* Configuration handle used to get system configuration */
void *cfg_ctx;
bool is_wakelock_log_enabled;
uint32_t wakelock_log_level;
uint32_t connectivity_log_level;
uint32_t packet_stats_log_level;
uint32_t driver_debug_log_level;
uint32_t fw_debug_log_level;
struct cds_log_complete log_complete;
cdf_spinlock_t bug_report_lock;
cdf_event_t connection_update_done_evt;
cdf_mutex_t cdf_conc_list_lock;
} cds_context_type, *p_cds_contextType;
/*---------------------------------------------------------------------------
Function declarations and documenation
---------------------------------------------------------------------------*/
#ifdef QCA_CONFIG_SMP
/*---------------------------------------------------------------------------
\brief cds_drop_rxpkt_by_staid() - API to drop pending Rx packets for a sta
The \a cds_drop_rxpkt_by_staid() drops queued packets for a station, to drop
all the pending packets the caller has to send WLAN_MAX_STA_COUNT as staId.
\param pSchedContext - pointer to the global CDS Sched Context
\param staId - Station Id
\return Nothing
\sa cds_drop_rxpkt_by_staid()
-------------------------------------------------------------------------*/
void cds_drop_rxpkt_by_staid(p_cds_sched_context pSchedContext, uint16_t staId);
/*---------------------------------------------------------------------------
\brief cds_indicate_rxpkt() - API to Indicate rx data packet
The \a cds_indicate_rxpkt() enqueues the rx packet onto ol_rx_thread_queue
and notifies cds_ol_rx_thread().
\param Arg - pointer to the global CDS Sched Context
\param pkt - Vos data message buffer
\return Nothing
\sa cds_indicate_rxpkt()
-------------------------------------------------------------------------*/
void cds_indicate_rxpkt(p_cds_sched_context pSchedContext,
struct cds_ol_rx_pkt *pkt);
/*---------------------------------------------------------------------------
\brief cds_alloc_ol_rx_pkt() - API to return next available cds message
The \a cds_alloc_ol_rx_pkt() returns next available cds message buffer
used for Rx Data processing.
\param pSchedContext - pointer to the global CDS Sched Context
\return pointer to cds message buffer
\sa cds_alloc_ol_rx_pkt()
-------------------------------------------------------------------------*/
struct cds_ol_rx_pkt *cds_alloc_ol_rx_pkt(p_cds_sched_context pSchedContext);
/*---------------------------------------------------------------------------
\brief cds_free_ol_rx_pkt() - API to release cds message to the freeq
The \a cds_free_ol_rx_pkt() returns the cds message used for Rx data
to the free queue.
\param pSchedContext - pointer to the global CDS Sched Context
\param pkt - Vos message buffer to be returned to free queue.
\return Nothing
\sa cds_free_ol_rx_pkt()
-------------------------------------------------------------------------*/
void cds_free_ol_rx_pkt(p_cds_sched_context pSchedContext,
struct cds_ol_rx_pkt *pkt);
/*---------------------------------------------------------------------------
\brief cds_free_ol_rx_pkt_freeq() - Free cdss buffer free queue
The \a cds_free_ol_rx_pkt_freeq() does mem free of the buffers
available in free cds buffer queue which is used for Data rx processing
from Tlshim.
\param pSchedContext - pointer to the global CDS Sched Context
\return Nothing
\sa cds_free_ol_rx_pkt_freeq()
-------------------------------------------------------------------------*/
void cds_free_ol_rx_pkt_freeq(p_cds_sched_context pSchedContext);
#endif
/*---------------------------------------------------------------------------
\brief cds_sched_open() - initialize the CDS Scheduler
The \a cds_sched_open() function initializes the CDS Scheduler
Upon successful initialization:
- All the message queues are initialized
- The Main Controller thread is created and ready to receive and
dispatch messages.
- The Tx thread is created and ready to receive and dispatch messages
\param p_cds_context - pointer to the global CDF Context
\param p_cds_sched_context - pointer to a previously allocated buffer big
enough to hold a scheduler context.
\
\return CDF_STATUS_SUCCESS - Scheduler was successfully initialized and
is ready to be used.
CDF_STATUS_E_RESOURCES - System resources (other than memory)
are unavailable to initilize the scheduler
CDF_STATUS_E_NOMEM - insufficient memory exists to initialize
the scheduler
CDF_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
function
CDF_STATUS_E_FAILURE - Failure to initialize the scheduler/
\sa cds_sched_open()
-------------------------------------------------------------------------*/
CDF_STATUS cds_sched_open(void *p_cds_context,
p_cds_sched_context pSchedCxt, uint32_t SchedCtxSize);
/*---------------------------------------------------------------------------
\brief cds_sched_close() - Close the CDS Scheduler
The \a cds_sched_closes() function closes the CDS Scheduler
Upon successful closing:
- All the message queues are flushed
- The Main Controller thread is closed
- The Tx thread is closed
\param p_cds_context - pointer to the global CDF Context
\return CDF_STATUS_SUCCESS - Scheduler was successfully initialized and
is ready to be used.
CDF_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
function
CDF_STATUS_E_FAILURE - Failure to initialize the scheduler/
\sa cds_sched_close()
---------------------------------------------------------------------------*/
CDF_STATUS cds_sched_close(void *p_cds_context);
/* Helper routines provided to other CDS API's */
CDF_STATUS cds_mq_init(p_cds_mq_type pMq);
void cds_mq_deinit(p_cds_mq_type pMq);
void cds_mq_put(p_cds_mq_type pMq, p_cds_msg_wrapper pMsgWrapper);
p_cds_msg_wrapper cds_mq_get(p_cds_mq_type pMq);
bool cds_is_mq_empty(p_cds_mq_type pMq);
p_cds_sched_context get_cds_sched_ctxt(void);
CDF_STATUS cds_sched_init_mqs(p_cds_sched_context pSchedContext);
void cds_sched_deinit_mqs(p_cds_sched_context pSchedContext);
void cds_sched_flush_mc_mqs(p_cds_sched_context pSchedContext);
void cdf_timer_module_init(void);
void cds_ssr_protect_init(void);
void cds_ssr_protect(const char *caller_func);
void cds_ssr_unprotect(const char *caller_func);
bool cds_wait_for_external_threads_completion(const char *caller_func);
int cds_get_gfp_flags(void);
#endif /* #if !defined __CDS_SCHED_H */

View File

@@ -1,189 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __CDS_UTILS_H )
#define __CDS_UTILS_H
/**=========================================================================
\file cds_utils.h
\brief Connectivity driver services (CDS) utility APIs
Various utility functions
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include <cdf_types.h>
#include <cdf_status.h>
#include <cdf_event.h>
#include "ani_global.h"
/*--------------------------------------------------------------------------
Preprocessor definitions and constants
------------------------------------------------------------------------*/
#define CDS_DIGEST_SHA1_SIZE (20)
#define CDS_DIGEST_MD5_SIZE (16)
#define CDS_BAND_2GHZ (1)
#define CDS_BAND_5GHZ (2)
#define CDS_24_GHZ_BASE_FREQ (2407)
#define CDS_5_GHZ_BASE_FREQ (5000)
#define CDS_24_GHZ_CHANNEL_14 (14)
#define CDS_24_GHZ_CHANNEL_15 (15)
#define CDS_24_GHZ_CHANNEL_27 (27)
#define CDS_5_GHZ_CHANNEL_170 (170)
#define CDS_CHAN_SPACING_5MHZ (5)
#define CDS_CHAN_SPACING_20MHZ (20)
#define CDS_CHAN_14_FREQ (2484)
#define CDS_CHAN_15_FREQ (2512)
#define CDS_CHAN_170_FREQ (5852)
#define cds_log(level, args...) CDF_TRACE(CDF_MODULE_ID_CDF, level, ## args)
#define cds_logfl(level, format, args...) cds_log(level, FL(format), ## args)
#define cds_alert(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_FATAL, format, ## args)
#define cds_err(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_ERROR, format, ## args)
#define cds_warn(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_WARN, format, ## args)
#define cds_notice(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_INFO, format, ## args)
#define cds_info(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
#define cds_debug(format, args...) \
cds_logfl(CDF_TRACE_LEVEL_DEBUG, format, ## args)
/*--------------------------------------------------------------------------
Type declarations
------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
Function declarations and documenation
------------------------------------------------------------------------*/
CDF_STATUS cds_crypto_init(uint32_t *phCryptProv);
CDF_STATUS cds_crypto_deinit(uint32_t hCryptProv);
/**
* cds_rand_get_bytes
* FUNCTION:
* Returns cryptographically secure pseudo-random bytes.
*
*
* @param pbBuf - the caller allocated location where the bytes should be copied
* @param numBytes the number of bytes that should be generated and
* copied
*
* @return CDF_STATUS_SUCCSS if the operation succeeds
*/
CDF_STATUS cds_rand_get_bytes(uint32_t handle, uint8_t *pbBuf,
uint32_t numBytes);
/**
* cds_sha1_hmac_str
*
* FUNCTION:
* Generate the HMAC-SHA1 of a string given a key.
*
* LOGIC:
* Standard HMAC processing from RFC 2104. The code is provided in the
* appendix of the RFC.
*
* ASSUMPTIONS:
* The RFC is correct.
*
* @param text text to be hashed
* @param textLen length of text
* @param key key to use for HMAC
* @param keyLen length of key
* @param digest holds resultant SHA1 HMAC (20B)
*
* @return CDF_STATUS_SUCCSS if the operation succeeds
*
*/
CDF_STATUS cds_sha1_hmac_str(uint32_t cryptHandle, /* Handle */
uint8_t * text, /* pointer to data stream */
uint32_t textLen, /* length of data stream */
uint8_t * key, /* pointer to authentication key */
uint32_t keyLen, /* length of authentication key */
uint8_t digest[CDS_DIGEST_SHA1_SIZE]); /* caller digest to be filled in */
/**
* cds_md5_hmac_str
*
* FUNCTION:
* Generate the HMAC-MD5 of a string given a key.
*
* LOGIC:
* Standard HMAC processing from RFC 2104. The code is provided in the
* appendix of the RFC.
*
* ASSUMPTIONS:
* The RFC is correct.
*
* @param text text to be hashed
* @param textLen length of text
* @param key key to use for HMAC
* @param keyLen length of key
* @param digest holds resultant MD5 HMAC (16B)
*
* @return CDF_STATUS_SUCCSS if the operation succeeds
*
*/
CDF_STATUS cds_md5_hmac_str(uint32_t cryptHandle, /* Handle */
uint8_t * text, /* pointer to data stream */
uint32_t textLen, /* length of data stream */
uint8_t * key, /* pointer to authentication key */
uint32_t keyLen, /* length of authentication key */
uint8_t digest[CDS_DIGEST_MD5_SIZE]); /* caller digest to be filled in */
CDF_STATUS cds_encrypt_aes(uint32_t cryptHandle, /* Handle */
uint8_t *pText, /* pointer to data stream */
uint8_t *Encrypted, uint8_t *pKey); /* pointer to authentication key */
CDF_STATUS cds_decrypt_aes(uint32_t cryptHandle, /* Handle */
uint8_t *pText, /* pointer to data stream */
uint8_t *pDecrypted, uint8_t *pKey); /* pointer to authentication key */
uint32_t cds_chan_to_freq(uint8_t chan);
uint8_t cds_freq_to_chan(uint32_t freq);
uint8_t cds_chan_to_band(uint32_t chan);
#ifdef WLAN_FEATURE_11W
bool cds_is_mmie_valid(uint8_t *key, uint8_t *ipn,
uint8_t *frm, uint8_t *efrm);
bool cds_attach_mmie(uint8_t *igtk, uint8_t *ipn, uint16_t key_id,
uint8_t *frm, uint8_t *efrm, uint16_t frmLen);
uint8_t cds_get_mmie_size(void);
#endif /* WLAN_FEATURE_11W */
CDF_STATUS sme_send_flush_logs_cmd_to_fw(tpAniSirGlobal pMac);
#endif /* #if !defined __CDS_UTILS_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,545 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef CDS_COMMON__IEEE80211_I_H_
#define CDS_COMMON__IEEE80211_I_H_
/* These defines should match the table from ah_internal.h */
typedef enum {
DFS_UNINIT_DOMAIN = 0, /* Uninitialized dfs domain */
DFS_FCC_DOMAIN = 1, /* FCC3 dfs domain */
DFS_ETSI_DOMAIN = 2, /* ETSI dfs domain */
DFS_MKK4_DOMAIN = 3 /* Japan dfs domain */
} HAL_DFS_DOMAIN;
/* XXX not really a mode; there are really multiple PHY's */
enum ieee80211_phymode {
IEEE80211_MODE_AUTO = 0, /* autoselect */
IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */
IEEE80211_MODE_11B = 2, /* 2GHz, CCK */
IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */
IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock dynamic turbo */
IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock dynamic turbo */
IEEE80211_MODE_11NA_HT20 = 7, /* 5Ghz, HT20 */
IEEE80211_MODE_11NG_HT20 = 8, /* 2Ghz, HT20 */
IEEE80211_MODE_11NA_HT40PLUS = 9, /* 5Ghz, HT40 (ext ch +1) */
IEEE80211_MODE_11NA_HT40MINUS = 10, /* 5Ghz, HT40 (ext ch -1) */
IEEE80211_MODE_11NG_HT40PLUS = 11, /* 2Ghz, HT40 (ext ch +1) */
IEEE80211_MODE_11NG_HT40MINUS = 12, /* 2Ghz, HT40 (ext ch -1) */
IEEE80211_MODE_11NG_HT40 = 13, /* 2Ghz, Auto HT40 */
IEEE80211_MODE_11NA_HT40 = 14, /* 2Ghz, Auto HT40 */
IEEE80211_MODE_11AC_VHT20 = 15, /* 5Ghz, VHT20 */
IEEE80211_MODE_11AC_VHT40PLUS = 16, /* 5Ghz, VHT40 (Ext ch +1) */
IEEE80211_MODE_11AC_VHT40MINUS = 17, /* 5Ghz VHT40 (Ext ch -1) */
IEEE80211_MODE_11AC_VHT40 = 18, /* 5Ghz, VHT40 */
IEEE80211_MODE_11AC_VHT80 = 19, /* 5Ghz, VHT80 */
IEEE80211_MODE_2G_AUTO = 20, /* 2G 11 b/g/n autoselect */
IEEE80211_MODE_5G_AUTO = 21, /* 5G 11 a/n/ac autoselect */
IEEE80211_MODE_11AGN = 22, /* Support 11N in both 2G and 5G */
};
#define IEEE80211_MODE_MAX (IEEE80211_MODE_11AC_VHT80 + 1)
enum ieee80211_opmode {
IEEE80211_M_STA = 1, /* infrastructure station */
IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */
IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */
IEEE80211_M_HOSTAP = 6, /* Software Access Point */
IEEE80211_M_MONITOR = 8, /* Monitor mode */
IEEE80211_M_WDS = 2, /* WDS link */
IEEE80211_M_BTAMP = 9, /* VAP for BT AMP */
IEEE80211_M_P2P_GO = 33, /* P2P GO */
IEEE80211_M_P2P_CLIENT = 34, /* P2P Client */
IEEE80211_M_P2P_DEVICE = 35, /* P2P Device */
IEEE80211_OPMODE_MAX = IEEE80211_M_BTAMP, /* Highest numbered opmode in the list */
IEEE80211_M_ANY = 0xFF /* Any of the above; used by NDIS 6.x */
};
/*
* 802.11n
*/
#define IEEE80211_CWM_EXTCH_BUSY_THRESHOLD 30
enum ieee80211_cwm_mode {
IEEE80211_CWM_MODE20,
IEEE80211_CWM_MODE2040,
IEEE80211_CWM_MODE40,
IEEE80211_CWM_MODEMAX
};
enum ieee80211_cwm_extprotspacing {
IEEE80211_CWM_EXTPROTSPACING20,
IEEE80211_CWM_EXTPROTSPACING25,
IEEE80211_CWM_EXTPROTSPACINGMAX
};
enum ieee80211_cwm_width {
IEEE80211_CWM_WIDTH20,
IEEE80211_CWM_WIDTH40,
IEEE80211_CWM_WIDTH80,
IEEE80211_CWM_WIDTHINVALID = 0xff /* user invalid value */
};
enum ieee80211_cwm_extprotmode {
IEEE80211_CWM_EXTPROTNONE, /* no protection */
IEEE80211_CWM_EXTPROTCTSONLY, /* CTS to self */
IEEE80211_CWM_EXTPROTRTSCTS, /* RTS-CTS */
IEEE80211_CWM_EXTPROTMAX
};
enum ieee80211_fixed_rate_mode {
IEEE80211_FIXED_RATE_NONE = 0,
IEEE80211_FIXED_RATE_MCS = 1, /* HT rates */
IEEE80211_FIXED_RATE_LEGACY = 2, /* legacy rates */
IEEE80211_FIXED_RATE_VHT = 3 /* VHT rates */
};
/* Holds the fixed rate information for each VAP */
struct ieee80211_fixed_rate {
enum ieee80211_fixed_rate_mode mode;
uint32_t series;
uint32_t retries;
};
/*
* 802.11g protection mode.
*/
enum ieee80211_protmode {
IEEE80211_PROT_NONE = 0, /* no protection */
IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
};
/*
* Roaming mode is effectively who controls the operation
* of the 802.11 state machine when operating as a station.
* State transitions are controlled either by the driver
* (typically when management frames are processed by the
* hardware/firmware), the host (auto/normal operation of
* the 802.11 layer), or explicitly through ioctl requests
* when applications like wpa_supplicant want control.
*/
enum ieee80211_roamingmode {
IEEE80211_ROAMING_DEVICE = 0, /* driver/hardware control */
IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */
IEEE80211_ROAMING_MANUAL = 2, /* application control */
};
/*
* Scanning mode controls station scanning work; this is
* used only when roaming mode permits the host to select
* the bss to join/channel to use.
*/
enum ieee80211_scanmode {
IEEE80211_SCAN_DEVICE = 0, /* driver/hardware control */
IEEE80211_SCAN_BEST = 1, /* 802.11 layer selects best */
IEEE80211_SCAN_FIRST = 2, /* take first suitable candidate */
};
#define IEEE80211_NWID_LEN 32
#define IEEE80211_CHAN_MAX 255
#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
#define IEEE80211_CHAN_ANY (-1) /* token for ``any channel'' */
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
#define IEEE80211_CHAN_DEFAULT 11
#define IEEE80211_CHAN_DEFAULT_11A 52
#define IEEE80211_CHAN_ADHOC_DEFAULT1 10
#define IEEE80211_CHAN_ADHOC_DEFAULT2 11
#define IEEE80211_RADAR_11HCOUNT 5
#define IEEE80211_RADAR_TEST_MUTE_CHAN_11A 36 /* Move to channel 36 for mute test */
#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT20 36
#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT40U 36
#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT40D 40 /* Move to channel 40 for HT40D mute test */
#define IEEE80211_RADAR_DETECT_DEFAULT_DELAY 60000 /* STA ignore AP beacons during this period in millisecond */
#define IEEE80211_2GCSA_TBTTCOUNT 3
/* bits 0-3 are for private use by drivers */
/* channel attributes */
#define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */
#define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */
#define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */
#define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */
#define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */
#define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */
#define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */
#define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */
#define IEEE80211_CHAN_RADAR_DFS 0x00001000 /* Radar found on channel */
#define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */
#define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */
#define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */
#define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
#define IEEE80211_CHAN_HT40PLUS 0x00020000 /* HT 40 with extension channel above */
#define IEEE80211_CHAN_HT40MINUS 0x00040000 /* HT 40 with extension channel below */
#define IEEE80211_CHAN_HT40INTOL 0x00080000 /* HT 40 Intolerant */
#define IEEE80211_CHAN_VHT20 0x00100000 /* VHT 20 channel */
#define IEEE80211_CHAN_VHT40PLUS 0x00200000 /* VHT 40 with extension channel above */
#define IEEE80211_CHAN_VHT40MINUS 0x00400000 /* VHT 40 with extension channel below */
#define IEEE80211_CHAN_VHT80 0x00800000 /* VHT 80 channel */
/* flagext */
#define IEEE80211_CHAN_RADAR_FOUND 0x01
#define IEEE80211_CHAN_DFS 0x0002 /* DFS required on channel */
#define IEEE80211_CHAN_DFS_CLEAR 0x0008 /* if channel has been checked for DFS */
#define IEEE80211_CHAN_11D_EXCLUDED 0x0010 /* excluded in 11D */
#define IEEE80211_CHAN_CSA_RECEIVED 0x0020 /* Channel Switch Announcement received on this channel */
#define IEEE80211_CHAN_DISALLOW_ADHOC 0x0040 /* ad-hoc is not allowed */
#define IEEE80211_CHAN_DISALLOW_HOSTAP 0x0080 /* Station only channel */
/*
* Useful combinations of channel characteristics.
*/
#define IEEE80211_CHAN_FHSS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
#define IEEE80211_CHAN_A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_B \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
#define IEEE80211_CHAN_PUREG \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
#define IEEE80211_CHAN_108A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
#define IEEE80211_CHAN_108G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
#define IEEE80211_CHAN_ST \
(IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
#define IEEE80211_IS_CHAN_11AC_2G(_c) \
(IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)))
#define IEEE80211_CHAN_11AC_VHT20_2G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT20)
#define IEEE80211_CHAN_11AC_VHT40_2G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)
#define IEEE80211_CHAN_11AC_VHT80_2G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT80)
#define IEEE80211_IS_CHAN_11AC_VHT20_2G(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20_2G) == IEEE80211_CHAN_11AC_VHT20_2G)
#define IEEE80211_IS_CHAN_11AC_VHT40_2G(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40_2G) != 0)
#define IEEE80211_IS_CHAN_11AC_VHT80_2G(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80_2G) == IEEE80211_CHAN_11AC_VHT80_2G)
#define IEEE80211_CHAN_11NG_HT20 \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT20)
#define IEEE80211_CHAN_11NA_HT20 \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT20)
#define IEEE80211_CHAN_11NG_HT40PLUS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40PLUS)
#define IEEE80211_CHAN_11NG_HT40MINUS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40MINUS)
#define IEEE80211_CHAN_11NA_HT40PLUS \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40PLUS)
#define IEEE80211_CHAN_11NA_HT40MINUS \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40MINUS)
#define IEEE80211_CHAN_ALL \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS | \
IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80 | \
IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)
#define IEEE80211_CHAN_ALLTURBO \
(IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
#define IEEE80211_IS_CHAN_FHSS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
#define IEEE80211_IS_CHAN_A(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
#define IEEE80211_IS_CHAN_B(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
#define IEEE80211_IS_CHAN_PUREG(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
#define IEEE80211_IS_CHAN_G(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
#define IEEE80211_IS_CHAN_ANYG(_c) \
(IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
#define IEEE80211_IS_CHAN_ST(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
#define IEEE80211_IS_CHAN_108A(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
#define IEEE80211_IS_CHAN_108G(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
#define IEEE80211_IS_CHAN_2GHZ(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
#define IEEE80211_IS_CHAN_5GHZ(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
#define IEEE80211_IS_CHAN_OFDM(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
#define IEEE80211_IS_CHAN_CCK(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
#define IEEE80211_IS_CHAN_GFSK(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
#define IEEE80211_IS_CHAN_TURBO(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
#define IEEE80211_IS_CHAN_WEATHER_RADAR(_c) \
((((_c)->ic_freq >= 5600) && ((_c)->ic_freq <= 5650)) \
|| (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) && (5580 == (_c)->ic_freq)))
#define IEEE80211_IS_CHAN_STURBO(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
#define IEEE80211_IS_CHAN_DTURBO(_c) \
(((_c)->ic_flags & \
(IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
#define IEEE80211_IS_CHAN_HALF(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
#define IEEE80211_IS_CHAN_QUARTER(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
#define IEEE80211_IS_CHAN_PASSIVE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
#define IEEE80211_IS_CHAN_DFS(_c) \
(((_c)->ic_flagext & (IEEE80211_CHAN_DFS|IEEE80211_CHAN_DFS_CLEAR)) == IEEE80211_CHAN_DFS)
#define IEEE80211_IS_CHAN_DFSFLAG(_c) \
(((_c)->ic_flagext & IEEE80211_CHAN_DFS) == IEEE80211_CHAN_DFS)
#define IEEE80211_IS_CHAN_DISALLOW_ADHOC(_c) \
(((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_ADHOC) != 0)
#define IEEE80211_IS_CHAN_11D_EXCLUDED(_c) \
(((_c)->ic_flagext & IEEE80211_CHAN_11D_EXCLUDED) != 0)
#define IEEE80211_IS_CHAN_CSA(_c) \
(((_c)->ic_flagext & IEEE80211_CHAN_CSA_RECEIVED) != 0)
#define IEEE80211_IS_CHAN_ODD(_c) \
(((_c)->ic_freq == 5170) || ((_c)->ic_freq == 5190) || \
((_c)->ic_freq == 5210) || ((_c)->ic_freq == 5230))
#define IEEE80211_IS_CHAN_DISALLOW_HOSTAP(_c) \
(((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_HOSTAP) != 0)
#define IEEE80211_IS_CHAN_11NG_HT20(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NG_HT20) == IEEE80211_CHAN_11NG_HT20)
#define IEEE80211_IS_CHAN_11NA_HT20(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NA_HT20) == IEEE80211_CHAN_11NA_HT20)
#define IEEE80211_IS_CHAN_11NG_HT40PLUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40PLUS) == IEEE80211_CHAN_11NG_HT40PLUS)
#define IEEE80211_IS_CHAN_11NG_HT40MINUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40MINUS) == IEEE80211_CHAN_11NG_HT40MINUS)
#define IEEE80211_IS_CHAN_11NA_HT40PLUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40PLUS) == IEEE80211_CHAN_11NA_HT40PLUS)
#define IEEE80211_IS_CHAN_11NA_HT40MINUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40MINUS) == IEEE80211_CHAN_11NA_HT40MINUS)
#define IEEE80211_IS_CHAN_11N(_c) \
(((_c)->ic_flags & (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
#define IEEE80211_IS_CHAN_11N_HT20(_c) \
(((_c)->ic_flags & (IEEE80211_CHAN_HT20)) != 0)
#define IEEE80211_IS_CHAN_11N_HT40(_c) \
(((_c)->ic_flags & (IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
#define IEEE80211_IS_CHAN_11NG(_c) \
(IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
#define IEEE80211_IS_CHAN_11NA(_c) \
(IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
#define IEEE80211_IS_CHAN_11N_HT40PLUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) != 0)
#define IEEE80211_IS_CHAN_11N_HT40MINUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) != 0)
#define IEEE80211_IS_CHAN_HT20_CAPABLE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT20) == IEEE80211_CHAN_HT20)
#define IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
#define IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
#define IEEE80211_IS_CHAN_HT40_CAPABLE(_c) \
(IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c))
#define IEEE80211_IS_CHAN_HT_CAPABLE(_c) \
(IEEE80211_IS_CHAN_HT20_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40_CAPABLE(_c))
#define IEEE80211_IS_CHAN_11N_CTL_CAPABLE(_c) IEEE80211_IS_CHAN_HT20_CAPABLE(_c)
#define IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
#define IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
#define IEEE80211_IS_CHAN_11N_CTL_40_CAPABLE(_c) \
(IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE((_c)) || IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE((_c)))
#define IEEE80211_IS_CHAN_VHT(_c) \
(((_c)->ic_flags & (IEEE80211_CHAN_VHT20 | \
IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80)) != 0)
#define IEEE80211_IS_CHAN_11AC(_c) \
( IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)) )
#define IEEE80211_CHAN_11AC_VHT20 \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT20)
#define IEEE80211_CHAN_11AC_VHT40 \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS )
#define IEEE80211_CHAN_11AC_VHT40PLUS \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS)
#define IEEE80211_CHAN_11AC_VHT40MINUS \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40MINUS)
#define IEEE80211_CHAN_11AC_VHT80 \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT80)
#define IEEE80211_IS_CHAN_11AC_VHT20(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20) == IEEE80211_CHAN_11AC_VHT20)
#define IEEE80211_IS_CHAN_11AC_VHT40(_c) \
(((_c)->ic_flags & (IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)) !=0)
#define IEEE80211_IS_CHAN_11AC_VHT40PLUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40PLUS) == IEEE80211_CHAN_11AC_VHT40PLUS)
#define IEEE80211_IS_CHAN_11AC_VHT40MINUS(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40MINUS) == IEEE80211_CHAN_11AC_VHT40MINUS)
#define IEEE80211_IS_CHAN_11AC_VHT80(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80) == IEEE80211_CHAN_11AC_VHT80)
#define IEEE80211_IS_CHAN_RADAR(_c) \
(((_c)->ic_flags & IEEE80211_CHAN_RADAR_DFS) == IEEE80211_CHAN_RADAR_DFS)
#define IEEE80211_CHAN_SET_RADAR(_c) \
((_c)->ic_flags |= IEEE80211_CHAN_RADAR_DFS)
#define IEEE80211_CHAN_CLR_RADAR(_c) \
((_c)->ic_flags &= ~IEEE80211_CHAN_RADAR_DFS)
#define IEEE80211_CHAN_SET_DISALLOW_ADHOC(_c) \
((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_ADHOC)
#define IEEE80211_CHAN_SET_DISALLOW_HOSTAP(_c) \
((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_HOSTAP)
#define IEEE80211_CHAN_SET_DFS(_c) \
((_c)->ic_flagext |= IEEE80211_CHAN_DFS)
#define IEEE80211_CHAN_SET_DFS_CLEAR(_c) \
((_c)->ic_flagext |= IEEE80211_CHAN_DFS_CLEAR)
#define IEEE80211_CHAN_EXCLUDE_11D(_c) \
((_c)->ic_flagext |= IEEE80211_CHAN_11D_EXCLUDED)
/* channel encoding for FH phy */
#define IEEE80211_FH_CHANMOD 80
#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
/*
* 802.11 rate set.
*/
#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
#define IEEE80211_RATE_MAXSIZE 36 /* max rates we'll handle */
#define IEEE80211_HT_RATE_SIZE 128
#define IEEE80211_RATE_SINGLE_STREAM_MCS_MAX 7 /* MCS7 */
#define IEEE80211_RATE_MCS 0x8000
#define IEEE80211_RATE_MCS_VAL 0x7FFF
#define IEEE80211_RATE_IDX_ENTRY(val, idx) (((val&(0xff<<(idx*8)))>>(idx*8)))
/*
* RSSI range
*/
#define IEEE80211_RSSI_MAX -10 /* in db */
#define IEEE80211_RSSI_MIN -200
/*
* 11n A-MPDU & A-MSDU limits
*/
#define IEEE80211_AMPDU_LIMIT_MIN (1 * 1024)
#define IEEE80211_AMPDU_LIMIT_MAX (64 * 1024 - 1)
#define IEEE80211_AMPDU_LIMIT_DEFAULT IEEE80211_AMPDU_LIMIT_MAX
#define IEEE80211_AMPDU_SUBFRAME_MIN 2
#define IEEE80211_AMPDU_SUBFRAME_MAX 64
#define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32
#define IEEE80211_AMSDU_LIMIT_MAX 4096
#define IEEE80211_RIFS_AGGR_DIV 10
#define IEEE80211_MAX_AMPDU_MIN 0
#define IEEE80211_MAX_AMPDU_MAX 3
/*
* 11ac A-MPDU limits
*/
#define IEEE80211_VHT_MAX_AMPDU_MIN 0
#define IEEE80211_VHT_MAX_AMPDU_MAX 7
struct ieee80211_rateset {
uint8_t rs_nrates;
uint8_t rs_rates[IEEE80211_RATE_MAXSIZE];
};
struct ieee80211_beacon_info {
uint8_t essid[IEEE80211_NWID_LEN + 1];
uint8_t esslen;
uint8_t rssi_ctl_0;
uint8_t rssi_ctl_1;
uint8_t rssi_ctl_2;
int numchains;
};
#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
struct ieee80211_ibss_peer_list {
uint8_t bssid[IEEE80211_ADDR_LEN];
};
struct ieee80211_roam {
int8_t rssi11a; /* rssi thresh for 11a bss */
int8_t rssi11b; /* for 11g sta in 11b bss */
int8_t rssi11bOnly; /* for 11b sta */
uint8_t pad1;
uint8_t rate11a; /* rate thresh for 11a bss */
uint8_t rate11b; /* for 11g sta in 11b bss */
uint8_t rate11bOnly; /* for 11b sta */
uint8_t pad2;
};
#define IEEE80211_TID_SIZE 17 /* total number of TIDs */
#define IEEE80211_NON_QOS_SEQ 16 /* index for non-QoS (including management) sequence number space */
#define IEEE80211_SEQ_MASK 0xfff /* sequence generator mask */
#define MIN_SW_SEQ 0x100 /* minimum sequence for SW generate packect */
/* crypto related defines*/
#define IEEE80211_KEYBUF_SIZE 16
#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */
enum ieee80211_clist_cmd {
CLIST_UPDATE,
CLIST_DFS_UPDATE,
CLIST_NEW_COUNTRY,
CLIST_NOL_UPDATE
};
enum ieee80211_nawds_param {
IEEE80211_NAWDS_PARAM_NUM = 0,
IEEE80211_NAWDS_PARAM_MODE,
IEEE80211_NAWDS_PARAM_DEFCAPS,
IEEE80211_NAWDS_PARAM_OVERRIDE,
};
struct ieee80211_mib_cycle_cnts {
uint32_t tx_frame_count;
uint32_t rx_frame_count;
uint32_t rx_clear_count;
uint32_t cycle_count;
uint8_t is_rx_active;
uint8_t is_tx_active;
};
struct ieee80211_chanutil_info {
uint32_t rx_clear_count;
uint32_t cycle_count;
uint8_t value;
uint32_t beacon_count;
uint8_t beacon_intervals;
};
#endif /* CDS_COMMON__IEEE80211_I_H_ */

View File

@@ -1,215 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC: cds_mq.c
*
* Connectivity driver services (CDS) message queue APIs
*
* Message Queue Definitions and API
*/
/* Include Files */
#include <cds_mq.h>
#include "cds_sched.h"
#include <cds_api.h>
#include "sir_types.h"
/* Preprocessor definitions and constants */
/* Type declarations */
/* Function declarations and documenation */
tSirRetStatus u_mac_post_ctrl_msg(void *pSirGlobal, void *pMb);
/**
* cds_mq_init() - initialize cds message queue
* @pMq: Pointer to the message queue
*
* This function initializes the Message queue.
*
* Return: cdf status
*/
inline CDF_STATUS cds_mq_init(p_cds_mq_type pMq)
{
if (pMq == NULL) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s: NULL pointer passed", __func__);
return CDF_STATUS_E_FAILURE;
}
/* Now initialize the lock */
spin_lock_init(&pMq->mqLock);
/* Now initialize the List data structure */
INIT_LIST_HEAD(&pMq->mqList);
return CDF_STATUS_SUCCESS;
} /* cds_mq_init() */
/**
* cds_mq_deinit() - de-initialize cds message queue
* @pMq: Pointer to the message queue
*
* This function de-initializes cds message queue
*
* Return: none
*/
inline void cds_mq_deinit(p_cds_mq_type pMq)
{
if (pMq == NULL) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s: NULL pointer passed", __func__);
return;
}
/* we don't have to do anything with the embedded list or spinlock */
} /* cds_mq_deinit() */
/**
* cds_mq_put() - add a message to the message queue
* @pMq: Pointer to the message queue
* @pMsgWrapper: Msg wrapper containing the message
*
* Return: none
*/
inline void cds_mq_put(p_cds_mq_type pMq, p_cds_msg_wrapper pMsgWrapper)
{
unsigned long flags;
if ((pMq == NULL) || (pMsgWrapper == NULL)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s: NULL pointer passed", __func__);
return;
}
spin_lock_irqsave(&pMq->mqLock, flags);
list_add_tail(&pMsgWrapper->msgNode, &pMq->mqList);
spin_unlock_irqrestore(&pMq->mqLock, flags);
} /* cds_mq_put() */
/**
* cds_mq_get() - get a message with its wrapper from a message queue
* @pMq: Pointer to the message queue
*
* Return: pointer to the message wrapper
*/
inline p_cds_msg_wrapper cds_mq_get(p_cds_mq_type pMq)
{
p_cds_msg_wrapper pMsgWrapper = NULL;
struct list_head *listptr;
unsigned long flags;
if (pMq == NULL) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s: NULL pointer passed", __func__);
return NULL;
}
spin_lock_irqsave(&pMq->mqLock, flags);
if (list_empty(&pMq->mqList)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_WARN,
"%s: CDS Message Queue is empty", __func__);
} else {
listptr = pMq->mqList.next;
pMsgWrapper =
(p_cds_msg_wrapper) list_entry(listptr, cds_msg_wrapper,
msgNode);
list_del(pMq->mqList.next);
}
spin_unlock_irqrestore(&pMq->mqLock, flags);
return pMsgWrapper;
} /* cds_mq_get() */
/**
* cds_is_mq_empty() - check if the message queue is empty
* @pMq: Pointer to the message queue
*
* Return: true if message queue is emtpy
* false otherwise
*/
inline bool cds_is_mq_empty(p_cds_mq_type pMq)
{
bool state = false;
unsigned long flags;
if (pMq == NULL) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s: NULL pointer passed", __func__);
return CDF_STATUS_E_FAILURE;
}
spin_lock_irqsave(&pMq->mqLock, flags);
state = list_empty(&pMq->mqList) ? true : false;
spin_unlock_irqrestore(&pMq->mqLock, flags);
return state;
} /* cds_mq_get() */
/**
* cds_send_mb_message_to_mac() - post a message to a message queue
* @pBuf: Pointer to buffer allocated by caller
*
* Return: cdf status
*/
CDF_STATUS cds_send_mb_message_to_mac(void *pBuf)
{
CDF_STATUS cdf_ret_status = CDF_STATUS_E_FAILURE;
tSirRetStatus sirStatus;
v_CONTEXT_t cds_context;
void *hHal;
cds_context = cds_get_global_context();
if (NULL == cds_context) {
CDF_TRACE(CDF_MODULE_ID_SYS, CDF_TRACE_LEVEL_ERROR,
"%s: invalid cds_context", __func__);
} else {
hHal = cds_get_context(CDF_MODULE_ID_SME);
if (NULL == hHal) {
CDF_TRACE(CDF_MODULE_ID_SYS, CDF_TRACE_LEVEL_ERROR,
"%s: invalid hHal", __func__);
} else {
sirStatus = u_mac_post_ctrl_msg(hHal, pBuf);
if (eSIR_SUCCESS == sirStatus)
cdf_ret_status = CDF_STATUS_SUCCESS;
}
}
cdf_mem_free(pBuf);
return cdf_ret_status;
}

View File

@@ -1,345 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**=========================================================================
\file cds_packet.c
\brief Connectivity driver services (CDS) network Packet APIs
Network Protocol packet/buffer support interfaces
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include <cds_packet.h>
#include <i_cds_packet.h>
#include <cdf_mc_timer.h>
#include <cdf_trace.h>
#include <wlan_hdd_main.h>
#include "cdf_nbuf.h"
#include "cdf_memory.h"
#define TX_PKT_MIN_HEADROOM (64)
/* Protocol specific packet tracking feature */
#define CDS_PKT_TRAC_ETH_TYPE_OFFSET (12)
#define CDS_PKT_TRAC_IP_OFFSET (14)
#define CDS_PKT_TRAC_IP_HEADER_SIZE (20)
#define CDS_PKT_TRAC_DHCP_SRV_PORT (67)
#define CDS_PKT_TRAC_DHCP_CLI_PORT (68)
#define CDS_PKT_TRAC_EAPOL_ETH_TYPE (0x888E)
#ifdef QCA_PKT_PROTO_TRACE
#define CDS_PKT_TRAC_MAX_STRING_LEN (12)
#define CDS_PKT_TRAC_MAX_TRACE_BUF (50)
#define CDS_PKT_TRAC_MAX_STRING_BUF (64)
/* protocol Storage Structure */
typedef struct {
uint32_t order;
v_TIME_t event_time;
char event_string[CDS_PKT_TRAC_MAX_STRING_LEN];
} cds_pkt_proto_trace_t;
cds_pkt_proto_trace_t *trace_buffer = NULL;
unsigned int trace_buffer_order = 0;
cdf_spinlock_t trace_buffer_lock;
#endif /* QCA_PKT_PROTO_TRACE */
/**
* cds_pkt_return_packet Free the cds Packet
* @ cds Packet
*/
CDF_STATUS cds_pkt_return_packet(cds_pkt_t *packet)
{
/* Validate the input parameter pointer */
if (unlikely(packet == NULL)) {
return CDF_STATUS_E_INVAL;
}
/* Free up the Adf nbuf */
cdf_nbuf_free(packet->pkt_buf);
packet->pkt_buf = NULL;
/* Free up the Rx packet */
cdf_mem_free(packet);
return CDF_STATUS_SUCCESS;
}
/**--------------------------------------------------------------------------
\brief cds_pkt_get_packet_length() - Get packet length for a cds Packet
This API returns the total length of the data in a cds Packet.
\param pPacket - the cds Packet to get the packet length from.
\param pPacketSize - location to return the total size of the data contained
in the cds Packet.
\return
\sa
---------------------------------------------------------------------------*/
CDF_STATUS
cds_pkt_get_packet_length(cds_pkt_t *pPacket, uint16_t *pPacketSize)
{
/* Validate the parameter pointers */
if (unlikely((pPacket == NULL) || (pPacketSize == NULL)) ||
(pPacket->pkt_buf == NULL)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"VPKT [%d]: NULL pointer", __LINE__);
return CDF_STATUS_E_INVAL;
}
/* return the requested information */
*pPacketSize = cdf_nbuf_len(pPacket->pkt_buf);
return CDF_STATUS_SUCCESS;
}
/*---------------------------------------------------------------------------
* @brief cds_pkt_get_proto_type() -
Find protoco type from packet contents
* skb Packet Pointer
* tracking_map packet type want to track
* dot11_type, type of dot11 frame
---------------------------------------------------------------------------*/
uint8_t cds_pkt_get_proto_type(struct sk_buff *skb, uint8_t tracking_map,
uint8_t dot11_type)
{
uint8_t pkt_proto_type = 0;
uint16_t ether_type;
uint16_t SPort;
uint16_t DPort;
if (dot11_type) {
if (dot11_type ==
(CDS_PKT_TRAC_TYPE_MGMT_ACTION & tracking_map))
pkt_proto_type |= CDS_PKT_TRAC_TYPE_MGMT_ACTION;
/* Protocol type map */
return pkt_proto_type;
}
/* EAPOL Tracking enabled */
if (CDS_PKT_TRAC_TYPE_EAPOL & tracking_map) {
ether_type = (uint16_t) (*(uint16_t *)
(skb->data +
CDS_PKT_TRAC_ETH_TYPE_OFFSET));
if (CDS_PKT_TRAC_EAPOL_ETH_TYPE == CDF_SWAP_U16(ether_type)) {
pkt_proto_type |= CDS_PKT_TRAC_TYPE_EAPOL;
}
}
/* DHCP Tracking enabled */
if (CDS_PKT_TRAC_TYPE_DHCP & tracking_map) {
SPort = (uint16_t) (*(uint16_t *)
(skb->data + CDS_PKT_TRAC_IP_OFFSET +
CDS_PKT_TRAC_IP_HEADER_SIZE));
DPort = (uint16_t) (*(uint16_t *)
(skb->data + CDS_PKT_TRAC_IP_OFFSET +
CDS_PKT_TRAC_IP_HEADER_SIZE +
sizeof(uint16_t)));
if (((CDS_PKT_TRAC_DHCP_SRV_PORT == CDF_SWAP_U16(SPort))
&& (CDS_PKT_TRAC_DHCP_CLI_PORT == CDF_SWAP_U16(DPort)))
|| ((CDS_PKT_TRAC_DHCP_CLI_PORT == CDF_SWAP_U16(SPort))
&& (CDS_PKT_TRAC_DHCP_SRV_PORT == CDF_SWAP_U16(DPort)))) {
pkt_proto_type |= CDS_PKT_TRAC_TYPE_DHCP;
}
}
/* Protocol type map */
return pkt_proto_type;
}
#ifdef QCA_PKT_PROTO_TRACE
/*---------------------------------------------------------------------------
* @brief cds_pkt_trace_buf_update() -
Update storage buffer with interest event string
* event_string Event String may packet type or outstanding event
---------------------------------------------------------------------------*/
void cds_pkt_trace_buf_update(char *event_string)
{
uint32_t slot;
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_INFO,
"%s %d, %s", __func__, __LINE__, event_string);
cdf_spinlock_acquire(&trace_buffer_lock);
slot = trace_buffer_order % CDS_PKT_TRAC_MAX_TRACE_BUF;
trace_buffer[slot].order = trace_buffer_order;
trace_buffer[slot].event_time = cdf_mc_timer_get_system_time();
cdf_mem_zero(trace_buffer[slot].event_string,
sizeof(trace_buffer[slot].event_string));
cdf_mem_copy(trace_buffer[slot].event_string,
event_string,
(CDS_PKT_TRAC_MAX_STRING_LEN < strlen(event_string)) ?
CDS_PKT_TRAC_MAX_STRING_LEN : strlen(event_string));
trace_buffer_order++;
cdf_spinlock_release(&trace_buffer_lock);
return;
}
/*---------------------------------------------------------------------------
* @brief cds_pkt_trace_buf_dump() -
Dump stored information into kernel log
---------------------------------------------------------------------------*/
void cds_pkt_trace_buf_dump(void)
{
uint32_t slot, idx;
cdf_spinlock_acquire(&trace_buffer_lock);
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"PACKET TRACE DUMP START Current Timestamp %u",
(unsigned int)cdf_mc_timer_get_system_time());
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"ORDER : TIME : EVT");
if (CDS_PKT_TRAC_MAX_TRACE_BUF > trace_buffer_order) {
for (slot = 0; slot < trace_buffer_order; slot++) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%5d :%12u : %s",
trace_buffer[slot].order,
(unsigned int)trace_buffer[slot].event_time,
trace_buffer[slot].event_string);
}
} else {
for (idx = 0; idx < CDS_PKT_TRAC_MAX_TRACE_BUF; idx++) {
slot =
(trace_buffer_order +
idx) % CDS_PKT_TRAC_MAX_TRACE_BUF;
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%5d :%12u : %s", trace_buffer[slot].order,
(unsigned int)trace_buffer[slot].event_time,
trace_buffer[slot].event_string);
}
}
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"PACKET TRACE DUMP END");
cdf_spinlock_release(&trace_buffer_lock);
return;
}
/*---------------------------------------------------------------------------
* @brief cds_pkt_proto_trace_init() -
Initialize protocol trace functionality, allocate required resource
---------------------------------------------------------------------------*/
void cds_pkt_proto_trace_init(void)
{
/* Init spin lock to protect global memory */
cdf_spinlock_init(&trace_buffer_lock);
trace_buffer_order = 0;
trace_buffer = cdf_mem_malloc(CDS_PKT_TRAC_MAX_TRACE_BUF *
sizeof(cds_pkt_proto_trace_t));
/* Register callback function to NBUF
* Lower layer event also will be reported to here */
cdf_nbuf_reg_trace_cb(cds_pkt_trace_buf_update);
return;
}
/*---------------------------------------------------------------------------
* @brief cds_pkt_proto_trace_close() -
Free required resource
---------------------------------------------------------------------------*/
void cds_pkt_proto_trace_close(void)
{
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
"%s %d", __func__, __LINE__);
cdf_mem_free(trace_buffer);
cdf_spinlock_destroy(&trace_buffer_lock);
return;
}
#endif /* QCA_PKT_PROTO_TRACE */
#ifdef MEMORY_DEBUG
/*---------------------------------------------------------------------------
* @brief cds_packet_alloc_debug() -
Allocate a network buffer for TX
---------------------------------------------------------------------------*/
CDF_STATUS cds_packet_alloc_debug(uint16_t size, void **data, void **ppPacket,
uint8_t *file_name, uint32_t line_num)
{
CDF_STATUS cdf_ret_status = CDF_STATUS_E_FAILURE;
cdf_nbuf_t nbuf;
nbuf =
cdf_nbuf_alloc_debug(NULL, roundup(size + TX_PKT_MIN_HEADROOM, 4),
TX_PKT_MIN_HEADROOM, sizeof(uint32_t), false,
file_name, line_num);
if (nbuf != NULL) {
cdf_nbuf_put_tail(nbuf, size);
cdf_nbuf_set_protocol(nbuf, ETH_P_CONTROL);
*ppPacket = nbuf;
*data = cdf_nbuf_data(nbuf);
cdf_ret_status = CDF_STATUS_SUCCESS;
}
return cdf_ret_status;
}
#else
/*---------------------------------------------------------------------------
* @brief cds_packet_alloc() -
Allocate a network buffer for TX
---------------------------------------------------------------------------*/
CDF_STATUS cds_packet_alloc(uint16_t size, void **data, void **ppPacket)
{
CDF_STATUS cdf_ret_status = CDF_STATUS_E_FAILURE;
cdf_nbuf_t nbuf;
nbuf = cdf_nbuf_alloc(NULL, roundup(size + TX_PKT_MIN_HEADROOM, 4),
TX_PKT_MIN_HEADROOM, sizeof(uint32_t), false);
if (nbuf != NULL) {
cdf_nbuf_put_tail(nbuf, size);
cdf_nbuf_set_protocol(nbuf, ETH_P_CONTROL);
*ppPacket = nbuf;
*data = cdf_nbuf_data(nbuf);
cdf_ret_status = CDF_STATUS_SUCCESS;
}
return cdf_ret_status;
}
#endif
/*---------------------------------------------------------------------------
* @brief cds_packet_free() -
Free input network buffer
---------------------------------------------------------------------------*/
void cds_packet_free(void *pPacket)
{
cdf_nbuf_free((cdf_nbuf_t) pPacket);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,743 +0,0 @@
/*
* Copyright (c) 2011,2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/*
* Notifications and licenses are retained for attribution purposes only.
*/
/*
* Copyright (c) 2002-2006 Sam Leffler, Errno Consulting
* Copyright (c) 2005-2006 Atheros Communications, Inc.
* Copyright (c) 2010, Atheros Communications Inc.
*
* Redistribution and use in source and binary forms are permitted
* provided that the following conditions are met:
* 1. The materials contained herein are unmodified and are used
* unmodified.
* 2. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following NO
* ''WARRANTY'' disclaimer below (''Disclaimer''), without
* modification.
* 3. Redistributions in binary form must reproduce at minimum a
* disclaimer similar to the Disclaimer below and any redistribution
* must be conditioned upon including a substantially similar
* Disclaimer requirement for further binary redistribution.
* 4. Neither the names of the above-listed copyright holders nor the
* names of any contributors may be used to endorse or promote
* product derived from this software without specific prior written
* permission.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
* FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include <cdf_types.h>
#include "wma.h"
#include "cds_regdomain.h"
#include "cds_regdomain_common.h"
static regdm_supp_op_classes regdm_curr_supp_opp_classes = { 0 };
/* Global Operating Classes */
regdm_op_class_map_t global_op_class[] = {
{81, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}},
{82, 25, BW20, {14}},
{83, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9}},
{84, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13}},
{115, 20, BW20, {36, 40, 44, 48}},
{116, 40, BW40_LOW_PRIMARY, {36, 44}},
{117, 40, BW40_HIGH_PRIMARY, {40, 48}},
{118, 20, BW20, {52, 56, 60, 64}},
{119, 40, BW40_LOW_PRIMARY, {52, 60}},
{120, 40, BW40_HIGH_PRIMARY, {56, 64}},
{121, 20, BW20,
{100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}},
{122, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}},
{123, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}},
{125, 20, BW20, {149, 153, 157, 161, 165, 169}},
{126, 40, BW40_LOW_PRIMARY, {149, 157}},
{127, 40, BW40_HIGH_PRIMARY, {153, 161}},
{128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108,
112, 116, 120, 124, 128, 132, 136, 140, 144,
149, 153, 157, 161} },
{0, 0, 0, {0}},
};
/* Operating Classes in US */
regdm_op_class_map_t us_op_class[] = {
{1, 20, BW20, {36, 40, 44, 48}},
{2, 20, BW20, {52, 56, 60, 64}},
{4, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
144} },
{5, 20, BW20, {149, 153, 157, 161, 165}},
{12, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}},
{22, 40, BW40_LOW_PRIMARY, {36, 44}},
{23, 40, BW40_LOW_PRIMARY, {52, 60}},
{24, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}},
{26, 40, BW40_LOW_PRIMARY, {149, 157}},
{27, 40, BW40_HIGH_PRIMARY, {40, 48}},
{28, 40, BW40_HIGH_PRIMARY, {56, 64}},
{29, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}},
{31, 40, BW40_HIGH_PRIMARY, {153, 161}},
{32, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7}},
{33, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11}},
{128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108,
112, 116, 120, 124, 128, 132, 136, 140, 144,
149, 153, 157, 161} },
{0, 0, 0, {0}},
};
/* Operating Classes in Europe */
regdm_op_class_map_t euro_op_class[] = {
{1, 20, BW20, {36, 40, 44, 48}},
{2, 20, BW20, {52, 56, 60, 64}},
{3, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}},
{4, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}},
{5, 40, BW40_LOW_PRIMARY, {36, 44}},
{6, 40, BW40_LOW_PRIMARY, {52, 60}},
{7, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}},
{8, 40, BW40_HIGH_PRIMARY, {40, 48}},
{9, 40, BW40_HIGH_PRIMARY, {56, 64}},
{10, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}},
{11, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9}},
{12, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13}},
{17, 20, BW20, {149, 153, 157, 161, 165, 169}},
{128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
116, 120, 124, 128} },
{0, 0, 0, {0}},
};
/* Operating Classes in Japan */
regdm_op_class_map_t japan_op_class[] = {
{1, 20, BW20, {36, 40, 44, 48}},
{30, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}},
{31, 25, BW20, {14}},
{32, 20, BW20, {52, 56, 60, 64}},
{34, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}},
{36, 40, BW40_LOW_PRIMARY, {36, 44}},
{37, 40, BW40_LOW_PRIMARY, {52, 60}},
{39, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132}},
{41, 40, BW40_HIGH_PRIMARY, {40, 48}},
{42, 40, BW40_HIGH_PRIMARY, {56, 64}},
{44, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136}},
{128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
116, 120, 124, 128} },
{0, 0, 0, {0}},
};
/*
* By default, the regdomain tables reference the common tables
* from regdomain_common.h. These default tables can be replaced
* by calls to populate_regdomain_tables functions.
*/
HAL_REG_DMN_TABLES ol_regdmn_rdt = {
ah_cmn_reg_domain_pairs, /* regDomainPairs */
ah_cmn_all_countries, /* allCountries */
ah_cmn_reg_domains, /* allRegDomains */
CDF_ARRAY_SIZE(ah_cmn_reg_domain_pairs), /* regDomainPairsCt */
CDF_ARRAY_SIZE(ah_cmn_all_countries), /* allCountriesCt */
CDF_ARRAY_SIZE(ah_cmn_reg_domains), /* allRegDomainCt */
};
static uint16_t get_eeprom_rd(uint16_t rd)
{
return rd & ~WORLDWIDE_ROAMING_FLAG;
}
/*
* Return whether or not the regulatory domain/country in EEPROM
* is acceptable.
*/
static bool regdmn_is_eeprom_valid(uint16_t rd)
{
int32_t i;
if (rd & COUNTRY_ERD_FLAG) {
uint16_t cc = rd & ~COUNTRY_ERD_FLAG;
for (i = 0; i < ol_regdmn_rdt.allCountriesCt; i++)
if (ol_regdmn_rdt.allCountries[i].countryCode == cc)
return true;
} else {
for (i = 0; i < ol_regdmn_rdt.regDomainPairsCt; i++)
if (ol_regdmn_rdt.regDomainPairs[i].regDmnEnum == rd)
return true;
}
/* TODO: Bring it under debug level */
cdf_print("%s: invalid regulatory domain/country code 0x%x\n",
__func__, rd);
return false;
}
/*
* Find the pointer to the country element in the country table
* corresponding to the country code
*/
static const COUNTRY_CODE_TO_ENUM_RD *find_country(uint16_t country_code)
{
int32_t i;
for (i = 0; i < ol_regdmn_rdt.allCountriesCt; i++) {
if (ol_regdmn_rdt.allCountries[i].countryCode == country_code)
return &ol_regdmn_rdt.allCountries[i];
}
return NULL; /* Not found */
}
int32_t cds_get_country_from_alpha2(uint8_t *alpha2)
{
int32_t i;
for (i = 0; i < ol_regdmn_rdt.allCountriesCt; i++) {
if (ol_regdmn_rdt.allCountries[i].isoName[0] == alpha2[0] &&
ol_regdmn_rdt.allCountries[i].isoName[1] == alpha2[1])
return ol_regdmn_rdt.allCountries[i].countryCode;
}
return CTRY_DEFAULT;
}
static uint16_t regdmn_get_default_country(uint16_t rd)
{
int32_t i;
if (rd & COUNTRY_ERD_FLAG) {
const COUNTRY_CODE_TO_ENUM_RD *country = NULL;
uint16_t cc = rd & ~COUNTRY_ERD_FLAG;
country = find_country(cc);
if (country)
return cc;
}
/*
* Check reg domains that have only one country
*/
for (i = 0; i < ol_regdmn_rdt.regDomainPairsCt; i++) {
if (ol_regdmn_rdt.regDomainPairs[i].regDmnEnum == rd) {
if (ol_regdmn_rdt.regDomainPairs[i].singleCC != 0)
return ol_regdmn_rdt.regDomainPairs[i].singleCC;
else
i = ol_regdmn_rdt.regDomainPairsCt;
}
}
return CTRY_DEFAULT;
}
static const REG_DMN_PAIR_MAPPING *get_regdmn_pair(uint16_t reg_dmn)
{
int32_t i;
for (i = 0; i < ol_regdmn_rdt.regDomainPairsCt; i++) {
if (ol_regdmn_rdt.regDomainPairs[i].regDmnEnum == reg_dmn)
return &ol_regdmn_rdt.regDomainPairs[i];
}
return NULL;
}
static const REG_DOMAIN *get_regdmn(uint16_t reg_dmn)
{
int32_t i;
for (i = 0; i < ol_regdmn_rdt.regDomainsCt; i++) {
if (ol_regdmn_rdt.regDomains[i].regDmnEnum == reg_dmn)
return &ol_regdmn_rdt.regDomains[i];
}
return NULL;
}
static const COUNTRY_CODE_TO_ENUM_RD *get_country_from_rd(uint16_t regdmn)
{
int32_t i;
for (i = 0; i < ol_regdmn_rdt.allCountriesCt; i++) {
if (ol_regdmn_rdt.allCountries[i].regDmnEnum == regdmn)
return &ol_regdmn_rdt.allCountries[i];
}
return NULL; /* Not found */
}
/*
* Some users have reported their EEPROM programmed with
* 0x8000 set, this is not a supported regulatory domain
* but since we have more than one user with it we need
* a solution for them. We default to WOR0_WORLD
*/
static void regd_sanitize(struct regulatory *reg)
{
if (reg->reg_domain != COUNTRY_ERD_FLAG)
return;
reg->reg_domain = WOR0_WORLD;
}
/*
* Returns country string for the given regulatory domain.
*/
int32_t cds_fill_some_regulatory_info(struct regulatory *reg)
{
uint16_t country_code;
uint16_t regdmn, rd;
const COUNTRY_CODE_TO_ENUM_RD *country = NULL;
regd_sanitize(reg);
rd = reg->reg_domain;
if (!regdmn_is_eeprom_valid(rd))
return -EINVAL;
regdmn = get_eeprom_rd(rd);
country_code = regdmn_get_default_country(regdmn);
if (country_code == CTRY_DEFAULT && regdmn == CTRY_DEFAULT) {
/* Set to CTRY_UNITED_STATES for testing */
country_code = CTRY_UNITED_STATES;
}
if (country_code != CTRY_DEFAULT) {
country = find_country(country_code);
if (!country) {
/* TODO: Bring it under debug level */
cdf_print(KERN_ERR "Not a valid country code\n");
return -EINVAL;
}
regdmn = country->regDmnEnum;
}
reg->regpair = get_regdmn_pair(regdmn);
if (!reg->regpair) {
/* TODO: Bring it under debug level */
cdf_print(KERN_ERR "No regpair is found, can not proceeed\n");
return -EINVAL;
}
reg->country_code = country_code;
if (!country)
country = get_country_from_rd(regdmn);
if (country) {
reg->alpha2[0] = country->isoName[0];
reg->alpha2[1] = country->isoName[1];
} else {
reg->alpha2[0] = '0';
reg->alpha2[1] = '0';
}
return 0;
}
/*
* Returns regulatory domain for given country string
*/
int32_t regdmn_get_regdmn_for_country(uint8_t *alpha2)
{
uint8_t i;
for (i = 0; i < ol_regdmn_rdt.allCountriesCt; i++) {
if ((ol_regdmn_rdt.allCountries[i].isoName[0] == alpha2[0]) &&
(ol_regdmn_rdt.allCountries[i].isoName[1] == alpha2[1]))
return ol_regdmn_rdt.allCountries[i].regDmnEnum;
}
return -1;
}
/*
* Test to see if the bitmask array is all zeros
*/
static bool is_chan_bit_mask_zero(const uint64_t *bitmask)
{
int i;
for (i = 0; i < BMLEN; i++) {
if (bitmask[i] != 0)
return false;
}
return true;
}
/*
* Return the mask of available modes based on the hardware
* capabilities and the specified country code and reg domain.
*/
static uint32_t regdmn_getwmodesnreg(uint32_t modesAvail,
const COUNTRY_CODE_TO_ENUM_RD *country,
const REG_DOMAIN *rd5GHz)
{
/* Check country regulations for allowed modes */
if ((modesAvail & (REGDMN_MODE_11A_TURBO | REGDMN_MODE_TURBO)) &&
(!country->allow11aTurbo))
modesAvail &= ~(REGDMN_MODE_11A_TURBO | REGDMN_MODE_TURBO);
if ((modesAvail & REGDMN_MODE_11G_TURBO) && (!country->allow11gTurbo))
modesAvail &= ~REGDMN_MODE_11G_TURBO;
if ((modesAvail & REGDMN_MODE_11G) && (!country->allow11g))
modesAvail &= ~REGDMN_MODE_11G;
if ((modesAvail & REGDMN_MODE_11A) &&
(is_chan_bit_mask_zero(rd5GHz->chan11a)))
modesAvail &= ~REGDMN_MODE_11A;
if ((modesAvail & REGDMN_MODE_11NG_HT20) && (!country->allow11ng20))
modesAvail &= ~REGDMN_MODE_11NG_HT20;
if ((modesAvail & REGDMN_MODE_11NA_HT20) && (!country->allow11na20))
modesAvail &= ~REGDMN_MODE_11NA_HT20;
if ((modesAvail & REGDMN_MODE_11NG_HT40PLUS) && (!country->allow11ng40))
modesAvail &= ~REGDMN_MODE_11NG_HT40PLUS;
if ((modesAvail & REGDMN_MODE_11NG_HT40MINUS) &&
(!country->allow11ng40))
modesAvail &= ~REGDMN_MODE_11NG_HT40MINUS;
if ((modesAvail & REGDMN_MODE_11NA_HT40PLUS) && (!country->allow11na40))
modesAvail &= ~REGDMN_MODE_11NA_HT40PLUS;
if ((modesAvail & REGDMN_MODE_11NA_HT40MINUS) &&
(!country->allow11na40))
modesAvail &= ~REGDMN_MODE_11NA_HT40MINUS;
if ((modesAvail & REGDMN_MODE_11AC_VHT20) && (!country->allow11na20))
modesAvail &= ~REGDMN_MODE_11AC_VHT20;
if ((modesAvail & REGDMN_MODE_11AC_VHT40PLUS) &&
(!country->allow11na40))
modesAvail &= ~REGDMN_MODE_11AC_VHT40PLUS;
if ((modesAvail & REGDMN_MODE_11AC_VHT40MINUS) &&
(!country->allow11na40))
modesAvail &= ~REGDMN_MODE_11AC_VHT40MINUS;
if ((modesAvail & REGDMN_MODE_11AC_VHT80) && (!country->allow11na80))
modesAvail &= ~REGDMN_MODE_11AC_VHT80;
if ((modesAvail & REGDMN_MODE_11AC_VHT20_2G) && (!country->allow11ng20))
modesAvail &= ~REGDMN_MODE_11AC_VHT20_2G;
return modesAvail;
}
void cds_fill_send_ctl_info_to_fw(struct regulatory *reg, uint32_t modesAvail,
uint32_t modeSelect)
{
const REG_DOMAIN *regdomain2G = NULL;
const REG_DOMAIN *regdomain5G = NULL;
int8_t ctl_2g, ctl_5g, ctl;
const REG_DOMAIN *rd = NULL;
const struct cmode *cm;
const COUNTRY_CODE_TO_ENUM_RD *country;
const REG_DMN_PAIR_MAPPING *regpair;
regpair = reg->regpair;
regdomain2G = get_regdmn(regpair->regDmn2GHz);
if (!regdomain2G) {
cdf_print(KERN_ERR "Failed to get regdmn 2G");
return;
}
regdomain5G = get_regdmn(regpair->regDmn5GHz);
if (!regdomain5G) {
cdf_print(KERN_ERR "Failed to get regdmn 5G");
return;
}
/* find first nible of CTL */
ctl_2g = regdomain2G->conformance_test_limit;
ctl_5g = regdomain5G->conformance_test_limit;
/* find second nible of CTL */
country = find_country(reg->country_code);
if (country != NULL)
modesAvail =
regdmn_getwmodesnreg(modesAvail, country, regdomain5G);
for (cm = modes; cm < &modes[CDF_ARRAY_SIZE(modes)]; cm++) {
if ((cm->mode & modeSelect) == 0)
continue;
if ((cm->mode & modesAvail) == 0)
continue;
switch (cm->mode) {
case REGDMN_MODE_TURBO:
rd = regdomain5G;
ctl = rd->conformance_test_limit | CTL_TURBO;
break;
case REGDMN_MODE_11A:
case REGDMN_MODE_11NA_HT20:
case REGDMN_MODE_11NA_HT40PLUS:
case REGDMN_MODE_11NA_HT40MINUS:
case REGDMN_MODE_11AC_VHT20:
case REGDMN_MODE_11AC_VHT40PLUS:
case REGDMN_MODE_11AC_VHT40MINUS:
case REGDMN_MODE_11AC_VHT80:
rd = regdomain5G;
ctl = rd->conformance_test_limit;
break;
case REGDMN_MODE_11B:
rd = regdomain2G;
ctl = rd->conformance_test_limit | CTL_11B;
break;
case REGDMN_MODE_11G:
case REGDMN_MODE_11NG_HT20:
case REGDMN_MODE_11NG_HT40PLUS:
case REGDMN_MODE_11NG_HT40MINUS:
case REGDMN_MODE_11AC_VHT20_2G:
case REGDMN_MODE_11AC_VHT40_2G:
case REGDMN_MODE_11AC_VHT80_2G:
rd = regdomain2G;
ctl = rd->conformance_test_limit | CTL_11G;
break;
case REGDMN_MODE_11G_TURBO:
rd = regdomain2G;
ctl = rd->conformance_test_limit | CTL_108G;
break;
case REGDMN_MODE_11A_TURBO:
rd = regdomain5G;
ctl = rd->conformance_test_limit | CTL_108G;
break;
default:
cdf_print(KERN_ERR "%s: Unkonwn HAL mode 0x%x\n",
__func__, cm->mode);
continue;
}
if (rd == regdomain2G)
ctl_2g = ctl;
if (rd == regdomain5G)
ctl_5g = ctl;
}
/* save the ctl information for future reference */
reg->ctl_5g = ctl_5g;
reg->ctl_2g = ctl_2g;
wma_send_regdomain_info_to_fw(reg->reg_domain, regpair->regDmn2GHz,
regpair->regDmn5GHz, ctl_2g, ctl_5g);
}
/* cds_set_wma_dfs_region() - to set the dfs region to wma
*
* @reg: the regulatory handle
*
* Return: none
*/
void cds_set_wma_dfs_region(struct regulatory *reg)
{
tp_wma_handle wma = cds_get_context(CDF_MODULE_ID_WMA);
if (!wma) {
cdf_print(KERN_ERR "%s: Unable to get WMA handle", __func__);
return;
}
cdf_print("%s: dfs_region: %d", __func__, reg->dfs_region);
wma_set_dfs_region(wma, reg->dfs_region);
}
void cds_fill_and_send_ctl_to_fw(struct regulatory *reg)
{
tp_wma_handle wma = cds_get_context(CDF_MODULE_ID_WMA);
uint32_t modeSelect = 0xFFFFFFFF;
if (!wma) {
WMA_LOGE("%s: Unable to get WMA handle", __func__);
return;
}
wma_get_modeselect(wma, &modeSelect);
cds_fill_send_ctl_info_to_fw(reg, wma->reg_cap.wireless_modes,
modeSelect);
return;
}
/* get the ctl from regdomain */
uint8_t cds_get_ctl_for_regdmn(uint32_t reg_dmn)
{
uint8_t i;
uint8_t default_regdmn_ctl = FCC;
if (reg_dmn == CTRY_DEFAULT) {
return default_regdmn_ctl;
} else {
for (i = 0; i < ol_regdmn_rdt.regDomainsCt; i++) {
if (ol_regdmn_rdt.regDomains[i].regDmnEnum == reg_dmn)
return ol_regdmn_rdt.regDomains[i].
conformance_test_limit;
}
}
return -1;
}
/*
* Get the 5G reg domain value for reg doamin
*/
uint16_t cds_get_regdmn_5g(uint32_t reg_dmn)
{
uint16_t i;
for (i = 0; i < ol_regdmn_rdt.regDomainPairsCt; i++) {
if (ol_regdmn_rdt.regDomainPairs[i].regDmnEnum == reg_dmn) {
return ol_regdmn_rdt.regDomainPairs[i].regDmn5GHz;
}
}
cdf_print("%s: invalid regulatory domain/country code 0x%x\n",
__func__, reg_dmn);
return 0;
}
/**
* cds_regdm_get_chanwidth_from_opclass() - return chan width based on opclass
* @country: country name
* @channel: operating channel
* @opclass: operating class
*
* Given a value of country, channel and opclass this API will return value of
* channel width.
*
* Return: channel width
*
*/
uint16_t cds_regdm_get_chanwidth_from_opclass(uint8_t *country,
uint8_t channel,
uint8_t opclass)
{
regdm_op_class_map_t *class;
uint16_t i;
if (true == cdf_mem_compare(country, "US", 2))
class = us_op_class;
else if (true == cdf_mem_compare(country, "EU", 2))
class = euro_op_class;
else if (true == cdf_mem_compare(country, "JP", 2))
class = japan_op_class;
else
class = global_op_class;
while (class->op_class) {
if (opclass == class->op_class) {
for (i = 0;
(i < MAX_CHANNELS_PER_OPERATING_CLASS &&
class->channels[i]);
i++) {
if (channel == class->channels[i])
return class->ch_spacing;
}
}
class++;
}
return 0;
}
/*
* Get operating class for a given channel
*/
uint16_t cds_regdm_get_opclass_from_channel(uint8_t *country, uint8_t channel,
uint8_t offset)
{
regdm_op_class_map_t *class = NULL;
uint16_t i = 0;
if (true == cdf_mem_compare(country, "US", 2)) {
class = us_op_class;
} else if (true == cdf_mem_compare(country, "EU", 2)) {
class = euro_op_class;
} else if (true == cdf_mem_compare(country, "JP", 2)) {
class = japan_op_class;
} else {
class = global_op_class;
}
while (class->op_class) {
if ((offset == class->offset) || (offset == BWALL)) {
for (i = 0;
(i < MAX_CHANNELS_PER_OPERATING_CLASS &&
class->channels[i]); i++) {
if (channel == class->channels[i])
return class->op_class;
}
}
class++;
}
return 0;
}
/*
* Set current operating classes per country, regdomain
*/
uint16_t cds_regdm_set_curr_opclasses(uint8_t num_classes, uint8_t *class)
{
uint8_t i;
if (SIR_MAC_MAX_SUPP_OPER_CLASSES < num_classes) {
cdf_print(KERN_ERR "%s: Invalid numClasses (%d)\n",
__func__, num_classes);
return -1;
}
for (i = 0; i < num_classes; i++) {
regdm_curr_supp_opp_classes.classes[i] = class[i];
}
regdm_curr_supp_opp_classes.num_classes = num_classes;
return 0;
}
/*
* Get current operating classes
*/
uint16_t cds_regdm_get_curr_opclasses(uint8_t *num_classes, uint8_t *class)
{
uint8_t i;
if (!num_classes || !class) {
cdf_print(KERN_ERR "%s: Either num_classes or class is null\n",
__func__);
return -1;
}
for (i = 0; i < regdm_curr_supp_opp_classes.num_classes; i++) {
class[i] = regdm_curr_supp_opp_classes.classes[i];
}
*num_classes = regdm_curr_supp_opp_classes.num_classes;
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,98 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined( __I_CDS_PACKET_H )
#define __I_CDS_PACKET_H
/**=========================================================================
\file i_cds_packet.h
\brief Connectivity driver services network packet APIs
Network Protocol packet/buffer internal include file
========================================================================*/
/*--------------------------------------------------------------------------
Include Files
------------------------------------------------------------------------*/
#include "cdf_types.h"
/**
* Rx Packet Struct
* Buffer for the packet received from WMA has pointers to 802.11
* frame fields and additional information based on the type of frame.
* @channel: Channel number
* @snr: Signal to noise ratio
* @rssi: Received signal strength indicator, normalized to -96 dBm as
* normal noise floor by adding -96 to snr. All the configured
* thresholds in the driver assume that noise floor is -96 dBm.
* @timestamp: System timestamp when frame was received. Set to jiffies.
* @mpdu_hdr_ptr: Pointer to beginning of 802.11 MPDU
* @mpdu_data_ptr: Pointer to beginning of payload
* @mpdu_len: Length of 802.11 MPDU
* @mpdu_hdr_len: Length of 802.11 MPDU header
* @mpdu_data_len: Length of 802.11 MPDU payload
* @offloadScanLearn: Bit set to 1 for beacons received during roaming scan
* @roamCandidateInd: Bit set to 1 when roaming candidate is found by fw
* @scan: Bit set to 1 if packet received during scanning
* @scan_src: Source of scan
* @dpuFeedback: DPU feedback for frame
* @sessionId: PE session
* @tsf_delta: Delta between tsf in frame and local value of tsf
* @rssi_raw: rssi based on actual noise floor in hardware.
*/
typedef struct {
uint8_t channel;
uint8_t snr;
uint32_t rssi;
uint32_t timestamp;
uint8_t *mpdu_hdr_ptr;
uint8_t *mpdu_data_ptr;
uint32_t mpdu_len;
uint32_t mpdu_hdr_len;
uint32_t mpdu_data_len;
uint8_t offloadScanLearn : 1;
uint8_t roamCandidateInd : 1;
uint8_t scan : 1;
uint8_t scan_src;
uint8_t dpuFeedback;
uint8_t sessionId;
uint32_t tsf_delta;
uint32_t rssi_raw;
} t_packetmeta, *tp_packetmeta;
/* implementation specific cds packet type */
struct cds_pkt_t {
/* Packet Meta Information */
t_packetmeta pkt_meta;
/* Pointer to Packet */
void *pkt_buf;
};
#endif /* !defined( __I_CDS_PACKET_H ) */

View File

@@ -1,571 +0,0 @@
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
* $FreeBSD: src/sys/sys/queue.h,v 1.58 2004/04/07 04:19:49 imp Exp $
*/
#if !defined(__NetBSD__)
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
/*
* This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues.
*
* A singly-linked list is headed by a single forward pointer. The elements
* are singly linked for minimum space and pointer manipulation overhead at
* the expense of O(n) removal for arbitrary elements. New elements can be
* added to the list after an existing element or at the head of the list.
* Elements being removed from the head of the list should use the explicit
* macro for this purpose for optimum efficiency. A singly-linked list may
* only be traversed in the forward direction. Singly-linked lists are ideal
* for applications with large datasets and few or no removals or for
* implementing a LIFO queue.
*
* A singly-linked tail queue is headed by a pair of pointers, one to the
* head of the list and the other to the tail of the list. The elements are
* singly linked for minimum space and pointer manipulation overhead at the
* expense of O(n) removal for arbitrary elements. New elements can be added
* to the list after an existing element, at the head of the list, or at the
* end of the list. Elements being removed from the head of the tail queue
* should use the explicit macro for this purpose for optimum efficiency.
* A singly-linked tail queue may only be traversed in the forward direction.
* Singly-linked tail queues are ideal for applications with large datasets
* and few or no removals or for implementing a FIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* For details on the use of these macros, see the queue(3) manual page.
*
*
* SLIST LIST STAILQ TAILQ
* _HEAD + + + +
* _HEAD_INITIALIZER + + + +
* _ENTRY + + + +
* _INIT + + + +
* _EMPTY + + + +
* _FIRST + + + +
* _NEXT + + + +
* _PREV - - - +
* _LAST - - + +
* _FOREACH + + + +
* _FOREACH_SAFE + + + +
* _FOREACH_REVERSE - - - +
* _FOREACH_REVERSE_SAFE - - - +
* _INSERT_HEAD + + + +
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
* _CONCAT - - + +
* _REMOVE_HEAD + - + -
* _REMOVE + + + +
*
*/
#define QUEUE_MACRO_DEBUG 0
#if QUEUE_MACRO_DEBUG
/* Store the last 2 places the queue element or head was altered */
struct qm_trace {
char *lastfile;
int lastline;
char *prevfile;
int prevline;
};
#define TRACEBUF struct qm_trace trace;
#define TRASHIT(x) do {(x) = (void *)NULL; } while (0)
#define QMD_TRACE_HEAD(head) do { \
(head)->trace.prevline = (head)->trace.lastline; \
(head)->trace.prevfile = (head)->trace.lastfile; \
(head)->trace.lastline = __LINE__; \
(head)->trace.lastfile = __FILE__; \
} while (0)
#define QMD_TRACE_ELEM(elem) do { \
(elem)->trace.prevline = (elem)->trace.lastline; \
(elem)->trace.prevfile = (elem)->trace.lastfile; \
(elem)->trace.lastline = __LINE__; \
(elem)->trace.lastfile = __FILE__; \
} while (0)
#else
#define QMD_TRACE_ELEM(elem)
#define QMD_TRACE_HEAD(head)
#define TRACEBUF
#define TRASHIT(x) do {(x) = (void *)0; } while (0)
#endif /* QUEUE_MACRO_DEBUG */
#ifdef ATHR_RNWF
/* NDIS contains a defn for SLIST_ENTRY and SINGLE_LIST_ENTRY */
#endif
/*
* Singly-linked List declarations.
*/
#define SLIST_HEAD(name, type) \
struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define SING_LIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List functions.
*/
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
#define SLIST_FIRST(head) ((head)->slh_first)
#define SLIST_FOREACH(var, head, field) \
for ((var) = SLIST_FIRST((head)); \
(var); \
(var) = SLIST_NEXT((var), field))
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
for ((varp) = &SLIST_FIRST((head)); \
((var) = *(varp)) != NULL; \
(varp) = &SLIST_NEXT((var), field))
#define SLIST_INIT(head) do { \
SLIST_FIRST((head)) = NULL; \
} while (0)
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
SLIST_NEXT((slistelm), field) = (elm); \
} while (0)
#define SLIST_INSERT_HEAD(head, elm, field) do { \
SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
SLIST_FIRST((head)) = (elm); \
} while (0)
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
#define SLIST_REMOVE(head, elm, type, field) do { \
if (SLIST_FIRST((head)) == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = SLIST_FIRST((head)); \
while (SLIST_NEXT(curelm, field) != (elm)) \
curelm = SLIST_NEXT(curelm, field); \
SLIST_NEXT(curelm, field) = \
SLIST_NEXT(SLIST_NEXT(curelm, field), field); \
} \
} while (0)
#define SLIST_REMOVE_HEAD(head, field) do { \
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
} while (0)
/*
* Singly-linked Tail queue declarations.
*/
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first; /* first element */ \
struct type **stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
/*
* Singly-linked Tail queue functions.
*/
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
*(head1)->stqh_last = (head2)->stqh_first; \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_INIT((head2)); \
} \
} while (0)
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
#define STAILQ_FIRST(head) ((head)->stqh_first)
#define STAILQ_FOREACH(var, head, field) \
for((var) = STAILQ_FIRST((head)); \
(var); \
(var) = STAILQ_NEXT((var), field))
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define STAILQ_INIT(head) do { \
STAILQ_FIRST((head)) = NULL; \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
STAILQ_NEXT((tqelm), field) = (elm); \
} while (0)
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
STAILQ_FIRST((head)) = (elm); \
} while (0)
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
STAILQ_NEXT((elm), field) = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *) \
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
#define STAILQ_REMOVE(head, elm, type, field) do { \
if (STAILQ_FIRST((head)) == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = STAILQ_FIRST((head)); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
if ((STAILQ_NEXT(curelm, field) = \
STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((curelm), field); \
} \
} while (0)
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
if (STAILQ_NEXT(elm, field)) { \
if ((STAILQ_NEXT(elm, field) = \
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} \
} while (0)
#define STAILQ_REMOVE_HEAD(head, field) do { \
if ((STAILQ_FIRST((head)) = \
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
/*
* List declarations.
*/
#define ATH_LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
#ifndef LIST_HEAD
#define LIST_HEAD ATH_LIST_HEAD
#endif
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
/*
* List functions.
*/
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
#define LIST_FIRST(head) ((head)->lh_first)
#define LIST_FOREACH(var, head, field) \
for ((var) = LIST_FIRST((head)); \
(var); \
(var) = LIST_NEXT((var), field))
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
#define LIST_INIT(head) do { \
LIST_FIRST((head)) = NULL; \
} while (0)
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL) \
LIST_NEXT((listelm), field)->field.le_prev = \
&LIST_NEXT((elm), field); \
LIST_NEXT((listelm), field) = (elm); \
(elm)->field.le_prev = &LIST_NEXT((listelm), field); \
} while (0)
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
LIST_NEXT((elm), field) = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &LIST_NEXT((elm), field); \
} while (0)
#define LIST_INSERT_HEAD(head, elm, field) do { \
if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field); \
LIST_FIRST((head)) = (elm); \
(elm)->field.le_prev = &LIST_FIRST((head)); \
} while (0)
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
#define LIST_REMOVE(elm, field) do { \
if (LIST_NEXT((elm), field) != NULL) \
LIST_NEXT((elm), field)->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = LIST_NEXT((elm), field); \
} while (0)
/*
* Tail queue declarations.
*/
#define HEADNAME
#define COPY_HEADNAME(head)
#define TAILQ_HEAD(name, type) \
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
HEADNAME \
TRACEBUF \
}
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
TRACEBUF \
}
/*
* Tail queue functions.
*/
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_FOREACH(var, head, field) \
for ((var) = TAILQ_FIRST((head)); \
(var); \
(var) = TAILQ_NEXT((var), field))
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var); \
(var) = TAILQ_PREV((var), headname, field))
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
for ((var) = TAILQ_LAST((head), headname); \
(var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
(var) = (tvar))
#define TAILQ_INIT(head) do { \
TAILQ_FIRST((head)) = NULL; \
(head)->tqh_last = &TAILQ_FIRST((head)); \
COPY_HEADNAME(head); \
QMD_TRACE_HEAD(head); \
} while (0)
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL) \
TAILQ_NEXT((elm), field)->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else { \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
} \
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
TAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
TAILQ_FIRST((head))->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_FIRST((head)) = (elm); \
(elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_REMOVE(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field)) != NULL) \
TAILQ_NEXT((elm), field)->field.tqe_prev = \
(elm)->field.tqe_prev; \
else { \
(head)->tqh_last = (elm)->field.tqe_prev; \
QMD_TRACE_HEAD(head); \
} \
*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
TRASHIT((elm)->field.tqe_next); \
TRASHIT((elm)->field.tqe_prev); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (0)
#ifdef _KERNEL
/*
* XXX insque() and remque() are an old way of handling certain queues.
* They bogusly assumes that all queue heads look alike.
*/
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
static __inline void insque(void *a, void *b)
{
struct quehead *element = (struct quehead *)a,
*head = (struct quehead *)b;
element->qh_link = head->qh_link;
element->qh_rlink = head;
head->qh_link = element;
element->qh_link->qh_rlink = element;
}
static __inline void remque(void *a)
{
struct quehead *element = (struct quehead *)a;
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;
element->qh_rlink = 0;
}
#else /* !(__GNUC__ || __INTEL_COMPILER) */
void insque(void *a, void *b);
void remque(void *a);
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* _KERNEL */
#endif /* !_SYS_QUEUE_H_ */
#else /* !__NetBSD__ */
#include_next <sys/queue.h>
#endif /* __NetBSD__ */

View File

@@ -1,253 +0,0 @@
/*
* Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _QC_SAP_IOCTL_H_
#define _QC_SAP_IOCTL_H_
/*
* QCSAP ioctls.
*/
/*
* Max size of optional information elements. We artificially
* constrain this; it's limited only by the max frame size (and
* the max parameter size of the wireless extensions).
*/
#define QCSAP_MAX_OPT_IE 256
#define QCSAP_MAX_WSC_IE 256
#define QCSAP_MAX_GET_STA_INFO 512
typedef struct sSSID {
uint8_t length;
uint8_t ssId[32];
} tSSID;
typedef struct sSSIDInfo {
tSSID ssid;
uint8_t ssidHidden;
} tSSIDInfo;
typedef enum {
eQC_DOT11_MODE_ALL = 0,
eQC_DOT11_MODE_ABG = 0x0001, /* 11a/b/g only, no HT, no proprietary */
eQC_DOT11_MODE_11A = 0x0002,
eQC_DOT11_MODE_11B = 0x0004,
eQC_DOT11_MODE_11G = 0x0008,
eQC_DOT11_MODE_11N = 0x0010,
eQC_DOT11_MODE_11G_ONLY = 0x0020,
eQC_DOT11_MODE_11N_ONLY = 0x0040,
eQC_DOT11_MODE_11B_ONLY = 0x0080,
eQC_DOT11_MODE_11A_ONLY = 0x0100,
/* This is for WIFI test. It is same as eWNIAPI_MAC_PROTOCOL_ALL except when it starts IBSS in 11B of 2.4GHz */
/* It is for CSR internal use */
eQC_DOT11_MODE_AUTO = 0x0200,
} tQcPhyMode;
#define QCSAP_ADDR_LEN 6
typedef uint8_t qcmacaddr[QCSAP_ADDR_LEN];
struct qc_mac_acl_entry {
qcmacaddr addr;
int vlan_id;
};
typedef enum {
eQC_AUTH_TYPE_OPEN_SYSTEM,
eQC_AUTH_TYPE_SHARED_KEY,
eQC_AUTH_TYPE_AUTO_SWITCH
} eQcAuthType;
typedef enum {
eQC_WPS_BEACON_IE,
eQC_WPS_PROBE_RSP_IE,
eQC_WPS_ASSOC_RSP_IE
} eQCWPSType;
/*
* Retrieve the WPA/RSN information element for an associated station.
*/
struct sQcSapreq_wpaie {
uint8_t wpa_ie[QCSAP_MAX_OPT_IE];
uint8_t wpa_macaddr[QCSAP_ADDR_LEN];
};
/*
* Retrieve the WSC information element for an associated station.
*/
struct sQcSapreq_wscie {
uint8_t wsc_macaddr[QCSAP_ADDR_LEN];
uint8_t wsc_ie[QCSAP_MAX_WSC_IE];
};
/*
* Retrieve the WPS PBC Probe Request IEs.
*/
typedef struct sQcSapreq_WPSPBCProbeReqIES {
struct cdf_mac_addr macaddr;
uint16_t probeReqIELen;
uint8_t probeReqIE[512];
} sQcSapreq_WPSPBCProbeReqIES_t;
/*
* Channel List Info
*/
typedef struct {
uint8_t num_channels;
uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
} tChannelListInfo, *tpChannelListInfo;
#ifdef __linux__
/*
* Wireless Extensions API, private ioctl interfaces.
*
* NB: Even-numbered ioctl numbers have set semantics and are privileged!
* (regardless of the incorrect comment in wireless.h!)
*/
#define QCSAP_IOCTL_SETPARAM (SIOCIWFIRSTPRIV+0)
#define QCSAP_IOCTL_GETPARAM (SIOCIWFIRSTPRIV+1)
/* (SIOCIWFIRSTPRIV+2) is unused */
/* (SIOCIWFIRSTPRIV+3) is unused */
#define QCSAP_IOCTL_GET_STAWPAIE (SIOCIWFIRSTPRIV+4)
#define QCSAP_IOCTL_SETWPAIE (SIOCIWFIRSTPRIV+5)
#define QCSAP_IOCTL_STOPBSS (SIOCIWFIRSTPRIV+6)
#define QCSAP_IOCTL_VERSION (SIOCIWFIRSTPRIV+7)
#define QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES (SIOCIWFIRSTPRIV+8)
#define QCSAP_IOCTL_GET_CHANNEL (SIOCIWFIRSTPRIV+9)
#define QCSAP_IOCTL_ASSOC_STA_MACADDR (SIOCIWFIRSTPRIV+10)
#define QCSAP_IOCTL_DISASSOC_STA (SIOCIWFIRSTPRIV+11)
/* (SIOCIWFIRSTPRIV+12) is unused */
/* Private ioctls and their sub-ioctls */
#define QCSAP_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 13)
#define QCSAP_GET_STATS 1
#define QCSAP_LIST_FW_PROFILE 2
#define QCSAP_IOCTL_CLR_STATS (SIOCIWFIRSTPRIV+14)
#define QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV+15)
#define WE_SET_WLAN_DBG 1
#define WE_SET_DP_TRACE 2
#define WE_SET_SAP_CHANNELS 3
#define QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV+16)
#define WE_UNIT_TEST_CMD 7
#define QCSAP_IOCTL_SET_CHANNEL_RANGE (SIOCIWFIRSTPRIV+17)
#define WE_P2P_NOA_CMD 2
#define QCSAP_IOCTL_MODIFY_ACL (SIOCIWFIRSTPRIV+18)
#define QCSAP_IOCTL_GET_CHANNEL_LIST (SIOCIWFIRSTPRIV+19)
#define QCSAP_IOCTL_SET_TX_POWER (SIOCIWFIRSTPRIV+20)
#define QCSAP_IOCTL_GET_STA_INFO (SIOCIWFIRSTPRIV+21)
#define QCSAP_IOCTL_SET_MAX_TX_POWER (SIOCIWFIRSTPRIV+22)
#define QCSAP_IOCTL_GET_INI_CFG (SIOCIWFIRSTPRIV+25)
#define QCSAP_IOCTL_SET_INI_CFG (SIOCIWFIRSTPRIV+26)
#define QCSAP_IOCTL_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
#ifdef DEBUG
#define QCSAP_IOCTL_SET_FW_CRASH_INJECT 1
#endif
#define QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL 2
#define QCSAP_ENABLE_FW_PROFILE 3
#define QCSAP_SET_FW_PROFILE_HIST_INTVL 4
#define MAX_VAR_ARGS 7
#define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
#define QCSAP_IOCTL_MAX_STR_LEN 1024
#define RC_2_RATE_IDX(_rc) ((_rc) & 0x7)
#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1)
#define RC_2_RATE_IDX_11AC(_rc) ((_rc) & 0xf)
#define HT_RC_2_STREAMS_11AC(_rc) ((((_rc) & 0x30) >> 4) + 1)
enum {
QCSAP_PARAM_MAX_ASSOC = 1,
QCSAP_PARAM_GET_WLAN_DBG,
QCSAP_PARAM_CLR_ACL = 4,
QCSAP_PARAM_ACL_MODE,
QCSAP_PARAM_HIDE_SSID,
QCSAP_PARAM_AUTO_CHANNEL,
QCSAP_PARAM_SET_MC_RATE,
QCSAP_PARAM_SET_TXRX_FW_STATS,
QCSAP_PARAM_SET_MCC_CHANNEL_LATENCY,
QCSAP_PARAM_SET_MCC_CHANNEL_QUOTA,
QCSAP_DBGLOG_LOG_LEVEL,
QCSAP_DBGLOG_VAP_ENABLE,
QCSAP_DBGLOG_VAP_DISABLE,
QCSAP_DBGLOG_MODULE_ENABLE,
QCSAP_DBGLOG_MODULE_DISABLE,
QCSAP_DBGLOG_MOD_LOG_LEVEL,
QCSAP_DBGLOG_TYPE,
QCSAP_DBGLOG_REPORT_ENABLE,
QCASAP_TXRX_FWSTATS_RESET,
QCSAP_PARAM_RTSCTS,
QCASAP_SET_11N_RATE,
QCASAP_SET_VHT_RATE,
QCASAP_SHORT_GI,
QCSAP_SET_AMPDU,
QCSAP_SET_AMSDU,
QCSAP_GTX_HT_MCS,
QCSAP_GTX_VHT_MCS,
QCSAP_GTX_USRCFG,
QCSAP_GTX_THRE,
QCSAP_GTX_MARGIN,
QCSAP_GTX_STEP,
QCSAP_GTX_MINTPC,
QCSAP_GTX_BWMASK,
#ifdef QCA_PKT_PROTO_TRACE
QCASAP_SET_DEBUG_LOG,
#endif
QCASAP_SET_TM_LEVEL,
QCASAP_SET_DFS_IGNORE_CAC,
QCASAP_GET_DFS_NOL,
QCASAP_SET_DFS_NOL,
QCSAP_PARAM_SET_CHANNEL_CHANGE,
QCASAP_SET_DFS_TARGET_CHNL,
QCASAP_SET_RADAR_CMD,
QCSAP_GET_ACL,
QCASAP_TX_CHAINMASK_CMD,
QCASAP_RX_CHAINMASK_CMD,
QCASAP_NSS_CMD,
QCSAP_IPA_UC_STAT,
QCASAP_SET_PHYMODE,
QCASAP_GET_TEMP_CMD,
QCASAP_DUMP_STATS,
QCASAP_CLEAR_STATS,
QCASAP_SET_RADAR_DBG,
QCSAP_GET_FW_PROFILE_DATA,
QCSAP_START_FW_PROFILING
};
int iw_softap_get_channel_list(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
#endif /* __linux__ */
#endif /*_QC_SAP_IOCTL_H_*/

View File

@@ -1,264 +0,0 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_ASSOC_H__)
#define WLAN_HDD_ASSOC_H__
/**
* DOC: wlan_hdd_assoc.h
*
*/
/* Include files */
#include <wlan_hdd_mib.h>
#include <sme_api.h>
#include <wlan_defs.h>
#include "ol_txrx_ctrl_api.h"
/* Preprocessor Definitions and Constants */
#ifdef FEATURE_WLAN_TDLS
#define HDD_MAX_NUM_TDLS_STA 8
#define HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN 1
#define TDLS_STA_INDEX_VALID(staId) \
(((staId) >= 1) && ((staId) < 0xFF))
#endif
#define TKIP_COUNTER_MEASURE_STARTED 1
#define TKIP_COUNTER_MEASURE_STOPED 0
/* Timeout (in ms) for Link to Up before Registering Station */
#define ASSOC_LINKUP_TIMEOUT 60
/* Type Declarations */
/**
* typedef eConnectionState - Connection states
* @eConnectionState_NotConnected: Not associated in Infra or participating
* in an IBSS / Ad-hoc network
* @eConnectionState_Connecting: While connection in progress
* @eConnectionState_Associated: Associated in an Infrastructure network
* @eConnectionState_IbssDisconnected: Participating in an IBSS network though
* disconnected (no partner stations in the IBSS)
* @eConnectionState_IbssConnected: Participating in an IBSS network with
* partner stations also present
* eConnectionState_Disconnecting: Disconnecting in an Infrastructure network
*/
typedef enum {
eConnectionState_NotConnected,
eConnectionState_Connecting,
eConnectionState_Associated,
eConnectionState_IbssDisconnected,
eConnectionState_IbssConnected,
eConnectionState_Disconnecting
} eConnectionState;
/**
* typedef ePeerStatus - Peer status
* @ePeerConnected: peer connected
* @ePeerDisconnected: peer disconnected
*/
typedef enum {
ePeerConnected = 1,
ePeerDisconnected
} ePeerStatus;
/**
* typedef connection_info_t - structure to store connection information
* @connState: connection state of the NIC
* @connDot11DesiredBssType: BSS type of the current connection.
* Comes from the MIB at the time the connect request is issued
* in combination with the BssDescription from the
* associated entity
* @bssId: BSSID
* @SSID: SSID Info
* @staId: Station ID
* @peerMacAddress:Peer Mac Address of the IBSS Stations
* @authType: Auth Type
* @ucEncryptionType: Unicast Encryption Type
* @mcEncryptionType: Multicast Encryption Type
* @Keys: Keys
* @operationChannel: Operation Channel
* @uIsAuthenticated: Remembers authenticated state
* @dot11Mode: dot11Mode
* @proxyARPService: proxy arp service
* @ptk_installed: ptk installed state
* @gtk_installed: gtk installed state
* @nss: number of spatial streams negotiated
* @rate_flags: rate flags for current connection
*/
typedef struct connection_info_s {
eConnectionState connState;
eMib_dot11DesiredBssType connDot11DesiredBssType;
struct cdf_mac_addr bssId;
tCsrSSIDInfo SSID;
uint8_t staId[MAX_IBSS_PEERS];
struct cdf_mac_addr peerMacAddress[MAX_IBSS_PEERS];
eCsrAuthType authType;
eCsrEncryptionType ucEncryptionType;
eCsrEncryptionType mcEncryptionType;
tCsrKeys Keys;
uint8_t operationChannel;
uint8_t uIsAuthenticated;
uint32_t dot11Mode;
uint8_t proxyARPService;
bool ptk_installed;
bool gtk_installed;
uint8_t nss;
uint32_t rate_flags;
} connection_info_t;
/* Forward declarations */
typedef struct hdd_adapter_s hdd_adapter_t;
typedef struct hdd_context_s hdd_context_t;
typedef struct hdd_station_ctx hdd_station_ctx_t;
typedef struct hdd_ap_ctx_s hdd_ap_ctx_t;
typedef struct hdd_mon_ctx_s hdd_mon_ctx_t;
/**
* hdd_is_connecting() - Function to check connection progress
* @hdd_sta_ctx: pointer to global HDD Station context
*
* Return: true if connecting, false otherwise
*/
bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx);
/**
* hdd_conn_is_connected() - Function to check connection status
* @pHddStaCtx: pointer to global HDD Station context
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx);
/**
* hdd_conn_get_connected_band() - get current connection radio band
* @pHddStaCtx: pointer to global HDD Station context
*
* Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection
* eCSR_BAND_ALL if not connected
*/
eCsrBand hdd_conn_get_connected_band(hdd_station_ctx_t *pHddStaCtx);
/**
* hdd_sme_roam_callback() - hdd sme roam callback
* @pContext: pointer to adapter context
* @pRoamInfo: pointer to roam info
* @roamId: roam id
* @roamStatus: roam status
* @roamResult: roam result
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo,
uint32_t roamId,
eRoamCmdStatus roamStatus,
eCsrRoamResult roamResult);
/**
* hdd_conn_get_connected_bss_type() - get current bss type
* @pHddStaCtx: pointer to global HDD Station context
* @pConnectedBssType: pointer to connected bss type
*
* Return: false if any errors encountered, true otherwise
*/
bool
hdd_conn_get_connected_bss_type(hdd_station_ctx_t *pHddStaCtx,
eMib_dot11DesiredBssType *pConnectedBssType);
/**
* hdd_set_genie_to_csr() - set genie to csr
* @pAdapter: pointer to adapter
* @RSNAuthType: pointer to auth type
*
* Return: 0 on success, error number otherwise
*/
int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType);
/**
* hdd_set_csr_auth_type() - set csr auth type
* @pAdapter: pointer to adapter
* @RSNAuthType: auth type
*
* Return: 0 on success, error number otherwise
*/
int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType);
/**
* hdd_roam_register_tdlssta() - register new TDLS station
* @pAdapter: pointer to adapter
* @peerMac: pointer to peer MAC address
* @staId: station identifier
* @ucastSig: unicast signature
*
* Construct the staDesc and register with TL the new STA.
* This is called as part of ADD_STA in the TDLS setup.
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter,
const uint8_t *peerMac, uint16_t staId,
uint8_t ucastSig);
/**
* hdd_perform_roam_set_key_complete() - perform set key complete
* @pAdapter: pointer to adapter
*
* Return: none
*/
void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter);
#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
/**
* hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results
* @pAdapter: pointer to adapter
* @measurementToken: measurement token
* @flag: flag
* @numBss: number of bss
*
* If the measurement is none and no scan results found,
* indicate the supplicant about measurement done.
*
* Return: none
*/
void
hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter,
const uint16_t measurementToken,
const bool flag,
const uint8_t numBss);
#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
CDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter,
uint8_t sta_id,
enum ol_txrx_peer_state sta_state,
bool roam_synch_in_progress);
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo);
#else
static inline bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo)
{
return false;
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,79 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_CONC_UT_H
#define __WLAN_HDD_CONC_UT_H
/* Include files */
#include "wlan_hdd_main.h"
#include "cds_concurrency.h"
#ifdef MPC_UT_FRAMEWORK
void clean_report(hdd_context_t *hdd_ctx);
void fill_report(hdd_context_t *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
bool status, enum cds_pcl_type pcl_type, char *reason, uint8_t *pcl);
void print_report(hdd_context_t *hdd_ctx);
void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx);
void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, enum cds_chain_mode first_chain_mask);
void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
enum cds_chain_mode chain_mask, uint8_t use_same_mac);
#else
static inline void clean_report(hdd_context_t *hdd_ctx)
{
}
static inline void fill_report(hdd_context_t *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
bool status, enum hdd_pcl_type pcl_type, char *reason, uint8_t *pcl)
{
}
static inline void print_report(hdd_context_t *hdd_ctx)
{
}
static inline void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx)
{
}
static inline void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, enum hdd_chain_mode first_chain_mask)
{
}
static inline void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
enum hdd_chain_mode chain_mask, uint8_t use_same_mac)
{
}
#endif
#endif

View File

@@ -1,44 +0,0 @@
/*
* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _WLAN_HDD_DEBUGFS_H
#define _WLAN_HDD_DEBUGFS_H
#ifdef WLAN_OPEN_SOURCE
CDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter);
void hdd_debugfs_exit(hdd_context_t *pHddCtx);
#else
inline CDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter)
{
return CDF_STATUS_SUCCESS;
}
inline void hdd_debugfs_exit(hdd_context_t *pHddCtx)
{
}
#endif /* #ifdef WLAN_OPEN_SOURCE */
#endif /* #ifndef _WLAN_HDD_DEBUGFS_H */

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_DRIVER_OPS_H__
#define __WLAN_HDD_DRIVER_OPS_H__
/**
* DOC: wlan_hdd_driver_ops.h
*
* Functions to register the wlan driver.
*/
int wlan_hdd_register_driver(void);
void wlan_hdd_unregister_driver(void);
int wlan_hdd_bus_suspend(pm_message_t state);
#endif /* __WLAN_HDD_DRIVER_OPS_H__ */

View File

@@ -1,89 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _WLAN_HDD_ETHER_H
#define _WLAN_HDD_ETHER_H
/*============================================================================
@file wlan_hdd_ether.h
This module describes Ethernet packet formats for processing by HDD.
============================================================================*/
/* $Header$ */
/*----------------------------------------------------------------------------
* Include Files
* -------------------------------------------------------------------------*/
#include <linux/version.h>
#include <linux/byteorder/generic.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
/*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants
* -------------------------------------------------------------------------*/
#define WLAN_SNAP_OUI_LEN 3
#define WLAN_SNAP_DSAP 0xAAU
#define WLAN_SNAP_SSAP 0xAAU
#define WLAN_SNAP_CTRL 0x03
#define WLAN_MIN_PROTO 0x0600
/*----------------------------------------------------------------------------
* Type Declarations
* -------------------------------------------------------------------------*/
struct wlan_snap_hdr {
unsigned char dsap;
unsigned char ssap;
unsigned char ctrl;
unsigned char oui[WLAN_SNAP_OUI_LEN];
} __packed;
struct wlan_8023 {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
__be16 h_len;
struct wlan_snap_hdr h_snap;
__be16 h_proto;
} __packed;
struct wlan_8023_vlan {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
__be16 h_vlan_proto;
__be16 h_vlan_TCI;
__be16 h_len;
struct wlan_snap_hdr h_snap;
__be16 h_proto;
} __packed;
union generic_ethhdr {
struct ethhdr eth_II;
struct vlan_ethhdr eth_IIv;
struct wlan_8023 eth_8023;
struct wlan_8023_vlan eth_8023v;
};
#endif /* #ifndef _WLAN_HDD_ETHER_H */

View File

@@ -1,68 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef WLAN_HDD_FTM_H
#define WLAN_HDD_FTM_H
/**
* DOC: wlan_hdd_ftm.h
*
* WLAN Host Device Driver Factory Test Mode header file
*/
#include "cdf_status.h"
#include "cds_mq.h"
#include "cds_api.h"
#include "msg.h"
#include "cdf_types.h"
#include <wlan_ptt_sock_svc.h>
enum wlan_hdd_ftm_state {
WLAN_FTM_INITIALIZED,
WLAN_FTM_STOPPED,
WLAN_FTM_STARTED,
};
/**
* struct wlan_hdd_ftm_status - FTM status
* @ftm_state: The current state of the FTM process
*/
struct wlan_hdd_ftm_status {
enum wlan_hdd_ftm_state ftm_state;
};
int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx);
int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx);
#if defined(QCA_WIFI_FTM)
CDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len);
int wlan_hdd_qcmbr_unified_ioctl(hdd_adapter_t *adapter, struct ifreq *ifr);
int hdd_ftm_start(hdd_context_t *hdd_ctx);
int hdd_ftm_stop(hdd_context_t *hdd_ctx);
#endif
#endif

View File

@@ -1,60 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_HOST_OFFLOAD_H__
#define __WLAN_HDD_HOST_OFFLOAD_H__
/**===========================================================================
\file wlan_hdd_host_offload.h
\brief Android WLAN HDD Host Offload API
==========================================================================*/
/* Offload types. */
#define WLAN_IPV4_ARP_REPLY_OFFLOAD 0
#define WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD 1
/* Enable or disable offload. */
#define WLAN_OFFLOAD_DISABLE 0
#define WLAN_OFFLOAD_ENABLE 0x1
#define WLAN_OFFLOAD_BC_FILTER_ENABLE 0x2
#define WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE (WLAN_OFFLOAD_ENABLE | WLAN_OFFLOAD_BC_FILTER_ENABLE)
/* Offload request. */
typedef struct {
uint8_t offloadType;
uint8_t enableOrDisable;
union {
uint8_t hostIpv4Addr[SIR_IPV4_ADDR_LEN];
uint8_t hostIpv6Addr[SIR_MAC_IPV6_ADDR_LEN];
} params;
struct cdf_mac_addr bssId;
} tHostOffloadRequest, *tpHostOffloadRequest;
#endif /* __WLAN_HDD_HOST_OFFLOAD_H__ */

View File

@@ -1,69 +0,0 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(HDD_INCLUDES_H__)
#define HDD_INCLUDES_H__
/**===========================================================================
\file wlan_hdd_includes.h
\brief Internal includes for the Linux HDD
==========================================================================*/
/* $HEADER$ */
/*---------------------------------------------------------------------------
Include files
-------------------------------------------------------------------------*/
/* throw all the includes in here f to get the .c files in the HDD to compile. */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/wireless.h>
#include <linux/if_arp.h>
#include "ol_txrx_ctrl_api.h"
#include <cds_api.h>
#include <sme_api.h>
#include "wlan_hdd_assoc.h"
#include "wlan_hdd_mib.h"
#include "wlan_hdd_wext.h"
#include "wlan_hdd_main.h"
#include "wlan_hdd_tx_rx.h"
#ifdef FEATURE_OEM_DATA_SUPPORT
/*include for oem data req specific structures*/
/*and function declarations*/
#include "wlan_hdd_oemdata.h"
#endif
#endif /* end #if !defined(HDD_INCLUDES_H__) */

View File

@@ -1,171 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef HDD_IPA_H__
#define HDD_IPA_H__
/**
* DOC: wlan_hdd_ipa.h
*
* WLAN IPA interface module headers
* Originally written by Qualcomm Atheros, Inc
*/
#include <linux/ipa.h>
#ifdef IPA_OFFLOAD
/* Include files */
CDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx);
CDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx);
CDF_STATUS hdd_ipa_process_rxt(void *cds_context, cdf_nbuf_t rxBuf,
uint8_t sta_id);
int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum ipa_wlan_event type, uint8_t *mac_addr);
int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, uint64_t tx_packets,
uint64_t rx_packets);
int hdd_ipa_suspend(hdd_context_t *hdd_ctx);
int hdd_ipa_resume(hdd_context_t *hdd_ctx);
void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx, uint32_t *ipa_tx_diff,
uint32_t *ipa_rx_diff);
void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx);
void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, uint8_t reason);
bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx);
bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx);
int hdd_ipa_send_mcc_scc_msg(hdd_context_t *pHddCtx, bool mcc_mode);
int hdd_ipa_uc_ssr_reinit(void);
int hdd_ipa_uc_ssr_deinit(void);
void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx);
struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx,
struct sk_buff *skb, uint8_t session_id);
#else
static inline CDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx)
{
return CDF_STATUS_SUCCESS;
}
static inline CDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx)
{
return CDF_STATUS_SUCCESS;
}
static inline CDF_STATUS hdd_ipa_process_rxt(void *cds_context,
cdf_nbuf_t rxBuf, uint8_t sta_id)
{
return CDF_STATUS_SUCCESS;
}
static inline int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum ipa_wlan_event type, uint8_t *mac_addr)
{
return 0;
}
static inline int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx,
bool mcc_mode)
{
return 0;
}
static inline int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx,
uint64_t tx_packets,
uint64_t rx_packets)
{
return 0;
}
static inline int hdd_ipa_suspend(hdd_context_t *hdd_ctx)
{
return 0;
}
static inline int hdd_ipa_resume(hdd_context_t *hdd_ctx)
{
return 0;
}
static inline void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx,
uint32_t *ipa_tx_diff,
uint32_t *ipa_rx_diff)
{
*ipa_tx_diff = 0;
*ipa_rx_diff = 0;
return;
}
static inline void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter,
uint8_t reason)
{
return;
}
static inline void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx)
{
return;
}
static inline bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx)
{
return false;
}
static inline bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx)
{
return false;
}
static inline int hdd_ipa_uc_ssr_reinit(void)
{
return false;
}
static inline int hdd_ipa_uc_ssr_deinit(void)
{
return false;
}
static inline void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx)
{
return;
}
/**
* hdd_ipa_tx_packet_ipa() - send packet to IPA
* @hdd_ctx: Global HDD context
* @skb: skb sent to IPA
* @session_id: send packet instance session id
*
* Send TX packet which generated by system to IPA.
* This routine only will be used for function verification
*
* Return: NULL packet sent to IPA properly
* skb packet not sent to IPA. legacy data path should handle
*/
static inline struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx,
struct sk_buff *skb, uint8_t session_id)
{
return skb;
}
#endif /* IPA_OFFLOAD */
#endif /* #ifndef HDD_IPA_H__ */

View File

@@ -1,145 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_LRO_H__
#define __WLAN_HDD_LRO_H__
/**
* DOC: wlan_hdd_lro.h
*
* WLAN LRO interface module headers
*/
/**
* enum hdd_lro_rx_status - LRO receive frame status
* @HDD_LRO_RX: frame sent over the LRO interface
* @HDD_LRO_NO_RX: frame not sent over the LRO interface
*/
enum hdd_lro_rx_status {
HDD_LRO_RX = 0,
HDD_LRO_NO_RX = 1,
};
#if defined(FEATURE_LRO)
#include <linux/inet_lro.h>
#include <linux/list.h>
/* LRO_DESC_TABLE_SZ must be a power of 2 */
#define LRO_DESC_TABLE_SZ 16
#define LRO_DESC_TABLE_SZ_MASK (LRO_DESC_TABLE_SZ - 1)
#define LRO_DESC_POOL_SZ 10
/**
* hdd_lro_desc_entry - defines the LRO descriptor
* element stored in the list
* @lro_node: node of the list
* @lro_desc: the LRO descriptor contained in this list entry
*/
struct hdd_lro_desc_entry {
struct list_head lro_node;
struct net_lro_desc *lro_desc;
};
/**
* hdd_lro_desc_pool - pool of free LRO descriptors
* @lro_desc_array: array of LRO descriptors allocated
* @lro_free_list_head: head of the list
* @lro_pool_lock: lock to protect access to the list
*/
struct hdd_lro_desc_pool {
struct hdd_lro_desc_entry *lro_desc_array;
struct list_head lro_free_list_head;
cdf_spinlock_t lro_pool_lock;
};
/**
* hdd_lro_desc_table - defines each entry of the LRO
* hash table
* @lro_desc_list: list of LRO descriptors
*/
struct hdd_lro_desc_table {
struct list_head lro_desc_list;
};
/**
* hdd_lro_desc_info - structure containing the LRO
* descriptor information
* @lro_hash_table: hash table used for a quick desc. look-up
* @lro_hash_lock: lock to protect access to the hash table
* @lro_desc_pool: Free pool of LRO descriptors
*/
struct hdd_lro_desc_info {
struct hdd_lro_desc_table *lro_hash_table;
cdf_spinlock_t lro_hash_lock;
struct hdd_lro_desc_pool lro_desc_pool;
};
/**
* hdd_lro_s - LRO information per HDD adapter
* @lro_mgr: LRO manager
* @lro_desc_info: LRO descriptor information
*/
struct hdd_lro_s {
struct net_lro_mgr *lro_mgr;
struct hdd_lro_desc_info lro_desc_info;
};
int hdd_lro_init(hdd_context_t *hdd_ctx);
int hdd_lro_enable(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter);
void hdd_lro_disable(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter, struct sk_buff *skb);
void hdd_lro_flush_all(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter);
#else
struct hdd_lro_s {};
static inline int hdd_lro_enable(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter)
{
return 0;
}
static inline enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter, struct sk_buff *skb)
{
return HDD_LRO_NO_RX;
}
static inline int hdd_lro_init(hdd_context_t *hdd_ctx)
{
return 0;
}
static inline void hdd_lro_disable(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter){}
#endif /* FEATURE_LRO */
#endif /* __WLAN_HDD_LRO_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,92 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC : wlan_hdd_memdump.h
*
* WLAN Host Device Driver file for dumping firmware memory
*
*/
#if !defined(WLAN_HDD_MEMDUMP_H)
#define WLAN_HDD_MEMDUMP_H
#include "wlan_hdd_main.h"
#ifdef WLAN_FEATURE_MEMDUMP
/**
* enum qca_wlan_vendor_attr_memory_dump - values for memory dump attributes
* @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID - Invalid
* @QCA_WLAN_VENDOR_ATTR_REQUEST_ID - Indicate request ID
* @QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE - Indicate size of the memory dump
* @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - To keep track of the last enum
* @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX - max value possible for this type
*
* enum values are used for NL attributes for data used by
* QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP sub command.
*/
enum qca_wlan_vendor_attr_memory_dump {
QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_REQUEST_ID = 1,
QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE = 2,
QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX =
QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - 1,
};
/* Size of fw memory dump is estimated to be 327680 bytes */
#define FW_MEM_DUMP_SIZE 327680
#define FW_DRAM_LOCATION 0x00400000
#define FW_MEM_DUMP_REQ_ID 1
#define FW_MEM_DUMP_NUM_SEG 1
#define MEMDUMP_COMPLETION_TIME_MS 5000
int memdump_init(void);
void memdump_deinit(void);
int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);
#else
static inline int memdump_init(void)
{
return -ENOTSUPP;
}
static inline void memdump_deinit(void)
{
}
static inline int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
return -ENOTSUPP;
}
#endif
#endif /* if !defined(WLAN_HDD_MEMDUMP_H)*/

View File

@@ -1,190 +0,0 @@
/*
* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_MIB_h__)
#define WLAN_HDD_MIB_h__
#include <cdf_types.h>
typedef enum {
eMib_dot11DesiredBssType_infrastructure = 1,
eMib_dot11DesiredBssType_independent = 2,
eMib_dot11DesiredBssType_infra_ap = 3,
eMib_dot11DesiredBssType_any = 4
} eMib_dot11DesiredBssType;
/** This is the maximum number of BSSIDs supported in the
dot11DesiredBssidList. All the code operates off of
this maximum BSSID list count. */
#define MIB_DOT11_DESIRED_BSSID_LIST_MAX_COUNT 1
typedef struct {
uint32_t cEntries;
struct cdf_mac_addr BSSIDs[MIB_DOT11_DESIRED_BSSID_LIST_MAX_COUNT];
} sMib_dot11DesiredBssidList;
/** This is the maximum number of SSIDs supported in the
dot11DesiredSsidList. All the code operates off of
this maximum SSID list count. */
#define MIB_DOT11_DESIRED_SSID_LIST_MAX_COUNT 1
#define MIB_DOT11_SSID_MAX_LENGTH 32
typedef struct {
uint32_t ssidLength;
uint8_t ssid[MIB_DOT11_SSID_MAX_LENGTH];
} sDot11Ssid;
typedef struct {
uint32_t cEntries;
sDot11Ssid SSIDs[MIB_DOT11_DESIRED_SSID_LIST_MAX_COUNT];
} sMib_dot11DesiredSsidList;
typedef enum {
/* these are bitmasks.... */
eMib_dot11AutoConfigEnabled_None = 0U,
eMib_dot11AutoConfigEnabled_Phy = 0x00000001U,
eMib_dot11AutoConfigEnabled_Mac = 0x00000002U
} eMib_dot11AutoConfigEnabled;
#define MIB_DOT11_SUPPORTED_PHY_TYPES_MAX_COUNT 3
typedef enum tagMib_dot11PhyType {
eMib_dot11PhyType_11b,
eMib_dot11PhyType_11a,
eMib_dot11PhyType_11g,
eMib_dot11PhyType_all
} eMib_dot11PhyType;
typedef struct tagMib_dot11SupportedPhyTypes {
uint32_t cEntries;
eMib_dot11PhyType phyTypes[MIB_DOT11_SUPPORTED_PHY_TYPES_MAX_COUNT];
} sMib_dot11SupportedPhyTypes;
typedef enum {
eMib_DevicePowerState_D0,
eMib_DevicePowerState_D1,
eMib_DevicePowerState_D2,
eMib_DevicePowerState_D3
} eMib_DevicePowerState;
typedef enum {
eMib_dot11NICPowerState_OFF = false,
eMib_dot11NICPowerState_ON = true
} eMib_dot11NICPowerState;
typedef enum {
eMib_dot11HardwarePHYState_OFF = false,
eMib_dot11HardwarePHYState_ON = true
} eMib_dot11HardwarePHYState;
typedef enum {
eMib_dot11PowerSavingLevel_None,
eMib_dot11PowerSavingLevel_MaxPS,
eMib_dot11PowerSavingLevel_FastPS,
eMib_dot11PowerSavingLevel_MaximumLevel
} eMib_dot11PowerSavingLevel;
#define MIB_DOT11_MAC_EXCLUSION_LIST_MAX_COUNT 4
typedef struct {
uint32_t cEntries;
struct cdf_mac_addr macAddrs[MIB_DOT11_MAC_EXCLUSION_LIST_MAX_COUNT];
} sMib_dot11MacExcludeList;
#define MIB_DOT11_PRIVACY_EXEMPT_LIST_MAX_COUNT 32
typedef enum {
eMib_dot11ExemptionAction_Always,
eMib_dot11ExemptionAction_OnKeyMapUnavailable
} eMib_dot11ExemptAction;
typedef enum {
eMib_dot11ExemptPacket_Unicast,
eMib_dot11ExemptPacket_Multicast,
eMib_dot11ExemptPacket_Both
} eMib_dot11ExemptPacket;
typedef struct {
uint16_t uEtherType;
eMib_dot11ExemptAction exemptAction;
eMib_dot11ExemptPacket exemptPacket;
} sMib_dot11PrivacyExemption;
typedef struct {
uint32_t cEntries;
sMib_dot11PrivacyExemption
privacyExemptList[MIB_DOT11_PRIVACY_EXEMPT_LIST_MAX_COUNT];
} sMib_dot11PrivacyExemptionList;
typedef struct sHddMib_s {
eMib_dot11DesiredBssType mibDot11DesiredBssType;
sMib_dot11DesiredBssidList mibDot11DesiredBssidList;
sMib_dot11DesiredSsidList mibDot11DesiredSsidList;
eMib_dot11AutoConfigEnabled mibDot11AutoConfigEnabled;
/* the device power state for the device (the D-state... you know D0, D1, D2, etc. */
eMib_DevicePowerState mibDevicePowerState;
/* dot11NICPowerState is really the on/off state of the PHY. This can be */
/* mamipulated through OIDs like a software control for radio on/off. */
eMib_dot11NICPowerState mibDot11NICPowerState;
/* Hardware PHY state is the on/off state of the hardware PHY. */
eMib_dot11HardwarePHYState mibDot11HardwarePHYState;
/* dot11 Power Saving level is the 802.11 power saving level/state for the 802.11 */
/* NIC. Typically this is mapped to 802.11 BMPS in some fashion. We are not going */
/* to disappoint; the Libra NIC maps these to different BMPS settings. */
eMib_dot11PowerSavingLevel mibDot11PowerSavingLevel;
sMib_dot11MacExcludeList mibDot11MacExcludeList;
sMib_dot11PrivacyExemptionList mibDot11PrivacyExemptionList;
sMib_dot11SupportedPhyTypes mibDot11SupportedPhyTypes;
eMib_dot11PhyType mibDot11CurrentPhyType;
bool dot11IbssJoinOnly;
bool HiddenNetworkEnabled;
} sHddMib_t;
#endif

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef WLAN_HDD_MISC_H
#define WLAN_HDD_MISC_H
#ifdef MSM_PLATFORM
#define WLAN_INI_FILE "wlan/qca_cld/WCNSS_qcom_cfg.ini"
#define WLAN_MAC_FILE "wlan/qca_cld/wlan_mac.bin"
#else
#define WLAN_INI_FILE "wlan/qcom_cfg.ini"
#define WLAN_MAC_FILE "wlan/wlan_mac.bin"
#endif /* MSM_PLATFORM */
#endif /* WLAN_HDD_MISC_H */

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_NAN_H
#define __WLAN_HDD_NAN_H
/**
* DOC: wlan_hdd_nan.h
*
* WLAN Host Device Driver NAN API specification
*/
struct hdd_context_s;
#ifdef WLAN_FEATURE_NAN
struct wiphy;
struct wireless_dev;
int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
bool wlan_hdd_nan_is_supported(void);
void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx);
#else
static inline bool wlan_hdd_nan_is_supported(void)
{
return false;
}
static inline void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx)
{
}
#endif /* WLAN_FEATURE_NAN */
#endif /* __WLAN_HDD_NAN_H */

View File

@@ -1,82 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __HDD_NAPI_H__
#define __HDD_NAPI_H__
#ifdef FEATURE_NAPI
/**
* DOC: wlan_hdd_napi.h
*
* WLAN NAPI interface module headers
*/
/* CLD headers */
#include "hif_napi.h"
/* Linux headers */
#include <linux/netdevice.h> /* net_device */
#define HDD_NAPI_ANY (-1)
int hdd_napi_enabled(int id);
int hdd_napi_create(void);
int hdd_napi_destroy(int force);
int hdd_napi_stats(char *buf,
int max,
char *indp,
struct qca_napi_data *napid);
/* the following triggers napi_enable/disable as required */
int hdd_napi_event(enum qca_napi_event event, void *data);
int hdd_napi_poll(struct napi_struct *napi, int budget);
struct qca_napi_data *hdd_napi_get_all(void);
#else /* ! defined(FEATURE_NAPI) */
#include "hif_napi.h"
/**
* Stub API
*
*/
#define HDD_NAPI_ANY (-1)
static inline int hdd_napi_enabled(int id) { return 0; }
static inline int hdd_napi_create(void) { return -EPERM; }
static inline int hdd_napi_destroy(int force) { return 0; }
static inline int hdd_napi_stats(char *buf, int max, char *indp,
struct qca_napi_data *napid)
{ return 0; }
static inline int hdd_napi_event(enum qca_napi_event event, void *data)
{ return 0; }
static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; }
#endif /* FEATURE_NAPI */
#endif /* HDD_NAPI_H__ */

View File

@@ -1,175 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC: wlan_hdd_oemdata.h
*
* Internal includes for the oem data
*/
#ifndef __WLAN_HDD_OEM_DATA_H__
#define __WLAN_HDD_OEM_DATA_H__
#ifdef FEATURE_OEM_DATA_SUPPORT
#ifndef OEM_DATA_REQ_SIZE
#define OEM_DATA_REQ_SIZE 280
#endif
#ifndef OEM_DATA_RSP_SIZE
#define OEM_DATA_RSP_SIZE 1724
#endif
#define OEM_APP_SIGNATURE_LEN 16
#define OEM_APP_SIGNATURE_STR "QUALCOMM-OEM-APP"
#define OEM_TARGET_SIGNATURE_LEN 8
#define OEM_TARGET_SIGNATURE "QUALCOMM"
#define OEM_CAP_MAX_NUM_CHANNELS 128
/**
* typedef eOemErrorCode - OEM error codes
* @OEM_ERR_NULL_CONTEXT: %NULL context
* @OEM_ERR_APP_NOT_REGISTERED: OEM App is not registered
* @OEM_ERR_INVALID_SIGNATURE: Invalid signature
* @OEM_ERR_NULL_MESSAGE_HEADER: Invalid message header
* @OEM_ERR_INVALID_MESSAGE_TYPE: Invalid message type
* @OEM_ERR_INVALID_MESSAGE_LENGTH: Invalid length in message body
*/
typedef enum {
OEM_ERR_NULL_CONTEXT = 1,
OEM_ERR_APP_NOT_REGISTERED,
OEM_ERR_INVALID_SIGNATURE,
OEM_ERR_NULL_MESSAGE_HEADER,
OEM_ERR_INVALID_MESSAGE_TYPE,
OEM_ERR_INVALID_MESSAGE_LENGTH
} eOemErrorCode;
/**
* typedef tDriverVersion - Driver version identifier (w.x.y.z)
* @major: Version ID major number
* @minor: Version ID minor number
* @patch: Version ID patch number
* @build: Version ID build number
*/
typedef struct cdf_packed {
uint8_t major;
uint8_t minor;
uint8_t patch;
uint8_t build;
} tDriverVersion;
/**
* typedef t_iw_oem_data_cap - OEM Data Capabilities
* @oem_target_signature: Signature of chipset vendor, e.g. QUALCOMM
* @oem_target_type: Chip type
* @oem_fw_version: Firmware version
* @driver_version: Host software version
* @allowed_dwell_time_min: Channel dwell time - allowed minimum
* @allowed_dwell_time_max: Channel dwell time - allowed maximum
* @curr_dwell_time_min: Channel dwell time - current minimim
* @curr_dwell_time_max: Channel dwell time - current maximum
* @supported_bands: Supported bands, 2.4G or 5G Hz
* @num_channels: Num of channels IDs to follow
* @channel_list: List of channel IDs
*/
typedef struct cdf_packed {
uint8_t oem_target_signature[OEM_TARGET_SIGNATURE_LEN];
uint32_t oem_target_type;
uint32_t oem_fw_version;
tDriverVersion driver_version;
uint16_t allowed_dwell_time_min;
uint16_t allowed_dwell_time_max;
uint16_t curr_dwell_time_min;
uint16_t curr_dwell_time_max;
uint16_t supported_bands;
uint16_t num_channels;
uint8_t channel_list[OEM_CAP_MAX_NUM_CHANNELS];
} t_iw_oem_data_cap;
/**
* typedef tHddChannelInfo - Channel information
* @chan_id: channel id
* @reserved0: reserved for padding and future use
* @mhz: primary 20 MHz channel frequency in mhz
* @band_center_freq1: Center frequency 1 in MHz
* @band_center_freq2: Center frequency 2 in MHz, valid only for 11ac
* VHT 80+80 mode
* @info: channel info
* @reg_info_1: regulatory information field 1 which contains min power,
* max power, reg power and reg class id
* @reg_info_2: regulatory information field 2 which contains antennamax
*/
typedef struct cdf_packed {
uint32_t chan_id;
uint32_t reserved0;
uint32_t mhz;
uint32_t band_center_freq1;
uint32_t band_center_freq2;
uint32_t info;
uint32_t reg_info_1;
uint32_t reg_info_2;
} tHddChannelInfo;
/**
* typedef tPeerStatusInfo - Status information for a given peer
* @peer_mac_addr: peer mac address
* @peer_status: peer status: 1: CONNECTED, 2: DISCONNECTED
* @vdev_id: vdev_id for the peer mac
* @peer_capability: peer capability: 0: RTT/RTT2, 1: RTT3. Default is 0
* @reserved0: reserved0
* @peer_chan_info: channel info on which peer is connected
*/
typedef struct cdf_packed {
uint8_t peer_mac_addr[ETH_ALEN];
uint8_t peer_status;
uint8_t vdev_id;
uint32_t peer_capability;
uint32_t reserved0;
tHddChannelInfo peer_chan_info;
} tPeerStatusInfo;
void hdd_send_peer_status_ind_to_oem_app(struct cdf_mac_addr *peerMac,
uint8_t peerStatus,
uint8_t peerTimingMeasCap,
uint8_t sessionId,
tSirSmeChanInfo *chan_info);
int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int oem_activate_service(struct hdd_context_s *hdd_ctx);
void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp);
#else
static inline int oem_activate_service(struct hdd_context_s *hdd_ctx)
{
return 0;
}
#endif /* FEATURE_OEM_DATA_SUPPORT */
#endif /* __WLAN_HDD_OEM_DATA_H__ */

View File

@@ -1,144 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __P2P_H
#define __P2P_H
/**===========================================================================
\file wlan_hdd_p2p.h
\brief Linux HDD P2P include file
==========================================================================*/
#define ACTION_FRAME_TX_TIMEOUT 2000
#define WAIT_CANCEL_REM_CHAN 1000
#define WAIT_REM_CHAN_READY 1000
#define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000
#define COMPLETE_EVENT_PROPOGATE_TIME 10
#ifdef QCA_WIFI_3_0_EMU
#define ACTION_FRAME_DEFAULT_WAIT 500
#else
#define ACTION_FRAME_DEFAULT_WAIT 200
#endif
#define WLAN_HDD_GET_TYPE_FRM_FC(__fc__) (((__fc__) & 0x0F) >> 2)
#define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__) (((__fc__) & 0xF0) >> 4)
#define WLAN_HDD_80211_FRM_DA_OFFSET 4
#define P2P_WILDCARD_SSID_LEN 7
#define P2P_WILDCARD_SSID "DIRECT-"
#ifdef QCA_WIFI_3_0_EMU
#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 3
#else
#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 5
#endif
#define HDD_P2P_MAX_ROC_DURATION 1000
#define MAX_ROC_REQ_QUEUE_ENTRY 10
#define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0)
#define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1)
#define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2)
#ifdef WLAN_FEATURE_P2P_DEBUG
typedef enum { P2P_NOT_ACTIVE,
P2P_GO_NEG_PROCESS,
P2P_GO_NEG_COMPLETED,
P2P_CLIENT_CONNECTING_STATE_1,
P2P_GO_COMPLETED_STATE,
P2P_CLIENT_CONNECTED_STATE_1,
P2P_CLIENT_DISCONNECTED_STATE,
P2P_CLIENT_CONNECTING_STATE_2,
P2P_CLIENT_COMPLETED_STATE} tP2PConnectionStatus;
extern tP2PConnectionStatus global_p2p_connection_status;
#endif
typedef struct p2p_app_setP2pPs {
uint8_t opp_ps;
uint32_t ctWindow;
uint8_t count;
uint32_t duration;
uint32_t interval;
uint32_t single_noa_duration;
uint8_t psSelection;
} p2p_app_setP2pPs_t;
int wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct ieee80211_channel *chan,
unsigned int duration, u64 *cookie);
int wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie);
int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie);
int hdd_set_p2p_ps(struct net_device *dev, void *msgData);
int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command);
int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command);
void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter,
uint32_t nFrameLength, uint8_t *pbFrames,
uint8_t frameType, uint32_t rxChan, int8_t rxRssi);
void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter,
uint32_t scan_id);
void hdd_send_action_cnf(hdd_adapter_t *pAdapter, bool actionSendSuccess);
int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params, u64 *cookie);
#else
int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
struct ieee80211_channel *chan, bool offchan,
unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
bool dont_wait_for_ack, u64 *cookie);
#endif
struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
const char *name,
enum nl80211_iftype type,
u32 *flags,
struct vif_params *params);
int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter);
void wlan_hdd_roc_request_dequeue(struct work_struct *work);
#endif /* __P2P_H */

View File

@@ -1,174 +0,0 @@
/*
* Copyright (c) 2012, 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_POWER_H
#define __WLAN_HDD_POWER_H
/**
* DOC: wlan_hdd_power.h
*
* HDD Power Management API
*/
#include "wlan_hdd_main.h"
#ifdef WLAN_FEATURE_PACKET_FILTERING
#define HDD_MAX_CMP_PER_PACKET_FILTER 5
/**
* enum pkt_filter_protocol_layer - packet filter protocol layer
* @HDD_FILTER_PROTO_TYPE_INVALID: Invalid initial value
* @HDD_FILTER_PROTO_TYPE_MAC: MAC protocol
* @HDD_FILTER_PROTO_TYPE_ARP: ARP protocol
* @HDD_FILTER_PROTO_TYPE_IPV4: IP V4 protocol
* @HDD_FILTER_PROTO_TYPE_IPV6: IP V6 protocol
* @HDD_FILTER_PROTO_TYPE_UDP: UDP protocol
* @HDD_FILTER_PROTO_TYPE_INVALID: Max place holder value
*/
enum pkt_filter_protocol_layer {
HDD_FILTER_PROTO_TYPE_INVALID = 0,
HDD_FILTER_PROTO_TYPE_MAC = 1,
HDD_FILTER_PROTO_TYPE_ARP = 2,
HDD_FILTER_PROTO_TYPE_IPV4 = 3,
HDD_FILTER_PROTO_TYPE_IPV6 = 4,
HDD_FILTER_PROTO_TYPE_UDP = 5,
HDD_FILTER_PROTO_TYPE_MAX
};
/**
* enum pkt_filter_action - packet filter action
* @HDD_RCV_FILTER_INVALID: Invalid initial value
* @HDD_RCV_FILTER_SET: Packet filter set
* @HDD_RCV_FILTER_CLEAR: Packet filter clear
* @HDD_RCV_FILTER_MAX: Max place holder value
*/
enum pkt_filter_action {
HDD_RCV_FILTER_INVALID = 0,
HDD_RCV_FILTER_SET = 1,
HDD_RCV_FILTER_CLEAR = 2,
HDD_RCV_FILTER_MAX
};
/**
* enum pkt_filter_compare_flag - packet filter compare flag
* @HDD_FILTER_CMP_TYPE_INVALID: Invalid initial value
* @HDD_FILTER_CMP_TYPE_EQUAL: Compare if filter is equal
* @HDD_FILTER_CMP_TYPE_MASK_EQUAL: Compare if filter mask is equal
* @HDD_FILTER_CMP_TYPE_NOT_EQUAL: Compare if filter is not equal
* @HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL: Compare if filter mask is not equal
* @HDD_FILTER_CMP_TYPE_MAX: Max place holder value
*/
enum pkt_filter_compare_flag {
HDD_FILTER_CMP_TYPE_INVALID = 0,
HDD_FILTER_CMP_TYPE_EQUAL = 1,
HDD_FILTER_CMP_TYPE_MASK_EQUAL = 2,
HDD_FILTER_CMP_TYPE_NOT_EQUAL = 3,
HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL = 4,
HDD_FILTER_CMP_TYPE_MAX
};
/**
* struct pkt_filter_param_cfg - packet filter parameter config
* @protocol_layer: Protocol layer
* @compare_flag: Compare flag
* @data_fffset: Data offset
* @data_length: Data length
* @compare_data: Compare data
* @data_mask: Data mask
*/
struct pkt_filter_param_cfg {
uint8_t protocol_layer;
uint8_t compare_flag;
uint8_t data_offset;
uint8_t data_length;
uint8_t compare_data[SIR_MAX_FILTER_TEST_DATA_LEN];
uint8_t data_mask[SIR_MAX_FILTER_TEST_DATA_LEN];
};
/**
* struct pkt_filter_cfg - packet filter config received from user space
* @filter_action: Filter action
* @filter_id: Filter id
* @num_params: Number of parameters
* @params_data: Packet filter parameters detail
*/
struct pkt_filter_cfg {
uint8_t filter_action;
uint8_t filter_id;
uint8_t num_params;
struct pkt_filter_param_cfg params_data[HDD_MAX_CMP_PER_PACKET_FILTER];
};
#endif
/* SSR shutdown & re-init functions */
CDF_STATUS hdd_wlan_shutdown(void);
CDF_STATUS hdd_wlan_re_init(void *hif_sc);
void hdd_conf_mcastbcast_filter(hdd_context_t *pHddCtx, bool setfilter);
CDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable);
void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, bool fenable);
#ifdef WLAN_FEATURE_PACKET_FILTERING
void wlan_hdd_set_mc_addr_list(hdd_adapter_t *pAdapter, uint8_t set);
#else
static inline void
wlan_hdd_set_mc_addr_list(hdd_adapter_t *pAdapter, uint8_t set)
{
}
#endif
int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
struct cfg80211_wowlan *wow);
int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy);
void hdd_ipv4_notifier_work_queue(struct work_struct *work);
#ifdef WLAN_NS_OFFLOAD
void hdd_ipv6_notifier_work_queue(struct work_struct *work);
#endif
int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
struct wireless_dev *wdev,
int *dbm);
int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
struct wireless_dev *wdev,
enum nl80211_tx_power_setting type,
int dbm);
int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
struct net_device *dev, bool mode,
int timeout);
int wlan_hdd_ipv4_changed(struct notifier_block *nb,
unsigned long data, void *arg);
int wlan_hdd_ipv6_changed(struct notifier_block *nb,
unsigned long data, void *arg);
#endif /* __WLAN_HDD_POWER_H */

View File

@@ -1,94 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_SOFTAP_TX_RX_H)
#define WLAN_HDD_SOFTAP_TX_RX_H
/**
* DOC: wlan_hdd_softap_tx_rx.h
*
*Linux HDD SOFTAP Tx/RX APIs
*/
#include <wlan_hdd_hostapd.h>
int hdd_softap_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
void hdd_softap_tx_timeout(struct net_device *dev);
CDF_STATUS hdd_softap_init_tx_rx(hdd_adapter_t *pAdapter);
CDF_STATUS hdd_softap_deinit_tx_rx(hdd_adapter_t *pAdapter);
CDF_STATUS hdd_softap_init_tx_rx_sta(hdd_adapter_t *pAdapter,
uint8_t STAId,
struct cdf_mac_addr *pmacAddrSTA);
CDF_STATUS hdd_softap_deinit_tx_rx_sta(hdd_adapter_t *pAdapter,
uint8_t STAId);
CDF_STATUS hdd_softap_rx_packet_cbk(void *cds_context,
cdf_nbuf_t rxBufChain,
uint8_t staId);
#ifdef IPA_OFFLOAD
CDF_STATUS hdd_softap_rx_mul_packet_cbk(void *cds_context,
cdf_nbuf_t rx_buf_list, uint8_t staId);
#endif /* IPA_OFFLOAD */
CDF_STATUS hdd_softap_deregister_sta(hdd_adapter_t *pAdapter,
uint8_t staId);
CDF_STATUS hdd_softap_register_sta(hdd_adapter_t *pAdapter,
bool fAuthRequired,
bool fPrivacyBit,
uint8_t staId,
uint8_t ucastSig,
uint8_t bcastSig,
struct cdf_mac_addr *pPeerMacAddress,
bool fWmmEnabled);
CDF_STATUS hdd_softap_register_bc_sta(hdd_adapter_t *pAdapter,
bool fPrivacyBit);
CDF_STATUS hdd_softap_deregister_bc_sta(hdd_adapter_t *pAdapter);
CDF_STATUS hdd_softap_stop_bss(hdd_adapter_t *pHostapdAdapter);
CDF_STATUS hdd_softap_change_sta_state(hdd_adapter_t *pAdapter,
struct cdf_mac_addr *pDestMacAddress,
enum ol_txrx_peer_state state);
CDF_STATUS hdd_softap_get_sta_id(hdd_adapter_t *pAdapter,
struct cdf_mac_addr *pMacAddress,
uint8_t *staId);
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context);
void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume);
#else
static inline
void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context)
{
return;
}
static inline
void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume)
{
return;
}
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
#endif /* end #if !defined(WLAN_HDD_SOFTAP_TX_RX_H) */

View File

@@ -1,628 +0,0 @@
/*
* Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __HDD_TDLS_H
#define __HDD_TDLS_H
/**
* DOC: wlan_hdd_tdls.h
* WLAN Host Device Driver TDLS include file
*/
#ifdef FEATURE_WLAN_TDLS
/*
* Before UpdateTimer expires, we want to timeout discovery response
* should not be more than 2000.
*/
#define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE 1000
#define TDLS_CTX_MAGIC 0x54444c53 /* "TDLS" */
#define TDLS_MAX_SCAN_SCHEDULE 10
#define TDLS_MAX_SCAN_REJECT 5
#define TDLS_DELAY_SCAN_PER_CONNECTION 100
#define TDLS_MAX_CONNECTED_PEERS_TO_ALLOW_SCAN 1
#define TDLS_IS_CONNECTED(peer) \
((eTDLS_LINK_CONNECTED == (peer)->link_status) || \
(eTDLS_LINK_TEARING == (peer)->link_status))
/* Bit mask flag for tdls_option to FW */
#define ENA_TDLS_OFFCHAN (1 << 0) /* TDLS Off Channel support */
#define ENA_TDLS_BUFFER_STA (1 << 1) /* TDLS Buffer STA support */
#define ENA_TDLS_SLEEP_STA (1 << 2) /* TDLS Sleep STA support */
#define TDLS_SEC_OFFCHAN_OFFSET_0 0
#define TDLS_SEC_OFFCHAN_OFFSET_40PLUS 40
#define TDLS_SEC_OFFCHAN_OFFSET_40MINUS (-40)
#define TDLS_SEC_OFFCHAN_OFFSET_80 80
#define TDLS_SEC_OFFCHAN_OFFSET_160 160
#define TDLS_PEER_LIST_SIZE 256
#define EXTTDLS_EVENT_BUF_SIZE (4096)
/**
* struct tdls_config_params_t - tdls config params
*
* @tdls: tdls
* @tx_period_t: tx period
* @tx_packet_n: tx packets number
* @discovery_tries_n: discovery tries
* @idle_packet_n: idle packet number
* @rssi_trigger_threshold: rssi trigger threshold
* @rssi_teardown_threshold: rssi tear down threshold
* @rssi_delta: rssi delta
*/
typedef struct {
uint32_t tdls;
uint32_t tx_period_t;
uint32_t tx_packet_n;
uint32_t discovery_tries_n;
uint32_t idle_packet_n;
int32_t rssi_trigger_threshold;
int32_t rssi_teardown_threshold;
int32_t rssi_delta;
} tdls_config_params_t;
/**
* struct tdls_scan_context_t - tdls scan context
*
* @wiphy: pointer to wiphy structure
* @dev: pointer to netdev
* @scan_request: scan request
* @magic: magic
* @attempt: attempt
* @reject: reject
* @tdls_scan_work: delayed tdls scan work
*/
typedef struct {
struct wiphy *wiphy;
struct cfg80211_scan_request *scan_request;
int magic;
int attempt;
int reject;
struct delayed_work tdls_scan_work;
} tdls_scan_context_t;
/**
* enum eTDLSSupportMode - tdls support mode
*
* @eTDLS_SUPPORT_NOT_ENABLED: tdls support not enabled
* @eTDLS_SUPPORT_DISABLED: suppress implicit trigger and not
* respond to the peer
* @eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: suppress implicit trigger,
* but respond to the peer
* @eTDLS_SUPPORT_ENABLED: implicit trigger
* @eTDLS_SUPPORT_EXTERNAL_CONTROL: External control means implicit
* trigger but only to a peer mac configured by user space.
*/
typedef enum {
eTDLS_SUPPORT_NOT_ENABLED = 0,
eTDLS_SUPPORT_DISABLED,
eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY,
eTDLS_SUPPORT_ENABLED,
eTDLS_SUPPORT_EXTERNAL_CONTROL,
} eTDLSSupportMode;
/**
* enum tTDLSCapType - tdls capability type
*
* @eTDLS_CAP_NOT_SUPPORTED: tdls not supported
* @eTDLS_CAP_UNKNOWN: unknown capability
* @eTDLS_CAP_SUPPORTED: tdls capability supported
*/
typedef enum eTDLSCapType {
eTDLS_CAP_NOT_SUPPORTED = -1,
eTDLS_CAP_UNKNOWN = 0,
eTDLS_CAP_SUPPORTED = 1,
} tTDLSCapType;
/**
* enum tTDLSLinkStatus - tdls link status
*
* @eTDLS_LINK_IDLE: tdls link idle
* @eTDLS_LINK_DISCOVERING: tdls link discovering
* @eTDLS_LINK_DISCOVERED: tdls link discovered
* @eTDLS_LINK_CONNECTING: tdls link connecting
* @eTDLS_LINK_CONNECTED: tdls link connected
* @eTDLS_LINK_TEARING: tdls link tearing
*/
typedef enum eTDLSLinkStatus {
eTDLS_LINK_IDLE = 0,
eTDLS_LINK_DISCOVERING,
eTDLS_LINK_DISCOVERED,
eTDLS_LINK_CONNECTING,
eTDLS_LINK_CONNECTED,
eTDLS_LINK_TEARING,
} tTDLSLinkStatus;
/**
* enum tTDLSLinkReason - tdls link reason
*
* @eTDLS_LINK_SUCCESS: Success
* @eTDLS_LINK_UNSPECIFIED: Unspecified reason
* @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
* @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
* @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
* @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
*/
typedef enum {
eTDLS_LINK_SUCCESS,
eTDLS_LINK_UNSPECIFIED = -1,
eTDLS_LINK_NOT_SUPPORTED = -2,
eTDLS_LINK_UNSUPPORTED_BAND = -3,
eTDLS_LINK_NOT_BENEFICIAL = -4,
eTDLS_LINK_DROPPED_BY_REMOTE = -5
} tTDLSLinkReason;
/**
* struct tdls_req_params_t - tdls request parameters
*
* @channel: channel hint, in channel number (NOT frequency)
* @global_operating_class: operating class to use
* @max_latency_ms: max latency that can be tolerated by apps
* @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second
*/
typedef struct {
int channel;
int global_operating_class;
int max_latency_ms;
int min_bandwidth_kbps;
} tdls_req_params_t;
/**
* enum tdls_state_t - tdls state
*
* @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now
* @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried
* @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established
* @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC
* @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped
* @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed
*/
typedef enum {
QCA_WIFI_HAL_TDLS_DISABLED = 1,
QCA_WIFI_HAL_TDLS_ENABLED,
QCA_WIFI_HAL_TDLS_ESTABLISHED,
QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL,
QCA_WIFI_HAL_TDLS_DROPPED,
QCA_WIFI_HAL_TDLS_FAILED
} tdls_state_t;
typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
uint32_t opclass,
uint32_t channel,
uint32_t state,
int32_t reason, void *ctx);
/**
* struct tdls_tx_tput_config_t - tdls tx throughput config
*
* @period: period
* @bytes: bytes
*/
typedef struct {
uint16_t period;
uint16_t bytes;
} tdls_tx_tput_config_t;
/**
* struct tdls_discovery_config_t - tdls discovery config
*
* @period: period
* @tries: number of tries
*/
typedef struct {
uint16_t period;
uint16_t tries;
} tdls_discovery_config_t;
/**
* struct tdls_rx_idle_config_t - tdls rx idle config
*
* @timeout: timeout
*/
typedef struct {
uint16_t timeout;
} tdls_rx_idle_config_t;
/**
* struct tdls_rssi_config_t - tdls rssi config
*
* @rssi_thres: rssi_thres
*/
typedef struct {
uint16_t rssi_thres;
} tdls_rssi_config_t;
struct _hddTdlsPeer_t;
/**
* struct tdlsCtx_t - tdls context
*
* @peer_list: peer list
* @pAdapter: pointer to adapter
* @peerDiscoverTimer: peer discovery timer
* @peerDiscoveryTimeoutTimer: peer discovery timeout timer
* @threshold_config: threshold config
* @discovery_peer_cnt: discovery peer count
* @discovery_sent_cnt: discovery sent count
* @ap_rssi: ap rssi
* @curr_candidate: current candidate
* @implicit_setup: implicit setup work queue
* @magic: magic
*
*/
typedef struct {
struct list_head peer_list[TDLS_PEER_LIST_SIZE];
hdd_adapter_t *pAdapter;
cdf_mc_timer_t peerDiscoveryTimeoutTimer;
tdls_config_params_t threshold_config;
int32_t discovery_peer_cnt;
uint32_t discovery_sent_cnt;
int8_t ap_rssi;
struct _hddTdlsPeer_t *curr_candidate;
struct work_struct implicit_setup;
uint32_t magic;
} tdlsCtx_t;
/**
* struct hddTdlsPeer_t - tdls peer data
*
* @node: node
* @pHddTdlsCtx: pointer to tdls context
* @peerMac: peer mac address
* @staId: station identifier
* @rssi: rssi
* @tdls_support: tdls support
* @link_status: tdls link status
* @signature: signature
* @is_responder: is responder
* @discovery_processed: discovery processed flag
* @discovery_attempt: discovery attempt
* @tx_pkt: tx packet
* @rx_pkt: rx packet
* @uapsdQueues: uapsd queues
* @maxSp: max sp
* @isBufSta: is buffer sta
* @isOffChannelSupported: is offchannel supported flag
* @supported_channels_len: supported channels length
* @supported_channels: supported channels
* @supported_oper_classes_len: supported operation classes length
* @supported_oper_classes: supported operation classes
* @isForcedPeer: is forced peer
* @op_class_for_pref_off_chan: op class for preferred off channel
* @pref_off_chan_num: preferred off channel number
* @op_class_for_pref_off_chan_is_set: op class for preferred off channel set
* @reason: reason
* @state_change_notification: state change notification
*/
typedef struct _hddTdlsPeer_t {
struct list_head node;
tdlsCtx_t *pHddTdlsCtx;
tSirMacAddr peerMac;
uint16_t staId;
int8_t rssi;
tTDLSCapType tdls_support;
tTDLSLinkStatus link_status;
uint8_t signature;
uint8_t is_responder;
uint8_t discovery_processed;
uint16_t discovery_attempt;
uint16_t tx_pkt;
uint16_t rx_pkt;
uint8_t uapsdQueues;
uint8_t maxSp;
uint8_t isBufSta;
uint8_t isOffChannelSupported;
uint8_t supported_channels_len;
uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS];
uint8_t supported_oper_classes_len;
uint8_t supported_oper_classes[SIR_MAC_MAX_SUPP_OPER_CLASSES];
bool isForcedPeer;
uint8_t op_class_for_pref_off_chan;
uint8_t pref_off_chan_num;
uint8_t op_class_for_pref_off_chan_is_set;
tTDLSLinkReason reason;
cfg80211_exttdls_callback state_change_notification;
} hddTdlsPeer_t;
/**
* struct tdlsConnInfo_t - tdls connection info
*
* @sessionId: Session ID
* @staId: TDLS peer station id
* @peerMac: peer mac address
*/
typedef struct {
uint8_t sessionId;
uint8_t staId;
struct cdf_mac_addr peerMac;
} tdlsConnInfo_t;
/**
* struct tdlsInfo_t - tdls info
*
* @vdev_id: vdev id
* @tdls_state: tdls state
* @notification_interval_ms: notification interval in ms
* @tx_discovery_threshold: tx discovery threshold
* @tx_teardown_threshold: tx teardown threshold
* @rssi_teardown_threshold: rx teardown threshold
* @rssi_delta: rssi delta
* @tdls_options: tdls options
* @peer_traffic_ind_window: peer traffic indication window
* @peer_traffic_response_timeout: peer traffic response timeout
* @puapsd_mask: puapsd mask
* @puapsd_inactivity_time: puapsd inactivity time
* @puapsd_rx_frame_threshold: puapsd rx frame threshold
* @teardown_notification_ms: tdls teardown notification interval
* @tdls_peer_kickout_threshold: tdls packets threshold
* for peer kickout operation
*/
typedef struct {
uint32_t vdev_id;
uint32_t tdls_state;
uint32_t notification_interval_ms;
uint32_t tx_discovery_threshold;
uint32_t tx_teardown_threshold;
int32_t rssi_teardown_threshold;
int32_t rssi_delta;
uint32_t tdls_options;
uint32_t peer_traffic_ind_window;
uint32_t peer_traffic_response_timeout;
uint32_t puapsd_mask;
uint32_t puapsd_inactivity_time;
uint32_t puapsd_rx_frame_threshold;
uint32_t teardown_notification_ms;
uint32_t tdls_peer_kickout_threshold;
} tdlsInfo_t;
int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_extract_da(struct sk_buff *skb, uint8_t *mac);
void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac);
int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
const uint8_t *mac, uint8_t tx);
int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, const uint8_t *mac,
uint8_t staId);
hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
const uint8_t *mac, bool mutexLock);
hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
const uint8_t *mac);
int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
const uint8_t *mac,
tCsrTdlsLinkEstablishParams *
tdlsLinkEstablishParams);
hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
const uint8_t *mac);
int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, const uint8_t *mac,
tTDLSCapType cap);
void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
tTDLSLinkStatus status,
tTDLSLinkReason reason);
void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
const uint8_t *mac,
tTDLSLinkStatus linkStatus,
tTDLSLinkReason reason);
int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
const uint8_t *mac);
int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
const uint8_t *mac,
tCsrStaParams *StaParams,
bool isBufSta, bool isOffChannelSupported);
int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
int8_t rxRssi);
int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, const uint8_t *mac,
uint8_t responder);
int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, const uint8_t *mac,
uint8_t uSignature);
int wlan_hdd_tdls_set_params(struct net_device *dev,
tdls_config_params_t *config);
int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, const uint8_t *mac);
uint16_t wlan_hdd_tdls_connected_peers(hdd_adapter_t *pAdapter);
int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf,
int buflen);
void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter,
uint32_t statusCode);
void wlan_hdd_tdls_tncrement_peer_count(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
const uint8_t *mac, uint8_t skip_self);
int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
struct wiphy *wiphy,
struct cfg80211_scan_request *request);
int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
struct cfg80211_scan_request *request);
void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
cdf_mc_timer_t *timer,
uint32_t expirationTime);
void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
hddTdlsPeer_t *curr_peer,
uint16_t reason);
void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t *pHddTdlsCtx,
hddTdlsPeer_t *curr_candidate);
int wlan_hdd_tdls_set_extctrl_param(hdd_adapter_t *pAdapter,
const uint8_t *mac,
uint32_t chan,
uint32_t max_latency,
uint32_t op_class, uint32_t min_bandwidth);
int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, const uint8_t *mac,
bool forcePeer);
int wlan_hdd_tdls_update_peer_mac(hdd_adapter_t *adapter,
const uint8_t *mac,
uint32_t peer_state);
int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
const uint8_t *peer);
int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
const uint8_t *peer,
cfg80211_exttdls_callback callback,
uint32_t chan,
uint32_t max_latency,
uint32_t op_class,
uint32_t min_bandwidth);
int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
const uint8_t *mac, uint32_t *opclass,
uint32_t *channel, uint32_t *state,
int32_t *reason);
void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
uint32_t *state, int32_t *reason);
int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
cfg80211_exttdls_callback callback);
void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter, bool tdls_prohibited,
bool tdls_chan_swit_prohibited);
int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
struct net_device *dev, const uint8_t *mac,
bool update, tCsrStaParams *StaParams);
int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
struct net_device *dev,
const uint8_t *peer,
enum nl80211_tdls_operation oper);
#else
int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
struct net_device *dev,
uint8_t *peer,
enum nl80211_tdls_operation oper);
#endif
#ifdef TDLS_MGMT_VERSION2
int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
struct net_device *dev, u8 *peer,
u8 action_code, u8 dialog_token,
u16 status_code, u32 peer_capability,
const u8 *buf, size_t len);
#else
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
struct net_device *dev, const uint8_t *peer,
uint8_t action_code, uint8_t dialog_token,
uint16_t status_code, uint32_t peer_capability,
bool initiator, const uint8_t *buf,
size_t len);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
struct net_device *dev, const uint8_t *peer,
uint8_t action_code, uint8_t dialog_token,
uint16_t status_code, uint32_t peer_capability,
const uint8_t *buf, size_t len);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
struct net_device *dev, uint8_t *peer,
uint8_t action_code, uint8_t dialog_token,
uint16_t status_code, uint32_t peer_capability,
const uint8_t *buf, size_t len);
#else
int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
struct net_device *dev, uint8_t *peer,
uint8_t action_code, uint8_t dialog_token,
uint16_t status_code, const uint8_t *buf,
size_t len);
#endif
#endif
void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
hdd_context_t *hddctx);
void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx);
hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter);
int hdd_set_tdls_offchannel(hdd_context_t *hdd_ctx, int offchannel);
int hdd_set_tdls_secoffchanneloffset(hdd_context_t *hdd_ctx, int offchanoffset);
int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode);
int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val);
void hdd_tdls_pre_init(hdd_context_t *hdd_ctx);
#else
static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
hdd_context_t *hddctx)
{
}
static inline void
wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
{
}
static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
{
}
static inline void hdd_tdls_pre_init(hdd_context_t *hdd_ctx) { }
#endif /* End of FEATURE_WLAN_TDLS */
#endif /* __HDD_TDLS_H */

View File

@@ -1,147 +0,0 @@
/*
* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_TRACE_H__
#define __WLAN_HDD_TRACE_H__
#include "mac_trace.h"
#define NO_SESSION 0xFF
#undef ENUMS
#define ENUMS \
ENUM(TRACE_CODE_HDD_OPEN_REQUEST) \
ENUM(TRACE_CODE_HDD_STOP_REQUEST) \
ENUM(TRACE_CODE_HDD_TX_TIMEOUT) \
ENUM(TRACE_CODE_HDD_P2P_DEV_ADDR_IOCTL) \
ENUM(TRACE_CODE_HDD_SETSUSPENDMODE_IOCTL) \
ENUM(TRACE_CODE_HDD_SETROAMTRIGGER_IOCTL) \
ENUM(TRACE_CODE_HDD_GETROAMTRIGGER_IOCTL) \
ENUM(TRACE_CODE_HDD_SETROAMSCANPERIOD_IOCTL) \
ENUM(TRACE_CODE_HDD_GETROAMSCANPERIOD_IOCTL) \
ENUM(TRACE_CODE_HDD_SETROAMDELTA_IOCTL) \
ENUM(TRACE_CODE_HDD_GETROAMDELTA_IOCTL) \
ENUM(TRACE_CODE_HDD_GETBAND_IOCTL) \
ENUM(TRACE_CODE_HDD_GETCOUNTRYREV_IOCTL) \
ENUM(TRACE_CODE_HDD_SETROAMSCANCHANNELS_IOCTL) \
ENUM(TRACE_CODE_HDD_GETROAMSCANCHANNELS_IOCTL) \
ENUM(TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST) \
ENUM(TRACE_CODE_HDD_HOSTAPD_STOP_REQUEST) \
ENUM(TRACE_CODE_HDD_HOSTAPD_UNINIT_REQUEST) \
ENUM(TRACE_CODE_HDD_SOFTAP_TX_TIMEOUT) \
ENUM(TRACE_CODE_HDD_HOSTAPD_SET_MAC_ADDR) \
ENUM(TRACE_CODE_HDD_HOSTAPD_P2P_SET_NOA_IOCTL) \
ENUM(TRACE_CODE_HDD_HOSTAPD_P2P_SET_PS_IOCTL) \
ENUM(TRACE_CODE_HDD_HOSTAPD_SET_SAP_CHANNEL_LIST_IOCTL) \
ENUM(TRACE_CODE_HDD_ADD_VIRTUAL_INTF) \
ENUM(TRACE_CODE_HDD_DEL_VIRTUAL_INTF) \
ENUM(TRACE_CODE_HDD_CHANGE_VIRTUAL_INTF) \
ENUM(TRACE_CODE_HDD_CFG80211_START_AP) \
ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_BEACON) \
ENUM(TRACE_CODE_HDD_CFG80211_STOP_AP) \
ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_BSS) \
ENUM(TRACE_CODE_HDD_CFG80211_ADD_KEY) \
ENUM(TRACE_CODE_HDD_CFG80211_GET_KEY) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY) \
ENUM(TRACE_CODE_HDD_CFG80211_CONNECT) \
ENUM(TRACE_CODE_HDD_CFG80211_DISCONNECT) \
ENUM(TRACE_CODE_HDD_CFG80211_JOIN_IBSS) \
ENUM(TRACE_CODE_HDD_CFG80211_LEAVE_IBSS) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_TXPOWER) \
ENUM(TRACE_CODE_HDD_CFG80211_GET_TXPOWER) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_CHANNEL) \
ENUM(TRACE_CODE_HDD_CFG80211_ADD_BEACON) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_BEACON) \
ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_IFACE) \
ENUM(TRACE_CODE_HDD_CHANGE_STATION) \
ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_BSS) \
ENUM(TRACE_CODE_HDD_CFG80211_SCAN) \
ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START) \
ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP) \
ENUM(TRACE_CODE_HDD_REMAIN_ON_CHANNEL) \
ENUM(TRACE_CODE_HDD_REMAINCHANREADYHANDLER) \
ENUM(TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL) \
ENUM(TRACE_CODE_HDD_ACTION) \
ENUM(TRACE_CODE_HDD_MGMT_TX_CANCEL_WAIT) \
ENUM(TRACE_CODE_HDD_CFG80211_GET_STA) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT) \
ENUM(TRACE_CODE_HDD_CFG80211_DEL_STA) \
ENUM(TRACE_CODE_HDD_CFG80211_ADD_STA) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_PMKSA) \
ENUM(TRACE_CODE_HDD_CFG80211_DEL_PMKSA) \
ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES) \
ENUM(TRACE_CODE_HDD_CFG80211_TDLS_MGMT) \
ENUM(TRACE_CODE_HDD_CFG80211_TDLS_OPER) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA) \
ENUM(TRACE_CODE_HDD_UNSUPPORTED_IOCTL) \
ENUM(TRACE_CODE_HDD_SETROAMSCANCHANNELMINTIME_IOCTL) \
ENUM(TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL) \
ENUM(TRACE_CODE_HDD_STORE_JOIN_REQ) \
ENUM(TRACE_CODE_HDD_CLEAR_JOIN_REQ) \
ENUM(TRACE_CODE_HDD_ISSUE_JOIN_REQ) \
ENUM(TRACE_CODE_HDD_CFG80211_RESUME_WLAN) \
ENUM(TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN) \
ENUM(TRACE_CODE_HDD_CFG80211_SET_MAC_ACL) \
ENUM(TRACE_CODE_HDD_CFG80211_TESTMODE) \
ENUM(TRACE_CODE_HDD_CFG80211_DUMP_SURVEY) \
ENUM(TRACE_CODE_HDD_RX_SME_MSG)
enum {
#undef ENUM
#define ENUM(enum) enum,
ENUMS
};
/**
* hdd_trace_event_string() - Convert trace event to string
* @code: trace event enumeration to convert
*
* Return: string representation of the input enumeration
*/
static inline const char *hdd_trace_event_string(uint32_t code)
{
switch (code) {
default:
return "UNKNOWN";
break;
#undef ENUM
#define ENUM(enum) CASE_RETURN_STRING(enum)
ENUMS
}
}
#undef ENUMS
#undef ENUM
#ifdef HDD_TRACE_RECORD
void hdd_trace_init(void);
#else
static inline void hdd_trace_init(void) {}
#endif
#endif

View File

@@ -1,137 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_TX_RX_H)
#define WLAN_HDD_TX_RX_H
/**
*
* DOC: wlan_hdd_tx_rx.h
*
* Linux HDD Tx/RX APIs
*/
#include <wlan_hdd_includes.h>
#include <cds_api.h>
#include <linux/skbuff.h>
#include "ol_txrx_osif_api.h"
#define HDD_ETHERTYPE_802_1_X 0x888E
#define HDD_ETHERTYPE_802_1_X_FRAME_OFFSET 12
#ifdef FEATURE_WLAN_WAPI
#define HDD_ETHERTYPE_WAI 0x88b4
#endif
#define HDD_PSB_CFG_INVALID 0xFF
#define HDD_PSB_CHANGED 0xFF
#define SME_QOS_UAPSD_CFG_BK_CHANGED_MASK 0xF1
#define SME_QOS_UAPSD_CFG_BE_CHANGED_MASK 0xF2
#define SME_QOS_UAPSD_CFG_VI_CHANGED_MASK 0xF4
#define SME_QOS_UAPSD_CFG_VO_CHANGED_MASK 0xF8
int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
void hdd_tx_timeout(struct net_device *dev);
CDF_STATUS hdd_init_tx_rx(hdd_adapter_t *pAdapter);
CDF_STATUS hdd_deinit_tx_rx(hdd_adapter_t *pAdapter);
CDF_STATUS hdd_rx_packet_cbk(void *cds_context, cdf_nbuf_t rxBufChain,
uint8_t staId);
#ifdef IPA_OFFLOAD
CDF_STATUS hdd_rx_mul_packet_cbk(void *cds_context,
cdf_nbuf_t rx_buf_list, uint8_t staId);
#endif /* IPA_OFFLOAD */
CDF_STATUS hdd_ibss_get_sta_id(hdd_station_ctx_t *pHddStaCtx,
struct cdf_mac_addr *pMacAddress,
uint8_t *staId);
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
void hdd_tx_resume_cb(void *adapter_context, bool tx_resume);
void hdd_tx_resume_timer_expired_handler(void *adapter_context);
void hdd_register_tx_flow_control(hdd_adapter_t *adapter,
cdf_mc_timer_callback_t timer_callback,
ol_txrx_tx_flow_control_fp flowControl);
void hdd_deregister_tx_flow_control(hdd_adapter_t *adapter);
void hdd_get_tx_resource(hdd_adapter_t *adapter,
uint8_t STAId, uint16_t timer_value);
#else
static inline void hdd_tx_resume_cb(void *adapter_context, bool tx_resume)
{
return;
}
static inline void hdd_tx_resume_timer_expired_handler(void *adapter_context)
{
return;
}
static inline void hdd_register_tx_flow_control(hdd_adapter_t *adapter,
cdf_mc_timer_callback_t timer_callback,
ol_txrx_tx_flow_control_fp flowControl)
{
return;
}
static inline void hdd_deregister_tx_flow_control(hdd_adapter_t *adapter)
{
return;
}
static inline void hdd_get_tx_resource(hdd_adapter_t *adapter,
uint8_t STAId, uint16_t timer_value)
{
return;
}
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
#ifdef FEATURE_WLAN_DIAG_SUPPORT
/**
* wlan_hdd_log_eapol() - Function to check and extract EAPOL params
* @skb: skb data
* @event_type: One of enum wifi_connectivity_events to indicate Tx/Rx
*
* This function parses the input skb data to get the EAPOL params,if the
* packet is EAPOL and store it in the pointer passed as input
*
* Return: None
*
*/
void wlan_hdd_log_eapol(struct sk_buff *skb,
uint8_t event_type);
#else
static inline void wlan_hdd_log_eapol(struct sk_buff *skb,
uint8_t event_type)
{
}
#endif /* FEATURE_WLAN_DIAG_SUPPORT */
const char *hdd_reason_type_to_string(enum netif_reason_type reason);
const char *hdd_action_type_to_string(enum netif_action_type action);
void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
enum netif_action_type action, enum netif_reason_type reason);
#endif /* end #if !defined(WLAN_HDD_TX_RX_H) */

View File

@@ -1,371 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WEXT_IW_H__
#define __WEXT_IW_H__
#include <linux/version.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
#include <linux/timer.h>
#include "cdf_event.h"
/*
* order of parameters in addTs private ioctl
*/
#define HDD_WLAN_WMM_PARAM_HANDLE 0
#define HDD_WLAN_WMM_PARAM_TID 1
#define HDD_WLAN_WMM_PARAM_DIRECTION 2
#define HDD_WLAN_WMM_PARAM_APSD 3
#define HDD_WLAN_WMM_PARAM_USER_PRIORITY 4
#define HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE 5
#define HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE 6
#define HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE 7
#define HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE 8
#define HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE 9
#define HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE 10
#define HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE 11
#define HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE 12
#define HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL 13
#define HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL 14
#define HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN 15
#define HDD_WLAN_WMM_PARAM_ACK_POLICY 16
#define HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL 17
#define HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL 18
#define HDD_WLAN_WMM_PARAM_COUNT 19
#define MHZ 6
#define WE_MAX_STR_LEN IW_PRIV_SIZE_MASK
#define WLAN_HDD_UI_BAND_AUTO 0
#define WLAN_HDD_UI_BAND_5_GHZ 1
#define WLAN_HDD_UI_BAND_2_4_GHZ 2
/* SETBAND x */
/* 012345678 */
#define WLAN_HDD_UI_SET_BAND_VALUE_OFFSET 8
typedef enum {
HDD_WLAN_WMM_DIRECTION_UPSTREAM = 0,
HDD_WLAN_WMM_DIRECTION_DOWNSTREAM = 1,
HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL = 2,
} hdd_wlan_wmm_direction_e;
typedef enum {
HDD_WLAN_WMM_POWER_SAVE_LEGACY = 0,
HDD_WLAN_WMM_POWER_SAVE_UAPSD = 1,
} hdd_wlan_wmm_power_save_e;
typedef enum {
/* TSPEC/re-assoc done, async */
HDD_WLAN_WMM_STATUS_SETUP_SUCCESS = 0,
/* no need to setup TSPEC since ACM=0 and no UAPSD desired, sync + async */
HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD = 1,
/* no need to setup TSPEC since ACM=0 and UAPSD already exists, sync + async */
HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING = 2,
/* TSPEC result pending, sync */
HDD_WLAN_WMM_STATUS_SETUP_PENDING = 3,
/* TSPEC/re-assoc failed, sync + async */
HDD_WLAN_WMM_STATUS_SETUP_FAILED = 4,
/* Request rejected due to invalid params, sync + async */
HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM = 5,
/* TSPEC request rejected since AP!=QAP, sync */
HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM = 6,
/* TSPEC modification/re-assoc successful, async */
HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS = 7,
/* TSPEC modification a no-op since ACM=0 and no change in UAPSD, sync + async */
HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD = 8,
/* TSPEC modification a no-op since ACM=0 and requested U-APSD already exists, sync + async */
HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING = 9,
/* TSPEC result pending, sync */
HDD_WLAN_WMM_STATUS_MODIFY_PENDING = 10,
/* TSPEC modification failed, prev TSPEC in effect, sync + async */
HDD_WLAN_WMM_STATUS_MODIFY_FAILED = 11,
/* TSPEC modification request rejected due to invalid params, sync + async */
HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM = 12,
/* TSPEC release successful, sync and also async */
HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS = 13,
/* TSPEC release pending, sync */
HDD_WLAN_WMM_STATUS_RELEASE_PENDING = 14,
/* TSPEC release failed, sync + async */
HDD_WLAN_WMM_STATUS_RELEASE_FAILED = 15,
/* TSPEC release rejected due to invalid params, sync */
HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM = 16,
/* TSPEC modified due to the mux'ing of requests on ACs, async */
HDD_WLAN_WMM_STATUS_MODIFIED = 17,
/* TSPEC revoked by AP, async */
HDD_WLAN_WMM_STATUS_LOST = 18,
/* some internal failure like memory allocation failure, etc, sync */
HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE = 19,
/* U-APSD failed during setup but OTA setup (whether TSPEC exchnage or */
/* re-assoc) was done so app should release this QoS, async */
HDD_WLAN_WMM_STATUS_SETUP_UAPSD_SET_FAILED = 20,
/* U-APSD failed during modify, but OTA setup (whether TSPEC exchnage or */
/* re-assoc) was done so app should release this QoS, async */
HDD_WLAN_WMM_STATUS_MODIFY_UAPSD_SET_FAILED = 21
} hdd_wlan_wmm_status_e;
/** TS Info Ack Policy */
typedef enum {
HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK = 0,
HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK = 1,
} hdd_wlan_wmm_ts_info_ack_policy_e;
/** Maximum Length of WPA/RSN IE */
#define MAX_WPA_RSN_IE_LEN 40
/** Enable 11d */
#define ENABLE_11D 1
/** Disable 11d */
#define DISABLE_11D 0
/*
refer wpa.h in wpa supplicant code for REASON_MICHAEL_MIC_FAILURE
supplicant sets REASON_MICHAEL_MIC_FAILURE as the reason code when it sends the MLME deauth IOCTL
for TKIP counter measures
*/
#define HDD_REASON_MICHAEL_MIC_FAILURE 14
/*
* These are for TLV fields in WPS IE
*/
#define HDD_WPS_UUID_LEN 16
#define HDD_WPS_ELEM_VERSION 0x104a
#define HDD_WPS_ELEM_REQUEST_TYPE 0x103a
#define HDD_WPS_ELEM_CONFIG_METHODS 0x1008
#define HDD_WPS_ELEM_UUID_E 0x1047
#define HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE 0x1054
#define HDD_WPS_ELEM_RF_BANDS 0x103c
#define HDD_WPS_ELEM_ASSOCIATION_STATE 0x1002
#define HDD_WPS_ELEM_CONFIGURATION_ERROR 0x1009
#define HDD_WPS_ELEM_DEVICE_PASSWORD_ID 0x1012
#define HDD_WPA_ELEM_VENDOR_EXTENSION 0x1049
#define HDD_WPS_MANUFACTURER_LEN 64
#define HDD_WPS_MODEL_NAME_LEN 32
#define HDD_WPS_MODEL_NUM_LEN 32
#define HDD_WPS_SERIAL_NUM_LEN 32
#define HDD_WPS_DEVICE_OUI_LEN 4
#define HDD_WPS_DEVICE_NAME_LEN 32
#define HDD_WPS_ELEM_WPS_STATE 0x1044
#define HDD_WPS_ELEM_APSETUPLOCK 0x1057
#define HDD_WPS_ELEM_SELECTEDREGISTRA 0x1041
#define HDD_WPS_ELEM_RSP_TYPE 0x103B
#define HDD_WPS_ELEM_MANUFACTURER 0x1021
#define HDD_WPS_ELEM_MODEL_NAME 0x1023
#define HDD_WPS_ELEM_MODEL_NUM 0x1024
#define HDD_WPS_ELEM_SERIAL_NUM 0x1042
#define HDD_WPS_ELEM_DEVICE_NAME 0x1011
#define HDD_WPS_ELEM_REGISTRA_CONF_METHODS 0x1053
#define HDD_RTSCTS_EN_MASK 0xF
#define HDD_RTSCTS_ENABLE 1
#define HDD_CTS_ENABLE 2
#define WPS_OUI_TYPE "\x00\x50\xf2\x04"
#define WPS_OUI_TYPE_SIZE 4
#define SS_OUI_TYPE "\x00\x16\x32"
#define SS_OUI_TYPE_SIZE 3
#define P2P_OUI_TYPE "\x50\x6f\x9a\x09"
#define P2P_OUI_TYPE_SIZE 4
#define HS20_OUI_TYPE "\x50\x6f\x9a\x10"
#define HS20_OUI_TYPE_SIZE 4
#define OSEN_OUI_TYPE "\x50\x6f\x9a\x12"
#define OSEN_OUI_TYPE_SIZE 4
#ifdef WLAN_FEATURE_WFD
#define WFD_OUI_TYPE "\x50\x6f\x9a\x0a"
#define WFD_OUI_TYPE_SIZE 4
#endif
typedef enum {
eWEXT_WPS_OFF = 0,
eWEXT_WPS_ON = 1,
} hdd_wps_mode_e;
/*
* This structure contains the interface level (granularity)
* configuration information in support of wireless extensions.
*/
typedef struct hdd_wext_state_s {
/** The CSR "desired" Profile */
tCsrRoamProfile roamProfile;
/** BSSID to which connect request is received */
struct cdf_mac_addr req_bssId;
/** The association status code */
uint32_t statusCode;
/** wpa version WPA/WPA2/None*/
int32_t wpaVersion;
/**WPA or RSN IE*/
uint8_t WPARSNIE[MAX_WPA_RSN_IE_LEN];
/**gen IE */
tSirAddie genIE;
/**Additional IE for assoc */
tSirAddie assocAddIE;
/**auth key mgmt */
int32_t authKeyMgmt;
/* cdf event */
cdf_event_t hdd_cdf_event;
cdf_event_t scanevent;
/**Counter measure state, Started/Stopped*/
bool mTKIPCounterMeasures;
/**Completion Variable*/
struct completion completion_var;
#ifdef FEATURE_WLAN_ESE
/* ESE state variables */
bool isESEConnection;
eCsrAuthType collectedAuthType; /* Collected from ALL SIOCSIWAUTH Ioctls. Will be negotiatedAuthType - in tCsrProfile */
#endif
} hdd_wext_state_t;
typedef struct ccp_freq_chan_map_s {
/* List of frequencies */
uint32_t freq;
uint32_t chan;
} hdd_freq_chan_map_t;
/* Packet Types. */
#define WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
#define WLAN_KEEP_ALIVE_NULL_PKT 1
#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
wlan_hdd_get_vendor_oui_ie_ptr(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, ie, ie_len)
#define wlan_hdd_get_p2p_ie_ptr(ie, ie_len) \
wlan_hdd_get_vendor_oui_ie_ptr(P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE, ie, ie_len)
#ifdef WLAN_FEATURE_WFD
#define wlan_hdd_get_wfd_ie_ptr(ie, ie_len) \
wlan_hdd_get_vendor_oui_ie_ptr(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, ie, ie_len)
#endif
extern int hdd_unregister_wext(struct net_device *dev);
extern int hdd_register_wext(struct net_device *dev);
extern int hdd_wlan_get_freq(uint32_t chan, uint32_t *freq);
extern int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter,
union iwreq_data *wrqu);
extern int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter,
union iwreq_data *wrqu);
extern void hdd_wlan_get_version(hdd_adapter_t *pAdapter,
union iwreq_data *wrqu, char *extra);
extern void hdd_wlan_get_stats(hdd_adapter_t *pAdapter, uint16_t *length,
char *buffer, uint16_t buf_len);
extern void hdd_wlan_list_fw_profile(uint16_t *length,
char *buffer, uint16_t buf_len);
extern int iw_set_essid(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_get_essid(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq, char *extra);
extern int iw_set_ap_address(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_get_ap_address(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_set_auth(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_get_auth(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_set_var_ints_getnone(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int iw_set_three_ints_getnone(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
extern int hdd_priv_get_data(struct iw_point *p_priv_data,
union iwreq_data *wrqu);
extern void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
extern CDF_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter,
struct cdf_mac_addr mac_address);
void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter);
uint8_t *wlan_hdd_get_vendor_oui_ie_ptr(uint8_t *oui, uint8_t oui_size,
uint8_t *ie, int ie_len);
CDF_STATUS wlan_hdd_get_class_astats(hdd_adapter_t *pAdapter);
CDF_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter);
CDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value);
CDF_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, int8_t *snr);
#ifdef FEATURE_WLAN_TDLS
CDF_STATUS iw_set_tdls_params(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra, int nOffset);
#endif
void wlan_hdd_change_country_code_callback(void *pAdapter);
int hdd_set_band(struct net_device *dev, u8 ui_band);
int hdd_set_band_helper(struct net_device *dev, const char *command);
int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal,
int new_phymode, hdd_context_t *phddctx);
int wlan_hdd_get_temperature(hdd_adapter_t *pAdapter, int *temperature);
int wlan_hdd_get_link_speed(hdd_adapter_t *sta_adapter, uint32_t *link_speed);
#endif /* __WEXT_IW_H__ */

View File

@@ -1,404 +0,0 @@
/*
* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _WLAN_HDD_WMM_H
#define _WLAN_HDD_WMM_H
/**
* DOC: HDD WMM
*
* This module (wlan_hdd_wmm.h interface + wlan_hdd_wmm.c implementation)
* houses all the logic for WMM in HDD.
*
* On the control path, it has the logic to setup QoS, modify QoS and delete
* QoS (QoS here refers to a TSPEC). The setup QoS comes in two flavors: an
* explicit application invoked and an internal HDD invoked. The implicit QoS
* is for applications that do NOT call the custom QCT WLAN OIDs for QoS but
* which DO mark their traffic for priortization. It also has logic to start,
* update and stop the U-APSD trigger frame generation. It also has logic to
* read WMM related config parameters from the registry.
*
* On the data path, it has the logic to figure out the WMM AC of an egress
* packet and when to signal TL to serve a particular AC queue. It also has the
* logic to retrieve a packet based on WMM priority in response to a fetch from
* TL.
*
* The remaining functions are utility functions for information hiding.
*/
/* Include files */
#include <linux/workqueue.h>
#include <linux/list.h>
#include <wlan_hdd_main.h>
#include <wlan_hdd_wext.h>
#include <sme_qos_api.h>
/*Maximum number of ACs */
#define WLAN_MAX_AC 4
/* Preprocessor Definitions and Constants */
/* #define HDD_WMM_DEBUG 1 */
#define HDD_WMM_CTX_MAGIC 0x574d4d58 /* "WMMX" */
#define HDD_WMM_HANDLE_IMPLICIT 0xFFFFFFFF
#define HDD_WLAN_INVALID_STA_ID 0xFF
/* Type Declarations */
/**
* enum hdd_wmm_classification: types of classification supported
*/
typedef enum hdd_wmm_classification {
HDD_WMM_CLASSIFICATION_DSCP = 0,
HDD_WMM_CLASSIFICATION_802_1Q = 1
} hdd_wmm_classification_t;
/**
* enum hdd_wmm_user_mode - WMM modes of operation
*
* @HDD_WMM_USER_MODE_AUTO: STA can associate with any AP, & HDD looks at
* the SME notification after association to find out if associated
* with QAP and acts accordingly
* @HDD_WMM_USER_MODE_QBSS_ONLY - SME will add the extra logic to make sure
* STA associates with a QAP only
* @HDD_WMM_USER_MODE_NO_QOS - SME will not join a QoS AP, unless the phy
* mode setting says "Auto". In that case, STA is free to join 11n AP.
* Although from HDD point of view, it will not be doing any packet
* classifications.
*/
typedef enum hdd_wmm_user_mode {
HDD_WMM_USER_MODE_AUTO = 0,
HDD_WMM_USER_MODE_QBSS_ONLY = 1,
HDD_WMM_USER_MODE_NO_QOS = 2,
} hdd_wmm_user_mode_t;
/* UAPSD Mask bits */
/* (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored) */
#define HDD_AC_VO 0x1
#define HDD_AC_VI 0x2
#define HDD_AC_BK 0x4
#define HDD_AC_BE 0x8
/**
* struct hdd_wmm_qos_context - HDD WMM QoS Context
*
* This structure holds the context for a single flow which has either
* been confgured explicitly from userspace or implicitly via the
* Implicit QoS feature.
*
* @node: list node which can be used to put the context into a list
* of contexts
* @handle: identifer which uniquely identifies this context to userspace
* @qosFlowID: identifier which uniquely identifies this flow to SME
* @pAdapter: adapter upon which this flow was configured
* @acType: access category for this flow
* @lastStatus: the status of the last operation performed on this flow by SME
* @wmmAcSetupImplicitQos: work structure used for deferring implicit QoS work
* from softirq context to thread context
* @magic: magic number used to verify that this is a valid context when
* referenced anonymously
*/
typedef struct hdd_wmm_qos_context {
struct list_head node;
uint32_t handle;
uint32_t qosFlowId;
hdd_adapter_t *pAdapter;
sme_ac_enum_type acType;
hdd_wlan_wmm_status_e lastStatus;
struct work_struct wmmAcSetupImplicitQos;
uint32_t magic;
bool is_inactivity_timer_running;
} hdd_wmm_qos_context_t;
/**
* struct hdd_wmm_ac_status - WMM related per-AC state & status info
* @wmmAcAccessRequired - does the AP require access to this AC?
* @wmmAcAccessNeeded - does the worker thread need to acquire access to
* this AC?
* @wmmAcAccessPending - is implicit QoS negotiation currently taking place?
* @wmmAcAccessFailed - has implicit QoS negotiation already failed?
* @wmmAcAccessGranted - has implicit QoS negotiation already succeeded?
* @wmmAcAccessAllowed - is access to this AC allowed, either because we
* are not doing WMM, we are not doing implicit QoS, implict QoS has
* completed, or explicit QoS has completed?
* @wmmAcTspecValid - is the wmmAcTspecInfo valid?
* @wmmAcUapsdInfoValid - are the wmmAcUapsd* fields valid?
* @wmmAcTspecInfo - current (possibly aggregate) Tspec for this AC
* @wmmAcIsUapsdEnabled - is UAPSD enabled on this AC?
* @wmmAcUapsdServiceInterval - service interval for this AC
* @wmmAcUapsdSuspensionInterval - suspension interval for this AC
* @wmmAcUapsdDirection - direction for this AC
* @wmmInactivityTime - inactivity time for this AC
* @wmmPrevTrafficCnt - TX counter used for inactivity detection
* @wmmInactivityTimer - timer used for inactivity detection
*/
typedef struct hdd_wmm_ac_status {
bool wmmAcAccessRequired;
bool wmmAcAccessNeeded;
bool wmmAcAccessPending;
bool wmmAcAccessFailed;
bool wmmAcAccessGranted;
bool wmmAcAccessAllowed;
bool wmmAcTspecValid;
bool wmmAcUapsdInfoValid;
sme_QosWmmTspecInfo wmmAcTspecInfo;
bool wmmAcIsUapsdEnabled;
uint32_t wmmAcUapsdServiceInterval;
uint32_t wmmAcUapsdSuspensionInterval;
sme_QosWmmDirType wmmAcUapsdDirection;
#ifdef FEATURE_WLAN_ESE
uint32_t wmmInactivityTime;
uint32_t wmmPrevTrafficCnt;
cdf_mc_timer_t wmmInactivityTimer;
#endif
} hdd_wmm_ac_status_t;
/**
* struct hdd_wmm_status - WMM status maintained per-adapter
* @wmmContextList - list of WMM contexts active on the adapter
* @wmmLock - mutex used for exclusive access to this adapter's WMM status
* @wmmACStatus - per-AC WMM status
* @wmmQap - is this connected to a QoS-enabled AP?
* @wmmQosConnection - is this a QoS connection?
*/
typedef struct hdd_wmm_status {
struct list_head wmmContextList;
struct mutex wmmLock;
hdd_wmm_ac_status_t wmmAcStatus[WLAN_MAX_AC];
bool wmmQap;
bool wmmQosConnection;
} hdd_wmm_status_t;
extern const uint8_t hdd_qdisc_ac_to_tl_ac[];
extern const uint8_t hdd_wmm_up_to_ac_map[];
extern const uint8_t hdd_linux_up_to_ac_map[];
#define WLAN_HDD_MAX_DSCP 0x3f
/**
* hdd_wmmps_helper() - Function to set uapsd psb dynamically
*
* @pAdapter: [in] pointer to adapter structure
* @ptr: [in] pointer to command buffer
*
* Return: Zero on success, appropriate error on failure.
*/
int hdd_wmmps_helper(hdd_adapter_t *pAdapter, uint8_t *ptr);
/**
* hdd_wmm_init() - initialize the WMM DSCP configuation
* @pAdapter : [in] pointer to Adapter context
*
* This function will initialize the WMM DSCP configuation of an
* adapter to an initial state. The configuration can later be
* overwritten via application APIs or via QoS Map sent OTA.
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_init(hdd_adapter_t *pAdapter);
/**
* hdd_wmm_adapter_init() - initialize the WMM configuration of an adapter
* @pAdapter: [in] pointer to Adapter context
*
* This function will initialize the WMM configuation and status of an
* adapter to an initial state. The configuration can later be
* overwritten via application APIs
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_adapter_init(hdd_adapter_t *pAdapter);
/**
* hdd_wmm_close() - WMM close function
* @pAdapter: [in] pointer to adapter context
*
* Function which will perform any necessary work to to clean up the
* WMM functionality prior to the kernel module unload.
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter);
/**
* hdd_wmm_select_queue() - Function which will classify the packet
* according to linux qdisc expectation.
*
* @dev: [in] pointer to net_device structure
* @skb: [in] pointer to os packet
*
* Return: Qdisc queue index
*/
uint16_t hdd_wmm_select_queue(struct net_device *dev, struct sk_buff *skb);
/**
* hdd_hostapd_select_queue() - Function which will classify the packet
* according to linux qdisc expectation.
*
* @dev: [in] pointer to net_device structure
* @skb: [in] pointer to os packet
*
* Return: Qdisc queue index
*/
uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
, void *accel_priv
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
, select_queue_fallback_t fallback
#endif
);
/**
* hdd_wmm_acquire_access_required() - Function which will determine
* acquire admittance for a WMM AC is required or not based on psb configuration
* done in framework
*
* @pAdapter: [in] pointer to adapter structure
* @acType: [in] WMM AC type of OS packet
*
* Return: void
*/
void hdd_wmm_acquire_access_required(hdd_adapter_t *pAdapter,
sme_ac_enum_type acType);
/**
* hdd_wmm_acquire_access() - Function which will attempt to acquire
* admittance for a WMM AC
*
* @pAdapter: [in] pointer to adapter context
* @acType: [in] WMM AC type of OS packet
* @pGranted: [out] pointer to bool flag when indicates if access
* has been granted or not
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_acquire_access(hdd_adapter_t *pAdapter,
sme_ac_enum_type acType, bool *pGranted);
/**
* hdd_wmm_assoc() - Function which will handle the housekeeping
* required by WMM when association takes place
*
* @pAdapter: [in] pointer to adapter context
* @pRoamInfo: [in] pointer to roam information
* @eBssType: [in] type of BSS
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_assoc(hdd_adapter_t *pAdapter,
tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType);
/**
* hdd_wmm_connect() - Function which will handle the housekeeping
* required by WMM when a connection is established
*
* @pAdapter : [in] pointer to adapter context
* @pRoamInfo: [in] pointer to roam information
* @eBssType : [in] type of BSS
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_connect(hdd_adapter_t *pAdapter,
tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType);
/**
* hdd_wmm_get_uapsd_mask() - Function which will calculate the
* initial value of the UAPSD mask based upon the device configuration
*
* @pAdapter : [in] pointer to adapter context
* @pUapsdMask: [out] pointer to where the UAPSD Mask is to be stored
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_get_uapsd_mask(hdd_adapter_t *pAdapter,
uint8_t *pUapsdMask);
/**
* hdd_wmm_is_active() - Function which will determine if WMM is
* active on the current connection
*
* @pAdapter: [in] pointer to adapter context
*
* Return: true if WMM is enabled, false if WMM is not enabled
*/
bool hdd_wmm_is_active(hdd_adapter_t *pAdapter);
/**
* hdd_wmm_addts() - Function which will add a traffic spec at the
* request of an application
*
* @pAdapter : [in] pointer to adapter context
* @handle : [in] handle to uniquely identify a TS
* @pTspec : [in] pointer to the traffic spec
*
* Return: HDD_WLAN_WMM_STATUS_*
*/
hdd_wlan_wmm_status_e hdd_wmm_addts(hdd_adapter_t *pAdapter,
uint32_t handle,
sme_QosWmmTspecInfo *pTspec);
/**
* hdd_wmm_delts() - Function which will delete a traffic spec at the
* request of an application
*
* @pAdapter: [in] pointer to adapter context
* @handle: [in] handle to uniquely identify a TS
*
* Return: HDD_WLAN_WMM_STATUS_*
*/
hdd_wlan_wmm_status_e hdd_wmm_delts(hdd_adapter_t *pAdapter, uint32_t handle);
/**
* hdd_wmm_checkts() - Function which will return the status of a traffic
* spec at the request of an application
*
* @pAdapter: [in] pointer to adapter context
* @handle: [in] handle to uniquely identify a TS
*
* Return: HDD_WLAN_WMM_STATUS_*
*/
hdd_wlan_wmm_status_e hdd_wmm_checkts(hdd_adapter_t *pAdapter,
uint32_t handle);
/**
* hdd_wmm_adapter_clear() - Function which will clear the WMM status
* for all the ACs
*
* @pAdapter: [in] pointer to Adapter context
*
* Return: CDF_STATUS enumeration
*/
CDF_STATUS hdd_wmm_adapter_clear(hdd_adapter_t *pAdapter);
void wlan_hdd_process_peer_unauthorised_pause(hdd_adapter_t *adapter);
#endif /* #ifndef _WLAN_HDD_WMM_H */

View File

@@ -1,183 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef _WLAN_HDD_WOWL_H
#define _WLAN_HDD_WOWL_H
/**
* DOC: wlan_hdd_wowl
*
* This module houses all the logic for WOWL in HDD.
*
* It provides the following APIs
*
* - Ability to enable/disable following WoWL modes
* 1) Magic packet (MP) mode
* 2) Pattern Byte Matching (PBM) mode
* - Ability to add/remove patterns for PBM
*
* A Magic Packet is a packet that contains 6 0xFFs followed by 16
* contiguous copies of the receiving NIC's Ethernet address. There is
* no API to configure Magic Packet Pattern.
*
* Wakeup pattern (used for PBM) is defined as following:
* typedef struct
* {
* U8 PatternSize; // Non-Zero pattern size
* U8 PatternMaskSize; // Non-zero pattern mask size
* U8 PatternMask[PatternMaskSize]; // Pattern mask
* U8 Pattern[PatternSize]; // Pattern
* } hdd_wowl_ptrn_t;
*
* PatternSize and PatternMaskSize indicate size of the variable
* length Pattern and PatternMask. PatternMask indicates which bytes
* of an incoming packet should be compared with corresponding bytes
* in the pattern.
*
* Maximum allowed pattern size is 128 bytes. Maximum allowed
* PatternMaskSize is 16 bytes.
*
* Maximum number of patterns that can be configured is 8
*
* HDD will add following 2 commonly used patterns for PBM by default:
* 1) ARP Broadcast Pattern
* 2) Unicast Pattern
*
* However note that WoWL will not be enabled by default by HDD. WoWL
* needs to enabled explcitly by exercising the iwpriv command.
*
* HDD will expose an API that accepts patterns as Hex string in the
* following format:
* "PatternSize:PatternMaskSize:PatternMask:Pattern"
*
* Multiple patterns can be specified by deleimiting each pattern with
* the ';' token:
* "PatternSize1:PatternMaskSize1:PatternMask1:Pattern1;PatternSize2:..."
*
* Patterns can be configured dynamically via iwpriv cmd or statically
* via qcom_cfg.ini file
*
* PBM (when enabled) can perform filtering on unicast data or
* broadcast data or both. These configurations are part of factory
* defaults (cfg.dat) and the deafult behavior is to perform filtering
* on both unicast and data frames.
*
* MP filtering (when enabled) is performed ALWAYS on both unicast and
* broadcast data frames.
*
* Mangement frames are not subjected to WoWL filtering and are
* discarded when WoWL is enabled.
*
* Whenever a patern match succeeds, RX path is restored and packets
* (both management and data) will be pushed to the host from that
* point onwards. Therefore, exit from WoWL is implicit and happens
* automatically when the first packet match succeeds.
*
* WoWL works on top of BMPS. So when WoWL is requested, SME will
* attempt to put the device in BMPS mode (if not already in BMPS). If
* attempt to BMPS fails, request for WoWL will be rejected.
*/
#include <cdf_types.h>
#define WOWL_PTRN_MAX_SIZE 146
#define WOWL_PTRN_MASK_MAX_SIZE 19
#define WOWL_MAX_PTRNS_ALLOWED CFG_MAX_WOW_FILTERS_MAX
/**
* hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be
* used when PBM filtering is enabled
* @pAdapter: pointer to the adapter
* @ptrn: pointer to the pattern string to be added
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_add_wowl_ptrn(hdd_adapter_t *pAdapter, const char *ptrn);
/**
* hdd_del_wowl_ptrn() - Function which will remove a WoWL pattern
* @pAdapter: pointer to the adapter
* @ptrn: pointer to the pattern string to be removed
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_del_wowl_ptrn(hdd_adapter_t *pAdapter, const char *ptrn);
/**
* hdd_add_wowl_ptrn_debugfs() - Function which will add a WoW pattern
* sent from debugfs interface
* @pAdapter: pointer to the adapter
* @pattern_idx: index of the pattern to be added
* @pattern_offset: offset of the pattern in the frame payload
* @pattern_buf: pointer to the pattern hex string to be added
* @pattern_mask: pointer to the pattern mask hex string
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_add_wowl_ptrn_debugfs(hdd_adapter_t *pAdapter, uint8_t pattern_idx,
uint8_t pattern_offset, char *pattern_buf,
char *pattern_mask);
/**
* hdd_del_wowl_ptrn_debugfs() - Function which will remove a WoW pattern
* sent from debugfs interface
* @pAdapter: pointer to the adapter
* @pattern_idx: index of the pattern to be removed
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_del_wowl_ptrn_debugfs(hdd_adapter_t *pAdapter, uint8_t pattern_idx);
/**
* hdd_enter_wowl() - Function which will enable WoWL. At least one
* of MP and PBM must be enabled
* @pAdapter: pointer to the adapter
* @enable_mp: Whether to enable magic packet WoWL mode
* @enable_pbm: Whether to enable pattern byte matching WoWL mode
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_enter_wowl(hdd_adapter_t *pAdapter, bool enable_mp, bool enable_pbm);
/**
* hdd_exit_wowl() - Function which will disable WoWL
* @pAdapter: pointer to the adapter
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_exit_wowl(hdd_adapter_t *pAdapter);
/**
* hdd_init_wowl() - Init function which will initialize the WoWL module
* and perform any required initial configuration
* @pAdapter: pointer to the adapter
*
* Return: false if any errors encountered, true otherwise
*/
bool hdd_init_wowl(hdd_adapter_t *pAdapter);
#endif /* #ifndef _WLAN_HDD_WOWL_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,863 +0,0 @@
/*
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* Include files */
#include <wlan_hdd_includes.h>
#include <cds_api.h>
#include <cds_sched.h>
#include <wni_api.h>
#include <wlan_hdd_cfg.h>
#include "wlan_hdd_trace.h"
#include "cds_concurrency.h"
#include "wlan_hdd_conc_ut.h"
#include "cdf_types.h"
#include "cdf_trace.h"
#include "cds_utils.h"
#include "cds_reg_service.h"
#include "wma_types.h"
#include "wma.h"
#include "wma_api.h"
#define NUMBER_OF_SCENARIO 300
#define MAX_ALLOWED_CHAR_IN_REPORT 50
/**
* struct report_t: Data structure to fill report
*
* @title: title of the concurrency case scenario
* @first_persona: device type of first persona
* @second_persona: device type of second persona
* @third_persona: device type of third persona
* @dbs_value: string to mention whether dbs enable or disable
* @system_conf: string to mention what is system's configuration
* @status: status field
* @result_code: string to mention whether test case passed or failed
* @reason: reason why test case failed
* @pcl: preferred channel list
*
* This structure will be used by unit test framework to fill
* report after running various concurrency scenarios.
*/
struct report_t {
char title[2 * MAX_ALLOWED_CHAR_IN_REPORT];
char first_persona[MAX_ALLOWED_CHAR_IN_REPORT];
char second_persona[MAX_ALLOWED_CHAR_IN_REPORT];
char third_persona[MAX_ALLOWED_CHAR_IN_REPORT];
char dbs_value[MAX_ALLOWED_CHAR_IN_REPORT];
char system_conf[MAX_ALLOWED_CHAR_IN_REPORT];
bool status;
char result_code[MAX_ALLOWED_CHAR_IN_REPORT];
char reason[MAX_ALLOWED_CHAR_IN_REPORT];
char pcl[2 * MAX_NUM_CHAN];
};
static struct report_t report[NUMBER_OF_SCENARIO];
static uint32_t report_idx;
static uint8_t wlan_hdd_valid_type_of_persona(uint32_t sub_type)
{
switch (sub_type) {
case CDS_STA_MODE:
return WMI_VDEV_TYPE_STA;
case CDS_IBSS_MODE:
return WMI_VDEV_TYPE_IBSS;
case CDS_SAP_MODE:
case CDS_P2P_CLIENT_MODE:
case CDS_P2P_GO_MODE:
return WMI_VDEV_TYPE_AP;
default:
return WMI_VDEV_TYPE_STA;
}
}
static const char *system_config_to_string(uint8_t idx)
{
switch (idx) {
CASE_RETURN_STRING(CDS_THROUGHPUT);
CASE_RETURN_STRING(CDS_POWERSAVE);
CASE_RETURN_STRING(CDS_LATENCY);
default:
return "Unknown";
}
}
static const char *device_mode_to_string(uint8_t idx)
{
switch (idx) {
CASE_RETURN_STRING(CDS_STA_MODE);
CASE_RETURN_STRING(CDS_SAP_MODE);
CASE_RETURN_STRING(CDS_P2P_CLIENT_MODE);
CASE_RETURN_STRING(CDS_P2P_GO_MODE);
CASE_RETURN_STRING(CDS_IBSS_MODE);
default:
return "none";
}
}
static const char *pcl_type_to_string(uint8_t idx)
{
switch (idx) {
CASE_RETURN_STRING(CDS_NONE);
CASE_RETURN_STRING(CDS_24G);
CASE_RETURN_STRING(CDS_5G);
CASE_RETURN_STRING(CDS_SCC_CH);
CASE_RETURN_STRING(CDS_MCC_CH);
CASE_RETURN_STRING(CDS_SCC_CH_24G);
CASE_RETURN_STRING(CDS_SCC_CH_5G);
CASE_RETURN_STRING(CDS_24G_SCC_CH);
CASE_RETURN_STRING(CDS_5G_SCC_CH);
CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24_24G);
CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24_5G);
CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5_24G);
CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5_5G);
CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24);
CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5);
CASE_RETURN_STRING(CDS_MCC_CH_24G);
CASE_RETURN_STRING(CDS_MCC_CH_5G);
CASE_RETURN_STRING(CDS_24G_MCC_CH);
CASE_RETURN_STRING(CDS_5G_MCC_CH);
default:
return "Unknown";
}
}
void clean_report(hdd_context_t *hdd_ctx)
{
uint32_t idx = 0;
while (idx < NUMBER_OF_SCENARIO) {
cdf_mem_zero(&report[idx], sizeof(struct report_t));
idx++;
}
report_idx = 0;
}
void print_report(hdd_context_t *hdd_ctx)
{
uint32_t idx = 0;
pr_info("+----------Report start -----------+\n");
while (idx < report_idx) {
pr_info("Idx:[%d]\nTitle:%s\nResult:[%s]\n\t1st_person[%s]\n\t2nd_persona[%s]\n\t3rd_persona[%s]\n\tDBS[%s]\n\tsystem_config[%s]\n\treason[%s]\n\tpcl[%s]\n",
idx,
report[idx].title, report[idx].result_code,
report[idx].first_persona, report[idx].second_persona,
report[idx].third_persona, report[idx].dbs_value,
report[idx].system_conf, report[idx].reason,
report[idx].pcl);
idx++;
}
pr_info("+----------Report end -----------+\n");
}
void fill_report(hdd_context_t *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
bool status, enum cds_pcl_type pcl_type, char *reason, uint8_t *pcl)
{
int i;
char buf[4] = {0};
if (report_idx >= NUMBER_OF_SCENARIO)
return;
snprintf(report[report_idx].title,
2 * MAX_ALLOWED_CHAR_IN_REPORT, "pcl for[%s] pcl_type[%s]",
title, pcl_type_to_string(pcl_type));
if (chnl_1st_conn == 0)
snprintf(report[report_idx].first_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
device_mode_to_string(first_persona));
else
snprintf(report[report_idx].first_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
"%s-chnl{%d}",
device_mode_to_string(first_persona), chnl_1st_conn);
if (chnl_2nd_conn == 0)
snprintf(report[report_idx].second_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
device_mode_to_string(second_persona));
else
snprintf(report[report_idx].second_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
"%s-chnl{%d}",
device_mode_to_string(second_persona), chnl_2nd_conn);
if (chnl_3rd_conn == 0)
snprintf(report[report_idx].third_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
device_mode_to_string(third_persona));
else
snprintf(report[report_idx].third_persona,
MAX_ALLOWED_CHAR_IN_REPORT,
"%s-chnl{%d}",
device_mode_to_string(third_persona), chnl_3rd_conn);
report[report_idx].status = status;
snprintf(report[report_idx].dbs_value,
MAX_ALLOWED_CHAR_IN_REPORT,
wma_is_hw_dbs_capable() ? "enable" : "disable");
snprintf(report[report_idx].system_conf,
MAX_ALLOWED_CHAR_IN_REPORT,
system_config_to_string(hdd_ctx->config->conc_system_pref));
snprintf(report[report_idx].result_code,
MAX_ALLOWED_CHAR_IN_REPORT,
status ? "PASS" : "FAIL");
snprintf(report[report_idx].reason,
MAX_ALLOWED_CHAR_IN_REPORT,
reason);
if (pcl) {
cdf_mem_zero(report[report_idx].pcl,
sizeof(report[report_idx].pcl));
for (i = 0; i < MAX_NUM_CHAN; i++) {
if (pcl[i] == 0)
break;
cdf_mem_zero(buf, sizeof(buf));
snprintf(buf, sizeof(buf), "%d ", pcl[i]);
strlcat(report[report_idx].pcl, buf,
sizeof(report[report_idx].pcl));
strlcat(report[report_idx].pcl, ", ",
sizeof(report[report_idx].pcl));
}
}
report_idx++;
}
static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
enum cds_pcl_type pcl_type, uint8_t *pcl, uint32_t pcl_len,
uint8_t first_connection_chnl, uint8_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
bool status = true;
uint32_t first_idx = 0;
if ((pcl_type != CDS_NONE) && (pcl_len == 0)) {
snprintf(reason, reason_length, "no of channels = 0");
return false;
}
switch (pcl_type) {
case CDS_NONE:
if (pcl_len != 0) {
snprintf(reason, reason_length, "no of channels>0");
return false;
}
break;
case CDS_5G:
for (first_idx = 0; first_idx < pcl_len; first_idx++) {
if (!CDS_IS_CHANNEL_5GHZ(pcl[first_idx])) {
snprintf(reason, reason_length,
"2G channel found");
return false;
}
}
break;
case CDS_24G:
for (first_idx = 0; first_idx < pcl_len; first_idx++) {
if (!CDS_IS_CHANNEL_24GHZ(pcl[first_idx])) {
snprintf(reason, reason_length,
"5G channel found");
return false;
}
}
break;
case CDS_SCC_CH:
if (second_connection_chnl > 0 &&
(first_connection_chnl != second_connection_chnl)) {
snprintf(reason, reason_length,
"invalid connections");
return false;
}
if (pcl[0] != first_connection_chnl) {
snprintf(reason, reason_length,
"No SCC found");
return false;
}
break;
case CDS_MCC_CH:
if ((pcl[0] != first_connection_chnl) &&
((second_connection_chnl > 0) &&
(pcl[0] != second_connection_chnl))) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if ((second_connection_chnl > 0) &&
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
break;
case CDS_SCC_CH_24G:
if (second_connection_chnl > 0 &&
(first_connection_chnl != second_connection_chnl)) {
snprintf(reason, reason_length,
"invalid connections");
return false;
}
if (pcl[0] != first_connection_chnl) {
snprintf(reason, reason_length,
"No SCC found");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 2.4Ghz chnl");
return false;
}
break;
case CDS_SCC_CH_5G:
if (second_connection_chnl > 0 &&
(first_connection_chnl != second_connection_chnl)) {
snprintf(reason, reason_length,
"invalid connections");
return false;
}
if (pcl[0] != first_connection_chnl) {
snprintf(reason, reason_length,
"No SCC found");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
}
break;
case CDS_24G_SCC_CH:
if (!CDS_IS_CHANNEL_24GHZ(pcl[0])) {
snprintf(reason, reason_length,
"No 2.4Ghz chnl");
return false;
}
if (second_connection_chnl > 0 &&
(first_connection_chnl != second_connection_chnl)) {
snprintf(reason, reason_length,
"invalid connections");
return false;
}
if (pcl[pcl_len-1] != first_connection_chnl) {
snprintf(reason, reason_length,
"No SCC found");
return false;
}
break;
case CDS_5G_SCC_CH:
if (!CDS_IS_CHANNEL_5GHZ(pcl[0])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
}
if (second_connection_chnl > 0 &&
(first_connection_chnl != second_connection_chnl)) {
snprintf(reason, reason_length,
"invalid connections");
return false;
}
if (pcl[pcl_len-1] != first_connection_chnl) {
snprintf(reason, reason_length,
"No SCC found");
return false;
}
break;
case CDS_MCC_CH_24G:
if ((pcl[0] != first_connection_chnl) &&
((second_connection_chnl > 0) &&
(pcl[0] != second_connection_chnl))) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if ((second_connection_chnl > 0) &&
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 24Ghz chnl");
return false;
}
break;
case CDS_MCC_CH_5G:
if ((pcl[0] != first_connection_chnl) &&
((second_connection_chnl > 0) &&
(pcl[0] != second_connection_chnl))) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if ((second_connection_chnl > 0) &&
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
}
break;
case CDS_24G_MCC_CH:
if (!CDS_IS_CHANNEL_24GHZ(pcl[0])) {
snprintf(reason, reason_length,
"No 24Ghz chnl");
return false;
}
if ((pcl[pcl_len-1] != first_connection_chnl) &&
((second_connection_chnl > 0) &&
(pcl[pcl_len-1] != second_connection_chnl))) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if ((second_connection_chnl > 0) &&
(pcl[pcl_len-2] != first_connection_chnl &&
pcl[pcl_len-2] != second_connection_chnl)) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
break;
case CDS_5G_MCC_CH:
if (!CDS_IS_CHANNEL_5GHZ(pcl[0])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
}
if ((pcl[pcl_len-1] != first_connection_chnl) &&
((second_connection_chnl > 0) &&
(pcl[pcl_len-1] != second_connection_chnl))) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
if ((second_connection_chnl > 0) &&
(pcl[pcl_len-2] != first_connection_chnl &&
pcl[pcl_len-2] != second_connection_chnl)) {
snprintf(reason, reason_length,
"MCC invalid");
return false;
}
break;
case CDS_SCC_ON_5_SCC_ON_24_24G:
if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 24Ghz chnls");
return false;
}
break;
case CDS_SCC_ON_5_SCC_ON_24_5G:
if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 5Ghz chnls");
return false;
}
break;
case CDS_SCC_ON_24_SCC_ON_5_24G:
if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 24Ghz chnls");
return false;
}
break;
case CDS_SCC_ON_24_SCC_ON_5_5G:
if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[pcl_len-1])) {
snprintf(reason, reason_length,
"No 5Ghz chnls");
return false;
}
break;
case CDS_SCC_ON_5_SCC_ON_24:
if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_24GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (pcl_len != 2) {
snprintf(reason, reason_length,
"more than 2 chnls");
return false;
}
break;
case CDS_SCC_ON_24_SCC_ON_5:
if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
(pcl[0] != first_connection_chnl &&
pcl[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 24Ghz chnl/scc");
return false;
}
if (!CDS_IS_CHANNEL_5GHZ(pcl[1]) ||
(pcl[1] != first_connection_chnl &&
pcl[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (pcl_len != 2) {
snprintf(reason, reason_length,
"more than 2 chnls");
return false;
}
break;
default:
snprintf(reason, reason_length,
"Unknown option");
status = false;
}
if (status == true) {
snprintf(reason, reason_length,
"success");
}
return status;
}
static void wlan_hdd_map_subtypes_hdd_wma(enum cds_con_mode *dst,
enum cds_con_mode *src)
{
/*
* wma defined sap subtype as 0
* Rest of the mappings are same
* In future, if mapping gets changed then re-map it here
*/
if (*src == CDS_SAP_MODE)
*dst = 0;
else
*dst = *src;
}
void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx)
{
enum cds_con_mode sub_type;
enum cds_conc_priority_mode system_pref =
hdd_ctx->config->conc_system_pref;
uint8_t pcl[MAX_NUM_CHAN] = {0};
uint32_t pcl_len = 0;
bool status = false;
enum cds_pcl_type pcl_type;
char reason[20] = {0};
CDF_STATUS ret;
/* flush the entire table first */
ret = cds_init_policy_mgr();
if (!CDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
return;
}
for (sub_type = 0; sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
/* validate one connection is created or no */
if (cds_get_connection_count() != 0) {
hddLog(LOGE,
FL("Test failed - No. of connection is not 0"));
return;
}
cdf_mem_zero(pcl, sizeof(pcl));
pcl_len = 0;
pcl_type = get_pcl_from_first_conn_table(sub_type, system_pref);
/* check PCL value for second connection is correct or no */
cds_get_pcl(sub_type, pcl, &pcl_len);
status = wlan_hdd_validate_pcl(hdd_ctx,
pcl_type, pcl, pcl_len, 0, 0,
reason, sizeof(reason));
if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0))
continue;
fill_report(hdd_ctx, "1 connection", sub_type,
CDS_MAX_NUM_OF_MODE,
CDS_MAX_NUM_OF_MODE,
0, 0, 0,
status, pcl_type, reason, pcl);
}
}
void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, enum cds_chain_mode first_chain_mask)
{
uint8_t vdevid = 0, tx_stream = 2, rx_stream = 2;
uint8_t type = WMI_VDEV_TYPE_STA, channel_id = first_chnl, mac_id = 1;
uint8_t pcl[MAX_NUM_CHAN] = {0};
uint32_t pcl_len = 0;
enum cds_chain_mode chain_mask = first_chain_mask;
enum cds_con_mode sub_type, next_sub_type, dummy_type;
enum cds_conc_priority_mode system_pref =
hdd_ctx->config->conc_system_pref;
enum cds_pcl_type pcl_type;
enum cds_one_connection_mode second_index;
char reason[20] = {0};
bool status = false;
CDF_STATUS ret;
for (sub_type = CDS_STA_MODE;
sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
type = wlan_hdd_valid_type_of_persona(sub_type);
/* flush the entire table first */
ret = cds_init_policy_mgr();
if (!CDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
return;
}
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type, &sub_type);
/* add first connection as STA */
cds_incr_connection_count_utfw(vdevid, tx_stream,
rx_stream, chain_mask, type, dummy_type,
channel_id, mac_id);
/* validate one connection is created or no */
if (cds_get_connection_count() != 1) {
hddLog(LOGE,
FL("Test failed - No. of connection is not 1"));
return;
}
next_sub_type = CDS_STA_MODE;
while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
/* get the PCL value & check the channels accordingly */
second_index =
cds_get_second_connection_pcl_table_index();
if (CDS_MAX_ONE_CONNECTION_MODE == second_index) {
/* not valid combination*/
hddLog(LOGE, FL("couldn't find index for 2nd connection pcl table"));
next_sub_type++;
continue;
}
cdf_mem_zero(pcl, sizeof(pcl));
pcl_len = 0;
pcl_type = get_pcl_from_second_conn_table(second_index,
next_sub_type, system_pref,
wma_is_hw_dbs_capable());
/* check PCL for second connection is correct or no */
cds_get_pcl(next_sub_type, pcl, &pcl_len);
status = wlan_hdd_validate_pcl(hdd_ctx,
pcl_type, pcl, pcl_len, channel_id, 0,
reason, sizeof(reason));
if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0)) {
next_sub_type++;
continue;
}
fill_report(hdd_ctx, "2 connections", sub_type,
next_sub_type,
CDS_MAX_NUM_OF_MODE, first_chnl,
0, 0, status, pcl_type, reason, pcl);
next_sub_type++;
}
}
}
void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
enum cds_chain_mode chain_mask, uint8_t use_same_mac)
{
uint8_t vdevid_1 = 0, tx_stream_1 = 2, rx_stream_1 = 2;
uint8_t vdevid_2 = 1, tx_stream_2 = 2, rx_stream_2 = 2;
uint8_t channel_id_1 = first_chnl, channel_id_2 = second_chnl;
uint8_t mac_id_1, mac_id_2;
uint8_t type_1 = WMI_VDEV_TYPE_STA, type_2 = WMI_VDEV_TYPE_STA;
uint8_t pcl[MAX_NUM_CHAN] = {0};
uint32_t pcl_len = 0;
enum cds_chain_mode chain_mask_1;
enum cds_chain_mode chain_mask_2;
enum cds_con_mode sub_type_1, sub_type_2, next_sub_type;
enum cds_con_mode dummy_type_1, dummy_type_2;
enum cds_conc_priority_mode system_pref =
hdd_ctx->config->conc_system_pref;
enum cds_pcl_type pcl_type;
enum cds_two_connection_mode third_index;
char reason[20] = {0};
bool status = false;
CDF_STATUS ret;
/* let's set the chain_mask, mac_ids*/
if (chain_mask == CDS_TWO_TWO) {
mac_id_1 = 1;
mac_id_2 = 1;
chain_mask_1 = CDS_TWO_TWO;
chain_mask_2 = CDS_TWO_TWO;
} else if (use_same_mac == 1) {
mac_id_1 = 1;
mac_id_2 = 1;
chain_mask_1 = CDS_ONE_ONE;
chain_mask_2 = CDS_ONE_ONE;
} else {
mac_id_1 = 1;
mac_id_2 = 2;
chain_mask_1 = CDS_ONE_ONE;
chain_mask_2 = CDS_ONE_ONE;
}
for (sub_type_1 = CDS_STA_MODE;
sub_type_1 < CDS_MAX_NUM_OF_MODE; sub_type_1++) {
type_1 = wlan_hdd_valid_type_of_persona(sub_type_1);
/* flush the entire table first */
ret = cds_init_policy_mgr();
if (!CDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
return;
}
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type_1, &sub_type_1);
/* add first connection as STA */
cds_incr_connection_count_utfw(vdevid_1,
tx_stream_1, rx_stream_1, chain_mask_1, type_1,
dummy_type_1, channel_id_1, mac_id_1);
/* validate one connection is created or no */
if (cds_get_connection_count() != 1) {
hddLog(LOGE,
FL("Test fail - No. of connection not 1"));
return;
}
for (sub_type_2 = CDS_STA_MODE;
sub_type_2 < CDS_MAX_NUM_OF_MODE; sub_type_2++) {
type_2 = wlan_hdd_valid_type_of_persona(sub_type_2);
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type_2,
&sub_type_2);
cds_incr_connection_count_utfw(vdevid_2,
tx_stream_2, rx_stream_2, chain_mask_2, type_2,
dummy_type_2, channel_id_2, mac_id_2);
/* validate two connections are created or no */
if (cds_get_connection_count() != 2) {
hddLog(LOGE,
FL("Test fail - No. connection not 2"));
return;
}
next_sub_type = CDS_STA_MODE;
while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
third_index =
cds_get_third_connection_pcl_table_index();
if (CDS_MAX_TWO_CONNECTION_MODE ==
third_index) {
/* not valid combination */
next_sub_type++;
continue;
}
cdf_mem_zero(pcl, sizeof(pcl));
pcl_len = 0;
pcl_type =
get_pcl_from_third_conn_table(
third_index, next_sub_type,
system_pref,
wma_is_hw_dbs_capable());
cds_get_pcl(next_sub_type,
pcl, &pcl_len);
status = wlan_hdd_validate_pcl(hdd_ctx,
pcl_type, pcl, pcl_len,
channel_id_1, channel_id_2,
reason, sizeof(reason));
if ((pcl_type == CDS_MAX_PCL_TYPE) &&
(pcl[0] == 0)) {
next_sub_type++;
continue;
}
fill_report(hdd_ctx, "3 connections",
sub_type_1, sub_type_2,
next_sub_type, first_chnl,
second_chnl, 0, status,
pcl_type, reason, pcl);
next_sub_type++;
}
/* remove entry to make a room for next iteration */
cds_decr_connection_count(vdevid_2);
}
next_sub_type = CDS_STA_MODE;
}
}

View File

@@ -1,654 +0,0 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC: wlan_hdd_debugfs.c
*
* This driver currently supports the following debugfs files:
* wlan_wcnss/wow_enable to enable/disable WoWL.
* wlan_wcnss/wow_pattern to configure WoWL patterns.
* wlan_wcnss/pattern_gen to configure periodic TX patterns.
*/
#ifdef WLAN_OPEN_SOURCE
#include <wlan_hdd_includes.h>
#include <wlan_hdd_wowl.h>
#include <cds_sched.h>
#define MAX_USER_COMMAND_SIZE_WOWL_ENABLE 8
#define MAX_USER_COMMAND_SIZE_WOWL_PATTERN 512
#define MAX_USER_COMMAND_SIZE_FRAME 4096
/**
* __wcnss_wowenable_write() - wow_enable debugfs handler
* @file: debugfs file handle
* @buf: text being written to the debugfs
* @count: size of @buf
* @ppos: (unused) offset into the virtual file system
*
* Return: number of bytes processed
*/
static ssize_t __wcnss_wowenable_write(struct file *file,
const char __user *buf, size_t count,
loff_t *ppos)
{
hdd_adapter_t *pAdapter;
hdd_context_t *hdd_ctx;
char cmd[MAX_USER_COMMAND_SIZE_WOWL_ENABLE + 1];
char *sptr, *token;
uint8_t wow_enable = 0;
uint8_t wow_mp = 0;
uint8_t wow_pbm = 0;
int ret;
ENTER();
pAdapter = (hdd_adapter_t *)file->private_data;
if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_FATAL,
"%s: Invalid adapter or adapter has invalid magic.",
__func__);
return -EINVAL;
}
hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;
if (!sme_is_feature_supported_by_fw(WOW)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Wake-on-Wireless feature is not supported in firmware!",
__func__);
return -EINVAL;
}
if (count > MAX_USER_COMMAND_SIZE_WOWL_ENABLE) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Command length is larger than %d bytes.",
__func__, MAX_USER_COMMAND_SIZE_WOWL_ENABLE);
return -EINVAL;
}
/* Get command from user */
if (copy_from_user(cmd, buf, count))
return -EFAULT;
cmd[count] = '\0';
sptr = cmd;
/* Get enable or disable wow */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
if (kstrtou8(token, 0, &wow_enable))
return -EINVAL;
/* Disable wow */
if (!wow_enable) {
if (!hdd_exit_wowl(pAdapter)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: hdd_exit_wowl failed!", __func__);
return -EFAULT;
}
return count;
}
/* Get enable or disable magic packet mode */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
if (kstrtou8(token, 0, &wow_mp))
return -EINVAL;
if (wow_mp > 1)
wow_mp = 1;
/* Get enable or disable pattern byte matching mode */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
if (kstrtou8(token, 0, &wow_pbm))
return -EINVAL;
if (wow_pbm > 1)
wow_pbm = 1;
if (!hdd_enter_wowl(pAdapter, wow_mp, wow_pbm)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: hdd_enter_wowl failed!", __func__);
return -EFAULT;
}
EXIT();
return count;
}
/**
* wcnss_wowenable_write() - SSR wrapper for wcnss_wowenable_write
* @file: file pointer
* @buf: buffer
* @count: count
* @ppos: position pointer
*
* Return: 0 on success, error number otherwise
*/
static ssize_t wcnss_wowenable_write(struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
cds_ssr_protect(__func__);
ret = __wcnss_wowenable_write(file, buf, count, ppos);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* __wcnss_wowpattern_write() - wow_pattern debugfs handler
* @file: debugfs file handle
* @buf: text being written to the debugfs
* @count: size of @buf
* @ppos: (unused) offset into the virtual file system
*
* Return: number of bytes processed
*/
static ssize_t __wcnss_wowpattern_write(struct file *file,
const char __user *buf, size_t count,
loff_t *ppos)
{
hdd_adapter_t *pAdapter = (hdd_adapter_t *) file->private_data;
hdd_context_t *hdd_ctx;
char cmd[MAX_USER_COMMAND_SIZE_WOWL_PATTERN + 1];
char *sptr, *token;
uint8_t pattern_idx = 0;
uint8_t pattern_offset = 0;
char *pattern_buf;
char *pattern_mask;
int ret;
ENTER();
if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_FATAL,
"%s: Invalid adapter or adapter has invalid magic.",
__func__);
return -EINVAL;
}
hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;
if (!sme_is_feature_supported_by_fw(WOW)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Wake-on-Wireless feature is not supported in firmware!",
__func__);
return -EINVAL;
}
if (count > MAX_USER_COMMAND_SIZE_WOWL_PATTERN) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Command length is larger than %d bytes.",
__func__, MAX_USER_COMMAND_SIZE_WOWL_PATTERN);
return -EINVAL;
}
/* Get command from user */
if (copy_from_user(cmd, buf, count))
return -EFAULT;
cmd[count] = '\0';
sptr = cmd;
/* Get pattern idx */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
if (kstrtou8(token, 0, &pattern_idx))
return -EINVAL;
/* Get pattern offset */
token = strsep(&sptr, " ");
/* Delete pattern if no further argument */
if (!token) {
hdd_del_wowl_ptrn_debugfs(pAdapter, pattern_idx);
return count;
}
if (kstrtou8(token, 0, &pattern_offset))
return -EINVAL;
/* Get pattern */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
pattern_buf = token;
/* Get pattern mask */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
pattern_mask = token;
pattern_mask[strlen(pattern_mask) - 1] = '\0';
hdd_add_wowl_ptrn_debugfs(pAdapter, pattern_idx, pattern_offset,
pattern_buf, pattern_mask);
EXIT();
return count;
}
/**
* wcnss_wowpattern_write() - SSR wrapper for __wcnss_wowpattern_write
* @file: file pointer
* @buf: buffer
* @count: count
* @ppos: position pointer
*
* Return: 0 on success, error number otherwise
*/
static ssize_t wcnss_wowpattern_write(struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
cds_ssr_protect(__func__);
ret = __wcnss_wowpattern_write(file, buf, count, ppos);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* wcnss_patterngen_write() - pattern_gen debugfs handler
* @file: debugfs file handle
* @buf: text being written to the debugfs
* @count: size of @buf
* @ppos: (unused) offset into the virtual file system
*
* Return: number of bytes processed
*/
static ssize_t __wcnss_patterngen_write(struct file *file,
const char __user *buf, size_t count,
loff_t *ppos)
{
hdd_adapter_t *pAdapter;
hdd_context_t *pHddCtx;
tSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams;
tSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams;
char *cmd, *sptr, *token;
uint8_t pattern_idx = 0;
uint8_t pattern_duration = 0;
char *pattern_buf;
uint16_t pattern_len = 0;
uint16_t i = 0;
CDF_STATUS status;
int ret;
ENTER();
pAdapter = (hdd_adapter_t *)file->private_data;
if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_FATAL,
"%s: Invalid adapter or adapter has invalid magic.",
__func__);
return -EINVAL;
}
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
ret = wlan_hdd_validate_context(pHddCtx);
if (0 != ret)
return ret;
if (!sme_is_feature_supported_by_fw(WLAN_PERIODIC_TX_PTRN)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Periodic Tx Pattern Offload feature is not supported in firmware!",
__func__);
return -EINVAL;
}
/* Get command from user */
if (count <= MAX_USER_COMMAND_SIZE_FRAME)
cmd = cdf_mem_malloc(count + 1);
else {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Command length is larger than %d bytes.",
__func__, MAX_USER_COMMAND_SIZE_FRAME);
return -EINVAL;
}
if (!cmd) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
FL("Memory allocation for cmd failed!"));
return -ENOMEM;
}
if (copy_from_user(cmd, buf, count)) {
cdf_mem_free(cmd);
return -EFAULT;
}
cmd[count] = '\0';
sptr = cmd;
/* Get pattern idx */
token = strsep(&sptr, " ");
if (!token)
goto failure;
if (kstrtou8(token, 0, &pattern_idx))
goto failure;
if (pattern_idx > (MAXNUM_PERIODIC_TX_PTRNS - 1)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Pattern index %d is not in the range (0 ~ %d).",
__func__, pattern_idx, MAXNUM_PERIODIC_TX_PTRNS - 1);
goto failure;
}
/* Get pattern duration */
token = strsep(&sptr, " ");
if (!token)
goto failure;
if (kstrtou8(token, 0, &pattern_duration))
goto failure;
/* Delete pattern using index if duration is 0 */
if (!pattern_duration) {
delPeriodicTxPtrnParams =
cdf_mem_malloc(sizeof(tSirDelPeriodicTxPtrn));
if (!delPeriodicTxPtrnParams) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
FL("Memory allocation failed!"));
cdf_mem_free(cmd);
return -ENOMEM;
}
delPeriodicTxPtrnParams->ucPtrnId = pattern_idx;
delPeriodicTxPtrnParams->ucPatternIdBitmap = 1 << pattern_idx;
cdf_copy_macaddr(&delPeriodicTxPtrnParams->mac_address,
&pAdapter->macAddressCurrent);
/* Delete pattern */
status = sme_del_periodic_tx_ptrn(pHddCtx->hHal,
delPeriodicTxPtrnParams);
if (CDF_STATUS_SUCCESS != status) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: sme_del_periodic_tx_ptrn() failed!",
__func__);
cdf_mem_free(delPeriodicTxPtrnParams);
goto failure;
}
cdf_mem_free(cmd);
cdf_mem_free(delPeriodicTxPtrnParams);
return count;
}
/*
* In SAP mode allow configuration without any connection check
* In STA mode check if it's in connected state before adding
* patterns
*/
hdd_info("device mode %d", pAdapter->device_mode);
if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
(!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)))) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Not in Connected state!", __func__);
goto failure;
}
/* Get pattern */
token = strsep(&sptr, " ");
if (!token)
goto failure;
pattern_buf = token;
pattern_buf[strlen(pattern_buf) - 1] = '\0';
pattern_len = strlen(pattern_buf);
/* Since the pattern is a hex string, 2 characters represent 1 byte. */
if (pattern_len % 2) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Malformed pattern!", __func__);
goto failure;
} else
pattern_len >>= 1;
if (pattern_len < 14 || pattern_len > PERIODIC_TX_PTRN_MAX_SIZE) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Not an 802.3 frame!", __func__);
goto failure;
}
addPeriodicTxPtrnParams = cdf_mem_malloc(sizeof(tSirAddPeriodicTxPtrn));
if (!addPeriodicTxPtrnParams) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
FL("Memory allocation failed!"));
cdf_mem_free(cmd);
return -ENOMEM;
}
addPeriodicTxPtrnParams->ucPtrnId = pattern_idx;
addPeriodicTxPtrnParams->usPtrnIntervalMs = pattern_duration * 500;
addPeriodicTxPtrnParams->ucPtrnSize = pattern_len;
cdf_copy_macaddr(&addPeriodicTxPtrnParams->mac_address,
&pAdapter->macAddressCurrent);
/* Extract the pattern */
for (i = 0; i < addPeriodicTxPtrnParams->ucPtrnSize; i++) {
addPeriodicTxPtrnParams->ucPattern[i] =
(hex_to_bin(pattern_buf[0]) << 4) +
hex_to_bin(pattern_buf[1]);
/* Skip to next byte */
pattern_buf += 2;
}
/* Add pattern */
status = sme_add_periodic_tx_ptrn(pHddCtx->hHal,
addPeriodicTxPtrnParams);
if (CDF_STATUS_SUCCESS != status) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: sme_add_periodic_tx_ptrn() failed!", __func__);
cdf_mem_free(addPeriodicTxPtrnParams);
goto failure;
}
cdf_mem_free(cmd);
cdf_mem_free(addPeriodicTxPtrnParams);
EXIT();
return count;
failure:
cdf_mem_free(cmd);
return -EINVAL;
}
/**
* wcnss_patterngen_write() - SSR wrapper for __wcnss_patterngen_write
* @file: file pointer
* @buf: buffer
* @count: count
* @ppos: position pointer
*
* Return: 0 on success, error number otherwise
*/
static ssize_t wcnss_patterngen_write(struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
cds_ssr_protect(__func__);
ret = __wcnss_patterngen_write(file, buf, count, ppos);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* __wcnss_debugfs_open() - Generic debugfs open() handler
* @inode: inode of the debugfs file
* @file: file handle of the debugfs file
*
* Return: 0
*/
static int __wcnss_debugfs_open(struct inode *inode, struct file *file)
{
hdd_adapter_t *adapter;
hdd_context_t *hdd_ctx;
int ret;
ENTER();
if (inode->i_private)
file->private_data = inode->i_private;
adapter = (hdd_adapter_t *)file->private_data;
if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_FATAL,
"%s: Invalid adapter or adapter has invalid magic.",
__func__);
return -EINVAL;
}
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;
EXIT();
return 0;
}
/**
* wcnss_debugfs_open() - SSR wrapper for __wcnss_debugfs_open
* @inode: inode pointer
* @file: file pointer
*
* Return: 0 on success, error number otherwise
*/
static int wcnss_debugfs_open(struct inode *inode, struct file *file)
{
int ret;
cds_ssr_protect(__func__);
ret = __wcnss_debugfs_open(inode, file);
cds_ssr_unprotect(__func__);
return ret;
}
static const struct file_operations fops_wowenable = {
.write = wcnss_wowenable_write,
.open = wcnss_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static const struct file_operations fops_wowpattern = {
.write = wcnss_wowpattern_write,
.open = wcnss_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static const struct file_operations fops_patterngen = {
.write = wcnss_patterngen_write,
.open = wcnss_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
/**
* hdd_debugfs_init() - Initialize debugfs interface
* @pAdapter: primary wlan adapter
*
* Register support for the debugfs files supported by the driver.
*
* NB: The current implementation only supports debugfs operations
* on the primary interface, i.e. wlan0
*
* Return: CDF_STATUS_SUCCESS if all files registered,
* CDF_STATUS_E_FAILURE on failure
*/
CDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter)
{
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
pHddCtx->debugfs_phy = debugfs_create_dir("wlan_wcnss", 0);
if (NULL == pHddCtx->debugfs_phy)
return CDF_STATUS_E_FAILURE;
if (NULL == debugfs_create_file("wow_enable", S_IRUSR | S_IWUSR,
pHddCtx->debugfs_phy, pAdapter,
&fops_wowenable))
return CDF_STATUS_E_FAILURE;
if (NULL == debugfs_create_file("wow_pattern", S_IRUSR | S_IWUSR,
pHddCtx->debugfs_phy, pAdapter,
&fops_wowpattern))
return CDF_STATUS_E_FAILURE;
if (NULL == debugfs_create_file("pattern_gen", S_IRUSR | S_IWUSR,
pHddCtx->debugfs_phy, pAdapter,
&fops_patterngen))
return CDF_STATUS_E_FAILURE;
return CDF_STATUS_SUCCESS;
}
/**
* hdd_debugfs_exit() - Shutdown debugfs interface
* @pHddCtx: the global HDD context
*
* Unregister support for the debugfs files supported by the driver.
*
* Return: None
*/
void hdd_debugfs_exit(hdd_context_t *pHddCtx)
{
debugfs_remove_recursive(pHddCtx->debugfs_phy);
}
#endif /* #ifdef WLAN_OPEN_SOURCE */

View File

@@ -1,924 +0,0 @@
/*
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* denote that this file does not allow legacy hddLog */
#define HDD_DISALLOW_LEGACY_HDDLOG 1
#include <linux/platform_device.h>
#include <linux/pci.h>
#ifdef HIF_PCI
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif /* CONFIG_CNSS */
#else
#include <soc/qcom/icnss.h>
#endif /* HIF_PCI */
#include "cds_api.h"
#include "cdf_status.h"
#include "cdf_lock.h"
#include "cds_sched.h"
#include "osdep.h"
#include "hif.h"
#include "htc.h"
#include "epping_main.h"
#include "wlan_hdd_main.h"
#include "wlan_hdd_power.h"
#include "wlan_logging_sock_svc.h"
#include "wma_api.h"
#include "wlan_hdd_napi.h"
#include "cds_concurrency.h"
#include "qwlan_version.h"
#ifdef MODULE
#define WLAN_MODULE_NAME module_name(THIS_MODULE)
#else
#define WLAN_MODULE_NAME "wlan"
#endif
#ifdef HIF_PCI
#ifdef CONFIG_CNSS
#define WLAN_HDD_REGISTER_DRIVER(wlan_drv_ops) \
cnss_wlan_register_driver(wlan_drv_ops)
#define WLAN_HDD_UNREGISTER_DRIVER(wlan_drv_ops) \
cnss_wlan_unregister_driver(wlan_drv_ops)
#else
#define WLAN_HDD_REGISTER_DRIVER(wlan_drv_ops) \
pci_register_driver(wlan_drv_ops)
#define WLAN_HDD_UNREGISTER_DRIVER(wlan_drv_ops) \
pci_unregister_driver(wlan_drv_ops)
#endif /* CONFIG_CNSS */
#else
#define WLAN_HDD_REGISTER_DRIVER(wlan_drv_ops) \
icnss_register_driver(wlan_drv_ops)
#define WLAN_HDD_UNREGISTER_DRIVER(wlan_drv_ops) \
icnss_unregister_driver(wlan_drv_ops)
#endif /* HIF_PCI */
#define DISABLE_KRAIT_IDLE_PS_VAL 1
/*
* In BMI Phase we are only sending small chunk (256 bytes) of the FW image at
* a time, and wait for the completion interrupt to start the next transfer.
* During this phase, the KRAIT is entering IDLE/StandAlone(SA) Power Save(PS).
* The delay incurred for resuming from IDLE/SA PS is huge during driver load.
* So prevent APPS IDLE/SA PS durint driver load for reducing interrupt latency.
*/
#ifdef CONFIG_CNSS
static inline void hdd_request_pm_qos(int val)
{
cnss_request_pm_qos(val);
}
static inline void hdd_remove_pm_qos(void)
{
cnss_remove_pm_qos();
}
#else
static inline void hdd_request_pm_qos(int val)
{
}
static inline void hdd_remove_pm_qos(void)
{
}
#endif
/**
* hdd_hif_open() - HIF open helper
* @dev: wlan device structure
* @bdev: bus device structure
* @bid: bus identifier for shared busses
* @bus_type: underlying bus type
* @reinit: true if we are reinitializing the driver during recovery phase
*
* This function brings-up HIF layer during load/recovery phase.
*
* Return: 0 on success and errno on failure.
*/
static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
enum ath_hal_bus_type bus_type, bool reinit)
{
CDF_STATUS status;
int ret = 0;
void *hif_ctx;
status = hif_open(bus_type);
if (!CDF_IS_STATUS_SUCCESS(status)) {
hdd_err("hif_open error = %d", status);
return cdf_status_to_os_return(status);
}
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
ret = hdd_napi_create();
if (hdd_napi_enabled(HDD_NAPI_ANY)) {
hdd_info("hdd_napi_create returned: %d", status);
if (ret <= 0) {
hdd_err("NAPI creation error, rc: 0x%x, reinit = %d",
status, reinit);
ret = -EFAULT;
goto err_hif_close;
}
}
status = hif_enable(hif_ctx, dev, bdev, bid, bus_type,
(reinit == true) ? HIF_ENABLE_TYPE_REINIT :
HIF_ENABLE_TYPE_PROBE);
if (!CDF_IS_STATUS_SUCCESS(status)) {
hdd_err("hif_enable error = %d, reinit = %d",
status, reinit);
ret = cdf_status_to_os_return(status);
goto err_napi_destroy;
}
return 0;
err_napi_destroy:
hdd_napi_destroy(true);
err_hif_close:
hif_close(hif_ctx);
return ret;
}
/**
* hdd_hif_close() - HIF close helper
* @hif_ctx: HIF context
*
* Helper function to close HIF
*/
static void hdd_hif_close(void *hif_ctx)
{
if (hif_ctx == NULL)
return;
hif_disable(hif_ctx, HIF_DISABLE_TYPE_REMOVE);
hdd_napi_destroy(true);
hif_close(hif_ctx);
}
/**
* wlan_hdd_probe() - handles probe request
*
* This function is called to probe the wlan driver
*
* @dev: wlan device structure
* @bdev: bus device structure
* @bid: bus identifier for shared busses
* @bus_type: underlying bus type
* @reinit: true if we are reinitiallizing the driver after a subsystem restart
*
* Return: 0 on successfull probe
*/
static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
enum ath_hal_bus_type bus_type, bool reinit)
{
void *hif_ctx;
CDF_STATUS status;
int ret = 0;
pr_info("%s: %sprobing driver v%s\n", WLAN_MODULE_NAME,
reinit ? "re-" : "", QWLAN_VERSIONSTR);
hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
/*
* The Krait is going to Idle/Stand Alone Power Save
* more aggressively which is resulting in the longer driver load time.
* The Fix is to not allow Krait to enter Idle Power Save during driver
* load.
*/
hdd_request_pm_qos(DISABLE_KRAIT_IDLE_PS_VAL);
if (reinit) {
cds_set_recovery_in_progress(true);
} else {
ret = hdd_init();
if (ret)
goto out;
cds_set_load_in_progress(true);
}
if (WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
status = epping_open();
if (status != CDF_STATUS_SUCCESS)
goto err_hdd_deinit;
}
ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit);
if (ret)
goto err_epping_close;
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
if (reinit)
ret = hdd_wlan_re_init(hif_ctx);
else
ret = hdd_wlan_startup(dev, hif_ctx);
if (ret)
goto err_hif_close;
hif_enable_power_management(hif_ctx);
if (reinit) {
cds_set_recovery_in_progress(false);
} else {
cds_set_load_in_progress(false);
cds_set_driver_loaded(true);
}
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
hdd_remove_pm_qos();
return 0;
err_hif_close:
hdd_hif_close(hif_ctx);
err_epping_close:
if (WLAN_IS_EPPING_ENABLED(cds_get_conparam()))
epping_close();
err_hdd_deinit:
cds_set_load_in_progress(false);
hdd_deinit();
out:
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
hdd_remove_pm_qos();
return ret;
}
#ifdef CONFIG_CNSS
static inline void hdd_cnss_driver_unloading(void)
{
cnss_set_driver_status(CNSS_LOAD_UNLOAD);
}
#else
static inline void hdd_cnss_driver_unloading(void) { }
#endif
/**
* wlan_hdd_remove() - wlan_hdd_remove
*
* This function is called by the platform driver to remove the
* driver
*
* Return: void
*/
static void wlan_hdd_remove(void)
{
void *hif_ctx;
pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME,
QWLAN_VERSIONSTR);
/* Wait for recovery to complete */
while (cds_is_driver_recovering()) {
hdd_alert("Recovery in progress; wait here!!!");
msleep(1000);
}
cds_set_driver_loaded(false);
cds_set_unload_in_progress(true);
if (!cds_wait_for_external_threads_completion(__func__))
hdd_err("External threads are still active attempting driver unload anyway");
hdd_cnss_driver_unloading();
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
hif_disable_power_management(hif_ctx);
hif_pktlogmod_exit(hif_ctx);
if (WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
epping_disable();
epping_close();
} else {
__hdd_wlan_exit();
}
hdd_hif_close(hif_ctx);
hdd_deinit();
pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME);
}
/**
* wlan_hdd_shutdown() - wlan_hdd_shutdown
*
* This is routine is called by platform driver to shutdown the
* driver
*
* Return: void
*/
static void wlan_hdd_shutdown(void)
{
void *hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
if (cds_is_load_or_unload_in_progress()) {
hdd_err("Load/unload in progress, ignore SSR shutdown");
return;
}
/* this is for cases, where shutdown invoked from CNSS */
cds_set_recovery_in_progress(true);
if (cds_get_conparam() != CDF_GLOBAL_FTM_MODE &&
!WLAN_IS_EPPING_ENABLED(cds_get_conparam()))
hif_pktlogmod_exit(hif_ctx);
if (!cds_wait_for_external_threads_completion(__func__))
hdd_err("Host is not ready for SSR, attempting anyway");
if (!WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
hif_disable_isr(hif_ctx);
hdd_wlan_shutdown();
}
hdd_hif_close(hif_ctx);
}
/**
* wlan_hdd_crash_shutdown() - wlan_hdd_crash_shutdown
*
* HDD crash shutdown funtion: This function is called by
* platfrom driver's crash shutdown routine
*
* Return: void
*/
void wlan_hdd_crash_shutdown(void)
{
hif_crash_shutdown(cds_get_context(CDF_MODULE_ID_HIF));
}
/**
* wlan_hdd_notify_handler() - wlan_hdd_notify_handler
*
* This function is called by the platform driver to notify the
* COEX
*
* @state: state
*
* Return: void
*/
void wlan_hdd_notify_handler(int state)
{
if (!WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
int ret = 0;
ret = hdd_wlan_notify_modem_power_state(state);
if (ret < 0)
hdd_err("Fail to send notify");
}
}
/**
* __wlan_hdd_bus_suspend() - handles platform supsend
* @state: suspend message from the kernel
*
* Does precondtion validation. Ensures that a subsystem restart isn't in
* progress. Ensures that no load or unload is in progress.
* Calls ol_txrx_bus_suspend to ensure the layer is ready for a bus suspend.
* Calls wma_suspend to configure offloads.
* Calls hif_suspend to suspend the bus.
*
* Return: 0 for success, -EFAULT for null pointers,
* -EBUSY or -EAGAIN if another opperation is in progress and
* wlan will not be ready to suspend in time.
*/
static int __wlan_hdd_bus_suspend(pm_message_t state)
{
void *hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
int err = wlan_hdd_validate_context(hdd_ctx);
int status;
hdd_info("event %d", state.event);
if (err)
goto done;
err = cdf_status_to_os_return(
ol_txrx_bus_suspend());
if (err)
goto done;
err = wma_bus_suspend();
if (err)
goto resume_oltxrx;
err = hif_bus_suspend();
if (err)
goto resume_wma;
hdd_info("suspend done, status = %d", err);
return err;
resume_wma:
status = wma_bus_resume();
CDF_BUG(!status);
resume_oltxrx:
status = ol_txrx_bus_resume();
CDF_BUG(!status);
done:
hdd_err("suspend done, status = %d", err);
return err;
}
/**
* wlan_hdd_bus_suspend() - suspend the wlan bus
*
* This function is called by the platform driver to suspend the
* wlan bus
*
* @state: state
*
* Return: CDF_STATUS
*/
int wlan_hdd_bus_suspend(pm_message_t state)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_bus_suspend(state);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* __wlan_hdd_bus_resume() - handles platform resume
*
* Does precondtion validation. Ensures that a subsystem restart isn't in
* progress. Ensures that no load or unload is in progress. Ensures that
* it has valid pointers for the required contexts.
* Calls into hif to resume the bus opperation.
* Calls into wma to handshake with firmware and notify it that the bus is up.
* Calls into ol_txrx for symetry.
* Failures are treated as catastrophic.
*
* return: error code or 0 for success
*/
static int __wlan_hdd_bus_resume(void)
{
void *hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
int status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hdd_err("HDD context is not valid");
return status;
}
status = hif_bus_resume();
CDF_BUG(!status);
status = wma_bus_resume();
CDF_BUG(!status);
status = ol_txrx_bus_resume();
CDF_BUG(!status);
hdd_info("resume done");
return status;
}
/**
* wlan_hdd_bus_resume(): wake up the bus
*
* This function is called by the platform driver to resume wlan
* bus
*
* Return: void
*/
static int wlan_hdd_bus_resume(void)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_bus_resume();
cds_ssr_unprotect(__func__);
return ret;
}
#ifdef FEATURE_RUNTIME_PM
/**
* __wlan_hdd_runtime_suspend() - suspend the wlan bus without apps suspend
*
* Each layer is responsible for its own suspend actions. wma_runtime_suspend
* takes care of the parts of the 802.11 suspend that we want to do for runtime
* suspend.
*
* Return: 0 or errno
*/
static int __wlan_hdd_runtime_suspend(void)
{
void *hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
int status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status)
goto process_failure;
status = hif_pre_runtime_suspend();
if (status)
goto process_failure;
status = htc_runtime_suspend();
if (status)
goto process_failure;
status = wma_runtime_suspend();
if (status)
goto resume_htc;
status = hif_runtime_suspend();
if (status)
goto resume_wma;
status = cnss_auto_suspend();
if (status)
goto resume_hif;
hif_process_runtime_suspend_success();
return status;
resume_hif:
CDF_BUG(!hif_runtime_resume());
resume_wma:
CDF_BUG(!wma_runtime_resume());
resume_htc:
CDF_BUG(!htc_runtime_resume());
process_failure:
hif_process_runtime_suspend_failure();
return status;
}
/**
* wlan_hdd_runtime_suspend() - suspend the wlan bus without apps suspend
*
* This function is called by the platform driver to suspend the
* wlan bus separately from system suspend
*
* Return: 0 or errno
*/
static int wlan_hdd_runtime_suspend(void)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_runtime_suspend();
cds_ssr_unprotect(__func__);
return ret;
}
/**
* __wlan_hdd_runtime_resume() - resume the wlan bus from runtime suspend
*
* Sets the runtime pm state and coordinates resume between hif wma and
* ol_txrx.
*
* Return: success since failure is a bug
*/
static int __wlan_hdd_runtime_resume(void)
{
hif_pre_runtime_resume();
CDF_BUG(!cnss_auto_resume());
CDF_BUG(!hif_runtime_resume());
CDF_BUG(!wma_runtime_resume());
CDF_BUG(!htc_runtime_resume());
hif_process_runtime_resume_success();
return 0;
}
/**
* wlan_hdd_runtime_resume() - resume the wlan bus from runtime suspend
*
* This function is called by the platform driver to resume the
* wlan bus separately from system suspend
*
* Return: success since failure is a bug
*/
static int wlan_hdd_runtime_resume(void)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_runtime_resume();
cds_ssr_unprotect(__func__);
return ret;
}
#endif
#ifdef HIF_PCI
/**
* wlan_hdd_pci_probe() - probe callback for pci platform driver
* @pdev: bus dev
*
* Return: void
*/
static int wlan_hdd_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
return wlan_hdd_probe(&pdev->dev, pdev, (void *)id,
HAL_BUS_TYPE_PCI, false);
}
/**
* wlan_hdd_pci_remove() - wlan_hdd_pci_remove
*
* Return: void
*/
void wlan_hdd_pci_remove(struct pci_dev *pdev)
{
wlan_hdd_remove();
}
/**
* wlan_hdd_pci_reinit() - wlan_hdd_pci_reinit
* @pdev: bus dev
* @id: bus id
*
* Return: int
*/
int wlan_hdd_pci_reinit(struct pci_dev *pdev,
const struct pci_device_id *id)
{
return wlan_hdd_probe(&pdev->dev, pdev, id,
HAL_BUS_TYPE_PCI, true);
}
/**
* wlan_hdd_pci_shutdown() - wlan_hdd_pci_shutdown
* @pdev: pdev
*
* Return: void
*/
void wlan_hdd_pci_shutdown(struct pci_dev *pdev)
{
wlan_hdd_shutdown();
}
/**
* wlan_hdd_pci_crash_shutdown() - wlan_hdd_pci_crash_shutdown
* @pdev: pdev
*
* Return: void
*/
void wlan_hdd_pci_crash_shutdown(struct pci_dev *pdev)
{
wlan_hdd_crash_shutdown();
}
/**
* wlan_hdd_pci_notify_handler() - wlan_hdd_pci_notify_handler
* @pdev: pdev
* @state: state
*
* Return: void
*/
void wlan_hdd_pci_notify_handler(struct pci_dev *pdev, int state)
{
wlan_hdd_notify_handler(state);
}
/**
* wlan_hdd_pci_suspend() - wlan_hdd_pci_suspend
* @pdev: pdev
* @state: state
*
* Return: void
*/
static int wlan_hdd_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
return wlan_hdd_bus_suspend(state);
}
/**
* wlan_hdd_pci_resume() - wlan_hdd_pci_resume
* @pdev: pdev
*
* Return: void
*/
static int wlan_hdd_pci_resume(struct pci_dev *pdev)
{
return wlan_hdd_bus_resume();
}
#ifdef FEATURE_RUNTIME_PM
/**
* wlan_hdd_pci_runtime_suspend() - wlan_hdd_pci_suspend
* @pdev: pdev
* @state: state
*
* Return: success or errno
*/
static int wlan_hdd_pci_runtime_suspend(struct pci_dev *pdev)
{
return wlan_hdd_runtime_suspend();
}
/**
* wlan_hdd_pci_runtime_resume() - runtime resume callback to register with pci
* @pdev: pci device id
*
* Return: success or errno
*/
static int wlan_hdd_pci_runtime_resume(struct pci_dev *pdev)
{
return wlan_hdd_runtime_resume();
}
#endif
#else
/**
* wlan_hdd_snoc_probe() - wlan_hdd_snoc_probe
* @dev: dev
*
* Return: int
*/
static int wlan_hdd_snoc_probe(struct device *dev)
{
return wlan_hdd_probe(dev, NULL, NULL, HAL_BUS_TYPE_SNOC, false);
}
/**
* wlan_hdd_snoc_remove() - wlan_hdd_snoc_remove
* @dev: dev
*
* Return: void
*/
void wlan_hdd_snoc_remove(struct device *dev)
{
wlan_hdd_remove();
}
/**
* wlan_hdd_snoc_shutdown() - wlan_hdd_snoc_shutdown
* @dev: dev
*
* Return: void
*/
void wlan_hdd_snoc_shutdown(struct device *dev)
{
wlan_hdd_shutdown();
}
/**
* wlan_hdd_snoc_reinit() - wlan_hdd_snoc_reinit
* @dev: dev
*
* Return: int
*/
int wlan_hdd_snoc_reinit(struct device *dev)
{
return wlan_hdd_probe(dev, NULL, NULL, HAL_BUS_TYPE_SNOC, true);
}
/**
* wlan_hdd_snoc_crash_shutdown() - wlan_hdd_snoc_crash_shutdown
* @dev: dev
*
* Return: void
*/
void wlan_hdd_snoc_crash_shutdown(void *pdev)
{
wlan_hdd_crash_shutdown();
}
/**
* wlan_hdd_snoc_suspend() - wlan_hdd_snoc_suspend
* @dev: dev
* @state: state
*
* Return: int
*/
static int wlan_hdd_snoc_suspend(struct device *dev, pm_message_t state)
{
return wlan_hdd_bus_suspend(state);
}
/**
* wlan_hdd_snoc_resume() - wlan_hdd_snoc_resume
* @dev: dev
*
* Return: int
*/
static int wlan_hdd_snoc_resume(struct device *dev)
{
return wlan_hdd_bus_resume();
}
#endif /* HIF_PCI */
#ifdef HIF_PCI
static struct pci_device_id wlan_hdd_pci_id_table[] = {
{ 0x168c, 0x003c, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x003e, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0041, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0xabcd, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x7021, PCI_ANY_ID, PCI_ANY_ID },
{ 0 }
};
#ifdef CONFIG_CNSS
#ifdef FEATURE_RUNTIME_PM
struct cnss_wlan_runtime_ops runtime_pm_ops = {
.runtime_suspend = wlan_hdd_pci_runtime_suspend,
.runtime_resume = wlan_hdd_pci_runtime_resume,
};
#endif
struct cnss_wlan_driver wlan_drv_ops = {
.name = "wlan_hdd_pci",
.id_table = wlan_hdd_pci_id_table,
.probe = wlan_hdd_pci_probe,
.remove = wlan_hdd_pci_remove,
.reinit = wlan_hdd_pci_reinit,
.shutdown = wlan_hdd_pci_shutdown,
.crash_shutdown = wlan_hdd_pci_crash_shutdown,
.modem_status = wlan_hdd_pci_notify_handler,
#ifdef ATH_BUS_PM
.suspend = wlan_hdd_pci_suspend,
.resume = wlan_hdd_pci_resume,
#endif /* ATH_BUS_PM */
#ifdef FEATURE_RUNTIME_PM
.runtime_ops = &runtime_pm_ops,
#endif
};
#else
MODULE_DEVICE_TABLE(pci, wlan_hdd_pci_id_table);
struct pci_driver wlan_drv_ops = {
.name = "wlan_hdd_pci",
.id_table = wlan_hdd_pci_id_table,
.probe = wlan_hdd_pci_probe,
.remove = wlan_hdd_pci_remove,
#ifdef ATH_BUS_PM
.suspend = wlan_hdd_pci_suspend,
.resume = wlan_hdd_pci_resume,
#endif /* ATH_BUS_PM */
};
#endif /* CONFIG_CNSS */
#else
struct icnss_driver_ops wlan_drv_ops = {
.name = "wlan_hdd_drv",
.probe = wlan_hdd_snoc_probe,
.remove = wlan_hdd_snoc_remove,
.shutdown = wlan_hdd_snoc_shutdown,
.reinit = wlan_hdd_snoc_reinit,
.crash_shutdown = wlan_hdd_snoc_crash_shutdown,
.suspend = wlan_hdd_snoc_suspend,
.resume = wlan_hdd_snoc_resume,
};
#endif
/**
* wlan_hdd_register_driver() - wlan_hdd_register_driver
*
* Return: int
*/
int wlan_hdd_register_driver(void)
{
return WLAN_HDD_REGISTER_DRIVER(&wlan_drv_ops);
}
/**
* wlan_hdd_unregister_driver() - wlan_hdd_unregister_driver
*
* Return: void
*/
void wlan_hdd_unregister_driver(void)
{
WLAN_HDD_UNREGISTER_DRIVER(&wlan_drv_ops);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,127 +0,0 @@
/*
* Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(WLAN_HDD_EXT_SCAN_H)
#define WLAN_HDD_EXT_SCAN_H
/**
* DOC: wlan_hdd_ext_scan.h
*
* WLAN Host Device Driver EXT SCAN feature implementation
*
*/
#ifdef FEATURE_WLAN_EXTSCAN
#include "wlan_hdd_main.h"
/*
* Used to allocate the size of 4096 for the EXTScan NL data.
* The size of 4096 is considered assuming that all data per
* respective event fit with in the limit.Please take a call
* on the limit based on the data requirements.
*/
#define EXTSCAN_EVENT_BUF_SIZE 4096
int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);
int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);
int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);
int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_reset_significant_change(struct wiphy
*wiphy,
struct
wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_set_passpoint_list(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_reset_passpoint_list(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int
wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int
wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
void wlan_hdd_cfg80211_extscan_init(hdd_context_t *hdd_ctx);
#else /* FEATURE_WLAN_EXTSCAN */
static void wlan_hdd_cfg80211_extscan_init(hdd_context_t *hdd_ctx)
{
}
#endif /* End of FEATURE_WLAN_EXTSCAN */
#endif /* end #if !defined(WLAN_HDD_EXT_SCAN_H) */

File diff suppressed because it is too large Load Diff

View File

@@ -1,492 +0,0 @@
/*
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_hdd_green_ap.c
*
* WLAN Host Device Driver Green AP implementation
*
*/
/* denote that this file does not allow legacy hddLog */
#define HDD_DISALLOW_LEGACY_HDDLOG 1
/* Include Files */
#include <wlan_hdd_main.h>
#include <wlan_hdd_misc.h>
#include "wlan_hdd_green_ap.h"
#include "wma_api.h"
#include "cds_concurrency.h"
#define GREEN_AP_PS_ON_TIME (0)
#define GREEN_AP_PS_DELAY_TIME (20)
/**
* enum hdd_green_ap_ps_state - Green-AP power save states
* @GREEN_AP_PS_IDLE_STATE: the Green_AP is not enabled
* @GREEN_AP_PS_OFF_STATE: in Power Saving OFF state
* @GREEN_AP_PS_WAIT_STATE: in transition to Power Saving ON state
* @GREEN_AP_PS_ON_STATE: in Power Saving ON state
*/
enum hdd_green_ap_ps_state {
GREEN_AP_PS_IDLE_STATE = 1,
GREEN_AP_PS_OFF_STATE,
GREEN_AP_PS_WAIT_STATE,
GREEN_AP_PS_ON_STATE,
};
/**
* enum hdd_green_ap_event - Green-AP power save events
* @GREEN_AP_PS_START_EVENT: event to indicate to enable Green_AP
* @GREEN_AP_PS_START_EVENT: event to indicate to disable Green_AP
* @GREEN_AP_ADD_STA_EVENT: event to indicate a new STA connected
* @GREEN_AP_DEL_STA_EVENT: event to indicate a STA disconnected
* @GREEN_AP_PS_ON_EVENT: event to indicate to enter Power Saving state
* @GREEN_AP_PS_WAIT_EVENT: event to indicate in the transition to Power Saving
*/
enum hdd_green_ap_event {
GREEN_AP_PS_START_EVENT = 1,
GREEN_AP_PS_STOP_EVENT,
GREEN_AP_ADD_STA_EVENT,
GREEN_AP_DEL_STA_EVENT,
GREEN_AP_PS_ON_EVENT,
GREEN_AP_PS_WAIT_EVENT,
};
/**
* struct hdd_green_ap_ctx - Green-AP context
* @ps_enable: Whether or not Green AP is enabled
* @ps_on_time: Amount of time to stay in Green AP power saving state
* @ps_delay_time: Amount of time to delay when changing states
* @num_nodes: Number of connected clients
* @ps_state: Current state
* @ps_event: Event to trigger when timer expires
* @ps_timer: Event timer
* @egap_support: Enhanced Green AP support flag
*/
struct hdd_green_ap_ctx {
uint8_t ps_enable;
uint32_t ps_on_time;
uint32_t ps_delay_time;
uint32_t num_nodes;
enum hdd_green_ap_ps_state ps_state;
enum hdd_green_ap_event ps_event;
cdf_mc_timer_t ps_timer;
bool egap_support;
};
/**
* hdd_wlan_green_ap_update() - update the current State and Event
* @hdd_ctx: Global HDD context
* @state: New state
* @event: New event
*
* Return: none
*/
static void hdd_wlan_green_ap_update(struct hdd_context_s *hdd_ctx,
enum hdd_green_ap_ps_state state,
enum hdd_green_ap_event event)
{
struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx;
green_ap->ps_state = state;
green_ap->ps_event = event;
}
/**
* hdd_wlan_green_ap_enable() - Send Green AP configuration to firmware
* @adapter: Adapter upon which Green AP is being configured
* @enable: Flag which indicates if Green AP is being enabled or disabled
*
* Return: 0 upon success, non-zero upon failure
*/
static int hdd_wlan_green_ap_enable(hdd_adapter_t *adapter,
uint8_t enable)
{
int ret;
hdd_notice("Set Green-AP val: %d", enable);
ret = wma_cli_set_command(adapter->sessionId,
WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID,
enable, DBG_CMD);
return ret;
}
/**
* hdd_wlan_green_ap_mc() - Green AP state machine
* @hdd_ctx: HDD global context
* @event: New event being processed
*
* Return: none
*/
static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
enum hdd_green_ap_event event)
{
struct hdd_green_ap_ctx *green_ap;
hdd_adapter_t *adapter;
green_ap = hdd_ctx->green_ap_ctx;
if (green_ap == NULL)
return;
hdd_notice("Green-AP event: %d, state: %d, num_nodes: %d",
event, green_ap->ps_state, green_ap->num_nodes);
/* handle the green ap ps event */
switch (event) {
case GREEN_AP_PS_START_EVENT:
green_ap->ps_enable = 1;
break;
case GREEN_AP_PS_STOP_EVENT:
if (!(cds_get_concurrency_mode() & CDF_SAP_MASK))
green_ap->ps_enable = 0;
break;
case GREEN_AP_ADD_STA_EVENT:
green_ap->num_nodes++;
break;
case GREEN_AP_DEL_STA_EVENT:
if (green_ap->num_nodes)
green_ap->num_nodes--;
break;
case GREEN_AP_PS_ON_EVENT:
case GREEN_AP_PS_WAIT_EVENT:
break;
default:
hdd_err("invalid event %d", event);
break;
}
/* Confirm that power save is enabled before doing state transitions */
if (!green_ap->ps_enable) {
hdd_notice("Green-AP is disabled");
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_IDLE_STATE,
GREEN_AP_PS_WAIT_EVENT);
goto done;
}
adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_SOFTAP);
if (adapter == NULL) {
hdd_err("Green-AP no SAP adapter");
goto done;
}
/* handle the green ap ps state */
switch (green_ap->ps_state) {
case GREEN_AP_PS_IDLE_STATE:
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_OFF_STATE,
GREEN_AP_PS_WAIT_EVENT);
break;
case GREEN_AP_PS_OFF_STATE:
if (!green_ap->num_nodes) {
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_WAIT_STATE,
GREEN_AP_PS_WAIT_EVENT);
cdf_mc_timer_start(&green_ap->ps_timer,
green_ap->ps_delay_time);
}
break;
case GREEN_AP_PS_WAIT_STATE:
if (!green_ap->num_nodes) {
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_ON_STATE,
GREEN_AP_PS_WAIT_EVENT);
hdd_wlan_green_ap_enable(adapter, 1);
if (green_ap->ps_on_time) {
hdd_wlan_green_ap_update(hdd_ctx,
0,
GREEN_AP_PS_WAIT_EVENT);
cdf_mc_timer_start(&green_ap->ps_timer,
green_ap->ps_on_time);
}
} else {
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_OFF_STATE,
GREEN_AP_PS_WAIT_EVENT);
}
break;
case GREEN_AP_PS_ON_STATE:
if (green_ap->num_nodes) {
if (hdd_wlan_green_ap_enable(adapter, 0)) {
hdd_err("FAILED TO SET GREEN-AP mode");
goto done;
}
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_OFF_STATE,
GREEN_AP_PS_WAIT_EVENT);
} else if ((green_ap->ps_event == GREEN_AP_PS_WAIT_EVENT)
&& (green_ap->ps_on_time)) {
/* ps_on_time timeout, switch to ps off */
hdd_wlan_green_ap_update(hdd_ctx,
GREEN_AP_PS_WAIT_STATE,
GREEN_AP_PS_ON_EVENT);
if (hdd_wlan_green_ap_enable(adapter, 0)) {
hdd_err("FAILED TO SET GREEN-AP mode");
goto done;
}
cdf_mc_timer_start(&green_ap->ps_timer,
green_ap->ps_delay_time);
}
break;
default:
hdd_err("invalid state %d", green_ap->ps_state);
hdd_wlan_green_ap_update(hdd_ctx, GREEN_AP_PS_OFF_STATE,
GREEN_AP_PS_WAIT_EVENT);
break;
}
done:
return;
}
/**
* hdd_wlan_green_ap_timer_fn() - Green AP Timer handler
* @ctx: Global HDD context
*
* Return: none
*/
static void hdd_wlan_green_ap_timer_fn(void *ctx)
{
struct hdd_context_s *hdd_ctx = ctx;
struct hdd_green_ap_ctx *green_ap;
if (0 != wlan_hdd_validate_context(hdd_ctx)) {
hdd_err("HDD context is not valid");
return;
}
green_ap = hdd_ctx->green_ap_ctx;
if (green_ap)
hdd_wlan_green_ap_mc(hdd_ctx, green_ap->ps_event);
}
/**
* hdd_wlan_green_ap_attach() - Attach Green AP context to HDD context
* @hdd_ctx: Global HDD contect
*
* Return: CDF_STATUS_SUCCESS on success, otherwise CDF_STATUS_E_* error
*/
static CDF_STATUS hdd_wlan_green_ap_attach(struct hdd_context_s *hdd_ctx)
{
struct hdd_green_ap_ctx *green_ap;
CDF_STATUS status = CDF_STATUS_SUCCESS;
ENTER();
green_ap = cdf_mem_malloc(sizeof(*green_ap));
if (!green_ap) {
hdd_alert("Memory allocation for Green-AP failed!");
status = CDF_STATUS_E_NOMEM;
goto error;
}
cdf_mem_zero(green_ap, sizeof(*green_ap));
green_ap->ps_state = GREEN_AP_PS_OFF_STATE;
green_ap->ps_event = 0;
green_ap->num_nodes = 0;
green_ap->ps_on_time = GREEN_AP_PS_ON_TIME;
green_ap->ps_delay_time = GREEN_AP_PS_DELAY_TIME;
cdf_mc_timer_init(&green_ap->ps_timer,
CDF_TIMER_TYPE_SW,
hdd_wlan_green_ap_timer_fn, hdd_ctx);
error:
hdd_ctx->green_ap_ctx = green_ap;
EXIT();
return status;
}
/**
* hdd_wlan_green_ap_deattach() - Detach Green AP context from HDD context
* @hdd_ctx: Global HDD contect
*
* Return: CDF_STATUS_SUCCESS on success, otherwise CDF_STATUS_E_* error
*/
static CDF_STATUS hdd_wlan_green_ap_deattach(struct hdd_context_s *hdd_ctx)
{
struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx;
CDF_STATUS status = CDF_STATUS_SUCCESS;
ENTER();
if (green_ap == NULL) {
hdd_notice("Green-AP is not enabled");
status = CDF_STATUS_E_NOSUPPORT;
goto done;
}
/* check if the timer status is destroyed */
if (CDF_TIMER_STATE_RUNNING ==
cdf_mc_timer_get_current_state(&green_ap->ps_timer))
cdf_mc_timer_stop(&green_ap->ps_timer);
/* Destroy the Green AP timer */
if (!CDF_IS_STATUS_SUCCESS(cdf_mc_timer_destroy(&green_ap->ps_timer)))
hdd_notice("Cannot deallocate Green-AP's timer");
/* release memory */
cdf_mem_zero(green_ap, sizeof(*green_ap));
cdf_mem_free(green_ap);
hdd_ctx->green_ap_ctx = NULL;
done:
EXIT();
return status;
}
/**
* hdd_wlan_green_ap_init() - Initialize Green AP feature
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx)
{
if (!CDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_attach(hdd_ctx)))
hdd_err("Failed to allocate Green-AP resource");
}
/**
* hdd_wlan_green_ap_deinit() - De-initialize Green AP feature
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx)
{
if (!CDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_deattach(hdd_ctx)))
hdd_err("Cannot deallocate Green-AP resource");
}
/**
* hdd_wlan_green_ap_start_bss() - Notify Green AP of Start BSS event
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx)
{
struct hdd_config *cfg = hdd_ctx->config;
/* check if the firmware and ini are both enabled the egap,
* and also the feature_flag enable, then we enable the egap
*/
if (hdd_ctx->green_ap_ctx->egap_support && cfg->enable_egap &&
cfg->egap_feature_flag) {
hdd_notice("Set EGAP - enabled: %d, flag: %x, inact_time: %d, wait_time: %d",
cfg->enable_egap, cfg->egap_feature_flag,
cfg->egap_inact_time, cfg->egap_wait_time);
if (!sme_send_egap_conf_params(cfg->enable_egap,
cfg->egap_inact_time,
cfg->egap_wait_time,
cfg->egap_feature_flag)) {
/* EGAP is enabled, disable host GAP */
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
goto exit;
}
/* fall through, if send_egap_conf_params() failed,
* then check host GAP and enable it accordingly
*/
}
if (!(CDF_STA_MASK & hdd_ctx->concurrency_mode) &&
cfg->enable2x2 && cfg->enableGreenAP) {
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_START_EVENT);
} else {
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
hdd_notice("Green-AP: is disabled, due to sta_concurrency: %d, enable2x2: %d, enableGreenAP: %d",
CDF_STA_MASK & hdd_ctx->concurrency_mode,
cfg->enable2x2, cfg->enableGreenAP);
}
exit:
return;
}
/**
* hdd_wlan_green_ap_stop_bss() - Notify Green AP of Stop BSS event
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx)
{
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
}
/**
* hdd_wlan_green_ap_add_sta() - Notify Green AP of Add Station event
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx)
{
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_ADD_STA_EVENT);
}
/**
* hdd_wlan_green_ap_del_sta() - Notify Green AP of Delete Station event
* @hdd_ctx: HDD global context
*
* Return: none
*/
void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx)
{
hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_DEL_STA_EVENT);
}
/**
* hdd_wlan_set_egap_support() - helper function to set egap support flag
* @hdd_ctx: pointer to hdd context
* @param: pointer to target configuration
*
* Return: None
*/
void hdd_wlan_set_egap_support(hdd_context_t *hdd_ctx, void *param)
{
struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *) param;
if (hdd_ctx && cfg)
hdd_ctx->green_ap_ctx->egap_support = cfg->egap_support;
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_GREEN_AP_H
#define __WLAN_HDD_GREEN_AP_H
/**
* DOC: wlan_hdd_green_ap.h
*
* WLAN Host Device Driver Green AP API specification
*/
struct hdd_context_s;
#ifdef FEATURE_GREEN_AP
void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx);
void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx);
void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx);
void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx);
void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx);
void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx);
void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx, void *param);
#else
static inline void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx) {}
static inline void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx,
void *param) {}
#endif /* FEATURE_GREEN_AP */
#endif /* __WLAN_HDD_GREEN_AP_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,116 +0,0 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_HOSTAPD_H)
#define WLAN_HDD_HOSTAPD_H
/**
* DOC: wlan_hdd_hostapd.h
*
* WLAN Host Device driver hostapd header file
*/
/* Include files */
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <cdf_list.h>
#include <cdf_types.h>
#include <wlan_hdd_main.h>
/* Preprocessor definitions and constants */
/* max length of command string in hostapd ioctl */
#define HOSTAPD_IOCTL_COMMAND_STRLEN_MAX 8192
hdd_adapter_t *hdd_wlan_create_ap_dev(hdd_context_t *pHddCtx,
tSirMacAddr macAddr, uint8_t *name);
CDF_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, uint8_t rtnl_held);
CDF_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held);
eCsrAuthType
hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]);
int hdd_softap_set_channel_change(struct net_device *dev,
int target_channel,
phy_ch_width target_bw);
eCsrEncryptionType
hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]);
eCsrEncryptionType
hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]);
eCsrAuthType
hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]);
eCsrEncryptionType
hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]);
CDF_STATUS hdd_softap_sta_deauth(hdd_adapter_t *,
struct tagCsrDelStaParams *);
void hdd_softap_sta_disassoc(hdd_adapter_t *, uint8_t *);
void hdd_softap_tkip_mic_fail_counter_measure(hdd_adapter_t *, bool);
int hdd_softap_unpack_ie(tHalHandle halHandle,
eCsrEncryptionType *pEncryptType,
eCsrEncryptionType *mcEncryptType,
eCsrAuthType *pAuthType,
bool *pMFPCapable,
bool *pMFPRequired,
uint16_t gen_ie_len, uint8_t *gen_ie);
CDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
void *usrDataForCallback);
CDF_STATUS hdd_init_ap_mode(hdd_adapter_t *pAdapter);
void hdd_set_ap_ops(struct net_device *pWlanHostapdDev);
int hdd_hostapd_stop(struct net_device *dev);
void hdd_hostapd_channel_wakelock_init(hdd_context_t *pHddCtx);
void hdd_hostapd_channel_wakelock_deinit(hdd_context_t *pHddCtx);
#ifdef FEATURE_WLAN_FORCE_SAP_SCC
void hdd_restart_softap(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
#endif /* FEATURE_WLAN_FORCE_SAP_SCC */
#ifdef QCA_HT_2040_COEX
CDF_STATUS hdd_set_sap_ht2040_mode(hdd_adapter_t *pHostapdAdapter,
uint8_t channel_type);
#endif
int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
struct net_device *dev);
int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_ap_settings *params);
int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_beacon_data *params);
CDF_STATUS wlan_hdd_config_acs(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
#endif /* end #if !defined(WLAN_HDD_HOSTAPD_H) */

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#if !defined(WLAN_HDD_IOCTL_H)
#define WLAN_HDD_IOCTL_H
#include <netdevice.h>
#include <uapi/linux/if.h>
#include "wlan_hdd_main.h"
int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
int wlan_hdd_set_mc_rate(hdd_adapter_t *pAdapter, int targetRate);
#endif /* end #if !defined(WLAN_HDD_IOCTL_H) */

File diff suppressed because it is too large Load Diff

View File

@@ -1,659 +0,0 @@
/*
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC: wlan_hdd_lro.c
*
* WLAN HDD LRO interface implementation
*/
/* denote that this file does not allow legacy hddLog */
#define HDD_DISALLOW_LEGACY_HDDLOG 1
#include <wlan_hdd_includes.h>
#include <cdf_types.h>
#include <wlan_hdd_lro.h>
#include <wlan_hdd_napi.h>
#include <wma_api.h>
#include <ol_txrx_types.h>
#include <ol_cfg.h>
#include <linux/inet_lro.h>
#include <linux/list.h>
#include <linux/random.h>
#include <net/tcp.h>
#define LRO_MAX_AGGR_SIZE 100
#define LRO_VALID_FIELDS \
(LRO_DESC | LRO_ELIGIBILITY_CHECKED | LRO_TCP_ACK_NUM | \
LRO_TCP_DATA_CSUM | LRO_TCP_SEQ_NUM | LRO_TCP_WIN)
/**
* hdd_lro_get_skb_header() - LRO callback function
* @skb: network buffer
* @ip_hdr: contains a pointer to the IP header
* @tcpudp_hdr: contains a pointer to the TCP header
* @hdr_flags: indicates if this is a TCP, IPV4 frame
* @priv: private driver specific opaque pointer
*
* Get the IP and TCP headers from the skb
*
* Return: 0 - success, < 0 - failure
*/
static int hdd_lro_get_skb_header(struct sk_buff *skb, void **ip_hdr,
void **tcpudp_hdr, u64 *hdr_flags, void *priv)
{
if (NBUF_IPV6_PROTO(skb)) {
hdr_flags = 0;
return -EINVAL;
}
*hdr_flags |= (LRO_IPV4 | LRO_TCP);
(*ip_hdr) = skb->data;
(*tcpudp_hdr) = skb->data + NBUF_TCP_OFFSET(skb);
return 0;
}
/**
* hdd_lro_desc_pool_init() - Initialize the free pool of LRO
* descriptors
* @lro_desc_pool: free pool of the LRO descriptors
* @lro_mgr: LRO manager
*
* Initialize a list that holds the free LRO descriptors
*
* Return: none
*/
static void hdd_lro_desc_pool_init(struct hdd_lro_desc_pool *lro_desc_pool,
struct net_lro_mgr *lro_mgr)
{
int i;
INIT_LIST_HEAD(&lro_desc_pool->lro_free_list_head);
for (i = 0; i < LRO_DESC_POOL_SZ; i++) {
lro_desc_pool->lro_desc_array[i].lro_desc =
&lro_mgr->lro_arr[i];
list_add_tail(&lro_desc_pool->lro_desc_array[i].lro_node,
&lro_desc_pool->lro_free_list_head);
}
cdf_spinlock_init(&lro_desc_pool->lro_pool_lock);
}
/**
* hdd_lro_desc_info_init() - Initialize the LRO descriptors
* @hdd_info: HDD LRO data structure
*
* Initialize the free pool of LRO descriptors and the entries
* of the hash table
*
* Return: none
*/
static void hdd_lro_desc_info_init(struct hdd_lro_s *hdd_info)
{
int i;
/* Initialize pool of free LRO desc.*/
hdd_lro_desc_pool_init(&hdd_info->lro_desc_info.lro_desc_pool,
hdd_info->lro_mgr);
/* Initialize the hash table of LRO desc.*/
for (i = 0; i < LRO_DESC_TABLE_SZ; i++) {
/* initialize the flows in the hash table */
INIT_LIST_HEAD(&hdd_info->lro_desc_info.
lro_hash_table[i].lro_desc_list);
}
cdf_spinlock_init(&hdd_info->lro_desc_info.lro_hash_lock);
}
/**
* hdd_lro_desc_pool_deinit() - Free the LRO descriptor list
* @hdd_info: HDD LRO data structure
*
* Free the pool of LRO descriptors
*
* Return: none
*/
static void hdd_lro_desc_pool_deinit(struct hdd_lro_desc_pool *lro_desc_pool)
{
INIT_LIST_HEAD(&lro_desc_pool->lro_free_list_head);
cdf_spinlock_destroy(&lro_desc_pool->lro_pool_lock);
}
/**
* hdd_lro_desc_info_deinit() - Deinitialize the LRO descriptors
*
* @hdd_info: HDD LRO data structure
*
* Deinitialize the free pool of LRO descriptors and the entries
* of the hash table
*
* Return: none
*/
static void hdd_lro_desc_info_deinit(struct hdd_lro_s *hdd_info)
{
struct hdd_lro_desc_info *desc_info = &hdd_info->lro_desc_info;
hdd_lro_desc_pool_deinit(&desc_info->lro_desc_pool);
cdf_spinlock_destroy(&desc_info->lro_hash_lock);
}
/**
* hdd_lro_tcp_flow_match() - function to check for a flow match
* @iph: IP header
* @tcph: TCP header
* @lro_desc: LRO decriptor
*
* Checks if the descriptor belongs to the same flow as the one
* indicated by the TCP and IP header.
*
* Return: true - flow match, false - flow does not match
*/
static inline bool hdd_lro_tcp_flow_match(struct net_lro_desc *lro_desc,
struct iphdr *iph,
struct tcphdr *tcph)
{
if ((lro_desc->tcph->source != tcph->source) ||
(lro_desc->tcph->dest != tcph->dest) ||
(lro_desc->iph->saddr != iph->saddr) ||
(lro_desc->iph->daddr != iph->daddr))
return false;
return true;
}
/**
* hdd_lro_desc_find() - LRO descriptor look-up function
*
* @adapter: HDD adaptor
* @skb: network buffer
* @iph: IP header
* @tcph: TCP header
* @lro_desc: contains a pointer to the LRO decriptor
*
* Look-up the LRO descriptor in the hash table based on the
* flow ID toeplitz. If the flow is not found, allocates a new
* LRO descriptor and places it in the hash table
*
* Return: 0 - success, < 0 - failure
*/
static int hdd_lro_desc_find(hdd_adapter_t *adapter,
struct sk_buff *skb, struct iphdr *iph, struct tcphdr *tcph,
struct net_lro_desc **lro_desc)
{
uint32_t i;
struct hdd_lro_desc_table *lro_hash_table;
struct list_head *ptr;
struct hdd_lro_desc_entry *entry;
struct hdd_lro_desc_pool free_pool;
struct hdd_lro_desc_info *desc_info = &adapter->lro_info.lro_desc_info;
*lro_desc = NULL;
i = NBUF_FLOW_ID_TOEPLITZ(skb) & LRO_DESC_TABLE_SZ_MASK;
lro_hash_table = &desc_info->lro_hash_table[i];
if (!lro_hash_table) {
hdd_err("Invalid hash entry");
CDF_ASSERT(0);
return -EINVAL;
}
cdf_spin_lock_bh(&desc_info->lro_hash_lock);
/* Check if this flow exists in the descriptor list */
list_for_each(ptr, &lro_hash_table->lro_desc_list) {
struct net_lro_desc *tmp_lro_desc = NULL;
entry = list_entry(ptr, struct hdd_lro_desc_entry, lro_node);
tmp_lro_desc = entry->lro_desc;
if (tmp_lro_desc->active) {
if (hdd_lro_tcp_flow_match(tmp_lro_desc, iph, tcph)) {
*lro_desc = entry->lro_desc;
cdf_spin_unlock_bh(&desc_info->lro_hash_lock);
return 0;
}
}
}
cdf_spin_unlock_bh(&desc_info->lro_hash_lock);
/* no existing flow found, a new LRO desc needs to be allocated */
free_pool = adapter->lro_info.lro_desc_info.lro_desc_pool;
cdf_spin_lock_bh(&free_pool.lro_pool_lock);
entry = list_first_entry_or_null(
&free_pool.lro_free_list_head,
struct hdd_lro_desc_entry, lro_node);
if (NULL == entry) {
hdd_err("Could not allocate LRO desc!");
cdf_spin_unlock_bh(&free_pool.lro_pool_lock);
return -ENOMEM;
}
list_del_init(&entry->lro_node);
cdf_spin_unlock_bh(&free_pool.lro_pool_lock);
if (NULL == entry->lro_desc) {
hdd_err("entry->lro_desc is NULL!\n");
return -EINVAL;
}
cdf_mem_zero((void *)entry->lro_desc, sizeof(struct net_lro_desc));
/*
* lro_desc->active should be 0 and lro_desc->tcp_rcv_tsval
* should be 0 for newly allocated lro descriptors
*/
cdf_spin_lock_bh(&desc_info->lro_hash_lock);
list_add_tail(&entry->lro_node,
&lro_hash_table->lro_desc_list);
cdf_spin_unlock_bh(&desc_info->lro_hash_lock);
*lro_desc = entry->lro_desc;
return 0;
}
/**
* hdd_lro_get_desc() - LRO descriptor look-up function
* @iph: IP header
* @tcph: TCP header
* @lro_arr: Array of LRO decriptors
* @lro_mgr: LRO manager
*
* Looks-up the LRO descriptor for a given flow
*
* Return: LRO descriptor
*/
static struct net_lro_desc *hdd_lro_get_desc(struct net_lro_mgr *lro_mgr,
struct net_lro_desc *lro_arr,
struct iphdr *iph,
struct tcphdr *tcph)
{
int i;
for (i = 0; i < lro_mgr->max_desc; i++) {
if (lro_arr[i].active)
if (hdd_lro_tcp_flow_match(&lro_arr[i], iph, tcph))
return &lro_arr[i];
}
return NULL;
}
/**
* hdd_lro_eligible() - LRO eligibilty check
* @iph: IP header
* @tcph: TCP header
* @adapter: HDD adaptor
* @desc: LRO descriptor
* @skb: network buffer
*
* Determines if the frame is LRO eligible
*
* Return: true - LRO eligible frame, false - frame is not LRO
* eligible
*/
static bool hdd_lro_eligible(hdd_adapter_t *adapter, struct sk_buff *skb,
struct iphdr *iph, struct tcphdr *tcph, struct net_lro_desc **desc)
{
struct net_lro_desc *lro_desc = NULL;
int hw_lro_eligible =
NBUF_LRO_ELIGIBLE(skb) && (!NBUF_TCP_PURE_ACK(skb));
if (!hw_lro_eligible)
return false;
if (0 != hdd_lro_desc_find(adapter, skb, iph, tcph, desc)) {
hdd_err("finding the LRO desc failed");
return false;
}
lro_desc = *desc;
if (!lro_desc)
return false;
/* if this is not the first skb, check the timestamp option */
if (lro_desc->tcp_rcv_tsval) {
if (tcph->doff == 8) {
__be32 *topt = (__be32 *)(tcph + 1);
if (*topt != htonl((TCPOPT_NOP << 24)
|(TCPOPT_NOP << 16)
| (TCPOPT_TIMESTAMP << 8)
| TCPOLEN_TIMESTAMP))
return true;
/* timestamp should be in right order */
topt++;
if (after(ntohl(lro_desc->tcp_rcv_tsval),
ntohl(*topt)))
return false;
/* timestamp reply should not be zero */
topt++;
if (*topt == 0)
return false;
}
}
return true;
}
/**
* hdd_lro_desc_free() - Free the LRO descriptor
* @adapter: HDD adaptor
* @desc: LRO descriptor
*
* Return the LRO descriptor to the free pool
*
* Return: none
*/
static void hdd_lro_desc_free(struct net_lro_desc *desc,
hdd_adapter_t *adapter)
{
struct hdd_lro_desc_entry *entry;
struct net_lro_desc *arr_base = adapter->lro_info.lro_mgr->lro_arr;
struct hdd_lro_desc_info *desc_info = &adapter->lro_info.lro_desc_info;
int i = desc - arr_base;
if (i >= LRO_DESC_POOL_SZ) {
hdd_err("invalid index %d", i);
return;
}
entry = &desc_info->lro_desc_pool.lro_desc_array[i];
cdf_spin_lock_bh(&desc_info->lro_hash_lock);
list_del_init(&entry->lro_node);
cdf_spin_unlock_bh(&desc_info->lro_hash_lock);
cdf_spin_lock_bh(&desc_info->lro_desc_pool.lro_pool_lock);
list_add_tail(&entry->lro_node, &desc_info->
lro_desc_pool.lro_free_list_head);
cdf_spin_unlock_bh(&desc_info->lro_desc_pool.lro_pool_lock);
}
/**
* hdd_lro_flush_pkt() - function to flush the LRO flow
* @iph: IP header
* @tcph: TCP header
* @adapter: HDD adaptor
* @lro_mgr: LRO manager
*
* Flush all the packets aggregated in the LRO manager for the
* flow indicated by the TCP and IP header
*
* Return: none
*/
void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
struct iphdr *iph, struct tcphdr *tcph, hdd_adapter_t *adapter)
{
struct net_lro_desc *lro_desc;
lro_desc = hdd_lro_get_desc(lro_mgr, lro_mgr->lro_arr, iph, tcph);
if (!lro_desc)
return;
hdd_lro_desc_free(lro_desc, adapter);
lro_flush_desc(lro_mgr, lro_desc);
}
/**
* hdd_lro_flush() - LRO flush callback
* @data: opaque pointer containing HDD specific information
*
* Callback registered to flush all the packets aggregated in
* the LRO manager for all the flows
*
* Return: none
*/
void hdd_lro_flush(void *data)
{
hdd_adapter_t *adapter = (hdd_adapter_t *)data;
int i;
for (i = 0; i < adapter->lro_info.lro_mgr->max_desc; i++) {
if (adapter->lro_info.lro_mgr->lro_arr[i].active) {
hdd_lro_desc_free(
&adapter->lro_info.lro_mgr->lro_arr[i],
(void *)adapter);
lro_flush_desc(adapter->lro_info.lro_mgr,
&adapter->lro_info.lro_mgr->lro_arr[i]);
}
}
}
/**
* hdd_lro_init() - initialization for LRO
* @hdd_ctx: HDD context
*
* This function sends the LRO configuration to the firmware
* via WMA
*
* Return: 0 - success, < 0 - failure
*/
int hdd_lro_init(hdd_context_t *hdd_ctx)
{
struct wma_lro_config_cmd_t lro_config;
if (!hdd_ctx->config->lro_enable) {
hdd_err("LRO Disabled");
return 0;
}
lro_config.lro_enable = 1;
lro_config.tcp_flag = TCPHDR_ACK;
lro_config.tcp_flag_mask = TCPHDR_FIN | TCPHDR_SYN | TCPHDR_RST |
TCPHDR_ACK | TCPHDR_URG | TCPHDR_ECE | TCPHDR_CWR;
get_random_bytes(lro_config.toeplitz_hash_ipv4,
(sizeof(lro_config.toeplitz_hash_ipv4[0]) *
LRO_IPV4_SEED_ARR_SZ));
get_random_bytes(lro_config.toeplitz_hash_ipv6,
(sizeof(lro_config.toeplitz_hash_ipv6[0]) *
LRO_IPV6_SEED_ARR_SZ));
hdd_debug("sending the LRO configuration to the fw");
if (0 != wma_lro_init(&lro_config)) {
hdd_err("Failed to send LRO configuration!");
hdd_ctx->config->lro_enable = 0;
return -EAGAIN;
}
return 0;
}
/**
* hdd_lro_enable() - enable LRO
* @hdd_ctx: HDD context
* @adapter: HDD adapter
*
* This function enables LRO in the network device attached to
* the HDD adapter. It also allocates the HDD LRO instance for
* that network device
*
* Return: 0 - success, < 0 - failure
*/
int hdd_lro_enable(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter)
{
struct hdd_lro_s *hdd_lro;
struct ol_txrx_pdev_t *pdev = cds_get_context(CDF_MODULE_ID_TXRX);
size_t lro_mgr_sz, desc_arr_sz, desc_pool_sz, hash_table_sz;
uint8_t *lro_mem_ptr;
if (!hdd_ctx->config->lro_enable ||
NL80211_IFTYPE_STATION != adapter->wdev.iftype) {
hdd_info("LRO Disabled");
return 0;
}
hdd_info("LRO Enabled");
hdd_lro = &adapter->lro_info;
cdf_mem_zero((void *)hdd_lro, sizeof(struct hdd_lro_s));
/*
* Allocate all the LRO data structures at once and then carve
* them up as needed
*/
lro_mgr_sz = sizeof(struct net_lro_mgr);
desc_arr_sz = (LRO_DESC_POOL_SZ * sizeof(struct net_lro_desc));
desc_pool_sz = (LRO_DESC_POOL_SZ * sizeof(struct hdd_lro_desc_entry));
hash_table_sz = (sizeof(struct hdd_lro_desc_table) * LRO_DESC_TABLE_SZ);
lro_mem_ptr = cdf_mem_malloc(lro_mgr_sz + desc_arr_sz + desc_pool_sz +
hash_table_sz);
if (NULL == lro_mem_ptr) {
hdd_err("Unable to allocate memory for LRO");
hdd_ctx->config->lro_enable = 0;
return -ENOMEM;
}
/* LRO manager */
hdd_lro->lro_mgr = (struct net_lro_mgr *)lro_mem_ptr;
lro_mem_ptr += lro_mgr_sz;
/* LRO decriptor array */
hdd_lro->lro_mgr->lro_arr = (struct net_lro_desc *)lro_mem_ptr;
lro_mem_ptr += desc_arr_sz;
/* LRO descriptor pool */
hdd_lro->lro_desc_info.lro_desc_pool.lro_desc_array =
(struct hdd_lro_desc_entry *)lro_mem_ptr;
lro_mem_ptr += desc_pool_sz;
/* hash table to store the LRO descriptors */
hdd_lro->lro_desc_info.lro_hash_table =
(struct hdd_lro_desc_table *)lro_mem_ptr;
/* Initialize the LRO descriptors */
hdd_lro_desc_info_init(hdd_lro);
hdd_lro->lro_mgr->dev = adapter->dev;
if (ol_cfg_is_rx_thread_enabled(pdev->ctrl_pdev))
hdd_lro->lro_mgr->features = LRO_F_NI;
if (hdd_napi_enabled(HDD_NAPI_ANY))
hdd_lro->lro_mgr->features |= LRO_F_NAPI;
hdd_lro->lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY;
hdd_lro->lro_mgr->max_aggr = LRO_MAX_AGGR_SIZE;
hdd_lro->lro_mgr->get_skb_header = hdd_lro_get_skb_header;
hdd_lro->lro_mgr->ip_summed = CHECKSUM_UNNECESSARY;
hdd_lro->lro_mgr->max_desc = LRO_DESC_POOL_SZ;
adapter->dev->features |= NETIF_F_LRO;
/* Register the flush callback */
ol_register_lro_flush_cb(hdd_lro_flush, adapter);
return 0;
}
/**
* hdd_lro_disable() - disable LRO
* @hdd_ctx: HDD context
* @adapter: HDD adapter
*
* This function frees the HDD LRO instance for the network
* device attached to the HDD adapter
*
* Return: none
*/
void hdd_lro_disable(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter)
{
if (!hdd_ctx->config->lro_enable ||
NL80211_IFTYPE_STATION != adapter->wdev.iftype)
return;
/* Deregister the flush callback */
ol_deregister_lro_flush_cb();
if (adapter->lro_info.lro_mgr) {
hdd_lro_desc_info_deinit(&adapter->lro_info);
cdf_mem_free(adapter->lro_info.lro_mgr);
adapter->lro_info.lro_mgr = NULL;
adapter->lro_info.lro_desc_info.
lro_desc_pool.lro_desc_array = NULL;
adapter->lro_info.lro_desc_info.
lro_hash_table = NULL;
}
return;
}
/**
* hdd_lro_rx() - LRO receive function
* @hdd_ctx: HDD context
* @adapter: HDD adapter
* @skb: network buffer
*
* Delivers LRO eligible frames to the LRO manager
*
* Return: HDD_LRO_RX - frame delivered to LRO manager
* HDD_LRO_NO_RX - frame not delivered
*/
enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
hdd_adapter_t *adapter, struct sk_buff *skb)
{
enum hdd_lro_rx_status status = HDD_LRO_NO_RX;
if ((adapter->dev->features & NETIF_F_LRO) &&
NBUF_TCP_PROTO(skb)) {
struct iphdr *iph;
struct tcphdr *tcph;
struct net_lro_desc *lro_desc = NULL;
iph = (struct iphdr *)skb->data;
tcph = (struct tcphdr *)(skb->data + NBUF_TCP_OFFSET(skb));
if (hdd_lro_eligible(adapter, skb, iph, tcph, &lro_desc)) {
struct net_lro_info hdd_lro_info;
hdd_lro_info.valid_fields = LRO_VALID_FIELDS;
hdd_lro_info.lro_desc = lro_desc;
hdd_lro_info.lro_eligible = 1;
hdd_lro_info.tcp_ack_num = NBUF_TCP_ACK_NUM(skb);
hdd_lro_info.tcp_data_csum =
csum_unfold(htons(NBUF_TCP_CHKSUM(skb)));
hdd_lro_info.tcp_seq_num = NBUF_TCP_SEQ_NUM(skb);
hdd_lro_info.tcp_win = NBUF_TCP_WIN(skb);
lro_receive_skb_ext(adapter->lro_info.lro_mgr, skb,
(void *)adapter, &hdd_lro_info);
if (!hdd_lro_info.lro_desc->active)
hdd_lro_desc_free(lro_desc, adapter);
status = HDD_LRO_RX;
} else {
hdd_lro_flush_pkt(adapter->lro_info.lro_mgr,
iph, tcph, adapter);
}
}
return status;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,637 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC : wlan_hdd_memdump.c
*
* WLAN Host Device Driver file for dumping firmware memory
*
*/
#include <sme_api.h>
#include <wlan_hdd_includes.h>
#include "wlan_hdd_memdump.h"
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/proc_fs.h> /* Necessary because we use the proc fs */
#include <linux/uaccess.h> /* for copy_to_user */
/**
* hdd_fw_dump_context - hdd firmware memory dump context
*
* @request_id: userspace assigned firmware memory dump request ID
* @response_event: firmware memory dump request wait event
*/
struct hdd_fw_dump_context {
uint32_t request_id;
struct completion response_event;
};
static struct hdd_fw_dump_context fw_dump_context;
/**
* memdump_cleanup_timer_cb() - Timer callback function for memory dump cleanup.
*
* @data: Callback data (used to stored HDD context)
*
* Callback function registered for memory dump cleanup VOS timer.
*
* Return: none
*/
static void memdump_cleanup_timer_cb(void *data)
{
int status;
hdd_context_t *hdd_ctx = data;
cdf_dma_addr_t paddr;
cdf_dma_addr_t dma_ctx = 0;
cdf_device_t cdf_ctx;
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hddLog(LOGE, FL("HDD context is not valid"));
return;
}
if (!hdd_ctx->fw_dump_loc) {
hddLog(LOG1, FL("Memory dump already freed"));
return;
}
cdf_ctx = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!cdf_ctx) {
hddLog(LOGE, FL("CDF context is NULL"));
return;
}
paddr = hdd_ctx->dump_loc_paddr;
mutex_lock(&hdd_ctx->memdump_lock);
cdf_os_mem_free_consistent(cdf_ctx,
FW_MEM_DUMP_SIZE, hdd_ctx->fw_dump_loc, paddr, dma_ctx);
hdd_ctx->fw_dump_loc = NULL;
hdd_ctx->memdump_in_progress = false;
mutex_unlock(&hdd_ctx->memdump_lock);
}
/**
* wlan_hdd_cfg80211_fw_mem_dump_cb() - Callback to receive FW memory dump
* @ctx: pointer to HDD context.
* @rsp: pointer to fw dump copy complete response
*
* This is a callback function used to indicate user space about the
* availability for firmware memory dump via vendor event.
*
* Return: None
*/
static void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
struct fw_dump_rsp *dump_rsp)
{
hdd_context_t *hdd_ctx = ctx;
struct hdd_fw_dump_context *context;
int status;
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hddLog(LOGE, FL("HDD context is not valid"));
return;
}
spin_lock(&hdd_context_lock);
context = &fw_dump_context;
/* validate the response received */
if (!dump_rsp->dump_complete ||
context->request_id != dump_rsp->request_id) {
spin_unlock(&hdd_context_lock);
hddLog(LOGE,
FL("Error @ request_id: %d response_id: %d status: %d"),
context->request_id, dump_rsp->request_id,
dump_rsp->dump_complete);
return;
} else {
complete(&context->response_event);
}
spin_unlock(&hdd_context_lock);
return;
}
/**
* wlan_hdd_send_memdump_rsp - send memory dump response to user space
* @hdd_ctx: Pointer to hdd context
*
* Return: 0 for success; non-zero for failure
*/
static int wlan_hdd_send_memdump_rsp(hdd_context_t *hdd_ctx)
{
struct sk_buff *skb;
int status;
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hddLog(LOGE, FL("HDD context is not valid"));
return status;
}
skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
NLMSG_HDRLEN + NLA_HDRLEN + sizeof(uint32_t));
if (!skb) {
hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
return -ENOMEM;
}
if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
FW_MEM_DUMP_SIZE)) {
hddLog(LOGE, FL("nla put fail"));
goto nla_put_failure;
}
cfg80211_vendor_cmd_reply(skb);
hddLog(LOG1, FL("Memdump event sent successfully to user space"));
return 0;
nla_put_failure:
kfree_skb(skb);
return -EINVAL;
}
/**
* __wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump
* @wiphy: pointer to wireless wiphy structure.
* @wdev: pointer to wireless_dev structure.
* @data: Pointer to the NL data.
* @data_len:Length of @data
*
* This is called when wlan driver needs to get the firmware memory dump
* via vendor specific command.
*
* Return: 0 on success, error number otherwise.
*/
static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
int status;
CDF_STATUS sme_status;
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
struct fw_dump_req fw_mem_dump_req;
struct fw_dump_seg_req *seg_req;
uint8_t loop;
cdf_dma_addr_t paddr;
cdf_dma_addr_t dma_ctx = 0;
cdf_device_t cdf_ctx;
unsigned long rc;
struct hdd_fw_dump_context *context;
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hddLog(LOGE, FL("HDD context is invalid"));
return status;
}
cdf_ctx = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!cdf_ctx) {
hddLog(LOGE, FL("CDF context is NULL"));
return -EINVAL;
}
if (hdd_ctx->memdump_in_progress) {
hddLog(LOGE, FL("Already a memdump req in progress."));
return -EBUSY;
}
/*
* Allocate memory for fw memory dump. Memory allocated should be
* contiguous. Physical address of the allocated memory is passed
* to the FW for copy
*
* Reuse the memory if available.
*/
mutex_lock(&hdd_ctx->memdump_lock);
if (!hdd_ctx->fw_dump_loc) {
hdd_ctx->fw_dump_loc = cdf_os_mem_alloc_consistent(
cdf_ctx, FW_MEM_DUMP_SIZE, &paddr, dma_ctx);
if (!hdd_ctx->fw_dump_loc) {
mutex_unlock(&hdd_ctx->memdump_lock);
hddLog(LOGE, FL("cdf_os_mem_alloc_consistent failed"));
return -ENOMEM;
}
hdd_ctx->dump_loc_paddr = paddr;
}
mutex_unlock(&hdd_ctx->memdump_lock);
/*
* Currently request_id and num_seg is assumed to be default(1)
* It is assumed that firmware dump requested is for DRAM section
* only
*/
fw_mem_dump_req.request_id = FW_MEM_DUMP_REQ_ID;
fw_mem_dump_req.num_seg = FW_MEM_DUMP_NUM_SEG;
hddLog(LOG1, FL("request_id:%d num_seg:%d"),
fw_mem_dump_req.request_id, fw_mem_dump_req.num_seg);
seg_req = (struct fw_dump_seg_req *) fw_mem_dump_req.segment;
for (loop = 0; loop < fw_mem_dump_req.num_seg; loop++) {
seg_req->seg_id = 1;
seg_req->seg_start_addr_lo = FW_DRAM_LOCATION;
seg_req->seg_start_addr_hi = 0;
seg_req->seg_length = FW_MEM_DUMP_SIZE;
seg_req->dst_addr_lo = hdd_ctx->dump_loc_paddr;
seg_req->dst_addr_hi = 0;
hddLog(LOG1, FL("seg_number:%d"), loop);
hddLog(LOG1,
FL("seg_id:%d start_addr_lo:0x%x start_addr_hi:0x%x"),
seg_req->seg_id, seg_req->seg_start_addr_lo,
seg_req->seg_start_addr_hi);
hddLog(LOG1,
FL("seg_length:%d dst_addr_lo:0x%x dst_addr_hi:0x%x"),
seg_req->seg_length, seg_req->dst_addr_lo,
seg_req->dst_addr_hi);
seg_req++;
}
/**
* Start the cleanup timer.
* Memory allocated for this request will be freed up
* once the timer expires. Memory dump request is expected to be
* completed by this time.
*
* User space will not be able to access the dump after this time.
* New request should be issued to get the dump again.
*/
cdf_mc_timer_start(&hdd_ctx->memdump_cleanup_timer,
MEMDUMP_COMPLETION_TIME_MS);
hdd_ctx->memdump_in_progress = true;
spin_lock(&hdd_context_lock);
context = &fw_dump_context;
context->request_id = fw_mem_dump_req.request_id;
INIT_COMPLETION(context->response_event);
spin_unlock(&hdd_context_lock);
sme_status = sme_fw_mem_dump(hdd_ctx->hHal, &fw_mem_dump_req);
if (CDF_STATUS_SUCCESS != sme_status) {
hddLog(LOGE, FL("sme_fw_mem_dump Failed"));
mutex_lock(&hdd_ctx->memdump_lock);
cdf_os_mem_free_consistent(cdf_ctx,
FW_MEM_DUMP_SIZE, hdd_ctx->fw_dump_loc, paddr, dma_ctx);
hdd_ctx->fw_dump_loc = NULL;
mutex_unlock(&hdd_ctx->memdump_lock);
hdd_ctx->memdump_in_progress = false;
if (CDF_TIMER_STATE_RUNNING ==
cdf_mc_timer_get_current_state(
&hdd_ctx->memdump_cleanup_timer)) {
cdf_mc_timer_stop(&hdd_ctx->memdump_cleanup_timer);
}
return -EINVAL;
}
rc = wait_for_completion_timeout(&context->response_event,
msecs_to_jiffies(MEMDUMP_COMPLETION_TIME_MS));
if (!rc) {
hddLog(LOGE, FL("Target response timed out for request_id: %d"),
context->request_id);
return -ETIMEDOUT;
}
status = wlan_hdd_send_memdump_rsp(hdd_ctx);
if (status)
hddLog(LOGE,
FL("Failed to send FW memory dump rsp to user space"));
return status;
}
/**
* wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump
* @wiphy: pointer to wireless wiphy structure.
* @wdev: pointer to wireless_dev structure.
* @data: Pointer to the NL data.
* @data_len:Length of @data
*
* This is called when wlan driver needs to get the firmware memory dump
* via vendor specific command.
*
* Return: 0 on success, error number otherwise.
*/
int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data, data_len);
cds_ssr_unprotect(__func__);
return ret;
}
#define PROCFS_MEMDUMP_DIR "debug"
#define PROCFS_MEMDUMP_NAME "fwdump"
#define PROCFS_MEMDUMP_PERM 0444
static struct proc_dir_entry *proc_file, *proc_dir;
/** memdump_get_file_data() - get data available in proc file
*
* @file - handle for the proc file.
*
* This function is used to retrieve the data passed while
* creating proc file entry.
*
* Return: void pointer to hdd_context
*/
static void *memdump_get_file_data(struct file *file)
{
void *hdd_ctx;
hdd_ctx = PDE_DATA(file_inode(file));
return hdd_ctx;
}
/**
* memdump_read() - perform read operation in memory dump proc file
*
* @file - handle for the proc file.
* @buf - pointer to user space buffer.
* @count - number of bytes to be read.
* @pos - offset in the from buffer.
*
* This function performs read operation for the memory dump proc file.
*
* Return: number of bytes read on success, error code otherwise.
*/
static ssize_t memdump_read(struct file *file, char __user *buf,
size_t count, loff_t *pos)
{
int status;
hdd_context_t *hdd_ctx;
cdf_dma_addr_t paddr;
cdf_dma_addr_t dma_ctx = 0;
cdf_device_t cdf_ctx;
hdd_ctx = memdump_get_file_data(file);
hddLog(LOG1, FL("Read req for size:%zu pos:%llu"), count, *pos);
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hddLog(LOGE, FL("HDD context is not valid"));
return -EINVAL;
}
cdf_ctx = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!cdf_ctx) {
hddLog(LOGE, FL("CDF context is NULL"));
return -EINVAL;
}
if (!hdd_ctx->memdump_in_progress) {
hddLog(LOGE, FL("Current mem dump request timed out/failed"));
return -EINVAL;
}
if (*pos < 0) {
hddLog(LOGE, FL("Invalid start offset for memdump read"));
return -EINVAL;
} else if (*pos >= FW_MEM_DUMP_SIZE || !count) {
hddLog(LOGE, FL("No more data to copy"));
return 0;
} else if (count > FW_MEM_DUMP_SIZE - *pos) {
count = FW_MEM_DUMP_SIZE - *pos;
}
if (!hdd_ctx->fw_dump_loc) {
hddLog(LOGE, FL("Invalid fw mem dump location"));
return -EINVAL;
}
if (copy_to_user(buf, hdd_ctx->fw_dump_loc + *pos, count)) {
hddLog(LOGE, FL("copy to user space failed"));
return -EFAULT;
}
/* offset(pos) should be updated here based on the copy done*/
*pos += count;
/* Entire FW memory dump copy completed */
if (*pos >= FW_MEM_DUMP_SIZE) {
paddr = hdd_ctx->dump_loc_paddr;
mutex_lock(&hdd_ctx->memdump_lock);
cdf_os_mem_free_consistent(cdf_ctx,
FW_MEM_DUMP_SIZE, hdd_ctx->fw_dump_loc, paddr, dma_ctx);
hdd_ctx->fw_dump_loc = NULL;
hdd_ctx->memdump_in_progress = false;
if (CDF_TIMER_STATE_RUNNING ==
cdf_mc_timer_get_current_state(
&hdd_ctx->memdump_cleanup_timer)) {
cdf_mc_timer_stop(&hdd_ctx->memdump_cleanup_timer);
}
mutex_unlock(&hdd_ctx->memdump_lock);
}
return count;
}
/**
* struct memdump_fops - file operations for memory dump feature
* @read - read function for memory dump operation.
*
* This structure initialize the file operation handle for memory
* dump feature
*/
static const struct file_operations memdump_fops = {
read: memdump_read
};
/**
* memdump_procfs_init() - Initialize procfs for memory dump
*
* This function create file under proc file system to be used later for
* processing firmware memory dump
*
* Return: 0 on success, error code otherwise.
*/
static int memdump_procfs_init(void)
{
hdd_context_t *hdd_ctx;
hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
if (!hdd_ctx) {
hddLog(LOGE , FL("Invalid HDD context"));
return -EINVAL;
}
proc_dir = proc_mkdir(PROCFS_MEMDUMP_DIR, NULL);
if (proc_dir == NULL) {
remove_proc_entry(PROCFS_MEMDUMP_DIR, NULL);
pr_debug("Error: Could not initialize /proc/%s\n",
PROCFS_MEMDUMP_DIR);
return -ENOMEM;
}
proc_file = proc_create_data(PROCFS_MEMDUMP_NAME,
PROCFS_MEMDUMP_PERM, proc_dir,
&memdump_fops, hdd_ctx);
if (proc_file == NULL) {
remove_proc_entry(PROCFS_MEMDUMP_NAME, proc_dir);
pr_debug("Error: Could not initialize /proc/%s\n",
PROCFS_MEMDUMP_NAME);
return -ENOMEM;
}
pr_debug("/proc/%s/%s created\n", PROCFS_MEMDUMP_DIR,
PROCFS_MEMDUMP_NAME);
return 0;
}
/**
* memdump_procfs_remove() - Remove file/dir under procfs for memory dump
*
* This function removes file/dir under proc file system that was
* processing firmware memory dump
*
* Return: None
*/
static void memdump_procfs_remove(void)
{
remove_proc_entry(PROCFS_MEMDUMP_NAME, proc_dir);
pr_debug("/proc/%s/%s removed\n", PROCFS_MEMDUMP_DIR,
PROCFS_MEMDUMP_NAME);
remove_proc_entry(PROCFS_MEMDUMP_DIR, NULL);
pr_debug("/proc/%s removed\n", PROCFS_MEMDUMP_DIR);
}
/**
* memdump_init() - Intialization function for memory dump feature
*
* This function creates proc file for memdump feature and registers
* HDD callback function with SME.
*
* Return - 0 on success, error otherwise
*/
int memdump_init(void)
{
hdd_context_t *hdd_ctx;
int status = 0;
CDF_STATUS cb_status;
CDF_STATUS cdf_status;
hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
if (!hdd_ctx) {
hddLog(LOGE , FL("Invalid HDD context"));
return -EINVAL;
}
if (CDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hddLog(LOGE, FL("Not initializing memdump in FTM mode"));
return -EINVAL;
}
cb_status = sme_fw_mem_dump_register_cb(hdd_ctx->hHal,
wlan_hdd_cfg80211_fw_mem_dump_cb);
if (CDF_STATUS_SUCCESS != cb_status) {
hddLog(LOGE , FL("Failed to register the callback"));
return -EINVAL;
}
status = memdump_procfs_init();
if (status) {
hddLog(LOGE , FL("Failed to create proc file"));
return status;
}
init_completion(&fw_dump_context.response_event);
cdf_status = cdf_mc_timer_init(&hdd_ctx->memdump_cleanup_timer,
CDF_TIMER_TYPE_SW, memdump_cleanup_timer_cb,
(void *)hdd_ctx);
if (!CDF_IS_STATUS_SUCCESS(cdf_status)) {
hddLog(LOGE, FL("Failed to init memdump cleanup timer"));
return -EINVAL;
}
mutex_init(&hdd_ctx->memdump_lock);
return 0;
}
/**
* memdump_deinit() - De initialize memdump feature
*
* This function removes proc file created for memdump feature.
*
* Return: None
*/
void memdump_deinit(void)
{
hdd_context_t *hdd_ctx;
cdf_dma_addr_t paddr;
cdf_dma_addr_t dma_ctx = 0;
cdf_device_t cdf_ctx;
CDF_STATUS cdf_status;
hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
if (!hdd_ctx) {
hddLog(LOGE , FL("Invalid HDD context"));
return;
}
if (CDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hddLog(LOGE, FL("Not deinitializing memdump in FTM mode"));
return;
}
cdf_ctx = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!cdf_ctx) {
hddLog(LOGE, FL("CDF context is NULL"));
return;
}
memdump_procfs_remove();
sme_fw_mem_dump_unregister_cb(hdd_ctx->hHal);
mutex_lock(&hdd_ctx->memdump_lock);
if (hdd_ctx->fw_dump_loc) {
paddr = hdd_ctx->dump_loc_paddr;
cdf_os_mem_free_consistent(cdf_ctx,
FW_MEM_DUMP_SIZE, hdd_ctx->fw_dump_loc, paddr, dma_ctx);
hdd_ctx->fw_dump_loc = NULL;
hdd_ctx->memdump_in_progress = false;
}
mutex_unlock(&hdd_ctx->memdump_lock);
if (CDF_TIMER_STATE_RUNNING ==
cdf_mc_timer_get_current_state(&hdd_ctx->memdump_cleanup_timer)) {
cdf_mc_timer_stop(&hdd_ctx->memdump_cleanup_timer);
}
cdf_status = cdf_mc_timer_destroy(&hdd_ctx->memdump_cleanup_timer);
if (!CDF_IS_STATUS_SUCCESS(cdf_status))
hddLog(LOGE, FL("Failed to deallocate timer"));
}

View File

@@ -1,193 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_hdd_nan.c
*
* WLAN Host Device Driver NAN API implementation
*/
/* denote that this file does not allow legacy hddLog */
#define HDD_DISALLOW_LEGACY_HDDLOG 1
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <net/cfg80211.h>
#include <ani_global.h>
#include "sme_api.h"
#include "nan_api.h"
#include "wlan_hdd_main.h"
#include "wlan_hdd_nan.h"
/**
* __wlan_hdd_cfg80211_nan_request() - cfg80211 NAN request handler
* @wiphy: driver's wiphy struct
* @wdev: wireless device to which the request is targeted
* @data: actual request data (netlink-encapsulated)
* @data_len: length of @data
*
* This is called when userspace needs to send a nan request to
* firmware. The wlan host driver simply de-encapsulates the
* request from the netlink payload and then forwards it to
* firmware via SME.
*
* Return: 0 on success, negative errno on failure
*/
static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len)
{
tNanRequestReq nan_req;
CDF_STATUS status;
int ret_val;
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
ENTER();
ret_val = wlan_hdd_validate_context(hdd_ctx);
if (ret_val)
return ret_val;
if (CDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (!hdd_ctx->config->enable_nan_support) {
hdd_err("NaN support is not enabled in INI");
return -EPERM;
}
nan_req.request_data_len = data_len;
nan_req.request_data = data;
status = sme_nan_request(&nan_req);
if (CDF_STATUS_SUCCESS != status) {
ret_val = -EINVAL;
}
return ret_val;
}
/**
* wlan_hdd_cfg80211_nan_request() - handle NAN request
* @wiphy: pointer to wireless wiphy structure.
* @wdev: pointer to wireless_dev structure.
* @data: Pointer to the data to be passed via vendor interface
* @data_len:Length of the data to be passed
*
* This function is called by userspace to send a NAN request to
* firmware. This is an SSR-protected wrapper function.
*
* Return: 0 on success, negative errno on failure
*/
int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* wlan_hdd_cfg80211_nan_callback() - cfg80211 NAN event handler
* @ctx: global HDD context
* @msg: NAN event message
*
* This is a callback function and it gets called when we need to report
* a nan event to userspace. The wlan host driver simply encapsulates the
* event into a netlink payload and then forwards it to userspace via a
* cfg80211 vendor event.
*
* Return: nothing
*/
static void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg)
{
hdd_context_t *hdd_ctx = ctx;
struct sk_buff *vendor_event;
int status;
if (NULL == msg) {
hdd_err("msg received here is null");
return;
}
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status) {
hdd_err("HDD context is not valid");
return;
}
vendor_event =
cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
NULL,
msg->event_data_len + NLMSG_HDRLEN,
QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX,
GFP_KERNEL);
if (!vendor_event) {
hdd_err("cfg80211_vendor_event_alloc failed");
return;
}
if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN,
msg->event_data_len, msg->event_data)) {
hdd_err("QCA_WLAN_VENDOR_ATTR_NAN put fail");
kfree_skb(vendor_event);
return;
}
cfg80211_vendor_event(vendor_event, GFP_KERNEL);
}
/**
* wlan_hdd_nan_is_supported() - HDD NAN support query function
*
* This function is called to determine if NAN is supported by the
* driver and by the firmware.
*
* Return: true if NAN is supported by the driver and firmware
*/
bool wlan_hdd_nan_is_supported(void)
{
return sme_is_feature_supported_by_fw(NAN);
}
/**
* wlan_hdd_nan_init() - HDD NAN initialization function
* @hdd_ctx: Global HDD context
*
* This function is called to initialize the HDD NAN feature. Currently
* the only operation required is to register a callback with SME.
*
* Return: void
*/
void wlan_hdd_nan_init(hdd_context_t *hdd_ctx)
{
sme_nan_register_callback(hdd_ctx->hHal,
wlan_hdd_cfg80211_nan_callback);
}

View File

@@ -1,273 +0,0 @@
/*
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/**
* DOC: wlan_hdd_napi.c
*
* WLAN HDD NAPI interface implementation
*/
#include <smp.h> /* get_cpu */
#include "wlan_hdd_napi.h"
#include "cds_api.h" /* cds_get_context */
#include "hif.h" /* hif_map_service...*/
#include "wlan_hdd_main.h" /* hdd_err/warn... */
#include "cdf_types.h" /* CDF_MODULE_ID_... */
#include "ce_api.h"
/* guaranteed to be initialized to zero/NULL by the standard */
static struct qca_napi_data *hdd_napi_ctx;
/**
* hdd_napi_get_all() - return the whole NAPI structure from HIF
*
* Gets to the data structure common to all NAPI instances.
*
* Return:
* NULL : probably NAPI not initialized yet.
* <addr>: the address of the whole NAPI structure
*/
struct qca_napi_data *hdd_napi_get_all(void)
{
struct qca_napi_data *rp = NULL;
struct ol_softc *hif;
NAPI_DEBUG("-->\n");
hif = cds_get_context(CDF_MODULE_ID_HIF);
if (unlikely(NULL == hif))
CDF_ASSERT(NULL != hif); /* WARN */
else
rp = hif_napi_get_all(hif);
NAPI_DEBUG("<-- [addr=%p]\n", rp);
return rp;
}
/**
* hdd_napi_get_map() - get a copy of napi pipe map
*
* Return:
* uint32_t : copy of pipe map
*/
static uint32_t hdd_napi_get_map(void)
{
uint32_t map = 0;
NAPI_DEBUG("-->\n");
/* cache once, use forever */
if (hdd_napi_ctx == NULL)
hdd_napi_ctx = hdd_napi_get_all();
if (hdd_napi_ctx != NULL)
map = hdd_napi_ctx->ce_map;
NAPI_DEBUG("<--[map=0x%08x]\n", map);
return map;
}
/**
* hdd_napi_create() - creates the NAPI structures for a given netdev
*
* Creates NAPI instances. This function is called
* unconditionally during initialization. It creates
* napi structures through the proper HTC/HIF calls.
* The structures are disabled on creation.
*
* Return:
* single-queue: <0: err, >0=id, 0 (should not happen)
* multi-queue: bitmap of created instances (0: none)
*/
int hdd_napi_create(void)
{
struct ol_softc *hif_ctx;
uint8_t ul, dl;
int ul_polled, dl_polled;
int rc = 0;
NAPI_DEBUG("-->\n");
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
if (unlikely(NULL == hif_ctx)) {
CDF_ASSERT(NULL != hif_ctx);
rc = -EFAULT;
} else {
/*
* Note: hif_service_to_pipe returns one pipe id per service.
* For multi-queue NAPI for Adrastea, we will use multiple
* services/calls.
* For Rome, there is only one service, hence a single call
*/
if (CDF_STATUS_SUCCESS !=
hif_map_service_to_pipe(hif_ctx, HTT_DATA_MSG_SVC,
&ul, &dl, &ul_polled, &dl_polled)) {
hdd_err("cannot map service to pipe");
rc = -EINVAL;
} else {
rc = hif_napi_create(hif_ctx, dl, hdd_napi_poll,
QCA_NAPI_BUDGET,
QCA_NAPI_DEF_SCALE);
if (rc < 0)
hdd_err("ERR(%d) creating NAPI on pipe %d",
rc, dl);
else {
hdd_info("napi instance %d created on pipe %d",
rc, dl);
/* rc = (0x01 << rc); -- phase 2 */
}
}
}
NAPI_DEBUG("<-- [rc=%d]\n", rc);
return rc;
}
/**
* hdd_napi_destroy() - destroys the NAPI structures for a given netdev
* @force: if set, will force-disable the instance before _del'ing
*
* Destroy NAPI instances. This function is called
* unconditionally during module removal. It destroy
* napi structures through the proper HTC/HIF calls.
*
* Return:
* number of NAPI instances destroyed
*/
int hdd_napi_destroy(int force)
{
int rc = 0;
int i;
uint32_t hdd_napi_map = hdd_napi_get_map();
NAPI_DEBUG("--> (force=%d)\n", force);
if (hdd_napi_map) {
struct ol_softc *hif_ctx;
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
if (unlikely(NULL == hif_ctx))
CDF_ASSERT(NULL != hif_ctx);
else
for (i = 0; i < CE_COUNT_MAX; i++)
if (hdd_napi_map & (0x01 << i)) {
if (0 <= hif_napi_destroy(
hif_ctx,
NAPI_PIPE2ID(i), force)) {
rc++;
hdd_napi_map &= ~(0x01 << i);
} else
hdd_err("cannot destroy napi %d: (pipe:%d), f=%d\n",
i,
NAPI_PIPE2ID(i), force);
}
}
/* if all instances are removed, it is likely that hif_context has been
* removed as well, so the cached value of the napi context also needs
* to be removed
*/
if (force)
CDF_ASSERT(hdd_napi_map == 0);
if (0 == hdd_napi_map)
hdd_napi_ctx = NULL;
NAPI_DEBUG("<-- [rc=%d]\n", rc);
return rc;
}
/**
* hdd_napi_enabled() - checks if NAPI is enabled (for a given id)
* @id: the id of the NAPI to check (any= -1)
*
* Return:
* int: 0 = false (NOT enabled)
* !0 = true (enabbled)
*/
int hdd_napi_enabled(int id)
{
struct ol_softc *hif;
int rc = 0; /* NOT enabled */
hif = cds_get_context(CDF_MODULE_ID_HIF);
if (unlikely(NULL == hif))
CDF_ASSERT(hif != NULL); /* WARN_ON; rc = 0 */
else if (-1 == id)
rc = hif_napi_enabled(hif, id);
else
rc = hif_napi_enabled(hif, NAPI_ID2PIPE(id));
return rc;
}
/**
* hdd_napi_event() - relay the event detected by HDD to HIF NAPI decision maker
* @event: event code
* @data : event-specific auxiliary data
*
* Return code does not indicate a change, but whether or not NAPI is
* enabled at the time of the return of the function. That is, if NAPI
* was disabled before the call, and the event does not cause NAPI to be
* enabled, a value of 0 will be returned indicating that it is (still)
* disabled.
*
* Return:
* < 0: error code
* = 0: NAPI state = disabled (after processing the event)
* = 1: NAPI state = enabled (after processing the event)
*/
int hdd_napi_event(enum qca_napi_event event, void *data)
{
int rc = -EFAULT; /* assume err */
struct ol_softc *hif;
NAPI_DEBUG("-->(event=%d, aux=%p)\n", event, data);
hif = cds_get_context(CDF_MODULE_ID_HIF);
if (unlikely(NULL == hif))
CDF_ASSERT(hif != NULL);
else
rc = hif_napi_event(hif, event, data);
NAPI_DEBUG("<--[rc=%d]\n", rc);
return rc;
}
/**
* hdd_napi_poll() - NAPI poll function
* @napi : pointer to NAPI struct
* @budget: the pre-declared budget
*
* Implementation of poll function. This function is called
* by kernel during softirq processing.
*
* NOTE FOR THE MAINTAINER:
* Make sure this is very close to the ce_tasklet code.
*
* Return:
* int: the amount of work done ( <= budget )
*/
int hdd_napi_poll(struct napi_struct *napi, int budget)
{
return hif_napi_poll(napi, budget);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,292 +0,0 @@
/*
* Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __WLAN_HDD_OCB_H
#define __WLAN_HDD_OCB_H
#include <net/iw_handler.h>
#include "sir_api.h"
#define WLAN_OCB_CHANNEL_MAX 5
/**
* struct ocb_qos_params - QoS Parameters for each AC
* @aifsn: Arbitration Inter-Frame Spacing
* @cwmin: Contention Window (Min)
* @cwmax: Contention Window (Max)
*/
struct ocb_qos_params {
uint8_t aifsn;
uint8_t cwmin;
uint8_t cwmax;
};
/**
* struct ocb_channel - Parameters for each OCB channel
* @channel_freq: Channel Center Frequency (MHz)
* @duration: Channel Duration (ms)
* @start_guard_interval: Start Guard Interval (ms)
* @channel_bandwidth: Channel Bandwidth (MHz)
* @tx_power: Transmit Power (1/2 dBm)
* @tx_rate: Transmit Data Rate (mbit)
* @qos_params: Array of QoS Parameters
* @per_packet_rx_stats: Enable per packet RX statistics
*/
struct ocb_channel {
uint32_t channel_freq;
uint32_t duration;
uint32_t start_guard_interval;
uint32_t channel_bandwidth;
uint32_t tx_power;
uint32_t tx_rate;
struct ocb_qos_params qos_params[MAX_NUM_AC];
uint32_t per_packet_rx_stats;
};
/**
* struct dot11p_channel_sched - OCB channel schedule
* @num_channels: Number of channels
* @channels: Array of channel parameters
* @off_channel_tx: Enable off channel TX
*/
struct dot11p_channel_sched {
uint32_t num_channels;
struct ocb_channel channels[WLAN_OCB_CHANNEL_MAX];
uint32_t off_channel_tx;
};
/**
* enum qca_wlan_vendor_attr_ocb_set_config - vendor subcmd to set ocb config
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT:
* number of channels in the configuration
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE: size of the schedule
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY: array of channels
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY:
* array of channels to be scheduled
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY:
* array of NDL channel information
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY:
* array of NDL active state configuration
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS:
* flag to set the absolute expiry
*/
enum qca_wlan_vendor_attr_ocb_set_config {
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX =
QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_ocb_set_utc_time - vendor subcmd to set UTC time
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE:
* the UTC time as an array of 10 bytes
* @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR:
* the time error as an array of 5 bytes
*/
enum qca_wlan_vendor_attr_ocb_set_utc_time {
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE,
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR,
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX =
QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_ocb_start_timing_advert - vendor subcmd to start
sending timing advert
frames
* @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ:
* channel frequency on which to send the frames
* @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE:
* number of times the frame is sent in 5 seconds
*/
enum qca_wlan_vendor_attr_ocb_start_timing_advert {
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ,
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE,
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX =
QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_ocb_stop_timing_advert - vendor subcmd to stop
* timing advert
* @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ:
* the channel frequency on which to stop the timing advert
*/
enum qca_wlan_vendor_attr_ocb_stop_timing_advert {
QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ,
QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX =
QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_dcc_get_tsf_response - vendor subcmd to get TSF
* timer value
* @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH:
* higher 32 bits of the timer
* @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW:
* lower 32 bits of the timer
*/
enum qca_wlan_vendor_attr_ocb_get_tsf_resp {
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_MAX =
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_dcc_get_stats - vendor subcmd to get
* dcc stats
* @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT:
* the number of channels in the request array
* @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY
* array of the channel and information being requested
*/
enum qca_wlan_vendor_attr_dcc_get_stats {
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX =
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_dcc_get_stats_resp - response event from get
* dcc stats
* @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT:
* the number of channels in the request array
* @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY
* array of the information being requested
*/
enum qca_wlan_vendor_attr_dcc_get_stats_resp {
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_MAX =
QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_dcc_clear_stats - vendor subcmd to clear DCC stats
* @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP:
* mask of the type of stats to be cleared
*/
enum qca_wlan_vendor_attr_dcc_clear_stats {
QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP,
QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX =
QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST - 1,
};
/**
* enum qca_wlan_vendor_attr_ocb_set_config - vendor subcmd to update dcc
* @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT:
* number of channels in the configuration
* @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY: the array of NDL
* channel info
* @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY: the array of
* NDL active states
*/
enum qca_wlan_vendor_attr_dcc_update_ndl {
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT,
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY,
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY,
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX =
QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST - 1,
};
void hdd_set_dot11p_config(hdd_context_t *hdd_ctx);
void hdd_remove_ocb_tx_header(struct sk_buff *skb);
int iw_set_dot11p_channel_sched(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
void wlan_hdd_dcc_register_for_dcc_stats_event(hdd_context_t *hdd_ctx);
#endif /* __WLAN_HDD_OCB_H */

View File

@@ -1,811 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifdef FEATURE_OEM_DATA_SUPPORT
/**
* DOC: wlan_hdd_oemdata.c
*
* Support for generic OEM Data Request handling
*
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/wireless.h>
#include <wlan_hdd_includes.h>
#include <net/arp.h>
#include "qwlan_version.h"
#include "cds_utils.h"
#include "wma.h"
static struct hdd_context_s *p_hdd_ctx;
/**
* iw_get_oem_data_cap() - Get OEM Data Capabilities
* @dev: net device upon which the request was received
* @info: ioctl request information
* @wrqu: ioctl request data
* @extra: ioctl data payload
*
* This function gets the capability information for OEM Data Request
* and Response.
*
* Return: 0 for success, negative errno value on failure
*/
int iw_get_oem_data_cap(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
CDF_STATUS status;
t_iw_oem_data_cap oemDataCap;
t_iw_oem_data_cap *pHddOemDataCap;
hdd_adapter_t *pAdapter = (netdev_priv(dev));
hdd_context_t *pHddContext;
struct hdd_config *pConfig;
uint32_t numChannels;
uint8_t chanList[OEM_CAP_MAX_NUM_CHANNELS];
uint32_t i;
int ret;
ENTER();
pHddContext = WLAN_HDD_GET_CTX(pAdapter);
ret = wlan_hdd_validate_context(pHddContext);
if (0 != ret)
return ret;
pConfig = pHddContext->config;
if (!pConfig) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s:HDD configuration is null", __func__);
return -ENOENT;
}
do {
cdf_mem_zero(&oemDataCap, sizeof(oemDataCap));
strlcpy(oemDataCap.oem_target_signature, OEM_TARGET_SIGNATURE,
OEM_TARGET_SIGNATURE_LEN);
oemDataCap.oem_target_type = pHddContext->target_type;
oemDataCap.oem_fw_version = pHddContext->target_fw_version;
oemDataCap.driver_version.major = QWLAN_VERSION_MAJOR;
oemDataCap.driver_version.minor = QWLAN_VERSION_MINOR;
oemDataCap.driver_version.patch = QWLAN_VERSION_PATCH;
oemDataCap.driver_version.build = QWLAN_VERSION_BUILD;
oemDataCap.allowed_dwell_time_min =
pConfig->nNeighborScanMinChanTime;
oemDataCap.allowed_dwell_time_max =
pConfig->nNeighborScanMaxChanTime;
oemDataCap.curr_dwell_time_min =
sme_get_neighbor_scan_min_chan_time(pHddContext->hHal,
pAdapter->sessionId);
oemDataCap.curr_dwell_time_max =
sme_get_neighbor_scan_max_chan_time(pHddContext->hHal,
pAdapter->sessionId);
oemDataCap.supported_bands = pConfig->nBandCapability;
/* request for max num of channels */
numChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
status = sme_get_cfg_valid_channels(pHddContext->hHal,
&chanList[0], &numChannels);
if (CDF_STATUS_SUCCESS != status) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s:failed to get valid channel list",
__func__);
return -ENOENT;
} else {
/* make sure num channels is not more than chan list array */
if (numChannels > OEM_CAP_MAX_NUM_CHANNELS) {
CDF_TRACE(CDF_MODULE_ID_HDD,
CDF_TRACE_LEVEL_ERROR,
"%s:Num of channels(%d) more than length(%d) of chanlist",
__func__, numChannels,
OEM_CAP_MAX_NUM_CHANNELS);
return -ENOMEM;
}
oemDataCap.num_channels = numChannels;
for (i = 0; i < numChannels; i++) {
oemDataCap.channel_list[i] = chanList[i];
}
}
pHddOemDataCap = (t_iw_oem_data_cap *) (extra);
cdf_mem_copy(pHddOemDataCap, &oemDataCap,
sizeof(*pHddOemDataCap));
} while (0);
EXIT();
return 0;
}
/**
* send_oem_reg_rsp_nlink_msg() - send oem registration response
*
* This function sends oem message to registered application process
*
* Return: none
*/
static void send_oem_reg_rsp_nlink_msg(void)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
tAniMsgHdr *aniHdr;
uint8_t *buf;
uint8_t *numInterfaces;
uint8_t *deviceMode;
uint8_t *vdevId;
hdd_adapter_list_node_t *pAdapterNode = NULL;
hdd_adapter_list_node_t *pNext = NULL;
hdd_adapter_t *pAdapter = NULL;
CDF_STATUS status = 0;
/* OEM message is always to a specific process and cannot be a broadcast */
if (p_hdd_ctx->oem_pid == 0) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: invalid dest pid", __func__);
return;
}
skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
if (skb == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: alloc_skb failed", __func__);
return;
}
nlh = (struct nlmsghdr *)skb->data;
nlh->nlmsg_pid = 0; /* from kernel */
nlh->nlmsg_flags = 0;
nlh->nlmsg_seq = 0;
nlh->nlmsg_type = WLAN_NL_MSG_OEM;
aniHdr = NLMSG_DATA(nlh);
aniHdr->type = ANI_MSG_APP_REG_RSP;
/* Fill message body:
* First byte will be number of interfaces, followed by
* two bytes for each interfaces
* - one byte for device mode
* - one byte for vdev id
*/
buf = (char *)((char *)aniHdr + sizeof(tAniMsgHdr));
numInterfaces = buf++;
*numInterfaces = 0;
/* Iterate through each of the adapters and fill device mode and vdev id */
status = hdd_get_front_adapter(p_hdd_ctx, &pAdapterNode);
while ((CDF_STATUS_SUCCESS == status) && pAdapterNode) {
pAdapter = pAdapterNode->pAdapter;
if (pAdapter) {
deviceMode = buf++;
vdevId = buf++;
*deviceMode = pAdapter->device_mode;
*vdevId = pAdapter->sessionId;
(*numInterfaces)++;
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: numInterfaces: %d, deviceMode: %d, vdevId: %d",
__func__, *numInterfaces, *deviceMode,
*vdevId);
}
status = hdd_get_next_adapter(p_hdd_ctx, pAdapterNode, &pNext);
pAdapterNode = pNext;
}
aniHdr->length =
sizeof(uint8_t) + (*numInterfaces) * 2 * sizeof(uint8_t);
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: sending App Reg Response length (%d) to process pid (%d)",
__func__, aniHdr->length, p_hdd_ctx->oem_pid);
(void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT);
return;
}
/**
* send_oem_err_rsp_nlink_msg() - send oem error response
* @app_pid: PID of oem application process
* @error_code: response error code
*
* This function sends error response to oem app
*
* Return: none
*/
static void send_oem_err_rsp_nlink_msg(int32_t app_pid, uint8_t error_code)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
tAniMsgHdr *aniHdr;
uint8_t *buf;
skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
if (skb == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: alloc_skb failed", __func__);
return;
}
nlh = (struct nlmsghdr *)skb->data;
nlh->nlmsg_pid = 0; /* from kernel */
nlh->nlmsg_flags = 0;
nlh->nlmsg_seq = 0;
nlh->nlmsg_type = WLAN_NL_MSG_OEM;
aniHdr = NLMSG_DATA(nlh);
aniHdr->type = ANI_MSG_OEM_ERROR;
aniHdr->length = sizeof(uint8_t);
nlh->nlmsg_len = NLMSG_LENGTH(sizeof(tAniMsgHdr) + aniHdr->length);
/* message body will contain one byte of error code */
buf = (char *)((char *)aniHdr + sizeof(tAniMsgHdr));
*buf = error_code;
skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr) + aniHdr->length));
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: sending oem error response to process pid (%d)",
__func__, app_pid);
(void)nl_srv_ucast(skb, app_pid, MSG_DONTWAIT);
return;
}
/**
* hdd_send_oem_data_rsp_msg() - send oem data response
* @length: length of the OEM Data Response message
* @oemDataRsp: the actual OEM Data Response message
*
* This function sends an OEM Data Response message to a registered
* application process over the netlink socket.
*
* Return: 0 for success, non zero for failure
*/
void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
tAniMsgHdr *aniHdr;
uint8_t *oemData;
/* OEM message is always to a specific process and cannot be a broadcast */
if (p_hdd_ctx->oem_pid == 0) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: invalid dest pid", __func__);
return;
}
if (length > OEM_DATA_RSP_SIZE) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: invalid length of Oem Data response", __func__);
return;
}
skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + OEM_DATA_RSP_SIZE),
GFP_KERNEL);
if (skb == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: alloc_skb failed", __func__);
return;
}
nlh = (struct nlmsghdr *)skb->data;
nlh->nlmsg_pid = 0; /* from kernel */
nlh->nlmsg_flags = 0;
nlh->nlmsg_seq = 0;
nlh->nlmsg_type = WLAN_NL_MSG_OEM;
aniHdr = NLMSG_DATA(nlh);
aniHdr->type = ANI_MSG_OEM_DATA_RSP;
aniHdr->length = length;
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
oemData = (uint8_t *) ((char *)aniHdr + sizeof(tAniMsgHdr));
cdf_mem_copy(oemData, oemDataRsp, length);
skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: sending Oem Data Response of len (%d) to process pid (%d)",
__func__, length, p_hdd_ctx->oem_pid);
(void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT);
return;
}
/**
* oem_process_data_req_msg() - process oem data request
* @oemDataLen: Length to OEM Data buffer
* @oemData: Pointer to OEM Data buffer
*
* This function sends oem message to SME
*
* Return: CDF_STATUS enumeration
*/
static CDF_STATUS oem_process_data_req_msg(int oemDataLen, char *oemData)
{
hdd_adapter_t *pAdapter = NULL;
tOemDataReqConfig oemDataReqConfig;
uint32_t oemDataReqID = 0;
CDF_STATUS status = CDF_STATUS_SUCCESS;
/* for now, STA interface only */
pAdapter = hdd_get_adapter(p_hdd_ctx, WLAN_HDD_INFRA_STATION);
if (!pAdapter) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: No adapter for STA mode", __func__);
return CDF_STATUS_E_FAILURE;
}
if (!oemData) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: oemData is null", __func__);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_zero(&oemDataReqConfig, sizeof(tOemDataReqConfig));
oemDataReqConfig.data = cdf_mem_malloc(oemDataLen);
if (!oemDataReqConfig.data) {
hddLog(LOGE, FL("malloc failed for data req buffer"));
return CDF_STATUS_E_NOMEM;
}
oemDataReqConfig.data_len = oemDataLen;
cdf_mem_copy(oemDataReqConfig.data, oemData, oemDataLen);
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: calling sme_oem_data_req", __func__);
status = sme_oem_data_req(p_hdd_ctx->hHal,
pAdapter->sessionId,
&oemDataReqConfig,
&oemDataReqID);
cdf_mem_free(oemDataReqConfig.data);
oemDataReqConfig.data = NULL;
return status;
}
/**
* oem_process_channel_info_req_msg() - process oem channel_info request
* @numOfChannels: number of channels
* @chanList: list of channel information
*
* This function responds with channel info to oem process
*
* Return: 0 for success, non zero for failure
*/
static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
tAniMsgHdr *aniHdr;
tHddChannelInfo *pHddChanInfo;
tHddChannelInfo hddChanInfo;
uint8_t chanId;
uint32_t reg_info_1;
uint32_t reg_info_2;
CDF_STATUS status = CDF_STATUS_E_FAILURE;
int i;
uint8_t *buf;
/* OEM message is always to a specific process and cannot be a broadcast */
if (p_hdd_ctx->oem_pid == 0) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: invalid dest pid", __func__);
return -EPERM;
}
skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + sizeof(uint8_t) +
numOfChannels * sizeof(tHddChannelInfo)),
GFP_KERNEL);
if (skb == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: alloc_skb failed", __func__);
return -ENOMEM;
}
nlh = (struct nlmsghdr *)skb->data;
nlh->nlmsg_pid = 0; /* from kernel */
nlh->nlmsg_flags = 0;
nlh->nlmsg_seq = 0;
nlh->nlmsg_type = WLAN_NL_MSG_OEM;
aniHdr = NLMSG_DATA(nlh);
aniHdr->type = ANI_MSG_CHANNEL_INFO_RSP;
aniHdr->length =
sizeof(uint8_t) + numOfChannels * sizeof(tHddChannelInfo);
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
/* First byte of message body will have num of channels */
buf = (char *)((char *)aniHdr + sizeof(tAniMsgHdr));
*buf++ = numOfChannels;
/* Next follows channel info struct for each channel id.
* If chan id is wrong or SME returns failure for a channel
* then fill in 0 in channel info for that particular channel
*/
for (i = 0; i < numOfChannels; i++) {
pHddChanInfo = (tHddChannelInfo *) ((char *)buf +
i *
sizeof(tHddChannelInfo));
chanId = chanList[i];
status = sme_get_reg_info(p_hdd_ctx->hHal, chanId,
&reg_info_1, &reg_info_2);
if (CDF_STATUS_SUCCESS == status) {
/* copy into hdd chan info struct */
hddChanInfo.chan_id = chanId;
hddChanInfo.reserved0 = 0;
hddChanInfo.mhz = cds_chan_to_freq(chanId);
hddChanInfo.band_center_freq1 = hddChanInfo.mhz;
hddChanInfo.band_center_freq2 = 0;
hddChanInfo.info = 0;
if (CHANNEL_STATE_DFS ==
cds_get_channel_state(chanId))
WMI_SET_CHANNEL_FLAG(&hddChanInfo,
WMI_CHAN_FLAG_DFS);
hddChanInfo.reg_info_1 = reg_info_1;
hddChanInfo.reg_info_2 = reg_info_2;
} else {
/* channel info is not returned, fill in zeros in channel
* info struct
*/
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: sme_get_reg_info failed for chan (%d), return info 0",
__func__, chanId);
hddChanInfo.chan_id = chanId;
hddChanInfo.reserved0 = 0;
hddChanInfo.mhz = 0;
hddChanInfo.band_center_freq1 = 0;
hddChanInfo.band_center_freq2 = 0;
hddChanInfo.info = 0;
hddChanInfo.reg_info_1 = 0;
hddChanInfo.reg_info_2 = 0;
}
cdf_mem_copy(pHddChanInfo, &hddChanInfo,
sizeof(tHddChannelInfo));
}
skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: sending channel info resp for num channels (%d) to pid (%d)",
__func__, numOfChannels, p_hdd_ctx->oem_pid);
(void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT);
return 0;
}
/**
* hdd_send_peer_status_ind_to_oem_app() -
* Function to send peer status to a registered application
* @peerMac: MAC address of peer
* @peerStatus: ePeerConnected or ePeerDisconnected
* @peerTimingMeasCap: 0: RTT/RTT2, 1: RTT3. Default is 0
* @sessionId: SME session id, i.e. vdev_id
* @chan_info: operating channel information
*
* Return: none
*/
void hdd_send_peer_status_ind_to_oem_app(struct cdf_mac_addr *peerMac,
uint8_t peerStatus,
uint8_t peerTimingMeasCap,
uint8_t sessionId,
tSirSmeChanInfo *chan_info)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
tAniMsgHdr *aniHdr;
tPeerStatusInfo *pPeerInfo;
if (!p_hdd_ctx || !p_hdd_ctx->hHal) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Either HDD Ctx is null or Hal Ctx is null",
__func__);
return;
}
/* check if oem app has registered and pid is valid */
if ((!p_hdd_ctx->oem_app_registered) || (p_hdd_ctx->oem_pid == 0)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO_HIGH,
"%s: OEM app is not registered(%d) or pid is invalid(%d)",
__func__, p_hdd_ctx->oem_app_registered,
p_hdd_ctx->oem_pid);
return;
}
skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) +
sizeof(tPeerStatusInfo)),
GFP_KERNEL);
if (skb == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: alloc_skb failed", __func__);
return;
}
nlh = (struct nlmsghdr *)skb->data;
nlh->nlmsg_pid = 0; /* from kernel */
nlh->nlmsg_flags = 0;
nlh->nlmsg_seq = 0;
nlh->nlmsg_type = WLAN_NL_MSG_OEM;
aniHdr = NLMSG_DATA(nlh);
aniHdr->type = ANI_MSG_PEER_STATUS_IND;
aniHdr->length = sizeof(tPeerStatusInfo);
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
pPeerInfo = (tPeerStatusInfo *) ((char *)aniHdr + sizeof(tAniMsgHdr));
cdf_mem_copy(pPeerInfo->peer_mac_addr, peerMac->bytes,
sizeof(peerMac->bytes));
pPeerInfo->peer_status = peerStatus;
pPeerInfo->vdev_id = sessionId;
pPeerInfo->peer_capability = peerTimingMeasCap;
pPeerInfo->reserved0 = 0;
if (chan_info) {
pPeerInfo->peer_chan_info.chan_id = chan_info->chan_id;
pPeerInfo->peer_chan_info.reserved0 = 0;
pPeerInfo->peer_chan_info.mhz = chan_info->mhz;
pPeerInfo->peer_chan_info.band_center_freq1 =
chan_info->band_center_freq1;
pPeerInfo->peer_chan_info.band_center_freq2 =
chan_info->band_center_freq2;
pPeerInfo->peer_chan_info.info = chan_info->info;
pPeerInfo->peer_chan_info.reg_info_1 = chan_info->reg_info_1;
pPeerInfo->peer_chan_info.reg_info_2 = chan_info->reg_info_2;
} else {
pPeerInfo->peer_chan_info.chan_id = 0;
pPeerInfo->peer_chan_info.reserved0 = 0;
pPeerInfo->peer_chan_info.mhz = 0;
pPeerInfo->peer_chan_info.band_center_freq1 = 0;
pPeerInfo->peer_chan_info.band_center_freq2 = 0;
pPeerInfo->peer_chan_info.info = 0;
pPeerInfo->peer_chan_info.reg_info_1 = 0;
pPeerInfo->peer_chan_info.reg_info_2 = 0;
}
skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO_HIGH,
"%s: sending peer " MAC_ADDRESS_STR
" status(%d), peerTimingMeasCap(%d), vdevId(%d), chanId(%d)"
" to oem app pid(%d), center freq 1 (%d), center freq 2 (%d),"
" info (0x%x), frequency (%d),reg info 1 (0x%x),"
" reg info 2 (0x%x)", __func__,
MAC_ADDR_ARRAY(peerMac->bytes),
peerStatus, peerTimingMeasCap,
sessionId, pPeerInfo->peer_chan_info.chan_id,
p_hdd_ctx->oem_pid,
pPeerInfo->peer_chan_info.band_center_freq1,
pPeerInfo->peer_chan_info.band_center_freq2,
pPeerInfo->peer_chan_info.info,
pPeerInfo->peer_chan_info.mhz,
pPeerInfo->peer_chan_info.reg_info_1,
pPeerInfo->peer_chan_info.reg_info_2);
(void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT);
return;
}
/*
* Callback function invoked by Netlink service for all netlink
* messages (from user space) addressed to WLAN_NL_MSG_OEM
*/
/**
* oem_msg_callback() - callback invoked by netlink service
* @skb: skb with netlink message
*
* This function gets invoked by netlink service when a message
* is received from user space addressed to WLAN_NL_MSG_OEM
*
* Return: zero on success
* On error, error number will be returned.
*/
static int oem_msg_callback(struct sk_buff *skb)
{
struct nlmsghdr *nlh;
tAniMsgHdr *msg_hdr;
int ret;
char *sign_str = NULL;
nlh = (struct nlmsghdr *)skb->data;
if (!nlh) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Netlink header null", __func__);
return -EPERM;
}
ret = wlan_hdd_validate_context(p_hdd_ctx);
if (0 != ret) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
FL("HDD context is not valid"));
return ret;
}
msg_hdr = NLMSG_DATA(nlh);
if (!msg_hdr) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Message header null", __func__);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_NULL_MESSAGE_HEADER);
return -EPERM;
}
if (nlh->nlmsg_len <
NLMSG_LENGTH(sizeof(tAniMsgHdr) + msg_hdr->length)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Invalid nl msg len, nlh->nlmsg_len (%d), msg_hdr->len (%d)",
__func__, nlh->nlmsg_len, msg_hdr->length);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_INVALID_MESSAGE_LENGTH);
return -EPERM;
}
switch (msg_hdr->type) {
case ANI_MSG_APP_REG_REQ:
/* Registration request is only allowed for Qualcomm Application */
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: Received App Req Req from App process pid(%d), len(%d)",
__func__, nlh->nlmsg_pid, msg_hdr->length);
sign_str = (char *)((char *)msg_hdr + sizeof(tAniMsgHdr));
if ((OEM_APP_SIGNATURE_LEN == msg_hdr->length) &&
(0 == strncmp(sign_str, OEM_APP_SIGNATURE_STR,
OEM_APP_SIGNATURE_LEN))) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: Valid App Req Req from oem app process pid(%d)",
__func__, nlh->nlmsg_pid);
p_hdd_ctx->oem_app_registered = true;
p_hdd_ctx->oem_pid = nlh->nlmsg_pid;
send_oem_reg_rsp_nlink_msg();
} else {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Invalid signature in App Reg Request from pid(%d)",
__func__, nlh->nlmsg_pid);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_INVALID_SIGNATURE);
return -EPERM;
}
break;
case ANI_MSG_OEM_DATA_REQ:
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: Received Oem Data Request length(%d) from pid: %d",
__func__, msg_hdr->length, nlh->nlmsg_pid);
if ((!p_hdd_ctx->oem_app_registered) ||
(nlh->nlmsg_pid != p_hdd_ctx->oem_pid)) {
/* either oem app is not registered yet or pid is different */
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: OEM DataReq: app not registered(%d) or incorrect pid(%d)",
__func__, p_hdd_ctx->oem_app_registered,
nlh->nlmsg_pid);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_APP_NOT_REGISTERED);
return -EPERM;
}
if ((!msg_hdr->length) || (OEM_DATA_REQ_SIZE < msg_hdr->length)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Invalid length (%d) in Oem Data Request",
__func__, msg_hdr->length);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_INVALID_MESSAGE_LENGTH);
return -EPERM;
}
oem_process_data_req_msg(msg_hdr->length,
(char *)((char *)msg_hdr +
sizeof(tAniMsgHdr)));
break;
case ANI_MSG_CHANNEL_INFO_REQ:
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO,
"%s: Received channel info request, num channel(%d) from pid: %d",
__func__, msg_hdr->length, nlh->nlmsg_pid);
if ((!p_hdd_ctx->oem_app_registered) ||
(nlh->nlmsg_pid != p_hdd_ctx->oem_pid)) {
/* either oem app is not registered yet or pid is different */
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Chan InfoReq: app not registered(%d) or incorrect pid(%d)",
__func__, p_hdd_ctx->oem_app_registered,
nlh->nlmsg_pid);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_APP_NOT_REGISTERED);
return -EPERM;
}
/* message length contains list of channel ids */
if ((!msg_hdr->length) ||
(WNI_CFG_VALID_CHANNEL_LIST_LEN < msg_hdr->length)) {
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Invalid length (%d) in channel info request",
__func__, msg_hdr->length);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_INVALID_MESSAGE_LENGTH);
return -EPERM;
}
oem_process_channel_info_req_msg(msg_hdr->length,
(char *)((char *)msg_hdr +
sizeof(tAniMsgHdr)));
break;
default:
CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
"%s: Received Invalid message type (%d), length (%d)",
__func__, msg_hdr->type, msg_hdr->length);
send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
OEM_ERR_INVALID_MESSAGE_TYPE);
return -EPERM;
}
return 0;
}
static int __oem_msg_callback(struct sk_buff *skb)
{
int ret;
cds_ssr_protect(__func__);
ret = oem_msg_callback(skb);
cds_ssr_unprotect(__func__);
return ret;
}
/**
* oem_activate_service() - Activate oem message handler
* @hdd_ctx: pointer to global HDD context
*
* This function registers a handler to receive netlink message from
* an OEM application process.
*
* Return: zero on success
* On error, error number will be returned.
*/
int oem_activate_service(struct hdd_context_s *hdd_ctx)
{
p_hdd_ctx = hdd_ctx;
/* Register the msg handler for msgs addressed to WLAN_NL_MSG_OEM */
return nl_srv_register(WLAN_NL_MSG_OEM, __oem_msg_callback);
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC : wlan_hdd_scan.h
*
* WLAN Host Device Driver scan related implementation
*
*/
#if !defined(WLAN_HDD_SCAN_H)
#define WLAN_HDD_SCAN_H
#include "wlan_hdd_main.h"
#define MAX_PENDING_LOG 5
/*
* enum scan_source - scan request source
*
* @NL_SCAN: Scan initiated from NL
* @VENDOR_SCAN: Scan intiated from vendor command
*/
enum scan_source {
NL_SCAN,
VENDOR_SCAN,
};
int iw_get_scan(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
struct cfg80211_scan_request *request);
#ifdef FEATURE_WLAN_SCAN_PNO
int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_sched_scan_request
*request);
int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
struct net_device *dev);
#endif /* End of FEATURE_WLAN_SCAN_PNO */
int wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data,
int data_len);
int hdd_vendor_put_ifindex(struct sk_buff *skb, int ifindex);
#endif /* end #if !defined(WLAN_HDD_SCAN_H) */

View File

@@ -1,919 +0,0 @@
/*
* Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/* Include files */
#include <linux/semaphore.h>
#include <wlan_hdd_tx_rx.h>
#include <wlan_hdd_softap_tx_rx.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/etherdevice.h>
#include <cdf_types.h>
#include <ani_global.h>
#include <cdf_types.h>
#include <net/ieee80211_radiotap.h>
#include <cds_sched.h>
#include <wlan_hdd_napi.h>
#ifdef IPA_OFFLOAD
#include <wlan_hdd_ipa.h>
#endif
/* Preprocessor definitions and constants */
#undef QCA_HDD_SAP_DUMP_SK_BUFF
/* Type declarations */
/* Function definitions and documenation */
#ifdef QCA_HDD_SAP_DUMP_SK_BUFF
/**
* hdd_softap_dump_sk_buff() - Dump an skb
* @skb: skb to dump
*
* Return: None
*/
static void hdd_softap_dump_sk_buff(struct sk_buff *skb)
{
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: head = %p ", __func__, skb->head);
/* CDF_TRACE( CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,"%s: data = %p ", __func__, skb->data); */
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: tail = %p ", __func__, skb->tail);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: end = %p ", __func__, skb->end);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: len = %d ", __func__, skb->len);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: data_len = %d ", __func__, skb->data_len);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: mac_len = %d", __func__, skb->mac_len);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x ", skb->data[0],
skb->data[1], skb->data[2], skb->data[3], skb->data[4],
skb->data[5], skb->data[6], skb->data[7]);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", skb->data[8],
skb->data[9], skb->data[10], skb->data[11], skb->data[12],
skb->data[13], skb->data[14], skb->data[15]);
}
#else
static void hdd_softap_dump_sk_buff(struct sk_buff *skb)
{
}
#endif
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
/**
* hdd_softap_tx_resume_timer_expired_handler() - TX Q resume timer handler
* @adapter_context: pointer to vdev adapter
*
* TX Q resume timer handler for SAP and P2P GO interface. If Blocked
* OS Q is not resumed during timeout period, to prevent permanent
* stall, resume OS Q forcefully for SAP and P2P GO interface.
*
* Return: None
*/
void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context)
{
hdd_adapter_t *pAdapter = (hdd_adapter_t *) adapter_context;
if (!pAdapter) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: INV ARG", __func__);
/* INVALID ARG */
return;
}
hddLog(LOG1, FL("Enabling queues"));
wlan_hdd_netif_queue_control(pAdapter, WLAN_WAKE_ALL_NETIF_QUEUE,
WLAN_CONTROL_PATH);
return;
}
/**
* hdd_softap_tx_resume_cb() - Resume OS TX Q.
* @adapter_context: pointer to vdev apdapter
* @tx_resume: TX Q resume trigger
*
* Q was stopped due to WLAN TX path low resource condition
*
* Return: None
*/
void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume)
{
hdd_adapter_t *pAdapter = (hdd_adapter_t *) adapter_context;
if (!pAdapter) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: INV ARG", __func__);
/* INVALID ARG */
return;
}
/* Resume TX */
if (true == tx_resume) {
if (CDF_TIMER_STATE_STOPPED !=
cdf_mc_timer_get_current_state(&pAdapter->
tx_flow_control_timer)) {
cdf_mc_timer_stop(&pAdapter->tx_flow_control_timer);
}
hddLog(LOG1, FL("Enabling queues"));
wlan_hdd_netif_queue_control(pAdapter,
WLAN_WAKE_ALL_NETIF_QUEUE,
WLAN_DATA_FLOW_CONTROL);
}
return;
}
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
/**
* hdd_softap_hard_start_xmit() - Transmit a frame
* @skb: pointer to OS packet (sk_buff)
* @dev: pointer to network device
*
* Function registered with the Linux OS for transmitting
* packets. This version of the function directly passes
* the packet to Transport Layer.
*
* Return: Always returns NETDEV_TX_OK
*/
int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
sme_ac_enum_type ac = SME_AC_BE;
hdd_adapter_t *pAdapter = (hdd_adapter_t *) netdev_priv(dev);
hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
struct cdf_mac_addr *pDestMacAddress;
uint8_t STAId;
uint8_t proto_type = 0;
#ifdef QCA_PKT_PROTO_TRACE
hdd_context_t *hddCtxt = (hdd_context_t *) pAdapter->pHddCtx;
#endif /* QCA_PKT_PROTO_TRACE */
++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
/* Prevent this function from being called during SSR since TL
* context may not be reinitialized at this time which may
* lead to a crash.
*/
if (cds_is_driver_recovering()) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO_HIGH,
"%s: Recovery in Progress. Ignore!!!", __func__);
goto drop_pkt;
}
/*
* If the device is operating on a DFS Channel
* then check if SAP is in CAC WAIT state and
* drop the packets. In CAC WAIT state device
* is expected not to transmit any frames.
* SAP starts Tx only after the BSS START is
* done.
*/
if (pHddApCtx->dfs_cac_block_tx) {
goto drop_pkt;
}
pDestMacAddress = (struct cdf_mac_addr *) skb->data;
if (cdf_is_macaddr_broadcast(pDestMacAddress) ||
cdf_is_macaddr_group(pDestMacAddress)) {
/* The BC/MC station ID is assigned during BSS
* starting phase. SAP will return the station ID
* used for BC/MC traffic.
*/
STAId = pHddApCtx->uBCStaId;
} else {
if (CDF_STATUS_SUCCESS !=
hdd_softap_get_sta_id(pAdapter,
pDestMacAddress, &STAId)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_WARN,
"%s: Failed to find right station", __func__);
goto drop_pkt;
}
if (STAId == HDD_WLAN_INVALID_STA_ID) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_WARN,
"%s: Failed to find right station", __func__);
goto drop_pkt;
} else if (false == pAdapter->aStaInfo[STAId].isUsed) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_WARN,
"%s: STA %d is unregistered", __func__,
STAId);
goto drop_pkt;
}
if ((ol_txrx_peer_state_conn !=
pAdapter->aStaInfo[STAId].tlSTAState)
&& (ol_txrx_peer_state_auth !=
pAdapter->aStaInfo[STAId].tlSTAState)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_WARN,
"%s: Station not connected yet", __func__);
goto drop_pkt;
} else if (ol_txrx_peer_state_conn ==
pAdapter->aStaInfo[STAId].tlSTAState) {
if (ntohs(skb->protocol) != HDD_ETHERTYPE_802_1_X) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_WARN,
"%s: NON-EAPOL packet in non-Authenticated state",
__func__);
goto drop_pkt;
}
}
}
hdd_get_tx_resource(pAdapter, STAId,
WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
/* Get TL AC corresponding to Qdisc queue index/AC. */
ac = hdd_qdisc_ac_to_tl_ac[skb->queue_mapping];
++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
#if defined (IPA_OFFLOAD)
if (!(NBUF_OWNER_ID(skb) == IPA_NBUF_OWNER_ID)) {
#endif
/* Check if the buffer has enough header room */
skb = skb_unshare(skb, GFP_ATOMIC);
if (!skb)
goto drop_pkt_accounting;
if (skb_headroom(skb) < dev->hard_header_len) {
struct sk_buff *tmp;
tmp = skb;
skb = skb_realloc_headroom(tmp, dev->hard_header_len);
dev_kfree_skb(tmp);
if (!skb)
goto drop_pkt_accounting;
}
#if defined (IPA_OFFLOAD)
}
#endif
wlan_hdd_log_eapol(skb,
WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED);
#ifdef QCA_PKT_PROTO_TRACE
if ((hddCtxt->config->gEnableDebugLog & CDS_PKT_TRAC_TYPE_EAPOL) ||
(hddCtxt->config->gEnableDebugLog & CDS_PKT_TRAC_TYPE_DHCP)) {
/* Proto Trace enabled */
proto_type = cds_pkt_get_proto_type(skb,
hddCtxt->config->
gEnableDebugLog, 0);
if (CDS_PKT_TRAC_TYPE_EAPOL & proto_type) {
cds_pkt_trace_buf_update("HA:T:EPL");
} else if (CDS_PKT_TRAC_TYPE_DHCP & proto_type) {
cds_pkt_trace_buf_update("HA:T:DHC");
}
}
#endif /* QCA_PKT_PROTO_TRACE */
pAdapter->stats.tx_bytes += skb->len;
++pAdapter->stats.tx_packets;
/* Zero out skb's context buffer for the driver to use */
cdf_mem_set(skb->cb, sizeof(skb->cb), 0);
NBUF_SET_PACKET_TRACK(skb, NBUF_TX_PKT_DATA_TRACK);
NBUF_UPDATE_TX_PKT_COUNT(skb, NBUF_TX_PKT_HDD);
cdf_dp_trace_set_track(skb);
DPTRACE(cdf_dp_trace(skb, CDF_DP_TRACE_HDD_PACKET_PTR_RECORD,
(uint8_t *)skb->data, sizeof(skb->data)));
DPTRACE(cdf_dp_trace(skb, CDF_DP_TRACE_HDD_PACKET_RECORD,
(uint8_t *)skb->data, cdf_nbuf_len(skb)));
if (cdf_nbuf_len(skb) > CDF_DP_TRACE_RECORD_SIZE)
DPTRACE(cdf_dp_trace(skb, CDF_DP_TRACE_HDD_PACKET_RECORD,
(uint8_t *)&skb->data[CDF_DP_TRACE_RECORD_SIZE],
(cdf_nbuf_len(skb)-CDF_DP_TRACE_RECORD_SIZE)));
if (ol_tx_send_data_frame(STAId, skb,
proto_type) != NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_WARN,
"%s: Failed to send packet to txrx for staid:%d",
__func__, STAId);
++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
goto drop_pkt;
}
dev->trans_start = jiffies;
return NETDEV_TX_OK;
drop_pkt:
DPTRACE(cdf_dp_trace(skb, CDF_DP_TRACE_DROP_PACKET_RECORD,
(uint8_t *)skb->data, cdf_nbuf_len(skb)));
if (cdf_nbuf_len(skb) > CDF_DP_TRACE_RECORD_SIZE)
DPTRACE(cdf_dp_trace(skb, CDF_DP_TRACE_DROP_PACKET_RECORD,
(uint8_t *)&skb->data[CDF_DP_TRACE_RECORD_SIZE],
(cdf_nbuf_len(skb)-CDF_DP_TRACE_RECORD_SIZE)));
kfree_skb(skb);
drop_pkt_accounting:
++pAdapter->stats.tx_dropped;
++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
return NETDEV_TX_OK;
}
/**
* __hdd_softap_tx_timeout() - TX timeout handler
* @dev: pointer to network device
*
* This function is registered as a netdev ndo_tx_timeout method, and
* is invoked by the kernel if the driver takes too long to transmit a
* frame.
*
* Return: None
*/
static void __hdd_softap_tx_timeout(struct net_device *dev)
{
hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *hdd_ctx;
DPTRACE(cdf_dp_trace(NULL, CDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
NULL, 0));
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Transmission timeout occurred", __func__);
/* Getting here implies we disabled the TX queues for too
* long. Queues are disabled either because of disassociation
* or low resource scenarios. In case of disassociation it is
* ok to ignore this. But if associated, we have do possible
* recovery here
*/
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
if (cds_is_driver_recovering()) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Recovery in Progress. Ignore!!!", __func__);
return;
}
}
/**
* hdd_softap_tx_timeout() - SSR wrapper for __hdd_softap_tx_timeout
* @dev: pointer to net_device
*
* Return: none
*/
void hdd_softap_tx_timeout(struct net_device *dev)
{
cds_ssr_protect(__func__);
__hdd_softap_tx_timeout(dev);
cds_ssr_unprotect(__func__);
}
/**
* @hdd_softap_init_tx_rx() - Initialize Tx/RX module
* @pAdapter: pointer to adapter context
*
* Return: CDF_STATUS_E_FAILURE if any errors encountered,
* CDF_STATUS_SUCCESS otherwise
*/
CDF_STATUS hdd_softap_init_tx_rx(hdd_adapter_t *pAdapter)
{
CDF_STATUS status = CDF_STATUS_SUCCESS;
uint8_t STAId = 0;
cdf_mem_zero(&pAdapter->stats, sizeof(struct net_device_stats));
spin_lock_init(&pAdapter->staInfo_lock);
for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++) {
cdf_mem_zero(&pAdapter->aStaInfo[STAId],
sizeof(hdd_station_info_t));
}
return status;
}
/**
* @hdd_softap_deinit_tx_rx() - Deinitialize Tx/RX module
* @pAdapter: pointer to adapter context
*
* Return: CDF_STATUS_E_FAILURE if any errors encountered,
* CDF_STATUS_SUCCESS otherwise
*/
CDF_STATUS hdd_softap_deinit_tx_rx(hdd_adapter_t *pAdapter)
{
CDF_STATUS status = CDF_STATUS_SUCCESS;
return status;
}
/**
* hdd_softap_init_tx_rx_sta() - Initialize tx/rx for a softap station
* @pAdapter: pointer to adapter context
* @STAId: Station ID to initialize
* @pmacAddrSTA: pointer to the MAC address of the station
*
* Return: CDF_STATUS_E_FAILURE if any errors encountered,
* CDF_STATUS_SUCCESS otherwise
*/
CDF_STATUS hdd_softap_init_tx_rx_sta(hdd_adapter_t *pAdapter, uint8_t STAId,
struct cdf_mac_addr *pmacAddrSTA)
{
spin_lock_bh(&pAdapter->staInfo_lock);
if (pAdapter->aStaInfo[STAId].isUsed) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Reinit station %d", __func__, STAId);
spin_unlock_bh(&pAdapter->staInfo_lock);
return CDF_STATUS_E_FAILURE;
}
cdf_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
pAdapter->aStaInfo[STAId].isUsed = true;
pAdapter->aStaInfo[STAId].isDeauthInProgress = false;
cdf_copy_macaddr(&pAdapter->aStaInfo[STAId].macAddrSTA, pmacAddrSTA);
spin_unlock_bh(&pAdapter->staInfo_lock);
return CDF_STATUS_SUCCESS;
}
/**
* hdd_softap_deinit_tx_rx_sta() - Deinitialize tx/rx for a softap station
* @pAdapter: pointer to adapter context
* @STAId: Station ID to deinitialize
*
* Return: CDF_STATUS_E_FAILURE if any errors encountered,
* CDF_STATUS_SUCCESS otherwise
*/
CDF_STATUS hdd_softap_deinit_tx_rx_sta(hdd_adapter_t *pAdapter, uint8_t STAId)
{
CDF_STATUS status = CDF_STATUS_SUCCESS;
hdd_hostapd_state_t *pHostapdState;
pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
spin_lock_bh(&pAdapter->staInfo_lock);
if (false == pAdapter->aStaInfo[STAId].isUsed) {
spin_unlock_bh(&pAdapter->staInfo_lock);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Deinit station not inited %d", __func__, STAId);
return CDF_STATUS_E_FAILURE;
}
pAdapter->aStaInfo[STAId].isUsed = false;
pAdapter->aStaInfo[STAId].isDeauthInProgress = false;
spin_unlock_bh(&pAdapter->staInfo_lock);
return status;
}
/**
* hdd_softap_rx_packet_cbk() - Receive packet handler
* @cds_context: pointer to CDS context
* @rxBuf: pointer to rx cdf_nbuf
* @staId: Station Id
*
* Receive callback registered with TL. TL will call this to notify
* the HDD when one or more packets were received for a registered
* STA.
*
* Return: CDF_STATUS_E_FAILURE if any errors encountered,
* CDF_STATUS_SUCCESS otherwise
*/
CDF_STATUS hdd_softap_rx_packet_cbk(void *cds_context,
cdf_nbuf_t rxBuf, uint8_t staId)
{
hdd_adapter_t *pAdapter = NULL;
int rxstat;
unsigned int cpu_index;
struct sk_buff *skb = NULL;
hdd_context_t *pHddCtx = NULL;
#ifdef QCA_PKT_PROTO_TRACE
uint8_t proto_type;
#endif /* QCA_PKT_PROTO_TRACE */
/* Sanity check on inputs */
if ((NULL == cds_context) || (NULL == rxBuf)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Null params being passed", __func__);
return CDF_STATUS_E_FAILURE;
}
pHddCtx = cds_get_context(CDF_MODULE_ID_HDD);
if (NULL == pHddCtx) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: HDD context is Null", __func__);
return CDF_STATUS_E_FAILURE;
}
pAdapter = pHddCtx->sta_to_adapter[staId];
if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
hddLog(LOGE,
FL("invalid adapter %p or adapter has invalid magic"),
pAdapter);
return CDF_STATUS_E_FAILURE;
}
/* walk the chain until all are processed */
skb = (struct sk_buff *)rxBuf;
hdd_softap_dump_sk_buff(skb);
skb->dev = pAdapter->dev;
if (skb->dev == NULL) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: ERROR!!Invalid netdevice", __func__);
return CDF_STATUS_E_FAILURE;
}
cpu_index = wlan_hdd_get_cpu();
++pAdapter->hdd_stats.hddTxRxStats.rxPackets[cpu_index];
++pAdapter->stats.rx_packets;
pAdapter->stats.rx_bytes += skb->len;
wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED);
#ifdef QCA_PKT_PROTO_TRACE
if ((pHddCtx->config->gEnableDebugLog & CDS_PKT_TRAC_TYPE_EAPOL) ||
(pHddCtx->config->gEnableDebugLog & CDS_PKT_TRAC_TYPE_DHCP)) {
proto_type = cds_pkt_get_proto_type(skb,
pHddCtx->config->
gEnableDebugLog, 0);
if (CDS_PKT_TRAC_TYPE_EAPOL & proto_type) {
cds_pkt_trace_buf_update("HA:R:EPL");
} else if (CDS_PKT_TRAC_TYPE_DHCP & proto_type) {
cds_pkt_trace_buf_update("HA:R:DHC");
}
}
#endif /* QCA_PKT_PROTO_TRACE */
skb->protocol = eth_type_trans(skb, skb->dev);
#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
cdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock,
HDD_WAKE_LOCK_DURATION,
WIFI_POWER_EVENT_WAKELOCK_HOLD_RX);
#endif
/* Remove SKB from internal tracking table before submitting
* it to stack
*/
cdf_net_buf_debug_release_skb(rxBuf);
if (hdd_napi_enabled(HDD_NAPI_ANY) && !pHddCtx->config->enableRxThread)
rxstat = netif_receive_skb(skb);
else
rxstat = netif_rx_ni(skb);
if (NET_RX_SUCCESS == rxstat) {
++pAdapter->hdd_stats.hddTxRxStats.rxDelivered[cpu_index];
} else {
++pAdapter->hdd_stats.hddTxRxStats.rxRefused[cpu_index];
}
pAdapter->dev->last_rx = jiffies;
return CDF_STATUS_SUCCESS;
}
/**
* hdd_softap_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
* @pAdapter: pointer to adapter context
* @staId: Station ID to deregister
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
{
CDF_STATUS cdf_status = CDF_STATUS_SUCCESS;
hdd_context_t *pHddCtx;
if (NULL == pAdapter) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: pAdapter is NULL", __func__);
return CDF_STATUS_E_INVAL;
}
if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Invalid pAdapter magic", __func__);
return CDF_STATUS_E_INVAL;
}
pHddCtx = (hdd_context_t *) (pAdapter->pHddCtx);
/* Clear station in TL and then update HDD data
* structures. This helps to block RX frames from other
* station to this station.
*/
cdf_status = ol_txrx_clear_peer(staId);
if (!CDF_IS_STATUS_SUCCESS(cdf_status)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"ol_txrx_clear_peer() failed to for staID %d. "
"Status= %d [0x%08X]", staId, cdf_status, cdf_status);
}
if (pAdapter->aStaInfo[staId].isUsed) {
spin_lock_bh(&pAdapter->staInfo_lock);
cdf_mem_zero(&pAdapter->aStaInfo[staId],
sizeof(hdd_station_info_t));
spin_unlock_bh(&pAdapter->staInfo_lock);
}
pHddCtx->sta_to_adapter[staId] = NULL;
return cdf_status;
}
/**
* hdd_softap_register_sta() - Register a SoftAP STA
* @pAdapter: pointer to adapter context
* @fAuthRequired: is additional authentication required?
* @fPrivacyBit: should 802.11 privacy bit be set?
* @staId: station ID assigned to this station
* @ucastSig: unicast security signature
* @bcastSig: broadcast security signature
* @pPeerMacAddress: station MAC address
* @fWmmEnabled: is WMM enabled for this STA?
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_register_sta(hdd_adapter_t *pAdapter,
bool fAuthRequired,
bool fPrivacyBit,
uint8_t staId,
uint8_t ucastSig,
uint8_t bcastSig,
struct cdf_mac_addr *pPeerMacAddress,
bool fWmmEnabled)
{
CDF_STATUS cdf_status = CDF_STATUS_E_FAILURE;
struct ol_txrx_desc_type staDesc = { 0 };
hdd_context_t *pHddCtx = pAdapter->pHddCtx;
/*
* Clean up old entry if it is not cleaned up properly
*/
if (pAdapter->aStaInfo[staId].isUsed) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"clean up old entry for STA %d", staId);
hdd_softap_deregister_sta(pAdapter, staId);
}
/* Get the Station ID from the one saved during the assocation. */
staDesc.sta_id = staId;
/*Save the pAdapter Pointer for this staId */
pHddCtx->sta_to_adapter[staId] = pAdapter;
cdf_status =
hdd_softap_init_tx_rx_sta(pAdapter, staId,
pPeerMacAddress);
staDesc.is_qos_enabled = fWmmEnabled;
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"HDD SOFTAP register TL QoS_enabled=%d",
staDesc.is_qos_enabled);
cdf_status =
ol_txrx_register_peer(hdd_softap_rx_packet_cbk,
&staDesc);
if (!CDF_IS_STATUS_SUCCESS(cdf_status)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"SOFTAP ol_txrx_register_peer() failed to register. Status= %d [0x%08X]",
cdf_status, cdf_status);
return cdf_status;
}
/* if ( WPA ), tell TL to go to 'connected' and after keys come to the
* driver then go to 'authenticated'. For all other authentication
* types (those that do not require upper layer authentication) we can
* put TL directly into 'authenticated' state
*/
pAdapter->aStaInfo[staId].ucSTAId = staId;
pAdapter->aStaInfo[staId].isQosEnabled = fWmmEnabled;
if (!fAuthRequired) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time",
pAdapter->aStaInfo[staId].ucSTAId);
/* Connections that do not need Upper layer auth,
* transition TL directly to 'Authenticated' state.
*/
cdf_status = hdd_change_peer_state(pAdapter, staDesc.sta_id,
ol_txrx_peer_state_auth, false);
pAdapter->aStaInfo[staId].tlSTAState = ol_txrx_peer_state_auth;
pAdapter->sessionCtx.ap.uIsAuthenticated = true;
} else {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"ULA auth StaId= %d. Changing TL state to CONNECTED at Join time",
pAdapter->aStaInfo[staId].ucSTAId);
cdf_status = hdd_change_peer_state(pAdapter, staDesc.sta_id,
ol_txrx_peer_state_conn, false);
pAdapter->aStaInfo[staId].tlSTAState = ol_txrx_peer_state_conn;
pAdapter->sessionCtx.ap.uIsAuthenticated = false;
}
/* Enable Tx queue */
hddLog(LOG1, FL("Enabling queues"));
wlan_hdd_netif_queue_control(pAdapter,
WLAN_START_ALL_NETIF_QUEUE_N_CARRIER,
WLAN_CONTROL_PATH);
return cdf_status;
}
/**
* hdd_softap_register_bc_sta() - Register the SoftAP broadcast STA
* @pAdapter: pointer to adapter context
* @fPrivacyBit: should 802.11 privacy bit be set?
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_register_bc_sta(hdd_adapter_t *pAdapter,
bool fPrivacyBit)
{
CDF_STATUS cdf_status = CDF_STATUS_E_FAILURE;
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
struct cdf_mac_addr broadcastMacAddr =
CDF_MAC_ADDR_BROADCAST_INITIALIZER;
hdd_ap_ctx_t *pHddApCtx;
pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
pHddCtx->sta_to_adapter[WLAN_RX_BCMC_STA_ID] = pAdapter;
#ifdef WLAN_FEATURE_MBSSID
pHddCtx->sta_to_adapter[pHddApCtx->uBCStaId] = pAdapter;
#else
pHddCtx->sta_to_adapter[WLAN_RX_SAP_SELF_STA_ID] = pAdapter;
#endif
cdf_status =
hdd_softap_register_sta(pAdapter, false, fPrivacyBit,
(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->
uBCStaId, 0, 1, &broadcastMacAddr, 0);
return cdf_status;
}
/**
* hdd_softap_deregister_bc_sta() - Deregister the SoftAP broadcast STA
* @pAdapter: pointer to adapter context
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_deregister_bc_sta(hdd_adapter_t *pAdapter)
{
return hdd_softap_deregister_sta(pAdapter,
(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->
uBCStaId);
}
/**
* hdd_softap_stop_bss() - Stop the BSS
* @pAdapter: pointer to adapter context
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_stop_bss(hdd_adapter_t *pAdapter)
{
CDF_STATUS cdf_status = CDF_STATUS_E_FAILURE;
uint8_t staId = 0;
hdd_context_t *pHddCtx;
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
/* bss deregister is not allowed during wlan driver loading or
* unloading
*/
if (cds_is_load_or_unload_in_progress()) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Loading_unloading in Progress, state: 0x%x. Ignore!!!",
__func__, cds_get_driver_state());
return CDF_STATUS_E_PERM;
}
cdf_status = hdd_softap_deregister_bc_sta(pAdapter);
if (!CDF_IS_STATUS_SUCCESS(cdf_status)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Failed to deregister BC sta Id %d", __func__,
(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->uBCStaId);
}
for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) {
/* This excludes BC sta as it is already deregistered */
if (pAdapter->aStaInfo[staId].isUsed) {
cdf_status = hdd_softap_deregister_sta(pAdapter, staId);
if (!CDF_IS_STATUS_SUCCESS(cdf_status)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA,
CDF_TRACE_LEVEL_ERROR,
"%s: Failed to deregister sta Id %d",
__func__, staId);
}
}
}
return cdf_status;
}
/**
* hdd_softap_change_sta_state() - Change the state of a SoftAP station
* @pAdapter: pointer to adapter context
* @pDestMacAddress: MAC address of the station
* @state: new state of the station
*
* Return: CDF_STATUS_SUCCESS on success, CDF_STATUS_E_* on error
*/
CDF_STATUS hdd_softap_change_sta_state(hdd_adapter_t *pAdapter,
struct cdf_mac_addr *pDestMacAddress,
enum ol_txrx_peer_state state)
{
uint8_t ucSTAId = WLAN_MAX_STA_COUNT;
CDF_STATUS cdf_status = CDF_STATUS_SUCCESS;
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"%s: enter", __func__);
if (CDF_STATUS_SUCCESS !=
hdd_softap_get_sta_id(pAdapter,
pDestMacAddress, &ucSTAId)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Failed to find right station", __func__);
return CDF_STATUS_E_FAILURE;
}
if (false ==
cdf_is_macaddr_equal(&pAdapter->aStaInfo[ucSTAId].macAddrSTA,
pDestMacAddress)) {
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
"%s: Station MAC address does not matching",
__func__);
return CDF_STATUS_E_FAILURE;
}
cdf_status =
hdd_change_peer_state(pAdapter, ucSTAId, state, false);
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"%s: change station to state %d succeed", __func__, state);
if (CDF_STATUS_SUCCESS == cdf_status) {
pAdapter->aStaInfo[ucSTAId].tlSTAState =
ol_txrx_peer_state_auth;
}
CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO,
"%s exit", __func__);
return cdf_status;
}
/*
* hdd_softap_get_sta_id() - Find station ID from MAC address
* @pAdapter: pointer to adapter context
* @pDestMacAddress: MAC address of the destination
* @staId: Station ID associated with the MAC address
*
* Return: CDF_STATUS_SUCCESS if a match was found, in which case
* staId is populated, CDF_STATUS_E_FAILURE if a match is
* not found
*/
CDF_STATUS hdd_softap_get_sta_id(hdd_adapter_t *pAdapter,
struct cdf_mac_addr *pMacAddress,
uint8_t *staId)
{
uint8_t i;
for (i = 0; i < WLAN_MAX_STA_COUNT; i++) {
if (cdf_mem_compare
(&pAdapter->aStaInfo[i].macAddrSTA, pMacAddress,
CDF_MAC_ADDR_SIZE) && pAdapter->aStaInfo[i].isUsed) {
*staId = i;
return CDF_STATUS_SUCCESS;
}
}
return CDF_STATUS_E_FAILURE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,209 +0,0 @@
/*
* Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC : wlan_hdd_stats.h
*
* WLAN Host Device Driver statistics related implementation
*
*/
#if !defined(WLAN_HDD_STATS_H)
#define WLAN_HDD_STATS_H
#include "wlan_hdd_main.h"
#define INVALID_MCS_IDX 255
#define MAX_HT_MCS_IDX 8
#define MAX_VHT_MCS_IDX 10
#ifdef WLAN_FEATURE_11AC
#define DATA_RATE_11AC_MCS_MASK 0x03
/* LL stats get request time out value */
#define WLAN_WAIT_TIME_LL_STATS 5000
/**
* struct index_vht_data_rate_type - vht data rate type
* @beacon_rate_index: Beacon rate index
* @supported_VHT80_rate: VHT80 rate
* @supported_VHT40_rate: VHT40 rate
* @supported_VHT20_rate: VHT20 rate
*/
struct index_vht_data_rate_type {
uint8_t beacon_rate_index;
uint16_t supported_VHT80_rate[2];
uint16_t supported_VHT40_rate[2];
uint16_t supported_VHT20_rate[2];
};
/**
* enum - eDataRate11ACMaxMcs
* @DATA_RATE_11AC_MAX_MCS_7: MCS7 rate
* @DATA_RATE_11AC_MAX_MCS_8: MCS8 rate
* @DATA_RATE_11AC_MAX_MCS_9: MCS9 rate
* @DATA_RATE_11AC_MAX_MCS_NA:i Not applicable
*/
enum eDataRate11ACMaxMcs{
DATA_RATE_11AC_MAX_MCS_7,
DATA_RATE_11AC_MAX_MCS_8,
DATA_RATE_11AC_MAX_MCS_9,
DATA_RATE_11AC_MAX_MCS_NA
};
#endif /* End of WLAN_FEATURE_11AC */
/**
* struct index_data_rate_type - non vht data rate type
* @beacon_rate_index: Beacon rate index
* @supported_rate: Supported rate table
*/
struct index_data_rate_type {
uint8_t beacon_rate_index;
uint16_t supported_rate[4];
};
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
/*
* Used to allocate the size of 4096 for the link layer stats.
* The size of 4096 is considered assuming that all data per
* respective event fit with in the limit.Please take a call
* on the limit based on the data requirements on link layer
* statistics.
*/
#define LL_STATS_EVENT_BUF_SIZE 4096
void hdd_cfg80211_link_layer_stats_init(hdd_context_t *pHddCtx);
/**
* wlan_hdd_cfg80211_ll_stats_set() - set link layer stats
* @wiphy: Pointer to wiphy
* @wdev: Pointer to wdev
* @data: Pointer to data
* @data_len: Data length
*
* Return: int
*/
int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
/**
* wlan_hdd_cfg80211_ll_stats_get() - get link layer stats
* @wiphy: Pointer to wiphy
* @wdev: Pointer to wdev
* @data: Pointer to data
* @data_len: Data length
*
* Return: int
*/
int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
/**
* wlan_hdd_cfg80211_ll_stats_clear() - clear link layer stats
* @wiphy: Pointer to wiphy
* @wdev: Pointer to wdev
* @data: Pointer to data
* @data_len: Data length
*
* Return: int
*/
int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
void hdd_init_ll_stats_ctx(void);
static inline bool hdd_link_layer_stats_supported(void)
{
return true;
}
#else
static inline void hdd_cfg80211_link_layer_stats_init(hdd_context_t *pHddCtx)
{
return;
}
static inline void hdd_init_ll_stats_ctx(void)
{
return;
}
static inline bool hdd_link_layer_stats_supported(void)
{
return false;
}
#endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
#ifdef WLAN_FEATURE_STATS_EXT
/**
* wlan_hdd_cfg80211_stats_ext_request() - ext stats request
* @wiphy: Pointer to wiphy
* @wdev: Pointer to wdev
* @data: Pointer to data
* @data_len: Data length
*
* Return: int
*/
int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
int data_len);
void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx);
#else
static inline void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx) {}
#endif /* End of WLAN_FEATURE_STATS_EXT */
/**
* wlan_hdd_cfg80211_get_station() - get station statistics
* @wiphy: Pointer to wiphy
* @dev: Pointer to network device
* @mac: Pointer to mac
* @sinfo: Pointer to station info
*
* Return: 0 for success, non-zero for failure
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
struct net_device *dev, const uint8_t *mac,
struct station_info *sinfo);
#else
int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
struct net_device *dev, uint8_t *mac,
struct station_info *sinfo);
#endif
struct net_device_stats *hdd_get_stats(struct net_device *dev);
int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy,
struct net_device *dev,
int idx, struct survey_info *survey);
#endif /* end #if !defined(WLAN_HDD_STATS_H) */

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