]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: wfx: simplify update of DTIM period
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Wed, 15 Jan 2020 13:54:32 +0000 (13:54 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jan 2020 19:59:48 +0000 (20:59 +0100)
Current code parse the TIM and retrieve the DTIM period. It is far
easier to rely on bss_info_changed() for this job.

It is no more necessary to run task asynchronously. So
set_beacon_wakeup_period_work is now useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-22-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/data_rx.c
drivers/staging/wfx/sta.c
drivers/staging/wfx/wfx.h

index d460c0ffca1f8fdc7faf9b29b232611c9b7c918e..0ab71c911f8438dc411c1365f68738810d48eba0 100644 (file)
@@ -173,20 +173,6 @@ void wfx_rx_cb(struct wfx_vif *wvif,
            !arg->status && wvif->vif &&
            ether_addr_equal(ieee80211_get_SA(frame),
                             wvif->vif->bss_conf.bssid)) {
-               const u8 *tim_ie;
-               u8 *ies = mgmt->u.beacon.variable;
-               size_t ies_len = skb->len - (ies - skb->data);
-
-               tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len);
-               if (tim_ie) {
-                       struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *)&tim_ie[2];
-
-                       if (wvif->dtim_period != tim->dtim_period) {
-                               wvif->dtim_period = tim->dtim_period;
-                               schedule_work(&wvif->set_beacon_wakeup_period_work);
-                       }
-               }
-
                /* Disable beacon filter once we're associated... */
                if (wvif->disable_beacon_filter &&
                    (wvif->vif->bss_conf.assoc ||
index ae01f7be0ddba198054b3a2b2e94313fcfdf1398..1af99b7930f491c88313411798f57b771645aca5 100644 (file)
@@ -446,15 +446,6 @@ static void wfx_bss_params_work(struct work_struct *work)
        mutex_unlock(&wvif->wdev->conf_mutex);
 }
 
-static void wfx_set_beacon_wakeup_period_work(struct work_struct *work)
-{
-       struct wfx_vif *wvif = container_of(work, struct wfx_vif,
-                                           set_beacon_wakeup_period_work);
-
-       hif_set_beacon_wakeup_period(wvif, wvif->dtim_period,
-                                    wvif->dtim_period);
-}
-
 static void wfx_do_unjoin(struct wfx_vif *wvif)
 {
        mutex_lock(&wvif->wdev->conf_mutex);
@@ -466,7 +457,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif)
                goto done;
 
        cancel_work_sync(&wvif->update_filtering_work);
-       cancel_work_sync(&wvif->set_beacon_wakeup_period_work);
        wvif->state = WFX_STATE_PASSIVE;
 
        /* Unjoin is a reset. */
@@ -823,7 +813,8 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
                hif_keep_alive_period(wvif, 30 /* sec */);
                hif_set_bss_params(wvif, &wvif->bss_params);
                wvif->setbssparams_done = true;
-               wfx_set_beacon_wakeup_period_work(&wvif->set_beacon_wakeup_period_work);
+               hif_set_beacon_wakeup_period(wvif, info->dtim_period,
+                                            info->dtim_period);
                wfx_update_pm(wvif);
        }
 }
@@ -872,6 +863,10 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
                }
        }
 
+       if (changed & BSS_CHANGED_BEACON_INFO)
+               hif_set_beacon_wakeup_period(wvif, info->dtim_period,
+                                            info->dtim_period);
+
        /* assoc/disassoc, or maybe AID changed */
        if (changed & BSS_CHANGED_ASSOC) {
                wfx_tx_lock_flush(wdev);
@@ -1260,8 +1255,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 
        init_completion(&wvif->set_pm_mode_complete);
        complete(&wvif->set_pm_mode_complete);
-       INIT_WORK(&wvif->set_beacon_wakeup_period_work,
-                 wfx_set_beacon_wakeup_period_work);
        INIT_WORK(&wvif->update_filtering_work, wfx_update_filtering_work);
        INIT_WORK(&wvif->bss_params_work, wfx_bss_params_work);
        INIT_WORK(&wvif->set_cts_work, wfx_set_cts_work);
index 155dbe5704c9804ae9ceb1882989e58ca03273db..d201cceec1abf6302698783c05e1a04ad803cd84 100644 (file)
@@ -101,8 +101,6 @@ struct wfx_vif {
        int                     dtim_period;
        int                     beacon_int;
        bool                    enable_beacon;
-       struct work_struct      set_beacon_wakeup_period_work;
-
        bool                    filter_bssid;
        bool                    fwd_probe_req;
        bool                    disable_beacon_filter;