wifi: iwlwifi: enable monitor on passive/inactive channels
authorJohannes Berg <johannes.berg@intel.com>
Tue, 19 Mar 2024 08:10:26 +0000 (10:10 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Mar 2024 14:39:11 +0000 (15:39 +0100)
If firmware supports pure passive monitor on passive/inactive
channels, enable that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240319100755.7c62f421f03e.I9969d3a46fed48e67fa28a7d00080b0dd314dabd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/file.h
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

index f69d29e531c89d0ffcc5bb71bfdb6faeebb0a29e..ae05227b615375539bfea748b2c51143acd54b34 100644 (file)
@@ -395,6 +395,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
  * @IWL_UCODE_TLV_CAPA_SPP_AMSDU_SUPPORT: Support SPP (signaling and payload
  *     protected) A-MSDU.
  * @IWL_UCODE_TLV_CAPA_SECURE_LTF_SUPPORT: Support secure LTF measurement.
+ * @IWL_UCODE_TLV_CAPA_MONITOR_PASSIVE_CHANS: Support monitor mode on otherwise
+ *     passive channels
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -494,6 +496,7 @@ enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_SNIFF_VALIDATE_SUPPORT       = (__force iwl_ucode_tlv_capa_t)116,
        IWL_UCODE_TLV_CAPA_CHINA_22_REG_SUPPORT         = (__force iwl_ucode_tlv_capa_t)117,
        IWL_UCODE_TLV_CAPA_SECURE_LTF_SUPPORT           = (__force iwl_ucode_tlv_capa_t)121,
+       IWL_UCODE_TLV_CAPA_MONITOR_PASSIVE_CHANS        = (__force iwl_ucode_tlv_capa_t)122,
        NUM_IWL_UCODE_TLV_CAPA
 /*
  * This construction make both sparse (which cannot increment the previous
index 047f77aad367ea4f090f0d6b4855e0d0bfa6260d..9a8d2b69f1548bce8000fbd1a61f69f5c668e3bf 100644 (file)
@@ -392,11 +392,14 @@ static enum nl80211_band iwl_nl80211_band_from_channel_idx(int ch_idx)
        return NL80211_BAND_2GHZ;
 }
 
-static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
+static int iwl_init_channel_map(struct iwl_trans *trans,
+                               const struct iwl_fw *fw,
                                struct iwl_nvm_data *data,
                                const void * const nvm_ch_flags,
                                u32 sbands_flags, bool v4)
 {
+       const struct iwl_cfg *cfg = trans->cfg;
+       struct device *dev = trans->dev;
        int ch_idx;
        int n_channels = 0;
        struct ieee80211_channel *channel;
@@ -478,6 +481,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
                else
                        channel->flags = 0;
 
+               if (fw_has_capa(&fw->ucode_capa,
+                               IWL_UCODE_TLV_CAPA_MONITOR_PASSIVE_CHANS))
+                       channel->flags |= IEEE80211_CHAN_CAN_MONITOR;
+
                iwl_nvm_print_channel_flags(dev, IWL_DL_EEPROM,
                                            channel->hw_value, ch_flags);
                IWL_DEBUG_EEPROM(dev, "Ch. %d: %ddBm\n",
@@ -1171,12 +1178,11 @@ static void iwl_init_sbands(struct iwl_trans *trans,
                            const struct iwl_fw *fw)
 {
        struct device *dev = trans->dev;
-       const struct iwl_cfg *cfg = trans->cfg;
        int n_channels;
        int n_used = 0;
        struct ieee80211_supported_band *sband;
 
-       n_channels = iwl_init_channel_map(dev, cfg, data, nvm_ch_flags,
+       n_channels = iwl_init_channel_map(trans, fw, data, nvm_ch_flags,
                                          sbands_flags, v4);
        sband = &data->bands[NL80211_BAND_2GHZ];
        sband->band = NL80211_BAND_2GHZ;