aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-12-04 16:39:17 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-12-16 05:29:44 -0500
commit6a9d1b91f34df1935bc0ad98114801a44db0f98c (patch)
treeecf4637a32c57786a6ac468be5bc392bb28e779d /include/net
parentc4de673b775e4db48cd2db6277e0c6714332ca0c (diff)
mac80211: add pre-RCU-sync sta removal driver operation
Currently, mac80211 allows drivers to keep RCU-protected station references that are cleared when the station is removed from the driver and consequently needs to synchronize twice, once before removing the station from the driver (so it can guarantee that the station is no longer used in TX towards the driver) and once after the station is removed from the driver. Add a new pre-RCU-synchronisation station removal operation to the API to allow drivers to clear/invalidate their RCU-protected station pointers before the RCU synchronisation. This will allow removing the second synchronisation by changing the driver API so that the driver may no longer assume a valid RCU-protected pointer after sta_remove/sta_state returns. The alternative to this would be to synchronize_rcu() in all the drivers that currently rely on this behaviour (only iwlmvm) but that would defeat the purpose. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/mac80211.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c014acc09ebc..22b6dd96dbc6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2495,7 +2495,11 @@ enum ieee80211_roc_type {
2495 * AP, IBSS/WDS/mesh peer etc. This callback can sleep. 2495 * AP, IBSS/WDS/mesh peer etc. This callback can sleep.
2496 * 2496 *
2497 * @sta_remove: Notifies low level driver about removal of an associated 2497 * @sta_remove: Notifies low level driver about removal of an associated
2498 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 2498 * station, AP, IBSS/WDS/mesh peer etc. Note that after the callback
2499 * returns it isn't safe to use the pointer, not even RCU protected;
2500 * no RCU grace period is guaranteed between returning here and freeing
2501 * the station. See @sta_pre_rcu_remove if needed.
2502 * This callback can sleep.
2499 * 2503 *
2500 * @sta_add_debugfs: Drivers can use this callback to add debugfs files 2504 * @sta_add_debugfs: Drivers can use this callback to add debugfs files
2501 * when a station is added to mac80211's station list. This callback 2505 * when a station is added to mac80211's station list. This callback
@@ -2514,7 +2518,17 @@ enum ieee80211_roc_type {
2514 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.) 2518 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
2515 * This callback is mutually exclusive with @sta_add/@sta_remove. 2519 * This callback is mutually exclusive with @sta_add/@sta_remove.
2516 * It must not fail for down transitions but may fail for transitions 2520 * It must not fail for down transitions but may fail for transitions
2517 * up the list of states. 2521 * up the list of states. Also note that after the callback returns it
2522 * isn't safe to use the pointer, not even RCU protected - no RCU grace
2523 * period is guaranteed between returning here and freeing the station.
2524 * See @sta_pre_rcu_remove if needed.
2525 * The callback can sleep.
2526 *
2527 * @sta_pre_rcu_remove: Notify driver about station removal before RCU
2528 * synchronisation. This is useful if a driver needs to have station
2529 * pointers protected using RCU, it can then use this call to clear
2530 * the pointers instead of waiting for an RCU grace period to elapse
2531 * in @sta_state.
2518 * The callback can sleep. 2532 * The callback can sleep.
2519 * 2533 *
2520 * @sta_rc_update: Notifies the driver of changes to the bitrates that can be 2534 * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
@@ -2827,6 +2841,9 @@ struct ieee80211_ops {
2827 struct ieee80211_sta *sta, 2841 struct ieee80211_sta *sta,
2828 enum ieee80211_sta_state old_state, 2842 enum ieee80211_sta_state old_state,
2829 enum ieee80211_sta_state new_state); 2843 enum ieee80211_sta_state new_state);
2844 void (*sta_pre_rcu_remove)(struct ieee80211_hw *hw,
2845 struct ieee80211_vif *vif,
2846 struct ieee80211_sta *sta);
2830 void (*sta_rc_update)(struct ieee80211_hw *hw, 2847 void (*sta_rc_update)(struct ieee80211_hw *hw,
2831 struct ieee80211_vif *vif, 2848 struct ieee80211_vif *vif,
2832 struct ieee80211_sta *sta, 2849 struct ieee80211_sta *sta,