Patch "iwlwifi: mvm: synchronize with FW after multicast commands" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iwlwifi: mvm: synchronize with FW after multicast commands

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iwlwifi-mvm-synchronize-with-fw-after-multicast-comm.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a6444b12c763842e647119d433fca22218344bf7
Author: Johannes Berg <johannes.berg@xxxxxxxxx>
Date:   Sat Dec 4 08:35:45 2021 +0200

    iwlwifi: mvm: synchronize with FW after multicast commands
    
    [ Upstream commit db66abeea3aefed481391ecc564fb7b7fb31d742 ]
    
    If userspace installs a lot of multicast groups very quickly, then
    we may run out of command queue space as we send the updates in an
    asynchronous fashion (due to locking concerns), and the CPU can
    create them faster than the firmware can process them. This is true
    even when mac80211 has a work struct that gets scheduled.
    
    Fix this by synchronizing with the firmware after sending all those
    commands - outside of the iteration we can send a synchronous echo
    command that just has the effect of the CPU waiting for the prior
    asynchronous commands to finish. This also will cause fewer of the
    commands to be sent to the firmware overall, because the work will
    only run once when rescheduled multiple times while it's running.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=213649
    Suggested-by: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx>
    Reported-by: Maximilian Ernestus <maximilian@xxxxxxxxxxx>
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx>
    Link: https://lore.kernel.org/r/iwlwifi.20211204083238.51aea5b79ea4.I88a44798efda16e9fe480fb3e94224931d311b29@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 81cc85a97eb20..922a7ea0cd24e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1739,6 +1739,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)
 	struct iwl_mvm_mc_iter_data iter_data = {
 		.mvm = mvm,
 	};
+	int ret;
 
 	lockdep_assert_held(&mvm->mutex);
 
@@ -1748,6 +1749,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)
 	ieee80211_iterate_active_interfaces_atomic(
 		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
 		iwl_mvm_mc_iface_iterator, &iter_data);
+
+	/*
+	 * Send a (synchronous) ech command so that we wait for the
+	 * multiple asynchronous MCAST_FILTER_CMD commands sent by
+	 * the interface iterator. Otherwise, we might get here over
+	 * and over again (by userspace just sending a lot of these)
+	 * and the CPU can send them faster than the firmware can
+	 * process them.
+	 * Note that the CPU is still faster - but with this we'll
+	 * actually send fewer commands overall because the CPU will
+	 * not schedule the work in mac80211 as frequently if it's
+	 * still running when rescheduled (possibly multiple times).
+	 */
+	ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL);
+	if (ret)
+		IWL_ERR(mvm, "Failed to synchronize multicast groups update\n");
 }
 
 static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux