aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-11-19 22:16:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-21 05:46:25 -0500
commit77d2ece6fde80631193054edc9c9a3edad519565 (patch)
treeea8597ad4790f00f064a482fa837480d1cf8ae53
parentfe5f255930af02ef3c3e0d00545b674e7e9d0cfb (diff)
mac80211: Add debugfs callbacks for station addition/removal
Provide drivers with hooks to create debugfs files when a new station is added. This would help drivers to take advantage of mac80211's station list infrastructure and not maintain tedious station management code internally. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> [ifdef inline wrapper functions] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/mac80211.h18
-rw-r--r--net/mac80211/debugfs_sta.c9
-rw-r--r--net/mac80211/driver-ops.h32
3 files changed, 59 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d11037b5b85..e1293c7e4d2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2208,6 +2208,14 @@ enum ieee80211_rate_control_changed {
2208 * @sta_remove: Notifies low level driver about removal of an associated 2208 * @sta_remove: Notifies low level driver about removal of an associated
2209 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 2209 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
2210 * 2210 *
2211 * @sta_add_debugfs: Drivers can use this callback to add debugfs files
2212 * when a station is added to mac80211's station list. This callback
2213 * and @sta_remove_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2214 * conditional. This callback can sleep.
2215 *
2216 * @sta_remove_debugfs: Remove the debugfs files which were added using
2217 * @sta_add_debugfs. This callback can sleep.
2218 *
2211 * @sta_notify: Notifies low level driver about power state transition of an 2219 * @sta_notify: Notifies low level driver about power state transition of an
2212 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating 2220 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
2213 * in AP mode, this callback will not be called when the flag 2221 * in AP mode, this callback will not be called when the flag
@@ -2489,6 +2497,16 @@ struct ieee80211_ops {
2489 struct ieee80211_sta *sta); 2497 struct ieee80211_sta *sta);
2490 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2498 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2491 struct ieee80211_sta *sta); 2499 struct ieee80211_sta *sta);
2500#ifdef CONFIG_MAC80211_DEBUGFS
2501 void (*sta_add_debugfs)(struct ieee80211_hw *hw,
2502 struct ieee80211_vif *vif,
2503 struct ieee80211_sta *sta,
2504 struct dentry *dir);
2505 void (*sta_remove_debugfs)(struct ieee80211_hw *hw,
2506 struct ieee80211_vif *vif,
2507 struct ieee80211_sta *sta,
2508 struct dentry *dir);
2509#endif
2492 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2510 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2493 enum sta_notify_cmd, struct ieee80211_sta *sta); 2511 enum sta_notify_cmd, struct ieee80211_sta *sta);
2494 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2512 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 3d103929d41..89281d24b09 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -14,6 +14,7 @@
14#include "debugfs.h" 14#include "debugfs.h"
15#include "debugfs_sta.h" 15#include "debugfs_sta.h"
16#include "sta_info.h" 16#include "sta_info.h"
17#include "driver-ops.h"
17 18
18/* sta attributtes */ 19/* sta attributtes */
19 20
@@ -334,6 +335,8 @@ STA_OPS(ht_capa);
334 335
335void ieee80211_sta_debugfs_add(struct sta_info *sta) 336void ieee80211_sta_debugfs_add(struct sta_info *sta)
336{ 337{
338 struct ieee80211_local *local = sta->local;
339 struct ieee80211_sub_if_data *sdata = sta->sdata;
337 struct dentry *stations_dir = sta->sdata->debugfs.subdir_stations; 340 struct dentry *stations_dir = sta->sdata->debugfs.subdir_stations;
338 u8 mac[3*ETH_ALEN]; 341 u8 mac[3*ETH_ALEN];
339 342
@@ -379,10 +382,16 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
379 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed); 382 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
380 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count); 383 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
381 DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count); 384 DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
385
386 drv_sta_add_debugfs(local, sdata, &sta->sta, sta->debugfs.dir);
382} 387}
383 388
384void ieee80211_sta_debugfs_remove(struct sta_info *sta) 389void ieee80211_sta_debugfs_remove(struct sta_info *sta)
385{ 390{
391 struct ieee80211_local *local = sta->local;
392 struct ieee80211_sub_if_data *sdata = sta->sdata;
393
394 drv_sta_remove_debugfs(local, sdata, &sta->sta, sta->debugfs.dir);
386 debugfs_remove_recursive(sta->debugfs.dir); 395 debugfs_remove_recursive(sta->debugfs.dir);
387 sta->debugfs.dir = NULL; 396 sta->debugfs.dir = NULL;
388} 397}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 284dd02385e..68c27aaf5c9 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -490,6 +490,38 @@ static inline void drv_sta_remove(struct ieee80211_local *local,
490 trace_drv_return_void(local); 490 trace_drv_return_void(local);
491} 491}
492 492
493#ifdef CONFIG_MAC80211_DEBUGFS
494static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
495 struct ieee80211_sub_if_data *sdata,
496 struct ieee80211_sta *sta,
497 struct dentry *dir)
498{
499 might_sleep();
500
501 sdata = get_bss_sdata(sdata);
502 check_sdata_in_driver(sdata);
503
504 if (local->ops->sta_add_debugfs)
505 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
506 sta, dir);
507}
508
509static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
510 struct ieee80211_sub_if_data *sdata,
511 struct ieee80211_sta *sta,
512 struct dentry *dir)
513{
514 might_sleep();
515
516 sdata = get_bss_sdata(sdata);
517 check_sdata_in_driver(sdata);
518
519 if (local->ops->sta_remove_debugfs)
520 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
521 sta, dir);
522}
523#endif
524
493static inline __must_check 525static inline __must_check
494int drv_sta_state(struct ieee80211_local *local, 526int drv_sta_state(struct ieee80211_local *local,
495 struct ieee80211_sub_if_data *sdata, 527 struct ieee80211_sub_if_data *sdata,