mirror of
https://github.com/nxp-imx/mwifiex.git
synced 2025-01-15 16:25:35 +00:00
mxm_wifiex: update to mxm5x16214 release(Support LF 5.10)
changes: 1. Added support for IMX Linux Kernel version 5.10 2. LF 5.10 need to be build out of tree Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Reviewed-by: yang.tian <yang.tian@nxp.com>
This commit is contained in:
parent
077332c2d2
commit
070397228c
88 changed files with 203211 additions and 1 deletions
|
@ -111,6 +111,8 @@ CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=n
|
|||
# Select Platform Tools
|
||||
#############################################################################
|
||||
|
||||
MODEXT = ko
|
||||
ccflags-y += -I$(M)/mlan
|
||||
ccflags-y += -DLINUX
|
||||
|
||||
KERNELVERSION_X86 := $(shell uname -r)
|
||||
|
@ -304,6 +306,7 @@ endif
|
|||
ccflags-y += -Wno-stringop-overflow
|
||||
ccflags-y += -Wno-tautological-compare
|
||||
ccflags-y += -Wno-stringop-truncation
|
||||
ccflags-y += -Wno-packed-bitfield-compat
|
||||
|
||||
#############################################################################
|
||||
# Make Targets
|
||||
|
@ -420,11 +423,111 @@ endif
|
|||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MOALOBJS = mlinux/moal_main.o \
|
||||
mlinux/moal_ioctl.o \
|
||||
mlinux/moal_shim.o \
|
||||
mlinux/moal_eth_ioctl.o \
|
||||
mlinux/moal_init.o
|
||||
|
||||
MLANOBJS = mlan/mlan_shim.o mlan/mlan_init.o \
|
||||
mlan/mlan_txrx.o \
|
||||
mlan/mlan_cmdevt.o mlan/mlan_misc.o \
|
||||
mlan/mlan_cfp.o \
|
||||
mlan/mlan_module.o
|
||||
|
||||
MLANOBJS += mlan/mlan_wmm.o
|
||||
ifeq ($(CONFIG_MUSB),y)
|
||||
MLANOBJS += mlan/mlan_usb.o
|
||||
endif
|
||||
ifeq ($(CONFIG_SDIO),y)
|
||||
MLANOBJS += mlan/mlan_sdio.o
|
||||
endif
|
||||
ifeq ($(CONFIG_PCIE),y)
|
||||
MLANOBJS += mlan/mlan_pcie.o
|
||||
endif
|
||||
MLANOBJS += mlan/mlan_11n_aggr.o
|
||||
MLANOBJS += mlan/mlan_11n_rxreorder.o
|
||||
MLANOBJS += mlan/mlan_11n.o
|
||||
MLANOBJS += mlan/mlan_11ac.o
|
||||
MLANOBJS += mlan/mlan_11ax.o
|
||||
MLANOBJS += mlan/mlan_11d.o
|
||||
MLANOBJS += mlan/mlan_11h.o
|
||||
ifeq ($(CONFIG_STA_SUPPORT),y)
|
||||
MLANOBJS += mlan/mlan_meas.o
|
||||
MLANOBJS += mlan/mlan_scan.o \
|
||||
mlan/mlan_sta_ioctl.o \
|
||||
mlan/mlan_sta_rx.o \
|
||||
mlan/mlan_sta_tx.o \
|
||||
mlan/mlan_sta_event.o \
|
||||
mlan/mlan_sta_cmd.o \
|
||||
mlan/mlan_sta_cmdresp.o \
|
||||
mlan/mlan_join.o
|
||||
ifeq ($(CONFIG_STA_WEXT),y)
|
||||
MOALOBJS += mlinux/moal_priv.o \
|
||||
mlinux/moal_wext.o
|
||||
endif
|
||||
endif
|
||||
ifeq ($(CONFIG_UAP_SUPPORT),y)
|
||||
MLANOBJS += mlan/mlan_uap_ioctl.o
|
||||
MLANOBJS += mlan/mlan_uap_cmdevent.o
|
||||
MLANOBJS += mlan/mlan_uap_txrx.o
|
||||
MOALOBJS += mlinux/moal_uap.o
|
||||
ifeq ($(CONFIG_UAP_WEXT),y)
|
||||
MOALOBJS += mlinux/moal_uap_priv.o
|
||||
MOALOBJS += mlinux/moal_uap_wext.o
|
||||
endif
|
||||
endif
|
||||
ifeq ($(CONFIG_STA_CFG80211),y)
|
||||
MOALOBJS += mlinux/moal_cfg80211.o
|
||||
MOALOBJS += mlinux/moal_cfg80211_util.o
|
||||
MOALOBJS += mlinux/moal_sta_cfg80211.o
|
||||
endif
|
||||
ifeq ($(CONFIG_UAP_CFG80211),y)
|
||||
MOALOBJS += mlinux/moal_cfg80211.o
|
||||
MOALOBJS += mlinux/moal_cfg80211_util.o
|
||||
MOALOBJS += mlinux/moal_uap_cfg80211.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PROC_FS
|
||||
MOALOBJS += mlinux/moal_proc.o
|
||||
MOALOBJS += mlinux/moal_debug.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MAC80211_SUPPORT),y)
|
||||
MOALOBJS += mlinux/moal_mac80211.o
|
||||
MLANOBJS += mlan/mlan_mac80211.o
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
obj-m := mlan.o
|
||||
mlan-objs := $(MLANOBJS)
|
||||
|
||||
ifeq ($(CONFIG_MUSB),y)
|
||||
MOALOBJS += mlinux/moal_usb.o
|
||||
endif
|
||||
ifeq ($(CONFIG_SDIO),y)
|
||||
MOALOBJS += mlinux/moal_sdio_mmc.o
|
||||
endif
|
||||
ifeq ($(CONFIG_PCIE),y)
|
||||
MOALOBJS += mlinux/moal_pcie.o
|
||||
endif
|
||||
obj-m += moal.o
|
||||
moal-objs := $(MOALOBJS)
|
||||
|
||||
# Otherwise we were called directly from the command line; invoke the kernel build system.
|
||||
else
|
||||
|
||||
default:
|
||||
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm64 CROSS_COMPILE=$(CROSS_COMPILE) modules
|
||||
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
|
||||
|
||||
endif
|
||||
|
||||
|
@ -448,6 +551,9 @@ build: echo default
|
|||
mkdir $(BINDIR); \
|
||||
fi
|
||||
|
||||
cp -f mlan.$(MODEXT) $(BINDIR)/mlan$(DBG).$(MODEXT)
|
||||
|
||||
cp -f moal.$(MODEXT) $(BINDIR)/moal$(DBG).$(MODEXT)
|
||||
cp -rpf script/load $(BINDIR)/
|
||||
cp -rpf script/unload $(BINDIR)/
|
||||
|
||||
|
@ -478,6 +584,8 @@ endif
|
|||
|
||||
install: default
|
||||
|
||||
cp -f mlan.$(MODEXT) $(INSTALLDIR)/mlan$(DBG).$(MODEXT)
|
||||
cp -f moal.$(MODEXT) $(INSTALLDIR)/moal$(DBG).$(MODEXT)
|
||||
echo $(INSTALLDIR)
|
||||
echo "MX Driver Installed"
|
||||
|
||||
|
|
37
mxm_wifiex/wlan_src/mlan/mlan.h
Normal file
37
mxm_wifiex/wlan_src/mlan/mlan.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/** @file mlan.h
|
||||
*
|
||||
* @brief This file declares all APIs that will be called from MOAL module.
|
||||
* It also defines the data structures used for APIs between MLAN and MOAL.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
10/13/2008: initial version
|
||||
11/07/2008: split mlan.h into mlan_decl.h & mlan_ioctl.h
|
||||
******************************************************/
|
||||
|
||||
#ifndef _MLAN_H_
|
||||
#define _MLAN_H_
|
||||
|
||||
#include "mlan_decl.h"
|
||||
#include "mlan_ioctl.h"
|
||||
#include "mlan_ieee.h"
|
||||
|
||||
#endif /* !_MLAN_H_ */
|
1309
mxm_wifiex/wlan_src/mlan/mlan_11ac.c
Normal file
1309
mxm_wifiex/wlan_src/mlan/mlan_11ac.c
Normal file
File diff suppressed because it is too large
Load diff
52
mxm_wifiex/wlan_src/mlan/mlan_11ac.h
Normal file
52
mxm_wifiex/wlan_src/mlan/mlan_11ac.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/** @file mlan_11ac.h
|
||||
*
|
||||
* @brief This file contains the functions for station ioctl.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MLAN_11AC_H_
|
||||
#define _MLAN_11AC_H_
|
||||
|
||||
#include "mlan_11n_aggr.h"
|
||||
#include "mlan_11n_rxreorder.h"
|
||||
#include "mlan_wmm.h"
|
||||
|
||||
void wlan_show_dot11acdevcap(pmlan_adapter pmadapter, t_u32 cap);
|
||||
void wlan_show_dot11acmcssupport(pmlan_adapter pmadapter, t_u32 support);
|
||||
t_u16 wlan_convert_mcsmap_to_maxrate(mlan_private *priv, t_u16 bands,
|
||||
t_u16 mcs_map);
|
||||
void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap,
|
||||
t_u16 bands, t_u8 flag, t_u8 bw_80p80);
|
||||
void wlan_fill_vht_cap_ie(mlan_private *priv, IEEEtypes_VHTCap_t *pvht_cap,
|
||||
t_u16 bands);
|
||||
int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
|
||||
t_u8 **ppbuffer);
|
||||
mlan_status wlan_11ac_cfg_ioctl(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
void wlan_update_11ac_cap(mlan_private *pmpriv);
|
||||
t_u8 wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band);
|
||||
t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc);
|
||||
|
||||
mlan_status wlan_cmd_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
|
||||
mlan_status wlan_ret_11ac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
|
||||
#endif /* _MLAN_11AC_H_ */
|
904
mxm_wifiex/wlan_src/mlan/mlan_11ax.c
Normal file
904
mxm_wifiex/wlan_src/mlan/mlan_11ax.c
Normal file
|
@ -0,0 +1,904 @@
|
|||
/** @file mlan_11ax.c
|
||||
*
|
||||
* @brief This file contains the functions for 11ax related features.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_join.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_ioctl.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_wmm.h"
|
||||
#include "mlan_11n.h"
|
||||
#include "mlan_11ax.h"
|
||||
#include "mlan_11ac.h"
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function prints the 802.11ax HE mac capability
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param cap Capability value
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void wlan_show_dot11axmaccap(pmlan_adapter pmadapter, t_u32 cap)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function check if AP support TWT Response.
|
||||
*
|
||||
* @param pbss_desc A pointer to BSSDescriptor_t structure
|
||||
*
|
||||
* @return MTRUE/MFALSE
|
||||
*/
|
||||
t_u8 wlan_check_ap_11ax_twt_supported(BSSDescriptor_t *pbss_desc)
|
||||
{
|
||||
if (!pbss_desc->phe_cap)
|
||||
return MFALSE;
|
||||
if (!(pbss_desc->phe_cap->he_mac_cap[0] & HE_MAC_CAP_TWT_REQ_SUPPORT))
|
||||
return MFALSE;
|
||||
if (!pbss_desc->pext_cap)
|
||||
return MFALSE;
|
||||
if (!ISSUPP_EXTCAP_EXT_TWT_RESP(pbss_desc->pext_cap->ext_cap))
|
||||
return MFALSE;
|
||||
return MTRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function check if we should enable TWT support
|
||||
*
|
||||
* @param pbss_desc A pointer to BSSDescriptor_t structure
|
||||
*
|
||||
* @return MTRUE/MFALSE
|
||||
*/
|
||||
t_u8 wlan_check_11ax_twt_supported(mlan_private *pmpriv,
|
||||
BSSDescriptor_t *pbss_desc)
|
||||
{
|
||||
MrvlIEtypes_He_cap_t *phecap =
|
||||
(MrvlIEtypes_He_cap_t *)&pmpriv->user_he_cap;
|
||||
MrvlIEtypes_He_cap_t *hw_he_cap =
|
||||
(MrvlIEtypes_He_cap_t *)&pmpriv->adapter->hw_he_cap;
|
||||
if (pbss_desc && !wlan_check_ap_11ax_twt_supported(pbss_desc)) {
|
||||
PRINTM(MINFO, "AP don't support twt feature\n");
|
||||
return MFALSE;
|
||||
}
|
||||
if (pbss_desc) {
|
||||
if (pbss_desc->bss_band & BAND_A) {
|
||||
hw_he_cap = (MrvlIEtypes_He_cap_t *)&pmpriv->adapter
|
||||
->hw_he_cap;
|
||||
phecap = (MrvlIEtypes_He_cap_t *)&pmpriv->user_he_cap;
|
||||
} else {
|
||||
hw_he_cap = (MrvlIEtypes_He_cap_t *)&pmpriv->adapter
|
||||
->hw_2g_he_cap;
|
||||
phecap =
|
||||
(MrvlIEtypes_He_cap_t *)&pmpriv->user_2g_he_cap;
|
||||
}
|
||||
}
|
||||
if (!(hw_he_cap->he_mac_cap[0] & HE_MAC_CAP_TWT_REQ_SUPPORT)) {
|
||||
PRINTM(MINFO, "FW don't support TWT\n");
|
||||
return MFALSE;
|
||||
}
|
||||
if (phecap->he_mac_cap[0] & HE_MAC_CAP_TWT_REQ_SUPPORT)
|
||||
return MTRUE;
|
||||
PRINTM(MINFO, "USER HE_MAC_CAP don't support TWT\n");
|
||||
return MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function prints the 802.11ax HE PHY cap
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param support Support value
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void wlan_show_dot11axphycap(pmlan_adapter pmadapter, t_u32 support)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function fills the HE cap tlv out put format is LE, not CPU
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param band 5G or 2.4 G
|
||||
* @param phe_cap A pointer to MrvlIEtypes_Data_t structure
|
||||
* @param flag TREU--pvht_cap has the setting for resp
|
||||
* MFALSE -- pvht_cap is clean
|
||||
*
|
||||
* @return bytes added to the phe_cap
|
||||
*/
|
||||
t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u8 band,
|
||||
MrvlIEtypes_Extension_t *phe_cap, t_u8 flag)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
t_u16 len = 0;
|
||||
|
||||
if (!phe_cap) {
|
||||
LEAVE();
|
||||
return 0;
|
||||
}
|
||||
if (band & BAND_A) {
|
||||
memcpy_ext(pmadapter, (t_u8 *)phe_cap, pmpriv->user_he_cap,
|
||||
pmpriv->user_hecap_len,
|
||||
sizeof(MrvlIEtypes_He_cap_t));
|
||||
len = pmpriv->user_hecap_len;
|
||||
} else {
|
||||
memcpy_ext(pmadapter, (t_u8 *)phe_cap, pmpriv->user_2g_he_cap,
|
||||
pmpriv->user_2g_hecap_len,
|
||||
sizeof(MrvlIEtypes_He_cap_t));
|
||||
len = pmpriv->user_2g_hecap_len;
|
||||
}
|
||||
phe_cap->type = wlan_cpu_to_le16(phe_cap->type);
|
||||
phe_cap->len = wlan_cpu_to_le16(phe_cap->len);
|
||||
|
||||
LEAVE();
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function append the 802_11ax HE capability tlv
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param pbss_desc A pointer to BSSDescriptor_t structure
|
||||
* @param ppbuffer A Pointer to command buffer pointer
|
||||
*
|
||||
* @return bytes added to the buffer
|
||||
*/
|
||||
int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
|
||||
t_u8 **ppbuffer)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
MrvlIEtypes_He_cap_t *phecap = MNULL;
|
||||
int len = 0;
|
||||
t_u8 bw_80p80 = MFALSE;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* Null Checks */
|
||||
if (ppbuffer == MNULL) {
|
||||
LEAVE();
|
||||
return 0;
|
||||
}
|
||||
if (*ppbuffer == MNULL) {
|
||||
LEAVE();
|
||||
return 0;
|
||||
}
|
||||
/** check if AP support HE, if not return right away */
|
||||
if (!pbss_desc->phe_cap) {
|
||||
LEAVE();
|
||||
return 0;
|
||||
}
|
||||
bw_80p80 = wlan_is_80_80_support(pmpriv, pbss_desc);
|
||||
phecap = (MrvlIEtypes_He_cap_t *)*ppbuffer;
|
||||
if (pbss_desc->bss_band & BAND_A) {
|
||||
memcpy_ext(pmadapter, *ppbuffer, pmpriv->user_he_cap,
|
||||
pmpriv->user_hecap_len, pmpriv->user_hecap_len);
|
||||
*ppbuffer += pmpriv->user_hecap_len;
|
||||
len = pmpriv->user_hecap_len;
|
||||
} else {
|
||||
memcpy_ext(pmadapter, *ppbuffer, pmpriv->user_2g_he_cap,
|
||||
pmpriv->user_2g_hecap_len,
|
||||
pmpriv->user_2g_hecap_len);
|
||||
*ppbuffer += pmpriv->user_2g_hecap_len;
|
||||
len = pmpriv->user_2g_hecap_len;
|
||||
}
|
||||
phecap->type = wlan_cpu_to_le16(phecap->type);
|
||||
phecap->len = wlan_cpu_to_le16(phecap->len);
|
||||
|
||||
if (bw_80p80) {
|
||||
/** configure 2*2 to 1*1 to support 80+80Mhz*/
|
||||
/** set 1*1 mcs rate for 80Mhz rx*/
|
||||
phecap->he_txrx_mcs_support[0] &= ~(MBIT(0) | MBIT(1));
|
||||
/** set 1*1 mcs rate for 80Mhz tx*/
|
||||
phecap->he_txrx_mcs_support[3] &= ~(MBIT(0) | MBIT(1));
|
||||
/** set 1*1 mcs rate for 160Mhz rx*/
|
||||
phecap->he160_txrx_mcs_support[0] &= ~(MBIT(0) | MBIT(1));
|
||||
/** set 1*1 mcs rate for 160Mhz tx*/
|
||||
phecap->he160_txrx_mcs_support[3] &= ~(MBIT(0) | MBIT(1));
|
||||
/** set 1*1 mcs rate for 80+80Mhz rx*/
|
||||
phecap->he8080_txrx_mcs_support[0] &= ~(MBIT(0) | MBIT(1));
|
||||
/** set 1*1 mcs rate for 80+80Mhz tx*/
|
||||
phecap->he8080_txrx_mcs_support[3] &= ~(MBIT(0) | MBIT(1));
|
||||
} else {
|
||||
/** reset BIT3 and BIT4 channel width ,not support 80 + 80*/
|
||||
/** not support 160Mhz now, if support,not reset bit3 */
|
||||
phecap->he_phy_cap[0] &= ~(MBIT(3) | MBIT(4));
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function save the 11ax cap from FW.
|
||||
*
|
||||
* @param pmadapater A pointer to mlan_adapter
|
||||
* @param hw_he_cap A pointer to MrvlIEtypes_Extension_t
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void wlan_update_11ax_cap(mlan_adapter *pmadapter,
|
||||
MrvlIEtypes_Extension_t *hw_he_cap)
|
||||
{
|
||||
MrvlIEtypes_He_cap_t *phe_cap = MNULL;
|
||||
t_u8 i = 0;
|
||||
t_u8 he_cap_2g = 0;
|
||||
|
||||
ENTER();
|
||||
if ((hw_he_cap->len + sizeof(MrvlIEtypesHeader_t)) >
|
||||
sizeof(pmadapter->hw_he_cap)) {
|
||||
PRINTM(MERROR, "hw_he_cap too big, len=%d\n", hw_he_cap->len);
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
phe_cap = (MrvlIEtypes_He_cap_t *)hw_he_cap;
|
||||
if (phe_cap->he_phy_cap[0] &
|
||||
(AX_2G_40MHZ_SUPPORT | AX_2G_20MHZ_SUPPORT)) {
|
||||
pmadapter->hw_2g_hecap_len =
|
||||
hw_he_cap->len + sizeof(MrvlIEtypesHeader_t);
|
||||
memcpy_ext(pmadapter, pmadapter->hw_2g_he_cap,
|
||||
(t_u8 *)hw_he_cap,
|
||||
hw_he_cap->len + sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmadapter->hw_2g_he_cap));
|
||||
pmadapter->fw_bands |= BAND_GAX;
|
||||
pmadapter->config_bands |= BAND_GAX;
|
||||
he_cap_2g = MTRUE;
|
||||
DBG_HEXDUMP(MCMD_D, "2.4G HE capability IE ",
|
||||
(t_u8 *)pmadapter->hw_2g_he_cap,
|
||||
pmadapter->hw_2g_hecap_len);
|
||||
} else {
|
||||
pmadapter->fw_bands |= BAND_AAX;
|
||||
pmadapter->config_bands |= BAND_AAX;
|
||||
pmadapter->hw_hecap_len =
|
||||
hw_he_cap->len + sizeof(MrvlIEtypesHeader_t);
|
||||
memcpy_ext(pmadapter, pmadapter->hw_he_cap, (t_u8 *)hw_he_cap,
|
||||
hw_he_cap->len + sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmadapter->hw_he_cap));
|
||||
DBG_HEXDUMP(MCMD_D, "5G HE capability IE ",
|
||||
(t_u8 *)pmadapter->hw_he_cap,
|
||||
pmadapter->hw_hecap_len);
|
||||
}
|
||||
for (i = 0; i < pmadapter->priv_num; i++) {
|
||||
if (pmadapter->priv[i]) {
|
||||
pmadapter->priv[i]->config_bands =
|
||||
pmadapter->config_bands;
|
||||
if (he_cap_2g) {
|
||||
pmadapter->priv[i]->user_2g_hecap_len =
|
||||
pmadapter->hw_2g_hecap_len;
|
||||
memcpy_ext(pmadapter,
|
||||
pmadapter->priv[i]->user_2g_he_cap,
|
||||
pmadapter->hw_2g_he_cap,
|
||||
pmadapter->hw_2g_hecap_len,
|
||||
sizeof(pmadapter->priv[i]
|
||||
->user_2g_he_cap));
|
||||
} else {
|
||||
pmadapter->priv[i]->user_hecap_len =
|
||||
pmadapter->hw_hecap_len;
|
||||
memcpy_ext(
|
||||
pmadapter,
|
||||
pmadapter->priv[i]->user_he_cap,
|
||||
pmadapter->hw_he_cap,
|
||||
pmadapter->hw_hecap_len,
|
||||
sizeof(pmadapter->priv[i]->user_he_cap));
|
||||
}
|
||||
}
|
||||
}
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function check if 11AX is allowed in bandcfg
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param bss_band bss band
|
||||
*
|
||||
* @return 0--not allowed, other value allowed
|
||||
*/
|
||||
t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band)
|
||||
{
|
||||
if (!IS_FW_SUPPORT_11AX(pmpriv->adapter))
|
||||
return MFALSE;
|
||||
if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) {
|
||||
if (bss_band & BAND_G)
|
||||
return (pmpriv->adapter->adhoc_start_band & BAND_GAX);
|
||||
else if (bss_band & BAND_A)
|
||||
return (pmpriv->adapter->adhoc_start_band & BAND_AAX);
|
||||
} else {
|
||||
if (bss_band & BAND_G)
|
||||
return (pmpriv->config_bands & BAND_GAX);
|
||||
else if (bss_band & BAND_A)
|
||||
return (pmpriv->config_bands & BAND_AAX);
|
||||
}
|
||||
return MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set 11ax configuration
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pioctl_req A pointer to ioctl request buffer
|
||||
*
|
||||
* @return MLAN_STATUS_PENDING --success, otherwise fail
|
||||
*/
|
||||
static mlan_status wlan_11ax_ioctl_hecfg(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index];
|
||||
mlan_ds_11ax_cfg *cfg = MNULL;
|
||||
t_u16 cmd_action = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (pioctl_req->buf_len < sizeof(mlan_ds_11ax_cfg)) {
|
||||
PRINTM(MINFO, "MLAN bss IOCTL length is too short.\n");
|
||||
pioctl_req->data_read_written = 0;
|
||||
pioctl_req->buf_len_needed = sizeof(mlan_ds_11ax_cfg);
|
||||
pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER;
|
||||
LEAVE();
|
||||
return MLAN_STATUS_RESOURCE;
|
||||
}
|
||||
|
||||
cfg = (mlan_ds_11ax_cfg *)pioctl_req->pbuf;
|
||||
|
||||
if ((cfg->param.he_cfg.band & MBIT(0)) &&
|
||||
!(pmadapter->fw_bands & BAND_GAX)) {
|
||||
PRINTM(MERROR, "FW don't support 2.4G AX\n");
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
if ((cfg->param.he_cfg.band & MBIT(1)) &&
|
||||
!(pmadapter->fw_bands & BAND_AAX)) {
|
||||
PRINTM(MERROR, "FW don't support 5G AX\n");
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
if (pioctl_req->action == MLAN_ACT_SET)
|
||||
cmd_action = HostCmd_ACT_GEN_SET;
|
||||
else
|
||||
cmd_action = HostCmd_ACT_GEN_GET;
|
||||
|
||||
/* Send request to firmware */
|
||||
ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_11AX_CFG, cmd_action, 0,
|
||||
(t_void *)pioctl_req,
|
||||
(t_void *)&cfg->param.he_cfg);
|
||||
if (ret == MLAN_STATUS_SUCCESS)
|
||||
ret = MLAN_STATUS_PENDING;
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 11ax configuration handler
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pioctl_req A pointer to ioctl request buffer
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS --success, otherwise fail
|
||||
*/
|
||||
mlan_status wlan_11ax_cfg_ioctl(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req)
|
||||
{
|
||||
mlan_status status = MLAN_STATUS_SUCCESS;
|
||||
mlan_ds_11ax_cfg *cfg = MNULL;
|
||||
|
||||
ENTER();
|
||||
|
||||
cfg = (mlan_ds_11ax_cfg *)pioctl_req->pbuf;
|
||||
switch (cfg->sub_command) {
|
||||
case MLAN_OID_11AX_HE_CFG:
|
||||
status = wlan_11ax_ioctl_hecfg(pmadapter, pioctl_req);
|
||||
break;
|
||||
case MLAN_OID_11AX_CMD_CFG:
|
||||
status = wlan_11ax_ioctl_cmd(pmadapter, pioctl_req);
|
||||
break;
|
||||
case MLAN_OID_11AX_TWT_CFG:
|
||||
status = wlan_11ax_ioctl_twtcfg(pmadapter, pioctl_req);
|
||||
break;
|
||||
default:
|
||||
pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID;
|
||||
status = MLAN_STATUS_FAILURE;
|
||||
break;
|
||||
}
|
||||
LEAVE();
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function prepares 11ax cfg command
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param cmd A pointer to HostCmd_DS_COMMAND structure
|
||||
* @param cmd_action the action: GET or SET
|
||||
* @param pdata_buf A pointer to data buffer
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_cmd_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
HostCmd_DS_11AX_CFG *axcfg = &cmd->params.axcfg;
|
||||
mlan_ds_11ax_he_cfg *hecfg = (mlan_ds_11ax_he_cfg *)pdata_buf;
|
||||
MrvlIEtypes_Extension_t *tlv = MNULL;
|
||||
t_u8 *pos = MNULL;
|
||||
|
||||
ENTER();
|
||||
cmd->command = wlan_cpu_to_le16(HostCmd_CMD_11AX_CFG);
|
||||
cmd->size = sizeof(HostCmd_DS_11AX_CFG) + S_DS_GEN;
|
||||
|
||||
axcfg->action = wlan_cpu_to_le16(cmd_action);
|
||||
axcfg->band_config = hecfg->band & 0xFF;
|
||||
|
||||
pos = (t_u8 *)axcfg->val;
|
||||
/**HE Capability */
|
||||
if (hecfg->he_cap.len && (hecfg->he_cap.ext_id == HE_CAPABILITY)) {
|
||||
tlv = (MrvlIEtypes_Extension_t *)pos;
|
||||
tlv->type = wlan_cpu_to_le16(hecfg->he_cap.id);
|
||||
tlv->len = wlan_cpu_to_le16(hecfg->he_cap.len);
|
||||
memcpy_ext(pmadapter, &tlv->ext_id, &hecfg->he_cap.ext_id,
|
||||
hecfg->he_cap.len,
|
||||
MRVDRV_SIZE_OF_CMD_BUFFER - cmd->size);
|
||||
cmd->size += hecfg->he_cap.len + sizeof(MrvlIEtypesHeader_t);
|
||||
pos += hecfg->he_cap.len + sizeof(MrvlIEtypesHeader_t);
|
||||
}
|
||||
|
||||
cmd->size = wlan_cpu_to_le16(cmd->size);
|
||||
|
||||
LEAVE();
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* @brief This function handles the command response of 11axcfg
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param resp A pointer to HostCmd_DS_COMMAND
|
||||
* @param pioctl_buf A pointer to mlan_ioctl_req structure
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_ret_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
mlan_ds_11ax_cfg *cfg = MNULL;
|
||||
mlan_ds_11ax_he_capa *hecap = MNULL;
|
||||
HostCmd_DS_11AX_CFG *axcfg = &resp->params.axcfg;
|
||||
MrvlIEtypes_Extension_t *tlv = MNULL;
|
||||
t_u16 left_len = 0, tlv_type = 0, tlv_len = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (pioctl_buf == MNULL)
|
||||
goto done;
|
||||
|
||||
cfg = (mlan_ds_11ax_cfg *)pioctl_buf->pbuf;
|
||||
cfg->param.he_cfg.band = axcfg->band_config;
|
||||
hecap = (mlan_ds_11ax_he_capa *)&cfg->param.he_cfg.he_cap;
|
||||
|
||||
/* TLV parse */
|
||||
left_len = resp->size - sizeof(HostCmd_DS_11AX_CFG) - S_DS_GEN;
|
||||
tlv = (MrvlIEtypes_Extension_t *)axcfg->val;
|
||||
|
||||
while (left_len > sizeof(MrvlIEtypesHeader_t)) {
|
||||
tlv_type = wlan_le16_to_cpu(tlv->type);
|
||||
tlv_len = wlan_le16_to_cpu(tlv->len);
|
||||
if (tlv_type == EXTENSION) {
|
||||
switch (tlv->ext_id) {
|
||||
case HE_CAPABILITY:
|
||||
hecap->id = tlv_type;
|
||||
hecap->len = tlv_len;
|
||||
memcpy_ext(pmadapter, (t_u8 *)&hecap->ext_id,
|
||||
(t_u8 *)&tlv->ext_id, tlv_len,
|
||||
sizeof(mlan_ds_11ax_he_capa) -
|
||||
sizeof(MrvlIEtypesHeader_t));
|
||||
if (cfg->param.he_cfg.band & MBIT(1)) {
|
||||
memcpy_ext(
|
||||
pmadapter,
|
||||
(t_u8 *)&pmpriv->user_he_cap,
|
||||
(t_u8 *)tlv,
|
||||
tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmpriv->user_he_cap));
|
||||
pmpriv->user_hecap_len = MIN(
|
||||
tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmpriv->user_he_cap));
|
||||
PRINTM(MCMND, "user_hecap_len=%d\n",
|
||||
pmpriv->user_hecap_len);
|
||||
} else {
|
||||
memcpy_ext(
|
||||
pmadapter,
|
||||
(t_u8 *)&pmpriv->user_2g_he_cap,
|
||||
(t_u8 *)tlv,
|
||||
tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmpriv->user_2g_he_cap));
|
||||
pmpriv->user_2g_hecap_len = MIN(
|
||||
tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t),
|
||||
sizeof(pmpriv->user_2g_he_cap));
|
||||
PRINTM(MCMND, "user_2g_hecap_len=%d\n",
|
||||
pmpriv->user_2g_hecap_len);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
left_len -= (sizeof(MrvlIEtypesHeader_t) + tlv_len);
|
||||
tlv = (MrvlIEtypes_Extension_t *)((t_u8 *)tlv + tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t));
|
||||
}
|
||||
|
||||
done:
|
||||
LEAVE();
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 11ax command handler
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pioctl_req A pointer to ioctl request buffer
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS --success, otherwise fail
|
||||
*/
|
||||
mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req)
|
||||
{
|
||||
mlan_status status = MLAN_STATUS_SUCCESS;
|
||||
mlan_ds_11ax_cmd_cfg *cfg = MNULL;
|
||||
mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index];
|
||||
t_u16 cmd_action = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (pioctl_req->buf_len < sizeof(mlan_ds_11ax_cmd_cfg)) {
|
||||
PRINTM(MINFO, "MLAN bss IOCTL length is too short.\n");
|
||||
pioctl_req->data_read_written = 0;
|
||||
pioctl_req->buf_len_needed = sizeof(mlan_ds_11ax_cmd_cfg);
|
||||
pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER;
|
||||
LEAVE();
|
||||
return MLAN_STATUS_RESOURCE;
|
||||
}
|
||||
cfg = (mlan_ds_11ax_cmd_cfg *)pioctl_req->pbuf;
|
||||
|
||||
if (pioctl_req->action == MLAN_ACT_SET)
|
||||
cmd_action = HostCmd_ACT_GEN_SET;
|
||||
else
|
||||
cmd_action = HostCmd_ACT_GEN_GET;
|
||||
|
||||
/* Send request to firmware */
|
||||
status = wlan_prepare_cmd(pmpriv, HostCmd_CMD_11AX_CMD, cmd_action, 0,
|
||||
(t_void *)pioctl_req, (t_void *)cfg);
|
||||
if (status == MLAN_STATUS_SUCCESS)
|
||||
status = MLAN_STATUS_PENDING;
|
||||
|
||||
LEAVE();
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function prepares 11ax command
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param cmd A pointer to HostCmd_DS_COMMAND structure
|
||||
* @param cmd_action the action: GET or SET
|
||||
* @param pdata_buf A pointer to data buffer
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_cmd_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
HostCmd_DS_11AX_CMD_CFG *axcmd = &cmd->params.axcmd;
|
||||
mlan_ds_11ax_cmd_cfg *ds_11ax_cmd = (mlan_ds_11ax_cmd_cfg *)pdata_buf;
|
||||
mlan_ds_11ax_sr_cmd *sr_cmd =
|
||||
(mlan_ds_11ax_sr_cmd *)&ds_11ax_cmd->param;
|
||||
mlan_ds_11ax_beam_cmd *beam_cmd =
|
||||
(mlan_ds_11ax_beam_cmd *)&ds_11ax_cmd->param;
|
||||
mlan_ds_11ax_htc_cmd *htc_cmd =
|
||||
(mlan_ds_11ax_htc_cmd *)&ds_11ax_cmd->param;
|
||||
mlan_ds_11ax_txop_cmd *txop_cmd =
|
||||
(mlan_ds_11ax_txop_cmd *)&ds_11ax_cmd->param;
|
||||
mlan_ds_11ax_txomi_cmd *txomi_cmd =
|
||||
(mlan_ds_11ax_txomi_cmd *)&ds_11ax_cmd->param;
|
||||
mlan_ds_11ax_toltime_cmd *toltime_cmd =
|
||||
(mlan_ds_11ax_toltime_cmd *)&ds_11ax_cmd->param;
|
||||
MrvlIEtypes_Data_t *tlv = MNULL;
|
||||
|
||||
ENTER();
|
||||
cmd->command = wlan_cpu_to_le16(HostCmd_CMD_11AX_CMD);
|
||||
cmd->size = sizeof(HostCmd_DS_11AX_CMD_CFG) + S_DS_GEN;
|
||||
|
||||
axcmd->action = wlan_cpu_to_le16(cmd_action);
|
||||
axcmd->sub_id = wlan_cpu_to_le16(ds_11ax_cmd->sub_id);
|
||||
switch (ds_11ax_cmd->sub_id) {
|
||||
case MLAN_11AXCMD_SR_SUBID:
|
||||
tlv = (MrvlIEtypes_Data_t *)axcmd->val;
|
||||
tlv->header.type = wlan_cpu_to_le16(sr_cmd->type);
|
||||
tlv->header.len = wlan_cpu_to_le16(sr_cmd->len);
|
||||
memcpy_ext(pmadapter, tlv->data,
|
||||
&sr_cmd->param.obss_pd_offset.offset, sr_cmd->len,
|
||||
sr_cmd->len);
|
||||
cmd->size += sizeof(MrvlIEtypesHeader_t) + sr_cmd->len;
|
||||
break;
|
||||
case MLAN_11AXCMD_BEAM_SUBID:
|
||||
axcmd->val[0] = beam_cmd->value;
|
||||
cmd->size += sizeof(t_u8);
|
||||
break;
|
||||
case MLAN_11AXCMD_HTC_SUBID:
|
||||
axcmd->val[0] = htc_cmd->value;
|
||||
cmd->size += sizeof(t_u8);
|
||||
break;
|
||||
case MLAN_11AXCMD_TXOPRTS_SUBID:
|
||||
memcpy_ext(pmadapter, axcmd->val, &txop_cmd->rts_thres,
|
||||
sizeof(t_u16), sizeof(t_u16));
|
||||
cmd->size += sizeof(t_u16);
|
||||
break;
|
||||
case MLAN_11AXCMD_TXOMI_SUBID:
|
||||
memcpy_ext(pmadapter, axcmd->val, &txomi_cmd->omi,
|
||||
sizeof(t_u16), sizeof(t_u16));
|
||||
cmd->size += sizeof(t_u16);
|
||||
break;
|
||||
case MLAN_11AXCMD_OBSS_TOLTIME_SUBID:
|
||||
memcpy_ext(pmadapter, axcmd->val, &toltime_cmd->tol_time,
|
||||
sizeof(t_u32), sizeof(t_u32));
|
||||
cmd->size += sizeof(t_u32);
|
||||
break;
|
||||
default:
|
||||
PRINTM(MERROR, "Unknown subcmd %x\n", ds_11ax_cmd->sub_id);
|
||||
break;
|
||||
}
|
||||
|
||||
cmd->size = wlan_cpu_to_le16(cmd->size);
|
||||
|
||||
LEAVE();
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles the command response of 11axcmd
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param resp A pointer to HostCmd_DS_COMMAND
|
||||
* @param pioctl_buf A pointer to mlan_ioctl_req structure
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_ret_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
mlan_ds_11ax_cmd_cfg *cfg = MNULL;
|
||||
HostCmd_DS_11AX_CMD_CFG *axcmd = &resp->params.axcmd;
|
||||
MrvlIEtypes_Data_t *tlv = MNULL;
|
||||
t_s16 left_len = 0;
|
||||
t_u16 tlv_type = 0, tlv_len = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (pioctl_buf == MNULL)
|
||||
goto done;
|
||||
|
||||
cfg = (mlan_ds_11ax_cmd_cfg *)pioctl_buf->pbuf;
|
||||
cfg->sub_id = wlan_le16_to_cpu(axcmd->sub_id);
|
||||
|
||||
switch (axcmd->sub_id) {
|
||||
case MLAN_11AXCMD_SR_SUBID:
|
||||
/* TLV parse */
|
||||
left_len =
|
||||
resp->size - sizeof(HostCmd_DS_11AX_CMD_CFG) - S_DS_GEN;
|
||||
// tlv = (MrvlIEtypes_Extension_t *)axcfg->val;
|
||||
tlv = (MrvlIEtypes_Data_t *)axcmd->val;
|
||||
while (left_len > sizeof(MrvlIEtypesHeader_t)) {
|
||||
tlv_type = wlan_le16_to_cpu(tlv->header.type);
|
||||
tlv_len = wlan_le16_to_cpu(tlv->header.len);
|
||||
memcpy_ext(
|
||||
pmadapter,
|
||||
cfg->param.sr_cfg.param.obss_pd_offset.offset,
|
||||
tlv->data, tlv_len, tlv_len);
|
||||
left_len -= (sizeof(MrvlIEtypesHeader_t) + tlv_len);
|
||||
tlv = (MrvlIEtypes_Data_t
|
||||
*)((t_u8 *)tlv + tlv_len +
|
||||
sizeof(MrvlIEtypesHeader_t));
|
||||
}
|
||||
break;
|
||||
case MLAN_11AXCMD_BEAM_SUBID:
|
||||
cfg->param.beam_cfg.value = *axcmd->val;
|
||||
break;
|
||||
case MLAN_11AXCMD_HTC_SUBID:
|
||||
cfg->param.htc_cfg.value = *axcmd->val;
|
||||
break;
|
||||
case MLAN_11AXCMD_TXOPRTS_SUBID:
|
||||
memcpy_ext(pmadapter, &cfg->param.txop_cfg.rts_thres,
|
||||
axcmd->val, sizeof(t_u16), sizeof(t_u16));
|
||||
break;
|
||||
case MLAN_11AXCMD_TXOMI_SUBID:
|
||||
memcpy_ext(pmadapter, &cfg->param.txomi_cfg.omi, axcmd->val,
|
||||
sizeof(t_u16), sizeof(t_u16));
|
||||
break;
|
||||
case MLAN_11AXCMD_OBSS_TOLTIME_SUBID:
|
||||
memcpy_ext(pmadapter, &cfg->param.toltime_cfg.tol_time,
|
||||
axcmd->val, sizeof(t_u32), sizeof(t_u32));
|
||||
break;
|
||||
default:
|
||||
PRINTM(MERROR, "Unknown subcmd %x\n", axcmd->sub_id);
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
LEAVE();
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function prepares TWT cfg command to configure
|
||||
* setup/teardown
|
||||
*
|
||||
* @param pmpriv A pointer to mlan_private structure
|
||||
* @param cmd A pointer to HostCmd_DS_COMMAND structure
|
||||
* @param cmd_action The action: GET or SET
|
||||
* @param pdata_buf A pointer to data buffer
|
||||
* @return Status returned
|
||||
*/
|
||||
mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf)
|
||||
{
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
HostCmd_DS_TWT_CFG *hostcmd_twtcfg =
|
||||
(HostCmd_DS_TWT_CFG *)&cmd->params.twtcfg;
|
||||
mlan_ds_twtcfg *ds_twtcfg = (mlan_ds_twtcfg *)pdata_buf;
|
||||
hostcmd_twt_setup *twt_setup_params = MNULL;
|
||||
hostcmd_twt_teardown *twt_teardown_params = MNULL;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
|
||||
ENTER();
|
||||
cmd->command = wlan_cpu_to_le16(HostCmd_CMD_TWT_CFG);
|
||||
|
||||
hostcmd_twtcfg->action = wlan_cpu_to_le16(cmd_action);
|
||||
hostcmd_twtcfg->sub_id = wlan_cpu_to_le16(ds_twtcfg->sub_id);
|
||||
|
||||
cmd->size = S_DS_GEN + sizeof(hostcmd_twtcfg->action) +
|
||||
sizeof(hostcmd_twtcfg->sub_id);
|
||||
|
||||
switch (hostcmd_twtcfg->sub_id) {
|
||||
case MLAN_11AX_TWT_SETUP_SUBID:
|
||||
twt_setup_params = &hostcmd_twtcfg->param.twt_setup;
|
||||
memset(pmadapter, twt_setup_params, 0x00,
|
||||
sizeof(hostcmd_twtcfg->param.twt_setup));
|
||||
twt_setup_params->implicit =
|
||||
ds_twtcfg->param.twt_setup.implicit;
|
||||
twt_setup_params->announced =
|
||||
ds_twtcfg->param.twt_setup.announced;
|
||||
twt_setup_params->trigger_enabled =
|
||||
ds_twtcfg->param.twt_setup.trigger_enabled;
|
||||
twt_setup_params->twt_info_disabled =
|
||||
ds_twtcfg->param.twt_setup.twt_info_disabled;
|
||||
twt_setup_params->negotiation_type =
|
||||
ds_twtcfg->param.twt_setup.negotiation_type;
|
||||
twt_setup_params->twt_wakeup_duration =
|
||||
ds_twtcfg->param.twt_setup.twt_wakeup_duration;
|
||||
twt_setup_params->flow_identifier =
|
||||
ds_twtcfg->param.twt_setup.flow_identifier;
|
||||
twt_setup_params->hard_constraint =
|
||||
ds_twtcfg->param.twt_setup.hard_constraint;
|
||||
twt_setup_params->twt_exponent =
|
||||
ds_twtcfg->param.twt_setup.twt_exponent;
|
||||
twt_setup_params->twt_mantissa = wlan_cpu_to_le16(
|
||||
ds_twtcfg->param.twt_setup.twt_mantissa);
|
||||
twt_setup_params->twt_request =
|
||||
ds_twtcfg->param.twt_setup.twt_request;
|
||||
cmd->size += sizeof(hostcmd_twtcfg->param.twt_setup);
|
||||
break;
|
||||
case MLAN_11AX_TWT_TEARDOWN_SUBID:
|
||||
twt_teardown_params = &hostcmd_twtcfg->param.twt_teardown;
|
||||
memset(pmadapter, twt_teardown_params, 0x00,
|
||||
sizeof(hostcmd_twtcfg->param.twt_teardown));
|
||||
twt_teardown_params->flow_identifier =
|
||||
ds_twtcfg->param.twt_teardown.flow_identifier;
|
||||
twt_teardown_params->negotiation_type =
|
||||
ds_twtcfg->param.twt_teardown.negotiation_type;
|
||||
twt_teardown_params->teardown_all_twt =
|
||||
ds_twtcfg->param.twt_teardown.teardown_all_twt;
|
||||
cmd->size += sizeof(hostcmd_twtcfg->param.twt_teardown);
|
||||
break;
|
||||
default:
|
||||
PRINTM(MERROR, "Unknown subcmd %x\n", ds_twtcfg->sub_id);
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
cmd->size = wlan_cpu_to_le16(cmd->size);
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TWT config command handler
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pioctl_req A pointer to ioctl request buffer
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS --success, otherwise fail
|
||||
*/
|
||||
mlan_status wlan_11ax_ioctl_twtcfg(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index];
|
||||
mlan_ds_twtcfg *cfg = MNULL;
|
||||
t_u16 cmd_action = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (pioctl_req->buf_len < sizeof(mlan_ds_twtcfg)) {
|
||||
PRINTM(MERROR, "MLAN bss IOCTL length is too short.\n");
|
||||
pioctl_req->data_read_written = 0;
|
||||
pioctl_req->buf_len_needed = sizeof(mlan_ds_twtcfg);
|
||||
pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER;
|
||||
LEAVE();
|
||||
return MLAN_STATUS_RESOURCE;
|
||||
}
|
||||
|
||||
cfg = (mlan_ds_twtcfg *)pioctl_req->pbuf;
|
||||
|
||||
if (pioctl_req->action == MLAN_ACT_SET)
|
||||
cmd_action = HostCmd_ACT_GEN_SET;
|
||||
else
|
||||
cmd_action = HostCmd_ACT_GEN_GET;
|
||||
|
||||
/* Send request to firmware */
|
||||
ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_TWT_CFG, cmd_action, 0,
|
||||
(t_void *)pioctl_req, (t_void *)cfg);
|
||||
if (ret == MLAN_STATUS_SUCCESS)
|
||||
ret = MLAN_STATUS_PENDING;
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
58
mxm_wifiex/wlan_src/mlan/mlan_11ax.h
Normal file
58
mxm_wifiex/wlan_src/mlan/mlan_11ax.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/** @file mlan_11ax.h
|
||||
*
|
||||
* @brief This file contains the functions for station ioctl.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MLAN_11AX_H_
|
||||
#define _MLAN_11AX_H_
|
||||
|
||||
/** device support 2.4G 40MHZ*/
|
||||
#define AX_2G_40MHZ_SUPPORT MBIT(1)
|
||||
/** device support 2.4G 242 tone RUs */
|
||||
#define AX_2G_20MHZ_SUPPORT MBIT(5)
|
||||
|
||||
t_u8 wlan_check_11ax_twt_supported(mlan_private *pmpriv,
|
||||
BSSDescriptor_t *pbss_desc);
|
||||
mlan_status wlan_11ax_ioctl_twtcfg(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u8 band,
|
||||
MrvlIEtypes_Extension_t *phe_cap, t_u8 flag);
|
||||
void wlan_update_11ax_cap(mlan_adapter *pmadapter,
|
||||
MrvlIEtypes_Extension_t *hw_he_cap);
|
||||
int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
|
||||
t_u8 **ppbuffer);
|
||||
t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band);
|
||||
mlan_status wlan_11ax_cfg_ioctl(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
|
||||
mlan_status wlan_cmd_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
mlan_status wlan_ret_11ax_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
mlan_status wlan_cmd_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
mlan_status wlan_ret_11ax_cmd(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
|
||||
#endif /* _MLAN_11AX_H_ */
|
1590
mxm_wifiex/wlan_src/mlan/mlan_11d.c
Normal file
1590
mxm_wifiex/wlan_src/mlan/mlan_11d.c
Normal file
File diff suppressed because it is too large
Load diff
4274
mxm_wifiex/wlan_src/mlan/mlan_11h.c
Normal file
4274
mxm_wifiex/wlan_src/mlan/mlan_11h.c
Normal file
File diff suppressed because it is too large
Load diff
201
mxm_wifiex/wlan_src/mlan/mlan_11h.h
Normal file
201
mxm_wifiex/wlan_src/mlan/mlan_11h.h
Normal file
|
@ -0,0 +1,201 @@
|
|||
/** @file mlan_11h.h
|
||||
*
|
||||
* @brief This header file contains data structures and
|
||||
* function declarations of 802.11h
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************
|
||||
Change Log:
|
||||
03/26/2009: initial creation
|
||||
*************************************************************/
|
||||
|
||||
#ifndef _MLAN_11H_
|
||||
#define _MLAN_11H_
|
||||
|
||||
/** 11H OID bitmasks */
|
||||
#define ENABLE_11H_MASK MBIT(0)
|
||||
#define MASTER_RADAR_DET_MASK MBIT(1)
|
||||
#define SLAVE_RADAR_DET_MASK MBIT(2)
|
||||
|
||||
/** DFS Master Radar Detect global enable */
|
||||
#define DFS_MASTER_RADAR_DETECT_EN (MTRUE)
|
||||
/** DFS Slave Radar Detect global enable */
|
||||
#define DFS_SLAVE_RADAR_DETECT_EN (MFALSE)
|
||||
|
||||
#define CHANNEL_OFFSET_MASK 0x30
|
||||
#define CHANNEL_BANDWIDTH_MASK 0x0C
|
||||
|
||||
/**
|
||||
* 11H APIs
|
||||
*/
|
||||
|
||||
/* Is master radar detection enabled in firmware? */
|
||||
extern t_bool wlan_11h_is_master_radar_det_active(mlan_private *priv);
|
||||
|
||||
/** Configure master radar detection.
|
||||
* Need call wlan_11h_check_update_radar_det_state() after.
|
||||
*/
|
||||
extern mlan_status wlan_11h_config_master_radar_det(mlan_private *priv,
|
||||
t_bool enable);
|
||||
|
||||
/** Configure slave radar detection.
|
||||
* Need call wlan_11h_check_update_radar_det_state() after.
|
||||
*/
|
||||
extern mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv,
|
||||
t_bool enable);
|
||||
|
||||
/** Checks all interfaces and updates radar detect flags if necessary */
|
||||
extern mlan_status wlan_11h_check_update_radar_det_state(mlan_private *pmpriv);
|
||||
|
||||
/** Return 1 if 11h is active in the firmware, 0 if it is inactive */
|
||||
extern t_bool wlan_11h_is_active(mlan_private *priv);
|
||||
|
||||
/** Enable the tx interface and record the new transmit state */
|
||||
extern void wlan_11h_tx_enable(mlan_private *priv);
|
||||
|
||||
/** Disable the tx interface and record the new transmit state */
|
||||
extern void wlan_11h_tx_disable(mlan_private *priv);
|
||||
|
||||
/** Activate 11h extensions in the firmware */
|
||||
extern mlan_status wlan_11h_activate(mlan_private *priv, t_void *pioctl_buf,
|
||||
t_bool flag);
|
||||
|
||||
/** Initialize the 11h device structure */
|
||||
extern void wlan_11h_init(mlan_adapter *pmadapter);
|
||||
|
||||
/** Cleanup for the 11h device structure */
|
||||
extern void wlan_11h_cleanup(mlan_adapter *pmadapter);
|
||||
|
||||
/** Initialize the 11h interface structure */
|
||||
extern void wlan_11h_priv_init(mlan_private *pmpriv);
|
||||
|
||||
/** Get an initial random channel to start an adhoc network on */
|
||||
extern t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv);
|
||||
|
||||
/** Get channel that has been closed via Channel Switch Announcement */
|
||||
extern t_u8 wlan_11h_get_csa_closed_channel(mlan_private *priv);
|
||||
|
||||
/** Check if radar detection is required on the specified channel */
|
||||
extern t_bool wlan_11h_radar_detect_required(mlan_private *priv, t_u8 channel);
|
||||
|
||||
/** Perform a standard availibility check on the specified channel */
|
||||
extern t_s32 wlan_11h_issue_radar_detect(mlan_private *priv,
|
||||
pmlan_ioctl_req pioctl_req,
|
||||
t_u8 channel, Band_Config_t bandcfg);
|
||||
|
||||
/** Check previously issued radar report for a channel */
|
||||
extern mlan_status wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan);
|
||||
|
||||
/** Add any 11h TLVs necessary to complete an adhoc start command */
|
||||
extern t_s32 wlan_11h_process_start(mlan_private *priv, t_u8 **ppbuffer,
|
||||
IEEEtypes_CapInfo_t *pcap_info,
|
||||
t_u32 channel,
|
||||
wlan_11h_bss_info_t *p11h_bss_info);
|
||||
|
||||
/** Add any 11h TLVs necessary to complete a join command (adhoc or infra) */
|
||||
extern t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer,
|
||||
IEEEtypes_CapInfo_t *pcap_info, t_u8 band,
|
||||
t_u32 channel,
|
||||
wlan_11h_bss_info_t *p11h_bss_info);
|
||||
|
||||
/** Complete the firmware command preparation for an 11h command function */
|
||||
extern mlan_status wlan_11h_cmd_process(mlan_private *priv,
|
||||
HostCmd_DS_COMMAND *pcmd_ptr,
|
||||
const t_void *pinfo_buf);
|
||||
|
||||
/** Process the response of an 11h firmware command */
|
||||
extern mlan_status wlan_11h_cmdresp_process(mlan_private *priv,
|
||||
const HostCmd_DS_COMMAND *resp);
|
||||
|
||||
/** Receive IEs from scan processing and record any needed info for 11h */
|
||||
extern mlan_status wlan_11h_process_bss_elem(mlan_adapter *pmadapter,
|
||||
wlan_11h_bss_info_t *p11h_bss_info,
|
||||
const t_u8 *pelement);
|
||||
|
||||
/** Handler for EVENT_CHANNEL_SWITCH_ANN */
|
||||
extern mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv);
|
||||
|
||||
/** Handler for EVENT_CHANNEL_REPORT_RDY */
|
||||
extern mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv,
|
||||
mlan_event *pevent,
|
||||
t_u8 *radar_chan);
|
||||
|
||||
/** Debug output for EVENT_RADAR_DETECTED */
|
||||
mlan_status wlan_11h_print_event_radar_detected(mlan_private *priv,
|
||||
mlan_event *pevent,
|
||||
t_u8 *radar_chan);
|
||||
|
||||
t_s32 wlan_11h_cancel_radar_detect(mlan_private *priv);
|
||||
/** Handler for DFS_TESTING IOCTL */
|
||||
extern mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
extern mlan_status
|
||||
wlan_11h_ioctl_get_channel_nop_info(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
|
||||
extern mlan_status wlan_11h_ioctl_dfs_chan_report(mlan_private *priv,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
extern mlan_status wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
|
||||
/** get/set dfs w53 cfg */
|
||||
mlan_status wlan_11h_ioctl_dfs_w53_cfg(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
|
||||
/** Check if channel is under a NOP duration (should not be used) */
|
||||
extern t_bool wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter,
|
||||
t_u8 channel);
|
||||
|
||||
/** Check if RADAR_DETECTED handling is blocking data tx */
|
||||
extern t_bool wlan_11h_radar_detected_tx_blocked(mlan_adapter *pmadapter);
|
||||
|
||||
/** Callback for RADAR_DETECTED (for UAP cmdresp) */
|
||||
extern mlan_status wlan_11h_radar_detected_callback(t_void *priv);
|
||||
/** set dfs check channel */
|
||||
void wlan_11h_set_dfs_check_chan(mlan_private *priv, t_u8 chan);
|
||||
|
||||
#ifdef UAP_SUPPORT
|
||||
/** BW_change event Handler for dfs_repeater */
|
||||
void wlan_dfs_rep_bw_change(mlan_adapter *pmadapter);
|
||||
|
||||
/** disconnect event Handler for dfs_repeater */
|
||||
void wlan_dfs_rep_disconnect(mlan_adapter *pmadapter);
|
||||
#endif
|
||||
|
||||
/** Handler for RADAR_DETECTED */
|
||||
extern mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter,
|
||||
mlan_private *priv);
|
||||
|
||||
mlan_status wlan_11h_remove_custom_ie(mlan_adapter *pmadapter,
|
||||
mlan_private *pmpriv);
|
||||
|
||||
/** DFS Event pre-processing */
|
||||
extern mlan_status wlan_11h_dfs_event_preprocessing(mlan_adapter *pmadapter);
|
||||
|
||||
/** DFS switch to non-DFS channel */
|
||||
extern mlan_status wlan_11h_switch_non_dfs_chan(mlan_private *priv, t_u8 *chan);
|
||||
|
||||
extern void wlan_11h_update_bandcfg(Band_Config_t *uap_band_cfg,
|
||||
t_u8 new_channel);
|
||||
|
||||
/** function checks if interface is active. **/
|
||||
extern t_bool wlan_is_intf_active(mlan_private *pmpriv);
|
||||
|
||||
#endif /*_MLAN_11H_ */
|
3092
mxm_wifiex/wlan_src/mlan/mlan_11n.c
Normal file
3092
mxm_wifiex/wlan_src/mlan/mlan_11n.c
Normal file
File diff suppressed because it is too large
Load diff
408
mxm_wifiex/wlan_src/mlan/mlan_11n.h
Normal file
408
mxm_wifiex/wlan_src/mlan/mlan_11n.h
Normal file
|
@ -0,0 +1,408 @@
|
|||
/** @file mlan_11n.h
|
||||
*
|
||||
* @brief Interface for the 802.11n mlan_11n module implemented in mlan_11n.c
|
||||
*
|
||||
* Driver interface functions and type declarations for the 11n module
|
||||
* implemented in mlan_11n.c.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
12/01/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MLAN_11N_H_
|
||||
#define _MLAN_11N_H_
|
||||
|
||||
#include "mlan_11n_aggr.h"
|
||||
#include "mlan_11n_rxreorder.h"
|
||||
#include "mlan_wmm.h"
|
||||
|
||||
/** Print the 802.11n device capability */
|
||||
void wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap);
|
||||
/** Print the 802.11n device MCS */
|
||||
void wlan_show_devmcssupport(pmlan_adapter pmadapter, t_u8 support);
|
||||
/** Handle the command response of a delete block ack request */
|
||||
mlan_status wlan_ret_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *resp);
|
||||
/** Handle the command response of an add block ack request */
|
||||
mlan_status wlan_ret_11n_addba_req(mlan_private *priv,
|
||||
HostCmd_DS_COMMAND *resp);
|
||||
/** Handle the command response of 11ncfg command */
|
||||
mlan_status wlan_ret_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
/** Prepare 11ncfg command */
|
||||
mlan_status wlan_cmd_11n_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
/** Prepare reject addba requst command */
|
||||
mlan_status wlan_cmd_reject_addba_req(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd, t_u16 cmd_action,
|
||||
t_void *pdata_buf);
|
||||
/** Handle the command response of rejecting addba request */
|
||||
mlan_status wlan_ret_reject_addba_req(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
/** Prepare TX BF configuration command */
|
||||
mlan_status wlan_cmd_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
|
||||
t_u16 cmd_action, t_void *pdata_buf);
|
||||
/** Handle the command response TX BF configuration */
|
||||
mlan_status wlan_ret_tx_bf_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
#ifdef STA_SUPPORT
|
||||
t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u8 bss_band);
|
||||
/** Append the 802_11N tlv */
|
||||
int wlan_cmd_append_11n_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
|
||||
t_u8 **ppbuffer);
|
||||
/** wlan fill HT cap tlv */
|
||||
void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap,
|
||||
t_u16 band, t_u8 fill);
|
||||
/** wlan fill HT cap IE */
|
||||
void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap,
|
||||
t_u16 bands);
|
||||
#endif /* STA_SUPPORT */
|
||||
/** Miscellaneous configuration handler */
|
||||
mlan_status wlan_11n_cfg_ioctl(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
/** Delete Tx BA stream table entry */
|
||||
void wlan_11n_delete_txbastream_tbl_entry(mlan_private *priv,
|
||||
TxBAStreamTbl *ptx_tbl);
|
||||
/** Delete all Tx BA stream table entries */
|
||||
void wlan_11n_deleteall_txbastream_tbl(mlan_private *priv);
|
||||
/** Get Tx BA stream table */
|
||||
TxBAStreamTbl *wlan_11n_get_txbastream_tbl(mlan_private *priv, int tid,
|
||||
t_u8 *ra, int lock);
|
||||
/** Create Tx BA stream table */
|
||||
void wlan_11n_create_txbastream_tbl(mlan_private *priv, t_u8 *ra, int tid,
|
||||
baStatus_e ba_status);
|
||||
/** Send ADD BA request */
|
||||
int wlan_send_addba(mlan_private *priv, int tid, t_u8 *peer_mac);
|
||||
/** Send DEL BA request */
|
||||
int wlan_send_delba(mlan_private *priv, pmlan_ioctl_req pioctl_req, int tid,
|
||||
t_u8 *peer_mac, int initiator);
|
||||
/** This function handles the command response of delete a block ack request*/
|
||||
void wlan_11n_delete_bastream(mlan_private *priv, t_u8 *del_ba);
|
||||
/** get rx reorder table */
|
||||
int wlan_get_rxreorder_tbl(mlan_private *priv, rx_reorder_tbl *buf);
|
||||
/** get tx ba stream table */
|
||||
int wlan_get_txbastream_tbl(mlan_private *priv, tx_ba_stream_tbl *buf);
|
||||
/** send delba */
|
||||
void wlan_11n_delba(mlan_private *priv, int tid);
|
||||
/** update amdpdu tx win size */
|
||||
void wlan_update_ampdu_txwinsize(pmlan_adapter pmadapter);
|
||||
/** Minimum number of AMSDU */
|
||||
#define MIN_NUM_AMSDU 2
|
||||
/** AMSDU Aggr control cmd resp */
|
||||
mlan_status wlan_ret_amsdu_aggr_ctrl(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
void wlan_set_tx_pause_flag(mlan_private *priv, t_u8 flag);
|
||||
/** reconfigure tx buf size */
|
||||
mlan_status wlan_cmd_recfg_tx_buf(mlan_private *priv, HostCmd_DS_COMMAND *cmd,
|
||||
int cmd_action, void *pdata_buf);
|
||||
/** AMSDU aggr control cmd */
|
||||
mlan_status wlan_cmd_amsdu_aggr_ctrl(mlan_private *priv,
|
||||
HostCmd_DS_COMMAND *cmd, int cmd_action,
|
||||
void *pdata_buf);
|
||||
|
||||
t_u8 wlan_validate_chan_offset(mlan_private *pmpriv, t_u16 band, t_u32 chan,
|
||||
t_u8 chan_bw);
|
||||
/** get channel offset */
|
||||
t_u8 wlan_get_second_channel_offset(int chan);
|
||||
|
||||
void wlan_update_11n_cap(mlan_private *pmpriv);
|
||||
|
||||
/** clean up txbastream_tbl */
|
||||
void wlan_11n_cleanup_txbastream_tbl(mlan_private *priv, t_u8 *ra);
|
||||
/**
|
||||
* @brief This function checks whether a station has 11N enabled or not
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param mac station mac address
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 is_station_11n_enabled(mlan_private *priv, t_u8 *mac)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
sta_ptr = wlan_get_station_entry(priv, mac);
|
||||
if (sta_ptr)
|
||||
return (sta_ptr->is_11n_enabled) ? MTRUE : MFALSE;
|
||||
return MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function get station max amsdu size
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param mac station mac address
|
||||
* @return max amsdu size statio supported
|
||||
*/
|
||||
static INLINE t_u16 get_station_max_amsdu_size(mlan_private *priv, t_u8 *mac)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
sta_ptr = wlan_get_station_entry(priv, mac);
|
||||
if (sta_ptr)
|
||||
return sta_ptr->max_amsdu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks whether a station allows AMPDU or not
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param ptr A pointer to RA list table
|
||||
* @param tid TID value for ptr
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 is_station_ampdu_allowed(mlan_private *priv, raListTbl *ptr,
|
||||
int tid)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
|
||||
if (sta_ptr) {
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
|
||||
if (priv->sec_info.wapi_enabled &&
|
||||
!sta_ptr->wapi_key_on)
|
||||
return MFALSE;
|
||||
}
|
||||
return (sta_ptr->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ?
|
||||
MTRUE :
|
||||
MFALSE;
|
||||
}
|
||||
return MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function disable station ampdu for specific tid
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param tid tid index
|
||||
* @param ra station mac address
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE void disable_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
sta_ptr = wlan_get_station_entry(priv, ra);
|
||||
if (sta_ptr)
|
||||
sta_ptr->ampdu_sta[tid] = BA_STREAM_NOT_ALLOWED;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function reset station ampdu for specific id to user setting.
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param tid tid index
|
||||
* @param ra station mac address
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE void reset_station_ampdu(mlan_private *priv, t_u8 tid, t_u8 *ra)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
sta_ptr = wlan_get_station_entry(priv, ra);
|
||||
if (sta_ptr)
|
||||
sta_ptr->ampdu_sta[tid] = priv->aggr_prio_tbl[tid].ampdu_user;
|
||||
return;
|
||||
}
|
||||
|
||||
#define IS_BG_RATE (priv->bitmap_rates[0] || priv->bitmap_rates[1])
|
||||
/**
|
||||
* @brief This function checks whether AMPDU is allowed or not
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param ptr A pointer to RA list table
|
||||
* @param tid TID value for ptr
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 wlan_is_ampdu_allowed(mlan_private *priv, raListTbl *ptr,
|
||||
int tid)
|
||||
{
|
||||
if ((!priv->is_data_rate_auto) && IS_BG_RATE)
|
||||
return MFALSE;
|
||||
#ifdef UAP_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)
|
||||
return is_station_ampdu_allowed(priv, ptr, tid);
|
||||
#endif /* UAP_SUPPORT */
|
||||
if (priv->sec_info.wapi_enabled && !priv->sec_info.wapi_key_on)
|
||||
return MFALSE;
|
||||
return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) ?
|
||||
MTRUE :
|
||||
MFALSE;
|
||||
}
|
||||
|
||||
#define BA_RSSI_HIGH_THRESHOLD -70
|
||||
|
||||
static INLINE void wlan_update_station_del_ba_count(mlan_private *priv,
|
||||
raListTbl *ptr)
|
||||
{
|
||||
sta_node *sta_ptr = MNULL;
|
||||
t_s8 rssi;
|
||||
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
|
||||
if (sta_ptr) {
|
||||
rssi = sta_ptr->snr - sta_ptr->nf;
|
||||
if (rssi > BA_RSSI_HIGH_THRESHOLD)
|
||||
ptr->del_ba_count = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void wlan_update_del_ba_count(mlan_private *priv, raListTbl *ptr)
|
||||
{
|
||||
t_s8 rssi;
|
||||
#ifdef UAP_802_11N
|
||||
#ifdef UAP_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP)
|
||||
return wlan_update_station_del_ba_count(priv, ptr);
|
||||
#endif /* UAP_SUPPORT */
|
||||
#endif /* UAP_802_11N */
|
||||
rssi = priv->snr - priv->nf;
|
||||
if (rssi > BA_RSSI_HIGH_THRESHOLD)
|
||||
ptr->del_ba_count = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks whether AMSDU is allowed or not
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param ptr A pointer to RA list table
|
||||
* @param tid TID value for ptr
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 wlan_is_amsdu_allowed(mlan_private *priv, raListTbl *ptr,
|
||||
int tid)
|
||||
{
|
||||
#ifdef UAP_SUPPORT
|
||||
sta_node *sta_ptr = MNULL;
|
||||
#endif
|
||||
if (priv->amsdu_disable)
|
||||
return MFALSE;
|
||||
#ifdef UAP_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
|
||||
sta_ptr = wlan_get_station_entry(priv, ptr->ra);
|
||||
if (sta_ptr) {
|
||||
if (priv->sec_info.wapi_enabled &&
|
||||
!sta_ptr->wapi_key_on)
|
||||
return MFALSE;
|
||||
}
|
||||
}
|
||||
#endif /* UAP_SUPPORT */
|
||||
#define TXRATE_BITMAP_INDEX_MCS0_7 2
|
||||
return ((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED) &&
|
||||
((priv->is_data_rate_auto) ||
|
||||
!(((priv->bitmap_rates[TXRATE_BITMAP_INDEX_MCS0_7]) & 0x03) ||
|
||||
IS_BG_RATE))) ?
|
||||
MTRUE :
|
||||
MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks whether a BA stream is available or not
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 wlan_is_bastream_avail(mlan_private *priv)
|
||||
{
|
||||
mlan_private *pmpriv = MNULL;
|
||||
t_u8 i = 0;
|
||||
t_u32 bastream_num = 0;
|
||||
t_u32 bastream_max = 0;
|
||||
for (i = 0; i < priv->adapter->priv_num; i++) {
|
||||
pmpriv = priv->adapter->priv[i];
|
||||
if (pmpriv)
|
||||
bastream_num += wlan_wmm_list_len(
|
||||
(pmlan_list_head)&pmpriv->tx_ba_stream_tbl_ptr);
|
||||
}
|
||||
bastream_max = ISSUPP_GETTXBASTREAM(priv->adapter->hw_dot_11n_dev_cap);
|
||||
if (bastream_max == 0)
|
||||
bastream_max = MLAN_MAX_TX_BASTREAM_DEFAULT;
|
||||
return (bastream_num < bastream_max) ? MTRUE : MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function finds the stream to delete
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param ptr A pointer to RA list table
|
||||
* @param ptr_tid TID value of ptr
|
||||
* @param ptid A pointer to TID of stream to delete, if return MTRUE
|
||||
* @param ra RA of stream to delete, if return MTRUE
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE t_u8 wlan_find_stream_to_delete(mlan_private *priv,
|
||||
raListTbl *ptr, int ptr_tid,
|
||||
int *ptid, t_u8 *ra)
|
||||
{
|
||||
int tid;
|
||||
t_u8 ret = MFALSE;
|
||||
TxBAStreamTbl *ptx_tbl;
|
||||
|
||||
ENTER();
|
||||
|
||||
ptx_tbl = (TxBAStreamTbl *)util_peek_list(priv->adapter->pmoal_handle,
|
||||
&priv->tx_ba_stream_tbl_ptr,
|
||||
MNULL, MNULL);
|
||||
if (!ptx_tbl) {
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user;
|
||||
|
||||
while (ptx_tbl != (TxBAStreamTbl *)&priv->tx_ba_stream_tbl_ptr) {
|
||||
if (tid > priv->aggr_prio_tbl[ptx_tbl->tid].ampdu_user) {
|
||||
tid = priv->aggr_prio_tbl[ptx_tbl->tid].ampdu_user;
|
||||
*ptid = ptx_tbl->tid;
|
||||
memcpy_ext(priv->adapter, ra, ptx_tbl->ra,
|
||||
MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH);
|
||||
ret = MTRUE;
|
||||
}
|
||||
|
||||
ptx_tbl = ptx_tbl->pnext;
|
||||
}
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks whether 11n is supported
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param ra Address of the receiver STA
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
static INLINE int wlan_is_11n_enabled(mlan_private *priv, t_u8 *ra)
|
||||
{
|
||||
int ret = MFALSE;
|
||||
ENTER();
|
||||
#ifdef UAP_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
|
||||
if ((!(ra[0] & 0x01)) && (priv->is_11n_enabled))
|
||||
ret = is_station_11n_enabled(priv, ra);
|
||||
}
|
||||
#endif /* UAP_SUPPORT */
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
#endif /* !_MLAN_11N_H_ */
|
603
mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c
Normal file
603
mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c
Normal file
|
@ -0,0 +1,603 @@
|
|||
/** @file mlan_11n_aggr.c
|
||||
*
|
||||
* @brief This file contains functions for 11n Aggregation.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
11/10/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_join.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_wmm.h"
|
||||
#include "mlan_11n.h"
|
||||
#include "mlan_11n_aggr.h"
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
/**
|
||||
* @brief Aggregate individual packets into one AMSDU packet
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param amsdu_buf A pointer to packet buffer
|
||||
* @param data A pointer to aggregated data packet being formed
|
||||
* @param pkt_len Length of current packet to aggregate
|
||||
* @param pad Pad
|
||||
*
|
||||
* @return Final packet size
|
||||
*/
|
||||
static int wlan_11n_form_amsdu_pkt(pmlan_adapter pmadapter, t_u8 *amsdu_buf,
|
||||
t_u8 *data, int pkt_len, int *pad)
|
||||
{
|
||||
int dt_offset, amsdu_buf_offset;
|
||||
Rfc1042Hdr_t snap = {
|
||||
0xaa, /* LLC DSAP */
|
||||
0xaa, /* LLC SSAP */
|
||||
0x03, /* LLC CTRL */
|
||||
{0x00, 0x00, 0x00}, /* SNAP OUI */
|
||||
0x0000 /* SNAP type */
|
||||
/*
|
||||
* This field will be overwritten
|
||||
* later with ethertype
|
||||
*/
|
||||
};
|
||||
|
||||
ENTER();
|
||||
|
||||
memcpy_ext(pmadapter, amsdu_buf, data, (MLAN_MAC_ADDR_LENGTH)*2,
|
||||
(MLAN_MAC_ADDR_LENGTH)*2);
|
||||
dt_offset = amsdu_buf_offset = (MLAN_MAC_ADDR_LENGTH)*2;
|
||||
|
||||
snap.snap_type = *(t_u16 *)(data + dt_offset);
|
||||
dt_offset += sizeof(t_u16);
|
||||
*(t_u16 *)(amsdu_buf + amsdu_buf_offset) =
|
||||
mlan_htons(pkt_len + LLC_SNAP_LEN -
|
||||
((2 * MLAN_MAC_ADDR_LENGTH) + sizeof(t_u16)));
|
||||
amsdu_buf_offset += sizeof(t_u16);
|
||||
memcpy_ext(pmadapter, amsdu_buf + amsdu_buf_offset, &snap, LLC_SNAP_LEN,
|
||||
LLC_SNAP_LEN);
|
||||
amsdu_buf_offset += LLC_SNAP_LEN;
|
||||
|
||||
memcpy_ext(pmadapter, amsdu_buf + amsdu_buf_offset, data + dt_offset,
|
||||
pkt_len - dt_offset, pkt_len - dt_offset);
|
||||
*pad = (((pkt_len + LLC_SNAP_LEN) & 3)) ?
|
||||
(4 - (((pkt_len + LLC_SNAP_LEN)) & 3)) :
|
||||
0;
|
||||
|
||||
LEAVE();
|
||||
return pkt_len + LLC_SNAP_LEN + *pad;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add TxPD to AMSDU header
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param mbuf Pointer to buffer where the TxPD will be formed
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static void wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf)
|
||||
{
|
||||
TxPD *ptx_pd;
|
||||
mlan_adapter *pmadapter = priv->adapter;
|
||||
|
||||
ENTER();
|
||||
|
||||
ptx_pd = (TxPD *)mbuf->pbuf;
|
||||
memset(pmadapter, ptx_pd, 0, sizeof(TxPD));
|
||||
|
||||
/*
|
||||
* Original priority has been overwritten
|
||||
*/
|
||||
ptx_pd->priority = (t_u8)mbuf->priority;
|
||||
ptx_pd->pkt_delay_2ms =
|
||||
wlan_wmm_compute_driver_packet_delay(priv, mbuf);
|
||||
ptx_pd->bss_num = GET_BSS_NUM(priv);
|
||||
ptx_pd->bss_type = priv->bss_type;
|
||||
/* Always zero as the data is followed by TxPD */
|
||||
ptx_pd->tx_pkt_offset = sizeof(TxPD);
|
||||
ptx_pd->tx_pkt_type = PKT_TYPE_AMSDU;
|
||||
if (ptx_pd->tx_control == 0)
|
||||
/* TxCtrl set by user or default */
|
||||
ptx_pd->tx_control = priv->pkt_tx_ctrl;
|
||||
|
||||
endian_convert_TxPD(ptx_pd);
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update the TxPktLength field in TxPD after the complete AMSDU
|
||||
* packet is formed
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param mbuf TxPD buffer
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE void wlan_11n_update_pktlen_amsdu_txpd(mlan_private *priv,
|
||||
pmlan_buffer mbuf)
|
||||
{
|
||||
TxPD *ptx_pd;
|
||||
ENTER();
|
||||
|
||||
ptx_pd = (TxPD *)mbuf->pbuf;
|
||||
ptx_pd->tx_pkt_length =
|
||||
(t_u16)wlan_cpu_to_le16(mbuf->data_len - sizeof(TxPD));
|
||||
#ifdef STA_SUPPORT
|
||||
if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
|
||||
(priv->adapter->pps_uapsd_mode)) {
|
||||
if (MTRUE == wlan_check_last_packet_indication(priv)) {
|
||||
priv->adapter->tx_lock_flag = MTRUE;
|
||||
ptx_pd->flags |= MRVDRV_TxPD_POWER_MGMT_LAST_PACKET;
|
||||
}
|
||||
}
|
||||
#endif /* STA_SUPPORT */
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get number of aggregated packets
|
||||
*
|
||||
* @param data A pointer to packet data
|
||||
* @param total_pkt_len Total packet length
|
||||
*
|
||||
* @return Number of packets
|
||||
*/
|
||||
static int wlan_11n_get_num_aggrpkts(t_u8 *data, int total_pkt_len)
|
||||
{
|
||||
int pkt_count = 0, pkt_len, pad;
|
||||
t_u8 hdr_len = sizeof(Eth803Hdr_t);
|
||||
|
||||
ENTER();
|
||||
while (total_pkt_len >= hdr_len) {
|
||||
/* Length will be in network format, change it to host */
|
||||
pkt_len = mlan_ntohs(
|
||||
(*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH))));
|
||||
if (pkt_len > total_pkt_len) {
|
||||
PRINTM(MERROR, "Error in packet length.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ?
|
||||
(4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) :
|
||||
0;
|
||||
data += pkt_len + pad + sizeof(Eth803Hdr_t);
|
||||
total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t);
|
||||
++pkt_count;
|
||||
}
|
||||
LEAVE();
|
||||
return pkt_count;
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief Deaggregate the received AMSDU packet
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param pmbuf A pointer to aggregated data packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS --success, otherwise fail
|
||||
*/
|
||||
mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf)
|
||||
{
|
||||
t_u16 pkt_len;
|
||||
int total_pkt_len;
|
||||
t_u8 *data;
|
||||
mlan_adapter *pmadapter = priv->adapter;
|
||||
t_u32 max_rx_data_size = MLAN_RX_DATA_BUF_SIZE;
|
||||
int pad;
|
||||
mlan_status ret = MLAN_STATUS_FAILURE;
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
mlan_buffer *daggr_mbuf = MNULL;
|
||||
t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03,
|
||||
0x00, 0x00, 0x00};
|
||||
t_u8 hdr_len = sizeof(Eth803Hdr_t);
|
||||
t_u8 eapol_type[2] = {0x88, 0x8e};
|
||||
|
||||
ENTER();
|
||||
|
||||
data = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
total_pkt_len = pmbuf->data_len;
|
||||
|
||||
/* Sanity test */
|
||||
#if defined(USB)
|
||||
if (IS_USB(pmadapter->card_type) &&
|
||||
pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.enable) {
|
||||
max_rx_data_size =
|
||||
pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.aggr_max;
|
||||
if (pmadapter->pcard_usb->usb_rx_deaggr.aggr_ctrl.aggr_mode ==
|
||||
MLAN_USB_AGGR_MODE_NUM) {
|
||||
max_rx_data_size *=
|
||||
MAX(MLAN_USB_MAX_PKT_SIZE,
|
||||
pmadapter->pcard_usb->usb_rx_deaggr
|
||||
.aggr_ctrl.aggr_align);
|
||||
max_rx_data_size =
|
||||
MAX(max_rx_data_size, MLAN_RX_DATA_BUF_SIZE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (total_pkt_len > max_rx_data_size) {
|
||||
PRINTM(MERROR,
|
||||
"Total packet length greater than tx buffer"
|
||||
" size %d\n",
|
||||
total_pkt_len);
|
||||
goto done;
|
||||
}
|
||||
|
||||
pmbuf->use_count = wlan_11n_get_num_aggrpkts(data, total_pkt_len);
|
||||
|
||||
// rx_trace 7
|
||||
if (pmadapter->tp_state_on)
|
||||
pmadapter->callbacks.moal_tp_accounting(
|
||||
pmadapter->pmoal_handle, pmbuf, 7 /*RX_DROP_P3*/);
|
||||
if (pmadapter->tp_state_drop_point == 7 /*RX_DROP_P3*/)
|
||||
goto done;
|
||||
|
||||
while (total_pkt_len >= hdr_len) {
|
||||
prx_pkt = (RxPacketHdr_t *)data;
|
||||
/* Length will be in network format, change it to host */
|
||||
pkt_len = mlan_ntohs(
|
||||
(*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH))));
|
||||
if (pkt_len > total_pkt_len) {
|
||||
PRINTM(MERROR,
|
||||
"Error in packet length: total_pkt_len = %d, pkt_len = %d\n",
|
||||
total_pkt_len, pkt_len);
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
pad = (((pkt_len + sizeof(Eth803Hdr_t)) & 3)) ?
|
||||
(4 - ((pkt_len + sizeof(Eth803Hdr_t)) & 3)) :
|
||||
0;
|
||||
|
||||
total_pkt_len -= pkt_len + pad + sizeof(Eth803Hdr_t);
|
||||
|
||||
if (memcmp(pmadapter, &prx_pkt->rfc1042_hdr, rfc1042_eth_hdr,
|
||||
sizeof(rfc1042_eth_hdr)) == 0) {
|
||||
memmove(pmadapter, data + LLC_SNAP_LEN, data,
|
||||
(2 * MLAN_MAC_ADDR_LENGTH));
|
||||
data += LLC_SNAP_LEN;
|
||||
pkt_len += sizeof(Eth803Hdr_t) - LLC_SNAP_LEN;
|
||||
} else {
|
||||
*(t_u16 *)(data + (2 * MLAN_MAC_ADDR_LENGTH)) =
|
||||
(t_u16)0;
|
||||
pkt_len += sizeof(Eth803Hdr_t);
|
||||
}
|
||||
daggr_mbuf = wlan_alloc_mlan_buffer(pmadapter,
|
||||
pkt_len + MLAN_NET_IP_ALIGN,
|
||||
0, MOAL_ALLOC_MLAN_BUFFER);
|
||||
if (daggr_mbuf == MNULL) {
|
||||
PRINTM(MERROR, "Error allocating daggr mlan_buffer\n");
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
break;
|
||||
}
|
||||
daggr_mbuf->data_offset += MLAN_NET_IP_ALIGN;
|
||||
daggr_mbuf->bss_index = pmbuf->bss_index;
|
||||
daggr_mbuf->buf_type = pmbuf->buf_type;
|
||||
daggr_mbuf->data_len = pkt_len;
|
||||
daggr_mbuf->in_ts_sec = pmbuf->in_ts_sec;
|
||||
daggr_mbuf->in_ts_usec = pmbuf->in_ts_usec;
|
||||
daggr_mbuf->pparent = pmbuf;
|
||||
daggr_mbuf->priority = pmbuf->priority;
|
||||
memcpy_ext(pmadapter,
|
||||
daggr_mbuf->pbuf + daggr_mbuf->data_offset, data,
|
||||
pkt_len, daggr_mbuf->data_len);
|
||||
|
||||
#ifdef UAP_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
|
||||
ret = wlan_uap_recv_packet(priv, daggr_mbuf);
|
||||
} else {
|
||||
#endif /* UAP_SUPPORT */
|
||||
/** send EAPOL from AMSDU pkt to firmware */
|
||||
if (priv->sec_info.ewpa_enabled &&
|
||||
(!memcmp(pmadapter,
|
||||
daggr_mbuf->pbuf +
|
||||
daggr_mbuf->data_offset +
|
||||
MLAN_ETHER_PKT_TYPE_OFFSET,
|
||||
eapol_type, sizeof(eapol_type)))) {
|
||||
ret = wlan_prepare_cmd(
|
||||
priv, HostCmd_CMD_802_11_EAPOL_PKT, 0,
|
||||
0, MNULL, daggr_mbuf);
|
||||
if (ret == MLAN_STATUS_SUCCESS)
|
||||
wlan_recv_event(
|
||||
priv,
|
||||
MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
wlan_free_mlan_buffer(pmadapter, daggr_mbuf);
|
||||
data += pkt_len + pad;
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pmadapter->callbacks.moal_recv_packet(
|
||||
pmadapter->pmoal_handle, daggr_mbuf);
|
||||
#ifdef UAP_SUPPORT
|
||||
}
|
||||
#endif /* UAP_SUPPORT */
|
||||
switch (ret) {
|
||||
case MLAN_STATUS_PENDING:
|
||||
break;
|
||||
case MLAN_STATUS_FAILURE:
|
||||
PRINTM(MERROR, "Deaggr, send to moal failed\n");
|
||||
daggr_mbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
/* fall through */
|
||||
case MLAN_STATUS_SUCCESS:
|
||||
wlan_recv_packet_complete(pmadapter, daggr_mbuf, ret);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
data += pkt_len + pad;
|
||||
}
|
||||
|
||||
done:
|
||||
priv->msdu_in_rx_amsdu_cnt += pmbuf->use_count;
|
||||
priv->amsdu_rx_cnt++;
|
||||
/** we should free the aggr buffer after deaggr */
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Aggregate multiple packets into one single AMSDU packet
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param pra_list Pointer to the RA List table containing the pointers
|
||||
* to packets.
|
||||
* @param headroom Any interface specific headroom that may be need. TxPD
|
||||
* will be formed leaving this headroom.
|
||||
* @param ptrindex Pointer index
|
||||
*
|
||||
* @return Final packet size or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list,
|
||||
int headroom, int ptrindex)
|
||||
{
|
||||
int pkt_size = 0;
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
mlan_buffer *pmbuf_aggr, *pmbuf_src;
|
||||
t_u8 *data;
|
||||
int pad = 0;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
#ifdef DEBUG_LEVEL1
|
||||
t_u32 sec = 0, usec = 0;
|
||||
#endif
|
||||
mlan_tx_param tx_param;
|
||||
#ifdef STA_SUPPORT
|
||||
TxPD *ptx_pd = MNULL;
|
||||
#endif
|
||||
t_u32 max_amsdu_size = MIN(pra_list->max_amsdu, pmadapter->tx_buf_size);
|
||||
ENTER();
|
||||
|
||||
PRINTM(MDAT_D, "Handling Aggr packet\n");
|
||||
|
||||
pmbuf_src = (pmlan_buffer)util_peek_list(
|
||||
pmadapter->pmoal_handle, &pra_list->buf_head, MNULL, MNULL);
|
||||
if (pmbuf_src) {
|
||||
pmbuf_aggr = wlan_alloc_mlan_buffer(pmadapter,
|
||||
pmadapter->tx_buf_size, 0,
|
||||
MOAL_MALLOC_BUFFER);
|
||||
if (!pmbuf_aggr) {
|
||||
PRINTM(MERROR, "Error allocating mlan_buffer\n");
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
data = pmbuf_aggr->pbuf + headroom;
|
||||
pmbuf_aggr->bss_index = pmbuf_src->bss_index;
|
||||
pmbuf_aggr->buf_type = pmbuf_src->buf_type;
|
||||
pmbuf_aggr->priority = pmbuf_src->priority;
|
||||
pmbuf_aggr->pbuf = data;
|
||||
pmbuf_aggr->data_offset = 0;
|
||||
pmbuf_aggr->in_ts_sec = pmbuf_src->in_ts_sec;
|
||||
pmbuf_aggr->in_ts_usec = pmbuf_src->in_ts_usec;
|
||||
if (pmbuf_src->flags & MLAN_BUF_FLAG_TCP_ACK)
|
||||
pmbuf_aggr->flags |= MLAN_BUF_FLAG_TCP_ACK;
|
||||
|
||||
/* Form AMSDU */
|
||||
wlan_11n_form_amsdu_txpd(priv, pmbuf_aggr);
|
||||
pkt_size = sizeof(TxPD);
|
||||
#ifdef STA_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA)
|
||||
ptx_pd = (TxPD *)pmbuf_aggr->pbuf;
|
||||
#endif
|
||||
priv->msdu_in_tx_amsdu_cnt++;
|
||||
} else {
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (pmbuf_src && ((pkt_size + (pmbuf_src->data_len + LLC_SNAP_LEN) +
|
||||
headroom) <= max_amsdu_size)) {
|
||||
pmbuf_src =
|
||||
(pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle,
|
||||
&pra_list->buf_head,
|
||||
MNULL, MNULL);
|
||||
/* Collects TP statistics */
|
||||
if (pmadapter->tp_state_on && (pkt_size > sizeof(TxPD)))
|
||||
pmadapter->callbacks.moal_tp_accounting(
|
||||
pmadapter->pmoal_handle, pmbuf_src->pdesc, 3);
|
||||
pra_list->total_pkts--;
|
||||
|
||||
/* decrement for every PDU taken from the list */
|
||||
priv->wmm.pkts_queued[ptrindex]--;
|
||||
util_scalar_decrement(pmadapter->pmoal_handle,
|
||||
&priv->wmm.tx_pkts_queued, MNULL, MNULL);
|
||||
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock);
|
||||
|
||||
if (pmbuf_src) {
|
||||
pkt_size += wlan_11n_form_amsdu_pkt(
|
||||
pmadapter, (data + pkt_size),
|
||||
pmbuf_src->pbuf + pmbuf_src->data_offset,
|
||||
pmbuf_src->data_len, &pad);
|
||||
|
||||
DBG_HEXDUMP(MDAT_D, "pmbuf_src", pmbuf_src,
|
||||
sizeof(mlan_buffer));
|
||||
wlan_write_data_complete(pmadapter, pmbuf_src,
|
||||
MLAN_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
|
||||
if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
pmbuf_src =
|
||||
(pmlan_buffer)util_peek_list(pmadapter->pmoal_handle,
|
||||
&pra_list->buf_head, MNULL,
|
||||
MNULL);
|
||||
priv->msdu_in_tx_amsdu_cnt++;
|
||||
}
|
||||
|
||||
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
|
||||
/* Last AMSDU packet does not need padding */
|
||||
pkt_size -= pad;
|
||||
pmbuf_aggr->data_len = pkt_size;
|
||||
wlan_11n_update_pktlen_amsdu_txpd(priv, pmbuf_aggr);
|
||||
pmbuf_aggr->data_len += headroom;
|
||||
pmbuf_aggr->pbuf = data - headroom;
|
||||
tx_param.next_pkt_len =
|
||||
((pmbuf_src) ? pmbuf_src->data_len + sizeof(TxPD) : 0);
|
||||
/* Collects TP statistics */
|
||||
if (pmadapter->tp_state_on)
|
||||
pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle,
|
||||
pmbuf_aggr, 4);
|
||||
|
||||
/* Drop Tx packets at drop point 4 */
|
||||
if (pmadapter->tp_state_drop_point == 4) {
|
||||
wlan_write_data_complete(pmadapter, pmbuf_aggr, ret);
|
||||
goto exit;
|
||||
} else
|
||||
ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA,
|
||||
pmbuf_aggr, &tx_param);
|
||||
switch (ret) {
|
||||
#ifdef USB
|
||||
case MLAN_STATUS_PRESOURCE:
|
||||
PRINTM(MINFO, "MLAN_STATUS_PRESOURCE is returned\n");
|
||||
break;
|
||||
#endif
|
||||
case MLAN_STATUS_RESOURCE:
|
||||
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
|
||||
if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
wlan_write_data_complete(pmadapter, pmbuf_aggr,
|
||||
MLAN_STATUS_FAILURE);
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
#ifdef STA_SUPPORT
|
||||
/* reset tx_lock_flag */
|
||||
if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
|
||||
pmadapter->pps_uapsd_mode &&
|
||||
(pmadapter->tx_lock_flag == MTRUE)) {
|
||||
pmadapter->tx_lock_flag = MFALSE;
|
||||
if (ptx_pd != MNULL)
|
||||
ptx_pd->flags = 0;
|
||||
}
|
||||
#endif
|
||||
util_enqueue_list_head(pmadapter->pmoal_handle,
|
||||
&pra_list->buf_head,
|
||||
(pmlan_linked_list)pmbuf_aggr, MNULL,
|
||||
MNULL);
|
||||
|
||||
pra_list->total_pkts++;
|
||||
|
||||
/* add back only one: aggregated packet is requeued as one */
|
||||
priv->wmm.pkts_queued[ptrindex]++;
|
||||
util_scalar_increment(pmadapter->pmoal_handle,
|
||||
&priv->wmm.tx_pkts_queued, MNULL, MNULL);
|
||||
pmbuf_aggr->flags |= MLAN_BUF_FLAG_REQUEUED_PKT;
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock);
|
||||
PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n");
|
||||
pmbuf_aggr->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
break;
|
||||
case MLAN_STATUS_FAILURE:
|
||||
pmbuf_aggr->status_code = MLAN_ERROR_DATA_TX_FAIL;
|
||||
pmadapter->dbg.num_tx_host_to_card_failure++;
|
||||
wlan_write_data_complete(pmadapter, pmbuf_aggr, ret);
|
||||
goto exit;
|
||||
case MLAN_STATUS_PENDING:
|
||||
break;
|
||||
case MLAN_STATUS_SUCCESS:
|
||||
wlan_write_data_complete(pmadapter, pmbuf_aggr, ret);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (ret != MLAN_STATUS_RESOURCE) {
|
||||
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
if (wlan_is_ralist_valid(priv, pra_list, ptrindex)) {
|
||||
priv->wmm.packets_out[ptrindex]++;
|
||||
priv->wmm.tid_tbl_ptr[ptrindex].ra_list_curr = pra_list;
|
||||
}
|
||||
pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur =
|
||||
pmadapter->bssprio_tbl[priv->bss_priority]
|
||||
.bssprio_cur->pnext;
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock);
|
||||
}
|
||||
PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data => FW\n", sec, usec);
|
||||
priv->amsdu_tx_cnt++;
|
||||
|
||||
exit:
|
||||
LEAVE();
|
||||
return pkt_size + headroom;
|
||||
}
|
38
mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.h
Normal file
38
mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/** @file mlan_11n_aggr.h
|
||||
*
|
||||
* @brief This file contains related macros, enum, and struct
|
||||
* of 11n aggregation functionalities
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
11/10/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MLAN_11N_AGGR_H_
|
||||
#define _MLAN_11N_AGGR_H_
|
||||
|
||||
/** Aggregate 11N packets */
|
||||
mlan_status wlan_11n_deaggregate_pkt(pmlan_private priv, pmlan_buffer pmbuf);
|
||||
/** Deaggregate 11N packets */
|
||||
int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *ptr, int headroom,
|
||||
int ptrindex);
|
||||
|
||||
#endif /* !_MLAN_11N_AGGR_H_ */
|
1497
mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c
Normal file
1497
mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c
Normal file
File diff suppressed because it is too large
Load diff
104
mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.h
Normal file
104
mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.h
Normal file
|
@ -0,0 +1,104 @@
|
|||
/** @file mlan_11n_rxreorder.h
|
||||
*
|
||||
* @brief This file contains related macros, enum, and struct
|
||||
* of 11n RxReordering functionalities
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
11/10/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MLAN_11N_RXREORDER_H_
|
||||
#define _MLAN_11N_RXREORDER_H_
|
||||
|
||||
/** Max value a TID can take = 2^12 = 4096 */
|
||||
#define MAX_TID_VALUE (2 << 11)
|
||||
/** 2^11 = 2048 */
|
||||
#define TWOPOW11 (2 << 10)
|
||||
|
||||
/** Tid Mask used for extracting TID from BlockAckParamSet */
|
||||
#define BLOCKACKPARAM_TID_MASK 0x3C
|
||||
/** Tid position in BlockAckParamSet */
|
||||
#define BLOCKACKPARAM_TID_POS 2
|
||||
/** WinSize Mask used for extracting WinSize from BlockAckParamSet */
|
||||
#define BLOCKACKPARAM_WINSIZE_MASK 0xffc0
|
||||
/** WinSize Mask used for extracting WinSize from BlockAckParamSet */
|
||||
#define BLOCKACKPARAM_AMSDU_SUPP_MASK 0x1
|
||||
/** WinSize position in BlockAckParamSet */
|
||||
#define BLOCKACKPARAM_WINSIZE_POS 6
|
||||
/** Position of TID in DelBA Param set */
|
||||
#define DELBA_TID_POS 12
|
||||
/** Position of INITIATOR in DelBA Param set */
|
||||
#define DELBA_INITIATOR_POS 11
|
||||
/** Reason code: Requested from peer STA as it does not want to
|
||||
* use the mechanism */
|
||||
#define REASON_CODE_STA_DONT_WANT 37
|
||||
/** Reason code: Requested from peer STA due to timeout*/
|
||||
#define REASON_CODE_STA_TIMEOUT 39
|
||||
/** Type: send delba command */
|
||||
#define TYPE_DELBA_SENT 1
|
||||
/** Type: recieve delba command */
|
||||
#define TYPE_DELBA_RECEIVE 2
|
||||
/** Set Initiator Bit */
|
||||
#define DELBA_INITIATOR(paramset) (paramset = (paramset | (1 << 11)))
|
||||
/** Reset Initiator Bit for recipient */
|
||||
#define DELBA_RECIPIENT(paramset) (paramset = (paramset & ~(1 << 11)))
|
||||
/** Immediate block ack */
|
||||
#define IMMEDIATE_BLOCK_ACK 0x2
|
||||
|
||||
/** The request has been declined */
|
||||
#define ADDBA_RSP_STATUS_DECLINED 37
|
||||
/** ADDBA response status : Reject */
|
||||
#define ADDBA_RSP_STATUS_REJECT 1
|
||||
/** ADDBA response status : Accept */
|
||||
#define ADDBA_RSP_STATUS_ACCEPT 0
|
||||
|
||||
/** DEFAULT SEQ NUM */
|
||||
#define DEFAULT_SEQ_NUM 0xffff
|
||||
|
||||
/** Indicate packet has been dropped in FW */
|
||||
#define RX_PKT_DROPPED_IN_FW 0xffffffff
|
||||
|
||||
mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seqNum, t_u16 tid,
|
||||
t_u8 *ta, t_u8 pkttype, void *payload);
|
||||
void mlan_11n_delete_bastream_tbl(mlan_private *priv, int tid,
|
||||
t_u8 *PeerMACAddr, t_u8 type, int initiator,
|
||||
t_u16 reason_code);
|
||||
void wlan_11n_ba_stream_timeout(mlan_private *priv,
|
||||
HostCmd_DS_11N_BATIMEOUT *event);
|
||||
mlan_status wlan_ret_11n_addba_resp(mlan_private *priv,
|
||||
HostCmd_DS_COMMAND *resp);
|
||||
mlan_status wlan_cmd_11n_delba(mlan_private *priv, HostCmd_DS_COMMAND *cmd,
|
||||
void *pdata_buf);
|
||||
mlan_status wlan_cmd_11n_addba_rspgen(mlan_private *priv,
|
||||
HostCmd_DS_COMMAND *cmd, void *pdata_buf);
|
||||
mlan_status wlan_cmd_11n_addba_req(mlan_private *priv, HostCmd_DS_COMMAND *cmd,
|
||||
void *pdata_buf);
|
||||
void wlan_11n_cleanup_reorder_tbl(mlan_private *priv);
|
||||
RxReorderTbl *wlan_11n_get_rxreorder_tbl(mlan_private *priv, int tid, t_u8 *ta);
|
||||
void wlan_11n_rxba_sync_event(mlan_private *priv, t_u8 *event_buf, t_u16 len);
|
||||
void wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag);
|
||||
void wlan_flush_rxreorder_tbl(pmlan_adapter pmadapter);
|
||||
void wlan_coex_ampdu_rxwinsize(pmlan_adapter pmadapter);
|
||||
|
||||
/** clean up reorder_tbl */
|
||||
void wlan_cleanup_reorder_tbl(mlan_private *priv, t_u8 *ta);
|
||||
#endif /* _MLAN_11N_RXREORDER_H_ */
|
3608
mxm_wifiex/wlan_src/mlan/mlan_cfp.c
Normal file
3608
mxm_wifiex/wlan_src/mlan/mlan_cfp.c
Normal file
File diff suppressed because it is too large
Load diff
8377
mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c
Normal file
8377
mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c
Normal file
File diff suppressed because it is too large
Load diff
1988
mxm_wifiex/wlan_src/mlan/mlan_decl.h
Normal file
1988
mxm_wifiex/wlan_src/mlan/mlan_decl.h
Normal file
File diff suppressed because it is too large
Load diff
7410
mxm_wifiex/wlan_src/mlan/mlan_fw.h
Normal file
7410
mxm_wifiex/wlan_src/mlan/mlan_fw.h
Normal file
File diff suppressed because it is too large
Load diff
1888
mxm_wifiex/wlan_src/mlan/mlan_ieee.h
Normal file
1888
mxm_wifiex/wlan_src/mlan/mlan_ieee.h
Normal file
File diff suppressed because it is too large
Load diff
1959
mxm_wifiex/wlan_src/mlan/mlan_init.c
Normal file
1959
mxm_wifiex/wlan_src/mlan/mlan_init.c
Normal file
File diff suppressed because it is too large
Load diff
125
mxm_wifiex/wlan_src/mlan/mlan_init.h
Normal file
125
mxm_wifiex/wlan_src/mlan/mlan_init.h
Normal file
|
@ -0,0 +1,125 @@
|
|||
/** @file mlan_init.h
|
||||
*
|
||||
* @brief This file defines the FW initialization data
|
||||
* structures.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
10/13/2008: initial version
|
||||
******************************************************/
|
||||
|
||||
#ifndef _MLAN_INIT_H_
|
||||
#define _MLAN_INIT_H_
|
||||
|
||||
/** Tx buffer size for firmware download*/
|
||||
#define FW_DNLD_TX_BUF_SIZE 2312
|
||||
/** Rx buffer size for firmware download*/
|
||||
#define FW_DNLD_RX_BUF_SIZE 2048
|
||||
/** Max firmware retry */
|
||||
#define MAX_FW_RETRY 3
|
||||
|
||||
/** Firmware has last block */
|
||||
#define FW_HAS_LAST_BLOCK 0x00000004
|
||||
/** CMD id for CMD4 */
|
||||
#define FW_CMD_4 0x00000004
|
||||
/** CMD id for CMD6 */
|
||||
#define FW_CMD_6 0x00000006
|
||||
/** CMD id for CMD7 */
|
||||
#define FW_CMD_7 0x00000007
|
||||
/** CMD id for CMD10 */
|
||||
#define FW_CMD_10 0x0000000a
|
||||
|
||||
/** Firmware data transmit size */
|
||||
#define FW_DATA_XMIT_SIZE (sizeof(FWHeader) + DataLength + sizeof(t_u32))
|
||||
|
||||
/** FWHeader */
|
||||
typedef MLAN_PACK_START struct _FWHeader {
|
||||
/** FW download command */
|
||||
t_u32 dnld_cmd;
|
||||
/** FW base address */
|
||||
t_u32 base_addr;
|
||||
/** FW data length */
|
||||
t_u32 data_length;
|
||||
/** FW CRC */
|
||||
t_u32 crc;
|
||||
} MLAN_PACK_END FWHeader;
|
||||
|
||||
/** FWData */
|
||||
typedef MLAN_PACK_START struct _FWData {
|
||||
/** FW data header */
|
||||
FWHeader fw_header;
|
||||
/** FW data sequence number */
|
||||
t_u32 seq_num;
|
||||
/** FW data buffer */
|
||||
t_u8 data[1];
|
||||
} MLAN_PACK_END FWData;
|
||||
|
||||
/** FWSyncHeader */
|
||||
typedef MLAN_PACK_START struct _FWSyncHeader {
|
||||
/** FW sync header command */
|
||||
t_u32 cmd;
|
||||
/** FW sync header sequence number */
|
||||
t_u32 seq_num;
|
||||
/** Extended header */
|
||||
t_u32 magic;
|
||||
/** Chip rev */
|
||||
t_u32 chip_rev;
|
||||
/** Strap */
|
||||
t_u32 strap;
|
||||
/** Status */
|
||||
t_u32 status;
|
||||
/** Offset */
|
||||
t_u32 offset;
|
||||
} MLAN_PACK_END FWSyncHeader;
|
||||
|
||||
/** FW Sync pkt */
|
||||
typedef MLAN_PACK_START struct _FWSyncPkt {
|
||||
/** pkt type */
|
||||
t_u32 pkt_type;
|
||||
/** FW sync header command */
|
||||
t_u32 cmd;
|
||||
/** FW sync header sequence number */
|
||||
t_u32 seq_num;
|
||||
/** chip rev */
|
||||
t_u32 chip_rev;
|
||||
/** fw status */
|
||||
t_u32 fw_ready;
|
||||
} MLAN_PACK_END FWSyncPkt;
|
||||
|
||||
#ifdef BIG_ENDIAN_SUPPORT
|
||||
/** Convert sequence number and command fields
|
||||
* of fwheader to correct endian format
|
||||
*/
|
||||
#define endian_convert_syncfwheader(x) \
|
||||
{ \
|
||||
(x)->cmd = wlan_le32_to_cpu((x)->cmd); \
|
||||
(x)->seq_num = wlan_le32_to_cpu((x)->seq_num); \
|
||||
(x)->status = wlan_le32_to_cpu((x)->status); \
|
||||
(x)->offset = wlan_le32_to_cpu((x)->offset); \
|
||||
}
|
||||
#else
|
||||
/** Convert sequence number and command fields
|
||||
* of fwheader to correct endian format
|
||||
*/
|
||||
#define endian_convert_syncfwheader(x)
|
||||
#endif /* BIG_ENDIAN_SUPPORT */
|
||||
|
||||
#endif /* _MLAN_INIT_H_ */
|
5159
mxm_wifiex/wlan_src/mlan/mlan_ioctl.h
Normal file
5159
mxm_wifiex/wlan_src/mlan/mlan_ioctl.h
Normal file
File diff suppressed because it is too large
Load diff
2621
mxm_wifiex/wlan_src/mlan/mlan_join.c
Normal file
2621
mxm_wifiex/wlan_src/mlan/mlan_join.c
Normal file
File diff suppressed because it is too large
Load diff
42
mxm_wifiex/wlan_src/mlan/mlan_join.h
Normal file
42
mxm_wifiex/wlan_src/mlan/mlan_join.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/** @file mlan_join.h
|
||||
*
|
||||
* @brief This file defines the interface for the WLAN infrastructure
|
||||
* and adhoc join routines.
|
||||
*
|
||||
* Driver interface functions and type declarations for the join module
|
||||
* implemented in mlan_join.c. Process all start/join requests for
|
||||
* both adhoc and infrastructure networks
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
10/13/2008: initial version
|
||||
******************************************************/
|
||||
|
||||
#ifndef _MLAN_JOIN_H_
|
||||
#define _MLAN_JOIN_H_
|
||||
|
||||
/** Size of buffer allocated to store the association response from firmware */
|
||||
#define MRVDRV_ASSOC_RSP_BUF_SIZE 500
|
||||
|
||||
/** Size of buffer allocated to store IEs passed to firmware in the assoc req */
|
||||
#define MRVDRV_GENIE_BUF_SIZE 256
|
||||
|
||||
#endif /* _MLAN_JOIN_H_ */
|
4137
mxm_wifiex/wlan_src/mlan/mlan_main.h
Normal file
4137
mxm_wifiex/wlan_src/mlan/mlan_main.h
Normal file
File diff suppressed because it is too large
Load diff
465
mxm_wifiex/wlan_src/mlan/mlan_meas.c
Normal file
465
mxm_wifiex/wlan_src/mlan/mlan_meas.c
Normal file
|
@ -0,0 +1,465 @@
|
|||
/**
|
||||
* @file mlan_meas.c
|
||||
*
|
||||
* @brief Implementation of measurement interface code with the app/firmware
|
||||
*
|
||||
* Driver implementation for sending and retrieving measurement requests
|
||||
* and responses.
|
||||
*
|
||||
* Current use is limited to 802.11h.
|
||||
*
|
||||
* Requires use of the following preprocessor define:
|
||||
* - ENABLE_MEAS
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************
|
||||
Change Log:
|
||||
03/24/2009: initial version
|
||||
************************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_join.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_ioctl.h"
|
||||
#include "mlan_meas.h"
|
||||
|
||||
/** Default measurement duration when not provided by the application */
|
||||
#define WLAN_MEAS_DEFAULT_MEAS_DURATION 1000U /* TUs */
|
||||
|
||||
#ifdef DEBUG_LEVEL2
|
||||
/** String descriptions of the different measurement enums. Debug display */
|
||||
static const char *meas_type_str[WLAN_MEAS_NUM_TYPES] = {
|
||||
"basic",
|
||||
};
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief Retrieve the measurement string representation of a meas_type enum
|
||||
* Used for debug display only
|
||||
*
|
||||
* @param meas_type Measurement type enumeration input for string lookup
|
||||
*
|
||||
* @return Constant string representing measurement type
|
||||
*/
|
||||
static const char *wlan_meas_get_meas_type_str(MeasType_t meas_type)
|
||||
{
|
||||
if (meas_type <= WLAN_MEAS_11H_MAX_TYPE)
|
||||
return meas_type_str[meas_type];
|
||||
|
||||
return "Invld";
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Debug print display of the input measurement request
|
||||
*
|
||||
* @param pmeas_req Pointer to the measurement request to display
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static void
|
||||
wlan_meas_dump_meas_req(const HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
PRINTM(MINFO, "Meas: Req: ------------------------------\n");
|
||||
|
||||
PRINTM(MINFO, "Meas: Req: mac_addr: " MACSTR "\n",
|
||||
MAC2STR(pmeas_req->mac_addr));
|
||||
|
||||
PRINTM(MINFO, "Meas: Req: dlgTkn: %d\n", pmeas_req->dialog_token);
|
||||
PRINTM(MINFO, "Meas: Req: mode: dm[%c] rpt[%c] req[%c]\n",
|
||||
pmeas_req->req_mode.duration_mandatory ? 'X' : ' ',
|
||||
pmeas_req->req_mode.report ? 'X' : ' ',
|
||||
pmeas_req->req_mode.request ? 'X' : ' ');
|
||||
PRINTM(MINFO, "Meas: Req: : en[%c] par[%c]\n",
|
||||
pmeas_req->req_mode.enable ? 'X' : ' ',
|
||||
pmeas_req->req_mode.parallel ? 'X' : ' ');
|
||||
#ifdef DEBUG_LEVEL2
|
||||
PRINTM(MINFO, "Meas: Req: measTyp: %s\n",
|
||||
wlan_meas_get_meas_type_str(pmeas_req->meas_type));
|
||||
#endif
|
||||
|
||||
switch (pmeas_req->meas_type) {
|
||||
case WLAN_MEAS_BASIC:
|
||||
/* Lazy cheat, fields of bas, cca, rpi union match on the
|
||||
* request */
|
||||
PRINTM(MINFO, "Meas: Req: chan: %u\n",
|
||||
pmeas_req->req.basic.channel);
|
||||
PRINTM(MINFO, "Meas: Req: strt: %llu\n",
|
||||
wlan_le64_to_cpu(pmeas_req->req.basic.start_time));
|
||||
PRINTM(MINFO, "Meas: Req: dur: %u\n",
|
||||
wlan_le16_to_cpu(pmeas_req->req.basic.duration));
|
||||
break;
|
||||
default:
|
||||
PRINTM(MINFO, "Meas: Req: <unhandled>\n");
|
||||
break;
|
||||
}
|
||||
|
||||
PRINTM(MINFO, "Meas: Req: ------------------------------\n");
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Debug print display of the input measurement report
|
||||
*
|
||||
* @param pmeas_rpt Pointer to measurement report to display
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static void
|
||||
wlan_meas_dump_meas_rpt(const HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt)
|
||||
{
|
||||
MeasType_t type;
|
||||
ENTER();
|
||||
|
||||
PRINTM(MINFO, "Meas: Rpt: ------------------------------\n");
|
||||
PRINTM(MINFO, "Meas: Rpt: mac_addr: " MACSTR "\n",
|
||||
MAC2STR(pmeas_rpt->mac_addr));
|
||||
|
||||
PRINTM(MINFO, "Meas: Rpt: dlgTkn: %d\n", pmeas_rpt->dialog_token);
|
||||
|
||||
PRINTM(MINFO, "Meas: Rpt: rptMode: (%x): Rfs[%c] ICp[%c] Lt[%c]\n",
|
||||
*(t_u8 *)&pmeas_rpt->rpt_mode,
|
||||
pmeas_rpt->rpt_mode.refused ? 'X' : ' ',
|
||||
pmeas_rpt->rpt_mode.incapable ? 'X' : ' ',
|
||||
pmeas_rpt->rpt_mode.late ? 'X' : ' ');
|
||||
#ifdef DEBUG_LEVEL2
|
||||
PRINTM(MINFO, "Meas: Rpt: measTyp: %s\n",
|
||||
wlan_meas_get_meas_type_str(pmeas_rpt->meas_type));
|
||||
#endif
|
||||
|
||||
type = wlan_le32_to_cpu(pmeas_rpt->meas_type);
|
||||
switch (type) {
|
||||
case WLAN_MEAS_BASIC:
|
||||
PRINTM(MINFO, "Meas: Rpt: chan: %u\n",
|
||||
pmeas_rpt->rpt.basic.channel);
|
||||
PRINTM(MINFO, "Meas: Rpt: strt: %llu\n",
|
||||
wlan_le64_to_cpu(pmeas_rpt->rpt.basic.start_time));
|
||||
PRINTM(MINFO, "Meas: Rpt: dur: %u\n",
|
||||
wlan_le16_to_cpu(pmeas_rpt->rpt.basic.duration));
|
||||
PRINTM(MINFO, "Meas: Rpt: bas: (%x): unmsd[%c], radar[%c]\n",
|
||||
*(t_u8 *)&(pmeas_rpt->rpt.basic.map),
|
||||
pmeas_rpt->rpt.basic.map.unmeasured ? 'X' : ' ',
|
||||
pmeas_rpt->rpt.basic.map.radar ? 'X' : ' ');
|
||||
PRINTM(MINFO, "Meas: Rpt: bas: unidSig[%c] ofdm[%c] bss[%c]\n",
|
||||
pmeas_rpt->rpt.basic.map.unidentified_sig ? 'X' : ' ',
|
||||
pmeas_rpt->rpt.basic.map.ofdm_preamble ? 'X' : ' ',
|
||||
pmeas_rpt->rpt.basic.map.bss ? 'X' : ' ');
|
||||
break;
|
||||
default:
|
||||
PRINTM(MINFO, "Meas: Rpt: <unhandled>\n");
|
||||
break;
|
||||
}
|
||||
|
||||
PRINTM(MINFO, "Meas: Rpt: ------------------------------\n");
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve a measurement report from the firmware
|
||||
*
|
||||
* Callback from command processing when a measurement report is received
|
||||
* from the firmware. Perform the following when a report is received:
|
||||
*
|
||||
* -# Debug displays the report if compiled with the appropriate flags
|
||||
* -# If we are pending on a specific measurement report token, and it
|
||||
* matches the received report's token, store the report and wake up
|
||||
* any pending threads
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param resp HostCmd_DS_COMMAND struct returned from the firmware command
|
||||
* passing a HostCmd_DS_MEASUREMENT_REPORT structure.
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
static int wlan_meas_cmdresp_get_report(mlan_private *pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp)
|
||||
{
|
||||
mlan_adapter *pmadapter = pmpriv->adapter;
|
||||
const HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt = &resp->params.meas_rpt;
|
||||
|
||||
ENTER();
|
||||
|
||||
PRINTM(MINFO, "Meas: Rpt: %#x-%u, Seq=%u, Ret=%u\n", resp->command,
|
||||
resp->size, resp->seq_num, resp->result);
|
||||
|
||||
/* Debug displays the measurement report */
|
||||
wlan_meas_dump_meas_rpt(pmeas_rpt);
|
||||
|
||||
/*
|
||||
* Check if we are pending on a measurement report and it matches
|
||||
* the dialog token of the received report:
|
||||
*/
|
||||
if (pmadapter->state_meas.meas_rpt_pend_on &&
|
||||
pmadapter->state_meas.meas_rpt_pend_on == pmeas_rpt->dialog_token) {
|
||||
PRINTM(MINFO, "Meas: Rpt: RCV'd Pend on meas #%d\n",
|
||||
pmadapter->state_meas.meas_rpt_pend_on);
|
||||
|
||||
/* Clear the pending report indicator */
|
||||
pmadapter->state_meas.meas_rpt_pend_on = 0;
|
||||
|
||||
/* Copy the received report into the measurement state for
|
||||
* retrieval */
|
||||
memcpy_ext(pmadapter, &pmadapter->state_meas.meas_rpt_returned,
|
||||
pmeas_rpt,
|
||||
sizeof(pmadapter->state_meas.meas_rpt_returned),
|
||||
sizeof(pmadapter->state_meas.meas_rpt_returned));
|
||||
|
||||
/*
|
||||
* Wake up any threads pending on the wait queue
|
||||
*/
|
||||
wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_MEAS_REPORT, MNULL);
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prepare CMD_MEASURMENT_REPORT firmware command
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param pcmd_ptr Output parameter: Pointer to the command being prepared
|
||||
* for the firmware
|
||||
* @param pinfo_buf HostCmd_DS_MEASUREMENT_REQUEST passed as void data block
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
static int wlan_meas_cmd_request(mlan_private *pmpriv,
|
||||
HostCmd_DS_COMMAND *pcmd_ptr,
|
||||
const void *pinfo_buf)
|
||||
{
|
||||
const HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req =
|
||||
(HostCmd_DS_MEASUREMENT_REQUEST *)pinfo_buf;
|
||||
|
||||
ENTER();
|
||||
|
||||
pcmd_ptr->command = HostCmd_CMD_MEASUREMENT_REQUEST;
|
||||
pcmd_ptr->size = sizeof(HostCmd_DS_MEASUREMENT_REQUEST) + S_DS_GEN;
|
||||
|
||||
memcpy_ext(pmpriv->adapter, &pcmd_ptr->params.meas_req, pmeas_req,
|
||||
sizeof(pcmd_ptr->params.meas_req),
|
||||
sizeof(pcmd_ptr->params.meas_req));
|
||||
|
||||
PRINTM(MINFO, "Meas: Req: %#x-%u, Seq=%u, Ret=%u\n", pcmd_ptr->command,
|
||||
pcmd_ptr->size, pcmd_ptr->seq_num, pcmd_ptr->result);
|
||||
|
||||
wlan_meas_dump_meas_req(pmeas_req);
|
||||
|
||||
LEAVE();
|
||||
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve a measurement report from the firmware
|
||||
*
|
||||
* The firmware will send a EVENT_MEAS_REPORT_RDY event when it
|
||||
* completes or receives a measurement report. The event response
|
||||
* handler will then start a HostCmd_CMD_MEASUREMENT_REPORT firmware command
|
||||
* which gets completed for transmission to the firmware in this routine.
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param pcmd_ptr Output parameter: Pointer to the command being prepared
|
||||
* for the firmware
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
static int wlan_meas_cmd_get_report(mlan_private *pmpriv,
|
||||
HostCmd_DS_COMMAND *pcmd_ptr)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
pcmd_ptr->command = HostCmd_CMD_MEASUREMENT_REPORT;
|
||||
pcmd_ptr->size = sizeof(HostCmd_DS_MEASUREMENT_REPORT) + S_DS_GEN;
|
||||
|
||||
memset(pmpriv->adapter, &pcmd_ptr->params.meas_rpt, 0x00,
|
||||
sizeof(pcmd_ptr->params.meas_rpt));
|
||||
|
||||
/*
|
||||
* Set the meas_rpt.mac_addr to our mac address to get a meas report,
|
||||
* setting the mac to another STA address instructs the firmware
|
||||
* to transmit this measurement report frame instead
|
||||
*/
|
||||
memcpy_ext(pmpriv->adapter, pcmd_ptr->params.meas_rpt.mac_addr,
|
||||
pmpriv->curr_addr,
|
||||
sizeof(pcmd_ptr->params.meas_rpt.mac_addr),
|
||||
sizeof(pcmd_ptr->params.meas_rpt.mac_addr));
|
||||
|
||||
LEAVE();
|
||||
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
Global functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief Send the input measurement request to the firmware.
|
||||
*
|
||||
* If the dialog token in the measurement request is set to 0, the function
|
||||
* will use an local static auto-incremented token in the measurement
|
||||
* request. This ensures the dialog token is always set.
|
||||
*
|
||||
* If wait_for_resp_timeout is set, the function will block its return on
|
||||
* a timeout or returned measurement report that matches the requests
|
||||
* dialog token.
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param pmeas_req Pointer to the measurement request to send
|
||||
* @param wait_for_resp_timeout Timeout value of the measurement request
|
||||
* in ms.
|
||||
* @param pioctl_req Pointer to IOCTL request buffer
|
||||
* @param pmeas_rpt Output parameter: Pointer for the resulting
|
||||
* measurement report
|
||||
*
|
||||
* @return
|
||||
* - 0 for success
|
||||
* - -ETIMEDOUT if the measurement report does not return before
|
||||
* the timeout expires
|
||||
* - Error return from wlan_prepare_cmd routine otherwise
|
||||
*/
|
||||
int wlan_meas_util_send_req(mlan_private *pmpriv,
|
||||
HostCmd_DS_MEASUREMENT_REQUEST *pmeas_req,
|
||||
t_u32 wait_for_resp_timeout,
|
||||
pmlan_ioctl_req pioctl_req,
|
||||
HostCmd_DS_MEASUREMENT_REPORT *pmeas_rpt)
|
||||
{
|
||||
static t_u8 auto_dialog_tok;
|
||||
wlan_meas_state_t *pmeas_state = &pmpriv->adapter->state_meas;
|
||||
int ret;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* If dialogTok was set to 0 or not provided, autoset */
|
||||
pmeas_req->dialog_token =
|
||||
(pmeas_req->dialog_token ? pmeas_req->dialog_token :
|
||||
++auto_dialog_tok);
|
||||
|
||||
/* Check for rollover of the dialog token. Avoid using 0 as a token */
|
||||
pmeas_req->dialog_token =
|
||||
(pmeas_req->dialog_token ? pmeas_req->dialog_token : 1);
|
||||
|
||||
/*
|
||||
* If the request is to pend waiting for the result, set the dialog
|
||||
* token of this measurement request in the state structure. The
|
||||
* measurement report handling routines can then check the incoming
|
||||
* measurement reports for a match with this dialog token.
|
||||
*/
|
||||
if (wait_for_resp_timeout) {
|
||||
pmeas_state->meas_rpt_pend_on = pmeas_req->dialog_token;
|
||||
PRINTM(MINFO, "Meas: Req: START Pend on meas #%d\n",
|
||||
pmeas_req->dialog_token);
|
||||
}
|
||||
|
||||
/* Send the measurement request to the firmware */
|
||||
ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MEASUREMENT_REQUEST,
|
||||
HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req,
|
||||
(void *)pmeas_req);
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prepare the HostCmd_DS_Command structure for a measurement command.
|
||||
*
|
||||
* Use the Command field to determine if the command being set up is for
|
||||
* 11h and call one of the local command handlers accordingly for:
|
||||
*
|
||||
* - HostCmd_CMD_MEASUREMENT_REQUEST
|
||||
* - HostCmd_CMD_MEASUREMENT_REPORT
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param pcmd_ptr Output parameter: Pointer to the command being prepared
|
||||
* for the firmware
|
||||
* @param pinfo_buf Void buffer passthrough with data necessary for a
|
||||
* specific command type
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*
|
||||
*/
|
||||
int wlan_meas_cmd_process(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd_ptr,
|
||||
const void *pinfo_buf)
|
||||
{
|
||||
int ret = MLAN_STATUS_SUCCESS;
|
||||
|
||||
ENTER();
|
||||
switch (pcmd_ptr->command) {
|
||||
case HostCmd_CMD_MEASUREMENT_REQUEST:
|
||||
ret = wlan_meas_cmd_request(pmpriv, pcmd_ptr, pinfo_buf);
|
||||
break;
|
||||
case HostCmd_CMD_MEASUREMENT_REPORT:
|
||||
ret = wlan_meas_cmd_get_report(pmpriv, pcmd_ptr);
|
||||
break;
|
||||
default:
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
pcmd_ptr->command = wlan_cpu_to_le16(pcmd_ptr->command);
|
||||
pcmd_ptr->size = wlan_cpu_to_le16(pcmd_ptr->size);
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle the command response from the firmware for a measurement
|
||||
* command
|
||||
*
|
||||
* Use the Command field to determine if the command response being
|
||||
* is for meas. Call the local command response handler accordingly for:
|
||||
*
|
||||
* - HostCmd_CMD_802_MEASUREMENT_REQUEST
|
||||
* - HostCmd_CMD_802_MEASUREMENT_REPORT
|
||||
*
|
||||
* @param pmpriv Private driver information structure
|
||||
* @param resp HostCmd_DS_COMMAND struct returned from the firmware command
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
int wlan_meas_cmdresp_process(mlan_private *pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp)
|
||||
{
|
||||
int ret = MLAN_STATUS_SUCCESS;
|
||||
|
||||
ENTER();
|
||||
switch (resp->command) {
|
||||
case HostCmd_CMD_MEASUREMENT_REQUEST:
|
||||
PRINTM(MINFO, "Meas: Req Resp: Sz=%u, Seq=%u, Ret=%u\n",
|
||||
resp->size, resp->seq_num, resp->result);
|
||||
break;
|
||||
case HostCmd_CMD_MEASUREMENT_REPORT:
|
||||
ret = wlan_meas_cmdresp_get_report(pmpriv, resp);
|
||||
break;
|
||||
default:
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
55
mxm_wifiex/wlan_src/mlan/mlan_meas.h
Normal file
55
mxm_wifiex/wlan_src/mlan/mlan_meas.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @file mlan_meas.h
|
||||
*
|
||||
* @brief Interface for the measurement module implemented in mlan_meas.c
|
||||
*
|
||||
* Driver interface functions and type declarations for the measurement module
|
||||
* implemented in mlan_meas.c
|
||||
*
|
||||
* @sa mlan_meas.c
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************
|
||||
Change Log:
|
||||
03/25/2009: initial version
|
||||
************************************************************/
|
||||
|
||||
#ifndef _MLAN_MEAS_H_
|
||||
#define _MLAN_MEAS_H_
|
||||
|
||||
#include "mlan_fw.h"
|
||||
|
||||
/* Send a given measurement request to the firmware, report back the result */
|
||||
extern int wlan_meas_util_send_req(pmlan_private pmpriv,
|
||||
pHostCmd_DS_MEASUREMENT_REQUEST pmeas_req,
|
||||
t_u32 wait_for_resp_timeout,
|
||||
pmlan_ioctl_req pioctl_req,
|
||||
pHostCmd_DS_MEASUREMENT_REPORT pmeas_rpt);
|
||||
|
||||
/* Setup a measurement command before it is sent to the firmware */
|
||||
extern int wlan_meas_cmd_process(mlan_private *pmpriv,
|
||||
HostCmd_DS_COMMAND *pcmd_ptr,
|
||||
const t_void *pinfo_buf);
|
||||
|
||||
/* Handle a given measurement command response from the firmware */
|
||||
extern int wlan_meas_cmdresp_process(mlan_private *pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp);
|
||||
|
||||
#endif /* _MLAN_MEAS_H_ */
|
5866
mxm_wifiex/wlan_src/mlan/mlan_misc.c
Normal file
5866
mxm_wifiex/wlan_src/mlan/mlan_misc.c
Normal file
File diff suppressed because it is too large
Load diff
65
mxm_wifiex/wlan_src/mlan/mlan_module.c
Normal file
65
mxm_wifiex/wlan_src/mlan/mlan_module.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
/** @file mlan_module.c
|
||||
*
|
||||
* @brief This file declares the exported symbols from MLAN.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
12/08/2008: initial version
|
||||
******************************************************/
|
||||
|
||||
#ifdef LINUX
|
||||
#include <linux/module.h>
|
||||
#include "mlan_decl.h"
|
||||
#include "mlan_ioctl.h"
|
||||
|
||||
EXPORT_SYMBOL(mlan_register);
|
||||
EXPORT_SYMBOL(mlan_unregister);
|
||||
EXPORT_SYMBOL(mlan_init_fw);
|
||||
EXPORT_SYMBOL(mlan_set_init_param);
|
||||
EXPORT_SYMBOL(mlan_dnld_fw);
|
||||
EXPORT_SYMBOL(mlan_shutdown_fw);
|
||||
#ifdef USB
|
||||
EXPORT_SYMBOL(mlan_write_data_async_complete);
|
||||
EXPORT_SYMBOL(mlan_recv);
|
||||
#endif
|
||||
EXPORT_SYMBOL(mlan_send_packet);
|
||||
EXPORT_SYMBOL(mlan_ioctl);
|
||||
EXPORT_SYMBOL(mlan_main_process);
|
||||
EXPORT_SYMBOL(mlan_rx_process);
|
||||
EXPORT_SYMBOL(mlan_select_wmm_queue);
|
||||
#if defined(SDIO) || defined(PCIE)
|
||||
EXPORT_SYMBOL(mlan_interrupt);
|
||||
#if defined(SYSKT)
|
||||
EXPORT_SYMBOL(mlan_hs_callback);
|
||||
#endif /* SYSKT_MULTI || SYSKT */
|
||||
#endif /* SDIO || PCIE */
|
||||
|
||||
EXPORT_SYMBOL(mlan_pm_wakeup_card);
|
||||
EXPORT_SYMBOL(mlan_is_main_process_running);
|
||||
#ifdef PCIE
|
||||
EXPORT_SYMBOL(mlan_set_int_mode);
|
||||
#endif
|
||||
|
||||
MODULE_DESCRIPTION("M-WLAN MLAN Driver");
|
||||
MODULE_AUTHOR("NXP");
|
||||
MODULE_VERSION(MLAN_RELEASE_VERSION);
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif /* LINUX */
|
4205
mxm_wifiex/wlan_src/mlan/mlan_pcie.c
Normal file
4205
mxm_wifiex/wlan_src/mlan/mlan_pcie.c
Normal file
File diff suppressed because it is too large
Load diff
650
mxm_wifiex/wlan_src/mlan/mlan_pcie.h
Normal file
650
mxm_wifiex/wlan_src/mlan/mlan_pcie.h
Normal file
|
@ -0,0 +1,650 @@
|
|||
/** @file mlan_pcie.h
|
||||
*
|
||||
* @brief This file contains definitions for PCIE interface.
|
||||
* driver.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
02/01/2012: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MLAN_PCIE_H_
|
||||
#define _MLAN_PCIE_H_
|
||||
/** Tx DATA */
|
||||
#define ADMA_TX_DATA 0
|
||||
/** Rx DATA */
|
||||
#define ADMA_RX_DATA 1
|
||||
/** EVENT */
|
||||
#define ADMA_EVENT 2
|
||||
/** CMD */
|
||||
#define ADMA_CMD 3
|
||||
/** CMD RESP */
|
||||
#define ADMA_CMDRESP 4
|
||||
/** ADMA direction */
|
||||
#define ADMA_HOST_TO_DEVICE 0
|
||||
/** ADMA direction Rx */
|
||||
#define ADMA_DEVICE_TO_HOST 1
|
||||
/** Direct Program mode */
|
||||
#define DMA_MODE_DIRECT 0
|
||||
/** Single descriptor mode */
|
||||
#define DMA_MODE_SINGLE_DESC 1
|
||||
/** dual discriptor mode */
|
||||
#define DMA_MODE_DUAL_DESC 2
|
||||
/** descriptor mode: ring mode */
|
||||
#define DESC_MODE_RING 0
|
||||
/** descriptor mode: chain mode */
|
||||
#define DESC_MODE_CHAIN 1
|
||||
/** DMA size start bit */
|
||||
#define DMA_SIZE_BIT 16
|
||||
/** DMA size mask */
|
||||
#define DMA_SIZE_MASK 0xffff0000
|
||||
/** Descriptor mode */
|
||||
#define DESC_MODE_MASK 0x0004
|
||||
/** DMA MODE MASK */
|
||||
#define DMA_MODE_MASK 0x0003
|
||||
/** Dest Num Descriptor start bits */
|
||||
#define DST_NUM_DESC_BIT 12
|
||||
/** Destination Num of Descriptor mask */
|
||||
#define DST_NUM_DESC_MASK 0xf000
|
||||
/** Src Num Descriptor start bits */
|
||||
#define SRC_NUM_DESC_BIT 8
|
||||
/** Destination Num of Descriptor mask */
|
||||
#define SRC_NUM_DESC_MASK 0x0f00
|
||||
/** Virtual Q priority mask */
|
||||
#define Q_PRIO_WEIGHT_MASK 0x00f0
|
||||
/** DMA cfg register offset*/
|
||||
#define ADMA_DMA_CFG 0x0000
|
||||
/** source base low */
|
||||
#define ADMA_SRC_LOW 0x0004
|
||||
/** source base high */
|
||||
#define ADMA_SRC_HIGH 0x0008
|
||||
/** destination base low */
|
||||
#define ADMA_DST_LOW 0x000C
|
||||
/** destination base high */
|
||||
#define ADMA_DST_HIGH 0x0010
|
||||
/** source rd/wr pointer */
|
||||
#define ADMA_SRC_RW_PTR 0x0014
|
||||
/** destination rd/wr pointer */
|
||||
#define ADMA_DST_RW_PTR 0x0018
|
||||
/** interrupt direction mapping reg, for each virtual Q, used for
|
||||
* dual-descriptor only, only valid for Q0 */
|
||||
#define ADMA_INT_MAPPING 0x001C
|
||||
/** destination interrupt to device */
|
||||
#define DEST_INT_TO_DEVICE MBIT(0)
|
||||
/** destination interrupt to host */
|
||||
#define DEST_INT_TO_HOST MBIT(1)
|
||||
/** interrupt pending status for each virtual Q, only valid for Q0 */
|
||||
#define ADMA_INT_PENDING 0x0020
|
||||
/** Default ADMA INT mask, We only enable dma done */
|
||||
#define DEF_ADMA_INT_MASK MBIT(0)
|
||||
/** source interrupt status mask reg */
|
||||
#define ADMA_SRC_INT_STATUS_MASK 0x0024
|
||||
/** source interrupt mask reg */
|
||||
#define ADMA_SRC_INT_MASK 0x0028
|
||||
/** source interrupt status reg */
|
||||
#define ADMA_SRC_INT_STATUS 0x002C
|
||||
/** destination interrupt status mask reg */
|
||||
#define ADMA_DST_INT_STATUS_MASK 0x0030
|
||||
/** destination interrupt mask reg */
|
||||
#define ADMA_DST_INT_MASK 0x0034
|
||||
/** destination interrupt status reg */
|
||||
#define ADMA_DST_INT_STATUS 0x0038
|
||||
/** DMA cfg2 register */
|
||||
#define ADMA_DMA_CFG2 0x003C
|
||||
/** ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN */
|
||||
#define ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN MBIT(22)
|
||||
/** ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN */
|
||||
#define ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN MBIT(21)
|
||||
/* If this bit is set, MSIX trigger event will be from DST, other wise MSIX
|
||||
* trigger event will be from SRC */
|
||||
#define ADMA_MSIX_INT_SRC_DST_SEL MBIT(20)
|
||||
/** Enable MSI/Legacy for this Queue */
|
||||
#define ADMA_MSI_LEGACY_ENABLE MBIT(19)
|
||||
/** Enable MSIX for this queue */
|
||||
#define ADMA_MSIX_ENABLE MBIT(18)
|
||||
/** ADMA_DST_DMA_DONE_INT_BYPASS_EN */
|
||||
#define ADMA_DST_DMA_DONE_INT_BYPASS_EN MBIT(17)
|
||||
/** SRC_DMA_DONE_INT_BYPASS_EN */
|
||||
#define ADMA_SRC_DMA_DONE_INT_BYPASS_EN MBIT(16)
|
||||
/* Destination Read Pointer Memory Copy Enable */
|
||||
#define ADMA_DST_RPTR_MEM_COPY_EN MBIT(11)
|
||||
/* Source Read Pointer Memory Copy Enable */
|
||||
#define ADMA_SRC_RPTR_MEM_COPY_EN MBIT(10)
|
||||
/** Destination address is host */
|
||||
#define ADMA_DST_ADDR_IS_HOST MBIT(2)
|
||||
/** Source address is host */
|
||||
#define ADMA_SRC_ADDR_IS_HOST MBIT(1)
|
||||
|
||||
/** DMA cfg3 register */
|
||||
#define ADMA_DMA_CFG3 0x0040
|
||||
/** source rd ptr address low */
|
||||
#define ADMA_SRC_RD_PTR_LOW 0x0044
|
||||
/** source rd ptr address high */
|
||||
#define ADMA_SRC_RD_PTR_HIGH 0x0048
|
||||
/** destination rd ptr address low */
|
||||
#define ADMA_DST_RD_PTR_LOW 0x004C
|
||||
/** destination rd ptr address high */
|
||||
#define ADMA_DST_RD_PTR_HIGH 0x0050
|
||||
/** source active interrupt mask */
|
||||
#define ADMA_SRC_ACTV_INT_MASK 0x0054
|
||||
/** destination active interrupt mask */
|
||||
#define ADMA_DST_ACTV_INT_MASK 0x0058
|
||||
/** Read pointer start from bit 16 */
|
||||
#define ADMA_RPTR_START 16
|
||||
/** write pointer start from bit 0 */
|
||||
#define ADMA_WPTR_START 0
|
||||
/** Tx/Rx Read/Write pointer's mask */
|
||||
#define TXRX_RW_PTR_MASK (MLAN_MAX_TXRX_BD - 1)
|
||||
/** Tx/Rx Read/Write pointer's rollover indicate bit */
|
||||
#define TXRX_RW_PTR_ROLLOVER_IND MLAN_MAX_TXRX_BD
|
||||
/** Start of packet flag */
|
||||
#define ADMA_BD_FLAG_SOP MBIT(0)
|
||||
/** End of packet flag */
|
||||
#define ADMA_BD_FLAG_EOP MBIT(1)
|
||||
/** interrupt enable flag */
|
||||
#define ADMA_BD_FLAG_INT_EN MBIT(2)
|
||||
/** Source address is host side flag */
|
||||
#define ADMA_BD_FLAG_SRC_HOST MBIT(3)
|
||||
/** Destination address is host side flag */
|
||||
#define ADMA_BD_FLAG_DST_HOST MBIT(4)
|
||||
/** ADMA MIN PKT SIZE */
|
||||
#define ADMA_MIN_PKT_SIZE 128
|
||||
/** ADMA dual descriptor mode requir 8 bytes alignment in buf size */
|
||||
#define ADMA_ALIGN_SIZE 8
|
||||
/** ADMA RW_PTR wrap mask */
|
||||
#define ADMA_RW_PTR_WRAP_MASK 0x00001FFF
|
||||
/** ADMA MSIX DOORBEEL DATA */
|
||||
#define ADMA_MSIX_DOORBELL_DATA 0x0064
|
||||
/** MSIX VECTOR MASK: BIT 0-10 */
|
||||
#define ADMA_MSIX_VECTOR_MASK 0x3f
|
||||
/** PF mask: BIT 24-28 */
|
||||
#define ADMA_MSIX_PF_MASK 0x1f000000
|
||||
/** PF start bit */
|
||||
#define ADMA_MSIX_PF_BIT 24
|
||||
|
||||
#if defined(PCIE9098) || defined(PCIE9097)
|
||||
/** PCIE9098 dev_id/vendor id reg */
|
||||
#define PCIE9098_DEV_ID_REG 0x0000
|
||||
/** PCIE revision ID register */
|
||||
#define PCIE9098_REV_ID_REG 0x0008
|
||||
/** PCIE IP revision register */
|
||||
#define PCIE9098_IP_REV_REG 0x1000
|
||||
/** PCIE CPU interrupt events */
|
||||
#define PCIE9098_CPU_INT_EVENT 0x1C20
|
||||
/** PCIE CPU interrupt status */
|
||||
#define PCIE9098_CPU_INT_STATUS 0x1C24
|
||||
/** PCIe CPU Interrupt Status Mask */
|
||||
#define PCIE9098_CPU_INT2ARM_ISM 0x1C28
|
||||
/** PCIE host interrupt status */
|
||||
#define PCIE9098_HOST_INT_STATUS 0x1C44
|
||||
/** PCIE host interrupt mask */
|
||||
#define PCIE9098_HOST_INT_MASK 0x1C48
|
||||
/** PCIE host interrupt clear select*/
|
||||
#define PCIE9098_HOST_INT_CLR_SEL 0x1C4C
|
||||
/** PCIE host interrupt status mask */
|
||||
#define PCIE9098_HOST_INT_STATUS_MASK 0x1C50
|
||||
/** PCIE host interrupt status */
|
||||
#define PCIE9097_B0_HOST_INT_STATUS 0x3C44
|
||||
/** PCIE host interrupt mask */
|
||||
#define PCIE9097_B0_HOST_INT_MASK 0x3C48
|
||||
/** PCIE host interrupt clear select*/
|
||||
#define PCIE9097_B0_HOST_INT_CLR_SEL 0x3C4C
|
||||
/** PCIE host interrupt status mask */
|
||||
#define PCIE9097_B0_HOST_INT_STATUS_MASK 0x3C50
|
||||
/** PCIE host interrupt select*/
|
||||
#define PCIE9098_HOST_INT_SEL 0x1C58
|
||||
/** PCIE data exchange register 0 */
|
||||
#define PCIE9098_SCRATCH_0_REG 0x1C60
|
||||
/** PCIE data exchange register 1 */
|
||||
#define PCIE9098_SCRATCH_1_REG 0x1C64
|
||||
/** PCIE data exchange register 2 */
|
||||
#define PCIE9098_SCRATCH_2_REG 0x1C68
|
||||
/** PCIE data exchange register 3 */
|
||||
#define PCIE9098_SCRATCH_3_REG 0x1C6C
|
||||
/** PCIE data exchange register 4 */
|
||||
#define PCIE9098_SCRATCH_4_REG 0x1C70
|
||||
/** PCIE data exchange register 5 */
|
||||
#define PCIE9098_SCRATCH_5_REG 0x1C74
|
||||
/** PCIE data exchange register 6 */
|
||||
#define PCIE9098_SCRATCH_6_REG 0x1C78
|
||||
/** PCIE data exchange register 7 */
|
||||
#define PCIE9098_SCRATCH_7_REG 0x1C7C
|
||||
/** PCIE data exchange register 8 */
|
||||
#define PCIE9098_SCRATCH_8_REG 0x1C80
|
||||
/** PCIE data exchange register 9 */
|
||||
#define PCIE9098_SCRATCH_9_REG 0x1C84
|
||||
/** PCIE data exchange register 10 */
|
||||
#define PCIE9098_SCRATCH_10_REG 0x1C88
|
||||
/** PCIE data exchange register 11 */
|
||||
#define PCIE9098_SCRATCH_11_REG 0x1C8C
|
||||
/** PCIE data exchange register 12 */
|
||||
#define PCIE9098_SCRATCH_12_REG 0x1C90
|
||||
/** PCIE data exchange register 13 */
|
||||
#define PCIE9098_SCRATCH_13_REG 0x1C94
|
||||
/** PCIE data exchange register 14 */
|
||||
#define PCIE9098_SCRATCH_14_REG 0x1C98
|
||||
/** PCIE data exchange register 15 */
|
||||
#define PCIE9098_SCRATCH_15_REG 0x1C9C
|
||||
/** ADMA CHAN0_Q0 start address, Tx Data */
|
||||
#define ADMA_CHAN0_Q0 0x10000
|
||||
/** ADMA CHAN1_Q0 start address, Rx Data */
|
||||
#define ADMA_CHAN1_Q0 0x10800
|
||||
/** ADMA CHAN1_Q1 start address, Rx Event */
|
||||
#define ADMA_CHAN1_Q1 0x10880
|
||||
/** ADMA CHAN2_Q0 start address, Tx Command */
|
||||
#define ADMA_CHAN2_Q0 0x11000
|
||||
/** ADMA CHAN2_Q1 start address, Command Resp */
|
||||
#define ADMA_CHAN2_Q1 0x11080
|
||||
/** CH0-Q0' src rd/wr ptr */
|
||||
#define ADMA_SRC_PTR_CH0_Q0 (ADMA_CHAN0_Q0 + ADMA_SRC_RW_PTR)
|
||||
/** CH1-Q1' dest rd/wr ptr */
|
||||
#define ADMA_DST_PTR_CH1_Q0 (ADMA_CHAN1_Q0 + ADMA_DST_RW_PTR)
|
||||
/** CH1-Q1' dest rd/wr ptr */
|
||||
#define ADMA_DST_PTR_CH1_Q1 (ADMA_CHAN1_Q1 + ADMA_DST_RW_PTR)
|
||||
/* TX buffer description read pointer */
|
||||
#define PCIE9098_TXBD_RDPTR ADMA_SRC_PTR_CH0_Q0
|
||||
/* TX buffer description write pointer */
|
||||
#define PCIE9098_TXBD_WRPTR ADMA_SRC_PTR_CH0_Q0
|
||||
/* RX buffer description read pointer */
|
||||
#define PCIE9098_RXBD_RDPTR ADMA_DST_PTR_CH1_Q0
|
||||
/* RX buffer description write pointer */
|
||||
#define PCIE9098_RXBD_WRPTR ADMA_DST_PTR_CH1_Q0
|
||||
/* Event buffer description read pointer */
|
||||
#define PCIE9098_EVTBD_RDPTR ADMA_DST_PTR_CH1_Q1
|
||||
/* Event buffer description write pointer */
|
||||
#define PCIE9098_EVTBD_WRPTR ADMA_DST_PTR_CH1_Q1
|
||||
/* Driver ready signature write pointer */
|
||||
#define PCIE9098_DRV_READY PCIE9098_SCRATCH_12_REG
|
||||
|
||||
/** interrupt bit define for ADMA CHAN0 Q0, For Tx DATA */
|
||||
#define ADMA_INT_CHAN0_Q0 MBIT(0)
|
||||
/** interrupt bit define for ADMA CHAN1 Q0, For Rx Data */
|
||||
#define AMDA_INT_CHAN1_Q0 MBIT(16)
|
||||
/** interrupt bit define for ADMA CHAN1 Q1, For Rx Event */
|
||||
#define AMDA_INT_CHAN1_Q1 MBIT(17)
|
||||
/** interrupt bit define for ADMA CHAN2 Q0, For Tx Command */
|
||||
#define AMDA_INT_CHAN2_Q0 MBIT(24)
|
||||
/** interrupt bit define for ADMA CHAN2 Q1, For Rx Command Resp */
|
||||
#define AMDA_INT_CHAN2_Q1 MBIT(25)
|
||||
|
||||
/** interrupt vector number for ADMA CHAN0 Q0, For Tx DATA */
|
||||
#define ADMA_VECTOR_CHAN0_Q0 0
|
||||
/** interrupt vector number for ADMA CHAN1 Q0, For Rx Data */
|
||||
#define AMDA_VECTOR_CHAN1_Q0 16
|
||||
/** interrupt vector number for ADMA CHAN1 Q1, For Rx Event */
|
||||
#define AMDA_VECTOR_CHAN1_Q1 17
|
||||
/** interrupt vector number for ADMA CHAN2 Q0, For Tx Command */
|
||||
#define AMDA_VECTOR_CHAN2_Q0 24
|
||||
/** interrupt vector number for ADMA CHAN2 Q1, For Rx Command Resp */
|
||||
#define AMDA_VECTOR_CHAN2_Q1 25
|
||||
|
||||
/** Data sent interrupt for host */
|
||||
#define PCIE9098_HOST_INTR_DNLD_DONE ADMA_INT_CHAN0_Q0
|
||||
/** Data receive interrupt for host */
|
||||
#define PCIE9098_HOST_INTR_UPLD_RDY AMDA_INT_CHAN1_Q0
|
||||
/** Command sent interrupt for host */
|
||||
#define PCIE9098_HOST_INTR_CMD_DONE AMDA_INT_CHAN2_Q1
|
||||
/** Event ready interrupt for host */
|
||||
#define PCIE9098_HOST_INTR_EVENT_RDY AMDA_INT_CHAN1_Q1
|
||||
/** CMD sent interrupt for host */
|
||||
#define PCIE9098_HOST_INTR_CMD_DNLD MBIT(7)
|
||||
|
||||
/** Interrupt mask for host */
|
||||
#define PCIE9098_HOST_INTR_MASK \
|
||||
(PCIE9098_HOST_INTR_DNLD_DONE | PCIE9098_HOST_INTR_UPLD_RDY | \
|
||||
PCIE9098_HOST_INTR_CMD_DONE | PCIE9098_HOST_INTR_CMD_DNLD | \
|
||||
PCIE9098_HOST_INTR_EVENT_RDY)
|
||||
|
||||
/** Interrupt select mask for host */
|
||||
#define PCIE9098_HOST_INTR_SEL_MASK \
|
||||
(PCIE9098_HOST_INTR_DNLD_DONE | PCIE9098_HOST_INTR_UPLD_RDY | \
|
||||
PCIE9098_HOST_INTR_CMD_DONE | PCIE9098_HOST_INTR_EVENT_RDY)
|
||||
#endif
|
||||
|
||||
#if defined(PCIE8997) || defined(PCIE8897)
|
||||
/* PCIE INTERNAL REGISTERS */
|
||||
/** PCIE data exchange register 0 */
|
||||
#define PCIE_SCRATCH_0_REG 0x0C10
|
||||
/** PCIE data exchange register 1 */
|
||||
#define PCIE_SCRATCH_1_REG 0x0C14
|
||||
/** PCIE CPU interrupt events */
|
||||
#define PCIE_CPU_INT_EVENT 0x0C18
|
||||
/** PCIE CPU interrupt status */
|
||||
#define PCIE_CPU_INT_STATUS 0x0C1C
|
||||
|
||||
/** PCIe CPU Interrupt Status Mask */
|
||||
#define PCIE_CPU_INT2ARM_ISM 0x0C28
|
||||
/** PCIE host interrupt status */
|
||||
#define PCIE_HOST_INT_STATUS 0x0C30
|
||||
/** PCIE host interrupt mask */
|
||||
#define PCIE_HOST_INT_MASK 0x0C34
|
||||
/** PCIE host interrupt status mask */
|
||||
#define PCIE_HOST_INT_STATUS_MASK 0x0C3C
|
||||
/** PCIE data exchange register 2 */
|
||||
#define PCIE_SCRATCH_2_REG 0x0C40
|
||||
/** PCIE data exchange register 3 */
|
||||
#define PCIE_SCRATCH_3_REG 0x0C44
|
||||
|
||||
#define PCIE_IP_REV_REG 0x0C48
|
||||
|
||||
/** PCIE data exchange register 4 */
|
||||
#define PCIE_SCRATCH_4_REG 0x0CD0
|
||||
/** PCIE data exchange register 5 */
|
||||
#define PCIE_SCRATCH_5_REG 0x0CD4
|
||||
/** PCIE data exchange register 6 */
|
||||
#define PCIE_SCRATCH_6_REG 0x0CD8
|
||||
/** PCIE data exchange register 7 */
|
||||
#define PCIE_SCRATCH_7_REG 0x0CDC
|
||||
/** PCIE data exchange register 8 */
|
||||
#define PCIE_SCRATCH_8_REG 0x0CE0
|
||||
/** PCIE data exchange register 9 */
|
||||
#define PCIE_SCRATCH_9_REG 0x0CE4
|
||||
/** PCIE data exchange register 10 */
|
||||
#define PCIE_SCRATCH_10_REG 0x0CE8
|
||||
/** PCIE data exchange register 11 */
|
||||
#define PCIE_SCRATCH_11_REG 0x0CEC
|
||||
/** PCIE data exchange register 12 */
|
||||
#define PCIE_SCRATCH_12_REG 0x0CF0
|
||||
#endif
|
||||
|
||||
#ifdef PCIE8997
|
||||
/* PCIE read data pointer for queue 0 and 1 */
|
||||
#define PCIE8997_RD_DATA_PTR_Q0_Q1 0xC1A4 /* 0x8000C1A4 */
|
||||
/* PCIE read data pointer for queue 2 and 3 */
|
||||
#define PCIE8997_RD_DATA_PTR_Q2_Q3 0xC1A8 /* 0x8000C1A8 */
|
||||
/* PCIE write data pointer for queue 0 and 1 */
|
||||
#define PCIE8997_WR_DATA_PTR_Q0_Q1 0xC174 /* 0x8000C174 */
|
||||
/* PCIE write data pointer for queue 2 and 3 */
|
||||
#define PCIE8997_WR_DATA_PTR_Q2_Q3 0xC178 /* 0x8000C178 */
|
||||
#endif
|
||||
#ifdef PCIE8897
|
||||
/* PCIE read data pointer for queue 0 and 1 */
|
||||
#define PCIE8897_RD_DATA_PTR_Q0_Q1 0xC08C /* 0x8000C08C */
|
||||
/* PCIE read data pointer for queue 2 and 3 */
|
||||
#define PCIE8897_RD_DATA_PTR_Q2_Q3 0xC090 /* 0x8000C090 */
|
||||
/* PCIE write data pointer for queue 0 and 1 */
|
||||
#define PCIE8897_WR_DATA_PTR_Q0_Q1 0xC05C /* 0x8000C05C */
|
||||
/* PCIE write data pointer for queue 2 and 3 */
|
||||
#define PCIE8897_WR_DATA_PTR_Q2_Q3 0xC060 /* 0x8000C060 */
|
||||
#endif
|
||||
|
||||
/** Download ready interrupt for CPU */
|
||||
#define CPU_INTR_DNLD_RDY MBIT(0)
|
||||
/** Command ready interrupt for CPU */
|
||||
#define CPU_INTR_DOOR_BELL MBIT(1)
|
||||
/** Confirmation that sleep confirm message has been processed.
|
||||
Device will enter sleep after receiving this interrupt */
|
||||
#define CPU_INTR_SLEEP_CFM_DONE MBIT(2)
|
||||
/** Reset interrupt for CPU */
|
||||
#define CPU_INTR_RESET MBIT(3)
|
||||
/** Set Event Done interupt to the FW*/
|
||||
#define CPU_INTR_EVENT_DONE MBIT(5)
|
||||
|
||||
#if defined(PCIE8997) || defined(PCIE8897)
|
||||
/** Data sent interrupt for host */
|
||||
#define HOST_INTR_DNLD_DONE MBIT(0)
|
||||
/** Data receive interrupt for host */
|
||||
#define HOST_INTR_UPLD_RDY MBIT(1)
|
||||
/** Command sent interrupt for host */
|
||||
#define HOST_INTR_CMD_DONE MBIT(2)
|
||||
/** Event ready interrupt for host */
|
||||
#define HOST_INTR_EVENT_RDY MBIT(3)
|
||||
/** Interrupt mask for host */
|
||||
#define HOST_INTR_MASK \
|
||||
(HOST_INTR_DNLD_DONE | HOST_INTR_UPLD_RDY | HOST_INTR_CMD_DONE | \
|
||||
HOST_INTR_EVENT_RDY)
|
||||
|
||||
/** Lower 32bits command address holding register */
|
||||
#define REG_CMD_ADDR_LO PCIE_SCRATCH_0_REG
|
||||
/** Upper 32bits command address holding register */
|
||||
#define REG_CMD_ADDR_HI PCIE_SCRATCH_1_REG
|
||||
/** Command length holding register */
|
||||
#define REG_CMD_SIZE PCIE_SCRATCH_2_REG
|
||||
|
||||
/** Lower 32bits command response address holding register */
|
||||
#define REG_CMDRSP_ADDR_LO PCIE_SCRATCH_4_REG
|
||||
/** Upper 32bits command response address holding register */
|
||||
#define REG_CMDRSP_ADDR_HI PCIE_SCRATCH_5_REG
|
||||
|
||||
/** TxBD's Read/Write pointer start from bit 16 */
|
||||
#define TXBD_RW_PTR_START 16
|
||||
/** RxBD's Read/Write pointer start from bit 0 */
|
||||
#define RXBD_RW_PTR_STRAT 0
|
||||
|
||||
#define MLAN_BD_FLAG_SOP MBIT(0)
|
||||
#define MLAN_BD_FLAG_EOP MBIT(1)
|
||||
#define MLAN_BD_FLAG_XS_SOP MBIT(2)
|
||||
#define MLAN_BD_FLAG_XS_EOP MBIT(3)
|
||||
|
||||
/* Event buffer description write pointer */
|
||||
#define REG_EVTBD_WRPTR PCIE_SCRATCH_10_REG
|
||||
/* Event buffer description read pointer */
|
||||
#define REG_EVTBD_RDPTR PCIE_SCRATCH_11_REG
|
||||
/* Driver ready signature write pointer */
|
||||
#define REG_DRV_READY PCIE_SCRATCH_12_REG
|
||||
|
||||
/** Event Read/Write pointer mask */
|
||||
#define EVT_RW_PTR_MASK 0x0f
|
||||
/** Event Read/Write pointer rollover bit */
|
||||
#define EVT_RW_PTR_ROLLOVER_IND MBIT(7)
|
||||
#endif
|
||||
|
||||
/* Define PCIE block size for firmware download */
|
||||
#define MLAN_PCIE_BLOCK_SIZE_FW_DNLD 256
|
||||
|
||||
/** Extra added macros **/
|
||||
#define MLAN_EVENT_HEADER_LEN 8
|
||||
|
||||
/** Max interrupt status register read limit */
|
||||
#define MAX_READ_REG_RETRY 10000
|
||||
|
||||
#ifdef PCIE8897
|
||||
static const struct _mlan_pcie_card_reg mlan_reg_pcie8897 = {
|
||||
.reg_txbd_rdptr = PCIE8897_RD_DATA_PTR_Q0_Q1,
|
||||
.reg_txbd_wrptr = PCIE8897_WR_DATA_PTR_Q0_Q1,
|
||||
.reg_rxbd_rdptr = PCIE8897_RD_DATA_PTR_Q0_Q1,
|
||||
.reg_rxbd_wrptr = PCIE8897_WR_DATA_PTR_Q0_Q1,
|
||||
.reg_evtbd_rdptr = REG_EVTBD_RDPTR,
|
||||
.reg_evtbd_wrptr = REG_EVTBD_WRPTR,
|
||||
.reg_host_int_mask = PCIE_HOST_INT_MASK,
|
||||
.reg_host_int_status_mask = PCIE_HOST_INT_STATUS_MASK,
|
||||
.reg_host_int_status = PCIE_HOST_INT_STATUS,
|
||||
.reg_cpu_int_event = PCIE_CPU_INT_EVENT,
|
||||
.reg_ip_rev = PCIE_IP_REV_REG,
|
||||
.reg_drv_ready = REG_DRV_READY,
|
||||
.reg_cpu_int_status = PCIE_CPU_INT_STATUS,
|
||||
.reg_scratch_0 = PCIE_SCRATCH_0_REG,
|
||||
.reg_scratch_1 = PCIE_SCRATCH_1_REG,
|
||||
.reg_scratch_2 = PCIE_SCRATCH_2_REG,
|
||||
.reg_scratch_3 = PCIE_SCRATCH_3_REG,
|
||||
.host_intr_mask = HOST_INTR_MASK,
|
||||
.host_intr_dnld_done = HOST_INTR_DNLD_DONE,
|
||||
.host_intr_upld_rdy = HOST_INTR_UPLD_RDY,
|
||||
.host_intr_cmd_done = HOST_INTR_CMD_DONE,
|
||||
.host_intr_event_rdy = HOST_INTR_EVENT_RDY,
|
||||
.txrx_rw_ptr_mask = 0x000003FF,
|
||||
.txrx_rw_ptr_wrap_mask = 0x000007FF,
|
||||
.txrx_rw_ptr_rollover_ind = MBIT(10),
|
||||
.use_adma = MFALSE,
|
||||
.msi_int_wr_clr = MTRUE,
|
||||
};
|
||||
|
||||
static const struct _mlan_card_info mlan_card_info_pcie8897 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 0,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef PCIE8997
|
||||
static const struct _mlan_pcie_card_reg mlan_reg_pcie8997 = {
|
||||
.reg_txbd_rdptr = PCIE8997_RD_DATA_PTR_Q0_Q1,
|
||||
.reg_txbd_wrptr = PCIE8997_WR_DATA_PTR_Q0_Q1,
|
||||
.reg_rxbd_rdptr = PCIE8997_RD_DATA_PTR_Q0_Q1,
|
||||
.reg_rxbd_wrptr = PCIE8997_WR_DATA_PTR_Q0_Q1,
|
||||
.reg_evtbd_rdptr = REG_EVTBD_RDPTR,
|
||||
.reg_evtbd_wrptr = REG_EVTBD_WRPTR,
|
||||
.reg_host_int_mask = PCIE_HOST_INT_MASK,
|
||||
.reg_host_int_status_mask = PCIE_HOST_INT_STATUS_MASK,
|
||||
.reg_host_int_status = PCIE_HOST_INT_STATUS,
|
||||
.reg_cpu_int_event = PCIE_CPU_INT_EVENT,
|
||||
.reg_ip_rev = PCIE_IP_REV_REG,
|
||||
.reg_drv_ready = REG_DRV_READY,
|
||||
.reg_cpu_int_status = PCIE_CPU_INT_STATUS,
|
||||
.reg_scratch_0 = PCIE_SCRATCH_0_REG,
|
||||
.reg_scratch_1 = PCIE_SCRATCH_1_REG,
|
||||
.reg_scratch_2 = PCIE_SCRATCH_2_REG,
|
||||
.reg_scratch_3 = PCIE_SCRATCH_3_REG,
|
||||
.host_intr_mask = HOST_INTR_MASK,
|
||||
.host_intr_dnld_done = HOST_INTR_DNLD_DONE,
|
||||
.host_intr_upld_rdy = HOST_INTR_UPLD_RDY,
|
||||
.host_intr_cmd_done = HOST_INTR_CMD_DONE,
|
||||
.host_intr_event_rdy = HOST_INTR_EVENT_RDY,
|
||||
.txrx_rw_ptr_mask = 0x00000FFF,
|
||||
.txrx_rw_ptr_wrap_mask = 0x00001FFF,
|
||||
.txrx_rw_ptr_rollover_ind = MBIT(12),
|
||||
.use_adma = MFALSE,
|
||||
.msi_int_wr_clr = MTRUE,
|
||||
};
|
||||
|
||||
static const struct _mlan_card_info mlan_card_info_pcie8997 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(PCIE9098) || defined(PCIE9097)
|
||||
static const struct _mlan_pcie_card_reg mlan_reg_pcie9098 = {
|
||||
.reg_txbd_rdptr = PCIE9098_TXBD_RDPTR,
|
||||
.reg_txbd_wrptr = PCIE9098_TXBD_WRPTR,
|
||||
.reg_rxbd_rdptr = PCIE9098_RXBD_RDPTR,
|
||||
.reg_rxbd_wrptr = PCIE9098_RXBD_WRPTR,
|
||||
.reg_evtbd_rdptr = PCIE9098_EVTBD_RDPTR,
|
||||
.reg_evtbd_wrptr = PCIE9098_EVTBD_WRPTR,
|
||||
.reg_host_int_mask = PCIE9098_HOST_INT_MASK,
|
||||
.reg_host_int_status_mask = PCIE9098_HOST_INT_STATUS_MASK,
|
||||
.reg_host_int_status = PCIE9098_HOST_INT_STATUS,
|
||||
.reg_host_int_clr_sel = PCIE9098_HOST_INT_CLR_SEL,
|
||||
.reg_cpu_int_event = PCIE9098_CPU_INT_EVENT,
|
||||
.reg_ip_rev = PCIE9098_DEV_ID_REG,
|
||||
.reg_drv_ready = PCIE9098_DRV_READY,
|
||||
.reg_cpu_int_status = PCIE9098_CPU_INT_STATUS,
|
||||
.reg_rev_id = PCIE9098_REV_ID_REG,
|
||||
.reg_scratch_0 = PCIE9098_SCRATCH_0_REG,
|
||||
.reg_scratch_1 = PCIE9098_SCRATCH_1_REG,
|
||||
.reg_scratch_2 = PCIE9098_SCRATCH_2_REG,
|
||||
.reg_scratch_3 = PCIE9098_SCRATCH_3_REG,
|
||||
.reg_scratch_6 = PCIE9098_SCRATCH_6_REG,
|
||||
.reg_scratch_7 = PCIE9098_SCRATCH_7_REG,
|
||||
.host_intr_mask = PCIE9098_HOST_INTR_MASK,
|
||||
.host_intr_dnld_done = PCIE9098_HOST_INTR_DNLD_DONE,
|
||||
.host_intr_upld_rdy = PCIE9098_HOST_INTR_UPLD_RDY,
|
||||
.host_intr_cmd_done = PCIE9098_HOST_INTR_CMD_DONE,
|
||||
.host_intr_event_rdy = PCIE9098_HOST_INTR_EVENT_RDY,
|
||||
.host_intr_cmd_dnld = PCIE9098_HOST_INTR_CMD_DNLD,
|
||||
.use_adma = MTRUE,
|
||||
.msi_int_wr_clr = MTRUE,
|
||||
};
|
||||
|
||||
static const struct _mlan_card_info mlan_card_info_pcie9098 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 1,
|
||||
.v17_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef PCIE9097
|
||||
static const struct _mlan_pcie_card_reg mlan_reg_pcie9097_b0 = {
|
||||
.reg_txbd_rdptr = PCIE9098_TXBD_RDPTR,
|
||||
.reg_txbd_wrptr = PCIE9098_TXBD_WRPTR,
|
||||
.reg_rxbd_rdptr = PCIE9098_RXBD_RDPTR,
|
||||
.reg_rxbd_wrptr = PCIE9098_RXBD_WRPTR,
|
||||
.reg_evtbd_rdptr = PCIE9098_EVTBD_RDPTR,
|
||||
.reg_evtbd_wrptr = PCIE9098_EVTBD_WRPTR,
|
||||
.reg_host_int_mask = PCIE9097_B0_HOST_INT_MASK,
|
||||
.reg_host_int_status_mask = PCIE9097_B0_HOST_INT_STATUS_MASK,
|
||||
.reg_host_int_status = PCIE9097_B0_HOST_INT_STATUS,
|
||||
.reg_host_int_clr_sel = PCIE9097_B0_HOST_INT_CLR_SEL,
|
||||
.reg_cpu_int_event = PCIE9098_CPU_INT_EVENT,
|
||||
.reg_ip_rev = PCIE9098_DEV_ID_REG,
|
||||
.reg_drv_ready = PCIE9098_DRV_READY,
|
||||
.reg_cpu_int_status = PCIE9098_CPU_INT_STATUS,
|
||||
.reg_rev_id = PCIE9098_REV_ID_REG,
|
||||
.reg_scratch_0 = PCIE9098_SCRATCH_0_REG,
|
||||
.reg_scratch_1 = PCIE9098_SCRATCH_1_REG,
|
||||
.reg_scratch_2 = PCIE9098_SCRATCH_2_REG,
|
||||
.reg_scratch_3 = PCIE9098_SCRATCH_3_REG,
|
||||
.reg_scratch_6 = PCIE9098_SCRATCH_6_REG,
|
||||
.reg_scratch_7 = PCIE9098_SCRATCH_7_REG,
|
||||
.host_intr_mask = PCIE9098_HOST_INTR_MASK,
|
||||
.host_intr_dnld_done = PCIE9098_HOST_INTR_DNLD_DONE,
|
||||
.host_intr_upld_rdy = PCIE9098_HOST_INTR_UPLD_RDY,
|
||||
.host_intr_cmd_done = PCIE9098_HOST_INTR_CMD_DONE,
|
||||
.host_intr_event_rdy = PCIE9098_HOST_INTR_EVENT_RDY,
|
||||
.host_intr_cmd_dnld = PCIE9098_HOST_INTR_CMD_DNLD,
|
||||
.use_adma = MTRUE,
|
||||
.msi_int_wr_clr = MTRUE,
|
||||
};
|
||||
#endif
|
||||
/* Get pcie device from card type */
|
||||
mlan_status wlan_get_pcie_device(pmlan_adapter pmadapter);
|
||||
|
||||
/** Set PCIE host buffer configurations */
|
||||
mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv);
|
||||
|
||||
/** Init write pointer */
|
||||
mlan_status wlan_pcie_init_fw(pmlan_adapter pmadapter);
|
||||
|
||||
#if defined(PCIE8997) || defined(PCIE8897)
|
||||
/** Prepare command PCIE host buffer config */
|
||||
mlan_status wlan_cmd_pcie_host_buf_cfg(pmlan_private pmpriv,
|
||||
pHostCmd_DS_COMMAND cmd,
|
||||
t_u16 cmd_action, t_pvoid pdata_buf);
|
||||
#endif
|
||||
|
||||
/** Wakeup PCIE card */
|
||||
mlan_status wlan_pcie_wakeup(pmlan_adapter pmadapter);
|
||||
|
||||
/** Set DRV_READY register */
|
||||
mlan_status wlan_set_drv_ready_reg(mlan_adapter *pmadapter, t_u32 val);
|
||||
/** PCIE init */
|
||||
mlan_status wlan_pcie_init(mlan_adapter *pmadapter);
|
||||
|
||||
/** Read interrupt status */
|
||||
mlan_status wlan_process_msix_int(mlan_adapter *pmadapter);
|
||||
/** Transfer data to card */
|
||||
mlan_status wlan_pcie_host_to_card(pmlan_private pmpriv, t_u8 type,
|
||||
mlan_buffer *mbuf, mlan_tx_param *tx_param);
|
||||
/** Ring buffer allocation function */
|
||||
mlan_status wlan_alloc_pcie_ring_buf(pmlan_adapter pmadapter);
|
||||
/** Ring buffer deallocation function */
|
||||
mlan_status wlan_free_pcie_ring_buf(pmlan_adapter pmadapter);
|
||||
/** Ring buffer cleanup function, e.g. on deauth */
|
||||
mlan_status wlan_clean_pcie_ring_buf(pmlan_adapter pmadapter);
|
||||
mlan_status wlan_alloc_ssu_pcie_buf(pmlan_adapter pmadapter);
|
||||
mlan_status wlan_free_ssu_pcie_buf(pmlan_adapter pmadapter);
|
||||
|
||||
#endif /* _MLAN_PCIE_H_ */
|
6468
mxm_wifiex/wlan_src/mlan/mlan_scan.c
Normal file
6468
mxm_wifiex/wlan_src/mlan/mlan_scan.c
Normal file
File diff suppressed because it is too large
Load diff
3013
mxm_wifiex/wlan_src/mlan/mlan_sdio.c
Normal file
3013
mxm_wifiex/wlan_src/mlan/mlan_sdio.c
Normal file
File diff suppressed because it is too large
Load diff
550
mxm_wifiex/wlan_src/mlan/mlan_sdio.h
Normal file
550
mxm_wifiex/wlan_src/mlan/mlan_sdio.h
Normal file
|
@ -0,0 +1,550 @@
|
|||
/** @file mlan_sdio.h
|
||||
*
|
||||
* @brief This file contains definitions for SDIO interface.
|
||||
* driver.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
/****************************************************
|
||||
Change log:
|
||||
****************************************************/
|
||||
|
||||
#ifndef _MLAN_SDIO_H
|
||||
#define _MLAN_SDIO_H
|
||||
|
||||
/** Block mode */
|
||||
#ifndef BLOCK_MODE
|
||||
#define BLOCK_MODE 1
|
||||
#endif
|
||||
|
||||
/** Fixed address mode */
|
||||
#ifndef FIXED_ADDRESS
|
||||
#define FIXED_ADDRESS 0
|
||||
#endif
|
||||
|
||||
/* Host Control Registers */
|
||||
/** Host Control Registers : Host to Card Event */
|
||||
#define HOST_TO_CARD_EVENT_REG 0x00
|
||||
/** Host Control Registers : Host terminates Command 53 */
|
||||
#define HOST_TERM_CMD53 (0x1U << 2)
|
||||
/** Host Control Registers : Host without Command 53 finish host */
|
||||
#define HOST_WO_CMD53_FINISH_HOST (0x1U << 2)
|
||||
/** Host Control Registers : Host power up */
|
||||
#define HOST_POWER_UP (0x1U << 1)
|
||||
/** Host Control Registers : Host power down */
|
||||
#define HOST_POWER_DOWN (0x1U << 0)
|
||||
|
||||
/** Host Control Registers : Upload host interrupt RSR */
|
||||
#define UP_LD_HOST_INT_RSR (0x1U)
|
||||
#define HOST_INT_RSR_MASK 0xFF
|
||||
|
||||
/** Host Control Registers : Upload command port host interrupt status */
|
||||
#define UP_LD_CMD_PORT_HOST_INT_STATUS (0x40U)
|
||||
/** Host Control Registers : Download command port host interrupt status */
|
||||
#define DN_LD_CMD_PORT_HOST_INT_STATUS (0x80U)
|
||||
|
||||
/** Host Control Registers : Upload host interrupt mask */
|
||||
#define UP_LD_HOST_INT_MASK (0x1U)
|
||||
/** Host Control Registers : Download host interrupt mask */
|
||||
#define DN_LD_HOST_INT_MASK (0x2U)
|
||||
/** Host Control Registers : Cmd port upload interrupt mask */
|
||||
#define CMD_PORT_UPLD_INT_MASK (0x1U << 6)
|
||||
/** Host Control Registers : Cmd port download interrupt mask */
|
||||
#define CMD_PORT_DNLD_INT_MASK (0x1U << 7)
|
||||
/** Enable Host interrupt mask */
|
||||
#define HIM_ENABLE \
|
||||
(UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK | CMD_PORT_UPLD_INT_MASK | \
|
||||
CMD_PORT_DNLD_INT_MASK)
|
||||
/** Disable Host interrupt mask */
|
||||
#define HIM_DISABLE 0xff
|
||||
|
||||
/** Host Control Registers : Upload host interrupt status */
|
||||
#define UP_LD_HOST_INT_STATUS (0x1U)
|
||||
/** Host Control Registers : Download host interrupt status */
|
||||
#define DN_LD_HOST_INT_STATUS (0x2U)
|
||||
|
||||
/** Host Control Registers : Download CRC error */
|
||||
#define DN_LD_CRC_ERR (0x1U << 2)
|
||||
/** Host Control Registers : Upload restart */
|
||||
#define UP_LD_RESTART (0x1U << 1)
|
||||
/** Host Control Registers : Download restart */
|
||||
#define DN_LD_RESTART (0x1U << 0)
|
||||
|
||||
/** Card Control Registers : Command port upload ready */
|
||||
#define UP_LD_CP_RDY (0x1U << 6)
|
||||
/** Card Control Registers : Command port download ready */
|
||||
#define DN_LD_CP_RDY (0x1U << 7)
|
||||
/** Card Control Registers : Card I/O ready */
|
||||
#define CARD_IO_READY (0x1U << 3)
|
||||
/** Card Control Registers : CIS card ready */
|
||||
#define CIS_CARD_RDY (0x1U << 2)
|
||||
/** Card Control Registers : Upload card ready */
|
||||
#define UP_LD_CARD_RDY (0x1U << 1)
|
||||
/** Card Control Registers : Download card ready */
|
||||
#define DN_LD_CARD_RDY (0x1U << 0)
|
||||
|
||||
/** Card Control Registers : Host power interrupt mask */
|
||||
#define HOST_POWER_INT_MASK (0x1U << 3)
|
||||
/** Card Control Registers : Abort card interrupt mask */
|
||||
#define ABORT_CARD_INT_MASK (0x1U << 2)
|
||||
/** Card Control Registers : Upload card interrupt mask */
|
||||
#define UP_LD_CARD_INT_MASK (0x1U << 1)
|
||||
/** Card Control Registers : Download card interrupt mask */
|
||||
#define DN_LD_CARD_INT_MASK (0x1U << 0)
|
||||
|
||||
/** Card Control Registers : Power up interrupt */
|
||||
#define POWER_UP_INT (0x1U << 4)
|
||||
/** Card Control Registers : Power down interrupt */
|
||||
#define POWER_DOWN_INT (0x1U << 3)
|
||||
|
||||
/** Card Control Registers : Power up RSR */
|
||||
#define POWER_UP_RSR (0x1U << 4)
|
||||
/** Card Control Registers : Power down RSR */
|
||||
#define POWER_DOWN_RSR (0x1U << 3)
|
||||
|
||||
/** Card Control Registers : SD test BUS 0 */
|
||||
#define SD_TESTBUS0 (0x1U)
|
||||
/** Card Control Registers : SD test BUS 1 */
|
||||
#define SD_TESTBUS1 (0x1U)
|
||||
/** Card Control Registers : SD test BUS 2 */
|
||||
#define SD_TESTBUS2 (0x1U)
|
||||
/** Card Control Registers : SD test BUS 3 */
|
||||
#define SD_TESTBUS3 (0x1U)
|
||||
|
||||
/** Port for registers */
|
||||
#define REG_PORT 0
|
||||
/** Port for memory */
|
||||
#define MEM_PORT 0x10000
|
||||
|
||||
/** Card Control Registers : cmd53 new mode */
|
||||
#define CMD53_NEW_MODE (0x1U << 0)
|
||||
/** Card Control Registers : cmd53 tx len format 1 (0x10) */
|
||||
#define CMD53_TX_LEN_FORMAT_1 (0x1U << 4)
|
||||
/** Card Control Registers : cmd53 tx len format 2 (0x20)*/
|
||||
#define CMD53_TX_LEN_FORMAT_2 (0x1U << 5)
|
||||
/** Card Control Registers : cmd53 rx len format 1 (0x40) */
|
||||
#define CMD53_RX_LEN_FORMAT_1 (0x1U << 6)
|
||||
/** Card Control Registers : cmd53 rx len format 2 (0x80)*/
|
||||
#define CMD53_RX_LEN_FORMAT_2 (0x1U << 7)
|
||||
|
||||
#define CMD_PORT_RD_LEN_EN (0x1U << 2)
|
||||
/* Card Control Registers : cmd port auto enable */
|
||||
#define CMD_PORT_AUTO_EN (0x1U << 0)
|
||||
|
||||
/* Command port */
|
||||
#define CMD_PORT_SLCT 0x8000
|
||||
|
||||
/** Misc. Config Register : Auto Re-enable interrupts */
|
||||
#define AUTO_RE_ENABLE_INT MBIT(4)
|
||||
|
||||
/** Enable GPIO-1 as a duplicated signal of interrupt as appear of SDIO_DAT1*/
|
||||
#define ENABLE_GPIO_1_INT_MODE 0x88
|
||||
/** Scratch reg 3 2 : Configure GPIO-1 INT*/
|
||||
#define SCRATCH_REG_32 0xEE
|
||||
|
||||
/** Event header Len*/
|
||||
#define MLAN_EVENT_HEADER_LEN 8
|
||||
|
||||
/** SDIO byte mode size */
|
||||
#define MAX_BYTE_MODE_SIZE 512
|
||||
|
||||
/** The base address for packet with multiple ports aggregation */
|
||||
#define SDIO_MPA_ADDR_BASE 0x1000
|
||||
|
||||
/** SDIO Tx aggregation in progress ? */
|
||||
#define MP_TX_AGGR_IN_PROGRESS(a) (a->pcard_sd->mpa_tx.pkt_cnt > 0)
|
||||
|
||||
/** SDIO Tx aggregation buffer room for next packet ? */
|
||||
#define MP_TX_AGGR_BUF_HAS_ROOM(a, mbuf, len) \
|
||||
(((a->pcard_sd->mpa_tx.buf_len) + len) <= \
|
||||
(a->pcard_sd->mpa_tx.buf_size))
|
||||
|
||||
/** Copy current packet (SDIO Tx aggregation buffer) to SDIO buffer */
|
||||
#define MP_TX_AGGR_BUF_PUT(a, mbuf, port) \
|
||||
do { \
|
||||
pmadapter->callbacks.moal_memmove( \
|
||||
a->pmoal_handle, \
|
||||
&a->pcard_sd->mpa_tx.buf[a->pcard_sd->mpa_tx.buf_len], \
|
||||
mbuf->pbuf + mbuf->data_offset, mbuf->data_len); \
|
||||
a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \
|
||||
a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = \
|
||||
*(t_u16 *)(mbuf->pbuf + mbuf->data_offset); \
|
||||
if (!a->pcard_sd->mpa_tx.pkt_cnt) { \
|
||||
a->pcard_sd->mpa_tx.start_port = port; \
|
||||
} \
|
||||
a->pcard_sd->mpa_tx.ports |= (1 << port); \
|
||||
a->pcard_sd->mpa_tx.pkt_cnt++; \
|
||||
} while (0)
|
||||
|
||||
#define MP_TX_AGGR_BUF_PUT_SG(a, mbuf, port) \
|
||||
do { \
|
||||
a->pcard_sd->mpa_tx.buf_len += mbuf->data_len; \
|
||||
a->pcard_sd->mpa_tx.mp_wr_info[a->pcard_sd->mpa_tx.pkt_cnt] = \
|
||||
*(t_u16 *)(mbuf->pbuf + mbuf->data_offset); \
|
||||
a->pcard_sd->mpa_tx.mbuf_arr[a->pcard_sd->mpa_tx.pkt_cnt] = \
|
||||
mbuf; \
|
||||
if (!a->pcard_sd->mpa_tx.pkt_cnt) { \
|
||||
a->pcard_sd->mpa_tx.start_port = port; \
|
||||
} \
|
||||
a->pcard_sd->mpa_tx.ports |= (1 << port); \
|
||||
a->pcard_sd->mpa_tx.pkt_cnt++; \
|
||||
} while (0)
|
||||
/** SDIO Tx aggregation limit ? */
|
||||
#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) \
|
||||
((a->pcard_sd->mpa_tx.pkt_cnt) == (a->pcard_sd->mpa_tx.pkt_aggr_limit))
|
||||
|
||||
/** Reset SDIO Tx aggregation buffer parameters */
|
||||
#define MP_TX_AGGR_BUF_RESET(a) \
|
||||
do { \
|
||||
memset(a, a->pcard_sd->mpa_tx.mp_wr_info, 0, \
|
||||
sizeof(a->pcard_sd->mpa_tx.mp_wr_info)); \
|
||||
a->pcard_sd->mpa_tx.pkt_cnt = 0; \
|
||||
a->pcard_sd->mpa_tx.buf_len = 0; \
|
||||
a->pcard_sd->mpa_tx.ports = 0; \
|
||||
a->pcard_sd->mpa_tx.start_port = 0; \
|
||||
} while (0)
|
||||
|
||||
/** SDIO Rx aggregation limit ? */
|
||||
#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) \
|
||||
(a->pcard_sd->mpa_rx.pkt_cnt == a->pcard_sd->mpa_rx.pkt_aggr_limit)
|
||||
|
||||
/** SDIO Rx aggregation port limit ? */
|
||||
/** this is for test only, because port 0 is reserved for control port */
|
||||
/* #define MP_RX_AGGR_PORT_LIMIT_REACHED(a) (a->curr_rd_port == 1) */
|
||||
|
||||
/* receive packets aggregated up to a half of mp_end_port */
|
||||
/* note: hw rx wraps round only after port (MAX_PORT-1) */
|
||||
#define MP_RX_AGGR_PORT_LIMIT_REACHED(a) \
|
||||
(((a->pcard_sd->curr_rd_port < a->pcard_sd->mpa_rx.start_port) && \
|
||||
(((MAX_PORT - a->pcard_sd->mpa_rx.start_port) + \
|
||||
a->pcard_sd->curr_rd_port) >= (a->pcard_sd->mp_end_port >> 1))) || \
|
||||
((a->pcard_sd->curr_rd_port - a->pcard_sd->mpa_rx.start_port) >= \
|
||||
(a->pcard_sd->mp_end_port >> 1)))
|
||||
|
||||
/** SDIO Rx aggregation in progress ? */
|
||||
#define MP_RX_AGGR_IN_PROGRESS(a) (a->pcard_sd->mpa_rx.pkt_cnt > 0)
|
||||
|
||||
/** SDIO Rx aggregation buffer room for next packet ? */
|
||||
#define MP_RX_AGGR_BUF_HAS_ROOM(a, rx_len) \
|
||||
((a->pcard_sd->mpa_rx.buf_len + rx_len) <= a->pcard_sd->mpa_rx.buf_size)
|
||||
|
||||
/** Prepare to copy current packet from card to SDIO Rx aggregation buffer */
|
||||
#define MP_RX_AGGR_SETUP(a, mbuf, port, rx_len) \
|
||||
do { \
|
||||
a->pcard_sd->mpa_rx.buf_len += rx_len; \
|
||||
if (!a->pcard_sd->mpa_rx.pkt_cnt) { \
|
||||
a->pcard_sd->mpa_rx.start_port = port; \
|
||||
} \
|
||||
a->pcard_sd->mpa_rx.ports |= (1 << port); \
|
||||
a->pcard_sd->mpa_rx.mbuf_arr[a->pcard_sd->mpa_rx.pkt_cnt] = \
|
||||
mbuf; \
|
||||
a->pcard_sd->mpa_rx.len_arr[a->pcard_sd->mpa_rx.pkt_cnt] = \
|
||||
rx_len; \
|
||||
a->pcard_sd->mpa_rx.pkt_cnt++; \
|
||||
} while (0)
|
||||
|
||||
/** Reset SDIO Rx aggregation buffer parameters */
|
||||
#define MP_RX_AGGR_BUF_RESET(a) \
|
||||
do { \
|
||||
a->pcard_sd->mpa_rx.pkt_cnt = 0; \
|
||||
a->pcard_sd->mpa_rx.buf_len = 0; \
|
||||
a->pcard_sd->mpa_rx.ports = 0; \
|
||||
a->pcard_sd->mpa_rx.start_port = 0; \
|
||||
} while (0)
|
||||
|
||||
/** aggr buf size 32k */
|
||||
#define SDIO_MP_AGGR_BUF_SIZE_32K (32768)
|
||||
/** max aggr buf size 64k-256 */
|
||||
#define SDIO_MP_AGGR_BUF_SIZE_MAX (65280)
|
||||
|
||||
#ifdef SD8887
|
||||
static const struct _mlan_sdio_card_reg mlan_reg_sd8887 = {
|
||||
.start_rd_port = 0,
|
||||
.start_wr_port = 0,
|
||||
.base_0_reg = 0x6C,
|
||||
.base_1_reg = 0x6D,
|
||||
.poll_reg = 0x5C,
|
||||
.host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK |
|
||||
CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK,
|
||||
.host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS |
|
||||
DN_LD_CMD_PORT_HOST_INT_STATUS |
|
||||
UP_LD_CMD_PORT_HOST_INT_STATUS,
|
||||
.status_reg_0 = 0x90,
|
||||
.status_reg_1 = 0x91,
|
||||
.sdio_int_mask = 0xff,
|
||||
.data_port_mask = 0xffffffff,
|
||||
.max_mp_regs = 196,
|
||||
.rd_bitmap_l = 0x10,
|
||||
.rd_bitmap_u = 0x11,
|
||||
.rd_bitmap_1l = 0x12,
|
||||
.rd_bitmap_1u = 0x13,
|
||||
.wr_bitmap_l = 0x14,
|
||||
.wr_bitmap_u = 0x15,
|
||||
.wr_bitmap_1l = 0x16,
|
||||
.wr_bitmap_1u = 0x17,
|
||||
.rd_len_p0_l = 0x18,
|
||||
.rd_len_p0_u = 0x19,
|
||||
.card_config_2_1_reg = 0xD9,
|
||||
.cmd_config_0 = 0xC4,
|
||||
.cmd_config_1 = 0xC5,
|
||||
.cmd_config_2 = 0xC6,
|
||||
.cmd_config_3 = 0xC7,
|
||||
.cmd_rd_len_0 = 0xC0,
|
||||
.cmd_rd_len_1 = 0xC1,
|
||||
.cmd_rd_len_2 = 0xC2,
|
||||
.cmd_rd_len_3 = 0xC3,
|
||||
.io_port_0_reg = 0xE4,
|
||||
.io_port_1_reg = 0xE5,
|
||||
.io_port_2_reg = 0xE6,
|
||||
.host_int_rsr_reg = 0x04,
|
||||
.host_int_mask_reg = 0x08,
|
||||
.host_int_status_reg = 0x0C,
|
||||
.host_restart_reg = 0x58,
|
||||
.card_to_host_event_reg = 0x5C,
|
||||
.host_interrupt_mask_reg = 0x60,
|
||||
.card_interrupt_status_reg = 0x64,
|
||||
.card_interrupt_rsr_reg = 0x68,
|
||||
.card_revision_reg = 0xC8,
|
||||
.card_ocr_0_reg = 0xD4,
|
||||
.card_ocr_1_reg = 0xD5,
|
||||
.card_ocr_3_reg = 0xD6,
|
||||
.card_config_reg = 0xD7,
|
||||
.card_misc_cfg_reg = 0xD8,
|
||||
.debug_0_reg = 0xDC,
|
||||
.debug_1_reg = 0xDD,
|
||||
.debug_2_reg = 0xDE,
|
||||
.debug_3_reg = 0xDF,
|
||||
.fw_reset_reg = 0x0B6,
|
||||
.fw_reset_val = 1,
|
||||
.winner_check_reg = 0x90,
|
||||
};
|
||||
|
||||
static const struct _mlan_card_info mlan_card_info_sd8887 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
.v16_fw_api = 0,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_1X1,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SD8897
|
||||
static const struct _mlan_sdio_card_reg mlan_reg_sd8897 = {
|
||||
.start_rd_port = 0,
|
||||
.start_wr_port = 0,
|
||||
.base_0_reg = 0x60,
|
||||
.base_1_reg = 0x61,
|
||||
.poll_reg = 0x50,
|
||||
.host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK |
|
||||
CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK,
|
||||
.host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS |
|
||||
DN_LD_CMD_PORT_HOST_INT_STATUS |
|
||||
UP_LD_CMD_PORT_HOST_INT_STATUS,
|
||||
.status_reg_0 = 0xC0,
|
||||
.status_reg_1 = 0xC1,
|
||||
.sdio_int_mask = 0xff,
|
||||
.data_port_mask = 0xffffffff,
|
||||
.max_mp_regs = 184,
|
||||
.rd_bitmap_l = 0x04,
|
||||
.rd_bitmap_u = 0x05,
|
||||
.rd_bitmap_1l = 0x06,
|
||||
.rd_bitmap_1u = 0x07,
|
||||
.wr_bitmap_l = 0x08,
|
||||
.wr_bitmap_u = 0x09,
|
||||
.wr_bitmap_1l = 0x0A,
|
||||
.wr_bitmap_1u = 0x0B,
|
||||
.rd_len_p0_l = 0x0C,
|
||||
.rd_len_p0_u = 0x0D,
|
||||
.card_config_2_1_reg = 0xCD,
|
||||
.cmd_config_0 = 0xB8,
|
||||
.cmd_config_1 = 0xB9,
|
||||
.cmd_config_2 = 0xBA,
|
||||
.cmd_config_3 = 0xBB,
|
||||
.cmd_rd_len_0 = 0xB4,
|
||||
.cmd_rd_len_1 = 0xB5,
|
||||
.cmd_rd_len_2 = 0xB6,
|
||||
.cmd_rd_len_3 = 0xB7,
|
||||
.io_port_0_reg = 0xD8,
|
||||
.io_port_1_reg = 0xD9,
|
||||
.io_port_2_reg = 0xDA,
|
||||
.host_int_rsr_reg = 0x01,
|
||||
.host_int_mask_reg = 0x02,
|
||||
.host_int_status_reg = 0x03,
|
||||
.host_restart_reg = 0x4C,
|
||||
.card_to_host_event_reg = 0x50,
|
||||
.host_interrupt_mask_reg = 0x54,
|
||||
.card_interrupt_status_reg = 0x58,
|
||||
.card_interrupt_rsr_reg = 0x5C,
|
||||
.card_revision_reg = 0xBC,
|
||||
.card_ocr_0_reg = 0xC8,
|
||||
.card_ocr_1_reg = 0xC9,
|
||||
.card_ocr_3_reg = 0xCA,
|
||||
.card_config_reg = 0xCB,
|
||||
.card_misc_cfg_reg = 0xCC,
|
||||
.debug_0_reg = 0xD0,
|
||||
.debug_1_reg = 0xD1,
|
||||
.debug_2_reg = 0xD2,
|
||||
.debug_3_reg = 0xD3,
|
||||
.fw_reset_reg = 0x0E8,
|
||||
.fw_reset_val = 1,
|
||||
.winner_check_reg = 0xC0,
|
||||
};
|
||||
|
||||
static const struct _mlan_card_info mlan_card_info_sd8897 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 0,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(SD8977) || defined(SD8997) || defined(SD8987) || \
|
||||
defined(SD9098) || defined(SD9097) || defined(SD8978)
|
||||
static const struct _mlan_sdio_card_reg mlan_reg_sd8977_sd8997 = {
|
||||
.start_rd_port = 0,
|
||||
.start_wr_port = 0,
|
||||
.base_0_reg = 0xf8,
|
||||
.base_1_reg = 0xf9,
|
||||
.poll_reg = 0x5C,
|
||||
.host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK |
|
||||
CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK,
|
||||
.host_int_status = DN_LD_HOST_INT_STATUS | UP_LD_HOST_INT_STATUS |
|
||||
DN_LD_CMD_PORT_HOST_INT_STATUS |
|
||||
UP_LD_CMD_PORT_HOST_INT_STATUS,
|
||||
.status_reg_0 = 0xe8,
|
||||
.status_reg_1 = 0xe9,
|
||||
.sdio_int_mask = 0xff,
|
||||
.data_port_mask = 0xffffffff,
|
||||
.max_mp_regs = 196,
|
||||
.rd_bitmap_l = 0x10,
|
||||
.rd_bitmap_u = 0x11,
|
||||
.rd_bitmap_1l = 0x12,
|
||||
.rd_bitmap_1u = 0x13,
|
||||
.wr_bitmap_l = 0x14,
|
||||
.wr_bitmap_u = 0x15,
|
||||
.wr_bitmap_1l = 0x16,
|
||||
.wr_bitmap_1u = 0x17,
|
||||
.rd_len_p0_l = 0x18,
|
||||
.rd_len_p0_u = 0x19,
|
||||
.card_config_2_1_reg = 0xD9,
|
||||
.cmd_config_0 = 0xC4,
|
||||
.cmd_config_1 = 0xC5,
|
||||
.cmd_config_2 = 0xC6,
|
||||
.cmd_config_3 = 0xC7,
|
||||
.cmd_rd_len_0 = 0xC0,
|
||||
.cmd_rd_len_1 = 0xC1,
|
||||
.cmd_rd_len_2 = 0xC2,
|
||||
.cmd_rd_len_3 = 0xC3,
|
||||
.io_port_0_reg = 0xE4,
|
||||
.io_port_1_reg = 0xE5,
|
||||
.io_port_2_reg = 0xE6,
|
||||
.host_int_rsr_reg = 0x04,
|
||||
.host_int_mask_reg = 0x08,
|
||||
.host_int_status_reg = 0x0C,
|
||||
.host_restart_reg = 0x58,
|
||||
.card_to_host_event_reg = 0x5C,
|
||||
.host_interrupt_mask_reg = 0x60,
|
||||
.card_interrupt_status_reg = 0x64,
|
||||
.card_interrupt_rsr_reg = 0x68,
|
||||
.card_revision_reg = 0xC8,
|
||||
.card_ocr_0_reg = 0xD4,
|
||||
.card_ocr_1_reg = 0xD5,
|
||||
.card_ocr_3_reg = 0xD6,
|
||||
.card_config_reg = 0xD7,
|
||||
.card_misc_cfg_reg = 0xD8,
|
||||
.debug_0_reg = 0xDC,
|
||||
.debug_1_reg = 0xDD,
|
||||
.debug_2_reg = 0xDE,
|
||||
.debug_3_reg = 0xDF,
|
||||
.fw_reset_reg = 0x0EE,
|
||||
.fw_reset_val = 0x99,
|
||||
.fw_dnld_offset_0_reg = 0xEC,
|
||||
.fw_dnld_offset_1_reg = 0xED,
|
||||
.fw_dnld_offset_2_reg = 0xEE,
|
||||
.fw_dnld_offset_3_reg = 0xEF,
|
||||
.fw_dnld_status_0_reg = 0xE8,
|
||||
.fw_dnld_status_1_reg = 0xE9,
|
||||
.winner_check_reg = 0xFC,
|
||||
};
|
||||
|
||||
#ifdef SD8997
|
||||
static const struct _mlan_card_info mlan_card_info_sd8997 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SD9097
|
||||
static const struct _mlan_card_info mlan_card_info_sd9097 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 1,
|
||||
.v17_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
#ifdef SD9098
|
||||
static const struct _mlan_card_info mlan_card_info_sd9098 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K,
|
||||
.v16_fw_api = 1,
|
||||
.v17_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(SD8977) || defined(SD8978)
|
||||
static const struct _mlan_card_info mlan_card_info_sd8977 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
.v16_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_1X1,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SD8987
|
||||
static const struct _mlan_card_info mlan_card_info_sd8987 = {
|
||||
.max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
.v16_fw_api = 1,
|
||||
.supp_ps_handshake = 0,
|
||||
.default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_1X1,
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Probe and initialization function */
|
||||
mlan_status wlan_sdio_probe(pmlan_adapter pmadapter);
|
||||
mlan_status wlan_get_sdio_device(pmlan_adapter pmadapter);
|
||||
|
||||
mlan_status wlan_send_mp_aggr_buf(mlan_adapter *pmadapter);
|
||||
|
||||
mlan_status wlan_re_alloc_sdio_rx_mpa_buffer(mlan_adapter *pmadapter);
|
||||
|
||||
void wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len);
|
||||
t_void wlan_sdio_deaggr_rx_pkt(pmlan_adapter pmadapter, mlan_buffer *pmbuf);
|
||||
/** Transfer data to card */
|
||||
mlan_status wlan_sdio_host_to_card(mlan_adapter *pmadapter, t_u8 type,
|
||||
mlan_buffer *mbuf, mlan_tx_param *tx_param);
|
||||
mlan_status wlan_set_sdio_gpio_int(pmlan_private priv);
|
||||
mlan_status wlan_cmd_sdio_gpio_int(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd, t_u16 cmd_action,
|
||||
t_void *pdata_buf);
|
||||
mlan_status wlan_reset_fw(pmlan_adapter pmadapter);
|
||||
|
||||
#endif /* _MLAN_SDIO_H */
|
1700
mxm_wifiex/wlan_src/mlan/mlan_shim.c
Normal file
1700
mxm_wifiex/wlan_src/mlan/mlan_shim.c
Normal file
File diff suppressed because it is too large
Load diff
2950
mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c
Normal file
2950
mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c
Normal file
File diff suppressed because it is too large
Load diff
2749
mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c
Normal file
2749
mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c
Normal file
File diff suppressed because it is too large
Load diff
1026
mxm_wifiex/wlan_src/mlan/mlan_sta_event.c
Normal file
1026
mxm_wifiex/wlan_src/mlan/mlan_sta_event.c
Normal file
File diff suppressed because it is too large
Load diff
5615
mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c
Normal file
5615
mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
488
mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c
Normal file
488
mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c
Normal file
|
@ -0,0 +1,488 @@
|
|||
/** @file mlan_sta_rx.c
|
||||
*
|
||||
* @brief This file contains the handling of RX in MLAN
|
||||
* module.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
10/27/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_join.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_11n_aggr.h"
|
||||
#include "mlan_11n_rxreorder.h"
|
||||
#ifdef DRV_EMBEDDED_SUPPLICANT
|
||||
#include "authenticator_api.h"
|
||||
#endif
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/** Ethernet II header */
|
||||
typedef struct {
|
||||
/** Ethernet II header destination address */
|
||||
t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH];
|
||||
/** Ethernet II header source address */
|
||||
t_u8 src_addr[MLAN_MAC_ADDR_LENGTH];
|
||||
/** Ethernet II header length */
|
||||
t_u16 ethertype;
|
||||
|
||||
} EthII_Hdr_t;
|
||||
|
||||
/** IPv4 ARP request header */
|
||||
typedef MLAN_PACK_START struct {
|
||||
/** Hardware type */
|
||||
t_u16 Htype;
|
||||
/** Protocol type */
|
||||
t_u16 Ptype;
|
||||
/** Hardware address length */
|
||||
t_u8 addr_len;
|
||||
/** Protocol address length */
|
||||
t_u8 proto_len;
|
||||
/** Operation code */
|
||||
t_u16 op_code;
|
||||
/** Source mac address */
|
||||
t_u8 src_mac[MLAN_MAC_ADDR_LENGTH];
|
||||
/** Sender IP address */
|
||||
t_u8 src_ip[4];
|
||||
/** Destination mac address */
|
||||
t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH];
|
||||
/** Destination IP address */
|
||||
t_u8 dst_ip[4];
|
||||
} MLAN_PACK_END IPv4_ARP_t;
|
||||
|
||||
/** IPv6 Nadv packet header */
|
||||
typedef MLAN_PACK_START struct {
|
||||
/** IP protocol version */
|
||||
t_u8 version;
|
||||
/** flow label */
|
||||
t_u8 flow_lab[3];
|
||||
/** Payload length */
|
||||
t_u16 payload_len;
|
||||
/** Next header type */
|
||||
t_u8 next_hdr;
|
||||
/** Hot limit */
|
||||
t_u8 hop_limit;
|
||||
/** Source address */
|
||||
t_u8 src_addr[16];
|
||||
/** Destination address */
|
||||
t_u8 dst_addr[16];
|
||||
/** ICMP type */
|
||||
t_u8 icmp_type;
|
||||
/** IPv6 Code */
|
||||
t_u8 ipv6_code;
|
||||
/** IPv6 Checksum */
|
||||
t_u16 ipv6_checksum;
|
||||
/** Flags */
|
||||
t_u32 flags;
|
||||
/** Target address */
|
||||
t_u8 taget_addr[16];
|
||||
/** Reserved */
|
||||
t_u8 rev[8];
|
||||
} MLAN_PACK_END IPv6_Nadv_t;
|
||||
|
||||
/********************************************************
|
||||
Global functions
|
||||
********************************************************/
|
||||
/**
|
||||
* @brief This function check and discard IPv4 and IPv6 gratuitous broadcast
|
||||
* packets
|
||||
*
|
||||
* @param prx_pkt A pointer to RxPacketHdr_t structure of received packet
|
||||
* @param pmadapter A pointer to pmlan_adapter structure
|
||||
* @return TRUE if found such type of packets, FALSE not found
|
||||
*/
|
||||
static t_u8 discard_gratuitous_ARP_msg(RxPacketHdr_t *prx_pkt,
|
||||
pmlan_adapter pmadapter)
|
||||
{
|
||||
t_u8 proto_ARP_type[] = {0x08, 0x06};
|
||||
t_u8 proto_ARP_type_v6[] = {0x86, 0xDD};
|
||||
IPv4_ARP_t *parp_hdr;
|
||||
IPv6_Nadv_t *pNadv_hdr;
|
||||
t_u8 ret = MFALSE;
|
||||
|
||||
/* IPV4 pkt check
|
||||
* A gratuitous ARP is an ARP packet
|
||||
* where the source and destination IP are both set to
|
||||
* the IP of the machine issuing the packet.
|
||||
*/
|
||||
if (memcmp(pmadapter, proto_ARP_type, &prx_pkt->eth803_hdr.h803_len,
|
||||
sizeof(proto_ARP_type)) == 0) {
|
||||
parp_hdr = (IPv4_ARP_t *)(&prx_pkt->rfc1042_hdr);
|
||||
/* Graguitous ARP can be ARP request or ARP reply*/
|
||||
if ((parp_hdr->op_code == mlan_htons(0x01)) ||
|
||||
(parp_hdr->op_code == mlan_htons(0x02)))
|
||||
if (memcmp(pmadapter, parp_hdr->src_ip,
|
||||
parp_hdr->dst_ip, 4) == 0)
|
||||
ret = MTRUE;
|
||||
}
|
||||
|
||||
/* IPV6 pkt check
|
||||
* An unsolicited Neighbor Advertisement pkt is
|
||||
* marked by a cleared Solicited Flag
|
||||
*/
|
||||
if (memcmp(pmadapter, proto_ARP_type_v6, &prx_pkt->eth803_hdr.h803_len,
|
||||
sizeof(proto_ARP_type_v6)) == 0) {
|
||||
pNadv_hdr = (IPv6_Nadv_t *)(&prx_pkt->rfc1042_hdr);
|
||||
/* Check Nadv type: next header is ICMPv6 and
|
||||
* icmp type is Nadv */
|
||||
if (pNadv_hdr->next_hdr == 0x3A && pNadv_hdr->icmp_type == 0x88)
|
||||
if ((pNadv_hdr->flags & mlan_htonl(0x40000000)) == 0)
|
||||
ret = MTRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter
|
||||
* @param pmbuf A pointer to mlan_buffer which includes the received packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
pmlan_private priv = pmadapter->priv[pmbuf->bss_index];
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
RxPD *prx_pd;
|
||||
int hdr_chop;
|
||||
EthII_Hdr_t *peth_hdr;
|
||||
t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03,
|
||||
0x00, 0x00, 0x00};
|
||||
t_u8 snap_oui_802_h[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03,
|
||||
0x00, 0x00, 0xf8};
|
||||
t_u8 appletalk_aarp_type[2] = {0x80, 0xf3};
|
||||
t_u8 ipx_snap_type[2] = {0x81, 0x37};
|
||||
#ifdef DRV_EMBEDDED_SUPPLICANT
|
||||
t_u8 eapol_type[2] = {0x88, 0x8e};
|
||||
#endif
|
||||
t_u8 ext_rate_info = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
prx_pkt = (RxPacketHdr_t *)((t_u8 *)prx_pd + prx_pd->rx_pkt_offset);
|
||||
|
||||
/** Small debug type */
|
||||
#define DBG_TYPE_SMALL 2
|
||||
/** Size of debugging structure */
|
||||
#define SIZE_OF_DBG_STRUCT 4
|
||||
if (prx_pd->rx_pkt_type == PKT_TYPE_DEBUG) {
|
||||
t_u8 dbg_type;
|
||||
dbg_type = *(t_u8 *)&prx_pkt->eth803_hdr;
|
||||
if (dbg_type == DBG_TYPE_SMALL) {
|
||||
PRINTM(MFW_D, "\n");
|
||||
DBG_HEXDUMP(MFW_D, "FWDBG",
|
||||
(char *)((t_u8 *)&prx_pkt->eth803_hdr +
|
||||
SIZE_OF_DBG_STRUCT),
|
||||
prx_pd->rx_pkt_length);
|
||||
PRINTM(MFW_D, "FWDBG::\n");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
PRINTM(MINFO,
|
||||
"RX Data: data_len - prx_pd->rx_pkt_offset = %d - %d = %d\n",
|
||||
pmbuf->data_len, prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len - prx_pd->rx_pkt_offset);
|
||||
|
||||
HEXDUMP("RX Data: Dest", prx_pkt->eth803_hdr.dest_addr,
|
||||
sizeof(prx_pkt->eth803_hdr.dest_addr));
|
||||
HEXDUMP("RX Data: Src", prx_pkt->eth803_hdr.src_addr,
|
||||
sizeof(prx_pkt->eth803_hdr.src_addr));
|
||||
|
||||
if ((memcmp(pmadapter, &prx_pkt->rfc1042_hdr, snap_oui_802_h,
|
||||
sizeof(snap_oui_802_h)) == 0) ||
|
||||
((memcmp(pmadapter, &prx_pkt->rfc1042_hdr, rfc1042_eth_hdr,
|
||||
sizeof(rfc1042_eth_hdr)) == 0) &&
|
||||
memcmp(pmadapter, &prx_pkt->rfc1042_hdr.snap_type,
|
||||
appletalk_aarp_type, sizeof(appletalk_aarp_type)) &&
|
||||
memcmp(pmadapter, &prx_pkt->rfc1042_hdr.snap_type, ipx_snap_type,
|
||||
sizeof(ipx_snap_type)))) {
|
||||
/*
|
||||
* Replace the 803 header and rfc1042 header (llc/snap) with an
|
||||
* EthernetII header, keep the src/dst and snap_type
|
||||
* (ethertype). The firmware only passes up SNAP frames
|
||||
* converting all RX Data from 802.11 to 802.2/LLC/SNAP frames.
|
||||
* To create the Ethernet II, just move the src, dst address
|
||||
* right before the snap_type.
|
||||
*/
|
||||
peth_hdr =
|
||||
(EthII_Hdr_t *)((t_u8 *)&prx_pkt->eth803_hdr +
|
||||
sizeof(prx_pkt->eth803_hdr) +
|
||||
sizeof(prx_pkt->rfc1042_hdr) -
|
||||
sizeof(prx_pkt->eth803_hdr.dest_addr) -
|
||||
sizeof(prx_pkt->eth803_hdr.src_addr) -
|
||||
sizeof(prx_pkt->rfc1042_hdr.snap_type));
|
||||
|
||||
memcpy_ext(pmadapter, peth_hdr->src_addr,
|
||||
prx_pkt->eth803_hdr.src_addr,
|
||||
sizeof(peth_hdr->src_addr),
|
||||
sizeof(peth_hdr->src_addr));
|
||||
memcpy_ext(pmadapter, peth_hdr->dest_addr,
|
||||
prx_pkt->eth803_hdr.dest_addr,
|
||||
sizeof(peth_hdr->dest_addr),
|
||||
sizeof(peth_hdr->dest_addr));
|
||||
|
||||
/* Chop off the RxPD + the excess memory from the 802.2/llc/snap
|
||||
* header that was removed.
|
||||
*/
|
||||
hdr_chop = (t_u32)((t_ptr)peth_hdr - (t_ptr)prx_pd);
|
||||
} else {
|
||||
HEXDUMP("RX Data: LLC/SNAP", (t_u8 *)&prx_pkt->rfc1042_hdr,
|
||||
sizeof(prx_pkt->rfc1042_hdr));
|
||||
if ((priv->hotspot_cfg & HOTSPOT_ENABLED) &&
|
||||
discard_gratuitous_ARP_msg(prx_pkt, pmadapter)) {
|
||||
ret = MLAN_STATUS_SUCCESS;
|
||||
PRINTM(MDATA,
|
||||
"Bypass sending Gratuitous ARP frame to Kernel.\n");
|
||||
goto done;
|
||||
}
|
||||
/* Chop off the RxPD */
|
||||
hdr_chop = (t_u32)((t_ptr)&prx_pkt->eth803_hdr - (t_ptr)prx_pd);
|
||||
}
|
||||
|
||||
/* Chop off the leading header bytes so the it points to the start of
|
||||
* either the reconstructed EthII frame or the 802.2/llc/snap frame
|
||||
*/
|
||||
pmbuf->data_len -= hdr_chop;
|
||||
pmbuf->data_offset += hdr_chop;
|
||||
pmbuf->pparent = MNULL;
|
||||
DBG_HEXDUMP(MDAT_D, "RxPD", (t_u8 *)prx_pd,
|
||||
MIN(sizeof(RxPD), MAX_DATA_DUMP_LEN));
|
||||
DBG_HEXDUMP(MDAT_D, "Rx Payload",
|
||||
((t_u8 *)prx_pd + prx_pd->rx_pkt_offset),
|
||||
MIN(prx_pd->rx_pkt_length, MAX_DATA_DUMP_LEN));
|
||||
|
||||
priv->rxpd_rate = prx_pd->rx_rate;
|
||||
pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle,
|
||||
&pmbuf->out_ts_sec,
|
||||
&pmbuf->out_ts_usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data => kernel seq_num=%d tid=%d\n",
|
||||
pmbuf->out_ts_sec, pmbuf->out_ts_usec, prx_pd->seq_num,
|
||||
prx_pd->priority);
|
||||
|
||||
#ifdef DRV_EMBEDDED_SUPPLICANT
|
||||
if (supplicantIsEnabled(priv->psapriv) &&
|
||||
(!memcmp(pmadapter, &prx_pkt->eth803_hdr.h803_len, eapol_type,
|
||||
sizeof(eapol_type)))) {
|
||||
// BML_SET_OFFSET(bufDesc, offset);
|
||||
if (ProcessEAPoLPkt(priv->psapriv, pmbuf)) {
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
ret = MLAN_STATUS_SUCCESS;
|
||||
PRINTM(MMSG,
|
||||
"host supplicant eapol pkt process done.\n");
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MFALSE || priv->rx_pkt_info) {
|
||||
ext_rate_info = (t_u8)(prx_pd->rx_info >> 16);
|
||||
pmbuf->u.rx_info.data_rate =
|
||||
wlan_index_to_data_rate(priv->adapter, prx_pd->rx_rate,
|
||||
prx_pd->rate_info,
|
||||
ext_rate_info);
|
||||
|
||||
pmbuf->u.rx_info.channel =
|
||||
(prx_pd->rx_info & RXPD_CHAN_MASK) >> 5;
|
||||
pmbuf->u.rx_info.antenna = prx_pd->antenna;
|
||||
pmbuf->u.rx_info.rssi = prx_pd->snr - prx_pd->nf;
|
||||
}
|
||||
ret = pmadapter->callbacks.moal_recv_packet(pmadapter->pmoal_handle,
|
||||
pmbuf);
|
||||
if (ret == MLAN_STATUS_FAILURE) {
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
PRINTM(MERROR,
|
||||
"STA Rx Error: moal_recv_packet returned error\n");
|
||||
}
|
||||
done:
|
||||
if (ret != MLAN_STATUS_PENDING)
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
#ifdef USB
|
||||
else if (IS_USB(pmadapter->card_type))
|
||||
pmadapter->callbacks.moal_recv_complete(pmadapter->pmoal_handle,
|
||||
MNULL, MLAN_USB_EP_DATA,
|
||||
MLAN_STATUS_SUCCESS);
|
||||
#endif
|
||||
LEAVE();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes the received buffer
|
||||
*
|
||||
* @param adapter A pointer to mlan_adapter
|
||||
* @param pmbuf A pointer to the received buffer
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_ops_sta_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_adapter pmadapter = (pmlan_adapter)adapter;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
RxPD *prx_pd;
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
pmlan_private priv = pmadapter->priv[pmbuf->bss_index];
|
||||
t_u8 ta[MLAN_MAC_ADDR_LENGTH];
|
||||
t_u16 rx_pkt_type = 0;
|
||||
wlan_mgmt_pkt *pmgmt_pkt_hdr = MNULL;
|
||||
|
||||
sta_node *sta_ptr = MNULL;
|
||||
t_u16 adj_rx_rate = 0;
|
||||
t_u8 antenna = 0;
|
||||
ENTER();
|
||||
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
/* Endian conversion */
|
||||
endian_convert_RxPD(prx_pd);
|
||||
rx_pkt_type = prx_pd->rx_pkt_type;
|
||||
prx_pkt = (RxPacketHdr_t *)((t_u8 *)prx_pd + prx_pd->rx_pkt_offset);
|
||||
|
||||
if ((prx_pd->rx_pkt_offset + prx_pd->rx_pkt_length) !=
|
||||
(t_u16)pmbuf->data_len) {
|
||||
PRINTM(MERROR,
|
||||
"Wrong rx packet: len=%d,rx_pkt_offset=%d,"
|
||||
" rx_pkt_length=%d\n",
|
||||
pmbuf->data_len, prx_pd->rx_pkt_offset,
|
||||
prx_pd->rx_pkt_length);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
pmbuf->data_len = prx_pd->rx_pkt_offset + prx_pd->rx_pkt_length;
|
||||
|
||||
if (pmadapter->priv[pmbuf->bss_index]->mgmt_frame_passthru_mask &&
|
||||
prx_pd->rx_pkt_type == PKT_TYPE_MGMT_FRAME) {
|
||||
/* Check if this is mgmt packet and needs to
|
||||
* forwarded to app as an event
|
||||
*/
|
||||
pmgmt_pkt_hdr = (wlan_mgmt_pkt *)((t_u8 *)prx_pd +
|
||||
prx_pd->rx_pkt_offset);
|
||||
pmgmt_pkt_hdr->frm_len =
|
||||
wlan_le16_to_cpu(pmgmt_pkt_hdr->frm_len);
|
||||
|
||||
if ((pmgmt_pkt_hdr->wlan_header.frm_ctl &
|
||||
IEEE80211_FC_MGMT_FRAME_TYPE_MASK) == 0)
|
||||
wlan_process_802dot11_mgmt_pkt(
|
||||
pmadapter->priv[pmbuf->bss_index],
|
||||
(t_u8 *)&pmgmt_pkt_hdr->wlan_header,
|
||||
pmgmt_pkt_hdr->frm_len + sizeof(wlan_mgmt_pkt) -
|
||||
sizeof(pmgmt_pkt_hdr->frm_len),
|
||||
prx_pd);
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
if (rx_pkt_type != PKT_TYPE_BAR) {
|
||||
priv->rxpd_rate_info = prx_pd->rate_info;
|
||||
priv->rxpd_rate = prx_pd->rx_rate;
|
||||
priv->rxpd_rx_info = (t_u8)(prx_pd->rx_info >> 16);
|
||||
if (priv->bss_type == MLAN_BSS_TYPE_STA) {
|
||||
antenna = wlan_adjust_antenna(priv, prx_pd);
|
||||
adj_rx_rate = wlan_adjust_data_rate(
|
||||
priv, priv->rxpd_rate, priv->rxpd_rate_info);
|
||||
pmadapter->callbacks.moal_hist_data_add(
|
||||
pmadapter->pmoal_handle, pmbuf->bss_index,
|
||||
adj_rx_rate, prx_pd->snr, prx_pd->nf, antenna);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the packet is not an unicast packet then send the packet
|
||||
* directly to os. Don't pass thru rx reordering
|
||||
*/
|
||||
if ((!IS_11N_ENABLED(priv)) ||
|
||||
memcmp(priv->adapter, priv->curr_addr,
|
||||
prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH)) {
|
||||
priv->snr = prx_pd->snr;
|
||||
priv->nf = prx_pd->nf;
|
||||
wlan_process_rx_packet(pmadapter, pmbuf);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (queuing_ra_based(priv)) {
|
||||
memcpy_ext(pmadapter, ta, prx_pkt->eth803_hdr.src_addr,
|
||||
MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH);
|
||||
if (prx_pd->priority < MAX_NUM_TID) {
|
||||
PRINTM(MDATA, "adhoc/tdls packet %p " MACSTR "\n",
|
||||
pmbuf, MAC2STR(ta));
|
||||
sta_ptr = wlan_get_station_entry(priv, ta);
|
||||
if (sta_ptr) {
|
||||
sta_ptr->rx_seq[prx_pd->priority] =
|
||||
prx_pd->seq_num;
|
||||
sta_ptr->snr = prx_pd->snr;
|
||||
sta_ptr->nf = prx_pd->nf;
|
||||
}
|
||||
if (!sta_ptr || !sta_ptr->is_11n_enabled) {
|
||||
wlan_process_rx_packet(pmadapter, pmbuf);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
priv->snr = prx_pd->snr;
|
||||
priv->nf = prx_pd->nf;
|
||||
if ((rx_pkt_type != PKT_TYPE_BAR) &&
|
||||
(prx_pd->priority < MAX_NUM_TID))
|
||||
priv->rx_seq[prx_pd->priority] = prx_pd->seq_num;
|
||||
memcpy_ext(pmadapter, ta,
|
||||
priv->curr_bss_params.bss_descriptor.mac_address,
|
||||
MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH);
|
||||
}
|
||||
if ((priv->port_ctrl_mode == MTRUE && priv->port_open == MFALSE) &&
|
||||
(rx_pkt_type != PKT_TYPE_BAR)) {
|
||||
mlan_11n_rxreorder_pkt(priv, prx_pd->seq_num, prx_pd->priority,
|
||||
ta, (t_u8)prx_pd->rx_pkt_type,
|
||||
(t_void *)RX_PKT_DROPPED_IN_FW);
|
||||
if (rx_pkt_type == PKT_TYPE_AMSDU) {
|
||||
pmbuf->data_len = prx_pd->rx_pkt_length;
|
||||
pmbuf->data_offset += prx_pd->rx_pkt_offset;
|
||||
wlan_11n_deaggregate_pkt(priv, pmbuf);
|
||||
} else {
|
||||
wlan_process_rx_packet(pmadapter, pmbuf);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
/* Reorder and send to OS */
|
||||
ret = mlan_11n_rxreorder_pkt(priv, prx_pd->seq_num, prx_pd->priority,
|
||||
ta, (t_u8)prx_pd->rx_pkt_type,
|
||||
(void *)pmbuf);
|
||||
if (ret || (rx_pkt_type == PKT_TYPE_BAR))
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
|
||||
done:
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
326
mxm_wifiex/wlan_src/mlan/mlan_sta_tx.c
Normal file
326
mxm_wifiex/wlan_src/mlan/mlan_sta_tx.c
Normal file
|
@ -0,0 +1,326 @@
|
|||
/** @file mlan_sta_tx.c
|
||||
*
|
||||
* @brief This file contains the handling of data packet
|
||||
* transmission in MLAN module.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
10/21/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_join.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_wmm.h"
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global functions
|
||||
********************************************************/
|
||||
/**
|
||||
* @brief This function fill the txpd for tx packet
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param pmbuf A pointer to the mlan_buffer for process
|
||||
*
|
||||
* @return headptr or MNULL
|
||||
*/
|
||||
t_void *wlan_ops_sta_process_txpd(t_void *priv, pmlan_buffer pmbuf)
|
||||
{
|
||||
mlan_private *pmpriv = (mlan_private *)priv;
|
||||
pmlan_adapter pmadapter = pmpriv->adapter;
|
||||
TxPD *plocal_tx_pd;
|
||||
t_u8 *head_ptr = MNULL;
|
||||
t_u32 pkt_type;
|
||||
t_u32 tx_control;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!pmbuf->data_len) {
|
||||
PRINTM(MERROR, "STA Tx Error: Invalid packet length: %d\n",
|
||||
pmbuf->data_len);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
|
||||
memcpy_ext(pmpriv->adapter, &pkt_type,
|
||||
pmbuf->pbuf + pmbuf->data_offset, sizeof(pkt_type),
|
||||
sizeof(pkt_type));
|
||||
memcpy_ext(pmpriv->adapter, &tx_control,
|
||||
pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type),
|
||||
sizeof(tx_control), sizeof(tx_control));
|
||||
pmbuf->data_offset += sizeof(pkt_type) + sizeof(tx_control);
|
||||
pmbuf->data_len -= sizeof(pkt_type) + sizeof(tx_control);
|
||||
}
|
||||
|
||||
if (pmbuf->data_offset <
|
||||
(sizeof(TxPD) + pmpriv->intf_hr_len + DMA_ALIGNMENT)) {
|
||||
PRINTM(MERROR,
|
||||
"not enough space for TxPD: headroom=%d pkt_len=%d, required=%d\n",
|
||||
pmbuf->data_offset, pmbuf->data_len,
|
||||
sizeof(TxPD) + pmpriv->intf_hr_len + DMA_ALIGNMENT);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* head_ptr should be aligned */
|
||||
head_ptr = pmbuf->pbuf + pmbuf->data_offset - sizeof(TxPD) -
|
||||
pmpriv->intf_hr_len;
|
||||
head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1)));
|
||||
|
||||
plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len);
|
||||
memset(pmadapter, plocal_tx_pd, 0, sizeof(TxPD));
|
||||
/* Set the BSS number to TxPD */
|
||||
plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);
|
||||
plocal_tx_pd->bss_type = pmpriv->bss_type;
|
||||
plocal_tx_pd->tx_pkt_length = (t_u16)pmbuf->data_len;
|
||||
|
||||
plocal_tx_pd->priority = (t_u8)pmbuf->priority;
|
||||
plocal_tx_pd->pkt_delay_2ms =
|
||||
wlan_wmm_compute_driver_packet_delay(pmpriv, pmbuf);
|
||||
|
||||
if (plocal_tx_pd->priority <
|
||||
NELEMENTS(pmpriv->wmm.user_pri_pkt_tx_ctrl))
|
||||
/*
|
||||
* Set the priority specific tx_control field, setting of 0 will
|
||||
* cause the default value to be used later in this function
|
||||
*/
|
||||
plocal_tx_pd->tx_control =
|
||||
pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd->priority];
|
||||
if (pmadapter->pps_uapsd_mode) {
|
||||
if (MTRUE == wlan_check_last_packet_indication(pmpriv)) {
|
||||
pmadapter->tx_lock_flag = MTRUE;
|
||||
plocal_tx_pd->flags =
|
||||
MRVDRV_TxPD_POWER_MGMT_LAST_PACKET;
|
||||
}
|
||||
}
|
||||
/* Offset of actual data */
|
||||
plocal_tx_pd->tx_pkt_offset = (t_u16)(
|
||||
(t_ptr)pmbuf->pbuf + pmbuf->data_offset - (t_ptr)plocal_tx_pd);
|
||||
|
||||
if (!plocal_tx_pd->tx_control) {
|
||||
/* TxCtrl set by user or default */
|
||||
plocal_tx_pd->tx_control = pmpriv->pkt_tx_ctrl;
|
||||
}
|
||||
|
||||
if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
|
||||
plocal_tx_pd->tx_pkt_type = (t_u16)pkt_type;
|
||||
plocal_tx_pd->tx_control = tx_control;
|
||||
}
|
||||
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_TX_STATUS) {
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->tx_seq_num << 8;
|
||||
plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TX_PACKET_STATUS;
|
||||
}
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_TX_CTRL) {
|
||||
if (pmbuf->u.tx_info.data_rate) {
|
||||
plocal_tx_pd->tx_control |=
|
||||
(wlan_ieee_rateid_to_mrvl_rateid(
|
||||
pmpriv, pmbuf->u.tx_info.data_rate,
|
||||
MNULL)
|
||||
<< 16);
|
||||
plocal_tx_pd->tx_control |= TXPD_TXRATE_ENABLE;
|
||||
}
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->u.tx_info.channel << 21;
|
||||
if (pmbuf->u.tx_info.bw) {
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->u.tx_info.bw << 16;
|
||||
plocal_tx_pd->tx_control_1 |= TXPD_BW_ENABLE;
|
||||
}
|
||||
if (pmbuf->u.tx_info.tx_power.tp.hostctl)
|
||||
plocal_tx_pd->tx_control |=
|
||||
(t_u32)pmbuf->u.tx_info.tx_power.val;
|
||||
if (pmbuf->u.tx_info.retry_limit) {
|
||||
plocal_tx_pd->tx_control |= pmbuf->u.tx_info.retry_limit
|
||||
<< 8;
|
||||
plocal_tx_pd->tx_control |= TXPD_RETRY_ENABLE;
|
||||
}
|
||||
}
|
||||
endian_convert_TxPD(plocal_tx_pd);
|
||||
|
||||
/* Adjust the data offset and length to include TxPD in pmbuf */
|
||||
pmbuf->data_len += pmbuf->data_offset;
|
||||
pmbuf->data_offset = (t_u32)(head_ptr - pmbuf->pbuf);
|
||||
pmbuf->data_len -= pmbuf->data_offset;
|
||||
|
||||
done:
|
||||
LEAVE();
|
||||
return head_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function tells firmware to send a NULL data packet.
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param flags Transmit Pkt Flags
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise
|
||||
* failure
|
||||
*/
|
||||
mlan_status wlan_send_null_packet(pmlan_private priv, t_u8 flags)
|
||||
{
|
||||
pmlan_adapter pmadapter = MNULL;
|
||||
TxPD *ptx_pd;
|
||||
/* sizeof(TxPD) + Interface specific header */
|
||||
#define NULL_PACKET_HDR 256
|
||||
t_u32 data_len = NULL_PACKET_HDR;
|
||||
pmlan_buffer pmbuf = MNULL;
|
||||
t_u8 *ptr;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
#ifdef DEBUG_LEVEL1
|
||||
t_u32 sec = 0, usec = 0;
|
||||
#endif
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!priv) {
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
pmadapter = priv->adapter;
|
||||
|
||||
if (pmadapter->surprise_removed == MTRUE) {
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (priv->media_connected == MFALSE) {
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (pmadapter->data_sent == MTRUE) {
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
pmbuf = wlan_alloc_mlan_buffer(pmadapter, data_len, 0,
|
||||
MOAL_MALLOC_BUFFER);
|
||||
if (!pmbuf) {
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
memset(pmadapter, pmbuf->pbuf, 0, data_len);
|
||||
pmbuf->bss_index = priv->bss_index;
|
||||
pmbuf->buf_type = MLAN_BUF_TYPE_DATA;
|
||||
pmbuf->flags |= MLAN_BUF_FLAG_NULL_PKT;
|
||||
ptr = pmbuf->pbuf + pmbuf->data_offset;
|
||||
pmbuf->data_len = sizeof(TxPD) + priv->intf_hr_len;
|
||||
ptx_pd = (TxPD *)(ptr + priv->intf_hr_len);
|
||||
ptx_pd->tx_control = priv->pkt_tx_ctrl;
|
||||
ptx_pd->flags = flags;
|
||||
ptx_pd->priority = WMM_HIGHEST_PRIORITY;
|
||||
ptx_pd->tx_pkt_offset = sizeof(TxPD);
|
||||
/* Set the BSS number to TxPD */
|
||||
ptx_pd->bss_num = GET_BSS_NUM(priv);
|
||||
ptx_pd->bss_type = priv->bss_type;
|
||||
|
||||
endian_convert_TxPD(ptx_pd);
|
||||
|
||||
ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA, pmbuf, MNULL);
|
||||
|
||||
switch (ret) {
|
||||
#ifdef USB
|
||||
case MLAN_STATUS_PRESOURCE:
|
||||
PRINTM(MINFO, "MLAN_STATUS_PRESOURCE is returned\n");
|
||||
break;
|
||||
#endif
|
||||
case MLAN_STATUS_RESOURCE:
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
PRINTM(MERROR, "STA Tx Error: Failed to send NULL packet!\n");
|
||||
pmadapter->dbg.num_tx_host_to_card_failure++;
|
||||
goto done;
|
||||
case MLAN_STATUS_FAILURE:
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
PRINTM(MERROR, "STA Tx Error: Failed to send NULL packet!\n");
|
||||
pmadapter->dbg.num_tx_host_to_card_failure++;
|
||||
goto done;
|
||||
case MLAN_STATUS_SUCCESS:
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
PRINTM(MINFO, "STA Tx: Successfully send the NULL packet\n");
|
||||
pmadapter->tx_lock_flag = MTRUE;
|
||||
break;
|
||||
case MLAN_STATUS_PENDING:
|
||||
pmadapter->tx_lock_flag = MTRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Null data => FW\n", sec, usec);
|
||||
DBG_HEXDUMP(MDAT_D, "Null data", ptr, sizeof(TxPD) + priv->intf_hr_len);
|
||||
done:
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks if we need to send last packet indication.
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
*
|
||||
* @return MTRUE or MFALSE
|
||||
*/
|
||||
t_u8 wlan_check_last_packet_indication(pmlan_private priv)
|
||||
{
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
t_u8 ret = MFALSE;
|
||||
t_u8 prop_ps = MTRUE;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!pmadapter->sleep_period.period) {
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
if (wlan_bypass_tx_list_empty(pmadapter) &&
|
||||
wlan_wmm_lists_empty(pmadapter)) {
|
||||
if (((priv->curr_bss_params.wmm_uapsd_enabled == MTRUE) &&
|
||||
priv->wmm_qosinfo) ||
|
||||
prop_ps)
|
||||
|
||||
ret = MTRUE;
|
||||
}
|
||||
if (ret && !pmadapter->cmd_sent && !pmadapter->curr_cmd &&
|
||||
!wlan_is_cmd_pending(pmadapter)) {
|
||||
pmadapter->delay_null_pkt = MFALSE;
|
||||
ret = MTRUE;
|
||||
} else {
|
||||
ret = MFALSE;
|
||||
pmadapter->delay_null_pkt = MTRUE;
|
||||
}
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
424
mxm_wifiex/wlan_src/mlan/mlan_txrx.c
Normal file
424
mxm_wifiex/wlan_src/mlan/mlan_txrx.c
Normal file
|
@ -0,0 +1,424 @@
|
|||
/**
|
||||
* @file mlan_txrx.c
|
||||
*
|
||||
* @brief This file contains the handling of TX/RX in MLAN
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************
|
||||
Change Log:
|
||||
05/11/2009: initial version
|
||||
************************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#ifdef STA_SUPPORT
|
||||
#include "mlan_join.h"
|
||||
#endif
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_wmm.h"
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
/**
|
||||
* @brief This function processes the received buffer
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter
|
||||
* @param pmbuf A pointer to the received buffer
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
pmlan_private priv = MNULL;
|
||||
RxPD *prx_pd;
|
||||
#ifdef DEBUG_LEVEL1
|
||||
t_u32 sec = 0, usec = 0;
|
||||
#endif
|
||||
|
||||
ENTER();
|
||||
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
/* Get the BSS number from RxPD, get corresponding priv */
|
||||
priv = wlan_get_priv_by_id(pmadapter, prx_pd->bss_num & BSS_NUM_MASK,
|
||||
prx_pd->bss_type);
|
||||
if (!priv)
|
||||
priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
|
||||
if (!priv) {
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
pmbuf->bss_index = priv->bss_index;
|
||||
PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data <= FW\n", sec, usec);
|
||||
ret = priv->ops.process_rx_packet(pmadapter, pmbuf);
|
||||
|
||||
done:
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function checks the conditions and sends packet to device
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param pmbuf A pointer to the mlan_buffer for process
|
||||
* @param tx_param A pointer to mlan_tx_param structure
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise
|
||||
* failure
|
||||
*/
|
||||
mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf,
|
||||
mlan_tx_param *tx_param)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
t_u8 *head_ptr = MNULL;
|
||||
#ifdef DEBUG_LEVEL1
|
||||
t_u32 sec = 0, usec = 0;
|
||||
#endif
|
||||
#ifdef STA_SUPPORT
|
||||
PTxPD plocal_tx_pd = MNULL;
|
||||
#endif
|
||||
|
||||
ENTER();
|
||||
head_ptr = (t_u8 *)priv->ops.process_txpd(priv, pmbuf);
|
||||
if (!head_ptr) {
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
#ifdef STA_SUPPORT
|
||||
if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA)
|
||||
plocal_tx_pd = (TxPD *)(head_ptr + priv->intf_hr_len);
|
||||
#endif
|
||||
if (pmadapter->tp_state_on)
|
||||
pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle,
|
||||
pmbuf, 4);
|
||||
if (pmadapter->tp_state_drop_point == 4)
|
||||
goto done;
|
||||
else {
|
||||
ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA, pmbuf,
|
||||
tx_param);
|
||||
}
|
||||
done:
|
||||
switch (ret) {
|
||||
#ifdef USB
|
||||
case MLAN_STATUS_PRESOURCE:
|
||||
PRINTM(MINFO, "MLAN_STATUS_PRESOURCE is returned\n");
|
||||
DBG_HEXDUMP(MDAT_D, "Tx", head_ptr + priv->intf_hr_len,
|
||||
MIN(pmbuf->data_len + sizeof(TxPD),
|
||||
MAX_DATA_DUMP_LEN));
|
||||
break;
|
||||
#endif
|
||||
case MLAN_STATUS_RESOURCE:
|
||||
#ifdef STA_SUPPORT
|
||||
if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
|
||||
pmadapter->pps_uapsd_mode &&
|
||||
(pmadapter->tx_lock_flag == MTRUE)) {
|
||||
pmadapter->tx_lock_flag = MFALSE;
|
||||
if (plocal_tx_pd != MNULL)
|
||||
plocal_tx_pd->flags = 0;
|
||||
}
|
||||
#endif
|
||||
PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n");
|
||||
break;
|
||||
case MLAN_STATUS_FAILURE:
|
||||
pmadapter->dbg.num_tx_host_to_card_failure++;
|
||||
pmbuf->status_code = MLAN_ERROR_DATA_TX_FAIL;
|
||||
wlan_write_data_complete(pmadapter, pmbuf, ret);
|
||||
break;
|
||||
case MLAN_STATUS_PENDING:
|
||||
DBG_HEXDUMP(MDAT_D, "Tx", head_ptr + priv->intf_hr_len,
|
||||
MIN(pmbuf->data_len + sizeof(TxPD),
|
||||
MAX_DATA_DUMP_LEN));
|
||||
break;
|
||||
case MLAN_STATUS_SUCCESS:
|
||||
DBG_HEXDUMP(MDAT_D, "Tx", head_ptr + priv->intf_hr_len,
|
||||
MIN(pmbuf->data_len + sizeof(TxPD),
|
||||
MAX_DATA_DUMP_LEN));
|
||||
wlan_write_data_complete(pmadapter, pmbuf, ret);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ret == MLAN_STATUS_SUCCESS) || (ret == MLAN_STATUS_PENDING)) {
|
||||
PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data => FW\n", sec, usec);
|
||||
}
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Packet send completion handling
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pmbuf A pointer to mlan_buffer structure
|
||||
* @param status Callback status
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_write_data_complete(pmlan_adapter pmadapter,
|
||||
pmlan_buffer pmbuf, mlan_status status)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
pmlan_callbacks pcb;
|
||||
|
||||
ENTER();
|
||||
|
||||
MASSERT(pmadapter && pmbuf);
|
||||
if (!pmadapter || !pmbuf) {
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
pcb = &pmadapter->callbacks;
|
||||
|
||||
if ((pmbuf->buf_type == MLAN_BUF_TYPE_DATA) ||
|
||||
(pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA)) {
|
||||
PRINTM(MINFO, "wlan_write_data_complete: DATA %p\n", pmbuf);
|
||||
#if defined(USB)
|
||||
if ((pmbuf->flags & MLAN_BUF_FLAG_USB_TX_AGGR) &&
|
||||
pmbuf->use_count) {
|
||||
pmlan_buffer pmbuf_next;
|
||||
t_u32 i, use_count = pmbuf->use_count;
|
||||
for (i = 0; i <= use_count; i++) {
|
||||
pmbuf_next = pmbuf->pnext;
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_MOAL_TX_BUF)
|
||||
pcb->moal_send_packet_complete(
|
||||
pmadapter->pmoal_handle, pmbuf,
|
||||
status);
|
||||
else
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
pmbuf = pmbuf_next;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_MOAL_TX_BUF) {
|
||||
/* pmbuf was allocated by MOAL */
|
||||
pcb->moal_send_packet_complete(
|
||||
pmadapter->pmoal_handle, pmbuf, status);
|
||||
} else {
|
||||
/* pmbuf was allocated by MLAN */
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
}
|
||||
#if defined(USB)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Packet receive completion callback handler
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param pmbuf A pointer to mlan_buffer structure
|
||||
* @param status Callback status
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS
|
||||
*/
|
||||
mlan_status wlan_recv_packet_complete(pmlan_adapter pmadapter,
|
||||
pmlan_buffer pmbuf, mlan_status status)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
pmlan_callbacks pcb;
|
||||
|
||||
ENTER();
|
||||
|
||||
MASSERT(pmadapter && pmbuf);
|
||||
if (!pmadapter || !pmbuf) {
|
||||
LEAVE();
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
pcb = &pmadapter->callbacks;
|
||||
MASSERT(pmbuf->bss_index < pmadapter->priv_num);
|
||||
|
||||
if (pmbuf->pparent) {
|
||||
/** we will free the pparaent at the end of deaggr */
|
||||
wlan_free_mlan_buffer(pmadapter, pmbuf);
|
||||
} else {
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, status);
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add packet to Bypass TX queue
|
||||
*
|
||||
* @param pmadapter Pointer to the mlan_adapter driver data struct
|
||||
* @param pmbuf Pointer to the mlan_buffer data struct
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
t_void wlan_add_buf_bypass_txqueue(mlan_adapter *pmadapter, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_private priv = pmadapter->priv[pmbuf->bss_index];
|
||||
ENTER();
|
||||
|
||||
if (pmbuf->buf_type != MLAN_BUF_TYPE_RAW_DATA)
|
||||
pmbuf->buf_type = MLAN_BUF_TYPE_DATA;
|
||||
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
pmadapter->bypass_pkt_count++;
|
||||
util_enqueue_list_tail(pmadapter->pmoal_handle, &priv->bypass_txq,
|
||||
(pmlan_linked_list)pmbuf, MNULL, MNULL);
|
||||
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if packets are available in Bypass TX queue
|
||||
*
|
||||
* @param pmadapter Pointer to the mlan_adapter driver data struct
|
||||
*
|
||||
* @return MFALSE if not empty; MTRUE if empty
|
||||
*/
|
||||
INLINE t_u8 wlan_bypass_tx_list_empty(mlan_adapter *pmadapter)
|
||||
{
|
||||
return (pmadapter->bypass_pkt_count) ? MFALSE : MTRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clean up the By-pass TX queue
|
||||
*
|
||||
* @param priv Pointer to the mlan_private data struct
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
t_void wlan_cleanup_bypass_txq(mlan_private *priv)
|
||||
{
|
||||
pmlan_buffer pmbuf;
|
||||
mlan_adapter *pmadapter = priv->adapter;
|
||||
ENTER();
|
||||
pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
while ((pmbuf = (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle,
|
||||
&priv->bypass_txq, MNULL,
|
||||
MNULL))) {
|
||||
util_unlink_list(pmadapter->pmoal_handle, &priv->bypass_txq,
|
||||
(pmlan_linked_list)pmbuf, MNULL, MNULL);
|
||||
wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE);
|
||||
pmadapter->bypass_pkt_count--;
|
||||
}
|
||||
pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transmit the By-passed packet awaiting in by-pass queue
|
||||
*
|
||||
* @param pmadapter Pointer to the mlan_adapter driver data struct
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
t_void wlan_process_bypass_tx(pmlan_adapter pmadapter)
|
||||
{
|
||||
pmlan_buffer pmbuf;
|
||||
mlan_tx_param tx_param;
|
||||
mlan_status status = MLAN_STATUS_SUCCESS;
|
||||
pmlan_private priv;
|
||||
int j = 0;
|
||||
ENTER();
|
||||
do {
|
||||
for (j = 0; j < pmadapter->priv_num; ++j) {
|
||||
priv = pmadapter->priv[j];
|
||||
if (priv) {
|
||||
pmbuf = (pmlan_buffer)util_dequeue_list(
|
||||
pmadapter->pmoal_handle,
|
||||
&priv->bypass_txq,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock);
|
||||
if (pmbuf) {
|
||||
pmadapter->callbacks.moal_spin_lock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
pmadapter->bypass_pkt_count--;
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
PRINTM(MINFO,
|
||||
"Dequeuing bypassed packet %p\n",
|
||||
pmbuf);
|
||||
if (wlan_bypass_tx_list_empty(
|
||||
pmadapter))
|
||||
tx_param.next_pkt_len = 0;
|
||||
else
|
||||
tx_param.next_pkt_len =
|
||||
pmbuf->data_len;
|
||||
status = wlan_process_tx(
|
||||
pmadapter->priv[pmbuf->bss_index],
|
||||
pmbuf, &tx_param);
|
||||
|
||||
if (status == MLAN_STATUS_RESOURCE) {
|
||||
/* Queue the packet again so
|
||||
* that it will be TX'ed later
|
||||
*/
|
||||
pmadapter->callbacks.moal_spin_lock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
pmadapter->bypass_pkt_count++;
|
||||
util_enqueue_list_head(
|
||||
pmadapter->pmoal_handle,
|
||||
&priv->bypass_txq,
|
||||
(pmlan_linked_list)pmbuf,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock);
|
||||
pmadapter->callbacks.moal_spin_unlock(
|
||||
pmadapter->pmoal_handle,
|
||||
priv->bypass_txq.plock);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
PRINTM(MINFO, "Nothing to send\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!pmadapter->data_sent && !pmadapter->tx_lock_flag &&
|
||||
!wlan_bypass_tx_list_empty(pmadapter));
|
||||
LEAVE();
|
||||
}
|
57
mxm_wifiex/wlan_src/mlan/mlan_uap.h
Normal file
57
mxm_wifiex/wlan_src/mlan/mlan_uap.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/** @file mlan_uap.h
|
||||
*
|
||||
* @brief This file contains related macros, enum, and struct
|
||||
* of uap functionalities
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
02/05/2009: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MLAN_UAP_H_
|
||||
#define _MLAN_UAP_H_
|
||||
|
||||
mlan_status wlan_uap_get_channel(pmlan_private pmpriv);
|
||||
|
||||
mlan_status wlan_uap_set_channel(pmlan_private pmpriv,
|
||||
Band_Config_t uap_band_cfg, t_u8 channel);
|
||||
|
||||
mlan_status wlan_uap_get_beacon_dtim(pmlan_private pmpriv);
|
||||
|
||||
mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req);
|
||||
|
||||
mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no,
|
||||
t_u16 cmd_action, t_u32 cmd_oid,
|
||||
t_void *pioctl_buf, t_void *pdata_buf,
|
||||
t_void *pcmd_buf);
|
||||
|
||||
mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no,
|
||||
t_void *pcmd_buf, t_void *pioctl);
|
||||
|
||||
mlan_status wlan_ops_uap_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf);
|
||||
|
||||
mlan_status wlan_ops_uap_process_event(t_void *priv);
|
||||
|
||||
t_void *wlan_ops_uap_process_txpd(t_void *priv, pmlan_buffer pmbuf);
|
||||
|
||||
mlan_status wlan_ops_uap_init_cmd(t_void *priv, t_u8 first_bss);
|
||||
|
||||
#endif /* _MLAN_UAP_H_ */
|
5587
mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c
Normal file
5587
mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c
Normal file
File diff suppressed because it is too large
Load diff
2240
mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c
Normal file
2240
mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
820
mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c
Normal file
820
mxm_wifiex/wlan_src/mlan/mlan_uap_txrx.c
Normal file
|
@ -0,0 +1,820 @@
|
|||
/** @file mlan_uap_txrx.c
|
||||
*
|
||||
* @brief This file contains AP mode transmit and receive functions
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
02/05/2009: initial version
|
||||
********************************************************/
|
||||
|
||||
#include "mlan.h"
|
||||
#include "mlan_util.h"
|
||||
#include "mlan_fw.h"
|
||||
#ifdef STA_SUPPORT
|
||||
#include "mlan_join.h"
|
||||
#endif
|
||||
#include "mlan_main.h"
|
||||
#include "mlan_uap.h"
|
||||
#include "mlan_wmm.h"
|
||||
#include "mlan_11n_aggr.h"
|
||||
#include "mlan_11n_rxreorder.h"
|
||||
#ifdef DRV_EMBEDDED_AUTHENTICATOR
|
||||
#include "authenticator_api.h"
|
||||
#endif
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter
|
||||
* @param pmbuf A pointer to mlan_buffer which includes the received packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
static mlan_status wlan_upload_uap_rx_packet(pmlan_adapter pmadapter,
|
||||
pmlan_buffer pmbuf)
|
||||
{
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
#ifdef DEBUG_LEVEL1
|
||||
pmlan_private priv = pmadapter->priv[pmbuf->bss_index];
|
||||
#endif
|
||||
PRxPD prx_pd;
|
||||
ENTER();
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
|
||||
/* Chop off RxPD */
|
||||
pmbuf->data_len -= prx_pd->rx_pkt_offset;
|
||||
pmbuf->data_offset += prx_pd->rx_pkt_offset;
|
||||
pmbuf->pparent = MNULL;
|
||||
|
||||
DBG_HEXDUMP(MDAT_D, "uAP RxPD", (t_u8 *)prx_pd,
|
||||
MIN(sizeof(RxPD), MAX_DATA_DUMP_LEN));
|
||||
DBG_HEXDUMP(MDAT_D, "uAP Rx Payload",
|
||||
((t_u8 *)prx_pd + prx_pd->rx_pkt_offset),
|
||||
MIN(prx_pd->rx_pkt_length, MAX_DATA_DUMP_LEN));
|
||||
|
||||
pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle,
|
||||
&pmbuf->out_ts_sec,
|
||||
&pmbuf->out_ts_usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data => kernel seq_num=%d tid=%d\n",
|
||||
pmbuf->out_ts_sec, pmbuf->out_ts_usec, prx_pd->seq_num,
|
||||
prx_pd->priority);
|
||||
ret = pmadapter->callbacks.moal_recv_packet(pmadapter->pmoal_handle,
|
||||
pmbuf);
|
||||
if (ret == MLAN_STATUS_FAILURE) {
|
||||
PRINTM(MERROR,
|
||||
"uAP Rx Error: moal_recv_packet returned error\n");
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
}
|
||||
|
||||
if (ret != MLAN_STATUS_PENDING)
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
#ifdef USB
|
||||
else if (IS_USB(pmadapter->card_type))
|
||||
pmadapter->callbacks.moal_recv_complete(pmadapter->pmoal_handle,
|
||||
MNULL,
|
||||
pmadapter->rx_data_ep,
|
||||
ret);
|
||||
#endif
|
||||
LEAVE();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function will check if unicast packet need be dropped
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param mac mac address to find in station list table
|
||||
*
|
||||
* @return MLAN_STATUS_FAILURE -- drop packet, otherwise forward to
|
||||
* network stack
|
||||
*/
|
||||
static mlan_status wlan_check_unicast_packet(mlan_private *priv, t_u8 *mac)
|
||||
{
|
||||
int j;
|
||||
sta_node *sta_ptr = MNULL;
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
pmlan_private pmpriv = MNULL;
|
||||
t_u8 pkt_type = 0;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
ENTER();
|
||||
for (j = 0; j < MLAN_MAX_BSS_NUM; ++j) {
|
||||
pmpriv = pmadapter->priv[j];
|
||||
if (pmpriv) {
|
||||
if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA)
|
||||
continue;
|
||||
sta_ptr = wlan_get_station_entry(pmpriv, mac);
|
||||
if (sta_ptr) {
|
||||
if (pmpriv == priv)
|
||||
pkt_type = PKT_INTRA_UCAST;
|
||||
else
|
||||
pkt_type = PKT_INTER_UCAST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((pkt_type == PKT_INTRA_UCAST) &&
|
||||
(priv->pkt_fwd & PKT_FWD_INTRA_UCAST)) {
|
||||
PRINTM(MDATA, "Drop INTRA_UCAST packet\n");
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
} else if ((pkt_type == PKT_INTER_UCAST) &&
|
||||
(priv->pkt_fwd & PKT_FWD_INTER_UCAST)) {
|
||||
PRINTM(MDATA, "Drop INTER_UCAST packet\n");
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
}
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
/**
|
||||
* @brief This function fill the txpd for tx packet
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
* @param pmbuf A pointer to the mlan_buffer for process
|
||||
*
|
||||
* @return headptr or MNULL
|
||||
*/
|
||||
t_void *wlan_ops_uap_process_txpd(t_void *priv, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_private pmpriv = (pmlan_private)priv;
|
||||
TxPD *plocal_tx_pd;
|
||||
t_u8 *head_ptr = MNULL;
|
||||
t_u32 pkt_type;
|
||||
t_u32 tx_control;
|
||||
t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH];
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!pmbuf->data_len) {
|
||||
PRINTM(MERROR, "uAP Tx Error: Invalid packet length: %d\n",
|
||||
pmbuf->data_len);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
|
||||
memcpy_ext(pmpriv->adapter, &pkt_type,
|
||||
pmbuf->pbuf + pmbuf->data_offset, sizeof(pkt_type),
|
||||
sizeof(pkt_type));
|
||||
memcpy_ext(pmpriv->adapter, &tx_control,
|
||||
pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type),
|
||||
sizeof(tx_control), sizeof(tx_control));
|
||||
pmbuf->data_offset += sizeof(pkt_type) + sizeof(tx_control);
|
||||
pmbuf->data_len -= sizeof(pkt_type) + sizeof(tx_control);
|
||||
}
|
||||
if (pmbuf->data_offset <
|
||||
(sizeof(TxPD) + pmpriv->intf_hr_len + DMA_ALIGNMENT)) {
|
||||
PRINTM(MERROR,
|
||||
"not enough space for TxPD: headroom=%d pkt_len=%d, required=%d\n",
|
||||
pmbuf->data_offset, pmbuf->data_len,
|
||||
sizeof(TxPD) + pmpriv->intf_hr_len + DMA_ALIGNMENT);
|
||||
DBG_HEXDUMP(MDAT_D, "drop pkt",
|
||||
pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* head_ptr should be aligned */
|
||||
head_ptr = pmbuf->pbuf + pmbuf->data_offset - sizeof(TxPD) -
|
||||
pmpriv->intf_hr_len;
|
||||
head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1)));
|
||||
|
||||
plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len);
|
||||
memset(pmpriv->adapter, plocal_tx_pd, 0, sizeof(TxPD));
|
||||
|
||||
/* Set the BSS number to TxPD */
|
||||
plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);
|
||||
plocal_tx_pd->bss_type = pmpriv->bss_type;
|
||||
|
||||
plocal_tx_pd->tx_pkt_length = (t_u16)pmbuf->data_len;
|
||||
|
||||
plocal_tx_pd->priority = (t_u8)pmbuf->priority;
|
||||
plocal_tx_pd->pkt_delay_2ms =
|
||||
wlan_wmm_compute_driver_packet_delay(pmpriv, pmbuf);
|
||||
|
||||
if (plocal_tx_pd->priority <
|
||||
NELEMENTS(pmpriv->wmm.user_pri_pkt_tx_ctrl))
|
||||
/*
|
||||
* Set the priority specific tx_control field, setting of 0 will
|
||||
* cause the default value to be used later in this function
|
||||
*/
|
||||
plocal_tx_pd->tx_control =
|
||||
pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd->priority];
|
||||
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_TX_STATUS) {
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->tx_seq_num << 8;
|
||||
plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TX_PACKET_STATUS;
|
||||
}
|
||||
|
||||
/* Offset of actual data */
|
||||
plocal_tx_pd->tx_pkt_offset = (t_u16)(
|
||||
(t_ptr)pmbuf->pbuf + pmbuf->data_offset - (t_ptr)plocal_tx_pd);
|
||||
|
||||
if (!plocal_tx_pd->tx_control) {
|
||||
/* TxCtrl set by user or default */
|
||||
plocal_tx_pd->tx_control = pmpriv->pkt_tx_ctrl;
|
||||
}
|
||||
|
||||
if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
|
||||
plocal_tx_pd->tx_pkt_type = (t_u16)pkt_type;
|
||||
plocal_tx_pd->tx_control = tx_control;
|
||||
}
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_TX_CTRL) {
|
||||
if (pmbuf->u.tx_info.data_rate) {
|
||||
memcpy_ext(pmpriv->adapter, dst_mac,
|
||||
pmbuf->pbuf + pmbuf->data_offset,
|
||||
sizeof(dst_mac), sizeof(dst_mac));
|
||||
plocal_tx_pd->tx_control |=
|
||||
(wlan_ieee_rateid_to_mrvl_rateid(
|
||||
pmpriv, pmbuf->u.tx_info.data_rate,
|
||||
dst_mac)
|
||||
<< 16);
|
||||
plocal_tx_pd->tx_control |= TXPD_TXRATE_ENABLE;
|
||||
}
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->u.tx_info.channel << 21;
|
||||
if (pmbuf->u.tx_info.bw) {
|
||||
plocal_tx_pd->tx_control_1 |= pmbuf->u.tx_info.bw << 16;
|
||||
plocal_tx_pd->tx_control_1 |= TXPD_BW_ENABLE;
|
||||
}
|
||||
if (pmbuf->u.tx_info.tx_power.tp.hostctl)
|
||||
plocal_tx_pd->tx_control |=
|
||||
(t_u32)pmbuf->u.tx_info.tx_power.val;
|
||||
if (pmbuf->u.tx_info.retry_limit) {
|
||||
plocal_tx_pd->tx_control |= pmbuf->u.tx_info.retry_limit
|
||||
<< 8;
|
||||
plocal_tx_pd->tx_control |= TXPD_RETRY_ENABLE;
|
||||
}
|
||||
}
|
||||
|
||||
endian_convert_TxPD(plocal_tx_pd);
|
||||
|
||||
/* Adjust the data offset and length to include TxPD in pmbuf */
|
||||
pmbuf->data_len += pmbuf->data_offset;
|
||||
pmbuf->data_offset = (t_u32)((t_ptr)head_ptr - (t_ptr)pmbuf->pbuf);
|
||||
pmbuf->data_len -= pmbuf->data_offset;
|
||||
|
||||
done:
|
||||
LEAVE();
|
||||
return head_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer
|
||||
*
|
||||
* @param adapter A pointer to mlan_adapter
|
||||
* @param pmbuf A pointer to mlan_buffer which includes the received packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_ops_uap_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_adapter pmadapter = (pmlan_adapter)adapter;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
RxPD *prx_pd;
|
||||
wlan_mgmt_pkt *puap_pkt_hdr = MNULL;
|
||||
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
pmlan_private priv = pmadapter->priv[pmbuf->bss_index];
|
||||
t_u8 ta[MLAN_MAC_ADDR_LENGTH];
|
||||
t_u16 rx_pkt_type = 0;
|
||||
sta_node *sta_ptr = MNULL;
|
||||
#ifdef DRV_EMBEDDED_AUTHENTICATOR
|
||||
t_u8 eapol_type[2] = {0x88, 0x8e};
|
||||
#endif
|
||||
t_u16 adj_rx_rate = 0;
|
||||
t_u8 antenna = 0;
|
||||
|
||||
t_u32 last_rx_sec = 0;
|
||||
t_u32 last_rx_usec = 0;
|
||||
t_u8 ext_rate_info = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
/* Endian conversion */
|
||||
endian_convert_RxPD(prx_pd);
|
||||
|
||||
if (priv->rx_pkt_info) {
|
||||
ext_rate_info = (t_u8)(prx_pd->rx_info >> 16);
|
||||
pmbuf->u.rx_info.data_rate =
|
||||
wlan_index_to_data_rate(priv->adapter, prx_pd->rx_rate,
|
||||
prx_pd->rate_info,
|
||||
ext_rate_info);
|
||||
pmbuf->u.rx_info.channel =
|
||||
(prx_pd->rx_info & RXPD_CHAN_MASK) >> 5;
|
||||
pmbuf->u.rx_info.antenna = prx_pd->antenna;
|
||||
pmbuf->u.rx_info.rssi = prx_pd->snr - prx_pd->nf;
|
||||
}
|
||||
|
||||
rx_pkt_type = prx_pd->rx_pkt_type;
|
||||
prx_pkt = (RxPacketHdr_t *)((t_u8 *)prx_pd + prx_pd->rx_pkt_offset);
|
||||
|
||||
PRINTM(MINFO,
|
||||
"RX Data: data_len - prx_pd->rx_pkt_offset = %d - %d = %d\n",
|
||||
pmbuf->data_len, prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len - prx_pd->rx_pkt_offset);
|
||||
|
||||
if ((prx_pd->rx_pkt_offset + prx_pd->rx_pkt_length) !=
|
||||
(t_u16)pmbuf->data_len) {
|
||||
PRINTM(MERROR,
|
||||
"Wrong rx packet: len=%d,rx_pkt_offset=%d,"
|
||||
" rx_pkt_length=%d\n",
|
||||
pmbuf->data_len, prx_pd->rx_pkt_offset,
|
||||
prx_pd->rx_pkt_length);
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
|
||||
ret = MLAN_STATUS_FAILURE;
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
pmbuf->data_len = prx_pd->rx_pkt_offset + prx_pd->rx_pkt_length;
|
||||
|
||||
if (pmadapter->priv[pmbuf->bss_index]->mgmt_frame_passthru_mask &&
|
||||
prx_pd->rx_pkt_type == PKT_TYPE_MGMT_FRAME) {
|
||||
/* Check if this is mgmt packet and needs to
|
||||
* forwarded to app as an event
|
||||
*/
|
||||
puap_pkt_hdr = (wlan_mgmt_pkt *)((t_u8 *)prx_pd +
|
||||
prx_pd->rx_pkt_offset);
|
||||
puap_pkt_hdr->frm_len = wlan_le16_to_cpu(puap_pkt_hdr->frm_len);
|
||||
if ((puap_pkt_hdr->wlan_header.frm_ctl &
|
||||
IEEE80211_FC_MGMT_FRAME_TYPE_MASK) == 0)
|
||||
wlan_process_802dot11_mgmt_pkt(
|
||||
pmadapter->priv[pmbuf->bss_index],
|
||||
(t_u8 *)&puap_pkt_hdr->wlan_header,
|
||||
puap_pkt_hdr->frm_len + sizeof(wlan_mgmt_pkt) -
|
||||
sizeof(puap_pkt_hdr->frm_len),
|
||||
(RxPD *)prx_pd);
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
if (rx_pkt_type != PKT_TYPE_BAR) {
|
||||
priv->rxpd_rate = prx_pd->rx_rate;
|
||||
priv->rxpd_rate_info = prx_pd->rate_info;
|
||||
priv->rxpd_rx_info = (t_u8)(prx_pd->rx_info >> 16);
|
||||
|
||||
if (priv->bss_type == MLAN_BSS_TYPE_UAP) {
|
||||
antenna = wlan_adjust_antenna(priv, (RxPD *)prx_pd);
|
||||
adj_rx_rate = wlan_adjust_data_rate(
|
||||
priv, priv->rxpd_rate, priv->rxpd_rate_info);
|
||||
pmadapter->callbacks.moal_hist_data_add(
|
||||
pmadapter->pmoal_handle, pmbuf->bss_index,
|
||||
adj_rx_rate, prx_pd->snr, prx_pd->nf, antenna);
|
||||
}
|
||||
}
|
||||
|
||||
sta_ptr = wlan_get_station_entry(priv, prx_pkt->eth803_hdr.src_addr);
|
||||
if (sta_ptr) {
|
||||
sta_ptr->snr = prx_pd->snr;
|
||||
sta_ptr->nf = prx_pd->nf;
|
||||
pmadapter->callbacks.moal_get_system_time(
|
||||
pmadapter->pmoal_handle, &last_rx_sec, &last_rx_usec);
|
||||
sta_ptr->stats.last_rx_in_msec =
|
||||
(t_u64)last_rx_sec * 1000 + (t_u64)last_rx_usec / 1000;
|
||||
}
|
||||
|
||||
#ifdef DRV_EMBEDDED_AUTHENTICATOR
|
||||
/**process eapol packet for uap*/
|
||||
if (IsAuthenticatorEnabled(priv->psapriv) &&
|
||||
(!memcmp(pmadapter, &prx_pkt->eth803_hdr.h803_len, eapol_type,
|
||||
sizeof(eapol_type)))) {
|
||||
ret = AuthenticatorProcessEapolPacket(
|
||||
priv->psapriv, ((t_u8 *)prx_pd + prx_pd->rx_pkt_offset),
|
||||
prx_pd->rx_pkt_length);
|
||||
if (ret == MLAN_STATUS_SUCCESS) {
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pmbuf->priority = prx_pd->priority;
|
||||
memcpy_ext(pmadapter, ta, prx_pkt->eth803_hdr.src_addr,
|
||||
MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH);
|
||||
if ((rx_pkt_type != PKT_TYPE_BAR) && (prx_pd->priority < MAX_NUM_TID)) {
|
||||
sta_ptr = wlan_get_station_entry(priv, ta);
|
||||
if (sta_ptr) {
|
||||
sta_ptr->rx_seq[prx_pd->priority] = prx_pd->seq_num;
|
||||
sta_ptr->snr = prx_pd->snr;
|
||||
sta_ptr->nf = prx_pd->nf;
|
||||
}
|
||||
}
|
||||
/* check if UAP enable 11n */
|
||||
if (!priv->is_11n_enabled ||
|
||||
(!wlan_11n_get_rxreorder_tbl((mlan_private *)priv, prx_pd->priority,
|
||||
ta) &&
|
||||
(prx_pd->rx_pkt_type != PKT_TYPE_AMSDU))) {
|
||||
if (priv->pkt_fwd)
|
||||
wlan_process_uap_rx_packet(priv, pmbuf);
|
||||
else
|
||||
wlan_upload_uap_rx_packet(pmadapter, pmbuf);
|
||||
goto done;
|
||||
}
|
||||
/* Reorder and send to OS */
|
||||
ret = mlan_11n_rxreorder_pkt(priv, prx_pd->seq_num, prx_pd->priority,
|
||||
ta, (t_u8)prx_pd->rx_pkt_type,
|
||||
(void *)pmbuf);
|
||||
if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
}
|
||||
done:
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer or send back to firmware
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param pmbuf A pointer to mlan_buffer which includes the received packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_uap_recv_packet(mlan_private *priv, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
pmlan_buffer newbuf = MNULL;
|
||||
|
||||
ENTER();
|
||||
|
||||
prx_pkt = (RxPacketHdr_t *)((t_u8 *)pmbuf->pbuf + pmbuf->data_offset);
|
||||
|
||||
DBG_HEXDUMP(MDAT_D, "uap_recv_packet", pmbuf->pbuf + pmbuf->data_offset,
|
||||
MIN(pmbuf->data_len, MAX_DATA_DUMP_LEN));
|
||||
|
||||
PRINTM(MDATA, "AMSDU dest " MACSTR "\n",
|
||||
MAC2STR(prx_pkt->eth803_hdr.dest_addr));
|
||||
|
||||
/* don't do packet forwarding in disconnected state */
|
||||
if ((priv->media_connected == MFALSE) ||
|
||||
(pmbuf->data_len > MV_ETH_FRAME_LEN))
|
||||
goto upload;
|
||||
|
||||
if (prx_pkt->eth803_hdr.dest_addr[0] & 0x01) {
|
||||
if (!(priv->pkt_fwd & PKT_FWD_INTRA_BCAST)) {
|
||||
/* Multicast pkt */
|
||||
newbuf =
|
||||
wlan_alloc_mlan_buffer(pmadapter,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
0, MOAL_MALLOC_BUFFER);
|
||||
if (newbuf) {
|
||||
newbuf->bss_index = pmbuf->bss_index;
|
||||
newbuf->buf_type = pmbuf->buf_type;
|
||||
newbuf->priority = pmbuf->priority;
|
||||
newbuf->in_ts_sec = pmbuf->in_ts_sec;
|
||||
newbuf->in_ts_usec = pmbuf->in_ts_usec;
|
||||
newbuf->data_offset =
|
||||
(sizeof(TxPD) + priv->intf_hr_len +
|
||||
DMA_ALIGNMENT);
|
||||
util_scalar_increment(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock);
|
||||
|
||||
newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF;
|
||||
|
||||
/* copy the data */
|
||||
memcpy_ext(pmadapter,
|
||||
(t_u8 *)newbuf->pbuf +
|
||||
newbuf->data_offset,
|
||||
pmbuf->pbuf + pmbuf->data_offset,
|
||||
pmbuf->data_len,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K);
|
||||
newbuf->data_len = pmbuf->data_len;
|
||||
wlan_wmm_add_buf_txqueue(pmadapter, newbuf);
|
||||
if (util_scalar_read(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock) >
|
||||
RX_HIGH_THRESHOLD)
|
||||
wlan_drop_tx_pkts(priv);
|
||||
wlan_recv_event(
|
||||
priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((!(priv->pkt_fwd & PKT_FWD_INTRA_UCAST)) &&
|
||||
(wlan_get_station_entry(priv,
|
||||
prx_pkt->eth803_hdr.dest_addr))) {
|
||||
/* Intra BSS packet */
|
||||
newbuf =
|
||||
wlan_alloc_mlan_buffer(pmadapter,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
0, MOAL_MALLOC_BUFFER);
|
||||
if (newbuf) {
|
||||
newbuf->bss_index = pmbuf->bss_index;
|
||||
newbuf->buf_type = pmbuf->buf_type;
|
||||
newbuf->priority = pmbuf->priority;
|
||||
newbuf->in_ts_sec = pmbuf->in_ts_sec;
|
||||
newbuf->in_ts_usec = pmbuf->in_ts_usec;
|
||||
newbuf->data_offset =
|
||||
(sizeof(TxPD) + priv->intf_hr_len +
|
||||
DMA_ALIGNMENT);
|
||||
util_scalar_increment(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock);
|
||||
newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF;
|
||||
|
||||
/* copy the data */
|
||||
memcpy_ext(pmadapter,
|
||||
(t_u8 *)newbuf->pbuf +
|
||||
newbuf->data_offset,
|
||||
pmbuf->pbuf + pmbuf->data_offset,
|
||||
pmbuf->data_len,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K);
|
||||
newbuf->data_len = pmbuf->data_len;
|
||||
wlan_wmm_add_buf_txqueue(pmadapter, newbuf);
|
||||
if (util_scalar_read(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock) >
|
||||
RX_HIGH_THRESHOLD)
|
||||
wlan_drop_tx_pkts(priv);
|
||||
wlan_recv_event(
|
||||
priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
}
|
||||
goto done;
|
||||
} else if (MLAN_STATUS_FAILURE ==
|
||||
wlan_check_unicast_packet(
|
||||
priv, prx_pkt->eth803_hdr.dest_addr)) {
|
||||
/* drop packet */
|
||||
PRINTM(MDATA, "Drop AMSDU dest " MACSTR "\n",
|
||||
MAC2STR(prx_pkt->eth803_hdr.dest_addr));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
upload:
|
||||
/** send packet to moal */
|
||||
ret = pmadapter->callbacks.moal_recv_packet(pmadapter->pmoal_handle,
|
||||
pmbuf);
|
||||
done:
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer or send back to firmware
|
||||
*
|
||||
* @param priv A pointer to mlan_private
|
||||
* @param pmbuf A pointer to mlan_buffer which includes the received packet
|
||||
*
|
||||
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
|
||||
*/
|
||||
mlan_status wlan_process_uap_rx_packet(mlan_private *priv, pmlan_buffer pmbuf)
|
||||
{
|
||||
pmlan_adapter pmadapter = priv->adapter;
|
||||
mlan_status ret = MLAN_STATUS_SUCCESS;
|
||||
RxPD *prx_pd;
|
||||
RxPacketHdr_t *prx_pkt;
|
||||
pmlan_buffer newbuf = MNULL;
|
||||
|
||||
ENTER();
|
||||
|
||||
prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
|
||||
prx_pkt = (RxPacketHdr_t *)((t_u8 *)prx_pd + prx_pd->rx_pkt_offset);
|
||||
|
||||
DBG_HEXDUMP(MDAT_D, "uAP RxPD", prx_pd,
|
||||
MIN(sizeof(RxPD), MAX_DATA_DUMP_LEN));
|
||||
DBG_HEXDUMP(MDAT_D, "uAP Rx Payload",
|
||||
((t_u8 *)prx_pd + prx_pd->rx_pkt_offset),
|
||||
MIN(prx_pd->rx_pkt_length, MAX_DATA_DUMP_LEN));
|
||||
|
||||
PRINTM(MINFO,
|
||||
"RX Data: data_len - prx_pd->rx_pkt_offset = %d - %d = %d\n",
|
||||
pmbuf->data_len, prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len - prx_pd->rx_pkt_offset);
|
||||
PRINTM(MDATA, "Rx dest " MACSTR "\n",
|
||||
MAC2STR(prx_pkt->eth803_hdr.dest_addr));
|
||||
|
||||
/* don't do packet forwarding in disconnected state */
|
||||
/* don't do packet forwarding when packet > 1514 */
|
||||
if ((priv->media_connected == MFALSE) ||
|
||||
((pmbuf->data_len - prx_pd->rx_pkt_offset) > MV_ETH_FRAME_LEN))
|
||||
goto upload;
|
||||
|
||||
if (prx_pkt->eth803_hdr.dest_addr[0] & 0x01) {
|
||||
if (!(priv->pkt_fwd & PKT_FWD_INTRA_BCAST)) {
|
||||
/* Multicast pkt */
|
||||
newbuf =
|
||||
wlan_alloc_mlan_buffer(pmadapter,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K,
|
||||
0, MOAL_MALLOC_BUFFER);
|
||||
if (newbuf) {
|
||||
newbuf->bss_index = pmbuf->bss_index;
|
||||
newbuf->buf_type = pmbuf->buf_type;
|
||||
newbuf->priority = pmbuf->priority;
|
||||
newbuf->in_ts_sec = pmbuf->in_ts_sec;
|
||||
newbuf->in_ts_usec = pmbuf->in_ts_usec;
|
||||
newbuf->data_offset =
|
||||
(sizeof(TxPD) + priv->intf_hr_len +
|
||||
DMA_ALIGNMENT);
|
||||
util_scalar_increment(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock);
|
||||
newbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF;
|
||||
|
||||
/* copy the data, skip rxpd */
|
||||
memcpy_ext(pmadapter,
|
||||
(t_u8 *)newbuf->pbuf +
|
||||
newbuf->data_offset,
|
||||
pmbuf->pbuf + pmbuf->data_offset +
|
||||
prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len -
|
||||
prx_pd->rx_pkt_offset,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K);
|
||||
newbuf->data_len =
|
||||
pmbuf->data_len - prx_pd->rx_pkt_offset;
|
||||
wlan_wmm_add_buf_txqueue(pmadapter, newbuf);
|
||||
if (util_scalar_read(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock) >
|
||||
RX_HIGH_THRESHOLD)
|
||||
wlan_drop_tx_pkts(priv);
|
||||
wlan_recv_event(
|
||||
priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((!(priv->pkt_fwd & PKT_FWD_INTRA_UCAST)) &&
|
||||
(wlan_get_station_entry(priv,
|
||||
prx_pkt->eth803_hdr.dest_addr))) {
|
||||
/* Forwarding Intra-BSS packet */
|
||||
#ifdef USB
|
||||
if (IS_USB(pmadapter->card_type)) {
|
||||
if (pmbuf->flags & MLAN_BUF_FLAG_RX_DEAGGR) {
|
||||
newbuf = wlan_alloc_mlan_buffer(
|
||||
pmadapter,
|
||||
MLAN_TX_DATA_BUF_SIZE_2K, 0,
|
||||
MOAL_MALLOC_BUFFER);
|
||||
if (newbuf) {
|
||||
newbuf->bss_index =
|
||||
pmbuf->bss_index;
|
||||
newbuf->buf_type =
|
||||
pmbuf->buf_type;
|
||||
newbuf->priority =
|
||||
pmbuf->priority;
|
||||
newbuf->in_ts_sec =
|
||||
pmbuf->in_ts_sec;
|
||||
newbuf->in_ts_usec =
|
||||
pmbuf->in_ts_usec;
|
||||
newbuf->data_offset =
|
||||
(sizeof(TxPD) +
|
||||
priv->intf_hr_len +
|
||||
DMA_ALIGNMENT);
|
||||
util_scalar_increment(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock);
|
||||
newbuf->flags |=
|
||||
MLAN_BUF_FLAG_BRIDGE_BUF;
|
||||
|
||||
/* copy the data, skip rxpd */
|
||||
memcpy_ext(
|
||||
pmadapter,
|
||||
(t_u8 *)newbuf->pbuf +
|
||||
newbuf->data_offset,
|
||||
pmbuf->pbuf +
|
||||
pmbuf->data_offset +
|
||||
prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len -
|
||||
prx_pd->rx_pkt_offset,
|
||||
pmbuf->data_len -
|
||||
prx_pd->rx_pkt_offset);
|
||||
newbuf->data_len =
|
||||
pmbuf->data_len -
|
||||
prx_pd->rx_pkt_offset;
|
||||
wlan_wmm_add_buf_txqueue(
|
||||
pmadapter, newbuf);
|
||||
if (util_scalar_read(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_lock,
|
||||
pmadapter->callbacks
|
||||
.moal_spin_unlock) >
|
||||
RX_HIGH_THRESHOLD)
|
||||
wlan_drop_tx_pkts(priv);
|
||||
wlan_recv_event(
|
||||
priv,
|
||||
MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
}
|
||||
pmadapter->callbacks.moal_recv_complete(
|
||||
pmadapter->pmoal_handle, pmbuf,
|
||||
pmadapter->rx_data_ep, ret);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pmbuf->data_len -= prx_pd->rx_pkt_offset;
|
||||
pmbuf->data_offset += prx_pd->rx_pkt_offset;
|
||||
pmbuf->flags |= MLAN_BUF_FLAG_BRIDGE_BUF;
|
||||
util_scalar_increment(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock);
|
||||
wlan_wmm_add_buf_txqueue(pmadapter, pmbuf);
|
||||
if (util_scalar_read(
|
||||
pmadapter->pmoal_handle,
|
||||
&pmadapter->pending_bridge_pkts,
|
||||
pmadapter->callbacks.moal_spin_lock,
|
||||
pmadapter->callbacks.moal_spin_unlock) >
|
||||
RX_HIGH_THRESHOLD)
|
||||
wlan_drop_tx_pkts(priv);
|
||||
wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
|
||||
MNULL);
|
||||
goto done;
|
||||
} else if (MLAN_STATUS_FAILURE ==
|
||||
wlan_check_unicast_packet(
|
||||
priv, prx_pkt->eth803_hdr.dest_addr)) {
|
||||
PRINTM(MDATA, "Drop Pkts: Rx dest " MACSTR "\n",
|
||||
MAC2STR(prx_pkt->eth803_hdr.dest_addr));
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
upload:
|
||||
/* Chop off RxPD */
|
||||
pmbuf->data_len -= prx_pd->rx_pkt_offset;
|
||||
pmbuf->data_offset += prx_pd->rx_pkt_offset;
|
||||
pmbuf->pparent = MNULL;
|
||||
|
||||
pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle,
|
||||
&pmbuf->out_ts_sec,
|
||||
&pmbuf->out_ts_usec);
|
||||
PRINTM_NETINTF(MDATA, priv);
|
||||
PRINTM(MDATA, "%lu.%06lu : Data => kernel seq_num=%d tid=%d\n",
|
||||
pmbuf->out_ts_sec, pmbuf->out_ts_usec, prx_pd->seq_num,
|
||||
prx_pd->priority);
|
||||
|
||||
ret = pmadapter->callbacks.moal_recv_packet(pmadapter->pmoal_handle,
|
||||
pmbuf);
|
||||
if (ret == MLAN_STATUS_FAILURE) {
|
||||
PRINTM(MERROR,
|
||||
"uAP Rx Error: moal_recv_packet returned error\n");
|
||||
pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
|
||||
}
|
||||
|
||||
if (ret != MLAN_STATUS_PENDING)
|
||||
pmadapter->ops.data_complete(pmadapter, pmbuf, ret);
|
||||
#ifdef USB
|
||||
else if (IS_USB(pmadapter->card_type))
|
||||
pmadapter->callbacks.moal_recv_complete(pmadapter->pmoal_handle,
|
||||
MNULL,
|
||||
pmadapter->rx_data_ep,
|
||||
ret);
|
||||
#endif
|
||||
done:
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
1264
mxm_wifiex/wlan_src/mlan/mlan_usb.c
Normal file
1264
mxm_wifiex/wlan_src/mlan/mlan_usb.c
Normal file
File diff suppressed because it is too large
Load diff
492
mxm_wifiex/wlan_src/mlan/mlan_util.h
Normal file
492
mxm_wifiex/wlan_src/mlan/mlan_util.h
Normal file
|
@ -0,0 +1,492 @@
|
|||
/** @file mlan_util.h
|
||||
*
|
||||
* @brief This file contains wrappers for linked-list,
|
||||
* spinlock and timer defines.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
10/28/2008: initial version
|
||||
******************************************************/
|
||||
|
||||
#ifndef _MLAN_UTIL_H_
|
||||
#define _MLAN_UTIL_H_
|
||||
|
||||
/** Circular doubly linked list */
|
||||
typedef struct _mlan_linked_list {
|
||||
/** Pointer to previous node */
|
||||
struct _mlan_linked_list *pprev;
|
||||
/** Pointer to next node */
|
||||
struct _mlan_linked_list *pnext;
|
||||
} mlan_linked_list, *pmlan_linked_list;
|
||||
|
||||
/** List head */
|
||||
typedef struct _mlan_list_head {
|
||||
/** Pointer to previous node */
|
||||
struct _mlan_linked_list *pprev;
|
||||
/** Pointer to next node */
|
||||
struct _mlan_linked_list *pnext;
|
||||
/** Pointer to lock */
|
||||
t_void *plock;
|
||||
} mlan_list_head, *pmlan_list_head;
|
||||
|
||||
/**
|
||||
* @brief This function initializes a list without locking
|
||||
*
|
||||
* @param phead List head
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_init_list(pmlan_linked_list phead)
|
||||
{
|
||||
/* Both next and prev point to self */
|
||||
phead->pprev = phead->pnext = (pmlan_linked_list)phead;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function initializes a list
|
||||
*
|
||||
* @param phead List head
|
||||
* @param lock_required A flag for spinlock requirement
|
||||
* @param moal_init_lock A pointer to init lock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_init_list_head(
|
||||
t_void *pmoal_handle, pmlan_list_head phead, t_u8 lock_required,
|
||||
mlan_status (*moal_init_lock)(t_void *handle, t_void **pplock))
|
||||
{
|
||||
/* Both next and prev point to self */
|
||||
util_init_list((pmlan_linked_list)phead);
|
||||
if (lock_required)
|
||||
moal_init_lock(pmoal_handle, &phead->plock);
|
||||
else
|
||||
phead->plock = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function frees a list
|
||||
*
|
||||
* @param phead List head
|
||||
* @param moal_free_lock A pointer to free lock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_free_list_head(
|
||||
t_void *pmoal_handle, pmlan_list_head phead,
|
||||
mlan_status (*moal_free_lock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
phead->pprev = phead->pnext = 0;
|
||||
if (phead->plock)
|
||||
moal_free_lock(pmoal_handle, phead->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function peeks into a list
|
||||
*
|
||||
* @param phead List head
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return List node
|
||||
*/
|
||||
static INLINE pmlan_linked_list
|
||||
util_peek_list(t_void *pmoal_handle, pmlan_list_head phead,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
pmlan_linked_list pnode = 0;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, phead->plock);
|
||||
if (phead->pnext != (pmlan_linked_list)phead)
|
||||
pnode = phead->pnext;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, phead->plock);
|
||||
return pnode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function queues a node at the list tail
|
||||
*
|
||||
* @param phead List head
|
||||
* @param pnode List node to queue
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_enqueue_list_tail(
|
||||
t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
pmlan_linked_list pold_last;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, phead->plock);
|
||||
pold_last = phead->pprev;
|
||||
pnode->pprev = pold_last;
|
||||
pnode->pnext = (pmlan_linked_list)phead;
|
||||
|
||||
phead->pprev = pold_last->pnext = pnode;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, phead->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function adds a node at the list head
|
||||
*
|
||||
* @param phead List head
|
||||
* @param pnode List node to add
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_enqueue_list_head(
|
||||
t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
pmlan_linked_list pold_first;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, phead->plock);
|
||||
pold_first = phead->pnext;
|
||||
pnode->pprev = (pmlan_linked_list)phead;
|
||||
pnode->pnext = pold_first;
|
||||
|
||||
phead->pnext = pold_first->pprev = pnode;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, phead->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function removes a node from the list
|
||||
*
|
||||
* @param phead List head
|
||||
* @param pnode List node to remove
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_unlink_list(
|
||||
t_void *pmoal_handle, pmlan_list_head phead, pmlan_linked_list pnode,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
pmlan_linked_list pmy_prev;
|
||||
pmlan_linked_list pmy_next;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, phead->plock);
|
||||
pmy_prev = pnode->pprev;
|
||||
pmy_next = pnode->pnext;
|
||||
pmy_next->pprev = pmy_prev;
|
||||
pmy_prev->pnext = pmy_next;
|
||||
|
||||
pnode->pnext = pnode->pprev = 0;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, phead->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function dequeues a node from the list
|
||||
*
|
||||
* @param phead List head
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return List node
|
||||
*/
|
||||
static INLINE pmlan_linked_list util_dequeue_list(
|
||||
t_void *pmoal_handle, pmlan_list_head phead,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
pmlan_linked_list pnode;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, phead->plock);
|
||||
pnode = phead->pnext;
|
||||
if (pnode && (pnode != (pmlan_linked_list)phead))
|
||||
util_unlink_list(pmoal_handle, phead, pnode, 0, 0);
|
||||
else
|
||||
pnode = 0;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, phead->plock);
|
||||
return pnode;
|
||||
}
|
||||
|
||||
/** Access controlled scalar variable */
|
||||
typedef struct _mlan_scalar {
|
||||
/** Value */
|
||||
t_s32 value;
|
||||
/** Pointer to lock */
|
||||
t_void *plock;
|
||||
/** Control flags */
|
||||
t_u32 flags;
|
||||
} mlan_scalar, *pmlan_scalar;
|
||||
|
||||
/** Flag to scalar lock acquired */
|
||||
#define MLAN_SCALAR_FLAG_UNIQUE_LOCK MBIT(16)
|
||||
|
||||
/** scalar conditional value list */
|
||||
typedef enum _MLAN_SCALAR_CONDITIONAL {
|
||||
MLAN_SCALAR_COND_EQUAL,
|
||||
MLAN_SCALAR_COND_NOT_EQUAL,
|
||||
MLAN_SCALAR_COND_GREATER_THAN,
|
||||
MLAN_SCALAR_COND_GREATER_OR_EQUAL,
|
||||
MLAN_SCALAR_COND_LESS_THAN,
|
||||
MLAN_SCALAR_COND_LESS_OR_EQUAL
|
||||
} MLAN_SCALAR_CONDITIONAL;
|
||||
|
||||
/**
|
||||
* @brief This function initializes a scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param val Initial scalar value
|
||||
* @param plock_to_use A new lock is created if NULL, else lock to use
|
||||
* @param moal_init_lock A pointer to init lock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void
|
||||
util_scalar_init(t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 val,
|
||||
t_void *plock_to_use,
|
||||
mlan_status (*moal_init_lock)(t_void *handle, t_void **pplock))
|
||||
{
|
||||
pscalar->value = val;
|
||||
pscalar->flags = 0;
|
||||
if (plock_to_use) {
|
||||
pscalar->flags &= ~MLAN_SCALAR_FLAG_UNIQUE_LOCK;
|
||||
pscalar->plock = plock_to_use;
|
||||
} else {
|
||||
pscalar->flags |= MLAN_SCALAR_FLAG_UNIQUE_LOCK;
|
||||
moal_init_lock(pmoal_handle, &pscalar->plock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function frees a scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param moal_free_lock A pointer to free lock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void
|
||||
util_scalar_free(t_void *pmoal_handle, pmlan_scalar pscalar,
|
||||
mlan_status (*moal_free_lock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
if (pscalar->flags & MLAN_SCALAR_FLAG_UNIQUE_LOCK)
|
||||
moal_free_lock(pmoal_handle, pscalar->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function reads value from scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return Stored value
|
||||
*/
|
||||
static INLINE t_s32
|
||||
util_scalar_read(t_void *pmoal_handle, pmlan_scalar pscalar,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
t_s32 val;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
val = pscalar->value;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function writes value to scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param val Value to write
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_scalar_write(
|
||||
t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 val,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
pscalar->value = val;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function increments the value in scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_scalar_increment(
|
||||
t_void *pmoal_handle, pmlan_scalar pscalar,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
pscalar->value++;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function decrements the value in scalar
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void util_scalar_decrement(
|
||||
t_void *pmoal_handle, pmlan_scalar pscalar,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
pscalar->value--;
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function adds an offset to the value in scalar,
|
||||
* and returns the new value
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param offset Offset value (can be negative)
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return Value after offset
|
||||
*/
|
||||
static INLINE t_s32 util_scalar_offset(
|
||||
t_void *pmoal_handle, pmlan_scalar pscalar, t_s32 offset,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
t_s32 newval;
|
||||
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
newval = (pscalar->value += offset);
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
|
||||
return newval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function writes the value to the scalar
|
||||
* if existing value compared with other value is true.
|
||||
*
|
||||
* @param pscalar Pointer to scalar
|
||||
* @param condition Condition to check
|
||||
* @param val_compare Value to compare against current value
|
||||
* ((A X B), where B = val_compare)
|
||||
* @param val_to_set Value to set if comparison is true
|
||||
* @param moal_spin_lock A pointer to spin lock handler
|
||||
* @param moal_spin_unlock A pointer to spin unlock handler
|
||||
*
|
||||
* @return Comparison result (MTRUE or MFALSE)
|
||||
*/
|
||||
static INLINE t_u8 util_scalar_conditional_write(
|
||||
t_void *pmoal_handle, pmlan_scalar pscalar,
|
||||
MLAN_SCALAR_CONDITIONAL condition, t_s32 val_compare, t_s32 val_to_set,
|
||||
mlan_status (*moal_spin_lock)(t_void *handle, t_void *plock),
|
||||
mlan_status (*moal_spin_unlock)(t_void *handle, t_void *plock))
|
||||
{
|
||||
t_u8 update;
|
||||
if (moal_spin_lock)
|
||||
moal_spin_lock(pmoal_handle, pscalar->plock);
|
||||
|
||||
switch (condition) {
|
||||
case MLAN_SCALAR_COND_EQUAL:
|
||||
update = (pscalar->value == val_compare);
|
||||
break;
|
||||
case MLAN_SCALAR_COND_NOT_EQUAL:
|
||||
update = (pscalar->value != val_compare);
|
||||
break;
|
||||
case MLAN_SCALAR_COND_GREATER_THAN:
|
||||
update = (pscalar->value > val_compare);
|
||||
break;
|
||||
case MLAN_SCALAR_COND_GREATER_OR_EQUAL:
|
||||
update = (pscalar->value >= val_compare);
|
||||
break;
|
||||
case MLAN_SCALAR_COND_LESS_THAN:
|
||||
update = (pscalar->value < val_compare);
|
||||
break;
|
||||
case MLAN_SCALAR_COND_LESS_OR_EQUAL:
|
||||
update = (pscalar->value <= val_compare);
|
||||
break;
|
||||
default:
|
||||
update = MFALSE;
|
||||
break;
|
||||
}
|
||||
if (update)
|
||||
pscalar->value = val_to_set;
|
||||
|
||||
if (moal_spin_unlock)
|
||||
moal_spin_unlock(pmoal_handle, pscalar->plock);
|
||||
return (update) ? MTRUE : MFALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function counts the bits of unsigned int number
|
||||
*
|
||||
* @param num number
|
||||
* @return number of bits
|
||||
*/
|
||||
static INLINE t_u32 bitcount(t_u32 num)
|
||||
{
|
||||
t_u32 count = 0;
|
||||
static t_u32 nibblebits[] = {0, 1, 1, 2, 1, 2, 2, 3,
|
||||
1, 2, 2, 3, 2, 3, 3, 4};
|
||||
for (; num != 0; num >>= 4)
|
||||
count += nibblebits[num & 0x0f];
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif /* !_MLAN_UTIL_H_ */
|
3282
mxm_wifiex/wlan_src/mlan/mlan_wmm.c
Normal file
3282
mxm_wifiex/wlan_src/mlan/mlan_wmm.c
Normal file
File diff suppressed because it is too large
Load diff
242
mxm_wifiex/wlan_src/mlan/mlan_wmm.h
Normal file
242
mxm_wifiex/wlan_src/mlan/mlan_wmm.h
Normal file
|
@ -0,0 +1,242 @@
|
|||
/** @file mlan_wmm.h
|
||||
*
|
||||
* @brief This file contains related macros, enum, and struct
|
||||
* of wmm functionalities
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************
|
||||
Change log:
|
||||
10/24/2008: initial version
|
||||
****************************************************/
|
||||
|
||||
#ifndef _MLAN_WMM_H_
|
||||
#define _MLAN_WMM_H_
|
||||
|
||||
/**
|
||||
* @brief This function gets the TID
|
||||
*
|
||||
* @param pmadapter A pointer to mlan_adapter structure
|
||||
* @param ptr A pointer to RA list table
|
||||
*
|
||||
* @return TID
|
||||
*/
|
||||
static INLINE t_u32 wlan_get_tid(pmlan_adapter pmadapter, praListTbl ptr)
|
||||
{
|
||||
pmlan_buffer mbuf;
|
||||
|
||||
ENTER();
|
||||
mbuf = (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle,
|
||||
&ptr->buf_head, MNULL, MNULL);
|
||||
LEAVE();
|
||||
|
||||
if (!mbuf) {
|
||||
return 0; // The default TID,BE
|
||||
} else
|
||||
return mbuf->priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function gets the length of a list
|
||||
*
|
||||
* @param head A pointer to mlan_list_head
|
||||
*
|
||||
* @return Length of list
|
||||
*/
|
||||
static INLINE t_u32 wlan_wmm_list_len(pmlan_list_head head)
|
||||
{
|
||||
pmlan_linked_list pos;
|
||||
t_u32 count = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
pos = head->pnext;
|
||||
|
||||
while (pos != (pmlan_linked_list)head) {
|
||||
++count;
|
||||
pos = pos->pnext;
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function requests a ralist lock
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void wlan_request_ralist_lock(pmlan_private priv)
|
||||
{
|
||||
mlan_adapter *pmadapter = priv->adapter;
|
||||
mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* Call MOAL spin lock callback function */
|
||||
pcb->moal_spin_lock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function releases a lock on ralist
|
||||
*
|
||||
* @param priv A pointer to mlan_private structure
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static INLINE t_void wlan_release_ralist_lock(pmlan_private priv)
|
||||
{
|
||||
mlan_adapter *pmadapter = priv->adapter;
|
||||
mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* Call MOAL spin unlock callback function */
|
||||
pcb->moal_spin_unlock(pmadapter->pmoal_handle,
|
||||
priv->wmm.ra_list_spinlock);
|
||||
|
||||
LEAVE();
|
||||
return;
|
||||
}
|
||||
|
||||
/** Add buffer to WMM Tx queue */
|
||||
void wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf);
|
||||
/** Add to RA list */
|
||||
void wlan_ralist_add(mlan_private *priv, t_u8 *ra);
|
||||
/** Update the RA list */
|
||||
int wlan_ralist_update(mlan_private *priv, t_u8 *old_ra, t_u8 *new_ra);
|
||||
|
||||
/** WMM status change command handler */
|
||||
mlan_status wlan_cmd_wmm_status_change(pmlan_private priv);
|
||||
/** Check if WMM lists are empty */
|
||||
int wlan_wmm_lists_empty(pmlan_adapter pmadapter);
|
||||
/** Process WMM transmission */
|
||||
t_void wlan_wmm_process_tx(pmlan_adapter pmadapter);
|
||||
/** Test to see if the ralist ptr is valid */
|
||||
int wlan_is_ralist_valid(mlan_private *priv, raListTbl *ra_list, int tid);
|
||||
|
||||
raListTbl *wlan_wmm_get_ralist_node(pmlan_private priv, t_u8 tid,
|
||||
t_u8 *ra_addr);
|
||||
t_u8 wlan_get_random_ba_threshold(pmlan_adapter pmadapter);
|
||||
|
||||
/** Compute driver packet delay */
|
||||
t_u8 wlan_wmm_compute_driver_packet_delay(pmlan_private priv,
|
||||
const pmlan_buffer pmbuf);
|
||||
/** Initialize WMM */
|
||||
t_void wlan_wmm_init(pmlan_adapter pmadapter);
|
||||
/** Initialize WMM paramter */
|
||||
t_void wlan_init_wmm_param(pmlan_adapter pmadapter);
|
||||
/** Setup WMM queues */
|
||||
extern void wlan_wmm_setup_queues(pmlan_private priv);
|
||||
/* Setup default queues */
|
||||
void wlan_wmm_default_queue_priorities(pmlan_private priv);
|
||||
/* process wmm_param_config command */
|
||||
mlan_status wlan_cmd_wmm_param_config(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd, t_u8 cmd_action,
|
||||
t_void *pdata_buf);
|
||||
|
||||
/* process wmm_param_config command response */
|
||||
mlan_status wlan_ret_wmm_param_config(pmlan_private pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
|
||||
#ifdef STA_SUPPORT
|
||||
/** Process WMM association request */
|
||||
extern t_u32 wlan_wmm_process_association_req(pmlan_private priv,
|
||||
t_u8 **ppAssocBuf,
|
||||
IEEEtypes_WmmParameter_t *pWmmIE,
|
||||
IEEEtypes_HTCap_t *pHTCap);
|
||||
#endif /* STA_SUPPORT */
|
||||
|
||||
/** setup wmm queue priorities */
|
||||
void wlan_wmm_setup_queue_priorities(pmlan_private priv,
|
||||
IEEEtypes_WmmParameter_t *wmm_ie);
|
||||
|
||||
/* Get tid_down from tid */
|
||||
int wlan_get_wmm_tid_down(mlan_private *priv, int tid);
|
||||
/** Downgrade WMM priority queue */
|
||||
void wlan_wmm_setup_ac_downgrade(pmlan_private priv);
|
||||
/** select WMM queue */
|
||||
t_u8 wlan_wmm_select_queue(mlan_private *pmpriv, t_u8 tid);
|
||||
t_void wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 *mac);
|
||||
|
||||
#ifdef STA_SUPPORT
|
||||
/*
|
||||
* Functions used in the cmd handling routine
|
||||
*/
|
||||
/** WMM ADDTS request command handler */
|
||||
extern mlan_status wlan_cmd_wmm_addts_req(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd,
|
||||
t_void *pdata_buf);
|
||||
/** WMM DELTS request command handler */
|
||||
extern mlan_status wlan_cmd_wmm_delts_req(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd,
|
||||
t_void *pdata_buf);
|
||||
/** WMM QUEUE_STATS command handler */
|
||||
extern mlan_status wlan_cmd_wmm_queue_stats(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd,
|
||||
t_void *pdata_buf);
|
||||
/** WMM TS_STATUS command handler */
|
||||
extern mlan_status wlan_cmd_wmm_ts_status(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd,
|
||||
t_void *pdata_buf);
|
||||
|
||||
/*
|
||||
* Functions used in the cmdresp handling routine
|
||||
*/
|
||||
/** WMM get status command response handler */
|
||||
extern mlan_status wlan_ret_wmm_get_status(pmlan_private priv, t_u8 *ptlv,
|
||||
int resp_len);
|
||||
/** WMM ADDTS request command response handler */
|
||||
extern mlan_status wlan_ret_wmm_addts_req(pmlan_private pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
/** WMM DELTS request command response handler */
|
||||
extern mlan_status wlan_ret_wmm_delts_req(pmlan_private pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
/** WMM QUEUE_STATS command response handler */
|
||||
extern mlan_status wlan_ret_wmm_queue_stats(pmlan_private pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
/** WMM TS_STATUS command response handler */
|
||||
extern mlan_status wlan_ret_wmm_ts_status(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
#endif /* STA_SUPPORT */
|
||||
|
||||
/** WMM QUEUE_CONFIG command handler */
|
||||
extern mlan_status wlan_cmd_wmm_queue_config(pmlan_private pmpriv,
|
||||
HostCmd_DS_COMMAND *cmd,
|
||||
t_void *pdata_buf);
|
||||
|
||||
/** WMM QUEUE_CONFIG command response handler */
|
||||
extern mlan_status wlan_ret_wmm_queue_config(pmlan_private pmpriv,
|
||||
const HostCmd_DS_COMMAND *resp,
|
||||
mlan_ioctl_req *pioctl_buf);
|
||||
|
||||
mlan_status wlan_wmm_cfg_ioctl(pmlan_adapter pmadapter,
|
||||
pmlan_ioctl_req pioctl_req);
|
||||
#endif /* !_MLAN_WMM_H_ */
|
37
mxm_wifiex/wlan_src/mlinux/mlan.h
Normal file
37
mxm_wifiex/wlan_src/mlinux/mlan.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/** @file mlan.h
|
||||
*
|
||||
* @brief This file declares all APIs that will be called from MOAL module.
|
||||
* It also defines the data structures used for APIs between MLAN and MOAL.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
Change log:
|
||||
10/13/2008: initial version
|
||||
11/07/2008: split mlan.h into mlan_decl.h & mlan_ioctl.h
|
||||
******************************************************/
|
||||
|
||||
#ifndef _MLAN_H_
|
||||
#define _MLAN_H_
|
||||
|
||||
#include "mlan_decl.h"
|
||||
#include "mlan_ioctl.h"
|
||||
#include "mlan_ieee.h"
|
||||
|
||||
#endif /* !_MLAN_H_ */
|
1988
mxm_wifiex/wlan_src/mlinux/mlan_decl.h
Normal file
1988
mxm_wifiex/wlan_src/mlinux/mlan_decl.h
Normal file
File diff suppressed because it is too large
Load diff
1888
mxm_wifiex/wlan_src/mlinux/mlan_ieee.h
Normal file
1888
mxm_wifiex/wlan_src/mlinux/mlan_ieee.h
Normal file
File diff suppressed because it is too large
Load diff
5159
mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h
Normal file
5159
mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h
Normal file
File diff suppressed because it is too large
Load diff
4679
mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c
Normal file
4679
mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c
Normal file
File diff suppressed because it is too large
Load diff
478
mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h
Normal file
478
mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h
Normal file
|
@ -0,0 +1,478 @@
|
|||
/** @file moal_cfg80211.h
|
||||
*
|
||||
* @brief This file contains the CFG80211 specific defines.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MOAL_CFG80211_H_
|
||||
#define _MOAL_CFG80211_H_
|
||||
|
||||
#include "moal_main.h"
|
||||
|
||||
#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE
|
||||
#define IEEE80211_CHAN_PASSIVE_SCAN IEEE80211_CHAN_NO_IR
|
||||
#define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 16, 0) <= CFG80211_VERSION_CODE
|
||||
#define MAX_CSA_COUNTERS_NUM 2
|
||||
#endif
|
||||
|
||||
/* Clear all key indexes */
|
||||
#define KEY_INDEX_CLEAR_ALL (0x0000000F)
|
||||
|
||||
/** RTS/FRAG disabled value */
|
||||
#define MLAN_FRAG_RTS_DISABLED (0xFFFFFFFF)
|
||||
|
||||
#ifndef WLAN_CIPHER_SUITE_SMS4
|
||||
#define WLAN_CIPHER_SUITE_SMS4 0x00000020
|
||||
#endif
|
||||
|
||||
#ifndef WLAN_CIPHER_SUITE_AES_CMAC
|
||||
#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
|
||||
#endif
|
||||
#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
|
||||
#ifndef WLAN_CIPHER_SUITE_BIP_GMAC_256
|
||||
#define WLAN_CIPHER_SUITE_BIP_GMAC_256 0x000FAC0C
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* define for custom ie operation */
|
||||
#define MLAN_CUSTOM_IE_AUTO_IDX_MASK 0xffff
|
||||
#define MLAN_CUSTOM_IE_NEW_MASK 0x8000
|
||||
#define IE_MASK_WPS 0x0001
|
||||
#define IE_MASK_P2P 0x0002
|
||||
#define IE_MASK_WFD 0x0004
|
||||
#define IE_MASK_VENDOR 0x0008
|
||||
#define IE_MASK_EXTCAP 0x0010
|
||||
|
||||
#define MRVL_PKT_TYPE_MGMT_FRAME 0xE5
|
||||
|
||||
/**
|
||||
* If multiple wiphys are registered e.g. a regular netdev with
|
||||
* assigned ieee80211_ptr and you won't know whether it points
|
||||
* to a wiphy your driver has registered or not. Assign this to
|
||||
* something global to your driver to help determine whether
|
||||
* you own this wiphy or not.
|
||||
*/
|
||||
static const void *const mrvl_wiphy_privid = &mrvl_wiphy_privid;
|
||||
|
||||
/* Get the private structure from wiphy */
|
||||
void *woal_get_wiphy_priv(struct wiphy *wiphy);
|
||||
|
||||
/* Get the private structure from net device */
|
||||
void *woal_get_netdev_priv(struct net_device *dev);
|
||||
#ifdef STA_SUPPORT
|
||||
/** get scan interface */
|
||||
pmoal_private woal_get_scan_interface(pmoal_handle handle);
|
||||
#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE
|
||||
/** AUTH pending flag */
|
||||
#define HOST_MLME_AUTH_PENDING MBIT(0)
|
||||
/** AUTH complete flag */
|
||||
#define HOST_MLME_AUTH_DONE MBIT(1)
|
||||
#define HOST_MLME_ASSOC_PENDING MBIT(2)
|
||||
#define HOST_MLME_ASSOC_DONE MBIT(3)
|
||||
void woal_host_mlme_disconnect(pmoal_private priv, u16 reason_code, u8 *sa);
|
||||
void woal_host_mlme_work_queue(struct work_struct *work);
|
||||
void woal_host_mlme_process_assoc_resp(moal_private *priv,
|
||||
mlan_ds_misc_assoc_rsp *assoc_rsp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
t_u8 woal_band_cfg_to_ieee_band(t_u32 band);
|
||||
|
||||
int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
||||
struct net_device *dev,
|
||||
enum nl80211_iftype type,
|
||||
#if KERNEL_VERSION(4, 12, 0) > CFG80211_VERSION_CODE
|
||||
u32 *flags,
|
||||
#endif
|
||||
struct vif_params *params);
|
||||
|
||||
int woal_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
|
||||
|
||||
int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
t_u8 key_index,
|
||||
#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE
|
||||
bool pairwise,
|
||||
#endif
|
||||
const t_u8 *mac_addr, struct key_params *params);
|
||||
|
||||
int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
t_u8 key_index,
|
||||
#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE
|
||||
bool pairwise,
|
||||
#endif
|
||||
const t_u8 *mac_addr);
|
||||
#ifdef STA_SUPPORT
|
||||
/** Opportunistic Key Caching APIs support */
|
||||
struct pmksa_entry *woal_get_pmksa_entry(pmoal_private priv, const u8 *bssid);
|
||||
|
||||
int woal_flush_pmksa_list(moal_private *priv);
|
||||
|
||||
int woal_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_pmksa *pmksa);
|
||||
|
||||
int woal_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_pmksa *pmksa);
|
||||
|
||||
int woal_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev);
|
||||
#endif
|
||||
|
||||
int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
|
||||
const u8 *peer,
|
||||
const struct cfg80211_bitrate_mask *mask);
|
||||
#if KERNEL_VERSION(2, 6, 38) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
|
||||
int woal_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_qos_map(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_qos_map *qos_map);
|
||||
#endif
|
||||
|
||||
#ifdef STA_CFG80211
|
||||
#ifdef STA_SUPPORT
|
||||
int woal_set_rf_channel(moal_private *priv, struct ieee80211_channel *chan,
|
||||
enum nl80211_channel_type channel_type,
|
||||
t_u8 wait_option);
|
||||
|
||||
static inline int woal_cfg80211_scan_done(struct cfg80211_scan_request *request,
|
||||
bool aborted)
|
||||
{
|
||||
#if KERNEL_VERSION(4, 8, 0) <= CFG80211_VERSION_CODE
|
||||
struct cfg80211_scan_info info;
|
||||
|
||||
info.aborted = aborted;
|
||||
cfg80211_scan_done(request, &info);
|
||||
#else
|
||||
cfg80211_scan_done(request, aborted);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
mlan_status woal_inform_bss_from_scan_result(moal_private *priv,
|
||||
pmlan_ssid_bssid ssid_bssid,
|
||||
t_u8 wait_option);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 5, 0) > CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_channel(struct wiphy *wiphy,
|
||||
#if KERNEL_VERSION(2, 6, 34) < CFG80211_VERSION_CODE
|
||||
struct net_device *dev,
|
||||
#endif
|
||||
struct ieee80211_channel *chan,
|
||||
enum nl80211_channel_type channel_type);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(2, 6, 37) < CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
t_u8 key_index, bool ucast, bool mcast);
|
||||
#else
|
||||
int woal_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
t_u8 key_index);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(2, 6, 30) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
|
||||
struct net_device *netdev,
|
||||
t_u8 key_index);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 1, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_gtk_rekey_data *data);
|
||||
#endif
|
||||
void woal_mgmt_frame_register(moal_private *priv, u16 frame_type, bool reg);
|
||||
void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy,
|
||||
#if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE
|
||||
struct wireless_dev *wdev,
|
||||
#else
|
||||
struct net_device *dev,
|
||||
#endif
|
||||
#if KERNEL_VERSION(5, 8, 0) <= CFG80211_VERSION_CODE
|
||||
struct mgmt_frame_regs *upd
|
||||
#else
|
||||
t_u16 frame_type, bool reg
|
||||
#endif
|
||||
);
|
||||
|
||||
int woal_cfg80211_mgmt_tx(struct wiphy *wiphy,
|
||||
#if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE
|
||||
struct wireless_dev *wdev,
|
||||
#else
|
||||
struct net_device *dev,
|
||||
#endif
|
||||
#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE
|
||||
struct cfg80211_mgmt_tx_params *params,
|
||||
#else
|
||||
struct ieee80211_channel *chan, bool offchan,
|
||||
#if KERNEL_VERSION(3, 8, 0) > CFG80211_VERSION_CODE
|
||||
enum nl80211_channel_type channel_type,
|
||||
bool channel_type_valid,
|
||||
#endif
|
||||
unsigned int wait, const u8 *buf, size_t len,
|
||||
#if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE
|
||||
bool no_cck,
|
||||
#endif
|
||||
#if KERNEL_VERSION(3, 3, 0) <= CFG80211_VERSION_CODE
|
||||
bool dont_wait_for_ack,
|
||||
#endif
|
||||
#endif
|
||||
u64 *cookie);
|
||||
|
||||
#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE
|
||||
void woal_update_radar_chans_dfs_state(struct wiphy *wiphy);
|
||||
#endif
|
||||
|
||||
mlan_status woal_register_cfg80211(moal_private *priv);
|
||||
|
||||
extern struct ieee80211_supported_band cfg80211_band_2ghz;
|
||||
extern struct ieee80211_supported_band cfg80211_band_5ghz;
|
||||
extern struct ieee80211_supported_band mac1_cfg80211_band_2ghz;
|
||||
extern struct ieee80211_supported_band mac1_cfg80211_band_5ghz;
|
||||
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
int woal_cfg80211_bss_role_cfg(moal_private *priv, t_u16 action,
|
||||
t_u8 *bss_role);
|
||||
#endif
|
||||
#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE
|
||||
struct wireless_dev *
|
||||
woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, const char *name,
|
||||
unsigned char name_assign_type,
|
||||
enum nl80211_iftype type,
|
||||
#if KERNEL_VERSION(4, 12, 0) > CFG80211_VERSION_CODE
|
||||
u32 *flags,
|
||||
#endif
|
||||
struct vif_params *params);
|
||||
#else
|
||||
#if KERNEL_VERSION(3, 7, 0) <= CFG80211_VERSION_CODE
|
||||
struct wireless_dev *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy,
|
||||
const char *name,
|
||||
enum nl80211_iftype type,
|
||||
u32 *flags,
|
||||
struct vif_params *params);
|
||||
#else
|
||||
#if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE
|
||||
struct wireless_dev *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy,
|
||||
char *name,
|
||||
enum nl80211_iftype type,
|
||||
u32 *flags,
|
||||
struct vif_params *params);
|
||||
#else
|
||||
#if KERNEL_VERSION(2, 6, 37) < CFG80211_VERSION_CODE
|
||||
struct net_device *woal_cfg80211_add_virtual_intf(struct wiphy *wiphy,
|
||||
char *name,
|
||||
enum nl80211_iftype type,
|
||||
u32 *flags,
|
||||
struct vif_params *params);
|
||||
#else
|
||||
int woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name,
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
struct vif_params *params);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
int woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev);
|
||||
#if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev);
|
||||
#else
|
||||
int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev);
|
||||
#endif
|
||||
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
/* Group Owner Negotiation Req */
|
||||
#define P2P_GO_NEG_REQ 0
|
||||
/* Group Owner Negotiation Rsp */
|
||||
#define P2P_GO_NEG_RSP 1
|
||||
/* Group Owner Negotiation Confirm */
|
||||
#define P2P_GO_NEG_CONF 2
|
||||
/* P2P Invitation Request */
|
||||
#define P2P_INVITE_REQ 3
|
||||
/* P2P Invitation Response */
|
||||
#define P2P_INVITE_RSP 4
|
||||
/* Device Discoverability Request */
|
||||
#define P2P_DEVDIS_REQ 5
|
||||
/* Device Discoverability Response */
|
||||
#define P2P_DEVDIS_RSP 6
|
||||
/* Provision Discovery Request */
|
||||
#define P2P_PROVDIS_REQ 7
|
||||
/* Provision Discovery Response */
|
||||
#define P2P_PROVDIS_RSP 8
|
||||
/** P2P category */
|
||||
#define P2P_ACT_FRAME_CATEGORY 0x04
|
||||
/** P2P oui offset */
|
||||
#define P2P_ACT_FRAME_OUI_OFFSET 26
|
||||
/** P2P subtype offset */
|
||||
#define P2P_ACT_FRAME_OUI_SUBTYPE_OFFSET 30
|
||||
void woal_cfg80211_display_p2p_actframe(const t_u8 *buf, int len,
|
||||
struct ieee80211_channel *chan,
|
||||
const t_u8 flag);
|
||||
|
||||
/** Define kernel version for wifi direct */
|
||||
#define WIFI_DIRECT_KERNEL_VERSION KERNEL_VERSION(2, 6, 39)
|
||||
|
||||
#if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION
|
||||
|
||||
int woal_cfg80211_init_p2p_client(moal_private *priv);
|
||||
|
||||
int woal_cfg80211_init_p2p_go(moal_private *priv);
|
||||
|
||||
int woal_cfg80211_deinit_p2p(moal_private *priv);
|
||||
|
||||
void woal_remove_virtual_interface(moal_handle *handle);
|
||||
|
||||
#endif /* KERNEL_VERSION */
|
||||
#endif /* WIFI_DIRECT_SUPPORT */
|
||||
|
||||
/** Define for remain on channel duration timer */
|
||||
#define MAX_REMAIN_ON_CHANNEL_DURATION (1000)
|
||||
|
||||
int woal_cfg80211_remain_on_channel_cfg(moal_private *priv, t_u8 wait_option,
|
||||
t_u8 remove, t_u8 *status,
|
||||
struct ieee80211_channel *chan,
|
||||
enum mlan_channel_type channel_type,
|
||||
t_u32 duration);
|
||||
|
||||
#ifdef UAP_CFG80211
|
||||
int woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
#if KERNEL_VERSION(3, 16, 0) <= CFG80211_VERSION_CODE
|
||||
const u8 *mac,
|
||||
#else
|
||||
u8 *mac,
|
||||
#endif
|
||||
struct station_info *stainfo);
|
||||
|
||||
int woal_uap_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
int idx, t_u8 *mac,
|
||||
struct station_info *sinfo);
|
||||
#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct bss_parameters *params);
|
||||
#endif
|
||||
#if KERNEL_VERSION(3, 9, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev,
|
||||
const struct cfg80211_acl_data *params);
|
||||
#endif
|
||||
#if KERNEL_VERSION(3, 1, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_txq_params(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct ieee80211_txq_params *params);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_set_coalesce(struct wiphy *wiphy,
|
||||
struct cfg80211_coalesce *coalesce);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(3, 4, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_ap_settings *params);
|
||||
|
||||
int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_beacon_data *params);
|
||||
#else
|
||||
int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct beacon_parameters *params);
|
||||
|
||||
int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct beacon_parameters *params);
|
||||
#endif
|
||||
|
||||
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev);
|
||||
int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
#if KERNEL_VERSION(3, 19, 0) <= CFG80211_VERSION_CODE
|
||||
struct station_del_parameters *param);
|
||||
#else
|
||||
#if KERNEL_VERSION(3, 16, 0) <= CFG80211_VERSION_CODE
|
||||
const u8 *mac_addr);
|
||||
#else
|
||||
u8 *mac_addr);
|
||||
#endif
|
||||
#endif
|
||||
#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE
|
||||
#if KERNEL_VERSION(3, 15, 0) <= CFG80211_VERSION_CODE
|
||||
int woal_cfg80211_start_radar_detection(struct wiphy *wiphy,
|
||||
struct net_device *dev,
|
||||
struct cfg80211_chan_def *chandef,
|
||||
u32 cac_time_ms);
|
||||
#else
|
||||
int woal_cfg80211_start_radar_detection(struct wiphy *wiphy,
|
||||
struct net_device *dev,
|
||||
struct cfg80211_chan_def *chandef);
|
||||
#endif
|
||||
|
||||
int woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_csa_settings *params);
|
||||
|
||||
void woal_cac_timer_func(void *context);
|
||||
void woal_csa_work_queue(struct work_struct *work);
|
||||
#endif
|
||||
#endif /* UAP_CFG80211 */
|
||||
#if defined(UAP_CFG80211) || defined(STA_CFG80211)
|
||||
#if KERNEL_VERSION(3, 5, 0) <= CFG80211_VERSION_CODE
|
||||
void woal_cfg80211_notify_channel(moal_private *priv,
|
||||
pchan_band_info pchan_info);
|
||||
void woal_channel_switch_event(moal_private *priv, chan_band_info *pchan_info);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef STA_CFG80211
|
||||
#if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE
|
||||
void woal_bgscan_stop_event(moal_private *priv);
|
||||
void woal_cfg80211_notify_sched_scan_stop(moal_private *priv);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void woal_deauth_event(moal_private *priv, int reason_code);
|
||||
|
||||
#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE
|
||||
mlan_status woal_chandef_create(moal_private *priv,
|
||||
struct cfg80211_chan_def *chandef,
|
||||
chan_band_info *pchan_info);
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(4, 20, 0) <= CFG80211_VERSION_CODE
|
||||
void woal_cfg80211_setup_he_cap(moal_private *priv,
|
||||
struct ieee80211_supported_band *band);
|
||||
void woal_cfg80211_free_iftype_data(struct wiphy *wiphy);
|
||||
#endif
|
||||
|
||||
void woal_clear_all_mgmt_ies(moal_private *priv, t_u8 wait_option);
|
||||
int woal_cfg80211_mgmt_frame_ie(
|
||||
moal_private *priv, const t_u8 *beacon_ies, size_t beacon_ies_len,
|
||||
const t_u8 *proberesp_ies, size_t proberesp_ies_len,
|
||||
const t_u8 *assocresp_ies, size_t assocresp_ies_len,
|
||||
const t_u8 *probereq_ies, size_t probereq_ies_len, t_u16 mask,
|
||||
t_u8 wait_option);
|
||||
|
||||
int woal_get_active_intf_freq(moal_private *priv);
|
||||
|
||||
void woal_cfg80211_setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info,
|
||||
t_u32 dev_cap, t_u8 *mcs_set);
|
||||
#if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE
|
||||
void woal_cfg80211_setup_vht_cap(moal_private *priv,
|
||||
struct ieee80211_sta_vht_cap *vht_cap);
|
||||
#endif
|
||||
int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option,
|
||||
pmlan_ds_misc_assoc_rsp assoc_rsp);
|
||||
|
||||
#endif /* _MOAL_CFG80211_H_ */
|
4209
mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c
Normal file
4209
mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c
Normal file
File diff suppressed because it is too large
Load diff
781
mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h
Normal file
781
mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h
Normal file
|
@ -0,0 +1,781 @@
|
|||
/** @file moal_cfg80211_util.h
|
||||
*
|
||||
* @brief This file contains the CFG80211 vendor specific defines.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MOAL_CFGVENDOR_H_
|
||||
#define _MOAL_CFGVENDOR_H_
|
||||
|
||||
#include "moal_main.h"
|
||||
|
||||
#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE
|
||||
#define RING_NAME_MAX 32
|
||||
typedef int wifi_ring_buffer_id;
|
||||
|
||||
#define VALID_RING(id) (id >= 0 && id < RING_ID_MAX)
|
||||
|
||||
/** WiFi ring control structure */
|
||||
typedef struct _wifi_ring_ctrl {
|
||||
/** Written bytes */
|
||||
t_u32 written_bytes;
|
||||
/** Read Bytes */
|
||||
t_u32 read_bytes;
|
||||
/** Written records */
|
||||
t_u32 written_records;
|
||||
} ring_buffer_ctrl;
|
||||
|
||||
enum ring_state {
|
||||
/** ring is not initialized*/
|
||||
RING_STOP = 0,
|
||||
/** ring is live and logging*/
|
||||
RING_ACTIVE,
|
||||
/** ring is initialized but not logging*/
|
||||
RING_SUSPEND,
|
||||
};
|
||||
|
||||
/** WiFi ring buffer sttructure */
|
||||
typedef struct _wifi_ring_buffer {
|
||||
/** Ring ID */
|
||||
wifi_ring_buffer_id ring_id;
|
||||
/** Ring name */
|
||||
t_u8 name[RING_NAME_MAX];
|
||||
/** Ring size */
|
||||
t_u32 ring_size;
|
||||
/** Write pointer */
|
||||
t_u32 wp;
|
||||
/** Read pointer */
|
||||
t_u32 rp;
|
||||
/** Log level */
|
||||
t_u32 log_level;
|
||||
/** Threshold */
|
||||
t_u32 threshold;
|
||||
/** Ring buffer */
|
||||
void *ring_buf;
|
||||
/** Lock */
|
||||
spinlock_t lock;
|
||||
/** Buffer control */
|
||||
ring_buffer_ctrl ctrl;
|
||||
/** Ring state */
|
||||
enum ring_state state;
|
||||
/** Delayed work */
|
||||
struct delayed_work work;
|
||||
/** Interval */
|
||||
unsigned long interval;
|
||||
/** Moal priv */
|
||||
moal_private *priv;
|
||||
} wifi_ring_buffer;
|
||||
|
||||
#define VERBOSE_RING_NAME "verbose"
|
||||
#define EVENT_RING_NAME "event"
|
||||
|
||||
#define DEFAULT_RING_BUFFER_SIZE 1024
|
||||
|
||||
#define TLV_LOG_HEADER_LEN 4
|
||||
|
||||
#define WIFI_LOGGER_MEMORY_DUMP_SUPPORTED MBIT(0) /* Memory dump of Fw*/
|
||||
#define WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORT MBIT(1) /*PKT status*/
|
||||
#define WIFI_LOGGER_CONNECT_EVENT_SUPPORTED MBIT(2) /* connectivity event*/
|
||||
#define WIFI_LOGGER_POWER_EVENT_SUPPORTED MBIT(3) /* Power of driver*/
|
||||
#define WIFI_LOGGER_WAKE_LOCK_SUPPORTED MBIT(4) /* Wake lock of driver*/
|
||||
#define WIFI_LOGGER_VERBOSE_SUPPORTED MBIT(5) /*verbose log of Fw*/
|
||||
#define WIFI_LOGGER_WATCHDOG_TIMER_SUPPORTED \
|
||||
MBIT(6) /*monitor the health of Fw*/
|
||||
|
||||
/**
|
||||
* Parameters of wifi logger events are TLVs
|
||||
* Event parameters tags are defined as:
|
||||
*/
|
||||
#define WIFI_TAG_VENDOR_SPECIFIC 0 // take a byte stream as parameter
|
||||
#define WIFI_TAG_BSSID 1 // takes a 6 bytes MAC address as parameter
|
||||
#define WIFI_TAG_ADDR 2 // takes a 6 bytes MAC address as parameter
|
||||
#define WIFI_TAG_SSID 3 // takes a 32 bytes SSID address as parameter
|
||||
#define WIFI_TAG_STATUS 4 // takes an integer as parameter
|
||||
#define WIFI_TAG_REASON_CODE 14 // take a reason code as per 802.11 as parameter
|
||||
#define WIFI_TAG_RSSI 21 // take an integer as parameter
|
||||
#define WIFI_TAG_CHANNEL 22 // take an integer as parameter
|
||||
|
||||
#define RING_ENTRY_SIZE (sizeof(wifi_ring_buffer_entry))
|
||||
#define ENTRY_LENGTH(hdr) (hdr->entry_size + RING_ENTRY_SIZE)
|
||||
#define READ_AVAIL_SPACE(ring) \
|
||||
(ring->ctrl.written_bytes - ring->ctrl.read_bytes)
|
||||
|
||||
enum logger_attributes {
|
||||
ATTR_WIFI_LOGGER_INVALID = 0,
|
||||
ATTR_WIFI_LOGGER_RING_ID,
|
||||
ATTR_WIFI_LOGGER_FLAGS,
|
||||
ATTR_WIFI_LOGGER_VERBOSE_LEVEL,
|
||||
ATTR_WIFI_LOGGER_MIN_DATA_SIZE,
|
||||
ATTR_RING_BUFFER_STATUS,
|
||||
ATTR_NUM_RINGS,
|
||||
ATTR_WIFI_LOGGER_FEATURE_SET,
|
||||
ATTR_WIFI_LOGGER_MAX_INTERVAL_SEC,
|
||||
ATTR_RING_BUFFER,
|
||||
ATTR_NAME,
|
||||
ATTR_MEM_DUMP,
|
||||
ATTR_ERR_CODE,
|
||||
ATTR_RING_DATA,
|
||||
ATTR_WAKE_REASON_STAT,
|
||||
ATTR_PACKET_FATE_TX,
|
||||
ATTR_PACKET_FATE_RX,
|
||||
ATTR_PACKET_FATE_DATA,
|
||||
ATTR_FW_DUMP_PATH = 20,
|
||||
ATTR_DRV_DUMP_PATH = 21,
|
||||
ATTR_WIFI_LOGGER_AFTER_LAST,
|
||||
ATTR_WIFI_LOGGER_MAX = ATTR_WIFI_LOGGER_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/* Below events refer to the wifi_connectivity_event ring and shall be supported
|
||||
*/
|
||||
enum { WIFI_EVENT_ASSOCIATION_REQUESTED = 0,
|
||||
WIFI_EVENT_AUTH_COMPLETE,
|
||||
WIFI_EVENT_ASSOC_COMPLETE,
|
||||
};
|
||||
|
||||
enum {
|
||||
/* set for binary entries */
|
||||
RING_BUFFER_ENTRY_FLAGS_HAS_BINARY = (1 << (0)),
|
||||
/* set if 64 bits timestamp is present */
|
||||
RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP = (1 << (1))
|
||||
};
|
||||
|
||||
enum { ENTRY_TYPE_CONNECT_EVENT = 1,
|
||||
ENTRY_TYPE_PKT,
|
||||
ENTRY_TYPE_WAKE_LOCK,
|
||||
ENTRY_TYPE_POWER_EVENT,
|
||||
ENTRY_TYPE_DATA };
|
||||
|
||||
/** WiFi ring buffer entry structure */
|
||||
typedef struct {
|
||||
/** size of payload excluding the header */
|
||||
t_u16 entry_size;
|
||||
/** Flags */
|
||||
t_u8 flags;
|
||||
/** entry type */
|
||||
t_u8 type;
|
||||
/** present if has_timestamp bit is set. */
|
||||
t_u64 timestamp;
|
||||
} __attribute__((packed)) wifi_ring_buffer_entry;
|
||||
|
||||
/** WiFi ring buffer status structure*/
|
||||
typedef struct _wifi_ring_buffer_status {
|
||||
/** Ring name */
|
||||
t_u8 name[RING_NAME_MAX];
|
||||
/** Flag */
|
||||
t_u32 flag;
|
||||
/** Ring ID */
|
||||
wifi_ring_buffer_id ring_id;
|
||||
/** Buffer size */
|
||||
t_u32 ring_buffer_byte_size;
|
||||
/** Verbose Level */
|
||||
t_u32 verbose_level;
|
||||
/** Written bytes */
|
||||
t_u32 written_bytes;
|
||||
/** Read bytes */
|
||||
t_u32 read_bytes;
|
||||
/** Written records */
|
||||
t_u32 written_records;
|
||||
} wifi_ring_buffer_status;
|
||||
|
||||
/** TLV log structure */
|
||||
typedef struct {
|
||||
/** Tag */
|
||||
u16 tag;
|
||||
/** Length of value*/
|
||||
u16 length;
|
||||
/** Value */
|
||||
u8 value[];
|
||||
} __attribute__((packed)) tlv_log;
|
||||
|
||||
/** WiFi ring buffer driver structure */
|
||||
typedef struct {
|
||||
/** event */
|
||||
u16 event;
|
||||
/** TLV log structure array */
|
||||
tlv_log tlvs[];
|
||||
/** separate parameter structure per event to be provided and optional
|
||||
* data the event_data is expected to include an official android part,
|
||||
* with some parameter as transmit rate, num retries, num scan result
|
||||
* found etc... as well, event_data can include a vendor proprietary
|
||||
* part which is understood by the developer only
|
||||
*/
|
||||
} __attribute__((packed)) wifi_ring_buffer_driver_connectivity_event;
|
||||
|
||||
/** Assoc logger data structure */
|
||||
typedef struct _assoc_logger {
|
||||
/** vendor specific */
|
||||
t_u8 oui[3];
|
||||
/** BSSID */
|
||||
t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
|
||||
/** SSID */
|
||||
t_u8 ssid[MLAN_MAX_SSID_LENGTH];
|
||||
/** RSSI */
|
||||
t_s32 rssi;
|
||||
/** Channel */
|
||||
t_u32 channel;
|
||||
} assoc_logger_data;
|
||||
|
||||
int woal_ring_event_logger(moal_private *priv, int ring_id,
|
||||
pmlan_event pmevent);
|
||||
|
||||
int woal_wake_reason_logger(moal_private *priv,
|
||||
mlan_ds_hs_wakeup_reason wake_reason);
|
||||
|
||||
#define MD5_PREFIX_LEN 4
|
||||
#define MAX_FATE_LOG_LEN 32
|
||||
#define MAX_FRAME_LEN_ETHERNET 1518
|
||||
#define MAX_FRAME_LEN_80211_MGMT 2352
|
||||
|
||||
/** packet_fate_packet_type */
|
||||
typedef enum {
|
||||
PACKET_TYPE_TX,
|
||||
PACKET_TYPE_RX,
|
||||
} packet_fate_packet_type;
|
||||
|
||||
/** packet fate frame_type */
|
||||
typedef enum {
|
||||
FRAME_TYPE_UNKNOWN,
|
||||
FRAME_TYPE_ETHERNET_II,
|
||||
FRAME_TYPE_80211_MGMT,
|
||||
} frame_type;
|
||||
|
||||
/** wifi_tx_packet_fate */
|
||||
typedef enum {
|
||||
/** Sent over air and ACKed. */
|
||||
TX_PKT_FATE_ACKED,
|
||||
|
||||
/** Sent over air but not ACKed. (Normal for broadcast/multicast.) */
|
||||
TX_PKT_FATE_SENT,
|
||||
|
||||
/** Queued within firmware, but not yet sent over air. */
|
||||
TX_PKT_FATE_FW_QUEUED,
|
||||
|
||||
/** Dropped by firmware as invalid. E.g. bad source address, bad
|
||||
* checksum, or invalid for current state.
|
||||
*/
|
||||
TX_PKT_FATE_FW_DROP_INVALID,
|
||||
|
||||
/** Dropped by firmware due to lack of buffer space. */
|
||||
TX_PKT_FATE_FW_DROP_NOBUFS,
|
||||
|
||||
/** Dropped by firmware for any other reason. Includes frames that were
|
||||
* sent by driver to firmware, but unaccounted for by firmware.
|
||||
*/
|
||||
TX_PKT_FATE_FW_DROP_OTHER,
|
||||
|
||||
/** Queued within driver, not yet sent to firmware. */
|
||||
TX_PKT_FATE_DRV_QUEUED,
|
||||
|
||||
/** Dropped by driver as invalid. E.g. bad source address, or invalid
|
||||
* for current state.
|
||||
*/
|
||||
TX_PKT_FATE_DRV_DROP_INVALID,
|
||||
|
||||
/** Dropped by driver due to lack of buffer space. */
|
||||
TX_PKT_FATE_DRV_DROP_NOBUFS,
|
||||
|
||||
/** Dropped by driver for any other reason. */
|
||||
TX_PKT_FATE_DRV_DROP_OTHER,
|
||||
} wifi_tx_packet_fate;
|
||||
|
||||
/** wifi_rx_packet_fate */
|
||||
typedef enum {
|
||||
/** Valid and delivered to network stack (e.g., netif_rx()). */
|
||||
RX_PKT_FATE_SUCCESS,
|
||||
|
||||
/** Queued within firmware, but not yet sent to driver. */
|
||||
RX_PKT_FATE_FW_QUEUED,
|
||||
|
||||
/** Dropped by firmware due to host-programmable filters. */
|
||||
RX_PKT_FATE_FW_DROP_FILTER,
|
||||
|
||||
/** Dropped by firmware as invalid. E.g. bad checksum, decrypt failed,
|
||||
* or invalid for current state.
|
||||
*/
|
||||
RX_PKT_FATE_FW_DROP_INVALID,
|
||||
|
||||
/** Dropped by firmware due to lack of buffer space. */
|
||||
RX_PKT_FATE_FW_DROP_NOBUFS,
|
||||
|
||||
/** Dropped by firmware for any other reason. */
|
||||
RX_PKT_FATE_FW_DROP_OTHER,
|
||||
|
||||
/** Queued within driver, not yet delivered to network stack. */
|
||||
RX_PKT_FATE_DRV_QUEUED,
|
||||
|
||||
/** Dropped by driver due to filter rules. */
|
||||
RX_PKT_FATE_DRV_DROP_FILTER,
|
||||
|
||||
/** Dropped by driver as invalid. E.g. not permitted in current state.
|
||||
*/
|
||||
RX_PKT_FATE_DRV_DROP_INVALID,
|
||||
|
||||
/** Dropped by driver due to lack of buffer space. */
|
||||
RX_PKT_FATE_DRV_DROP_NOBUFS,
|
||||
|
||||
/** Dropped by driver for any other reason. */
|
||||
RX_PKT_FATE_DRV_DROP_OTHER,
|
||||
} wifi_rx_packet_fate;
|
||||
|
||||
/** frame_info_i */
|
||||
typedef struct {
|
||||
/** Payload Type */
|
||||
frame_type payload_type;
|
||||
/** Driver timestamp in uS */
|
||||
u32 driver_timestamp_usec;
|
||||
/** FW timestamp in uS */
|
||||
u32 firmware_timestamp_usec;
|
||||
/** Frame Length */
|
||||
u32 frame_len;
|
||||
} frame_info_i;
|
||||
|
||||
/** wifi_tx_report_i */
|
||||
typedef struct {
|
||||
/** MD5 prefix */
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
/** TX packet fate */
|
||||
wifi_tx_packet_fate fate;
|
||||
/** frame information */
|
||||
frame_info_i frame_inf;
|
||||
} wifi_tx_report_i;
|
||||
|
||||
/** wifi_rx_report_i */
|
||||
typedef struct {
|
||||
/** MD5 prefix */
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
/** TX packet fate */
|
||||
wifi_rx_packet_fate fate;
|
||||
/** frame information */
|
||||
frame_info_i frame_inf;
|
||||
} wifi_rx_report_i;
|
||||
|
||||
/** packet_fate_report_t */
|
||||
typedef struct packet_fate_report_t {
|
||||
union {
|
||||
wifi_tx_report_i tx_report_i;
|
||||
wifi_rx_report_i rx_report_i;
|
||||
} u;
|
||||
} PACKET_FATE_REPORT;
|
||||
|
||||
int woal_packet_fate_monitor(moal_private *priv,
|
||||
packet_fate_packet_type pkt_type, t_u8 fate,
|
||||
frame_type payload_type,
|
||||
t_u32 driver_timestamp_usec,
|
||||
t_u32 firmware_timestamp_usec, t_u8 *data,
|
||||
t_u32 len);
|
||||
|
||||
/** =========== Define Copied from apf.h START =========== */
|
||||
/* Number of memory slots, see ldm/stm instructions. */
|
||||
#define MEM_ITEMS 16
|
||||
/* Upon program execution starting some memory slots are prefilled: */
|
||||
/* 4*([APF_FRAME_HEADER_SIZE]&15) */
|
||||
#define MEM_OFFSET_IPV4_HEADER_SIZE 13
|
||||
/* Size of packet in bytes. */
|
||||
#define MEM_OFFSET_PKT_SIZE 14
|
||||
/* Age since filter installed in seconds. */
|
||||
#define MEM_OFFSET_FILTER_AGE 15
|
||||
|
||||
/* Leave 0 opcode unused as it's a good indicator of accidental incorrect
|
||||
* execution (e.g. data).
|
||||
*/
|
||||
/* Load 1 byte from immediate offset, e.g. "ldb R0, [5]" */
|
||||
#define NXP_LDB_OPCODE 1
|
||||
/* Load 2 bytes from immediate offset, e.g. "ldh R0, [5]" */
|
||||
#define NXP_LDH_OPCODE 2
|
||||
/* Load 4 bytes from immediate offset, e.g. "ldw R0, [5]" */
|
||||
#define NXP_LDW_OPCODE 3
|
||||
/* Load 1 byte from immediate offset plus register, e.g. "ldbx R0, [5]R0" */
|
||||
#define NXP_LDBX_OPCODE 4
|
||||
/* Load 2 byte from immediate offset plus register, e.g. "ldhx R0, [5]R0" */
|
||||
#define NXP_LDHX_OPCODE 5
|
||||
/* Load 4 byte from immediate offset plus register, e.g. "ldwx R0, [5]R0" */
|
||||
#define NXP_LDWX_OPCODE 6
|
||||
/* Add, e.g. "add R0,5" */
|
||||
#define NXP_ADD_OPCODE 7
|
||||
/* Multiply, e.g. "mul R0,5" */
|
||||
#define NXP_MUL_OPCODE 8
|
||||
/* Divide, e.g. "div R0,5" */
|
||||
#define NXP_DIV_OPCODE 9
|
||||
/* And, e.g. "and R0,5" */
|
||||
#define NXP_AND_OPCODE 10
|
||||
/* Or, e.g. "or R0,5" */
|
||||
#define NXP_OR_OPCODE 11
|
||||
/* Left shift, e.g, "sh R0, 5" or "sh R0, -5" (shifts right) */
|
||||
#define NXP_SH_OPCODE 12
|
||||
/* Load immediate, e.g. "li R0,5" (immediate encoded as signed value) */
|
||||
#define NXP_LI_OPCODE 13
|
||||
/* Unconditional jump, e.g. "jmp label" */
|
||||
#define NXP_JMP_OPCODE 14
|
||||
/* Compare equal and branch, e.g. "jeq R0,5,label" */
|
||||
#define NXP_JEQ_OPCODE 15
|
||||
/* Compare not equal and branch, e.g. "jne R0,5,label" */
|
||||
#define NXP_JNE_OPCODE 16
|
||||
/* Compare greater than and branch, e.g. "jgt R0,5,label" */
|
||||
#define NXP_JGT_OPCODE 17
|
||||
/* Compare less than and branch, e.g. "jlt R0,5,label" */
|
||||
#define NXP_JLT_OPCODE 18
|
||||
/* Compare any bits set and branch, e.g. "jset R0,5,label" */
|
||||
#define NXP_JSET_OPCODE 19
|
||||
/* Compare not equal byte sequence, e.g. "jnebs R0,5,label,0x1122334455" */
|
||||
#define NXP_JNEBS_OPCODE 20
|
||||
/* Immediate value is one of *_EXT_OPCODE
|
||||
* Extended opcodes. These all have an opcode of EXT_OPCODE
|
||||
* and specify the actual opcode in the immediate field.
|
||||
*/
|
||||
#define NXP_EXT_OPCODE 21
|
||||
/* Load from memory, e.g. "ldm R0,5"
|
||||
* Values 0-15 represent loading the different memory slots.
|
||||
*/
|
||||
#define NXP_LDM_EXT_OPCODE 0
|
||||
/* Store to memory, e.g. "stm R0,5" *
|
||||
* Values 16-31 represent storing to the different memory slots.
|
||||
*/
|
||||
#define NXP_STM_EXT_OPCODE 16
|
||||
/* Not, e.g. "not R0" */
|
||||
#define NXP_NOT_EXT_OPCODE 32
|
||||
/* Negate, e.g. "neg R0" */
|
||||
#define NXP_NEG_EXT_OPCODE 33
|
||||
/* Swap, e.g. "swap R0,R1" */
|
||||
#define NXP_SWAP_EXT_OPCODE 34
|
||||
/* Move, e.g. "move R0,R1" */
|
||||
#define NXP_MOV_EXT_OPCODE 35
|
||||
|
||||
#define GET_OPCODE(i) (((i) >> 3) & 31)
|
||||
#define GET_REGISTER(i) ((i)&1)
|
||||
#define GET_IMM_LENGTH(i) (((i) >> 1) & 3)
|
||||
/** =========== Define Copied from apf.h END =========== */
|
||||
|
||||
/** =========== Define Copied from apf_interpreter.h START =========== */
|
||||
/**
|
||||
* Version of APF instruction set processed by accept_packet().
|
||||
* Should be returned by wifi_get_packet_filter_info.
|
||||
*/
|
||||
#define APF_VERSION 2
|
||||
/** =========== Define Copied from apf_interpreter.h END =========== */
|
||||
|
||||
/** =========== Define Copied from apf_interpreter.c START =========== */
|
||||
/* Return code indicating "packet" should accepted. */
|
||||
#define PASS_PKT 1
|
||||
/* Return code indicating "packet" should be dropped. */
|
||||
#define DROP_PKT 0
|
||||
/* If "c" is of an unsigned type, generate a compile warning that gets promoted
|
||||
* to an error. This makes bounds checking simpler because ">= 0" can be
|
||||
* avoided. Otherwise adding superfluous ">= 0" with unsigned expressions
|
||||
* generates compile warnings.
|
||||
*/
|
||||
#define ENFORCE_UNSIGNED(c) ((c) == (uint32_t)(c))
|
||||
/** =========== Define Copied from apf_interpreter.c END =========== */
|
||||
|
||||
/** depend on the format of skb->data */
|
||||
#define APF_FRAME_HEADER_SIZE 14
|
||||
#define PACKET_FILTER_MAX_LEN 1024
|
||||
|
||||
enum { PACKET_FILTER_STATE_INIT = 0,
|
||||
PACKET_FILTER_STATE_STOP,
|
||||
PACKET_FILTER_STATE_START,
|
||||
};
|
||||
|
||||
enum wifi_attr_packet_filter {
|
||||
ATTR_PACKET_FILTER_INVALID = 0,
|
||||
ATTR_PACKET_FILTER_TOTAL_LENGTH,
|
||||
ATTR_PACKET_FILTER_PROGRAM,
|
||||
ATTR_PACKET_FILTER_VERSION,
|
||||
ATTR_PACKET_FILTER_MAX_LEN,
|
||||
ATTR_PACKET_FILTER_AFTER_LAST,
|
||||
ATTR_PACKET_FILTER_MAX = ATTR_PACKET_FILTER_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/** Packet filter structure */
|
||||
typedef struct _packet_filter {
|
||||
spinlock_t lock;
|
||||
t_u8 state;
|
||||
t_u8 packet_filter_program[PACKET_FILTER_MAX_LEN];
|
||||
t_u8 packet_filter_len;
|
||||
t_u32 packet_filter_version;
|
||||
t_u32 packet_filter_max_len;
|
||||
} packet_filter;
|
||||
|
||||
int woal_filter_packet(moal_private *priv, t_u8 *data, t_u32 len,
|
||||
t_u32 filter_age);
|
||||
|
||||
int woal_init_wifi_hal(moal_private *priv);
|
||||
int woal_deinit_wifi_hal(moal_private *priv);
|
||||
|
||||
#define ATTRIBUTE_U32_LEN (nla_total_size(NLA_HDRLEN + 4))
|
||||
#define VENDOR_ID_OVERHEAD ATTRIBUTE_U32_LEN
|
||||
#define VENDOR_SUBCMD_OVERHEAD ATTRIBUTE_U32_LEN
|
||||
#define VENDOR_DATA_OVERHEAD (nla_total_size(NLA_HDRLEN))
|
||||
|
||||
#define VENDOR_REPLY_OVERHEAD \
|
||||
(VENDOR_ID_OVERHEAD + VENDOR_SUBCMD_OVERHEAD + VENDOR_DATA_OVERHEAD)
|
||||
|
||||
/* Features Enums*/
|
||||
#define WLAN_FEATURE_INFRA 0x0001 // Basic infrastructure mode support
|
||||
#define WLAN_FEATURE_INFRA_5G 0x0002 // 5 GHz Band support
|
||||
#define WLAN_FEATURE_HOTSPOT 0x0004 // GAS/ANQP support
|
||||
#define WLAN_FEATURE_P2P 0x0008 // Wifi-Direct/P2P
|
||||
#define WLAN_FEATURE_SOFT_AP 0x0010 // Soft AP support
|
||||
#define WLAN_FEATURE_GSCAN 0x0020 // Google-Scan APIsi support
|
||||
#define WLAN_FEATURE_NAN 0x0040 // Neighbor Awareness Networking (NAN)
|
||||
#define WLAN_FEATURE_D2D_RTT 0x0080 // Device-to-device RTT support
|
||||
#define WLAN_FEATURE_D2AP_RTT 0x0100 // Device-to-AP RTT support
|
||||
#define WLAN_FEATURE_BATCH_SCAN 0x0200 // Batched Scan (legacy) support
|
||||
#define WLAN_FEATURE_PNO 0x0400 // Preferred network offload support
|
||||
#define WLAN_FEATURE_ADDITIONAL_STA 0x0800 // Two STAs support
|
||||
#define WLAN_FEATURE_TDLS 0x1000 // Tunnel directed link setup (TDLS)
|
||||
#define WLAN_FEATURE_TDLS_OFFCHANNEL 0x2000 // TDLS off channel support
|
||||
#define WLAN_FEATURE_EPR 0x4000 // Enhanced power reporting support
|
||||
#define WLAN_FEATURE_AP_STA 0x8000 // AP STA Concurrency support
|
||||
#define WLAN_FEATURE_LINK_LAYER_STATS \
|
||||
0x10000 // Link layer stats collection support
|
||||
#define WLAN_FEATURE_LOGGER 0x20000 // WiFi Logger support
|
||||
#define WLAN_FEATURE_HAL_EPNO 0x40000 // WiFi enhanced PNO support
|
||||
#define WLAN_FEATURE_RSSI_MONITOR 0x80000 // RSSI Monitor support
|
||||
#define WLAN_FEATURE_MKEEP_ALIVE 0x100000 // WiFi mkeep_alive support
|
||||
#define WLAN_FEATURE_CONFIG_NDO 0x200000 // ND offload configure support
|
||||
#define WLAN_FEATURE_TX_TRANSMIT_POWER \
|
||||
0x400000 // Capture Tx transmit power levels
|
||||
#define WLAN_FEATURE_CONTROL_ROAMING 0x800000 // Enable/Disable firmware roaming
|
||||
#define WLAN_FEATURE_IE_WHITELIST 0x1000000 // Probe IE white listing support
|
||||
#define WLAN_FEATURE_SCAN_RAND \
|
||||
0x2000000 // MAC & Probe Sequence Number randomization Support
|
||||
// Add more features here
|
||||
|
||||
#define MAX_CHANNEL_NUM 200
|
||||
|
||||
/** Wifi Band */
|
||||
typedef enum {
|
||||
WIFI_BAND_UNSPECIFIED,
|
||||
/** 2.4 GHz */
|
||||
WIFI_BAND_BG = 1,
|
||||
/** 5 GHz without DFS */
|
||||
WIFI_BAND_A = 2,
|
||||
/** 5 GHz DFS only */
|
||||
WIFI_BAND_A_DFS = 4,
|
||||
/** 5 GHz with DFS */
|
||||
WIFI_BAND_A_WITH_DFS = 6,
|
||||
/** 2.4 GHz + 5 GHz; no DFS */
|
||||
WIFI_BAND_ABG = 3,
|
||||
/** 2.4 GHz + 5 GHz with DFS */
|
||||
WIFI_BAND_ABG_WITH_DFS = 7,
|
||||
|
||||
/** Keep it last */
|
||||
WIFI_BAND_LAST,
|
||||
WIFI_BAND_MAX = WIFI_BAND_LAST - 1,
|
||||
} wifi_band;
|
||||
|
||||
typedef enum wifi_attr {
|
||||
ATTR_FEATURE_SET_INVALID = 0,
|
||||
ATTR_SCAN_MAC_OUI_SET = 1,
|
||||
ATTR_FEATURE_SET = 2,
|
||||
ATTR_NODFS_VALUE = 3,
|
||||
ATTR_COUNTRY_CODE = 4,
|
||||
ATTR_CHANNELS_BAND = 5,
|
||||
ATTR_NUM_CHANNELS = 6,
|
||||
ATTR_CHANNEL_LIST = 7,
|
||||
ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE_MAX = 8,
|
||||
ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE = 9,
|
||||
ATTR_GET_CONCURRENCY_MATRIX_SET = 10,
|
||||
ATTR_WIFI_AFTER_LAST,
|
||||
ATTR_WIFI_MAX = ATTR_WIFI_AFTER_LAST - 1
|
||||
} wifi_attr_t;
|
||||
|
||||
enum mrvl_wlan_vendor_attr_wifi_logger {
|
||||
MRVL_WLAN_VENDOR_ATTR_NAME = 10,
|
||||
};
|
||||
|
||||
/**vendor event*/
|
||||
enum vendor_event {
|
||||
event_hang = 0,
|
||||
event_rssi_monitor = 0x1501,
|
||||
event_cloud_keep_alive = 0x10003,
|
||||
event_dfs_radar_detected = 0x10004,
|
||||
event_dfs_cac_started = 0x10005,
|
||||
event_dfs_cac_finished = 0x10006,
|
||||
event_dfs_cac_aborted = 0x10007,
|
||||
event_dfs_nop_finished = 0x10008,
|
||||
event_wifi_logger_ring_buffer_data = 0x1000b,
|
||||
event_wifi_logger_alert,
|
||||
event_packet_fate_monitor,
|
||||
event_wake_reason_report,
|
||||
event_max,
|
||||
};
|
||||
|
||||
/** struct dfs_event */
|
||||
typedef struct _dfs_event {
|
||||
/** Frequency */
|
||||
int freq;
|
||||
/** HT enable */
|
||||
int ht_enabled;
|
||||
/** Channel Offset */
|
||||
int chan_offset;
|
||||
/** Channel width */
|
||||
enum nl80211_chan_width chan_width;
|
||||
/** Center Frequency 1 */
|
||||
int cf1;
|
||||
/** Center Frequency 2 */
|
||||
int cf2;
|
||||
} dfs_event;
|
||||
|
||||
void woal_cfg80211_dfs_vendor_event(moal_private *priv, int event,
|
||||
struct cfg80211_chan_def *chandef);
|
||||
|
||||
enum ATTR_LINK_LAYER_STAT {
|
||||
ATTR_LL_STATS_INVALID,
|
||||
ATTR_LL_STATS_MPDU_SIZE_THRESHOLD,
|
||||
ATTR_LL_STATS_AGGRESSIVE_STATS_GATHERING,
|
||||
ATTR_LL_STATS_IFACE,
|
||||
ATTR_LL_STATS_NUM_RADIO,
|
||||
ATTR_LL_STATS_RADIO,
|
||||
ATTR_LL_STATS_CLEAR_REQ_MASK,
|
||||
ATTR_LL_STATS_STOP_REQ,
|
||||
ATTR_LL_STATS_CLEAR_RSP_MASK,
|
||||
ATTR_LL_STATS_STOP_RSP,
|
||||
ATTR_LL_STATS_AFTER_LAST,
|
||||
ATTR_LL_STATS_MAX = ATTR_LL_STATS_AFTER_LAST - 1,
|
||||
};
|
||||
|
||||
enum ATTR_RSSI_MONITOR {
|
||||
ATTR_RSSI_MONITOR_INVALID,
|
||||
ATTR_RSSI_MONITOR_CONTROL,
|
||||
ATTR_RSSI_MONITOR_MIN_RSSI,
|
||||
ATTR_RSSI_MONITOR_MAX_RSSI,
|
||||
ATTR_RSSI_MONITOR_CUR_BSSID,
|
||||
ATTR_RSSI_MONITOR_CUR_RSSI,
|
||||
ATTR_RSSI_MONITOR_AFTER_LAST,
|
||||
ATTR_RSSI_MONITOR_MAX = ATTR_RSSI_MONITOR_AFTER_LAST - 1,
|
||||
};
|
||||
void woal_cfg80211_rssi_monitor_event(moal_private *priv, t_s16 rssi);
|
||||
|
||||
/**vendor sub command*/
|
||||
enum vendor_sub_command {
|
||||
sub_cmd_set_drvdbg = 0,
|
||||
sub_cmd_start_keep_alive = 0x0003,
|
||||
sub_cmd_stop_keep_alive = 0x0004,
|
||||
sub_cmd_dfs_capability = 0x0005,
|
||||
sub_cmd_set_scan_mac_oui = 0x0007,
|
||||
sub_cmd_set_packet_filter = 0x0011,
|
||||
sub_cmd_get_packet_filter_capability,
|
||||
sub_cmd_nd_offload = 0x0100,
|
||||
sub_cmd_link_statistic_set = 0x1200,
|
||||
sub_cmd_link_statistic_get = 0x1201,
|
||||
sub_cmd_link_statistic_clr = 0x1202,
|
||||
sub_cmd_get_valid_channels = 0x1009,
|
||||
sub_cmd_get_wifi_supp_feature_set = 0x100a,
|
||||
sub_cmd_set_country_code = 0x100d,
|
||||
sub_cmd_get_fw_version = 0x1404,
|
||||
sub_cmd_get_drv_version = 0x1406,
|
||||
sub_cmd_start_logging = 0x1400,
|
||||
sub_cmd_get_wifi_logger_supp_feature_set,
|
||||
sub_cmd_get_ring_buff_data,
|
||||
sub_cmd_get_ring_buff_status,
|
||||
sub_cmd_get_fw_mem_dump = 0x1405,
|
||||
sub_cmd_get_drv_mem_dump = 0x1407,
|
||||
sub_cmd_start_packet_fate_monitor = 0x1408,
|
||||
sub_cmd_rssi_monitor = 0x1500,
|
||||
/*Sub-command for wifi hal*/
|
||||
sub_cmd_get_roaming_capability = 0x1700,
|
||||
sub_cmd_fw_roaming_enable = 0x1701,
|
||||
sub_cmd_fw_roaming_config = 0x1702,
|
||||
sub_cmd_max,
|
||||
};
|
||||
|
||||
void woal_register_cfg80211_vendor_command(struct wiphy *wiphy);
|
||||
int woal_cfg80211_vendor_event(moal_private *priv, int event, t_u8 *data,
|
||||
int len);
|
||||
|
||||
enum mrvl_wlan_vendor_attr {
|
||||
MRVL_WLAN_VENDOR_ATTR_INVALID = 0,
|
||||
/* Used by MRVL_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY */
|
||||
MRVL_WLAN_VENDOR_ATTR_DFS = 1,
|
||||
MRVL_WLAN_VENDOR_ATTR_AFTER_LAST,
|
||||
|
||||
MRVL_WLAN_VENDOR_ATTR_MAX = MRVL_WLAN_VENDOR_ATTR_AFTER_LAST - 1,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
ATTR_ND_OFFLOAD_INVALID = 0,
|
||||
ATTR_ND_OFFLOAD_CONTROL,
|
||||
ATTR_ND_OFFLOAD_AFTER_LAST,
|
||||
ATTR_ND_OFFLOAD_MAX = ATTR_ND_OFFLOAD_AFTER_LAST - 1,
|
||||
} ND_OFFLOAD_ATTR;
|
||||
|
||||
#define MKEEP_ALIVE_IP_PKT_MAX 256
|
||||
enum mkeep_alive_attributes {
|
||||
MKEEP_ALIVE_ATTRIBUTE_INVALID = 0,
|
||||
MKEEP_ALIVE_ATTRIBUTE_ID,
|
||||
MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE,
|
||||
MKEEP_ALIVE_ATTRIBUTE_IP_PKT,
|
||||
MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN,
|
||||
MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR,
|
||||
MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR,
|
||||
MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC,
|
||||
MKEEP_ALIVE_ATTRIBUTE_RETRY_INTERVAL,
|
||||
MKEEP_ALIVE_ATTRIBUTE_RETRY_CNT,
|
||||
MKEEP_ALIVE_ATTRIBUTE_AFTER_LAST,
|
||||
MKEEP_ALIVE_ATTRIBUTE_MAX = MKEEP_ALIVE_ATTRIBUTE_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/** WiFi roaming capabilities structure */
|
||||
typedef struct {
|
||||
/** max blacklist size */
|
||||
u32 max_blacklist_size;
|
||||
/** max whitelist size */
|
||||
u32 max_whitelist_size;
|
||||
} wifi_roaming_capabilities;
|
||||
|
||||
/** WiFi BSSID params structure */
|
||||
typedef struct {
|
||||
/** Num of BSSID */
|
||||
u32 num_bssid;
|
||||
/** List of AP mac address */
|
||||
t_u8 mac_addr[MAX_AP_LIST][MLAN_MAC_ADDR_LENGTH];
|
||||
} wifi_bssid_params;
|
||||
|
||||
/** SSID structure */
|
||||
typedef struct {
|
||||
/** Length */
|
||||
u32 length;
|
||||
/** SSID */
|
||||
char ssid[MLAN_MAX_SSID_LENGTH];
|
||||
} ssid_t;
|
||||
|
||||
/** WiFi SSID params structure */
|
||||
typedef struct {
|
||||
/** No of SSID */
|
||||
u32 num_ssid;
|
||||
/** Whitelist SSID */
|
||||
ssid_t whitelist_ssid[MAX_SSID_NUM];
|
||||
} wifi_ssid_params;
|
||||
|
||||
/*Attribute for wifi hal*/
|
||||
enum mrvl_wlan_vendor_attr_fw_roaming {
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_INVALID = 0,
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CAPA,
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONTROL,
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_BSSID,
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_CONFIG_SSID,
|
||||
/* keep last */
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_AFTER_LAST,
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_MAX =
|
||||
MRVL_WLAN_VENDOR_ATTR_FW_ROAMING_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* _MOAL_CFGVENDOR_H_ */
|
1468
mxm_wifiex/wlan_src/mlinux/moal_debug.c
Normal file
1468
mxm_wifiex/wlan_src/mlinux/moal_debug.c
Normal file
File diff suppressed because it is too large
Load diff
16895
mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c
Normal file
16895
mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
675
mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h
Normal file
675
mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h
Normal file
|
@ -0,0 +1,675 @@
|
|||
|
||||
/** @file moal_eth_ioctl.h
|
||||
*
|
||||
* @brief This file contains definition for private IOCTL call.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
01/05/2012: initial version
|
||||
********************************************************/
|
||||
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
|
||||
#include "moal_cfg80211.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WOAL_ETH_PRIV_H_
|
||||
#define _WOAL_ETH_PRIV_H_
|
||||
|
||||
/** Command disabled */
|
||||
#define CMD_DISABLED 0
|
||||
/** Command enabled */
|
||||
#define CMD_ENABLED 1
|
||||
/** Command get */
|
||||
#define CMD_GET 2
|
||||
|
||||
/** 2K bytes */
|
||||
#define WOAL_2K_BYTES 2000
|
||||
|
||||
/** NXP private command identifier string */
|
||||
#define CMD_NXP "MRVL_CMD"
|
||||
|
||||
/** Private command: Version */
|
||||
#define PRIV_CMD_VERSION "version"
|
||||
/** Private command: Band cfg */
|
||||
#define PRIV_CMD_BANDCFG "bandcfg"
|
||||
/** Private command: Host cmd */
|
||||
#define PRIV_CMD_HOSTCMD "hostcmd"
|
||||
/** Private command: Custom IE config*/
|
||||
#define PRIV_CMD_CUSTOMIE "customie"
|
||||
/** Private command: HT Tx Cfg */
|
||||
#define PRIV_CMD_HTTXCFG "httxcfg"
|
||||
/** Private command: HT Cap Info */
|
||||
#define PRIV_CMD_HTCAPINFO "htcapinfo"
|
||||
/** Private command: Add BA para */
|
||||
#define PRIV_CMD_ADDBAPARA "addbapara"
|
||||
/** Private command: Aggragation priority table */
|
||||
#define PRIV_CMD_AGGRPRIOTBL "aggrpriotbl"
|
||||
/** Private command: Add BA reject cfg */
|
||||
#define PRIV_CMD_ADDBAREJECT "addbareject"
|
||||
/** Private command: Delete BA */
|
||||
#define PRIV_CMD_DELBA "delba"
|
||||
/** Private command: Reject Addba Req */
|
||||
#define PRIV_CMD_REJECTADDBAREQ "rejectaddbareq"
|
||||
/** Private command: 11AC Cfg */
|
||||
#define PRIV_CMD_VHTCFG "vhtcfg"
|
||||
/** Private command: 11AC Oper Mode Cfg */
|
||||
#define PRIV_CMD_OPERMODECFG "opermodecfg"
|
||||
#define PRIV_CMD_DATARATE "getdatarate"
|
||||
#define PRIV_CMD_TXRATECFG "txratecfg"
|
||||
#define PRIV_CMD_GETLOG "getlog"
|
||||
#define PRIV_CMD_ESUPPMODE "esuppmode"
|
||||
#define PRIV_CMD_PASSPHRASE "passphrase"
|
||||
#define PRIV_CMD_DEAUTH "deauth"
|
||||
#ifdef UAP_SUPPORT
|
||||
#define PRIV_CMD_AP_DEAUTH "apdeauth"
|
||||
#define PRIV_CMD_GET_STA_LIST "getstalist"
|
||||
#define PRIV_CMD_BSS_CONFIG "bssconfig"
|
||||
#endif
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
#define PRIV_CMD_BSSROLE "bssrole"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef STA_SUPPORT
|
||||
#define PRIV_CMD_GETSCANTABLE "getscantable"
|
||||
#define PRIV_CMD_GETCHANSTATS "getchanstats"
|
||||
typedef struct _chan_stats {
|
||||
/** Number of records in the chan_stats */
|
||||
t_u32 num_in_chan_stats;
|
||||
/** channel statistics */
|
||||
ChanStatistics_t stats[];
|
||||
} chan_stats;
|
||||
#define PRIV_CMD_SETUSERSCAN "setuserscan"
|
||||
#define PRIV_CMD_EXTCAPCFG "extcapcfg"
|
||||
#define PRIV_CMD_CANCELSCAN "cancelscan"
|
||||
#endif
|
||||
#define PRIV_CMD_DEEPSLEEP "deepsleep"
|
||||
#define PRIV_CMD_IPADDR "ipaddr"
|
||||
#define PRIV_CMD_WPSSESSION "wpssession"
|
||||
#define PRIV_CMD_OTPUSERDATA "otpuserdata"
|
||||
#define PRIV_CMD_COUNTRYCODE "countrycode"
|
||||
#define PRIV_CMD_TCPACKENH "tcpackenh"
|
||||
#ifdef REASSOCIATION
|
||||
#define PRIV_CMD_ASSOCESSID "assocessid"
|
||||
#define PRIV_CMD_ASSOCBSSID "assocessid_bssid"
|
||||
#endif
|
||||
#define PRIV_CMD_WAKEUPREASON "wakeupreason"
|
||||
#ifdef STA_SUPPORT
|
||||
#define PRIV_CMD_LISTENINTERVAL "listeninterval"
|
||||
#endif
|
||||
#ifdef DEBUG_LEVEL1
|
||||
#define PRIV_CMD_DRVDBG "drvdbg"
|
||||
#endif
|
||||
#define PRIV_CMD_HSCFG "hscfg"
|
||||
#define PRIV_CMD_HSSETPARA "hssetpara"
|
||||
#define PRIV_CMD_MGMT_FILTER "mgmtfilter"
|
||||
#define PRIV_CMD_SCANCFG "scancfg"
|
||||
#define PRIV_CMD_GETNLNUM "getnlnum"
|
||||
#define PRIV_CMD_AGGRCTRL "aggrctrl"
|
||||
#ifdef USB
|
||||
#define PRIV_CMD_USBAGGRCTRL "usbaggrctrl"
|
||||
#endif
|
||||
#define PRIV_CMD_SET_BSS_MODE "setbssmode"
|
||||
#ifdef STA_SUPPORT
|
||||
#define PRIV_CMD_SET_AP "setap"
|
||||
#define PRIV_CMD_SET_POWER "setpower"
|
||||
#define PRIV_CMD_SET_ESSID "setessid"
|
||||
#define PRIV_CMD_SET_AUTH "setauth"
|
||||
#define PRIV_CMD_GET_AP "getap"
|
||||
#define PRIV_CMD_GET_POWER "getpower"
|
||||
#define PRIV_CMD_PSMODE "psmode"
|
||||
#endif
|
||||
#define PRIV_CMD_WARMRESET "warmreset"
|
||||
#define PRIV_CMD_TXPOWERCFG "txpowercfg"
|
||||
#define PRIV_CMD_PSCFG "pscfg"
|
||||
#define PRIV_CMD_BCNTIMEOUTCFG "bcntimeoutcfg"
|
||||
#define PRIV_CMD_SLEEPPD "sleeppd"
|
||||
#define PRIV_CMD_TXCONTROL "txcontrol"
|
||||
#define PRIV_CMD_REGRDWR "regrdwr"
|
||||
#define PRIV_CMD_RDEEPROM "rdeeprom"
|
||||
#define PRIV_CMD_MEMRDWR "memrdwr"
|
||||
#ifdef SDIO
|
||||
#define PRIV_CMD_SDCMD52RW "sdcmd52rw"
|
||||
#endif
|
||||
#define PRIV_CMD_HOTSPOTCFG "hotspotcfg"
|
||||
#define PRIV_CMD_MGMT_FRAME_CTRL "mgmtframectrl"
|
||||
#define PRIV_CMD_QCONFIG "qconfig"
|
||||
#define PRIV_CMD_ADDTS "addts"
|
||||
#define PRIV_CMD_DELTS "delts"
|
||||
#define PRIV_CMD_QSTATUS "qstatus"
|
||||
#define PRIV_CMD_TS_STATUS "ts_status"
|
||||
#define PRIV_CMD_QOS_CFG "qoscfg"
|
||||
#define PRIV_CMD_MAC_CTRL "macctrl"
|
||||
#define PRIV_CMD_GETWAP "getwap"
|
||||
#define PRIV_CMD_REGION_CODE "regioncode"
|
||||
#define PRIV_CMD_CFPINFO "cfpinfo"
|
||||
#define PRIV_CMD_FWMACADDR "fwmacaddr"
|
||||
#define PRIV_CMD_OFFCHANNEL "offchannel"
|
||||
#define PRIV_CMD_DSCP_MAP "dscpmap"
|
||||
/** Private command: Verext */
|
||||
#define PRIV_CMD_VEREXT "verext"
|
||||
#ifdef CONFIG_USB_SUSPEND
|
||||
#define PRIV_CMD_USB_SUSPEND "usbsuspend"
|
||||
#define PRIV_CMD_USB_RESUME "usbresume"
|
||||
#endif /* CONFIG_USB_SUSPEND */
|
||||
#if defined(STA_SUPPORT) && defined(STA_WEXT)
|
||||
#define PRIV_CMD_RADIO_CTRL "radioctrl"
|
||||
#endif
|
||||
#define PRIV_CMD_WMM_CFG "wmmcfg"
|
||||
#define PRIV_CMD_MIN_BA_THRESH_CFG "min_ba_threshold"
|
||||
#if defined(STA_SUPPORT)
|
||||
#define PRIV_CMD_11D_CFG "11dcfg"
|
||||
#define PRIV_CMD_11D_CLR_TBL "11dclrtbl"
|
||||
#endif
|
||||
#ifndef OPCHAN
|
||||
#define PRIV_CMD_WWS_CFG "wwscfg"
|
||||
#endif
|
||||
#if defined(REASSOCIATION)
|
||||
#define PRIV_CMD_REASSOCTRL "reassoctrl"
|
||||
#endif
|
||||
#define PRIV_CMD_TXBUF_CFG "txbufcfg"
|
||||
#ifdef STA_SUPPORT
|
||||
#define PRIV_CMD_AUTH_TYPE "authtype"
|
||||
#endif
|
||||
#define PRIV_CMD_POWER_CONS "powercons"
|
||||
#define PRIV_CMD_HT_STREAM_CFG "htstreamcfg"
|
||||
#define PRIV_CMD_MIMO_SWITCH "mimoswitch"
|
||||
#define PRIV_CMD_THERMAL "thermal"
|
||||
#define PRIV_CMD_BCN_INTERVAL "bcninterval"
|
||||
#ifdef STA_SUPPORT
|
||||
#define PRIV_CMD_GET_SIGNAL "getsignal"
|
||||
#define PRIV_CMD_SIGNALEXT_CFG "signalextcfg"
|
||||
#define PRIV_CMD_GET_SIGNAL_EXT_V2 "getsignalextv2"
|
||||
#define PRIV_CMD_GET_SIGNAL_EXT "getsignalext"
|
||||
#endif
|
||||
#if defined(STA_SUPPORT)
|
||||
#define PRIV_CMD_PMFCFG "pmfcfg"
|
||||
#endif
|
||||
#define PRIV_CMD_INACTIVITYTO "inactivityto"
|
||||
#define PRIV_CMD_AMSDU_AGGR_CTRL "amsduaggrctrl"
|
||||
#define PRIV_CMD_TX_BF_CAP "httxbfcap"
|
||||
#ifdef SDIO
|
||||
#define PRIV_CMD_SDIO_CLOCK "sdioclock"
|
||||
#endif
|
||||
#ifdef SDIO
|
||||
#define PRIV_CMD_MPA_CTRL "mpactrl"
|
||||
#endif
|
||||
#define PRIV_CMD_SLEEP_PARAMS "sleepparams"
|
||||
#define PRIV_CMD_DFS_TESTING "dfstesting"
|
||||
#define PRIV_CMD_DFS53_CFG "dfs53cfg"
|
||||
#define PRIV_CMD_CFP_CODE "cfpcode"
|
||||
#define PRIV_CMD_CWMODE "cwmode"
|
||||
#define PRIV_CMD_ANT_CFG "antcfg"
|
||||
#define PRIV_CMD_SYSCLOCK "sysclock"
|
||||
#define PRIV_CMD_GET_KEY "getkey"
|
||||
#define PRIV_CMD_ASSOCIATE "associate"
|
||||
#define PRIV_CMD_TX_BF_CFG "httxbfcfg"
|
||||
#define PRIV_CMD_PORT_CTRL "port_ctrl"
|
||||
#define PRIV_CMD_PB_BYPASS "pb_bypass"
|
||||
#ifdef SDIO
|
||||
#define PRIV_CMD_SD_CMD53_RW "sdcmd53rw"
|
||||
#endif
|
||||
#ifdef RX_PACKET_COALESCE
|
||||
#define PRIV_CMD_RX_COAL_CFG "rxpktcoal_cfg"
|
||||
#endif
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(UAP_CFG80211)
|
||||
#define PRIV_CMD_CFG_NOA "cfg_noa"
|
||||
#define PRIV_CMD_CFG_OPP_PS "cfg_opp_ps"
|
||||
#endif
|
||||
#endif
|
||||
#define PRIV_CMD_DFS_REPEATER_CFG "dfs_repeater"
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
|
||||
#define PRIV_CMD_MIRACAST_CFG "miracastcfg"
|
||||
#endif
|
||||
#endif
|
||||
#define PRIV_CMD_COEX_RX_WINSIZE "coex_rx_winsize"
|
||||
|
||||
#ifdef PCIE
|
||||
#define PRIV_CMD_PCIE_REG_RW "pcieregrw"
|
||||
#define PRIV_CMD_PCIE_BAR0_REG_RW "pciebar0regrw"
|
||||
#endif
|
||||
|
||||
#define PRIV_CMD_GET_SENSOR_TEMP "get_sensor_temp"
|
||||
|
||||
#define PRIV_CMD_GET_CHNRGPWR "get_chnrgpwr"
|
||||
#define PRIV_CMD_GET_TXPWR_LIMIT "get_txpwrlimit"
|
||||
#define PRIV_CMD_GET_CFG_CHAN_LIST "getcfgchanlist"
|
||||
#if defined(UAP_SUPPORT)
|
||||
#define PRIV_CMD_EXTEND_CHAN_SWITCH "channel_switch"
|
||||
#endif
|
||||
|
||||
#define PRIV_CMD_DYN_BW "dyn_bw"
|
||||
|
||||
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
|
||||
#define PRIV_CMD_DFS_OFFLOAD "dfs_offload"
|
||||
#endif
|
||||
|
||||
#define PRIV_CMD_AUTO_ARP "auto_arp"
|
||||
|
||||
#define PRIV_CMD_PER_PKT_CFG "per_pkt_cfg"
|
||||
|
||||
#define PRIV_CMD_DEAUTH_CTRL "ctrldeauth"
|
||||
|
||||
#define PRIV_CMD_TX_RX_HISTOGRAM "txrxhistogram"
|
||||
|
||||
/**Private command ID to set/get independent reset*/
|
||||
#define PRIV_CMD_IND_RST_CFG "indrstcfg"
|
||||
|
||||
#define PRIV_CMD_ARB_CFG "arb"
|
||||
|
||||
/**Private command to configure static rx abort config */
|
||||
#define PRIV_CMD_RX_ABORT_CFG "rx_abort_cfg"
|
||||
/**Private command to configure dynamic rx abort config */
|
||||
#define PRIV_CMD_RX_ABORT_CFG_EXT "rx_abort_cfg_ext"
|
||||
#define TX_AMPDU_RTS_CTS 0
|
||||
#define TX_AMPDU_CTS_2_SELF 1
|
||||
#define TX_AMPDU_DISABLE_PROTECTION 2
|
||||
#define TX_AMPDU_DYNAMIC_RTS_CTS 3
|
||||
/**Private command to set tx ampdu protection mode */
|
||||
#define PRIV_CMD_TX_AMPDU_PROT_MODE "tx_ampdu_prot_mode"
|
||||
/**Private command to configure tx rate adapt config */
|
||||
#define PRIV_CMD_RATE_ADAPT_CFG "rate_adapt_cfg"
|
||||
#define CCK_DESENSE_MODE_DISABLED 0
|
||||
#define CCK_DESENSE_MODE_DYNAMIC 1
|
||||
#define CCK_DESENSE_MODE_DYN_ENH 2
|
||||
/**Private command to configure cck desense config */
|
||||
#define PRIV_CMD_CCK_DESENSE_CFG "cck_desense_cfg"
|
||||
#define PRIV_CMD_DOT11MC_UNASSOC_FTM_CFG "dot11mc_unassoc_ftm_cfg"
|
||||
|
||||
/** Private command ID for Android default commands */
|
||||
#define WOAL_ANDROID_DEF_CMD (SIOCDEVPRIVATE + 1)
|
||||
|
||||
/** Private command ID to pass mgmt frame */
|
||||
#define WOAL_MGMT_FRAME_TX WOAL_MGMT_FRAME_TX_IOCTL
|
||||
|
||||
/** Private command ID to pass custom IE list */
|
||||
#define WOAL_CUSTOM_IE_CFG (SIOCDEVPRIVATE + 13)
|
||||
|
||||
/** Private command ID for Android ICS priv CMDs */
|
||||
#define WOAL_ANDROID_PRIV_CMD (SIOCDEVPRIVATE + 14)
|
||||
|
||||
/** Private command ID to get BSS type */
|
||||
#define WOAL_GET_BSS_TYPE (SIOCDEVPRIVATE + 15)
|
||||
|
||||
/** Private command ID for robustcoex */
|
||||
#define PRIV_CMD_ROBUSTCOEX "robustcoex"
|
||||
|
||||
#define PRIV_CMD_DMCS "dmcs"
|
||||
|
||||
#if defined(PCIE)
|
||||
#define PRIV_CMD_SSU "ssu"
|
||||
/** ssu_params_ctrl */
|
||||
typedef struct _ssu_params_cfg {
|
||||
/* ssu mode */
|
||||
t_u8 ssu_mode;
|
||||
/* 0-3; # of FFT samples to skip*/
|
||||
t_u32 nskip;
|
||||
/* 0-3: # of FFT samples selected to dump */
|
||||
t_u32 nsel;
|
||||
/* 0-3: Down sample ADC input for buffering*/
|
||||
t_u32 adcdownsample;
|
||||
/* 0-1: Mask out ADC Data from spectral packet */
|
||||
t_u32 mask_adc_pkt;
|
||||
/* 0-1: Enable 16-Bit FFT output data precision in spectral packet */
|
||||
t_u32 out_16bits;
|
||||
/* 0-1: Enable power spectrum in dB for spectral packe */
|
||||
t_u32 spec_pwr_enable;
|
||||
/* 0-1: Enable spectral packet rate reduction in DB output format */
|
||||
t_u32 rate_deduction;
|
||||
/* 0-7: Number of spectral packets over which spectral data is to be
|
||||
* averaged. */
|
||||
t_u32 n_pkt_avg;
|
||||
} __attribute__((packed)) ssu_params_cfg;
|
||||
#endif
|
||||
|
||||
#define PRIV_CMD_BOOTSLEEP "bootsleep"
|
||||
|
||||
/** Private command: 11AX Cfg */
|
||||
#define PRIV_CMD_11AXCFG "11axcfg"
|
||||
/** Private command: 11AX Cmd */
|
||||
#define PRIV_CMD_11AXCMDCFG "11axcmd"
|
||||
/** Private command: Range ext Cmd */
|
||||
#define PRIV_CMD_RANGE_EXT "range_ext"
|
||||
/** Private command: TWT Setup Cfg */
|
||||
#define PRIV_CMD_TWT_SETUP "twt_setup"
|
||||
/** Private command: TWT Teardown Cfg */
|
||||
#define PRIV_CMD_TWT_TEARDOWN "twt_teardown"
|
||||
|
||||
#define PRIV_CMD_LPM "lpm"
|
||||
|
||||
int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
|
||||
|
||||
/*
|
||||
* For android private commands, fixed value of ioctl is used.
|
||||
* Internally commands are differentiated using strings.
|
||||
*
|
||||
* application needs to specify "total_len" of data for copy_from_user
|
||||
* kernel updates "used_len" during copy_to_user
|
||||
*/
|
||||
/** Private command structure from app */
|
||||
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
|
||||
typedef struct _android_wifi_priv_cmd {
|
||||
/** Buffer pointer */
|
||||
t_u64 buf;
|
||||
/** buffer updated by driver */
|
||||
int used_len;
|
||||
/** buffer sent by application */
|
||||
int total_len;
|
||||
} __attribute__((packed)) android_wifi_priv_cmd;
|
||||
#else
|
||||
typedef struct _android_wifi_priv_cmd {
|
||||
/** Buffer pointer */
|
||||
char *buf;
|
||||
/** buffer updated by driver */
|
||||
int used_len;
|
||||
/** buffer sent by application */
|
||||
int total_len;
|
||||
} android_wifi_priv_cmd;
|
||||
#endif
|
||||
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
|
||||
/* Maximum size of the ESSID and NICKN strings */
|
||||
#define MW_ESSID_MAX_SIZE 32
|
||||
|
||||
/* Modes of operation */
|
||||
#define MW_MODE_AUTO 0 /* Let the driver decides */
|
||||
#define MW_MODE_ADHOC 1 /* Single cell network */
|
||||
#define MW_MODE_INFRA 2 /* Multi cell network, roaming, ... */
|
||||
#define MW_MODE_MASTER 3 /* Synchronisation master or Access Point */
|
||||
#define MW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
|
||||
#define MW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
|
||||
#define MW_MODE_MONITOR 6 /* Passive monitor (listen only) */
|
||||
#define MW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
|
||||
|
||||
#define MW_POWER_TYPE 0xF000 /* Type of parameter */
|
||||
#define MW_POWER_PERIOD 0x1000 /* Value is a period/duration of */
|
||||
#define MW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */
|
||||
|
||||
#define MW_AUTH_INDEX 0x0FFF
|
||||
#define MW_AUTH_FLAGS 0xF000
|
||||
#define MW_AUTH_WPA_VERSION 0
|
||||
#define MW_AUTH_CIPHER_PAIRWISE 1
|
||||
#define MW_AUTH_CIPHER_GROUP 2
|
||||
#define MW_AUTH_KEY_MGMT 3
|
||||
#define MW_AUTH_TKIP_COUNTERMEASURES 4
|
||||
#define MW_AUTH_DROP_UNENCRYPTED 5
|
||||
#define MW_AUTH_80211_AUTH_ALG 6
|
||||
#define MW_AUTH_WPA_ENABLED 7
|
||||
#define MW_AUTH_RX_UNENCRYPTED_EAPOL 8
|
||||
#define MW_AUTH_ROAMING_CONTROL 9
|
||||
#define MW_AUTH_PRIVACY_INVOKED 10
|
||||
#define MW_AUTH_CIPHER_GROUP_MGMT 11
|
||||
#define MW_AUTH_MFP 12
|
||||
|
||||
#define MW_AUTH_CIPHER_NONE 0x00000001
|
||||
#define MW_AUTH_CIPHER_WEP40 0x00000002
|
||||
#define MW_AUTH_CIPHER_TKIP 0x00000004
|
||||
#define MW_AUTH_CIPHER_CCMP 0x00000008
|
||||
#define MW_AUTH_CIPHER_WEP104 0x00000010
|
||||
#define MW_AUTH_CIPHER_AES_CMAC 0x00000020
|
||||
|
||||
#define MW_AUTH_ALG_OPEN_SYSTEM 0x00000001
|
||||
#define MW_AUTH_ALG_SHARED_KEY 0x00000002
|
||||
#define MW_AUTH_ALG_LEAP 0x00000004
|
||||
|
||||
/* Generic format for most parameters that fit in an int */
|
||||
struct mw_param {
|
||||
t_s32 value; /* The value of the parameter itself */
|
||||
t_u8 fixed; /* Hardware should not use auto select */
|
||||
t_u8 disabled; /* Disable the feature */
|
||||
t_u16 flags; /* Various specifc flags (if any) */
|
||||
};
|
||||
|
||||
/*
|
||||
* For all data larger than 16 octets, we need to use a
|
||||
* pointer to memory allocated in user space.
|
||||
*/
|
||||
struct mw_point {
|
||||
t_u8 *pointer; /* Pointer to the data (in user space) */
|
||||
t_u16 length; /* number of fields or size in bytes */
|
||||
t_u16 flags; /* Optional params */
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure defines the payload of an ioctl, and is used
|
||||
* below.
|
||||
*/
|
||||
union mwreq_data {
|
||||
/* Config - generic */
|
||||
char name[IFNAMSIZ];
|
||||
|
||||
struct mw_point essid; /* Extended network name */
|
||||
t_u32 mode; /* Operation mode */
|
||||
struct mw_param power; /* PM duration/timeout */
|
||||
struct sockaddr ap_addr; /* Access point address */
|
||||
struct mw_param param; /* Other small parameters */
|
||||
struct mw_point data; /* Other large parameters */
|
||||
};
|
||||
|
||||
/* The structure to exchange data for ioctl */
|
||||
struct mwreq {
|
||||
union {
|
||||
char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
|
||||
} ifr_ifrn;
|
||||
|
||||
/* Data part */
|
||||
union mwreq_data u;
|
||||
};
|
||||
|
||||
typedef struct woal_priv_ht_cap_info {
|
||||
t_u32 ht_cap_info_bg;
|
||||
t_u32 ht_cap_info_a;
|
||||
} woal_ht_cap_info;
|
||||
|
||||
typedef struct woal_priv_addba {
|
||||
t_u32 time_out;
|
||||
t_u32 tx_win_size;
|
||||
t_u32 rx_win_size;
|
||||
t_u32 tx_amsdu;
|
||||
t_u32 rx_amsdu;
|
||||
} woal_addba;
|
||||
|
||||
typedef struct _txrate_setting {
|
||||
t_u16 preamble : 2; /*BIT1-BIT0:
|
||||
* For legacy 11b: preamble type
|
||||
* 00 = long
|
||||
* 01 = short
|
||||
* 10/11 = reserved
|
||||
* For legacy 11g: reserved
|
||||
* For 11n: Green field PPDU indicator
|
||||
* 00 = HT-mix
|
||||
* 01 = HT-GF
|
||||
* 10/11 = reserved.
|
||||
* For 11ac: reserved.
|
||||
* For 11ax:
|
||||
* 00 = HE-SU
|
||||
* 01 = HE-EXT-SU
|
||||
* 10 = HE-MU
|
||||
* 11 = HE trigger based
|
||||
*/
|
||||
t_u16 bandwidth : 3; /* BIT2- BIT4
|
||||
* For 11n and 11ac traffic: Bandwidth
|
||||
* 0 = 20Mhz
|
||||
* 1 = 40Mhz
|
||||
* 2 = 80 Mhz
|
||||
* 3 = 160 Mhz
|
||||
* 4-7 = reserved
|
||||
* For legacy rate : BW>0 implies non-HT
|
||||
* duplicates. For HE SU PPDU: 0 = 20Mhz 1 = 40Mhz
|
||||
* 2 = 80 Mhz
|
||||
* 3 = 160 Mhz
|
||||
* 4-7 = reserved
|
||||
* For HE ER SU PPDU:
|
||||
* 0 = 242-tone RU
|
||||
* 1 = upper frequency 106 tone RU within the
|
||||
* primary 20 Mhz. For HE MU PPDU: 0 = 20Mhz. 1 =
|
||||
* 40Mhz. 2 = 80Mhz non-preamble puncturing mode 3
|
||||
* = 160Mhz and 80+80 Mhz non-preamble. 4 = for
|
||||
* preemble puncturing in 80 Mhz , where in the
|
||||
* preamble only the secondary 20Mhz is punctured.
|
||||
* 5 = for preemble puncturing in 80 Mhz ,
|
||||
* where in the preamble only one of the two
|
||||
* 20Mhz subchannels in the secondary 40Mhz is
|
||||
* punctured. 6 = for preemble puncturing in 160
|
||||
* Mhz or 80 Mhz + 80 Mhz, where in the primary 80
|
||||
* Mhz of the preamble only the secondary 20 Mhz is
|
||||
* punctured. 7 = for preemble puncturing in 160
|
||||
* Mhz or 80 Mhz + 80 Mhz, where in the primary 80
|
||||
* Mhz of the preamble the primary 40 Mhz is
|
||||
* present.
|
||||
*/
|
||||
t_u16 shortGI : 2; /*BIT5- BIT6
|
||||
* For legacy: not used
|
||||
* For 11n: 00 = normal, 01 =shortGI, 10/11 =
|
||||
* reserved For 11ac: SGI map to VHT-SIG-A2[0]
|
||||
* VHT-SIG-A2[1] is set to 1 if short guard
|
||||
* interval is used and NSYM mod 10 = 9, otherwise
|
||||
* set to 0. For 11ax: 00 = 1xHELTF+GI0.8usec 01 =
|
||||
* 2xHELTF+GI0.8usec 10 = 2xHELTF+GI1.6usec 11 =
|
||||
* 4xHELTF+GI0.8 usec if both DCM and STBC are 1
|
||||
* 4xHELTF+GI3.2 usec otherwise
|
||||
*/
|
||||
t_u16 stbc : 1; // BIT7, 0: no STBC; 1: STBC
|
||||
t_u16 dcm : 1; // BIT8, 0: no DCM; 1: DCM used.
|
||||
t_u16 adv_coding : 1; // BIT9, 0: BCC; 1: LDPC.
|
||||
t_u16 doppler : 2; /* BIT11-BIT10,
|
||||
00: Doppler0
|
||||
01: Doppler 1 with Mma =10
|
||||
10: Doppler 1 with Mma =20
|
||||
*/
|
||||
t_u16 max_pktext : 2; /*BIT12-BIT13:
|
||||
* Max packet extension
|
||||
* 0 - 0 usec
|
||||
* 1 - 8 usec
|
||||
* 2 - 16 usec.
|
||||
*/
|
||||
t_u16 reserverd : 2; // BIT14-BIT15
|
||||
} __ATTRIB_PACK__ txrate_setting;
|
||||
|
||||
/** data structure for cmd txratecfg */
|
||||
typedef struct woal_priv_tx_rate_cfg {
|
||||
/* LG rate: 0, HT rate: 1, VHT rate: 2 */
|
||||
t_u32 rate_format;
|
||||
/** Rate/MCS index (0xFF: auto) */
|
||||
t_u32 rate_index;
|
||||
/** Data rate */
|
||||
t_u32 rate;
|
||||
/** NSS */
|
||||
t_u32 nss;
|
||||
/** Rate Setting */
|
||||
t_u16 rate_setting;
|
||||
} woal_tx_rate_cfg;
|
||||
|
||||
typedef struct woal_priv_esuppmode_cfg {
|
||||
/* RSN mode */
|
||||
t_u16 rsn_mode;
|
||||
/* Pairwise cipher */
|
||||
t_u8 pairwise_cipher;
|
||||
/* Group cipher */
|
||||
t_u8 group_cipher;
|
||||
} woal_esuppmode_cfg;
|
||||
|
||||
mlan_status woal_set_ap_wps_p2p_ie(moal_private *priv, t_u8 *ie, size_t len);
|
||||
mlan_status woal_ioctl_aggr_prio_tbl(moal_private *priv, t_u32 action,
|
||||
mlan_ds_11n_aggr_prio_tbl *aggr_prio_tbl);
|
||||
|
||||
int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req);
|
||||
|
||||
#define PRIV_CMD_CLOUD_KEEP_ALIVE "cloud_keep_alive"
|
||||
/** cloud keep alive parameters */
|
||||
typedef struct _cloud_keep_alive {
|
||||
/** id */
|
||||
t_u8 mkeep_alive_id;
|
||||
/** enable/disable of this id */
|
||||
t_u8 enable;
|
||||
/** enable/disable reset*/
|
||||
t_u8 reset;
|
||||
/** Reserved */
|
||||
t_u8 reserved;
|
||||
/** Destination MAC address */
|
||||
t_u8 dst_mac[ETH_ALEN];
|
||||
/** Source MAC address */
|
||||
t_u8 src_mac[ETH_ALEN];
|
||||
/** packet send period */
|
||||
t_u32 sendInterval;
|
||||
/** packet retry interval */
|
||||
t_u32 retryInterval;
|
||||
/** packet retry count */
|
||||
t_u8 retryCount;
|
||||
/** packet length */
|
||||
t_u8 pkt_len;
|
||||
/** packet content */
|
||||
t_u8 pkt[255];
|
||||
} __ATTRIB_PACK__ cloud_keep_alive;
|
||||
|
||||
#define TLV_TYPE_PER_PKT_CFG 0x0001
|
||||
#define TX_PKT_CTRL MBIT(0)
|
||||
#define RX_PKT_INFO MBIT(1)
|
||||
|
||||
#define FLAG_TX_HISTOGRAM 0x01
|
||||
#define FLAG_RX_HISTOGRAM 0x02
|
||||
#define DISABLE_TX_RX_HISTOGRAM 0x00
|
||||
#define ENABLE_TX_RX_HISTOGRAM 0x01
|
||||
#define GET_TX_RX_HISTOGRAM 0x02
|
||||
#define PRIV_CMD_TX_RX_HISTOGRAM "txrxhistogram"
|
||||
/** TX and RX histogram statistic parameters*/
|
||||
typedef struct _tx_rx_histogram {
|
||||
/** Enable or disable get tx/rx histogram statistic */
|
||||
t_u8 enable;
|
||||
/** Choose to get TX, RX or both histogram statistic */
|
||||
t_u8 action;
|
||||
} __ATTRIB_PACK__ tx_rx_histogram;
|
||||
|
||||
/* Enum for different CW mode type */
|
||||
typedef enum _cw_modes_e {
|
||||
CWMODE_DISABLE,
|
||||
CWMODE_TXCONTPKT,
|
||||
CWMODE_TXCONTWAVE,
|
||||
} cw_modes_e;
|
||||
|
||||
/** wlan_ieee80211_chan */
|
||||
typedef struct {
|
||||
/** center freq */
|
||||
t_u16 center_freq;
|
||||
/** chan num */
|
||||
t_u16 hw_value;
|
||||
/** chan flags */
|
||||
t_u32 flags;
|
||||
/** max power */
|
||||
int max_power;
|
||||
/** dfs_state */
|
||||
t_u8 dfs_state;
|
||||
} __ATTRIB_PACK__ wlan_ieee80211_chan;
|
||||
|
||||
/** wlan_ieee80211_chan_list*/
|
||||
typedef struct {
|
||||
/** num of chan */
|
||||
t_u8 num_chan;
|
||||
/** chan_list */
|
||||
wlan_ieee80211_chan chan_list[];
|
||||
} __ATTRIB_PACK__ wlan_ieee80211_chan_list;
|
||||
|
||||
#define PRIV_CMD_TP_STATE "tp_state"
|
||||
#endif /* _WOAL_ETH_PRIV_H_ */
|
2355
mxm_wifiex/wlan_src/mlinux/moal_init.c
Normal file
2355
mxm_wifiex/wlan_src/mlinux/moal_init.c
Normal file
File diff suppressed because it is too large
Load diff
6979
mxm_wifiex/wlan_src/mlinux/moal_ioctl.c
Normal file
6979
mxm_wifiex/wlan_src/mlinux/moal_ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
9628
mxm_wifiex/wlan_src/mlinux/moal_main.c
Normal file
9628
mxm_wifiex/wlan_src/mlinux/moal_main.c
Normal file
File diff suppressed because it is too large
Load diff
3148
mxm_wifiex/wlan_src/mlinux/moal_main.h
Normal file
3148
mxm_wifiex/wlan_src/mlinux/moal_main.h
Normal file
File diff suppressed because it is too large
Load diff
2436
mxm_wifiex/wlan_src/mlinux/moal_pcie.c
Normal file
2436
mxm_wifiex/wlan_src/mlinux/moal_pcie.c
Normal file
File diff suppressed because it is too large
Load diff
142
mxm_wifiex/wlan_src/mlinux/moal_pcie.h
Normal file
142
mxm_wifiex/wlan_src/mlinux/moal_pcie.h
Normal file
|
@ -0,0 +1,142 @@
|
|||
/** @file moal_pcie.h
|
||||
*
|
||||
* @brief This file contains definitions for PCIE interface.
|
||||
* driver.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
02/01/2012: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MOAL_PCIE_H_
|
||||
#define _MOAL_PCIE_H_
|
||||
|
||||
#define PCIE_VENDOR_ID_NXP (0x11ab)
|
||||
#define PCIE_VENDOR_ID_V2_NXP (0x1b4b)
|
||||
#ifdef PCIE8997
|
||||
/** PCIE device ID for 8997 card */
|
||||
#define PCIE_DEVICE_ID_NXP_88W8997P (0x2b42)
|
||||
#endif
|
||||
#ifdef PCIE8897
|
||||
/** PCIE device ID for 8897 card */
|
||||
#define PCIE_DEVICE_ID_NXP_88W8897P (0x2b38)
|
||||
#endif
|
||||
|
||||
#ifdef PCIE9097
|
||||
/** PCIE device ID for 9097 card */
|
||||
#define PCIE_DEVICE_ID_NXP_88W9097 (0x2b56)
|
||||
#endif
|
||||
|
||||
#ifdef PCIE9098
|
||||
/** PCIE device ID for 9098 card FN0 */
|
||||
#define PCIE_DEVICE_ID_NXP_88W9098P_FN0 (0x2b43)
|
||||
/** PCIE device ID for 9098 card FN1 */
|
||||
#define PCIE_DEVICE_ID_NXP_88W9098P_FN1 (0x2b44)
|
||||
#endif
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/pci.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
||||
#include <linux/pcieport_if.h>
|
||||
#endif
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include "moal_main.h"
|
||||
|
||||
/** Default firmware name */
|
||||
#ifdef PCIE8997
|
||||
#define PCIE8997_DEFAULT_COMBO_FW_NAME "nxp/pcieusb8997_combo_v4.bin"
|
||||
#define PCIEUART8997_DEFAULT_COMBO_FW_NAME "nxp/pcieuart8997_combo_v4.bin"
|
||||
#define PCIEUSB8997_DEFAULT_COMBO_FW_NAME "nxp/pcieusb8997_combo_v4.bin"
|
||||
#define PCIE8997_DEFAULT_WLAN_FW_NAME "nxp/pcie8997_wlan_v4.bin"
|
||||
/** PCIE8997 chip revision ID */
|
||||
#define PCIE8997_A0 0x10
|
||||
#define PCIE8997_A1 0x11
|
||||
#endif /* PCIE8997 */
|
||||
|
||||
#ifdef PCIE8897
|
||||
#define PCIE8897_DEFAULT_COMBO_FW_NAME "nxp/pcie8897_uapsta.bin"
|
||||
#define PCIE8897_DEFAULT_WLAN_FW_NAME "nxp/pcie8897_wlan.bin"
|
||||
#endif /* PCIE8897*/
|
||||
|
||||
#ifdef PCIE9098
|
||||
#define PCIE9098_Z1Z2 0x00
|
||||
#define PCIE9098_A0 0x01
|
||||
#define PCIE9098_A1 0x02
|
||||
#define PCIE9098_A2 0x03
|
||||
#define PCIE9098_DEFAULT_COMBO_FW_NAME "nxp/pcieusb9098_combo.bin"
|
||||
#define PCIEUART9098_DEFAULT_COMBO_FW_NAME "nxp/pcieuart9098_combo.bin"
|
||||
#define PCIEUSB9098_DEFAULT_COMBO_FW_NAME "nxp/pcieusb9098_combo.bin"
|
||||
#define PCIEPCIE9098_DEFAULT_COMBO_FW_NAME "nxp/pciepcie9098_combo.bin"
|
||||
#define PCIEUART9098_COMBO_V1_FW_NAME "nxp/pcieuart9098_combo_v1.bin"
|
||||
#define PCIEUSB9098_COMBO_V1_FW_NAME "nxp/pcieusb9098_combo_v1.bin"
|
||||
#define PCIEPCIE9098_COMBO_V1_FW_NAME "nxp/pciepcie9098_combo_v1.bin"
|
||||
#define PCIE9098_DEFAULT_WLAN_FW_NAME "nxp/pcie9098_wlan.bin"
|
||||
#define PCIE9098_WLAN_V1_FW_NAME "nxp/pcie9098_wlan_v1.bin"
|
||||
#endif /* PCIE9098 */
|
||||
|
||||
#ifdef PCIE9097
|
||||
#define PCIE9097_A0 0x00
|
||||
#define PCIE9097_B0 0x01
|
||||
#define PCIE9097_B1 0x02
|
||||
#define PCIE9097_DEFAULT_COMBO_FW_NAME "nxp/pcieusb9097_combo.bin"
|
||||
#define PCIEUART9097_DEFAULT_COMBO_FW_NAME "nxp/pcieuart9097_combo.bin"
|
||||
#define PCIEUSB9097_DEFAULT_COMBO_FW_NAME "nxp/pcieusb9097_combo.bin"
|
||||
#define PCIEUART9097_COMBO_V1_FW_NAME "nxp/pcieuart9097_combo_v1.bin"
|
||||
#define PCIEUSB9097_COMBO_V1_FW_NAME "nxp/pcieusb9097_combo_v1.bin"
|
||||
#define PCIE9097_DEFAULT_WLAN_FW_NAME "nxp/pcie9097_wlan.bin"
|
||||
#define PCIE9097_WLAN_V1_FW_NAME "nxp/pcie9097_wlan_v1.bin"
|
||||
#endif /* PCIE9097 */
|
||||
|
||||
#if defined(PCIE9098) || defined(PCIE9097)
|
||||
#define PCIE_NUM_MSIX_VECTORS 32
|
||||
#else
|
||||
#define PCIE_NUM_MSIX_VECTORS 4
|
||||
#endif
|
||||
|
||||
typedef struct _msix_context {
|
||||
/** pci_dev structure pointer */
|
||||
struct pci_dev *dev;
|
||||
/** message id related to msix vector */
|
||||
t_u16 msg_id;
|
||||
} msix_context;
|
||||
|
||||
/** Structure: PCIE service card */
|
||||
typedef struct _pcie_service_card {
|
||||
/** pci_dev structure pointer */
|
||||
struct pci_dev *dev;
|
||||
/** moal_handle structure pointer */
|
||||
moal_handle *handle;
|
||||
/** I/O memory regions pointer to the bus */
|
||||
void __iomem *pci_mmap;
|
||||
/** I/O memory regions pointer to the bus */
|
||||
void __iomem *pci_mmap1;
|
||||
#if defined(PCIE)
|
||||
struct msix_entry msix_entries[PCIE_NUM_MSIX_VECTORS];
|
||||
msix_context msix_contexts[PCIE_NUM_MSIX_VECTORS];
|
||||
#endif
|
||||
} pcie_service_card, *ppcie_service_card;
|
||||
|
||||
/** Register to bus driver function */
|
||||
mlan_status woal_pcie_bus_register(void);
|
||||
/** Unregister from bus driver function */
|
||||
void woal_pcie_bus_unregister(void);
|
||||
#endif /* _MOAL_PCIE_H_ */
|
6863
mxm_wifiex/wlan_src/mlinux/moal_priv.c
Normal file
6863
mxm_wifiex/wlan_src/mlinux/moal_priv.c
Normal file
File diff suppressed because it is too large
Load diff
485
mxm_wifiex/wlan_src/mlinux/moal_priv.h
Normal file
485
mxm_wifiex/wlan_src/mlinux/moal_priv.h
Normal file
|
@ -0,0 +1,485 @@
|
|||
|
||||
/** @file moal_priv.h
|
||||
*
|
||||
* @brief This file contains definition for extended private IOCTL call.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
10/31/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _WOAL_PRIV_H_
|
||||
#define _WOAL_PRIV_H_
|
||||
|
||||
/** 2K bytes */
|
||||
#define WOAL_2K_BYTES 2000
|
||||
|
||||
/** PRIVATE CMD ID */
|
||||
#define WOAL_IOCTL (SIOCIWFIRSTPRIV) /* 0x8BE0 defined in wireless.h */
|
||||
|
||||
/** Private command ID to set one int/get word char */
|
||||
#define WOAL_SETONEINT_GETWORDCHAR (WOAL_IOCTL + 1)
|
||||
/** Private command ID to get version */
|
||||
#define WOAL_VERSION 1
|
||||
/** Private command ID to get extended version */
|
||||
#define WOAL_VEREXT 2
|
||||
|
||||
/** Private command ID to set/get none */
|
||||
#define WOAL_SETNONE_GETNONE (WOAL_IOCTL + 2)
|
||||
/** Private command ID for warm reset */
|
||||
#define WOAL_WARMRESET 1
|
||||
|
||||
/**
|
||||
* Linux Kernels later 3.9 use CONFIG_PM_RUNTIME instead of
|
||||
* CONFIG_USB_SUSPEND
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
||||
#ifdef CONFIG_PM
|
||||
#ifndef CONFIG_USB_SUSPEND
|
||||
#define CONFIG_USB_SUSPEND
|
||||
#endif
|
||||
#endif
|
||||
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
#ifndef CONFIG_USB_SUSPEND
|
||||
#define CONFIG_USB_SUSPEND
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_SUSPEND
|
||||
/** Private command ID for usb suspend */
|
||||
#define WOAL_USB_SUSPEND 2
|
||||
/** Private command ID for usb resume */
|
||||
#define WOAL_USB_RESUME 3
|
||||
#endif /* CONFIG_USB_SUSPEND */
|
||||
/** Private command ID to clear 11d chan table */
|
||||
#define WOAL_11D_CLR_CHAN_TABLE 4
|
||||
|
||||
/** Private command ID to set/get sixteen int */
|
||||
#define WOAL_SET_GET_SIXTEEN_INT (WOAL_IOCTL + 3)
|
||||
/** Private command ID to set/get TX power configurations */
|
||||
#define WOAL_TX_POWERCFG 1
|
||||
#ifdef DEBUG_LEVEL1
|
||||
/** Private command ID to set/get driver debug */
|
||||
#define WOAL_DRV_DBG 2
|
||||
#endif
|
||||
/** Private command ID to set/get beacon interval */
|
||||
#define WOAL_BEACON_INTERVAL 3
|
||||
/** Private command ID to get RSSI */
|
||||
#define WOAL_SIGNAL 5
|
||||
/** Private command ID to set/get Deep Sleep mode */
|
||||
#define WOAL_DEEP_SLEEP 7
|
||||
/** Private command ID for 11n ht configration */
|
||||
#define WOAL_11N_TX_CFG 8
|
||||
/** Private command ID for 11n usr ht configration */
|
||||
#define WOAL_11N_HTCAP_CFG 9
|
||||
/** Private command ID for TX Aggregation */
|
||||
#define WOAL_PRIO_TBL 10
|
||||
/** Private command ID for Updating ADDBA variables */
|
||||
#define WOAL_ADDBA_UPDT 11
|
||||
/** Private command ID to set/get Host Sleep configuration */
|
||||
#define WOAL_HS_CFG 12
|
||||
/** Private command ID to set Host Sleep parameters */
|
||||
#define WOAL_HS_SETPARA 13
|
||||
/** Private command ID to read/write registers */
|
||||
#define WOAL_REG_READ_WRITE 14
|
||||
/** Private command ID to set/get band/adhocband */
|
||||
#define WOAL_BAND_CFG 15
|
||||
/** Private command ID for TX Aggregation */
|
||||
#define WOAL_11N_AMSDU_AGGR_CTRL 17
|
||||
/** Private command ID to set/get Inactivity timeout */
|
||||
#define WOAL_INACTIVITY_TIMEOUT_EXT 18
|
||||
#ifdef SDIO
|
||||
/** Private command ID to turn on/off sdio clock */
|
||||
#define WOAL_SDIO_CLOCK 19
|
||||
/** Private command ID to read/write Command 52 */
|
||||
#define WOAL_CMD_52RDWR 20
|
||||
#endif
|
||||
/** Private command ID to set/get scan configuration parameter */
|
||||
#define WOAL_SCAN_CFG 21
|
||||
/** Private command ID to set/get PS configuration parameter */
|
||||
#define WOAL_PS_CFG 22
|
||||
/** Private command ID to read/write memory */
|
||||
#define WOAL_MEM_READ_WRITE 23
|
||||
#ifdef SDIO
|
||||
/** Private command ID to control SDIO MP-A */
|
||||
#define WOAL_SDIO_MPA_CTRL 25
|
||||
#endif
|
||||
/** Private command ID for Updating ADDBA variables */
|
||||
#define WOAL_ADDBA_REJECT 27
|
||||
/** Private command ID to set/get sleep parameters */
|
||||
#define WOAL_SLEEP_PARAMS 28
|
||||
/** Private command ID to set/get TX BF capabilities */
|
||||
#define WOAL_TX_BF_CAP 31
|
||||
/** Private command ID to set/get dfs testing settings */
|
||||
#define WOAL_DFS_TESTING 33
|
||||
/** Private command ID to set/get CFP table codes */
|
||||
#define WOAL_CFP_CODE 34
|
||||
/** Private command ID to set/get tx/rx antenna */
|
||||
#define WOAL_SET_GET_TX_RX_ANT 35
|
||||
/** Private command ID to set/get management frame passthru mask */
|
||||
#define WOAL_MGMT_FRAME_CTRL 36
|
||||
|
||||
/** Private command ID to configure gpio independent reset */
|
||||
#define WOAL_IND_RST_CFG 37
|
||||
|
||||
/** Private command ID to set one int/get one int */
|
||||
#define WOAL_SETONEINT_GETONEINT (WOAL_IOCTL + 5)
|
||||
/** Private command ID to set/get Tx rate */
|
||||
#define WOAL_SET_GET_TXRATE 1
|
||||
/** Private command ID to set/get region code */
|
||||
#define WOAL_SET_GET_REGIONCODE 2
|
||||
/** Private command ID to turn on/off radio */
|
||||
#define WOAL_SET_RADIO 3
|
||||
/** Private command ID to enable WMM */
|
||||
#define WOAL_WMM_ENABLE 4
|
||||
/** Private command ID to enable 802.11D */
|
||||
#define WOAL_11D_ENABLE 5
|
||||
/** Private command ID to set/get QoS configuration */
|
||||
#define WOAL_SET_GET_QOS_CFG 7
|
||||
#if defined(REASSOCIATION)
|
||||
/** Private command ID to set/get reassociation setting */
|
||||
#define WOAL_SET_GET_REASSOC 9
|
||||
#endif /* REASSOCIATION */
|
||||
/** Private command ID for Updating Transmit buffer configration */
|
||||
#define WOAL_TXBUF_CFG 10
|
||||
/** Private command ID to set/get WWS mode */
|
||||
#define WOAL_SET_GET_WWS_CFG 12
|
||||
/** Private command ID to set/get sleep period */
|
||||
#define WOAL_SLEEP_PD 13
|
||||
/** Private command ID to set/get auth type */
|
||||
#define WOAL_AUTH_TYPE 18
|
||||
/** Private command ID to set/get port control */
|
||||
#define WOAL_PORT_CTRL 19
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
/** Private command ID for set/get BSS role */
|
||||
#define WOAL_SET_GET_BSS_ROLE 21
|
||||
#endif
|
||||
#endif
|
||||
/** Private command ID for set/get 11h local power constraint */
|
||||
#define WOAL_SET_GET_11H_LOCAL_PWR_CONSTRAINT 22
|
||||
/** Private command ID to set/get 11N HT stream configuration */
|
||||
#define WOAL_HT_STREAM_CFG 23
|
||||
/** Private command ID to set/get MAC control */
|
||||
#define WOAL_MAC_CONTROL 24
|
||||
/** Private command ID to get thermal value */
|
||||
#define WOAL_THERMAL 25
|
||||
/** Private command ID to set/get hs cfg param */
|
||||
#define WOAL_CFG_HOTSPOT 26
|
||||
|
||||
/** Private command ID to get log */
|
||||
#define WOALGETLOG (WOAL_IOCTL + 7)
|
||||
|
||||
/** Private command ID to set a wext address variable */
|
||||
#define WOAL_SETADDR_GETNONE (WOAL_IOCTL + 8)
|
||||
/** Private command ID to send deauthentication */
|
||||
#define WOAL_DEAUTH 1
|
||||
|
||||
/** Private command to get/set 256 chars */
|
||||
#define WOAL_SET_GET_256_CHAR (WOAL_IOCTL + 9)
|
||||
/** Private command to read/write passphrase */
|
||||
#define WOAL_PASSPHRASE 1
|
||||
#define WOAL_ASSOCIATE 3
|
||||
/** Private command ID to get WMM queue status */
|
||||
#define WOAL_WMM_QUEUE_STATUS 4
|
||||
/** Private command ID to get Traffic stream status */
|
||||
#define WOAL_WMM_TS_STATUS 5
|
||||
#define WOAL_IP_ADDRESS 7
|
||||
/** Private command ID to set/get TX bemaforming */
|
||||
#define WOAL_TX_BF_CFG 8
|
||||
/** Private command ID to get PTK/GTK */
|
||||
#define WOAL_GET_KEY 9
|
||||
|
||||
/** Get log buffer size */
|
||||
#define GETLOG_BUFSIZE 1500
|
||||
|
||||
/** Private command ID to set none/get twelve chars*/
|
||||
#define WOAL_SETNONE_GETTWELVE_CHAR (WOAL_IOCTL + 11)
|
||||
/** Private command ID for WPS session */
|
||||
#define WOAL_WPS_SESSION 1
|
||||
|
||||
/** Private command ID to set none/get four int */
|
||||
#define WOAL_SETNONE_GET_FOUR_INT (WOAL_IOCTL + 13)
|
||||
/** Private command ID to get data rates */
|
||||
#define WOAL_DATA_RATE 1
|
||||
/** Private command ID to get E-Supplicant mode */
|
||||
#define WOAL_ESUPP_MODE 2
|
||||
|
||||
/** Private command to get/set 64 ints */
|
||||
#define WOAL_SET_GET_64_INT (WOAL_IOCTL + 15)
|
||||
/** Private command ID to set/get ECL system clock */
|
||||
#define WOAL_ECL_SYS_CLOCK 1
|
||||
|
||||
/** Private command ID for hostcmd */
|
||||
#define WOAL_HOST_CMD (WOAL_IOCTL + 17)
|
||||
|
||||
/** Private command ID to set ints and get chars */
|
||||
#define WOAL_SET_INTS_GET_CHARS (WOAL_IOCTL + 21)
|
||||
/** Private command ID to read EEPROM data */
|
||||
#define WOAL_READ_EEPROM 1
|
||||
|
||||
/** Private command ID to set/get 2K bytes */
|
||||
#define WOAL_SET_GET_2K_BYTES (WOAL_IOCTL + 23)
|
||||
|
||||
#ifdef SDIO
|
||||
/** Private command ID to read/write Command 53 */
|
||||
#define WOAL_CMD_53RDWR 2
|
||||
#endif
|
||||
|
||||
/** Private command ID for setuserscan */
|
||||
#define WOAL_SET_USER_SCAN 3
|
||||
/** Private command ID for getscantable */
|
||||
#define WOAL_GET_SCAN_TABLE 4
|
||||
/** Private command ID for setuserscanext: async without wait */
|
||||
#define WOAL_SET_USER_SCAN_EXT 5
|
||||
|
||||
/** Private command ID to request ADDTS */
|
||||
#define WOAL_WMM_ADDTS 7
|
||||
/** Private command ID to request DELTS */
|
||||
#define WOAL_WMM_DELTS 8
|
||||
/** Private command ID to queue configuration */
|
||||
#define WOAL_WMM_QUEUE_CONFIG 9
|
||||
/** Private command ID to queue stats */
|
||||
#define WOAL_WMM_QUEUE_STATS 10
|
||||
/** Private command ID to Bypass auth packet */
|
||||
#define WOAL_BYPASSED_PACKET 11
|
||||
|
||||
#ifdef UAP_WEXT
|
||||
/** The following command IDs are for Froyo app */
|
||||
/** Private command ID to start driver */
|
||||
#define WOAL_FROYO_START (WOAL_IOCTL + 28)
|
||||
/** Private command ID to reload FW */
|
||||
#define WOAL_FROYO_WL_FW_RELOAD (WOAL_IOCTL + 29)
|
||||
/** Private command ID to stop driver */
|
||||
#define WOAL_FROYO_STOP (WOAL_IOCTL + 30)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* iwpriv ioctl handlers
|
||||
*/
|
||||
static const struct iw_priv_args woal_private_args[] = {
|
||||
{WOAL_SETONEINT_GETWORDCHAR, IW_PRIV_TYPE_INT | 1,
|
||||
IW_PRIV_TYPE_CHAR | 128, ""},
|
||||
{WOAL_VERSION, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_CHAR | 128,
|
||||
"version"},
|
||||
{WOAL_VEREXT, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_CHAR | 128, "verext"},
|
||||
{WOAL_SETNONE_GETNONE, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, ""},
|
||||
{WOAL_WARMRESET, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "warmreset"},
|
||||
#ifdef CONFIG_USB_SUSPEND
|
||||
{WOAL_USB_SUSPEND, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "usbsuspend"},
|
||||
{WOAL_USB_RESUME, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "usbresume"},
|
||||
#endif /* CONFIG_USB_SUSPEND */
|
||||
{WOAL_SETONEINT_GETONEINT, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
""},
|
||||
{WOAL_SET_GET_TXRATE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"txratecfg"},
|
||||
{WOAL_SET_GET_REGIONCODE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"regioncode"},
|
||||
{WOAL_SET_RADIO, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"radioctrl"},
|
||||
{WOAL_WMM_ENABLE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1, "wmmcfg"},
|
||||
{WOAL_11D_ENABLE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1, "11dcfg"},
|
||||
{WOAL_11D_CLR_CHAN_TABLE, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE,
|
||||
"11dclrtbl"},
|
||||
{WOAL_SET_GET_QOS_CFG, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"qoscfg"},
|
||||
#ifndef OPCHAN
|
||||
{WOAL_SET_GET_WWS_CFG, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"wwscfg"},
|
||||
#endif
|
||||
#if defined(REASSOCIATION)
|
||||
{WOAL_SET_GET_REASSOC, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"reassoctrl"},
|
||||
#endif
|
||||
{WOAL_TXBUF_CFG, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"txbufcfg"},
|
||||
{WOAL_SLEEP_PD, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1, "sleeppd"},
|
||||
{WOAL_AUTH_TYPE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"authtype"},
|
||||
{WOAL_PORT_CTRL, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"port_ctrl"},
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
{WOAL_SET_GET_BSS_ROLE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"bssrole"},
|
||||
#endif
|
||||
#endif
|
||||
{WOAL_SET_GET_11H_LOCAL_PWR_CONSTRAINT, IW_PRIV_TYPE_INT | 1,
|
||||
IW_PRIV_TYPE_INT | 1, "powercons"},
|
||||
{WOAL_HT_STREAM_CFG, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"htstreamcfg"},
|
||||
{WOAL_MAC_CONTROL, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"macctrl"},
|
||||
{WOAL_THERMAL, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1, "thermal"},
|
||||
{WOAL_CFG_HOTSPOT, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"hotspotcfg"},
|
||||
{WOAL_SET_GET_SIXTEEN_INT, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
""},
|
||||
{WOAL_TX_POWERCFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"txpowercfg"},
|
||||
#ifdef DEBUG_LEVEL1
|
||||
{WOAL_DRV_DBG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "drvdbg"},
|
||||
#endif
|
||||
{WOAL_BEACON_INTERVAL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"bcninterval"},
|
||||
{WOAL_SIGNAL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"getsignal"},
|
||||
{
|
||||
WOAL_DEEP_SLEEP,
|
||||
IW_PRIV_TYPE_INT | 16,
|
||||
IW_PRIV_TYPE_INT | 16,
|
||||
"deepsleep",
|
||||
},
|
||||
{WOAL_11N_TX_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"httxcfg"},
|
||||
{WOAL_11N_HTCAP_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"htcapinfo"},
|
||||
{WOAL_PRIO_TBL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"aggrpriotbl"},
|
||||
{WOAL_11N_AMSDU_AGGR_CTRL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"amsduaggrctrl"},
|
||||
{WOAL_ADDBA_UPDT, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"addbapara"},
|
||||
{WOAL_ADDBA_REJECT, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"addbareject"},
|
||||
{WOAL_TX_BF_CAP, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"httxbfcap"},
|
||||
{WOAL_HS_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "hscfg"},
|
||||
{WOAL_HS_SETPARA, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"hssetpara"},
|
||||
{WOAL_REG_READ_WRITE, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"regrdwr"},
|
||||
{WOAL_BAND_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"bandcfg"},
|
||||
{WOAL_INACTIVITY_TIMEOUT_EXT, IW_PRIV_TYPE_INT | 16,
|
||||
IW_PRIV_TYPE_INT | 16, "inactivityto"},
|
||||
#ifdef SDIO
|
||||
{WOAL_SDIO_CLOCK, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"sdioclock"},
|
||||
{WOAL_CMD_52RDWR, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"sdcmd52rw"},
|
||||
#endif
|
||||
{WOAL_SCAN_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"scancfg"},
|
||||
{WOAL_PS_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16, "pscfg"},
|
||||
{WOAL_MEM_READ_WRITE, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"memrdwr"},
|
||||
#ifdef SDIO
|
||||
{WOAL_SDIO_MPA_CTRL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"mpactrl"},
|
||||
#endif
|
||||
{WOAL_SLEEP_PARAMS, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"sleepparams"},
|
||||
{WOAL_DFS_TESTING, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"dfstesting"},
|
||||
{WOAL_MGMT_FRAME_CTRL, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"mgmtframectrl"},
|
||||
{WOAL_CFP_CODE, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"cfpcode"},
|
||||
{WOAL_SET_GET_TX_RX_ANT, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"antcfg"},
|
||||
{WOAL_IND_RST_CFG, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_INT | 16,
|
||||
"indrstcfg"},
|
||||
{WOALGETLOG, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR | GETLOG_BUFSIZE,
|
||||
"getlog"},
|
||||
{WOAL_SETADDR_GETNONE, IW_PRIV_TYPE_ADDR | 1, IW_PRIV_TYPE_NONE, ""},
|
||||
{WOAL_DEAUTH, IW_PRIV_TYPE_ADDR | 1, IW_PRIV_TYPE_NONE, "deauth"},
|
||||
{WOAL_SET_GET_256_CHAR, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, ""},
|
||||
{WOAL_PASSPHRASE, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"passphrase"},
|
||||
{WOAL_GET_KEY, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"getkey"},
|
||||
{WOAL_ASSOCIATE, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"associate"},
|
||||
{WOAL_WMM_QUEUE_STATUS, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, "qstatus"},
|
||||
{WOAL_WMM_TS_STATUS, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"ts_status"},
|
||||
{WOAL_IP_ADDRESS, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"ipaddr"},
|
||||
{WOAL_TX_BF_CFG, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"httxbfcfg"},
|
||||
{WOAL_SETNONE_GETTWELVE_CHAR, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR | 12,
|
||||
""},
|
||||
{WOAL_WPS_SESSION, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR | 12,
|
||||
"wpssession"},
|
||||
{WOAL_SETNONE_GET_FOUR_INT, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | 4,
|
||||
""},
|
||||
{WOAL_DATA_RATE, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | 4,
|
||||
"getdatarate"},
|
||||
{WOAL_ESUPP_MODE, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | 4, "esuppmode"},
|
||||
{WOAL_SET_GET_64_INT, IW_PRIV_TYPE_INT | 64, IW_PRIV_TYPE_INT | 64, ""},
|
||||
{WOAL_ECL_SYS_CLOCK, IW_PRIV_TYPE_INT | 64, IW_PRIV_TYPE_INT | 64,
|
||||
"sysclock"},
|
||||
{WOAL_HOST_CMD, IW_PRIV_TYPE_BYTE | 2047, IW_PRIV_TYPE_BYTE | 2047,
|
||||
"hostcmd"},
|
||||
{WOAL_SET_INTS_GET_CHARS, IW_PRIV_TYPE_INT | 16,
|
||||
IW_PRIV_TYPE_BYTE | 256, ""},
|
||||
{WOAL_READ_EEPROM, IW_PRIV_TYPE_INT | 16, IW_PRIV_TYPE_BYTE | 256,
|
||||
"rdeeprom"},
|
||||
{WOAL_SET_GET_2K_BYTES, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, ""},
|
||||
#if defined(SDIO)
|
||||
{WOAL_CMD_53RDWR, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "sdcmd53rw"},
|
||||
#endif
|
||||
{WOAL_SET_USER_SCAN, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "setuserscan"},
|
||||
{WOAL_GET_SCAN_TABLE, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "getscantable"},
|
||||
{WOAL_SET_USER_SCAN_EXT, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "setuserscanext"},
|
||||
{WOAL_WMM_ADDTS, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "addts"},
|
||||
{WOAL_WMM_DELTS, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "delts"},
|
||||
{WOAL_WMM_QUEUE_CONFIG, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "qconfig"},
|
||||
{WOAL_WMM_QUEUE_STATS, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "qstats"},
|
||||
{WOAL_BYPASSED_PACKET, IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES,
|
||||
IW_PRIV_TYPE_BYTE | WOAL_2K_BYTES, "pb_bypass"},
|
||||
#ifdef UAP_WEXT
|
||||
{WOAL_FROYO_START, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "START"},
|
||||
{WOAL_FROYO_STOP, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "STOP"},
|
||||
{WOAL_FROYO_WL_FW_RELOAD, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, "WL_FW_RELOAD"},
|
||||
#endif
|
||||
};
|
||||
|
||||
/** moal_802_11_rates */
|
||||
typedef struct _moal_802_11_rates {
|
||||
/** Num of rates */
|
||||
t_u8 num_of_rates;
|
||||
/** Rates */
|
||||
t_u8 rates[MLAN_SUPPORTED_RATES];
|
||||
} moal_802_11_rates, *pmoal_802_11_rates;
|
||||
|
||||
#if defined(STA_WEXT) || defined(UAP_WEXT)
|
||||
int woal_wext_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
|
||||
#endif
|
||||
|
||||
#endif /* _WOAL_PRIV_H_ */
|
1099
mxm_wifiex/wlan_src/mlinux/moal_proc.c
Normal file
1099
mxm_wifiex/wlan_src/mlinux/moal_proc.c
Normal file
File diff suppressed because it is too large
Load diff
174
mxm_wifiex/wlan_src/mlinux/moal_sdio.h
Normal file
174
mxm_wifiex/wlan_src/mlinux/moal_sdio.h
Normal file
|
@ -0,0 +1,174 @@
|
|||
/** @file moal_sdio.h
|
||||
*
|
||||
* @brief This file contains definitions for SDIO interface.
|
||||
* driver.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
/****************************************************
|
||||
Change log:
|
||||
****************************************************/
|
||||
|
||||
#ifndef _MOAL_SDIO_H
|
||||
#define _MOAL_SDIO_H
|
||||
|
||||
#include <linux/mmc/sdio.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
#include "moal_main.h"
|
||||
|
||||
#ifndef BLOCK_MODE
|
||||
/** Block mode */
|
||||
#define BLOCK_MODE 1
|
||||
#endif
|
||||
|
||||
#ifndef BYTE_MODE
|
||||
/** Byte Mode */
|
||||
#define BYTE_MODE 0
|
||||
#endif
|
||||
|
||||
#ifndef FIXED_ADDRESS
|
||||
/** Fixed address mode */
|
||||
#define FIXED_ADDRESS 0
|
||||
#endif
|
||||
|
||||
#if defined(SD8977)
|
||||
#define SD8977_V0 0x0
|
||||
#define SD8977_V1 0x8
|
||||
#define SD8977_V2 0x9
|
||||
#define SD8977_V0_FW_NAME "nxp/sdsd8977_combo.bin"
|
||||
#define SD8977_V1_FW_NAME "nxp/sdsd8977_combo_v1.bin"
|
||||
#define SD8977_V2_FW_NAME "nxp/sdsd8977_combo_v2.bin"
|
||||
#define SD8977_WLAN_V2_FW_NAME "nxp/sd8977_wlan_v2.bin"
|
||||
#define SD8977_WLAN_V1_FW_NAME "nxp/sd8977_wlan_v1.bin"
|
||||
#define SD8977_WLAN_V0_FW_NAME "nxp/sd8977_wlan.bin"
|
||||
#endif /* SD8977_MULTI_FW */
|
||||
|
||||
#if defined(SD8887)
|
||||
/** SD8887 chip revision ID */
|
||||
#define SD8887_A0 0x0
|
||||
#define SD8887_A2 0x2
|
||||
|
||||
#define SD8887_A0_FW_NAME "nxp/sd8887_uapsta.bin"
|
||||
#define SD8887_A2_FW_NAME "nxp/sd8887_uapsta_a2.bin"
|
||||
#define SD8887_WLAN_A2_FW_NAME "nxp/sd8887_wlan_a2.bin"
|
||||
#define SD8887_WLAN_A0_FW_NAME "nxp/sd8887_wlan.bin"
|
||||
#endif /* SD8887_MULTI_FW */
|
||||
|
||||
/** Default firmware name */
|
||||
#ifdef SD8887
|
||||
#define SD8887_DEFAULT_COMBO_FW_NAME "nxp/sd8887_uapsta_a2.bin"
|
||||
#define SD8887_DEFAULT_WLAN_FW_NAME "nxp/sd8887_wlan_a2.bin"
|
||||
#endif /* SD8887 */
|
||||
|
||||
#ifdef SD8977
|
||||
#define SD8977_DEFAULT_COMBO_FW_NAME "nxp/sdsd8977_combo_v2.bin"
|
||||
#define SD8977_DEFAULT_WLAN_FW_NAME "nxp/sd8977_wlan_v2.bin"
|
||||
#endif /* SD8977 */
|
||||
|
||||
#ifdef SD8997
|
||||
#define SD8997_DEFAULT_COMBO_FW_NAME "nxp/sdsd8997_combo_v4.bin"
|
||||
#define SDUART8997_DEFAULT_COMBO_FW_NAME "nxp/sduart8997_combo_v4.bin"
|
||||
#define SDSD8997_DEFAULT_COMBO_FW_NAME "nxp/sdsd8997_combo_v4.bin"
|
||||
#define SD8997_DEFAULT_WLAN_FW_NAME "nxp/sd8997_wlan_v4.bin"
|
||||
#endif /* SD8997 */
|
||||
|
||||
#ifdef SD8987
|
||||
#define SD8987_DEFAULT_COMBO_FW_NAME "nxp/sdsd8987_combo.bin"
|
||||
#define SDUART8987_DEFAULT_COMBO_FW_NAME "nxp/sduart8987_combo.bin"
|
||||
#define SDSD8987_DEFAULT_COMBO_FW_NAME "nxp/sdsd8987_combo.bin"
|
||||
#define SD8987_DEFAULT_WLAN_FW_NAME "nxp/sd8987_wlan.bin"
|
||||
#endif /* SD8987 */
|
||||
|
||||
#ifdef SD8897
|
||||
#define SD8897_DEFAULT_COMBO_FW_NAME "nxp/sdsd8897_uapsta.bin"
|
||||
#define SD8897_DEFAULT_WLAN_FW_NAME "nxp/sd8897_wlan.bin"
|
||||
#endif /* SD8897 */
|
||||
|
||||
#ifdef SD8978
|
||||
#define SD8978_DEFAULT_COMBO_FW_NAME "nxp/sdsd8978_combo.bin"
|
||||
#define SDUART8978_DEFAULT_COMBO_FW_NAME "nxp/sduart8978_combo.bin"
|
||||
#define SDSD8978_DEFAULT_COMBO_FW_NAME "nxp/sdsd8978_combo.bin"
|
||||
#define SD8978_DEFAULT_WLAN_FW_NAME "nxp/sd8978_wlan.bin"
|
||||
#endif /* SD8978 */
|
||||
|
||||
#ifdef SD9098
|
||||
#define SD9098_Z1Z2 0x00
|
||||
#define SD9098_A0 0x01
|
||||
#define SD9098_A1 0x02
|
||||
#define SD9098_A2 0x03
|
||||
#define SD9098_DEFAULT_COMBO_FW_NAME "nxp/sdsd9098_combo.bin"
|
||||
#define SDUART9098_DEFAULT_COMBO_FW_NAME "nxp/sduart9098_combo.bin"
|
||||
#define SDSD9098_DEFAULT_COMBO_FW_NAME "nxp/sdsd9098_combo.bin"
|
||||
#define SD9098_DEFAULT_WLAN_FW_NAME "nxp/sd9098_wlan.bin"
|
||||
#define SDUART9098_COMBO_V1_FW_NAME "nxp/sduart9098_combo_v1.bin"
|
||||
#define SDSD9098_COMBO_V1_FW_NAME "nxp/sdsd9098_combo_v1.bin"
|
||||
#define SD9098_WLAN_V1_FW_NAME "nxp/sd9098_wlan_v1.bin"
|
||||
#endif /* SD9098 */
|
||||
|
||||
#ifdef SD9097
|
||||
#define SD9097_B0 0x01
|
||||
#define SD9097_B1 0x02
|
||||
#define SD9097_DEFAULT_COMBO_FW_NAME "nxp/sdsd9097_combo_v1.bin"
|
||||
|
||||
#define SD9097_DEFAULT_WLAN_FW_NAME "nxp/sd9097_wlan_v1.bin"
|
||||
#define SDUART9097_COMBO_V1_FW_NAME "nxp/sduart9097_combo_v1.bin"
|
||||
#define SDSD9097_COMBO_V1_FW_NAME "nxp/sdsd9097_combo_v1.bin"
|
||||
#define SD9097_WLAN_V1_FW_NAME "nxp/sd9097_wlan_v1.bin"
|
||||
#endif /* SD9097 */
|
||||
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
|
||||
/** Register to bus driver function */
|
||||
mlan_status woal_sdiommc_bus_register(void);
|
||||
/** Unregister from bus driver function */
|
||||
void woal_sdiommc_bus_unregister(void);
|
||||
|
||||
int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option);
|
||||
|
||||
#ifdef SDIO_SUSPEND_RESUME
|
||||
#ifdef MMC_PM_FUNC_SUSPENDED
|
||||
/** Notify SDIO bus driver that WLAN is suspended */
|
||||
void woal_wlan_is_suspended(moal_handle *handle);
|
||||
#endif
|
||||
/** SDIO Suspend */
|
||||
int woal_sdio_suspend(struct device *dev);
|
||||
/** SDIO Resume */
|
||||
int woal_sdio_resume(struct device *dev);
|
||||
#endif /* SDIO_SUSPEND_RESUME */
|
||||
|
||||
#ifdef SDIO_MMC
|
||||
/** Structure: SDIO MMC card */
|
||||
struct sdio_mmc_card {
|
||||
/** sdio_func structure pointer */
|
||||
struct sdio_func *func;
|
||||
/** moal_handle structure pointer */
|
||||
moal_handle *handle;
|
||||
/** saved host clock value */
|
||||
unsigned int host_clock;
|
||||
};
|
||||
#endif /* SDIO_MMC */
|
||||
|
||||
/** cmd52 read write */
|
||||
int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val);
|
||||
#endif /* _MOAL_SDIO_H */
|
2106
mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c
Normal file
2106
mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c
Normal file
File diff suppressed because it is too large
Load diff
3231
mxm_wifiex/wlan_src/mlinux/moal_shim.c
Normal file
3231
mxm_wifiex/wlan_src/mlinux/moal_shim.c
Normal file
File diff suppressed because it is too large
Load diff
122
mxm_wifiex/wlan_src/mlinux/moal_shim.h
Normal file
122
mxm_wifiex/wlan_src/mlinux/moal_shim.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/** @file moal_shim.h
|
||||
*
|
||||
* @brief This file contains declaration referring to
|
||||
* functions defined in moal module
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
/*************************************************************
|
||||
* Change Log:
|
||||
* 10/21/2008: initial version
|
||||
************************************************************/
|
||||
|
||||
#ifndef _MOAL_H
|
||||
#define _MOAL_H
|
||||
|
||||
mlan_status moal_get_fw_data(t_void *pmoal_handle, t_u32 offset, t_u32 len,
|
||||
t_u8 *pbuf);
|
||||
mlan_status moal_get_vdll_data(t_void *pmoal_handle, t_u32 len, t_u8 *pbuf);
|
||||
mlan_status moal_get_hw_spec_complete(t_void *pmoal_handle, mlan_status status,
|
||||
mlan_hw_info *phw, pmlan_bss_tbl ptbl);
|
||||
mlan_status moal_init_fw_complete(t_void *pmoal_handle, mlan_status status);
|
||||
mlan_status moal_shutdown_fw_complete(t_void *pmoal_handle, mlan_status status);
|
||||
mlan_status moal_ioctl_complete(t_void *pmoal_handle,
|
||||
pmlan_ioctl_req pioctl_req, mlan_status status);
|
||||
mlan_status moal_alloc_mlan_buffer(t_void *pmoal_handle, t_u32 size,
|
||||
pmlan_buffer *pmbuf);
|
||||
mlan_status moal_free_mlan_buffer(t_void *pmoal_handle, pmlan_buffer pmbuf);
|
||||
mlan_status moal_send_packet_complete(t_void *pmoal_handle, pmlan_buffer pmbuf,
|
||||
mlan_status status);
|
||||
#ifdef USB
|
||||
mlan_status moal_recv_complete(t_void *pmoal_handle, pmlan_buffer pmbuf,
|
||||
t_u32 port, mlan_status status);
|
||||
mlan_status moal_write_data_async(t_void *pmoal_handle, pmlan_buffer pmbuf,
|
||||
t_u32 port);
|
||||
#endif
|
||||
|
||||
#if defined(SDIO) || defined(PCIE)
|
||||
/** moal_write_reg */
|
||||
mlan_status moal_write_reg(t_void *pmoal_handle, t_u32 reg, t_u32 data);
|
||||
/** moal_read_reg */
|
||||
mlan_status moal_read_reg(t_void *pmoal_handle, t_u32 reg, t_u32 *data);
|
||||
#endif /* SDIO || PCIE */
|
||||
mlan_status moal_write_data_sync(t_void *pmoal_handle, pmlan_buffer pmbuf,
|
||||
t_u32 port, t_u32 timeout);
|
||||
mlan_status moal_read_data_sync(t_void *pmoal_handle, pmlan_buffer pmbuf,
|
||||
t_u32 port, t_u32 timeout);
|
||||
mlan_status moal_recv_packet(t_void *pmoal_handle, pmlan_buffer pmbuf);
|
||||
mlan_status moal_recv_event(t_void *pmoal_handle, pmlan_event pmevent);
|
||||
mlan_status moal_malloc(t_void *pmoal_handle, t_u32 size, t_u32 flag,
|
||||
t_u8 **ppbuf);
|
||||
mlan_status moal_mfree(t_void *pmoal_handle, t_u8 *pbuf);
|
||||
mlan_status moal_vmalloc(t_void *pmoal_handle, t_u32 size, t_u8 **ppbuf);
|
||||
mlan_status moal_vfree(t_void *pmoal_handle, t_u8 *pbuf);
|
||||
#ifdef PCIE
|
||||
mlan_status moal_malloc_consistent(t_void *pmoal_handle, t_u32 size,
|
||||
t_u8 **ppbuf, t_pu64 pbuf_pa);
|
||||
mlan_status moal_mfree_consistent(t_void *pmoal_handle, t_u32 size, t_u8 *pbuf,
|
||||
t_u64 buf_pa);
|
||||
mlan_status moal_map_memory(t_void *pmoal_handle, t_u8 *pbuf, t_u64 *pbuf_pa,
|
||||
t_u32 size, t_u32 flag);
|
||||
mlan_status moal_unmap_memory(t_void *pmoal_handle, t_u8 *pbuf, t_u64 buf_pa,
|
||||
t_u32 size, t_u32 flag);
|
||||
#endif /* PCIE */
|
||||
t_void *moal_memset(t_void *pmoal_handle, t_void *pmem, t_u8 byte, t_u32 num);
|
||||
t_void *moal_memcpy(t_void *pmoal_handle, t_void *pdest, const t_void *psrc,
|
||||
t_u32 num);
|
||||
t_void *moal_memcpy_ext(t_void *pmoal_handle, t_void *pdest, const t_void *psrc,
|
||||
t_u32 num, t_u32 dest_size);
|
||||
|
||||
t_void *moal_memmove(t_void *pmoal_handle, t_void *pdest, const t_void *psrc,
|
||||
t_u32 num);
|
||||
t_s32 moal_memcmp(t_void *pmoal_handle, const t_void *pmem1,
|
||||
const t_void *pmem2, t_u32 num);
|
||||
/** moal_udelay */
|
||||
t_void moal_udelay(t_void *pmoal_handle, t_u32 udelay);
|
||||
t_void moal_usleep_range(t_void *pmoal_handle, t_u32 min_delay,
|
||||
t_u32 max_delay);
|
||||
mlan_status moal_get_boot_ktime(t_void *pmoal_handle, t_u64 *pnsec);
|
||||
mlan_status moal_get_system_time(t_void *pmoal_handle, t_u32 *psec,
|
||||
t_u32 *pusec);
|
||||
mlan_status moal_init_lock(t_void *pmoal_handle, t_void **pplock);
|
||||
mlan_status moal_free_lock(t_void *pmoal_handle, t_void *plock);
|
||||
mlan_status moal_spin_lock(t_void *pmoal_handle, t_void *plock);
|
||||
mlan_status moal_spin_unlock(t_void *pmoal_handle, t_void *plock);
|
||||
#if defined(DRV_EMBEDDED_AUTHENTICATOR) || defined(DRV_EMBEDDED_SUPPLICANT)
|
||||
mlan_status moal_wait_hostcmd_complete(t_void *pmoal_handle, t_u32 bss_index);
|
||||
mlan_status moal_notify_hostcmd_complete(t_void *pmoal_handle, t_u32 bss_index);
|
||||
#endif
|
||||
t_void moal_print(t_void *pmoal_handle, t_u32 level, char *pformat, IN...);
|
||||
t_void moal_print_netintf(t_void *pmoal_handle, t_u32 bss_index, t_u32 level);
|
||||
t_void moal_assert(t_void *pmoal_handle, t_u32 cond);
|
||||
t_void moal_hist_data_add(t_void *pmoal_handle, t_u32 bss_index, t_u16 rx_rate,
|
||||
t_s8 snr, t_s8 nflr, t_u8 antenna);
|
||||
|
||||
t_u64 moal_do_div(t_u64 num, t_u32 base);
|
||||
|
||||
mlan_status moal_init_timer(t_void *pmoal_handle, t_void **pptimer,
|
||||
IN t_void (*callback)(t_void *pcontext),
|
||||
t_void *pcontext);
|
||||
mlan_status moal_free_timer(t_void *pmoal_handle, t_void *ptimer);
|
||||
mlan_status moal_start_timer(t_void *pmoal_handle, t_void *ptimer,
|
||||
t_u8 periodic, t_u32 msec);
|
||||
mlan_status moal_stop_timer(t_void *pmoal_handle, t_void *ptimer);
|
||||
void moal_tp_accounting(t_void *pmoal_handle, void *buf, t_u32 drop_point);
|
||||
void moal_tp_accounting_rx_param(t_void *pmoal_handle, unsigned int type,
|
||||
unsigned int rsvd1);
|
||||
#endif /*_MOAL_H */
|
7893
mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c
Normal file
7893
mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c
Normal file
File diff suppressed because it is too large
Load diff
41
mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.h
Normal file
41
mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/** @file moal_sta_cfg80211.h
|
||||
*
|
||||
* @brief This file contains the STA CFG80211 specific defines.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MOAL_STA_CFG80211_H_
|
||||
#define _MOAL_STA_CFG80211_H_
|
||||
|
||||
/** Convert RSSI signal strength from dBm to mBm (100*dBm) */
|
||||
#define RSSI_DBM_TO_MDM(x) ((x)*100)
|
||||
|
||||
mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type);
|
||||
|
||||
mlan_status woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep,
|
||||
t_u32 cipher, const t_u8 *key, int key_len,
|
||||
const t_u8 *seq, int seq_len, t_u8 key_index,
|
||||
const t_u8 *addr, int disable,
|
||||
t_u8 wait_option);
|
||||
|
||||
mlan_status woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key,
|
||||
int key_len, t_u8 index,
|
||||
t_u8 wait_option);
|
||||
|
||||
#endif /* _MOAL_STA_CFG80211_H_ */
|
4526
mxm_wifiex/wlan_src/mlinux/moal_uap.c
Normal file
4526
mxm_wifiex/wlan_src/mlinux/moal_uap.c
Normal file
File diff suppressed because it is too large
Load diff
581
mxm_wifiex/wlan_src/mlinux/moal_uap.h
Normal file
581
mxm_wifiex/wlan_src/mlinux/moal_uap.h
Normal file
|
@ -0,0 +1,581 @@
|
|||
/** @file moal_uap.h
|
||||
*
|
||||
* @brief This file contains uap driver specific defines etc.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
02/02/2009: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _MOAL_UAP_H
|
||||
#define _MOAL_UAP_H
|
||||
|
||||
/** Maximum buffer length for WOAL_UAP_SET_GET_256_CHAR */
|
||||
#define MAX_BUF_LEN 256
|
||||
|
||||
/** Private command ID to send ioctl */
|
||||
#define UAP_IOCTL_CMD (SIOCDEVPRIVATE + 2)
|
||||
/** Updating ADDBA variables */
|
||||
#define UAP_ADDBA_PARA 0
|
||||
/** Updating priority table for AMPDU/AMSDU */
|
||||
#define UAP_AGGR_PRIOTBL 1
|
||||
/** Updating addbareject table */
|
||||
|
||||
#define UAP_ADDBA_REJECT 2
|
||||
/** Get FW INFO */
|
||||
#define UAP_FW_INFO 4
|
||||
/** Updating Deep sleep variables */
|
||||
#define UAP_DEEP_SLEEP 3
|
||||
/** Tx data pause subcommand */
|
||||
#define UAP_TX_DATA_PAUSE 5
|
||||
#ifdef SDIO
|
||||
/** sdcmd52 read write subcommand */
|
||||
#define UAP_SDCMD52_RW 6
|
||||
#endif
|
||||
/** snmp mib subcommand */
|
||||
#define UAP_SNMP_MIB 7
|
||||
/** domain info subcommand */
|
||||
#define UAP_DOMAIN_INFO 8
|
||||
/** TX beamforming configuration */
|
||||
#define UAP_TX_BF_CFG 9
|
||||
/** dfs testing subcommand */
|
||||
#define UAP_DFS_TESTING 10
|
||||
/** sub command ID to set/get Host Sleep configuration */
|
||||
#define UAP_HS_CFG 11
|
||||
/** sub command ID to set/get Host Sleep Parameters */
|
||||
#define UAP_HS_SET_PARA 12
|
||||
|
||||
/** Management Frame Control Mask */
|
||||
#define UAP_MGMT_FRAME_CONTROL 13
|
||||
|
||||
#define UAP_TX_RATE_CFG 14
|
||||
|
||||
/** Subcommand ID to set/get antenna configuration */
|
||||
#define UAP_ANTENNA_CFG 15
|
||||
|
||||
#define UAP_DFS_REPEATER_MODE 16
|
||||
|
||||
#define UAP_CAC_TIMER_STATUS 17
|
||||
|
||||
/** Skip CAC */
|
||||
#define UAP_SKIP_CAC 18
|
||||
|
||||
#define UAP_HT_TX_CFG 19
|
||||
|
||||
#define UAP_VHT_CFG 20
|
||||
|
||||
#define UAP_HT_STREAM_CFG 21
|
||||
|
||||
#define UAP_OPERATION_CTRL 22
|
||||
|
||||
#define UAP_CHAN_SWITCH_COUNT_CFG 23
|
||||
#define UAP_BAND_STEER 24
|
||||
|
||||
#define UAP_BEACON_STUCK_DETECT 25
|
||||
|
||||
/** Private command ID to Power Mode */
|
||||
#define UAP_POWER_MODE (SIOCDEVPRIVATE + 3)
|
||||
|
||||
/** Private command id to start/stop/reset bss */
|
||||
#define UAP_BSS_CTRL (SIOCDEVPRIVATE + 4)
|
||||
/** BSS START */
|
||||
#define UAP_BSS_START 0
|
||||
/** BSS STOP */
|
||||
#define UAP_BSS_STOP 1
|
||||
/** BSS RESET */
|
||||
#define UAP_BSS_RESET 2
|
||||
|
||||
/** wapi_msg */
|
||||
typedef struct _wapi_msg {
|
||||
/** message type */
|
||||
t_u16 msg_type;
|
||||
/** message len */
|
||||
t_u16 msg_len;
|
||||
/** message */
|
||||
t_u8 msg[96];
|
||||
} wapi_msg;
|
||||
|
||||
/* wapi key msg */
|
||||
typedef struct _wapi_key_msg {
|
||||
/** mac address */
|
||||
t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
|
||||
/** pad */
|
||||
t_u8 pad;
|
||||
/** key id */
|
||||
t_u8 key_id;
|
||||
/** key */
|
||||
t_u8 key[32];
|
||||
} wapi_key_msg;
|
||||
|
||||
/** Private command ID to set wapi info */
|
||||
#define UAP_WAPI_MSG (SIOCDEVPRIVATE + 10)
|
||||
/** set wapi flag */
|
||||
#define P80211_PACKET_WAPIFLAG 0x0001
|
||||
/** set wapi key */
|
||||
#define P80211_PACKET_SETKEY 0x0003
|
||||
/** wapi mode psk */
|
||||
#define WAPI_MODE_PSK 0x04
|
||||
/** wapi mode certificate */
|
||||
#define WAPI_MODE_CERT 0x08
|
||||
|
||||
typedef struct _tx_rate_cfg_t {
|
||||
/** sub command */
|
||||
int subcmd;
|
||||
/** Action */
|
||||
int action;
|
||||
/** Rate format */
|
||||
int rate_format;
|
||||
/** Rate configured */
|
||||
int rate;
|
||||
/** nss */
|
||||
int nss;
|
||||
/** user_data_cnt */
|
||||
int user_data_cnt;
|
||||
/** Rate bitmap */
|
||||
t_u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
|
||||
/** Rate Setting */
|
||||
t_u16 rate_setting;
|
||||
} tx_rate_cfg_t;
|
||||
|
||||
/** ant_cfg structure */
|
||||
typedef struct _ant_cfg_t {
|
||||
/** Subcommand */
|
||||
int subcmd;
|
||||
/** Action */
|
||||
int action;
|
||||
/** TX mode configured */
|
||||
int tx_mode;
|
||||
/** RX mode configured */
|
||||
int rx_mode;
|
||||
} ant_cfg_t;
|
||||
|
||||
/** htstream_cfg structure */
|
||||
typedef struct _htstream_cfg_t {
|
||||
/** Subcommand */
|
||||
int subcmd;
|
||||
/** Action */
|
||||
int action;
|
||||
/** HT stream configuration */
|
||||
t_u32 stream_cfg;
|
||||
} htstream_cfg_t;
|
||||
|
||||
/* dfs repeater mode */
|
||||
typedef struct _dfs_repeater_mode {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** set/get */
|
||||
t_u32 action;
|
||||
/** mode */
|
||||
t_u32 mode;
|
||||
} dfs_repeater_mode;
|
||||
|
||||
/* */
|
||||
typedef struct _cac_timer_status {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** set/get */
|
||||
t_u32 action;
|
||||
/** mode */
|
||||
t_u32 mode;
|
||||
} cac_timer_status;
|
||||
|
||||
/** skip_cac parameters */
|
||||
typedef struct _skip_cac_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** enable/disable deepsleep*/
|
||||
t_u16 skip_cac;
|
||||
} skip_cac_para;
|
||||
|
||||
/** radio control command */
|
||||
#define UAP_RADIO_CTL (SIOCDEVPRIVATE + 5)
|
||||
|
||||
/** Private command ID to BSS config */
|
||||
#define UAP_BSS_CONFIG (SIOCDEVPRIVATE + 6)
|
||||
|
||||
/** deauth station */
|
||||
#define UAP_STA_DEAUTH (SIOCDEVPRIVATE + 7)
|
||||
|
||||
/** enable UAP report mic error */
|
||||
#define UAP_REPORT_MIC_ERR (SIOCDEVPRIVATE + 8)
|
||||
/** uap set key */
|
||||
#define UAP_SET_KEY (SIOCDEVPRIVATE + 9)
|
||||
/** encrypt key */
|
||||
typedef struct _encrypt_key {
|
||||
/** Key index */
|
||||
t_u32 key_index;
|
||||
/** Key length */
|
||||
t_u32 key_len;
|
||||
/** Key */
|
||||
t_u8 key_material[MLAN_MAX_KEY_LENGTH];
|
||||
/** mac address */
|
||||
t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
|
||||
} encrypt_key;
|
||||
|
||||
/** pkt_header */
|
||||
typedef struct _pkt_header {
|
||||
/** pkt_len */
|
||||
u32 pkt_len;
|
||||
/** pkt_type */
|
||||
u32 TxPktType;
|
||||
/** tx control */
|
||||
u32 TxControl;
|
||||
} pkt_header;
|
||||
/** uap get station list */
|
||||
#define UAP_GET_STA_LIST (SIOCDEVPRIVATE + 11)
|
||||
/** Packet inject command ioctl number */
|
||||
#define UAPHOSTPKTINJECT WOAL_MGMT_FRAME_TX_IOCTL
|
||||
|
||||
/** Private command ID to set/get custom IE buffer */
|
||||
#define UAP_CUSTOM_IE (SIOCDEVPRIVATE + 13)
|
||||
|
||||
/** HS WAKE UP event id */
|
||||
#define UAP_EVENT_ID_HS_WAKEUP 0x80000001
|
||||
/** HS_ACTIVATED event id */
|
||||
#define UAP_EVENT_ID_DRV_HS_ACTIVATED 0x80000002
|
||||
/** HS DEACTIVATED event id */
|
||||
#define UAP_EVENT_ID_DRV_HS_DEACTIVATED 0x80000003
|
||||
|
||||
/** Host sleep flag set */
|
||||
#define HS_CFG_FLAG_GET 0
|
||||
/** Host sleep flag get */
|
||||
#define HS_CFG_FLAG_SET 1
|
||||
/** Host sleep flag for condition */
|
||||
#define HS_CFG_FLAG_CONDITION 2
|
||||
/** Host sleep flag for GPIO */
|
||||
#define HS_CFG_FLAG_GPIO 4
|
||||
/** Host sleep flag for Gap */
|
||||
#define HS_CFG_FLAG_GAP 8
|
||||
/** Host sleep flag for all */
|
||||
#define HS_CFG_FLAG_ALL 0x0f
|
||||
/** Host sleep mask to get condition */
|
||||
#define HS_CFG_CONDITION_MASK 0x0f
|
||||
|
||||
/** ds_hs_cfg */
|
||||
typedef struct _ds_hs_cfg {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Bit0: 0 - Get, 1 Set
|
||||
* Bit1: 1 - conditions is valid
|
||||
* Bit2: 2 - gpio is valid
|
||||
* Bit3: 3 - gap is valid
|
||||
*/
|
||||
t_u32 flags;
|
||||
/** Host sleep config condition */
|
||||
/** Bit0: non-unicast data
|
||||
* Bit1: unicast data
|
||||
* Bit2: mac events
|
||||
* Bit3: magic packet
|
||||
*/
|
||||
t_u32 conditions;
|
||||
/** GPIO */
|
||||
t_u32 gpio;
|
||||
/** Gap in milliseconds */
|
||||
t_u32 gap;
|
||||
} ds_hs_cfg;
|
||||
|
||||
/** Private command ID to get BSS type */
|
||||
#define UAP_GET_BSS_TYPE (SIOCDEVPRIVATE + 15)
|
||||
|
||||
/** addba_param */
|
||||
typedef struct _addba_param {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** block ack timeout for ADDBA request */
|
||||
t_u32 timeout;
|
||||
/** Buffer size for ADDBA request */
|
||||
t_u32 txwinsize;
|
||||
/** Buffer size for ADDBA response */
|
||||
t_u32 rxwinsize;
|
||||
/** amsdu for ADDBA request */
|
||||
t_u8 txamsdu;
|
||||
/** amsdu for ADDBA response */
|
||||
t_u8 rxamsdu;
|
||||
} addba_param;
|
||||
|
||||
/** aggr_prio_tbl */
|
||||
typedef struct _aggr_prio_tbl {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** ampdu priority table */
|
||||
t_u8 ampdu[MAX_NUM_TID];
|
||||
/** amsdu priority table */
|
||||
t_u8 amsdu[MAX_NUM_TID];
|
||||
} aggr_prio_tbl;
|
||||
|
||||
/** addba_reject parameters */
|
||||
typedef struct _addba_reject_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** BA Reject paramters */
|
||||
t_u8 addba_reject[MAX_NUM_TID];
|
||||
} addba_reject_para;
|
||||
|
||||
/** fw_info */
|
||||
typedef struct _fw_info {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Get */
|
||||
t_u32 action;
|
||||
/** Firmware release number */
|
||||
t_u32 fw_release_number;
|
||||
/** Device support for MIMO abstraction of MCSs */
|
||||
t_u8 hw_dev_mcs_support;
|
||||
/** fw_bands*/
|
||||
t_u8 fw_bands;
|
||||
/** Region Code */
|
||||
t_u16 region_code;
|
||||
/** 802.11n device capabilities */
|
||||
t_u32 hw_dot_11n_dev_cap;
|
||||
} fw_info;
|
||||
|
||||
typedef struct _ht_tx_cfg_para_hdr {
|
||||
/** Sub command */
|
||||
t_u32 subcmd;
|
||||
/** Action: Set/Get */
|
||||
t_u32 action;
|
||||
} ht_tx_cfg_para_hdr;
|
||||
|
||||
typedef struct _tx_bf_cfg_para_hdr {
|
||||
/** Sub command */
|
||||
t_u32 subcmd;
|
||||
/** Action: Set/Get */
|
||||
t_u32 action;
|
||||
} tx_bf_cfg_para_hdr;
|
||||
|
||||
typedef struct _vht_cfg_para_hdr {
|
||||
/** Sub command */
|
||||
t_u32 subcmd;
|
||||
/** Action: Set/Get */
|
||||
t_u32 action;
|
||||
} vht_cfg_para_hdr;
|
||||
|
||||
typedef struct _uap_oper_para_hdr {
|
||||
/** Sub command */
|
||||
t_u32 subcmd;
|
||||
/** Action: Set/Get */
|
||||
t_u32 action;
|
||||
} uap_oper_para_hdr;
|
||||
|
||||
#ifdef SDIO
|
||||
/** sdcmd52rw parameters */
|
||||
typedef struct _sdcmd52_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Write /Read */
|
||||
t_u32 action;
|
||||
/** Command 52 paramters */
|
||||
t_u8 cmd52_params[3];
|
||||
} sdcmd52_para;
|
||||
#endif
|
||||
|
||||
/** deep_sleep parameters */
|
||||
typedef struct _deep_sleep_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** enable/disable deepsleep*/
|
||||
t_u16 deep_sleep;
|
||||
/** idle_time */
|
||||
t_u16 idle_time;
|
||||
} deep_sleep_para;
|
||||
|
||||
/** band_steering parameters */
|
||||
typedef struct _band_steer_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u8 action;
|
||||
/** enable/disable band steering*/
|
||||
t_u8 state;
|
||||
/** Probe Response will be blocked to 2G channel for first
|
||||
* block_2g_prb_req probe requests*/
|
||||
t_u8 block_2g_prb_req;
|
||||
/** When band steering is enabled, limit the btm request sent to STA at
|
||||
* <max_btm_req_allowed>*/
|
||||
t_u8 max_btm_req_allowed;
|
||||
|
||||
} band_steer_para;
|
||||
|
||||
/** beacon stuck detect mechanism parameters */
|
||||
typedef struct _beacon_stuck_detect_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u8 action;
|
||||
/** No of beacon interval after which firmware will check if beacon Tx
|
||||
* is going fine */
|
||||
t_u8 beacon_stuck_detect_count;
|
||||
/** Upon performing MAC reset, no of beacon interval after which
|
||||
* firmware will check if recovery was successful */
|
||||
t_u8 recovery_confirm_count;
|
||||
} beacon_stuck_detect_para;
|
||||
|
||||
/** tx_data_pause parameters */
|
||||
typedef struct _tx_data_pause_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** enable/disable Tx data pause*/
|
||||
t_u16 txpause;
|
||||
/** Max number of TX buffer allowed for all PS client*/
|
||||
t_u16 txbufcnt;
|
||||
} tx_data_pause_para;
|
||||
|
||||
/** mgmt_frame_ctrl */
|
||||
typedef struct _mgmt_frame_ctrl {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** mask */
|
||||
t_u32 mask;
|
||||
} mgmt_frame_ctrl;
|
||||
|
||||
typedef struct _snmp_mib_para {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** oid to set/get */
|
||||
t_u16 oid;
|
||||
/** length of oid value */
|
||||
t_u16 oid_val_len;
|
||||
/** oid value to set/get */
|
||||
t_u8 oid_value[];
|
||||
} snmp_mib_para;
|
||||
|
||||
/** Max length for oid_value field */
|
||||
#define MAX_SNMP_VALUE_SIZE 128
|
||||
|
||||
/** Oid for 802.11D enable/disable */
|
||||
#define OID_80211D_ENABLE 0x0009
|
||||
/** Oid for 802.11H enable/disable */
|
||||
#define OID_80211H_ENABLE 0x000a
|
||||
|
||||
/** dfs_testing parameters */
|
||||
typedef struct _dfs_testing_param {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** user CAC period (msec) */
|
||||
t_u32 usr_cac_period;
|
||||
/** user NOP period (sec) */
|
||||
t_u16 usr_nop_period;
|
||||
/** don't change channel on radar */
|
||||
t_u8 no_chan_change;
|
||||
/** fixed channel to change to on radar */
|
||||
t_u8 fixed_new_chan;
|
||||
/** CAC restart */
|
||||
t_u8 cac_restart;
|
||||
} dfs_testing_para;
|
||||
|
||||
/** Channel switch count config */
|
||||
typedef struct _cscount_cfg_t {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** user channel switch count */
|
||||
t_u8 cs_count;
|
||||
} cscount_cfg_t;
|
||||
|
||||
/** domain_info parameters */
|
||||
typedef struct _domain_info_param {
|
||||
/** subcmd */
|
||||
t_u32 subcmd;
|
||||
/** Set/Get */
|
||||
t_u32 action;
|
||||
/** domain_param TLV (incl. header) */
|
||||
t_u8 tlv[];
|
||||
} domain_info_para;
|
||||
|
||||
/** DOMAIN_INFO param sizes */
|
||||
#define TLV_HEADER_LEN (2 + 2)
|
||||
#define SUB_BAND_LEN 3
|
||||
#define MAX_SUB_BANDS 40
|
||||
|
||||
/** MAX domain TLV length */
|
||||
#define MAX_DOMAIN_TLV_LEN \
|
||||
(TLV_HEADER_LEN + COUNTRY_CODE_LEN + (SUB_BAND_LEN * MAX_SUB_BANDS))
|
||||
|
||||
int woal_set_get_uap_power_mode(moal_private *priv, t_u32 action,
|
||||
mlan_ds_ps_mgmt *ps_mgmt);
|
||||
void woal_uap_set_multicast_list(struct net_device *dev);
|
||||
int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
|
||||
int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data);
|
||||
#ifdef UAP_CFG80211
|
||||
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)
|
||||
int woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option,
|
||||
pmlan_ds_11h_chan_nop_info ch_info);
|
||||
#endif
|
||||
#endif
|
||||
mlan_status woal_set_get_ap_channel(moal_private *priv, t_u16 action,
|
||||
t_u8 wait_option,
|
||||
pchan_band_info uap_channel);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
void woal_uap_get_version(moal_private *priv, char *version, int max_len);
|
||||
#endif
|
||||
mlan_status woal_uap_get_stats(moal_private *priv, t_u8 wait_option,
|
||||
pmlan_ds_uap_stats ustats);
|
||||
#if defined(UAP_WEXT) || defined(UAP_CFG80211)
|
||||
extern struct iw_handler_def woal_uap_handler_def;
|
||||
struct iw_statistics *woal_get_uap_wireless_stats(struct net_device *dev);
|
||||
/** IOCTL function for wireless private IOCTLs */
|
||||
int woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
|
||||
#endif
|
||||
/** Set invalid data for each member of mlan_uap_bss_param */
|
||||
void woal_set_sys_config_invalid_data(pmlan_uap_bss_param config);
|
||||
/** Set/Get system configuration parameters */
|
||||
mlan_status woal_set_get_sys_config(moal_private *priv, t_u16 action,
|
||||
t_u8 wait_option,
|
||||
mlan_uap_bss_param *sys_cfg);
|
||||
/** Set get AP wmm parameter */
|
||||
mlan_status woal_set_get_ap_wmm_para(moal_private *priv, t_u16 action,
|
||||
wmm_parameter_t *ap_wmm_para);
|
||||
int woal_uap_set_ap_cfg(moal_private *priv, t_u8 *data, int len);
|
||||
int woal_uap_set_11ac_status(moal_private *priv, t_u8 action, t_u8 vht20_40,
|
||||
IEEEtypes_VHTCap_t *vhtcap_ie);
|
||||
int woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg *he_cfg);
|
||||
int woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band,
|
||||
IEEEtypes_HECap_t *hecap_ie);
|
||||
int woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg,
|
||||
t_u16 ht_cap, t_u8 en);
|
||||
mlan_status woal_uap_set_11n_status(moal_private *priv,
|
||||
mlan_uap_bss_param *sys_cfg, t_u8 action);
|
||||
#ifdef UAP_WEXT
|
||||
void woal_ioctl_get_uap_info_resp(moal_private *priv, pmlan_ds_get_info info);
|
||||
int woal_set_get_custom_ie(moal_private *priv, t_u16 mask, t_u8 *ie,
|
||||
int ie_len);
|
||||
#endif /* UAP_WEXT */
|
||||
|
||||
#endif /* _MOAL_UAP_H */
|
3259
mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c
Normal file
3259
mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c
Normal file
File diff suppressed because it is too large
Load diff
30
mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h
Normal file
30
mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/** @file moal_uap_cfg80211.h
|
||||
*
|
||||
* @brief This file contains the uAP CFG80211 specific defines.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MOAL_UAP_CFG80211_H_
|
||||
#define _MOAL_UAP_CFG80211_H_
|
||||
|
||||
#include "moal_uap.h"
|
||||
|
||||
mlan_status woal_register_uap_cfg80211(struct net_device *dev, t_u8 bss_type);
|
||||
|
||||
#endif /* _MOAL_UAP_CFG80211_H_ */
|
179
mxm_wifiex/wlan_src/mlinux/moal_uap_priv.c
Normal file
179
mxm_wifiex/wlan_src/mlinux/moal_uap_priv.c
Normal file
|
@ -0,0 +1,179 @@
|
|||
/** @file moal_uap_priv.c
|
||||
*
|
||||
* @brief This file contains standard ioctl functions
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/************************************************************************
|
||||
Change log:
|
||||
08/06/2010: initial version
|
||||
************************************************************************/
|
||||
|
||||
#include "moal_main.h"
|
||||
#include "moal_uap.h"
|
||||
#include "moal_uap_priv.h"
|
||||
|
||||
/********************************************************
|
||||
Local Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Variables
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Local Functions
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
Global Functions
|
||||
********************************************************/
|
||||
|
||||
/**
|
||||
* @brief ioctl function for wireless IOCTLs
|
||||
*
|
||||
* @param dev A pointer to net_device structure
|
||||
* @param req A pointer to ifreq structure
|
||||
* @param cmd Command
|
||||
*
|
||||
* @return 0 --success, otherwise fail
|
||||
*/
|
||||
int woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
||||
{
|
||||
moal_private *priv = (moal_private *)netdev_priv(dev);
|
||||
struct iwreq *wrq = (struct iwreq *)req;
|
||||
int ret = 0;
|
||||
|
||||
ENTER();
|
||||
|
||||
switch (cmd) {
|
||||
case WOAL_UAP_SETNONE_GETNONE:
|
||||
switch (wrq->u.data.flags) {
|
||||
case WOAL_UAP_START:
|
||||
break;
|
||||
case WOAL_UAP_STOP:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT,
|
||||
UAP_BSS_STOP);
|
||||
break;
|
||||
case WOAL_AP_BSS_START:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT,
|
||||
UAP_BSS_START);
|
||||
break;
|
||||
case WOAL_AP_BSS_STOP:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT,
|
||||
UAP_BSS_STOP);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WOAL_UAP_SETONEINT_GETWORDCHAR:
|
||||
switch (wrq->u.data.flags) {
|
||||
case WOAL_UAP_VERSION:
|
||||
ret = woal_get_driver_version(priv, req);
|
||||
break;
|
||||
case WOAL_UAP_VEREXT:
|
||||
ret = woal_get_driver_verext(priv, req);
|
||||
break;
|
||||
default:
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WOAL_UAP_SET_GET_256_CHAR:
|
||||
switch (wrq->u.data.flags) {
|
||||
case WOAL_WL_FW_RELOAD:
|
||||
break;
|
||||
case WOAL_AP_SET_CFG:
|
||||
ret = woal_uap_set_ap_cfg(priv, wrq->u.data.pointer,
|
||||
wrq->u.data.length);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
case WOAL_UAP_SETONEINT_GETONEINT:
|
||||
switch (wrq->u.data.flags) {
|
||||
case WOAL_UAP_SET_GET_BSS_ROLE:
|
||||
ret = woal_set_get_bss_role(priv, wrq);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case WOAL_UAP_HOST_CMD:
|
||||
ret = woal_host_command(priv, wrq);
|
||||
break;
|
||||
case WOAL_UAP_FROYO_START:
|
||||
break;
|
||||
case WOAL_UAP_FROYO_STOP:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP);
|
||||
break;
|
||||
case WOAL_UAP_FROYO_AP_BSS_START:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START);
|
||||
break;
|
||||
case WOAL_UAP_FROYO_AP_BSS_STOP:
|
||||
ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP);
|
||||
break;
|
||||
case WOAL_UAP_FROYO_WL_FW_RELOAD:
|
||||
break;
|
||||
case WOAL_UAP_FROYO_AP_SET_CFG:
|
||||
ret = woal_uap_set_ap_cfg(priv, wrq->u.data.pointer,
|
||||
wrq->u.data.length);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle get info resp
|
||||
*
|
||||
* @param priv Pointer to moal_private structure
|
||||
* @param info Pointer to mlan_ds_get_info structure
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void woal_ioctl_get_uap_info_resp(moal_private *priv, mlan_ds_get_info *info)
|
||||
{
|
||||
ENTER();
|
||||
switch (info->sub_command) {
|
||||
case MLAN_OID_GET_STATS:
|
||||
priv->w_stats.discard.fragment =
|
||||
info->param.ustats.fcs_error_count;
|
||||
priv->w_stats.discard.retries = info->param.ustats.retry_count;
|
||||
priv->w_stats.discard.misc =
|
||||
info->param.ustats.ack_failure_count;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
LEAVE();
|
||||
}
|
128
mxm_wifiex/wlan_src/mlinux/moal_uap_priv.h
Normal file
128
mxm_wifiex/wlan_src/mlinux/moal_uap_priv.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
/** @file moal_uap_priv.h
|
||||
*
|
||||
* @brief This file contains definition for extended private IOCTL call.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/************************************************************************
|
||||
Change log:
|
||||
08/06/2010: initial version
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _MOAL_UAP_PRIV_H_
|
||||
#define _MOAL_UAP_PRIV_H_
|
||||
|
||||
/** Private command ID */
|
||||
#define WOAL_UAP_IOCTL 0x8BE0
|
||||
|
||||
/** Private command to get/set 256 chars */
|
||||
#define WOAL_UAP_SET_GET_256_CHAR (WOAL_UAP_IOCTL + 1)
|
||||
/** Private command ID to FW reload */
|
||||
#define WOAL_WL_FW_RELOAD 1
|
||||
/** Private command ID to set AP configuration */
|
||||
#define WOAL_AP_SET_CFG 2
|
||||
|
||||
/** Private command ID to set/get none */
|
||||
#define WOAL_UAP_SETNONE_GETNONE (WOAL_UAP_IOCTL + 2)
|
||||
/** Private command ID to start UAP */
|
||||
#define WOAL_UAP_START 1
|
||||
/** Private command ID to stop UAP */
|
||||
#define WOAL_UAP_STOP 2
|
||||
/** Private command ID to start AP BSS */
|
||||
#define WOAL_AP_BSS_START 3
|
||||
/** Private command ID to stop AP BSS */
|
||||
#define WOAL_AP_BSS_STOP 4
|
||||
|
||||
/** Private command ID to set one int/get word char */
|
||||
#define WOAL_UAP_SETONEINT_GETWORDCHAR (WOAL_UAP_IOCTL + 3)
|
||||
/** Private command ID to get version */
|
||||
#define WOAL_UAP_VERSION 1
|
||||
/** Private command ID to get extended version */
|
||||
#define WOAL_UAP_VEREXT 2
|
||||
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
/** Private command ID to set one int/get one int */
|
||||
#define WOAL_UAP_SETONEINT_GETONEINT (WOAL_UAP_IOCTL + 5)
|
||||
/** Private command ID for set/get BSS role */
|
||||
#define WOAL_UAP_SET_GET_BSS_ROLE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Private command ID for hostcmd */
|
||||
#define WOAL_UAP_HOST_CMD (WOAL_UAP_IOCTL + 17)
|
||||
|
||||
/** The following command IDs are for Froyo app */
|
||||
/** Private command ID to start AP BSS */
|
||||
#define WOAL_UAP_FROYO_AP_BSS_START (WOAL_UAP_IOCTL + 24)
|
||||
/** Private command ID to stop AP BSS */
|
||||
#define WOAL_UAP_FROYO_AP_BSS_STOP (WOAL_UAP_IOCTL + 26)
|
||||
/** Private command ID to set AP config */
|
||||
#define WOAL_UAP_FROYO_AP_SET_CFG (WOAL_UAP_IOCTL + 27)
|
||||
/** Private command ID to start driver */
|
||||
#define WOAL_UAP_FROYO_START (WOAL_UAP_IOCTL + 28)
|
||||
/** Private command ID to reload FW */
|
||||
#define WOAL_UAP_FROYO_WL_FW_RELOAD (WOAL_UAP_IOCTL + 29)
|
||||
/** Private command ID to stop driver */
|
||||
#define WOAL_UAP_FROYO_STOP (WOAL_UAP_IOCTL + 30)
|
||||
|
||||
/**
|
||||
* iwpriv ioctl handlers
|
||||
*/
|
||||
static const struct iw_priv_args woal_uap_priv_args[] = {
|
||||
{WOAL_UAP_SETNONE_GETNONE, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, ""},
|
||||
{WOAL_UAP_START, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "start"},
|
||||
{WOAL_UAP_STOP, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "stop"},
|
||||
{WOAL_AP_BSS_START, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "bssstart"},
|
||||
{WOAL_AP_BSS_STOP, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "bssstop"},
|
||||
{WOAL_UAP_SETONEINT_GETWORDCHAR, IW_PRIV_TYPE_INT | 1,
|
||||
IW_PRIV_TYPE_CHAR | 128, ""},
|
||||
{WOAL_UAP_VERSION, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_CHAR | 128,
|
||||
"version"},
|
||||
{WOAL_UAP_VEREXT, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_CHAR | 128,
|
||||
"verext"},
|
||||
#ifdef WIFI_DIRECT_SUPPORT
|
||||
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
|
||||
{WOAL_UAP_SETONEINT_GETONEINT, IW_PRIV_TYPE_INT | 1,
|
||||
IW_PRIV_TYPE_INT | 1, ""},
|
||||
{WOAL_UAP_SET_GET_BSS_ROLE, IW_PRIV_TYPE_INT | 1, IW_PRIV_TYPE_INT | 1,
|
||||
"bssrole"},
|
||||
#endif
|
||||
#endif
|
||||
{WOAL_UAP_SET_GET_256_CHAR, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, ""},
|
||||
{WOAL_WL_FW_RELOAD, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"fwreload"},
|
||||
{WOAL_AP_SET_CFG, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | 256,
|
||||
"apcfg"},
|
||||
{WOAL_UAP_HOST_CMD, IW_PRIV_TYPE_BYTE | 2047, IW_PRIV_TYPE_BYTE | 2047,
|
||||
"hostcmd"},
|
||||
{WOAL_UAP_FROYO_START, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "START"},
|
||||
{WOAL_UAP_FROYO_STOP, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE, "STOP"},
|
||||
{WOAL_UAP_FROYO_AP_BSS_START, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE,
|
||||
"AP_BSS_START"},
|
||||
{WOAL_UAP_FROYO_AP_BSS_STOP, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_NONE,
|
||||
"AP_BSS_STOP"},
|
||||
{WOAL_UAP_FROYO_WL_FW_RELOAD, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, "WL_FW_RELOAD"},
|
||||
{WOAL_UAP_FROYO_AP_SET_CFG, IW_PRIV_TYPE_CHAR | 256,
|
||||
IW_PRIV_TYPE_CHAR | 256, "AP_SET_CFG"},
|
||||
};
|
||||
|
||||
#endif /* _MOAL_UAP_PRIV_H_ */
|
1865
mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c
Normal file
1865
mxm_wifiex/wlan_src/mlinux/moal_uap_wext.c
Normal file
File diff suppressed because it is too large
Load diff
2028
mxm_wifiex/wlan_src/mlinux/moal_usb.c
Normal file
2028
mxm_wifiex/wlan_src/mlinux/moal_usb.c
Normal file
File diff suppressed because it is too large
Load diff
234
mxm_wifiex/wlan_src/mlinux/moal_usb.h
Normal file
234
mxm_wifiex/wlan_src/mlinux/moal_usb.h
Normal file
|
@ -0,0 +1,234 @@
|
|||
/** @file moal_usb.h
|
||||
*
|
||||
* @brief This file contains definitions for USB interface.
|
||||
* driver.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
/*************************************************************
|
||||
Change Log:
|
||||
10/21/2008: initial version
|
||||
************************************************************/
|
||||
|
||||
#ifndef _MOAL_USB_H
|
||||
#define _MOAL_USB_H
|
||||
|
||||
#ifdef USB8997
|
||||
/** USB VID 1 */
|
||||
#define USB8997_VID_1 0x1286
|
||||
/** USB PID 1 */
|
||||
#define USB8997_PID_1 0x204D
|
||||
/** USB PID 2 */
|
||||
#define USB8997_PID_2 0x204E
|
||||
#define USB8997_PID_3 0x2047
|
||||
#define USB8997_PID_4 0x2048
|
||||
#define USB8997_PID_5 0x2050
|
||||
#define USB8997_PID_6 0x2051
|
||||
#define USB8997V2_PID_1 0x2052
|
||||
#endif /* USB8997 */
|
||||
|
||||
#ifdef USB8978
|
||||
/** USB VID 1 */
|
||||
#define USB8978_VID_1 0x1286
|
||||
/** USB PID 1 */
|
||||
#define USB8978_PID_1 0x2062
|
||||
/** USB PID 2 */
|
||||
#define USB8978_PID_2 0x2063
|
||||
/* BT downloaded combo firmware; register for WLAN enumeration */
|
||||
#define USB8978_PID_1_BT 0x2064
|
||||
#define USB8978_PID_2_BT 0x2065
|
||||
#endif
|
||||
|
||||
#ifdef USB8897
|
||||
/** USB VID 1 */
|
||||
#define USB8897_VID_1 0x1286
|
||||
/** USB PID 1 */
|
||||
#define USB8897_PID_1 0x2045
|
||||
/** USB PID 2 */
|
||||
#define USB8897_PID_2 0x2046
|
||||
#endif /* USB8897 */
|
||||
|
||||
#ifdef USB9098
|
||||
/** USB VID 1 */
|
||||
#define USB9098_VID_1 0x1286
|
||||
/** USB PID 1 */
|
||||
#define USB9098_PID_1 0x2056
|
||||
/** USB PID 2 */
|
||||
#define USB9098_PID_2 0x2057
|
||||
#endif /* USB9098 */
|
||||
|
||||
#ifdef USB9097
|
||||
/** USB VID 1 */
|
||||
#define USB9097_VID_1 0x1286
|
||||
/** USB PID 1 */
|
||||
#define USB9097_PID_1 0x2060
|
||||
/** USB PID 2 */
|
||||
#define USB9097_PID_2 0x2061
|
||||
#endif /* USB9097 */
|
||||
|
||||
/** Boot state: FW download */
|
||||
#define USB_FW_DNLD 1
|
||||
/** Boot state: FW ready */
|
||||
#define USB_FW_READY 2
|
||||
|
||||
/** High watermark for Tx data */
|
||||
#define MVUSB_TX_HIGH_WMARK 12
|
||||
|
||||
/** Number of Rx data URB */
|
||||
#define MVUSB_RX_DATA_URB 6
|
||||
|
||||
#if defined(USB8997) || defined(USB9098) || defined(USB9097) || defined(USB8978)
|
||||
/* Transmit buffer size for chip revision check */
|
||||
#define CHIP_REV_TX_BUF_SIZE 16
|
||||
/* Receive buffer size for chip revision check */
|
||||
#define CHIP_REV_RX_BUF_SIZE 2048
|
||||
|
||||
/* Extensions */
|
||||
#define EXTEND_HDR (0xAB950000)
|
||||
#define EXTEND_V1 (0x00000001)
|
||||
#define EXTEND_V2 (0x00000002)
|
||||
|
||||
#endif
|
||||
|
||||
/** Default firmaware name */
|
||||
#ifdef USB8997
|
||||
#define USB8997_DEFAULT_COMBO_FW_NAME "nxp/usbusb8997_combo_v4.bin"
|
||||
#define USB8997_DEFAULT_WLAN_FW_NAME "nxp/usb8997_wlan_v4.bin"
|
||||
#define USBUART8997_DEFAULT_COMBO_FW_NAME "nxp/usbuart8997_combo_v4.bin"
|
||||
#define USBUSB8997_DEFAULT_COMBO_FW_NAME "nxp/usbusb8997_combo_v4.bin"
|
||||
|
||||
#endif /* USB8997 */
|
||||
|
||||
#ifdef USB8978
|
||||
#define USB8978_DEFAULT_COMBO_FW_NAME "nxp/usbusb8978_combo.bin"
|
||||
#define USB8978_DEFAULT_WLAN_FW_NAME "nxp/usb8978_wlan.bin"
|
||||
#define USBUART8978_DEFAULT_COMBO_FW_NAME "nxp/usbuart8978_combo.bin"
|
||||
#define USBUSB8978_DEFAULT_COMBO_FW_NAME "nxp/usbusb8978_combo.bin"
|
||||
#endif /* USB8978 */
|
||||
|
||||
#ifdef USB8897
|
||||
#define USB8897_DEFAULT_COMBO_FW_NAME "nxp/usb8897_uapsta.bin"
|
||||
#define USB8897_DEFAULT_WLAN_FW_NAME "nxp/usb8897_wlan.bin"
|
||||
#endif /* USB8897 */
|
||||
|
||||
#ifdef USB9098
|
||||
#define USB9098_Z1Z2 0x00
|
||||
#define USB9098_A0 0x01
|
||||
#define USB9098_A1 0x02
|
||||
#define USB9098_A2 0x03
|
||||
#define USB9098_DEFAULT_COMBO_FW_NAME "nxp/usbusb9098_combo.bin"
|
||||
#define USB9098_DEFAULT_WLAN_FW_NAME "nxp/usb9098_wlan.bin"
|
||||
#define USBUART9098_DEFAULT_COMBO_FW_NAME "nxp/usbuart9098_combo.bin"
|
||||
#define USBUSB9098_DEFAULT_COMBO_FW_NAME "nxp/usbusb9098_combo.bin"
|
||||
#define USB9098_WLAN_V1_FW_NAME "nxp/usb9098_wlan_v1.bin"
|
||||
#define USBUART9098_COMBO_V1_FW_NAME "nxp/usbuart9098_combo_v1.bin"
|
||||
#define USBUSB9098_COMBO_V1_FW_NAME "nxp/usbusb9098_combo_v1.bin"
|
||||
#endif /* USB9098 */
|
||||
|
||||
#ifdef USB9097
|
||||
#define USB9097_B0 0x01
|
||||
#define USB9097_B1 0x02
|
||||
#define USB9097_DEFAULT_COMBO_FW_NAME "nxp/usbusb9097_combo_v1.bin"
|
||||
#define USB9097_DEFAULT_WLAN_FW_NAME "nxp/usb9097_wlan_v1.bin"
|
||||
#define USB9097_WLAN_V1_FW_NAME "nxp/usb9097_wlan_v1.bin"
|
||||
#define USBUART9097_COMBO_V1_FW_NAME "nxp/usbuart9097_combo_v1.bin"
|
||||
#define USBUSB9097_COMBO_V1_FW_NAME "nxp/usbusb9097_combo_v1.bin"
|
||||
#endif /* USB9097 */
|
||||
|
||||
/** urb context */
|
||||
typedef struct _urb_context {
|
||||
/** Pointer to moal_handle structure */
|
||||
moal_handle *handle;
|
||||
/** Pointer to mlan buffer */
|
||||
mlan_buffer *pmbuf;
|
||||
/** URB */
|
||||
struct urb *urb;
|
||||
/** EP */
|
||||
t_u8 ep;
|
||||
} urb_context;
|
||||
|
||||
/** USB card description structure*/
|
||||
struct usb_card_rec {
|
||||
/** USB device */
|
||||
struct usb_device *udev;
|
||||
/** MOAL handle */
|
||||
moal_handle *phandle;
|
||||
/** USB interface */
|
||||
struct usb_interface *intf;
|
||||
/** Rx command endpoint type */
|
||||
int rx_cmd_ep_type;
|
||||
/** Rx command interval for INTR type */
|
||||
t_u8 rx_cmd_interval;
|
||||
/** Rx data endpoint address */
|
||||
t_u8 rx_cmd_ep;
|
||||
/** Rx cmd contxt */
|
||||
urb_context rx_cmd;
|
||||
/** Rx command URB pending count */
|
||||
atomic_t rx_cmd_urb_pending;
|
||||
/** Rx data context list */
|
||||
urb_context rx_data_list[MVUSB_RX_DATA_URB];
|
||||
/** Flag to indicate boot state */
|
||||
t_u8 boot_state;
|
||||
/** Rx data endpoint address */
|
||||
t_u8 rx_data_ep;
|
||||
/** Rx data URB pending count */
|
||||
atomic_t rx_data_urb_pending;
|
||||
/** Tx data endpoint address */
|
||||
t_u8 tx_data_ep;
|
||||
/** Tx command endpoint type */
|
||||
int tx_cmd_ep_type;
|
||||
/** Tx command interval for INTR type */
|
||||
t_u8 tx_cmd_interval;
|
||||
/** Tx command endpoint address */
|
||||
t_u8 tx_cmd_ep;
|
||||
/** Tx data URB pending count */
|
||||
atomic_t tx_data_urb_pending;
|
||||
/** Tx command URB pending count */
|
||||
atomic_t tx_cmd_urb_pending;
|
||||
/** Tx data endpoint max pkt size */
|
||||
int tx_data_maxpktsize;
|
||||
/** Tx cmd endpoint max pkt size */
|
||||
int tx_cmd_maxpktsize;
|
||||
/** Pre-allocated urb for command */
|
||||
urb_context tx_cmd;
|
||||
/** Index to point to next data urb to use */
|
||||
int tx_data_ix;
|
||||
/** Pre-allocated urb for data */
|
||||
urb_context tx_data_list[MVUSB_TX_HIGH_WMARK];
|
||||
usb_aggr_ctrl tx_aggr_ctrl;
|
||||
usb_aggr_ctrl rx_deaggr_ctrl;
|
||||
t_u8 resubmit_urbs;
|
||||
/** USB card type */
|
||||
t_u16 card_type;
|
||||
t_u8 second_mac;
|
||||
};
|
||||
|
||||
void woal_kill_urbs(moal_handle *handle);
|
||||
void woal_resubmit_urbs(moal_handle *handle);
|
||||
|
||||
mlan_status woal_write_data_async(moal_handle *handle, mlan_buffer *pmbuf,
|
||||
t_u8 ep);
|
||||
mlan_status woal_usb_submit_rx_data_urbs(moal_handle *handle);
|
||||
mlan_status woal_usb_rx_init(moal_handle *handle);
|
||||
mlan_status woal_usb_tx_init(moal_handle *handle);
|
||||
mlan_status woal_usb_aggr_init(moal_handle *handle);
|
||||
void woal_submit_rx_urb(moal_handle *handle, t_u8 ep);
|
||||
void woal_usb_bus_unregister(void);
|
||||
mlan_status woal_usb_bus_register(void);
|
||||
void woal_usb_free(struct usb_card_rec *cardp);
|
||||
#endif /*_MOAL_USB_H */
|
3175
mxm_wifiex/wlan_src/mlinux/moal_wext.c
Normal file
3175
mxm_wifiex/wlan_src/mlinux/moal_wext.c
Normal file
File diff suppressed because it is too large
Load diff
58
mxm_wifiex/wlan_src/mlinux/moal_wext.h
Normal file
58
mxm_wifiex/wlan_src/mlinux/moal_wext.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/** @file moal_wext.h
|
||||
*
|
||||
* @brief This file contains definition for wireless extension IOCTL call.
|
||||
*
|
||||
*
|
||||
* Copyright 2014-2020 NXP
|
||||
*
|
||||
* This software file (the File) is distributed by NXP
|
||||
* under the terms of the GNU General Public License Version 2, June 1991
|
||||
* (the License). You may use, redistribute and/or modify the File in
|
||||
* accordance with the terms and conditions of the License, a copy of which
|
||||
* is available by writing to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
||||
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
*
|
||||
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
||||
* this warranty disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************
|
||||
Change log:
|
||||
10/21/2008: initial version
|
||||
********************************************************/
|
||||
|
||||
#ifndef _WOAL_WEXT_H_
|
||||
#define _WOAL_WEXT_H_
|
||||
|
||||
/** NF value for default scan */
|
||||
#define MRVDRV_NF_DEFAULT_SCAN_VALUE (-96)
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
/** Add event */
|
||||
#define IWE_STREAM_ADD_EVENT(i, c, e, w, l) \
|
||||
iwe_stream_add_event((i), (c), (e), (w), (l))
|
||||
/** Add point */
|
||||
#define IWE_STREAM_ADD_POINT(i, c, e, w, p) \
|
||||
iwe_stream_add_point((i), (c), (e), (w), (p))
|
||||
/** Add value */
|
||||
#define IWE_STREAM_ADD_VALUE(i, c, v, e, w, l) \
|
||||
iwe_stream_add_value((i), (c), (v), (e), (w), (l))
|
||||
#else
|
||||
/** Add event */
|
||||
#define IWE_STREAM_ADD_EVENT(i, c, e, w, l) \
|
||||
iwe_stream_add_event((c), (e), (w), (l))
|
||||
/** Add point */
|
||||
#define IWE_STREAM_ADD_POINT(i, c, e, w, p) \
|
||||
iwe_stream_add_point((c), (e), (w), (p))
|
||||
/** Add value */
|
||||
#define IWE_STREAM_ADD_VALUE(i, c, v, e, w, l) \
|
||||
iwe_stream_add_value((c), (v), (e), (w), (l))
|
||||
#endif
|
||||
|
||||
extern struct iw_handler_def woal_handler_def;
|
||||
struct iw_statistics *woal_get_wireless_stats(struct net_device *dev);
|
||||
#endif /* _WOAL_WEXT_H_ */
|
Loading…
Reference in a new issue