All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Benjamin Berg <benjamin.berg@intel.com>,
	Greenman, Gregory <gregory.greenman@intel.com>,
	Berg, Johannes <johannes.berg@intel.com>
Subject: [PATCH 13/15] wifi: mac80211: add/remove driver debugfs entries as appropriate
Date: Wed, 20 Dec 2023 04:38:01 +0200	[thread overview]
Message-ID: <20231220043149.a9f64c359424.I7076526b5297ae8f832228079c999f7b8e147a4c@changeid> (raw)
In-Reply-To: <20231220023803.2901117-1-miriam.rachel.korenblit@intel.com>

From: Benjamin Berg <benjamin.berg@intel.com>

When an interface is removed, we should also be deleting the driver
debugfs entries (as it might still exist in DOWN state in mac80211). At
the same time, when adding an interface, we can check the
IEEE80211_SDATA_IN_DRIVER flag to know whether the interface was
previously known to the driver and is simply being reconfigured.

Fixes: a1f5dcb1c0c1 ("wifi: mac80211: add a driver callback to add vif debugfs")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
Reviewed-by: Berg, Johannes <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/debugfs_netdev.c |  9 ++++++---
 net/mac80211/driver-ops.c     | 10 +++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index ec91e131b29e..f879a0f2728e 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -983,9 +983,12 @@ void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata,
 {
 	ieee80211_debugfs_remove_netdev(sdata);
 	ieee80211_debugfs_add_netdev(sdata, mld_vif);
-	drv_vif_add_debugfs(sdata->local, sdata);
-	if (!mld_vif)
-		ieee80211_link_debugfs_drv_add(&sdata->deflink);
+
+	if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) {
+		drv_vif_add_debugfs(sdata->local, sdata);
+		if (!mld_vif)
+			ieee80211_link_debugfs_drv_add(&sdata->deflink);
+	}
 }
 
 void ieee80211_link_debugfs_add(struct ieee80211_link_data *link)
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 5e0435db2f9c..3b7f70073fc3 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -75,9 +75,9 @@ int drv_add_interface(struct ieee80211_local *local,
 	if (ret)
 		return ret;
 
-	sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
+	if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) {
+		sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
 
-	if (!local->in_reconfig && !local->resuming) {
 		drv_vif_add_debugfs(local, sdata);
 		/* initially vif is not MLD */
 		ieee80211_link_debugfs_drv_add(&sdata->deflink);
@@ -113,9 +113,13 @@ void drv_remove_interface(struct ieee80211_local *local,
 	if (!check_sdata_in_driver(sdata))
 		return;
 
+	sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
+
+	/* Remove driver debugfs entries */
+	ieee80211_debugfs_recreate_netdev(sdata, sdata->vif.valid_links);
+
 	trace_drv_remove_interface(local, sdata);
 	local->ops->remove_interface(&local->hw, &sdata->vif);
-	sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
 	trace_drv_return_void(local);
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-12-19  8:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  2:37 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2023-12-19 Miri Korenblit
2023-12-20  2:37 ` [PATCH 01/15] wifi: cfg80211: reg: Support P2P operation on DFS channels Miri Korenblit
2023-12-20  2:37 ` [PATCH 02/15] wifi: cfg80211: Schedule regulatory check on BSS STA channel change Miri Korenblit
2023-12-20  2:37 ` [PATCH 03/15] wifi: mac80211: Schedule regulatory channels check on bandwith change Miri Korenblit
2023-12-20  2:37 ` [PATCH 04/15] wifi: mac80211_hwsim: Add custom reg for DFS concurrent Miri Korenblit
2023-12-20  2:37 ` [PATCH 05/15] wifi: cfg80211: handle UHB AP and STA power type Miri Korenblit
2023-12-19  9:28   ` Kalle Valo
2023-12-20  2:37 ` [PATCH 06/15] wifi: mac80211: rework RX timestamp flags Miri Korenblit
2023-12-19  9:24   ` Kalle Valo
2023-12-20  2:37 ` [PATCH 07/15] wifi: mac80211: allow 64-bit radiotap timestamps Miri Korenblit
2023-12-20  2:37 ` [PATCH 08/15] wifi: cfg80211: free beacon_ies when overridden from hidden BSS Miri Korenblit
2023-12-20  2:37 ` [PATCH 09/15] wifi: cfg80211: ensure cfg80211_bss_update frees IEs on error Miri Korenblit
2023-12-20  2:37 ` [PATCH 10/15] wifi: cfg80211: avoid double free if updating BSS fails Miri Korenblit
2023-12-20  2:37 ` [PATCH 11/15] wifi: mac80211: fix advertised TTLM scheduling Miri Korenblit
2023-12-20  2:38 ` [PATCH 12/15] wifi: mac80211: do not re-add debugfs entries during resume Miri Korenblit
2023-12-20  2:38 ` Miri Korenblit [this message]
2023-12-20  2:38 ` [PATCH 14/15] wifi: mac80211: add a driver callback to check active_links Miri Korenblit
2023-12-20  2:38 ` [PATCH 15/15] wifi: mac80211_hwsim: support HE 40MHz in 2.4Ghz band Miri Korenblit
2023-12-19  8:57   ` Johannes Berg
2023-12-23 16:01     ` Jouni Malinen
2023-12-23 17:30       ` Johannes Berg

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=20231220043149.a9f64c359424.I7076526b5297ae8f832228079c999f7b8e147a4c@changeid \
    --to=miriam.rachel.korenblit@intel.com \
    --cc=benjamin.berg@intel.com \
    --cc=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.