linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 17/20] staging: wfx: split out wfx_filter_beacon()
Date: Wed, 15 Apr 2020 18:11:44 +0200	[thread overview]
Message-ID: <20200415161147.69738-18-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200415161147.69738-1-Jerome.Pouiller@silabs.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Currently, wfx_update_filtering() is sometime called only to apply the
value of wvif->filter_beacon to the hardware. It is nicer to have a
specific function for beacon filtering.

In add, an attentive reader would note that wfx_update_filtering() is
always called after change of wvif->filter_beacon. Thus, it not
necessary to store filter_beacon in the struct wfx_vif. We can just pass
it as parameter.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/sta.c | 23 +++++++++++++----------
 drivers/staging/wfx/wfx.h |  1 -
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index a9261ef4b4c5..1ccd40a3322f 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -113,9 +113,8 @@ void wfx_cqm_bssloss_sm(struct wfx_vif *wvif, int init, int good, int bad)
 	mutex_unlock(&wvif->bss_loss_lock);
 }
 
-void wfx_update_filtering(struct wfx_vif *wvif)
+static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon)
 {
-	int i;
 	const struct hif_ie_table_entry filter_ies[] = {
 		{
 			.ie_id        = WLAN_EID_VENDOR_SPECIFIC,
@@ -136,13 +135,18 @@ void wfx_update_filtering(struct wfx_vif *wvif)
 		}
 	};
 
-	if (!wvif->filter_beacon) {
+	if (!filter_beacon) {
 		hif_set_beacon_filter_table(wvif, 0, NULL);
 		hif_beacon_filter_control(wvif, 0, 1);
 	} else {
 		hif_set_beacon_filter_table(wvif, 3, filter_ies);
 		hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0);
 	}
+}
+
+void wfx_update_filtering(struct wfx_vif *wvif)
+{
+	int i;
 
 	// Temporary workaround for filters
 	hif_set_data_filtering(wvif, false, true);
@@ -194,7 +198,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw,
 {
 	struct wfx_vif *wvif = NULL;
 	struct wfx_dev *wdev = hw->priv;
-	bool filter_bssid, filter_prbreq;
+	bool filter_bssid, filter_prbreq, filter_beacon;
 
 	// Notes:
 	//   - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered
@@ -213,9 +217,10 @@ void wfx_configure_filter(struct ieee80211_hw *hw,
 		// Note: FIF_BCN_PRBRESP_PROMISC covers probe response and
 		// beacons from other BSS
 		if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-			wvif->filter_beacon = false;
+			filter_beacon = false;
 		else
-			wvif->filter_beacon = true;
+			filter_beacon = true;
+		wfx_filter_beacon(wvif, filter_beacon);
 
 		if (*total_flags & FIF_ALLMULTI) {
 			wvif->filter_mcast = false;
@@ -501,8 +506,7 @@ static void wfx_do_join(struct wfx_vif *wvif)
 		 * Disable filtering temporary to make sure the stack
 		 * receives at least one
 		 */
-		wvif->filter_beacon = false;
-		wfx_update_filtering(wvif);
+		wfx_filter_beacon(wvif, false);
 	}
 	wfx_tx_unlock(wvif->wdev);
 }
@@ -703,8 +707,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
 					     info->dtim_period);
 		// We temporary forwarded beacon for join process. It is now no
 		// more necessary.
-		wvif->filter_beacon = true;
-		wfx_update_filtering(wvif);
+		wfx_filter_beacon(wvif, true);
 	}
 
 	/* assoc/disassoc, or maybe AID changed */
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 310d95478824..c30e6984aec1 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -90,7 +90,6 @@ struct wfx_vif {
 	int			filter_mcast_count;
 	u8			filter_mcast_addr[8][ETH_ALEN];
 	bool			filter_mcast;
-	bool			filter_beacon;
 
 	unsigned long		uapsd_mask;
 	struct hif_req_set_bss_params bss_params;
-- 
2.25.1


  parent reply	other threads:[~2020-04-15 16:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 16:11 [PATCH 00/20] staging: wfx: simplify filtering Jerome Pouiller
2020-04-15 16:11 ` [PATCH 01/20] staging: wfx: update filtering even if not connected Jerome Pouiller
2020-04-15 16:11 ` [PATCH 02/20] staging: wfx: simplify wfx_update_filtering() Jerome Pouiller
2020-04-15 16:11 ` [PATCH 03/20] staging: wfx: rework wfx_configure_filter() Jerome Pouiller
2020-04-15 16:11 ` [PATCH 04/20] staging: wfx: simplify handling of beacon filter during join process Jerome Pouiller
2020-04-15 16:11 ` [PATCH 05/20] staging: wfx: wfx_update_filtering_work() is no more used Jerome Pouiller
2020-04-15 16:11 ` [PATCH 06/20] staging: wfx: do not wait for a dtim before associate Jerome Pouiller
2020-04-15 16:11 ` [PATCH 07/20] staging: wfx: disabling beacon filtering after hif_reset() is useless Jerome Pouiller
2020-04-15 16:11 ` [PATCH 08/20] staging: wfx: do not use built-in AUTO_ERP feature Jerome Pouiller
2020-04-15 16:11 ` [PATCH 09/20] staging: wfx: stop changing filtering rule in wfx_hw_scan() Jerome Pouiller
2020-04-15 16:11 ` [PATCH 10/20] staging: wfx: ensure that probe requests are filtered when AP Jerome Pouiller
2020-04-15 16:11 ` [PATCH 11/20] staging: wfx: drop useless wfx_fwd_probe_req() Jerome Pouiller
2020-04-15 16:11 ` [PATCH 12/20] staging: wfx: align semantic of beacon filter with other filters Jerome Pouiller
2020-04-16 13:52   ` Dan Carpenter
2020-04-15 16:11 ` [PATCH 13/20] staging: wfx: align semantic of probe request " Jerome Pouiller
2020-04-15 16:11 ` [PATCH 14/20] staging: wfx: drop struct wfx_grp_addr_table Jerome Pouiller
2020-04-15 16:11 ` [PATCH 15/20] staging: wfx: drop useless call to hif_set_rx_filter() Jerome Pouiller
2020-04-15 16:11 ` [PATCH 16/20] staging: wfx: drop useless attributes 'filter_prbreq' and 'filter_bssid' Jerome Pouiller
2020-04-15 16:11 ` Jerome Pouiller [this message]
2020-04-15 16:11 ` [PATCH 18/20] staging: wfx: drop useless filter update when starting AP Jerome Pouiller
2020-04-15 16:11 ` [PATCH 19/20] staging: wfx: drop useless attribute 'filter_mcast' Jerome Pouiller
2020-04-15 16:11 ` [PATCH 20/20] staging: wfx: update TODO Jerome Pouiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200415161147.69738-18-Jerome.Pouiller@silabs.com \
    --to=jerome.pouiller@silabs.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).