Skip to content

Commit a1f5dcb

Browse files
Miriam-Racheljmberg-intel
authored andcommitted
wifi: mac80211: add a driver callback to add vif debugfs
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. Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Johannes Berg <[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 822cab1 commit a1f5dcb

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
@@ -3869,6 +3869,10 @@ struct ieee80211_prep_tx_info {
38693869
* the station. See @sta_pre_rcu_remove if needed.
38703870
* This callback can sleep.
38713871
*
3872+
* @vif_add_debugfs: Drivers can use this callback to add a debugfs vif
3873+
* directory with its files. This callback should be within a
3874+
* CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
3875+
*
38723876
* @link_add_debugfs: Drivers can use this callback to add debugfs files
38733877
* when a link is added to a mac80211 vif. This callback should be within
38743878
* a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
@@ -4368,6 +4372,8 @@ struct ieee80211_ops {
43684372
int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
43694373
struct ieee80211_sta *sta);
43704374
#ifdef CONFIG_MAC80211_DEBUGFS
4375+
void (*vif_add_debugfs)(struct ieee80211_hw *hw,
4376+
struct ieee80211_vif *vif);
43714377
void (*link_add_debugfs)(struct ieee80211_hw *hw,
43724378
struct ieee80211_vif *vif,
43734379
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
@@ -72,10 +72,15 @@ int drv_add_interface(struct ieee80211_local *local,
7272
ret = local->ops->add_interface(&local->hw, &sdata->vif);
7373
trace_drv_return_int(local, ret);
7474

75-
if (ret == 0)
76-
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
75+
if (ret)
76+
return ret;
7777

78-
return ret;
78+
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
79+
80+
if (!local->in_reconfig)
81+
drv_vif_add_debugfs(local, sdata);
82+
83+
return 0;
7984
}
8085

8186
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
@@ -489,6 +489,23 @@ static inline void drv_sta_remove(struct ieee80211_local *local,
489489
}
490490

491491
#ifdef CONFIG_MAC80211_DEBUGFS
492+
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
493+
struct ieee80211_sub_if_data *sdata)
494+
{
495+
might_sleep();
496+
497+
if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
498+
WARN_ON(!sdata->vif.debugfs_dir))
499+
return;
500+
501+
sdata = get_bss_sdata(sdata);
502+
if (!check_sdata_in_driver(sdata))
503+
return;
504+
505+
if (local->ops->vif_add_debugfs)
506+
local->ops->vif_add_debugfs(&local->hw, &sdata->vif);
507+
}
508+
492509
static inline void drv_link_add_debugfs(struct ieee80211_local *local,
493510
struct ieee80211_sub_if_data *sdata,
494511
struct ieee80211_bss_conf *link_conf,
@@ -539,6 +556,12 @@ static inline void drv_link_sta_add_debugfs(struct ieee80211_local *local,
539556
local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif,
540557
link_sta, dir);
541558
}
559+
#else
560+
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
561+
struct ieee80211_sub_if_data *sdata)
562+
{
563+
might_sleep();
564+
}
542565
#endif
543566

544567
static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,

0 commit comments

Comments
 (0)