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: 736904 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);