1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2005-2014, 2018-2022 Intel Corporation 4 */ 5 #ifndef __iwl_modparams_h__ 6 #define __iwl_modparams_h__ 7 8 #include <linux/types.h> 9 #include <linux/spinlock.h> 10 #include <linux/gfp.h> 11 #ifdef CONFIG_IWLWIFI_DEBUG 12 #include "iwl-debug.h" 13 #endif 14 15 extern struct iwl_mod_params iwlwifi_mod_params; 16 17 enum iwl_power_level { 18 IWL_POWER_INDEX_1, 19 IWL_POWER_INDEX_2, 20 IWL_POWER_INDEX_3, 21 IWL_POWER_INDEX_4, 22 IWL_POWER_INDEX_5, 23 IWL_POWER_NUM 24 }; 25 26 enum iwl_disable_11n { 27 IWL_DISABLE_HT_ALL = BIT(0), 28 IWL_DISABLE_HT_TXAGG = BIT(1), 29 IWL_DISABLE_HT_RXAGG = BIT(2), 30 IWL_ENABLE_HT_TXAGG = BIT(3), 31 }; 32 33 enum iwl_amsdu_size { 34 IWL_AMSDU_DEF = 0, 35 IWL_AMSDU_4K = 1, 36 IWL_AMSDU_8K = 2, 37 IWL_AMSDU_12K = 3, 38 /* Add 2K at the end to avoid breaking current API */ 39 IWL_AMSDU_2K = 4, 40 }; 41 42 enum iwl_uapsd_disable { 43 IWL_DISABLE_UAPSD_BSS = BIT(0), 44 IWL_DISABLE_UAPSD_P2P_CLIENT = BIT(1), 45 }; 46 47 /** 48 * struct iwl_mod_params 49 * 50 * Holds the module parameters 51 * 52 * @swcrypto: using hardware encryption, default = 0 53 * @disable_11n: disable 11n capabilities, default = 0, 54 * use IWL_[DIS,EN]ABLE_HT_* constants 55 * @amsdu_size: See &enum iwl_amsdu_size. 56 * @fw_restart: restart firmware, default = 1 57 * @bt_coex_active: enable bt coex, default = true 58 * @led_mode: system default, default = 0 59 * @power_save: enable power save, default = false 60 * @power_level: power level, default = 1 61 * @debug_level: levels are IWL_DL_* 62 * @nvm_file: specifies a external NVM file 63 * @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default = 64 * IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT 65 * @disable_11ac: disable VHT capabilities, default = false. 66 * @remove_when_gone: remove an inaccessible device from the PCIe bus. 67 * @enable_ini: enable new FW debug infratructure (INI TLVs) 68 * @disable_11be: disable EHT capabilities, default = false. 69 */ 70 struct iwl_mod_params { 71 int swcrypto; 72 unsigned int disable_11n; 73 int amsdu_size; 74 bool fw_restart; 75 bool bt_coex_active; 76 int led_mode; 77 bool power_save; 78 int power_level; 79 #ifdef CONFIG_IWLWIFI_DEBUG 80 #if defined(__linux__) 81 u32 debug_level; 82 #elif defined(__FreeBSD__) 83 enum iwl_dl debug_level; 84 #endif 85 #endif 86 char *nvm_file; 87 u32 uapsd_disable; 88 bool disable_11ac; 89 /** 90 * @disable_11ax: disable HE capabilities, default = false 91 */ 92 bool disable_11ax; 93 bool remove_when_gone; 94 u32 enable_ini; 95 bool disable_11be; 96 }; 97 98 static inline bool iwl_enable_rx_ampdu(void) 99 { 100 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) 101 return false; 102 return true; 103 } 104 105 static inline bool iwl_enable_tx_ampdu(void) 106 { 107 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) 108 return false; 109 if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG) 110 return true; 111 112 /* enabled by default */ 113 return true; 114 } 115 116 #endif /* #__iwl_modparams_h__ */ 117