diff options
-rw-r--r-- | include/net/mac80211.h | 18 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 37 | ||||
-rw-r--r-- | net/mac80211/iface.c | 4 |
3 files changed, 59 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 7da11211825d..46e08ba92b97 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -2167,6 +2167,18 @@ enum ieee80211_rate_control_changed { | |||
2167 | * MAC address of the device going away. | 2167 | * MAC address of the device going away. |
2168 | * Hence, this callback must be implemented. It can sleep. | 2168 | * Hence, this callback must be implemented. It can sleep. |
2169 | * | 2169 | * |
2170 | * @add_interface_debugfs: Drivers can use this callback to add debugfs files | ||
2171 | * when a vif is added to mac80211. This callback and | ||
2172 | * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS | ||
2173 | * conditional. @remove_interface_debugfs must be provided for cleanup. | ||
2174 | * This callback can sleep. | ||
2175 | * | ||
2176 | * @remove_interface_debugfs: Remove the debugfs files which were added using | ||
2177 | * @add_interface_debugfs. This callback must remove all debugfs entries | ||
2178 | * that were added because mac80211 only removes interface debugfs when the | ||
2179 | * interface is destroyed, not when it is removed from the driver. | ||
2180 | * This callback can sleep. | ||
2181 | * | ||
2170 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | 2182 | * @config: Handler for configuration requests. IEEE 802.11 code calls this |
2171 | * function to change hardware configuration, e.g., channel. | 2183 | * function to change hardware configuration, e.g., channel. |
2172 | * This function should never fail but returns a negative error code | 2184 | * This function should never fail but returns a negative error code |
@@ -2580,6 +2592,12 @@ struct ieee80211_ops { | |||
2580 | struct ieee80211_vif *vif, | 2592 | struct ieee80211_vif *vif, |
2581 | struct ieee80211_sta *sta, | 2593 | struct ieee80211_sta *sta, |
2582 | struct dentry *dir); | 2594 | struct dentry *dir); |
2595 | void (*add_interface_debugfs)(struct ieee80211_hw *hw, | ||
2596 | struct ieee80211_vif *vif, | ||
2597 | struct dentry *dir); | ||
2598 | void (*remove_interface_debugfs)(struct ieee80211_hw *hw, | ||
2599 | struct ieee80211_vif *vif, | ||
2600 | struct dentry *dir); | ||
2583 | #endif | 2601 | #endif |
2584 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2602 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2585 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 2603 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 434b3c4f31b5..2b08b9982d06 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -528,6 +528,43 @@ static inline void drv_sta_remove_debugfs(struct ieee80211_local *local, | |||
528 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, | 528 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, |
529 | sta, dir); | 529 | sta, dir); |
530 | } | 530 | } |
531 | |||
532 | static inline | ||
533 | void drv_add_interface_debugfs(struct ieee80211_local *local, | ||
534 | struct ieee80211_sub_if_data *sdata) | ||
535 | { | ||
536 | might_sleep(); | ||
537 | |||
538 | check_sdata_in_driver(sdata); | ||
539 | |||
540 | if (!local->ops->add_interface_debugfs) | ||
541 | return; | ||
542 | |||
543 | local->ops->add_interface_debugfs(&local->hw, &sdata->vif, | ||
544 | sdata->debugfs.dir); | ||
545 | } | ||
546 | |||
547 | static inline | ||
548 | void drv_remove_interface_debugfs(struct ieee80211_local *local, | ||
549 | struct ieee80211_sub_if_data *sdata) | ||
550 | { | ||
551 | might_sleep(); | ||
552 | |||
553 | check_sdata_in_driver(sdata); | ||
554 | |||
555 | if (!local->ops->remove_interface_debugfs) | ||
556 | return; | ||
557 | |||
558 | local->ops->remove_interface_debugfs(&local->hw, &sdata->vif, | ||
559 | sdata->debugfs.dir); | ||
560 | } | ||
561 | #else | ||
562 | static inline | ||
563 | void drv_add_interface_debugfs(struct ieee80211_local *local, | ||
564 | struct ieee80211_sub_if_data *sdata) {} | ||
565 | static inline | ||
566 | void drv_remove_interface_debugfs(struct ieee80211_local *local, | ||
567 | struct ieee80211_sub_if_data *sdata) {} | ||
531 | #endif | 568 | #endif |
532 | 569 | ||
533 | static inline __must_check | 570 | static inline __must_check |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 0a36dc6346bb..deb78e864af6 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -621,6 +621,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
621 | goto err_del_interface; | 621 | goto err_del_interface; |
622 | } | 622 | } |
623 | 623 | ||
624 | drv_add_interface_debugfs(local, sdata); | ||
625 | |||
624 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | 626 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
625 | local->fif_pspoll++; | 627 | local->fif_pspoll++; |
626 | local->fif_probe_req++; | 628 | local->fif_probe_req++; |
@@ -882,6 +884,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
882 | */ | 884 | */ |
883 | ieee80211_free_keys(sdata); | 885 | ieee80211_free_keys(sdata); |
884 | 886 | ||
887 | drv_remove_interface_debugfs(local, sdata); | ||
888 | |||
885 | if (going_down) | 889 | if (going_down) |
886 | drv_remove_interface(local, sdata); | 890 | drv_remove_interface(local, sdata); |
887 | } | 891 | } |