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 04/19] staging: wfx: implement start_ap/stop_ap
Date: Fri, 10 Apr 2020 15:32:24 +0200 [thread overview]
Message-ID: <20200410133239.438347-5-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200410133239.438347-1-Jerome.Pouiller@silabs.com>
From: Jérôme Pouiller <jerome.pouiller@silabs.com>
Currently, wfx_bss_info_changed() check interface status changes and
guess when the pattern match with an AP start and AP stop (through
wfx_update_beaconing()). It is far easier to rely on start_ap and
stop_ap callbacks provided by mac80211.
wfx_bss_info_changed() keeps only the responsibility of updating the
frame templates.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
drivers/staging/wfx/main.c | 2 ++
drivers/staging/wfx/sta.c | 71 ++++++++++++++------------------------
drivers/staging/wfx/sta.h | 2 ++
3 files changed, 30 insertions(+), 45 deletions(-)
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 1e9f6da75024..b459fac928fd 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -136,6 +136,8 @@ static const struct ieee80211_ops wfx_ops = {
.conf_tx = wfx_conf_tx,
.hw_scan = wfx_hw_scan,
.cancel_hw_scan = wfx_cancel_hw_scan,
+ .start_ap = wfx_start_ap,
+ .stop_ap = wfx_stop_ap,
.sta_add = wfx_sta_add,
.sta_remove = wfx_sta_remove,
.set_tim = wfx_set_tim,
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 36e55e32da2b..92bf317b57bb 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -575,40 +575,6 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return 0;
}
-static int wfx_start_ap(struct wfx_vif *wvif)
-{
- int ret;
-
- wvif->beacon_int = wvif->vif->bss_conf.beacon_int;
- ret = hif_start(wvif, &wvif->vif->bss_conf, wvif->channel);
- if (ret)
- return ret;
- ret = wfx_upload_keys(wvif);
- if (ret)
- return ret;
- if (wvif_count(wvif->wdev) <= 1)
- hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
- wvif->state = WFX_STATE_AP;
- wfx_update_filtering(wvif);
- return 0;
-}
-
-static int wfx_update_beaconing(struct wfx_vif *wvif)
-{
- if (wvif->vif->type != NL80211_IFTYPE_AP)
- return 0;
- if (wvif->state == WFX_STATE_AP &&
- wvif->beacon_int == wvif->vif->bss_conf.beacon_int)
- return 0;
- wfx_tx_lock_flush(wvif->wdev);
- hif_reset(wvif, false);
- wfx_tx_policy_init(wvif);
- wvif->state = WFX_STATE_PASSIVE;
- wfx_start_ap(wvif);
- wfx_tx_unlock(wvif->wdev);
- return 0;
-}
-
static int wfx_upload_ap_templates(struct wfx_vif *wvif)
{
struct sk_buff *skb;
@@ -634,6 +600,30 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif)
return 0;
}
+int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+ struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+
+ hif_start(wvif, &vif->bss_conf, wvif->channel);
+ wfx_upload_keys(wvif);
+ if (wvif_count(wvif->wdev) <= 1)
+ hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
+ wvif->state = WFX_STATE_AP;
+ wfx_update_filtering(wvif);
+ wfx_upload_ap_templates(wvif);
+ wfx_fwd_probe_req(wvif, false);
+ return 0;
+}
+
+void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+ struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+
+ hif_reset(wvif, false);
+ wfx_tx_policy_init(wvif);
+ wvif->state = WFX_STATE_PASSIVE;
+}
+
static void wfx_join_finalize(struct wfx_vif *wvif,
struct ieee80211_bss_conf *info)
{
@@ -709,16 +699,9 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
}
}
- if (changed & BSS_CHANGED_BEACON ||
- changed & BSS_CHANGED_AP_PROBE_RESP ||
- changed & BSS_CHANGED_BSSID ||
- changed & BSS_CHANGED_SSID ||
- changed & BSS_CHANGED_IBSS) {
- wvif->beacon_int = info->beacon_int;
- wfx_update_beaconing(wvif);
+ if (changed & BSS_CHANGED_AP_PROBE_RESP ||
+ changed & BSS_CHANGED_BEACON)
wfx_upload_ap_templates(wvif);
- wfx_fwd_probe_req(wvif, false);
- }
if (changed & BSS_CHANGED_BEACON_ENABLED &&
wvif->state != WFX_STATE_IBSS)
@@ -742,8 +725,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_BEACON_INT) {
if (info->ibss_joined)
do_join = true;
- else if (wvif->state == WFX_STATE_AP)
- wfx_update_beaconing(wvif);
}
if (changed & BSS_CHANGED_BSSID)
diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h
index a0c5153e5272..6a4b91a47f5b 100644
--- a/drivers/staging/wfx/sta.h
+++ b/drivers/staging/wfx/sta.h
@@ -54,6 +54,8 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u16 queue, const struct ieee80211_tx_queue_params *params);
void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
--
2.25.1
next prev parent reply other threads:[~2020-04-10 13:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 13:32 [PATCH 00/19] staging: wfx: simplify start/shutdown of RF Jerome Pouiller
2020-04-10 13:32 ` [PATCH 01/19] staging: wfx: fix race between configure_filter and remove_interface Jerome Pouiller
2020-04-10 13:32 ` [PATCH 02/19] staging: wfx: reduce hold duration of cfg80211_bss Jerome Pouiller
2020-04-10 13:32 ` [PATCH 03/19] staging: wfx: call wfx_do_unjoin() synchronously Jerome Pouiller
2020-04-10 13:32 ` Jerome Pouiller [this message]
2020-04-10 13:32 ` [PATCH 05/19] staging: wfx: set all parameters before starting AP Jerome Pouiller
2020-04-10 13:32 ` [PATCH 06/19] staging: wfx: change the way the station associate to an AP Jerome Pouiller
2020-04-10 13:32 ` [PATCH 07/19] staging: wfx: remove useless call to wfx_tx_flush() Jerome Pouiller
2020-04-10 13:32 ` [PATCH 08/19] staging: wfx: fix support for BSS_CHANGED_KEEP_ALIVE Jerome Pouiller
2020-04-10 13:32 ` [PATCH 09/19] staging: wfx: disabling keep alive during unjoin is useless Jerome Pouiller
2020-04-10 13:32 ` [PATCH 10/19] staging: wfx: drop unnecessary condition checks in wfx_upload_ap_templates() Jerome Pouiller
2020-04-10 13:32 ` [PATCH 11/19] staging: wfx: request to send beacons in IBSS mode Jerome Pouiller
2020-04-10 13:32 ` [PATCH 12/19] staging: wfx: remove unnecessary conditions in wfx_bss_info_changed() Jerome Pouiller
2020-04-10 13:32 ` [PATCH 13/19] staging: wfx: avoid duplicate updating of beacon template Jerome Pouiller
2020-04-10 13:32 ` [PATCH 14/19] staging: wfx: allow to join IBSS networks Jerome Pouiller
2020-04-10 13:32 ` [PATCH 15/19] staging: wfx: introduce wfx_join_ibss() and wfx_leave_ibss() Jerome Pouiller
2020-04-10 13:32 ` [PATCH 16/19] staging: wfx: re-enable BA after reset Jerome Pouiller
2020-04-10 13:32 ` [PATCH 17/19] staging: wfx: check value of beacon_int Jerome Pouiller
2020-04-10 13:32 ` [PATCH 18/19] staging: wfx: drop unused attribute 'beacon_int' Jerome Pouiller
2020-04-10 13:32 ` [PATCH 19/19] staging: wfx: drop useless update of macaddr 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=20200410133239.438347-5-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
all inboxes | Powered by JetHome®