linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
	Gregory Greenman <gregory.greenman@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 06/16] iwlwifi: mvm: add a wrapper around rs_tx_status to handle locks
Date: Sat, 20 Jul 2019 13:25:35 +0300	[thread overview]
Message-ID: <20190720102545.5952-7-luca@coelho.fi> (raw)
In-Reply-To: <20190720102545.5952-1-luca@coelho.fi>

From: Gregory Greenman <gregory.greenman@intel.com>

iwl_mvm_rs_tx_status can be called from two places in the code, but the
mutex is taken only on one of the calls. Split it into a wrapper taking
locks and an internal __iwl_mvm_rs_tx_status function.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 28 ++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 02b4ef92543f..b50a47e86ef0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -1218,8 +1218,10 @@ void iwl_mvm_rs_init_wk(struct work_struct *wk)
 	rcu_read_unlock();
 }
 
-void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
-			  int tid, struct ieee80211_tx_info *info, bool ndp)
+static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm,
+				   struct ieee80211_sta *sta,
+				   int tid, struct ieee80211_tx_info *info,
+				   bool ndp)
 {
 	int legacy_success;
 	int retries;
@@ -1451,6 +1453,21 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 		rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp);
 }
 
+void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
+			  int tid, struct ieee80211_tx_info *info, bool ndp)
+{
+	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
+
+	/* If it's locked we are in middle of init flow
+	 * just wait for next tx status to update the lq_sta data
+	 */
+	if (!mutex_trylock(&mvmsta->lq_sta.rs_drv.mutex))
+		return;
+
+	__iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp);
+	mutex_unlock(&mvmsta->lq_sta.rs_drv.mutex);
+}
+
 /*
  * mac80211 sends us Tx status
  */
@@ -1472,15 +1489,8 @@ static void rs_drv_mac80211_tx_status(void *mvm_r,
 	    info->flags & IEEE80211_TX_CTL_NO_ACK)
 		return;
 
-	/* If it's locked we are in middle of init flow
-	 * just wait for next tx status to update the lq_sta data
-	 */
-	if (!mutex_trylock(&mvmsta->lq_sta.rs_drv.mutex))
-		return;
-
 	iwl_mvm_rs_tx_status(mvm, sta, rs_get_tid(hdr), info,
 			     ieee80211_is_qos_nullfunc(hdr->frame_control));
-	mutex_unlock(&mvmsta->lq_sta.rs_drv.mutex);
 }
 
 /*
-- 
2.20.1


  parent reply	other threads:[~2019-07-20 10:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-20 10:25 [PATCH 00/16] iwlwifi: fixes intended for 5.3 2019-07-20 Luca Coelho
2019-07-20 10:25 ` [PATCH 01/16] iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT on version < 41 Luca Coelho
     [not found]   ` <20190720122332.E229E2186A@mail.kernel.org>
2019-08-05  9:45     ` Luca Coelho
2019-07-20 10:25 ` [PATCH 02/16] iwlwifi: mvm: prepare the ground for more RSS notifications Luca Coelho
2019-07-20 10:25 ` [PATCH 03/16] iwlwifi: mvm: add a new RSS sync notification for NSSN sync Luca Coelho
2019-07-20 10:25 ` [PATCH 04/16] iwlwiif: mvm: refactor iwl_mvm_notify_rx_queue Luca Coelho
2019-07-20 10:25 ` [PATCH 05/16] iwlwifi: mvm: add a loose synchronization of the NSSN across Rx queues Luca Coelho
2019-07-20 10:25 ` Luca Coelho [this message]
2019-07-20 10:25 ` [PATCH 07/16] iwlwifi: dbg_ini: move iwl_dbg_tlv_load_bin out of debug override ifdef Luca Coelho
2019-07-20 10:25 ` [PATCH 08/16] iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef Luca Coelho
2019-07-20 10:25 ` [PATCH 09/16] iwlwifi: fix locking in delayed GTK setting Luca Coelho
2019-07-20 10:25 ` [PATCH 10/16] iwlwifi: mvm: fix comparison of u32 variable with less than zero Luca Coelho
2019-07-20 10:25 ` [PATCH 11/16] iwlwifi: mvm: send LQ command always ASYNC Luca Coelho
2019-07-20 10:25 ` [PATCH 12/16] iwlwifi: mvm: replace RS mutex with a spin_lock Luca Coelho
2019-07-20 10:25 ` [PATCH 13/16] iwlwifi: mvm: fix frame drop from the reordering buffer Luca Coelho
2019-07-20 10:25 ` [PATCH 14/16] iwlwifi: mvm: fix possible out-of-bounds read when accessing lq_info Luca Coelho
2019-07-20 10:25 ` [PATCH 15/16] iwlwifi: add 3 new IDs for the 9000 series (iwl9260_2ac_160_cfg) Luca Coelho
2019-07-20 10:25 ` [PATCH 16/16] iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support Luca Coelho
2019-08-01 14:07   ` Jonas Hahnfeld
2019-08-22  6:44     ` Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190720102545.5952-7-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=gregory.greenman@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).