Skip to content

Commit 789934f

Browse files
Miriam-Rachelzhoufuro
authored andcommitted
wifi: mac80211: add a driver callback to add vif debugfs
commit a1f5dcb ("wifi: mac80211: add a driver callback to add vif debugfs") upstream. Add a callback which the driver can use to add the vif debugfs. We used to have this back until commit d260ff1 ("mac80211: remove vif debugfs driver callbacks") where we thought that it will be easier to just add them during interface add/remove. However, now with multi-link, we want to have proper debugfs for drivers for multi-link where some files might be in the netdev for non-MLO connections, and in the links for MLO ones, so we need to do some reconstruction when switching the mode. Moving to this new call enables that and MLO drivers will have to use it for proper debugfs operation. deepin-Intel-SIG: commit a1f5dcb ("wifi: mac80211: add a driver callback to add vif debugfs"). Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Johannes Berg <[email protected]> [ Furong Zhou: amend commit log ] Signed-off-by: Furong Zhou <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20230928172905.ac38913f6ab7.Iee731d746bb08fcc628fa776f337016a12dc62ac@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 6584569 commit 789934f

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

include/net/mac80211.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,6 +3867,10 @@ struct ieee80211_prep_tx_info {
38673867
* the station. See @sta_pre_rcu_remove if needed.
38683868
* This callback can sleep.
38693869
*
3870+
* @vif_add_debugfs: Drivers can use this callback to add a debugfs vif
3871+
* directory with its files. This callback should be within a
3872+
* CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
3873+
*
38703874
* @link_add_debugfs: Drivers can use this callback to add debugfs files
38713875
* when a link is added to a mac80211 vif. This callback should be within
38723876
* a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
@@ -4362,6 +4366,8 @@ struct ieee80211_ops {
43624366
int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
43634367
struct ieee80211_sta *sta);
43644368
#ifdef CONFIG_MAC80211_DEBUGFS
4369+
void (*vif_add_debugfs)(struct ieee80211_hw *hw,
4370+
struct ieee80211_vif *vif);
43654371
void (*link_add_debugfs)(struct ieee80211_hw *hw,
43664372
struct ieee80211_vif *vif,
43674373
struct ieee80211_bss_conf *link_conf,

net/mac80211/driver-ops.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,15 @@ int drv_add_interface(struct ieee80211_local *local,
6969
ret = local->ops->add_interface(&local->hw, &sdata->vif);
7070
trace_drv_return_int(local, ret);
7171

72-
if (ret == 0)
73-
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
72+
if (ret)
73+
return ret;
7474

75-
return ret;
75+
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
76+
77+
if (!local->in_reconfig)
78+
drv_vif_add_debugfs(local, sdata);
79+
80+
return 0;
7681
}
7782

7883
int drv_change_interface(struct ieee80211_local *local,

net/mac80211/driver-ops.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,23 @@ static inline void drv_sta_remove(struct ieee80211_local *local,
467467
}
468468

469469
#ifdef CONFIG_MAC80211_DEBUGFS
470+
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
471+
struct ieee80211_sub_if_data *sdata)
472+
{
473+
might_sleep();
474+
475+
if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
476+
WARN_ON(!sdata->vif.debugfs_dir))
477+
return;
478+
479+
sdata = get_bss_sdata(sdata);
480+
if (!check_sdata_in_driver(sdata))
481+
return;
482+
483+
if (local->ops->vif_add_debugfs)
484+
local->ops->vif_add_debugfs(&local->hw, &sdata->vif);
485+
}
486+
470487
static inline void drv_link_add_debugfs(struct ieee80211_local *local,
471488
struct ieee80211_sub_if_data *sdata,
472489
struct ieee80211_bss_conf *link_conf,
@@ -514,6 +531,12 @@ static inline void drv_link_sta_add_debugfs(struct ieee80211_local *local,
514531
local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif,
515532
link_sta, dir);
516533
}
534+
#else
535+
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
536+
struct ieee80211_sub_if_data *sdata)
537+
{
538+
might_sleep();
539+
}
517540
#endif
518541

519542
static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,

0 commit comments

Comments
 (0)