1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2005-2014, 2018-2020 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 */ 69 struct iwl_mod_params { 70 int swcrypto; 71 unsigned int disable_11n; 72 int amsdu_size; 73 bool fw_restart; 74 bool bt_coex_active; 75 int led_mode; 76 bool power_save; 77 int power_level; 78 #ifdef CONFIG_IWLWIFI_DEBUG 79 enum iwl_dl debug_level; 80 #endif 81 char *nvm_file; 82 u32 uapsd_disable; 83 bool disable_11ac; 84 /** 85 * @disable_11ax: disable HE capabilities, default = false 86 */ 87 bool disable_11ax; 88 bool remove_when_gone; 89 bool enable_ini; 90 }; 91 92 static inline bool iwl_enable_rx_ampdu(void) 93 { 94 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) 95 return false; 96 return true; 97 } 98 99 static inline bool iwl_enable_tx_ampdu(void) 100 { 101 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) 102 return false; 103 if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG) 104 return true; 105 106 /* enabled by default */ 107 return true; 108 } 109 110 #endif /* #__iwl_modparams_h__ */ 111