Skip to content

Commit 0a3d898

Browse files
benzeajmberg-intel
authored andcommitted
wifi: mac80211: add/remove driver debugfs entries as appropriate
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: a1f5dcb ("wifi: mac80211: add a driver callback to add vif debugfs") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Reviewed-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20231220043149.a9f64c359424.I7076526b5297ae8f832228079c999f7b8e147a4c@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 8c917f1 commit 0a3d898

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

net/mac80211/debugfs_netdev.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,9 +1043,12 @@ void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata,
10431043
{
10441044
ieee80211_debugfs_remove_netdev(sdata);
10451045
ieee80211_debugfs_add_netdev(sdata, mld_vif);
1046-
drv_vif_add_debugfs(sdata->local, sdata);
1047-
if (!mld_vif)
1048-
ieee80211_link_debugfs_drv_add(&sdata->deflink);
1046+
1047+
if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) {
1048+
drv_vif_add_debugfs(sdata->local, sdata);
1049+
if (!mld_vif)
1050+
ieee80211_link_debugfs_drv_add(&sdata->deflink);
1051+
}
10491052
}
10501053

10511054
void ieee80211_link_debugfs_add(struct ieee80211_link_data *link)

net/mac80211/driver-ops.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ int drv_add_interface(struct ieee80211_local *local,
7575
if (ret)
7676
return ret;
7777

78-
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
78+
if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) {
79+
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
7980

80-
if (!local->in_reconfig && !local->resuming) {
8181
drv_vif_add_debugfs(local, sdata);
8282
/* initially vif is not MLD */
8383
ieee80211_link_debugfs_drv_add(&sdata->deflink);
@@ -113,9 +113,13 @@ void drv_remove_interface(struct ieee80211_local *local,
113113
if (!check_sdata_in_driver(sdata))
114114
return;
115115

116+
sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
117+
118+
/* Remove driver debugfs entries */
119+
ieee80211_debugfs_recreate_netdev(sdata, sdata->vif.valid_links);
120+
116121
trace_drv_remove_interface(local, sdata);
117122
local->ops->remove_interface(&local->hw, &sdata->vif);
118-
sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
119123
trace_drv_return_void(local);
120124
}
121125

0 commit comments

Comments
 (0)