diff options
| author | Arik Nemtsov <arik@wizery.com> | 2015-03-01 02:10:15 -0500 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2015-03-04 04:34:12 -0500 |
| commit | 3384d757d41521a3dee274ed2802bcd285ed8e62 (patch) | |
| tree | 9993a13e3df98a06e9aabf5f4de0125478fe5e8a /include/net | |
| parent | 98fc43864af9e74116eec81c290db048cded15d8 (diff) | |
mac80211: allow iterating inactive interfaces
Sometimes the driver might want to modify private data in interfaces
that are down. One possible use-case is cleaning up interface state
after HW recovery. Some interfaces that were up before the recovery took
place might be down now, but they might still be "dirty".
Introduce a new iterate_interfaces() API and a new ACTIVE iterator flag.
This way the internal implementation of the both active and inactive
APIs remains the same.
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/mac80211.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 3a029f0e303d..d1d6fbc13b1c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -4346,13 +4346,33 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); | |||
| 4346 | * haven't been re-added to the driver yet. | 4346 | * haven't been re-added to the driver yet. |
| 4347 | * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all | 4347 | * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all |
| 4348 | * interfaces, even if they haven't been re-added to the driver yet. | 4348 | * interfaces, even if they haven't been re-added to the driver yet. |
| 4349 | * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up). | ||
| 4349 | */ | 4350 | */ |
| 4350 | enum ieee80211_interface_iteration_flags { | 4351 | enum ieee80211_interface_iteration_flags { |
| 4351 | IEEE80211_IFACE_ITER_NORMAL = 0, | 4352 | IEEE80211_IFACE_ITER_NORMAL = 0, |
| 4352 | IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0), | 4353 | IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0), |
| 4354 | IEEE80211_IFACE_ITER_ACTIVE = BIT(1), | ||
| 4353 | }; | 4355 | }; |
| 4354 | 4356 | ||
| 4355 | /** | 4357 | /** |
| 4358 | * ieee80211_iterate_interfaces - iterate interfaces | ||
| 4359 | * | ||
| 4360 | * This function iterates over the interfaces associated with a given | ||
| 4361 | * hardware and calls the callback for them. This includes active as well as | ||
| 4362 | * inactive interfaces. This function allows the iterator function to sleep. | ||
| 4363 | * Will iterate over a new interface during add_interface(). | ||
| 4364 | * | ||
| 4365 | * @hw: the hardware struct of which the interfaces should be iterated over | ||
| 4366 | * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags | ||
| 4367 | * @iterator: the iterator function to call | ||
| 4368 | * @data: first argument of the iterator function | ||
| 4369 | */ | ||
| 4370 | void ieee80211_iterate_interfaces(struct ieee80211_hw *hw, u32 iter_flags, | ||
| 4371 | void (*iterator)(void *data, u8 *mac, | ||
| 4372 | struct ieee80211_vif *vif), | ||
| 4373 | void *data); | ||
| 4374 | |||
| 4375 | /** | ||
| 4356 | * ieee80211_iterate_active_interfaces - iterate active interfaces | 4376 | * ieee80211_iterate_active_interfaces - iterate active interfaces |
| 4357 | * | 4377 | * |
| 4358 | * This function iterates over the interfaces associated with a given | 4378 | * This function iterates over the interfaces associated with a given |
| @@ -4367,11 +4387,16 @@ enum ieee80211_interface_iteration_flags { | |||
| 4367 | * @iterator: the iterator function to call | 4387 | * @iterator: the iterator function to call |
| 4368 | * @data: first argument of the iterator function | 4388 | * @data: first argument of the iterator function |
| 4369 | */ | 4389 | */ |
| 4370 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | 4390 | static inline void |
| 4371 | u32 iter_flags, | 4391 | ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, u32 iter_flags, |
| 4372 | void (*iterator)(void *data, u8 *mac, | 4392 | void (*iterator)(void *data, u8 *mac, |
| 4373 | struct ieee80211_vif *vif), | 4393 | struct ieee80211_vif *vif), |
| 4374 | void *data); | 4394 | void *data) |
| 4395 | { | ||
| 4396 | ieee80211_iterate_interfaces(hw, | ||
| 4397 | iter_flags | IEEE80211_IFACE_ITER_ACTIVE, | ||
| 4398 | iterator, data); | ||
| 4399 | } | ||
| 4375 | 4400 | ||
| 4376 | /** | 4401 | /** |
| 4377 | * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces | 4402 | * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces |
