mac80211: replace restart_complete() with reconfig_complete()
authorEliad Peller <eliad@wizery.com>
Tue, 4 Nov 2014 09:43:54 +0000 (11:43 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 4 Nov 2014 12:49:00 +0000 (13:49 +0100)
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: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/iwlwifi/mvm/mac80211.c
include/net/mac80211.h
net/mac80211/driver-ops.h
net/mac80211/trace.h
net/mac80211/util.c

index fe531ea6926cce4fc2076dd132455440cb647454..cc8f1fc65044d0bd931462544ba638eb1408778d 100644 (file)
@@ -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,
 
index 46709301a51e1986bb4b505b659d7f94bbfca6d9..f57459a2f51a08cbbdd461151c38f9e17c04f6dc 100644 (file)
@@ -3929,10 +3929,14 @@ exit:
 }
 #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,
index c7a73c68bdabddcb2eb2536256e0a7736be06dc1..e16c29dc9d495d403e54c88c6d9f7176bda1e141 100644 (file)
@@ -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,
index db54635d65c56e15519e24bab521bc8243770c84..5f203a6a5e7eb8bbab27627143b1430f3eb37d9c 100644 (file)
@@ -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,
index 8e1889ff2e53d2ef19ee72c3f53ad062a76e1c46..9759dd1f0734000337790aabca58066d411a80be 100644 (file)
@@ -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);
 }
 
index aeeace5ba47b52a902e5e82ba3e325057bedf72e..809a4983eb4a7e553621d1687f462b6eb5ecd773 100644 (file)
@@ -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)
index 5f7b0e935b656925460c614063c2b6c46b260248..f9319a5dca642c26a52b465bb2f0657e950c7486 100644 (file)
@@ -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;