public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mordechay Goodstein <mordechay.goodstein@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	johannes@sipsolutions.net, davem@davemloft.net, kuba@kernel.org,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 07/11] mac80211: update channel context before station state
Date: Mon, 20 Dec 2021 21:00:26 -0500	[thread overview]
Message-ID: <20211221020030.117225-7-sashal@kernel.org> (raw)
In-Reply-To: <20211221020030.117225-1-sashal@kernel.org>

From: Mordechay Goodstein <mordechay.goodstein@intel.com>

[ Upstream commit 4dde3c3627b52ca515a34f6f4de3898224aa1dd3 ]

Currently channel context is updated only after station got an update about
new assoc state, this results in station using the old channel context.

Fix this by moving the update channel context before updating station,
enabling the driver to immediately use the updated channel context in
the new assoc state.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211129152938.1c80c17ffd8a.I94ae31378b363c1182cfdca46c4b7e7165cff984@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/sta_info.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 03f4358020796..663aecf76765f 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -597,6 +597,15 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 
 	list_add_tail_rcu(&sta->list, &local->sta_list);
 
+	/* update channel context before notifying the driver about state
+	 * change, this enables driver using the updated channel context right away.
+	 */
+	if (sta->sta_state >= IEEE80211_STA_ASSOC) {
+		ieee80211_recalc_min_chandef(sta->sdata);
+		if (!sta->sta.support_p2p_ps)
+			ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
+	}
+
 	/* notify driver */
 	err = sta_info_insert_drv_state(local, sdata, sta);
 	if (err)
@@ -604,12 +613,6 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 
 	set_sta_flag(sta, WLAN_STA_INSERTED);
 
-	if (sta->sta_state >= IEEE80211_STA_ASSOC) {
-		ieee80211_recalc_min_chandef(sta->sdata);
-		if (!sta->sta.support_p2p_ps)
-			ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
-	}
-
 	/* accept BA sessions now */
 	clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
 
-- 
2.34.1


  parent reply	other threads:[~2021-12-21  2:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  2:00 [PATCH AUTOSEL 4.19 01/11] ARM: rockchip: Use memcpy_toio instead of memcpy on smp bring-up Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 02/11] mac80211: set up the fwd_skb->dev for mesh forwarding Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 03/11] mac80211: fix a memory leak where sta_info is not freed Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 04/11] phonet: refcount leak in pep_sock_accep Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 05/11] net: bcmgenet: Fix NULL vs IS_ERR() checking Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 06/11] mac80211: Fix the size used for building probe request Sasha Levin
2021-12-21  2:00 ` Sasha Levin [this message]
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 08/11] mac80211: do drv_reconfig_complete() before restarting all Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 09/11] block: reduce kblockd_mod_delayed_work_on() CPU consumption Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 10/11] net: usb: lan78xx: add Allied Telesis AT29M2-AF Sasha Levin
2021-12-21  2:00 ` [PATCH AUTOSEL 4.19 11/11] Revert "block: reduce kblockd_mod_delayed_work_on() CPU consumption" Sasha Levin

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=20211221020030.117225-7-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=mordechay.goodstein@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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