From patchwork Tue Nov 28 08:31:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 748489 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ql1Xdd8p" Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2042.outbound.protection.outlook.com [40.107.241.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FF81A1; Tue, 28 Nov 2023 00:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRnH2jTvPIAFwoZ4Dcg0VXOnIBPfw0VV6s/xdcFpSMezR6+jZo9H2wlMDOO0R0C0UZwSWkZNYz581p0jsTy/C7UwVcnMk6br9gEppfDi7vM4HBDxDfYesKCAK1f67ApXpBpjs5UGxqSDg3vyT6ibx+DGvnh0Fb5WStEuZuWocvOG/PsJT/zanGioHcT1fcF5eOpt0R/X8WQEebQlL90yN6Or0lzhvq0a0M0gAIiyKAnpVKq4LOZuJyaI4X9X81dvTQbBmMdJH2SgOyunz8wBFQz8M/uzxOsGX89n3UsYsg9nAAoTOXIFo1ySzbHTuiosiT5fZa+PHoc1RYJbbZ7UIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s3Jm6rutR3ZzR9OuEz8K2efKZSKn5aVuiA9IuYUcO6k=; b=cmZw9TCvRGAxbber8rT07XAnuSqVre+pczvOoyJ8UVA3w5bhBcaOHoh3BawqAgNHCOKppVXv5fQr3V2FHDz08ymZEXMFzblxfD4UNjzwOG35uepigGISFggB0T7qels7ZkQK2pm2KJmXZJWeIB1zblCtzAG1Qlg87qcsTeglVbk+wesPceArztDygd4OxBaJMvU3gUifDjVnIDb2PI/2zYxdJzV/eOPIlfP7yLZqk0f2Vr17m4iX2rE52fp73ZUiL7Dz77iavdo7yjDCQKyigBpOaObyinp085tUmSLtZKH4ZRpnCU8mRWNV8u2FMRcbZ6Gb4hmjvBjTj8aXuB4ZCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s3Jm6rutR3ZzR9OuEz8K2efKZSKn5aVuiA9IuYUcO6k=; b=ql1Xdd8pEmDWz4JriU8zsWQn4qhXvsWw6qjZpvI4aaTxVM1aShZu2qdTr4nXT0Sb+GqBZjmjeftu9B+2DCxzUru3vgzGXkH24eTrGTRYwqBtHYzvPUNrhG5u9CElXxXuPMeQYLKDspM+rY1mNLJyXYyZLe88j8FP7Opix/vkMSg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by AS5PR04MB10043.eurprd04.prod.outlook.com (2603:10a6:20b:67f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.18; Tue, 28 Nov 2023 08:31:52 +0000 Received: from PA4PR04MB9638.eurprd04.prod.outlook.com ([fe80::34dd:289e:9e8b:9c9b]) by PA4PR04MB9638.eurprd04.prod.outlook.com ([fe80::34dd:289e:9e8b:9c9b%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 08:31:52 +0000 From: David Lin 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 Subject: [PATCH v7 03/12] wifi: mwifiex: fixed reassocation issue for WPA3. Date: Tue, 28 Nov 2023 16:31:06 +0800 Message-Id: <20231128083115.613235-4-yu-hao.lin@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231128083115.613235-1-yu-hao.lin@nxp.com> References: <20231128083115.613235-1-yu-hao.lin@nxp.com> X-ClientProxiedBy: TYCP286CA0019.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::13) To PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB9638:EE_|AS5PR04MB10043:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ba1180d-843c-4630-742c-08dbefec78ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N0pS7Lib/nEIQ1KFfjwuS84nwvhJL4G6ST6PDx0j7ld2xemdQ6WnQuzssPdYkZqNqUjtR62lAoc2OObQMQ3Oit0e3/n7mMxuc1tc6rkeNn9KyLkVaR39dUq+OLQ/wCBncmNXn8rc6aytmJ9JPTX6DVJvEQUrSZrksEd3FwdvN0dmqvPsJDiJ8FbLfjCW2B2vMe3t5gAif+cPYt/FI7/PAsmckVUt1XWv1ueAZ4PAOFPfFDleV5kcTdaYaBuY6COGNOWEdp2ysIb9pwWwtGvSSEHUDHTCGAJF8Twbx1DuIo7JwtaQ9KOmk3JuJvCcHQsqQFwkHLjnxryQZqeNkB9J21AWIjbHLbYuOsYHdY5C8NUHcr4vCtJw34crER14X+jusy0p25P2oaKA6mB3e2iBSlkMT25dU4wEezqZqZfEFYM/+VgfdxJ9Xy4rbzFHZHXZZb1fElHdkzK/F/st5Kj1Sx6o/0Dqrp/TOhr2a5KanJ35MHxNU/AaDwIFJza4seuOWV10J42FemyVSPUxMj7y5OlrjGK525sdPwQwgr4G9YwzVM+O7zykPxzukhlkv6it X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR04MB9638.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(86362001)(2906002)(5660300002)(6506007)(83380400001)(6512007)(52116002)(41300700001)(38100700002)(36756003)(6666004)(1076003)(2616005)(478600001)(66556008)(66946007)(6486002)(8936002)(6916009)(8676002)(316002)(4326008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xfcE0iR3Xp9UaFN9HZnB7SJ0at+pGgRWcLjCHpaxbDoLr03GeSiA7l0F0g5pi44+lIzwPvUME6UuivfSdf2u0FvtIIY12ssFdiBRLvVbNUpGOEFYVVPZcgiB/ax+BJh8gfnZQFn2iParN1xlZRjDeXm2R3leNb1ebhFIFh84C28fM2B2gaCGUWrKjlE2gSfZtDzCee2Sjq8+zB847J9aSqd5sNkZeAuqF1CaHrsOKNxDL3nLjxKzMJTQRCNjQ2aoUL5liYuCaYA9VfOeOQbyd2cZmNPTffrVQqlrHZ+eYIR2865o08BhXPEY8BSdaTQ+e3nY0l5dXG4ddcxBFoYSrL9UIOYdM6inm4zbMZBO9ACPezpOTCNK7O8U43T8gSMI2fy01HbRwN+Kb5F7FGLyTPneAyEBp0KNv6BwA6/VMj4e4q0Y8MEueYWdM7tCv4WFMIlo3/wMXXIGHk/aQaCByki4PzYt2i3fHJq67ZweQQxv6VQ8CHBmjXAQVJwOB9FQ/JoF7yqm/Lj917xEr23TnJAZtcEqgceh9+jBd06LNSc9IIaz99ezowwQUpoHnXpyfUmC55qPpfnuptmqVK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ginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ba1180d-843c-4630-742c-08dbefec78ba X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 08:31:52.2818 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lIlZBWVggZWRFKgABsRZtX59qJGjDtn3P3LsAfU0qXGDV9KBRMLhVGbP5DkdjSm+CmKT0SfWaEbR/VFNGQBrog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10043 This issue is related to resatart/reconfigure AP. When AP is restarted or reconfigured, wpa_supplilcant will use cached PMKSA to do association to AP. Because association failure does not report to cfg80211/wpa_supplicant, wpa_supplicant will always use cached PMKSA to do assocaiton. Connection can't be established under this way. Signed-off-by: David Lin --- .../net/wireless/marvell/mwifiex/cfg80211.c | 25 ++++++++----------- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 18 +++++++++++++ drivers/net/wireless/marvell/mwifiex/init.c | 1 + drivers/net/wireless/marvell/mwifiex/main.c | 6 +++++ drivers/net/wireless/marvell/mwifiex/main.h | 3 +++ 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 3d59e6a441b9..a21310f3807c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4395,9 +4395,6 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, int ret; struct cfg80211_ssid req_ssid; const u8 *ssid_ie; - struct cfg80211_rx_assoc_resp assoc_resp = { - .uapsd_queues = -1, - }; if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { mwifiex_dbg(adapter, ERROR, @@ -4433,13 +4430,13 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, req_ssid.ssid_len = ssid_ie[1]; if (req_ssid.ssid_len > IEEE80211_MAX_SSID_LEN) { - mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); + mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); goto ssid_err; } memcpy(req_ssid.ssid, ssid_ie + 2, req_ssid.ssid_len); if (!req_ssid.ssid_len || req_ssid.ssid[0] < 0x20) { - mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); + mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); goto ssid_err; } rcu_read_unlock(); @@ -4466,25 +4463,25 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, memcpy(priv->cfg_bssid, req->bss->bssid, ETH_ALEN); - mwifiex_dbg(priv->adapter, MSG, + mwifiex_dbg(adapter, MSG, "assoc: send association to %pM\n", req->bss->bssid); - cfg80211_ref_bss(priv->adapter->wiphy, req->bss); + cfg80211_ref_bss(adapter->wiphy, req->bss); ret = mwifiex_bss_start(priv, req->bss, &req_ssid); - if (!ret) { - assoc_resp.links[0].bss = priv->attempted_bss_desc->bss; - assoc_resp.buf = priv->assoc_rsp_buf; - assoc_resp.len = priv->assoc_rsp_size; - cfg80211_rx_assoc_resp(priv->netdev, - &assoc_resp); - } else { + if (ret) { priv->auth_flag = 0; priv->auth_alg = 0xFFFF; eth_zero_addr(priv->cfg_bssid); } + if (priv->assoc_rsp_size) { + priv->req_bss = req->bss; + adapter->assoc_resp_received = true; + queue_work(adapter->workqueue, &adapter->main_work); + } + cfg80211_put_bss(priv->adapter->wiphy, req->bss); return 0; diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 311af5f40c3e..16777af50097 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -924,6 +924,24 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) return ret; } +void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter) +{ + struct cfg80211_rx_assoc_resp assoc_resp = { + .uapsd_queues = -1, + }; + struct mwifiex_private *priv = + mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); + + if (priv->assoc_rsp_size) { + assoc_resp.links[0].bss = priv->req_bss; + assoc_resp.buf = priv->assoc_rsp_buf; + assoc_resp.len = priv->assoc_rsp_size; + cfg80211_rx_assoc_resp(priv->netdev, + &assoc_resp); + priv->assoc_rsp_size = 0; + } +} + /* * This function handles the timeout of command sending. * diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index f86a527fd7ca..4326e03a66d3 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -223,6 +223,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->cmd_resp_received = false; adapter->event_received = false; adapter->data_received = false; + adapter->assoc_resp_received = 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 3bebb6c37604..1dac77946813 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -365,6 +365,12 @@ 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) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 83449ad84d15..ae4b44ad6c50 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -615,6 +615,7 @@ struct mwifiex_private { #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE]; u32 assoc_rsp_size; + struct cfg80211_bss *req_bss; #define MWIFIEX_GENIE_BUF_SIZE 256 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE]; @@ -915,6 +916,7 @@ struct mwifiex_adapter { u8 cmd_resp_received; u8 event_received; u8 data_received; + u8 assoc_resp_received; u16 seq_num; struct cmd_ctrl_node *cmd_pool; struct cmd_ctrl_node *curr_cmd; @@ -1104,6 +1106,7 @@ void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter); int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter); +void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter); int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb); int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,