Skip to content

Commit ddbfe86

Browse files
Stanislaw Gruszkajmberg-intel
authored andcommitted
mac80211: move sdata debugfs dir to vif
There is need create driver own per interface debugfs files. This is currently done by drv_{add,remove}_interface_debugfs() callbacks. But it is possible that after we remove interface from the driver (i.e. on suspend) we call drv_remove_interface_debugfs() function. Fixing this problem will require to add call drv_{add,remove}_interface_debugfs() anytime we create and remove interface in mac80211. So it's better to add debugfs dir dentry to vif structure to allow to create/remove custom debugfs driver files on drv_{add,remove}_interface(). Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 488b366 commit ddbfe86

5 files changed

Lines changed: 25 additions & 19 deletions

File tree

‎include/net/mac80211.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,9 @@ enum ieee80211_vif_flags {
10671067
* path needing to access it; even though the netdev carrier will always
10681068
* be off when it is %NULL there can still be races and packets could be
10691069
* processed after it switches back to %NULL.
1070+
* @debugfs_dir: debugfs dentry, can be used by drivers to create own per
1071+
* interface debug files. Note that it will be NULL for the virtual
1072+
* monitor interface (if that is requested.)
10701073
* @drv_priv: data area for driver use, will always be aligned to
10711074
* sizeof(void *).
10721075
*/
@@ -1083,6 +1086,10 @@ struct ieee80211_vif {
10831086

10841087
u32 driver_flags;
10851088

1089+
#ifdef CONFIG_MAC80211_DEBUGFS
1090+
struct dentry *debugfs_dir;
1091+
#endif
1092+
10861093
/* must be last */
10871094
u8 drv_priv[0] __aligned(sizeof(void *));
10881095
};

‎net/mac80211/debugfs_key.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
295295
char buf[50];
296296
struct ieee80211_key *key;
297297

298-
if (!sdata->debugfs.dir)
298+
if (!sdata->vif.debugfs_dir)
299299
return;
300300

301301
lockdep_assert_held(&sdata->local->key_mtx);
@@ -311,7 +311,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
311311
sprintf(buf, "../keys/%d", key->debugfs.cnt);
312312
sdata->debugfs.default_unicast_key =
313313
debugfs_create_symlink("default_unicast_key",
314-
sdata->debugfs.dir, buf);
314+
sdata->vif.debugfs_dir, buf);
315315
}
316316

317317
if (sdata->debugfs.default_multicast_key) {
@@ -325,7 +325,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
325325
sprintf(buf, "../keys/%d", key->debugfs.cnt);
326326
sdata->debugfs.default_multicast_key =
327327
debugfs_create_symlink("default_multicast_key",
328-
sdata->debugfs.dir, buf);
328+
sdata->vif.debugfs_dir, buf);
329329
}
330330
}
331331

@@ -334,7 +334,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
334334
char buf[50];
335335
struct ieee80211_key *key;
336336

337-
if (!sdata->debugfs.dir)
337+
if (!sdata->vif.debugfs_dir)
338338
return;
339339

340340
key = key_mtx_dereference(sdata->local,
@@ -343,7 +343,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
343343
sprintf(buf, "../keys/%d", key->debugfs.cnt);
344344
sdata->debugfs.default_mgmt_key =
345345
debugfs_create_symlink("default_mgmt_key",
346-
sdata->debugfs.dir, buf);
346+
sdata->vif.debugfs_dir, buf);
347347
} else
348348
ieee80211_debugfs_key_remove_mgmt_default(sdata);
349349
}

‎net/mac80211/debugfs_netdev.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
521521
#endif
522522

523523
#define DEBUGFS_ADD_MODE(name, mode) \
524-
debugfs_create_file(#name, mode, sdata->debugfs.dir, \
524+
debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \
525525
sdata, &name##_ops);
526526

527527
#define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400)
@@ -577,7 +577,7 @@ static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
577577
static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
578578
{
579579
struct dentry *dir = debugfs_create_dir("mesh_stats",
580-
sdata->debugfs.dir);
580+
sdata->vif.debugfs_dir);
581581
#define MESHSTATS_ADD(name)\
582582
debugfs_create_file(#name, 0400, dir, sdata, &name##_ops);
583583

@@ -594,7 +594,7 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
594594
static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
595595
{
596596
struct dentry *dir = debugfs_create_dir("mesh_config",
597-
sdata->debugfs.dir);
597+
sdata->vif.debugfs_dir);
598598

599599
#define MESHPARAMS_ADD(name) \
600600
debugfs_create_file(#name, 0600, dir, sdata, &name##_ops);
@@ -631,7 +631,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
631631

632632
static void add_files(struct ieee80211_sub_if_data *sdata)
633633
{
634-
if (!sdata->debugfs.dir)
634+
if (!sdata->vif.debugfs_dir)
635635
return;
636636

637637
DEBUGFS_ADD(flags);
@@ -673,29 +673,29 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
673673
char buf[10+IFNAMSIZ];
674674

675675
sprintf(buf, "netdev:%s", sdata->name);
676-
sdata->debugfs.dir = debugfs_create_dir(buf,
676+
sdata->vif.debugfs_dir = debugfs_create_dir(buf,
677677
sdata->local->hw.wiphy->debugfsdir);
678-
if (sdata->debugfs.dir)
678+
if (sdata->vif.debugfs_dir)
679679
sdata->debugfs.subdir_stations = debugfs_create_dir("stations",
680-
sdata->debugfs.dir);
680+
sdata->vif.debugfs_dir);
681681
add_files(sdata);
682682
}
683683

684684
void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
685685
{
686-
if (!sdata->debugfs.dir)
686+
if (!sdata->vif.debugfs_dir)
687687
return;
688688

689-
debugfs_remove_recursive(sdata->debugfs.dir);
690-
sdata->debugfs.dir = NULL;
689+
debugfs_remove_recursive(sdata->vif.debugfs_dir);
690+
sdata->vif.debugfs_dir = NULL;
691691
}
692692

693693
void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
694694
{
695695
struct dentry *dir;
696696
char buf[10 + IFNAMSIZ];
697697

698-
dir = sdata->debugfs.dir;
698+
dir = sdata->vif.debugfs_dir;
699699

700700
if (!dir)
701701
return;

‎net/mac80211/driver-ops.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void drv_add_interface_debugfs(struct ieee80211_local *local,
560560
return;
561561

562562
local->ops->add_interface_debugfs(&local->hw, &sdata->vif,
563-
sdata->debugfs.dir);
563+
sdata->vif.debugfs_dir);
564564
}
565565

566566
static inline
@@ -575,7 +575,7 @@ void drv_remove_interface_debugfs(struct ieee80211_local *local,
575575
return;
576576

577577
local->ops->remove_interface_debugfs(&local->hw, &sdata->vif,
578-
sdata->debugfs.dir);
578+
sdata->vif.debugfs_dir);
579579
}
580580
#else
581581
static inline

‎net/mac80211/ieee80211_i.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,6 @@ struct ieee80211_sub_if_data {
758758

759759
#ifdef CONFIG_MAC80211_DEBUGFS
760760
struct {
761-
struct dentry *dir;
762761
struct dentry *subdir_stations;
763762
struct dentry *default_unicast_key;
764763
struct dentry *default_multicast_key;

0 commit comments

Comments
 (0)