Commit cf2c92d8 authored by Eliad Peller's avatar Eliad Peller Committed by Johannes Berg

mac80211: replace restart_complete() with reconfig_complete()

Drivers might want to know also when mac80211 has
completed reconfiguring after resume (e.g. in order
to know when frames can be passed to mac80211).

Rename restart_complete() to a more-generic reconfig_complete(),
and add a new enum to indicate the reconfiguration type.

Update the current users with the new prototype.
Signed-off-by: default avatarEliad Peller <eliadx.peller@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 13a8098a
......@@ -321,7 +321,7 @@ enum ath10k_state {
* stopped in ath10k_core_restart() work holding conf_mutex. The state
* RESTARTED means that the device is up and mac80211 has started hw
* reconfiguration. Once mac80211 is done with the reconfiguration we
* set the state to STATE_ON in restart_complete(). */
* set the state to STATE_ON in reconfig_complete(). */
ATH10K_STATE_RESTARTING,
ATH10K_STATE_RESTARTED,
......
......@@ -3929,10 +3929,14 @@ static int ath10k_resume(struct ieee80211_hw *hw)
}
#endif
static void ath10k_restart_complete(struct ieee80211_hw *hw)
static void ath10k_reconfig_complete(struct ieee80211_hw *hw,
enum ieee80211_reconfig_type reconfig_type)
{
struct ath10k *ar = hw->priv;
if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART)
return;
mutex_lock(&ar->conf_mutex);
/* If device failed to restart it will be in a different state, e.g.
......@@ -4450,7 +4454,7 @@ static const struct ieee80211_ops ath10k_ops = {
.tx_last_beacon = ath10k_tx_last_beacon,
.set_antenna = ath10k_set_antenna,
.get_antenna = ath10k_get_antenna,
.restart_complete = ath10k_restart_complete,
.reconfig_complete = ath10k_reconfig_complete,
.get_survey = ath10k_get_survey,
.set_bitrate_mask = ath10k_set_bitrate_mask,
.sta_rc_update = ath10k_sta_rc_update,
......
......@@ -857,9 +857,8 @@ static int iwl_mvm_mac_start(struct ieee80211_hw *hw)
return ret;
}
static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
static void iwl_mvm_restart_complete(struct iwl_mvm *mvm)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
mutex_lock(&mvm->mutex);
......@@ -877,6 +876,21 @@ static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
mutex_unlock(&mvm->mutex);
}
static void
iwl_mvm_mac_reconfig_complete(struct ieee80211_hw *hw,
enum ieee80211_reconfig_type reconfig_type)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
switch (reconfig_type) {
case IEEE80211_RECONFIG_TYPE_RESTART:
iwl_mvm_restart_complete(mvm);
break;
case IEEE80211_RECONFIG_TYPE_SUSPEND:
break;
}
}
void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
{
lockdep_assert_held(&mvm->mutex);
......@@ -3014,7 +3028,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = {
.tx = iwl_mvm_mac_tx,
.ampdu_action = iwl_mvm_mac_ampdu_action,
.start = iwl_mvm_mac_start,
.restart_complete = iwl_mvm_mac_restart_complete,
.reconfig_complete = iwl_mvm_mac_reconfig_complete,
.stop = iwl_mvm_mac_stop,
.add_interface = iwl_mvm_mac_add_interface,
.remove_interface = iwl_mvm_mac_remove_interface,
......
......@@ -2388,6 +2388,22 @@ enum ieee80211_roc_type {
IEEE80211_ROC_TYPE_MGMT_TX,
};
/**
* enum ieee80211_reconfig_complete_type - reconfig type
*
* This enum is used by the reconfig_complete() callback to indicate what
* reconfiguration type was completed.
*
* @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type
* (also due to resume() callback returning 1)
* @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless
* of wowlan configuration)
*/
enum ieee80211_reconfig_type {
IEEE80211_RECONFIG_TYPE_RESTART,
IEEE80211_RECONFIG_TYPE_SUSPEND,
};
/**
* struct ieee80211_ops - callbacks from mac80211 to the driver
*
......@@ -2823,11 +2839,11 @@ enum ieee80211_roc_type {
* disabled/enabled via @bss_info_changed.
* @stop_ap: Stop operation on the AP interface.
*
* @restart_complete: Called after a call to ieee80211_restart_hw(), when the
* reconfiguration has completed. This can help the driver implement the
* reconfiguration step. Also called when reconfiguring because the
* driver's resume function returned 1, as this is just like an "inline"
* hardware restart. This callback may sleep.
* @reconfig_complete: Called after a call to ieee80211_restart_hw() and
* during resume, when the reconfiguration has completed.
* This can help the driver implement the reconfiguration step (and
* indicate mac80211 is ready to receive frames).
* This callback may sleep.
*
* @ipv6_addr_change: IPv6 address assignment on the given interface changed.
* Currently, this is only called for managed or P2P client interfaces.
......@@ -3050,7 +3066,8 @@ struct ieee80211_ops {
int n_vifs,
enum ieee80211_chanctx_switch_mode mode);
void (*restart_complete)(struct ieee80211_hw *hw);
void (*reconfig_complete)(struct ieee80211_hw *hw,
enum ieee80211_reconfig_type reconfig_type);
#if IS_ENABLED(CONFIG_IPV6)
void (*ipv6_addr_change)(struct ieee80211_hw *hw,
......
......@@ -1152,13 +1152,15 @@ static inline void drv_stop_ap(struct ieee80211_local *local,
trace_drv_return_void(local);
}
static inline void drv_restart_complete(struct ieee80211_local *local)
static inline void
drv_reconfig_complete(struct ieee80211_local *local,
enum ieee80211_reconfig_type reconfig_type)
{
might_sleep();
trace_drv_restart_complete(local);
if (local->ops->restart_complete)
local->ops->restart_complete(&local->hw);
trace_drv_reconfig_complete(local, reconfig_type);
if (local->ops->reconfig_complete)
local->ops->reconfig_complete(&local->hw, reconfig_type);
trace_drv_return_void(local);
}
......
......@@ -1562,9 +1562,26 @@ DEFINE_EVENT(local_sdata_evt, drv_stop_ap,
TP_ARGS(local, sdata)
);
DEFINE_EVENT(local_only_evt, drv_restart_complete,
TP_PROTO(struct ieee80211_local *local),
TP_ARGS(local)
TRACE_EVENT(drv_reconfig_complete,
TP_PROTO(struct ieee80211_local *local,
enum ieee80211_reconfig_type reconfig_type),
TP_ARGS(local, reconfig_type),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u8, reconfig_type)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->reconfig_type = reconfig_type;
),
TP_printk(
LOCAL_PR_FMT " reconfig_type:%d",
LOCAL_PR_ARG, __entry->reconfig_type
)
);
#if IS_ENABLED(CONFIG_IPV6)
......
......@@ -1998,7 +1998,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
* We may want to change that later, however.
*/
if (!local->suspended || reconfig_due_to_wowlan)
drv_restart_complete(local);
drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART);
if (!local->suspended)
return 0;
......@@ -2009,6 +2009,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
mb();
local->resuming = false;
if (!reconfig_due_to_wowlan)
drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND);
list_for_each_entry(sdata, &local->interfaces, list) {
if (!ieee80211_sdata_running(sdata))
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment