Advertisement
Guest User

iwlwifi lar_disable

a guest
Mar 19th, 2023
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.01 KB | Source Code | 0 0
  1. diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
  2. index 884750bf7..449a0eaad 100644
  3. --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
  4. +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
  5. @@ -1799,6 +1799,9 @@ MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)")
  6.  module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, 0444);
  7.  MODULE_PARM_DESC(nvm_file, "NVM file name");
  8.  
  9. +module_param_named(lar_disable, iwlwifi_mod_params.lar_disable, bool, 0444);
  10. +MODULE_PARM_DESC(lar_disable, "disable LAR functionality (default: N)");
  11. +
  12.  module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable, uint, 0644);
  13.  MODULE_PARM_DESC(uapsd_disable,
  14.          "disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3)");
  15. diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
  16. index 004ebdac4..3a1b89f94 100644
  17. --- a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
  18. +++ b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
  19. @@ -59,6 +59,7 @@ enum iwl_uapsd_disable {
  20.   * @nvm_file: specifies a external NVM file
  21.   * @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default =
  22.   * IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT
  23. + * @lar_disable: disable LAR (regulatory), default = 0
  24.   * @disable_11ac: disable VHT capabilities, default = false.
  25.   * @remove_when_gone: remove an inaccessible device from the PCIe bus.
  26.   * @enable_ini: enable new FW debug infratructure (INI TLVs)
  27. @@ -77,6 +78,7 @@ struct iwl_mod_params {
  28.  #endif
  29.     char *nvm_file;
  30.     u32 uapsd_disable;
  31. +   bool lar_disable;
  32.     bool disable_11ac;
  33.     /**
  34.      * @disable_11ax: disable HE capabilities, default = false
  35. diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
  36. index fc75d0490..905bcdfde 100644
  37. --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
  38. +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
  39. @@ -1066,7 +1066,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
  40.            const __be16 *nvm_hw, const __le16 *nvm_sw,
  41.            const __le16 *nvm_calib, const __le16 *regulatory,
  42.            const __le16 *mac_override, const __le16 *phy_sku,
  43. -          u8 tx_chains, u8 rx_chains)
  44. +          u8 tx_chains, u8 rx_chains, bool lar_fw_supported)
  45.  {
  46.     struct iwl_nvm_data *data;
  47.     bool lar_enabled;
  48. @@ -1146,8 +1146,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
  49.         return NULL;
  50.     }
  51.  
  52. -   if (lar_enabled &&
  53. -       fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_LAR_SUPPORT))
  54. +   if (lar_fw_supported && lar_enabled)
  55.         sbands_flags |= IWL_NVM_SBANDS_FLAGS_LAR;
  56.  
  57.     if (iwl_nvm_no_wide_in_5ghz(trans, cfg, nvm_hw))
  58. @@ -1569,6 +1568,9 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
  59.         .id = WIDE_ID(REGULATORY_AND_NVM_GROUP, NVM_GET_INFO)
  60.     };
  61.     int  ret;
  62. +   bool lar_fw_supported = !iwlwifi_mod_params.lar_disable &&
  63. +           fw_has_capa(&fw->ucode_capa,
  64. +                   IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
  65.     bool empty_otp;
  66.     u32 mac_flags;
  67.     u32 sbands_flags = 0;
  68. @@ -1646,9 +1648,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
  69.     nvm->valid_tx_ant = (u8)le32_to_cpu(rsp->phy_sku.tx_chains);
  70.     nvm->valid_rx_ant = (u8)le32_to_cpu(rsp->phy_sku.rx_chains);
  71.  
  72. -   if (le32_to_cpu(rsp->regulatory.lar_enabled) &&
  73. -       fw_has_capa(&fw->ucode_capa,
  74. -           IWL_UCODE_TLV_CAPA_LAR_SUPPORT)) {
  75. +   if (le32_to_cpu(rsp->regulatory.lar_enabled) && lar_fw_supported) {
  76.         nvm->lar_enabled = true;
  77.         sbands_flags |= IWL_NVM_SBANDS_FLAGS_LAR;
  78.     }
  79. diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
  80. index e1f5a9741..65a04659a 100644
  81. --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
  82. +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
  83. @@ -34,7 +34,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
  84.            const __be16 *nvm_hw, const __le16 *nvm_sw,
  85.            const __le16 *nvm_calib, const __le16 *regulatory,
  86.            const __le16 *mac_override, const __le16 *phy_sku,
  87. -          u8 tx_chains, u8 rx_chains);
  88. +          u8 tx_chains, u8 rx_chains, bool lar_fw_supported);
  89.  
  90.  /**
  91.   * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW
  92. diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
  93. index 02cf52133..c30f11857 100644
  94. --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
  95. +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
  96. @@ -1257,6 +1257,9 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
  97.     bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
  98.                    IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
  99.  
  100. +   if (iwlwifi_mod_params.lar_disable)
  101. +       return false;
  102. +
  103.     /*
  104.      * Enable LAR only if it is supported by the FW (TLV) &&
  105.      * enabled in the NVM
  106. diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
  107. index 7fb4e618f..e3675fdfc 100644
  108. --- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
  109. +++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
  110. @@ -220,6 +220,7 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
  111.     struct iwl_nvm_section *sections = mvm->nvm_sections;
  112.     const __be16 *hw;
  113.     const __le16 *sw, *calib, *regulatory, *mac_override, *phy_sku;
  114. +   bool lar_enabled;
  115.     int regulatory_type;
  116.  
  117.     /* Checking for required sections */
  118. @@ -270,9 +271,14 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
  119.         (const __le16 *)sections[NVM_SECTION_TYPE_REGULATORY_SDP].data :
  120.         (const __le16 *)sections[NVM_SECTION_TYPE_REGULATORY].data;
  121.  
  122. +   lar_enabled = !iwlwifi_mod_params.lar_disable &&
  123. +             fw_has_capa(&mvm->fw->ucode_capa,
  124. +                 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
  125. +
  126.     return iwl_parse_nvm_data(mvm->trans, mvm->cfg, mvm->fw, hw, sw, calib,
  127.                   regulatory, mac_override, phy_sku,
  128. -                 mvm->fw->valid_tx_ant, mvm->fw->valid_rx_ant);
  129. +                 mvm->fw->valid_tx_ant, mvm->fw->valid_rx_ant,
  130. +                 lar_enabled);
  131.  }
  132.  
  133.  /* Loads the NVM data stored in mvm->nvm_sections into the NIC */
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement