From: David Lin <yu-hao.lin@nxp.com>
To: linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, briannorris@chromium.org,
kvalo@kernel.org, francesco@dolcini.it,
tsung-hsien.hsieh@nxp.com, David Lin <yu-hao.lin@nxp.com>
Subject: [PATCH v7 09/12] wifi: mwifiex: fixed the way to handle link lost.
Date: Tue, 28 Nov 2023 16:31:12 +0800 [thread overview]
Message-ID: <20231128083115.613235-10-yu-hao.lin@nxp.com> (raw)
In-Reply-To: <20231128083115.613235-1-yu-hao.lin@nxp.com>
If host mlme is enabled, event EVENT_LINK_LOST must be handled with
sending deauthentication to upper layers.
Without this patch, if AP is leaving and station won't receive
deauthentication from AP, station won't reconnect to AP again.
Signed-off-by: David Lin <yu-hao.lin@nxp.com>
---
.../net/wireless/marvell/mwifiex/cfg80211.c | 3 +-
drivers/net/wireless/marvell/mwifiex/init.c | 2 +
drivers/net/wireless/marvell/mwifiex/main.c | 56 +++++++++++++++++--
drivers/net/wireless/marvell/mwifiex/main.h | 4 ++
.../net/wireless/marvell/mwifiex/sta_event.c | 18 +++++-
5 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 40ab3e8d0c1c..588a500fe1b9 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4556,7 +4556,8 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev,
if (priv->assoc_rsp_size) {
priv->req_bss = req->bss;
adapter->assoc_resp_received = true;
- queue_work(adapter->workqueue, &adapter->main_work);
+ queue_work(adapter->host_mlme_workqueue,
+ &adapter->host_mlme_work);
}
cfg80211_put_bss(priv->adapter->wiphy, req->bss);
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c
index 4326e03a66d3..87121018abc6 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -224,6 +224,8 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
adapter->event_received = false;
adapter->data_received = false;
adapter->assoc_resp_received = false;
+ adapter->priv_link_lost = NULL;
+ adapter->host_mlme_link_lost = false;
clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags);
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 1dac77946813..f8cef2673502 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -365,12 +365,6 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
}
}
- /* Chekc for Assoc Resp */
- if (adapter->assoc_resp_received) {
- adapter->assoc_resp_received = false;
- mwifiex_process_assoc_resp(adapter);
- }
-
/* Check if we need to confirm Sleep Request
received previously */
if (adapter->ps_state == PS_STATE_PRE_SLEEP)
@@ -536,6 +530,11 @@ static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter)
destroy_workqueue(adapter->rx_workqueue);
adapter->rx_workqueue = NULL;
}
+
+ if (adapter->host_mlme_workqueue) {
+ destroy_workqueue(adapter->host_mlme_workqueue);
+ adapter->host_mlme_workqueue = NULL;
+ }
}
/*
@@ -1394,6 +1393,35 @@ int is_command_pending(struct mwifiex_adapter *adapter)
return !is_cmd_pend_q_empty;
}
+/* This is the host mlme work queue function.
+ * It handles the host mlme operations.
+ */
+static void mwifiex_host_mlme_work_queue(struct work_struct *work)
+{
+ struct mwifiex_adapter *adapter =
+ container_of(work, struct mwifiex_adapter, host_mlme_work);
+
+ if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags))
+ return;
+
+ /* Check for host mlme disconnection */
+ if (adapter->host_mlme_link_lost) {
+ if (adapter->priv_link_lost) {
+ mwifiex_reset_connect_state(adapter->priv_link_lost,
+ WLAN_REASON_DEAUTH_LEAVING,
+ true);
+ adapter->priv_link_lost = NULL;
+ }
+ adapter->host_mlme_link_lost = false;
+ }
+
+ /* Check for host mlme Assoc Resp */
+ if (adapter->assoc_resp_received) {
+ mwifiex_process_assoc_resp(adapter);
+ adapter->assoc_resp_received = false;
+ }
+}
+
/*
* This is the RX work queue function.
*
@@ -1568,6 +1596,14 @@ mwifiex_reinit_sw(struct mwifiex_adapter *adapter)
INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue);
}
+ adapter->host_mlme_workqueue =
+ alloc_workqueue("MWIFIEX_HOST_MLME_WORK_QUEUE",
+ WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
+ if (!adapter->host_mlme_workqueue)
+ goto err_kmalloc;
+
+ INIT_WORK(&adapter->host_mlme_work, mwifiex_host_mlme_work_queue);
+
/* Register the device. Fill up the private data structure with
* relevant information from the card. Some code extracted from
* mwifiex_register_dev()
@@ -1724,6 +1760,14 @@ mwifiex_add_card(void *card, struct completion *fw_done,
INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue);
}
+ adapter->host_mlme_workqueue =
+ alloc_workqueue("MWIFIEX_HOST_MLME_WORK_QUEUE",
+ WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
+ if (!adapter->host_mlme_workqueue)
+ goto err_kmalloc;
+
+ INIT_WORK(&adapter->host_mlme_work, mwifiex_host_mlme_work_queue);
+
/* Register the device. Fill up the private data structure with relevant
information from the card. */
if (adapter->if_ops.register_dev(adapter)) {
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index ae4b44ad6c50..f0158d217bb8 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -885,6 +885,8 @@ struct mwifiex_adapter {
struct work_struct main_work;
struct workqueue_struct *rx_workqueue;
struct work_struct rx_work;
+ struct workqueue_struct *host_mlme_workqueue;
+ struct work_struct host_mlme_work;
bool rx_work_enabled;
bool rx_processing;
bool delay_main_work;
@@ -917,6 +919,8 @@ struct mwifiex_adapter {
u8 event_received;
u8 data_received;
u8 assoc_resp_received;
+ struct mwifiex_private *priv_link_lost;
+ u8 host_mlme_link_lost;
u16 seq_num;
struct cmd_ctrl_node *cmd_pool;
struct cmd_ctrl_node *curr_cmd;
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c
index 69426ddd9c3a..9c6fac91204c 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
@@ -225,8 +225,12 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code,
priv->cfg_bssid, reason_code);
if (priv->bss_mode == NL80211_IFTYPE_STATION ||
priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) {
- cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
- !from_ap, GFP_KERNEL);
+ if (adapter->host_mlme && adapter->host_mlme_link_lost)
+ mwifiex_host_mlme_disconnect(adapter->priv_link_lost,
+ reason_code, NULL);
+ else
+ cfg80211_disconnected(priv->netdev, reason_code, NULL,
+ 0, !from_ap, GFP_KERNEL);
}
eth_zero_addr(priv->cfg_bssid);
@@ -749,7 +753,15 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
if (priv->media_connected) {
reason_code =
get_unaligned_le16(adapter->event_body);
- mwifiex_reset_connect_state(priv, reason_code, true);
+ if (adapter->host_mlme) {
+ adapter->priv_link_lost = priv;
+ adapter->host_mlme_link_lost = true;
+ queue_work(adapter->host_mlme_workqueue,
+ &adapter->host_mlme_work);
+ } else {
+ mwifiex_reset_connect_state(priv, reason_code,
+ true);
+ }
}
break;
--
2.25.1
next prev parent reply other threads:[~2023-11-28 8:34 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 8:31 [PATCH v7 00/12] wifi: mwifiex: added code to support host mlme David Lin
2023-11-28 8:31 ` [PATCH v7 01/12] " David Lin
2023-11-28 22:51 ` kernel test robot
2023-11-28 8:31 ` [PATCH v7 02/12] wifi: mwifiex: fixed group rekey issue for WPA3 David Lin
2023-12-01 10:15 ` Francesco Dolcini
2023-12-01 15:05 ` Jeff Johnson
2023-12-01 23:18 ` [EXT] " David Lin
2023-12-01 22:41 ` David Lin
2023-11-28 8:31 ` [PATCH v7 03/12] wifi: mwifiex: fixed reassocation " David Lin
2023-12-01 10:17 ` Francesco Dolcini
2023-12-01 22:44 ` [EXT] " David Lin
2023-11-28 8:31 ` [PATCH v7 04/12] wifi: mwifiex: fixed missing WMM IE for assoc req David Lin
2023-12-01 10:18 ` Francesco Dolcini
2023-12-01 22:47 ` [EXT] " David Lin
2023-12-14 2:16 ` Brian Norris
2023-12-14 2:20 ` David Lin
2023-11-28 8:31 ` [PATCH v7 05/12] wifi: mwifiex: supported host mlme for AP mode David Lin
2023-11-28 8:31 ` [PATCH v7 06/12] wifi: mwifiex: added mac address for AP config David Lin
2023-12-01 10:31 ` Francesco Dolcini
2023-12-01 22:50 ` [EXT] " David Lin
2023-12-03 16:13 ` Jeff Johnson
2023-12-04 1:56 ` David Lin
2023-11-28 8:31 ` [PATCH v7 07/12] wifi: mwifiex: fixed TLV error for station add cmd David Lin
2023-12-01 10:36 ` Francesco Dolcini
2023-12-01 22:52 ` [EXT] " David Lin
2023-11-28 8:31 ` [PATCH v7 08/12] wifi: mwifiex: fixed the way to handle assoc timeout David Lin
2023-12-01 10:37 ` Francesco Dolcini
2023-11-28 8:31 ` David Lin [this message]
2023-12-01 10:38 ` [PATCH v7 09/12] wifi: mwifiex: fixed the way to handle link lost Francesco Dolcini
2023-11-28 8:31 ` [PATCH v7 10/12] wifi: mwifiex: fixed AP issue without host mlme David Lin
2023-12-01 10:39 ` Francesco Dolcini
2023-11-28 8:31 ` [PATCH v7 11/12] wifi: mwifiex: misc modifications for review comments David Lin
2023-12-01 10:40 ` Francesco Dolcini
2023-11-28 8:31 ` [PATCH v7 12/12] wifi: mwifiex: fixed compile and coding errors David Lin
2023-12-01 10:43 ` Francesco Dolcini
2023-12-01 11:49 ` [PATCH v7 00/12] wifi: mwifiex: added code to support host mlme Francesco Dolcini
2023-12-01 12:25 ` Kalle Valo
2023-12-01 23:12 ` [EXT] " David Lin
2023-12-01 23:05 ` David Lin
2023-12-05 19:46 ` Francesco Dolcini
2023-12-06 1:49 ` David Lin
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=20231128083115.613235-10-yu-hao.lin@nxp.com \
--to=yu-hao.lin@nxp.com \
--cc=briannorris@chromium.org \
--cc=francesco@dolcini.it \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=tsung-hsien.hsieh@nxp.com \
/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®