Path: blob/main/sys/contrib/dev/iwlwifi/iwl-modparams.h
48253 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2005-2014, 2018-2022, 2024 Intel Corporation3*/4#ifndef __iwl_modparams_h__5#define __iwl_modparams_h__67#include <linux/types.h>8#include <linux/spinlock.h>9#include <linux/gfp.h>10#ifdef CONFIG_IWLWIFI_DEBUG11#include "iwl-debug.h"12#endif1314extern struct iwl_mod_params iwlwifi_mod_params;1516enum iwl_power_level {17IWL_POWER_INDEX_1,18IWL_POWER_INDEX_2,19IWL_POWER_INDEX_3,20IWL_POWER_INDEX_4,21IWL_POWER_INDEX_5,22IWL_POWER_NUM23};2425enum iwl_disable_11n {26IWL_DISABLE_HT_ALL = BIT(0),27IWL_DISABLE_HT_TXAGG = BIT(1),28IWL_DISABLE_HT_RXAGG = BIT(2),29IWL_ENABLE_HT_TXAGG = BIT(3),30};3132enum iwl_amsdu_size {33IWL_AMSDU_DEF = 0,34IWL_AMSDU_4K = 1,35IWL_AMSDU_8K = 2,36IWL_AMSDU_12K = 3,37/* Add 2K at the end to avoid breaking current API */38IWL_AMSDU_2K = 4,39};4041enum iwl_uapsd_disable {42IWL_DISABLE_UAPSD_BSS = BIT(0),43IWL_DISABLE_UAPSD_P2P_CLIENT = BIT(1),44};4546/**47* struct iwl_mod_params48*49* Holds the module parameters50*51* @swcrypto: using hardware encryption, default = 052* @disable_11n: disable 11n capabilities, default = 0,53* use IWL_[DIS,EN]ABLE_HT_* constants54* @amsdu_size: See &enum iwl_amsdu_size.55* @fw_restart: restart firmware, default = 156* @bt_coex_active: enable bt coex, default = true57* @led_mode: system default, default = 058* @power_save: enable power save, default = false59* @power_level: power level, default = 160* @debug_level: levels are IWL_DL_*61* @nvm_file: specifies a external NVM file62* @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default =63* IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT64* @disable_11ac: disable VHT capabilities, default = false.65* @remove_when_gone: remove an inaccessible device from the PCIe bus.66* @enable_ini: enable new FW debug infratructure (INI TLVs)67* @disable_11be: disable EHT capabilities, default = false.68*/69struct iwl_mod_params {70int swcrypto;71unsigned int disable_11n;72int amsdu_size;73bool fw_restart;74bool bt_coex_active;75int led_mode;76bool power_save;77int power_level;78#ifdef CONFIG_IWLWIFI_DEBUG79#if defined(__linux__)80u32 debug_level;81#elif defined(__FreeBSD__)82enum iwl_dl debug_level;83#endif84#endif85char *nvm_file;86u32 uapsd_disable;87bool disable_11ac;88/**89* @disable_11ax: disable HE capabilities, default = false90*/91bool disable_11ax;92bool remove_when_gone;93u32 enable_ini;94bool disable_11be;95};9697static inline bool iwl_enable_rx_ampdu(void)98{99if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG)100return false;101return true;102}103104static inline bool iwl_enable_tx_ampdu(void)105{106if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)107return false;108if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG)109return true;110111/* enabled by default */112return true;113}114115/* Verify amsdu_size module parameter and convert it to a rxb size */116static inline enum iwl_amsdu_size117iwl_amsdu_size_to_rxb_size(void)118{119switch (iwlwifi_mod_params.amsdu_size) {120case IWL_AMSDU_8K:121return IWL_AMSDU_8K;122case IWL_AMSDU_12K:123return IWL_AMSDU_12K;124default:125pr_err("%s: Unsupported amsdu_size: %d\n", KBUILD_MODNAME,126iwlwifi_mod_params.amsdu_size);127fallthrough;128case IWL_AMSDU_DEF:129case IWL_AMSDU_4K:130return IWL_AMSDU_4K;131}132}133134#endif /* #__iwl_modparams_h__ */135136137