rt2x00: implement reconfig_complete
authorStanislaw Gruszka <sgruszka@redhat.com>
Thu, 28 Nov 2019 09:11:23 +0000 (10:11 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 18 Dec 2019 18:55:55 +0000 (20:55 +0200)
mac80211 has .reconfig_complete that can be used as indicator of
HW restart end. This will allow to configure keys/IV differently
for HW restart and normal configuration.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2800pci.c
drivers/net/wireless/ralink/rt2x00/rt2800soc.c
drivers/net/wireless/ralink/rt2x00/rt2800usb.c
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c

index a23c265..3868c07 100644 (file)
@@ -311,6 +311,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = {
        .get_survey             = rt2800_get_survey,
        .get_ringparam          = rt2x00mac_get_ringparam,
        .tx_frames_pending      = rt2x00mac_tx_frames_pending,
+       .reconfig_complete      = rt2x00mac_reconfig_complete,
 };
 
 static const struct rt2800_ops rt2800pci_rt2800_ops = {
index 7b931bb..bbfe142 100644 (file)
@@ -156,6 +156,7 @@ static const struct ieee80211_ops rt2800soc_mac80211_ops = {
        .get_survey             = rt2800_get_survey,
        .get_ringparam          = rt2x00mac_get_ringparam,
        .tx_frames_pending      = rt2x00mac_tx_frames_pending,
+       .reconfig_complete      = rt2x00mac_reconfig_complete,
 };
 
 static const struct rt2800_ops rt2800soc_rt2800_ops = {
index 0dfb55c..4cc64fe 100644 (file)
@@ -654,6 +654,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = {
        .get_survey             = rt2800_get_survey,
        .get_ringparam          = rt2x00mac_get_ringparam,
        .tx_frames_pending      = rt2x00mac_tx_frames_pending,
+       .reconfig_complete      = rt2x00mac_reconfig_complete,
 };
 
 static const struct rt2800_ops rt2800usb_rt2800_ops = {
index a90a518..ea8a34e 100644 (file)
@@ -1439,6 +1439,8 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
                  struct sk_buff *skb);
 int rt2x00mac_start(struct ieee80211_hw *hw);
 void rt2x00mac_stop(struct ieee80211_hw *hw);
+void rt2x00mac_reconfig_complete(struct ieee80211_hw *hw,
+                                enum ieee80211_reconfig_type reconfig_type);
 int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                            struct ieee80211_vif *vif);
 void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
index c3eab76..7f9e43a 100644 (file)
@@ -1255,16 +1255,6 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
 {
        int retval = 0;
 
-       if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
-               /*
-                * This is special case for ieee80211_restart_hw(), otherwise
-                * mac80211 never call start() two times in row without stop();
-                */
-               set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
-               rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
-               rt2x00lib_stop(rt2x00dev);
-       }
-
        /*
         * If this is the first interface which is added,
         * we should load the firmware now.
@@ -1292,7 +1282,6 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
        set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags);
 
 out:
-       clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
        return retval;
 }
 
index beb20c5..32efbc8 100644 (file)
@@ -165,6 +165,15 @@ int rt2x00mac_start(struct ieee80211_hw *hw)
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                return 0;
 
+       if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
+               /*
+                * This is special case for ieee80211_restart_hw(), otherwise
+                * mac80211 never call start() two times in row without stop();
+                */
+               set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
+               rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
+               rt2x00lib_stop(rt2x00dev);
+       }
        return rt2x00lib_start(rt2x00dev);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_start);
@@ -180,6 +189,17 @@ void rt2x00mac_stop(struct ieee80211_hw *hw)
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_stop);
 
+void
+rt2x00mac_reconfig_complete(struct ieee80211_hw *hw,
+                           enum ieee80211_reconfig_type reconfig_type)
+{
+       struct rt2x00_dev *rt2x00dev = hw->priv;
+
+       if (reconfig_type == IEEE80211_RECONFIG_TYPE_RESTART)
+               clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
+}
+EXPORT_SYMBOL_GPL(rt2x00mac_reconfig_complete);
+
 int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                            struct ieee80211_vif *vif)
 {