From: Gavin Li <git@xxxxxxxxxxxxxx> Open up the filter if there is a monitor interface configured; this allows all packets on the channel to be captured even if the device is in STA mode and associated to a BSS. Signed-off-by: Gavin Li <git@xxxxxxxxxxxxxx> --- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 6 ++++++ drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index a2bf530eeae4..38b933dc8545 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -654,6 +654,12 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP); + if (mvm->hw->conf.flags & IEEE80211_CONF_MONITOR) + cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROMISC | + MAC_FILTER_IN_CONTROL_AND_MGMT | + MAC_FILTER_IN_BEACON | + MAC_FILTER_IN_PROBE_REQUEST); + for (i = 0; i < IEEE80211_NUM_ACS; i++) { u8 txf = iwl_mvm_mac_ac_to_tx_fifo(mvm, i); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 15f2d826bb4b..c529fb8228df 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1530,8 +1530,23 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, mutex_unlock(&mvm->mutex); } +static void iwl_mvm_monitor_changed_iterator(void *_mvm, u8 *mac, struct ieee80211_vif *vif) +{ + struct iwl_mvm *mvm = _mvm; + iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); +} + static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed) { + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); + + if (changed & IEEE80211_CONF_CHANGE_MONITOR) { + mutex_lock(&mvm->mutex); + ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_NORMAL, + iwl_mvm_monitor_changed_iterator, mvm); + mutex_unlock(&mvm->mutex); + } + return 0; } -- 2.14.1