1*4882a593Smuzhiyun /******************************************************************************
2*4882a593Smuzhiyun *
3*4882a593Smuzhiyun * This file is provided under a dual BSD/GPLv2 license. When using or
4*4882a593Smuzhiyun * redistributing this file, you may do so under either license.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * GPL LICENSE SUMMARY
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * Copyright(c) 2007 - 2014, 2018 - 2020 Intel Corporation. All rights reserved.
9*4882a593Smuzhiyun *
10*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify
11*4882a593Smuzhiyun * it under the terms of version 2 of the GNU General Public License as
12*4882a593Smuzhiyun * published by the Free Software Foundation.
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, but
15*4882a593Smuzhiyun * WITHOUT ANY WARRANTY; without even the implied warranty of
16*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17*4882a593Smuzhiyun * General Public License for more details.
18*4882a593Smuzhiyun *
19*4882a593Smuzhiyun * The full GNU General Public License is included in this distribution
20*4882a593Smuzhiyun * in the file called COPYING.
21*4882a593Smuzhiyun *
22*4882a593Smuzhiyun * Contact Information:
23*4882a593Smuzhiyun * Intel Linux Wireless <linuxwifi@intel.com>
24*4882a593Smuzhiyun * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25*4882a593Smuzhiyun *
26*4882a593Smuzhiyun * BSD LICENSE
27*4882a593Smuzhiyun *
28*4882a593Smuzhiyun * Copyright(c) 2005 - 2014, 2018 - 2020 Intel Corporation. All rights reserved.
29*4882a593Smuzhiyun * All rights reserved.
30*4882a593Smuzhiyun *
31*4882a593Smuzhiyun * Redistribution and use in source and binary forms, with or without
32*4882a593Smuzhiyun * modification, are permitted provided that the following conditions
33*4882a593Smuzhiyun * are met:
34*4882a593Smuzhiyun *
35*4882a593Smuzhiyun * * Redistributions of source code must retain the above copyright
36*4882a593Smuzhiyun * notice, this list of conditions and the following disclaimer.
37*4882a593Smuzhiyun * * Redistributions in binary form must reproduce the above copyright
38*4882a593Smuzhiyun * notice, this list of conditions and the following disclaimer in
39*4882a593Smuzhiyun * the documentation and/or other materials provided with the
40*4882a593Smuzhiyun * distribution.
41*4882a593Smuzhiyun * * Neither the name Intel Corporation nor the names of its
42*4882a593Smuzhiyun * contributors may be used to endorse or promote products derived
43*4882a593Smuzhiyun * from this software without specific prior written permission.
44*4882a593Smuzhiyun *
45*4882a593Smuzhiyun * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46*4882a593Smuzhiyun * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47*4882a593Smuzhiyun * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48*4882a593Smuzhiyun * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49*4882a593Smuzhiyun * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50*4882a593Smuzhiyun * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51*4882a593Smuzhiyun * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52*4882a593Smuzhiyun * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53*4882a593Smuzhiyun * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54*4882a593Smuzhiyun * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55*4882a593Smuzhiyun * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56*4882a593Smuzhiyun *
57*4882a593Smuzhiyun *****************************************************************************/
58*4882a593Smuzhiyun #ifndef __iwl_modparams_h__
59*4882a593Smuzhiyun #define __iwl_modparams_h__
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun #include <linux/types.h>
62*4882a593Smuzhiyun #include <linux/spinlock.h>
63*4882a593Smuzhiyun #include <linux/gfp.h>
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun extern struct iwl_mod_params iwlwifi_mod_params;
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun enum iwl_power_level {
68*4882a593Smuzhiyun IWL_POWER_INDEX_1,
69*4882a593Smuzhiyun IWL_POWER_INDEX_2,
70*4882a593Smuzhiyun IWL_POWER_INDEX_3,
71*4882a593Smuzhiyun IWL_POWER_INDEX_4,
72*4882a593Smuzhiyun IWL_POWER_INDEX_5,
73*4882a593Smuzhiyun IWL_POWER_NUM
74*4882a593Smuzhiyun };
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun enum iwl_disable_11n {
77*4882a593Smuzhiyun IWL_DISABLE_HT_ALL = BIT(0),
78*4882a593Smuzhiyun IWL_DISABLE_HT_TXAGG = BIT(1),
79*4882a593Smuzhiyun IWL_DISABLE_HT_RXAGG = BIT(2),
80*4882a593Smuzhiyun IWL_ENABLE_HT_TXAGG = BIT(3),
81*4882a593Smuzhiyun };
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun enum iwl_amsdu_size {
84*4882a593Smuzhiyun IWL_AMSDU_DEF = 0,
85*4882a593Smuzhiyun IWL_AMSDU_4K = 1,
86*4882a593Smuzhiyun IWL_AMSDU_8K = 2,
87*4882a593Smuzhiyun IWL_AMSDU_12K = 3,
88*4882a593Smuzhiyun /* Add 2K at the end to avoid breaking current API */
89*4882a593Smuzhiyun IWL_AMSDU_2K = 4,
90*4882a593Smuzhiyun };
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun enum iwl_uapsd_disable {
93*4882a593Smuzhiyun IWL_DISABLE_UAPSD_BSS = BIT(0),
94*4882a593Smuzhiyun IWL_DISABLE_UAPSD_P2P_CLIENT = BIT(1),
95*4882a593Smuzhiyun };
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun /**
98*4882a593Smuzhiyun * struct iwl_mod_params
99*4882a593Smuzhiyun *
100*4882a593Smuzhiyun * Holds the module parameters
101*4882a593Smuzhiyun *
102*4882a593Smuzhiyun * @swcrypto: using hardware encryption, default = 0
103*4882a593Smuzhiyun * @disable_11n: disable 11n capabilities, default = 0,
104*4882a593Smuzhiyun * use IWL_[DIS,EN]ABLE_HT_* constants
105*4882a593Smuzhiyun * @amsdu_size: See &enum iwl_amsdu_size.
106*4882a593Smuzhiyun * @fw_restart: restart firmware, default = 1
107*4882a593Smuzhiyun * @bt_coex_active: enable bt coex, default = true
108*4882a593Smuzhiyun * @led_mode: system default, default = 0
109*4882a593Smuzhiyun * @power_save: enable power save, default = false
110*4882a593Smuzhiyun * @power_level: power level, default = 1
111*4882a593Smuzhiyun * @debug_level: levels are IWL_DL_*
112*4882a593Smuzhiyun * @nvm_file: specifies a external NVM file
113*4882a593Smuzhiyun * @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default =
114*4882a593Smuzhiyun * IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT
115*4882a593Smuzhiyun * @disable_11ac: disable VHT capabilities, default = false.
116*4882a593Smuzhiyun * @remove_when_gone: remove an inaccessible device from the PCIe bus.
117*4882a593Smuzhiyun * @enable_ini: enable new FW debug infratructure (INI TLVs)
118*4882a593Smuzhiyun */
119*4882a593Smuzhiyun struct iwl_mod_params {
120*4882a593Smuzhiyun int swcrypto;
121*4882a593Smuzhiyun unsigned int disable_11n;
122*4882a593Smuzhiyun int amsdu_size;
123*4882a593Smuzhiyun bool fw_restart;
124*4882a593Smuzhiyun bool bt_coex_active;
125*4882a593Smuzhiyun int led_mode;
126*4882a593Smuzhiyun bool power_save;
127*4882a593Smuzhiyun int power_level;
128*4882a593Smuzhiyun #ifdef CONFIG_IWLWIFI_DEBUG
129*4882a593Smuzhiyun u32 debug_level;
130*4882a593Smuzhiyun #endif
131*4882a593Smuzhiyun char *nvm_file;
132*4882a593Smuzhiyun u32 uapsd_disable;
133*4882a593Smuzhiyun bool disable_11ac;
134*4882a593Smuzhiyun /**
135*4882a593Smuzhiyun * @disable_11ax: disable HE capabilities, default = false
136*4882a593Smuzhiyun */
137*4882a593Smuzhiyun bool disable_11ax;
138*4882a593Smuzhiyun bool remove_when_gone;
139*4882a593Smuzhiyun bool enable_ini;
140*4882a593Smuzhiyun };
141*4882a593Smuzhiyun
iwl_enable_rx_ampdu(void)142*4882a593Smuzhiyun static inline bool iwl_enable_rx_ampdu(void)
143*4882a593Smuzhiyun {
144*4882a593Smuzhiyun if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG)
145*4882a593Smuzhiyun return false;
146*4882a593Smuzhiyun return true;
147*4882a593Smuzhiyun }
148*4882a593Smuzhiyun
iwl_enable_tx_ampdu(void)149*4882a593Smuzhiyun static inline bool iwl_enable_tx_ampdu(void)
150*4882a593Smuzhiyun {
151*4882a593Smuzhiyun if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)
152*4882a593Smuzhiyun return false;
153*4882a593Smuzhiyun if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG)
154*4882a593Smuzhiyun return true;
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun /* enabled by default */
157*4882a593Smuzhiyun return true;
158*4882a593Smuzhiyun }
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun #endif /* #__iwl_modparams_h__ */
161