Skip to content

Commit

Permalink
wifi: mac80211: add/remove driver debugfs entries as appropriate
Browse files Browse the repository at this point in the history
mainline inclusion
from mainline-v6.7
category: bugfix

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 <[email protected]>
Reviewed-by: Gregory Greenman <[email protected]>
Signed-off-by: Miri Korenblit <[email protected]>
Link: https://msgid.link/20231220043149.a9f64c359424.I7076526b5297ae8f832228079c999f7b8e147a4c@changeid
Signed-off-by: Johannes Berg <[email protected]>
(cherry picked from commit 0a3d898)
Signed-off-by: Wentao Guan <[email protected]>
  • Loading branch information
benzea authored and opsiff committed Feb 20, 2025
1 parent 3d14dab commit 62c6a6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions net/mac80211/debugfs_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,9 +934,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)
Expand Down
10 changes: 7 additions & 3 deletions net/mac80211/driver-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,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);
Expand Down Expand Up @@ -108,9 +108,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);
}

Expand Down

0 comments on commit 62c6a6d

Please sign in to comment.