From patchwork Fri Oct 20 03:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430035 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA033CDB47E for ; Fri, 20 Oct 2023 03:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346962AbjJTDsV (ORCPT ); Thu, 19 Oct 2023 23:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346903AbjJTDsT (ORCPT ); Thu, 19 Oct 2023 23:48:19 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4229E8; Thu, 19 Oct 2023 20:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lWQH7qz8MFwBEqPpF1PLeMvVWb8rcYXnaL+Mv00f/j8LqM3RnHei8C5TVdlr/dx4Y5N9dfY/iVlOjUVEhjismBD1YdFSt1pi0LrUFrtXwgNhdLB/2kZVptCO9MolaNkT58POEr44Wyb7LjcTYT3FZFrOCmoFy6NPHUWopF92kVw5DGGGhxBeJb1wxkQBD5VP0vT8jkRQuBta65Vr3EDtm5YhZm7eYKy7KfJ8H+H8jG8XJZU6qBE6uT9OxNW4ds7qLUzmOuCcK4ylC9LCwxbIINlAPXBn8iSRdKbBhac8u59Rt2aztrMLyLBMoJh0mdp/FtId0Ptwl+dj+88otpX4qg== 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=wL1IhBpw0yNmBAU1xmDYS5FXFTsz2zjurwEpQ9GmpQQ=; b=DtbUpNoZ/SS+/QmiaX5AitmeBDBHHdMPZy47Yhv1WOSu+EgwE52feQzvzGuifyYxSaqLtNm1LuHwTr9Hxxv4NRWXf1iONo1l1/LSihttc4beodgQu/trM7FRWtoZa7aBkD56xK/XYBBqvZggo4oVu11Lr/yrBNJ7qMpcLP6y+sVKErsnmmhOKqQkAxfj/+o/g/mTcPIx0aC5M66ni8ogN1Xq0EeWA11R6+xHSOQED5WTe0kfOUDVtINqisQx3XxrSX08PYdIk5xcqpjVbrFobfGpOpqrrO22qb3EFxRsn0uQGrFXS3u/0dSXuVzawBZlo6cvW2TNmZwmYroQBVvxzA== 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=wL1IhBpw0yNmBAU1xmDYS5FXFTsz2zjurwEpQ9GmpQQ=; b=fj1fS5a0YcIgyOY+zgb0MaFBifrWGKlOFdRYL9X4REqm6m60L0U/9eU4zUvvJln4KUk1ogsx9dGd9vHtjK8QnWQVxrVYbD8f7pvg0TvLOwOdKlVNUkQYMB9St7x7Vb+lWJdjjv6djv8Ef+uI2Z0KhLjFIWn0IVqLgZa6HZool2M= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:11 +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.6933.011; Fri, 20 Oct 2023 03:48:11 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 1/6] wifi: mwifiex: added code to support host mlme. Thread-Topic: [PATCH v6 1/6] wifi: mwifiex: added code to support host mlme. Thread-Index: AdoDCD3HfqdGXSjhR7u7/u1lbWxIUw== Date: Fri, 20 Oct 2023 03:48:11 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 27b5cce3-d470-41e7-481b-08dbd11f61a8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0gMzFd5i+wS9pEhVGmDMlDtbuyM9Je8/7pNKNnrYMnRyiWBzkcvY40zapojz0f/x8YJSzcrTn6uC1Q8iHjaxnsU8XzOU2WPfvP8t3dqiOvCWiEm42Gk3DaQovQuBt5ZeCF4GamQJi3e2IxF7FcyuABTSQ8HQbBImseZeZ4Rdl4mwH3LIHq7mOvdTN7nfA/Aq0lQ3ZIUwfxUw6BW0thOQOuyBEApOGmumKY1CJMk9gmAKfIOnuNFbEpsw+sjcPjEnWzbHW7Nqo/nWZN1f405QclDTiidq2jSYaMz4CbbprWvkbLQ4TQNXWuH96keQE7FEZgKXggrTR+I/iQhjnxNqazBmzHfUvyfFn40qQoPw0xT6F4Z8Pvk2W3+dN/jtIr/S4PMlCAbGSxP5mV58JxXVRAVlTdNQoVqSPCvCM9Fhcy2N8DaKs9epHbfb29UD5z3yv57kKL0cMk9xYUuuagwpMSISKAdC15lQPZJ0C9q3KgGnj7oTILDP2ggXew2qr4ZS8Wj2iOuwDui2mZGspRwVSCeluNcKUzI372lnG3eBKf4n4OuP6P/uLDZVq+BRz0bB2ZvJTH92VrNPbeaZIUuprN9ojtrtdYzPaTqZxyVgJ8JXW4kmkjXt+/ton5/0vvP/ 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(30864003)(55016003)(38100700002)(66899024)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: WcsDhMRMtPNrtryLRk4cbe4TKNXeYZIZUrCnla3rA60fTMGoiqb2dTaKOjqV2wQnQvg+AxLM3Bey24UiDNNMKmPyT5ANjznhZgn6VoQzfWQVl7PNnY4lhFp9QYtR/pdgCl5niYRAz5/jg8mfe+Lk6bymipWOwh8btJx5NeDEX4HGO86qU9aE2BnaNjEGDUOT+46sUZ2diPRFF9AR6BAJ3m/NUAbzxdkZ190R7NdxXRocfQMrefR6b4PoJo0bdliuZizLUVSigCSk94gAWyOsfw+6CaeOAPii+7JpbCbLa6zKso8sjwsqsHDlWbxTI+qed6hDg+LHIeecRbHKxvOndCpXQBJRwYKGhPhRvKF7AmjagQEsCD9i6Wq/TwmjpHbfgE1+aoF2q//QwVF6cRIz+GAw7LheF3/cEkJRFiyVFCZXcy726qw8kFfiogHxZLF7d0ruB3SF+6bpW9Uw/0uP9eU91IXA9DbWoe1tIzM2olVpKcX2O6P/RBeWol7H/pWBWBWLMQcqJdOz6WGcLMQXpF7tn7GqvS7irIiRll+aiwjMbgrCME4GzB6qCxBLXGs5VDCirGdfHWt+0RTX0/3vXdybEp9W0eig57vseJmh4LWHAKlmvHbe1PELQUtjAe3IKH0Sc6xu1eZ74fDG2YnkpgrOaOmE8QCiXgnNTYqXk4NJkcNGQZgrOPcwxb6e5qUbaxxJB2Oa7pJDSLeJXGk899ZQaHVTBsxGm1zfi67W2GokJS6FOStobwj0I+6xIOoToEyLZG8Tr1GaE2sjCtYOeUHyCvxkHkce3hJDPYOPLJ9lZlmVjEGgcJjJ4yxKDPL0nUgo/8J8F/VezwrH+UkiRW/T4zQSu0iR/SwoFI3uMWeqDazRZM2W3fSGZraZo2w64RAGQuzdvruFPuOatUETWngzIDITgjvWsqvexA8TgtILCUYZ6Bp2BeFEl/n5ZXTa/gs0o/KGoW7ijtCuv1NgHnbCXDmBFyJOveIt+7UHAJ3IdelHFWm0m5qeb599iR9mZlBN/u1B2bHl32/1nt4EO1l536Mcc1lz4w4f3TaiJ15F2eA+z1iuJczmQA7AyZ7rGCFrJ48WZOeibJPnZB5xeChT/l+GQe1ASxc9bNtKYeASGkoGyVlPbgbaeha9IiKWm5Y4iB5Sd/dfRMyKu4fZ7Dg6ROD9Y6ODj5l6+aDUEIIiScc+gVi+QyycH9G0B2BvQKhfpHlD5aqf35Lx3xwrbQNPNgUPL1yJWCwMKKVRfR0QArG79vJOFz8/uuxfJbOVNeYj8rqSnvLuJ/ySMmWx6rPiJni90APaHjgieWbZwU7THU/F0bqZubz+bCkYROX7JNywOonoM5ZpiwcBVfC9LtXCsfaFqimiUQdkUfzpdwjGM5W93sEZrdHEgkfQuEfQxH7GVFrjY9eIC+MEMhNcHKrIgcvwnkPm03Ox9DweSrwsjVg7fGNBjCxP+n2fLtPQcS07xBBEl0PVU+POP/0H30DO2ymLDGjIMWv73k5JGg7waM6qSp8sWTZSyjI30hei0vsDSn3JVnNVwU+NZfj87vatLWWvwfJ8s04VMk6Z1JoRK9U4gPz2sizKT0BhzgSo MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27b5cce3-d470-41e7-481b-08dbd11f61a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:11.5330 (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: qMwrCv/t6R5nQZekgIj3Q64Iqg5RXhNfdCw/wsA8Ba14QVqdOhwLhPatqpdg/6EwOcf5WGATmnUW+Mf1T5rEQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 1. For station mode first. 2. This feature is a must for WPA3. 3. Firmware key api version 2 is needed for this feature. 4. The code is only enabled and tested with IW416. 5. This feature is disabled for other chips. Signed-off-by: David Lin --- .../net/wireless/marvell/mwifiex/cfg80211.c | 327 ++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/cmdevt.c | 14 +- drivers/net/wireless/marvell/mwifiex/decl.h | 12 + drivers/net/wireless/marvell/mwifiex/fw.h | 15 + drivers/net/wireless/marvell/mwifiex/init.c | 3 + drivers/net/wireless/marvell/mwifiex/join.c | 64 +++- drivers/net/wireless/marvell/mwifiex/main.h | 10 + drivers/net/wireless/marvell/mwifiex/scan.c | 6 + drivers/net/wireless/marvell/mwifiex/sdio.c | 13 + drivers/net/wireless/marvell/mwifiex/sdio.h | 2 + .../net/wireless/marvell/mwifiex/sta_event.c | 18 +- .../net/wireless/marvell/mwifiex/sta_ioctl.c | 3 +- drivers/net/wireless/marvell/mwifiex/sta_tx.c | 9 +- .../net/wireless/marvell/mwifiex/uap_cmd.c | 26 ++ drivers/net/wireless/marvell/mwifiex/util.c | 73 ++++ 15 files changed, 582 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 7a15ea8072e6..40c39e4765f7 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -57,6 +57,31 @@ ieee80211_iface_combination mwifiex_iface_comb_ap_sta_drcs = { .beacon_int_infra_match = true, }; +struct mwifiex_ieee80211_mgmt { + __le16 frame_control; + __le16 duration; + u8 da[ETH_ALEN]; + u8 sa[ETH_ALEN]; + u8 bssid[ETH_ALEN]; + __le16 seq_ctrl; + u8 addr4[ETH_ALEN]; + union { + struct { + __le16 auth_alg; + __le16 auth_transaction; + __le16 status_code; + /* possibly followed by Challenge text */ + u8 variable[]; + } __packed auth; + struct { + __le16 capab_info; + __le16 listen_interval; + /* followed by SSID and Supported rates */ + u8 variable[]; + } __packed assoc_req; + } u; +} __pack; + /* * This function maps the nl802.11 channel type into driver channel type. * @@ -268,6 +293,8 @@ mwifiex_cfg80211_update_mgmt_frame_registrations(struct wiphy *wiphy, if (mask != priv->mgmt_frame_mask) { priv->mgmt_frame_mask = mask; + if (priv->host_mlme_reg) + priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, HostCmd_ACT_GEN_SET, 0, &priv->mgmt_frame_mask, false); @@ -848,6 +875,7 @@ static int mwifiex_deinit_priv_params(struct mwifiex_private *priv) struct mwifiex_adapter *adapter = priv->adapter; unsigned long flags; + priv->host_mlme_reg = false; priv->mgmt_frame_mask = 0; if (mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, HostCmd_ACT_GEN_SET, 0, @@ -4202,6 +4230,292 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, return ret; } +static int +mwifiex_cfg80211_authenticate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_auth_request *req) +{ + struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); + struct mwifiex_adapter *adapter = priv->adapter; + struct sk_buff *skb; + u16 pkt_len, auth_alg; + int ret; + struct mwifiex_ieee80211_mgmt *mgmt; + struct mwifiex_txinfo *tx_info; + u32 tx_control = 0, pkt_type = PKT_TYPE_MGMT; + u8 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + u8 trans = 1, status_code = 0; + u8 *varptr; + + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { + mwifiex_dbg(priv->adapter, ERROR, "Interface role is AP\n"); + return -EFAULT; + } + + if (priv->wdev.iftype != NL80211_IFTYPE_STATION) { + mwifiex_dbg(priv->adapter, ERROR, + "Interface type is not correct (type %d)\n", + priv->wdev.iftype); + return -EINVAL; + } + + if (priv->auth_alg != WLAN_AUTH_SAE && + (priv->auth_flag & HOST_MLME_AUTH_PENDING)) { + mwifiex_dbg(priv->adapter, ERROR, "Pending auth on going\n"); + return -EBUSY; + } + + if (!priv->host_mlme_reg) { + priv->host_mlme_reg = true; + priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; + mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, + HostCmd_ACT_GEN_SET, 0, + &priv->mgmt_frame_mask, false); + } + + switch (req->auth_type) { + case NL80211_AUTHTYPE_OPEN_SYSTEM: + auth_alg = WLAN_AUTH_OPEN; + break; + case NL80211_AUTHTYPE_SHARED_KEY: + auth_alg = WLAN_AUTH_SHARED_KEY; + break; + case NL80211_AUTHTYPE_FT: + auth_alg = WLAN_AUTH_FT; + break; + case NL80211_AUTHTYPE_NETWORK_EAP: + auth_alg = WLAN_AUTH_LEAP; + break; + case NL80211_AUTHTYPE_SAE: + auth_alg = WLAN_AUTH_SAE; + break; + default: + mwifiex_dbg(priv->adapter, ERROR, + "unsupported auth type=%d\n", req->auth_type); + return -EOPNOTSUPP; + } + + if (!priv->auth_flag) { + ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_SET, + req->bss->channel, + AUTH_TX_DEFAULT_WAIT_TIME); + + if (!ret) { + priv->roc_cfg.cookie = get_random_u32() | 1; + priv->roc_cfg.chan = *req->bss->channel; + } + } + + priv->sec_info.authentication_mode = auth_alg; + + mwifiex_cancel_scan(adapter); + + pkt_len = (u16)req->ie_len + req->auth_data_len + + MWIFIEX_MGMT_HEADER_LEN + MWIFIEX_AUTH_BODY_LEN; + if (req->auth_data_len >= 4) + pkt_len -= 4; + + skb = dev_alloc_skb(MWIFIEX_MIN_DATA_HEADER_LEN + + MWIFIEX_MGMT_FRAME_HEADER_SIZE + + pkt_len + sizeof(pkt_len)); + if (!skb) { + mwifiex_dbg(priv->adapter, ERROR, + "allocate skb failed for management frame\n"); + return -ENOMEM; + } + + tx_info = MWIFIEX_SKB_TXCB(skb); + memset(tx_info, 0, sizeof(*tx_info)); + tx_info->bss_num = priv->bss_num; + tx_info->bss_type = priv->bss_type; + tx_info->pkt_len = pkt_len; + + skb_reserve(skb, MWIFIEX_MIN_DATA_HEADER_LEN + + MWIFIEX_MGMT_FRAME_HEADER_SIZE + sizeof(pkt_len)); + memcpy(skb_push(skb, sizeof(pkt_len)), &pkt_len, sizeof(pkt_len)); + memcpy(skb_push(skb, sizeof(tx_control)), + &tx_control, sizeof(tx_control)); + memcpy(skb_push(skb, sizeof(pkt_type)), &pkt_type, sizeof(pkt_type)); + + mgmt = (struct mwifiex_ieee80211_mgmt *)skb_put(skb, pkt_len); + memset(mgmt, 0, pkt_len); + mgmt->frame_control = + cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); + memcpy(mgmt->da, req->bss->bssid, ETH_ALEN); + memcpy(mgmt->sa, priv->curr_addr, ETH_ALEN); + memcpy(mgmt->bssid, req->bss->bssid, ETH_ALEN); + memcpy(mgmt->addr4, addr, ETH_ALEN); + + if (req->auth_data_len >= 4) { + if (req->auth_type == NL80211_AUTHTYPE_SAE) { + __le16 *pos = (__le16 *)req->auth_data; + + trans = le16_to_cpu(pos[0]); + status_code = le16_to_cpu(pos[1]); + } + memcpy((u8 *)(&mgmt->u.auth.variable), req->auth_data + 4, + req->auth_data_len - 4); + varptr = (u8 *)&mgmt->u.auth.variable + + (req->auth_data_len - 4); + } + + mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); + mgmt->u.auth.auth_transaction = trans; + mgmt->u.auth.status_code = status_code; + + if (req->ie && req->ie_len) { + if (!varptr) + varptr = (u8 *)&mgmt->u.auth.variable; + memcpy((u8 *)varptr, req->ie, req->ie_len); + } + + priv->auth_flag = HOST_MLME_AUTH_PENDING; + priv->auth_alg = auth_alg; + + skb->priority = WMM_HIGHEST_PRIORITY; + __net_timestamp(skb); + + mwifiex_dbg(priv->adapter, MSG, + "auth: send authentication to %pM\n", req->bss->bssid); + + mwifiex_queue_tx_pkt(priv, skb); + + return 0; +} + +static int +mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_assoc_request *req) +{ + struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); + struct mwifiex_adapter *adapter = priv->adapter; + 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, + "%s: reject infra assoc request in non-STA role\n", + dev->name); + return -EINVAL; + } + + if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags) || + test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { + mwifiex_dbg(adapter, ERROR, + "%s: Ignore association.\t" + "Card removed or FW in bad state\n", + dev->name); + return -EFAULT; + } + + if (priv->auth_alg == WLAN_AUTH_SAE) + priv->auth_flag = HOST_MLME_AUTH_DONE; + + if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) + return -EBUSY; + + if (!mwifiex_stop_bg_scan(priv)) + cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); + + memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); + rcu_read_lock(); + ssid_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); + + if (!ssid_ie) + goto ssid_err; + + 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"); + 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"); + goto ssid_err; + } + rcu_read_unlock(); + + /* As this is new association, clear locally stored + * keys and security related flags + */ + priv->sec_info.wpa_enabled = false; + priv->sec_info.wpa2_enabled = false; + priv->wep_key_curr_index = 0; + priv->sec_info.encryption_mode = 0; + priv->sec_info.is_authtype_auto = 0; + ret = mwifiex_set_encode(priv, NULL, NULL, 0, 0, NULL, 1); + + if (req->crypto.n_ciphers_pairwise) + priv->sec_info.encryption_mode = + req->crypto.ciphers_pairwise[0]; + + if (req->crypto.cipher_group) + priv->sec_info.encryption_mode = req->crypto.cipher_group; + + if (req->ie) + ret = mwifiex_set_gen_ie(priv, req->ie, req->ie_len); + + memcpy(priv->cfg_bssid, req->bss->bssid, ETH_ALEN); + + mwifiex_dbg(priv->adapter, MSG, + "assoc: send association to %pM\n", req->bss->bssid); + + cfg80211_ref_bss(priv->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 { + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + eth_zero_addr(priv->cfg_bssid); + } + + cfg80211_put_bss(priv->adapter->wiphy, req->bss); + + return 0; + +ssid_err: + + rcu_read_unlock(); + return -EFAULT; +} + +static int +mwifiex_cfg80211_deauthenticate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_deauth_request *req) +{ + return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); +} + +static int +mwifiex_cfg80211_disassociate(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_disassoc_request *req) +{ + return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); +} + +static int +mwifiex_cfg80211_probe_client(struct wiphy *wiphy, + struct net_device *dev, const u8 *peer, + u64 *cookie) +{ + return -1; +} + /* station cfg80211 operations */ static struct cfg80211_ops mwifiex_cfg80211_ops = { .add_virtual_intf = mwifiex_add_virtual_intf, @@ -4347,6 +4661,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) "%s: creating new wiphy\n", __func__); return -ENOMEM; } + if (adapter->host_mlme) { + mwifiex_cfg80211_ops.auth = mwifiex_cfg80211_authenticate; + mwifiex_cfg80211_ops.assoc = mwifiex_cfg80211_associate; + mwifiex_cfg80211_ops.deauth = mwifiex_cfg80211_deauthenticate; + mwifiex_cfg80211_ops.disassoc = mwifiex_cfg80211_disassociate; + mwifiex_cfg80211_ops.disconnect = NULL; + mwifiex_cfg80211_ops.connect = NULL; + mwifiex_cfg80211_ops.probe_client = + mwifiex_cfg80211_probe_client; + } wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; wiphy->mgmt_stypes = mwifiex_mgmt_stypes; @@ -4428,6 +4752,9 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) NL80211_FEATURE_LOW_PRIORITY_SCAN | NL80211_FEATURE_NEED_OBSS_SCAN; + if (adapter->host_mlme) + wiphy->features |= NL80211_FEATURE_SAE; + if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info)) wiphy->features |= NL80211_FEATURE_HT_IBSS; diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 3756aa247e77..311af5f40c3e 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -654,7 +654,7 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, if (ret) { mwifiex_dbg(adapter, ERROR, "PREP_CMD: cmd %#x preparation failed\n", - cmd_no); + cmd_no); mwifiex_insert_cmd_to_free_q(adapter, cmd_node); return -1; } @@ -1477,6 +1477,17 @@ int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv, return 0; } +static void mwifiex_check_key_api_ver(struct mwifiex_adapter *adapter) +{ + if (adapter->host_mlme) { + if (adapter->key_api_major_ver != KEY_API_VER_MAJOR_V2) + adapter->host_mlme = false; + mwifiex_dbg(adapter, MSG, "host_mlme: %s, key_api: %d\n", + adapter->host_mlme ? "enable" : "disable", + adapter->key_api_major_ver); + } +} + /* * This function handles the command response of get hardware * specifications. @@ -1586,6 +1597,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, "key_api v%d.%d\n", adapter->key_api_major_ver, adapter->key_api_minor_ver); + mwifiex_check_key_api_ver(adapter); break; case FW_API_VER_ID: adapter->fw_api_ver = diff --git a/drivers/net/wireless/marvell/mwifiex/decl.h b/drivers/net/wireless/marvell/mwifiex/decl.h index 326ffb05d791..f9b21b13d6c3 100644 --- a/drivers/net/wireless/marvell/mwifiex/decl.h +++ b/drivers/net/wireless/marvell/mwifiex/decl.h @@ -24,6 +24,18 @@ #define MWIFIEX_RX_HEADROOM 64 #define MAX_TXPD_SZ 32 #define INTF_HDR_ALIGN 4 +/* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 */ +#define MWIFIEX_MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) +/* 6 = auth_alg + auth_transaction + auth_status */ +#define MWIFIEX_AUTH_BODY_LEN 6 + +#define HOST_MLME_AUTH_PENDING BIT(0) +#define HOST_MLME_AUTH_DONE BIT(1) + +#define HOST_MLME_MGMT_MASK (BIT(IEEE80211_STYPE_AUTH >> 4) | \ + BIT(IEEE80211_STYPE_DEAUTH >> 4) | \ + BIT(IEEE80211_STYPE_DISASSOC >> 4)) +#define AUTH_TX_DEFAULT_WAIT_TIME 2400 #define MWIFIEX_MIN_DATA_HEADER_LEN (MWIFIEX_DMA_ALIGN_SZ + INTF_HDR_ALIGN + \ MAX_TXPD_SZ) diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 8e6db904e5b2..8b22cd993a79 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -209,6 +209,9 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define TLV_TYPE_RANDOM_MAC (PROPRIETARY_TLV_BASE_ID + 236) #define TLV_TYPE_CHAN_ATTR_CFG (PROPRIETARY_TLV_BASE_ID + 237) #define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 279) +#define TLV_TYPE_HOST_MLME (PROPRIETARY_TLV_BASE_ID + 307) +#define TLV_TYPE_SAE_PWE_MODE (PROPRIETARY_TLV_BASE_ID + 339) + #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 @@ -802,6 +805,11 @@ struct mwifiex_ie_types_ssid_param_set { u8 ssid[]; } __packed; +struct mwifiex_ie_types_host_mlme { + struct mwifiex_ie_types_header header; + u8 host_mlme; +} __packed; + struct mwifiex_ie_types_num_probes { struct mwifiex_ie_types_header header; __le16 num_probes; @@ -905,6 +913,13 @@ struct mwifiex_ie_types_tdls_idle_timeout { __le16 value; } __packed; +#define MWIFIEX_AUTHTYPE_SAE 6 + +struct mwifiex_ie_types_sae_pwe_mode { + struct mwifiex_ie_types_header header; + u8 pwe[]; +} __packed; + struct mwifiex_ie_types_rsn_param_set { struct mwifiex_ie_types_header header; u8 rsn_ie[]; diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index c9c58419c37b..f86a527fd7ca 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -81,6 +81,9 @@ int mwifiex_init_priv(struct mwifiex_private *priv) priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR; priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR; + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + priv->sec_info.wep_enabled = 0; priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; priv->sec_info.encryption_mode = 0; diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c index a6e254a1185c..ef7cc40c3ba4 100644 --- a/drivers/net/wireless/marvell/mwifiex/join.c +++ b/drivers/net/wireless/marvell/mwifiex/join.c @@ -382,7 +382,9 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, struct mwifiex_ie_types_ss_param_set *ss_tlv; struct mwifiex_ie_types_rates_param_set *rates_tlv; struct mwifiex_ie_types_auth_type *auth_tlv; + struct mwifiex_ie_types_sae_pwe_mode *sae_pwe_tlv; struct mwifiex_ie_types_chan_list_param_set *chan_tlv; + struct mwifiex_ie_types_host_mlme *host_mlme_tlv; u8 rates[MWIFIEX_SUPPORTED_RATES]; u32 rates_size; u16 tmp_cap; @@ -448,7 +450,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, mwifiex_dbg(priv->adapter, INFO, "info: ASSOC_CMD: rates size = %d\n", rates_size); - /* Add the Authentication type to be used for Auth frames */ + /* Add the Authentication type */ auth_tlv = (struct mwifiex_ie_types_auth_type *) pos; auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type)); @@ -460,6 +462,24 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, pos += sizeof(auth_tlv->header) + le16_to_cpu(auth_tlv->header.len); + if (priv->sec_info.authentication_mode == WLAN_AUTH_SAE) { + auth_tlv->auth_type = cpu_to_le16(MWIFIEX_AUTHTYPE_SAE); + if (bss_desc->bcn_rsnx_ie && + bss_desc->bcn_rsnx_ie->ieee_hdr.len && + (bss_desc->bcn_rsnx_ie->data[0] & + WLAN_RSNX_CAPA_SAE_H2E)) { + sae_pwe_tlv = + (struct mwifiex_ie_types_sae_pwe_mode *)pos; + sae_pwe_tlv->header.type = + cpu_to_le16(TLV_TYPE_SAE_PWE_MODE); + sae_pwe_tlv->header.len = + cpu_to_le16(sizeof(sae_pwe_tlv->pwe[0])); + sae_pwe_tlv->pwe[0] = bss_desc->bcn_rsnx_ie->data[0]; + pos += sizeof(sae_pwe_tlv->header) + + sizeof(sae_pwe_tlv->pwe[0]); + } + } + if (IS_SUPPORT_MULTI_BANDS(priv->adapter) && !(ISSUPP_11NENABLED(priv->adapter->fw_cap_info) && (!bss_desc->disable_11n) && @@ -491,6 +511,16 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, sizeof(struct mwifiex_chan_scan_param_set); } + if (priv->adapter->host_mlme) { + host_mlme_tlv = (struct mwifiex_ie_types_host_mlme *)pos; + host_mlme_tlv->header.type = cpu_to_le16(TLV_TYPE_HOST_MLME); + host_mlme_tlv->header.len = + cpu_to_le16(sizeof(host_mlme_tlv->host_mlme)); + host_mlme_tlv->host_mlme = 1; + pos += sizeof(host_mlme_tlv->header) + + sizeof(host_mlme_tlv->host_mlme); + } + if (!priv->wps.session_enable) { if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled) rsn_ie_len = mwifiex_append_rsn_ie_wpa_wpa2(priv, &pos); @@ -634,6 +664,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, u16 cap_info, status_code, aid; const u8 *ie_ptr; struct ieee80211_ht_operation *assoc_resp_ht_oper; + struct ieee80211_mgmt *hdr; if (!priv->attempted_bss_desc) { mwifiex_dbg(priv->adapter, ERROR, @@ -641,7 +672,19 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, goto done; } - assoc_rsp = (struct ieee_types_assoc_rsp *) &resp->params; + if (adapter->host_mlme) { + hdr = (struct ieee80211_mgmt *)&resp->params; + if (!memcmp(hdr->bssid, + priv->attempted_bss_desc->mac_address, + ETH_ALEN)) + assoc_rsp = (struct ieee_types_assoc_rsp *) + &hdr->u.assoc_resp; + else + assoc_rsp = + (struct ieee_types_assoc_rsp *)&resp->params; + } else { + assoc_rsp = (struct ieee_types_assoc_rsp *)&resp->params; + } cap_info = le16_to_cpu(assoc_rsp->cap_info_bitmap); status_code = le16_to_cpu(assoc_rsp->status_code); @@ -778,7 +821,8 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, priv->adapter->dbg.num_cmd_assoc_success++; - mwifiex_dbg(priv->adapter, INFO, "info: ASSOC_RESP: associated\n"); + mwifiex_dbg(priv->adapter, MSG, "assoc: associated with %pM\n", + priv->attempted_bss_desc->mac_address); /* Add the ra_list here for infra mode as there will be only 1 ra always */ @@ -1491,6 +1535,20 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) if (!priv->media_connected) return 0; + if (priv->adapter->host_mlme) { + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + priv->host_mlme_reg = false; + priv->mgmt_frame_mask = 0; + if (mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, + HostCmd_ACT_GEN_SET, 0, + &priv->mgmt_frame_mask, false)) { + mwifiex_dbg(priv->adapter, ERROR, + "could not unregister mgmt frame rx\n"); + return -1; + } + } + switch (priv->bss_mode) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index d263eae6078c..83449ad84d15 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -384,6 +384,7 @@ struct ieee_types_aid { struct mwifiex_bssdescriptor { u8 mac_address[ETH_ALEN]; + struct cfg80211_bss *bss; struct cfg80211_ssid ssid; u32 privacy; s32 rssi; @@ -426,6 +427,8 @@ struct mwifiex_bssdescriptor { u16 wpa_offset; struct ieee_types_generic *bcn_rsn_ie; u16 rsn_offset; + struct ieee_types_generic *bcn_rsnx_ie; + u16 rsnx_offset; struct ieee_types_generic *bcn_wapi_ie; u16 wapi_offset; u8 *beacon_buf; @@ -527,6 +530,8 @@ struct mwifiex_private { u8 bss_priority; u8 bss_num; u8 bss_started; + u8 auth_flag; + u16 auth_alg; u8 frame_type; u8 curr_addr[ETH_ALEN]; u8 media_connected; @@ -649,6 +654,7 @@ struct mwifiex_private { u16 gen_idx; u8 ap_11n_enabled; u8 ap_11ac_enabled; + bool host_mlme_reg; u32 mgmt_frame_mask; struct mwifiex_roc_cfg roc_cfg; bool scan_aborting; @@ -998,6 +1004,7 @@ struct mwifiex_adapter { bool is_up; bool ext_scan; + bool host_mlme; u8 fw_api_ver; u8 key_api_major_ver, key_api_minor_ver; u8 max_p2p_conn, max_sta_conn; @@ -1063,6 +1070,9 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb); int mwifiex_uap_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb); +void mwifiex_host_mlme_disconnect(struct mwifiex_private *priv, + u16 reason_code, u8 *sa); + int mwifiex_process_mgmt_packet(struct mwifiex_private *priv, struct sk_buff *skb); diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index 72904c275461..7ecff7ce06e4 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -1383,6 +1383,12 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, bss_entry->rsn_offset = (u16) (current_ptr - bss_entry->beacon_buf); break; + case WLAN_EID_RSNX: + bss_entry->bcn_rsnx_ie = + (struct ieee_types_generic *)current_ptr; + bss_entry->rsnx_offset = + (u16)(current_ptr - bss_entry->beacon_buf); + break; case WLAN_EID_BSS_AC_ACCESS_DELAY: bss_entry->bcn_wapi_ie = (struct ieee_types_generic *) current_ptr; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 6462a0ffe698..f5039d158f46 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -331,6 +331,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { .can_dump_fw = false, .can_auto_tdls = false, .can_ext_scan = false, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { @@ -346,6 +347,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { .can_dump_fw = false, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { @@ -361,6 +363,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { .can_dump_fw = false, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { @@ -376,6 +379,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { .can_dump_fw = true, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { @@ -392,6 +396,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { .fw_dump_enh = true, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { @@ -408,6 +413,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { .fw_dump_enh = true, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = true, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { @@ -425,6 +431,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { .fw_dump_enh = true, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { @@ -440,6 +447,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { .can_dump_fw = false, .can_auto_tdls = true, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { @@ -456,6 +464,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { .fw_dump_enh = true, .can_auto_tdls = true, .can_ext_scan = true, + .host_mlme = false, }; static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { @@ -471,6 +480,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { .can_dump_fw = false, .can_auto_tdls = false, .can_ext_scan = true, + .host_mlme = false, }; static struct memory_type_mapping generic_mem_type_map[] = { @@ -563,6 +573,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) card->fw_dump_enh = data->fw_dump_enh; card->can_auto_tdls = data->can_auto_tdls; card->can_ext_scan = data->can_ext_scan; + card->host_mlme = data->host_mlme; INIT_WORK(&card->work, mwifiex_sdio_work); } @@ -2493,6 +2504,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) adapter->num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl); } + adapter->host_mlme = card->host_mlme; + return 0; } diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h index b86a9263a6a8..4f253d8cae42 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.h +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h @@ -255,6 +255,7 @@ struct sdio_mmc_card { bool fw_dump_enh; bool can_auto_tdls; bool can_ext_scan; + bool host_mlme; struct mwifiex_sdio_mpa_tx mpa_tx; struct mwifiex_sdio_mpa_rx mpa_rx; @@ -278,6 +279,7 @@ struct mwifiex_sdio_device { bool fw_dump_enh; bool can_auto_tdls; bool can_ext_scan; + bool host_mlme; }; /* diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index df9cdd10a494..69426ddd9c3a 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -135,6 +135,9 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code, priv->media_connected = false; + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + priv->scan_block = false; priv->port_open = false; @@ -999,10 +1002,17 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) case EVENT_REMAIN_ON_CHAN_EXPIRED: mwifiex_dbg(adapter, EVENT, "event: Remain on channel expired\n"); - cfg80211_remain_on_channel_expired(&priv->wdev, - priv->roc_cfg.cookie, - &priv->roc_cfg.chan, - GFP_ATOMIC); + + if (adapter->host_mlme && + (priv->auth_flag & HOST_MLME_AUTH_PENDING)) { + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + } else { + cfg80211_remain_on_channel_expired(&priv->wdev, + priv->roc_cfg.cookie, + &priv->roc_cfg.chan, + GFP_ATOMIC); + } memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg)); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index a2ad2b53f016..046541713318 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -136,6 +136,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, const struct cfg80211_bss_ies *ies; rcu_read_lock(); + bss_desc->bss = bss; ies = rcu_dereference(bss->ies); beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC); beacon_ie_len = ies->len; @@ -339,7 +340,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, ret = mwifiex_associate(priv, bss_desc); } - if (bss) + if (bss && !priv->adapter->host_mlme) cfg80211_put_bss(priv->adapter->wiphy, bss); } else { /* Adhoc mode */ diff --git a/drivers/net/wireless/marvell/mwifiex/sta_tx.c b/drivers/net/wireless/marvell/mwifiex/sta_tx.c index 70c2790b8e35..9d0ef04ebe02 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_tx.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_tx.c @@ -36,7 +36,7 @@ void mwifiex_process_sta_txpd(struct mwifiex_private *priv, struct txpd *local_tx_pd; struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); unsigned int pad; - u16 pkt_type, pkt_offset; + u16 pkt_type, pkt_length, pkt_offset; int hroom = adapter->intf_hdr_len; pkt_type = mwifiex_is_skb_mgmt_frame(skb) ? PKT_TYPE_MGMT : 0; @@ -49,9 +49,10 @@ void mwifiex_process_sta_txpd(struct mwifiex_private *priv, memset(local_tx_pd, 0, sizeof(struct txpd)); local_tx_pd->bss_num = priv->bss_num; local_tx_pd->bss_type = priv->bss_type; - local_tx_pd->tx_pkt_length = cpu_to_le16((u16)(skb->len - - (sizeof(struct txpd) + - pad))); + pkt_length = (u16)(skb->len - (sizeof(struct txpd) + pad)); + if (pkt_type == PKT_TYPE_MGMT) + pkt_length -= MWIFIEX_MGMT_FRAME_HEADER_SIZE; + local_tx_pd->tx_pkt_length = cpu_to_le16(pkt_length); local_tx_pd->priority = (u8) skb->priority; local_tx_pd->pkt_delay_2ms = diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index e78a201cd150..eb0b8016d43d 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -743,6 +743,29 @@ mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, u16 cmd_action, return 0; } +/* This function prepares AP start up command with or without host MLME + */ +static int mwifiex_cmd_uap_bss_start(struct mwifiex_private *priv, + struct host_cmd_ds_command *cmd) +{ + struct mwifiex_ie_types_host_mlme *tlv; + + cmd->command = cpu_to_le16(HostCmd_CMD_UAP_BSS_START); + cmd->size = S_DS_GEN; + + if (priv->adapter->host_mlme) { + tlv = (struct mwifiex_ie_types_host_mlme *)((u8 *)cmd + cmd->size); + tlv->header.type = cpu_to_le16(TLV_TYPE_HOST_MLME); + tlv->header.len = cpu_to_le16(sizeof(tlv->host_mlme)); + tlv->host_mlme = 1; + cmd->size += sizeof(struct mwifiex_ie_types_host_mlme); + } + + cmd->size = cpu_to_le16(cmd->size); + + return 0; +} + /* This function prepares AP specific deauth command with mac supplied in * function parameter. */ @@ -777,6 +800,9 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, return -1; break; case HostCmd_CMD_UAP_BSS_START: + if (mwifiex_cmd_uap_bss_start(priv, cmd)) + return -1; + break; case HostCmd_CMD_UAP_BSS_STOP: case HOST_CMD_APCMD_SYS_RESET: case HOST_CMD_APCMD_STA_LIST: diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 745b1d925b21..23675c1cecae 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -370,6 +370,46 @@ mwifiex_parse_mgmt_packet(struct mwifiex_private *priv, u8 *payload, u16 len, return 0; } + +/* This function sends deauth packet to the kernel. */ +void mwifiex_host_mlme_disconnect(struct mwifiex_private *priv, + u16 reason_code, u8 *sa) +{ + u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 frame_buf[100]; + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)frame_buf; + + memset(frame_buf, 0, sizeof(frame_buf)); + mgmt->frame_control = (__force __le16)IEEE80211_STYPE_DEAUTH; + mgmt->duration = 0; + mgmt->seq_ctrl = 0; + mgmt->u.deauth.reason_code = (__force __le16)reason_code; + + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) { + memcpy(mgmt->da, broadcast_addr, ETH_ALEN); + memcpy(mgmt->sa, + priv->curr_bss_params.bss_descriptor.mac_address, + ETH_ALEN); + memcpy(mgmt->bssid, priv->cfg_bssid, ETH_ALEN); + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + } else { + memcpy(mgmt->da, priv->curr_addr, ETH_ALEN); + memcpy(mgmt->sa, sa, ETH_ALEN); + memcpy(mgmt->bssid, priv->curr_addr, ETH_ALEN); + } + + if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) { + wiphy_lock(priv->wdev.wiphy); + cfg80211_rx_mlme_mgmt(priv->netdev, frame_buf, 26); + wiphy_unlock(priv->wdev.wiphy); + } else { + cfg80211_rx_mgmt(&priv->wdev, + priv->bss_chandef.chan->center_freq, + 0, frame_buf, 26, 0); + } +} + /* * This function processes the received management packet and send it * to the kernel. @@ -417,6 +457,39 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, pkt_len -= ETH_ALEN; rx_pd->rx_pkt_length = cpu_to_le16(pkt_len); + if (priv->host_mlme_reg && + (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) && + (ieee80211_is_auth(ieee_hdr->frame_control) || + ieee80211_is_deauth(ieee_hdr->frame_control) || + ieee80211_is_disassoc(ieee_hdr->frame_control))) { + if (ieee80211_is_auth(ieee_hdr->frame_control)) { + if (priv->auth_flag & HOST_MLME_AUTH_PENDING) { + if (priv->auth_alg != WLAN_AUTH_SAE) { + priv->auth_flag &= + ~HOST_MLME_AUTH_PENDING; + priv->auth_flag |= + HOST_MLME_AUTH_DONE; + } + } else { + return 0; + } + + mwifiex_dbg(priv->adapter, MSG, + "auth: receive authentication from %pM\n", + ieee_hdr->addr3); + } else { + if (!priv->wdev.connected) + return 0; + + if (ieee80211_is_deauth(ieee_hdr->frame_control)) { + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + } + } + + cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len); + } + cfg80211_rx_mgmt(&priv->wdev, priv->roc_cfg.chan.center_freq, CAL_RSSI(rx_pd->snr, rx_pd->nf), skb->data, pkt_len, 0); From patchwork Fri Oct 20 03:48:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430036 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD4AFC001DF for ; Fri, 20 Oct 2023 03:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346928AbjJTDs0 (ORCPT ); Thu, 19 Oct 2023 23:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376295AbjJTDsX (ORCPT ); Thu, 19 Oct 2023 23:48:23 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597EAD5D; Thu, 19 Oct 2023 20:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BiZu3K0mtrHSZC84pdkDshSiRFEfoLy2VKw6sZsDpfHCPIisn0l9mO/HSXcKwqeb/j35Qz7QNJURGCd9wz0kIvLd4T1JPLk+YIpiiAp8e7hHDYFjFrzs68dZsuag0OwwSh8glTcfKtkePxrYAQ/xVFJZT74/THcQZD2tNiqeAPa954hmLvY6mheS75toNbYLk7lL2XH8Tfa6o+IO9j40rNfM73bFd8fAaAdwDZczSF8ERpwmMBv4su2g7STwa+edI2/cmgfQkrS4sGg/yREe0pXKlaqvMhEnkKx6fLpICVCPKjSCXv2WjYOE+jq8iNRgdMfHsCgbp7DltFPY8X/OeA== 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=XZU9nOm2Yensoyv6sYH4rYubgfZwwZbRFAcGUo23CQI=; b=KIbnbMjLqTeDvtFvnz/J50TBQygxor7bEb3q5oy6C/M4JsCTanbO7aK9cMtxexJdcX0CpQJ6kAo7eF/4IQb94F0tHSxFjISnPmsaArxXlGcy1eEBTCDqNPcfaCPKYzId/9/SlD8QfJO2Ob67l+IXxyuMDLSj6ogl2ImfWhwecDHORvRivRmzWvcvjfHQ8ZmpU4lv8TZEGBiVqAttlsx9i/1grMxVv240GgE/7mH2pOYnEBQudTAiTqGqybySHDVfZwm4DOmFdbAlOgnw7pkVYulmcNPI9n3bxX8VZ8lRV3/II4EDuBFaN7SGSTHVtWueUzkMRHY0sxWGGsRI7z4EiQ== 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=XZU9nOm2Yensoyv6sYH4rYubgfZwwZbRFAcGUo23CQI=; b=rdHiwpxzzgJxgS7tdTRDGb53p1zrdsvdJyqsQMePzfssZ/0kI+h+7W8Fwos3U6b49WwKQWNf4j9osoqCez3no5DZrtm9M6mX3xePHoh49HwRIPXeJPWF+4z3H5wRUSRsuH+qr//2FktUVjmRAWcO7Mr110ajQ0RI1SW5gqnidtc= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:14 +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.6933.011; Fri, 20 Oct 2023 03:48:14 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 2/6] wifi: mwifiex: fixed group rekey issue for WPA3. Thread-Topic: [PATCH v6 2/6] wifi: mwifiex: fixed group rekey issue for WPA3. Thread-Index: AdoDCD/stmTqfaxRSnefie6i84io6w== Date: Fri, 20 Oct 2023 03:48:14 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 146c5c20-63b0-4820-8e00-08dbd11f6368 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JCX6Rv23ajLYjX45aBk+OmdhxGZLJ0ZIhUwOcVKlLZhmex8WawMXtpQPrHSjgxwlJLSHimf6WKeGWz9Zwtx4ccifW5fXg2SqPH8HsUEpjEFAZn5GDw59q/zn/A0StQsTJUv+RDoUsjQzh8v1tP27vcV8lJKjEte49uIeO30W2E6Qqk7myXbFoM8qopQB+gfdb5QrBHJSyNTo8v3ky0cMfxVAxXhrrt/ZTLWjFhZmKm6lrV14E6nEVDnUfoEvwq4DN6Bh04y5HVht1eff8Zp1LPYWHSbR875NhW/zAimTDOpe6yiMnMskOhEvxPMYqf9DkiLPJKkrF2JP9GfHD6go55qVr61GdaiVPgl90Yl/d99vxoplNiqbuynxroESpd7u+mYEKl1HTztG1YfNy+Z4Rud+AULlyBAvZz+XmOuYLP5UPJAsngPBC5knDi+kJFcv1NmXw/JpMy3j3o/I8c94m5EEwatVc7TXR+G8OBki/v/+8ifwKYGp9R/jNqyZe9OX7KCkGjzlUtEiosgSlEzcKEr4KEqthJhj0bH5WeRbaf7wRdShulNFlgvoRMy1w1rzsmJSdnstNekcPkrJFsdluQ4ESnOdmYWFUS1Un3+4PAQfH3559DvEkzHQARpxdMa9 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(55016003)(38100700002)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: YeECtiLEdD/Otcs/BdcG2uCxJKJ7h7JBxObI1glMrjy6g9Qu9jZ1845ZYdRsYkAK1eRD7NB2UJYwHz7iOrsfjK0/wohCkaLc06f9biSyTmA4Ky7E+5HgQ+AffAfmuXe2WT4pGYuM0/Grbumhvy6oBv31DuD+CrNmKyN5q5wD6Xm83jnee/M1J3uqTigj3lAsAv948DRs3gCPY1BKfJCwqdq+y6dAUhj3c1yvVLM8obkAEURNJ/4CkwQV5ksHjwq6pKkVRInw+plybCiVj6rcLeSPpRHDFhIUhbhIm5YeKLUMZi3q+clOU75S9DL0Uaetw8V8BUdmKh2XLFz+we9FG45pEOLrUq7QmY5vG3JY9S8AF+GpRyDQUFXvGcSOdU3k6kSRrYa7jLliL1TzRWVjzYfi9xkX8/JE5jTHsYUgUY45h0xuxR7Vdr6+Y2VEcmJ2PezRD66u92GZnEumNOLF8adUE7h0yghD6t5MXB16imW5L9QmA0LAYuHN82UUjNGBdsWtjsG7oXZu2jGia3DydbVCa2xfv90vFIw6d2mnRDrgsaHLVKNo/kDltqfdYToxewSiXOa1j1GQaYI96VhjwhcH36IbrtxGaJHR205QgMo/4OR0/YeGXeAIB0Ywv9AyIg0lnv17ePkN5pNwlEUwP+Snx67bltmIJ5ntlQATVmtIX427nAsMLAc7foUdarJgz1NoRV5gYOMUxOwf7CKXqN1gdKtBCXZ8j8IiXKBNzjUHWgQRhfmY7bomFAs0tlFzDiL/E4X6DtiXTFyBS+rUpdP0NlnP3Xv2eJV3iVttM5JMob28NhNrkFaN3cjksxs1XOak2VRSRn3gkZlrIResCk+QnUprxBqOc7+3TOneOOfBn0+vYq3vQQMUR+J+BSkSOBcWtFAfPX2rwfkTswZHl3yOEW+VBKESfqwKf9WUpLo7xmK3XJ8UnXFuKHk5ZSAiK5952cQ2V0JbSxFdfZF1a4XJ48EqksdOL5U8xms3sDeeNUr4NdidzwwXfaY1WlBkbeylX6fOfG9GoE7EtLbyTFmohFjm6E+YTzIBuPx0OHQ40ku1ZcmmvSrLRfAvcPXXw3+1x94jAMnGv3iyOfJes1DlZSl7lOMnopcEgdptIg8amMNvvK+0n6PBmCK2mY+VH9PseQb8O9Y+yW2huZnV4ljFZ8PGTYvSlcCeeiroESd+XhutHGNk0AFC5++agGDtFngG9uCLq3OOG6Z74PLpUvTwIOBgtbWwi8ekYc4n/up2xe4wJGyuds0m9uFalPineMfZC0Q/M3HjGu8VY7DaGk/LWb+9VO+5JNpWCjMT4ht9ZvtHFgsbBBniIWqCsBghuVdsk+Lkn5Feh1ilETnJAOsKe1jBVl99VA12K/qLx2WsBvmwhNfTK2T4u3j9aCBeM9DId5EzKYtFM6UxIfmyt5hMbTyxbPwmhHTLZw+JR0L5Txs2yzFsCONiiEzITMskNMmt6gj6YscSgzqwohNrN9GowD3EdX5Yl2l8QwAT0kk56CAcf+G8uCK4el4vbXe4w+3FUkGaY+KF6L0UguXoMrZnwGxHMQkFZYE4RBiptjosm0lgIfDx8gHP4khQEC0m MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 146c5c20-63b0-4820-8e00-08dbd11f6368 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:14.4890 (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: R9m/CRGz0jniHWJVHF12GPL5iXt1Qdveq8V43S/1v0x7PVRwRpJ4LwvEHzmgUVqtSgv90EOe3JPXO91Ine4k+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If host mlme is enabled, gropu rekey offload should be disabled. Signed-off-by: David Lin --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 3 +++ drivers/net/wireless/marvell/mwifiex/main.c | 4 ++++ drivers/net/wireless/marvell/mwifiex/util.c | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 40c39e4765f7..3d59e6a441b9 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3657,6 +3657,9 @@ static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info)) return -EOPNOTSUPP; + if (priv->adapter->host_mlme) + return 0; + return mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, HostCmd_ACT_GEN_SET, 0, data, true); } diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index d99127dc466e..3bebb6c37604 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -802,6 +802,10 @@ mwifiex_bypass_tx_queue(struct mwifiex_private *priv, "bypass txqueue; eth type %#x, mgmt %d\n", ntohs(eth_hdr->h_proto), mwifiex_is_skb_mgmt_frame(skb)); + if (ntohs(eth_hdr->h_proto) == ETH_P_PAE) + mwifiex_dbg(priv->adapter, MSG, + "key: send EAPOL to %pM\n", + eth_hdr->h_dest); return true; } diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 23675c1cecae..ff1b2f162c30 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -482,8 +482,15 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, return 0; if (ieee80211_is_deauth(ieee_hdr->frame_control)) { + mwifiex_dbg(priv->adapter, MSG, + "auth: receive deauth from %pM\n", + ieee_hdr->addr3); priv->auth_flag = 0; priv->auth_alg = 0xFFFF; + } else { + mwifiex_dbg(priv->adapter, MSG, + "assoc: receive disasso from %pM\n", + ieee_hdr->addr3); } } From patchwork Fri Oct 20 03:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430037 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F549CDB474 for ; Fri, 20 Oct 2023 03:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376294AbjJTDs3 (ORCPT ); Thu, 19 Oct 2023 23:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346903AbjJTDs0 (ORCPT ); Thu, 19 Oct 2023 23:48:26 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C9B5D6D; Thu, 19 Oct 2023 20:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FRsiYkBRwYEISV0mMtD8nJSl6GK2DudrD2EBQG3+sN9y4GohpbXbrpXdEwy7KVfeqFdeM0Z40Cm9/14/nSrTOC+VEtNwQF+KALV6WYHT5llKrW4Fq9HebW1+ReAE3KBYd5X+d6FoBWNe82MyQDuzBM1kVbIU7rzF3Us5nBMUgvtAtcD0Q5QoNRF2IeMV0OiRbjRfT1NxRAD+Wk1Dkuk2Yk4jOUdbuTvxdQIax163mKp3arM1w4XCM1LTuKchAuTMY5WDOsY77uibbc8lhq7qVcSUnj+o5sWOn3QSKdiKR9HnlCF/xgpw3NvkIzRPkGT+gN3TyB6QULEq3ovohrr8Rw== 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=oWRcRKmudbqI0qax2S4mo8MMj1VvT9eC/WKABK8rIuU=; b=ZwGqSqIsw5TG+w4B6eViCpm6W1O2OI6YFQr7HPzdvCuW2BwAwvXEVMAWMkn6zTXqbkBjwfCbCZeRU/2MDNaxzC2vZ6HcXUl7jm+GVgH2P6JPDkl+g14RFtQDTpfSgofeonWkW9vW2UhnVAvAEqpHe1T1F+0A4eyUHhr3D5iG7tKgtHSy9fp8T2XLIny0Hva9lDo+gPz5g4tZj19ssRYgmuwUcsh5YKzYXaUjxe/7zeInD/vagecmkGPCAM7YtUkJ/bwUPA91670hEoxiYd8bGDJf+jG568UbCi8QF6CAAX+SoONnsMW3eJfTOQBqYQqnXPN0SUWcECS2TJyMmggcLA== 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=oWRcRKmudbqI0qax2S4mo8MMj1VvT9eC/WKABK8rIuU=; b=ESPEU+zYGvwHjCgfCnaz5oTs7SEDR14Funhzm05uM4QXgseAHKx2SUWW4pzAPOVeljFdwmjWG1zkcgmp5W0qqJuXc5cZPZYTM3xSjzkSQXKjoVhOiHuITo2iWhUtwPXSXb/yjcVAqXK2zL0WuiZWn4Y6OerNnyGhIc9Yksj0XFo= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:18 +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.6933.011; Fri, 20 Oct 2023 03:48:18 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 3/6] wifi: mwifiex: fixed reassocation issue for WPA3. Thread-Topic: [PATCH v6 3/6] wifi: mwifiex: fixed reassocation issue for WPA3. Thread-Index: AdoDCEJxeqzS6xZwTgO7r0FJr3DzXg== Date: Fri, 20 Oct 2023 03:48:18 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 0a19f5d0-4237-47d3-19cd-08dbd11f65f1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LqiAaTNomxCmNJtmUoFX/m5xYIWNs1jN1uWtFEtStHsH6gsFsfgt4jPfy1RgTWCpLdloO44tZ40c8aj28Nfn8aUMFkDSWwgWdOVu6nuOoFCSmFLwNP/1/dHlqFNw0C63GbxVmdqon7ncTcyOan4/OsShB4hm0QQgeEMwkBQtr2zGAEdYoc7uPjScvHx00jOJ2/iJMliNLHO+ew8kR0SHrfV/QIyO+VIZrX54uQEA6qlCxu0VXbrbIVVNLj5onYBYt+zHwOAh/qvx2vy+5b6N5X6k5cOJWP0fFkfOrArzoTdWugoDVMl9+vm7Yi+R8jRi6K5Y5IZFffJUnhEJDaN/4YtACFWXTzqorGO/xwW2XjVlmjzwed9p/xu27gsRRKKSC2EoK1mHOT1SziuKmjTIY2kwcFSntusu6c5/UuxblUpvi/BXUd8xv0WBSJMh5Azqmk7hVd1J7ZBCFPGAB29QaOSybAlGdfTvOLLI0GCXeeu0LQckgh2NZUhes6BnHL4N5PX/POAQvbTPAXp9pVzLyJVOkfELa3MMpNbgoFTLGjdXeu6AScyBpkkEAxefpssIhItMTCtxjsQV31Px8MAoNm1Ujpt+Qu4Bg6OAQfQhGc8grg5WTTxVOuAYjYlH4Csq 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(55016003)(38100700002)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 4TNAOIhXvU0xmZTH030DM/P32GTPIhQNHLoBFiOlinidjzbt4ixfKmELlwzg4vhgyj67Jt4MP1J6ejVjxFBLcoSkpuKx6ZWr83Ku1s4hxdm9tIukBIy/14/ChmDjBGOd6NhnkQAMwpYXk/gn0xpEKD0UF2QQMqZfpxGsGqghGKldIinOZrGO0BME7SwA01X2dltvsN7pA7vq2tSeiCoVnXAkLp3YUMkGCdd0FQ2QD4bTZ3JwLPsMy60JKUZs7y6smyukRI5RWsgDs2RzBHV28FOZOU8DUXgmH/O3htCdFchd3GW5A7DVTpprs9v+0aZD3VofLabYB6dNaA24l9+T9jd24OiuUhP8hotdwXlFkBcbHFdvYysC4h+srs/nhpd6hFD7YQadyLdimnnaTpHOQgUZ7E9vuLDl13aTn4sTvPHHJAZNAkahWoN8RP2fAutZFrRsCDeOxxN2DNWKay0tAWWyEwNhUCxogRQi8scjxkcOKh0DIexUj91ZF6zv5aArYRot6ZBJnrps9/GUzZ500UkLB5DGdY0GeYH7clKhENR/0xIdIeLqXh6FnyQtrTVU215v4X8pq4NQb9QbBlOVbWD5kGeGqoloXx20x+RsYOpmnLblzh0mCIW5PtJHD0Bw2OYtfg68H/yRplHYwGPVfrO9ArXYQk8oGT/ryeroFT/VRBNKwob+3fHF4YzKHp61eO9JF4drLM7dbHS2Px+9Qx3Hd0BQh88umx1yEFEYuHrJazv2AFEu4J7Z8f6w/EWQfzBzc5sYDnNrU17b+ohHMAfIH88Um6oGwOmJDEhj5G1Fv3Zo2TEGvD4XblBBFm9e+dbS2kwaCvj3d+JYr/hhhOZx9AM6jWc2alMOHmfsPDtkWIra7yHGNhJYAQXYi8prOXXPVhi/gG7Q3waKM4GUXlnmDU+0DBvoMBwbnmr1b94CrhdvGuApHPGK8sjrqQUpERmvPsVHI7pkxsrPEV8mavb/1z8y6R0hLv1cmgdZQFN/14e9pEFDepu0XVXbzmxmiA4Ihjjnks73UDKFQeGpDcVaJAcNth09tKIWtmh0QqTGIvjMIOV7PvF/z9KDWoEF3tlEBo8/ZRR4dYhng9xeaMt9+miPAMC0VBvGUz8yNUa9/JOBB3E/GJb+d79WJOCAhNz8OHZieZra6ZxYy3h3409ChxE2FDTpM1M4ZN4Dc3Gw1OtX8VQ7/JIBo7npAeEXnY52cL/vNloM4OtRlkPMoLkmLkoJkKL744REIj6HDdqJFl5IOtLwwBt8uY0CGEvEA9uaZtGPXruKja9XYvTEKKYK+GS6JI1U1Rk0J7KFR3WUoLOmpU/56Uz4p5qohloy/sWJylNFF+8fx9f260diOiME/3rAtHtv7qzlqxefWgxx/b73DGf4i+FoDpvqK3G49P5rp66CUZNfa2ohEJpy3HdgSGUj52yFBc3U6FDJr/K50pS+aN4k+sCzmiraPaH9pZIvkq7Oqx/43FuQ4dBwq/bHi2XHtVqjYDcO+c2Yu558ILuhYtLgAhrGEI0itN+YFZM9VgLpt7tK7yXkFHDdLOGiEGmWmXzAYJEtjnZtNSFxRKdoW8LzMGN0lBNZeAmt MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a19f5d0-4237-47d3-19cd-08dbd11f65f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:18.7311 (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: 2Gd5ZLNpi4Dhy6bBJY+ZdwpfGbC8abUoWG9L9pWCdWqFgcpI0f+buUQYyli0NLPuWpViKbU5hoGTgh6XVSOf5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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, From patchwork Fri Oct 20 03:48:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430038 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91887CDB474 for ; Fri, 20 Oct 2023 03:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376289AbjJTDsr (ORCPT ); Thu, 19 Oct 2023 23:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376280AbjJTDsa (ORCPT ); Thu, 19 Oct 2023 23:48:30 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5EBD63; Thu, 19 Oct 2023 20:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQ7OJFMikuS79Uo4KUc5eG3Ri8jpfNYbu0x+a08lIQqGPSqcyhHgYvRK2eSoWcw/KtgVvxGsUZDpHtlnHac/dCaLb2zP2ELwjRaBWQty2lHpQvqLzN3B75WnDeAFRqVqJ0SaK50LdEIeohSkGtiHTbkT2XZt+pceJpwSqhIFh+oWtG0Vx1Qw2bovdIFVsP4fp9znSwdNSynMoHUlkLYqh3zfhyo+HoEwukdswQZGE1s3MzuwjV0GiCPuw1pCGwmJBqurgUeBIQTbytdbffSHIiXya23v3nTCBzmtW9K/o+sPkviisvwUdFdJ2iXXuYHWDuFL7+yRgt8ZOGUtaX/Vag== 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=x4g8aiFpAPO46rCCo4fpIYzWi8yIvh5ziB7zpPcJZQQ=; b=OwTY3yB4ersACrdc4H/Zi7Ba41C7sa3rmEAXepSz34b7ViFAiq6ggCGL4Zdswz6HmPxoyjA8//zoBVD3o4m426Ri4FAGEOFoVpBetXPxaPUl2wqWrYpNSRjAgDtqtVmm0xYqmxzh5i2n0M7L3pm6i0bv0YPH1ouzZswTTSV78tok8nhcGzus0DSDQaBo7dVn1NoUW8vdUmdvt5MvlaFm1p9RtI2+9KMGylkWbRYxbGWvuIXE3N3nJhnbfJLqmGQn38OzsfdNp1O0gH/9m9v0w07t8Izc79fKvtvvQHQ0fRMsX2wb58gbr2o+xteqGyhe9+uuEqXMNU4S/54i5NoTpQ== 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=x4g8aiFpAPO46rCCo4fpIYzWi8yIvh5ziB7zpPcJZQQ=; b=VjyA59KZiSJbl3paJPqEF6Rs8lpVD7k+YaqQz5Ckqthoh5Kn/nMwr47CdEFp82e2h6tt3K6EEJx2whOgdTymOHTugzg6QfUkjVH3ZO7AVoPNYkul6uSnFgakIXWKBY6eaqcFIn1zaXX1f+IjJRUnaZ1AGsY5p8mlhCHDYolV1Hg= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:22 +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.6933.011; Fri, 20 Oct 2023 03:48:22 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 4/6] wifi: mwifiex: fixed missing WMM IE for assoc req. Thread-Topic: [PATCH v6 4/6] wifi: mwifiex: fixed missing WMM IE for assoc req. Thread-Index: AdoDCER83S1icFhzSwGFhocieyul/g== Date: Fri, 20 Oct 2023 03:48:22 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 23f643a8-b00c-4d0f-1c55-08dbd11f6807 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mcymvGXyMF8HRHKuqa0nUa3dINIRZnDO4xj5qk/bxvNDULWhLxYNEQLT9hGCtgP0eHO1oQgzFOhZAOeSgDmZITSF9APDGkJoLFCI9DesVQyAFL4yLSHz3xVs2fFIf1MBDpguvLHbLdxQRKvzfSmKXyGW16eSISTR1/8MztXzjwOPn71cQHV51kzRw9QaMBp0gQ4yeZYQ6oHsLNbEy4bw51ZDCNEnLpd5vdUhLB+PQzep9NlHYQw5S/FgnteMwnil5ppHSeYhGC/agct6VVi4DSDsyHoDX3an4M6k46UYH8slklVUAn5uZpS/xB5wr/IIYL2nohF7Fc7JbAleit3Vktoxjf6VJXLD5PMFrtz+H/mA3+4c01m0Ollw+QDh5uqljq+7WpV/Sc+GN8vE2balHlDj2giwLxQw3Jv/ezD4zXd45guyJExqeUXaRUpsXHUyyDyTOPlZfmnXqLrk60v9+Tkkz1kYK8dLGR+RaDuq539MGKcAfs8WyN9AqBSOJ1Rk1PAAUpxXjyhoa3ih2uWIDSrWXbvBsVy69SqmXzdUyFsRvPMcVj0H3P1Vav0mdk97VZPZv90igNM2aGwzTlaTjc1kJI9qhX7Jj2XVwfTdW76k9vwgrmFyRutyNDqLibvR 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(55016003)(38100700002)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: NSYPu+LyCMZZYWEImssSGaLrnMprUNzWuJjjShMEQqciGYC/bVjDUZB5Llf8GtGhHvVatZjgyJQMgYfr9q1BoDGPjDlOGe39yXxFZsClLIlMhBShstN0lQh3E0jcKnR7lJg9GLJVjjkE0qPIDb0plBEa1hn8jZuvF9Qc8DiuYtLJNNOUqMzoz+qvEAonptUbQvyV2Cz1Etr642fjQcJnqZmPmrjx3or8ej4Bv0aLnG77QGjIxFTKCgKLK82QkSmBnZdJtsQ9mVwo/MVazN2OEtMYe6AIOJjHdG5llgC9zZ40gVhLkRuIt3vOUTgMxHBcEZL4QYc+JknedBL1PUthhOmWaL8xs4OFf93m2wVtQDCNc7pez9kIZI7pf1JtPvKqj1zjSlPByWOIpQekfkZPk+4wjl+FBhH1nD8c38nJ9ODeAvmN50bEC2wE4jH3lIU2Fg6UVXoFpaDNFg1zwTNg695Dfvu6HCP/B5nimEdWEqJm7V6dIyLdLJOuiSE53pQLipkmJqDkgMPq1J9Q2JRxmbDyokwsHW+5nt9kVulr/nma5k+DcIFuXMRtPKtElq+89Cie6iSI/1PipksyJkNX3j2LLLVhrRQsNs3jJ7kT3jRg0N/sZfbBhOBCSB4FO9KILxgz8IpRbxqQb+iPpFsu0W5HLyfTOE5YDyoG+q4BemmXBh2JImcS4830FDatfEuYnWI/n0Ucu7kq66is/7XT1pIvdBKjXWdLx2izlkV/PQ0gKc5uKd/NseWRFOgtnZTZfTtAmEx9w4oLO5V7WxQ9wiO82U5UMgSEkI3Ipf7rMa/624XK9bY6j426Lyo3a8AtVzVkMO5lLwZvO27MwWH6XUKYqEeZHwHKXPYsGk0YSwGFmTXjPHkqhexq77+K0nCnhWDS9P+LwIkPjrBdtAFY0DUyjgTKRCXz6VQZRajp3qrXKnUcb7URLThQNLnSw0a0UsuvySY0GKFAicrztjygu0v61basG6CwU+nzkMYjt0kO+7DViZ8g9p+u0DnkpgWCkrNrJ1Nvl7ie5+HYmxIcOrtee8FGwHykvC/EVlE4MOs/znq7VQLcOMlfYFi4fVC08OCsSpqova/YRFVPWCxhssFT+2GovO3+2hG+vZeIDFua2oDWeBjYhG7i+zE69Aq6KLq731XmDiz9+mM+U/HnnS2uf2bVWtixu4NXeMKu7nuESxZ7wVMTResCzuCAqLnuxtgu3I0A8URqIg2uyRVd+wZ61Zq2vz2VRpSBGdD4VbWX0MoBv+McnLasY6NefbfrDGVR/I6jFgXRexU2AXS5s0M9V20rtwZlcDaJu/ETkyyuNgEgiE5d05ruDJjIiOTZ7uWNeO0nTvUyWGSZwcoUIBow0GrqSVFic4LySIWjBk+gWGHf7Rq5imq7FYBJV4a14q310nYcxA8kLCaFuam/CD64i1B6OFhBSegPVghez30yj+vB7FIZjrPl3EnPTXBVjBnejBqhzO+WkebP2QRhYrUHHDnkbxTRL6fBO/QyifIZ2VDZOO6Xkkxb3Ub/apq8kazIRwmDxKTItUsDNh37+gkfDMAtfJdTHyeCWaZBpmNqn0xeBdK09OCxlt2349RT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23f643a8-b00c-4d0f-1c55-08dbd11f6807 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:22.1936 (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: UKlplxEwlwwljH/bNF5/rL3yZeED4qbtnly43mw5/8KP9yjhzaGd4RhblED4/4TE5jOaySMOxFXNpTN3J/Ozgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Remain on channel must be removed after authentication is done. Otherwise WMM setting for assoiation request will be removed. Signed-off-by: David Lin --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a21310f3807c..b99de9f4ca14 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4306,6 +4306,8 @@ mwifiex_cfg80211_authenticate(struct wiphy *wiphy, if (!ret) { priv->roc_cfg.cookie = get_random_u32() | 1; priv->roc_cfg.chan = *req->bss->channel; + } else { + return -EFAULT; } } @@ -4418,6 +4420,16 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) return -EBUSY; + if (priv->roc_cfg.cookie) { + ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_REMOVE, + &priv->roc_cfg.chan, 0); + if (!ret) + memset(&priv->roc_cfg, 0, + sizeof(struct mwifiex_roc_cfg)); + else + return -EFAULT; + } + if (!mwifiex_stop_bg_scan(priv)) cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); From patchwork Fri Oct 20 03:48:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430039 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25AB6CDB474 for ; Fri, 20 Oct 2023 03:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376280AbjJTDtL (ORCPT ); Thu, 19 Oct 2023 23:49:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346999AbjJTDsr (ORCPT ); Thu, 19 Oct 2023 23:48:47 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE96D79; Thu, 19 Oct 2023 20:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W02nkRRnBXUDFETs+KKZwlJtEextIB74atQQ5c2rG9qpbU1O+A8/zC5D/lEGMypW5cq2mGXBGV/t+aEze9YyvW8EC7oHxiXF8lNj+Cc1bCBYKS9lsZ56AquFXmf5Em4SDtfsjbVJpceBSSZwMFA9kP2KLjJJl8z+S+psH2EnrSl3/O2M34iIke3AseKkZ8lcOjoc/i9jJvmujcDayCyzr5X22W+PKZg7X1cKnVYg5yZTzrSdtP7BTIx2FK2rVCkHCEt5ZxIAC+8qm5AlejLF77+x0Z1tgRynCWEBfUcNu9F4hKdU2V3sf3Kf6FurTiBy16CxMUFWAH54fe/gcCHokA== 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=ysWULn5r2ulql1x1U1BTLzMnHQqNo1+u/i7q/0e68l8=; b=Q4uDmWI6wVDiHQdBr5dQ5a5qJn4hf/VXH7vNEip8qQIPQD2ZRA34NOu2iqA68dQOyAPFqaVeaRPHLUN7nUWulEZmRjzjWQ/0+vebKnyMoX+SuF5GpGrYVd/ZgX9f+8IV9qkzGxN/THwp90Jx7YI2jChqfVHGT92FU4nVicToGTfdKeJXtzyLFcJLMO1uBPXqaZ4Te68tFNr3XsXah4gHDpQl+6GTF56KNjjiXST5gm/g/60AtmGZl2Io9nbGe7t8SQyDkxcT0oZ3a7U3Mqy12F0W1m9Ch8RPoZ75UudQwgpdZvHwSu7GIn+9i6awlTz4Grw3WJ3L0tIyxImlLamlSQ== 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=ysWULn5r2ulql1x1U1BTLzMnHQqNo1+u/i7q/0e68l8=; b=hw3LFGrb4ULlbEqow12ie/uaHZyFQXqCKBYk8gWppqt+BYlIAjnRhKtBIa2Qc3y+kVCic4AgRtOZg+XwXIi9DpYDKOlhUvnbayj9Iv89GGGsPDvPrVJTKIIAHrUKZ1yMEbv8fWTAR8uReTtpYyhrCMvRjKdhzPR+aT6ZTYor7CU= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:26 +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.6933.011; Fri, 20 Oct 2023 03:48:26 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 5/6] wifi: mwifiex: supported host mlme for AP mode. Thread-Topic: [PATCH v6 5/6] wifi: mwifiex: supported host mlme for AP mode. Thread-Index: AdoDCEZkNa8a4Iv/RwSnAs5s8DeG7A== Date: Fri, 20 Oct 2023 03:48:25 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 400d4f01-ade9-43e5-d8a8-08dbd11f6a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: s9SWoCx5LcNqXLLvrBLglXzYEjn7S3t12Ii6ElwvY7IYulI6XAjAuTlRxpJ7OTEfc7TmB+aEoLJwzzlWHPO3S19fgK6OiESo057YTpgGymZH4lCOTqXjvh0H9XXk/4TJvEzt2MHdyLSBsgnJQrgTcK45VZZIHQI00dIX+93bjPm38XvPLPm8wOjQKxZhybUmnHtnZXETVcE5rRjIkdSOLHUUhDgUdxLpOnxvDE2C5QH1V+EJdr1XwVUQPepBmBcO35/4UHoSjhzdOMZeJbdMzUKo/SJdVdlVpbYbOGOB8Rwq6bHAioI6LsAynpIRSJupjDtukrATJi0hMeOV5+SHOID1Ih1Ud8I3Ci6QL6TjFLznp3pYBVKom7ZUvkoKrF4CxsPWQjZasjOuz/hX8E1i3ay7mI0VuCPNyspmMsIt7fJ5HAgrX5ZLV2X5DDfIMZgJAsOQ9MZLK3rPMpCbEJPHN7aRagLIB8fgwrhpN/LaDdT0yVSSopjNn9rdMOre7aWF52je0bOwIhHidta4EAwWnnJYbb143DlEobacR03l0LhMzuWPEkY3gN5nuohh3WCoTsRtaNvg1r/hTJPQBFYC5hLyovCIsH3OVwYLRkAM58+5ud0BrByZWuPHSQzjV1Nm 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(30864003)(55016003)(38100700002)(66899024)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 7GGLCbpP7Uz94/AIqzCO5KtdRpCsdiKTTgT5FM6aK3Ls1Ahd6ZXYFuiuWvHL1qLP4u/QNTt+NYXb8VkczMDgJkafI6PRQBW8WhLhK0XPp9fTlsiI893k5YlCzNm6qjD2NtsFxmTDYOy0sKrZlftG3Z6XDeXnBPw/yoSXEedpaIHeo79mCs+dD9x/KUAUkzAk0nH7SehJ03sMN8vQNcItuD3wyLAp+NAOfjxm3YchqRz6YV684O9Yv9gLJFqxG68L/LrxWptOERzKaEqHXzlLKcAgSzzMRczbrHiIK7ICYjbSPkVGJOPoRD8WrVyZ7/e9i4+9BvZTPXVc2YGOfSa2I01by2Vc0SCdT6A+xrPG5tNOnPUGGkasx18ZDBkn3KxUNr7SUTMwb+Lm2IGYLpXHQy06eL+JYx1gt7JN2mMf9Q5QYOBC4TpqvwOTjpkzgb34qMrCswo1lu3gEuRvM7iKk4OkwEdzFkYV1HEiQ0zOmANjoQnqF+gTb3EZt3hCE7cw8mZv+/d9X/gMyceCfhRunPToObRWSCVO4ncqzU974/9eBSZWAteI/g75RvhaGaqnVryYy4wLs8X01tqFfRCMIAXIK18xeiXn87Ln0LX7RZtGaRZlAFD2HItbu/rMjWj0mBNXyjL7cepGrvGvRzyiLUMe3PTMp82PbvUc11cmypnt/sX2RowU+aXamwcI6UmHlh4/J6QzDoE+zYkrhRJlFi9JtJLfsMUWsdfUErqg81YTfctmTr/VNXE2bACAjpKt9GMwBlme8n4FS54A0cFGD4StW3oQFczW8bC5MwNcoUnUFR0H6TE5EJW6qo58hmjYdmHLXfCQbz3OSTXPzfAL0SsfE1FhMwmajY6pFqdFhTky5qYMV2jYIt8VUJggM4mRTk8FWzlh+ZWtA5FVQ+2gZsRDrhK5/R2Na6T1l7a5GpfODliZ3LYNVUIDMUgLwLo5Bx8PHYVLzTt7aXXu758nP3d9odtkeDRxz6izIX7Y5J3GI0XmI7SN0L3zzkRsYpPtdRK+ShhSjCXBjVYA+CP+OdhEn5NwIsKyrH+wNPoN0Dy2vHE+JjX9RLrL0/rHOP1QkymwNGn41bzJMz8VshMi7aj7NmVNaDtSNdW7A5K2Oe/OI6GCjJ/p2e+5fKc7FM7UNXWKkDQMzmX7DuJ92PI4YjskdiJaxqrZRsSdw7jSr9Amjzb3sBPloBDuFRNGwGSfjkqxaHJZhHWcYIFG5IwzIbgyeER0jGBrdoe/tHKtjzEwCzo19Ezf/F+tO1/AVpPjRi7cwIlsSfmPI7v3uUQfuCh1BB3pZy3W//fWL8b1zrhMzjR05uEvB5VyFuIP8FRoQwU/7q5NURwkneWGpj7FhuaBSsJWODVBN9H3nnuZxgiIKVxBTokJg/SqXkYLewTP2KYF4JUWCM/Z8NtetjpsPtSr9GXLLbDJwi+zY+CD7SxmOOVFRaz9HCMpoZpEDuPbEYuwszYDzrdb1tg/DErfRraHuMYMTmCvh6rCc691P9IiIMqQaKfXmLCXdOWjJXT8NHvlnq5hC++vMmpbXwQMYfIyPxFwrf71egXaiQiJMsuo7riwTgED7V+4oxUoshET MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 400d4f01-ade9-43e5-d8a8-08dbd11f6a4c X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:26.0125 (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: KRv8oYlaSjePJIZ6dPdw+rz+cr0x0RYNsZCY2sE00zhOtHU0FRRUrnKhZ3jMzdfn/pPCPXx+xMHFT5p4LNVp2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Added code to support host mlme for AP mode and let WPA3 work. Signed-off-by: David Lin --- .../net/wireless/marvell/mwifiex/cfg80211.c | 81 +++++++++- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 + drivers/net/wireless/marvell/mwifiex/fw.h | 22 ++- drivers/net/wireless/marvell/mwifiex/ioctl.h | 5 + .../wireless/marvell/mwifiex/sta_cmdresp.c | 2 + .../net/wireless/marvell/mwifiex/uap_cmd.c | 148 ++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/util.c | 24 +++ 7 files changed, 276 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index b99de9f4ca14..2968db643ab4 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -246,6 +246,26 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, return 0; } + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { + if (ieee80211_is_auth(mgmt->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "auth: send auth to %pM\n", mgmt->da); + if (ieee80211_is_deauth(mgmt->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "auth: send deauth to %pM\n", mgmt->da); + if (ieee80211_is_disassoc(mgmt->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: send disassoc to %pM\n", mgmt->da); + if (ieee80211_is_assoc_resp(mgmt->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: send assoc resp to %pM\n", + mgmt->da); + if (ieee80211_is_reassoc_resp(mgmt->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: send reassoc resp to %pM\n", + mgmt->da); + } + pkt_len = len + ETH_ALEN; skb = dev_alloc_skb(MWIFIEX_MIN_DATA_HEADER_LEN + MWIFIEX_MGMT_FRAME_HEADER_SIZE + @@ -293,7 +313,8 @@ mwifiex_cfg80211_update_mgmt_frame_registrations(struct wiphy *wiphy, if (mask != priv->mgmt_frame_mask) { priv->mgmt_frame_mask = mask; - if (priv->host_mlme_reg) + if (priv->host_mlme_reg && + GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, HostCmd_ACT_GEN_SET, 0, @@ -530,6 +551,9 @@ mwifiex_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, wiphy_dbg(wiphy, "set default mgmt key, key index=%d\n", key_index); + if (priv->adapter->host_mlme) + return 0; + memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key)); encrypt_key.key_len = WLAN_KEY_LEN_CCMP; encrypt_key.key_index = key_index; @@ -1746,10 +1770,14 @@ mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES] = { BIT(IEEE80211_STYPE_PROBE_REQ >> 4), }, [NL80211_IFTYPE_AP] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4), }, [NL80211_IFTYPE_P2P_CLIENT] = { .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | @@ -3974,12 +4002,43 @@ mwifiex_cfg80211_tdls_cancel_chan_switch(struct wiphy *wiphy, } } +static int +mwifiex_cfg80211_uap_add_station(struct mwifiex_private *priv, const u8 *mac, + struct station_parameters *params) +{ + struct mwifiex_sta_info add_sta; + int ret; + + memcpy(add_sta.peer_mac, mac, ETH_ALEN); + add_sta.params = params; + + ret = mwifiex_send_cmd(priv, HostCmd_CMD_ADD_NEW_STATION, + HostCmd_ACT_ADD_STA, 0, (void *)&add_sta, true); + + if (!ret) { + struct station_info *sinfo = NULL; + + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + + if (sinfo) { + cfg80211_new_sta(priv->netdev, mac, sinfo, GFP_KERNEL); + kfree(sinfo); + } + } + + return ret; +} + static int mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); + if (priv->adapter->host_mlme && + (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)) + return mwifiex_cfg80211_uap_add_station(priv, mac, params); + if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) return -EOPNOTSUPP; @@ -4217,6 +4276,10 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, int ret; struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); + if (priv->adapter->host_mlme && + (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)) + return 0; + /* we support change_station handler only for TDLS peers*/ if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) return -EOPNOTSUPP; @@ -4727,14 +4790,18 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) ether_addr_copy(wiphy->perm_addr, adapter->perm_addr); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | + wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | WIPHY_FLAG_AP_UAPSD | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | WIPHY_FLAG_HAS_CHANNEL_SWITCH | WIPHY_FLAG_NETNS_OK | WIPHY_FLAG_PS_ON_BY_DEFAULT; + if (adapter->host_mlme) + wiphy->flags |= WIPHY_FLAG_REPORTS_OBSS; + else + wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; + if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 16777af50097..c8d94cc6706f 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -635,6 +635,8 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, case HostCmd_CMD_UAP_STA_DEAUTH: case HOST_CMD_APCMD_SYS_RESET: case HOST_CMD_APCMD_STA_LIST: + case HostCmd_CMD_CHAN_REPORT_REQUEST: + case HostCmd_CMD_ADD_NEW_STATION: ret = mwifiex_uap_prepare_cmd(priv, cmd_no, cmd_action, cmd_oid, data_buf, cmd_ptr); diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 8b22cd993a79..7080f8701952 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -210,9 +210,9 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define TLV_TYPE_CHAN_ATTR_CFG (PROPRIETARY_TLV_BASE_ID + 237) #define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 279) #define TLV_TYPE_HOST_MLME (PROPRIETARY_TLV_BASE_ID + 307) +#define TLV_TYPE_UAP_STA_FLAGS (PROPRIETARY_TLV_BASE_ID + 313) #define TLV_TYPE_SAE_PWE_MODE (PROPRIETARY_TLV_BASE_ID + 339) - #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 #define SSN_MASK 0xfff0 @@ -407,6 +407,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define HostCmd_CMD_STA_CONFIGURE 0x023f #define HostCmd_CMD_CHAN_REGION_CFG 0x0242 #define HostCmd_CMD_PACKET_AGGR_CTRL 0x0251 +#define HostCmd_CMD_ADD_NEW_STATION 0x025f #define PROTOCOL_NO_SECURITY 0x01 #define PROTOCOL_STATIC_WEP 0x02 @@ -417,6 +418,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define KEY_MGMT_NONE 0x04 #define KEY_MGMT_PSK 0x02 #define KEY_MGMT_EAP 0x01 +#define KEY_MGMT_SAE 0x400 #define CIPHER_TKIP 0x04 #define CIPHER_AES_CCMP 0x08 #define VALID_CIPHER_BITMAP 0x0c @@ -502,6 +504,9 @@ enum mwifiex_channel_flags { #define HostCmd_ACT_GET_TX 0x0008 #define HostCmd_ACT_GET_BOTH 0x000c +#define HostCmd_ACT_REMOVE_STA 0x0 +#define HostCmd_ACT_ADD_STA 0x1 + #define RF_ANTENNA_AUTO 0xFFFF #define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) \ @@ -2312,6 +2317,20 @@ struct host_cmd_ds_sta_configure { u8 tlv_buffer[]; } __packed; +struct mwifiex_ie_types_sta_flag { + struct mwifiex_ie_types_header header; + __le32 sta_flags; +} __packed; + +struct host_cmd_ds_add_station { + __le16 action; + __le16 aid; + u8 peer_mac[ETH_ALEN]; + __le32 listen_interval; + __le16 cap_info; + u8 tlv[]; +} __packed; + struct host_cmd_ds_command { __le16 command; __le16 size; @@ -2390,6 +2409,7 @@ struct host_cmd_ds_command { struct host_cmd_ds_chan_region_cfg reg_cfg; struct host_cmd_ds_pkt_aggr_ctrl pkt_aggr_ctrl; struct host_cmd_ds_sta_configure sta_cfg; + struct host_cmd_ds_add_station sta_info; } params; } __packed; diff --git a/drivers/net/wireless/marvell/mwifiex/ioctl.h b/drivers/net/wireless/marvell/mwifiex/ioctl.h index 091e7ca79376..80ba79ca74c5 100644 --- a/drivers/net/wireless/marvell/mwifiex/ioctl.h +++ b/drivers/net/wireless/marvell/mwifiex/ioctl.h @@ -157,6 +157,11 @@ struct mwifiex_bss_info { u8 bssid[ETH_ALEN]; }; +struct mwifiex_sta_info { + u8 peer_mac[ETH_ALEN]; + struct station_parameters *params; +}; + #define MAX_NUM_TID 8 #define MAX_RX_WINSIZE 64 diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 7b69d27e0c0e..9c53825f222d 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -1398,6 +1398,8 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, break; case HostCmd_CMD_UAP_STA_DEAUTH: break; + case HostCmd_CMD_ADD_NEW_STATION: + break; case HOST_CMD_APCMD_SYS_RESET: break; case HostCmd_CMD_MEF_CFG: diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index eb0b8016d43d..91a8a581e3f5 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -72,6 +72,10 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, bss_config->key_mgmt = KEY_MGMT_PSK; } break; + case WLAN_AKM_SUITE_SAE: + bss_config->protocol = PROTOCOL_WPA2; + bss_config->key_mgmt = KEY_MGMT_SAE; + break; default: break; } @@ -783,6 +787,145 @@ static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv, return 0; } +/* This function prepares AP specific add station command. + */ +static int mwifiex_cmd_uap_add_station(struct mwifiex_private *priv, + struct host_cmd_ds_command *cmd, + u16 cmd_action, void *data_buf) +{ + struct host_cmd_ds_add_station *new_sta = &cmd->params.sta_info; + struct mwifiex_sta_info *add_sta = (struct mwifiex_sta_info *)data_buf; + struct station_parameters *params = add_sta->params; + struct mwifiex_sta_node *sta_ptr; + u8 *pos; + u8 qos_capa; + u16 header_len = sizeof(struct mwifiex_ie_types_header); + u16 tlv_len; + struct mwifiex_ie_types_header *tlv; + struct mwifiex_ie_types_sta_flag *sta_flag; + int i; + + cmd->command = cpu_to_le16(HostCmd_CMD_ADD_NEW_STATION); + new_sta->action = cpu_to_le16(cmd_action); + cmd->size = sizeof(struct host_cmd_ds_add_station) + S_DS_GEN; + + if (cmd_action == HostCmd_ACT_ADD_STA) + sta_ptr = mwifiex_add_sta_entry(priv, add_sta->peer_mac); + else + sta_ptr = mwifiex_get_sta_entry(priv, add_sta->peer_mac); + + if (!sta_ptr) + return -1; + + memcpy(new_sta->peer_mac, add_sta->peer_mac, ETH_ALEN); + + if (cmd_action == HostCmd_ACT_REMOVE_STA) + goto done; + + new_sta->aid = cpu_to_le16(params->aid); + new_sta->listen_interval = cpu_to_le32(params->listen_interval); + new_sta->cap_info = cpu_to_le16(params->capability); + + pos = new_sta->tlv; + + if (params->sta_flags_set & NL80211_STA_FLAG_WME) + sta_ptr->is_wmm_enabled = 1; + sta_flag = (struct mwifiex_ie_types_sta_flag *)pos; + sta_flag->header.type = cpu_to_le16(TLV_TYPE_UAP_STA_FLAGS); + sta_flag->header.len = cpu_to_le16(sizeof(__le32)); + sta_flag->sta_flags = cpu_to_le32(params->sta_flags_set); + pos += sizeof(struct mwifiex_ie_types_sta_flag); + cmd->size += sizeof(struct mwifiex_ie_types_sta_flag); + + if (params->ext_capab_len) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY); + tlv_len = params->ext_capab_len; + tlv->len = cpu_to_le16(tlv_len); + memcpy(tlv + header_len, params->ext_capab, tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + } + + if (params->link_sta_params.supported_rates_len) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_SUPP_RATES); + tlv_len = params->link_sta_params.supported_rates_len; + tlv->len = cpu_to_le16(tlv_len); + memcpy(tlv + header_len, + params->link_sta_params.supported_rates, tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + } + + if (params->uapsd_queues || params->max_sp) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_QOS_CAPA); + tlv_len = sizeof(qos_capa); + tlv->len = cpu_to_le16(tlv_len); + qos_capa = params->uapsd_queues | (params->max_sp << 5); + memcpy(tlv + header_len, &qos_capa, tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + sta_ptr->is_wmm_enabled = 1; + } + + if (params->link_sta_params.ht_capa) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); + tlv_len = sizeof(struct ieee80211_ht_cap); + tlv->len = cpu_to_le16(tlv_len); + memcpy(tlv + header_len, params->link_sta_params.ht_capa, + tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + sta_ptr->is_11n_enabled = 1; + sta_ptr->max_amsdu = + le16_to_cpu(params->link_sta_params.ht_capa->cap_info) & + IEEE80211_HT_CAP_MAX_AMSDU ? + MWIFIEX_TX_DATA_BUF_SIZE_8K : + MWIFIEX_TX_DATA_BUF_SIZE_4K; + } + + if (params->link_sta_params.vht_capa) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY); + tlv_len = sizeof(struct ieee80211_vht_cap); + tlv->len = cpu_to_le16(tlv_len); + memcpy(tlv + header_len, params->link_sta_params.vht_capa, + tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + sta_ptr->is_11ac_enabled = 1; + } + + if (params->link_sta_params.opmode_notif_used) { + tlv = (struct mwifiex_ie_types_header *)pos; + tlv->type = cpu_to_le16(WLAN_EID_OPMODE_NOTIF); + tlv_len = sizeof(u8); + tlv->len = cpu_to_le16(tlv_len); + memcpy(tlv + header_len, params->link_sta_params.opmode_notif, + tlv_len); + pos += (header_len + tlv_len); + cmd->size += (header_len + tlv_len); + } + + for (i = 0; i < MAX_NUM_TID; i++) { + if (sta_ptr->is_11n_enabled) + sta_ptr->ampdu_sta[i] = + priv->aggr_prio_tbl[i].ampdu_user; + else + sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; + } + + memset(sta_ptr->rx_seq, 0xff, sizeof(sta_ptr->rx_seq)); + +done: + cmd->size = cpu_to_le16(cmd->size); + + return 0; +} + /* This function prepares the AP specific commands before sending them * to the firmware. * This is a generic function which calls specific command preparation @@ -818,6 +961,11 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, data_buf)) return -1; break; + case HostCmd_CMD_ADD_NEW_STATION: + if (mwifiex_cmd_uap_add_station(priv, cmd, cmd_action, + data_buf)) + return -1; + break; default: mwifiex_dbg(priv->adapter, ERROR, "PREP_CMD: unknown cmd %#x\n", cmd_no); diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index ff1b2f162c30..9e36bb4a8d67 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -497,6 +497,30 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len); } + if (priv->adapter->host_mlme && + (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)) { + if (ieee80211_is_auth(ieee_hdr->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "auth: receive auth from %pM\n", + ieee_hdr->addr2); + if (ieee80211_is_deauth(ieee_hdr->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "auth: receive deauth from %pM\n", + ieee_hdr->addr2); + if (ieee80211_is_disassoc(ieee_hdr->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: receive disassoc from %pM\n", + ieee_hdr->addr2); + if (ieee80211_is_assoc_req(ieee_hdr->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: receive assoc req from %pM\n", + ieee_hdr->addr2); + if (ieee80211_is_reassoc_req(ieee_hdr->frame_control)) + mwifiex_dbg(priv->adapter, MSG, + "assoc: receive reassoc req from %pM\n", + ieee_hdr->addr2); + } + cfg80211_rx_mgmt(&priv->wdev, priv->roc_cfg.chan.center_freq, CAL_RSSI(rx_pd->snr, rx_pd->nf), skb->data, pkt_len, 0); From patchwork Fri Oct 20 03:49:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430040 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47AD3C001DF for ; Fri, 20 Oct 2023 03:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347005AbjJTDt3 (ORCPT ); Thu, 19 Oct 2023 23:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376308AbjJTDtV (ORCPT ); Thu, 19 Oct 2023 23:49:21 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2075.outbound.protection.outlook.com [40.107.15.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC6910CF; Thu, 19 Oct 2023 20:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WTAdg+XgK5DLroIa2oAvmZ7aPy0nvRC6FthqyZ+a3a1G3SCzzcOvMBnsgUMKoGNu/tvOiKc+WDuVgS9GtfGgbtE/HORFqWNzP78DqHd2hFP9qh58jE9zrhP6EOrfnfzNtr7e1QYFVsrmSQRdwkmEF/LkdrXXoUCtpk3sfLB//yC833yKTRue3Av+HRAaYa4J4CPgmij4LMDEVAW7F71QqTUCKIsxG5XuTtgAOuDgpy9lutXQkpcC1ovyTBMTc2i9iVXIllXZO493yelbUHJ8YRDtT181C3TVm0dyA9mYJ6Rb3kj/38whMU3HZmGybI5uPGg1KD9pYIUkr1b2ZaIniA== 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=tfNYCrQm/wK2XnczQIVZkD5iyQbQTHVwNb/d7iSrOvE=; b=oOr3dmFWHW53k8XIbzOVDzq4vT9OQ+NJMRsT7lEzGFV/WmYE0/rtTfC5QS+OAAPqlnkVQ1mVVNu7FweJHzp8tCmFgl/Aj9OGTBitm1/AxUUi9Kx9byxDDLp8jx/eViFXeQmJzVoCytYhcWs87kJgUULtRuJr0n/dSFm9sTkQWjE8jrDekJ4jJYLA1EPFTGD8pP08VpRttbkbarabfAnlMe76pAE9fIzp8GMqhhTZPcwhDLz+FpDVhOFapQseh0reJijHf2GCGvpxEfAosCfaC7w/DZWBhDkrG4NTYcaiYXmzrPzb0Yo+cDMdIALWgSoy91TlXYFg+mZ89KSSOAcFAA== 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=tfNYCrQm/wK2XnczQIVZkD5iyQbQTHVwNb/d7iSrOvE=; b=LlcjMbyadq5QsqozzjGSzamIiorA4gF+Rdy8lPaMkTDrqVlfWvLOAzhiYHZi0uxhuZupNOCf7lFUTFuIqo11sUcWHDI2/MThyUMfkGpLy+j8mzV0xsj274vlYn4ktfy2XqidaMcXl2eQs2yIo/ZMLySwD60y83Nz/yyeNEGNFXk= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:49:13 +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.6933.011; Fri, 20 Oct 2023 03:49:13 +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" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 6/6] wifi: mwifiex: added mac address for AP config. Thread-Topic: [PATCH v6 6/6] wifi: mwifiex: added mac address for AP config. Thread-Index: AdoDCGMYrPaKM3X4QW2qaT7OzNDnMw== Date: Fri, 20 Oct 2023 03:49:13 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 9ce86412-14c7-4a9b-b57c-08dbd11f86a8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: j++zEnhkMaZltlSVpYc0QQdpp8uj/Ko6l3b57ZRAEglEZQ+86hoWPcjwQSxtt5fFnfkDhyA5mgZTzVa+JFL5MlS+SGQpYLzfvZXo77R2hQh9ZoihxEw77k9MV0E7yxGBg2sUCEXq0o10bTjhFI+Q8O4s+LVmW3gURzxV/h9VDRAW56ErXikyhgCmyYQTNCgs+cGnfCEKCFD8WZ/qe7ekp3jHyBy5MG9GSeIeeWExIhaB1QvQt8SPp9DZCqXHie7HZQ/7JRhre78c8bZrr8V8EETqq4yNOVxE8lJeSPWDb8IIn12arTcWUjrVYIS624PntPqDszQQzRXZXOrhaDSJGy713egnJE3Ive57NWDZYwFJaPzNo+bs5Z72D3JOhtixae+Zm5AgQ44ZLwPO60wflCVeUtDMkex0MxdKqXbsuqzmXpauiITX+484ACS08J3aKsM54gUFGXw7Tjf99GZ0WwTzZYFezQBx/XpeKjx4McdvJh/hryW3/AT1l6inPj0iEJEhtEQS9rl6bVHP85qFGYyeppl6HI4q1qG67DYLa2IOxJ+gtcquz1RCE7TOHA5EcQ2BisjIRuOy+QgEfj0q3LFUBMKkciHtIrDgUwFpHeyrzLp7N0X62NHIBjwFi4UM 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)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(55016003)(38100700002)(66899024)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: rX9R94XQO3pukemvqQe/lUSdldg8344a5P+GPa7pkLpBXbTsyUlIlytb20rD8+2I7RZ7ldHois1v25eFku7yUA2xNmXhyX6G9OrP7xcE3VeL1r4F7CaT80hFg7rO9H4WXG2L8QlsZfLtn2O1CfW7+0ShruQK/LCP9p9K3Egkq9Y/WzuUZf+lvZKIOTFT9fPyHDpS8sjIwggZG/+QphaIIyQPnDGNgzbZG+nnISUeXjDKH0AgX0dFOlG4iwnyI5TEGVXszSKfTLW9fByPssX23QdcPOUPqFLgOQ1/tuao/jBsmShtZM4IF34WUOxlqA0PrT6h32ZyumNLppy0TIfCwF2STmvkbGP09E10zOovSBXjpX+j/VwETfq5J6iteNy0g+kb1ULp4JJzW9zTyJ0WFBImkUeBD0szhn/DkMmIO0zrEjH8C2cIZqjhWIbOSZ5o7d5HGpJ5OVATFEQmStzvDFJcA53+ge2+OJl7CVkpQbdRXrjd+cljj4rzkgJmxcxwi7EMgXCEdWymxIgLkeDbAWV/Wmch5F9446H/O4FeG0k/BBJwaFF//MgzSY7EUqrsEf7LcQazt1SMd4ERpGujuLtQcDOVTnJ7b44VwkjXz74w+fWVs9+l3Xz3JMS7rzGQNG2tOgBv06P0A4D+YMpOcb5XtRNyKBbtGQU3Udusg7LLyn4dcfIoufq+hMo8Yn4IogPTtMEcyR5WQYpE4SgaWgzQG2c6OzXcvQigA/BQ+/urliCCiSnG10DJacg91z8k2ikHylaAM+s71NrZfc5fcyC3AW6PeZ4erntL6JBsBuyPyz2CMLo3700hnDW3HBpbiX5SoyT1gfEibPVERxdgH0uWJHFrwRzEEz/EcXve2sYHZ8JAXFy+ghzySpDMYALew8+hsWcwm52YUXcDm7IWGISWQHdSBQmWR8eAqhtMI+t2zNII1kldBKLsW0dJsaubtP1CnhYErnPqDRfNM0JK0uuJvDm+K4zvA7vs38oBVDDM/agjYlwReQj2a+J4X6oe3BVN6hEv4J4twlUf4sCgWGUtoT7zfNs/Z+rYv6F6yyZ5XU8zqHAnPFgl24aG8cQ5Nxs8DRYbunKHmrx7DBHfz/yz806qkOQ/FIi0MGK3W6kkTGz8Nd7XxX0oiNnYrJrjAFGYxjA2UnEtY5Yit1sZ1GbdFs0PstkFpUwhGe46C38oLlqcRoxLNYaa8zi22SjZN0t1F0Tgvt19qD/f8vS/FpU5VmZ082k0qTH2hGQ7Rw5mzEI/Z8DBNNrGV54tTk7TgeNY+kHSqeE/TgdLCQP4hTAqG6accUP8QlzhU8WgI9OG/Tav3KK4nelpMFaMYIfsh5JBbIzoeYq3laEk9xfIywZLgNEz3xxj3hYSZkyC5lCYrZIJ599Ula7OHMmM7O39KvcFroGAwkJo9xD45t12E3roE5djeos1tmfQZlpntMUFqc8E7EIaPCVuns7tQmtkBHrQiDM4U/z7Nv4fWJkON/QgPzbaIcKRtKQxTEq73Rux1x9Wk84UVL4wD9AIyGiCg9gBELiy35Doau5w/9czKWncFZ7/d2nhAZ0ki2Er0viieqVmvJZRJmbv/kZ46+Pd MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ce86412-14c7-4a9b-b57c-08dbd11f86a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:49:13.6182 (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: s1v0RSa9PoCLBtfwNxP1ouPtv2StqwdZH9XF/rnLA5YO2V+D66SuwVBmHb5uV+tJl9mYaQfUpsqQ02urOyG1Tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Added TLV command TLV_TYPE_UAP_MAC_ADDRESS for AP configuration. Without this TLV command, client can't connect to AP after restart of hostapd. Signed-off-by: David Lin --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++ drivers/net/wireless/marvell/mwifiex/fw.h | 1 + drivers/net/wireless/marvell/mwifiex/ioctl.h | 1 + drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 8 ++++++++ 4 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 2968db643ab4..40ab3e8d0c1c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2103,6 +2103,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, mwifiex_set_sys_config_invalid_data(bss_cfg); + memcpy(bss_cfg->mac_addr, priv->curr_addr, ETH_ALEN); + if (params->beacon_interval) bss_cfg->beacon_period = params->beacon_interval; if (params->dtim_period) diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 7080f8701952..699c7ffcd0e5 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -165,6 +165,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32) #define TLV_TYPE_BSSID (PROPRIETARY_TLV_BASE_ID + 35) #define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) +#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 43) #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) diff --git a/drivers/net/wireless/marvell/mwifiex/ioctl.h b/drivers/net/wireless/marvell/mwifiex/ioctl.h index 80ba79ca74c5..fbbb5aafb803 100644 --- a/drivers/net/wireless/marvell/mwifiex/ioctl.h +++ b/drivers/net/wireless/marvell/mwifiex/ioctl.h @@ -83,6 +83,7 @@ struct wep_key { #define MWIFIEX_OPERATING_CLASSES 16 struct mwifiex_uap_bss_param { + u8 mac_addr[ETH_ALEN]; u8 channel; u8 band_cfg; u16 rts_threshold; diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 91a8a581e3f5..c1133da28bc6 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -472,6 +472,7 @@ void mwifiex_config_uap_11d(struct mwifiex_private *priv, static int mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) { + struct host_cmd_tlv_mac_addr *mac_tlv; struct host_cmd_tlv_dtim_period *dtim_period; struct host_cmd_tlv_beacon_period *beacon_period; struct host_cmd_tlv_ssid *ssid; @@ -491,6 +492,13 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) int i; u16 cmd_size = *param_size; + mac_tlv = (struct host_cmd_tlv_mac_addr *)tlv; + mac_tlv->header.type = cpu_to_le16(TLV_TYPE_UAP_MAC_ADDRESS); + mac_tlv->header.len = cpu_to_le16(ETH_ALEN); + memcpy(mac_tlv->mac_addr, bss_cfg->mac_addr, ETH_ALEN); + cmd_size += sizeof(struct host_cmd_tlv_mac_addr); + tlv += sizeof(struct host_cmd_tlv_mac_addr); + if (bss_cfg->ssid.ssid_len) { ssid = (struct host_cmd_tlv_ssid *)tlv; ssid->header.type = cpu_to_le16(TLV_TYPE_UAP_SSID);