Add 'qcom/opensource/wlan/qcacld-3.0/' from commit 'f5a566817a453ad657922a9aa68024db4d1ac3c7'

git-subtree-dir: qcom/opensource/wlan/qcacld-3.0
git-subtree-mainline: 925e49bf4f
git-subtree-split: f5a566817a
Change-Id:
repo: https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/wlan/qcacld-3.0
tag: LA.VENDOR.14.3.0.r1-17300-lanai.QSSI15.0
This commit is contained in:
David Wronek 2024-10-06 16:48:36 +02:00
commit 5add812a59
1243 changed files with 963166 additions and 0 deletions

View File

@ -0,0 +1,390 @@
# Android makefile for the WLAN Module
# set WLAN_BUILD_DEBUG=y in your environment to enable debug logging
define wlog
$(if $(WLAN_BUILD_DEBUG),$(info $(1)))
endef
define target_is_dual_wlan
$(strip \
$(if $(TARGET_SUPPORT_DUAL_WLAN), \
$(if $(findstring cnss2,$(1)),true,), \
) \
)
endef
LOCAL_MODULE_DDK_BUILD := false
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := false
ifeq ($(TARGET_BOARD_PLATFORM), sun)
LOCAL_MODULE_DDK_BUILD := true
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
endif
ifeq ($(TARGET_BOARD_PLATFORM), pineapple)
LOCAL_MODULE_DDK_BUILD := true
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
endif
ifeq ($(TARGET_BOARD_PLATFORM), niobe)
LOCAL_MODULE_DDK_BUILD := true
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
endif
ifeq ($(TARGET_BOARD_PLATFORM), volcano)
LOCAL_MODULE_DDK_BUILD := true
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
endif
ifeq ($(TARGET_BOARD_PLATFORM),parrot)
ifeq ($(TARGET_BOARD_SUFFIX),66)
LOCAL_MODULE_DDK_BUILD := true
LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
endif
endif
LOCAL_PATH := $(call my-dir)
$(call wlog,LOCAL_PATH=$(LOCAL_PATH))
BOARD_OPENSOURCE_DIR ?= vendor/qcom/opensource
ENABLE_QCACLD := true
ifeq ($(TARGET_USES_QMAA), true)
ifneq ($(TARGET_USES_QMAA_OVERRIDE_WLAN), true)
ENABLE_QCACLD := false
else
ENABLE_QCACLD := true
endif
endif
ifeq ($(BOARD_COMMON_DIR),)
BOARD_COMMON_DIR := device/qcom/common
endif
ifeq ($(ENABLE_QCACLD), true)
# Assume no targets will be supported
WLAN_CHIPSET :=
ifeq ($(BOARD_HAS_QCOM_WLAN), true)
# Check if this driver needs be built for current target
ifneq ($(findstring qca_cld3,$(WIFI_DRIVER_BUILT)),)
WLAN_CHIPSET := qca_cld3
WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
endif
# Build/Package only in case of supported target
ifneq ($(WLAN_CHIPSET),)
# This makefile is only for DLKM
ifneq ($(findstring vendor,$(LOCAL_PATH)),)
ifneq ($(findstring opensource,$(LOCAL_PATH)),)
WLAN_BLD_DIR := $(BOARD_OPENSOURCE_DIR)/wlan
endif # opensource
# Multi-ko check
LOCAL_DEV_NAME := $(patsubst .%,%,\
$(lastword $(strip $(subst /, ,$(LOCAL_PATH)))))
$(call wlog,LOCAL_DEV_NAME=$(LOCAL_DEV_NAME))
$(call wlog,TARGET_WLAN_CHIP=$(TARGET_WLAN_CHIP))
TARGET_WLAN_CHIP ?= wlan
LOCAL_MULTI_KO := false
ifneq ($(TARGET_WLAN_CHIP), wlan)
ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
LOCAL_MULTI_KO := true
endif
endif
ifeq ($(LOCAL_MULTI_KO), true)
LOCAL_ANDROID_ROOT := $(shell pwd)
LOCAL_WLAN_BLD_DIR := $(LOCAL_ANDROID_ROOT)/$(WLAN_BLD_DIR)
$(shell `find $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/ -maxdepth 1 -name '.*' ! -name '.git' -delete`)
ifeq ($(LOCAL_MODULE_DDK_BUILD), true)
ifeq ($(CHIPSET),)
$(foreach chip, $(TARGET_WLAN_CHIP),\
$(eval CHIPSET := $(chip))\
$(eval include $(LOCAL_PATH)/Android.mk))
else
# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
BAZEL_CHIPSET_NAME := $(subst _,-,$(CHIPSET))
ifeq ($(call is-platform-sdk-version-at-least,16),true)
DLKM_DIR := $(TOP)/$(BOARD_COMMON_DIR)/dlkm
else
DLKM_DIR := build/dlkm
endif # platform-sdk-version
include $(CLEAR_VARS)
LOCAL_MOD_NAME := wlan
LOCAL_MODULE := qca_cld3_$(CHIPSET).ko
LOCAL_MODULE_KBUILD_NAME := qca_cld3_$(CHIPSET).ko
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_DDK_SUBTARGET_REGEX := "all.*"
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
ifeq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
else
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)
endif
else
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
endif
LOCAL_DEV_NAME := $(CHIPSET)
LOCAL_CHIP_NAME := $(LOCAL_DEV_NAME)
TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_CHIP_NAME)
TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_CHIP_NAME)
TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_CHIP_NAME)
TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_CHIP_NAME)
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
else
TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
endif
# Create wlan_mac.bin symbolic link as part of the module
$(call symlink-file,,$(TARGET_MAC_BIN_PATH)/wlan_mac.bin,$(TARGET_FW_PATH)/wlan_mac.bin)
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_FW_PATH)/wlan_mac.bin
# Conditionally create module symbolic link
ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
$(call symlink-file,,$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE)
endif
else
$(call symlink-file,,/system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE)
endif
endif
# Conditionally create ini symbolic link
ifeq ($(TARGET_BOARD_AUTO),true)
$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
$(call wlog,"generate soft link because TARGET_BOARD_AUTO true")
else
ifneq ($(GENERIC_ODM_IMAGE),true)
$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
$(call wlog,"generate soft link because GENERIC_ODM_IMAGE not true")
endif
endif
# Set dependencies so that CNSS family drivers can be compiled ahead.
ifneq ($(WLAN_PLATFORM_KBUILD_OPTIONS),)
LOCAL_REQUIRED_MODULES := wlan-platform-module-symvers
LOCAL_ADDITIONAL_DEPENDENCIES += $(call intermediates-dir-for,DLKM,wlan-platform-module-symvers)/Module.symvers
endif
$(call wlog,TARGET_USES_KERNEL_PLATFORM=$(TARGET_USES_KERNEL_PLATFORM))
ifeq ($(TARGET_USES_KERNEL_PLATFORM),true)
include $(DLKM_DIR)/Build_external_kernelmodule.mk
else
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
endif
else
$(foreach chip, $(TARGET_WLAN_CHIP), \
$(shell ln -sf . $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip)))
include $(foreach chip, $(TARGET_WLAN_CHIP), $(LOCAL_PATH)/.$(chip)/Android.mk)
endif
else # Multi-ok check
# When dual wlan enabled, secondary dev name would be $(chip)_cnss2.
# Use LOCAL_CHIP_NAME instead of LOCAL_DEV_NAME for secondary one.
LOCAL_CHIP_NAME := $(LOCAL_DEV_NAME)
TARGET_SECONDARY_WLAN := $(call target_is_dual_wlan,$(LOCAL_DEV_NAME))
ifeq ($(TARGET_SECONDARY_WLAN), true)
LOCAL_CHIP_NAME := $(patsubst %_cnss2,%,$(strip $(LOCAL_DEV_NAME)))
endif
ifeq ($(WLAN_PROFILE),)
WLAN_PROFILE := default
endif
ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
LOCAL_DEV_NAME := wlan
LOCAL_MOD_NAME := wlan
LOCAL_SRC_DIR :=
TARGET_FW_DIR := firmware/wlan/qca_cld
TARGET_CFG_PATH := /vendor/etc/wifi
TARGET_MAC_BIN_PATH := /mnt/vendor/persist
else
LOCAL_SRC_DIR := .$(LOCAL_DEV_NAME)
# Use default profile if WLAN_CFG_USE_DEFAULT defined.
ifeq ($(WLAN_CFG_USE_DEFAULT),)
WLAN_PROFILE := $(LOCAL_CHIP_NAME)
endif
TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_CHIP_NAME)
TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_CHIP_NAME)
TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_CHIP_NAME)
ifneq ($(TARGET_MULTI_WLAN), true)
LOCAL_MOD_NAME := wlan
DYNAMIC_SINGLE_CHIP := $(LOCAL_DEV_NAME)
else
LOCAL_MOD_NAME := $(LOCAL_DEV_NAME)
endif
ifeq ($(TARGET_SECONDARY_WLAN), true)
TARGET_SECONDARY_WLAN_NUMBER := 2
LOCAL_MOD_NAME := $(LOCAL_CHIP_NAME)_$(TARGET_SECONDARY_WLAN_NUMBER)
DYNAMIC_SINGLE_CHIP := $(LOCAL_CHIP_NAME)
endif
endif
# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
ifeq ($(call is-platform-sdk-version-at-least,16),true)
DLKM_DIR := $(TOP)/$(BOARD_COMMON_DIR)/dlkm
else
DLKM_DIR := build/dlkm
endif # platform-sdk-version
# Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
###########################################################
# This is set once per LOCAL_PATH, not per (kernel) module
KBUILD_OPTIONS := WLAN_ROOT=$(WLAN_BLD_DIR)/qcacld-3.0/$(LOCAL_SRC_DIR)
KBUILD_OPTIONS += WLAN_COMMON_ROOT=cmn
KBUILD_OPTIONS += WLAN_COMMON_INC=$(WLAN_BLD_DIR)/qcacld-3.0/cmn
KBUILD_OPTIONS += WLAN_FW_API=$(WLAN_BLD_DIR)/fw-api
KBUILD_OPTIONS += WLAN_PROFILE=$(WLAN_PROFILE)
KBUILD_OPTIONS += DYNAMIC_SINGLE_CHIP=$(DYNAMIC_SINGLE_CHIP)
# We are actually building wlan.ko here, as per the
# requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
# This means we need to rename the module to <chipset>_wlan.ko
# after wlan.ko is built.
KBUILD_OPTIONS += MODNAME=$(LOCAL_MOD_NAME)
KBUILD_OPTIONS += DEVNAME=$(LOCAL_DEV_NAME)
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(WLAN_SELECT)
KBUILD_REQUIRED_KOS := ipam.ko
ifneq ($(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME)),)
KBUILD_OPTIONS += WLAN_CFG_OVERRIDE="$(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME))"
endif
# driver expects "/dev/<name>" for wifi driver state ctrl parameter.
# i.e. WIFI_DRIVER_STATE_CTRL_PARAM="/dev/wlan" is defined for single wlan.
# WIFI_DRIVER_STATE_CTRL_PARAM_SECONDARY="/dev/wlan2" is defined for 2nd wlan.
ifeq ($(TARGET_SECONDARY_WLAN), true)
$(call wlog,STATE_CTRL_PARAM_SECONDARY=$(WIFI_DRIVER_STATE_CTRL_PARAM_SECONDARY))
PARAM_SECONDARY := $(patsubst "%",%,$(WIFI_DRIVER_STATE_CTRL_PARAM_SECONDARY))
$(call wlog,PARAM_SECONDARY=$(PARAM_SECONDARY))
ifeq ($(dir $(PARAM_SECONDARY)),/dev/)
KBUILD_OPTIONS += WLAN_CTRL_NAME=$(notdir $(PARAM_SECONDARY))
endif
else
$(call wlog,WIFI_DRIVER_STATE_CTRL_PARAM=$(WIFI_DRIVER_STATE_CTRL_PARAM))
PARAM := $(patsubst "%",%,$(WIFI_DRIVER_STATE_CTRL_PARAM))
$(call wlog,PARAM=$(PARAM))
ifeq ($(dir $(PARAM)),/dev/)
KBUILD_OPTIONS += WLAN_CTRL_NAME=$(notdir $(PARAM))
endif
endif
# Pass build options per chip to Kbuild. This will be injected from upper layer
# makefile.
#
# e.g.
# WLAN_KBUILD_OPTIONS_qca6390 := CONFIG_CNSS_QCA6390=y
ifneq ($(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME)),)
KBUILD_OPTIONS += "$(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME))"
endif
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
else
TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
endif
# WLAN_PLATFORM_KBUILD_OPTIONS should be passed from upper level Makefiles
# like wlan.mk. It indicates sources of CNSS family drivers (cnss2, cnss_nl,
# cnss_prealloc and cnss_utils etc.) are built out of kernel tree and it
# should also include all necessary config flags (e.g. CONFIG_CNSS2) which
# are originally defined from kernel Kconfig/defconfig. KBUILD_EXTRA_SYMBOLS
# is also needed to indicate all the symbols from these drivers.
ifneq ($(WLAN_PLATFORM_KBUILD_OPTIONS),)
KBUILD_OPTIONS += $(foreach wlan_platform_kbuild_option, \
$(WLAN_PLATFORM_KBUILD_OPTIONS), \
$(wlan_platform_kbuild_option))
KBUILD_OPTIONS += KBUILD_EXTRA_SYMBOLS+=$(shell pwd)/$(call intermediates-dir-for,DLKM,wlan-platform-module-symvers)/Module.symvers
endif
include $(CLEAR_VARS)
# Create the module
LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko
LOCAL_MODULE_KBUILD_NAME := $(LOCAL_MOD_NAME).ko
LOCAL_MODULE_DEBUG_ENABLE := true
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
ifeq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
else
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)
endif
else
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
endif
# Create wlan_mac.bin symbolic link as part of the module
$(call symlink-file,,$(TARGET_MAC_BIN_PATH)/wlan_mac.bin,$(TARGET_FW_PATH)/wlan_mac.bin)
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_FW_PATH)/wlan_mac.bin
# Conditionally create module symbolic link
ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
$(call symlink-file,,$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE)
endif
else
$(call symlink-file,,/system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE)
endif
endif
# Conditionally create ini symbolic link
ifeq ($(TARGET_BOARD_AUTO),true)
$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
$(call wlog,"generate soft link because TARGET_BOARD_AUTO true")
else
ifneq ($(GENERIC_ODM_IMAGE),true)
$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
$(call wlog,"generate soft link because GENERIC_ODM_IMAGE not true")
endif
endif
# Set dependencies so that CNSS family drivers can be compiled ahead.
ifneq ($(WLAN_PLATFORM_KBUILD_OPTIONS),)
LOCAL_REQUIRED_MODULES := wlan-platform-module-symvers
LOCAL_ADDITIONAL_DEPENDENCIES += $(call intermediates-dir-for,DLKM,wlan-platform-module-symvers)/Module.symvers
endif
$(call wlog,TARGET_USES_KERNEL_PLATFORM=$(TARGET_USES_KERNEL_PLATFORM))
ifeq ($(TARGET_USES_KERNEL_PLATFORM),true)
include $(DLKM_DIR)/Build_external_kernelmodule.mk
else
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
endif # Multi-ko check
endif # DLKM check
endif # supported target check
endif # WLAN enabled check
endif # ENABLE_QCACLD

View File

@ -0,0 +1,10 @@
load("//build/kernel/kleaf:kernel.bzl", "ddk_headers")
load(":wlan_qcacld3_modules.bzl", "define_modules")
package(
default_visibility = [
"//visibility:public",
],
)
define_modules()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
# The Make variable $(M) must point to the directory that contains the module
# source code (which includes this Makefile). It can either be an absolute or a
# relative path. If it is a relative path, then it must be relative to the
# kernel source directory (KERNEL_SRC). An absolute path can be obtained very
# easily through $(shell pwd). Generating a path relative to KERNEL_SRC is
# difficult and we accept some outside help by letting the caller override the
# variable $(M). Allowing a relative path for $(M) enables us to have the build
# system put output/object files (.o, .ko.) into a directory different from the
# module source directory.
M ?= $(shell pwd)
ifeq ($(WLAN_ROOT),)
# WLAN_ROOT must contain an absolute path (i.e. not a relative path)
KBUILD_OPTIONS := WLAN_ROOT=$(shell cd $(KERNEL_SRC); readlink -e $(M))
# MODNAME should be qca_cld3_wlan for helium based wear target
ifeq (qca_cld3, $(WLAN_WEAR_CHIPSET))
KBUILD_OPTIONS += MODNAME?=$(WLAN_WEAR_CHIPSET)_wlan
else
KBUILD_OPTIONS += MODNAME?=wlan
endif
#By default build for CLD
WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0
KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1
KBUILD_OPTIONS += $(WLAN_SELECT)
KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any
endif
all:
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 M=$(M) -C $(KERNEL_SRC) modules_install
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(M) clean $(KBUILD_OPTIONS)

View File

@ -0,0 +1 @@
This is CNSS WLAN Host Driver for products starting from iHelium

View File

@ -0,0 +1 @@
../fw-api

View File

@ -0,0 +1 @@
../qca-wifi-host-cmn

View File

@ -0,0 +1,173 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare private API which shall be used internally only
* in action_oui component. This file shall include prototypes of
* various notification handlers and logging functions.
*
* Note: This API should be never accessed out of action_oui component.
*/
#ifndef _WLAN_ACTION_OUI_MAIN_H_
#define _WLAN_ACTION_OUI_MAIN_H_
#include <qdf_types.h>
#include "wlan_action_oui_public_struct.h"
#include "wlan_action_oui_priv.h"
#include "wlan_action_oui_objmgr.h"
#define action_oui_log(level, args...) \
QDF_TRACE(QDF_MODULE_ID_ACTION_OUI, level, ## args)
#define action_oui_logfl(level, format, args...) \
action_oui_log(level, FL(format), ## args)
#define action_oui_fatal(format, args...) \
action_oui_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
#define action_oui_err(format, args...) \
action_oui_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define action_oui_warn(format, args...) \
action_oui_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
#define action_oui_info(format, args...) \
action_oui_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
#define action_oui_debug(format, args...) \
action_oui_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
#define ACTION_OUI_ENTER() action_oui_debug("enter")
#define ACTION_OUI_EXIT() action_oui_debug("exit")
/**
* action_oui_psoc_create_notification(): Handler for psoc create notify.
* @psoc: psoc which is going to be created by objmgr
* @arg: argument for notification handler.
*
* Allocate and attach psoc private object.
*
* Return: QDF_STATUS status in case of success else return error.
*/
QDF_STATUS
action_oui_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg);
/**
* action_oui_psoc_destroy_notification(): Handler for psoc destroy notify.
* @psoc: psoc which is going to be destroyed by objmgr
* @arg: argument for notification handler.
*
* Deallocate and detach psoc private object.
*
* Return QDF_STATUS status in case of success else return error
*/
QDF_STATUS
action_oui_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg);
/**
* wlan_action_oui_search() - Check for OUIs and related info in IE data.
* @psoc: objmgr psoc object
* @attr: pointer to structure containing type of action, beacon IE data etc.,
* @action_id: type of action to be checked
*
* This is a wrapper function which invokes internal function to search
* for OUIs and related info (specified from ini file) in vendor specific
* data of beacon IE for given action.
*
* Return: If search is successful return true else false.
*/
#ifdef WLAN_FEATURE_ACTION_OUI
bool wlan_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id);
/**
* wlan_action_oui_is_empty() - Check action oui present or not
* @psoc: psoc object
* @action_id: action oui id
*
* This function will check action oui present or not for specific action type.
*
* Return: True if no action oui for the action type.
*/
bool wlan_action_oui_is_empty(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id);
/**
* wlan_action_oui_cleanup() - Remove all of existing oui entry.
* @psoc_priv: action oui objmgr private context
* @action_id: type of action to be removed
*
* This is a wrapper function which invokes internal function to remove
* all of existing oui entry.
*
* Return: QDF_STATUS_SUCCESS If remove is successful.
*/
QDF_STATUS
wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv,
enum action_oui_id action_id);
/**
* action_oui_psoc_enable() - Notify action OUI psoc enable
* @psoc: objmgr psoc object
*
* Return: void
*/
void action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc);
/**
* action_oui_psoc_disable() - Notify action OUI psoc disable
* @psoc: objmgr psoc object
*
* Return: void
*/
void action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc);
#else
static inline
bool wlan_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id)
{
return false;
}
static inline
bool wlan_action_oui_is_empty(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
return true;
}
static inline QDF_STATUS
wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv,
enum action_oui_id action_id)
{
return QDF_STATUS_SUCCESS;
}
static inline
void action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
}
#endif
#endif /* end of _WLAN_ACTION_OUI_MAIN_H_ */

View File

@ -0,0 +1,79 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains various object manager related wrappers and helpers
*/
#ifndef _WLAN_ACTION_OUI_OBJMGR_H
#define _WLAN_ACTION_OUI_OBJMGR_H
#include "wlan_cmn.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_psoc_obj.h"
/**
* action_oui_psoc_get_ref() - Wrapper to increment action_oui ref count
* @psoc: psoc object
*
* Wrapper for action_oui to increment ref count after checking valid
* object state.
*
* Return: SUCCESS/FAILURE
*/
static inline
QDF_STATUS action_oui_psoc_get_ref(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_try_get_ref(psoc, WLAN_ACTION_OUI_ID);
}
/**
* action_oui_psoc_put_ref() - Wrapper to decrement action_oui ref count
* @psoc: psoc object
*
* Wrapper for action_oui to decrement ref count of psoc.
*
* Return: SUCCESS/FAILURE
*/
static inline
void action_oui_psoc_put_ref(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_release_ref(psoc, WLAN_ACTION_OUI_ID);
}
/**
* action_oui_psoc_get_priv(): Wrapper to retrieve psoc priv obj
* @psoc: psoc pointer
*
* Wrapper for action_oui to get psoc private object pointer.
*
* Return: Private object of psoc
*/
static inline struct action_oui_psoc_priv *
action_oui_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
psoc_priv = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_ACTION_OUI);
QDF_BUG(psoc_priv);
return psoc_priv;
}
#endif /* _WLAN_ACTION_OUI_OBJMGR_H */

View File

@ -0,0 +1,185 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare private API which shall be used internally only
* in action_oui component. This file shall include prototypes of
* action_oui parsing and send logic.
*
* Note: This API should be never accessed out of action_oui component.
*/
#ifndef _WLAN_ACTION_OUI_PRIV_STRUCT_H_
#define _WLAN_ACTION_OUI_PRIV_STRUCT_H_
#include <qdf_list.h>
#include <qdf_types.h>
#include "wlan_action_oui_public_struct.h"
#include "wlan_action_oui_tgt_api.h"
#include "wlan_action_oui_objmgr.h"
/**
* enum action_oui_token_type - String token types expected.
* @ACTION_OUI_TOKEN: oui string
* @ACTION_OUI_DATA_LENGTH_TOKEN: data length string
* @ACTION_OUI_DATA_TOKEN: OUI data string
* @ACTION_OUI_DATA_MASK_TOKEN: data mask string
* @ACTION_OUI_INFO_MASK_TOKEN: info mask string
* @ACTION_OUI_MAC_ADDR_TOKEN: mac addr string
* @ACTION_OUI_MAC_MASK_TOKEN: mac mask string
* @ACTION_OUI_CAPABILITY_TOKEN: capability string
* @ACTION_OUI_END_TOKEN: end of one oui extension
*/
enum action_oui_token_type {
ACTION_OUI_TOKEN = 1 << 0,
ACTION_OUI_DATA_LENGTH_TOKEN = 1 << 1,
ACTION_OUI_DATA_TOKEN = 1 << 2,
ACTION_OUI_DATA_MASK_TOKEN = 1 << 3,
ACTION_OUI_INFO_MASK_TOKEN = 1 << 4,
ACTION_OUI_MAC_ADDR_TOKEN = 1 << 5,
ACTION_OUI_MAC_MASK_TOKEN = 1 << 6,
ACTION_OUI_CAPABILITY_TOKEN = 1 << 7,
ACTION_OUI_END_TOKEN = 1 << 8,
};
/**
* struct action_oui_extension_priv - Private contents of extension.
* @item: list element
* @extension: Extension contents
*
* This structure encapsulates action_oui_extension and list item.
*/
struct action_oui_extension_priv {
qdf_list_node_t item;
struct action_oui_extension extension;
};
/**
* struct action_oui_priv - Each action info.
* @id: type of action
* @extension_list: list of extensions
* @extension_lock: lock to control access to @extension_list
*
* All extensions of action specified by action_id are stored
* at @extension_list as linked list.
*/
struct action_oui_priv {
enum action_oui_id id;
qdf_list_t extension_list;
qdf_mutex_t extension_lock;
};
/**
* struct action_oui_psoc_priv - Private object to be stored in psoc
* @psoc: pointer to psoc object
* @action_oui_enable: action oui enable
* @action_oui_str: oui configuration strings
* @total_extensions: total count of extensions from all actions
* @host_only_extensions: total host only only extensions from all actions
* @max_extensions: Max no. of extensions that can be configured to the firmware
* @oui_priv: array of pointers used to refer each action info
* @tx_ops: call-back functions to send OUIs to firmware
*/
struct action_oui_psoc_priv {
struct wlan_objmgr_psoc *psoc;
bool action_oui_enable;
uint8_t action_oui_str[ACTION_OUI_MAXIMUM_ID][ACTION_OUI_MAX_STR_LEN];
uint32_t total_extensions;
uint32_t host_only_extensions;
uint32_t max_extensions;
struct action_oui_priv *oui_priv[ACTION_OUI_MAXIMUM_ID];
struct action_oui_tx_ops tx_ops;
};
/**
* action_oui_parse() - Parse action oui string
* @psoc_priv: pointer to action_oui psoc priv obj
* @oui_string: string to be parsed
* @action_id: type of the action to be parsed
*
* This function parses the action oui string, extracts extensions and
* stores them @action_oui_priv using list data structure.
*
* Return: QDF_STATUS
*
*/
QDF_STATUS
action_oui_parse(struct action_oui_psoc_priv *psoc_priv,
uint8_t *oui_string, enum action_oui_id action_id);
/**
* action_oui_parse_string() - Parse action oui string
* @psoc: psoc object
* @in_str: string to be parsed
* @action_id: type of the action to be parsed
*
* This function will validate the input string and call action_oui_parse
* to parse it.
*
* Return: QDF_STATUS
*
*/
QDF_STATUS
action_oui_parse_string(struct wlan_objmgr_psoc *psoc,
const uint8_t *in_str,
enum action_oui_id action_id);
/**
* action_oui_send() - Send action oui extensions to target_if.
* @psoc_priv: pointer to action_oui psoc priv obj
* @action_id: type of the action to send
*
* This function sends action oui extensions to target_if.
*
* Return: QDF_STATUS
*
*/
QDF_STATUS
action_oui_send(struct action_oui_psoc_priv *psoc_priv,
enum action_oui_id action_id);
/**
* action_oui_search() - Check if Vendor OUIs are present in IE buffer
* @psoc_priv: pointer to action_oui psoc priv obj
* @attr: pointer to structure containing type of action, beacon IE data etc.,
* @action_id: type of action to be checked
*
* This function parses the IE buffer and finds if any of the vendor OUI
* and related attributes are present in it.
*
* Return: If vendor OUI is present return true else false
*/
bool
action_oui_search(struct action_oui_psoc_priv *psoc_priv,
struct action_oui_search_attr *attr,
enum action_oui_id action_id);
/**
* action_oui_is_empty() - Check action oui present or not
* @psoc_priv: action psoc private object
* @action_id: action oui id
*
* This function will check action oui present or not for specific action type.
*
* Return: True if no action oui for the action type.
*/
bool
action_oui_is_empty(struct action_oui_psoc_priv *psoc_priv,
enum action_oui_id action_id);
#endif /* End of _WLAN_ACTION_OUI_PRIV_STRUCT_H_ */

View File

@ -0,0 +1,503 @@
/*
* Copyright (c) 2012-2018, 2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement various notification handlers which are accessed
* internally in action_oui component only.
*/
#include "cfg_ucfg_api.h"
#include "wlan_action_oui_cfg.h"
#include "wlan_action_oui_main.h"
#include "wlan_action_oui_public_struct.h"
#include "wlan_action_oui_tgt_api.h"
#include "target_if_action_oui.h"
/**
* action_oui_allocate() - Allocates memory for various actions.
* @psoc_priv: pointer to action_oui psoc priv obj
*
* This function allocates memory for all the action_oui types
* and initializes the respective lists to store extensions
* extracted from action_oui_extract().
*
* Return: QDF_STATUS
*/
static QDF_STATUS
action_oui_allocate(struct action_oui_psoc_priv *psoc_priv)
{
struct action_oui_priv *oui_priv;
uint32_t i;
uint32_t j;
for (i = 0; i < ACTION_OUI_MAXIMUM_ID; i++) {
oui_priv = qdf_mem_malloc(sizeof(*oui_priv));
if (!oui_priv) {
action_oui_err("Mem alloc failed for oui_priv id: %u",
i);
goto free_mem;
}
oui_priv->id = i;
qdf_list_create(&oui_priv->extension_list,
ACTION_OUI_MAX_EXTENSIONS);
qdf_mutex_create(&oui_priv->extension_lock);
psoc_priv->oui_priv[i] = oui_priv;
}
return QDF_STATUS_SUCCESS;
free_mem:
for (j = 0; j < i; j++) {
oui_priv = psoc_priv->oui_priv[j];
if (!oui_priv)
continue;
qdf_list_destroy(&oui_priv->extension_list);
qdf_mutex_destroy(&oui_priv->extension_lock);
psoc_priv->oui_priv[j] = NULL;
}
return QDF_STATUS_E_NOMEM;
}
/**
* action_oui_destroy() - Deallocates memory for various actions.
* @psoc_priv: pointer to action_oui psoc priv obj
*
* This function Deallocates memory for all the action_oui types.
* As a part of deallocate, all extensions are destroyed.
*
* Return: None
*/
static void
action_oui_destroy(struct action_oui_psoc_priv *psoc_priv)
{
struct action_oui_priv *oui_priv;
struct action_oui_extension_priv *ext_priv;
qdf_list_t *ext_list;
QDF_STATUS status;
qdf_list_node_t *node = NULL;
uint32_t i;
psoc_priv->total_extensions = 0;
psoc_priv->max_extensions = 0;
psoc_priv->host_only_extensions = 0;
for (i = 0; i < ACTION_OUI_MAXIMUM_ID; i++) {
oui_priv = psoc_priv->oui_priv[i];
psoc_priv->oui_priv[i] = NULL;
if (!oui_priv)
continue;
ext_list = &oui_priv->extension_list;
qdf_mutex_acquire(&oui_priv->extension_lock);
while (!qdf_list_empty(ext_list)) {
status = qdf_list_remove_front(ext_list, &node);
if (!QDF_IS_STATUS_SUCCESS(status)) {
action_oui_err("Invalid delete in action: %u",
oui_priv->id);
break;
}
ext_priv = qdf_container_of(node,
struct action_oui_extension_priv,
item);
qdf_mem_free(ext_priv);
ext_priv = NULL;
}
qdf_list_destroy(ext_list);
qdf_mutex_release(&oui_priv->extension_lock);
qdf_mutex_destroy(&oui_priv->extension_lock);
qdf_mem_free(oui_priv);
oui_priv = NULL;
}
}
static void action_oui_load_config(struct action_oui_psoc_priv *psoc_priv)
{
struct wlan_objmgr_psoc *psoc = psoc_priv->psoc;
psoc_priv->action_oui_enable =
cfg_get(psoc, CFG_ENABLE_ACTION_OUI);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_CONNECT_1X1],
cfg_get(psoc, CFG_ACTION_OUI_CONNECT_1X1),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_ITO_EXTENSION],
cfg_get(psoc, CFG_ACTION_OUI_ITO_EXTENSION),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_CCKM_1X1],
cfg_get(psoc, CFG_ACTION_OUI_CCKM_1X1),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_ITO_ALTERNATE],
cfg_get(psoc, CFG_ACTION_OUI_ITO_ALTERNATE),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_SWITCH_TO_11N_MODE],
cfg_get(psoc, CFG_ACTION_OUI_SWITCH_TO_11N_MODE),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN],
cfg_get(psoc,
CFG_ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_DISABLE_AGGRESSIVE_TX],
cfg_get(psoc,
CFG_ACTION_OUI_DISABLE_AGGRESSIVE_TX),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_DISABLE_AGGRESSIVE_EDCA],
cfg_get(psoc,
CFG_ACTION_OUI_DISABLE_AGGRESSIVE_EDCA),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_EXTEND_WOW_ITO],
cfg_get(psoc, CFG_ACTION_OUI_EXTEND_WOW_ITO),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_DISABLE_TWT],
cfg_get(psoc, CFG_ACTION_OUI_DISABLE_TWT),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_HOST_RECONN],
cfg_get(psoc, CFG_ACTION_OUI_RECONN_ASSOCTIMEOUT),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_TAKE_ALL_BAND_INFO],
cfg_get(psoc, CFG_ACTION_OUI_TAKE_ALL_BAND_INFO),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_11BE_OUI_ALLOW],
cfg_get(psoc, CFG_ACTION_OUI_11BE_ALLOW_LIST),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE],
cfg_get(psoc,
CFG_ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL],
cfg_get(psoc,
CFG_ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_ENABLE_CTS2SELF],
cfg_get(psoc, CFG_ACTION_OUI_ENABLE_CTS2SELF),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN],
cfg_get(psoc,
CFG_ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_RESTRICT_MAX_MLO_LINKS],
cfg_get(psoc, CFG_ACTION_OUI_RESTRICT_MAX_MLO_LINKS),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str
[ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ],
cfg_get(psoc, CFG_ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_DISABLE_BFORMEE],
cfg_get(psoc, CFG_ACTION_OUI_DISABLE_BFORMEE),
ACTION_OUI_MAX_STR_LEN);
qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_LIMIT_BW],
cfg_get(psoc, CFG_ACTION_OUI_LIMIT_BW),
ACTION_OUI_MAX_STR_LEN);
}
static void action_oui_parse_config(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
uint32_t id;
uint8_t *str;
struct action_oui_psoc_priv *psoc_priv;
if (!psoc) {
action_oui_err("Invalid psoc");
return;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
return;
}
if (!psoc_priv->action_oui_enable) {
action_oui_debug("action_oui is not enable");
return;
}
for (id = 0; id < ACTION_OUI_MAXIMUM_ID; id++) {
str = psoc_priv->action_oui_str[id];
if (!qdf_str_len(str))
continue;
status = action_oui_parse_string(psoc, str, id);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_err("Failed to parse action_oui str: %u",
id);
}
/* FW allocates memory for the extensions only during init time.
* Therefore, send additional legspace for configuring new
* extensions during runtime.
* The current max value is default extensions count + 10.
*/
psoc_priv->max_extensions = psoc_priv->total_extensions -
psoc_priv->host_only_extensions +
ACTION_OUI_MAX_ADDNL_EXTENSIONS;
action_oui_debug("Extensions - Max: %d Total: %d host_only %d",
psoc_priv->max_extensions, psoc_priv->total_extensions,
psoc_priv->host_only_extensions);
}
static QDF_STATUS action_oui_send_config(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status = QDF_STATUS_E_INVAL;
uint32_t id;
if (!psoc) {
action_oui_err("psoc is NULL");
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
if (!psoc_priv->action_oui_enable) {
action_oui_debug("action_oui is not enable");
return QDF_STATUS_SUCCESS;
}
for (id = 0; id < ACTION_OUI_MAXIMUM_ID; id++) {
if (id >= ACTION_OUI_HOST_ONLY)
continue;
status = action_oui_send(psoc_priv, id);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_err("Failed to send: %u", id);
}
exit:
return status;
}
QDF_STATUS
action_oui_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status;
ACTION_OUI_ENTER();
psoc_priv = qdf_mem_malloc(sizeof(*psoc_priv));
if (!psoc_priv) {
status = QDF_STATUS_E_NOMEM;
goto exit;
}
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_ACTION_OUI,
(void *)psoc_priv, QDF_STATUS_SUCCESS);
if (!QDF_IS_STATUS_SUCCESS(status)) {
action_oui_err("Failed to attach priv with psoc");
goto free_psoc_priv;
}
target_if_action_oui_register_tx_ops(&psoc_priv->tx_ops);
psoc_priv->psoc = psoc;
action_oui_load_config(psoc_priv);
action_oui_debug("psoc priv attached");
goto exit;
free_psoc_priv:
qdf_mem_free(psoc_priv);
status = QDF_STATUS_E_INVAL;
exit:
ACTION_OUI_EXIT();
return status;
}
QDF_STATUS
action_oui_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct action_oui_psoc_priv *psoc_priv = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
ACTION_OUI_ENTER();
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_ACTION_OUI,
(void *)psoc_priv);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_err("Failed to detach priv with psoc");
qdf_mem_free(psoc_priv);
exit:
ACTION_OUI_EXIT();
return status;
}
void action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
ACTION_OUI_ENTER();
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
status = action_oui_allocate(psoc_priv);
if (!QDF_IS_STATUS_SUCCESS(status)) {
action_oui_err("Failed to alloc action_oui");
goto exit;
}
action_oui_parse_config(psoc);
action_oui_send_config(psoc);
exit:
ACTION_OUI_EXIT();
}
void action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
ACTION_OUI_ENTER();
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
action_oui_destroy(psoc_priv);
exit:
ACTION_OUI_EXIT();
}
bool wlan_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id)
{
struct action_oui_psoc_priv *psoc_priv;
bool found = false;
if (!psoc || !attr) {
action_oui_err("Invalid psoc or search attrs");
goto exit;
}
if (action_id >= ACTION_OUI_MAXIMUM_ID) {
action_oui_err("Invalid action_oui id: %u", action_id);
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
found = action_oui_search(psoc_priv, attr, action_id);
exit:
return found;
}
QDF_STATUS
wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv,
enum action_oui_id action_id)
{
struct action_oui_priv *oui_priv;
struct action_oui_extension_priv *ext_priv;
qdf_list_t *ext_list;
QDF_STATUS status;
qdf_list_node_t *node = NULL;
if (action_id >= ACTION_OUI_MAXIMUM_ID)
return QDF_STATUS_E_INVAL;
oui_priv = psoc_priv->oui_priv[action_id];
if (!oui_priv)
return QDF_STATUS_SUCCESS;
ext_list = &oui_priv->extension_list;
qdf_mutex_acquire(&oui_priv->extension_lock);
while (!qdf_list_empty(ext_list)) {
status = qdf_list_remove_front(ext_list, &node);
if (!QDF_IS_STATUS_SUCCESS(status)) {
action_oui_err("Invalid delete in action: %u",
oui_priv->id);
break;
}
ext_priv = qdf_container_of(
node,
struct action_oui_extension_priv,
item);
qdf_mem_free(ext_priv);
ext_priv = NULL;
if (psoc_priv->total_extensions)
psoc_priv->total_extensions--;
else
action_oui_err("unexpected total_extensions 0");
if (action_id >= ACTION_OUI_HOST_ONLY) {
if (!psoc_priv->host_only_extensions)
action_oui_err("unexpected total host extensions");
else
psoc_priv->host_only_extensions--;
}
}
qdf_mutex_release(&oui_priv->extension_lock);
return QDF_STATUS_SUCCESS;
}
bool wlan_action_oui_is_empty(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
struct action_oui_psoc_priv *psoc_priv;
bool empty = true;
if (!psoc) {
action_oui_err("Invalid psoc");
goto exit;
}
if (action_id >= ACTION_OUI_MAXIMUM_ID) {
action_oui_err("Invalid action_oui id: %u", action_id);
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
empty = action_oui_is_empty(psoc_priv, action_id);
exit:
return empty;
}

View File

@ -0,0 +1,914 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains centralized definitions of action oui configuration.
*/
#ifndef __WLAN_ACTION_OUI_CFG_H__
#define __WLAN_ACTION_OUI_CFG_H__
/*
* Start of action oui inis
*
* To enable action oui feature, set gEnableActionOUI
*
* Each action oui is expected in the following format:
* <Extension 1> <Extension 2> ..... <Extension 10> (maximum 10)
*
* whereas, each Extension is separated by space and have the following format:
* <Token1> <Token2> <Token3> <Token4> <Token5> <Token6> <Token7> <Token8>
* where each Token is a string of hexa-decimal digits and
* following are the details about each token
*
* Token1 = OUI
* Token2 = Data_Length
* Token3 = Data
* Token4 = Data_Mask
* Token5 = Info_Presence_Bit
* Token6 = MAC_Address
* Token7 = Mac_Address Mask
* Token8 = Capability
*
* <OUI> is mandatory and it can be either 3 or 5 bytes means 6 or 10
* hexa-decimal characters
* If the OUI and Data checks needs to be ignored, the oui FFFFFF
* needs to be provided as OUI and bit 0 of Info_Presence_Bit should
* be set to 0.
*
* <Data_Length> is mandatory field and should give length of
* the <Data> if present else zero
*
* Presence of <Data> is controlled by <Data_Length>, if <Data_Length> is 0,
* then <Data> is not expected else Data of the size Data Length bytes are
* expected which means the length of Data string is 2 * Data Length,
* since every byte constitutes two hexa-decimal characters.
*
* <Data_Mask> is mandatory if <Data> is present and length of the
* Data mask string depends on the <Data Length>
* If <Data Length> is 06, then length of Data Mask string is
* 2 characters (represents 1 byte)
* data_mask_length = ((Data_Length - (Data_Length % 8)) / 8) +
* ((Data_Length % 8) ? 1 : 0)
* and <Data_Mask> has to be constructed from left to right.
*
* Presence of <Mac_Address> and <Capability> is
* controlled by <Info_Presence_Bit> which is mandatory
* <Info_Presence_Bit> will give the information for
* OUI bit 0 Should be set to 1
* Setting to 0 will ignore OUI and data check
* Mac Address present bit 1
* NSS bit 2
* HT check bit 3
* VHT check bit 4
* Band info bit 5
* reserved bit 6 (should always be zero)
* reserved bit 7 (should always be zero)
* and should be constructed from right to left (b7b6b5b4b3b2b1b0)
*
* <Mac_Address_Mask> for <Mac_Address> should be constructed from left to right
*
* <Capability> is 1 byte long and it contains the below info
* NSS 4 bits starting from LSB (b0 b3)
* HT enabled bit 4
* VHT enabled bit 5
* 2G band bit 6
* 5G band bit 7
* and should be constructed from right to left (b7b6b5b4b3b2b1b0)
* <Capability> is present if at least one of the bit is set
* from b2 - b6 in <Info_Presence_Bit>
*
* Example 1:
*
* OUI is 00-10-18, data length is 05 (hex form), data is 02-11-04-5C-DE and
* need to consider first 3 bytes and last byte of data for comparison
* mac-addr EE-1A-59-FE-FD-AF is present and first 3 bytes and last byte of
* mac address should be considered for comparison
* capability is not present
* then action OUI for gActionOUIITOExtension is as follows:
*
* gActionOUIITOExtension=001018 05 0211045CDE E8 03 EE1A59FEFDAF E4
*
* data mask calculation in above example:
* Data[0] = 02 ---- d0 = 1
* Data[1] = 11 ---- d1 = 1
* Data[2] = 04 ---- d2 = 1
* Data[3] = 5C ---- d3 = 0
* Data[4] = DE ---- d4 = 1
* data_mask = d0d1d2d3d4 + append with zeros to complete 8-bit = 11101000 = E8
*
* mac mask calculation in above example:
* mac_addr[0] = EE ---- m0 = 1
* mac_addr[1] = 1A ---- m1 = 1
* mac_addr[2] = 59 ---- m2 = 1
* mac_addr[3] = FE ---- m3 = 0
* mac_addr[4] = FD ---- m4 = 0
* mac_addr[5] = AF ---- m5 = 1
* mac_mask = m0m1m2m3m4m5 + append with zeros to complete 8-bit = 11100100 = E4
*
* Example 2:
*
* OUI is 00-10-18, data length is 00 and no Mac Address and capability
*
* gActionOUIITOExtension=001018 00 01
*
*/
/*
* <ini>
* gEnableActionOUI - Enable/Disable action oui feature
* @Min: 0 (disable)
* @Max: 1 (enable)
* @Default: 1 (enable)
*
* This ini is used to enable the action oui feature to control
* mode of connection, connected AP's in-activity time, Tx rate etc.,
*
* Related: If gEnableActionOUI is set, then at least one of the following inis
* must be set with the proper action oui extensions:
* gActionOUIConnect1x1, gActionOUIITOExtension, gActionOUICCKM1X1
*
* Supported Feature: action ouis
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_ACTION_OUI CFG_INI_BOOL( \
"gEnableActionOUI", \
1, \
"Enable/Disable action oui feature")
/*
* <ini>
* gActionOUIConnect1x1 - Used to specify action OUIs for 1x1 connection
* @Default: 000C43 00 25 C2 001018 06 02FFF02C0000 BC 25 42 001018 06 02FF040C0000 BC 25 42 00037F 00 35 6C 001018 06 02FF009C0000 BC 25 48
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs: (All values in Hex)
* OUI 1 : 000C43
* OUI data Len : 00
* Info Mask : 25 - Check for NSS and Band
* Capabilities: C2 - NSS == 2 && Band == 2G || Band == 5G
* OUI 2 : 001018
* OUI data Len : 06
* OUI Data : 02FFF02C0000
* OUI data Mask: BC - 10111100
* Info Mask : 25 - Check for NSS and Band
* Capabilities: 42 - NSS == 2 && Band == 2G
* OUI 3 : 001018
* OUI data Len : 06
* OUI Data : 02FF040C0000
* OUI data Mask: BC - 10111100
* Info Mask : 25 - Check for NSS and Band
* Capabilities: 42 - NSS == 2 && Band == 2G
* OUI 4 : 00037F
* OUI data Len : 00
* Info Mask : 35 - Check for NSS, VHT Caps and Band
* Capabilities: 6C - (NSS == 3 or 4) && VHT Caps Preset && Band == 2G
* OUI 5 : 001018
* OUI data Len : 06
* OUI Data : 02FF009C0000
* OUI data Mask: BC - 10111100
* Info Mask : 25 - Check for NSS and Band
* Capabilities: 48 - NSS == 4 && Band == 2G
*
* This ini is used to specify the AP OUIs with which only 1x1 connection
* is allowed.
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_CONNECT_1X1 CFG_INI_STRING( \
"gActionOUIConnect1x1", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"000C43 00 25 C2 001018 06 02FFF02C0000 BC 25 42 001018 06 02FF040C0000 BC 25 42 00037F 00 35 6C 001018 06 02FF009C0000 BC 25 48", \
"Used to specify action OUIs for 1x1 connection")
/*
* <ini>
* gActionOUIITOExtension - Used to extend in-activity time for specified APs
* @Default: 00037F 06 01010000FF7F FC 01 000AEB 02 0100 C0 01 000B86 03 010408 E0 01
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs: (All values in Hex)
* OUI 1: 00037F
* OUI data Len: 06
* OUI Data: 01010000FF7F
* OUI data Mask: FC - 11111100
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 2: 000AEB
* OUI data Len: 02
* OUI Data: 0100
* OUI data Mask: C0 - 11000000
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 3: 000B86
* OUI data Len: 03
* OUI Data: 010408
* OUI data Mask: E0 - 11100000
* Info Mask : 01 - only OUI present in Info mask
*
* This ini is used to specify AP OUIs using which station's in-activity time
* can be extended with the respective APs
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_ITO_EXTENSION CFG_INI_STRING( \
"gActionOUIITOExtension", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"00037F 06 01010000FF7F FC 01 000AEB 02 0100 C0 01 000B86 03 010408 E0 01", \
"Used to extend in-activity time for specified APs")
/*
* <ini>
* gActionOUICCKM1X1 - Used to specify action OUIs to control station's TX rates
*
* This ini is used to specify AP OUIs for which station's CCKM TX rates
* should be 1x1 only.
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_CCKM_1X1 CFG_INI_STRING( \
"gActionOUICCKM1X1", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to specify action OUIs to control station's TX rates")
/*
* <ini>
* gActionOUIITOAlternate - Used to specify action OUIs to have alternate ITO in
* weak RSSI state
*
* This ini is used to specify AP OUIs for which the stations will have
* alternate ITOs for the case when the RSSI is weak.
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_ITO_ALTERNATE CFG_INI_STRING( \
"gActionOUIITOAlternate", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"001018 06 0202001c0000 FC 01", \
"Used to specify action OUIs to have alternate ITO")
/*
* <ini>
* gActionOUISwitchTo11nMode - Used to specify action OUIs for switching to 11n
*
* This ini is used to specify which AP for which the connection has to be
* made in 2x2 mode with HT capabilities only and not VHT.
*
* Default OUIs: (All values in Hex)
* OUI 1 : 00904C
* OUI data Len : 03
* OUI Data : 0418BF
* OUI data Mask: E0 - 11100000
* Info Mask : 21 - Check for Band
* Capabilities: 40 - Band == 2G
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_SWITCH_TO_11N_MODE CFG_INI_STRING( \
"gActionOUISwitchTo11nMode", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"00904C 05 0418BF0CB2 F8 21 40", \
"Used to specify action OUIs for switching to 11n")
/*
* <ini>
* gActionOUIConnect1x1with1TxRxChain - Used to specify action OUIs for
* 1x1 connection with one Tx/Rx Chain
* @Default:
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs: (All values in Hex)
* OUI 1 : 001018
* OUI data Len : 06
* OUI Data : 02FFF0040000
* OUI data Mask: BC - 10111100
* Info Mask : 21 - Check for Band
* Capabilities: 40 - Band == 2G
*
* OUI 2 : 001018
* OUI data Len : 06
* OUI Data : 02FFF0050000
* OUI data Mask: BC - 10111100
* Info Mask : 21 - Check for Band
* Capabilities: 40 - Band == 2G
*
* OUI 3 : 001018
* OUI data Len : 06
* OUI Data : 02FFF4050000
* OUI data Mask: BC - 10111100
* Info Mask : 21 - Check for Band
* Capabilities: 40 - Band == 2G
*
* This ini is used to specify the AP OUIs with which only 1x1 connection
* with one Tx/Rx Chain is allowed.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN CFG_INI_STRING( \
"gActionOUIConnect1x1with1TxRxChain", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"001018 06 02FFF0040000 BC 21 40 001018 06 02FFF0050000 BC 21 40 001018 06 02FFF4050000 BC 21 40", \
"Used to specify action OUIs for 1x1 connection with one Tx/Rx Chain")
/*
* <ini>
* gActionOUIDisableAggressiveTX - Used to specify action OUIs to disable
* Aggressive TX feature when operating in softap.
*
* @Default:
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs:
*
* OUI 1 : FFFFFF
* OUI data Len : 00
* OUI Data: No data
* OUI data Mask: No data mask
* Info Mask: 2A - Check for mac-addr, HT capability and Band
* Mac-addr: F8:59:71:00:00:00 - first 3 bytes
* Mac-mask: E0 - Match only first 3 bytes of peer mac-addr
* Capabilities: 50 HT should be enabled, and band should be 2.4GHz
*
* OUI 2 : FFFFFF
* OUI data Len : 00
* OUI Data: No data
* OUI data Mask: No data mask
* Info Mask: 2A - Check for mac-addr, HT capability and Band
* Mac-addr: 14:AB:C5:00:00:00 - first 3 bytes
* Mac-mask: E0 - Match only first 3 bytes of peer mac-addr
* Capabilities: 50 HT should be enabled, and band should be 2.4GHz
*
* When operating in Softap mode, this ini is used to specify
* STA (peer) OUIs/mac-addr for which aggressive tx is disabled after
* association is successful.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_DISABLE_AGGRESSIVE_TX CFG_INI_STRING( \
"gActionOUIDisableAggressiveTX", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"FFFFFF 00 2A F85971000000 E0 50 FFFFFF 00 2A 14ABC5000000 E0 50", \
"Used to specify action OUIs to disable aggressive TX")
/*
* <ini>
* gActionOUIDisableAggressiveEDCA - Used to specify action OUIs to control
* EDCA configuration when join the candidate AP
*
* @Default: NULL
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* This ini is used to specify AP OUIs. The station's EDCA should follow the
* APs' when connecting to those AP, even if the gEnableEdcaParams is set.
* For example, it follows the AP's EDCA whose OUI is 0050F2 with the
* following setting:
* gActionOUIDisableAggressiveEDCA=0050F2 00 01
* Explain: 0050F2: OUI
* 00: data length is 0
* 01: info mask, only OUI present in Info mask
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableEdcaParams, gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_DISABLE_AGGRESSIVE_EDCA CFG_INI_STRING( \
"gActionOUIDisableAggressiveEDCA", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to specify action OUIs to control edca configuration")
/*
* <ini>
* gActionOUIExtendWowITO - Used to extend ITO(Inactivity Time-Out) value under
* WoWLAN mode for specified APs.
*
* @Default: NULL
*
* Some APs sometimes don't honor Qos null frames under WoWLAN mode if
* station's ITO is too small. This ini is used to specify AP OUIs which
* exhibit this behavior. When connected to such an AP, the station's ITO
* value will be extended when in WoWLAN mode.
* For example, it extends the ITO value(under WoWLAN mode) when connected
* to AP whose OUI is 001018 and vendor specific data is 0201009C0000 with
* the following setting:
* gActionOUIExtendWowITO=001018 06 0201009C0000 FC 01
* OUI: 001018
* OUI data Len : 06
* OUI Data : 0201009C0000
* OUI data Mask: FC - 11111100
* Info Mask : 01 - only OUI present in Info mask
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_EXTEND_WOW_ITO CFG_INI_STRING( \
"gActionOUIExtendWowITO", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to extend inactivity time out under WoWLAN mode for specified APs")
/*
* <ini>
* gActionOUIReconnAssocTimeout - Used to specify action OUIs to
* reconnect to same BSSID when wait for association response timeout
*
* This ini is used to specify AP OUIs. Some of AP doesn't response our
* first association request, but it would response our second association
* request. Add such OUI configuration INI to apply reconnect logic when
* association timeout happends with such AP.
* For default:
* gActionOUIReconnAssocTimeout=00E04C 00 01
* Explain: 00E04C: OUI
* 00: data length is 0
* 01: info mask, only OUI present in Info mask
* Note: User should strictly add new action OUIs at the end of this
* default value.
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_RECONN_ASSOCTIMEOUT CFG_INI_STRING( \
"gActionOUIReconnAssocTimeout", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"00E04C 00 01", \
"Used to specify action OUIs to reconnect when assoc timeout")
/*
* <ini>
* gActionOUIDisableTWT - Used to specify action OUIs to control TWT param
* while joining the candidate AP
*
* This ini is used to specify AP OUIs. Some APs advertise TWT but do not
* follow through when the STA reaches out to them. Thus, TWT will be
* disabled when we receive OUIs of those APs.
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs: (All values in Hex)
* OUI 1: 001018
* OUI data Len: 00
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 2: 000986
* OUI data Len: 00
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 3: 000ce7
* OUI data Len: 00
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 4: 00e0fc
* OUI data Len: 00
* Info Mask : 01 - only OUI present in Info mask
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_DISABLE_TWT CFG_INI_STRING( \
"gActionOUIDisableTWT", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"001018 00 01 000986 00 01 000ce7 00 01 00e0fc 00 01", \
"Used to specify action OUIs to control TWT configuration")
/*
* <ini>
* gActionOUITakeAllBandInfo - Used to specify action OUIs to check
* whether country ie need take all band channel information.
*
* This ini is used to specify STA association request OUIs. Some STA
* need AP country ie take all band channel information when do BSS
* transition across band. Thus, AP will take all band channel info
* when we receive association request with this OUIs.
* Note: User should strictly add new action OUIs at the end of this
* default value.
*
* Default OUIs: (All values in Hex)
* OUI 1: 0017f2
* OUI data Len: 01
* OUI Data : 0a
* OUI data Mask: 80 - 10000000
* Info Mask : 01 - only OUI present in Info mask
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_TAKE_ALL_BAND_INFO CFG_INI_STRING( \
"gActionOUITakeAllBandInfo", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"0017f2 01 0a 80 01", \
"Used to specify action OUIs to control country ie")
/*
* <ini>
* g11be_oui_allow_list - Used to specify 802.11be allowed ap oui list
*
* This ini is used to specify AP OUIs for which station can connect
* in 802.11be mode with the 802.11be AP.
* If no OUI set, then allow STA to connect to All 802.11be AP in 802.11be
* mode.
* If INI is set to "ffffff 00 01", then STA is not allowed to connect to
* any AP in 802.11be mode.
*
* Related: None
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_11BE_ALLOW_LIST CFG_INI_STRING( \
"g11be_oui_allow_list", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to specify 11be allowed ap oui list")
/*
* <ini>
* gActionOUIDisableDynamicQosNullTxRate - Used to turn off FW's dynamic qos
* null tx rate feature if specific vendor OUI received in beacon
*
* Some APs sometimes don't honor Qos null frames with some specific rate.
* This ini will disable dynamic qos null tx rate feature for specified APs.
*
* Default OUIs: (All values in Hex)
* OUI 1: 00e04c
* OUI data Len: 03
* OUI Data : 020160
* OUI data Mask: E0 - 11100000
* Info Mask : 01 - only OUI present in Info mask
*
* OUI 2: 001018
* OUI data Len : 06
* OUI Data : 02FF009C0000
* OUI data Mask: BC - 10111100
* Info Mask : 01 - only OUI present in Info mask
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE CFG_INI_STRING( \
"gActionOUIDisableDynamicQosNullTxRate", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"00e04c 03 020160 E0 01 001018 06 02FF009c0000 BC 01", \
"Used to turn off FW's dynamic qos null tx rate for specified APs")
/*
* <ini>
* gActionOUIAuthAssoc6Mbps2GHz - Used to send auth/assoc req with 6 Mbps rate
* on 2.4 GHz for specified AP
*
* Some AP sometimes doesn't honor auth/assoc with CCK rate.
* This ini will provide 6 Mbps rate for auth/assoc in 2.4 GHz.
*
* Example OUIs: (All values in Hex)
* OUI 1: 000c43
* OUI data Len: 04
* OUI Data : 03000000
* OUI data Mask: F0 - 11110000
* Info Mask : 01 - only OUI present in Info mask
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ CFG_INI_STRING( \
"gActionOUIAuthAssoc6Mbps2GHz", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"send auth/assoc req with 6 Mbps rate on 2.4 GHz for specified APs")
/*
* <ini>
* CFG_ACTION_OUI_DISABLE_BFORMEE - Used to disable SU/MU beamformee
* capability for specified AP with some conditions
*
* Example OUIs: (All values in Hex)
* OUI 1: 000c43
* OUI data Len: 04
* OUI Data : 03000000
* OUI data Mask: F0 - 11110000
* Info Mask : 01 - only OUI present in Info mask
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_DISABLE_BFORMEE CFG_INI_STRING( \
"gActionOUIDisableBFORMEE", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"disable SU/MU beamformee capability for specified AP")
/*
* <ini>
* gActionOUIEnableCTS2SelfWithQoSNull - Used to enable CTS2SELF with QoS null
* frame for specified APs
*
* Sample OUIs: (All values in Hex)
* OUI 1: 000c43
* OUI data Len: 04
* OUI Data : 03000000
* OUI data Mask: F0 - 11110000
* Info Mask : 01 - only OUI present in Info mask
*
* gActionOUIEnableCTS2SelfWithQoSNull=000c43 04 03000000 F0 01
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL CFG_INI_STRING( \
"gActionOUIEnableCTS2SelfWithQoSNull", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to enable CTS2SELF with QoS null frame for specified APs")
/*
* <ini>
* g_action_oui_enable_cts_2_self - Used to enable CTS2SELF for specified APs
*
* Default OUIs: (All values in Hex)
* OUI 1: 000C43
* OUI data Len: 04
* OUI Data : 07000000
* OUI data Mask: F0 - 11110000
* Info Mask : 21 - 0010 0001 Check for OUI and Band
* Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
*
* OUI 2 : 000C43
* OUI data Len : 04
* OUI Data : 03000000
* OUI data Mask: F0 - 11110000
* Info Mask : 21 - 0010 0001 Check for OUI and Band
* Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
*
* g_action_oui_enable_cts_2_self=000C43 04 07000000 F0 21 C0 000C43 04 03000000 F0 21 C0
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_ENABLE_CTS2SELF CFG_INI_STRING( \
"g_action_oui_enable_cts_2_self", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"000C43 04 07000000 F0 21 C0 000C43 04 03000000 F0 21 C0", \
"Used to enable CTS2SELF frame for specified APs")
/*
* <ini>
* gActionOUISendSMPSFrameWithOMN - Used to send SMPS frame along with OMN
* for specified APs
*
* Sample OUIs: (All values in Hex)
* OUI 1: 000ce7
* OUI data Len: 04
* OUI Data : 88000000
* OUI data Mask: F0 - 11110000
* Info Mask : 01 - only OUI present in Info mask
*
* gActionOUISendSMPSFrameWithOMN=000ce7 04 88000000 F0 01
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN CFG_INI_STRING( \
"gActionOUISendSMPSFrameWithOMN", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Used to send SMPS frame along with OMN for specified APs")
/*
* <ini>
* gActionOUIRestrictMaxMLOLinks - Used to downgrade 3 link to 2 link ML
* connection for specific AP build version.
*
* Sample OUIs: (All values in Hex)
* OUI 3 : 8CFDF0
* OUI data Len : 13
* OUI Data : 040000494c510302097201cb17000009110000
* OUI data Mask: FFFFE0 - 1111 1111 1111 1111 1110 0000
* Info Mask : 01 - only OUI present in Info mask
*
* gActionOUIRestrictMaxMLOLinks=8CFDF0 13 040000494c510c00203000cb17000009110000 FFFFE0 01
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_RESTRICT_MAX_MLO_LINKS CFG_INI_STRING( \
"gActionOUIRestrictMaxMLOLinks", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"8CFDF0 13 040000494c510302097201cb17000009110000 FFFFE0 01", \
"To restrict matching OUI APs to two link connection at max")
/*
* <ini>
* CFG_ACTION_OUI_LIMIT_BW - Used to limit BW for specified AP
*
* Example OUIs: (All values in Hex)
* OUI 1: 00904c
* OUI data Len: 04
* OUI Data : 0201009C
* OUI data Mask: F0 - 11110000
* Info Mask : 01 - only OUI present in Info mask
*
* Refer to gEnableActionOUI for more detail about the format.
*
* Related: gEnableActionOUI
*
* Supported Feature: Action OUIs
*
* Usage: External
*
* </ini>
*/
#define CFG_ACTION_OUI_LIMIT_BW CFG_INI_STRING( \
"gActionOUILimitBW", \
0, \
ACTION_OUI_MAX_STR_LEN, \
"", \
"Limit BW for specified AP")
#define CFG_ACTION_OUI \
CFG(CFG_ACTION_OUI_CCKM_1X1) \
CFG(CFG_ACTION_OUI_CONNECT_1X1) \
CFG(CFG_ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN) \
CFG(CFG_ACTION_OUI_ITO_ALTERNATE) \
CFG(CFG_ACTION_OUI_ITO_EXTENSION) \
CFG(CFG_ACTION_OUI_DISABLE_AGGRESSIVE_TX) \
CFG(CFG_ACTION_OUI_DISABLE_AGGRESSIVE_EDCA) \
CFG(CFG_ACTION_OUI_EXTEND_WOW_ITO) \
CFG(CFG_ACTION_OUI_SWITCH_TO_11N_MODE) \
CFG(CFG_ACTION_OUI_RECONN_ASSOCTIMEOUT) \
CFG(CFG_ACTION_OUI_DISABLE_TWT) \
CFG(CFG_ACTION_OUI_TAKE_ALL_BAND_INFO) \
CFG(CFG_ACTION_OUI_11BE_ALLOW_LIST) \
CFG(CFG_ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE) \
CFG(CFG_ACTION_OUI_ENABLE_CTS2SELF) \
CFG(CFG_ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL) \
CFG(CFG_ACTION_OUI_RESTRICT_MAX_MLO_LINKS) \
CFG(CFG_ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN) \
CFG(CFG_ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ) \
CFG(CFG_ACTION_OUI_DISABLE_BFORMEE) \
CFG(CFG_ACTION_OUI_LIMIT_BW) \
CFG(CFG_ENABLE_ACTION_OUI)
#endif

View File

@ -0,0 +1,260 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare structs and macros which can be accessed by various
* components and modules.
*/
#ifndef _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_
#define _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_
#include <wlan_cmn.h>
#include <qdf_status.h>
#include <qdf_types.h>
/*
* Maximum ini string length of actions oui extensions,
* (n * 83) + (n - 1) spaces + 1 (terminating character),
* where n is the no of oui extensions
* currently, max no of oui extensions is 10
*/
#define ACTION_OUI_MAX_STR_LEN 840
/*
* Maximum number of action oui extensions supported in
* each action oui category
*/
#define ACTION_OUI_MAX_EXTENSIONS 10
/*
* Firmware allocates memory for the extensions only during init time.
* Therefore, inaddition to the total extensions configured during
* init time, driver has to add extra space to allow runtime extensions.
*
* Example: ACTION_OUI_11BE_OUI_ALLOW
*
* Max. value should be increased with the addition of new runtime extensions.
*/
#define ACTION_OUI_MAX_ADDNL_EXTENSIONS 10
#define ACTION_OUI_MAX_OUI_LENGTH 5
#define ACTION_OUI_MAX_DATA_LENGTH 20
#define ACTION_OUI_MAX_DATA_MASK_LENGTH 3
#define ACTION_OUI_MAC_MASK_LENGTH 1
#define ACTION_OUI_MAX_CAPABILITY_LENGTH 1
/*
* NSS Mask and NSS Offset to extract NSS info from
* capability field of action oui extension
*/
#define ACTION_OUI_CAPABILITY_NSS_MASK 0x0f
#define ACTION_OUI_CAPABILITY_NSS_OFFSET 0
#define ACTION_OUI_CAPABILITY_NSS_MASK_1X1 1
#define ACTION_OUI_CAPABILITY_NSS_MASK_2X2 2
#define ACTION_OUI_CAPABILITY_NSS_MASK_3X3 4
#define ACTION_OUI_CAPABILITY_NSS_MASK_4X4 8
/*
* Mask and offset to extract HT and VHT info from
* capability field of action oui extension
*/
#define ACTION_OUI_CAPABILITY_HT_ENABLE_MASK 0x10
#define ACTION_OUI_CAPABILITY_HT_ENABLE_OFFSET 4
#define ACTION_OUI_CAPABILITY_VHT_ENABLE_MASK 0x20
#define ACTION_OUI_CAPABILITY_VHT_ENABLE_OFFSET 5
/*
* Mask and offset to extract Band (2G and 5G) info from
* capability field of action oui extension
*/
#define ACTION_OUI_CAPABILITY_BAND_MASK 0xC0
#define ACTION_OUI_CAPABILITY_BAND_OFFSET 6
#define ACTION_OUI_CAPABILITY_2G_BAND_MASK 0x40
#define ACTION_OUI_CAPABILITY_2G_BAND_OFFSET 6
#define ACTION_CAPABILITY_5G_BAND_MASK 0x80
#define ACTION_CAPABILITY_5G_BAND_OFFSET 7
/* Invalid OUI ID action */
#define ACTION_OUI_INVALID "ffffff 00 01"
/**
* enum action_oui_id - to identify type of action oui
* @ACTION_OUI_CONNECT_1X1: for 1x1 connection only
* @ACTION_OUI_ITO_EXTENSION: for extending inactivity time of station
* @ACTION_OUI_CCKM_1X1: for TX with CCKM 1x1 only
* @ACTION_OUI_ITO_ALTERNATE: alternate ITO extensions used by firmware
* @ACTION_OUI_SWITCH_TO_11N_MODE: connect in 11n
* @ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN: connect in 1x1 & disable diversity gain
* @ACTION_OUI_DISABLE_AGGRESSIVE_TX: disable aggressive TX in firmware
* @ACTION_OUI_DISABLE_AGGRESSIVE_EDCA: disable aggressive EDCA with the ap
* @ACTION_OUI_DISABLE_TWT: disable TWT with the ap
* @ACTION_OUI_EXTEND_WOW_ITO: extend ITO under WOW mode if vendor OUI is
* received in beacon.
* @ACTION_OUI_11BE_OUI_ALLOW: ap oui for which station can connect with
* 11be mode
* @ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE: Turn off FW's dynamic qos
* null tx rate feature if specific vendor OUI received in beacon
* @ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL: Enable CTS2SELF with QoS null
* frame for specified IoT APs.
* @ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN: Send SMPS frame along with OMN
* frame for specified IoT APs.
* @ACTION_OUI_HOST_ONLY: host only action id start - placeholder.
* New Firmware related "ACTION" needs to be added before this placeholder.
* @ACTION_OUI_HOST_RECONN: reconnect to the same BSSID when wait for
* association response timeout from AP
* @ACTION_OUI_TAKE_ALL_BAND_INFO: let AP country ie take all band info
* @ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ: send auth/assoc req with 6 Mbps rate
* on 2.4 GHz
* @ACTION_OUI_DISABLE_BFORMEE: disable SU/MU beam formee capability for
* specified AP
* @ACTION_OUI_ENABLE_CTS2SELF: enable cts to self for specified AP's
* @ACTION_OUI_RESTRICT_MAX_MLO_LINKS: Downgrade MLO if particular AP
* build present.
* @ACTION_OUI_LIMIT_BW: Limit BW if vendor OUI is received in beacon.
* @ACTION_OUI_MAXIMUM_ID: maximum number of action oui types
*/
enum action_oui_id {
ACTION_OUI_CONNECT_1X1 = 0,
ACTION_OUI_ITO_EXTENSION = 1,
ACTION_OUI_CCKM_1X1 = 2,
ACTION_OUI_ITO_ALTERNATE = 3,
ACTION_OUI_SWITCH_TO_11N_MODE = 4,
ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN = 5,
ACTION_OUI_DISABLE_AGGRESSIVE_TX = 6,
ACTION_OUI_DISABLE_TWT = 7,
ACTION_OUI_EXTEND_WOW_ITO = 8,
ACTION_OUI_11BE_OUI_ALLOW = 9,
ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE = 10,
ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL = 11,
ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN = 12,
/* host&fw interface add above here */
ACTION_OUI_HOST_ONLY,
ACTION_OUI_HOST_RECONN = ACTION_OUI_HOST_ONLY,
ACTION_OUI_TAKE_ALL_BAND_INFO,
ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ,
ACTION_OUI_DISABLE_BFORMEE,
ACTION_OUI_DISABLE_AGGRESSIVE_EDCA,
ACTION_OUI_ENABLE_CTS2SELF,
ACTION_OUI_RESTRICT_MAX_MLO_LINKS,
ACTION_OUI_LIMIT_BW,
ACTION_OUI_MAXIMUM_ID
};
/**
* enum action_oui_info - to indicate presence of various action OUI
* fields in action oui extension, following identifiers are to be set in
* the info mask field of action oui extension
* @ACTION_OUI_INFO_OUI: to indicate presence of OUI string
* @ACTION_OUI_INFO_MAC_ADDRESS: to indicate presence of mac address
* @ACTION_OUI_INFO_AP_CAPABILITY_NSS: to indicate presence of nss info
* @ACTION_OUI_INFO_AP_CAPABILITY_HT: to indicate presence of HT cap
* @ACTION_OUI_INFO_AP_CAPABILITY_VHT: to indicate presence of VHT cap
* @ACTION_OUI_INFO_AP_CAPABILITY_BAND: to indicate presence of band info
*/
enum action_oui_info {
/*
* OUI centric parsing, expect OUI in each action OUI extension,
* hence, ACTION_OUI_INFO_OUI is dummy
*/
ACTION_OUI_INFO_OUI = 1 << 0,
ACTION_OUI_INFO_MAC_ADDRESS = 1 << 1,
ACTION_OUI_INFO_AP_CAPABILITY_NSS = 1 << 2,
ACTION_OUI_INFO_AP_CAPABILITY_HT = 1 << 3,
ACTION_OUI_INFO_AP_CAPABILITY_VHT = 1 << 4,
ACTION_OUI_INFO_AP_CAPABILITY_BAND = 1 << 5,
};
/* Total mask of all enum action_oui_info IDs */
#define ACTION_OUI_INFO_MASK 0x3F
/**
* struct action_oui_extension - action oui extension contents
* @info_mask: info mask
* @oui_length: length of the oui, either 3 or 5 bytes
* @data_length: length of the oui data
* @data_mask_length: length of the data mask
* @mac_addr_length: length of the mac addr
* @mac_mask_length: length of the mac mask
* @capability_length: length of the capability
* @oui: oui value
* @data: data buffer
* @data_mask: data mask buffer
* @mac_addr: mac addr
* @mac_mask: mac mask
* @capability: capability buffer
*/
struct action_oui_extension {
uint32_t info_mask;
uint32_t oui_length;
uint32_t data_length;
uint32_t data_mask_length;
uint32_t mac_addr_length;
uint32_t mac_mask_length;
uint32_t capability_length;
uint8_t oui[ACTION_OUI_MAX_OUI_LENGTH];
uint8_t data[ACTION_OUI_MAX_DATA_LENGTH];
uint8_t data_mask[ACTION_OUI_MAX_DATA_MASK_LENGTH];
uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
uint8_t mac_mask[ACTION_OUI_MAC_MASK_LENGTH];
uint8_t capability[ACTION_OUI_MAX_CAPABILITY_LENGTH];
};
/**
* struct action_oui_request - Contains specific action oui information
* @action_id: type of action from enum action_oui_info
* @no_oui_extensions: number of action oui extensions of type @action_id
* @total_no_oui_extensions: total no of oui extensions from all
* action oui types, this is just a total count needed by firmware
* @extension: pointer to zero length array, to indicate this structure is
* followed by a array of @no_oui_extensions structures of
* type struct action_oui_extension
*/
struct action_oui_request {
enum action_oui_id action_id;
uint32_t no_oui_extensions;
uint32_t total_no_oui_extensions;
struct action_oui_extension extension[];
};
/**
* struct action_oui_search_attr - Used to check against action_oui ini input
*
* @ie_data: beacon ie data
* @ie_length: length of ie data
* @mac_addr: bssid of access point
* @nss: AP spatial stream info
* @ht_cap: Whether AP is HT capable
* @vht_cap: Whether AP is VHT capable
* @enable_2g: Whether 2.4GHz band is enabled in AP
* @enable_5g: Whether 5GHz band is enabled in AP
*/
struct action_oui_search_attr {
uint8_t *ie_data;
uint32_t ie_length;
uint8_t *mac_addr;
uint32_t nss;
bool ht_cap;
bool vht_cap;
bool enable_2g;
bool enable_5g;
};
#endif /* _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_ */

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare public API for action_oui to interact with target/WMI
*/
#ifndef _WLAN_ACTION_OUI_TGT_API_H_
#define _WLAN_ACTION_OUI_TGT_API_H_
#include "wlan_action_oui_public_struct.h"
#include "wlan_action_oui_objmgr.h"
#define GET_ACTION_OUI_TX_OPS_FROM_PSOC(psoc) \
(&action_oui_psoc_get_priv(psoc)->tx_ops)
/**
* tgt_action_oui_send() - Send request to target if
* @psoc: objmgr psoc object
* @req: action_oui request to be send
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_action_oui_send(struct wlan_objmgr_psoc *psoc,
struct action_oui_request *req);
/**
* struct action_oui_tx_ops - structure of tx operations
* @send_req: Pointer to hold target_if send function
*/
struct action_oui_tx_ops {
QDF_STATUS (*send_req)(struct wlan_objmgr_psoc *psoc,
struct action_oui_request *req);
};
#endif /* _WLAN_ACTION_OUI_TGT_API_H_ */

View File

@ -0,0 +1,331 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare public API related to the action_oui called by north bound
* HDD/OSIF/LIM
*/
#ifndef _WLAN_ACTION_OUI_UCFG_API_H_
#define _WLAN_ACTION_OUI_UCFG_API_H_
#include <qdf_status.h>
#include <qdf_types.h>
#include "wlan_action_oui_public_struct.h"
#include "wlan_action_oui_objmgr.h"
#ifdef WLAN_FEATURE_ACTION_OUI
/**
* ucfg_action_oui_init() - Register notification handlers.
*
* This function registers action_oui notification handlers which are
* invoked from psoc create/destroy handlers.
*
* Return: For successful registration - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS ucfg_action_oui_init(void);
/**
* ucfg_action_oui_deinit() - Unregister notification handlers.
*
* This function Unregisters action_oui notification handlers which are
* invoked from psoc create/destroy handlers.
*
* Return: None
*/
void ucfg_action_oui_deinit(void);
/**
* ucfg_action_oui_psoc_enable() - Notify action oui psoc enable
* @psoc: psoc object
*
* Return: None
*/
void ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_action_oui_psoc_disable() - Notify action oui psoc disable
* @psoc: psoc object
*
* Return: None
*/
void ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_action_oui_parse() - Parse input string and extract extensions.
* @psoc: objmgr psoc object
* @in_str: input string to be parsed
* @action_id: action to which given string corresponds
*
* This is a wrapper function which invokes internal function
* action_oui_extract() to extract OUIs and related attributes.
*
* Return: For successful parse - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS
ucfg_action_oui_parse(struct wlan_objmgr_psoc *psoc,
const uint8_t *in_str,
enum action_oui_id action_id);
/**
* ucfg_action_oui_send() - Send action_oui and related attributes to Fw.
* @psoc: objmgr psoc object
*
* This is a wrapper function which invokes internal function
* action_oui_send() to send OUIs and related attributes to firmware.
*
* Return: For successful send - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS ucfg_action_oui_send(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_action_oui_enabled() - State of action_oui component
* @psoc: psoc object
*
* Return: True if action oui is enabled
*/
bool ucfg_action_oui_enabled(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_action_oui_search() - Check for OUIs and related info in IE data.
* @psoc: objmgr psoc object
* @attr: pointer to structure containing type of action, beacon IE data etc.,
* @action_id: type of action to be checked
*
* This is a wrapper function which invokes internal function to search
* for OUIs and related info (specified from ini file) in vendor specific
* data of beacon IE for given action.
*
* Return: If search is successful return true else false.
*/
bool ucfg_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id);
/**
* ucfg_action_oui_cleanup() - Remove all in existing oui entry.
* @psoc: objmgr psoc object
* @action_id: type of action to be removed
*
* This is a wrapper function which invokes internal function to remove
* all the existing oui entry.
*
* Return: QDF_STATUS_SUCCESS If remove is successful.
*/
QDF_STATUS
ucfg_action_oui_cleanup(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id);
/**
* ucfg_action_oui_send_by_id() - Send action oui for action id
* @psoc: objmgr psoc object
* @id: type of action to be sent
*
* This is a wrapper function which invokes internal function to send
* action oui entry to firmware.
*
* Return: QDF_STATUS_SUCCESS If sending is successful.
*/
QDF_STATUS ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc *psoc,
enum action_oui_id id);
/**
* ucfg_action_oui_get_config() - Get current action INI config
* @psoc: objmgr psoc object
* @action_id: type of action to get
*
* Return: config string.
*/
uint8_t *
ucfg_action_oui_get_config(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id);
#else
/**
* ucfg_action_oui_init() - Register notification handlers.
*
* This function registers action_oui notification handlers which are
* invoked from psoc create/destroy handlers.
*
* Return: For successful registration - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
static inline
QDF_STATUS ucfg_action_oui_init(void)
{
return QDF_STATUS_SUCCESS;
}
/**
* ucfg_action_oui_deinit() - Unregister notification handlers.
*
* This function Unregisters action_oui notification handlers which are
* invoked from psoc create/destroy handlers.
*
* Return: None
*/
static inline
void ucfg_action_oui_deinit(void)
{
}
/**
* ucfg_action_oui_psoc_enable() - Notify action oui psoc enable
* @psoc: psoc object
*
* Return: None
*/
static inline
void ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
}
/**
* ucfg_action_oui_psoc_disable() - Notify action oui psoc disable
* @psoc: psoc object
*
* Return: None
*/
static inline
void ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
}
/**
* ucfg_action_oui_parse() - Parse input string of action_id specified.
* @psoc: objmgr psoc object
* @in_str: input string to be parsed
* @action_id: action to which given string corresponds
*
* This is a wrapper function which invokes internal function
* action_oui_extract() to extract OUIs and related attributes.
*
* Return: For successful parse - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
static inline QDF_STATUS
ucfg_action_oui_parse(struct wlan_objmgr_psoc *psoc,
const uint8_t *in_str,
enum action_oui_id action_id)
{
return QDF_STATUS_SUCCESS;
}
/**
* ucfg_action_oui_send() - Send action_oui and related attributes to Fw.
* @psoc: objmgr psoc object
*
* This is a wrapper function which invokes internal function
* action_oui_send() to send OUIs and related attributes to firmware.
*
* Return: For successful send - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
static inline
QDF_STATUS ucfg_action_oui_send(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
/**
* ucfg_action_oui_enabled() - State of action_oui component
*
* Return: When action_oui component is present return true
* else return false.
*/
static inline bool ucfg_action_oui_enabled(void)
{
return false;
}
/**
* ucfg_action_oui_search() - Check for OUIs and related info in IE data.
* @psoc: objmgr psoc object
* @attr: pointer to structure containing type of action, beacon IE data etc.,
* @action_id: type of action to be checked
*
* This is a wrapper function which invokes internal function to search
* for OUIs and related info (specified from ini file) in vendor specific
* data of beacon IE for given action.
*
* Return: If search is successful return true else false.
*/
static inline
bool ucfg_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id)
{
return false;
}
/**
* ucfg_action_oui_cleanup() - Remove all of existing oui entry
* @psoc: objmgr psoc object
* @action_id: type of action to be removed
*
* This is a wrapper function which invokes internal function to remove
* all the existing oui entry.
*
* Return: QDF_STATUS_SUCCESS If remove is successful.
*/
static inline
QDF_STATUS
ucfg_action_oui_cleanup(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
return QDF_STATUS_SUCCESS;
}
/**
* ucfg_action_oui_send_by_id() - Send action oui for action id
* @psoc: objmgr psoc object
* @id: type of action to be sent
*
* This is a wrapper function which invokes internal function to send
* action oui entry to firmware.
*
* Return: QDF_STATUS_SUCCESS If sending is successful.
*/
static inline
QDF_STATUS ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc *psoc,
enum action_oui_id id)
{
return QDF_STATUS_SUCCESS;
}
/**
* ucfg_action_oui_get_config() - Get current action INI config
* @psoc: objmgr psoc object
* @action_id: type of action to get
*
* Return: config string.
*/
static inline uint8_t *
ucfg_action_oui_get_config(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
return "";
}
#endif /* WLAN_FEATURE_ACTION_OUI */
#endif /* _WLAN_ACTION_OUI_UCFG_API_H_ */

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implements public API for action_oui to interact with target/WMI
*/
#include "wlan_action_oui_tgt_api.h"
#include "wlan_action_oui_main.h"
#include "wlan_action_oui_public_struct.h"
QDF_STATUS tgt_action_oui_send(struct wlan_objmgr_psoc *psoc,
struct action_oui_request *req)
{
struct action_oui_tx_ops *tx_ops;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
ACTION_OUI_ENTER();
tx_ops = GET_ACTION_OUI_TX_OPS_FROM_PSOC(psoc);
QDF_ASSERT(tx_ops->send_req);
if (tx_ops->send_req)
status = tx_ops->send_req(psoc, req);
ACTION_OUI_EXIT();
return status;
}

View File

@ -0,0 +1,233 @@
/*
* Copyright (c) 2012-2018, 2020-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Public API implementation of action_oui called by north bound HDD/OSIF.
*/
#include "wlan_action_oui_ucfg_api.h"
#include "wlan_action_oui_main.h"
#include "target_if_action_oui.h"
#include "wlan_action_oui_tgt_api.h"
#include <qdf_str.h>
QDF_STATUS ucfg_action_oui_init(void)
{
QDF_STATUS status;
ACTION_OUI_ENTER();
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_ACTION_OUI,
action_oui_psoc_create_notification, NULL);
if (!QDF_IS_STATUS_SUCCESS(status)) {
action_oui_err("Failed to register psoc create handler");
goto exit;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_ACTION_OUI,
action_oui_psoc_destroy_notification, NULL);
if (QDF_IS_STATUS_SUCCESS(status)) {
action_oui_debug("psoc create/delete notifications registered");
goto exit;
}
action_oui_err("Failed to register psoc delete handler");
wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_ACTION_OUI,
action_oui_psoc_create_notification, NULL);
exit:
ACTION_OUI_EXIT();
return status;
}
void ucfg_action_oui_deinit(void)
{
QDF_STATUS status;
ACTION_OUI_ENTER();
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_ACTION_OUI,
action_oui_psoc_create_notification, NULL);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_err("Failed to unregister psoc create handler");
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_ACTION_OUI,
action_oui_psoc_destroy_notification,
NULL);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_err("Failed to unregister psoc delete handler");
ACTION_OUI_EXIT();
}
void ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
action_oui_psoc_enable(psoc);
}
void ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
action_oui_psoc_disable(psoc);
}
bool ucfg_action_oui_enabled(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
return false;
}
return psoc_priv->action_oui_enable;
}
uint8_t *
ucfg_action_oui_get_config(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
struct action_oui_psoc_priv *psoc_priv;
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
return "";
}
if (action_id >= ACTION_OUI_MAXIMUM_ID) {
action_oui_err("Invalid action_oui id: %u", action_id);
return "";
}
return psoc_priv->action_oui_str[action_id];
}
QDF_STATUS
ucfg_action_oui_parse(struct wlan_objmgr_psoc *psoc,
const uint8_t *in_str,
enum action_oui_id action_id)
{
return action_oui_parse_string(psoc, in_str, action_id);
}
QDF_STATUS
ucfg_action_oui_cleanup(struct wlan_objmgr_psoc *psoc,
enum action_oui_id action_id)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status = QDF_STATUS_E_INVAL;
ACTION_OUI_ENTER();
if (action_id >= ACTION_OUI_MAXIMUM_ID) {
action_oui_err("Invalid action_oui id: %u", action_id);
goto exit;
}
if (!psoc) {
action_oui_err("psoc is NULL");
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
status = wlan_action_oui_cleanup(psoc_priv, action_id);
exit:
ACTION_OUI_EXIT();
return status;
}
QDF_STATUS ucfg_action_oui_send(struct wlan_objmgr_psoc *psoc)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status = QDF_STATUS_E_INVAL;
uint32_t id;
if (!psoc) {
action_oui_err("psoc is NULL");
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
for (id = 0; id < ACTION_OUI_MAXIMUM_ID; id++) {
if (id >= ACTION_OUI_HOST_ONLY)
continue;
status = action_oui_send(psoc_priv, id);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_debug("Failed to send: %u", id);
}
exit:
return status;
}
QDF_STATUS ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc *psoc,
enum action_oui_id id)
{
struct action_oui_psoc_priv *psoc_priv;
QDF_STATUS status = QDF_STATUS_E_INVAL;
ACTION_OUI_ENTER();
if (!psoc) {
action_oui_err("psoc is NULL");
goto exit;
}
psoc_priv = action_oui_psoc_get_priv(psoc);
if (!psoc_priv) {
action_oui_err("psoc priv is NULL");
goto exit;
}
if (id >= ACTION_OUI_HOST_ONLY) {
action_oui_err("id %d not for firmware", id);
status = QDF_STATUS_SUCCESS;
goto exit;
}
status = action_oui_send(psoc_priv, id);
if (!QDF_IS_STATUS_SUCCESS(status))
action_oui_debug("Failed to send: %u", id);
exit:
ACTION_OUI_EXIT();
return status;
}
bool ucfg_action_oui_search(struct wlan_objmgr_psoc *psoc,
struct action_oui_search_attr *attr,
enum action_oui_id action_id)
{
return wlan_action_oui_search(psoc, attr, action_id);
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "cfg_policy_mgr.h"
#include "cfg_define.h"
#include "cfg_converged.h"
#include "cfg_mlme.h"
#include "cfg_fwol.h"
#include "cfg_ipa.h"
#ifdef CONVERGED_P2P_ENABLE
#include "cfg_p2p.h"
#else
#define CFG_P2P_ALL
#endif
#ifdef FEATURE_WLAN_TDLS
#include "cfg_tdls.h"
#else
#define CFG_TDLS_ALL
#endif
#ifdef WLAN_FEATURE_NAN
#include "cfg_nan.h"
#else
#define CFG_NAN_ALL
#endif
#include "cfg_ftm_time_sync.h"
#include "wlan_pmo_cfg.h"
#include "wlan_dp_cfg.h"
#include "hdd_config.h"
#include "hdd_dp_cfg.h"
#include "cfg_legacy_dp.h"
#include "cfg_dlm.h"
#include "cfg_pkt_capture.h"
#include "wlan_action_oui_cfg.h"
/* Maintain Alphabetic order here while adding components */
#define CFG_ALL \
CFG_DENYLIST_MGR_ALL \
CFG_CONVERGED_ALL \
CFG_FWOL_ALL \
CFG_POLICY_MGR_ALL \
CFG_HDD_ALL \
CFG_HDD_DP_ALL \
CFG_DP_ALL \
CFG_LEGACY_DP_ALL \
CFG_MLME_ALL \
CFG_NAN_ALL \
CFG_P2P_ALL \
CFG_PMO_ALL \
CFG_TDLS_ALL \
CFG_PKT_CAPTURE_MODE_ALL \
CFG_TIME_SYNC_FTM_ALL \
CFG_ACTION_OUI

View File

@ -0,0 +1,199 @@
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains interface manager public api
*/
#ifndef _WLAN_IF_MGR_ROAM_H_
#define _WLAN_IF_MGR_ROAM_H_
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "wlan_objmgr_vdev_obj.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_if_mgr_public_struct.h"
#include "wlan_if_mgr_roam.h"
/**
* struct change_roam_state_arg - Contains roam state arguments
* @requestor: Driver disabled roaming requestor
* @curr_vdev_id: virtual device ID
*
* This structure is used to pass the roam state change information to the
* callback
*/
struct change_roam_state_arg {
enum wlan_cm_rso_control_requestor requestor;
uint8_t curr_vdev_id;
};
/**
* struct bssid_search_arg - Contains candidate validation arguments
* @peer_addr: MAC address of the BSS
* @vdev_id: virtual device ID
*
* This structure is used to pass the candidate validation information to the
* callback
*/
struct bssid_search_arg {
struct qdf_mac_addr peer_addr;
uint8_t vdev_id;
};
/**
* enum allow_mcc_go_diff_bi_definition - Defines the config values for allowing
* different beacon intervals between P2P-G0 and STA
* @ALLOW_MCC_GO_DIFF_BI_WFA_CERT: GO Beacon interval is not changed.
* MCC GO doesn't work well in optimized way. In worst scenario, it may
* invite STA disconnection.
* @ALLOW_MCC_GO_DIFF_BI_WORKAROUND: Workaround 1 disassoc all the clients and
* update beacon Interval.
* @ALLOW_MCC_GO_DIFF_BI_TEAR_DOWN: Tear down the P2P link in
* auto/Non-autonomous -GO case.
* @ALLOW_MCC_GO_DIFF_BI_NO_DISCONNECT: Don't disconnect the P2P client in
* autonomous/Non-autonomous -GO case update the BI dynamically
*/
enum allow_mcc_go_diff_bi_definition {
ALLOW_MCC_GO_DIFF_BI_WFA_CERT = 1,
ALLOW_MCC_GO_DIFF_BI_WORKAROUND,
ALLOW_MCC_GO_DIFF_BI_TEAR_DOWN,
ALLOW_MCC_GO_DIFF_BI_NO_DISCONNECT,
};
/**
* struct beacon_interval_arg - Contains beacon interval validation arguments
* @curr_vdev_id: current iterator vdev ID
* @curr_bss_opmode: current iterator BSS's opmode
* @ch_freq: current operating channel frequency
* @bss_beacon_interval: beacon interval that can be updated by callee
* @status: status to be filled by callee
* @is_done: boolean to stop iterating
* @update_beacon_interval: boolean to mark beacon interval as updated by callee
*
* This structure is used to pass the candidate validation information to the
* callback
*/
struct beacon_interval_arg {
uint8_t curr_vdev_id;
enum QDF_OPMODE curr_bss_opmode;
qdf_freq_t ch_freq;
uint16_t bss_beacon_interval;
QDF_STATUS status;
bool is_done;
bool update_beacon_interval;
};
/**
* if_mgr_enable_roaming() - interface manager enable roaming
* @pdev: pdev object
* @vdev: vdev object
* @requestor: RSO enable requestor
*
* Interface manager api to enable roaming for all other active vdev id's
*
* Context: It should run in thread context
*
* Return: QDF_STATUS
*/
QDF_STATUS if_mgr_enable_roaming(struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_vdev *vdev,
enum wlan_cm_rso_control_requestor requestor);
/**
* if_mgr_disable_roaming() - interface manager disable roaming
* @pdev: pdev object
* @vdev: vdev object
* @requestor: RSO disable requestor
*
* Interface manager api to disable roaming for all other active vdev id's
*
* Context: It should run in thread context
*
* Return: QDF_STATUS
*/
QDF_STATUS if_mgr_disable_roaming(struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_vdev *vdev,
enum wlan_cm_rso_control_requestor requestor);
/**
* if_mgr_enable_roaming_on_connected_sta() - interface manager disable roaming
* on connected STA
* @pdev: pdev object
* @vdev: vdev object
*
* Loops through connected vdevs and disables roaming if it is STA
*
* Context: It should run in thread context
*
* Return: QDF_STATUS
*/
QDF_STATUS
if_mgr_enable_roaming_on_connected_sta(struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_vdev *vdev);
/**
* if_mgr_enable_roaming_after_p2p_disconnect() - interface manager enable
* roaming after p2p disconnect
* @pdev: pdev object
* @vdev: vdev object
* @requestor: RSO enable requestor
*
* Disables roaming on p2p vdevs if the state is disconnected
*
* Context: It should run in thread context
*
* Return: QDF_STATUS
*/
QDF_STATUS if_mgr_enable_roaming_after_p2p_disconnect(
struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_vdev *vdev,
enum wlan_cm_rso_control_requestor requestor);
/**
* if_mgr_is_beacon_interval_valid() - checks if the concurrent session is
* valid
* @pdev: pdev object
* @vdev_id: vdev ID
* @candidate: concurrent candidate info
*
* This function validates the beacon interval with all other active vdevs.
*
* Context: It should run in thread context
*
* Return: true if session is valid, false if not
*/
bool if_mgr_is_beacon_interval_valid(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id,
struct validate_bss_data *candidate);
/**
* if_mgr_validate_candidate() - validate candidate event handler
* @vdev: vdev object
* @event_data: Interface mgr event data
*
* This function will validate the candidate to see if it is a suitable option
* for roaming to.
*
* Context: It should run in thread context
*
* Return: QDF_STATUS
*/
QDF_STATUS if_mgr_validate_candidate(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data);
#endif

View File

@ -0,0 +1,235 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains interface manager public api
*/
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_vdev_obj.h"
#include "wlan_if_mgr_public_struct.h"
#include "wlan_if_mgr_ap.h"
#include "wlan_if_mgr_roam.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_if_mgr_main.h"
#include "wlan_p2p_cfg_api.h"
#include "wlan_tdls_api.h"
#include "wlan_p2p_api.h"
#include "wlan_mlme_vdev_mgr_interface.h"
#include "wlan_p2p_ucfg_api.h"
#include "wlan_vdev_mgr_utils_api.h"
#include "wlan_tdls_tgt_api.h"
#include "wlan_policy_mgr_ll_sap.h"
QDF_STATUS if_mgr_ap_start_bss(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
QDF_STATUS status;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
wlan_tdls_notify_start_bss(psoc, vdev);
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE ||
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE)
wlan_handle_emlsr_sta_concurrency(psoc, true, false);
if (policy_mgr_is_hw_mode_change_in_progress(psoc)) {
if (!QDF_IS_STATUS_SUCCESS(
policy_mgr_wait_for_connection_update(psoc))) {
ifmgr_err("qdf wait for event failed!!");
return QDF_STATUS_E_FAILURE;
}
}
if (policy_mgr_is_chan_switch_in_progress(psoc)) {
status = policy_mgr_wait_chan_switch_complete_evt(psoc);
if (!QDF_IS_STATUS_SUCCESS(status)) {
ifmgr_err("qdf wait for csa event failed!!");
return QDF_STATUS_E_FAILURE;
}
}
if (policy_mgr_is_sta_active_connection_exists(psoc))
/* Disable Roaming on all vdev's before starting bss */
if_mgr_disable_roaming(pdev, vdev, RSO_START_BSS);
/* abort p2p roc before starting the BSS for sync event */
ucfg_p2p_cleanup_roc_by_psoc(psoc);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
if_mgr_ap_start_bss_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
/*
* Due to audio share glitch with P2P GO caused by
* roam scan on concurrent interface, disable
* roaming if "p2p_disable_roam" ini is enabled.
* Donot re-enable roaming again on other STA interface
* if p2p GO is active on any vdev.
*/
if (cfg_p2p_is_roam_config_disabled(psoc) &&
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE) {
ifmgr_debug("p2p go mode, keep roam disabled");
} else {
/* Enable Roaming after start bss in case of failure/success */
if_mgr_enable_roaming(pdev, vdev, RSO_START_BSS);
}
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE)
policy_mgr_check_sap_go_force_scc(psoc, vdev,
CSA_REASON_GO_BSS_STARTED);
ifmgr_debug("check for SAP restart");
if (policy_mgr_is_vdev_ll_lt_sap(psoc, wlan_vdev_get_id(vdev)))
policy_mgr_ll_lt_sap_restart_concurrent_sap(psoc, true);
else
policy_mgr_check_concurrent_intf_and_restart_sap(
psoc,
wlan_util_vdev_mgr_get_acs_mode_for_vdev(vdev));
/*
* Enable TDLS again on concurrent STA
*/
if (event_data && QDF_IS_STATUS_ERROR(event_data->status))
wlan_tdls_notify_start_bss_failure(psoc);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS if_mgr_ap_stop_bss(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
if_mgr_ap_stop_bss_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
uint8_t mcc_scc_switch;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE ||
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE)
wlan_handle_emlsr_sta_concurrency(psoc, false, true);
/*
* Due to audio share glitch with P2P GO caused by
* roam scan on concurrent interface, disable
* roaming if "p2p_disable_roam" ini is enabled.
* Re-enable roaming on other STA interface if p2p GO
* is active on any vdev.
*/
if (cfg_p2p_is_roam_config_disabled(psoc) &&
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE) {
ifmgr_debug("p2p go disconnected enable roam");
if_mgr_enable_roaming(pdev, vdev, RSO_START_BSS);
}
ifmgr_debug("SAP/P2P-GO is stopped, re-enable roaming if it's stopped due to SAP/P2P-GO CSA");
if_mgr_enable_roaming(pdev, vdev, RSO_SAP_CHANNEL_CHANGE);
policy_mgr_get_mcc_scc_switch(psoc, &mcc_scc_switch);
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE &&
mcc_scc_switch == QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL)
policy_mgr_check_concurrent_intf_and_restart_sap(psoc, false);
if (policy_mgr_is_vdev_ll_lt_sap(psoc, wlan_vdev_get_id(vdev)))
policy_mgr_ll_lt_sap_restart_concurrent_sap(psoc, false);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
if_mgr_ap_csa_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
QDF_STATUS status = QDF_STATUS_SUCCESS;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
status = wlan_p2p_check_and_force_scc_go_plus_go(psoc, vdev);
if (QDF_IS_STATUS_ERROR(status))
ifmgr_err("force scc failure with status: %d", status);
wlan_tdls_notify_channel_switch_complete(psoc, wlan_vdev_get_id(vdev));
return status;
}
QDF_STATUS
if_mgr_ap_csa_start(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
enum QDF_OPMODE op_mode;
op_mode = wlan_vdev_mlme_get_opmode(vdev);
if (op_mode != QDF_SAP_MODE && op_mode != QDF_P2P_GO_MODE)
return QDF_STATUS_SUCCESS;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
/*
* Disable TDLS off-channel before VDEV restart
*/
wlan_tdls_notify_channel_switch_start(psoc, vdev);
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,288 @@
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains interface manager public api
*/
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_vdev_obj.h"
#include "wlan_if_mgr_public_struct.h"
#include "wlan_if_mgr_sta.h"
#include "wlan_if_mgr_roam.h"
#include "wlan_if_mgr_main.h"
#include "nan_ucfg_api.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_p2p_ucfg_api.h"
#include "wlan_tdls_ucfg_api.h"
#include "wlan_tdls_api.h"
#include <wlan_cm_api.h>
#include <wlan_mlo_mgr_public_structs.h>
#include <wlan_mlo_mgr_cmn.h>
#include <wlan_cm_roam_api.h>
#include "wlan_nan_api.h"
#include "wlan_mlme_vdev_mgr_interface.h"
#include <wlan_mlo_mgr_sta.h>
#include "wlan_vdev_mgr_utils_api.h"
#include "wlan_tdls_api.h"
#include "wlan_mlo_mgr_link_switch.h"
#include "wlan_ll_sap_api.h"
QDF_STATUS if_mgr_connect_start(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
uint8_t sta_cnt, sap_cnt;
struct wlan_objmgr_pdev *pdev;
struct wlan_objmgr_psoc *psoc;
enum QDF_OPMODE op_mode;
uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS], i;
bool disable_nan = true;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
/*
* Disable NAN Discovery if incoming connection is P2P or if a STA
* connection already exists and if this is a case of STA+STA
* or SAP+STA concurrency
*/
sta_cnt = policy_mgr_get_mode_specific_conn_info(psoc, NULL,
vdev_id_list,
PM_STA_MODE);
sap_cnt = policy_mgr_get_sap_mode_info(psoc, NULL,
&vdev_id_list[sta_cnt]);
op_mode = wlan_vdev_mlme_get_opmode(vdev);
if (op_mode == QDF_STA_MODE || op_mode == QDF_P2P_CLIENT_MODE)
wlan_handle_emlsr_sta_concurrency(psoc, true, false);
if (op_mode == QDF_P2P_CLIENT_MODE || sap_cnt || sta_cnt) {
for (i = 0; i < sta_cnt + sap_cnt; i++) {
if (vdev_id_list[i] == wlan_vdev_get_id(vdev))
disable_nan = false;
/* 1. Don't disable nan if firmware supports
* ML STA + NAN + NDP.
* 2. Disable nan if legacy sta + nan +
* ML STA(primary link) comes up.
*/
if (wlan_vdev_mlme_is_mlo_link_vdev(vdev) &&
wlan_is_mlo_sta_nan_ndi_allowed(psoc))
disable_nan = false;
}
if (disable_nan)
ucfg_nan_disable_concurrency(psoc);
}
if (op_mode == QDF_P2P_CLIENT_MODE)
wlan_tdls_handle_p2p_client_connect(psoc, vdev);
/*
* STA+NDI concurrency gets preference over NDI+NDI. Disable
* first NDI in case an NDI+NDI concurrency exists if FW does
* not support 4 port concurrency of two NDI + NAN with STA.
*/
if (!ucfg_nan_is_sta_nan_ndi_4_port_allowed(psoc))
ucfg_nan_check_and_disable_unsupported_ndi(psoc,
false);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS if_mgr_connect_active(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_pdev *pdev;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
if (!wlan_vdev_mlme_is_mlo_link_vdev(vdev)) {
/*
* In case of STA+STA concurrency, firmware might try to roam
* to same AP where host is trying to do association on the other
* STA iface. Roaming is disabled on all the ifaces to avoid
* this scenario.
*/
if_mgr_disable_roaming(pdev, vdev, RSO_CONNECT_START);
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS if_mgr_connect_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
QDF_STATUS status = event_data->status;
uint8_t vdev_id;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
vdev_id = wlan_vdev_get_id(vdev);
if (QDF_IS_STATUS_SUCCESS(status)) {
/*
* Due to audio share glitch with P2P clients caused by roam
* scan on concurrent interface, disable roaming if
* "p2p_disable_roam" ini is enabled. Donot re-enable roaming
* again on other STA interface if p2p client connection is
* active on any vdev.
*/
if (ucfg_p2p_is_roam_config_disabled(psoc) &&
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_CLIENT_MODE) {
ifmgr_debug("p2p client active, keep roam disabled");
} else {
ifmgr_debug("set pcl when connection on vdev id:%d",
vdev_id);
policy_mgr_set_pcl_for_connected_vdev(psoc, vdev_id,
false);
/*
* Enable roaming on other STA iface except this one.
* Firmware doesn't support connection on one STA iface
* while roaming on other STA iface.
*/
if_mgr_enable_roaming(pdev, vdev, RSO_CONNECT_START);
}
} else {
/* notify connect failure on final failure */
ucfg_tdls_notify_connect_failure(psoc);
/*
* Enable roaming on other STA iface except this one.
* Firmware doesn't support connection on one STA iface
* while roaming on other STA iface.
*/
if_mgr_enable_roaming(pdev, vdev, RSO_CONNECT_START);
}
policy_mgr_check_n_start_opportunistic_timer(psoc);
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE &&
wlan_vdev_mlme_is_mlo_vdev(vdev))
wlan_handle_emlsr_sta_concurrency(psoc, false, true);
if (!wlan_cm_is_vdev_roaming(vdev))
policy_mgr_check_concurrent_intf_and_restart_sap(psoc,
wlan_util_vdev_mgr_get_acs_mode_for_vdev(vdev));
wlan_ll_sap_switch_bearer_on_sta_connect_complete(psoc, vdev_id);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS if_mgr_disconnect_start(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
struct mlme_legacy_priv *mlme_priv;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
if (!mlme_priv)
return QDF_STATUS_E_FAILURE;
qdf_runtime_pm_prevent_suspend(&mlme_priv->disconnect_runtime_lock);
if (mlo_mgr_is_link_switch_in_progress(vdev))
wlan_tdls_delete_all_peers(vdev);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS if_mgr_disconnect_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
struct mlme_legacy_priv *mlme_priv;
QDF_STATUS status;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
if (!mlme_priv)
return QDF_STATUS_E_FAILURE;
qdf_runtime_pm_allow_suspend(&mlme_priv->disconnect_runtime_lock);
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE ||
wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_CLIENT_MODE)
wlan_handle_emlsr_sta_concurrency(psoc, false, true);
status = if_mgr_enable_roaming_after_p2p_disconnect(pdev, vdev,
RSO_CONNECT_START);
if (status) {
ifmgr_err("Failed to enable roaming after p2p disconnect");
return status;
}
if (!mlo_is_mld_sta(vdev) || !mlo_mgr_is_link_switch_in_progress(vdev))
policy_mgr_check_concurrent_intf_and_restart_sap(
psoc, wlan_util_vdev_mgr_get_acs_mode_for_vdev(vdev));
status = if_mgr_enable_roaming_on_connected_sta(pdev, vdev);
if (status) {
ifmgr_err("Failed to enable roaming on connected sta");
return status;
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
if_mgr_sta_csa_complete(struct wlan_objmgr_vdev *vdev,
struct if_mgr_event_data *event_data)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev)
return QDF_STATUS_E_FAILURE;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
wlan_tdls_notify_channel_switch_complete(psoc, wlan_vdev_get_id(vdev));
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,781 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __CFG_POLICY_MGR
#define __CFG_POLICY_MGR
#include "qdf_types.h"
/*
* <ini>
* gWlanMccToSccSwitchMode - Control SAP channel.
* @Min: 0
* @Max: 6
* @Default: 0
*
* This ini is used to override SAP channel.
* If gWlanMccToSccSwitchMode = 0: disabled.
* If gWlanMccToSccSwitchMode = 1: deprecated, overwritten to 3 in driver
* If gWlanMccToSccSwitchMode = 2: deprecated, overwritten to 3 in driver
* If gWlanMccToSccSwitchMode = 3: Force switch without SAP restart.
* If gWlanMccToSccSwitchMode = 4: Switch using
* fav channel(s)without SAP restart.
* If gWlanMccToSccSwitchMode = 5: Force switch without SAP restart.MCC allowed
* in exceptional cases.
* If gWlanMccToSccSwitchMode = 6: Force Switch without SAP restart only in
* user preferred band.
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_MCC_TO_SCC_SWITCH CFG_INI_UINT(\
"gWlanMccToSccSwitchMode", \
QDF_MCC_TO_SCC_SWITCH_DISABLE, \
QDF_MCC_TO_SCC_SWITCH_MAX - 1, \
QDF_MCC_TO_SCC_SWITCH_DISABLE, \
CFG_VALUE_OR_DEFAULT, \
"Provides MCC to SCC switch mode")
/*
* <ini>
* gSystemPref - Configure wlan system preference for PCL.
* @Min: 0
* @Max: 2
* @Default: 0
*
* This ini is used to configure wlan system preference option to help
* policy manager decide on Preferred Channel List for a new connection.
* For possible values refer to enum hdd_conc_priority_mode
*
* Related: None.
*
* Supported Feature: DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_CONC_SYS_PREF CFG_INI_UINT(\
"gSystemPref", 0, 2, 0, \
CFG_VALUE_OR_DEFAULT, \
"System preference to predict PCL")
/*
* <ini>
* gMaxConcurrentActiveSessions - Maximum number of concurrent connections.
* @Min: 1
* @Max: 4
* @Default: 3
*
* This ini is used to configure the maximum number of concurrent connections.
*
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_MAX_CONC_CXNS CFG_INI_UINT(\
"gMaxConcurrentActiveSessions", \
1, 4, 3, \
CFG_VALUE_OR_DEFAULT, \
"Config max num allowed connections")
#define POLICY_MGR_CH_SELECT_POLICY_DEF 0x00000003
/*
* <ini>
* channel_select_logic_conc - Set channel selection logic
* for different concurrency combinations to DBS or inter band
* MCC. Default is DBS for STA+STA and STA+P2P.
* @Min: 0x00000000
* @Max: 0xFFFFFFFF
* @Default: 0x00000000
*
* 0 - inter-band MCC
* 1 - DBS
*
* BIT 0: STA+STA
* BIT 1: STA+P2P
* BIT 2-31: Reserved
*
* Supported Feature: STA+STA, STA+P2P
*
* Usage: External
*
* </ini>
*/
#define CFG_CHNL_SELECT_LOGIC_CONC CFG_INI_UINT(\
"channel_select_logic_conc",\
0x00000000, \
0xFFFFFFFF, \
POLICY_MGR_CH_SELECT_POLICY_DEF, \
CFG_VALUE_OR_DEFAULT, \
"Set channel selection policy for various concurrency")
/*
* <ini>
* dbs_selection_policy - Configure dbs selection policy.
* @Min: 0
* @Max: 3
* @Default: 0
*
* set band preference or Vdev preference.
* bit[0] = 0: 5G 2x2 preferred to select 2x2 5G + 1x1 2G DBS mode.
* bit[0] = 1: 2G 2x2 preferred to select 2x2 2G + 1x1 5G DBS mode.
* bit[1] = 1: vdev priority enabled. The INI "vdev_priority_list" will
* specify the vdev priority.
* bit[1] = 0: vdev priority disabled.
* This INI only take effect for Genoa dual DBS hw.
*
* Supported Feature: DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_DBS_SELECTION_PLCY CFG_INI_UINT(\
"dbs_selection_policy", \
0, 3, 0, \
CFG_VALUE_OR_DEFAULT, \
"Configure dbs selection policy")
/*
* <ini>
* vdev_priority_list - Configure vdev priority list.
* @Min: 0
* @Max: 0x4444
* @Default: 0x4321
*
* @vdev_priority_list: vdev priority list
* bit[0-3]: pri_id (policy_mgr_pri_id) of highest priority
* bit[4-7]: pri_id (policy_mgr_pri_id) of second priority
* bit[8-11]: pri_id (policy_mgr_pri_id) of third priority
* bit[12-15]: pri_id (policy_mgr_pri_id) of fourth priority
* example: 0x4321 - CLI < GO < SAP < STA
* vdev priority id mapping:
* PM_STA_PRI_ID = 1,
* PM_SAP_PRI_ID = 2,
* PM_P2P_GO_PRI_ID = 3,
* PM_P2P_CLI_PRI_ID = 4,
* When the previous INI "dbs_selection_policy" bit[1]=1, which means
* the vdev 2x2 prioritization enabled. Then this INI will be used to
* specify the vdev type priority list. For example :
* dbs_selection_policy=0x2
* vdev_priority_list=0x4312
* means: default preference 2x2 band is 5G, vdev 2x2 prioritization enabled.
* And the priority list is CLI < GO < STA < SAP
*
* This INI only take effect for Genoa dual DBS hw.
*
* Supported Feature: DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_VDEV_CUSTOM_PRIORITY_LIST CFG_INI_UINT(\
"vdev_priority_list", \
0, 0x4444, 0x4321, \
CFG_VALUE_OR_DEFAULT, \
"Configure vdev priority list")
/*
* <ini>
* gEnableCustomConcRule1 - Enable custom concurrency rule1.
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to enable/disable custom concurrency rule1.
* If SAP comes up first and STA comes up later then SAP needs to follow STA's
* channel.
*
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_CONC_RULE1 CFG_INI_UINT(\
"gEnableCustomConcRule1", \
0, 1, 0, \
CFG_VALUE_OR_DEFAULT, \
"Enable custom concurrency rule 1")
/*
* <ini>
* gEnableCustomConcRule2 - Enable custom concurrency rule2.
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to enable/disable custom concurrency rule2.
* If P2PGO comes up first and STA comes up later then P2PGO need to follow
* STA's channel in 5Ghz. In following if condition we are just adding sanity
* check to make sure that by this time P2PGO's channel is same as STA's
* channel.
*
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_CONC_RULE2 CFG_INI_UINT(\
"gEnableCustomConcRule2", \
0, 1, 0, \
CFG_VALUE_OR_DEFAULT, \
"Enable custom concurrency rule 2")
/*
* <ini>
* gEnableMCCAdaptiveScheduler - MCC Adaptive Scheduler feature.
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable MCC Adaptive Scheduler feature.
*
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_MCC_ADAPTIVE_SCH_ENABLED_NAME CFG_INI_BOOL(\
"gEnableMCCAdaptiveScheduler", \
true, \
"Enable/Disable MCC Adaptive Scheduler")
/*
* <ini>
* gEnableStaConnectionIn5Ghz - To enable/disable STA connection in 5G
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable STA connection in 5G band
*
* Related: STA
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_STA_CONNECTION_IN_5GHZ CFG_INI_UINT(\
"gEnableStaConnectionIn5Ghz", \
0, 1, 1, \
CFG_VALUE_OR_DEFAULT, \
"Enable/Disable STA connection in 5G")
/*
* <ini>
* gAllowMCCGODiffBI - Allow GO in MCC mode to accept different beacon interval
* than STA's.
* @Min: 0
* @Max: 4
* @Default: 4
*
* This ini is used to allow GO in MCC mode to accept different beacon interval
* than STA's.
* Added for Wi-Fi Cert. 5.1.12
* If gAllowMCCGODiffBI = 1
* Set to 1 for WFA certification. GO Beacon interval is not changed.
* MCC GO doesn't work well in optimized way. In worst scenario, it may
* invite STA disconnection.
* If gAllowMCCGODiffBI = 2
* If set to 2 workaround 1 disassoc all the clients and update beacon
* Interval.
* If gAllowMCCGODiffBI = 3
* If set to 3 tear down the P2P link in auto/Non-autonomous -GO case.
* If gAllowMCCGODiffBI = 4
* If set to 4 don't disconnect the P2P client in autonomous/Non-auto-
* nomous -GO case update the BI dynamically
*
* Related: None.
*
* Supported Feature: Concurrency
*
* Usage: External
*
* </ini>
*/
#define CFG_ALLOW_MCC_GO_DIFF_BI \
CFG_INI_UINT("gAllowMCCGODiffBI", 0, 4, 4, CFG_VALUE_OR_DEFAULT, \
"Allow GO in MCC mode to accept different BI than STA's")
/*
*
* <ini>
* gDualMacFeatureDisable - Disable Dual MAC feature.
* @Min: 0
* @Max: 6
* @Default: 6
*
* This ini is used to enable/disable dual MAC feature.
* 0 - enable DBS
* 1 - disable DBS
* 2 - disable DBS for connection but keep DBS for scan
* 3 - disable DBS for connection but keep DBS scan with async
* scan policy disabled
* 4 - enable DBS for connection as well as for scan with async
* scan policy disabled
* 5 - enable DBS for connection but disable DBS for scan.
* 6 - enable DBS for connection but disable simultaneous scan
* from upper layer (DBS scan remains enabled in FW).
*
* Note: INI item value should match 'enum dbs_support'
*
* Related: None.
*
* Supported Feature: DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_DUAL_MAC_FEATURE_DISABLE \
CFG_INI_UINT("gDualMacFeatureDisable", 0, 6, 6, CFG_VALUE_OR_DEFAULT, \
"This INI is used to enable/disable Dual MAC feature")
/*
*
* <ini>
* enable_sbs - Enable/Disable SBS.
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable SBS feature.
* 0 - disable SBS
* 1 - enable SBS
*
*
* Related: None.
*
* Supported Feature: SBS
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_SBS CFG_INI_BOOL(\
"enable_sbs", \
true, \
"Enable/Disable SBS")
/*
* <ini>
* g_sta_sap_scc_on_dfs_chan - Allow STA+SAP SCC on DFS channel with master
* mode support disabled.
* @Min: 0
* @Max: 2
* @Default: 2
*
* This ini is used to allow STA+SAP SCC on DFS channel with master mode
* support disabled, the value is defined by enum PM_AP_DFS_MASTER_MODE.
* 0 - Disallow STA+SAP SCC on DFS channel
* 1 - Allow STA+SAP SCC on DFS channel with master mode disabled
* This needs gEnableDFSMasterCap enabled to allow SAP SCC with
* STA on DFS but dfs master mode disabled. Single SAP is not allowed
* on DFS.
* 2 - enhance "1" with below requirement
* a. Allow single SAP (GO) start on DFS channel.
* b. Allow CAC process on DFS channel in single SAP (GO) mode
* c. Allow DFS radar event process in single SAP (GO) mode
* d. Disallow CAC and radar event process in SAP (GO) + STA mode.
* The value 2 of this ini requires master mode to be enabled so it is
* mandatory to enable the dfs master mode ini gEnableDFSMasterCap
* along with it.
*
* Related: None.
*
* Supported Feature: Non-DBS, DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_STA_SAP_SCC_ON_DFS_CHAN \
CFG_INI_UINT("g_sta_sap_scc_on_dfs_chan", 0, 2, 2, CFG_VALUE_OR_DEFAULT, \
"Allow STA+SAP SCC on DFS channel with master mode disable")
/*
* <ini>
* sta_sap_scc_on_indoor_chan - Allow STA+SAP SCC on indoor channel
* when STA is connected on indoor channel.
* @Min: false
* @Max: true
* @Default: false
*
* This ini is used to allow STA+SAP SCC on indoor channel
* 0 - Disallow STA+SAP SCC on Indoor only channel
* 1 - Allow STA+SAP SCC on DFS channel. SAP will move to indoor channel
* once STA is connected on indoor only channel.
* When gindoor_channel_support=1, this ini will not be considered and
* SAP can come up on indoor channel.
*
* Related: gindoor_channel_support.
*
* Supported Feature: Non-DBS, DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_STA_SAP_SCC_ON_INDOOR_CHAN CFG_INI_BOOL(\
"sta_sap_scc_on_indoor_chan", \
false, \
"Allow STA+SAP SCC on indoor channel")
/*
* <ini>
* gForce1x1Exception - force 1x1 when connecting to certain peer
* @Min: 0
* @Max: 2
* @Default: 2
*
* This INI when enabled will force 1x1 connection with certain peer.
* The implementation for this ini would be as follows:-
* Value 0: Even if the AP is present in OUI, 1x1 will not be forced
* Value 1: If antenna sharing supported, then only do 1x1.
* Value 2: If AP present in OUI, force 1x1 connection.
*
* Related: None
*
* Supported Feature: connection
*
* Usage: External
*
* </ini>
*/
#define CFG_FORCE_1X1_FEATURE \
CFG_INI_UINT("gForce1x1Exception", 0, 2, 1, CFG_VALUE_OR_DEFAULT, \
"force 1x1 when connecting to certain peer")
/*
* <ini>
* gEnableSAPManadatoryChanList - Enable SAP Mandatory channel list
* Options.
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to enable/disable the SAP manadatory chan list
* 0 - Disable SAP mandatory chan list
* 1 - Enable SAP mandatory chan list
*
* Supported Feature: SAP
*
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_SAP_MANDATORY_CHAN_LIST \
CFG_INI_UINT("gEnableSAPManadatoryChanList", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \
"Enable SAP Mandatory channel list")
/*
* <ini>
* g_nan_sap_scc_on_lte_coex_chan - Allow NAN+SAP SCC on LTE coex channel
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to allow NAN+SAP SCC on LTE coex channel
* 0 - Disallow NAN+SAP SCC on LTE coex channel
* 1 - Allow NAN+SAP SCC on LTE coex channel
*
* Related: Depends on gWlanMccToSccSwitchMode config.
*
* Supported Feature: Non-DBS, DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_NAN_SAP_SCC_ON_LTE_COEX_CHAN \
CFG_INI_BOOL("g_nan_sap_scc_on_lte_coex_chan", 1, \
"Allow NAN+SAP SCC on LTE coex channel")
/*
* <ini>
* g_sta_sap_scc_on_lte_coex_chan - Allow STA+SAP SCC on LTE coex channel
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to allow STA+SAP SCC on LTE coex channel
* 0 - Disallow STA+SAP SCC on LTE coex channel
* 1 - Allow STA+SAP SCC on LTE coex channel
*
* Related: None.
*
* Supported Feature: Non-DBS, DBS
*
* Usage: External
*
* </ini>
*/
#define CFG_STA_SAP_SCC_ON_LTE_COEX_CHAN \
CFG_INI_UINT("g_sta_sap_scc_on_lte_coex_chan", 0, 1, 1, CFG_VALUE_OR_DEFAULT, \
"Allow STA+SAP SCC on LTE coex channel")
/*
* <ini>
* g_mark_sap_indoor_as_disable - Enable/Disable Indoor channel
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to mark the Indoor channel as
* disable when SAP start and revert it on SAP stop,
* so SAP will not turn on indoor channel and
* sta will not scan/associate and roam on indoor
* channels.
*
* Related: If g_mark_sap_indoor_as_disable set, turn the
* indoor channels to disable and update Wiphy & fw.
*
* Supported Feature: SAP/STA
*
* Usage: External
*
* </ini>
*/
#define CFG_MARK_INDOOR_AS_DISABLE_FEATURE \
CFG_INI_UINT("g_mark_sap_indoor_as_disable", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \
"Enable/Disable Indoor channel")
/*
* <ini>
* g_enable_go_force_scc - Enable/Disable force SCC on P2P GO
* @Min: 0
* @Max: 2
* @Default: 0
*
* This ini and along with "gWlanMccToSccSwitchMode" is used to enable
* force SCC on P2P GO interface.
*
* GO_FORCE_SCC_DISABLED (value 0): GO force scc disabled and GO can come up
* in MCC mode
* GO_FORCE_SCC_STRICT (value 1): New GO will be forced to form on existing
* GO/STA/GC channel in start bss itself.
* GO_FORCE_SCC_LIBERAL (value 2): After SET KEY is done, do force SCC for the
* first GO to move to new GO channel.
*
* Supported Feature: P2P GO
*
* Usage: External
*
* </ini>
*/
#define CFG_P2P_GO_ENABLE_FORCE_SCC \
CFG_INI_UINT("g_enable_go_force_scc", 0, 2, 0, CFG_VALUE_OR_DEFAULT, \
"Enable/Disable P2P GO force SCC")
/*
* <ini>
* g_pcl_band_priority - Set 5G/6G Channel order
* Options.
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to set preference between 5G and 6G channels during
* PCL population.
* 0 - Prefer 5G channels, 5G channels will be placed before the 6G channels
* in PCL.
* 1 - Prefer 6G channels, 6G channels will be placed before the 5G channels
* in PCL.
*
* Supported Feature: STA, SAP
*
*
* Usage: External
*
* </ini>
*/
#define CFG_PCL_BAND_PRIORITY \
CFG_INI_UINT("g_pcl_band_priority", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \
"Set 5G and 6G Channel order")
/*
* <ini>
* g_multi_sap_allowed_on_same_band - Allow multi sap started on same band
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to allow multi sap started on same band or not.
* 0 - Disallow multi sap started on same band
* 1 - Allow multi sap started on same band
*
* Supported Feature: SAP
*
* Usage: External
*
* </ini>
*/
#define CFG_MULTI_SAP_ALLOWED_ON_SAME_BAND \
CFG_INI_BOOL("g_multi_sap_allowed_on_same_band", 1, \
"Allow multi SAP started on same band")
#ifdef WLAN_FEATURE_SR
/*
* <ini>
* g_enable_sr_in_same_mac_conc - Enable/Disable SR in same MAC concurrency
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable SR in same MAC concurrency scenarios.
* 0 - disable SR in same mac concurrency
* 1 - enable SR in same mac concurrency
*
* Ex- If 1st connection STA operating on MAC0 has enabled Spatial Reuse
* already. Then if user tries to bring-up 2nd connection SAP on MAC0
* (STA + SAP (SCC)).
* Now if this INI is not set to 1, then Spatial Reuse gets disabled for
* all the interfaces running on MAC0. Once 2nd connection or concurrency
* interface is disabled, Spatial Reuse gets enabled again.
*
* Related: None.
*
* Supported Feature: Spatial Reuse
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_SR_IN_SAME_MAC_CONC \
CFG_INI_BOOL("g_enable_sr_in_same_mac_conc", 1, \
"Enable/Disable SR in Same MAC concurrency")
#define CFG_SPATIAL_REUSE CFG(CFG_ENABLE_SR_IN_SAME_MAC_CONC)
#else
#define CFG_SPATIAL_REUSE
#endif
/*
* <ini>
* g_use_original_bw_for_sap_restart - Set sap default BW when do restart
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini is used to set sap default BW when do restart.
* 0 - Use maximum BW as default BW
* 1 - Use sap original BW as default BW
*
* Supported Feature: SAP
*
* Usage: External
*
* </ini>
*/
#define CFG_SAP_DEFAULT_BW_FOR_RESTART \
CFG_INI_BOOL("g_use_original_bw_for_sap_restart", 0, \
"Use SAP original bandwidth when do restart")
/*
* <ini>
* g_move_sap_go_1st_on_dfs_sta_csa - Move SAP / GO first to enforce scc
* @Min: 0
* @Max: 1
* @Default: 0
*
* This ini moves SAP / GO first to enforce scc in STA+SAP (GO) DFS SCC
* 0 - Keep default MCC to SCC enforcement movement
* 1 - Move SAP / GO first before STA's movement to non-DFS channel
*
* In STA+SAP / GO concurrency, SCC is enforced by moving SAP / GO
* to STA's operating channel. STA side, if there is a CSA
* then SCC will be enforced only after STA moves to new channel.
*
* In usecase of STA + GO SCC on DFS channel, CSA is sent with no-TX
* and STA's movement will only happen once CSA count becomes 0.
* This will block data transmission till then, which will have bad
* user experience in case of XR where, it needs to have periodic data
* transmission in every 1 second with GO interface.
*
* To resolve this, it is better to move GO / SAP first to allow 1
* second periodic transmissions. And once the STA moves to new channel,
* existing logic will be triggered to enforce SCC.
*
* This INI is added to change the behavior only in this specific case.
* If this INI is set, then move SAP / GO first upon receiving very first
* CSA from AP to a non-DFS channel. Current MCC to SCC rules will be applied
* once STA moves to new channel after CSA count becomes 0.
*
* Dependency: g_sta_sap_scc_on_dfs_chan, g_enable_go_force_scc
*
* Supported Feature: SAP / P2P-GO
*
* Usage: External
*
* </ini>
*/
#define CFG_MOVE_SAP_GO_1ST_ON_DFS_STA_CSA \
CFG_INI_BOOL("g_move_sap_go_1st_on_dfs_sta_csa", 0, \
"Move SAP / GO first to enforce scc on dfs sta csa")
#define CFG_POLICY_MGR_ALL \
CFG(CFG_MCC_TO_SCC_SWITCH) \
CFG(CFG_CONC_SYS_PREF) \
CFG(CFG_MAX_CONC_CXNS) \
CFG(CFG_DBS_SELECTION_PLCY) \
CFG(CFG_VDEV_CUSTOM_PRIORITY_LIST) \
CFG(CFG_CHNL_SELECT_LOGIC_CONC) \
CFG(CFG_ENABLE_CONC_RULE1) \
CFG(CFG_ENABLE_CONC_RULE2) \
CFG(CFG_ENABLE_MCC_ADAPTIVE_SCH_ENABLED_NAME)\
CFG(CFG_ENABLE_STA_CONNECTION_IN_5GHZ)\
CFG(CFG_DUAL_MAC_FEATURE_DISABLE)\
CFG(CFG_ENABLE_SBS)\
CFG(CFG_STA_SAP_SCC_ON_DFS_CHAN)\
CFG(CFG_STA_SAP_SCC_ON_INDOOR_CHAN)\
CFG(CFG_FORCE_1X1_FEATURE)\
CFG(CFG_ENABLE_SAP_MANDATORY_CHAN_LIST)\
CFG(CFG_STA_SAP_SCC_ON_LTE_COEX_CHAN)\
CFG(CFG_NAN_SAP_SCC_ON_LTE_COEX_CHAN) \
CFG(CFG_MARK_INDOOR_AS_DISABLE_FEATURE)\
CFG(CFG_ALLOW_MCC_GO_DIFF_BI) \
CFG(CFG_P2P_GO_ENABLE_FORCE_SCC) \
CFG(CFG_PCL_BAND_PRIORITY) \
CFG(CFG_MULTI_SAP_ALLOWED_ON_SAME_BAND) \
CFG_SPATIAL_REUSE \
CFG(CFG_SAP_DEFAULT_BW_FOR_RESTART) \
CFG(CFG_MOVE_SAP_GO_1ST_ON_DFS_STA_CSA)
#endif

View File

@ -0,0 +1,133 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: contains policy manager ll_sap definitions specific to the ll_sap module
*/
#ifndef WLAN_POLICY_MGR_LL_SAP_H
#define WLAN_POLICY_MGR_LL_SAP_H
#include "wlan_objmgr_psoc_obj.h"
#ifdef WLAN_FEATURE_LL_LT_SAP
/**
* policy_mgr_ll_lt_sap_get_valid_freq() - Check and get valid frequency for
* the current interface (SAP/P2PGO/LL_LT_SAP)
* @psoc: PSOC object
* @pdev: PDEV pointer
* @vdev_id: Vdev id of the current interface
* @sap_ch_freq: Frequency of the current interface
* @cc_switch_mode: Channel switch mode
* @new_sap_freq: Updated frequency
* @is_ll_lt_sap_present: Indicates if ll_lt_sap is present or not
*
* This API checks if ll_lt_sap is present or not and if ll_lt_sap is present
* then if current frequency of the ll_lt_sap or concurrent SAP or concurrent
* P2PGO is valid or not according to ll_lt_sap concurrency, if valid, does not
* fill anything in the new_sap_freq and if not valid, update the new_sap_freq
* with some new valid frequency.
*
* Return: true/false
*/
void policy_mgr_ll_lt_sap_get_valid_freq(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id,
qdf_freq_t sap_ch_freq,
uint8_t cc_switch_mode,
qdf_freq_t *new_sap_freq,
bool *is_ll_lt_sap_present);
/**
* wlan_policy_mgr_get_ll_lt_sap_vdev_id() - Get ll_lt_sap vdev id
* @psoc: PSOC object
*
* API to find ll_lt_sap vdev id
*
* Return: vdev id
*/
uint8_t wlan_policy_mgr_get_ll_lt_sap_vdev_id(struct wlan_objmgr_psoc *psoc);
/**
* __policy_mgr_is_ll_lt_sap_restart_required() - Check in ll_lt_sap restart is
* required
* @psoc: PSOC object
* @func: Function pointer of the caller function.
*
* This API checks if ll_lt_sap restart is required or not
*
* Return: true/false
*/
bool __policy_mgr_is_ll_lt_sap_restart_required(struct wlan_objmgr_psoc *psoc,
const char *func);
#define policy_mgr_is_ll_lt_sap_restart_required(psoc) \
__policy_mgr_is_ll_lt_sap_restart_required(psoc, __func__)
/**
* policy_mgr_ll_lt_sap_restart_concurrent_sap() - Check and restart
* concurrent SAP or ll_lt_sap
* @psoc: PSOC object
* @is_ll_lt_sap_enabled: Indicates if ll_lt_sap is getting enabled or
* getting disabled
*
* This API checks and restarts concurrent SAP or ll_lt_sap when ll_lt_sap comes
* up or goes down.
* Concurrent SAP and ll_lt_sap should always be on different MAC.
* restart the concurrent SAP in below scenario:
* If ll_lt_sap is coming up and HW is not sbs capable and concurrent SAP is
* operating on 5 GHz, then move concurrent SAP to 2.4 Ghz MAC to allow
* ll_lt_sap on 5 GHz
* If ll_lt_sap is going down and if concurrent SAP is on 2.4 GHz then try to
* restart concurrent SAP on its original user configured frequency
* If ll_lt_sap interface has come up and in parallel if some other interface
* comes up on the ll_lt_sap frequency, then ll_lt_sap needs to be restarted.
*
* Return: None
*/
void policy_mgr_ll_lt_sap_restart_concurrent_sap(struct wlan_objmgr_psoc *psoc,
bool is_ll_lt_sap_enabled);
#else
static inline bool
policy_mgr_is_ll_lt_sap_restart_required(struct wlan_objmgr_psoc *psoc)
{
return false;
}
static inline
void policy_mgr_ll_lt_sap_get_valid_freq(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id,
qdf_freq_t sap_ch_freq,
uint8_t cc_switch_mode,
qdf_freq_t *new_sap_freq,
bool *is_ll_lt_sap_present)
{
}
static inline
uint8_t wlan_policy_mgr_get_ll_lt_sap_vdev_id(struct wlan_objmgr_psoc *psoc)
{
return WLAN_INVALID_VDEV_ID;
}
static inline void
policy_mgr_ll_lt_sap_restart_concurrent_sap(struct wlan_objmgr_psoc *psoc,
bool is_ll_lt_sap_enabled)
{
}
#endif
#endif /* WLAN_POLICY_MGR_LL_SAP_H */

View File

@ -0,0 +1,470 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __WLAN_POLICY_MGR_UCFG
#define __WLAN_POLICY_MGR_UCFG
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_global_obj.h"
#include "qdf_status.h"
#include "wlan_policy_mgr_public_struct.h"
/**
* ucfg_policy_mgr_psoc_open() - This API sets CFGs to policy manager context
* @psoc: pointer to psoc
*
* This API pulls policy manager's context from PSOC and initialize the CFG
* structure of policy manager.
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_psoc_close() - This API resets CFGs for policy manager ctx
* @psoc: pointer to psoc
*
* This API pulls policy manager's context from PSOC and resets the CFG
* structure of policy manager.
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc);
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
/**
* ucfg_policy_mgr_get_mcc_scc_switch() - To mcc to scc switch setting from INI
* @psoc: pointer to psoc
* @mcc_scc_switch: value to be filled
*
* This API pulls mcc to scc switch setting which is given as part of INI and
* stored in policy manager's CFGs.
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
uint8_t *mcc_scc_switch);
#else
static inline
QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
uint8_t *mcc_scc_switch)
{
return QDF_STATUS_SUCCESS;
}
#endif //FEATURE_WLAN_MCC_TO_SCC_SWITCH
/**
* ucfg_policy_mgr_get_radio_combinations() - Query the supported radio
* combinations
* @psoc: soc object
* @comb: combination buffer
* @comb_max: max combination number can be saved to comb buffer
* @comb_num: returned combination number
*
* This function returns the radio combination information supported by target.
*
* Return: QDF_STATUS_SUCCESS if query successfully
*/
QDF_STATUS
ucfg_policy_mgr_get_radio_combinations(struct wlan_objmgr_psoc *psoc,
struct radio_combination *comb,
uint32_t comb_max,
uint32_t *comb_num);
/**
* ucfg_policy_mgr_get_sys_pref() - to get system preference
* @psoc: pointer to psoc
* @sys_pref: value to be filled
*
* This API pulls the system preference for policy manager to provide
* PCL
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
uint8_t *sys_pref);
/**
* ucfg_policy_mgr_set_sys_pref() - to set system preference
* @psoc: pointer to psoc
* @sys_pref: value to be applied as new INI setting
*
* This API is meant to override original INI setting for system pref
* with new value which is used by policy manager to provide PCL
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_set_sys_pref(struct wlan_objmgr_psoc *psoc,
uint8_t sys_pref);
/**
* ucfg_policy_mgr_get_conc_rule1() - to find out if conc rule1 is enabled
* @psoc: pointer to psoc
* @conc_rule1: value to be filled
*
* This API is used to find out if conc rule-1 is enabled by user
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
uint8_t *conc_rule1);
/**
* ucfg_policy_mgr_get_conc_rule2() - to find out if conc rule2 is enabled
* @psoc: pointer to psoc
* @conc_rule2: value to be filled
*
* This API is used to find out if conc rule-2 is enabled by user
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
uint8_t *conc_rule2);
/**
* ucfg_policy_mgr_get_chnl_select_plcy() - to get channel selection policy
* @psoc: pointer to psoc
* @chnl_select_plcy: value to be filled
*
* This API is used to find out which channel selection policy has been
* configured
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
uint32_t *chnl_select_plcy);
/**
* ucfg_policy_mgr_get_mcc_adaptive_sch() - to get mcc adaptive scheduler
* @psoc: pointer to psoc
* @enable_mcc_adaptive_sch: value to be filled
*
* This API is used to find out if mcc adaptive scheduler enabled or disabled
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool *enable_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch() - to get dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sch: value to be filled
*
* This API is used to get dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch() - to set dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sch: value to be set
*
* This API is used to set dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_get_sta_cxn_5g_band() - to get STA's connection in 5G config
*
* @psoc: pointer to psoc
* @enable_sta_cxn_5g_band: value to be filled
*
* This API is used to find out if STA connection in 5G band is allowed or
* disallowed.
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_sta_cxn_5g_band(struct wlan_objmgr_psoc *psoc,
uint8_t *enable_sta_cxn_5g_band);
/**
* ucfg_policy_mgr_get_allow_mcc_go_diff_bi() - to get information on whether GO
* can have diff BI than STA in MCC
* @psoc: pointer to psoc
* @allow_mcc_go_diff_bi: value to be filled
*
* This API is used to find out whether GO's BI can different than STA in MCC
* scenario
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_allow_mcc_go_diff_bi(struct wlan_objmgr_psoc *psoc,
uint8_t *allow_mcc_go_diff_bi);
/**
* ucfg_policy_mgr_get_dual_mac_feature() - to find out if DUAL MAC feature is
* enabled
* @psoc: pointer to psoc
* @dual_mac_feature: value to be filled
*
* This API is used to find out whether dual mac (dual radio) specific feature
* is enabled or not
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc,
uint8_t *dual_mac_feature);
/**
* ucfg_policy_mgr_get_dual_sta_feature() - to find out if DUAL STA feature is
* enabled
* @psoc: pointer to psoc
*
* This API is used to find out whether dual sta specific feature is enabled
* or not.
*
* Return: true if feature is enabled, otherwise false.
*/
bool ucfg_policy_mgr_get_dual_sta_feature(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_get_force_1x1() - to find out if 1x1 connection is enforced
*
* @psoc: pointer to psoc
* @force_1x1: value to be filled
*
* This API is used to find out if 1x1 connection is enforced.
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_force_1x1(struct wlan_objmgr_psoc *psoc,
uint8_t *force_1x1);
/**
* ucfg_policy_mgr_get_max_conc_cxns() - to get configured max concurrent active
* connection count
*
* @psoc: pointer to psoc
*
* This API is used to query the configured max concurrent active connection
* count.
*
* Return: max active connection count
*/
uint32_t ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_set_max_conc_cxns() - to set supported max concurrent active
* connection count to policy mgr
*
* @psoc: pointer to psoc
* @max_conc_cxns: max active connection count
*
* This API is used to update the max concurrent active connection
* count to policy mgr
*
* Return: QDF_STATUS_SUCCESS if set successfully
*/
QDF_STATUS ucfg_policy_mgr_set_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
uint32_t max_conc_cxns);
/**
* ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl() - to find out if STA and SAP
* SCC is allowed on DFS channel
* @psoc: pointer to psoc
* @sta_sap_scc_on_dfs_chnl: value to be filled
*
* This API is used to find out whether STA and SAP SCC is allowed on
* DFS channels
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sta_sap_scc_on_dfs_chnl);
/**
* ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl() - to find out if STA & SAP
* SCC is allowed on LTE COEX
* @psoc: pointer to psoc
* @sta_sap_scc_lte_coex: value to be filled
*
* This API is used to find out whether STA and SAP scc is allowed on LTE COEX
* channel
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sta_sap_scc_lte_coex);
/**
* ucfg_policy_mgr_get_dfs_master_dynamic_enabled() - support dfs master or not
* AP interface when STA+SAP(GO) concurrency
* @psoc: pointer to psoc
* @vdev_id: sap vdev id
*
* This API is used to check SAP (GO) dfs master functionality enabled or not
* when STA+SAP(GO) concurrency.
* If g_sta_sap_scc_on_dfs_chan is non-zero, the STA+SAP(GO) is allowed on DFS
* channel SCC and the SAP's DFS master functionality should be enable/disable
* according to:
* 1. g_sta_sap_scc_on_dfs_chan is 0: function return true - dfs master
* capability enabled.
* 2. g_sta_sap_scc_on_dfs_chan is 1: function return false - dfs master
* capability disabled.
* 3. g_sta_sap_scc_on_dfs_chan is 2: dfs master capability based on STA on
* 5G or not:
* a. 5G STA active - return false
* b. no 5G STA active -return true
*
* Return: true if dfs master functionality should be enabled.
*/
bool
ucfg_policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id);
/**
* ucfg_policy_mgr_init_chan_avoidance() - init channel avoidance in policy
* manager
* @psoc: pointer to psoc
* @chan_freq_list: channel frequency list
* @chan_cnt: channel count
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc,
qdf_freq_t *chan_freq_list,
uint16_t chan_cnt);
/**
* ucfg_policy_mgr_get_sap_mandt_chnl() - to find out if SAP mandatory channel
* support is enabled
* @psoc: pointer to psoc
* @sap_mandt_chnl: value to be filled
*
* This API is used to find out whether SAP's mandatory channel support
* is enabled
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS ucfg_policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sap_mandt_chnl);
/**
* ucfg_policy_mgr_get_indoor_chnl_marking() - to get if indoor channel can be
* marked as disabled
* @psoc: pointer to psoc
* @indoor_chnl_marking: value to be filled
*
* This API is used to find out whether indoor channel can be marked as disabled
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_indoor_chnl_marking(struct wlan_objmgr_psoc *psoc,
uint8_t *indoor_chnl_marking);
/**
* ucfg_policy_mgr_get_sta_sap_scc_on_indoor_chnl() - to get if
* sta sap scc on indoor channel is allowed
* @psoc: pointer to psoc
*
* This API is used to get the value of sta+sap scc on indoor channel
*
* Return: TRUE or FALSE
*/
bool
ucfg_policy_mgr_get_sta_sap_scc_on_indoor_chnl(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_is_fw_supports_dbs() - to check whether FW supports DBS or
* not
* @psoc: pointer to psoc
*
* Return: true if DBS is supported else false
*/
bool ucfg_policy_mgr_is_fw_supports_dbs(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_get_connection_count() - Get number of connections
* @psoc: pointer to psoc
*
* This API is used to get the count of current connections.
*
* Return: connection count
*/
uint32_t ucfg_policy_mgr_get_connection_count(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_policy_mgr_is_hw_sbs_capable() - Check if HW is SBS capable
* @psoc: pointer to psoc
*
* This API is to check if the HW is SBS capable.
*
* Return: true if the HW is SBS capable
*/
bool ucfg_policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc);
/*
* ucfg_policy_mgr_get_vdev_same_freq_new_conn() - Get vdev_id of the first
* connection that has same
* channel frequency as new_freq
* @psoc: psoc object pointer
* @new_freq: channel frequency for the new connection
* @vdev_id: Output parameter to return vdev id of the first existing connection
* that has same channel frequency as @new_freq
*
* This function is to return the first connection that has same
* channel frequency as @new_freq.
*
* Return: true if connection that has same channel frequency as
* @new_freq exists. Otherwise false.
*/
bool ucfg_policy_mgr_get_vdev_same_freq_new_conn(struct wlan_objmgr_psoc *psoc,
uint32_t new_freq,
uint8_t *vdev_id);
/*
* ucfg_policy_mgr_get_vdev_diff_freq_new_conn() - Get vdev id of the first
* connection that has different
* channel freq from new_freq
* @psoc: psoc object pointer
* @new_freq: channel frequency for the new connection
* @vdev_id: Output parameter to return vdev id of the first existing connection
* that has different channel frequency from @new_freq
*
* This function is to return the first connection that has different
* channel frequency from @new_freq.
*
* Return: true if connection that has different channel frequency from
* @new_freq exists. Otherwise false.
*/
bool ucfg_policy_mgr_get_vdev_diff_freq_new_conn(struct wlan_objmgr_psoc *psoc,
uint32_t new_freq,
uint8_t *vdev_id);
/**
* ucfg_policy_mgr_get_dbs_hw_modes() - to get the DBS HW modes
*
* @psoc: pointer to psoc
* @one_by_one_dbs: 1x1 DBS capability of HW
* @two_by_two_dbs: 2x2 DBS capability of HW
*
* Return: Failure in case of error otherwise success
*/
QDF_STATUS ucfg_policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc,
bool *one_by_one_dbs,
bool *two_by_two_dbs);
#endif //__WLAN_POLICY_MGR_UCFG

View File

@ -0,0 +1,989 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_policy_mgr_init_deinit.c
*
* WLAN Concurrenct Connection Management APIs
*
*/
/* Include files */
#include "wlan_policy_mgr_api.h"
#include "wlan_policy_mgr_tables_no_dbs_i.h"
#include "wlan_policy_mgr_tables_1x1_dbs_i.h"
#include "wlan_policy_mgr_tables_2x2_dbs_i.h"
#include "wlan_policy_mgr_tables_2x2_5g_1x1_2g.h"
#include "wlan_policy_mgr_tables_2x2_2g_1x1_5g.h"
#include "wlan_policy_mgr_tables_2x2_dbs_sbs_i.h"
#include "wlan_policy_mgr_i.h"
#include "qdf_types.h"
#include "qdf_trace.h"
#include "wlan_objmgr_global_obj.h"
#include "target_if.h"
static QDF_STATUS policy_mgr_psoc_obj_create_cb(struct wlan_objmgr_psoc *psoc,
void *data)
{
struct policy_mgr_psoc_priv_obj *policy_mgr_ctx;
policy_mgr_ctx = qdf_mem_malloc(
sizeof(struct policy_mgr_psoc_priv_obj));
if (!policy_mgr_ctx)
return QDF_STATUS_E_FAILURE;
policy_mgr_ctx->psoc = psoc;
policy_mgr_ctx->old_hw_mode_index = POLICY_MGR_DEFAULT_HW_MODE_INDEX;
policy_mgr_ctx->new_hw_mode_index = POLICY_MGR_DEFAULT_HW_MODE_INDEX;
wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_ctx,
QDF_STATUS_SUCCESS);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS policy_mgr_psoc_obj_destroy_cb(struct wlan_objmgr_psoc *psoc,
void *data)
{
struct policy_mgr_psoc_priv_obj *policy_mgr_ctx;
policy_mgr_ctx = policy_mgr_get_context(psoc);
wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_ctx);
qdf_mem_free(policy_mgr_ctx);
return QDF_STATUS_SUCCESS;
}
static void policy_mgr_psoc_obj_status_cb(struct wlan_objmgr_psoc *psoc,
void *data, QDF_STATUS status)
{
return;
}
static QDF_STATUS policy_mgr_pdev_obj_create_cb(struct wlan_objmgr_pdev *pdev,
void *data)
{
struct policy_mgr_psoc_priv_obj *policy_mgr_ctx;
struct wlan_objmgr_psoc *psoc;
psoc = wlan_pdev_get_psoc(pdev);
policy_mgr_ctx = policy_mgr_get_context(psoc);
if (!policy_mgr_ctx) {
policy_mgr_err("invalid context");
return QDF_STATUS_E_FAILURE;
}
policy_mgr_ctx->pdev = pdev;
wlan_reg_register_chan_change_callback(psoc,
policy_mgr_reg_chan_change_callback, NULL);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS policy_mgr_pdev_obj_destroy_cb(struct wlan_objmgr_pdev *pdev,
void *data)
{
struct policy_mgr_psoc_priv_obj *policy_mgr_ctx;
struct wlan_objmgr_psoc *psoc;
psoc = wlan_pdev_get_psoc(pdev);
policy_mgr_ctx = policy_mgr_get_context(psoc);
if (!policy_mgr_ctx) {
policy_mgr_err("invalid context");
return QDF_STATUS_E_FAILURE;
}
policy_mgr_ctx->pdev = NULL;
wlan_reg_unregister_chan_change_callback(psoc,
policy_mgr_reg_chan_change_callback);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS policy_mgr_vdev_obj_create_cb(struct wlan_objmgr_vdev *vdev,
void *data)
{
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS policy_mgr_vdev_obj_destroy_cb(struct wlan_objmgr_vdev *vdev,
void *data)
{
return QDF_STATUS_SUCCESS;
}
static void policy_mgr_vdev_obj_status_cb(struct wlan_objmgr_vdev *vdev,
void *data, QDF_STATUS status)
{
return;
}
#ifdef WLAN_FEATURE_11BE_MLO
static QDF_STATUS policy_mgr_register_link_switch_notifier(void)
{
QDF_STATUS status;
status = mlo_mgr_register_link_switch_notifier(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_link_switch_notifier_cb);
if (status == QDF_STATUS_E_NOSUPPORT) {
status = QDF_STATUS_SUCCESS;
policy_mgr_debug("Link switch not supported");
} else if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register link switch notifier for policy mgr!");
}
return status;
}
static QDF_STATUS policy_mgr_unregister_link_switch_notifier(void)
{
QDF_STATUS status;
status = mlo_mgr_unregister_link_switch_notifier(
WLAN_UMAC_COMP_POLICY_MGR);
if (status == QDF_STATUS_E_NOSUPPORT)
status = QDF_STATUS_SUCCESS;
else if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to unregister link switch notifier for policy mgr!");
return status;
}
#else
static QDF_STATUS policy_mgr_register_link_switch_notifier(void)
{
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS policy_mgr_unregister_link_switch_notifier(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
QDF_STATUS policy_mgr_init(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register psoc obj create cback");
goto err_psoc_create;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register psoc obj delete cback");
goto err_psoc_delete;
}
status = wlan_objmgr_register_psoc_status_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_status_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register psoc obj status cback");
goto err_psoc_status;
}
status = wlan_objmgr_register_pdev_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register pdev obj create cback");
goto err_pdev_create;
}
status = wlan_objmgr_register_pdev_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register pdev obj delete cback");
goto err_pdev_delete;
}
status = wlan_objmgr_register_vdev_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register vdev obj create cback");
goto err_vdev_create;
}
status = wlan_objmgr_register_vdev_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register vdev obj delete cback");
goto err_vdev_delete;
}
status = wlan_objmgr_register_vdev_status_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_status_cb,
NULL);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register vdev obj status cback");
goto err_vdev_status;
}
status = policy_mgr_register_link_switch_notifier();
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to register link switch cback");
goto err_link_switch;
}
policy_mgr_notice("Callbacks registered with obj mgr");
return QDF_STATUS_SUCCESS;
err_link_switch:
wlan_objmgr_unregister_vdev_status_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_status_cb,
NULL);
err_vdev_status:
wlan_objmgr_unregister_vdev_destroy_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_destroy_cb,
NULL);
err_vdev_delete:
wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_create_cb,
NULL);
err_vdev_create:
wlan_objmgr_unregister_pdev_destroy_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_destroy_cb,
NULL);
err_pdev_delete:
wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_create_cb,
NULL);
err_pdev_create:
wlan_objmgr_unregister_psoc_status_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_status_cb,
NULL);
err_psoc_status:
wlan_objmgr_unregister_psoc_destroy_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_destroy_cb,
NULL);
err_psoc_delete:
wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_create_cb,
NULL);
err_psoc_create:
return status;
}
QDF_STATUS policy_mgr_deinit(void)
{
QDF_STATUS status;
status = policy_mgr_unregister_link_switch_notifier();
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister link switch cback");
status = wlan_objmgr_unregister_psoc_status_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_status_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister psoc obj status cback");
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister psoc obj delete cback");
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_psoc_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister psoc obj create cback");
status = wlan_objmgr_unregister_pdev_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister pdev obj delete cback");
status = wlan_objmgr_unregister_pdev_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_pdev_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister pdev obj create cback");
status = wlan_objmgr_unregister_vdev_status_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_status_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister vdev obj status cback");
status = wlan_objmgr_unregister_vdev_destroy_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_destroy_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister vdev obj delete cback");
status = wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_POLICY_MGR,
policy_mgr_vdev_obj_create_cb,
NULL);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to deregister vdev obj create cback");
policy_mgr_info("deregistered callbacks with obj mgr successfully");
return status;
}
QDF_STATUS policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create(
&pm_ctx->qdf_conc_list_lock))) {
policy_mgr_err("Failed to init qdf_conc_list_lock");
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
pm_ctx->sta_ap_intf_check_work_info = qdf_mem_malloc(
sizeof(struct sta_ap_intf_check_work_ctx));
if (!pm_ctx->sta_ap_intf_check_work_info) {
qdf_mutex_destroy(&pm_ctx->qdf_conc_list_lock);
return QDF_STATUS_E_FAILURE;
}
pm_ctx->sta_ap_intf_check_work_info->psoc = psoc;
pm_ctx->sta_ap_intf_check_work_info->go_plus_go_force_scc.vdev_id =
WLAN_UMAC_VDEV_ID_MAX;
pm_ctx->sta_ap_intf_check_work_info->sap_plus_go_force_scc.reason =
CSA_REASON_UNKNOWN;
if (QDF_IS_STATUS_ERROR(qdf_delayed_work_create(
&pm_ctx->sta_ap_intf_check_work,
policy_mgr_check_sta_ap_concurrent_ch_intf,
pm_ctx))) {
policy_mgr_err("Failed to create dealyed work queue");
qdf_mutex_destroy(&pm_ctx->qdf_conc_list_lock);
qdf_mem_free(pm_ctx->sta_ap_intf_check_work_info);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(
&pm_ctx->qdf_conc_list_lock))) {
policy_mgr_err("Failed to destroy qdf_conc_list_lock");
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
if (pm_ctx->hw_mode.hw_mode_list) {
qdf_mem_free(pm_ctx->hw_mode.hw_mode_list);
pm_ctx->hw_mode.hw_mode_list = NULL;
policy_mgr_debug("HW list is freed");
}
if (pm_ctx->sta_ap_intf_check_work_info) {
qdf_delayed_work_destroy(&pm_ctx->sta_ap_intf_check_work);
qdf_mem_free(pm_ctx->sta_ap_intf_check_work_info);
pm_ctx->sta_ap_intf_check_work_info = NULL;
}
return QDF_STATUS_SUCCESS;
}
#ifdef FEATURE_NO_DBS_INTRABAND_MCC_SUPPORT
static void policy_mgr_init_non_dbs_pcl(struct wlan_objmgr_psoc *psoc)
{
struct wmi_unified *wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
policy_mgr_debug("Invalid WMI handle");
return;
}
if (wmi_service_enabled(wmi_handle,
wmi_service_no_interband_mcc_support) &&
!wmi_service_enabled(wmi_handle,
wmi_service_dual_band_simultaneous_support)) {
second_connection_pcl_non_dbs_table =
&second_connection_pcl_nodbs_no_interband_mcc_table;
third_connection_pcl_non_dbs_table =
&third_connection_pcl_nodbs_no_interband_mcc_table;
} else {
second_connection_pcl_non_dbs_table =
&second_connection_pcl_nodbs_table;
third_connection_pcl_non_dbs_table =
&third_connection_pcl_nodbs_table;
}
}
#else
static void policy_mgr_init_non_dbs_pcl(struct wlan_objmgr_psoc *psoc)
{
second_connection_pcl_non_dbs_table =
&second_connection_pcl_nodbs_table;
third_connection_pcl_non_dbs_table =
&third_connection_pcl_nodbs_table;
}
#endif
#ifdef WLAN_FEATURE_11BE_MLO
static inline void policy_mgr_memzero_disabled_ml_list(void)
{
qdf_mem_zero(pm_disabled_ml_links, sizeof(pm_disabled_ml_links));
}
static QDF_STATUS
policy_mgr_init_ml_link_update(struct policy_mgr_psoc_priv_obj *pm_ctx)
{
QDF_STATUS qdf_status;
qdf_atomic_init(&pm_ctx->link_in_progress);
qdf_status = qdf_event_create(&pm_ctx->set_link_update_done_evt);
if (QDF_IS_STATUS_ERROR(qdf_status)) {
policy_mgr_err("init event failed for for set_link_update_done_evt");
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS
policy_mgr_deinit_ml_link_update(struct policy_mgr_psoc_priv_obj *pm_ctx)
{
QDF_STATUS qdf_status;
qdf_atomic_set(&pm_ctx->link_in_progress, 0);
qdf_status = qdf_event_destroy(&pm_ctx->set_link_update_done_evt);
if (QDF_IS_STATUS_ERROR(qdf_status)) {
policy_mgr_err("deinit event failed for set_link_update_done_evt");
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
#else
static inline void policy_mgr_memzero_disabled_ml_list(void) {}
static inline QDF_STATUS
policy_mgr_init_ml_link_update(struct policy_mgr_psoc_priv_obj *pm_ctx)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
policy_mgr_deinit_ml_link_update(struct policy_mgr_psoc_priv_obj *pm_ctx)
{
return QDF_STATUS_SUCCESS;
}
#endif
QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
struct policy_mgr_psoc_priv_obj *pm_ctx;
bool enable_mcc_adaptive_sch = false;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
policy_mgr_debug("Initializing the policy manager");
/* init pm_conc_connection_list */
qdf_mem_zero(pm_conc_connection_list, sizeof(pm_conc_connection_list));
policy_mgr_memzero_disabled_ml_list();
policy_mgr_clear_concurrent_session_count(psoc);
/* init dbs_opportunistic_timer */
status = qdf_mc_timer_init(&pm_ctx->dbs_opportunistic_timer,
QDF_TIMER_TYPE_SW,
pm_dbs_opportunistic_timer_handler,
(void *)psoc);
if (!QDF_IS_STATUS_SUCCESS(status)) {
policy_mgr_err("Failed to init DBS opportunistic timer");
return status;
}
status = policy_mgr_init_ml_link_update(pm_ctx);
if (QDF_IS_STATUS_ERROR(status))
return status;
/* init connection_update_done_evt */
status = policy_mgr_init_connection_update(pm_ctx);
if (!QDF_IS_STATUS_SUCCESS(status)) {
policy_mgr_err("connection_update_done_evt init failed");
return status;
}
status = qdf_event_create(&pm_ctx->opportunistic_update_done_evt);
if (!QDF_IS_STATUS_SUCCESS(status)) {
policy_mgr_err("opportunistic_update_done_evt init failed");
return status;
}
status = qdf_event_create(&pm_ctx->channel_switch_complete_evt);
if (!QDF_IS_STATUS_SUCCESS(status)) {
policy_mgr_err("channel_switch_complete_evt init failed");
return status;
}
policy_mgr_get_mcc_adaptive_sch(psoc, &enable_mcc_adaptive_sch);
policy_mgr_set_dynamic_mcc_adaptive_sch(psoc, enable_mcc_adaptive_sch);
pm_ctx->hw_mode_change_in_progress = POLICY_MGR_HW_MODE_NOT_IN_PROGRESS;
/* reset sap mandatory channels */
status = policy_mgr_reset_sap_mandatory_channels(psoc);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("failed to reset mandatory channels");
return status;
}
/* init PCL table & function pointers based on HW capability */
if (policy_mgr_is_hw_dbs_2x2_capable(psoc) ||
policy_mgr_is_hw_dbs_required_for_band(psoc, HW_MODE_MAC_BAND_2G))
policy_mgr_get_current_pref_hw_mode_ptr =
policy_mgr_get_current_pref_hw_mode_dbs_2x2;
else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc))
policy_mgr_get_current_pref_hw_mode_ptr =
policy_mgr_get_current_pref_hw_mode_dual_dbs;
else
policy_mgr_get_current_pref_hw_mode_ptr =
policy_mgr_get_current_pref_hw_mode_dbs_1x1;
if (policy_mgr_is_hw_dbs_2x2_capable(psoc) &&
policy_mgr_is_hw_sbs_capable(psoc))
second_connection_pcl_dbs_table =
&pm_second_connection_pcl_dbs_sbs_2x2_table;
else if (policy_mgr_is_hw_dbs_2x2_capable(psoc) ||
policy_mgr_is_hw_dbs_required_for_band(psoc,
HW_MODE_MAC_BAND_2G) ||
policy_mgr_is_2x2_1x1_dbs_capable(psoc))
second_connection_pcl_dbs_table =
&pm_second_connection_pcl_dbs_2x2_table;
else
second_connection_pcl_dbs_table =
&pm_second_connection_pcl_dbs_1x1_table;
if (policy_mgr_is_hw_dbs_2x2_capable(psoc) &&
policy_mgr_is_hw_sbs_capable(psoc))
third_connection_pcl_dbs_table =
&pm_third_connection_pcl_dbs_sbs_2x2_table;
else if (policy_mgr_is_hw_dbs_2x2_capable(psoc) ||
policy_mgr_is_hw_dbs_required_for_band(psoc,
HW_MODE_MAC_BAND_2G) ||
policy_mgr_is_2x2_1x1_dbs_capable(psoc))
third_connection_pcl_dbs_table =
&pm_third_connection_pcl_dbs_2x2_table;
else
third_connection_pcl_dbs_table =
&pm_third_connection_pcl_dbs_1x1_table;
/* Initialize non-DBS pcl table pointer to particular table*/
policy_mgr_init_non_dbs_pcl(psoc);
if (policy_mgr_is_hw_dbs_2x2_capable(psoc)) {
if (policy_mgr_is_hw_dbs_required_for_band(psoc,
HW_MODE_MAC_BAND_2G)) {
next_action_two_connection_table =
&pm_next_action_two_connection_dbs_2x2_table;
policy_mgr_debug("using hst/hsp policy manager table");
} else {
next_action_two_connection_table =
&pm_next_action_two_connection_dbs_2x2_table_v2;
policy_mgr_debug("using hmt policy manager table");
}
} else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) {
next_action_two_connection_table =
&pm_next_action_two_connection_dbs_2x2_5g_1x1_2g_table;
next_action_two_connection_2x2_2g_1x1_5g_table =
&pm_next_action_two_connection_dbs_2x2_2g_1x1_5g_table;
} else {
next_action_two_connection_table =
&pm_next_action_two_connection_dbs_1x1_table;
}
if (policy_mgr_is_hw_dbs_2x2_capable(psoc) ||
policy_mgr_is_hw_dbs_required_for_band(psoc,
HW_MODE_MAC_BAND_2G)) {
next_action_three_connection_table =
&pm_next_action_three_connection_dbs_2x2_table;
} else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) {
next_action_three_connection_table =
&pm_next_action_three_connection_dbs_2x2_5g_1x1_2g_table;
next_action_three_connection_2x2_2g_1x1_5g_table =
&pm_next_action_three_connection_dbs_2x2_2g_1x1_5g_table;
} else {
next_action_three_connection_table =
&pm_next_action_three_connection_dbs_1x1_table;
}
policy_mgr_debug("is DBS Capable %d, is SBS Capable %d",
policy_mgr_is_hw_dbs_capable(psoc),
policy_mgr_is_hw_sbs_capable(psoc));
policy_mgr_debug("is2x2 %d, 2g-on-dbs %d is2x2+1x1 %d, is2x2_5g+1x1_2g %d, is2x2_2g+1x1_5g %d",
policy_mgr_is_hw_dbs_2x2_capable(psoc),
policy_mgr_is_hw_dbs_required_for_band(
psoc, HW_MODE_MAC_BAND_2G),
policy_mgr_is_2x2_1x1_dbs_capable(psoc),
policy_mgr_is_2x2_5G_1x1_2G_dbs_capable(psoc),
policy_mgr_is_2x2_2G_1x1_5G_dbs_capable(psoc));
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
/* destroy connection_update_done_evt */
if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
(&pm_ctx->connection_update_done_evt))) {
policy_mgr_err("Failed to destroy connection_update_done_evt");
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
/* destroy opportunistic_update_done_evt */
if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
(&pm_ctx->opportunistic_update_done_evt))) {
policy_mgr_err("Failed to destroy opportunistic_update_done_evt");
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
/* destroy channel_switch_complete_evt */
if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
(&pm_ctx->channel_switch_complete_evt))) {
policy_mgr_err("Failed to destroy channel_switch_complete evt");
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
if (QDF_IS_STATUS_ERROR(policy_mgr_deinit_ml_link_update(pm_ctx))) {
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
/* deallocate dbs_opportunistic_timer */
if (QDF_TIMER_STATE_RUNNING ==
qdf_mc_timer_get_current_state(
&pm_ctx->dbs_opportunistic_timer)) {
qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer);
}
if (!QDF_IS_STATUS_SUCCESS(qdf_mc_timer_destroy(
&pm_ctx->dbs_opportunistic_timer))) {
policy_mgr_err("Cannot deallocate dbs opportunistic timer");
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
/* reset sap mandatory channels */
if (QDF_IS_STATUS_ERROR(
policy_mgr_reset_sap_mandatory_channels(psoc))) {
policy_mgr_err("failed to reset sap mandatory channels");
status = QDF_STATUS_E_FAILURE;
QDF_ASSERT(0);
}
/* deinit pm_conc_connection_list */
qdf_mem_zero(pm_conc_connection_list, sizeof(pm_conc_connection_list));
policy_mgr_clear_concurrent_session_count(psoc);
return status;
}
QDF_STATUS policy_mgr_register_conc_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_conc_cbacks *conc_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->conc_cbacks.connection_info_update =
conc_cbacks->connection_info_update;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_sme_cbacks *sme_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->sme_cbacks.sme_get_nss_for_vdev =
sme_cbacks->sme_get_nss_for_vdev;
pm_ctx->sme_cbacks.sme_nss_update_request =
sme_cbacks->sme_nss_update_request;
if (!policy_mgr_is_hwmode_offload_enabled(psoc))
pm_ctx->sme_cbacks.sme_pdev_set_hw_mode =
sme_cbacks->sme_pdev_set_hw_mode;
pm_ctx->sme_cbacks.sme_soc_set_dual_mac_config =
sme_cbacks->sme_soc_set_dual_mac_config;
pm_ctx->sme_cbacks.sme_change_mcc_beacon_interval =
sme_cbacks->sme_change_mcc_beacon_interval;
pm_ctx->sme_cbacks.sme_rso_start_cb =
sme_cbacks->sme_rso_start_cb;
pm_ctx->sme_cbacks.sme_rso_stop_cb =
sme_cbacks->sme_rso_stop_cb;
pm_ctx->sme_cbacks.sme_change_sap_csa_count =
sme_cbacks->sme_change_sap_csa_count;
pm_ctx->sme_cbacks.sme_sap_update_ch_width =
sme_cbacks->sme_sap_update_ch_width;
return QDF_STATUS_SUCCESS;
}
/**
* policy_mgr_register_hdd_cb() - register HDD callbacks
* @psoc: PSOC object information
* @hdd_cbacks: function pointers from HDD
*
* API, allows HDD to register callbacks to be invoked by policy
* mgr
*
* Return: SUCCESS,
* Failure (if registration fails)
*/
QDF_STATUS policy_mgr_register_hdd_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_hdd_cbacks *hdd_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb =
hdd_cbacks->sap_restart_chan_switch_cb;
pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart =
hdd_cbacks->wlan_hdd_get_channel_for_sap_restart;
pm_ctx->hdd_cbacks.get_mode_for_non_connected_vdev =
hdd_cbacks->get_mode_for_non_connected_vdev;
pm_ctx->hdd_cbacks.hdd_get_device_mode =
hdd_cbacks->hdd_get_device_mode;
pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress =
hdd_cbacks->hdd_is_chan_switch_in_progress;
pm_ctx->hdd_cbacks.hdd_is_cac_in_progress =
hdd_cbacks->hdd_is_cac_in_progress;
pm_ctx->hdd_cbacks.hdd_get_ap_6ghz_capable =
hdd_cbacks->hdd_get_ap_6ghz_capable;
pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt =
hdd_cbacks->wlan_hdd_indicate_active_ndp_cnt;
pm_ctx->hdd_cbacks.wlan_get_ap_prefer_conc_ch_params =
hdd_cbacks->wlan_get_ap_prefer_conc_ch_params;
pm_ctx->hdd_cbacks.wlan_get_sap_acs_band =
hdd_cbacks->wlan_get_sap_acs_band;
pm_ctx->hdd_cbacks.wlan_check_cc_intf_cb =
hdd_cbacks->wlan_check_cc_intf_cb;
pm_ctx->hdd_cbacks.wlan_set_tx_rx_nss_cb =
hdd_cbacks->wlan_set_tx_rx_nss_cb;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_deregister_hdd_cb(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb = NULL;
pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart = NULL;
pm_ctx->hdd_cbacks.get_mode_for_non_connected_vdev = NULL;
pm_ctx->hdd_cbacks.hdd_get_device_mode = NULL;
pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress = NULL;
pm_ctx->hdd_cbacks.hdd_is_cac_in_progress = NULL;
pm_ctx->hdd_cbacks.hdd_get_ap_6ghz_capable = NULL;
pm_ctx->hdd_cbacks.wlan_get_ap_prefer_conc_ch_params = NULL;
pm_ctx->hdd_cbacks.wlan_get_sap_acs_band = NULL;
pm_ctx->hdd_cbacks.wlan_set_tx_rx_nss_cb = NULL;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_wma_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_wma_cbacks *wma_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->wma_cbacks.wma_get_connection_info =
wma_cbacks->wma_get_connection_info;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_cdp_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_cdp_cbacks *cdp_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->cdp_cbacks.cdp_update_mac_id =
cdp_cbacks->cdp_update_mac_id;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_dp_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_dp_cbacks *dp_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->dp_cbacks.hdd_disable_rx_ol_in_concurrency =
dp_cbacks->hdd_disable_rx_ol_in_concurrency;
pm_ctx->dp_cbacks.hdd_set_rx_mode_rps_cb =
dp_cbacks->hdd_set_rx_mode_rps_cb;
pm_ctx->dp_cbacks.hdd_ipa_set_mcc_mode_cb =
dp_cbacks->hdd_ipa_set_mcc_mode_cb;
pm_ctx->dp_cbacks.hdd_v2_flow_pool_map =
dp_cbacks->hdd_v2_flow_pool_map;
pm_ctx->dp_cbacks.hdd_v2_flow_pool_unmap =
dp_cbacks->hdd_v2_flow_pool_unmap;
pm_ctx->dp_cbacks.hdd_ipa_set_perf_level_bw =
dp_cbacks->hdd_ipa_set_perf_level_bw;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_tdls_cb(struct wlan_objmgr_psoc *psoc,
struct policy_mgr_tdls_cbacks *tdls_cbacks)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->tdls_cbacks.tdls_notify_increment_session =
tdls_cbacks->tdls_notify_increment_session;
pm_ctx->tdls_cbacks.tdls_notify_decrement_session =
tdls_cbacks->tdls_notify_decrement_session;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_register_mode_change_cb(struct wlan_objmgr_psoc *psoc,
send_mode_change_event_cb mode_change_cb)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->mode_change_cb = mode_change_cb;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->mode_change_cb = NULL;
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,327 @@
/*
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: contains policy manager ll_sap definitions specific to the ll_sap module
*/
#include "wlan_policy_mgr_ll_sap.h"
#include "wlan_policy_mgr_public_struct.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_policy_mgr_i.h"
#include "wlan_cmn.h"
#include "wlan_ll_sap_api.h"
void policy_mgr_ll_lt_sap_get_valid_freq(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id,
qdf_freq_t sap_ch_freq,
uint8_t cc_switch_mode,
qdf_freq_t *new_sap_freq,
bool *is_ll_lt_sap_present)
{
enum sap_csa_reason_code csa_reason;
enum policy_mgr_con_mode conn_mode;
qdf_freq_t ll_lt_sap_freq = 0;
*is_ll_lt_sap_present = false;
/* If Vdev is ll_lt_sap, check if the frequency on which it is
* coming up is correct, else, get new frequency
*/
if (policy_mgr_is_vdev_ll_lt_sap(psoc, vdev_id)) {
*new_sap_freq = wlan_get_ll_lt_sap_restart_freq(pdev,
sap_ch_freq,
vdev_id,
&csa_reason);
*is_ll_lt_sap_present = true;
}
ll_lt_sap_freq = policy_mgr_get_ll_lt_sap_freq(psoc);
if (!ll_lt_sap_freq)
return;
conn_mode = policy_mgr_get_mode_by_vdev_id(psoc, vdev_id);
if (conn_mode == PM_SAP_MODE) {
/* If ll_lt_sap and concurrent SAP are on same MAC,
* update the frequency of concurrent SAP, else return.
*/
if (!policy_mgr_are_2_freq_on_same_mac(psoc, sap_ch_freq,
ll_lt_sap_freq))
return;
goto policy_mgr_check_scc;
} else if (conn_mode == PM_P2P_GO_MODE) {
/* If ll_lt_sap and P2P_GO are in SCC,
* update the frequency of concurrent GO else, return.
*/
if (ll_lt_sap_freq != sap_ch_freq)
return;
goto policy_mgr_check_scc;
} else {
policy_mgr_debug("Invalid con mode %d vdev %d", conn_mode,
vdev_id);
return;
}
policy_mgr_check_scc:
policy_mgr_check_scc_channel(psoc, new_sap_freq, sap_ch_freq, vdev_id,
cc_switch_mode);
policy_mgr_debug("vdev_id %d old_freq %d new_freq %d", vdev_id,
sap_ch_freq, *new_sap_freq);
}
uint8_t wlan_policy_mgr_get_ll_lt_sap_vdev_id(struct wlan_objmgr_psoc *psoc)
{
uint8_t ll_lt_sap_cnt;
uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
ll_lt_sap_cnt = policy_mgr_get_mode_specific_conn_info(psoc, NULL,
vdev_id_list,
PM_LL_LT_SAP_MODE);
/* Currently only 1 ll_lt_sap is supported */
if (!ll_lt_sap_cnt)
return WLAN_INVALID_VDEV_ID;
return vdev_id_list[0];
}
bool __policy_mgr_is_ll_lt_sap_restart_required(struct wlan_objmgr_psoc *psoc,
const char *func)
{
qdf_freq_t ll_lt_sap_freq = 0;
uint8_t scc_vdev_id;
bool is_scc = false;
uint8_t conn_idx = 0;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid pm ctx");
return false;
}
ll_lt_sap_freq = policy_mgr_get_ll_lt_sap_freq(psoc);
if (!ll_lt_sap_freq)
return false;
/*
* Restart ll_lt_sap if any other interface is present in SCC
* with LL_LT_SAP.
*/
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
for (conn_idx = 0; conn_idx < MAX_NUMBER_OF_CONC_CONNECTIONS;
conn_idx++) {
if (pm_conc_connection_list[conn_idx].mode ==
PM_LL_LT_SAP_MODE)
continue;
if (ll_lt_sap_freq == pm_conc_connection_list[conn_idx].freq) {
scc_vdev_id = pm_conc_connection_list[conn_idx].vdev_id;
is_scc = true;
break;
}
}
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
if (is_scc) {
uint8_t ll_lt_sap_vdev_id =
wlan_policy_mgr_get_ll_lt_sap_vdev_id(psoc);
policymgr_nofl_debug("%s ll_lt_sap vdev %d with freq %d is in scc with vdev %d",
func, ll_lt_sap_vdev_id, ll_lt_sap_freq,
scc_vdev_id);
return true;
}
return false;
}
/**
* policy_mgr_ll_lt_sap_get_restart_freq_for_concurent_sap() - Get restart frequency
* for concurrent SAP which is in concurrency with LL_LT_SAP
* @pm_ctx: Policy manager context
* @vdev_id: Vdev id of the SAP for which restart freq is required
* @curr_freq: Current frequency of the SAP for which restart freq is required
* @ll_lt_sap_enabled: Indicates if ll_lt_sap is getting enabled or disabled
*
* This API returns user configured frequency if ll_lt_sap is going down and
* if ll_lt_sap is coming up it returns frequency according to ll_lt_sap
* concurrency.
*
* Return: Restart frequency
*/
static qdf_freq_t
policy_mgr_ll_lt_sap_get_restart_freq_for_concurent_sap(
struct policy_mgr_psoc_priv_obj *pm_ctx,
uint8_t vdev_id,
qdf_freq_t curr_freq,
bool ll_lt_sap_enabled)
{
qdf_freq_t user_config_freq;
uint8_t i;
QDF_STATUS status;
uint32_t channel_list[NUM_CHANNELS];
uint32_t num_channels;
qdf_freq_t restart_freq = 0;
/*
* If ll_lt_sap is getting disabled, return user configured frequency
* for concurrent SAP restart, if user configured frequency is not valid
* frequency, remain on the same frequency and do not restart the SAP
*/
if (!ll_lt_sap_enabled) {
user_config_freq = policy_mgr_get_user_config_sap_freq(
pm_ctx->psoc,
vdev_id);
if (wlan_reg_is_enable_in_secondary_list_for_freq(
pm_ctx->pdev,
user_config_freq) &&
policy_mgr_is_safe_channel(pm_ctx->psoc, user_config_freq))
return user_config_freq;
return curr_freq;
}
status = policy_mgr_get_valid_chans(pm_ctx->psoc, channel_list,
&num_channels);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("Error in getting valid channels");
return curr_freq;
}
/* return first valid 2.4 GHz frequency */
for (i = 0; i < num_channels; i++) {
if (wlan_reg_is_24ghz_ch_freq(channel_list[i])) {
if (!restart_freq)
restart_freq = channel_list[i];
/* Prefer SCC frequency */
if (policy_mgr_get_connection_count_with_ch_freq(
channel_list[i])) {
restart_freq = channel_list[i];
break;
}
}
}
return restart_freq;
}
void policy_mgr_ll_lt_sap_restart_concurrent_sap(struct wlan_objmgr_psoc *psoc,
bool is_ll_lt_sap_enabled)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
struct policy_mgr_conc_connection_info sap_info = {0};
qdf_freq_t restart_freq;
struct ch_params ch_params = {0};
uint8_t i;
enum sap_csa_reason_code csa_reason;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid pm context");
return;
}
qdf_mem_zero(&sap_info, sizeof(sap_info));
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
if (!pm_conc_connection_list[i].in_use)
continue;
if (PM_SAP_MODE == pm_conc_connection_list[i].mode ||
PM_LL_LT_SAP_MODE == pm_conc_connection_list[i].mode) {
qdf_mem_copy(&sap_info, &pm_conc_connection_list[i],
sizeof(sap_info));
break;
}
}
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
/* No concurrent SAP or ll_lt_sap present, return */
if (!sap_info.in_use)
return;
if (sap_info.mode == PM_SAP_MODE) {
/*
* For SBS case, no need to restart concurrent SAP as LL_LT_SAP
* and concurrent SAP can be on different MACs
*/
if (policy_mgr_is_hw_sbs_capable(psoc))
return;
/*
* If concurrent SAP is 2.4 GHz and ll_lt_sap is getting enabled
* then there is no need to restart the concurrent SAP
*/
if (is_ll_lt_sap_enabled &&
wlan_reg_is_24ghz_ch_freq(sap_info.freq))
return;
/*
* If concurrent SAP is 5 GHz/6 GHz and ll_lt_sap is getting
* disabled then there is no need to restart the concurrent SAP
*/
else if (!is_ll_lt_sap_enabled &&
(wlan_reg_is_5ghz_ch_freq(sap_info.freq) ||
wlan_reg_is_6ghz_chan_freq(sap_info.freq)))
return;
restart_freq =
policy_mgr_ll_lt_sap_get_restart_freq_for_concurent_sap(
pm_ctx,
sap_info.vdev_id,
sap_info.freq,
is_ll_lt_sap_enabled);
csa_reason = CSA_REASON_CONCURRENT_LL_LT_SAP_EVENT;
} else {
restart_freq = wlan_get_ll_lt_sap_restart_freq(pm_ctx->pdev,
sap_info.freq,
sap_info.vdev_id,
&csa_reason);
}
if (pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress &&
pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress()) {
policy_mgr_debug("channel switch is already in progress");
return;
}
if (!restart_freq) {
policy_mgr_err("Restart freq not found for vdev %d",
sap_info.vdev_id);
return;
}
if (restart_freq == sap_info.freq) {
policy_mgr_debug("vdev %d restart freq %d same as current freq",
sap_info.vdev_id, restart_freq);
return;
}
ch_params.ch_width = policy_mgr_get_ch_width(sap_info.bw);
wlan_reg_set_channel_params_for_pwrmode(pm_ctx->pdev, restart_freq,
0, &ch_params,
REG_CURRENT_PWR_MODE);
policy_mgr_debug("Restart SAP vdev %d with %d freq width %d",
sap_info.vdev_id, restart_freq, ch_params.ch_width);
if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason)
pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(psoc,
sap_info.vdev_id,
csa_reason);
policy_mgr_change_sap_channel_with_csa(psoc, sap_info.vdev_id,
restart_freq,
ch_params.ch_width, true);
}

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2012-2018, 2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __WLAN_POLICY_MGR_TABLES_2X2_2G_1X1_5G_DBS_H
#define __WLAN_POLICY_MGR_TABLES_2X2_2G_1X1_5G_DBS_H
#include "wlan_policy_mgr_api.h"
/*
* next_action_two_connection_table - table which provides next
* action while a new connection is coming up, with one
* connection already in the system
*/
static policy_mgr_next_action_two_connection_table_type
pm_next_action_two_connection_dbs_2x2_2g_1x1_5g_table = {
[PM_STA_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_5_2x2] = {PM_DBS2, PM_NOP},
[PM_P2P_CLI_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_CLI_5_2x2] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_SAP_24_1x1] = {PM_NOP, PM_DBS2},
[PM_SAP_24_2x2] = {PM_NOP, PM_DBS2},
[PM_SAP_5_1x1] = {PM_DBS2, PM_NOP},
[PM_SAP_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
};
/*
* next_action_three_connection_table - table which provides next
* action while a new connection is coming up, with two
* connections already in the system
*/
static policy_mgr_next_action_three_connection_table_type
pm_next_action_three_connection_dbs_2x2_2g_1x1_5g_table = {
[PM_STA_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_SAP_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_SAP_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_STA_SAP_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_SAP_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_STA_SAP_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_SAP_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_SAP_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_SAP_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_P2P_GO_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_GO_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_GO_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_GO_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_GO_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_GO_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_STA_P2P_GO_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_GO_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_STA_P2P_GO_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_P2P_GO_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_P2P_GO_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_P2P_GO_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_STA_P2P_CLI_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_CLI_SCC_5_2x2] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_CLI_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_CLI_MCC_5_2x2] = {PM_DBS2, PM_NOP},
[PM_STA_P2P_CLI_MCC_24_5_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_MCC_24_5_2x2] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_DBS_1x1] = {PM_NOP, PM_DBS2},
[PM_STA_P2P_CLI_DBS_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_P2P_CLI_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_P2P_CLI_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_P2P_CLI_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_P2P_CLI_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_P2P_CLI_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_P2P_CLI_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE,
PM_DBS2_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE,
PM_DBS2_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_GO_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_GO_SAP_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_SAP_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_GO_SAP_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_GO_SAP_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_GO_SAP_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_GO_SAP_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_GO_SAP_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_GO_SAP_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_CLI_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_P2P_CLI_SAP_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_CLI_SAP_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_CLI_SAP_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_P2P_CLI_SAP_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_P2P_CLI_SAP_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_CLI_SAP_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_CLI_SAP_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_P2P_CLI_SAP_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_SAP_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_SAP_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_SAP_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS2},
[PM_SAP_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS2},
[PM_SAP_SAP_SCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_SAP_SAP_SCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_SAP_SAP_MCC_5_1x1] = {PM_DBS2, PM_NOP},
[PM_SAP_SAP_MCC_5_2x2] = {PM_DBS2_DOWNGRADE, PM_NOP},
[PM_SAP_SAP_MCC_24_5_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_SAP_SAP_MCC_24_5_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_SAP_SAP_DBS_1x1] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
[PM_SAP_SAP_DBS_2x2] = {PM_DBS2_DOWNGRADE, PM_DBS2_DOWNGRADE},
};
#endif

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2012-2018, 2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __WLAN_POLICY_MGR_TABLES_2X2_5G_1X1_2G_DBS_H
#define __WLAN_POLICY_MGR_TABLES_2X2_5G_1X1_2G_DBS_H
#include "wlan_policy_mgr_api.h"
/*
* next_action_two_connection_table - table which provides next
* action while a new connection is coming up, with one
* connection already in the system
*/
static policy_mgr_next_action_two_connection_table_type
pm_next_action_two_connection_dbs_2x2_5g_1x1_2g_table = {
[PM_STA_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_24_2x2] = {PM_NOP, PM_DBS1},
[PM_STA_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_CLI_24_2x2] = {PM_NOP, PM_DBS1},
[PM_P2P_CLI_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_GO_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_5_2x2] = {PM_DBS1, PM_NOP},
[PM_SAP_24_1x1] = {PM_NOP, PM_DBS1},
[PM_SAP_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_SAP_5_1x1] = {PM_DBS1, PM_NOP},
[PM_SAP_5_2x2] = {PM_DBS1, PM_NOP},
};
/*
* next_action_three_connection_table - table which provides next
* action while a new connection is coming up, with two
* connections already in the system
*/
static policy_mgr_next_action_three_connection_table_type
pm_next_action_three_connection_dbs_2x2_5g_1x1_2g_table = {
[PM_STA_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_STA_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_STA_SAP_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_SAP_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_SAP_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_SAP_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_SAP_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_SAP_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_SAP_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_SAP_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_GO_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_GO_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_GO_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_GO_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_GO_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_GO_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_GO_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_STA_P2P_CLI_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_CLI_SCC_24_2x2] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_CLI_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_CLI_MCC_24_2x2] = {PM_NOP, PM_DBS1},
[PM_STA_P2P_CLI_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_CLI_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_CLI_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_CLI_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_STA_P2P_CLI_MCC_24_5_1x1] = {PM_DBS1, PM_DBS1},
[PM_STA_P2P_CLI_MCC_24_5_2x2] = {PM_DBS1, PM_DBS1},
[PM_STA_P2P_CLI_DBS_1x1] = {PM_DBS1, PM_DBS1},
[PM_STA_P2P_CLI_DBS_2x2] = {PM_DBS1, PM_DBS1},
[PM_P2P_GO_P2P_CLI_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_GO_P2P_CLI_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_GO_P2P_CLI_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_P2P_CLI_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_P2P_CLI_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE,
PM_DBS1_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE,
PM_DBS1_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_P2P_CLI_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_GO_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_GO_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_SAP_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_SAP_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_SAP_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_GO_SAP_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_GO_SAP_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_CLI_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_P2P_CLI_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_SAP_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_SAP_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_SAP_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_P2P_CLI_SAP_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_P2P_CLI_SAP_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_SCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_SAP_SAP_SCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_MCC_24_1x1] = {PM_NOP, PM_DBS1},
[PM_SAP_SAP_MCC_24_2x2] = {PM_NOP, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_SCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_SAP_SAP_SCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_SAP_SAP_MCC_5_1x1] = {PM_DBS1, PM_NOP},
[PM_SAP_SAP_MCC_5_2x2] = {PM_DBS1, PM_NOP},
[PM_SAP_SAP_MCC_24_5_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_MCC_24_5_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_DBS_1x1] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
[PM_SAP_SAP_DBS_2x2] = {PM_DBS1_DOWNGRADE, PM_DBS1_DOWNGRADE},
};
#endif

View File

@ -0,0 +1,381 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "wlan_policy_mgr_ucfg.h"
#include "wlan_policy_mgr_i.h"
#include "cfg_ucfg_api.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_nan_api.h"
#ifdef WLAN_FEATURE_SR
/**
* policy_mgr_init_same_mac_conc_sr_status() - Function initializes default
* value to sr_in_same_mac_conc based on INI g_enable_sr_in_same_mac_conc
*
* @psoc: Pointer to PSOC
*
* Return: void
*/
static void
policy_mgr_init_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return;
}
pm_ctx->cfg.sr_in_same_mac_conc =
cfg_get(psoc, CFG_ENABLE_SR_IN_SAME_MAC_CONC);
}
#else
static void
policy_mgr_init_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc)
{}
#endif
static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
struct policy_mgr_cfg *cfg;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("pm_ctx is NULL");
return QDF_STATUS_E_FAILURE;
}
cfg = &pm_ctx->cfg;
cfg->mcc_to_scc_switch = cfg_get(psoc, CFG_MCC_TO_SCC_SWITCH);
if (cfg->mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE &&
cfg->mcc_to_scc_switch <
QDF_MCC_TO_SCC_SWITCH_FORCE_WITHOUT_DISCONNECTION) {
policy_mgr_info("User configured mcc_to_scc_switch: %d, overwrite it to: %d",
cfg->mcc_to_scc_switch,
QDF_MCC_TO_SCC_SWITCH_FORCE_WITHOUT_DISCONNECTION);
cfg->mcc_to_scc_switch =
QDF_MCC_TO_SCC_SWITCH_FORCE_WITHOUT_DISCONNECTION;
}
cfg->sys_pref = cfg_get(psoc, CFG_CONC_SYS_PREF);
if (wlan_is_mlo_sta_nan_ndi_allowed(psoc)) {
cfg->max_conc_cxns = cfg_get(psoc, CFG_MAX_CONC_CXNS) + 1;
policy_mgr_err("max_conc_cxns %d nan", cfg->max_conc_cxns);
} else {
cfg->max_conc_cxns = cfg_get(psoc, CFG_MAX_CONC_CXNS);
policy_mgr_err("max_conc_cxns %d non-nan", cfg->max_conc_cxns);
}
cfg->max_conc_cxns = QDF_MIN(cfg->max_conc_cxns,
MAX_NUMBER_OF_CONC_CONNECTIONS);
cfg->conc_rule1 = cfg_get(psoc, CFG_ENABLE_CONC_RULE1);
cfg->conc_rule2 = cfg_get(psoc, CFG_ENABLE_CONC_RULE2);
cfg->pcl_band_priority = cfg_get(psoc, CFG_PCL_BAND_PRIORITY);
cfg->dbs_selection_plcy = cfg_get(psoc, CFG_DBS_SELECTION_PLCY);
cfg->vdev_priority_list = cfg_get(psoc, CFG_VDEV_CUSTOM_PRIORITY_LIST);
cfg->chnl_select_plcy = cfg_get(psoc, CFG_CHNL_SELECT_LOGIC_CONC);
cfg->enable_mcc_adaptive_sch =
cfg_get(psoc, CFG_ENABLE_MCC_ADAPTIVE_SCH_ENABLED_NAME);
cfg->enable_sta_cxn_5g_band =
cfg_get(psoc, CFG_ENABLE_STA_CONNECTION_IN_5GHZ);
cfg->allow_mcc_go_diff_bi =
cfg_get(psoc, CFG_ALLOW_MCC_GO_DIFF_BI);
cfg->dual_mac_feature =
cfg_get(psoc, CFG_DUAL_MAC_FEATURE_DISABLE);
cfg->sbs_enable =
cfg_get(psoc, CFG_ENABLE_SBS);
cfg->is_force_1x1_enable =
cfg_get(psoc, CFG_FORCE_1X1_FEATURE);
cfg->sta_sap_scc_on_dfs_chnl =
cfg_get(psoc, CFG_STA_SAP_SCC_ON_DFS_CHAN);
/*
* Override concurrency sta+sap indoor flag to true if global indoor
* flag is true
*/
cfg->sta_sap_scc_on_indoor_channel =
cfg_get(psoc, CFG_STA_SAP_SCC_ON_INDOOR_CHAN);
if (cfg_get(psoc, CFG_INDOOR_CHANNEL_SUPPORT))
cfg->sta_sap_scc_on_indoor_channel = true;
/*
* Force set sta_sap_scc_on_dfs_chnl on Non-DBS HW so that standalone
* SAP is not allowed on DFS channel on non-DBS HW, Also, force SCC in
* case of STA+SAP
*/
if (cfg->sta_sap_scc_on_dfs_chnl == 2 &&
!cfg_get(psoc, CFG_ENABLE_DFS_MASTER_CAPABILITY))
cfg->sta_sap_scc_on_dfs_chnl = 0;
cfg->nan_sap_scc_on_lte_coex_chnl =
cfg_get(psoc, CFG_NAN_SAP_SCC_ON_LTE_COEX_CHAN);
cfg->sta_sap_scc_on_lte_coex_chnl =
cfg_get(psoc, CFG_STA_SAP_SCC_ON_LTE_COEX_CHAN);
cfg->sap_mandatory_chnl_enable =
cfg_get(psoc, CFG_ENABLE_SAP_MANDATORY_CHAN_LIST);
cfg->mark_indoor_chnl_disable =
cfg_get(psoc, CFG_MARK_INDOOR_AS_DISABLE_FEATURE);
cfg->go_force_scc = cfg_get(psoc, CFG_P2P_GO_ENABLE_FORCE_SCC);
cfg->multi_sap_allowed_on_same_band =
cfg_get(psoc, CFG_MULTI_SAP_ALLOWED_ON_SAME_BAND);
policy_mgr_init_same_mac_conc_sr_status(psoc);
cfg->use_sap_original_bw =
cfg_get(psoc, CFG_SAP_DEFAULT_BW_FOR_RESTART);
cfg->move_sap_go_1st_on_dfs_sta_csa =
cfg_get(psoc, CFG_MOVE_SAP_GO_1ST_ON_DFS_STA_CSA);
return QDF_STATUS_SUCCESS;
}
static void policy_mgr_deinit_cfg(struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("pm_ctx is NULL");
return;
}
qdf_mem_zero(&pm_ctx->cfg, sizeof(pm_ctx->cfg));
}
QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
status = policy_mgr_init_cfg(psoc);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("pm_ctx is NULL");
return status;
}
status = policy_mgr_psoc_open(psoc);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("psoc open fail");
policy_mgr_psoc_close(psoc);
return status;
}
return QDF_STATUS_SUCCESS;
}
void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc)
{
policy_mgr_psoc_close(psoc);
policy_mgr_deinit_cfg(psoc);
}
QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
uint8_t *mcc_scc_switch)
{
return policy_mgr_get_mcc_scc_switch(psoc, mcc_scc_switch);
}
QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
uint8_t *sys_pref)
{
return policy_mgr_get_sys_pref(psoc, sys_pref);
}
QDF_STATUS ucfg_policy_mgr_set_sys_pref(struct wlan_objmgr_psoc *psoc,
uint8_t sys_pref)
{
return policy_mgr_set_sys_pref(psoc, sys_pref);
}
QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
uint8_t *conc_rule1)
{
return policy_mgr_get_conc_rule1(psoc, conc_rule1);
}
QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
uint8_t *conc_rule2)
{
return policy_mgr_get_conc_rule2(psoc, conc_rule2);
}
QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
uint32_t *chnl_select_plcy)
{
return policy_mgr_get_chnl_select_plcy(psoc, chnl_select_plcy);
}
QDF_STATUS ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sch)
{
return policy_mgr_set_dynamic_mcc_adaptive_sch(
psoc, dynamic_mcc_adaptive_sch);
}
QDF_STATUS ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sch)
{
return policy_mgr_get_dynamic_mcc_adaptive_sch(
psoc, dynamic_mcc_adaptive_sch);
}
QDF_STATUS ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool *mcc_adaptive_sch)
{
return policy_mgr_get_mcc_adaptive_sch(psoc, mcc_adaptive_sch);
}
QDF_STATUS ucfg_policy_mgr_get_sta_cxn_5g_band(struct wlan_objmgr_psoc *psoc,
uint8_t *enable_sta_cxn_5g_band)
{
return policy_mgr_get_sta_cxn_5g_band(psoc, enable_sta_cxn_5g_band);
}
QDF_STATUS
ucfg_policy_mgr_get_allow_mcc_go_diff_bi(struct wlan_objmgr_psoc *psoc,
uint8_t *allow_mcc_go_diff_bi)
{
return policy_mgr_get_allow_mcc_go_diff_bi(psoc, allow_mcc_go_diff_bi);
}
QDF_STATUS ucfg_policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc,
uint8_t *dual_mac_feature)
{
return policy_mgr_get_dual_mac_feature(psoc, dual_mac_feature);
}
bool ucfg_policy_mgr_get_dual_sta_feature(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_allow_multiple_sta_connections(psoc);
}
QDF_STATUS ucfg_policy_mgr_get_force_1x1(struct wlan_objmgr_psoc *psoc,
uint8_t *force_1x1)
{
return policy_mgr_get_force_1x1(psoc, force_1x1);
}
uint32_t ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_get_max_conc_cxns(psoc);
}
QDF_STATUS ucfg_policy_mgr_set_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
uint32_t max_conc_cxns)
{
return policy_mgr_set_max_conc_cxns(psoc, max_conc_cxns);
}
QDF_STATUS
ucfg_policy_mgr_get_radio_combinations(struct wlan_objmgr_psoc *psoc,
struct radio_combination *comb,
uint32_t comb_max,
uint32_t *comb_num)
{
return policy_mgr_get_radio_combinations(psoc, comb,
comb_max, comb_num);
}
QDF_STATUS
ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sta_sap_scc_on_dfs_chnl)
{
return policy_mgr_get_sta_sap_scc_on_dfs_chnl(psoc,
sta_sap_scc_on_dfs_chnl);
}
bool
ucfg_policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id)
{
return policy_mgr_get_dfs_master_dynamic_enabled(psoc, vdev_id);
}
QDF_STATUS
ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sta_sap_scc_lte_coex)
{
return policy_mgr_get_sta_sap_scc_lte_coex_chnl(psoc,
sta_sap_scc_lte_coex);
}
QDF_STATUS
ucfg_policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc,
qdf_freq_t *chan_freq_list,
uint16_t chan_cnt)
{
return policy_mgr_init_chan_avoidance(psoc, chan_freq_list, chan_cnt);
}
QDF_STATUS ucfg_policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc,
uint8_t *sap_mandt_chnl)
{
return policy_mgr_get_sap_mandt_chnl(psoc, sap_mandt_chnl);
}
QDF_STATUS
ucfg_policy_mgr_get_indoor_chnl_marking(struct wlan_objmgr_psoc *psoc,
uint8_t *indoor_chnl_marking)
{
return policy_mgr_get_indoor_chnl_marking(psoc, indoor_chnl_marking);
}
bool
ucfg_policy_mgr_get_sta_sap_scc_on_indoor_chnl(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc) ?
true : false;
}
bool ucfg_policy_mgr_is_fw_supports_dbs(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_find_if_fw_supports_dbs(psoc);
}
uint32_t ucfg_policy_mgr_get_connection_count(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_get_connection_count(psoc);
}
bool ucfg_policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc)
{
return policy_mgr_is_hw_dbs_capable(psoc);
}
bool ucfg_policy_mgr_get_vdev_same_freq_new_conn(struct wlan_objmgr_psoc *psoc,
uint32_t new_freq,
uint8_t *vdev_id)
{
return policy_mgr_get_vdev_same_freq_new_conn(psoc, new_freq, vdev_id);
}
bool ucfg_policy_mgr_get_vdev_diff_freq_new_conn(struct wlan_objmgr_psoc *psoc,
uint32_t new_freq,
uint8_t *vdev_id)
{
return policy_mgr_get_vdev_diff_freq_new_conn(psoc, new_freq, vdev_id);
}
QDF_STATUS ucfg_policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc,
bool *one_by_one_dbs,
bool *two_by_two_dbs)
{
return policy_mgr_get_dbs_hw_modes(psoc, one_by_one_dbs,
two_by_two_dbs);
}

View File

@ -0,0 +1,152 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains declarations for CoAP core functions
*/
#ifndef _WLAN_COAP_MAIN_H_
#define _WLAN_COAP_MAIN_H_
#ifdef WLAN_FEATURE_COAP
#include "wlan_objmgr_vdev_obj.h"
#define coap_err(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_COAP, params)
#define coap_info(params...) \
QDF_TRACE_INFO(QDF_MODULE_ID_COAP, params)
#define coap_debug(params...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_COAP, params)
/**
* struct wlan_coap_comp_priv - CoAP component private structure
* @req_id: cache get request id
* @cache_get_cbk: Callback function to be called with the cache get result
* @cache_get_context: context to be used by the caller to associate the get
* cache request with the response
*/
struct wlan_coap_comp_priv {
uint32_t req_id;
coap_cache_get_callback cache_get_cbk;
void *cache_get_context;
};
static inline struct wlan_coap_comp_priv *
wlan_get_vdev_coap_obj(struct wlan_objmgr_vdev *vdev)
{
return wlan_objmgr_vdev_get_comp_private_obj(vdev,
WLAN_UMAC_COMP_COAP);
}
/*
* wlan_coap_init() - CoAP module initialization API
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_coap_init(void);
/*
* wlan_coap_init() - CoAP module deinitialization API
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_coap_deinit(void);
/**
* wlan_coap_enable(): API to enable CoAP component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc enable.
* This API will register CoAP related WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_coap_enable(struct wlan_objmgr_psoc *psoc);
/**
* wlan_coap_disable(): API to disable CoAP component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc disable.
* This API will unregister CoAP related WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_coap_disable(struct wlan_objmgr_psoc *psoc);
/**
* wlan_coap_offload_reply_enable() - private API to enable CoAP offload reply
* @vdev: pointer to vdev object
* @param: parameters of CoAP offload reply
*
* Return: status of operation
*/
QDF_STATUS
wlan_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *param);
/**
* wlan_coap_offload_reply_disable() - private API to disable CoAP offload reply
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to be called with the cache info
* @context: context to be used by the caller to associate the disable request
*
* Return: status of operation
*/
QDF_STATUS
wlan_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context);
/**
* wlan_coap_offload_periodic_tx_enable() - private API to enable CoAP offload
* periodic transmitting
* @vdev: pointer to vdev object
* @param: parameters of CoAP periodic transmit
*
* Return: status of operation
*/
QDF_STATUS
wlan_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *param);
/**
* wlan_coap_offload_periodic_tx_disable() - private API to disable CoAP
* offload periodic transmitting
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
wlan_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id);
/**
* wlan_coap_offload_cache_get() - private API to get CoAP offload cache
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to be called with the cache get result
* @context: context to be used by the caller to associate the get
* cache request with the response
*
* Return: status of operation
*/
QDF_STATUS
wlan_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context);
#endif
#endif

View File

@ -0,0 +1,163 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains definitions for CoAP core functions
*/
#include <wlan_coap_tgt_api.h>
#include <wlan_coap_main.h>
#include <wlan_objmgr_global_obj.h>
QDF_STATUS wlan_coap_enable(struct wlan_objmgr_psoc *psoc)
{
return tgt_coap_attach(psoc);
}
QDF_STATUS wlan_coap_disable(struct wlan_objmgr_psoc *psoc)
{
return tgt_coap_detach(psoc);
}
static QDF_STATUS
wlan_coap_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg)
{
struct wlan_coap_comp_priv *coap_priv;
QDF_STATUS status;
if (!vdev)
return QDF_STATUS_E_INVAL;
coap_priv = qdf_mem_malloc(sizeof(struct wlan_coap_comp_priv));
if (!coap_priv)
return QDF_STATUS_E_NOMEM;
status = wlan_objmgr_vdev_component_obj_attach(vdev,
WLAN_UMAC_COMP_COAP,
(void *)coap_priv,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status))
qdf_mem_free(coap_priv);
return status;
}
static QDF_STATUS
wlan_coap_vdev_obj_destroy_handler(struct wlan_objmgr_vdev *vdev, void *arg)
{
void *coap_priv;
if (!vdev) {
coap_err("Vdev NULL");
return QDF_STATUS_E_INVAL;
}
coap_priv = wlan_get_vdev_coap_obj(vdev);
if (!coap_priv) {
coap_err("coap_priv NULL");
return QDF_STATUS_E_INVAL;
}
wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_COAP,
coap_priv);
qdf_mem_free(coap_priv);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_coap_init(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
status = wlan_objmgr_register_vdev_create_handler(WLAN_UMAC_COMP_COAP,
wlan_coap_vdev_obj_create_handler, NULL);
if (status != QDF_STATUS_SUCCESS)
return status;
status = wlan_objmgr_register_vdev_destroy_handler(WLAN_UMAC_COMP_COAP,
wlan_coap_vdev_obj_destroy_handler, NULL);
if (QDF_IS_STATUS_SUCCESS(status))
return status;
wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_COAP,
wlan_coap_vdev_obj_create_handler, NULL);
return status;
}
QDF_STATUS wlan_coap_deinit(void)
{
wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_COAP,
wlan_coap_vdev_obj_create_handler, NULL);
wlan_objmgr_unregister_vdev_destroy_handler(WLAN_UMAC_COMP_COAP,
wlan_coap_vdev_obj_destroy_handler, NULL);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *params)
{
return tgt_send_coap_offload_reply_enable(vdev, params);
}
QDF_STATUS
wlan_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context)
{
struct wlan_coap_comp_priv *coap_priv;
if (!vdev) {
coap_err("Vdev NULL");
return QDF_STATUS_E_INVAL;
}
coap_priv = wlan_get_vdev_coap_obj(vdev);
coap_priv->req_id = req_id;
coap_priv->cache_get_context = context;
coap_priv->cache_get_cbk = cbk;
return tgt_send_coap_offload_reply_disable(vdev, req_id);
}
QDF_STATUS
wlan_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *params)
{
return tgt_send_coap_offload_periodic_tx_enable(vdev, params);
}
QDF_STATUS
wlan_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id)
{
return tgt_send_coap_offload_periodic_tx_disable(vdev, req_id);
}
QDF_STATUS
wlan_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context)
{
struct wlan_coap_comp_priv *coap_priv;
if (!vdev) {
coap_err("Vdev NULL");
return QDF_STATUS_E_INVAL;
}
coap_priv = wlan_get_vdev_coap_obj(vdev);
coap_priv->req_id = req_id;
coap_priv->cache_get_context = context;
coap_priv->cache_get_cbk = cbk;
return tgt_send_coap_offload_cache_get(vdev, req_id);
}

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains CoAP structure definitions
*/
#ifndef _WLAN_COAP_PUBLIC_STRUCTS_H_
#define _WLAN_COAP_PUBLIC_STRUCTS_H_
#include <qdf_types.h>
/**
* struct coap_offload_reply_param - parameters to enable CoAP offload reply
* @vdev_id: vdev id
* @pattern_id: pattern id
* @cache_timeout: the cached packet expire timeout in ms
* @src_ip_v4: source IPv4 address for sending reply message
* @src_udp_port: source udp port for sending reply message
* @dest_ip_v4: destination IPv4 address to match received CoAP message
* @dest_ip_v4_is_bc: indicate whether the destination address is broadcast
* address or not
* @dest_udp_port: destination UDP port to match received CoAP message
* @verify_offset: UDP payload offset to match received CoAP message
* @verify_len: UDP payload length to match received CoAP message
* @verify: pointer to binary data to match received CoAP message
* @coapmsg_len: CoAP reply message length
* @coapmsg: pointer to CoAP reply message
*/
struct coap_offload_reply_param {
uint32_t vdev_id;
uint32_t pattern_id;
uint32_t cache_timeout;
uint32_t src_ip_v4;
uint16_t src_udp_port;
uint32_t dest_ip_v4;
bool dest_ip_v4_is_bc;
uint16_t dest_udp_port;
uint32_t verify_offset;
uint32_t verify_len;
uint8_t *verify;
uint32_t coapmsg_len;
uint8_t *coapmsg;
};
/**
* struct coap_offload_periodic_tx_param - parameters to enable CoAP offload
* periodic transmitting
* @vdev_id: vdev id
* @pattern_id: pattern id
* @src_ip_v4: IPv4 address for sending CoAP message
* @src_udp_port: source udp port for sending CoAP message
* @dest_ip_v4: destination IPv4 address for sending CoAP message
* @dest_ip_v4_is_bc: indicate whether the destination address is broadcast
* address or not
* @dest_udp_port: destination UDP port for sending CoAP message
* @timeout: the periorid to send keepalive message in ms
* @coapmsg_len: keeplive CoAP message length
* @coapmsg: pointer to keeplive CoAP message
*/
struct coap_offload_periodic_tx_param {
uint32_t vdev_id;
uint32_t pattern_id;
uint32_t src_ip_v4;
uint16_t src_udp_port;
uint32_t dest_ip_v4;
bool dest_ip_v4_is_bc;
uint16_t dest_udp_port;
uint32_t timeout;
uint32_t coapmsg_len;
uint8_t *coapmsg;
};
/**
* struct coap_buf_node - CoAP message info entry
* @node: List entry element
* @tsf: TSF of the CoAP meesage
* @src_ip: source IPv4 address of the CoAP message
* @len: length of the payload
* @payload: pointer to buffer holding UDP payload of the CoAP message
*/
struct coap_buf_node {
qdf_list_node_t node;
uint64_t tsf;
uint32_t src_ip;
uint32_t len;
uint8_t *payload;
};
/**
* struct coap_buf_info - info of the cached CoAP messages
* @vdev_id: vdev id
* @req_id: request id
* @more_info: flag to indicate whether there are more cached messages
* @info_list: list to hold cached CoAP messages
*/
struct coap_buf_info {
uint8_t vdev_id;
uint32_t req_id;
bool more_info;
qdf_list_t info_list;
};
/**
* typedef coap_cache_get_callback() - callback for getting cached CoAP messages
* @context: context for getting cached CoAP messages
* @info: pointer to info of the cached CoAP messages
*/
typedef void (*coap_cache_get_callback)(void *context,
struct coap_buf_info *info);
#endif

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains CoAP south bound interface definitions
*/
#ifndef _WLAN_COAP_TGT_API_H_
#define _WLAN_COAP_TGT_API_H_
#ifdef WLAN_FEATURE_COAP
#include <qdf_types.h>
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_vdev_obj.h>
/**
* tgt_coap_attach(): attach CoAP component
* @psoc: pointer to psoc
*
* This API will register CoAP related WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS tgt_coap_attach(struct wlan_objmgr_psoc *psoc);
/**
* tgt_coap_detach(): detach CoAP component
* @psoc: pointer to psoc
*
* This API will unregister CoAP related WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS tgt_coap_detach(struct wlan_objmgr_psoc *psoc);
/**
* tgt_send_coap_offload_reply_enable() - enable CoAP offload reply
* @vdev: pointer to vdev object
* @param: parameters for CoAP offload reply
*
* Return: status of operation
*/
QDF_STATUS
tgt_send_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *param);
/**
* tgt_send_coap_offload_reply_disable() - disable CoAP offload reply
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
tgt_send_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id);
/**
* tgt_send_coap_offload_periodic_tx_enable() - enable CoAP offload
* periodic transmitting
* @vdev: pointer to vdev object
* @param: parameters for CoAP periodic transmitting
*
* Return: status of operation
*/
QDF_STATUS
tgt_send_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *param);
/**
* tgt_send_coap_offload_periodic_tx_disable() - disable CoAP offload
* periodic transmitting
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
tgt_send_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id);
/**
* tgt_send_coap_offload_cache_get() - get cached CoAP messages
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
tgt_send_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev,
uint32_t req_id);
#endif
#endif

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains CoAP north bound interface declarations
*/
#ifndef _WLAN_COAP_UCFG_API_H_
#define _WLAN_COAP_UCFG_API_H_
#include "qdf_status.h"
#include <wlan_objmgr_vdev_obj.h>
#include "wlan_coap_public_structs.h"
#ifdef WLAN_FEATURE_COAP
/**
* ucfg_coap_offload_reply_enable() - API to enable CoAP offload reply
* @vdev: pointer to vdev object
* @param: parameters of CoAP offload reply
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *param);
/**
* ucfg_coap_offload_reply_disable() - API to disable CoAP offload reply
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to invoke with cached data
* @context: caller-supplied context
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context);
/**
* ucfg_coap_offload_periodic_tx_enable() - API to enable CoAP offload
* periodic transmit
* @vdev: pointer to vdev object
* @param: parameters of CoAP periodic transmit
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *param);
/**
* ucfg_coap_offload_periodic_tx_disable() - API to disable CoAP offload
* periodic transmit
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id);
/**
* ucfg_coap_offload_cache_get() - API to get CoAP offload cache
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to be called with the cache get result
* @context: context to be used by the caller to associate the get
* cache request with the response
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context);
#endif
#endif

View File

@ -0,0 +1,187 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains CoAP south bound interface definitions
*/
#include <wlan_coap_main.h>
#include <wlan_coap_tgt_api.h>
#include <wlan_lmac_if_def.h>
#include "wlan_objmgr_pdev_obj.h"
static inline struct wlan_lmac_if_coap_tx_ops *
wlan_psoc_get_coap_txops(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_tx_ops *tx_ops;
tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
if (!tx_ops) {
coap_err("tx_ops is NULL");
return NULL;
}
return &tx_ops->coap_ops;
}
static inline struct wlan_lmac_if_coap_tx_ops *
wlan_vdev_get_coap_txops(struct wlan_objmgr_vdev *vdev)
{
struct wlan_objmgr_psoc *psoc;
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coap_err("NULL psoc");
return NULL;
}
return wlan_psoc_get_coap_txops(psoc);
}
QDF_STATUS tgt_coap_attach(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_coap_tx_ops *coap_tx_ops;
if (!psoc) {
coap_err("psoc is null");
return QDF_STATUS_E_NULL_VALUE;
}
coap_tx_ops = wlan_psoc_get_coap_txops(psoc);
if (!coap_tx_ops) {
coap_err("tx_ops is null!");
return QDF_STATUS_E_NULL_VALUE;
}
if (!coap_tx_ops->attach) {
coap_err("attach function is null!");
return QDF_STATUS_E_NULL_VALUE;
}
return coap_tx_ops->attach(psoc);
}
QDF_STATUS tgt_coap_detach(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_coap_tx_ops *coap_tx_ops;
if (!psoc) {
coap_err("psoc is null");
return QDF_STATUS_E_NULL_VALUE;
}
coap_tx_ops = wlan_psoc_get_coap_txops(psoc);
if (!coap_tx_ops) {
coap_err("tx_ops is null!");
return QDF_STATUS_E_NULL_VALUE;
}
if (!coap_tx_ops->detach) {
coap_err("coap_detach function is null!");
return QDF_STATUS_E_NULL_VALUE;
}
return coap_tx_ops->detach(psoc);
}
QDF_STATUS
tgt_send_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *param)
{
struct wlan_lmac_if_coap_tx_ops *coap_ops;
if (!vdev) {
coap_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
coap_ops = wlan_vdev_get_coap_txops(vdev);
if (coap_ops && coap_ops->offload_reply_enable)
return coap_ops->offload_reply_enable(vdev, param);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
tgt_send_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id)
{
struct wlan_lmac_if_coap_tx_ops *coap_ops;
if (!vdev) {
coap_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
coap_ops = wlan_vdev_get_coap_txops(vdev);
if (coap_ops && coap_ops->offload_reply_disable)
return coap_ops->offload_reply_disable(vdev, req_id);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
tgt_send_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *param)
{
struct wlan_lmac_if_coap_tx_ops *coap_ops;
if (!vdev) {
coap_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
coap_ops = wlan_vdev_get_coap_txops(vdev);
if (coap_ops && coap_ops->offload_periodic_tx_enable)
return coap_ops->offload_periodic_tx_enable(vdev, param);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
tgt_send_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id)
{
struct wlan_lmac_if_coap_tx_ops *coap_ops;
if (!vdev) {
coap_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
coap_ops = wlan_vdev_get_coap_txops(vdev);
if (coap_ops && coap_ops->offload_periodic_tx_disable)
return coap_ops->offload_periodic_tx_disable(vdev, req_id);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
tgt_send_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id)
{
struct wlan_lmac_if_coap_tx_ops *coap_ops;
if (!vdev) {
coap_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
coap_ops = wlan_vdev_get_coap_txops(vdev);
if (coap_ops && coap_ops->offload_cache_get)
return coap_ops->offload_cache_get(vdev, req_id);
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains CoAP north bound interface definitions
*/
#include <wlan_coap_main.h>
#include <wlan_coap_ucfg_api.h>
/**
* ucfg_coap_offload_reply_enable() - API to enable CoAP offload reply
* @vdev: pointer to vdev object
* @param: parameters of CoAP offload reply
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_reply_param *param)
{
return wlan_coap_offload_reply_enable(vdev, param);
}
/**
* ucfg_coap_offload_reply_disable() - API to disable CoAP offload reply
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to be called with the cache info
* @context: context to be used by the caller to associate the disable request
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context)
{
return wlan_coap_offload_reply_disable(vdev, req_id, cbk, context);
}
/**
* ucfg_coap_offload_periodic_tx_enable() - API to enable CoAP offload
* periodic transmitting
* @vdev: pointer to vdev object
* @param: parameters for CoAP periodic transmit
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
struct coap_offload_periodic_tx_param *param)
{
return wlan_coap_offload_periodic_tx_enable(vdev, param);
}
/**
* ucfg_coap_offload_periodic_tx_disable() - private API to disable CoAP
* offload periodic transmitting
* @vdev: pointer to vdev object
* @req_id: request id
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
uint32_t req_id)
{
return wlan_coap_offload_periodic_tx_disable(vdev, req_id);
}
/**
* ucfg_coap_offload_cache_get() - API to get CoAP offload cache
* @vdev: pointer to vdev object
* @req_id: request id
* @cbk: callback function to be called with the cache get result
* @context: context to be used by the caller to associate the get
* cache request with the response
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
coap_cache_get_callback cbk, void *context)
{
return wlan_coap_offload_cache_get(vdev, req_id, cbk, context);
}

View File

@ -0,0 +1,249 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains declarations for coex core functions
*/
#ifndef _WLAN_COEX_MAIN_API_H_
#define _WLAN_COEX_MAIN_API_H_
#ifdef FEATURE_COEX
#include "wlan_coex_ucfg_api.h"
#include "wmi_unified_param.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_vdev_obj.h"
#define coex_err(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_COEX, params)
#define coex_info(params...) \
QDF_TRACE_INFO(QDF_MODULE_ID_COEX, params)
#define coex_debug(params...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_COEX, params)
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* struct wlan_coex_callback - coex dbam callback structure
* @set_dbam_config_cb: callback for set_dbam_config
* @set_dbam_config_ctx: context for set_dbam_config callback
*/
struct wlan_coex_callback {
void (*set_dbam_config_cb)(void *ctx, enum coex_dbam_comp_status *rsp);
void *set_dbam_config_ctx;
};
#endif
/**
* struct coex_psoc_obj - coex object definition
* @btc_chain_mode: BT Coex chain mode.
* @coex_config_updated: callback functions for each config type, which will
* be called when config is updated.
* @cb: structure to dbam callback
*/
struct coex_psoc_obj {
enum coex_btc_chain_mode btc_chain_mode;
update_coex_cb coex_config_updated[COEX_CONFIG_TYPE_MAX];
#ifdef WLAN_FEATURE_DBAM_CONFIG
struct wlan_coex_callback cb;
#endif
};
/**
* wlan_psoc_get_coex_obj() - private API to get coex object from psoc
* @psoc: psoc object
*
* Return: coex object
*/
#define wlan_psoc_get_coex_obj(psoc) \
wlan_psoc_get_coex_obj_fl(psoc, __func__, __LINE__)
static inline struct coex_psoc_obj *
wlan_psoc_get_coex_obj_fl(struct wlan_objmgr_psoc *psoc,
const char *func, uint32_t line)
{
struct coex_psoc_obj *psoc_obj;
psoc_obj = (struct coex_psoc_obj *)
wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_COEX);
if (!psoc_obj) {
coex_err("%s:%u, Failed to get coex psoc object", func, line);
return NULL;
}
return psoc_obj;
}
/**
* wlan_coex_psoc_init() - API to initialize coex component
* @psoc: soc context
*
* Return: QDF_STATUS
*/
QDF_STATUS
wlan_coex_psoc_init(struct wlan_objmgr_psoc *psoc);
/**
* wlan_coex_psoc_deinit() - API to deinitialize coex component
* @psoc: soc context
*
* Return: QDF_STATUS
*/
QDF_STATUS
wlan_coex_psoc_deinit(struct wlan_objmgr_psoc *psoc);
/**
* wlan_coex_config_send() - private API to send coex config
* @vdev: pointer to vdev object
* @param: parameters of coex config
*
* Return: status of operation
*/
QDF_STATUS wlan_coex_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_config_params *param);
/**
* wlan_coex_multi_config_send() - API to send coex multiple configure
* @vdev: pointer to vdev object
* @param: parameters of coex multiple config
*
* QDF_STATUS
*/
QDF_STATUS wlan_coex_multi_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param);
/**
* wlan_coex_config_updated() - private API to notify that coex config
* is updated.
* @vdev: pointer to vdev object
* @type: type of coex config
*
* Return: status of operation
*/
QDF_STATUS
wlan_coex_config_updated(struct wlan_objmgr_vdev *vdev, uint8_t type);
/**
* wlan_coex_psoc_created_notification() - PSOC obj create callback
* @psoc: PSOC object
* @arg_list: Variable argument list
*
* This callback is registered with object manager during initialization to
* get notified when the object is created.
*
* Return: Success or Failure
*/
QDF_STATUS wlan_coex_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
void *arg_list);
/**
* wlan_coex_psoc_destroyed_notification() - PSOC obj delete callback
* @psoc: PSOC object
* @arg_list: Variable argument list
*
* This callback is registered with object manager during initialization to
* get notified when the object is deleted.
*
* Return: Success or Failure
*/
QDF_STATUS wlan_coex_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc,
void *arg_list);
/**
* wlan_coex_psoc_set_btc_chain_mode() - private API to set BT coex chain mode
* for psoc
* @psoc: pointer to psoc object
* @val: BT coex chain mode
*
* Return : status of operation
*/
QDF_STATUS
wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode val);
/**
* wlan_coex_psoc_get_btc_chain_mode() - private API to get BT coex chain mode
* from psoc
* @psoc: pointer to psoc object
* @val: pointer to BT coex chain mode
*
* Return : status of operation
*/
QDF_STATUS
wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode *val);
#endif
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* wlan_dbam_config_send() - private API to send dbam config
* @vdev: pointer to vdev object
* @param: parameters of dbam config
*
* Return: QDF_STATUS of operation
*/
QDF_STATUS wlan_dbam_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param);
static inline struct wlan_lmac_if_dbam_rx_ops *
wlan_psoc_get_dbam_rx_ops(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_rx_ops *rx_ops;
rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
if (!rx_ops) {
coex_err("rx_ops is NULL");
return NULL;
}
return &rx_ops->dbam_rx_ops;
}
static inline struct wlan_lmac_if_dbam_tx_ops *
wlan_psoc_get_dbam_tx_ops(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_tx_ops *tx_ops;
tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
if (!tx_ops) {
coex_err("tx_ops is NULL");
return NULL;
}
return &tx_ops->dbam_tx_ops;
}
/**
* wlan_dbam_attach() - Attach dbam handler
* @psoc: psoc pointer
*
* This function gets called to register dbam FW events handler
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_dbam_attach(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dbam_detach() - Detach dbam handler
* @psoc: psoc pointer
*
* This function gets called to unregister dbam FW events handler
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_dbam_detach(struct wlan_objmgr_psoc *psoc);
#endif /* WLAN_FEATURE_DBAM_CONFIG */
#endif

View File

@ -0,0 +1,264 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains definitions for coex core functions
*/
#include <wlan_coex_ucfg_api.h>
#include <wlan_coex_tgt_api.h>
#include <wlan_coex_main.h>
QDF_STATUS wlan_coex_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
void *arg_list)
{
struct coex_psoc_obj *psoc_obj;
QDF_STATUS status;
psoc_obj = qdf_mem_malloc(sizeof(*psoc_obj));
if (!psoc_obj)
return QDF_STATUS_E_NOMEM;
psoc_obj->btc_chain_mode = WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
/* Attach scan private date to psoc */
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_COEX,
psoc_obj,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
coex_err("Failed to attach psoc coex component");
qdf_mem_free(psoc_obj);
} else {
coex_debug("Coex object attach to psoc successful");
}
return status;
}
QDF_STATUS wlan_coex_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc,
void *arg_list)
{
void *psoc_obj;
QDF_STATUS status;
psoc_obj = wlan_psoc_get_coex_obj(psoc);
if (!psoc_obj)
return QDF_STATUS_E_FAILURE;
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_COEX,
psoc_obj);
if (QDF_IS_STATUS_ERROR(status))
coex_err("Failed to detach psoc coex component");
qdf_mem_free(psoc_obj);
return status;
}
QDF_STATUS
wlan_coex_psoc_init(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_coex_psoc_deinit(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_coex_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_config_params *param)
{
QDF_STATUS status;
status = tgt_send_coex_config(vdev, param);
if (QDF_IS_STATUS_ERROR(status))
coex_err("failed to send coex config");
return status;
}
QDF_STATUS wlan_coex_multi_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param)
{
struct wlan_objmgr_psoc *psoc;
struct coex_config_params one_param;
QDF_STATUS status, ret = QDF_STATUS_SUCCESS;
uint32_t i;
if (!vdev) {
coex_err("Null vdev");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("failed to get coex_obj");
return QDF_STATUS_E_INVAL;
}
if (tgt_get_coex_multi_config_support(psoc))
return tgt_send_coex_multi_config(vdev, param);
for (i = 0; i < param->num_configs; i++) {
one_param.vdev_id = param->vdev_id;
one_param.config_type = param->cfg_items[i].config_type;
one_param.config_arg1 = param->cfg_items[i].config_arg1;
one_param.config_arg2 = param->cfg_items[i].config_arg2;
one_param.config_arg3 = param->cfg_items[i].config_arg3;
one_param.config_arg4 = param->cfg_items[i].config_arg4;
one_param.config_arg5 = param->cfg_items[i].config_arg5;
one_param.config_arg6 = param->cfg_items[i].config_arg6;
status = tgt_send_coex_config(vdev, &one_param);
if (QDF_IS_STATUS_ERROR(status)) {
coex_err("fail to send one coex config");
ret = status;
}
}
return ret;
}
QDF_STATUS
wlan_coex_config_updated(struct wlan_objmgr_vdev *vdev, uint8_t type)
{
struct wlan_objmgr_psoc *psoc;
struct coex_psoc_obj *coex_obj;
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (!vdev) {
coex_err("NULL vdev");
return QDF_STATUS_E_INVAL;
}
if (type >= COEX_CONFIG_TYPE_MAX) {
coex_err("config type out of range: %d", type);
return QDF_STATUS_E_INVAL;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("NULL psoc");
return QDF_STATUS_E_INVAL;
}
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj)
return QDF_STATUS_E_INVAL;
if (coex_obj->coex_config_updated[type])
status = coex_obj->coex_config_updated[type](vdev);
return status;
}
QDF_STATUS
wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode val)
{
struct coex_psoc_obj *coex_obj;
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj)
return QDF_STATUS_E_INVAL;
coex_obj->btc_chain_mode = val;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode *val)
{
struct coex_psoc_obj *coex_obj;
if (!val) {
coex_err("invalid param for getting btc chain mode");
return QDF_STATUS_E_INVAL;
}
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj)
return QDF_STATUS_E_INVAL;
*val = coex_obj->btc_chain_mode;
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_DBAM_CONFIG
QDF_STATUS wlan_dbam_config_send(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param)
{
QDF_STATUS status;
status = tgt_send_dbam_config(vdev, param);
if (QDF_IS_STATUS_ERROR(status))
coex_err("failed to send dbam config");
return status;
}
QDF_STATUS wlan_dbam_attach(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_dbam_tx_ops *dbam_tx_ops;
if (!psoc) {
coex_err("psoc is Null");
return QDF_STATUS_E_NULL_VALUE;
}
dbam_tx_ops = wlan_psoc_get_dbam_tx_ops(psoc);
if (!dbam_tx_ops) {
coex_err("dbam_tx_ops is Null");
return QDF_STATUS_E_NULL_VALUE;
}
if (!dbam_tx_ops->dbam_event_attach) {
coex_err("dbam_event_attach function is Null");
return QDF_STATUS_E_NULL_VALUE;
}
return dbam_tx_ops->dbam_event_attach(psoc);
}
QDF_STATUS wlan_dbam_detach(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_dbam_tx_ops *dbam_tx_ops;
if (!psoc) {
coex_err("psoc is Null");
return QDF_STATUS_E_NULL_VALUE;
}
dbam_tx_ops = wlan_psoc_get_dbam_tx_ops(psoc);
if (!dbam_tx_ops) {
coex_err("dbam_tx_ops is Null");
return QDF_STATUS_E_NULL_VALUE;
}
if (!dbam_tx_ops->dbam_event_detach) {
coex_err("dbam_event_detach function is Null");
return QDF_STATUS_E_NULL_VALUE;
}
return dbam_tx_ops->dbam_event_detach(psoc);
}
#endif

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains coex south bound interface definitions
*/
#ifndef _WLAN_COEX_TGT_API_H_
#define _WLAN_COEX_TGT_API_H_
#ifdef WLAN_FEATURE_DBAM_CONFIG
#include "wlan_coex_public_structs.h"
#endif
#ifdef FEATURE_COEX
struct coex_config_params;
struct coex_multi_config;
/**
* tgt_send_coex_config() - invoke target_if send coex config
* @vdev: vdev object
* @param: coex config parameters
*
* Return: QDF_STATUS
*/
QDF_STATUS
tgt_send_coex_config(struct wlan_objmgr_vdev *vdev,
struct coex_config_params *param);
/**
* tgt_send_coex_multi_config() - invoke target_if send coex multiple config
* @vdev: vdev object
* @param: coex multiple config parameters
*
* Return: QDF_STATUS
*/
QDF_STATUS
tgt_send_coex_multi_config(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param);
/**
* tgt_get_coex_multi_config_support() - invoke target_if get coex multiple
* configure support
* @psoc: PSOC object
*
* Return: true if target support coex multiple config command
*/
bool
tgt_get_coex_multi_config_support(struct wlan_objmgr_psoc *psoc);
#endif
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* tgt_send_dbam_config() - invoke target_if send dbam config
* @vdev: vdev object
* @param: dbam config parameters
*
* Return: QDF_STATUS
*/
QDF_STATUS
tgt_send_dbam_config(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param);
#endif
#endif

View File

@ -0,0 +1,198 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains coex north bound interface declarations
*/
#ifndef _WLAN_COEX_UCFG_API_H_
#define _WLAN_COEX_UCFG_API_H_
#include "qdf_status.h"
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_objmgr_psoc_obj.h>
#include "wlan_coex_public_structs.h"
/**
* enum coex_btc_chain_mode - btc chain mode definitions
* @WLAN_COEX_BTC_CHAIN_MODE_SHARED: chains of BT and WLAN 2.4 GHz are shared.
* @WLAN_COEX_BTC_CHAIN_MODE_FDD: chains of BT and WLAN 2.4 GHz are
* separated, FDD mode.
* @WLAN_COEX_BTC_CHAIN_MODE_HYBRID: chains of BT and WLAN 2.4 GHz are
* separated, hybrid mode.
* @WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED: chain mode is not set.
*/
enum coex_btc_chain_mode {
WLAN_COEX_BTC_CHAIN_MODE_SHARED = 0,
WLAN_COEX_BTC_CHAIN_MODE_FDD,
WLAN_COEX_BTC_CHAIN_MODE_HYBRID,
WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED = 0xFF,
};
/**
* enum coex_config_type - coex config type definitions
* @COEX_CONFIG_BTC_CHAIN_MODE: config BT coex chain mode
* @COEX_CONFIG_TYPE_MAX: max value
*/
enum coex_config_type {
COEX_CONFIG_BTC_CHAIN_MODE,
/* keep last */
COEX_CONFIG_TYPE_MAX,
};
/**
* typedef update_coex_cb() - cb to inform coex config
* @vdev: vdev pointer
*
* Return: void
*/
typedef QDF_STATUS (*update_coex_cb)(struct wlan_objmgr_vdev *vdev);
#ifdef FEATURE_COEX
/**
* ucfg_coex_register_cfg_updated_handler() - API to register coex config
* updated handler.
* @psoc: pointer to psoc object
* @type: type of coex config
* @handler: handler to be registered
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
enum coex_config_type type,
update_coex_cb handler);
/**
* ucfg_coex_psoc_set_btc_chain_mode() - API to set BT coex chain mode for psoc
* @psoc: pointer to psoc object
* @val: BT coex chain mode
*
* Return : status of operation
*/
QDF_STATUS
ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode val);
/**
* ucfg_coex_psoc_get_btc_chain_mode() - API to get BT coex chain mode from psoc
* @psoc: pointer to psoc object
* @val: pointer to BT coex chain mode
*
* Return : status of operation
*/
QDF_STATUS
ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode *val);
/**
* ucfg_coex_send_btc_chain_mode() - API to send BT coex config to target if
* @vdev: pointer to vdev object
* @mode: BT coex chain mode
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
enum coex_btc_chain_mode mode);
/**
* ucfg_coex_send_multi_config() - API to send coex multiple config to target
* @vdev: pointer to vdev object
* @param: pointer to coex multiple config parameters
*
* Return: status of operation
*/
QDF_STATUS
ucfg_coex_send_multi_config(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param);
/**
* ucfg_coex_send_logging_config() - API to send BT coex logging config to
* target if
* @psoc: pointer to psoc object
* @apps_args: pointer to argument
*
* Return : status of operation
*/
QDF_STATUS
ucfg_coex_send_logging_config(struct wlan_objmgr_psoc *psoc,
uint32_t *apps_args);
#else
static inline QDF_STATUS
ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
enum coex_config_type type,
update_coex_cb handler)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode *val)
{
if (val)
*val = WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
enum coex_btc_chain_mode mode)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
ucfg_coex_send_multi_config(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param)
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
ucfg_coex_send_logging_config(struct wlan_objmgr_psoc *psoc,
uint32_t *apps_args)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* ucfg_coex_send_dbam_config() - API to send dbam config to target if
* @vdev: pointer to vdev object
* @param: DBAM config mode params
* @clbk: dbam config response callback
* @context: request manager context
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS
ucfg_coex_send_dbam_config(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param,
void (*clbk)(void *ctx,
enum coex_dbam_comp_status *rsp),
void *context);
#else
static inline QDF_STATUS
ucfg_coex_send_dbam_config(void)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif
#endif

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_coex_utils_api.h
*
* This header file provides declaration of public APIs exposed to other UMAC
* components.
*/
#ifndef _WLAN_COEX_UTILS_API_H_
#define _WLAN_COEX_UTILS_API_H_
#include <wlan_objmgr_psoc_obj.h>
/*
* wlan_coex_init() - Coex module initialization API
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_coex_init(void);
/*
* wlan_coex_deinit() - Coex module deinitialization API
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_coex_deinit(void);
/**
* wlan_coex_psoc_open() - Open coex component
* @psoc: soc context
*
* This function gets called when dispatcher opening.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS
wlan_coex_psoc_open(struct wlan_objmgr_psoc *psoc);
/**
* wlan_coex_psoc_close() - Close coex component
* @psoc: soc context
*
* This function gets called when dispatcher closing.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS
wlan_coex_psoc_close(struct wlan_objmgr_psoc *psoc);
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* wlan_dbam_psoc_enable() - API to enable coex dbam psoc component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc enable.
* This API will register dbam WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dbam_psoc_enable(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dbam_psoc_disable() - API to disable coex dbam psoc component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc disable.
* This API will unregister dbam WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dbam_psoc_disable(struct wlan_objmgr_psoc *psoc);
#endif /* WLAN_FEATURE_DBAM_CONFIG */
#endif

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains coex south bound interface definitions
*/
#include <wlan_coex_main.h>
#include <wlan_coex_tgt_api.h>
#include <wlan_lmac_if_def.h>
#include "wlan_objmgr_pdev_obj.h"
static inline struct wlan_lmac_if_coex_tx_ops *
wlan_psoc_get_coex_txops(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_tx_ops *tx_ops;
tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
if (!tx_ops) {
coex_err("tx_ops is NULL");
return NULL;
}
return &tx_ops->coex_ops;
}
static inline struct wlan_lmac_if_coex_tx_ops *
wlan_vdev_get_coex_txops(struct wlan_objmgr_vdev *vdev)
{
struct wlan_objmgr_psoc *psoc;
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("NULL psoc");
return NULL;
}
return wlan_psoc_get_coex_txops(psoc);
}
QDF_STATUS
tgt_send_coex_config(struct wlan_objmgr_vdev *vdev,
struct coex_config_params *param)
{
struct wlan_lmac_if_coex_tx_ops *coex_ops;
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
if (!vdev) {
coex_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("NULL psoc");
return QDF_STATUS_E_NULL_VALUE;
}
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev) {
coex_err("NULL pdev");
return QDF_STATUS_E_NULL_VALUE;
}
coex_ops = wlan_psoc_get_coex_txops(psoc);
if (coex_ops && coex_ops->coex_config_send)
return coex_ops->coex_config_send(pdev, param);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
tgt_send_coex_multi_config(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param)
{
struct wlan_lmac_if_coex_tx_ops *coex_ops;
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
if (!vdev) {
coex_err("NULL vdev");
return QDF_STATUS_E_NULL_VALUE;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("NULL psoc");
return QDF_STATUS_E_NULL_VALUE;
}
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev) {
coex_err("NULL pdev");
return QDF_STATUS_E_NULL_VALUE;
}
coex_ops = wlan_psoc_get_coex_txops(psoc);
if (coex_ops && coex_ops->coex_multi_config_send)
return coex_ops->coex_multi_config_send(pdev, param);
return QDF_STATUS_SUCCESS;
}
bool
tgt_get_coex_multi_config_support(struct wlan_objmgr_psoc *psoc)
{
struct wlan_lmac_if_coex_tx_ops *coex_ops;
coex_ops = wlan_psoc_get_coex_txops(psoc);
if (coex_ops && coex_ops->coex_get_multi_config_support)
return coex_ops->coex_get_multi_config_support(psoc);
return false;
}
#ifdef WLAN_FEATURE_DBAM_CONFIG
QDF_STATUS
tgt_send_dbam_config(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param)
{
struct wlan_lmac_if_dbam_tx_ops *dbam_tx_ops;
struct wlan_objmgr_psoc *psoc;
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("NULL psoc");
return QDF_STATUS_E_NULL_VALUE;
}
dbam_tx_ops = wlan_psoc_get_dbam_tx_ops(psoc);
if (dbam_tx_ops && dbam_tx_ops->set_dbam_config)
return dbam_tx_ops->set_dbam_config(psoc, param);
return QDF_STATUS_SUCCESS;
}
#endif

View File

@ -0,0 +1,167 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains coex north bound interface definitions
*/
#include <wlan_coex_main.h>
#include <wlan_coex_ucfg_api.h>
#include "wmi_unified.h"
#include "wlan_coex_public_structs.h"
#include "wlan_coex_tgt_api.h"
QDF_STATUS
ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
enum coex_config_type type,
update_coex_cb handler)
{
struct coex_psoc_obj *coex_obj;
if (type >= COEX_CONFIG_TYPE_MAX) {
coex_err("invalid coex type: %d", type);
return QDF_STATUS_E_INVAL;
}
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj)
return QDF_STATUS_E_INVAL;
coex_obj->coex_config_updated[type] = handler;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode val)
{
return wlan_coex_psoc_set_btc_chain_mode(psoc, val);
}
QDF_STATUS
ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
enum coex_btc_chain_mode *val)
{
return wlan_coex_psoc_get_btc_chain_mode(psoc, val);
}
QDF_STATUS
ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
enum coex_btc_chain_mode mode)
{
struct coex_config_params param = {0};
if (mode > WLAN_COEX_BTC_CHAIN_MODE_HYBRID)
return QDF_STATUS_E_INVAL;
param.vdev_id = wlan_vdev_get_id(vdev);
param.config_type = WMI_COEX_CONFIG_BTCOEX_SEPARATE_CHAIN_MODE;
param.config_arg1 = mode;
coex_debug("send btc chain mode %d for vdev %d", mode, param.vdev_id);
return wlan_coex_config_send(vdev, &param);
}
QDF_STATUS
ucfg_coex_send_multi_config(struct wlan_objmgr_vdev *vdev,
struct coex_multi_config *param)
{
return wlan_coex_multi_config_send(vdev, param);
}
#ifdef WLAN_FEATURE_DBAM_CONFIG
QDF_STATUS
ucfg_coex_send_dbam_config(struct wlan_objmgr_vdev *vdev,
struct coex_dbam_config_params *param,
void (*clbk)(void *ctx,
enum coex_dbam_comp_status *rsp),
void *context)
{
struct wlan_objmgr_psoc *psoc;
struct coex_psoc_obj *coex_obj;
struct wlan_coex_callback *cbk;
if (!vdev) {
coex_err("Null vdev");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
coex_err("psoc is null");
return QDF_STATUS_E_INVAL;
}
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj) {
coex_err("failed to get coex_obj");
return QDF_STATUS_E_INVAL;
}
cbk = &coex_obj->cb;
cbk->set_dbam_config_cb = clbk;
cbk->set_dbam_config_ctx = context;
coex_debug("send dbam config mode %d for vdev_id %d",
param->dbam_mode, param->vdev_id);
return wlan_dbam_config_send(vdev, param);
}
#endif
#define COEX_CONFIG_ENABLE_CONT_INFO 12
QDF_STATUS
ucfg_coex_send_logging_config(struct wlan_objmgr_psoc *psoc,
uint32_t *apps_args)
{
struct coex_config_params param = {0};
struct wlan_objmgr_vdev *vdev;
QDF_STATUS status;
if (apps_args[0] != COEX_CONFIG_ENABLE_CONT_INFO) {
coex_err("invalid cmd %d", apps_args[0]);
return QDF_STATUS_E_FAILURE;
}
vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(psoc, QDF_STA_MODE,
WLAN_COEX_ID);
if (!vdev) {
coex_err("vdev is null");
return QDF_STATUS_E_INVAL;
}
param.vdev_id = wlan_vdev_get_id(vdev);
param.config_type = WMI_COEX_CONFIG_ENABLE_CONT_INFO;
param.config_arg1 = apps_args[1];
param.config_arg2 = apps_args[2];
param.config_arg3 = apps_args[3];
param.config_arg4 = apps_args[4];
param.config_arg5 = apps_args[5];
param.config_arg6 = apps_args[6];
coex_debug("send logging_config arg: %u for vdev %d", *apps_args,
param.vdev_id);
status = wlan_coex_config_send(vdev, &param);
wlan_objmgr_vdev_release_ref(vdev, WLAN_COEX_ID);
return status;
}

View File

@ -0,0 +1,147 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_coex_utils_api.c
*
* This file provides definitions of public APIs exposed to other UMAC
* components.
*/
#include <wlan_coex_main.h>
#include <wlan_objmgr_global_obj.h>
#include <wlan_coex_utils_api.h>
#include "cfg_ucfg_api.h"
QDF_STATUS wlan_coex_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_COEX,
wlan_coex_psoc_created_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
coex_err("Failed to register psoc create handler");
goto fail_create_psoc;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_COEX,
wlan_coex_psoc_destroyed_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
coex_err("Failed to create psoc delete handler");
goto fail_psoc_destroy;
}
coex_debug("coex psoc create and delete handler registered");
return status;
fail_psoc_destroy:
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_COEX,
wlan_coex_psoc_created_notification, NULL);
fail_create_psoc:
return status;
}
QDF_STATUS wlan_coex_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_COEX,
wlan_coex_psoc_destroyed_notification, NULL);
if (status != QDF_STATUS_SUCCESS)
coex_err("Failed to unregister psoc delete handler");
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_COEX,
wlan_coex_psoc_created_notification, NULL);
if (status != QDF_STATUS_SUCCESS)
coex_err("Failed to unregister psoc create handler");
return status;
}
#ifdef FEATURE_BTC_CHAIN_MODE
/**
* wlan_coex_set_btc_chain_mode_with_ini() - set BTC init chain mode
* with ini
* @psoc: pointer to psoc object
*
* This function is used to set BTC init chain mode with ini
*
* Return: None
*/
static void
wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
{
enum coex_btc_chain_mode btc_chain_mode;
QDF_STATUS status;
status = wlan_coex_psoc_get_btc_chain_mode(psoc, &btc_chain_mode);
if (QDF_IS_STATUS_ERROR(status)) {
coex_err("error for getting btc chain mode");
return;
}
if (btc_chain_mode == WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
btc_chain_mode = cfg_get(psoc, CFG_SET_INIT_CHAIN_MODE_FOR_BTC);
if (btc_chain_mode > WLAN_COEX_BTC_CHAIN_MODE_HYBRID &&
btc_chain_mode != WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
coex_err("invalid ini config %d for btc chain mode",
btc_chain_mode);
return;
}
status = wlan_coex_psoc_set_btc_chain_mode(psoc,
btc_chain_mode);
if (QDF_IS_STATUS_ERROR(status))
coex_err("error for setting btc init chain mode from ini");
}
}
#else
static void
wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
{
}
#endif
QDF_STATUS
wlan_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
{
wlan_coex_set_btc_chain_mode_with_ini(psoc);
return wlan_coex_psoc_init(psoc);
}
QDF_STATUS
wlan_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
{
return wlan_coex_psoc_deinit(psoc);
}
#ifdef WLAN_FEATURE_DBAM_CONFIG
QDF_STATUS wlan_dbam_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
return wlan_dbam_attach(psoc);
}
QDF_STATUS wlan_dbam_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
return wlan_dbam_detach(psoc);
}
#endif

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_ext_cp_stats_types.h
*
* This header file is included by the converged control path statistics
* component to map legacy statistic structures to the external
* (ext)typedefs used by the converged code. This mechanism allows the
* legacy structs to be included as part of the global objmgr objects.
*/
#ifndef __WLAN_EXT_CP_STATS_TYPE_H__
#define __WLAN_EXT_CP_STATS_TYPE_H__
/**
* typedef psoc_ext_cp_stats_t - Definition of psoc cp stats pointer
* Define obj_stats from external umac/cp_stats component point to this type
*/
typedef struct psoc_mc_cp_stats psoc_ext_cp_stats_t;
/**
* typedef pdev_ext_cp_stats_t - Definition of pdev cp stats pointer
* Define pdev_stats from external umac/cp_stats component point to this type
*/
typedef struct pdev_mc_cp_stats pdev_ext_cp_stats_t;
/**
* typedef vdev_ext_cp_stats_t - Definition of vdev cp stats pointer
* Define vdev_stats from external umac/cp_stats component point to this type
*/
typedef struct vdev_mc_cp_stats vdev_ext_cp_stats_t;
/**
* typedef peer_ext_cp_stats_t - Definition of peer cp stats pointer
* Define peer_stats from external umac/cp_stats component point to this type
*/
typedef struct peer_mc_cp_stats peer_ext_cp_stats_t;
/**
* typedef peer_ext_adv_cp_stats_t - Definition of peer adv cp stats pointer
* Define peer_adv_stats from external umac/cp_stats component point to this
* type
*/
typedef struct peer_adv_mc_cp_stats peer_ext_adv_cp_stats_t;
#endif /* __WLAN_EXT_CP_STATS_TYPE_H__ */

View File

@ -0,0 +1,875 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_cp_stats_mc_defs.h
*
* This file provide definition for structure/enums/defines related to control
* path stats component
*/
#ifndef __WLAN_CP_STATS_MC_DEFS_H__
#define __WLAN_CP_STATS_MC_DEFS_H__
#include "wlan_cmn.h"
#include "qdf_event.h"
/* For WMI_MAX_CHAINS */
#include "wmi_unified.h"
#include "wlan_mlo_mgr_cmn.h"
#ifdef QCA_SUPPORT_MC_CP_STATS
#include "wlan_cp_stats_public_structs.h"
#endif
#ifdef WLAN_SUPPORT_TWT
#include <wmi_unified_twt_param.h>
/* Max TWT sessions per peer (supported by fw) */
#define TWT_PEER_MAX_SESSIONS 1
#endif /* WLAN_SUPPORT_TWT */
#define MAX_NUM_CHAINS 2
#define MAX_MIB_STATS 1
#define IS_MSB_SET(__num) ((__num) & BIT(31))
#define IS_LSB_SET(__num) ((__num) & BIT(0))
#define VDEV_ALL 0xFF
/**
* enum stats_req_type - enum indicating bit position of various stats type in
* request map
* @TYPE_CONNECTION_TX_POWER: tx power was requested
* @TYPE_STATION_STATS: station stats was requested
* @TYPE_PEER_STATS: peer stats was requested
* @TYPE_MIB_STATS: MIB stats was requested
* @TYPE_PEER_STATS_INFO_EXT: peer stats info ext was requested
* @TYPE_CONGESTION_STATS: congestion stats was requested
* @TYPE_BIG_DATA_STATS: big data stats was requested
* @TYPE_MAX: maximum value
*/
enum stats_req_type {
TYPE_CONNECTION_TX_POWER = 0,
TYPE_STATION_STATS,
TYPE_PEER_STATS,
TYPE_MIB_STATS,
TYPE_PEER_STATS_INFO_EXT,
TYPE_CONGESTION_STATS,
TYPE_BIG_DATA_STATS,
TYPE_MAX,
};
/**
* enum tx_rate_info - tx rate flags
* @TX_RATE_LEGACY: Legacy rates
* @TX_RATE_HT20: HT20 rates
* @TX_RATE_HT40: HT40 rates
* @TX_RATE_SGI: Rate with Short guard interval
* @TX_RATE_LGI: Rate with Long guard interval
* @TX_RATE_VHT20: VHT 20 rates
* @TX_RATE_VHT40: VHT 40 rates
* @TX_RATE_VHT80: VHT 80 rates
* @TX_RATE_HE20: HE 20 rates
* @TX_RATE_HE40: HE 40 rates
* @TX_RATE_HE80: HE 80 rates
* @TX_RATE_HE160: HE 160 rates
* @TX_RATE_VHT160: VHT 160 rates
* @TX_RATE_EHT20: EHT 20 rates
* @TX_RATE_EHT40: EHT 40 rates
* @TX_RATE_EHT80: EHT 80 rates
* @TX_RATE_EHT160: EHT 160 rates
* @TX_RATE_EHT320: EHT 320 rates
*/
enum tx_rate_info {
TX_RATE_LEGACY = 0x1,
TX_RATE_HT20 = 0x2,
TX_RATE_HT40 = 0x4,
TX_RATE_SGI = 0x8,
TX_RATE_LGI = 0x10,
TX_RATE_VHT20 = 0x20,
TX_RATE_VHT40 = 0x40,
TX_RATE_VHT80 = 0x80,
TX_RATE_HE20 = 0x100,
TX_RATE_HE40 = 0x200,
TX_RATE_HE80 = 0x400,
TX_RATE_HE160 = 0x800,
TX_RATE_VHT160 = 0x1000,
TX_RATE_EHT20 = 0x2000,
TX_RATE_EHT40 = 0x4000,
TX_RATE_EHT80 = 0x8000,
TX_RATE_EHT160 = 0x10000,
TX_RATE_EHT320 = 0x20000,
};
/**
* enum txrate_gi - Guard Intervals
* @TXRATE_GI_0_8_US: guard interval 0.8 us
* @TXRATE_GI_0_4_US: guard interval 0.4 us for legacy
* @TXRATE_GI_1_6_US: guard interval 1.6 us
* @TXRATE_GI_3_2_US: guard interval 3.2 us
*/
enum txrate_gi {
TXRATE_GI_0_8_US = 0,
TXRATE_GI_0_4_US,
TXRATE_GI_1_6_US,
TXRATE_GI_3_2_US,
};
/**
* struct wake_lock_stats - wake lock stats structure
* @ucast_wake_up_count: Unicast wakeup count
* @bcast_wake_up_count: Broadcast wakeup count
* @ipv4_mcast_wake_up_count: ipv4 multicast wakeup count
* @ipv6_mcast_wake_up_count: ipv6 multicast wakeup count
* @ipv6_mcast_ra_stats: ipv6 multicast ra stats
* @ipv6_mcast_ns_stats: ipv6 multicast ns stats
* @ipv6_mcast_na_stats: ipv6 multicast na stats
* @icmpv4_count: ipv4 icmp packet count
* @icmpv6_count: ipv6 icmp packet count
* @rssi_breach_wake_up_count: rssi breach wakeup count
* @low_rssi_wake_up_count: low rssi wakeup count
* @gscan_wake_up_count: gscan wakeup count
* @pno_complete_wake_up_count: pno complete wakeup count
* @pno_match_wake_up_count: pno match wakeup count
* @oem_response_wake_up_count: oem response wakeup count
* @uc_drop_wake_up_count: local data uc drop wakeup count
* @fatal_event_wake_up_count: fatal event wakeup count
* @pwr_save_fail_detected: pwr save fail detected wakeup count
* @scan_11d: 11d scan wakeup count
* @mgmt_assoc: association request management frame
* @mgmt_disassoc: disassociation management frame
* @mgmt_assoc_resp: association response management frame
* @mgmt_reassoc: reassociate request management frame
* @mgmt_reassoc_resp: reassociate response management frame
* @mgmt_auth: authentication management frame
* @mgmt_deauth: deauthentication management frame
* @mgmt_action: action management frame
*/
struct wake_lock_stats {
uint32_t ucast_wake_up_count;
uint32_t bcast_wake_up_count;
uint32_t ipv4_mcast_wake_up_count;
uint32_t ipv6_mcast_wake_up_count;
uint32_t ipv6_mcast_ra_stats;
uint32_t ipv6_mcast_ns_stats;
uint32_t ipv6_mcast_na_stats;
uint32_t icmpv4_count;
uint32_t icmpv6_count;
uint32_t rssi_breach_wake_up_count;
uint32_t low_rssi_wake_up_count;
uint32_t gscan_wake_up_count;
uint32_t pno_complete_wake_up_count;
uint32_t pno_match_wake_up_count;
uint32_t oem_response_wake_up_count;
uint32_t uc_drop_wake_up_count;
uint32_t fatal_event_wake_up_count;
uint32_t pwr_save_fail_detected;
uint32_t scan_11d;
uint32_t mgmt_assoc;
uint32_t mgmt_disassoc;
uint32_t mgmt_assoc_resp;
uint32_t mgmt_reassoc;
uint32_t mgmt_reassoc_resp;
uint32_t mgmt_auth;
uint32_t mgmt_deauth;
uint32_t mgmt_action;
};
struct stats_event;
/**
* struct big_data_stats_event - big data stats event param
* @vdev_id: vdev id
* @tsf_out_of_sync: tsf out of sync
* @ani_level: ani level
* @last_data_tx_pwr: tx pwr last data frm
* @target_power_dsss: tx power dsss
* @target_power_ofdm: target power ofdm
* @last_tx_data_rix: rx lateset data frame
* @last_tx_data_rate_kbps: tx latest data frame
*/
struct big_data_stats_event {
uint32_t vdev_id;
uint32_t tsf_out_of_sync;
int32_t ani_level;
uint32_t last_data_tx_pwr;
uint32_t target_power_dsss;
uint32_t target_power_ofdm;
uint32_t last_tx_data_rix;
uint32_t last_tx_data_rate_kbps;
};
/**
* struct medium_assess_data - medium assess data from firmware
* @part1_valid: the flag for part1 data, include cycle_count,
* rx_clear_count and tx_frame_count
* @cycle_count: accumulative cycle count (total time)
* @rx_clear_count: accumulative rx clear count (busy time)
* @tx_frame_count: accumulative tx frame count (total time)
* @part2_valid: the flag for part2 data, include my_rx_count
* @my_rx_count: my RX count
*/
struct medium_assess_data {
bool part1_valid;
uint32_t cycle_count;
uint32_t rx_clear_count;
uint32_t tx_frame_count;
bool part2_valid;
uint32_t my_rx_count;
};
/**
* struct request_info: details of each request
* @cookie: identifier for os_if request
* @u: unified data type for callback to process tx power/peer rssi/
* station stats/mib stats/peer stats request when response comes and
* congestion notification callback.
* @vdev_id: vdev_id of request
* @pdev_id: pdev_id of request
* @peer_mac_addr: peer mac address
* @ml_vdev_info: mlo_stats_vdev_params structure
* @ml_peer_mac_addr: Array of ml peer mac addresses
*/
struct request_info {
void *cookie;
union {
void (*get_tx_power_cb)(int tx_power, void *cookie);
void (*get_peer_rssi_cb)(struct stats_event *ev, void *cookie);
void (*get_station_stats_cb)(struct stats_event *ev,
void *cookie);
void (*get_mib_stats_cb)(struct stats_event *ev,
void *cookie);
void (*get_peer_stats_cb)(struct stats_event *ev,
void *cookie);
void (*congestion_notif_cb)(uint8_t vdev_id,
struct medium_assess_data *data,
bool last);
#ifdef WLAN_FEATURE_BIG_DATA_STATS
void (*get_big_data_stats_cb)(struct big_data_stats_event *ev,
void *cookie);
#endif
} u;
uint32_t vdev_id;
uint32_t pdev_id;
uint8_t peer_mac_addr[QDF_MAC_ADDR_SIZE];
#ifdef WLAN_FEATURE_11BE_MLO
struct mlo_stats_vdev_params ml_vdev_info;
uint8_t ml_peer_mac_addr[WLAN_UMAC_MLO_MAX_VDEVS][QDF_MAC_ADDR_SIZE];
#endif
};
/**
* struct pending_stats_requests: details of pending requests
* @type_map: map indicating type of outstanding requests
* @req: array of info for outstanding request of each type
*/
struct pending_stats_requests {
uint32_t type_map;
struct request_info req[TYPE_MAX];
};
/**
* struct cca_stats - cca stats
* @congestion: the congestion percentage = (busy_time/total_time)*100
* for the interval from when the vdev was started to the current time
* (or the time at which the vdev was stopped).
*/
struct cca_stats {
uint32_t congestion;
};
/**
* struct psoc_mc_cp_stats: psoc specific stats
* @is_cp_stats_suspended: is cp stats suspended or not
* @pending: details of pending requests
* @wow_unspecified_wake_up_count: number of non-wow related wake ups
* @wow_stats: wake_lock stats for vdev
* @big_data_fw_support_enable: big data feature supported by fw or not
*/
struct psoc_mc_cp_stats {
bool is_cp_stats_suspended;
struct pending_stats_requests pending;
uint32_t wow_unspecified_wake_up_count;
struct wake_lock_stats wow_stats;
#ifdef WLAN_FEATURE_BIG_DATA_STATS
bool big_data_fw_support_enable;
#endif
};
/**
* struct pdev_mc_cp_extd_stats - pdev extd stats
* @pdev_id: pdev id
* @my_rx_count: What portion of time, as measured by the MAC HW clock was
* occupied, by receiving PPDUs addressed to one of the vdevs
* within this pdev.
* @rx_matched_11ax_msdu_cnt: number of Rx 11ax MSDUs with matching BSS color
* counter updated at EOP (end of packet)
* @rx_other_11ax_msdu_cnt: number of Rx 11ax MSDUs with other BSS color counter
* updated at EOP (end of packet)
*/
struct pdev_mc_cp_extd_stats {
uint32_t pdev_id;
uint32_t my_rx_count;
uint32_t rx_matched_11ax_msdu_cnt;
uint32_t rx_other_11ax_msdu_cnt;
};
/* Max supported bandwidth is 320Mhz, so max 16 subbands for 20Mhz */
#define MAX_WIDE_BAND_SCAN_CHAN 16
/**
* struct wide_band_scan_chan_info - wide band scan channel info
* @vdev_id: vdev id
* @num_chan: number of channels (for each subbands fo 20Mhz)
* @is_wide_band_scan: wide band scan or not
* @cca_busy_subband_info: CCA busy for each possible 20Mhz subbands
* of the wideband scan channel
*/
struct wide_band_scan_chan_info {
uint32_t vdev_id;
uint8_t num_chan;
bool is_wide_band_scan;
uint32_t cca_busy_subband_info[MAX_WIDE_BAND_SCAN_CHAN];
};
/**
* struct channel_status
* @channel_freq: Channel freq
* @noise_floor: Noise Floor value
* @rx_clear_count: rx clear count
* @cycle_count: cycle count
* @chan_tx_pwr_range: channel tx power per range in 0.5dBm steps
* @chan_tx_pwr_throughput: channel tx power per throughput
* @rx_frame_count: rx frame count (cumulative)
* @bss_rx_cycle_count: BSS rx cycle count
* @rx_11b_mode_data_duration: b-mode data rx time (units are microseconds)
* @tx_frame_count: BSS tx cycle count
* @mac_clk_mhz: sample frequency
* @channel_id: channel index
* @cmd_flags: indicate which stat event is this status coming from
* @subband_info: wide band scan channel info
*/
struct channel_status {
uint32_t channel_freq;
uint32_t noise_floor;
uint32_t rx_clear_count;
uint32_t cycle_count;
uint32_t chan_tx_pwr_range;
uint32_t chan_tx_pwr_throughput;
uint32_t rx_frame_count;
uint32_t bss_rx_cycle_count;
uint32_t rx_11b_mode_data_duration;
uint32_t tx_frame_count;
uint32_t mac_clk_mhz;
uint32_t channel_id;
uint32_t cmd_flags;
struct wide_band_scan_chan_info subband_info;
};
/**
* struct per_channel_stats
* @total_channel: total number of be scanned channel
* @channel_status_list: channel status info store in this array
*/
struct per_channel_stats {
uint8_t total_channel;
struct channel_status
channel_status_list[NUM_CHANNELS];
};
/**
* struct pdev_mc_cp_stats: pdev specific stats
* @max_pwr: max tx power for pdev
* @pdev_id: pdev id
* @rx_clear_count: accumulative rx clear count (busy time) of pdev
* @cycle_count: accumulative cycle count (total time) of pdev
* @tx_frame_count: accumulative tx frame count (total time) of pdev
* @chan_stats: per channel info stats
*/
struct pdev_mc_cp_stats {
int32_t max_pwr;
uint32_t pdev_id;
uint32_t rx_clear_count;
uint32_t cycle_count;
uint32_t tx_frame_count;
struct per_channel_stats chan_stats;
};
/**
* struct summary_stats - summary stats
* @snr: snr of vdev
* @rssi: rssi of vdev
* @retry_cnt: retry count
* @multiple_retry_cnt: multiple_retry_cnt
* @tx_frm_cnt: num of tx frames
* @rx_frm_cnt: num of rx frames
* @frm_dup_cnt: duplicate frame count
* @fail_cnt: fail count
* @rts_fail_cnt: rts fail count
* @ack_fail_cnt: ack fail count
* @rts_succ_cnt: rts success count
* @rx_discard_cnt: rx frames discarded
* @rx_error_cnt: rx frames with error
*/
struct summary_stats {
uint32_t snr;
int8_t rssi;
uint32_t retry_cnt[4];
uint32_t multiple_retry_cnt[4];
uint32_t tx_frm_cnt[4];
uint32_t rx_frm_cnt;
uint32_t frm_dup_cnt;
uint32_t fail_cnt[4];
uint32_t rts_fail_cnt;
uint32_t ack_fail_cnt;
uint32_t rts_succ_cnt;
uint32_t rx_discard_cnt;
uint32_t rx_error_cnt;
};
/**
* struct pmf_bcn_protect_stats - pmf bcn protect stats param
* @pmf_bcn_stats_valid: bcn protect stats received from fw are valid or not
* @igtk_mic_fail_cnt: MIC failure count of management packets using IGTK
* @igtk_replay_cnt: Replay detection count of management packets using IGTK
* @bcn_mic_fail_cnt: MIC failure count of beacon packets using BIGTK
* @bcn_replay_cnt: Replay detection count of beacon packets using BIGTK
*/
struct pmf_bcn_protect_stats {
bool pmf_bcn_stats_valid;
uint32_t igtk_mic_fail_cnt;
uint32_t igtk_replay_cnt;
uint32_t bcn_mic_fail_cnt;
uint32_t bcn_replay_cnt;
};
/**
* struct vdev_summary_extd_stats - vdev summary extended stats
* @vdev_id: vdev_id of the event
* @is_mlo_vdev_active: is the mlo vdev currently active
* @vdev_tx_power: vdev tx power
*/
struct vdev_summary_extd_stats {
uint8_t vdev_id;
bool is_mlo_vdev_active;
uint32_t vdev_tx_power;
};
/**
* struct vdev_mc_cp_stats - vdev specific stats
* @cca: cca stats
* @tx_rate_flags: tx rate flags (enum tx_rate_info)
* @chain_rssi: chain rssi
* @vdev_summary_stats: vdev's summary stats
* @pmf_bcn_stats: pmf beacon protect stats
* @vdev_extd_stats: vdev summary extended stats
*/
struct vdev_mc_cp_stats {
struct cca_stats cca;
uint32_t tx_rate_flags;
int8_t chain_rssi[MAX_NUM_CHAINS];
struct summary_stats vdev_summary_stats;
struct pmf_bcn_protect_stats pmf_bcn_stats;
struct vdev_summary_extd_stats vdev_extd_stats;
};
/**
* struct peer_extd_stats - Peer extension statistics
* @peer_macaddr: peer MAC address
* @rx_duration: lower 32 bits of rx duration in microseconds
* @peer_tx_bytes: Total TX bytes (including dot11 header) sent to peer
* @peer_rx_bytes: Total RX bytes (including dot11 header) received from peer
* @last_tx_rate_code: last TX ratecode
* @last_tx_power: TX power used by peer - units are 0.5 dBm
* @rx_mc_bc_cnt: Total number of received multicast & broadcast data frames
* corresponding to this peer, 1 in the MSB of rx_mc_bc_cnt represents a
* valid data
*/
struct peer_extd_stats {
uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
uint32_t rx_duration;
uint32_t peer_tx_bytes;
uint32_t peer_rx_bytes;
uint32_t last_tx_rate_code;
int32_t last_tx_power;
uint32_t rx_mc_bc_cnt;
};
/**
* struct peer_mc_cp_stats - peer specific stats
* @tx_rate: tx rate
* @rx_rate: rx rate
* @peer_rssi: rssi
* @peer_macaddr: mac address
* @extd_stats: Pointer to peer extended stats
* @adv_stats: Pointer to peer adv (extd2) stats
* @twt_param: Pointer to peer twt session parameters
*/
struct peer_mc_cp_stats {
uint32_t tx_rate;
uint32_t rx_rate;
int8_t peer_rssi;
uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
struct peer_extd_stats *extd_stats;
struct peer_adv_mc_cp_stats *adv_stats;
#ifdef WLAN_SUPPORT_TWT
struct wmi_host_twt_session_stats_info twt_param[TWT_PEER_MAX_SESSIONS];
#endif
};
/**
* struct peer_adv_mc_cp_stats - peer specific adv stats
* @peer_macaddr: mac address
* @fcs_count: fcs count
* @rx_bytes: rx bytes
* @rx_count: rx count
*/
struct peer_adv_mc_cp_stats {
uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
uint32_t fcs_count;
uint32_t rx_count;
uint64_t rx_bytes;
};
#ifdef WLAN_FEATURE_MIB_STATS
/**
* struct dot11_counters - mib group containing attributes that are MAC counters
* @tx_frags: successfully transmitted fragments
* @group_tx_frames: transmitted group addressed frames
* @failed_cnt: MSDUs not transmitted successfully
* @rx_frags: fragments successfully received
* @group_rx_frames: group addressed frames received
* @fcs_error_cnt: FCS errors detected
* @tx_frames: frames successfully transmitted
*/
struct dot11_counters {
uint32_t tx_frags;
uint32_t group_tx_frames;
uint32_t failed_cnt;
uint32_t rx_frags;
uint32_t group_rx_frames;
uint32_t fcs_error_cnt;
uint32_t tx_frames;
};
/**
* struct dot11_mac_statistics - mib stats information on the operation of MAC
* @retry_cnt: retries done by mac for successful transmission
* @multi_retry_cnt: multiple retries done before successful transmission
* @frame_dup_cnt: duplicate no of frames
* @rts_success_cnt: number of CTS received (in response to RTS)
* @rts_fail_cnt: number of CTS not received (in response to RTS)
* @tx_ack_fail_cnt: number of ACK not received
*/
struct dot11_mac_statistics {
uint32_t retry_cnt;
uint32_t multi_retry_cnt;
uint32_t frame_dup_cnt;
uint32_t rts_success_cnt;
uint32_t rts_fail_cnt;
uint32_t tx_ack_fail_cnt;
};
/**
* struct dot11_qos_counters - qos mac counters
* @qos_tx_frag_cnt: transmitted QoS fragments
* @qos_failed_cnt: failed Qos fragments
* @qos_retry_cnt: Qos frames transmitted after retransmissions
* @qos_multi_retry_cnt: Qos frames transmitted after more than
* one retransmissions
* @qos_frame_dup_cnt: duplicate frames
* @qos_rts_success_cnt: number of CTS received (in response to RTS)
* @qos_rts_fail_cnt: number of CTS not received (in response to RTS)
* @tx_qos_ack_fail_cnt_up: number of ACK not received
* (in response to Qos frame)
* @qos_rx_frag_cnt: number of received MPDU of type Data
* @qos_tx_frame_cnt: number of transmitted MPDU of type Data
* @qos_discarded_frame_cnt: total Discarded MSDUs
* @qos_mpdu_rx_cnt: total received MPDU
* @qos_retries_rx_cnt: received MPDU with retry bit equal to 1
*/
struct dot11_qos_counters {
uint32_t qos_tx_frag_cnt;
uint32_t qos_failed_cnt;
uint32_t qos_retry_cnt;
uint32_t qos_multi_retry_cnt;
uint32_t qos_frame_dup_cnt;
uint32_t qos_rts_success_cnt;
uint32_t qos_rts_fail_cnt;
uint32_t tx_qos_ack_fail_cnt_up;
uint32_t qos_rx_frag_cnt;
uint32_t qos_tx_frame_cnt;
uint32_t qos_discarded_frame_cnt;
uint32_t qos_mpdu_rx_cnt;
uint32_t qos_retries_rx_cnt;
};
/**
* struct dot11_rsna_stats - mib rsn stats
* @rm_ccmp_replays: received robust management CCMP MPDUs discarded
* by the replay mechanism
* @tkip_icv_err: TKIP ICV errors encountered
* @tkip_replays: TKIP replay errors detected
* @ccmp_decrypt_err: MPDUs discarded by the CCMP decryption algorithm
* @ccmp_replays: received CCMP MPDUs discarded by the replay mechanism
* @cmac_icv_err: MPDUs discarded by the CMAC integrity check algorithm
* @cmac_replays: MPDUs discarded by the CMAC replay errors
*/
struct dot11_rsna_stats {
uint32_t rm_ccmp_replays;
uint32_t tkip_icv_err;
uint32_t tkip_replays;
uint32_t ccmp_decrypt_err;
uint32_t ccmp_replays;
uint32_t cmac_icv_err;
uint32_t cmac_replays;
};
/**
* struct dot11_counters_group3 - dot11 group3 stats
* @tx_ampdu_cnt: transmitted AMPDUs
* @tx_mpdus_in_ampdu_cnt: number of MPDUs in the A-MPDU in transmitted AMPDUs
* @tx_octets_in_ampdu_cnt: octets in the transmitted A-MPDUs
* @ampdu_rx_cnt: received A-MPDU
* @mpdu_in_rx_ampdu_cnt: MPDUs received in the A-MPDU
* @rx_octets_in_ampdu_cnt: octets in the received A-MPDU
* @rx_ampdu_deli_crc_err_cnt: number of MPDUs delimiter with CRC error
*/
struct dot11_counters_group3 {
uint32_t tx_ampdu_cnt;
uint32_t tx_mpdus_in_ampdu_cnt;
uint64_t tx_octets_in_ampdu_cnt;
uint32_t ampdu_rx_cnt;
uint32_t mpdu_in_rx_ampdu_cnt;
uint64_t rx_octets_in_ampdu_cnt;
uint32_t rx_ampdu_deli_crc_err_cnt;
};
/**
* struct mib_stats_metrics - mib stats counters
* @mib_counters: dot11Counters group
* @mib_mac_statistics: dot11MACStatistics group
* @mib_qos_counters: dot11QoSCounters group
* @mib_rsna_stats: dot11RSNAStats group
* @mib_counters_group3: dot11CountersGroup3 group
*/
struct mib_stats_metrics {
struct dot11_counters mib_counters;
struct dot11_mac_statistics mib_mac_statistics;
struct dot11_qos_counters mib_qos_counters;
struct dot11_rsna_stats mib_rsna_stats;
struct dot11_counters_group3 mib_counters_group3;
};
#endif
/**
* struct congestion_stats_event: congestion stats event param
* @vdev_id: vdev_id of the event
* @congestion: the congestion percentage
*/
struct congestion_stats_event {
uint8_t vdev_id;
uint32_t congestion;
};
/**
* struct summary_stats_event - summary_stats event param
* @vdev_id: vdev_id of the event
* @stats: summary stats
*/
struct summary_stats_event {
uint8_t vdev_id;
struct summary_stats stats;
};
/**
* struct chain_rssi_event - chain_rssi event param
* @vdev_id: vdev_id of the event
* @chain_rssi: chain_rssi
*/
struct chain_rssi_event {
uint8_t vdev_id;
int8_t chain_rssi[MAX_NUM_CHAINS];
};
/**
* struct peer_stats_info_ext_event - peer extended stats info
* @peer_macaddr: MAC address
* @tx_packets: packets transmitted to this station
* @tx_bytes: bytes transmitted to this station
* @rx_packets: packets received from this station
* @rx_bytes: bytes received from this station
* @tx_retries: cumulative retry counts
* @tx_failed: the number of failed frames
* @tx_succeed: the number of succeed frames
* @rssi: the signal strength
* @tx_rate: last used tx bitrate (kbps)
* @tx_rate_code: last tx rate code (last_tx_rate_code of wmi_peer_stats_info)
* @rx_rate: last used rx bitrate (kbps)
* @rx_rate_code: last rx rate code (last_rx_rate_code of wmi_peer_stats_info)
* @peer_rssi_per_chain: the average value of RSSI (dbm) per chain
* @num_tx_rate_counts: Num tx rate count for current peer
* @num_rx_rate_counts: Num rx rate count for current peer
* @tx_pkt_per_mcs: Number of tx packets for each MCS
* @rx_pkt_per_mcs: Number of rx packets for each MCS
*/
struct peer_stats_info_ext_event {
struct qdf_mac_addr peer_macaddr;
uint32_t tx_packets;
uint64_t tx_bytes;
uint32_t rx_packets;
uint64_t rx_bytes;
uint32_t tx_retries;
uint32_t tx_failed;
uint32_t tx_succeed;
int32_t rssi;
uint32_t tx_rate;
uint32_t tx_rate_code;
uint32_t rx_rate;
uint32_t rx_rate_code;
int32_t peer_rssi_per_chain[WMI_MAX_CHAINS];
uint32_t num_tx_rate_counts;
uint32_t num_rx_rate_counts;
uint32_t *tx_pkt_per_mcs;
uint32_t *rx_pkt_per_mcs;
};
/**
* struct stats_event - parameters populated by stats event
* @num_pdev_stats: num pdev stats
* @pdev_stats: if populated array indicating pdev stats (index = pdev_id)
* @num_pdev_extd_stats: num pdev extended stats
* @pdev_extd_stats: if populated array indicating pdev extended stats
* (index = pdev_id)
* @num_peer_stats: num peer stats
* @peer_stats: if populated array indicating peer stats
* @peer_adv_stats: if populated, indicates peer adv (extd2) stats
* @num_peer_adv_stats: number of peer adv (extd2) stats
* @num_peer_extd_stats: Num peer extended stats
* @peer_extended_stats: Peer extended stats
* @cca_stats: if populated indicates congestion stats
* @num_summary_stats: number of summary stats
* @vdev_summary_stats: if populated indicates array of summary stats per vdev
* @num_mib_stats: number of mib stats
* @mib_stats: if populated indicates array of mib stats per vdev
* @num_chain_rssi_stats: number of chain rssi stats
* @vdev_chain_rssi: if populated indicates array of chain rssi per vdev
* @tx_rate: tx rate (kbps)
* @rx_rate: rx rate (kbps)
* @tx_rate_flags: tx rate flags, (enum tx_rate_info)
* @last_event: The LSB indicates if the event is the last event or not and the
* MSB indicates if this feature is supported by FW or not.
* @mac_seq_num: sequence number of event when fw update to host
* @num_peer_stats_info_ext: number of peer extended stats info
* @peer_stats_info_ext: peer extended stats info
* @bcn_protect_stats: pmf bcn protect stats
* @num_vdev_extd_stats: number of vdev extended stats
* @vdev_extd_stats: if populated indicates array of ext summary stats per vdev
*/
struct stats_event {
uint32_t num_pdev_stats;
struct pdev_mc_cp_stats *pdev_stats;
uint32_t num_pdev_extd_stats;
struct pdev_mc_cp_extd_stats *pdev_extd_stats;
uint32_t num_peer_stats;
struct peer_mc_cp_stats *peer_stats;
uint32_t num_peer_adv_stats;
struct peer_adv_mc_cp_stats *peer_adv_stats;
uint32_t num_peer_extd_stats;
struct peer_extd_stats *peer_extended_stats;
struct congestion_stats_event *cca_stats;
uint32_t num_summary_stats;
struct summary_stats_event *vdev_summary_stats;
#ifdef WLAN_FEATURE_MIB_STATS
uint32_t num_mib_stats;
struct mib_stats_metrics *mib_stats;
#endif
uint32_t num_chain_rssi_stats;
struct chain_rssi_event *vdev_chain_rssi;
uint32_t tx_rate;
uint32_t rx_rate;
enum tx_rate_info tx_rate_flags;
uint32_t last_event;
uint8_t mac_seq_num;
uint32_t num_peer_stats_info_ext;
struct peer_stats_info_ext_event *peer_stats_info_ext;
struct pmf_bcn_protect_stats bcn_protect_stats;
uint32_t num_vdev_extd_stats;
struct vdev_summary_extd_stats *vdev_extd_stats;
};
/**
* struct peer_stats_request_params - peer stats request parameter
* @request_type: request type, one peer or all peers of the vdev
* @vdev_id: vdev id
* @peer_mac_addr: peer mac address, omitted if request type is all peers
* @reset_after_request: whether reset stats after request
*/
struct peer_stats_request_params {
uint32_t request_type;
uint32_t vdev_id;
uint8_t peer_mac_addr[QDF_MAC_ADDR_SIZE];
uint32_t reset_after_request;
};
/**
* struct wmi_host_peer_stats_info - WMI peer stats info
* @peer_macaddr: peer mac address
* @tx_bytes: tx_bytes
* @tx_packets: tx packets
* @rx_bytes: rx_bytes
* @rx_packets: rx packets
* @tx_retries: tx retries of MPDU
* @tx_failed: tx failed MPDU
* @last_tx_rate_code: rate code of the last tx
* @last_rx_rate_code: rate code of the last rx
* @last_tx_bitrate_kbps: bitrate in bps of the last tx
* @last_rx_bitrate_kbps: bitrate in bps of the last rx
* @peer_rssi: peer rssi
* @tx_succeed: tx succeed MPDU
* @peer_rssi_per_chain: peer rssi per chain
* @num_tx_rate_counts: Num tx rate count for current peer
* @num_rx_rate_counts: Num rx rate count for current peer
* @tx_pkt_per_mcs: Number of tx rate counts for each MCS
* @rx_pkt_per_mcs: Number of rx rate counts for each MCS
*/
typedef struct {
struct qdf_mac_addr peer_macaddr;
uint64_t tx_bytes;
uint32_t tx_packets;
uint64_t rx_bytes;
uint32_t rx_packets;
uint32_t tx_retries;
uint32_t tx_failed;
uint32_t last_tx_rate_code;
uint32_t last_rx_rate_code;
uint32_t last_tx_bitrate_kbps;
uint32_t last_rx_bitrate_kbps;
int32_t peer_rssi;
uint32_t tx_succeed;
int32_t peer_rssi_per_chain[WMI_MAX_CHAINS];
uint32_t num_tx_rate_counts;
uint32_t num_rx_rate_counts;
uint32_t *tx_pkt_per_mcs;
uint32_t *rx_pkt_per_mcs;
} wmi_host_peer_stats_info;
#endif /* __WLAN_CP_STATS_MC_DEFS_H__ */

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_cp_stats_mc_tgt_api.h
*
* This header file provide with API declarations to interface with Southbound
*/
#ifndef __WLAN_CP_STATS_MC_TGT_API_H__
#define __WLAN_CP_STATS_MC_TGT_API_H__
#ifdef QCA_SUPPORT_CP_STATS
#include "wlan_cp_stats_mc_defs.h"
//TODO - Check if this is true for hamilton
#ifdef QCA_WIFI_QCA6490
#define TGT_MAC_ID_24G 2
#define TGT_MAC_ID_5G 1
#else
#define TGT_MAC_ID_24G 0
#define TGT_MAC_ID_5G 0
#endif
/**
* target_if_mc_cp_get_mac_id(): API to get mac id
* @vdev_mlme: vdev mlme pointer
*
* Return: mac id
*/
uint8_t target_if_mc_cp_get_mac_id(struct vdev_mlme_obj *vdev_mlme);
/**
* tgt_mc_cp_stats_process_stats_event(): API to process stats event
* @psoc: pointer to psoc object
* @ev: event parameters
*
* Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
* failure
*/
QDF_STATUS
tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc,
struct stats_event *ev);
#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
/**
* tgt_mc_cp_stats_process_infra_stats_event(): API to process event from
* cp stats infrastructure
* @psoc: pointer to psoc object
* @infra_event: infra cp stats event parameters
*
* Return: status of operation
*/
QDF_STATUS tgt_mc_cp_stats_process_infra_stats_event(
struct wlan_objmgr_psoc *psoc,
struct infra_cp_stats_event *infra_event);
#endif
#ifdef WLAN_FEATURE_BIG_DATA_STATS
/**
* tgt_mc_cp_stats_process_big_data_stats_event(): API to process big data
* stats event
* @psoc: pointer to psoc object
* @event: big data stats event parameters
*
* Return: status of operation
*/
QDF_STATUS
tgt_mc_cp_stats_process_big_data_stats_event(
struct wlan_objmgr_psoc *psoc,
struct big_data_stats_event *event);
#endif
/**
* tgt_send_mc_cp_stats_req(): API to send stats request to lmac
* @psoc: pointer to psoc object
* @type: specific type of stats requested
* @req: pointer to stats request
*
* Return: status of operation
*/
QDF_STATUS tgt_send_mc_cp_stats_req(struct wlan_objmgr_psoc *psoc,
enum stats_req_type type,
struct request_info *req);
/**
* tgt_set_pdev_stats_update_period(): API to set pdev stats update
* period to FW
* @psoc: pointer to psoc object
* @pdev_id: pdev id
* @val: pdev stats update period, 0: disabled periodical stats report.
*
* Return: status of operation
*/
QDF_STATUS tgt_set_pdev_stats_update_period(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id, uint32_t val);
/**
* tgt_mc_cp_stats_inc_wake_lock_stats() : API to increment wake lock stats
* given the wake reason code
* @psoc: pointer to psoc object
* @reason: wake reason
* @stats: vdev wow stats to update
* @unspecified_wake_count: unspecified wake count to update
*
* Return : status of operation
*/
QDF_STATUS tgt_mc_cp_stats_inc_wake_lock_stats(struct wlan_objmgr_psoc *psoc,
uint32_t reason, struct wake_lock_stats *stats,
uint32_t *unspecified_wake_count);
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* __WLAN_CP_STATS_MC_TGT_API_H__ */

View File

@ -0,0 +1,538 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_cp_stats_mc_ucfg_api.h
*
* This header file maintain API declaration required for northbound interaction
*/
#ifndef __WLAN_CP_STATS_MC_UCFG_API_H__
#define __WLAN_CP_STATS_MC_UCFG_API_H__
#ifdef QCA_SUPPORT_CP_STATS
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_cp_stats_mc_defs.h>
#ifdef WLAN_SUPPORT_TWT
#include <wlan_objmgr_peer_obj.h>
#include "../../core/src/wlan_cp_stats_defs.h"
#include <qdf_event.h>
/* Max TWT sessions supported */
#define TWT_PSOC_MAX_SESSIONS TWT_PEER_MAX_SESSIONS
/**
* ucfg_twt_get_peer_session_params() - Retrieves peer twt session parameters
* corresponding to a peer by using mac_addr and dialog id
* If dialog_id is TWT_GET_ALL_PEER_PARAMS_DIALOG_ID retrieves twt session
* parameters of all peers with valid twt session
* @psoc_obj: psoc object
* @param: array pointer to store peer twt session parameters, should contain
* mac_addr and dialog id of a peer for which twt session stats to be retrieved
*
* Return: total number of valid twt session
*/
int
ucfg_twt_get_peer_session_params(struct wlan_objmgr_psoc *psoc_obj,
struct wmi_host_twt_session_stats_info *param);
#endif /* WLAN_SUPPORT_TWT */
struct psoc_cp_stats;
struct vdev_cp_stats;
/**
* ucfg_mc_cp_stats_get_psoc_wake_lock_stats() : API to get wake lock stats from
* psoc
* @psoc: pointer to psoc object
* @stats: stats object to populate
*
* Return : status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_get_psoc_wake_lock_stats(
struct wlan_objmgr_psoc *psoc,
struct wake_lock_stats *stats);
/**
* ucfg_mc_cp_stats_get_vdev_wake_lock_stats() : API to get wake lock stats from
* vdev
* @vdev: pointer to vdev object
* @stats: stats object to populate
*
* Return : status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_get_vdev_wake_lock_stats(
struct wlan_objmgr_vdev *vdev,
struct wake_lock_stats *stats);
/**
* ucfg_mc_cp_stats_inc_wake_lock_stats_by_protocol() : API to increment wake
* lock stats given the protocol of the packet that was received.
* @psoc: pointer to psoc object
* @vdev_id: vdev_id for which the packet was received
* @protocol: protocol of the packet that was received
*
* Return : status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats_by_protocol(
struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id,
enum qdf_proto_subtype protocol);
/**
* ucfg_mc_cp_stats_inc_wake_lock_stats_by_dst_addr() : API to increment wake
* lock stats given destination of packet that was received.
* @psoc: pointer to psoc object
* @vdev_id: vdev_id for which the packet was received
* @dest_mac: destination mac address of packet that was received
*
* Return : status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats_by_dst_addr(
struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, uint8_t *dest_mac);
/**
* ucfg_mc_cp_stats_inc_wake_lock_stats() : API to increment wake lock stats
* given wake reason.
* @psoc: pointer to psoc object
* @vdev_id: vdev_id on with WOW was received
* @reason: reason of WOW
*
* Return : status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id,
uint32_t reason);
/**
* ucfg_mc_cp_stats_write_wow_stats() - Writes WOW stats to buffer
* @psoc: pointer to psoc object
* @buffer: The char buffer to write to
* @max_len: The maximum number of chars to write
* @ret: number of bytes written
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_write_wow_stats(
struct wlan_objmgr_psoc *psoc,
char *buffer, uint16_t max_len, int *ret);
/**
* ucfg_mc_cp_stats_send_stats_request() - API to send stats request to lmac
* @vdev: pointer to vdev object
* @type: request type
* @info: specific request information
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_send_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info);
/**
* wlan_cfg80211_mc_twt_clear_infra_cp_stats() - send request to reset
* control path statistics
* @vdev: pointer to vdev object
* @dialog_id: dialod id of the twt session
* @twt_peer_mac: mac address of the peer
*
* Return: 0 for success or error code for failure
*/
int
wlan_cfg80211_mc_twt_clear_infra_cp_stats(
struct wlan_objmgr_vdev *vdev,
uint32_t dialog_id,
uint8_t twt_peer_mac[QDF_MAC_ADDR_SIZE]);
/**
* wlan_cfg80211_mc_twt_get_infra_cp_stats() - send twt get statistic request
* @vdev: pointer to vdev object
* @dialog_id: TWT session dialog id
* @twt_peer_mac: mac address of the peer
* @errno: error code
*
* Return: pointer to infra cp stats event for success or NULL for failure
*/
struct infra_cp_stats_event *
wlan_cfg80211_mc_twt_get_infra_cp_stats(struct wlan_objmgr_vdev *vdev,
uint32_t dialog_id,
uint8_t twt_peer_mac[QDF_MAC_ADDR_SIZE],
int *errno);
/**
* ucfg_mc_cp_stats_get_tx_power() - API to fetch tx_power
* @vdev: pointer to vdev object
* @dbm: pointer to tx power in dbm
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
int *dbm);
/**
* ucfg_mc_cp_stats_is_req_pending() - API to tell if given request is pending
* @psoc: pointer to psoc object
* @type: request type to check
*
* Return: true of request is pending, false otherwise
*/
bool ucfg_mc_cp_stats_is_req_pending(struct wlan_objmgr_psoc *psoc,
enum stats_req_type type);
/**
* ucfg_mc_cp_stats_set_pending_req() - API to set pending request
* @psoc: pointer to psoc object
* @type: request to update
* @req: value to update
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_set_pending_req(struct wlan_objmgr_psoc *psoc,
enum stats_req_type type,
struct request_info *req);
/**
* ucfg_mc_cp_stats_reset_pending_req() - API to reset pending request
* @psoc: pointer to psoc object
* @type: request to update
* @last_req: last request
* @pending: pending request present
*
* The function is an atomic operation of "reset" and "get" last request.
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_reset_pending_req(struct wlan_objmgr_psoc *psoc,
enum stats_req_type type,
struct request_info *last_req,
bool *pending);
/**
* ucfg_mc_cp_stats_get_pending_req() - API to get pending request
* @psoc: pointer to psoc object
* @type: request to update
* @info: buffer to populate
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
enum stats_req_type type,
struct request_info *info);
/**
* ucfg_mc_infra_cp_stats_free_stats_resources() - API to free buffers within
* infra cp stats_event structure
* @ev: structure whose buffer are to freed
*
* Return: none
*/
void
ucfg_mc_infra_cp_stats_free_stats_resources(struct infra_cp_stats_event *ev);
/**
* ucfg_mc_cp_stats_free_stats_resources() - API to free buffers within stats_event
* structure
* @ev: structure whose buffer are to freed
*
* Return: none
*/
void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev);
/**
* ucfg_mc_cp_stats_cca_stats_get() - API to fetch cca stats
* @vdev: pointer to vdev object
* @cca_stats: pointer to cca info
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_cca_stats_get(struct wlan_objmgr_vdev *vdev,
struct cca_stats *cca_stats);
/**
* ucfg_mc_cp_stats_set_rate_flags() - API to set rate flags
* @vdev: pointer to vdev object
* @flags: value to set
*
* Return: status of operation
*/
QDF_STATUS ucfg_mc_cp_stats_set_rate_flags(struct wlan_objmgr_vdev *vdev,
uint32_t flags);
/**
* ucfg_mc_cp_stats_register_lost_link_info_cb() - API to register lost link
* info callback
* @psoc: pointer to psoc object
* @lost_link_cp_stats_info_cb: Lost link info callback to be registered
*
*/
void ucfg_mc_cp_stats_register_lost_link_info_cb(
struct wlan_objmgr_psoc *psoc,
void (*lost_link_cp_stats_info_cb)(void *stats_ev));
#ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
/**
* ucfg_mc_cp_stats_register_pmo_handler() - API to register pmo handler
*
* Return: none
*/
void ucfg_mc_cp_stats_register_pmo_handler(void);
#else
void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
#endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
#ifdef WLAN_FEATURE_BIG_DATA_STATS
/**
* ucfg_send_big_data_stats_request() - API to send big data stats
* request
* @vdev: pointer to vdev object
* @type: request type
* @info: request info
*
* Return: status of operation
*/
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info);
/**
* ucfg_mc_cp_set_big_data_fw_support() - set big data fw support
* @psoc: PSOC object
* @enable: Set true if firmware supports big data, otherwise false
*
* API to set fw supports big data feature or not
*
* Return: void
*/
void
ucfg_mc_cp_set_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool enable);
/**
* ucfg_mc_cp_get_big_data_fw_support() - get big data fw support
* @psoc: PSOC object
* @enable: Set true if firmware supports big data, otherwise false
*
* API to get fw supports big data feature or not
*
* Return: void
*/
void
ucfg_mc_cp_get_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool *enable);
#else
static inline
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_mc_cp_set_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool enable)
{}
static inline void
ucfg_mc_cp_get_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool *enable)
{}
#endif
#ifdef CONFIG_WLAN_BMISS
/**
* wlan_cfg80211_mc_bmiss_get_infra_cp_stats() - API to get bmiss stats
* @vdev: pointer to vdev object
* @bmiss_peer_mac: mac address of the peer
* @errno: error code
*
* Return: pointer to infra cp stats event for success or NULL for failure
*/
struct infra_cp_stats_event*
wlan_cfg80211_mc_bmiss_get_infra_cp_stats(
struct wlan_objmgr_vdev *vdev,
uint8_t bmiss_peer_mac[QDF_MAC_ADDR_SIZE],
int *errno);
#else /* CONFIG_WLAN_BMISS */
static inline struct infra_cp_stats_event*
wlan_cfg80211_mc_bmiss_get_infra_cp_stats(
struct wlan_objmgr_vdev *vdev,
uint8_t bmiss_peer_mac[QDF_MAC_ADDR_SIZE],
int *errno)
{
return NULL;
}
#endif /* CONFIG_WLAN_BMISS */
/**
* wlan_cp_stats_update_chan_info() - API to update chan stats
* @psoc: pointer to psoc
* @chan_stat: channel stats
* @vdev_id: vdev id
*
* Return: None
*/
void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
struct channel_status *chan_stat,
uint8_t vdev_id);
/**
* wlan_cp_stats_get_rx_clear_count() - API to get rx clear count for a channel
* @psoc: pointer to psoc
* @vdev_id: vdev id
* @req_freq: freq for which rx clear count require
*
* Return: channel load
*/
uint8_t wlan_cp_stats_get_rx_clear_count(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, qdf_freq_t req_freq);
/**
* ucfg_mc_cp_stats_clear_channel_status() - API to clear chan stats
* @pdev: pointer to pdev object
*
* Return: None
*/
void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_mc_cp_stats_get_channel_status() - API to get chan stats
* @pdev: pointer to pdev object
* @chan_freq: channel freq of which stats are needed
*
* Return: channel status
*/
struct channel_status *
ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq);
#else /* QCA_SUPPORT_CP_STATS */
void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
static inline QDF_STATUS ucfg_mc_cp_stats_send_stats_request(
struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_set_rate_flags(
struct wlan_objmgr_vdev *vdev,
uint32_t flags)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_get_psoc_wake_lock_stats(
struct wlan_objmgr_psoc *psoc,
struct wake_lock_stats *stats)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats_by_protocol(
struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id,
enum qdf_proto_subtype protocol)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats(
struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id,
uint32_t reason)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_inc_wake_lock_stats_by_dst_addr(
struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, uint8_t *dest_mac)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_mc_cp_stats_get_vdev_wake_lock_stats(
struct wlan_objmgr_vdev *vdev,
struct wake_lock_stats *stats)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_mc_cp_set_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool enable)
{}
static inline void
ucfg_mc_cp_big_data_fw_support(struct wlan_objmgr_psoc *psoc,
bool *enable)
{}
static inline struct infra_cp_stats_event*
wlan_cfg80211_mc_bmiss_get_infra_cp_stats(
struct wlan_objmgr_vdev *vdev,
uint8_t bmiss_peer_mac[QDF_MAC_ADDR_SIZE],
int *errno)
{
return NULL;
}
static inline void
ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
int *dbm)
{}
static inline
void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
struct channel_status *chan_stat,
uint8_t vdev_id)
{
}
static inline
uint8_t wlan_cp_stats_get_rx_clear_count(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, qdf_freq_t req_freq)
{
}
static inline
void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev)
{
}
static inline struct channel_status *
ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq)
{
return NULL;
}
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

View File

@ -0,0 +1,333 @@
/*
* Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare internal APIs related to the denylist component
*/
#ifndef _WLAN_DLM_CORE_H_
#define _WLAN_DLM_CORE_H_
#include <wlan_dlm_main.h>
#define DLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) \
(cur_node)->userspace_avoidlist
#define DLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) \
(cur_node)->driver_avoidlist
#define DLM_IS_AP_DENYLISTED_BY_USERSPACE(cur_node) \
(cur_node)->userspace_denylist
#define DLM_IS_AP_DENYLISTED_BY_DRIVER(cur_node) \
(cur_node)->driver_denylist
#define DLM_IS_AP_IN_MONITOR_LIST(cur_node) \
(cur_node)->driver_monitorlist
#define DLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) \
(cur_node)->rssi_reject_list
#define DLM_IS_AP_IN_DENYLIST(cur_node) \
(DLM_IS_AP_DENYLISTED_BY_USERSPACE(cur_node) | \
DLM_IS_AP_DENYLISTED_BY_DRIVER(cur_node) | \
DLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node))
#define DLM_IS_AP_IN_AVOIDLIST(cur_node) \
(DLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) | \
DLM_IS_AP_AVOIDED_BY_DRIVER(cur_node))
#define IS_AP_IN_USERSPACE_DENYLIST_ONLY(cur_node) \
(DLM_IS_AP_DENYLISTED_BY_USERSPACE(cur_node) & \
!(DLM_IS_AP_IN_AVOIDLIST(cur_node) | \
DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) | \
DLM_IS_AP_DENYLISTED_BY_DRIVER(cur_node)))
#define IS_AP_IN_MONITOR_LIST_ONLY(cur_node) \
(DLM_IS_AP_IN_MONITOR_LIST(cur_node) & \
!(DLM_IS_AP_IN_AVOIDLIST(cur_node) | \
DLM_IS_AP_IN_DENYLIST(cur_node)))
#define IS_AP_IN_AVOID_LIST_ONLY(cur_node) \
(DLM_IS_AP_IN_AVOIDLIST(cur_node) & \
!(DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_IN_DENYLIST(cur_node)))
#define IS_AP_IN_DRIVER_DENYLIST_ONLY(cur_node) \
(DLM_IS_AP_DENYLISTED_BY_DRIVER(cur_node) & \
!(DLM_IS_AP_IN_AVOIDLIST(cur_node) | \
DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) | \
DLM_IS_AP_DENYLISTED_BY_USERSPACE(cur_node)))
#define IS_AP_IN_RSSI_REJECT_LIST_ONLY(cur_node) \
(DLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) & \
!(DLM_IS_AP_IN_AVOIDLIST(cur_node) | \
DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_DENYLISTED_BY_DRIVER(cur_node) | \
DLM_IS_AP_DENYLISTED_BY_USERSPACE(cur_node)))
#define IS_AP_IN_USERSPACE_AVOID_LIST_ONLY(cur_node) \
(DLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) & \
!(DLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) | \
DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_IN_DENYLIST(cur_node)))
#define IS_AP_IN_DRIVER_AVOID_LIST_ONLY(cur_node) \
(DLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) & \
!(DLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) | \
DLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
DLM_IS_AP_IN_DENYLIST(cur_node)))
/**
* struct dlm_reject_ap_timestamp - Structure to store the reject list BSSIDs
* entry time stamp.
* @userspace_avoid_timestamp: Time when userspace adds BSSID to avoid list.
* @driver_avoid_timestamp: Time when driver adds BSSID to avoid list.
* @userspace_denylist_timestamp: Time when userspace adds BSSID to deny list.
* @driver_denylist_timestamp: Time when driver adds BSSID to deny list.
* @rssi_reject_timestamp: Time when driver adds BSSID to rssi reject list.
* @driver_monitor_timestamp: Time when driver adds BSSID to monitor list.
*/
struct dlm_reject_ap_timestamp {
qdf_time_t userspace_avoid_timestamp;
qdf_time_t driver_avoid_timestamp;
qdf_time_t userspace_denylist_timestamp;
qdf_time_t driver_denylist_timestamp;
qdf_time_t rssi_reject_timestamp;
qdf_time_t driver_monitor_timestamp;
};
/**
* struct dlm_reject_ap - Structure of a node added to denylist manager
* @node: Node of the entry
* @bssid: Bssid of the AP entry.
* @rssi_reject_params: Rssi reject params of the AP entry.
* @bad_bssid_counter: It represent how many times data stall happened.
* @ap_timestamp: AP timestamp.
* @reject_ap_type: consolidated bitmap of rejection types for the AP
* @userspace_denylist: AP in userspace denylist
* @driver_denylist: AP in driver denylist
* @userspace_avoidlist: AP in userspace avoidlist
* @driver_avoidlist: AP in driver avoidlist
* @rssi_reject_list: AP has bad RSSI
* @driver_monitorlist: AP is monitored
* @reject_ap_reason: consolidated bitmap of rejection reasons for the AP
* @nud_fail: NUD fail reason
* @sta_kickout: STA kickout reason
* @ho_fail: Handoff failure reason
* @poor_rssi: Poor RSSI reason
* @oce_assoc_reject: OCE association rejected reason
* @denylist_userspace: Userspace denylist reason
* @avoid_userspace: Userspace avoidlist reason
* @btm_disassoc_imminent: BTM disassociation imminent reason
* @btm_bss_termination: BTM BSS termination reason
* @btm_mbo_retry: BTM MBO retry reason
* @reassoc_rssi_reject: Reassociation RSSI rejection reason
* @no_more_stas: AP reached STA capacity reason
* @source: source of the rejection
* @connect_timestamp: Timestamp when the STA got connected with this BSSID
*/
struct dlm_reject_ap {
qdf_list_node_t node;
struct qdf_mac_addr bssid;
struct dlm_rssi_disallow_params rssi_reject_params;
uint8_t bad_bssid_counter;
struct dlm_reject_ap_timestamp ap_timestamp;
union {
struct {
uint8_t userspace_denylist:1,
driver_denylist:1,
userspace_avoidlist:1,
driver_avoidlist:1,
rssi_reject_list:1,
driver_monitorlist:1;
};
uint8_t reject_ap_type;
};
union {
struct {
uint32_t nud_fail:1,
sta_kickout:1,
ho_fail:1,
poor_rssi:1,
oce_assoc_reject:1,
denylist_userspace:1,
avoid_userspace:1,
btm_disassoc_imminent:1,
btm_bss_termination:1,
btm_mbo_retry:1,
reassoc_rssi_reject:1,
no_more_stas:1;
};
uint32_t reject_ap_reason;
};
enum dlm_reject_ap_source source;
qdf_time_t connect_timestamp;
};
/**
* dlm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
* @pdev: Pdev object
* @ap_info: Ap info params such as BSSID, and the type of rejection to be done
*
* This API will add the BSSID to the reject AP list maintained by the denylist
* manager.
*
* Return: QDF status
*/
QDF_STATUS
dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info);
#if defined(WLAN_FEATURE_ROAM_OFFLOAD)
/**
* dlm_send_reject_ap_list_to_fw() - Send the denylist BSSIDs to FW
* @pdev: Pdev object
* @reject_db_list: List of denylist BSSIDs
* @cfg: Denylist manager cfg
*
* This API will send the denylist BSSIDs to FW for avoiding or denylisting
* in roaming scenarios.
*
* Return: None
*/
void
dlm_send_reject_ap_list_to_fw(struct wlan_objmgr_pdev *pdev,
qdf_list_t *reject_db_list,
struct dlm_config *cfg);
/**
* dlm_update_reject_ap_list_to_fw() - Send the denylist BSSIDs to FW
* @psoc: psoc object
*
* This API will send the denylist BSSIDs to FW.
*
* Return: None
*/
void dlm_update_reject_ap_list_to_fw(struct wlan_objmgr_psoc *psoc);
#else
static inline void dlm_send_reject_ap_list_to_fw(struct wlan_objmgr_pdev *pdev,
qdf_list_t *reject_db_list,
struct dlm_config *cfg)
{
}
static inline void
dlm_update_reject_ap_list_to_fw(struct wlan_objmgr_psoc *psoc)
{
}
#endif
/**
* dlm_add_userspace_deny_list() - Clear already existing userspace BSSID, and
* add the new ones to denylist manager.
* @pdev: pdev object
* @bssid_deny_list: BSSIDs to be denylisted by userspace.
* @num_of_bssid: num of bssids to be denylisted.
*
* This API will Clear already existing userspace BSSID, and add the new ones
* to denylist manager's reject list.
*
* Return: QDF status
*/
QDF_STATUS
dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid_deny_list,
uint8_t num_of_bssid);
/**
* dlm_update_bssid_connect_params() - Inform the DLM about connect/disconnect
* with the current AP.
* @pdev: pdev object
* @bssid: BSSID of the AP
* @con_state: Connection state (connected/disconnected)
*
* This API will inform the DLM about the state with the AP so that if the AP
* is selected, and the connection went through, and the connection did not
* face any data stall till the bad bssid reset timer, DLM can remove the
* AP from the reject ap list maintained by it.
*
* Return: None
*/
void
dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state);
/**
* dlm_flush_reject_ap_list() - Clear away BSSID and destroy the reject ap list
* @dlm_ctx: denylist manager pdev priv object
*
* This API will clear the BSSID info in the reject AP list maintained by the
* denylist manager, and will destroy the list as well.
*
* Return: None
*/
void
dlm_flush_reject_ap_list(struct dlm_pdev_priv_obj *dlm_ctx);
/**
* dlm_get_bssid_reject_list() - Get the BSSIDs in reject list from DLM
* @pdev: pdev object
* @reject_list: reject list to be filled (passed by caller)
* @max_bssid_to_be_filled: num of bssids filled in reject list by DLM
* @reject_ap_type: reject ap type of the BSSIDs to be filled.
*
* This API will fill the reject ap list requested by caller of type given as
* argument reject_ap_type, and will return the number of BSSIDs filled.
*
* Return: Unsigned integer (number of BSSIDs filled by the denylist manager)
*/
uint8_t
dlm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_config_params *reject_list,
uint8_t max_bssid_to_be_filled,
enum dlm_reject_ap_type reject_ap_type);
/**
* dlm_dump_denylist_bssid - Dump denylisted bssids
* @pdev: pdev object
*
* Return: None
*/
void dlm_dump_denylist_bssid(struct wlan_objmgr_pdev *pdev);
/**
* dlm_is_bssid_in_reject_list - Check whether a BSSID is present in
* reject list or not.
* @pdev: pdev object
* @bssid: bssid to check
*
* Return: true if BSSID is present in reject list
*/
bool dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid);
/**
* dlm_get_rssi_denylist_threshold() - Get rssi denylist threshold value
* @pdev: pdev object
*
* This API will get the RSSI denylist threshold info.
*
* Return: rssi threshold value
*/
int32_t
dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev *pdev);
#endif

View File

@ -0,0 +1,178 @@
/*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare internal APIs related to the denylist manager component
*/
#ifndef _WLAN_DLM_MAIN_H_
#define _WLAN_DLM_MAIN_H_
#include <qdf_time.h>
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_global_obj.h>
#include <wlan_dlm_ucfg_api.h>
#define dlm_fatal(params...)\
QDF_TRACE_FATAL(QDF_MODULE_ID_DENYLIST_MGR, params)
#define dlm_err(params...)\
QDF_TRACE_ERROR(QDF_MODULE_ID_DENYLIST_MGR, params)
#define dlm_warn(params...)\
QDF_TRACE_WARN(QDF_MODULE_ID_DENYLIST_MGR, params)
#define dlm_info(params...)\
QDF_TRACE_INFO(QDF_MODULE_ID_DENYLIST_MGR, params)
#define dlm_debug(params...)\
QDF_TRACE_DEBUG(QDF_MODULE_ID_DENYLIST_MGR, params)
#define dlm_nofl_debug(params...)\
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DENYLIST_MGR, params)
/**
* struct dlm_pdev_priv_obj - Pdev priv struct to store list of denylist mgr.
* @reject_ap_list_lock: Mutex needed to restrict two threads updating the list.
* @reject_ap_list: The reject Ap list which would contain the list of bad APs.
* @dlm_tx_ops: tx ops to send reject ap list to FW
*/
struct dlm_pdev_priv_obj {
qdf_mutex_t reject_ap_list_lock;
qdf_list_t reject_ap_list;
struct wlan_dlm_tx_ops dlm_tx_ops;
};
/**
* struct dlm_config - Structure to define the config params for denylist mgr.
* @avoid_list_exipry_time: Timer after which transition from avoid->monitor
* would happen for the BSSID which is in avoid list.
* @deny_list_exipry_time: Timer after which transition from deny->monitor
* would happen for the BSSID which is in deny list.
* @bad_bssid_counter_reset_time: Timer after which the bssid would be removed
* from the reject list when connected, and data stall is not seen with the AP.
* @bad_bssid_counter_thresh: This is the threshold count which is incremented
* after every NUD fail, and after this much count, the BSSID would be moved to
* denylist.
* @delta_rssi: This is the rssi threshold, only when rssi
* improves by this value the entry for BSSID should be removed from deny
* list manager list.
*/
struct dlm_config {
qdf_time_t avoid_list_exipry_time;
qdf_time_t deny_list_exipry_time;
qdf_time_t bad_bssid_counter_reset_time;
uint8_t bad_bssid_counter_thresh;
uint32_t delta_rssi;
};
/**
* struct dlm_psoc_priv_obj - Psoc priv structure of the denylist manager.
* @pdev_id: pdev id
* @is_suspended: is deny list manager state suspended
* @dlm_cfg: These are the config ini params that the user can configure.
*/
struct dlm_psoc_priv_obj {
uint8_t pdev_id;
bool is_suspended;
struct dlm_config dlm_cfg;
};
/**
* dlm_pdev_object_created_notification() - denylist mgr pdev create
* handler
* @pdev: pdev which is going to be created by objmgr
* @arg: argument for pdev create handler
*
* Register this api with objmgr to detect if pdev is created.
*
* Return: QDF_STATUS status in case of success else return error
*/
QDF_STATUS
dlm_pdev_object_created_notification(struct wlan_objmgr_pdev *pdev,
void *arg);
/**
* dlm_pdev_object_destroyed_notification() - denylist mgr pdev delete handler
* @pdev: pdev which is going to be deleted by objmgr
* @arg: argument for pdev delete handler
*
* Register this api with objmgr to detect if pdev is deleted.
*
* Return: QDF_STATUS status in case of success else return error
*/
QDF_STATUS
dlm_pdev_object_destroyed_notification(struct wlan_objmgr_pdev *pdev,
void *arg);
/**
* dlm_psoc_object_created_notification() - denylist mgr psoc create handler
* @psoc: psoc which is going to be created by objmgr
* @arg: argument for psoc create handler
*
* Register this api with objmgr to detect if psoc is created.
*
* Return: QDF_STATUS status in case of success else return error
*/
QDF_STATUS
dlm_psoc_object_created_notification(struct wlan_objmgr_psoc *psoc,
void *arg);
/**
* dlm_psoc_object_destroyed_notification() - denylist mgr psoc delete handler
* @psoc: psoc which is going to be deleted by objmgr
* @arg: argument for psoc delete handler.
*
* Register this api with objmgr to detect if psoc is deleted.
*
* Return: QDF_STATUS status in case of success else return error
*/
QDF_STATUS
dlm_psoc_object_destroyed_notification(struct wlan_objmgr_psoc *psoc,
void *arg);
/**
* dlm_cfg_psoc_open() - denylist mgr psoc open handler
* @psoc: psoc which is initialized by objmgr
*
* This API will initialize the config file, and store the config while in the
* psoc priv object of the denylist manager.
*
* Return: QDF_STATUS status in case of success else return error
*/
QDF_STATUS
dlm_cfg_psoc_open(struct wlan_objmgr_psoc *psoc);
/**
* dlm_get_pdev_obj() - Get the pdev priv object of the denylist manager
* @pdev: pdev object
*
* Get the pdev priv object of the denylist manager
*
* Return: Pdev priv object if present, else NULL.
*/
struct dlm_pdev_priv_obj *
dlm_get_pdev_obj(struct wlan_objmgr_pdev *pdev);
/**
* dlm_get_psoc_obj() - Get the psoc priv object of the denylist manager
* @psoc: psoc object
*
* Get the psoc priv object of the denylist manager
*
* Return: Psoc priv object if present, else NULL.
*/
struct dlm_psoc_priv_obj *
dlm_get_psoc_obj(struct wlan_objmgr_psoc *psoc);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,190 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_dlm_main.c
*
* WLAN Denylist Mgr related APIs
*
*/
/* Include files */
#include "target_if_dlm.h"
#include <wlan_dlm_ucfg_api.h>
#include "cfg_ucfg_api.h"
#include <wlan_dlm_core.h>
struct dlm_pdev_priv_obj *
dlm_get_pdev_obj(struct wlan_objmgr_pdev *pdev)
{
struct dlm_pdev_priv_obj *dlm_pdev_obj;
dlm_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_DENYLIST_MGR);
return dlm_pdev_obj;
}
struct dlm_psoc_priv_obj *
dlm_get_psoc_obj(struct wlan_objmgr_psoc *psoc)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
dlm_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_DENYLIST_MGR);
return dlm_psoc_obj;
}
QDF_STATUS
dlm_pdev_object_created_notification(struct wlan_objmgr_pdev *pdev,
void *arg)
{
struct dlm_pdev_priv_obj *dlm_ctx;
QDF_STATUS status;
dlm_ctx = qdf_mem_malloc(sizeof(*dlm_ctx));
if (!dlm_ctx)
return QDF_STATUS_E_FAILURE;
status = qdf_mutex_create(&dlm_ctx->reject_ap_list_lock);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("Failed to create mutex");
qdf_mem_free(dlm_ctx);
return status;
}
qdf_list_create(&dlm_ctx->reject_ap_list, MAX_BAD_AP_LIST_SIZE);
target_if_dlm_register_tx_ops(&dlm_ctx->dlm_tx_ops);
status = wlan_objmgr_pdev_component_obj_attach(pdev,
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_ctx,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("Failed to attach pdev_ctx with pdev");
qdf_list_destroy(&dlm_ctx->reject_ap_list);
qdf_mutex_destroy(&dlm_ctx->reject_ap_list_lock);
qdf_mem_free(dlm_ctx);
}
return status;
}
QDF_STATUS
dlm_pdev_object_destroyed_notification(struct wlan_objmgr_pdev *pdev,
void *arg)
{
struct dlm_pdev_priv_obj *dlm_ctx;
dlm_ctx = dlm_get_pdev_obj(pdev);
if (!dlm_ctx) {
dlm_err("DLM Pdev obj is NULL");
return QDF_STATUS_E_FAILURE;
}
/* Clear away the memory allocated for the bad BSSIDs */
dlm_flush_reject_ap_list(dlm_ctx);
qdf_list_destroy(&dlm_ctx->reject_ap_list);
qdf_mutex_destroy(&dlm_ctx->reject_ap_list_lock);
wlan_objmgr_pdev_component_obj_detach(pdev,
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_ctx);
qdf_mem_free(dlm_ctx);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
dlm_psoc_object_created_notification(struct wlan_objmgr_psoc *psoc,
void *arg)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
QDF_STATUS status;
dlm_psoc_obj = qdf_mem_malloc(sizeof(*dlm_psoc_obj));
if (!dlm_psoc_obj)
return QDF_STATUS_E_FAILURE;
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_obj,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("Failed to attach psoc_ctx with psoc");
qdf_mem_free(dlm_psoc_obj);
}
return status;
}
QDF_STATUS
dlm_psoc_object_destroyed_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
dlm_psoc_obj = dlm_get_psoc_obj(psoc);
if (!dlm_psoc_obj) {
dlm_err("DLM psoc obj NULL");
return QDF_STATUS_E_FAILURE;
}
wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_obj);
qdf_mem_free(dlm_psoc_obj);
return QDF_STATUS_SUCCESS;
}
static void
dlm_init_cfg(struct wlan_objmgr_psoc *psoc, struct dlm_config *dlm_cfg)
{
dlm_cfg->avoid_list_exipry_time =
cfg_get(psoc, CFG_AVOID_LIST_EXPIRY_TIME);
dlm_cfg->deny_list_exipry_time =
cfg_get(psoc, CFG_DENY_LIST_EXPIRY_TIME);
dlm_cfg->bad_bssid_counter_reset_time =
cfg_get(psoc, CFG_BAD_BSSID_RESET_TIME);
dlm_cfg->bad_bssid_counter_thresh =
cfg_get(psoc, CFG_BAD_BSSID_COUNTER_THRESHOLD);
dlm_cfg->delta_rssi =
cfg_get(psoc, CFG_DENYLIST_RSSI_THRESHOLD);
}
QDF_STATUS
dlm_cfg_psoc_open(struct wlan_objmgr_psoc *psoc)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
dlm_psoc_obj = dlm_get_psoc_obj(psoc);
if (!dlm_psoc_obj) {
dlm_err("DLM psoc obj NULL");
return QDF_STATUS_E_FAILURE;
}
dlm_init_cfg(psoc, &dlm_psoc_obj->dlm_cfg);
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,176 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains ini params for denylist mgr component
*/
#ifndef __CFG_DLM_H_
#define __CFG_DLM_H_
#ifdef FEATURE_DENYLIST_MGR
/*
* <ini>
* avoid_list_expiry_time - Config Param to move AP from avoid to monitor list.
* @Min: 1 minutes
* @Max: 300 minutes
* @Default: 5 minutes
*
* This ini is used to specify the time after which the BSSID which is in the
* avoid list should be moved to monitor list, assuming that the AP or the
* gateway with which the data stall happenend might have recovered, and now
* the STA can give another chance to connect to the AP.
*
* Supported Feature: Data Stall Recovery
*
* Usage: External
*
* </ini>
*/
#define CFG_AVOID_LIST_EXPIRY_TIME CFG_INI_UINT( \
"avoid_list_expiry_time", \
1, \
300, \
5, \
CFG_VALUE_OR_DEFAULT, \
"avoid list expiry")
/*
* <ini>
* bad_bssid_counter_thresh - Threshold to move the Ap from avoid to denylist.
* @Min: 2
* @Max: 100
* @Default: 3
*
* This ini is used to specify the threshld after which the BSSID which is in
* the avoid list should be moved to deny list, assuming that the AP or the
* gateway with which the data stall happenend has no recovered, and now
* the STA got the NUD failure again with the BSSID
*
* Supported Feature: Data Stall Recovery
*
* Usage: External
*
* </ini>
*/
#define CFG_BAD_BSSID_COUNTER_THRESHOLD CFG_INI_UINT( \
"bad_bssid_counter_thresh", \
2, \
100, \
3, \
CFG_VALUE_OR_DEFAULT, \
"bad bssid counter thresh")
/*
* <ini>
* deny_list_expiry_time - Config Param to move AP from denylist to monitor
* list.
* @Min: 1 minutes
* @Max: 600 minutes
* @Default: 10 minutes
*
* This ini is used to specify the time after which the BSSID which is in the
* deny list should be moved to monitor list, assuming that the AP or the
* gateway with which the data stall happenend might have recovered, and now
* the STA can give another chance to connect to the AP.
*
* Supported Feature: Data Stall Recovery
*
* Usage: External
*
* </ini>
*/
#define CFG_DENY_LIST_EXPIRY_TIME CFG_INI_UINT( \
"black_list_expiry_time", \
1, \
600, \
10, \
CFG_VALUE_OR_DEFAULT, \
"deny list expiry")
/*
* <ini>
* bad_bssid_reset_time - Config Param to specify time after which AP would be
* removed from monitor/avoid when connected.
* @Min: 30 seconds
* @Max: 1 minute
* @Default: 30 seconds
*
* This ini is used to specify the time after which the BSSID which is in the
* avoid or monitor list should be removed from the respective list, if the
* data stall has not happened till the mentioned time after connection to the
* AP. That means that the AP has recovered from the previous state where
* data stall was observed with it, and was moved to avoid list.
*
* Supported Feature: Data Stall Recovery
*
* Usage: External
*
* </ini>
*/
#define CFG_BAD_BSSID_RESET_TIME CFG_INI_UINT( \
"bad_bssid_reset_time", \
30, \
60, \
30, \
CFG_VALUE_OR_DEFAULT, \
"bad bssid reset time")
/*
* <ini>
* delta_rssi - RSSI threshold value, only when AP rssi improves
* by threshold value entry would be removed from denylist manager and assoc
* req would be sent by FW.
* @Min: 0
* @Max: 10
* @Default: 5
*
* This ini is used to specify the rssi threshold value, after rssi improves
* by threshold the BSSID which is in the denylist manager list should be
* removed from the respective list.
*
* Supported Feature: Customer requirement
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_DENYLIST_RSSI_THRESHOLD CFG_INI_INT( \
"delta_rssi", \
0, \
10, \
5, \
CFG_VALUE_OR_DEFAULT, \
"Configure delta RSSI")
#define CFG_DENYLIST_MGR_ALL \
CFG(CFG_AVOID_LIST_EXPIRY_TIME) \
CFG(CFG_BAD_BSSID_COUNTER_THRESHOLD) \
CFG(CFG_DENY_LIST_EXPIRY_TIME) \
CFG(CFG_BAD_BSSID_RESET_TIME) \
CFG(CFG_DENYLIST_RSSI_THRESHOLD)
#else
#define CFG_DENYLIST_MGR_ALL
#endif /* FEATURE_DENYLIST_MGR */
#endif /* __CFG_DENYLIST_MGR */

View File

@ -0,0 +1,173 @@
/*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare public APIs exposed by the denylist manager component
*/
#ifndef _WLAN_DLM_API_H_
#define _WLAN_DLM_API_H_
#include "qdf_types.h"
#include "wlan_objmgr_pdev_obj.h"
#include <wlan_dlm_public_struct.h>
#ifdef FEATURE_DENYLIST_MGR
#include "wlan_dlm_core.h"
/**
* wlan_dlm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
* @pdev: Pdev object
* @ap_info: Ap info params such as BSSID, and the type of rejection to be done
*
* This API will add the BSSID to the reject AP list maintained by the denylist
* manager.
*/
static inline QDF_STATUS
wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info)
{
return dlm_add_bssid_to_reject_list(pdev, ap_info);
}
/**
* wlan_dlm_update_bssid_connect_params() - Inform the DLM about connect or
* disconnect with the current AP.
* @pdev: pdev object
* @bssid: BSSID of the AP
* @con_state: Connection state (connected/disconnected)
*
* This API will inform the DLM about the state with the AP so that if the AP
* is selected, and the connection went through, and the connection did not
* face any data stall till the bad bssid reset timer, DLM can remove the
* AP from the reject ap list maintained by it.
*
* Return: None
*/
static inline void
wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state)
{
return dlm_update_bssid_connect_params(pdev, bssid, con_state);
}
/**
* wlan_dlm_get_bssid_reject_list() - Get the BSSIDs in reject list from DLM
* @pdev: pdev object
* @reject_list: reject list to be filled (passed by caller)
* @max_bssid_to_be_filled: num of bssids filled in reject list by DLM
* @reject_ap_type: reject ap type of the BSSIDs to be filled.
*
* This API is a wrapper to an API of denylist manager which will fill the
* reject ap list requested by caller of type given as argument reject_ap_type,
* and will return the number of BSSIDs filled.
*
* Return: Unsigned integer (number of BSSIDs filled by the denylist manager)
*/
static inline uint8_t
wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_config_params *reject_list,
uint8_t max_bssid_to_be_filled,
enum dlm_reject_ap_type reject_ap_type)
{
return dlm_get_bssid_reject_list(pdev, reject_list,
max_bssid_to_be_filled,
reject_ap_type);
}
/**
* wlan_dlm_is_bssid_in_reject_list() - Check whether a BSSID is present in
* reject list or not
* @pdev: pdev object
* @bssid: bssid to check
*
* Return: true if BSSID is present in reject list
*/
static inline bool
wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid)
{
return dlm_is_bssid_in_reject_list(pdev, bssid);
}
/**
* wlan_dlm_dump_denylist_bssid() - dump the denylisted BSSIDs from DLM
* @pdev: pdev object
*
* Return: None
*/
static inline void
wlan_dlm_dump_denylist_bssid(struct wlan_objmgr_pdev *pdev)
{
return dlm_dump_denylist_bssid(pdev);
}
/**
* wlan_dlm_get_rssi_denylist_threshold() - Get the RSSI denylist threshold
* @pdev: pdev object
*
* This API will get the rssi denylist threshold value configured via
* CFG_DENYLIST_RSSI_THRESHOLD.
*
* Return: int32_t (threshold value)
*/
static inline int32_t
wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev *pdev)
{
return dlm_get_rssi_denylist_threshold(pdev);
}
#else
static inline bool
wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid)
{
return false;
}
static inline QDF_STATUS
wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info)
{
return QDF_STATUS_SUCCESS;
}
static inline uint8_t
wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_config_params *reject_list,
uint8_t max_bssid_to_be_filled,
enum dlm_reject_ap_type reject_ap_type)
{
return 0;
}
static inline void
wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state)
{
}
static inline int32_t
wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev *pdev)
{
return 0;
}
#endif
#endif

View File

@ -0,0 +1,186 @@
/*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: define public structures of denylist mgr.
*/
#ifndef _WLAN_DLM_PUBLIC_STRUCT_H
#define _WLAN_DLM_PUBLIC_STRUCT_H
#include <qdf_types.h>
#include "wlan_objmgr_pdev_obj.h"
#define MAX_BAD_AP_LIST_SIZE 28
#define MAX_RSSI_AVOID_BSSID_LIST 10
#define PDEV_MAX_NUM_BSSID_DISALLOW_LIST 28
/**
* enum dlm_reject_ap_source - Source of adding BSSID to DLM
* @ADDED_BY_DRIVER: Source adding this BSSID is driver
* @ADDED_BY_TARGET: Source adding this BSSID is target
*/
enum dlm_reject_ap_source {
ADDED_BY_DRIVER = 1,
ADDED_BY_TARGET,
};
/**
* struct dlm_rssi_disallow_params - structure to specify params for RSSI
* reject
* @retry_delay: Time before which the AP doesn't expect a connection.
* @expected_rssi: RSSI less than which only the STA should try association
* @received_time: Time at which the AP was added to denylist.
* @original_timeout: Original timeout which the AP sent while denylisting.
* @source: Source of adding this BSSID to RSSI reject list
*/
struct dlm_rssi_disallow_params {
uint32_t retry_delay;
int8_t expected_rssi;
qdf_time_t received_time;
uint32_t original_timeout;
enum dlm_reject_ap_source source;
};
/**
* enum dlm_reject_ap_type - Rejection type of the AP
* @USERSPACE_AVOID_TYPE: userspace wants the AP to be avoided.
* @USERSPACE_DENYLIST_TYPE: userspace wants the AP to be denylisted.
* @DRIVER_AVOID_TYPE: driver wants the AP to be avoided.
* @DRIVER_DENYLIST_TYPE: driver wants the AP to be denylisted.
* @DRIVER_RSSI_REJECT_TYPE: driver wants the AP to be in driver rssi
* reject.
* @DRIVER_MONITOR_TYPE: driver wants the AP to be in monitor list.
* @REJECT_REASON_UNKNOWN: Rejection reason unknown
*/
enum dlm_reject_ap_type {
USERSPACE_AVOID_TYPE = 0,
USERSPACE_DENYLIST_TYPE = 1,
DRIVER_AVOID_TYPE = 2,
DRIVER_DENYLIST_TYPE = 3,
DRIVER_RSSI_REJECT_TYPE = 4,
DRIVER_MONITOR_TYPE = 5,
REJECT_REASON_UNKNOWN = 6,
};
/**
* enum dlm_reject_ap_reason - Rejection reason for adding BSSID to DLM
* @REASON_UNKNOWN: Unknown reason
* @REASON_NUD_FAILURE: NUD failure happened with this BSSID
* @REASON_STA_KICKOUT: STA kickout happened with this BSSID
* @REASON_ROAM_HO_FAILURE: HO failure happenend with this BSSID
* @REASON_ASSOC_REJECT_POOR_RSSI: assoc rsp with reason 71 received from
* AP.
* @REASON_ASSOC_REJECT_OCE: OCE assoc reject received from the AP.
* @REASON_USERSPACE_BL: Userspace wants to denylist this AP.
* @REASON_USERSPACE_AVOID_LIST: Userspace wants to avoid this AP.
* @REASON_BTM_DISASSOC_IMMINENT: BTM IE received with disassoc imminent
* set.
* @REASON_BTM_BSS_TERMINATION: BTM IE received with BSS termination set.
* @REASON_BTM_MBO_RETRY: BTM IE received from AP with MBO retry set.
* @REASON_REASSOC_RSSI_REJECT: Re-Assoc resp received with reason code 34
* @REASON_REASSOC_NO_MORE_STAS: Re-assoc reject received with reason code
* 17
*/
enum dlm_reject_ap_reason {
REASON_UNKNOWN = 0,
REASON_NUD_FAILURE,
REASON_STA_KICKOUT,
REASON_ROAM_HO_FAILURE,
REASON_ASSOC_REJECT_POOR_RSSI,
REASON_ASSOC_REJECT_OCE,
REASON_USERSPACE_BL,
REASON_USERSPACE_AVOID_LIST,
REASON_BTM_DISASSOC_IMMINENT,
REASON_BTM_BSS_TERMINATION,
REASON_BTM_MBO_RETRY,
REASON_REASSOC_RSSI_REJECT,
REASON_REASSOC_NO_MORE_STAS,
};
/**
* enum dlm_connection_state - State with AP (Connected, Disconnected)
* @DLM_AP_CONNECTED: Connected with the AP
* @DLM_AP_DISCONNECTED: Disconnected with the AP
*/
enum dlm_connection_state {
DLM_AP_CONNECTED,
DLM_AP_DISCONNECTED,
};
/**
* struct reject_ap_config_params - Structure to send reject ap list to FW
* @bssid: BSSID of the AP
* @reject_ap_type: Type of the rejection done with the BSSID
* @reject_duration: time left till the AP is in the reject list.
* @expected_rssi: expected RSSI when the AP expects the connection to be
* made.
* @reject_reason: reason to add the BSSID to DLM
* @source: Source of adding the BSSID to DLM
* @received_time: Time at which the AP was added to denylist.
* @original_timeout: Original timeout which the AP sent while denylisting.
*/
struct reject_ap_config_params {
struct qdf_mac_addr bssid;
enum dlm_reject_ap_type reject_ap_type;
uint32_t reject_duration;
int32_t expected_rssi;
enum dlm_reject_ap_reason reject_reason;
enum dlm_reject_ap_source source;
qdf_time_t received_time;
uint32_t original_timeout;
};
/**
* struct reject_ap_params - Struct to send bssid list and there num to FW
* @num_of_reject_bssid: num of bssid params there in bssid config.
* @bssid_list: Pointer to the bad bssid list
*/
struct reject_ap_params {
uint8_t num_of_reject_bssid;
struct reject_ap_config_params *bssid_list;
};
/**
* struct wlan_dlm_tx_ops - structure of tx operation function
* pointers for denylist manager component
* @dlm_send_reject_ap_list: send reject ap list to fw
*/
struct wlan_dlm_tx_ops {
QDF_STATUS (*dlm_send_reject_ap_list)(struct wlan_objmgr_pdev *pdev,
struct reject_ap_params *reject_params);
};
/**
* struct reject_ap_info - structure to specify the reject ap info.
* @bssid: BSSID of the AP.
* @rssi_reject_params: RSSI reject params of the AP is of type RSSI reject
* @reject_ap_type: Reject type of AP (eg. avoid, denylist, rssi reject
* etc.)
* @reject_reason: reason to add the BSSID to DLM
* @source: Source of adding the BSSID to DLM
*/
struct reject_ap_info {
struct qdf_mac_addr bssid;
struct dlm_rssi_disallow_params rssi_reject_params;
enum dlm_reject_ap_type reject_ap_type;
enum dlm_reject_ap_reason reject_reason;
enum dlm_reject_ap_source source;
};
#endif

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare public API for denylist manager to interact with target/WMI
*/
#ifndef _WLAN_DLM_TGT_API_H
#define _WLAN_DLM_TGT_API_H
#include "wlan_dlm_main.h"
/**
* tgt_dlm_send_reject_list_to_fw() - API to send the reject ap list to FW.
* @pdev: pdev object
* @reject_params: Reject params contains the bssid list, and num of bssids
*
* This API will send the reject AP list maintained by the denylist manager
* to the target.
*
* Return: QDF status
*/
QDF_STATUS
tgt_dlm_send_reject_list_to_fw(struct wlan_objmgr_pdev *pdev,
struct reject_ap_params *reject_params);
#endif

View File

@ -0,0 +1,222 @@
/*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare UCFG APIs exposed by the denylist manager component
*/
#ifndef _WLAN_DLM_UCFG_H_
#define _WLAN_DLM_UCFG_H_
#include "qdf_types.h"
#include "wlan_objmgr_psoc_obj.h"
#include <wlan_dlm_public_struct.h>
#ifdef FEATURE_DENYLIST_MGR
/**
* ucfg_dlm_init() - initialize denylist mgr context
*
* This function initializes the denylist mgr context
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_init(void);
/**
* ucfg_dlm_deinit() - De initialize denylist mgr context
*
* This function De initializes denylist mgr context
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_deinit(void);
/**
* ucfg_dlm_psoc_set_suspended() - API to set denylist mgr state suspended
* @psoc: pointer to psoc object
* @state: state to be set
*
* This function sets denylist mgr state to suspended
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_psoc_set_suspended(struct wlan_objmgr_psoc *psoc,
bool state);
/**
* ucfg_dlm_psoc_get_suspended() - API to get denylist mgr state suspended
* @psoc: pointer to psoc object
* @state: pointer to get suspend state of denylist manager
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_psoc_get_suspended(struct wlan_objmgr_psoc *psoc,
bool *state);
/**
* ucfg_dlm_psoc_open() - API to initialize the cfg when psoc is initialized.
* @psoc: psoc object
*
* This function initializes the config of denylist mgr.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_psoc_open(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_dlm_psoc_close() - API to deinit the dlm when psoc is deinitialized.
* @psoc: psoc object
*
* This function deinits the dlm psoc object.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS ucfg_dlm_psoc_close(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_dlm_add_userspace_deny_list() - Clear already existing userspace BSSID,
* and add the new ones to denylist manager.
* @pdev: pdev object
* @bssid_deny_list: BSSIDs to be denylisted by userspace.
* @num_of_bssid: num of bssids to be denylisted.
*
* This API clear already existing userspace BSSID, and add the new ones to
* denylist manager
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error.
*/
QDF_STATUS
ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid_deny_list,
uint8_t num_of_bssid);
/**
* ucfg_dlm_dump_deny_list_ap() - get denylisted bssid.
* @pdev: pdev object
*
* This API dumps denylist ap
*
* Return: None
*/
void ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_dlm_update_bssid_connect_params() - Inform the DLM about connect or
* disconnect with the current AP.
* @pdev: pdev object
* @bssid: BSSID of the AP
* @con_state: Connection state (connected/disconnected)
*
* This API will inform the DLM about the state with the AP so that if the AP
* is selected, and the connection went through, and the connection did not
* face any data stall till the bad bssid reset timer, DLM can remove the
* AP from the reject ap list maintained by it.
*
* Return: None
*/
void
ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state);
/**
* ucfg_dlm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
* @pdev: Pdev object
* @ap_info: Ap info params such as BSSID, and the type of rejection to be done
*
* This API will add the BSSID to the reject AP list maintained by the denylist
* manager.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error.
*/
QDF_STATUS
ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info);
/**
* ucfg_dlm_wifi_off() - Inform the denylist manager about wifi off
* @pdev: Pdev object
*
* This API will inform the denylist manager that the user has turned wifi off
* from the UI, and the denylist manager can take action based upon this.
*
* Return: None
*/
void
ucfg_dlm_wifi_off(struct wlan_objmgr_pdev *pdev);
#else
static inline
QDF_STATUS ucfg_dlm_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_dlm_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_dlm_psoc_open(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_dlm_psoc_close(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev *pdev)
{}
static inline
QDF_STATUS
ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid_deny_list,
uint8_t num_of_bssid)
{
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state)
{
}
static inline
void ucfg_dlm_wifi_off(struct wlan_objmgr_pdev *pdev)
{
}
#endif
#endif /* _WLAN_DLM_UCFG_H_ */

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implements public API for denylist manager to interact with target/WMI
*/
#include "wlan_dlm_tgt_api.h"
#if defined(WLAN_FEATURE_ROAM_OFFLOAD)
QDF_STATUS
tgt_dlm_send_reject_list_to_fw(struct wlan_objmgr_pdev *pdev,
struct reject_ap_params *reject_params)
{
struct wlan_dlm_tx_ops *dlm_tx_ops;
struct dlm_pdev_priv_obj *dlm_priv;
dlm_priv = dlm_get_pdev_obj(pdev);
if (!dlm_priv) {
dlm_err("dlm_priv is NULL");
return QDF_STATUS_E_FAILURE;
}
dlm_tx_ops = &dlm_priv->dlm_tx_ops;
if (!dlm_tx_ops) {
dlm_err("dlm_tx_ops is NULL");
return QDF_STATUS_E_FAILURE;
}
if (dlm_tx_ops->dlm_send_reject_ap_list)
return dlm_tx_ops->dlm_send_reject_ap_list(pdev, reject_params);
dlm_err("Tx ops not registered, failed to send reject list to FW");
return QDF_STATUS_E_FAILURE;
}
#endif

View File

@ -0,0 +1,253 @@
/*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: define UCFG APIs exposed by the denylist mgr component
*/
#include <wlan_dlm_ucfg_api.h>
#include <wlan_dlm_core.h>
#include <wlan_dlm_api.h>
#include "wlan_pmo_obj_mgmt_api.h"
QDF_STATUS ucfg_dlm_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_pdev_create_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_created_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("pdev create register notification failed");
goto fail_create_pdev;
}
status = wlan_objmgr_register_pdev_destroy_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_destroyed_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("pdev destroy register notification failed");
goto fail_destroy_pdev;
}
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_object_created_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("psoc create register notification failed");
goto fail_create_psoc;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_object_destroyed_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("psoc destroy register notification failed");
goto fail_destroy_psoc;
}
return QDF_STATUS_SUCCESS;
fail_destroy_psoc:
wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_object_created_notification, NULL);
fail_create_psoc:
wlan_objmgr_unregister_pdev_destroy_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_destroyed_notification, NULL);
fail_destroy_pdev:
wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_created_notification, NULL);
fail_create_pdev:
return status;
}
QDF_STATUS ucfg_dlm_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_object_destroyed_notification,
NULL);
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_psoc_object_created_notification,
NULL);
status = wlan_objmgr_unregister_pdev_destroy_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_destroyed_notification,
NULL);
status = wlan_objmgr_unregister_pdev_create_handler(
WLAN_UMAC_COMP_DENYLIST_MGR,
dlm_pdev_object_created_notification,
NULL);
return status;
}
QDF_STATUS ucfg_dlm_psoc_set_suspended(struct wlan_objmgr_psoc *psoc,
bool state)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
dlm_psoc_obj = dlm_get_psoc_obj(psoc);
if (!dlm_psoc_obj) {
dlm_err("DLM psoc obj NULL");
return QDF_STATUS_E_FAILURE;
}
dlm_psoc_obj->is_suspended = state;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_dlm_psoc_get_suspended(struct wlan_objmgr_psoc *psoc,
bool *state)
{
struct dlm_psoc_priv_obj *dlm_psoc_obj;
dlm_psoc_obj = dlm_get_psoc_obj(psoc);
if (!dlm_psoc_obj) {
dlm_err("DLM psoc obj NULL");
*state = true;
return QDF_STATUS_E_FAILURE;
}
*state = dlm_psoc_obj->is_suspended;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS
ucfg_dlm_suspend_handler(struct wlan_objmgr_psoc *psoc, void *arg)
{
ucfg_dlm_psoc_set_suspended(psoc, true);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS
ucfg_dlm_resume_handler(struct wlan_objmgr_psoc *psoc, void *arg)
{
ucfg_dlm_psoc_set_suspended(psoc, false);
dlm_update_reject_ap_list_to_fw(psoc);
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_dlm_register_pmo_handler(void)
{
pmo_register_suspend_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
ucfg_dlm_suspend_handler, NULL);
pmo_register_resume_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
ucfg_dlm_resume_handler, NULL);
}
static inline void
ucfg_dlm_unregister_pmo_handler(void)
{
pmo_unregister_suspend_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
ucfg_dlm_suspend_handler);
pmo_unregister_resume_handler(WLAN_UMAC_COMP_DENYLIST_MGR,
ucfg_dlm_resume_handler);
}
QDF_STATUS ucfg_dlm_psoc_open(struct wlan_objmgr_psoc *psoc)
{
ucfg_dlm_register_pmo_handler();
return dlm_cfg_psoc_open(psoc);
}
QDF_STATUS ucfg_dlm_psoc_close(struct wlan_objmgr_psoc *psoc)
{
ucfg_dlm_unregister_pmo_handler();
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct reject_ap_info *ap_info)
{
return dlm_add_bssid_to_reject_list(pdev, ap_info);
}
QDF_STATUS
ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr *bssid_deny_list,
uint8_t num_of_bssid)
{
return dlm_add_userspace_deny_list(pdev, bssid_deny_list,
num_of_bssid);
}
void
ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev *pdev)
{
return wlan_dlm_dump_denylist_bssid(pdev);
}
void
ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
struct qdf_mac_addr bssid,
enum dlm_connection_state con_state)
{
wlan_dlm_update_bssid_connect_params(pdev, bssid, con_state);
}
void
ucfg_dlm_wifi_off(struct wlan_objmgr_pdev *pdev)
{
struct dlm_pdev_priv_obj *dlm_ctx;
struct dlm_psoc_priv_obj *dlm_psoc_obj;
struct dlm_config *cfg;
QDF_STATUS status;
if (!pdev) {
dlm_err("pdev is NULL");
return;
}
dlm_ctx = dlm_get_pdev_obj(pdev);
dlm_psoc_obj = dlm_get_psoc_obj(wlan_pdev_get_psoc(pdev));
if (!dlm_ctx || !dlm_psoc_obj) {
dlm_err("dlm_ctx or dlm_psoc_obj is NULL");
return;
}
status = qdf_mutex_acquire(&dlm_ctx->reject_ap_list_lock);
if (QDF_IS_STATUS_ERROR(status)) {
dlm_err("failed to acquire reject_ap_list_lock");
return;
}
cfg = &dlm_psoc_obj->dlm_cfg;
dlm_flush_reject_ap_list(dlm_ctx);
dlm_send_reject_ap_list_to_fw(pdev, &dlm_ctx->reject_ap_list, cfg);
qdf_mutex_release(&dlm_ctx->reject_ap_list_lock);
}

View File

@ -0,0 +1,100 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare various api which shall be used by
* DISA user configuration and target interface
*/
#ifndef _WLAN_DISA_MAIN_H_
#define _WLAN_DISA_MAIN_H_
#include "wlan_disa_public_struct.h"
#include "wlan_disa_obj_mgmt_public_struct.h"
#include "wlan_disa_priv.h"
#include "wlan_disa_objmgr.h"
#define disa_fatal(params...) \
QDF_TRACE_FATAL(QDF_MODULE_ID_DISA, params)
#define disa_err(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_DISA, params)
#define disa_warn(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_DISA, params)
#define disa_info(params...) \
QDF_TRACE_INFO(QDF_MODULE_ID_DISA, params)
#define disa_debug(params...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_DISA, params)
#define disa_nofl_fatal(params...) \
QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DISA, params)
#define disa_nofl_err(params...) \
QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DISA, params)
#define disa_nofl_warn(params...) \
QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DISA, params)
#define disa_nofl_info(params...) \
QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_DISA, params)
#define disa_nofl_debug(params...) \
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DISA, params)
#define DISA_ENTER() \
QDF_TRACE_ENTER(QDF_MODULE_ID_DISA, "enter")
#define DISA_EXIT() \
QDF_TRACE_EXIT(QDF_MODULE_ID_DISA, "exit")
/**
* disa_allocate_ctx() - Api to allocate disa ctx
*
* Helper function to allocate disa ctx
*
* Return: Success or failure.
*/
QDF_STATUS disa_allocate_ctx(void);
/**
* disa_free_ctx() - to free disa context
*
* Helper function to free disa context
*
* Return: None.
*/
void disa_free_ctx(void);
/**
* disa_get_context() - to get disa context
*
* Helper function to get disa context
*
* Return: disa context.
*/
struct wlan_disa_ctx *disa_get_context(void);
/**
* disa_core_encrypt_decrypt_req() - Form encrypt/decrypt request
* @psoc: objmgr psoc object
* @req: DISA encrypt/decrypt request parameters
* @cb: Response callback for the encrypt/decrypt request
* @cookie: Cookie to pass to the response callback
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_core_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req,
encrypt_decrypt_resp_callback cb,
void *cookie);
#endif /* end of _WLAN_DISA_MAIN_H_ */

View File

@ -0,0 +1,193 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains various object manager related wrappers and helpers
*/
#ifndef _WLAN_DISA_OBJMGR_H
#define _WLAN_DISA_OBJMGR_H
#include "wlan_objmgr_vdev_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_disa_obj_mgmt_public_struct.h"
/* Get/Put Ref */
/**
* disa_psoc_get_ref() - DISA wrapper to increment ref count, if allowed
* @psoc: PSOC object
*
* DISA wrapper to increment ref count after checking valid object state
*
* Return: SUCCESS/FAILURE
*/
static inline QDF_STATUS disa_psoc_get_ref(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_try_get_ref(psoc, WLAN_DISA_ID);
}
/**
* disa_psoc_put_ref() - DISA wrapper to decrement ref count
* @psoc: PSOC object
*
* DISA wrapper to decrement ref count of psoc
*
* Return: SUCCESS/FAILURE
*/
static inline void disa_psoc_put_ref(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_release_ref(psoc, WLAN_DISA_ID);
}
/* Private Data */
/**
* disa_psoc_get_priv_nolock(): DISA wrapper to retrieve component object
* @psoc: Psoc pointer
*
* DISA wrapper used to get the component private object pointer
*
* Return: Component private object
*/
static inline void *disa_psoc_get_priv_nolock(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_DISA);
}
/* Ids */
static inline uint8_t
disa_vdev_get_id(struct wlan_objmgr_vdev *vdev)
{
uint8_t vdev_id;
vdev_id = wlan_vdev_get_id(vdev);
QDF_BUG(vdev_id < WLAN_UMAC_PSOC_MAX_VDEVS);
return vdev_id;
}
/* Tree Navigation */
/*
* !PLEASE READ!
*
* The following are objmgr navigation helpers for traversing objmgr object
* trees.
*
* Objmgr ensures parents of an objmgr object cannot be freed while a valid
* reference to one of its children is held. Based on this fact, all of these
* navigation helpers make the following assumptions to ensure safe usage:
*
* 1) The caller must hold a valid reference to the input objmgr object!
* E.g. Use disa_[peer|vdev|pdev|psoc]_get_ref() on the input objmgr
* object before using these APIs
* 2) Given assumption #1, the caller does not need to hold a reference to the
* parents of the input objmgr object
* 3) Given assumption #1, parents of the input objmgr object cannot be null
* 4) Given assumption #1, private contexts of any parent of the input objmgr
* object cannot be null
*
* These characteristics remove the need for most sanity checks when dealing
* with objmgr objects. However, please note that if you ever walk the tree
* from parent to child, references must be acquired all the way down!
*
* Example #1:
*
* psoc = disa_vdev_get_psoc(vdev);
* if (!psoc)
* // this is dead code
*
* Example #2:
*
* psoc_priv = disa_psoc_get_priv(psoc);
* if (!psoc_priv)
* // this is dead code
*
* Example #3:
*
* status = disa_psoc_get_ref(psoc);
*
* ...
*
* psoc = disa_vdev_get_psoc(vdev);
*
* // the next line is redundant, don't do it!
* status = disa_psoc_get_ref(psoc);
*/
/* Tree Navigation: psoc */
static inline struct disa_psoc_priv_obj *
disa_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
{
struct disa_psoc_priv_obj *psoc_priv;
psoc_priv = disa_psoc_get_priv_nolock(psoc);
QDF_BUG(psoc_priv);
return psoc_priv;
}
static inline struct wlan_objmgr_vdev *
disa_psoc_get_vdev(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
{
struct wlan_objmgr_vdev *vdev;
QDF_BUG(vdev_id < WLAN_UMAC_PSOC_MAX_VDEVS);
if (vdev_id >= WLAN_UMAC_PSOC_MAX_VDEVS)
return NULL;
wlan_psoc_obj_lock(psoc);
vdev = psoc->soc_objmgr.wlan_vdev_list[vdev_id];
wlan_psoc_obj_unlock(psoc);
return vdev;
}
/* Tree Navigation: pdev */
static inline struct wlan_objmgr_psoc *
disa_pdev_get_psoc(struct wlan_objmgr_pdev *pdev)
{
struct wlan_objmgr_psoc *psoc;
psoc = wlan_pdev_get_psoc(pdev);
QDF_BUG(psoc);
return psoc;
}
/* Tree Navigation: vdev */
static inline struct wlan_objmgr_pdev *
disa_vdev_get_pdev(struct wlan_objmgr_vdev *vdev)
{
struct wlan_objmgr_pdev *pdev;
pdev = wlan_vdev_get_pdev(vdev);
QDF_BUG(pdev);
return pdev;
}
static inline struct wlan_objmgr_psoc *
disa_vdev_get_psoc(struct wlan_objmgr_vdev *vdev)
{
return disa_pdev_get_psoc(disa_vdev_get_pdev(vdev));
}
#endif /* _WLAN_DISA_OBJMGR_H */

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare various struct, macros which are used privately in DISA
* component.
*
* Note: This file shall not contain public API's prototype/declarations.
*
*/
#ifndef _WLAN_DISA_PRIV_STRUCT_H_
#define _WLAN_DISA_PRIV_STRUCT_H_
#include <qdf_lock.h>
#include "wlan_disa_public_struct.h"
/**
* struct disa_psoc_priv_obj -psoc specific user configuration required for disa
*
* @disa_rx_ops: rx operations for disa
* @disa_tx_ops: tx operations for disa
* @lock: spin lock for disa psoc priv ctx
*/
struct disa_psoc_priv_obj {
struct wlan_disa_rx_ops disa_rx_ops;
struct wlan_disa_tx_ops disa_tx_ops;
qdf_spinlock_t lock;
};
/**
* struct wlan_disa_ctx - disa context for single command
*
* @callback: hdd callback for disa encrypt/decrypt resp
* @callback_context: context for the callback
* @request_active: true if a request is active
* @lock: spin lock for disa context
*/
struct wlan_disa_ctx {
encrypt_decrypt_resp_callback callback;
void *callback_context;
bool request_active;
qdf_spinlock_t lock;
};
#endif /* end of _WLAN_DISA_PRIV_STRUCT_H_ */

View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement various api / helper function which shall be used for
* DISA user and target interface.
*/
#include "wlan_disa_main.h"
#include "wlan_disa_obj_mgmt_public_struct.h"
#include "wlan_disa_tgt_api.h"
static struct wlan_disa_ctx *gp_disa_ctx;
QDF_STATUS disa_allocate_ctx(void)
{
/* If it is already created, ignore */
if (gp_disa_ctx) {
disa_debug("already allocated disa_ctx");
return QDF_STATUS_SUCCESS;
}
/* allocate DISA ctx */
gp_disa_ctx = qdf_mem_malloc(sizeof(*gp_disa_ctx));
if (!gp_disa_ctx)
return QDF_STATUS_E_NOMEM;
qdf_spinlock_create(&gp_disa_ctx->lock);
return QDF_STATUS_SUCCESS;
}
void disa_free_ctx(void)
{
if (!gp_disa_ctx) {
disa_err("disa ctx is already freed");
QDF_ASSERT(0);
return;
}
qdf_spinlock_destroy(&gp_disa_ctx->lock);
qdf_mem_free(gp_disa_ctx);
gp_disa_ctx = NULL;
}
struct wlan_disa_ctx *disa_get_context(void)
{
return gp_disa_ctx;
}
QDF_STATUS disa_core_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req,
encrypt_decrypt_resp_callback cb,
void *cookie)
{
struct wlan_disa_ctx *disa_ctx;
QDF_STATUS status = QDF_STATUS_SUCCESS;
DISA_ENTER();
disa_ctx = disa_get_context();
if (!disa_ctx) {
disa_err("DISA context is NULL!");
return QDF_STATUS_E_INVAL;
}
qdf_spin_lock_bh(&disa_ctx->lock);
if (!disa_ctx->request_active) {
disa_ctx->callback = cb;
disa_ctx->callback_context = cookie;
disa_ctx->request_active = true;
} else {
status = QDF_STATUS_E_INVAL;
}
qdf_spin_unlock_bh(&disa_ctx->lock);
if (status != QDF_STATUS_SUCCESS) {
disa_err("A request is already active!");
return status;
}
status = disa_psoc_get_ref(psoc);
if (status != QDF_STATUS_SUCCESS) {
disa_err("DISA cannot get the reference out of psoc");
return status;
}
status = tgt_disa_encrypt_decrypt_req(psoc, req);
disa_psoc_put_ref(psoc);
DISA_EXIT();
return status;
}

View File

@ -0,0 +1,116 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: declare utility API related to the disa component
* called by other components
*/
#ifndef _WLAN_DISA_OBJ_MGMT_API_H_
#define _WLAN_DISA_OBJ_MGMT_API_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
/**
* disa_init() - register disa notification handlers.
*
* This function registers disa related notification handlers.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_init(void);
#else
static inline QDF_STATUS disa_init(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_deinit() - unregister disa notification handlers.
*
* This function unregisters disa related notification handlers.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_deinit(void);
#else
static inline QDF_STATUS disa_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_enable() - Trigger psoc enable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc);
#else
static inline QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_disable() - Trigger psoc disable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc);
#else
static inline QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_object_created_notification(): disa psoc create handler
* @psoc: psoc which is going to created by objmgr
* @arg: argument for psoc create handler
*
* Attach psoc private object, register rx/tx ops and event handlers
*
* Return QDF_STATUS status in case of success else return error
*/
QDF_STATUS disa_psoc_object_created_notification(
struct wlan_objmgr_psoc *psoc, void *arg);
/**
* disa_psoc_object_destroyed_notification(): disa psoc destroy handler
* @psoc: objmgr object corresponding to psoc which is going to be destroyed
* @arg: argument for psoc destroy handler
*
* Detach and free psoc private object, unregister event handlers
*
* Return QDF_STATUS status in case of success else return error
*/
QDF_STATUS disa_psoc_object_destroyed_notification(
struct wlan_objmgr_psoc *psoc, void *arg);
#endif /* end of _WLAN_DISA_OBJ_MGMT_API_H_ */

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare various struct, macros which are used for object mgmt in disa.
*
* Note: This file shall not contain public API's prototype/declarations.
*
*/
#ifndef _WLAN_DISA_OBJ_MGMT_PUBLIC_STRUCT_H_
#define _WLAN_DISA_OBJ_MGMT_PUBLIC_STRUCT_H_
struct wlan_objmgr_psoc;
struct disa_encrypt_decrypt_req_params;
struct disa_encrypt_decrypt_resp_params;
/**
* struct wlan_disa_tx_ops - structure of tx operation function
* pointers for disa component
* @disa_encrypt_decrypt_req: send encrypt/decrypt request
* @disa_register_ev_handlers: register disa event handlers
* @disa_unregister_ev_handlers: unregister disa event handlers
*/
struct wlan_disa_tx_ops {
QDF_STATUS (*disa_encrypt_decrypt_req)(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req);
QDF_STATUS (*disa_register_ev_handlers)(struct wlan_objmgr_psoc *psoc);
QDF_STATUS (*disa_unregister_ev_handlers)
(struct wlan_objmgr_psoc *psoc);
};
/**
* struct wlan_disa_rx_ops - structure of rx operation function
* pointers for disa component
* @encrypt_decrypt_msg_resp: send response of encrypt/decrypt request
*/
struct wlan_disa_rx_ops {
QDF_STATUS (*encrypt_decrypt_msg_resp)(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp);
};
#endif /* end of _WLAN_DISA_OBJ_MGMT_PUBLIC_STRUCT_H_ */

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare various struct, macros which shall be used in the DISA
* component.
*
* Note: This file shall not contain public API's prototype/declarations.
*
*/
#ifndef _WLAN_DISA_PUBLIC_STRUCT_H_
#define _WLAN_DISA_PUBLIC_STRUCT_H_
#include <qdf_types.h>
#define MAC_MAX_KEY_LENGTH 32
#define MAC_PN_LENGTH 8
#define MAX_MAC_HEADER_LEN 32
#define MIN_MAC_HEADER_LEN 24
/**
* struct disa_encrypt_decrypt_req_params - disa encrypt request
* @vdev_id: virtual device id
* @key_flag: This indicates firmware to encrypt/decrypt payload
* see ENCRYPT_DECRYPT_FLAG
* @key_idx: Index used in storing key
* @key_cipher: cipher used for encryption/decryption
* Eg: see WMI_CIPHER_AES_CCM for CCMP
* @key_len: length of key data
* @key_txmic_len: length of Tx MIC
* @key_rxmic_len: length of Rx MIC
* @key_data: Key
* @pn: packet number
* @mac_header: MAC header
* @data_len: length of data
* @data: pointer to payload
*/
struct disa_encrypt_decrypt_req_params {
uint32_t vdev_id;
uint8_t key_flag;
uint32_t key_idx;
uint32_t key_cipher;
uint32_t key_len;
uint32_t key_txmic_len;
uint32_t key_rxmic_len;
uint8_t key_data[MAC_MAX_KEY_LENGTH];
uint8_t pn[MAC_PN_LENGTH];
uint8_t mac_header[MAX_MAC_HEADER_LEN];
uint32_t data_len;
uint8_t *data;
};
/**
* struct disa_encrypt_decrypt_resp_params - disa encrypt response
* @vdev_id: vdev id
* @status: status
* @data_len: data length
* @data: data pointer
*/
struct disa_encrypt_decrypt_resp_params {
uint32_t vdev_id;
int32_t status;
uint32_t data_len;
uint8_t *data;
};
/**
* typedef encrypt_decrypt_resp_callback() - DISA callback function
* @cookie: cookie passed in the DISA request
* @resp: the DISA response
*/
typedef void (*encrypt_decrypt_resp_callback)(void *cookie,
struct disa_encrypt_decrypt_resp_params *resp);
#endif /* end of _WLAN_DISA_PUBLIC_STRUCT_H_ */

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare public API for disa to interact with target/WMI
*/
#ifndef _WLAN_DISA_TGT_API_H_
#define _WLAN_DISA_TGT_API_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
struct disa_encrypt_decrypt_req_params;
struct disa_encrypt_decrypt_resp_params;
#define GET_DISA_TX_OPS_FROM_PSOC(psoc) \
(&disa_psoc_get_priv(psoc)->disa_tx_ops)
/**
* tgt_disa_encrypt_decrypt_req() - send encrypt/decrypt request to target if
* @psoc: objmgr psoc object
* @req: encrypt/decrypt parameters
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req);
/**
* tgt_disa_encrypt_decrypt_resp() - receive encrypt/decrypt response
* from target if
* @psoc: objmgr psoc object
* @resp: encrypt/decrypt response containing results
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_disa_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp);
/**
* tgt_disa_register_ev_handlers() - API to register disa event handlers
* @psoc: objmgr psoc object
*
* Return: QDF_STATUS_SUCCESS in case of success else return error
*/
QDF_STATUS tgt_disa_register_ev_handlers(struct wlan_objmgr_psoc *psoc);
/**
* tgt_disa_unregister_ev_handlers() - API to unregister disa event handlers
* @psoc: objmgr psoc object
*
* Return: QDF_STATUS_SUCCESS in case of success else return error
*/
QDF_STATUS tgt_disa_unregister_ev_handlers(struct wlan_objmgr_psoc *psoc);
#endif /* end of _WLAN_DISA_TGT_API_H_ */

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare public API related to the disa called by north bound HDD/OSIF
*/
#ifndef _WLAN_DISA_UCFG_API_H_
#define _WLAN_DISA_UCFG_API_H_
#include "wlan_disa_public_struct.h"
struct wlan_objmgr_psoc;
struct disa_encrypt_decrypt_req_params;
/**
* ucfg_disa_encrypt_decrypt_req() - Send encrypt/decrypt request to the DISA
* core
* @psoc: objmgr psoc object
* @req: DISA encrypt/decrypt request parameters
* @cb: Response callback for the encrypt/decrypt request
* @cookie: Cookie to pass to the response callback
*
* Return: QDF status success or failure
*/
QDF_STATUS ucfg_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req,
encrypt_decrypt_resp_callback cb,
void *cookie);
#endif /* end of _WLAN_DISA_UCFG_API_H_ */

View File

@ -0,0 +1,209 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: define utility API related to the DISA component
* called by other components
*/
#include "wlan_disa_obj_mgmt_api.h"
#include "wlan_disa_main.h"
#include "target_if_disa.h"
#include "wlan_disa_tgt_api.h"
#include "wlan_objmgr_global_obj.h"
/**
* disa_init() - register disa notification handlers.
*
* This function registers disa related notification handlers and
* allocates disa context.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS disa_init(void)
{
QDF_STATUS status;
DISA_ENTER();
if (disa_allocate_ctx() != QDF_STATUS_SUCCESS) {
disa_err("unable to allocate disa ctx");
status = QDF_STATUS_E_FAULT;
goto out;
}
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_DISA,
disa_psoc_object_created_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
disa_err("unable to register psoc create handler");
goto err_free_ctx;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_DISA,
disa_psoc_object_destroyed_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
disa_err("unable to register psoc destroy handler");
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_DISA,
disa_psoc_object_created_notification,
NULL);
} else {
goto out;
}
err_free_ctx:
disa_free_ctx();
out:
DISA_EXIT();
return status;
}
/**
* disa_deinit() - unregister disa notification handlers.
*
* This function unregisters disa related notification handlers and
* frees disa context.
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
QDF_STATUS disa_deinit(void)
{
QDF_STATUS status;
DISA_ENTER();
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_DISA,
disa_psoc_object_destroyed_notification,
NULL);
if (status != QDF_STATUS_SUCCESS)
disa_err("unable to unregister psoc create handle");
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_DISA,
disa_psoc_object_created_notification,
NULL);
if (status != QDF_STATUS_SUCCESS)
disa_err("unable to unregister psoc create handle");
disa_free_ctx();
DISA_EXIT();
return status;
}
/**
* disa_psoc_object_created_notification(): disa psoc create handler
* @psoc: psoc which is going to created by objmgr
* @arg: argument for psoc create handler
*
* Attach psoc private object, register rx/tx ops and event handlers
*
* Return QDF_STATUS status in case of success else return error
*/
QDF_STATUS disa_psoc_object_created_notification(
struct wlan_objmgr_psoc *psoc, void *arg)
{
struct disa_psoc_priv_obj *disa_priv;
QDF_STATUS status;
DISA_ENTER();
disa_priv = qdf_mem_malloc(sizeof(*disa_priv));
if (!disa_priv) {
status = QDF_STATUS_E_NOMEM;
goto out;
}
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_DISA,
(void *)disa_priv, QDF_STATUS_SUCCESS);
if (status != QDF_STATUS_SUCCESS) {
disa_err("Failed to attach disa_priv with psoc");
qdf_mem_free(disa_priv);
goto out;
}
qdf_spinlock_create(&disa_priv->lock);
target_if_disa_register_tx_ops(&disa_priv->disa_tx_ops);
out:
DISA_EXIT();
return status;
}
/**
* disa_psoc_object_destroyed_notification(): disa psoc destroy handler
* @psoc: objmgr object corresponding to psoc which is going to be destroyed
* @arg: argument for psoc destroy handler
*
* Detach and free psoc private object, unregister event handlers
*
* Return QDF_STATUS status in case of success else return error
*/
QDF_STATUS disa_psoc_object_destroyed_notification(
struct wlan_objmgr_psoc *psoc, void *arg)
{
struct disa_psoc_priv_obj *disa_priv = NULL;
QDF_STATUS status = QDF_STATUS_SUCCESS;
DISA_ENTER();
disa_priv = disa_psoc_get_priv(psoc);
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_DISA,
(void *)disa_priv);
if (status != QDF_STATUS_SUCCESS)
disa_err("Failed to detach disa_priv with psoc");
qdf_spinlock_destroy(&disa_priv->lock);
qdf_mem_free(disa_priv);
DISA_EXIT();
return status;
}
/**
* disa_psoc_enable() - Trigger psoc enable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
return tgt_disa_register_ev_handlers(psoc);
}
/**
* disa_psoc_disable() - Trigger psoc disable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
return tgt_disa_unregister_ev_handlers(psoc);
}

View File

@ -0,0 +1,133 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implements public API for disa to interact with target/WMI
*/
#include "wlan_disa_tgt_api.h"
#include "wlan_disa_main.h"
#include "wlan_disa_public_struct.h"
/**
* tgt_disa_encrypt_decrypt_req() - send encrypt/decrypt request to target if
* @psoc: objmgr psoc object
* @req: encrypt/decrypt parameters
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req)
{
struct wlan_disa_tx_ops *disa_tx_ops;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
DISA_ENTER();
disa_tx_ops = GET_DISA_TX_OPS_FROM_PSOC(psoc);
QDF_ASSERT(disa_tx_ops->disa_encrypt_decrypt_req);
if (disa_tx_ops->disa_encrypt_decrypt_req)
status = disa_tx_ops->disa_encrypt_decrypt_req(psoc, req);
DISA_EXIT();
return status;
}
/**
* tgt_disa_encrypt_decrypt_resp() - receive encrypt/decrypt response
* from target if
* @psoc: objmgr psoc object
* @resp: encrypt/decrypt response containing results
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_disa_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp)
{
struct wlan_disa_ctx *disa_ctx;
encrypt_decrypt_resp_callback cb;
void *cookie;
DISA_ENTER();
if (!resp) {
disa_err("encrypt/decrypt resp is null");
return QDF_STATUS_E_NULL_VALUE;
}
disa_ctx = disa_get_context();
if (!disa_ctx) {
disa_err("DISA context is NULL!");
return QDF_STATUS_E_INVAL;
}
qdf_spin_lock_bh(&disa_ctx->lock);
cb = disa_ctx->callback;
disa_ctx->callback = NULL;
cookie = disa_ctx->callback_context;
disa_ctx->callback_context = NULL;
disa_ctx->request_active = false;
qdf_spin_unlock_bh(&disa_ctx->lock);
if (cb)
cb(cookie, resp);
DISA_EXIT();
return QDF_STATUS_SUCCESS;
}
/**
* tgt_disa_register_ev_handlers() - API to register disa event handlers
* @psoc: objmgr psoc object
*
* Return: QDF_STATUS_SUCCESS in case of success else return error
*/
QDF_STATUS tgt_disa_register_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
struct wlan_disa_tx_ops *disa_tx_ops;
disa_tx_ops = GET_DISA_TX_OPS_FROM_PSOC(psoc);
QDF_ASSERT(disa_tx_ops->disa_register_ev_handlers);
if (disa_tx_ops->disa_register_ev_handlers)
return disa_tx_ops->disa_register_ev_handlers(psoc);
return QDF_STATUS_SUCCESS;
}
/**
* tgt_disa_unregister_ev_handlers() - API to unregister disa event handlers
* @psoc: objmgr psoc object
*
* Return: QDF_STATUS_SUCCESS in case of success else return error
*/
QDF_STATUS tgt_disa_unregister_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
struct wlan_disa_tx_ops *disa_tx_ops;
disa_tx_ops = GET_DISA_TX_OPS_FROM_PSOC(psoc);
QDF_ASSERT(disa_tx_ops->disa_unregister_ev_handlers);
if (disa_tx_ops->disa_unregister_ev_handlers)
return disa_tx_ops->disa_unregister_ev_handlers(psoc);
return QDF_STATUS_SUCCESS;
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: public API related to the disa called by north bound HDD/OSIF
*/
#include "wlan_disa_ucfg_api.h"
#include "wlan_disa_main.h"
QDF_STATUS ucfg_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req,
encrypt_decrypt_resp_callback cb,
void *cookie)
{
return disa_core_encrypt_decrypt_req(psoc, req, cb, cookie);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains various object manager related wrappers and helpers
*/
#ifndef __WLAN_DP_OBJMGR_H
#define __WLAN_DP_OBJMGR_H
#include "wlan_cmn.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_peer_obj.h"
#include "wlan_objmgr_vdev_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_utility.h"
struct wlan_dp_intf;
struct wlan_dp_link;
/* Get/Put Ref */
#define dp_comp_peer_get_ref(peer) wlan_objmgr_peer_try_get_ref(peer, WLAN_DP_ID)
#define dp_comp_peer_put_ref(peer) wlan_objmgr_peer_release_ref(peer, WLAN_DP_ID)
#define dp_comp_vdev_get_ref(vdev) wlan_objmgr_vdev_try_get_ref(vdev, WLAN_DP_ID)
#define dp_comp_vdev_put_ref(vdev) wlan_objmgr_vdev_release_ref(vdev, WLAN_DP_ID)
#define dp_comp_pdev_get_ref(pdev) wlan_objmgr_pdev_try_get_ref(pdev, WLAN_DP_ID)
#define dp_comp_pdev_put_ref(pdev) wlan_objmgr_pdev_release_ref(pdev, WLAN_DP_ID)
#define dp_comp_psoc_get_ref(psoc) wlan_objmgr_psoc_try_get_ref(psoc, WLAN_DP_ID)
#define dp_comp_psoc_put_ref(psoc) wlan_objmgr_psoc_release_ref(psoc, WLAN_DP_ID)
/**
* dp_get_peer_priv_obj: get DP priv object from peer object
* @peer: pointer to peer object
*
* Return: pointer to DP peer private object
*/
static inline struct wlan_dp_sta_info *
dp_get_peer_priv_obj(struct wlan_objmgr_peer *peer)
{
struct wlan_dp_sta_info *peer_info;
peer_info = wlan_objmgr_peer_get_comp_private_obj(peer, WLAN_COMP_DP);
if (!peer_info) {
dp_err("peer is null");
return NULL;
}
return peer_info;
}
/**
* dp_get_vdev_priv_obj() - Wrapper to retrieve vdev priv obj
* @vdev: vdev pointer
*
* Return: DP vdev private object
*/
static inline struct wlan_dp_link *
dp_get_vdev_priv_obj(struct wlan_objmgr_vdev *vdev)
{
struct wlan_dp_link *obj;
if (!vdev) {
dp_err("vdev is null");
return NULL;
}
obj = wlan_objmgr_vdev_get_comp_private_obj(vdev, WLAN_COMP_DP);
return obj;
}
/**
* dp_psoc_get_priv() - Wrapper to retrieve psoc priv obj
* @psoc: psoc pointer
*
* Return: DP psoc private object
*/
static inline struct wlan_dp_psoc_context *
dp_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
{
struct wlan_dp_psoc_context *dp_ctx;
dp_ctx = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_COMP_DP);
QDF_BUG(dp_ctx);
return dp_ctx;
}
/**
* dp_objmgr_get_vdev_by_user() - Get reference of vdev from dp_link
* with user id
* @dp_link: DP link handle
* @dbgid: reference count dbg id
*
* Return: pointer to vdev object for success, NULL for failure
*/
#ifdef WLAN_OBJMGR_REF_ID_TRACE
#define dp_objmgr_get_vdev_by_user(dp_link, dbgid) \
__dp_objmgr_get_vdev_by_user(dp_link, dbgid, __func__, __LINE__)
struct wlan_objmgr_vdev *
__dp_objmgr_get_vdev_by_user(struct wlan_dp_link *dp_link,
wlan_objmgr_ref_dbgid id,
const char *func,
int line);
#else
#define dp_objmgr_get_vdev_by_user(dp_link, dbgid) \
__dp_objmgr_get_vdev_by_user(dp_link, dbgid, __func__)
struct wlan_objmgr_vdev *
__dp_objmgr_get_vdev_by_user(struct wlan_dp_link *dp_link,
wlan_objmgr_ref_dbgid id,
const char *func);
#endif
/**
* dp_objmgr_put_vdev_by_user() - Release reference of vdev object with
* user id
* @vdev: pointer to vdev object
* @dbgid: reference count dbg id
*
* This API releases vdev object reference which was acquired using
* dp_objmgr_get_vdev_by_user().
*
* Return: void
*/
#ifdef WLAN_OBJMGR_REF_ID_TRACE
#define dp_objmgr_put_vdev_by_user(vdev, dbgid) \
__dp_objmgr_put_vdev_by_user(vdev, dbgid, __func__, __LINE__)
void
__dp_objmgr_put_vdev_by_user(struct wlan_objmgr_vdev *vdev,
wlan_objmgr_ref_dbgid id, const char *func,
int line);
#else
#define dp_objmgr_put_vdev_by_user(vdev, dbgid) \
__dp_objmgr_put_vdev_by_user(vdev, dbgid, __func__)
void
__dp_objmgr_put_vdev_by_user(struct wlan_objmgr_vdev *vdev,
wlan_objmgr_ref_dbgid id, const char *func);
#endif
#endif /* __WLAN_DP_OBJMGR_H */

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: WLAN Host Device Driver periodic STA statistics related implementation
*/
#if !defined(WLAN_DP_PERIODIC_STA_STATS_H)
#define WLAN_DP_PERIODIC_STA_STATS_H
#include "wlan_dp_priv.h"
#include "wlan_objmgr_psoc_obj.h"
#ifdef WLAN_FEATURE_PERIODIC_STA_STATS
/**
* dp_periodic_sta_stats_config() - Initialize periodic stats configuration
* @config: Pointer to dp configuration
* @psoc: Pointer to psoc
*
* Return: none
*/
void dp_periodic_sta_stats_config(struct wlan_dp_psoc_cfg *config,
struct wlan_objmgr_psoc *psoc);
/**
* dp_periodic_sta_stats_init() - Initialize periodic stats display flag
* @dp_intf: Pointer to the station interface
*
* Return: none
*/
void dp_periodic_sta_stats_init(struct wlan_dp_intf *dp_intf);
/**
* dp_periodic_sta_stats_display() - Display periodic stats at STA
* @dp_ctx: dp context
*
* Return: none
*/
void dp_periodic_sta_stats_display(struct wlan_dp_psoc_context *dp_ctx);
/**
* dp_periodic_sta_stats_start() - Start displaying periodic stats for STA
* @vdev: vdev handle
*
* Return: none
*/
void dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev);
/**
* dp_periodic_sta_stats_stop() - Stop displaying periodic stats for STA
* @vdev: vdev handle
*
* Return: none
*/
void dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev);
/**
* dp_periodic_sta_stats_mutex_create() - Create mutex for STA periodic stats
* @dp_intf: Pointer to the station interface
*
* Return: none
*/
void dp_periodic_sta_stats_mutex_create(struct wlan_dp_intf *dp_intf);
/**
* dp_periodic_sta_stats_mutex_destroy() - Destroy STA periodic stats mutex
* @dp_intf: Pointer to the station interface
*
* Return: none
*/
void dp_periodic_sta_stats_mutex_destroy(struct wlan_dp_intf *dp_intf);
#else
static inline void
dp_periodic_sta_stats_display(struct wlan_dp_psoc_context *dp_ctx)
{
}
static inline void
dp_periodic_sta_stats_config(struct wlan_dp_psoc_cfg *config,
struct wlan_objmgr_psoc *psoc)
{
}
static inline void dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev)
{
}
static inline void dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev)
{
}
static inline void
dp_periodic_sta_stats_init(struct wlan_dp_intf *dp_intf)
{
}
static inline void
dp_periodic_sta_stats_mutex_create(struct wlan_dp_intf *dp_intf)
{
}
static inline void
dp_periodic_sta_stats_mutex_destroy(struct wlan_dp_intf *dp_intf)
{
}
#endif /* end #ifdef WLAN_FEATURE_PERIODIC_STA_STATS */
#endif /* end #if !defined(WLAN_DP_PERIODIC_STA_STATS_H) */

View File

@ -0,0 +1,163 @@
/*
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _WLAN_DP_PREALLOC_H
#define _WLAN_DP_PREALLOC_H
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_dp_rx_thread.h>
#include <qdf_trace.h>
#include <cdp_txrx_cmn_struct.h>
#include <cdp_txrx_cmn.h>
#ifdef DP_MEM_PRE_ALLOC
/**
* dp_prealloc_init() - Pre-allocate DP memory
* @ctrl_psoc: objmgr psoc
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_prealloc_init(struct cdp_ctrl_objmgr_psoc *ctrl_psoc);
/**
* dp_prealloc_deinit() - Free pre-alloced DP memory
*
* Return: None
*/
void dp_prealloc_deinit(void);
/**
* dp_prealloc_get_context_memory() - gets pre-alloc DP context memory from
* global pool
* @ctxt_type: type of DP context
* @ctxt_size: size of memory needed
*
* This is done only as part of init happening in a single context. Hence
* no lock is used for protection
*
* Return: Address of context
*/
void *dp_prealloc_get_context_memory(uint32_t ctxt_type, qdf_size_t ctxt_size);
/**
* dp_prealloc_put_context_memory() - puts back pre-alloc DP context memory to
* global pool
* @ctxt_type: type of DP context
* @vaddr: address of DP context
*
* This is done only as part of de-init happening in a single context. Hence
* no lock is used for protection
*
* Return: Failure if address not found
*/
QDF_STATUS dp_prealloc_put_context_memory(uint32_t ctxt_type, void *vaddr);
/**
* dp_prealloc_get_coherent() - gets pre-alloc DP memory
* @size: size of memory needed
* @base_vaddr_unaligned: Unaligned virtual address.
* @paddr_unaligned: Unaligned physical address.
* @paddr_aligned: Aligned physical address.
* @align: Base address alignment.
* @align: alignment needed
* @ring_type: HAL ring type
*
* The function does not handle concurrent access to pre-alloc memory.
* All ring memory allocation from pre-alloc memory should happen from single
* context to avoid race conditions.
*
* Return: unaligned virtual address if success or null if memory alloc fails.
*/
void *dp_prealloc_get_coherent(uint32_t *size, void **base_vaddr_unaligned,
qdf_dma_addr_t *paddr_unaligned,
qdf_dma_addr_t *paddr_aligned,
uint32_t align,
uint32_t ring_type);
/**
* dp_prealloc_put_coherent() - puts back pre-alloc DP memory
* @size: size of memory to be returned
* @vaddr_unligned: Unaligned virtual address.
* @paddr: Physical address
*
* Return: None
*/
void dp_prealloc_put_coherent(qdf_size_t size, void *vaddr_unligned,
qdf_dma_addr_t paddr);
/**
* dp_prealloc_get_multi_pages() - gets pre-alloc DP multi-pages memory
* @src_type: the source that do memory allocation
* @element_size: single element size
* @element_num: total number of elements should be allocated
* @pages: multi page information storage
* @cacheable: coherent memory or cacheable memory
*
* Return: None.
*/
void dp_prealloc_get_multi_pages(uint32_t src_type,
qdf_size_t element_size,
uint16_t element_num,
struct qdf_mem_multi_page_t *pages,
bool cacheable);
/**
* dp_prealloc_put_multi_pages() - puts back pre-alloc DP multi-pages memory
* @src_type: the source that do memory freement
* @pages: multi page information storage
*
* Return: None
*/
void dp_prealloc_put_multi_pages(uint32_t src_type,
struct qdf_mem_multi_page_t *pages);
/**
* dp_prealloc_get_consistent_mem_unaligned() - gets pre-alloc unaligned
* consistent memory
* @size: total memory size
* @base_addr: pointer to dma address
* @ring_type: HAL ring type that requires memory
*
* Return: memory virtual address pointer on success, NULL on failure
*/
void *dp_prealloc_get_consistent_mem_unaligned(qdf_size_t size,
qdf_dma_addr_t *base_addr,
uint32_t ring_type);
/**
* dp_prealloc_put_consistent_mem_unaligned() - puts back pre-alloc unaligned
* consistent memory
* @va_unaligned: memory virtual address pointer
*
* Return: None
*/
void dp_prealloc_put_consistent_mem_unaligned(void *va_unaligned);
#else
static inline
QDF_STATUS dp_prealloc_init(struct cdp_ctrl_objmgr_psoc *ctrl_psoc)
{
return QDF_STATUS_SUCCESS;
}
static inline void dp_prealloc_deinit(void) { }
#endif
uint32_t dp_get_tx_inqueue(ol_txrx_soc_handle soc);
#endif /* _WLAN_DP_PREALLOC_H */

View File

@ -0,0 +1,979 @@
/*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Declare various struct, macros which are used for private to DP.
*
* Note: This file shall not contain public API's prototype/declarations.
*
*/
#ifndef _WLAN_DP_PRIV_STRUCT_H_
#define _WLAN_DP_PRIV_STRUCT_H_
#include "wlan_dp_public_struct.h"
#include "cdp_txrx_cmn.h"
#include "wlan_dp_cfg.h"
#include "wlan_dp_objmgr.h"
#include <cdp_txrx_misc.h>
#include <wlan_dp_rx_thread.h>
#include "qdf_periodic_work.h"
#include <cds_api.h>
#include "pld_common.h"
#include "wlan_dp_nud_tracking.h"
#include <i_qdf_net_stats.h>
#include <qdf_types.h>
#include "htc_api.h"
#include "wlan_dp_wfds.h"
#ifndef NUM_TX_RX_HISTOGRAM
#define NUM_TX_RX_HISTOGRAM 128
#endif
#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
#if defined(WLAN_FEATURE_DP_BUS_BANDWIDTH) && defined(FEATURE_RUNTIME_PM)
/**
* enum dp_rtpm_tput_policy_state - states to track runtime_pm tput policy
* @DP_RTPM_TPUT_POLICY_STATE_INVALID: invalid state
* @DP_RTPM_TPUT_POLICY_STATE_REQUIRED: state indicating runtime_pm is required
* @DP_RTPM_TPUT_POLICY_STATE_NOT_REQUIRED: state indicating runtime_pm is NOT
* required
*/
enum dp_rtpm_tput_policy_state {
DP_RTPM_TPUT_POLICY_STATE_INVALID,
DP_RTPM_TPUT_POLICY_STATE_REQUIRED,
DP_RTPM_TPUT_POLICY_STATE_NOT_REQUIRED
};
/**
* struct dp_rtpm_tput_policy_context - RTPM throughput policy context
* @curr_state: current state of throughput policy (RTPM require or not)
* @wake_lock: wakelock for QDF wake_lock acquire/release APIs
* @rtpm_lock: lock use for QDF rutime PM prevent/allow APIs
* @high_tput_vote: atomic variable to keep track of voting
*/
struct dp_rtpm_tput_policy_context {
enum dp_rtpm_tput_policy_state curr_state;
qdf_wake_lock_t wake_lock;
qdf_runtime_lock_t rtpm_lock;
qdf_atomic_t high_tput_vote;
};
#endif
#define FISA_FLOW_MAX_AGGR_COUNT 16 /* max flow aggregate count */
/**
* struct wlan_dp_psoc_cfg - DP configuration parameters.
* @tx_orphan_enable: Enable/Disable tx orphan
* @rx_mode: rx mode for packet processing
* @tx_comp_loop_pkt_limit: max # of packets to be processed
* @rx_reap_loop_pkt_limit: max # of packets to be reaped
* @rx_hp_oos_update_limit: max # of HP OOS (out of sync)
* @rx_softirq_max_yield_duration_ns: max duration for RX softirq
* @periodic_stats_timer_interval: Print selective stats on this specified
* interval
* @periodic_stats_timer_duration: duration for which periodic timer should run
* @bus_bw_super_high_threshold: bus bandwidth super high threshold
* @bus_bw_ultra_high_threshold: bus bandwidth ultra high threshold
* @bus_bw_very_high_threshold: bus bandwidth very high threshold
* @bus_bw_mid_high_threshold: bus bandwidth mid high threshold
* @bus_bw_dbs_threshold: bus bandwidth for DBS mode threshold
* @bus_bw_high_threshold: bus bandwidth high threshold
* @bus_bw_medium_threshold: bandwidth threshold for medium bandwidth
* @bus_bw_low_threshold: bandwidth threshold for low bandwidth
* @bus_bw_compute_interval: bus bandwidth compute interval
* @enable_tcp_delack: enable Dynamic Configuration of Tcp Delayed Ack
* @enable_tcp_limit_output: enable TCP limit output
* @enable_tcp_adv_win_scale: enable TCP adv window scaling
* @tcp_delack_thres_high: High Threshold inorder to trigger TCP Del Ack
* indication
* @tcp_delack_thres_low: Low Threshold inorder to trigger TCP Del Ack
* indication
* @tcp_tx_high_tput_thres: High Threshold inorder to trigger High Tx
* Throughput requirement.
* @tcp_delack_timer_count: Del Ack Timer Count inorder to trigger TCP Del Ack
* indication
* @enable_tcp_param_update: enable tcp parameter update
* @bus_low_cnt_threshold: Threshold count to trigger low Tput GRO flush skip
* @enable_latency_crit_clients: Enable the handling of latency critical clients
* * @del_ack_enable: enable Dynamic Configuration of Tcp Delayed Ack
* @del_ack_threshold_high: High Threshold inorder to trigger TCP delay ack
* @del_ack_threshold_low: Low Threshold inorder to trigger TCP delay ack
* @del_ack_timer_value: Timeout value (ms) to send out all TCP del ack frames
* @del_ack_pkt_count: The maximum number of TCP delay ack frames
* @rx_thread_ul_affinity_mask: CPU mask to affine Rx_thread
* @rx_thread_affinity_mask: CPU mask to affine Rx_thread
* @cpu_map_list: RPS map for different RX queues
* @multicast_replay_filter: enable filtering of replayed multicast packets
* @rx_wakelock_timeout: Amount of time to hold wakelock for RX unicast packets
* @num_dp_rx_threads: number of dp rx threads
* @enable_dp_trace: Enable/Disable DP trace
* @dp_trace_config: DP trace configuration
* @enable_nud_tracking: Enable/Disable nud tracking
* @pkt_bundle_threshold_high: tx bundle high threshold
* @pkt_bundle_threshold_low: tx bundle low threshold
* @pkt_bundle_timer_value: tx bundle timer value in ms
* @pkt_bundle_size: tx bundle size
* @dp_proto_event_bitmap: Control for which protocol type diag log should be
* sent
* @fisa_enable: Enable/Disable FISA
* @icmp_req_to_fw_mark_interval: Interval to mark the ICMP Request packet to
* be sent to FW.
* @lro_enable: Enable/Disable lro
* @gro_enable: Enable/Disable gro
* @is_rx_fisa_enabled: flag to enable/disable FISA Rx
* @is_rx_fisa_lru_del_enabled: flag to enable/disable FST entry delete
*/
struct wlan_dp_psoc_cfg {
bool tx_orphan_enable;
uint32_t rx_mode;
uint32_t tx_comp_loop_pkt_limit;
uint32_t rx_reap_loop_pkt_limit;
uint32_t rx_hp_oos_update_limit;
uint64_t rx_softirq_max_yield_duration_ns;
#ifdef WLAN_FEATURE_PERIODIC_STA_STATS
uint32_t periodic_stats_timer_interval;
uint32_t periodic_stats_timer_duration;
#endif /* WLAN_FEATURE_PERIODIC_STA_STATS */
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
uint32_t bus_bw_super_high_threshold;
uint32_t bus_bw_ultra_high_threshold;
uint32_t bus_bw_very_high_threshold;
uint32_t bus_bw_dbs_threshold;
uint32_t bus_bw_mid_high_threshold;
uint32_t bus_bw_high_threshold;
uint32_t bus_bw_medium_threshold;
uint32_t bus_bw_low_threshold;
uint32_t bus_bw_compute_interval;
uint32_t enable_tcp_delack;
bool enable_tcp_limit_output;
uint32_t enable_tcp_adv_win_scale;
uint32_t tcp_delack_thres_high;
uint32_t tcp_delack_thres_low;
uint32_t tcp_tx_high_tput_thres;
uint32_t tcp_delack_timer_count;
bool enable_tcp_param_update;
uint32_t bus_low_cnt_threshold;
bool enable_latency_crit_clients;
#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
#ifdef QCA_SUPPORT_TXRX_DRIVER_TCP_DEL_ACK
bool del_ack_enable;
uint32_t del_ack_threshold_high;
uint32_t del_ack_threshold_low;
uint16_t del_ack_timer_value;
uint16_t del_ack_pkt_count;
#endif
uint32_t rx_thread_ul_affinity_mask;
uint32_t rx_thread_affinity_mask;
uint8_t cpu_map_list[CFG_DP_RPS_RX_QUEUE_CPU_MAP_LIST_LEN];
bool multicast_replay_filter;
uint32_t rx_wakelock_timeout;
uint8_t num_dp_rx_threads;
#ifdef CONFIG_DP_TRACE
bool enable_dp_trace;
uint8_t dp_trace_config[DP_TRACE_CONFIG_STRING_LENGTH];
#endif
uint8_t enable_nud_tracking;
#ifdef WLAN_SUPPORT_TXRX_HL_BUNDLE
uint32_t pkt_bundle_threshold_high;
uint32_t pkt_bundle_threshold_low;
uint16_t pkt_bundle_timer_value;
uint16_t pkt_bundle_size;
#endif
uint32_t dp_proto_event_bitmap;
uint32_t fisa_enable;
int icmp_req_to_fw_mark_interval;
bool lro_enable;
bool gro_enable;
#ifdef WLAN_SUPPORT_RX_FISA
bool is_rx_fisa_enabled;
bool is_rx_fisa_lru_del_enabled;
#endif
};
/**
* struct tx_rx_histogram: structure to keep track of tx and rx packets
* received over 100ms intervals
* @interval_rx: # of rx packets received in the last 100ms interval
* @interval_tx: # of tx packets received in the last 100ms interval
* @next_vote_level: pld_bus_width_type voting level (high or low)
* determined on the basis of total tx and rx packets
* received in the last 100ms interval
* @next_rx_level: pld_bus_width_type voting level (high or low)
* determined on the basis of rx packets received in the
* last 100ms interval
* @next_tx_level: pld_bus_width_type voting level (high or low)
* determined on the basis of tx packets received in the
* last 100ms interval
* @is_rx_pm_qos_high: Capture rx_pm_qos voting
* @is_tx_pm_qos_high: Capture tx_pm_qos voting
* @qtime: timestamp when the record is added
*
* The structure keeps track of throughput requirements of wlan driver.
* An entry is added if either of next_vote_level, next_rx_level or
* next_tx_level changes. An entry is not added for every 100ms interval.
*/
struct tx_rx_histogram {
uint64_t interval_rx;
uint64_t interval_tx;
uint32_t next_vote_level;
uint32_t next_rx_level;
uint32_t next_tx_level;
bool is_rx_pm_qos_high;
bool is_tx_pm_qos_high;
uint64_t qtime;
};
/**
* struct dp_stats - DP stats
* @tx_rx_stats : Tx/Rx debug stats
* @arp_stats: arp debug stats
* @dns_stats: dns debug stats
* @tcp_stats: tcp debug stats
* @icmpv4_stats: icmpv4 debug stats
* @dhcp_stats: dhcp debug stats
* @eapol_stats: eapol debug stats
*/
struct dp_stats {
struct dp_tx_rx_stats tx_rx_stats;
struct dp_arp_stats arp_stats;
struct dp_dns_stats dns_stats;
struct dp_tcp_stats tcp_stats;
struct dp_icmpv4_stats icmpv4_stats;
struct dp_dhcp_stats dhcp_stats;
struct dp_eapol_stats eapol_stats;
};
/**
* enum dhcp_phase - Per Peer DHCP Phases
* @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or
* DHCP_DELINE message in OFFER phase
* @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
* @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
* @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or
* ACK phase (Renewal process)
*/
enum dhcp_phase {
DHCP_PHASE_ACK,
DHCP_PHASE_DISCOVER,
DHCP_PHASE_OFFER,
DHCP_PHASE_REQUEST
};
/**
* enum dhcp_nego_status - Per Peer DHCP Negotiation Status
* @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated
* @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST
* (Renewal process) phase
*/
enum dhcp_nego_status {
DHCP_NEGO_STOP,
DHCP_NEGO_IN_PROGRESS
};
/*
* Pending frame type of EAP_FAILURE, bit number used in "pending_eap_frm_type"
* of sta_info.
*/
#define DP_PENDING_TYPE_EAP_FAILURE 0
enum bss_intf_state {
BSS_INTF_STOP,
BSS_INTF_START,
};
struct wlan_dp_sta_info {
struct qdf_mac_addr sta_mac;
unsigned long pending_eap_frm_type;
enum dhcp_phase dhcp_phase;
enum dhcp_nego_status dhcp_nego_status;
};
struct wlan_dp_conn_info {
struct qdf_mac_addr bssid;
struct qdf_mac_addr peer_macaddr;
uint8_t proxy_arp_service;
uint8_t is_authenticated;
};
/**
* struct link_monitoring - link speed monitoring related info
* @enabled: Is link speed monitoring feature enabled
* @rx_linkspeed_threshold: link speed good/bad threshold
* @is_rx_linkspeed_good: true means rx link speed good, false means bad
*/
struct link_monitoring {
uint8_t enabled;
uint32_t rx_linkspeed_threshold;
uint8_t is_rx_linkspeed_good;
};
/**
* struct direct_link_info - direct link configuration items
* @config_set: is the direct link config active
* @low_latency: is low latency enabled
*/
struct direct_link_info {
bool config_set;
bool low_latency;
};
/**
* struct dp_fisa_reo_mismatch_stats - reo mismatch sub-case stats for FISA
* @allow_cce_match: packet allowed due to cce mismatch
* @allow_fse_metdata_mismatch: packet allowed since it belongs to same flow,
* only fse_metadata is not same.
* @allow_non_aggr: packet allowed due to any other reason.
*/
struct dp_fisa_reo_mismatch_stats {
uint32_t allow_cce_match;
uint32_t allow_fse_metdata_mismatch;
uint32_t allow_non_aggr;
};
/**
* struct dp_fisa_stats - FISA stats
* @invalid_flow_index: flow index invalid from RX HW TLV
* @update_deferred: workqueue deferred due to suspend
* @reo_mismatch: REO ID mismatch
* @incorrect_rdi: Incorrect REO dest indication in TLV
* (typically used for RDI = 0)
*/
struct dp_fisa_stats {
uint32_t invalid_flow_index;
uint32_t update_deferred;
struct dp_fisa_reo_mismatch_stats reo_mismatch;
uint32_t incorrect_rdi;
};
/**
* enum fisa_aggr_ret - FISA aggregation return code
* @FISA_AGGR_DONE: FISA aggregation done
* @FISA_AGGR_NOT_ELIGIBLE: Not eligible for FISA aggregation
* @FISA_FLUSH_FLOW: FISA flow flushed
*/
enum fisa_aggr_ret {
FISA_AGGR_DONE,
FISA_AGGR_NOT_ELIGIBLE,
FISA_FLUSH_FLOW
};
/**
* struct fisa_pkt_hist - FISA Packet history structure
* @tlv_hist: array of TLV history
* @ts_hist: array of timestamps of fisa packets
* @idx: index indicating the next location to be used in the array.
*/
struct fisa_pkt_hist {
uint8_t *tlv_hist;
qdf_time_t ts_hist[FISA_FLOW_MAX_AGGR_COUNT];
uint32_t idx;
};
/**
* struct dp_fisa_rx_sw_ft - FISA Flow table entry
* @hw_fse: HAL Rx Flow Search Entry which matches HW definition
* @flow_hash: Flow hash value
* @flow_id_toeplitz: toeplitz hash value
* @flow_id: Flow index, equivalent to hash value truncated to FST size
* @stats: Stats tracking for this flow
* @is_ipv4_addr_entry: Flag indicating whether flow is IPv4 address tuple
* @is_valid: Flag indicating whether flow is valid
* @is_populated: Flag indicating whether flow is populated
* @is_flow_udp: Flag indicating whether flow is UDP stream
* @is_flow_tcp: Flag indicating whether flow is TCP stream
* @head_skb: HEAD skb where flow is aggregated
* @cumulative_l4_checksum: Cumulative L4 checksum
* @adjusted_cumulative_ip_length: Cumulative IP length
* @cur_aggr: Current aggregate length of flow
* @napi_flush_cumulative_l4_checksum: Cumulative L4 chekcsum for current
* NAPI flush
* @napi_flush_cumulative_ip_length: Cumulative IP length
* @last_skb: The last skb aggregated in the FISA flow
* @head_skb_ip_hdr_offset: IP header offset
* @head_skb_l4_hdr_offset: L4 header offset
* @rx_flow_tuple_info: RX tuple information
* @napi_id: NAPI ID (REO ID) on which the flow is being received
* @vdev: VDEV handle corresponding to the FLOW
* @vdev_id: DP vdev id
* @dp_intf: DP interface handle corresponding to the flow
* @bytes_aggregated: Number of bytes currently aggregated
* @flush_count: Number of Flow flushes done
* @aggr_count: Aggregation count
* @do_not_aggregate: Flag to indicate not to aggregate this flow
* @hal_cumultive_ip_len: HAL cumulative IP length
* @dp_ctx: DP component handle
* @soc_hdl: DP SoC handle
* @last_hal_aggr_count: last aggregate count fetched from RX PKT TLV
* @cur_aggr_gso_size: Current aggreagtesd GSO size
* @head_skb_udp_hdr: UDP header address for HEAD skb
* @frags_cumulative_len:
* @cmem_offset: CMEM offset
* @metadata:
* @reo_dest_indication: REO destination indication for the FLOW
* @flow_init_ts: FLOW init timestamp
* @last_accessed_ts: Timestamp when the flow was last accessed
* @pkt_hist: FISA aggreagtion packets history
* @same_mld_vdev_mismatch: Packets flushed after vdev_mismatch on same MLD
* @add_timestamp: FISA entry created timestamp
*/
struct dp_fisa_rx_sw_ft {
void *hw_fse;
uint32_t flow_hash;
uint32_t flow_id_toeplitz;
uint32_t flow_id;
struct cdp_flow_stats stats;
uint8_t is_ipv4_addr_entry;
uint8_t is_valid;
uint8_t is_populated;
uint8_t is_flow_udp;
uint8_t is_flow_tcp;
qdf_nbuf_t head_skb;
uint16_t cumulative_l4_checksum;
uint16_t adjusted_cumulative_ip_length;
uint16_t cur_aggr;
uint16_t napi_flush_cumulative_l4_checksum;
uint16_t napi_flush_cumulative_ip_length;
qdf_nbuf_t last_skb;
uint32_t head_skb_ip_hdr_offset;
uint32_t head_skb_l4_hdr_offset;
struct cdp_rx_flow_tuple_info rx_flow_tuple_info;
uint8_t napi_id;
struct dp_vdev *vdev;
uint8_t vdev_id;
struct wlan_dp_intf *dp_intf;
uint64_t bytes_aggregated;
uint32_t flush_count;
uint32_t aggr_count;
uint8_t do_not_aggregate;
uint16_t hal_cumultive_ip_len;
struct wlan_dp_psoc_context *dp_ctx;
/* TODO - Only reference needed to this is to get vdev.
* Once that ref is removed, this field can be deleted
*/
struct dp_soc *soc_hdl;
uint32_t last_hal_aggr_count;
uint32_t cur_aggr_gso_size;
qdf_net_udphdr_t *head_skb_udp_hdr;
uint16_t frags_cumulative_len;
uint32_t cmem_offset;
uint32_t metadata;
uint32_t reo_dest_indication;
qdf_time_t flow_init_ts;
qdf_time_t last_accessed_ts;
#ifdef WLAN_SUPPORT_RX_FISA_HIST
struct fisa_pkt_hist pkt_hist;
#endif
uint64_t same_mld_vdev_mismatch;
uint64_t add_timestamp;
};
#define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_fisa_rx_sw_ft)
#define MAX_FSE_CACHE_FL_HST 10
/**
* struct fse_cache_flush_history - Debug history cache flush
* @timestamp: Entry update timestamp
* @flows_added: Number of flows added for this flush
* @flows_deleted: Number of flows deleted for this flush
*/
struct fse_cache_flush_history {
uint64_t timestamp;
uint32_t flows_added;
uint32_t flows_deleted;
};
/**
* struct dp_rx_fst - FISA handle
* @base: Software (DP) FST
* @dp_ctx: DP component handle
* @hal_rx_fst: Pointer to HAL FST
* @hal_rx_fst_base_paddr: Base physical address of HAL RX HW FST
* @max_entries: Maximum number of flows FSE supports
* @num_entries: Num entries in flow table
* @max_skid_length: SKID Length
* @hash_mask: Hash mask to obtain legitimate hash entry
* @dp_rx_fst_lock: Lock for adding/deleting entries of FST
* @add_flow_count: Num of flows added
* @del_flow_count: Num of flows deleted
* @hash_collision_cnt: Num hash collisions
* @soc_hdl: DP SoC handle
* @fse_cache_flush_posted: Num FSE cache flush cmds posted
* @fse_cache_flush_timer: FSE cache flush timer
* @fse_cache_flush_allow: Flag to indicate if FSE cache flush is allowed
* @cache_fl_rec: FSE cache flush history
* @stats: FISA stats
* @fst_update_work: FST CMEM update work
* @fst_update_wq: FST CMEM update workqueue
* @fst_update_list: List to post event to CMEM update work
* @meta_counter:
* @cmem_ba:
* @dp_rx_sw_ft_lock: SW FST lock
* @cmem_resp_event: CMEM response event indicator
* @flow_deletion_supported: Flag to indicate if flow delete is supported
* @fst_in_cmem: Flag to indicate if FST is stored in CMEM
* @pm_suspended: Flag to indicate if driver is suspended
* @fst_wq_defer:
* @rx_hash_enabled: Flag to indicate if Hash based routing supported
* @rx_toeplitz_hash_key: hash key
* @rx_pkt_tlv_size: RX packet TLV size
*/
struct dp_rx_fst {
uint8_t *base;
struct wlan_dp_psoc_context *dp_ctx;
struct hal_rx_fst *hal_rx_fst;
uint64_t hal_rx_fst_base_paddr;
uint16_t max_entries;
uint16_t num_entries;
uint16_t max_skid_length;
uint32_t hash_mask;
qdf_spinlock_t dp_rx_fst_lock;
uint32_t add_flow_count;
uint32_t del_flow_count;
uint32_t hash_collision_cnt;
struct dp_soc *soc_hdl;
qdf_atomic_t fse_cache_flush_posted;
qdf_timer_t fse_cache_flush_timer;
bool fse_cache_flush_allow;
struct fse_cache_flush_history cache_fl_rec[MAX_FSE_CACHE_FL_HST];
struct dp_fisa_stats stats;
/* CMEM params */
qdf_work_t fst_update_work;
qdf_workqueue_t *fst_update_wq;
qdf_list_t fst_update_list;
uint32_t meta_counter;
uint32_t cmem_ba;
qdf_spinlock_t dp_rx_sw_ft_lock[MAX_REO_DEST_RINGS];
qdf_event_t cmem_resp_event;
bool flow_deletion_supported;
bool fst_in_cmem;
qdf_atomic_t pm_suspended;
bool fst_wq_defer;
bool rx_hash_enabled;
uint8_t *rx_toeplitz_hash_key;
uint16_t rx_pkt_tlv_size;
};
/**
* struct wlan_dp_intf - DP interface object related info
* @dp_ctx: DP context reference
* @link_monitoring: Link monitoring related info
* @mac_addr: Device MAC address
* @device_mode: Device Mode
* @intf_id: Interface ID
* @node: list node for membership in the interface list
* @dev: netdev reference
* @txrx_ops: Interface tx-rx ops
* @dp_stats: Device TX/RX statistics
* @is_sta_periodic_stats_enabled: Indicate whether to display sta periodic
* stats
* @periodic_stats_timer_count: count of periodic stats timer
* @periodic_stats_timer_counter: periodic stats timer counter
* @sta_periodic_stats_lock: sta periodic stats lock
* @stats: netdev stats
* @con_status: con_status value
* @dad: dad value
* @pkt_type_bitmap: packet type bitmap value
* @track_arp_ip: track ARP ip
* @dns_payload: dns payload
* @track_dns_domain_len: dns domain length
* @track_src_port: track source port value
* @track_dest_port: track destination port value
* @track_dest_ipv4: track destination ipv4 value
* @prev_rx_packets: Rx packets received N/W interface
* @prev_tx_packets: Tx packets transmitted on N/W interface
* @prev_tx_bytes: Tx bytes transmitted on N/W interface
* @prev_fwd_tx_packets: forwarded tx packets count
* @prev_fwd_rx_packets: forwarded rx packets count
* @nud_tracking: NUD tracking
* @mic_work: Work to handle MIC error
* @num_active_task: Active task count
* @sap_tx_block_mask: SAP TX block mask
* @gro_disallowed: GRO disallowed flag
* @gro_flushed: GRO flushed flag
* @fisa_disallowed: Flag to indicate fisa aggregation not to be done for a
* particular rx_context
* @fisa_force_flushed: Flag to indicate FISA flow has been flushed for a
* particular rx_context
* @runtime_disable_rx_thread: Runtime Rx thread flag
* @rx_stack: function pointer Rx packet handover
* @tx_fn: function pointer to send Tx packet
* @bss_state: AP BSS state
* @qdf_sta_eap_frm_done_event: EAP frame event management
* @traffic_end_ind: store traffic end indication info
* @direct_link_config: direct link configuration parameters
* @num_links: Number of links for this DP interface
* @def_link: Pointer to default link (usually used for TX operation)
* @dp_link_list_lock: Lock to protect dp_link_list operatiosn
* @dp_link_list: List of dp_links for this DP interface
*/
struct wlan_dp_intf {
struct wlan_dp_psoc_context *dp_ctx;
struct link_monitoring link_monitoring;
struct qdf_mac_addr mac_addr;
enum QDF_OPMODE device_mode;
qdf_list_node_t node;
qdf_netdev_t dev;
struct ol_txrx_ops txrx_ops;
struct dp_stats dp_stats;
#ifdef WLAN_FEATURE_PERIODIC_STA_STATS
bool is_sta_periodic_stats_enabled;
uint16_t periodic_stats_timer_count;
uint32_t periodic_stats_timer_counter;
qdf_mutex_t sta_periodic_stats_lock;
#endif /* WLAN_FEATURE_PERIODIC_STA_STATS */
qdf_net_dev_stats stats;
bool con_status;
bool dad;
uint32_t pkt_type_bitmap;
uint32_t track_arp_ip;
uint8_t dns_payload[256];
uint32_t track_dns_domain_len;
uint32_t track_src_port;
uint32_t track_dest_port;
uint32_t track_dest_ipv4;
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
unsigned long prev_rx_packets;
unsigned long prev_tx_packets;
unsigned long prev_tx_bytes;
uint64_t prev_fwd_tx_packets;
uint64_t prev_fwd_rx_packets;
#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
struct dp_mic_work mic_work;
#ifdef WLAN_NUD_TRACKING
struct dp_nud_tracking_info nud_tracking;
#endif
qdf_atomic_t num_active_task;
uint32_t sap_tx_block_mask;
qdf_atomic_t gro_disallowed;
uint8_t gro_flushed[DP_MAX_RX_THREADS];
#ifdef WLAN_SUPPORT_RX_FISA
/*
* Params used for controlling the fisa aggregation dynamically
*/
uint8_t fisa_disallowed[MAX_REO_DEST_RINGS];
uint8_t fisa_force_flushed[MAX_REO_DEST_RINGS];
#endif
bool runtime_disable_rx_thread;
enum bss_intf_state bss_state;
qdf_event_t qdf_sta_eap_frm_done_event;
struct dp_traffic_end_indication traffic_end_ind;
#ifdef FEATURE_DIRECT_LINK
struct direct_link_info direct_link_config;
#endif
uint8_t num_links;
struct wlan_dp_link *def_link;
qdf_spinlock_t dp_link_list_lock;
qdf_list_t dp_link_list;
};
#define WLAN_DP_LINK_MAGIC 0x5F44505F4C494E4B /* "_DP_LINK" in ASCII */
/**
* struct wlan_dp_link - DP link (corresponds to objmgr vdev)
* @node: list node for membership in the DP links list
* @magic: magic number to identify validity of dp_link
* @link_id: ID for this DP link (Same as vdev_id)
* @mac_addr: mac address of this link
* @dp_intf: Parent DP interface for this DP link
* @vdev: object manager vdev context
* @vdev_lock: vdev spin lock
* @conn_info: STA connection information
* @destroyed: flag to indicate dp_link destroyed (logical delete)
* @cdp_vdev_registered: flag to indicate if corresponding CDP vdev
* is registered
* @cdp_vdev_deleted: flag to indicate if corresponding CDP vdev is deleted
* @inactive_list_elem: list node for membership in dp link inactive list
*/
struct wlan_dp_link {
qdf_list_node_t node;
uint64_t magic;
uint8_t link_id;
struct qdf_mac_addr mac_addr;
struct wlan_dp_intf *dp_intf;
struct wlan_objmgr_vdev *vdev;
qdf_spinlock_t vdev_lock;
struct wlan_dp_conn_info conn_info;
uint8_t destroyed;
uint8_t cdp_vdev_registered;
uint8_t cdp_vdev_deleted;
TAILQ_ENTRY(wlan_dp_link) inactive_list_elem;
};
/**
* enum RX_OFFLOAD - Receive offload modes
* @CFG_LRO_ENABLED: Large Rx offload
* @CFG_GRO_ENABLED: Generic Rx Offload
*/
enum RX_OFFLOAD {
CFG_LRO_ENABLED = 1,
CFG_GRO_ENABLED,
};
#ifdef FEATURE_DIRECT_LINK
/**
* struct dp_direct_link_context - Datapath Direct Link context
* @dp_ctx: pointer to DP psoc priv context
* @lpass_ep_id: LPASS data msg service endpoint id
* @direct_link_refill_ring_hdl: Direct Link refill ring handle
* @dl_wfds: pointer to direct link WFDS context
*/
struct dp_direct_link_context {
struct wlan_dp_psoc_context *dp_ctx;
HTC_ENDPOINT_ID lpass_ep_id;
struct dp_srng *direct_link_refill_ring_hdl;
struct dp_direct_link_wfds_context *dl_wfds;
};
#endif
/**
* struct wlan_dp_psoc_context - psoc related data required for DP
* @psoc: object manager psoc context
* @pdev: object manager pdev context
* @qdf_dev: qdf device
* @dp_cfg: place holder for DP configuration
* @cdp_soc: CDP SoC handle
* @hif_handle: HIF handle
* @hal_soc: HAL SoC handle
* @intf_list_lock: DP interfaces list lock
* @intf_list: DP interfaces list
* @rps: rps
* @dynamic_rps: dynamic rps
* @enable_rxthread: Enable/Disable rx thread
* @enable_dp_rx_threads: Enable/Disable DP rx threads
* @napi_enable: Enable/Disable napi
* @dp_ops: DP callbacks registered from other modules
* @sb_ops: South bound direction call backs registered in DP
* @nb_ops: North bound direction call backs registered in DP
* @en_tcp_delack_no_lro: Enable/Disable tcp delack no lro
* @no_rx_offload_pkt_cnt: no of rx offload packet count
* @no_tx_offload_pkt_cnt: no of tx offload packet count
* @is_suspend: to check whether syetem suspend or not
* @is_wiphy_suspended: to check whether wiphy suspend or not
* @num_latency_critical_clients: num latency critical clients
* @high_bus_bw_request: high bus bandwidth request
* @bw_vote_time: bus bandwidth vote time
* @bus_bw_work: work for periodically computing DDR bus bandwidth requirements
* @cur_vote_level: Current vote level
* @prev_no_rx_offload_pkts: no of previous rx offload packets
* @prev_rx_offload_pkts: previous rx offload packets
* @prev_no_tx_offload_pkts: no of previous tx offload packets
* @prev_tx_offload_pkts: previous tx offload packets
* @cur_tx_level: Current Tx level
* @prev_tx: previous tx
* @low_tput_gro_enable: Enable/Disable low tput gro
* @bus_bw_lock: Bus bandwidth work lock
* @cur_rx_level: Current Rx level
* @bus_low_vote_cnt: bus low level count
* @disable_rx_ol_in_concurrency: disable RX offload in concurrency scenarios
* @disable_rx_ol_in_low_tput: disable RX offload in tput scenarios
* @txrx_hist_idx: txrx histogram index
* @rx_high_ind_cnt: rx high_ind count
* @receive_offload_cb: receive offload cb
* @dp_agg_param: DP aggregation parameter
* @dp_agg_param.rx_aggregation:
* @dp_agg_param.gro_force_flush:
* @dp_agg_param.tc_based_dyn_gro:
* @dp_agg_param.tc_ingress_prio:
* @rtpm_tput_policy_ctx: Runtime Tput policy context
* @txrx_hist: TxRx histogram
* @bbm_ctx: bus bandwidth manager context
* @dp_direct_link_lock: Direct link mutex lock
* @dp_direct_link_ctx: DP Direct Link context
* @arp_connectivity_map: ARP connectivity map
* @rx_wake_lock: rx wake lock
* @ol_enable: Enable/Disable offload
* @rx_fst: FST handle
* @fst_cmem_base: FST base in CMEM
* @fst_in_cmem: Flag indicating if FST is in CMEM or not
* @fisa_enable: Flag to indicate if FISA is enabled or not
* @fisa_lru_del_enable: Flag to indicate if LRU flow delete is enabled
* @fisa_dynamic_aggr_size_support: Indicate dynamic aggr size programming support
* @skip_fisa_param: FISA skip params structure
* @skip_fisa_param.skip_fisa: Flag to skip FISA aggr inside @skip_fisa_param
* @skip_fisa_param.fisa_force_flush: Force flush inside @skip_fisa_param
* @fst_cmem_size: CMEM size for FISA flow table
* @inactive_dp_link_list: inactive DP links list
* @dp_link_del_lock: DP link delete operation lock
*/
struct wlan_dp_psoc_context {
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
qdf_device_t qdf_dev;
struct wlan_dp_psoc_cfg dp_cfg;
ol_txrx_soc_handle cdp_soc;
struct hif_opaque_softc *hif_handle;
void *hal_soc;
qdf_spinlock_t intf_list_lock;
qdf_list_t intf_list;
bool rps;
bool dynamic_rps;
bool enable_rxthread;
bool enable_dp_rx_threads;
bool napi_enable;
struct wlan_dp_psoc_callbacks dp_ops;
struct wlan_dp_psoc_sb_ops sb_ops;
struct wlan_dp_psoc_nb_ops nb_ops;
bool en_tcp_delack_no_lro;
uint64_t no_rx_offload_pkt_cnt;
uint64_t no_tx_offload_pkt_cnt;
bool is_suspend;
bool is_wiphy_suspended;
qdf_atomic_t num_latency_critical_clients;
uint8_t high_bus_bw_request;
uint64_t bw_vote_time;
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
struct qdf_periodic_work bus_bw_work;
int cur_vote_level;
qdf_spinlock_t bus_bw_lock;
int cur_rx_level;
uint64_t prev_no_rx_offload_pkts;
uint64_t prev_rx_offload_pkts;
uint64_t prev_no_tx_offload_pkts;
uint64_t prev_tx_offload_pkts;
int cur_tx_level;
uint64_t prev_tx;
qdf_atomic_t low_tput_gro_enable;
uint32_t bus_low_vote_cnt;
#ifdef FEATURE_RUNTIME_PM
struct dp_rtpm_tput_policy_context rtpm_tput_policy_ctx;
#endif
#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
qdf_atomic_t disable_rx_ol_in_concurrency;
qdf_atomic_t disable_rx_ol_in_low_tput;
uint16_t txrx_hist_idx;
struct tx_rx_histogram *txrx_hist;
uint32_t rx_high_ind_cnt;
#ifdef FEATURE_BUS_BANDWIDTH_MGR
struct bbm_context *bbm_ctx;
#endif
QDF_STATUS(*receive_offload_cb)(struct wlan_dp_intf *, qdf_nbuf_t nbuf);
struct {
qdf_atomic_t rx_aggregation;
uint8_t gro_force_flush[DP_MAX_RX_THREADS];
bool tc_based_dyn_gro;
uint32_t tc_ingress_prio;
}
dp_agg_param;
uint32_t arp_connectivity_map;
qdf_wake_lock_t rx_wake_lock;
enum RX_OFFLOAD ol_enable;
#ifdef FEATURE_DIRECT_LINK
qdf_mutex_t dp_direct_link_lock;
struct dp_direct_link_context *dp_direct_link_ctx;
#endif
#ifdef WLAN_SUPPORT_RX_FISA
struct dp_rx_fst *rx_fst;
uint64_t fst_cmem_base;
bool fst_in_cmem;
uint8_t fisa_enable;
uint8_t fisa_lru_del_enable;
bool fisa_dynamic_aggr_size_support;
/*
* Params used for controlling the fisa aggregation dynamically
*/
struct {
qdf_atomic_t skip_fisa;
uint8_t fisa_force_flush[MAX_REO_DEST_RINGS];
} skip_fisa_param;
/*
* CMEM address and size for FST in CMEM, This is the address
* shared during init time.
*/
uint64_t fst_cmem_size;
#endif
TAILQ_HEAD(, wlan_dp_link) inactive_dp_link_list;
qdf_spinlock_t dp_link_del_lock;
};
#ifdef WLAN_DP_PROFILE_SUPPORT
/**
* enum wlan_dp_cfg_param_type - param context type
* @DP_TX_DESC_NUM_CFG: Number of TX desc
* @DP_TX_EXT_DESC_NUM_CFG: Number of TX ext desc
* @DP_TX_RING_SIZE_CFG: TX ring size
* @DP_TX_COMPL_RING_SIZE_CFG: TX completion ring size
* @DP_RX_SW_DESC_NUM_CFG: Number of RX S.W descriptors
* @DP_REO_DST_RING_SIZE_CFG: RX ring size
* @DP_RXDMA_BUF_RING_SIZE_CFG: RXDMA BUF ring size
* @DP_RXDMA_REFILL_RING_SIZE_CFG: RXDMA refill ring size
* @DP_RX_REFILL_POOL_NUM_CFG: Refill buffer pool size
*/
enum wlan_dp_cfg_param_type {
DP_TX_DESC_NUM_CFG,
DP_TX_EXT_DESC_NUM_CFG,
DP_TX_RING_SIZE_CFG,
DP_TX_COMPL_RING_SIZE_CFG,
DP_RX_SW_DESC_NUM_CFG,
DP_REO_DST_RING_SIZE_CFG,
DP_RXDMA_BUF_RING_SIZE_CFG,
DP_RXDMA_REFILL_RING_SIZE_CFG,
DP_RX_REFILL_POOL_NUM_CFG,
};
/**
* struct wlan_dp_memory_profile_ctx - element representing DP config param info
* @param_type: DP config param type
* @size: size/length of the param to be selected
*/
struct wlan_dp_memory_profile_ctx {
enum wlan_dp_cfg_param_type param_type;
uint32_t size;
};
/**
* struct wlan_dp_memory_profile_info - Current memory profile info
* @is_selected: profile is selected or not
* @ctx: DP memory profile context
* @size: size of profile
*/
struct wlan_dp_memory_profile_info {
bool is_selected;
struct wlan_dp_memory_profile_ctx *ctx;
int size;
};
#endif
#endif /* end of _WLAN_DP_PRIV_STRUCT_H_ */

View File

@ -0,0 +1,763 @@
/*
* Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(__WLAN_DP_RX_THREAD_H)
#define __WLAN_DP_RX_THREAD_H
#include <qdf_lock.h>
#include <qdf_event.h>
#include <qdf_threads.h>
#include <wlan_objmgr_vdev_obj.h>
#include "cfg_dp.h"
#include <cdp_txrx_cmn_struct.h>
#include <cdp_txrx_cmn.h>
#include "wlan_cfg.h"
#include "qdf_nbuf.h"
#include "qdf_threads.h"
#include "qdf_net_if.h"
/* Maximum number of REO rings supported (for stats tracking) */
#define DP_RX_TM_MAX_REO_RINGS WLAN_CFG_NUM_REO_DEST_RING
/* Number of DP RX threads supported */
#define DP_MAX_RX_THREADS WLAN_CFG_NUM_REO_DEST_RING
/*
* struct dp_rx_tm_handle_cmn - Opaque handle for rx_threads to store
* rx_tm_handle. This handle will be common for all the threads.
* Individual threads should not be accessing
* elements from dp_rx_tm_handle. It should be via an API.
*/
struct dp_rx_tm_handle_cmn;
/**
* struct dp_rx_thread_stats - structure holding stats for DP RX thread
* @nbuf_queued: packets queued into the thread per reo ring
* @nbuf_queued_total: packets queued into the thread for all reo rings
* @nbuf_dequeued: packets de-queued from the thread
* @nbuf_sent_to_stack: packets sent to the stack. some dequeued packets may be
* dropped due to no peer or vdev, hence this stat.
* @gro_flushes: number of GRO flushes
* @gro_flushes_by_vdev_del: number of GRO flushes triggered by vdev del.
* @nbufq_max_len: maximum number of nbuf_lists queued for the thread
* @dropped_invalid_vdev: packets(nbuf_list) dropped due to no vdev
* @rx_flushed: packets flushed after vdev delete
* @dropped_invalid_peer: packets(nbuf_list) dropped due to no peer
* @dropped_invalid_os_rx_handles: packets(nbuf_list) dropped due to no os rx
* handles
* @dropped_others: packets dropped due to other reasons
* @dropped_enq_fail: packets dropped due to pending queue full
* @rx_nbufq_loop_yield: rx loop yield counter
*/
struct dp_rx_thread_stats {
unsigned int nbuf_queued[DP_RX_TM_MAX_REO_RINGS];
unsigned int nbuf_queued_total;
unsigned int nbuf_dequeued;
unsigned int nbuf_sent_to_stack;
unsigned int gro_flushes;
unsigned int gro_flushes_by_vdev_del;
unsigned int nbufq_max_len;
unsigned int dropped_invalid_vdev;
unsigned int rx_flushed;
unsigned int dropped_invalid_peer;
unsigned int dropped_invalid_os_rx_handles;
unsigned int dropped_others;
unsigned int dropped_enq_fail;
unsigned int rx_nbufq_loop_yield;
};
/**
* enum dp_rx_refill_thread_state - enum to keep track of rx refill thread state
* @DP_RX_REFILL_THREAD_INVALID: initial invalid state
* @DP_RX_REFILL_THREAD_RUNNING: rx refill thread functional(NOT suspended,
* processing packets or waiting on a wait_queue)
* @DP_RX_REFILL_THREAD_SUSPENDING: rx refill thread is suspending
* @DP_RX_REFILL_THREAD_SUSPENDED: rx refill_thread suspended
*/
enum dp_rx_refill_thread_state {
DP_RX_REFILL_THREAD_INVALID,
DP_RX_REFILL_THREAD_RUNNING,
DP_RX_REFILL_THREAD_SUSPENDING,
DP_RX_REFILL_THREAD_SUSPENDED
};
/**
* struct dp_rx_thread - structure holding variables for a single DP RX thread
* @id: id of the dp_rx_thread (0 or 1 or 2..DP_MAX_RX_THREADS - 1)
* @task: task structure corresponding to the thread
* @start_event: handle of Event for DP Rx thread to signal startup
* @suspend_event: handle of Event for DP Rx thread to signal suspend
* @resume_event: handle of Event for DP Rx thread to signal resume
* @shutdown_event: handle of Event for DP Rx thread to signal shutdown
* @vdev_del_event: handle of Event for vdev del thread to signal completion
* for gro flush
* @gro_flush_ind: gro flush indication for DP Rx thread
* @event_flag: event flag to post events to DP Rx thread
* @nbuf_queue:nbuf queue used to store RX packets
* @nbufq_len: length of the nbuf queue
* @aff_mask: cuurent affinity mask of the DP Rx thread
* @stats: per thread stats
* @rtm_handle_cmn: abstract RX TM handle. This allows access to the dp_rx_tm
* structures via APIs.
* @napi: napi to deliver packet to stack via GRO
* @wait_q: wait queue to conditionally wait on events for DP Rx thread
* @netdev: dummy netdev to initialize the napi structure with
*/
struct dp_rx_thread {
uint8_t id;
qdf_thread_t *task;
qdf_event_t start_event;
qdf_event_t suspend_event;
qdf_event_t resume_event;
qdf_event_t shutdown_event;
qdf_event_t vdev_del_event;
qdf_atomic_t gro_flush_ind;
unsigned long event_flag;
qdf_nbuf_queue_head_t nbuf_queue;
unsigned long aff_mask;
struct dp_rx_thread_stats stats;
struct dp_rx_tm_handle_cmn *rtm_handle_cmn;
qdf_napi_struct napi;
qdf_wait_queue_head_t wait_q;
qdf_dummy_netdev_t netdev;
};
/**
* struct dp_rx_refill_thread - structure holding info of DP Rx refill thread
* @task: task structure corresponding to the thread
* @start_event: handle of Event for DP Rx refill thread to signal startup
* @suspend_event: handle of Event for DP Rx refill thread to signal suspend
* @resume_event: handle of Event for DP Rx refill thread to signal resume
* @shutdown_event: handle of Event for DP Rx refill thread to signal shutdown
* @event_flag: event flag to post events to DP Rx refill thread
* @wait_q: wait queue to conditionally wait on events for DP Rx refill thread
* @enabled: flag to check whether DP Rx refill thread is enabled
* @soc: abstract DP soc reference used in internal API's
* @state: state of DP Rx refill thread
*/
struct dp_rx_refill_thread {
qdf_thread_t *task;
qdf_event_t start_event;
qdf_event_t suspend_event;
qdf_event_t resume_event;
qdf_event_t shutdown_event;
unsigned long event_flag;
qdf_wait_queue_head_t wait_q;
bool enabled;
void *soc;
enum dp_rx_refill_thread_state state;
};
/**
* enum dp_rx_thread_state - enum to keep track of the state of the rx threads
* @DP_RX_THREADS_INVALID: initial invalid state
* @DP_RX_THREADS_RUNNING: rx threads functional(NOT suspended, processing
* packets or waiting on a wait_queue)
* @DP_RX_THREADS_SUSPENDING: rx thread is suspending
* @DP_RX_THREADS_SUSPENDED: rx_threads suspended from cfg8011 suspend
*/
enum dp_rx_thread_state {
DP_RX_THREADS_INVALID,
DP_RX_THREADS_RUNNING,
DP_RX_THREADS_SUSPENDING,
DP_RX_THREADS_SUSPENDED
};
/**
* struct dp_rx_tm_handle - DP RX thread infrastructure handle
* @num_dp_rx_threads: number of DP RX threads initialized
* @txrx_handle_cmn: opaque txrx handle to get to pdev and soc
* @state: state of the rx_threads. All of them should be in the same state.
* @rx_thread: array of pointers of type struct dp_rx_thread
* @allow_dropping: flag to indicate frame dropping is enabled
*/
struct dp_rx_tm_handle {
uint8_t num_dp_rx_threads;
struct dp_txrx_handle_cmn *txrx_handle_cmn;
enum dp_rx_thread_state state;
struct dp_rx_thread **rx_thread;
qdf_atomic_t allow_dropping;
};
/**
* enum dp_rx_gro_flush_code - enum differentiate different GRO flushes
* @DP_RX_GRO_NOT_FLUSH: not fush indication
* @DP_RX_GRO_NORMAL_FLUSH: Regular full flush
* @DP_RX_GRO_LOW_TPUT_FLUSH: Flush during low tput level
*/
enum dp_rx_gro_flush_code {
DP_RX_GRO_NOT_FLUSH = 0,
DP_RX_GRO_NORMAL_FLUSH,
DP_RX_GRO_LOW_TPUT_FLUSH
};
/**
* struct dp_txrx_config - dp txrx configuration passed to dp txrx modules
* @enable_rx_threads: DP rx threads or not
*/
struct dp_txrx_config {
bool enable_rx_threads;
};
struct dp_txrx_handle_cmn;
/**
* struct dp_txrx_handle - main dp txrx container handle
* @pdev: cdp_pdev pdev handle
* @soc: ol_txrx_soc_handle soc handle
* @refill_thread: rx refill thread infra handle
* @rx_tm_hdl: rx thread infrastructure handle
* @config: configuration for DP TXRX modules
*/
struct dp_txrx_handle {
ol_txrx_soc_handle soc;
struct cdp_pdev *pdev;
struct dp_rx_tm_handle rx_tm_hdl;
struct dp_rx_refill_thread refill_thread;
struct dp_txrx_config config;
};
/**
* dp_rx_refill_thread_init() - Initialize DP Rx refill threads
* @refill_thread: Contains over all rx refill thread info
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_rx_refill_thread_init(struct dp_rx_refill_thread *refill_thread);
/**
* dp_rx_refill_thread_deinit() - De-initialize DP Rx refill threads
* @refill_thread: Contains over all rx refill thread info
*
* Return: QDF_STATUS
*/
QDF_STATUS
dp_rx_refill_thread_deinit(struct dp_rx_refill_thread *refill_thread);
/**
* dp_rx_tm_init() - initialize DP Rx thread infrastructure
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread infrastructure
* @num_dp_rx_threads: number of DP Rx threads to be initialized
*
* Return: QDF_STATUS_SUCCESS
*/
QDF_STATUS dp_rx_tm_init(struct dp_rx_tm_handle *rx_tm_hdl,
uint8_t num_dp_rx_threads);
/**
* dp_rx_tm_deinit() - de-initialize DP Rx thread infrastructure
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread infrastructure
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_rx_tm_deinit(struct dp_rx_tm_handle *rx_tm_hdl);
/**
* dp_rx_tm_enqueue_pkt() - enqueue RX packet into RXTI
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread infrastructure
* @nbuf_list: single or a list of nbufs to be enqueued into RXTI
*
* Return: QDF_STATUS_SUCCESS
*/
QDF_STATUS dp_rx_tm_enqueue_pkt(struct dp_rx_tm_handle *rx_tm_hdl,
qdf_nbuf_t nbuf_list);
/**
* dp_rx_tm_gro_flush_ind() - flush GRO packets for a RX Context Id
* @rx_tm_handle: dp_rx_tm_handle containing the overall thread infrastructure
* @rx_ctx_id: RX Thread Context Id for which GRO flush needs to be done
* @flush_code: flush code to differentiate low TPUT flush
*
* Return: QDF_STATUS_SUCCESS
*/
QDF_STATUS dp_rx_tm_gro_flush_ind(struct dp_rx_tm_handle *rx_tm_handle,
int rx_ctx_id,
enum dp_rx_gro_flush_code flush_code);
/**
* dp_rx_refill_thread_suspend() - Suspend RX refill thread
* @refill_thread: pointer to dp_rx_refill_thread object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS
dp_rx_refill_thread_suspend(struct dp_rx_refill_thread *refill_thread);
/**
* dp_rx_tm_suspend() - suspend all threads in RXTI
* @rx_tm_handle: pointer to dp_rx_tm_handle object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_rx_tm_suspend(struct dp_rx_tm_handle *rx_tm_handle);
/**
* dp_rx_tm_flush_by_vdev_id() - flush rx packets by vdev_id in all
* rx thread queues
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread
* infrastructure
* @vdev_id: vdev id for which packets are to be flushed
*
* Return: QDF_STATUS_SUCCESS
*/
QDF_STATUS dp_rx_tm_flush_by_vdev_id(struct dp_rx_tm_handle *rx_tm_hdl,
uint8_t vdev_id);
/**
* dp_rx_refill_thread_resume() - Resume RX refill thread
* @refill_thread: pointer to dp_rx_refill_thread
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS
dp_rx_refill_thread_resume(struct dp_rx_refill_thread *refill_thread);
/**
* dp_rx_tm_resume() - resume all threads in RXTI
* @rx_tm_handle: pointer to dp_rx_tm_handle object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_rx_tm_resume(struct dp_rx_tm_handle *rx_tm_handle);
/**
* dp_rx_tm_dump_stats() - dump stats for all threads in RXTI
* @rx_tm_handle: pointer to dp_rx_tm_handle object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_rx_tm_dump_stats(struct dp_rx_tm_handle *rx_tm_handle);
/**
* dp_rx_thread_get_txrx_handle() - get txrx handle from rx_tm_handle_cmn
* @rx_tm_handle_cmn: opaque pointer to dp_rx_tm_handle_cmn struct
*
* Return: pointer to dp_txrx_handle_cmn handle
*/
static inline struct dp_txrx_handle_cmn*
dp_rx_thread_get_txrx_handle(struct dp_rx_tm_handle_cmn *rx_tm_handle_cmn)
{
return (((struct dp_rx_tm_handle *)rx_tm_handle_cmn)->txrx_handle_cmn);
}
/**
* dp_rx_tm_get_napi_context() - get NAPI context for a RX CTX ID
* @rx_ctx_id: RX context ID (RX thread ID) corresponding to which NAPI is
* needed
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread
* infrastructure
*
* Return: NULL on failure, else pointer to NAPI corresponding to rx_ctx_id
*/
qdf_napi_struct *dp_rx_tm_get_napi_context(struct dp_rx_tm_handle *rx_tm_hdl,
uint8_t rx_ctx_id);
/**
* dp_rx_tm_set_cpu_mask() - set CPU mask for RX threads
* @rx_tm_hdl: dp_rx_tm_handle containing the overall thread
* infrastructure
* @new_mask: New CPU mask pointer
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_rx_tm_set_cpu_mask(struct dp_rx_tm_handle *rx_tm_hdl,
qdf_cpu_mask *new_mask);
#ifdef FEATURE_WLAN_DP_RX_THREADS
/**
* dp_txrx_get_cmn_hdl_frm_ext_hdl() - conversion func ext_hdl->txrx_handle_cmn
* @dp_ext_hdl: pointer to dp_txrx_handle structure
*
* Return: typecasted pointer of type - struct dp_txrx_handle_cmn
*/
static inline struct dp_txrx_handle_cmn *
dp_txrx_get_cmn_hdl_frm_ext_hdl(struct dp_txrx_handle *dp_ext_hdl)
{
return (struct dp_txrx_handle_cmn *)dp_ext_hdl;
}
/**
* dp_txrx_get_ext_hdl_frm_cmn_hdl() - conversion func txrx_handle_cmn->ext_hdl
* @txrx_cmn_hdl: pointer to dp_txrx_handle_cmn structure
*
* Return: typecasted pointer of type - struct dp_txrx_handle
*/
static inline struct dp_txrx_handle *
dp_txrx_get_ext_hdl_frm_cmn_hdl(struct dp_txrx_handle_cmn *txrx_cmn_hdl)
{
return (struct dp_txrx_handle *)txrx_cmn_hdl;
}
static inline ol_txrx_soc_handle
dp_txrx_get_soc_from_ext_handle(struct dp_txrx_handle_cmn *txrx_cmn_hdl)
{
struct dp_txrx_handle *dp_ext_hdl;
dp_ext_hdl = dp_txrx_get_ext_hdl_frm_cmn_hdl(txrx_cmn_hdl);
return dp_ext_hdl->soc;
}
/**
* dp_txrx_init() - initialize DP TXRX module
* @soc: ol_txrx_soc_handle
* @pdev_id: id of dp pdev handle
* @config: configuration for DP TXRX modules
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_txrx_init(ol_txrx_soc_handle soc, uint8_t pdev_id,
struct dp_txrx_config *config);
/**
* dp_txrx_deinit() - de-initialize DP TXRX module
* @soc: ol_txrx_soc_handle
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
QDF_STATUS dp_txrx_deinit(ol_txrx_soc_handle soc);
/**
* dp_txrx_flush_pkts_by_vdev_id() - flush rx packets for a vdev_id
* @soc: ol_txrx_soc_handle object
* @vdev_id: vdev_id for which rx packets are to be flushed
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline QDF_STATUS dp_txrx_flush_pkts_by_vdev_id(ol_txrx_soc_handle soc,
uint8_t vdev_id)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
if (!soc) {
qdf_status = QDF_STATUS_E_INVAL;
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
qdf_status = dp_rx_tm_flush_by_vdev_id(&dp_ext_hdl->rx_tm_hdl, vdev_id);
ret:
return qdf_status;
}
/**
* dp_txrx_resume() - resume all threads
* @soc: ol_txrx_soc_handle object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline QDF_STATUS dp_txrx_resume(ol_txrx_soc_handle soc)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
struct dp_rx_refill_thread *refill_thread;
if (!soc) {
qdf_status = QDF_STATUS_E_INVAL;
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
refill_thread = &dp_ext_hdl->refill_thread;
if (refill_thread->enabled) {
qdf_status = dp_rx_refill_thread_resume(refill_thread);
if (qdf_status != QDF_STATUS_SUCCESS)
return qdf_status;
}
qdf_status = dp_rx_tm_resume(&dp_ext_hdl->rx_tm_hdl);
ret:
return qdf_status;
}
/**
* dp_txrx_suspend() - suspend all threads
* @soc: ol_txrx_soc_handle object
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline QDF_STATUS dp_txrx_suspend(ol_txrx_soc_handle soc)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
struct dp_rx_refill_thread *refill_thread;
if (!soc) {
qdf_status = QDF_STATUS_E_INVAL;
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
refill_thread = &dp_ext_hdl->refill_thread;
if (refill_thread->enabled) {
qdf_status = dp_rx_refill_thread_suspend(refill_thread);
if (qdf_status != QDF_STATUS_SUCCESS)
return qdf_status;
}
qdf_status = dp_rx_tm_suspend(&dp_ext_hdl->rx_tm_hdl);
if (QDF_IS_STATUS_ERROR(qdf_status) && refill_thread->enabled)
dp_rx_refill_thread_resume(refill_thread);
ret:
return qdf_status;
}
/**
* dp_rx_enqueue_pkt() - enqueue packet(s) into the thread
* @soc: ol_txrx_soc_handle object
* @nbuf_list: list of packets to be queued into the rx_thread
*
* The function accepts a list of skbs connected by the skb->next pointer and
* queues them into a RX thread to be sent to the stack.
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline
QDF_STATUS dp_rx_enqueue_pkt(ol_txrx_soc_handle soc, qdf_nbuf_t nbuf_list)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
if (!soc || !nbuf_list) {
qdf_status = QDF_STATUS_E_INVAL;
dp_err("invalid input params soc %pK nbuf %pK"
, soc, nbuf_list);
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
qdf_status = dp_rx_tm_enqueue_pkt(&dp_ext_hdl->rx_tm_hdl, nbuf_list);
ret:
return qdf_status;
}
/**
* dp_rx_gro_flush_ind() - Flush GRO packets for a given RX CTX Id
* @soc: ol_txrx_soc_handle object
* @rx_ctx_id: Context Id (Thread for which GRO packets need to be flushed)
* @flush_code: flush_code differentiating normal_flush from low_tput_flush
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline
QDF_STATUS dp_rx_gro_flush_ind(ol_txrx_soc_handle soc, int rx_ctx_id,
enum dp_rx_gro_flush_code flush_code)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
if (!soc) {
qdf_status = QDF_STATUS_E_INVAL;
dp_err("invalid input param soc %pK", soc);
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
qdf_status = dp_rx_tm_gro_flush_ind(&dp_ext_hdl->rx_tm_hdl, rx_ctx_id,
flush_code);
ret:
return qdf_status;
}
/**
* dp_txrx_ext_dump_stats() - dump txrx external module stats
* @soc: ol_txrx_soc_handle object
* @stats_id: id for the module whose stats are needed
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline QDF_STATUS dp_txrx_ext_dump_stats(ol_txrx_soc_handle soc,
uint8_t stats_id)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status;
if (!soc) {
dp_err("invalid input params soc %pK", soc);
return QDF_STATUS_E_INVAL;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl)
return QDF_STATUS_E_FAULT;
if (stats_id == CDP_DP_RX_THREAD_STATS)
qdf_status = dp_rx_tm_dump_stats(&dp_ext_hdl->rx_tm_hdl);
else
qdf_status = QDF_STATUS_E_INVAL;
return qdf_status;
}
/**
* dp_rx_get_napi_context() - get NAPI context for a RX CTX ID
* @soc: ol_txrx_soc_handle object
* @rx_ctx_id: RX context ID (RX thread ID) corresponding to which NAPI is
* needed
*
* Return: NULL on failure, else pointer to NAPI corresponding to rx_ctx_id
*/
static inline
qdf_napi_struct *dp_rx_get_napi_context(ol_txrx_soc_handle soc,
uint8_t rx_ctx_id)
{
struct dp_txrx_handle *dp_ext_hdl;
if (!soc) {
dp_err("soc in NULL!");
return NULL;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
dp_err("dp_ext_hdl in NULL!");
return NULL;
}
return dp_rx_tm_get_napi_context(&dp_ext_hdl->rx_tm_hdl, rx_ctx_id);
}
/**
* dp_txrx_set_cpu_mask() - set CPU mask for RX threads
* @soc: ol_txrx_soc_handle object
* @new_mask: New CPU mask pointer
*
* Return: QDF_STATUS_SUCCESS on success, error qdf status on failure
*/
static inline
QDF_STATUS dp_txrx_set_cpu_mask(ol_txrx_soc_handle soc, qdf_cpu_mask *new_mask)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
if (!soc) {
qdf_status = QDF_STATUS_E_INVAL;
goto ret;
}
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl) {
qdf_status = QDF_STATUS_E_FAULT;
goto ret;
}
qdf_status = dp_rx_tm_set_cpu_mask(&dp_ext_hdl->rx_tm_hdl, new_mask);
ret:
return qdf_status;
}
#else
static inline
QDF_STATUS dp_txrx_init(ol_txrx_soc_handle soc, uint8_t pdev_id,
struct dp_txrx_config *config)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_txrx_deinit(ol_txrx_soc_handle soc)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_txrx_flush_pkts_by_vdev_id(ol_txrx_soc_handle soc,
uint8_t vdev_id)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_txrx_resume(ol_txrx_soc_handle soc)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_txrx_suspend(ol_txrx_soc_handle soc)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS dp_rx_enqueue_pkt(ol_txrx_soc_handle soc, qdf_nbuf_t nbuf_list)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS dp_rx_gro_flush_ind(ol_txrx_soc_handle soc, int rx_ctx_id,
enum dp_rx_gro_flush_code flush_code)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_txrx_ext_dump_stats(ol_txrx_soc_handle soc,
uint8_t stats_id)
{
return QDF_STATUS_SUCCESS;
}
static inline
qdf_napi_struct *dp_rx_get_napi_context(ol_txrx_soc_handle soc,
uint8_t rx_ctx_id)
{
return NULL;
}
static inline
QDF_STATUS dp_txrx_set_cpu_mask(ol_txrx_soc_handle soc, qdf_cpu_mask *new_mask)
{
return QDF_STATUS_SUCCESS;
}
#endif /* FEATURE_WLAN_DP_RX_THREADS */
/**
* dp_rx_tm_get_pending() - get number of frame in thread
* nbuf queue pending
* @soc: ol_txrx_soc_handle object
*
* Return: number of frames
*/
int dp_rx_tm_get_pending(ol_txrx_soc_handle soc);
#endif /* __WLAN_DP_RX_THREAD_H */

View File

@ -0,0 +1,177 @@
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _WLAN_DP_SWLM_H_
#define _WLAN_DP_SWLM_H_
#ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
#define DP_SWLM_TCL_TPUT_PASS_THRESH 3
#define DP_SWLM_TCL_RX_TRAFFIC_THRESH 50
#define DP_SWLM_TCL_TX_TRAFFIC_THRESH 50
#define DP_SWLM_TCL_TX_PKT_THRESH 2
/* Traffic test time is in us */
#define DP_SWLM_TCL_TRAFFIC_SAMPLING_TIME 250
#define DP_SWLM_TCL_TIME_FLUSH_THRESH 1000
#define DP_SWLM_TCL_TX_THRESH_MULTIPLIER 2
/* Inline Functions */
/**
* dp_tx_is_special_frame() - check if this TX frame is a special frame.
* @nbuf: TX skb pointer
* @frame_mask: the mask for required special frames
*
* Check if TX frame is a required special frame.
*
* Returns: true, if this frame is a needed special frame,
* false, otherwise
*/
static inline
bool dp_tx_is_special_frame(qdf_nbuf_t nbuf, uint32_t frame_mask)
{
if (((frame_mask & FRAME_MASK_IPV4_ARP) &&
qdf_nbuf_is_ipv4_arp_pkt(nbuf)) ||
((frame_mask & FRAME_MASK_IPV4_DHCP) &&
qdf_nbuf_is_ipv4_dhcp_pkt(nbuf)) ||
((frame_mask & FRAME_MASK_IPV4_EAPOL) &&
qdf_nbuf_is_ipv4_eapol_pkt(nbuf)) ||
((frame_mask & FRAME_MASK_IPV6_DHCP) &&
qdf_nbuf_is_ipv6_dhcp_pkt(nbuf)))
return true;
return false;
}
/**
* dp_swlm_tcl_reset_session_data() - Reset the TCL coalescing session data
* @soc: DP soc handle
* @ring_id: TCL ring id
*
* Returns QDF_STATUS
*/
static inline QDF_STATUS
dp_swlm_tcl_reset_session_data(struct dp_soc *soc, uint8_t ring_id)
{
struct dp_swlm_params *params = &soc->swlm.params;
params->tcl[ring_id].coalesce_end_time = qdf_get_log_timestamp_usecs() +
params->time_flush_thresh;
params->tcl[ring_id].bytes_coalesced = 0;
params->tcl[ring_id].bytes_flush_thresh =
params->tcl[ring_id].sampling_session_tx_bytes *
params->tx_thresh_multiplier;
qdf_timer_sync_cancel(&params->tcl[ring_id].flush_timer);
return QDF_STATUS_SUCCESS;
}
/**
* dp_swlm_tcl_pre_check() - Pre checks for current packet to be transmitted
* @soc: Datapath soc handle
* @tcl_data: tcl swlm data
*
* Returns: QDF_STATUS_SUCCESS, if all pre-check conditions pass
* QDF_STATUS_E_FAILURE, otherwise
*/
static inline QDF_STATUS
dp_swlm_tcl_pre_check(struct dp_soc *soc,
struct dp_swlm_tcl_data *tcl_data)
{
struct dp_swlm *swlm = &soc->swlm;
uint32_t frame_mask = FRAME_MASK_IPV4_ARP | FRAME_MASK_IPV4_DHCP |
FRAME_MASK_IPV4_EAPOL | FRAME_MASK_IPV6_DHCP;
if (tcl_data->tid > DP_VO_TID) {
DP_STATS_INC(swlm, tcl[tcl_data->ring_id].tid_fail, 1);
goto fail;
}
if (dp_tx_is_special_frame(tcl_data->nbuf, frame_mask)) {
DP_STATS_INC(swlm, tcl[tcl_data->ring_id].sp_frames, 1);
goto fail;
}
if (tcl_data->num_ll_connections) {
DP_STATS_INC(swlm, tcl[tcl_data->ring_id].ll_connection, 1);
goto fail;
}
return QDF_STATUS_SUCCESS;
fail:
return QDF_STATUS_E_FAILURE;
}
/**
* dp_swlm_query_policy() - apply software latency policy based on ring type.
* @soc: Datapath global soc handle
* @ring_type: SRNG type
* @query_data: private data for the query corresponding to the ring type
*
* Returns: 1, if policy is to be applied
* 0, if policy is not to be applied
*/
static inline int dp_swlm_query_policy(struct dp_soc *soc, int ring_type,
union swlm_data query_data)
{
struct dp_swlm *swlm = &soc->swlm;
switch (ring_type) {
case TCL_DATA:
return swlm->ops->tcl_wr_coalesce_check(soc,
query_data.tcl_data);
default:
dp_err("Ring type %d not supported by SW latency manager",
ring_type);
break;
}
return 0;
}
/* Function Declarations */
/**
* dp_soc_swlm_attach() - attach the software latency manager resources
* @soc: Datapath global soc handle
*
* Returns: QDF_STATUS
*/
QDF_STATUS dp_soc_swlm_attach(struct dp_soc *soc);
/**
* dp_soc_swlm_detach() - detach the software latency manager resources
* @soc: Datapath global soc handle
*
* Returns: QDF_STATUS
*/
QDF_STATUS dp_soc_swlm_detach(struct dp_soc *soc);
/**
* dp_print_swlm_stats() - Print the SWLM stats
* @soc: Datapath soc handle
*
* Returns: QDF_STATUS
*/
QDF_STATUS dp_print_swlm_stats(struct dp_soc *soc);
#endif /* WLAN_DP_FEATURE_SW_LATENCY_MGR */
#endif

View File

@ -0,0 +1,674 @@
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __WLAN_DP_TXRX_H__
#define __WLAN_DP_TXRX_H__
#include <cds_api.h>
#include <qdf_tracepoint.h>
#include <qdf_pkt_add_timestamp.h>
#include <enet.h>
#include <qdf_tracepoint.h>
#include "wlan_dp_priv.h"
/** DP Tx Time out value */
#define DP_TX_TIMEOUT qdf_system_msecs_to_ticks(5000)
#define DP_TX_STALL_THRESHOLD 4
#ifdef FEATURE_WLAN_WAPI
#define IS_DP_ETHERTYPE_WAI(_nbuf) (qdf_ntohs(qdf_nbuf_get_protocol(_nbuf)) == \
ETHERTYPE_WAI)
#else
#define IS_DP_ETHERTYPE_WAI(_nbuf) (false)
#endif
#define DP_CONNECTIVITY_CHECK_SET_ARP 1
#define DP_CONNECTIVITY_CHECK_SET_DNS 2
#define DP_CONNECTIVITY_CHECK_SET_TCP_HANDSHAKE 3
#define DP_CONNECTIVITY_CHECK_SET_ICMPV4 4
#define DP_CONNECTIVITY_CHECK_SET_ICMPV6 5
#define DP_CONNECTIVITY_CHECK_SET_TCP_SYN 6
#define DP_CONNECTIVITY_CHECK_SET_TCP_SYN_ACK 7
#define DP_CONNECTIVITY_CHECK_SET_TCP_ACK 8
/**
* wlan_dp_intf_get_pkt_type_bitmap_value() - Get packt type bitmap info
* @intf_ctx: DP interface context
*
* Return: bitmap information
*/
uint32_t wlan_dp_intf_get_pkt_type_bitmap_value(void *intf_ctx);
#if defined(WLAN_SUPPORT_RX_FISA)
/**
* dp_rx_skip_fisa() - Set flags to skip fisa aggregation
* @dp_ctx: DP component handle
* @value: allow or skip fisa
*
* Return: None
*/
void dp_rx_skip_fisa(struct wlan_dp_psoc_context *dp_ctx, uint32_t value);
#endif
/**
* dp_reset_all_intfs_connectivity_stats() - reset connectivity stats
* @dp_ctx: pointer to DP Context
*
* Return: None
*/
void dp_reset_all_intfs_connectivity_stats(struct wlan_dp_psoc_context *dp_ctx);
/**
* dp_softap_check_wait_for_tx_eap_pkt() - Check and wait for eap failure
* pkt completion event
* @dp_intf: pointer to DP interface
* @mac_addr: mac address of peer
*
* Check and wait for eap failure pkt tx completion.
*
* Return: void
*/
void dp_softap_check_wait_for_tx_eap_pkt(struct wlan_dp_intf *dp_intf,
struct qdf_mac_addr *mac_addr);
#ifdef SAP_DHCP_FW_IND
/**
* dp_post_dhcp_ind() - Send DHCP START/STOP indication to FW
* @dp_link: DP link handle
* @mac_addr: mac address
* @dhcp_start: true if DHCP start, otherwise DHCP stop
*
* Return: error number
*/
int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
uint8_t *mac_addr, bool dhcp_start);
/**
* dp_softap_inspect_dhcp_packet() - Inspect DHCP packet
* @dp_link: DP link handle
* @nbuf: pointer to OS packet (sk_buff)
* @dir: direction
*
* Inspect the Tx/Rx frame, and send DHCP START/STOP notification to the FW
* through WMI message, during DHCP based IP address acquisition phase.
*
* - Send DHCP_START notification to FW when SAP gets DHCP Discovery
* - Send DHCP_STOP notification to FW when SAP sends DHCP ACK/NAK
*
* DHCP subtypes are determined by a status octet in the DHCP Message type
* option (option code 53 (0x35)).
*
* Each peer will be in one of 4 DHCP phases, starts from QDF_DHCP_PHASE_ACK,
* and transitioned per DHCP message type as it arrives.
*
* - QDF_DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
* - QDF_DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
* - QDF_DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase
* or ACK phase (Renewal process)
* - QDF_DHCP_PHASE_ACK : upon receiving DHCP_ACK/NAK message in REQUEST phase
* or DHCP_DELINE message in OFFER phase
*
* Return: error number
*/
int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
qdf_nbuf_t nbuf,
enum qdf_proto_dir dir);
#else
static inline
int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
uint8_t *mac_addr, bool dhcp_start)
{
return 0;
}
static inline
int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
qdf_nbuf_t nbuf,
enum qdf_proto_dir dir)
{
return 0;
}
#endif
/**
* dp_rx_flush_packet_cbk() - flush rx packet handler
* @dp_link_context: pointer to DP link context
* @link_id: vdev_id of the packets to be flushed
*
* Flush rx packet callback registered with data path. DP will call this to
* notify when packets for a particular vdev is to be flushed out.
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS dp_rx_flush_packet_cbk(void *dp_link_context, uint8_t link_id);
/**
* dp_softap_start_xmit() - Transmit a frame for SAP interface
* @nbuf: pointer to Network buffer
* @dp_link: DP link handle
*
* Return: QDF_STATUS_SUCCESS on successful transmission
*/
QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_link *dp_link);
/**
* dp_softap_tx_timeout() - TX timeout handler
* @dp_intf: pointer to DP interface
*
* Timeout API called for mode interfaces (SoftAP/P2P GO)
* when TX transmission takes too long.
* called by the OS_IF layer legacy driver.
*
* Return: None
*/
void dp_softap_tx_timeout(struct wlan_dp_intf *dp_intf);
/**
* dp_softap_rx_packet_cbk() - Receive packet handler for SAP
* @intf_ctx: pointer to DP interface context
* @rx_buf: pointer to rx qdf_nbuf
*
* Receive callback registered with data path. DP will call this to notify
* when one or more packets were received for a registered
* STA.
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS
dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf);
/**
* dp_start_xmit() - Transmit a frame for STA interface
* @nbuf: pointer to Network buffer
* @dp_link: DP link handle
*
* Return: QDF_STATUS_SUCCESS on successful transmission
*/
QDF_STATUS
dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf);
/**
* dp_tx_timeout() - DP Tx timeout API
* @dp_intf: Data path interface pointer
*
* Function called by OS_IF there is any timeout during transmission.
*
* Return: none
*/
void dp_tx_timeout(struct wlan_dp_intf *dp_intf);
/**
* dp_rx_packet_cbk() - Receive packet handler
* @dp_link_context: pointer to DP link context
* @rx_buf: pointer to rx qdf_nbuf
*
* Receive callback registered with data path. DP will call this to notify
* when one or more packets were received for a registered
* STA.
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS dp_rx_packet_cbk(void *dp_link_context, qdf_nbuf_t rx_buf);
#if defined(WLAN_SUPPORT_RX_FISA)
/**
* wlan_dp_rx_fisa_cbk() - Entry function to FISA to handle aggregation
* @dp_soc: core txrx main context
* @dp_vdev: Handle DP vdev
* @nbuf_list: List nbufs to be aggregated
*
* Return: Success on aggregation
*/
QDF_STATUS wlan_dp_rx_fisa_cbk(void *dp_soc, void *dp_vdev,
qdf_nbuf_t nbuf_list);
/**
* wlan_dp_rx_fisa_flush_by_ctx_id() - Flush function to end of context
* flushing of aggregates
* @dp_soc: core txrx main context
* @ring_num: REO number to flush the flow Rxed on the REO
*
* Return: Success on flushing the flows for the REO
*/
QDF_STATUS wlan_dp_rx_fisa_flush_by_ctx_id(void *dp_soc, int ring_num);
/**
* wlan_dp_rx_fisa_flush_by_vdev_id() - Flush fisa aggregates per vdev id
* @dp_soc: core txrx main context
* @vdev_id: vdev ID
*
* Return: Success on flushing the flows for the vdev
*/
QDF_STATUS wlan_dp_rx_fisa_flush_by_vdev_id(void *dp_soc, uint8_t vdev_id);
#else
static inline QDF_STATUS wlan_dp_rx_fisa_flush_by_vdev_id(void *dp_soc,
uint8_t vdev_id)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* wlan_dp_rx_deliver_to_stack() - DP helper function to deliver RX pkts to
* stack
* @dp_intf: pointer to DP interface context
* @nbuf: pointer to nbuf
*
* The function calls the appropriate stack function depending upon the packet
* type and whether GRO/LRO is enabled.
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS wlan_dp_rx_deliver_to_stack(struct wlan_dp_intf *dp_intf,
qdf_nbuf_t nbuf);
/**
* dp_rx_thread_gro_flush_ind_cbk() - receive handler to flush GRO packets
* @link_ctx: pointer to DP interface context
* @rx_ctx_id: RX CTX Id for which flush should happen
*
* Receive callback registered with DP layer which flushes GRO packets
* for a given RX CTX ID (RX Thread)
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS dp_rx_thread_gro_flush_ind_cbk(void *link_ctx, int rx_ctx_id);
/**
* dp_rx_pkt_thread_enqueue_cbk() - receive pkt handler to enqueue into thread
* @link_ctx: pointer to DP link context
* @nbuf_list: pointer to qdf_nbuf list
*
* Receive callback registered with DP layer which enqueues packets into dp rx
* thread
*
* Return: QDF_STATUS_E_FAILURE if any errors encountered,
* QDF_STATUS_SUCCESS otherwise
*/
QDF_STATUS dp_rx_pkt_thread_enqueue_cbk(void *link_ctx,
qdf_nbuf_t nbuf_list);
/**
* dp_disable_rx_ol_for_low_tput() - Disable Rx offload in low TPUT scenario
* @dp_ctx: dp context
* @disable: true/false to disable/enable the Rx offload
*
* Return: none
*/
void dp_disable_rx_ol_for_low_tput(struct wlan_dp_psoc_context *dp_ctx,
bool disable);
/**
* dp_tx_rx_collect_connectivity_stats_info() - collect connectivity stats
* @nbuf: pointer to n/w buffer
* @context: pointer to DP interface
* @action: action done on pkt.
* @pkt_type: data pkt type
*
* Return: None
*/
void
dp_tx_rx_collect_connectivity_stats_info(qdf_nbuf_t nbuf, void *context,
enum connectivity_stats_pkt_status action, uint8_t *pkt_type);
static inline void
dp_nbuf_fill_gso_size(qdf_netdev_t dev, qdf_nbuf_t nbuf)
{
unsigned long val;
if (qdf_nbuf_is_cloned(nbuf) && qdf_nbuf_is_nonlinear(nbuf) &&
qdf_nbuf_get_gso_size(nbuf) == 0 &&
qdf_nbuf_is_ipv4_tcp_pkt(nbuf)) {
val = dev->mtu - ((qdf_nbuf_transport_header(nbuf) -
qdf_nbuf_network_header(nbuf))
+ qdf_nbuf_get_tcp_hdr_len(nbuf));
qdf_nbuf_set_gso_size(nbuf, val);
}
}
#ifdef CONFIG_HL_SUPPORT
static inline QDF_STATUS
dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)
{
return QDF_STATUS_SUCCESS;
}
#else
static inline QDF_STATUS
dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)
{
if (qdf_nbuf_is_nonlinear(nbuf) && qdf_nbuf_is_tso(nbuf) == false) {
if (qdf_unlikely(qdf_nbuf_linearize(nbuf)))
return QDF_STATUS_E_NOMEM;
}
return QDF_STATUS_SUCCESS;
}
#endif
#ifdef FEATURE_WLAN_DIAG_SUPPORT
void dp_event_eapol_log(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
#else
static inline
void dp_event_eapol_log(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
{}
#endif
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
static inline
qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
qdf_nbuf_t nbuf)
{
struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
struct wlan_dp_psoc_callbacks *dp_ops = &dp_ctx->dp_ops;
unsigned int tx_flow_low_watermark;
int need_orphan = 0;
int cpu;
tx_flow_low_watermark =
dp_ops->dp_get_tx_flow_low_watermark(dp_ops->callback_ctx,
dp_intf->dev);
if (tx_flow_low_watermark > 0) {
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0))
/*
* The TCP TX throttling logic is changed a little after
* 3.19-rc1 kernel, the TCP sending limit will be smaller,
* which will throttle the TCP packets to the host driver.
* The TCP UP LINK throughput will drop heavily. In order to
* fix this issue, need to orphan the socket buffer asap, which
* will call skb's destructor to notify the TCP stack that the
* SKB buffer is unowned. And then the TCP stack will pump more
* packets to host driver.
*
* The TX packets might be dropped for UDP case in the iperf
* testing. So need to be protected by follow control.
*/
need_orphan = 1;
#else
if (dp_ctx->dp_cfg.tx_orphan_enable)
need_orphan = 1;
#endif
} else if (dp_ctx->dp_cfg.tx_orphan_enable) {
if (qdf_nbuf_is_ipv4_tcp_pkt(nbuf) ||
qdf_nbuf_is_ipv6_tcp_pkt(nbuf))
need_orphan = 1;
}
if (need_orphan) {
qdf_nbuf_orphan(nbuf);
cpu = qdf_get_smp_processor_id();
++dp_intf->dp_stats.tx_rx_stats.per_cpu[cpu].tx_orphaned;
} else {
nbuf = __qdf_nbuf_unshare(nbuf);
}
return nbuf;
}
/**
* dp_get_tx_resource() - check tx resources and take action
* @dp_link: DP link handle
* @mac_addr: mac address
*
* Return: none
*/
void dp_get_tx_resource(struct wlan_dp_link *dp_link,
struct qdf_mac_addr *mac_addr);
#else
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0))
/**
* dp_nbuf_orphan() - skb_unshare a cloned packed else skb_orphan
* @dp_intf: pointer to DP interface
* @nbuf: pointer to nbuf data packet
*
* Return: pointer to nbuf structure
*/
static inline
qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
qdf_nbuf_t nbuf)
{
struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
int cpu;
dp_nbuf_fill_gso_size(dp_intf->dev, nbuf);
if (unlikely(dp_ctx->dp_cfg.tx_orphan_enable) ||
qdf_nbuf_is_cloned(nbuf)) {
/*
* For UDP packets we want to orphan the packet to allow the app
* to send more packets. The flow would ultimately be controlled
* by the limited number of tx descriptors for the vdev.
*/
cpu = qdf_get_smp_processor_id();
++dp_intf->dp_stats.tx_rx_stats.per_cpu[cpu].tx_orphaned;
qdf_nbuf_orphan(nbuf);
}
return nbuf;
}
#else
static inline
qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
qdf_nbuf_t nbuf)
{
qdf_nbuf_t nskb;
dp_nbuf_fill_gso_size(dp_intf->dev, nbuf);
nskb = __qdf_nbuf_unshare(nbuf);
return nskb;
}
#endif
/**
* dp_get_tx_resource() - check tx resources and take action
* @dp_link: DP link handle
* @mac_addr: mac address
*
* Return: none
*/
static inline
void dp_get_tx_resource(struct wlan_dp_link *dp_link,
struct qdf_mac_addr *mac_addr)
{
}
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
/**
* dp_start_xmit() - Transmit a frame
* @dp_link: DP link handle
* @nbuf: n/w buffer
*
* Function called to Transmit a n/w buffer in STA mode.
*
* Return: Status of the transmission
*/
QDF_STATUS
dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf);
#ifdef FEATURE_MONITOR_MODE_SUPPORT
/**
* dp_mon_rx_packet_cbk() - Receive callback registered with OL layer.
* @context: pointer to qdf context
* @rxbuf: pointer to rx qdf_nbuf
*
* TL will call this to notify the HDD when one or more packets were
* received for a registered STA.
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf);
/**
* dp_monitor_set_rx_monitor_cb(): Set rx monitor mode callback function
* @txrx: pointer to txrx ops
* @rx_monitor_cb: pointer to callback function
*
* Returns: None
*/
void dp_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx,
ol_txrx_rx_mon_fp rx_monitor_cb);
/**
* dp_rx_monitor_callback(): Callback function for receive monitor mode
* @vdev: Handle to vdev object
* @mpdu: pointer to mpdu to be delivered to os
* @rx_status: receive status
*
* Returns: None
*/
void dp_rx_monitor_callback(ol_osif_vdev_handle vdev,
qdf_nbuf_t mpdu,
void *rx_status);
#else
static inline
QDF_STATUS dp_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
{
return QDF_STATUS_SUCCESS;
}
static inline
void dp_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx,
ol_txrx_rx_mon_fp rx_monitor_cb) { }
static inline
void dp_rx_monitor_callback(ol_osif_vdev_handle vdev, qdf_nbuf_t mpdu,
void *rx_status) { }
#endif
/**
* dp_sta_notify_tx_comp_cb() - notify tx comp callback registered with dp
* @nbuf: pointer to nbuf
* @ctx: osif context
* @flag: tx status flag
*
* Return: None
*/
void dp_sta_notify_tx_comp_cb(qdf_nbuf_t nbuf, void *ctx, uint16_t flag);
/**
* dp_softap_notify_tx_compl_cbk() - notify softap tx comp registered with dp
* @nbuf: pointer to nbuf
* @context: osif context
* @flag: tx status flag
*
* Return: None
*/
void dp_softap_notify_tx_compl_cbk(qdf_nbuf_t nbuf,
void *context, uint16_t flag);
/**
* dp_rx_pkt_tracepoints_enabled() - Get the state of rx pkt tracepoint
*
* Return: True if any rx pkt tracepoint is enabled else false
*/
static inline bool dp_rx_pkt_tracepoints_enabled(void)
{
return (qdf_trace_dp_rx_tcp_pkt_enabled() ||
qdf_trace_dp_rx_udp_pkt_enabled() ||
qdf_trace_dp_rx_pkt_enabled());
}
#ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
/**
* wlan_dp_pkt_add_timestamp() - add timestamp in data payload
* @dp_intf: DP interface
* @index: timestamp index which decides offset in payload
* @nbuf: Network socket buffer
*
* Return: none
*/
void wlan_dp_pkt_add_timestamp(struct wlan_dp_intf *dp_intf,
enum qdf_pkt_timestamp_index index,
qdf_nbuf_t nbuf);
#else
static inline
void wlan_dp_pkt_add_timestamp(struct wlan_dp_intf *dp_intf,
enum qdf_pkt_timestamp_index index,
qdf_nbuf_t nbuf)
{
}
#endif
#if defined(FEATURE_LRO)
/**
* dp_lro_set_reset() - API for Disable/Enable LRO
* @dp_intf: DP interface pointer
* @enable_flag: enable or disable LRO.
*
* Return: 0 on success and non zero on failure.
*/
QDF_STATUS dp_lro_set_reset(struct wlan_dp_intf *dp_intf, uint8_t enable_flag);
#else
static inline
QDF_STATUS dp_lro_set_reset(struct wlan_dp_intf *dp_intf,
uint8_t enable_flag)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif /* FEATURE_LRO */
#ifdef RECEIVE_OFFLOAD
/**
* dp_rx_ol_init() - Initialize Rx offload mode (LRO or GRO)
* @dp_ctx: pointer to DP Context
* @is_wifi3_0_target: true if it wifi3.0 target
*
* Return: 0 on success and non zero on failure.
*/
QDF_STATUS dp_rx_ol_init(struct wlan_dp_psoc_context *dp_ctx,
bool is_wifi3_0_target);
#else /* RECEIVE_OFFLOAD */
static inline QDF_STATUS
dp_rx_ol_init(struct wlan_dp_psoc_context *dp_ctx,
bool is_wifi3_0_target)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif
#ifdef WLAN_FEATURE_11BE_MLO
static inline
void dp_rx_pkt_da_check(struct wlan_dp_intf *dp_intf, qdf_nbuf_t nbuf)
{
/* only do DA check for RX frame from non-regular path */
if (!qdf_nbuf_is_exc_frame(nbuf))
return;
if (qdf_mem_cmp(qdf_nbuf_data(nbuf), dp_intf->mac_addr.bytes,
ETH_ALEN)) {
dp_info("da mac:" QDF_MAC_ADDR_FMT "intf_mac:" QDF_MAC_ADDR_FMT,
QDF_MAC_ADDR_REF(qdf_nbuf_data(nbuf)),
QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes));
qdf_mem_copy(qdf_nbuf_data(nbuf), dp_intf->mac_addr.bytes,
ETH_ALEN);
}
}
#else
static inline
void dp_rx_pkt_da_check(struct wlan_dp_intf *dp_intf, qdf_nbuf_t nbuf)
{
}
#endif
#endif

View File

@ -0,0 +1,187 @@
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _WLAN_DP_WFDS_H_
#define _WLAN_DP_WFDS_H_
#ifdef FEATURE_DIRECT_LINK
#include "qdf_atomic.h"
#include "wlan_dp_priv.h"
#include "wlan_qmi_public_struct.h"
#include "wlan_qmi_wfds_api.h"
#define DP_WFDS_CE_MAX_SRNG QMI_WFDS_CE_MAX_SRNG
/**
* enum dp_wfds_msg - WFDS message type
* @DP_WFDS_REQ_MEM_IND_MSG: Memory request indication message
* @DP_WFDS_IPCC_MAP_N_CFG_IND_MSG: IPCC map and configure indication message
* @DP_WFDS_MSG_MAX: not a real value just a placeholder for max
*/
enum dp_wfds_msg {
DP_WFDS_REQ_MEM_IND_MSG,
DP_WFDS_IPCC_MAP_N_CFG_IND_MSG,
DP_WFDS_MSG_MAX,
};
/**
* enum dp_wfds_state - Datapath WFDS state
* @DP_WFDS_SVC_DISCONNECTED: service disconnected
* @DP_WFDS_SVC_CONNECTED: service connected
* @DP_WFDS_SVC_CONFIG_DONE: configuration msg handshake done
* @DP_WFDS_SVC_MEM_CONFIG_DONE: memory handshake with server done
* @DP_WFDS_SVC_IPCC_MAP_N_CFG_DONE: IPCC map and cfg handshake completed
*/
enum dp_wfds_state {
DP_WFDS_SVC_DISCONNECTED,
DP_WFDS_SVC_CONNECTED,
DP_WFDS_SVC_CONFIG_DONE,
DP_WFDS_SVC_MEM_CONFIG_DONE,
DP_WFDS_SVC_IPCC_MAP_N_CFG_DONE,
};
/**
* enum dp_wfds_event_type - Datapath WFDS event type
* @DP_WFDS_NEW_SERVER: QMI new server event
* @DP_WFDS_MEM_REQ: QMI memory request event
* @DP_WFDS_IPCC_MAP_N_CFG: QMI IPCC map and configure event
*/
enum dp_wfds_event_type {
DP_WFDS_NEW_SERVER,
DP_WFDS_MEM_REQ,
DP_WFDS_IPCC_MAP_N_CFG,
};
/**
* struct dp_wfds_event - DP QMI event structure
* @list_node: node used for adding/deleting to a list
* @wfds_evt_type: QMI event type
* @data: Pointer to event data
*/
struct dp_wfds_event {
qdf_list_node_t list_node;
enum dp_wfds_event_type wfds_evt_type;
void *data;
};
/**
* struct dp_direct_link_iommu_config - Direct link related IOMMU configuration
* @shadow_rdptr_paddr: shadow read pointer dma address
* @shadow_rdptr_map_size: shadow read pointer memory size
* @shadow_wrptr_paddr: shadow write pointer dma address
* @shadow_wrptr_map_size: shadow write pointer memory size
* @direct_link_srng_ring_base_paddr: SRNG ring base dma address
* @direct_link_srng_ring_map_size: SRNG ring memory size
* @direct_link_refill_ring_base_paddr: refill SRNG ring base dma address
* @direct_link_refill_ring_map_size: refill SRNG ring memory size
*/
struct dp_direct_link_iommu_config {
qdf_dma_addr_t shadow_rdptr_paddr;
uint16_t shadow_rdptr_map_size;
qdf_dma_addr_t shadow_wrptr_paddr;
uint16_t shadow_wrptr_map_size;
qdf_dma_addr_t direct_link_srng_ring_base_paddr[QMI_WFDS_CE_MAX_SRNG];
uint16_t direct_link_srng_ring_map_size[QMI_WFDS_CE_MAX_SRNG];
qdf_dma_addr_t direct_link_refill_ring_base_paddr;
uint16_t direct_link_refill_ring_map_size;
};
/**
* struct dp_direct_link_wfds_context - DP Direct Link WFDS context structure
* @direct_link_ctx: direct link context
* @wfds_work: work to be scheduled on QMI event
* @wfds_wq: QMI workqueue
* @wfds_event_list_lock: spinlock for event list access
* @wfds_event_list: QMI event list
* @wfds_state: QMI state
* @num_mem_arenas: Number of memory arenas requested by QMI server
* @mem_arena_pages: Pointer to array of mem multi page structure for arenas
* @ipcc_dma_addr: ipcc dma address
* @ipcc_ce_id: ids of CEs that are configured with IPCC MSI info
* @ipcc_ce_id_len: number of valid entries in ipcc_ce_id array
* @iommu_cfg: direct link iommu configuration
*/
struct dp_direct_link_wfds_context {
struct dp_direct_link_context *direct_link_ctx;
qdf_work_t wfds_work;
qdf_workqueue_t *wfds_wq;
qdf_spinlock_t wfds_event_list_lock;
qdf_list_t wfds_event_list;
qdf_atomic_t wfds_state;
uint32_t num_mem_arenas;
struct qdf_mem_multi_page_t *mem_arena_pages;
uint32_t ipcc_dma_addr;
uint8_t ipcc_ce_id[DP_WFDS_CE_MAX_SRNG];
uint8_t ipcc_ce_id_len;
struct dp_direct_link_iommu_config iommu_cfg;
};
/**
* dp_wfds_handle_request_mem_ind() - Process request memory indication received
* from QMI server
* @mem_msg: pointer to memory request indication message
*
* Return: None
*/
void
dp_wfds_handle_request_mem_ind(struct wlan_qmi_wfds_mem_ind_msg *mem_msg);
/**
* dp_wfds_handle_ipcc_map_n_cfg_ind() - Process IPCC map and configure
* indication received from QMI server
* @ipcc_msg: pointer to IPCC map and configure indication message
*
* Return: None
*/
void
dp_wfds_handle_ipcc_map_n_cfg_ind(struct wlan_qmi_wfds_ipcc_map_n_cfg_ind_msg *ipcc_msg);
/**
* dp_wfds_new_server() - New server callback triggered when service is up.
* Connect to the service as part of this call.
*
* Return: QDF status
*/
QDF_STATUS dp_wfds_new_server(void);
/**
* dp_wfds_del_server() - Del server callback triggered when service is
* down.
*
* Return: None
*/
void dp_wfds_del_server(void);
/**
* dp_wfds_init() - Initialize DP WFDS context
* @direct_link_ctx: DP Direct Link context
*
* Return: QDF status
*/
QDF_STATUS dp_wfds_init(struct dp_direct_link_context *direct_link_ctx);
/**
* dp_wfds_deinit() - Deinitialize DP WFDS context
* @direct_link_ctx: DP Direct Link context
* @is_ssr: true if SSR is in progress else false
*
* Return: None
*/
void dp_wfds_deinit(struct dp_direct_link_context *direct_link_ctx,
bool is_ssr);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,453 @@
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(WLAN_DP_BUS_BANDWIDTH_H)
#define WLAN_DP_BUS_BANDWIDTH_H
/**
* DOC: wlan_dp_bus_bandwidth.h
*
* Bus Bandwidth Manager implementation
*/
#include "wlan_dp_priv.h"
#include <qdf_types.h>
#include <qca_vendor.h>
#include <wlan_objmgr_psoc_obj.h>
#include "wlan_dp_public_struct.h"
#include "wlan_dp_priv.h"
#include <cdp_txrx_misc.h>
typedef const enum bus_bw_level
bus_bw_table_type[QCA_WLAN_802_11_MODE_INVALID][TPUT_LEVEL_MAX];
/**
* struct bbm_context: Bus Bandwidth Manager context
*
* @curr_bus_bw_lookup_table: current bus bw lookup table
* @curr_vote_level: current vote level
* @per_policy_vote: per BBM policy related vote
* @bbm_lock: BBM API lock
*/
struct bbm_context {
bus_bw_table_type *curr_bus_bw_lookup_table;
enum bus_bw_level curr_vote_level;
enum bus_bw_level per_policy_vote[BBM_MAX_POLICY];
qdf_mutex_t bbm_lock;
};
#ifdef FEATURE_BUS_BANDWIDTH_MGR
/**
* dp_bbm_context_init() - Initialize BBM context
* @psoc: psoc Handle
*
* Returns: error code
*/
int dp_bbm_context_init(struct wlan_objmgr_psoc *psoc);
/**
* dp_bbm_context_deinit() - De-initialize BBM context
* @psoc: psoc Handle
*
* Returns: None
*/
void dp_bbm_context_deinit(struct wlan_objmgr_psoc *psoc);
/**
* dp_bbm_apply_independent_policy() - Function to apply independent policies
* to set the bus bw level
* @psoc: psoc Handle
* @params: BBM policy related params
*
* The function applies BBM related policies and appropriately sets the bus
* bandwidth level.
*
* Returns: None
*/
void dp_bbm_apply_independent_policy(struct wlan_objmgr_psoc *psoc,
struct bbm_params *params);
#else
static inline int dp_bbm_context_init(struct wlan_objmgr_psoc *psoc)
{
return 0;
}
static inline void dp_bbm_context_deinit(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bbm_apply_independent_policy(struct wlan_objmgr_psoc *psoc,
struct bbm_params *params)
{
}
#endif /* FEATURE_BUS_BANDWIDTH_MGR */
#if defined(WLAN_FEATURE_DP_BUS_BANDWIDTH) && defined(FEATURE_RUNTIME_PM)
/**
* dp_rtpm_tput_policy_init() - Initialize RTPM tput policy
* @psoc: psoc handle
*
* Returns: None
*/
void dp_rtpm_tput_policy_init(struct wlan_objmgr_psoc *psoc);
/**
* dp_rtpm_tput_policy_deinit() - Deinitialize RTPM tput policy
* @psoc: psoc handle
*
* Returns: None
*/
void dp_rtpm_tput_policy_deinit(struct wlan_objmgr_psoc *psoc);
/**
* dp_rtpm_tput_policy_apply() - Apply RTPM tput policy
* @dp_ctx: dp_ctx handle
* @tput_level : Tput level
*
* Returns: None
*/
void dp_rtpm_tput_policy_apply(struct wlan_dp_psoc_context *dp_ctx,
enum tput_level tput_level);
/**
* dp_rtpm_tput_policy_get_vote() - Get RTPM tput policy vote
* @dp_ctx: dp_ctx handle
*
* Returns: Current vote
*/
int dp_rtpm_tput_policy_get_vote(struct wlan_dp_psoc_context *dp_ctx);
#else
static inline
void dp_rtpm_tput_policy_init(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_rtpm_tput_policy_deinit(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_rtpm_tput_policy_apply(struct wlan_dp_psoc_context *dp_ctx,
enum tput_level tput_level)
{
}
static inline int
dp_rtpm_tput_policy_get_vote(struct wlan_dp_psoc_context *dp_ctx)
{
return -EINVAL;
}
#endif /* WLAN_FEATURE_DP_BUS_BANDWIDTH && FEATURE_RUNTIME_PM */
/**
* dp_set_high_bus_bw_request() - Set High Bandwidth request value
* @psoc: psoc handle
* @vdev_id: Vdev ID
* @high_bus_bw : Flag to set or clear high bandwidth request
*
* Return: None
*/
static inline void dp_set_high_bus_bw_request(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id,
bool high_bus_bw)
{
struct wlan_dp_psoc_context *dp_ctx = dp_psoc_get_priv(psoc);
if (high_bus_bw)
dp_ctx->high_bus_bw_request |= (1 << vdev_id);
else
dp_ctx->high_bus_bw_request &= ~(1 << vdev_id);
}
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
/**
* dp_reset_tcp_delack() - Reset tcp delack value to default
* @psoc: psoc handle
*
* Function used to reset TCP delack value to its default value
*
* Return: None
*/
void dp_reset_tcp_delack(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dp_update_tcp_rx_param() - update TCP param in RX dir
* @dp_ctx: Pointer to DP context
* @data: Parameters to update
*
* Return: None
*/
void wlan_dp_update_tcp_rx_param(struct wlan_dp_psoc_context *dp_ctx,
struct wlan_rx_tp_data *data);
#ifdef RX_PERFORMANCE
/**
* dp_is_current_high_throughput() - Check if vote level is high
* @dp_ctx: Pointer to DP context
*
* Function used to check if vote level is high
*
* Return: True if vote level is high
*/
bool dp_is_current_high_throughput(struct wlan_dp_psoc_context *dp_ctx);
#else
static inline
bool dp_is_current_high_throughput(struct wlan_dp_psoc_context *dp_ctx)
{
return false;
}
#endif /* RX_PERFORMANCE */
/**
* dp_reset_tcp_delack() - Reset TCP delack
* @psoc: psoc handle
*
* Return: None
*/
void dp_reset_tcp_delack(struct wlan_objmgr_psoc *psoc);
/**
* dp_get_current_throughput_level() - Get the current vote
* level
* @dp_ctx: DP Context handle
*
* Return: current vote level
*/
static inline enum pld_bus_width_type
dp_get_current_throughput_level(struct wlan_dp_psoc_context *dp_ctx)
{
return dp_ctx->cur_vote_level;
}
/**
* dp_set_current_throughput_level() - update the current vote
* level
* @psoc: psoc object
* @next_vote_level: pld_bus_width_type voting level
*
* This function updates the current vote level to the new level
* provided
*
* Return: None
*/
static inline void
dp_set_current_throughput_level(struct wlan_objmgr_psoc *psoc,
enum pld_bus_width_type next_vote_level)
{
struct wlan_dp_psoc_context *dp_ctx = dp_psoc_get_priv(psoc);
dp_ctx->cur_vote_level = next_vote_level;
}
/**
* wlan_dp_display_tx_rx_histogram() - display tx rx histogram
* @psoc: psoc handle
*
* Return: none
*/
void wlan_dp_display_tx_rx_histogram(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dp_clear_tx_rx_histogram() - clear tx rx histogram
* @psoc: psoc handle
*
* Return: none
*/
void wlan_dp_clear_tx_rx_histogram(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bandwidth_init() - Initialize bus bandwidth data structures.
* @psoc: psoc handle
*
* Initialize bus bandwidth related data structures like spinlock and timer.
*
* Return: None.
*/
int dp_bus_bandwidth_init(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bandwidth_deinit() - De-initialize bus bandwidth data structures.
* @psoc: psoc handle
*
* De-initialize bus bandwidth related data structures like timer.
*
* Return: None.
*/
void dp_bus_bandwidth_deinit(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bw_compute_timer_start() - start the bandwidth timer
* @psoc: psoc handle
*
* Return: None
*/
void dp_bus_bw_compute_timer_start(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
* @psoc: psoc handle
*
* This function ensures there is at least one interface in the assoc state
* before starting the bandwidth timer.
*
* Return: None
*/
void dp_bus_bw_compute_timer_try_start(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bw_compute_timer_stop() - stop the bandwidth timer
* @psoc: psoc handle
*
* Return: None
*/
void dp_bus_bw_compute_timer_stop(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
* @psoc: psoc handle
*
* This function ensures there are no interface in the assoc state before
* stopping the bandwidth timer.
*
* Return: None
*/
void dp_bus_bw_compute_timer_try_stop(struct wlan_objmgr_psoc *psoc);
/**
* dp_bus_bw_compute_prev_txrx_stats() - get tx and rx stats
* @vdev: vdev handle
*
* This function get the collected tx and rx stats before starting
* the bus bandwidth timer.
*
* Return: None
*/
void dp_bus_bw_compute_prev_txrx_stats(struct wlan_objmgr_vdev *vdev);
/**
* dp_bus_bw_compute_reset_prev_txrx_stats() - reset previous tx and rx stats
* @vdev: vdev handle
*
* This function resets the previous tx rx stats.
*
* Return: None
*/
void dp_bus_bw_compute_reset_prev_txrx_stats(struct wlan_objmgr_vdev *vdev);
/**
* dp_get_bus_bw_high_threshold() - Get the bus bw high threshold
* level
* @dp_ctx: DP Context handle
*
* Return: bus bw high threshold
*/
static inline uint32_t
dp_get_bus_bw_high_threshold(struct wlan_dp_psoc_context *dp_ctx)
{
return dp_ctx->dp_cfg.bus_bw_high_threshold;
}
#else
static inline
void dp_reset_tcp_delack(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void wlan_dp_update_tcp_rx_param(struct wlan_dp_psoc_context *dp_ctx,
struct wlan_rx_tp_data *data)
{
}
static inline
bool dp_is_current_high_throughput(struct wlan_dp_psoc_context *dp_ctx)
{
return false;
}
static inline enum pld_bus_width_type
dp_get_current_throughput_level(struct wlan_dp_psoc_context *dp_ctx)
{
return PLD_BUS_WIDTH_NONE;
}
static inline
void dp_set_current_throughput_level(struct wlan_objmgr_psoc *psoc,
enum pld_bus_width_type next_vote_level)
{
}
static inline
void wlan_dp_display_tx_rx_histogram(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void wlan_dp_clear_tx_rx_histogram(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bandwidth_init(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bandwidth_deinit(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bw_compute_timer_start(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bw_compute_timer_try_start(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bw_compute_timer_stop(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bw_compute_timer_try_stop(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void dp_bus_bw_compute_prev_txrx_stats(struct wlan_objmgr_vdev *vdev)
{
}
static inline
void dp_bus_bw_compute_reset_prev_txrx_stats(struct wlan_objmgr_vdev *vdev)
{
}
static inline uint32_t
dp_get_bus_bw_high_threshold(struct wlan_dp_psoc_context *dp_ctx)
{
return 0;
}
#endif /* WLAN_FEATURE_DP_BUS_BANDWIDTH */
#endif /* WLAN_DP_BUS_BANDWIDTH_H */

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