Commit b0674e06 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman
Browse files

staging: wfx: simplify update of DTIM period



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: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-22-Jerome.Pouiller@silabs.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 50a4fb47
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -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 ||
+6 −13
Original line number Diff line number Diff line
@@ -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);
+0 −2
Original line number Diff line number Diff line
@@ -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;