rt2800: add pre_reset_hw callback
authorStanislaw Gruszka <sgruszka@redhat.com>
Sat, 15 Jun 2019 10:00:57 +0000 (12:00 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Jun 2019 05:10:10 +0000 (08:10 +0300)
Add routine to cleanup interfaces data before hw reset as
ieee80211_restart_hw() will do setup interfaces again.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
drivers/net/wireless/ralink/rt2x00/rt2800lib.h
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

index d420d759a877572d50b972e15fa535c99201362a..499e9afa0026264cf854a26253c2084667560f1b 100644 (file)
@@ -1843,6 +1843,25 @@ int rt2800_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(rt2800_sta_remove);
 
+void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev)
+{
+       struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
+       struct data_queue *queue = rt2x00dev->bcn;
+       struct queue_entry *entry;
+       int i, wcid;
+
+       for (wcid = WCID_START; wcid < WCID_END; wcid++) {
+               drv_data->wcid_to_sta[wcid - WCID_START] = NULL;
+               __clear_bit(wcid - WCID_START, drv_data->sta_ids);
+       }
+
+       for (i = 0; i < queue->limit; i++) {
+               entry = &queue->entries[i];
+               clear_bit(ENTRY_BCN_ASSIGNED, &entry->flags);
+       }
+}
+EXPORT_SYMBOL_GPL(rt2800_pre_reset_hw);
+
 void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
                          const unsigned int filter_flags)
 {
index f35f4e20d5aa50c1013a9d8befdaf68ec79c8943..1139405c0ebbe844a41c8a452da4ae2bac11b32a 100644 (file)
@@ -257,5 +257,6 @@ void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
 void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev,
                               unsigned short *txwi_size,
                               unsigned short *rxwi_size);
+void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev);
 
 #endif /* RT2800LIB_H */
index df6345a92f72bebd6c5d3b61bb42b329be0004fa..a23c26574002a2fff3f8477db7aa50f01044a2c1 100644 (file)
@@ -368,6 +368,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
        .config_erp             = rt2800_config_erp,
        .config_ant             = rt2800_config_ant,
        .config                 = rt2800_config,
+       .pre_reset_hw           = rt2800_pre_reset_hw,
 };
 
 static const struct rt2x00_ops rt2800pci_ops = {
index 1054ade65af2c2f24e022df4178507ea5a8a30db..7b931bb96a9e67bec901bc1969e596054415afe0 100644 (file)
@@ -213,6 +213,7 @@ static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
        .config_erp             = rt2800_config_erp,
        .config_ant             = rt2800_config_ant,
        .config                 = rt2800_config,
+       .pre_reset_hw           = rt2800_pre_reset_hw,
 };
 
 static const struct rt2x00_ops rt2800soc_ops = {
index da813dfa9a91454d9c86eaad272b04e230206313..fdf0504b5f1d2b327dcaf45088594a295d3e24e8 100644 (file)
@@ -706,6 +706,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
        .config_erp             = rt2800_config_erp,
        .config_ant             = rt2800_config_ant,
        .config                 = rt2800_config,
+       .pre_reset_hw           = rt2800_pre_reset_hw,
 };
 
 static void rt2800usb_queue_init(struct data_queue *queue)
index 2b551dbe984450c53485b098a9365eaedbdf3893..dc6b79e4be3b1781c145801ae60304e406d5f82d 100644 (file)
@@ -616,6 +616,7 @@ struct rt2x00lib_ops {
        void (*config) (struct rt2x00_dev *rt2x00dev,
                        struct rt2x00lib_conf *libconf,
                        const unsigned int changed_flags);
+       void (*pre_reset_hw) (struct rt2x00_dev *rt2x00dev);
        int (*sta_add) (struct rt2x00_dev *rt2x00dev,
                        struct ieee80211_vif *vif,
                        struct ieee80211_sta *sta);