mac80211: add vif debugfs driver callbacks
Add debugfs driver callbacks so drivers can add debugfs entries for interfaces. Note that they _must_ remove the entries again as add/remove in the driver doesn't correspond to add/remove in debugfs; the former is up/down while the latter is netdev create/destroy. Signed-off-by: Alexander Bondar <alexander.bondar@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
776b358017
commit
b207cdb07f
3 changed files with 59 additions and 0 deletions
|
@ -2167,6 +2167,18 @@ enum ieee80211_rate_control_changed {
|
||||||
* MAC address of the device going away.
|
* MAC address of the device going away.
|
||||||
* Hence, this callback must be implemented. It can sleep.
|
* Hence, this callback must be implemented. It can sleep.
|
||||||
*
|
*
|
||||||
|
* @add_interface_debugfs: Drivers can use this callback to add debugfs files
|
||||||
|
* when a vif is added to mac80211. This callback and
|
||||||
|
* @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS
|
||||||
|
* conditional. @remove_interface_debugfs must be provided for cleanup.
|
||||||
|
* This callback can sleep.
|
||||||
|
*
|
||||||
|
* @remove_interface_debugfs: Remove the debugfs files which were added using
|
||||||
|
* @add_interface_debugfs. This callback must remove all debugfs entries
|
||||||
|
* that were added because mac80211 only removes interface debugfs when the
|
||||||
|
* interface is destroyed, not when it is removed from the driver.
|
||||||
|
* This callback can sleep.
|
||||||
|
*
|
||||||
* @config: Handler for configuration requests. IEEE 802.11 code calls this
|
* @config: Handler for configuration requests. IEEE 802.11 code calls this
|
||||||
* function to change hardware configuration, e.g., channel.
|
* function to change hardware configuration, e.g., channel.
|
||||||
* This function should never fail but returns a negative error code
|
* This function should never fail but returns a negative error code
|
||||||
|
@ -2580,6 +2592,12 @@ struct ieee80211_ops {
|
||||||
struct ieee80211_vif *vif,
|
struct ieee80211_vif *vif,
|
||||||
struct ieee80211_sta *sta,
|
struct ieee80211_sta *sta,
|
||||||
struct dentry *dir);
|
struct dentry *dir);
|
||||||
|
void (*add_interface_debugfs)(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif,
|
||||||
|
struct dentry *dir);
|
||||||
|
void (*remove_interface_debugfs)(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif,
|
||||||
|
struct dentry *dir);
|
||||||
#endif
|
#endif
|
||||||
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||||
enum sta_notify_cmd, struct ieee80211_sta *sta);
|
enum sta_notify_cmd, struct ieee80211_sta *sta);
|
||||||
|
|
|
@ -528,6 +528,43 @@ static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
|
||||||
local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
|
local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
|
||||||
sta, dir);
|
sta, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void drv_add_interface_debugfs(struct ieee80211_local *local,
|
||||||
|
struct ieee80211_sub_if_data *sdata)
|
||||||
|
{
|
||||||
|
might_sleep();
|
||||||
|
|
||||||
|
check_sdata_in_driver(sdata);
|
||||||
|
|
||||||
|
if (!local->ops->add_interface_debugfs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
local->ops->add_interface_debugfs(&local->hw, &sdata->vif,
|
||||||
|
sdata->debugfs.dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void drv_remove_interface_debugfs(struct ieee80211_local *local,
|
||||||
|
struct ieee80211_sub_if_data *sdata)
|
||||||
|
{
|
||||||
|
might_sleep();
|
||||||
|
|
||||||
|
check_sdata_in_driver(sdata);
|
||||||
|
|
||||||
|
if (!local->ops->remove_interface_debugfs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
local->ops->remove_interface_debugfs(&local->hw, &sdata->vif,
|
||||||
|
sdata->debugfs.dir);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline
|
||||||
|
void drv_add_interface_debugfs(struct ieee80211_local *local,
|
||||||
|
struct ieee80211_sub_if_data *sdata) {}
|
||||||
|
static inline
|
||||||
|
void drv_remove_interface_debugfs(struct ieee80211_local *local,
|
||||||
|
struct ieee80211_sub_if_data *sdata) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline __must_check
|
static inline __must_check
|
||||||
|
|
|
@ -621,6 +621,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
|
||||||
goto err_del_interface;
|
goto err_del_interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drv_add_interface_debugfs(local, sdata);
|
||||||
|
|
||||||
if (sdata->vif.type == NL80211_IFTYPE_AP) {
|
if (sdata->vif.type == NL80211_IFTYPE_AP) {
|
||||||
local->fif_pspoll++;
|
local->fif_pspoll++;
|
||||||
local->fif_probe_req++;
|
local->fif_probe_req++;
|
||||||
|
@ -882,6 +884,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
|
||||||
*/
|
*/
|
||||||
ieee80211_free_keys(sdata);
|
ieee80211_free_keys(sdata);
|
||||||
|
|
||||||
|
drv_remove_interface_debugfs(local, sdata);
|
||||||
|
|
||||||
if (going_down)
|
if (going_down)
|
||||||
drv_remove_interface(local, sdata);
|
drv_remove_interface(local, sdata);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue