From patchwork Fri Oct 20 03:34:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430003 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 F0E7ACDB47E for ; Fri, 20 Oct 2023 03:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346972AbjJTDe7 (ORCPT ); Thu, 19 Oct 2023 23:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346943AbjJTDex (ORCPT ); Thu, 19 Oct 2023 23:34:53 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2052.outbound.protection.outlook.com [40.107.7.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A74510C8; Thu, 19 Oct 2023 20:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1qDks0oxTIJXILdUuVc8Pi2b808ZZKrqadTNCbj5ZzJSSae9TSZfQCW2v9KuGZLAXztt7YdOaUI66IvMoHppVDJg5XM5DqRtKUTJI4xbwZDBVtRodaYxKJqd2nv4mkjK1/yxI6Gue2GhVzHG/7KB16TM+7l8hgESas0dYu0rzH/reC53yisVrPtglM5nvH8hYztjVbCinFC4rQryrGRIIvZ515iC0dYw5fv8VjZcTAiHcB3ESR9sdF5sSrYYPZUfX1TtaKiVpxs8f28GogX4l3xEgLw7WOixG5S9SKpYsta0pc0o8GIs5544K7lwd6z/do9d0v9reVJOjhtwfEObg== 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=j1ZVY9e1xs69Vnok9GtX9PAIlEDSqMHn6XF5ACmkOoM=; b=OZbS+D6AbLEL//d6Ehrf5hw4oDHPch7xeK7GoD3geZ+dJ4inxvyxyHCCEvEkp2awaAST0Vw/mNftyNGBFQzFSanZ2NbVCYKb23BsCrZALzlddYYM4oAw2WdbfNB2KDqyl9gru+065B0esvOM3tC3LTbD+QjT8wOengwBz+6H74XBKePTc2Dk3x+IiI9CuohDN7o6b9UAEiwRyuw/UfA21037p7AML1U79dRYiI36vieEuWvm8kLo1f1RRdZ4h7YcQ2oENH4CLizmebXk8QTB7AIAfEMFLKjdlOHeVZbBFppZ6bjufg199xfxkLLu/4yBLQZcSgVnvLl5bPc29eKu4A== 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=j1ZVY9e1xs69Vnok9GtX9PAIlEDSqMHn6XF5ACmkOoM=; b=QtlIQacAO3Oz6rShriaYfH8NMNF4XRfB6dPm/Zgy+pR6sl7jQeuTTBxrjXR+0RHLzMKZJ2mIzJIEcdJ/yi54CxoAIeCd33htlH5U69mdc7F6kWmW8v5yPuL2++PshJLiJTZNe2RKF7sQH/arU8TqRODFbxAzaTYLV52bo8ojqvQ= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by PR3PR04MB7306.eurprd04.prod.outlook.com (2603:10a6:102:81::13) 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:34: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:34:17 +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 v5 5/6] wifi: mwifiex: supported host mlme for AP mode. Thread-Topic: [PATCH v5 5/6] wifi: mwifiex: supported host mlme for AP mode. Thread-Index: AdoDBkz0gevPPdLTR0CvTnP7UaV03w== Date: Fri, 20 Oct 2023 03:34:17 +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_|PR3PR04MB7306:EE_ x-ms-office365-filtering-correlation-id: 0ec5e178-c15f-47be-1251-08dbd11d70a4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0bo8dom66iEHzGWcW1GGfDJj0OscuhFdhR3hN/WzvIz7MKSfVRzLcRyrSsfHbOhOoz3fUSSEJJBpqfykqaB3MS/kKzJlQ9fGuUysXwXiyw9Ok7vddLMtvOV0oVA5h2K4wSmuQSdzzVFRUUXAcgNIM45hakR6VYlYQnqCqfrcfLzKvKbc6igmhnBS7prj7Lxet6YNV5NyHn9TZ06GVqIQuAyMjVlJ8bKUCnr/IdmLmv5ZThON+wGrkxeQIa+Embe+K3psf60Lhp1NHzR/WYh2tvCSyJXQ4dm5IMuRPNPQILrI3O+zYPFtSb79a9rGiK72tZWKHC/dh2TwBBuI87bkPf6/YX3l2dAaCh7drOAmZq//UKKO81hR7CSOgDnB3ZGRdtMLgR3+8avKs5BeU4qdDBsRB+NB8ckaYK455GSDon5EoaZo8CHZorDUDpyAthHmqWe9kLGnw+qZEBGahsaCb4uqcfgWpt62wfE+6bE4/zASuds3gJHMO+tWo2kIBSxU/CUClUTyhwt6/wSOPpSJ7QnO5ONYbpZY0EYea7GL/xTeUDMMxoRXb5eolMjKzX3/64GdhJIskFD9fZpon7kbKzxoD9Aa0pQukgDCcb0IEYw3Qcyd2/tnKnu3vo0DsZlT 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)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(478600001)(26005)(7696005)(9686003)(83380400001)(6506007)(122000001)(38100700002)(33656002)(66899024)(71200400001)(66446008)(6916009)(66946007)(66556008)(66476007)(54906003)(64756008)(316002)(76116006)(41300700001)(52536014)(86362001)(38070700009)(5660300002)(8936002)(8676002)(4326008)(55016003)(2906002)(30864003)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 5Q6zILPLTPIeWjr5tor3jGEHSZvgdJeEE2xIiukI2t2v6mq5gf9dSGrBBEHyzZxRBxYN71nAjJAHA9KFtoSyp4YXkkpzTzHXOOMV2NQnp67AzFf1WO9zpPjqis1GJ/A630XwT92YRj39BDJs5w6T/fSVn0Nq4xpuJYTI9Ym3euEU6aumjDINtd4qFtQE5J9wFnyos5t/WQc7BE6k33bbqNq0T4xJ4hVGr6RnR3C4XUadUtpTJSFD4CGdEAbZ53BQI0wmOiTnqFhKVsAMD5aQuaNnBEJJuoJ5ZZxPOXWHsYk49dDHjL3VT0fasmJ9/h8y7LSYejcWfhiLrLDEu+vz1akHC3PmZwj9Xj/UVrVKCH8pF6WLgGHXaVUbH6bRcrZNdA5F5m1Dw2jwcn4RYF1ZkpgCAZ8XbuLDvzTnZNgcCxE2125l/kjm+HKGaWs8fs92iZu6OmaVlIz+3JJbcSFR+K1whneEHrN3C7WdI8tcCrpiRw/dRcyW7MltfCQ7p777UIqArqaOEH+5jESfaCGHWrdVOrboHszSvwRQ8Bvp0BuA4kLiBhZ2qGZyMo8BGNGEYXbvm+IBp5urx3uGLJb0Sjckx40xvV0o59Z/SvtngP5EcYT2d5mnHHE90e2wm8nSuQ9k5zhex9z9sBULzCntBtGjTTCtSzpmrdLn/StvIg1MyX+xw73bMvo/rlE4LfAviRG8dRuJxsVbHKq2AfWbIEOL3hppvrDfwIfZtjlBHgxSyFzIU8o+lHoczrQ/LlFAJlQ4/MzzVnBtGlXAbA8l54jhtrzqffqghESJf19KrQpWebAQ03981mZp+FWwSOTMhh0+v+P8JgQ8/zQ4r+vgqXMNcB6WQsmt6LudRA06sEqj78xsy4OS+erBZdITyj/z5KOkgGzgVh3YhKbV+0cXz2lQ58WYcH9SHQsvLoNXNF4BTRndsYgG+5hqmLXft0XBJtNU7Cyo5g2PjE3FDVKSfAXea8pO4w+RS5eSsudANWqZYQkR70xuKdH5KDPqpFeefwZyfMBFxktJgNysj633qoDb9RWdc9OUUFbrVqKsj02J53YmjkiJ7GTfTG96ES2ssoJf77NrVGjq+zwK4cyUOuNeeJq93zFh0ID9w5G1RRlwaSxdlcqM1+Qvc5vak1VSYNLJp/8wTLbIE+4o3Cymf/zu2D5nmxQdz+xU+tnQ3koOJ2MbPbMKYIf0eF0ZKEuYBl5RHJlUK8JrT/aCEy2nQi8F3BGNFqHbT/jwI4No80//5CvjyyS3xCOhCFXFmRu3Z74vaGpB8r2ZRewWlBqoc1z+OQnjdSewiVDV9cBv4dIav/F/4LlywgbXAHmxRht+/usZRNV10gZzN5YxQZF+UUA9vQ1T5M1KKwo9euxQbQn7q8WFSHii3NesyjyU7aPH7Kz3t415FZb17i5uAX9Mp7+RUBTiuaAAmIZorJUHbyPsSQXn0E7deg3rit+WuHPculVW0P1p5q/YxcI/ekO1b3S9KI5vNqVA0AO4SMCdzmIFkRkjs4vXgTV2PmW6YkA8ANwbmQqb6nkwr2N2aPrzwNthFvRIIlbAfoB7gpkG2X18k2LHpX8fgQyo/dy3FHcz 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: 0ec5e178-c15f-47be-1251-08dbd11d70a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:34:17.6535 (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: ZjbtJztrUvlo/X6TBPgOK+fmXEKETMZEefQVqNsIXdohfWQMQ+Dtmwt4mGj9JTqKGhz/vZ/B7PiuwK1R0EVRNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7306 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);