From patchwork Mon May 23 14:09:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 12859119 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 991A2C433EF for ; Mon, 23 May 2022 14:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236906AbiEWOJR (ORCPT ); Mon, 23 May 2022 10:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236900AbiEWOJM (ORCPT ); Mon, 23 May 2022 10:09:12 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42EFE590A8 for ; Mon, 23 May 2022 07:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1653314951; x=1684850951; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KsH5sYE2u2YRHQc9eXQt5Tfd+tPOiENJz897/d76V4Y=; b=sE7HJvz6gwHmZW/OH02BURyegu4KtskZDIu93KWqlUcT3n1r1r3/zYLJ gE1JMlSI/bDOLp/nr4v67npdxIvnUJPimwCDDdL+oJIpXrPMKdfBCcrj2 xrE+tjv9VgNZk80jUAkKoqmZPZoFS04JQWspRZwr5bcet4Q9oC5unTEV3 dOa6Ld0wdEMQFN5wZCeyiYggGdM+1+JR2x5ombCgyTaO/ZaZgctT0En6M besjmFMaJ/mK+I7U3H+vE4wSrpf2UyUBT+qo/bsq2Q5eznznKu4F2puEH JvEIa4D0U785anhJTH7pK1gSXACKWzfDpWoj0jbydvNjZFMv7TGVPRP5m A==; X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="165280792" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 May 2022 07:09:10 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 23 May 2022 07:09:09 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17 via Frontend Transport; Mon, 23 May 2022 07:09:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZtFLDZuWzeXy4ppJdC5dc9fE5KBueaAjcuGWVKJxJrNeMIOFEGpQs/NPKvqk6tEc3eiQoEeN+ff1RuCJys8Svqjl/U35Vc5QgZbNb2uckKb0SQpvK3OO7Y08/wXm21kVHeoVpT1IwcVAyueHTZxI9zyYJB1D99cvxk2pWfZTo+hdckmFSLG/rsUmZVaiEqAmB+HHKmQQ+IFzNBVqrAqJrjmfsKLEzbJ31MY28zuneH7EffSpZs3ua5p2vGY7gWi8zQWRqRpJ5NjVbgHkXiO4A1Ct+GClhBMbqtRDYEyduMtRrxP/NoHVekUBIWj+K13kNkUxTpM1qPHIufBnXBdYg== 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=tH34q5DUTaS4NO+saZpHmJDS1O8nIf305oT33HboKPY=; b=iNKuPQbAkAprnpH5MqyCiXc/HM+gFQjU929TRkLYaX8pPPEFf7UiXnAFtneRwwBWcUsekBOLR9Mo5fPepT38+G0jta9yuTXOdjwcPGV/6FX38LJ27pKTOhVQugIJS3lXW3K5YIvttamFVQ/nsdLksGetvpaQdeluYLy1LFh0F9oSRHxSlTHi9PabVn+Ec/HVmGpz5L+CvTGpZeAra23bfnVBoXsTIYgz2mbhykL/K6Jl2u0B7JpteO9dutBM1iw0D6/8IlCxBKdEC6IWmzD5oYpHKMcwFzh0X+LQbjWGNQkCkSxqBVOIKBXZpNkEPRg+0EyaVX2dpdlraUMmKkaTQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tH34q5DUTaS4NO+saZpHmJDS1O8nIf305oT33HboKPY=; b=tMMtcgkIh69471Ob5AF/yg8tvXrK1825lWNkfGp5yeeL68HsrRNAyrolvzrAMUxF+Xu8PHtJVPxu584biMwcQUvLFbQACr++/5i5jrX23IJd+kQ1o8rsGNOP7I5ScVEtCrwsfiDZCcRfCk2OZSkCwKXtZeaO58XdbllGMnpZqvY= Received: from PH0PR11MB5176.namprd11.prod.outlook.com (2603:10b6:510:3f::5) by SJ0PR11MB5600.namprd11.prod.outlook.com (2603:10b6:a03:3ab::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Mon, 23 May 2022 14:09:08 +0000 Received: from PH0PR11MB5176.namprd11.prod.outlook.com ([fe80::d0fc:845b:ce0b:11fa]) by PH0PR11MB5176.namprd11.prod.outlook.com ([fe80::d0fc:845b:ce0b:11fa%8]) with mapi id 15.20.5273.023; Mon, 23 May 2022 14:09:08 +0000 From: To: CC: , , Subject: [PATCH v2 3/4] wilc1000: add WPA3 SAE support Thread-Topic: [PATCH v2 3/4] wilc1000: add WPA3 SAE support Thread-Index: AQHYbq6qvTuLXN4jmUugCJjfcMRvPw== Date: Mon, 23 May 2022 14:09:07 +0000 Message-ID: <20220523140812.164028-3-ajay.kathat@microchip.com> References: <20220523140812.164028-1-ajay.kathat@microchip.com> In-Reply-To: <20220523140812.164028-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.25.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microchip.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b2002d2d-2b14-4cb0-76c4-08da3cc5cd82 x-ms-traffictypediagnostic: SJ0PR11MB5600:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pnPaRGRGMq9Qs8J/jYKYSf3tjpjnSSstb7dkTB5vn+c0aa8san8X998gVDM7UgsL9nngUCeUyzK5F4zu/dcg0EwYG3hoEyjH+mWhwzG5EGu2fFHiCDMOToxxz6/HAuqkibrfuWZRT4mL3py/epM3l2cZu1ND4aCh4AhUghpv7EiaZvU55f5i7x2OVtZw5G1wRihF10Mq5iWa03miu6KPpChZIECSEzzGfw8xHMBSoDVFeR6C+rfBu+4+KBUKMtqLitvdI5AkLs4MXHa2k4qU1qg7QNb1ILulljBEnDFOuIcj1r7vBHYnAuIIw1us3Wk9yASXGNQUh1SOxZww3QA4lZ59+4WMJVPebjZctBYu7KUWKZ64WeIREeNpjBCcVCdp1UsyLfrWClnnLfL+NDO1iHCaCLeOo9N4QsjtnpVzBB5X+N6fasgcbgL1Zl0Dp/c4la6YywOZ6+d5OqDB+AEtm+f7zOVQNa5HpICGpg8YaMv4z7bZ0hkKhGJcSNsLTPHNwHzgJK43uB/gKwP+O/3LO3lF3yYmNbU+7yYjjFUJygENwoRdNzlWzX/7oIb6jf9CMOMz/HH9Wa3BV51ye1lu0gK6ytwrU2SvRk3QjP/vWfe4f5rhu1byb9m/Mla+u6ulPLtilXueLyWRgBdKomTR3DX8+O9XO2usvxBBIZMHIvE0VMdB/NLr160noGKiHiCqsTsrak0Z/1swtFeWJh7TLA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5176.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(4326008)(83380400001)(76116006)(86362001)(91956017)(5660300002)(6486002)(36756003)(8936002)(508600001)(64756008)(66446008)(66946007)(316002)(8676002)(66476007)(66556008)(186003)(6512007)(30864003)(6916009)(122000001)(6506007)(54906003)(1076003)(107886003)(2616005)(2906002)(71200400001)(38070700005)(38100700002)(26005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?GFoBkSBB2xfP/3YXWwuZtXQ?= =?iso-8859-1?q?PxkjAg8QKGSUZsBqwaWB/T6Vp/cVl8KbnxCBmeRITcnNhDRJmJgh+nPpEjwf?= =?iso-8859-1?q?24Oz6q2Kt4pJs1OryI2teMtOdLNWnLZKxy06HBgpAiXm0bTcOXLC0waC/iW5?= =?iso-8859-1?q?ccugq1LZY6UfY1EGlWxE2hkvXDDCkHkvzu/i8EtDbiFv+HBLw/nMCsxdKa93?= =?iso-8859-1?q?oIQRNwR2RGbzUrbgYS02DX6ceez34GYiX3p+BvCyfMVSDStCx89JwiF9ZWMh?= =?iso-8859-1?q?Wjt7Kc+syR5irpbOHeyi6ccM6crRqM616ZmaSjoLCQ6+xMIVw6IY5BYblV+S?= =?iso-8859-1?q?xA8X/JhnBoOkIQMmDpzGzqyY1loBNsOOsdgq5fqpXBAaj3xiJKbS/9EWL+V4?= =?iso-8859-1?q?V9tvkcwktsK/pPCCDkdpAc1JQXDN6gXOcCxkidkSKpg94BcdV3kR43v8jRZm?= =?iso-8859-1?q?vYq1XkWggOAkQloirhu/0GhQGYS3WUUA6uFbUiI/IytmmQyjLjiKuzsnT9KK?= =?iso-8859-1?q?funiArd5kXMo2SbsztozeemgeXxv92dXkHge3z2NcGcM2iQb+ydq5u1tr4lp?= =?iso-8859-1?q?MtcByAy2hbLwBVYHwhOerLM0ebBlYPcj4FjkgFPLuX10iOOIG1If9JPClT2e?= =?iso-8859-1?q?XeDsuFfaGMrq2x9j5ZQCNIU7JiDq4L2n/AhcEM+1BQt9UfJMWRT5LZLGXsgf?= =?iso-8859-1?q?rW2U7+pknZxv6kAHslCPMJ8Qdc7jczedLG4EXeY0lIs3KoJr+Oc+PxA6b4IR?= =?iso-8859-1?q?aLD3iPXmIQkR2i8M+xbQQX/lxhfURf8l8IHMUs+vsbQ2uC5BmlCH9iIV8a9c?= =?iso-8859-1?q?YFaBH+sfY10zkYfg0k4MRTLG0uFw5To+BPt1DFHpjMrLvmioSp9BycGY/hjO?= =?iso-8859-1?q?RkJRYmbtJ1JHE9l2I7MuQeKeb68/+/ZqVDbPx/h1E+kxhTr+azI2PFN8TBgX?= =?iso-8859-1?q?zff7yx1dz0BEjhfI0WFE6P6KkUUfmfib+ubpcXwSCf4c9Qq8mXKn6jqCkUHU?= =?iso-8859-1?q?1Z9yoowevaBfGwxKgsCcVJpcp4K6ZfPyEfD1hNlfWP1BP61Tfr2DEBJBp1mY?= =?iso-8859-1?q?buSI9ezEdNuRIRr5SCUwmSWJWCPnFIzNJFazG9l4e75R933qJO3ACzD9A/N4?= =?iso-8859-1?q?zmmr+JrQ6npdaAK1xK+73Z/MzJtXRvCGVebjzJFhBcbpNyn5ynLu49FzlokJ?= =?iso-8859-1?q?+LyFXjg+xDckE7d+LNaYWCEboN2OabDUxtH5xNPyR5BpOjYOP44vhw+gRSnU?= =?iso-8859-1?q?EYySzb50psfVfDKJedigOzvSLVfbxYgfUJnlwdHW+dXF0+VV889Ss9EnGwuj?= =?iso-8859-1?q?RLYi2aSdKjsREeppmVi0D6zb8x3DuYEoJetLrLqISC3QNQi5IHJFM1DFTLAS?= =?iso-8859-1?q?rcIYNN4wiclwa8NyOJTyv4axusjuGI/p/ZsnZUogB1h1eyqoeGlvAAlMjxp+?= =?iso-8859-1?q?k3FYOw7uOH5IXPcs7uEGeypTE6vLjkDLgoc+LxsbAnObeUQ1E2bgxlnVkoTp?= =?iso-8859-1?q?X0tt1ZX7HWw32r10P2NP8oD/ahJ7M4xxV9prHP9aW8W1aD7lpeuQPXF/KJYl?= =?iso-8859-1?q?mTqbRZZLJRTJii/rpn9ipsEdC5xDVlaK7OmTWwAJEmXn0cFIOLqFz6rhKnIo?= =?iso-8859-1?q?HDsTmjOxz7muNZc8IFP65/0Yc3JL0lBBvEOjgKW17+cvV15Nrcq2i7VqIm+U?= =?iso-8859-1?q?QFOl/XxrUMAeVakLi6YfYM4+iWxwAWstAHseWGUKQIzYFPCWYmFG0ghGAFVp?= =?iso-8859-1?q?xIEvyTHUNfPDdPgxgwTdGtNCcCD0jJLLynRBeXNTUBB1/o20rMqAAhicdUMM?= =?iso-8859-1?q?mfH0FsmhYVrfYYD3WlXO31sXnC9sG?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5176.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2002d2d-2b14-4cb0-76c4-08da3cc5cd82 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2022 14:09:07.9824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ufgDoUp8GsceizvtNTp4kTkf0RQH6l8dDtyVP3eBY+l4bPjyFmxZ6/yHlHNyHunCGIygGRyyaxwaIStZ95jDfo9b7VNlfV3R2zWXJF8v6SY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5600 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Enable SAE authentication for AP and STA mode. In STA mode, allow the driver to pass the auth frames which are received from firmware to userspace application(hostapd) so that SAE authentication is offloaded to userspace. Signed-off-by: Ajay Singh --- v2: remove unused variable reported by kernel test robot .../wireless/microchip/wilc1000/cfg80211.c | 62 +++++++++++++++++-- drivers/net/wireless/microchip/wilc1000/fw.h | 9 +++ drivers/net/wireless/microchip/wilc1000/hif.c | 44 ++++++++++++- drivers/net/wireless/microchip/wilc1000/hif.h | 3 + .../net/wireless/microchip/wilc1000/netdev.c | 11 +++- .../net/wireless/microchip/wilc1000/netdev.h | 3 +- .../net/wireless/microchip/wilc1000/wlan.c | 3 +- .../net/wireless/microchip/wilc1000/wlan.h | 2 + .../net/wireless/microchip/wilc1000/wlan_if.h | 10 ++- 9 files changed, 133 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index 256026d57a70..ea59ce9fd991 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -20,9 +20,11 @@ static const struct ieee80211_txrx_stypes wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, + .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4), .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) }, [NL80211_IFTYPE_AP] = { .tx = 0xffff, @@ -350,6 +352,16 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, auth_type = WILC_FW_AUTH_OPEN_SYSTEM; break; + case NL80211_AUTHTYPE_SAE: + auth_type = WILC_FW_AUTH_SAE; + if (sme->ssid_len) { + memcpy(vif->auth.ssid.ssid, sme->ssid, sme->ssid_len); + vif->auth.ssid.ssid_len = sme->ssid_len; + } + vif->auth.key_mgmt_suite = cpu_to_be32(sme->crypto.akm_suites[0]); + ether_addr_copy(vif->auth.bssid, sme->bssid); + break; + default: break; } @@ -357,6 +369,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, if (sme->crypto.n_akm_suites) { if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X) auth_type = WILC_FW_AUTH_IEEE8021; + else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_PSK_SHA256) + auth_type = WILC_FW_AUTH_OPEN_SYSTEM_SHA256; + else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X_SHA256) + auth_type = WILC_FW_AUTH_IEE8021X_SHA256; } if (wfi_drv->usr_scan_req.scan_result) { @@ -905,6 +921,18 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch) } } +bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size) +{ + struct wilc *wl = vif->wilc; + struct wilc_priv *priv = &vif->priv; + int freq, ret; + + freq = ieee80211_channel_to_frequency(wl->op_ch, NL80211_BAND_2GHZ); + ret = cfg80211_rx_mgmt(&priv->wdev, freq, 0, buff, size, 0); + + return ret; +} + void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) { struct wilc *wl = vif->wilc; @@ -1090,8 +1118,14 @@ static int mgmt_tx(struct wiphy *wiphy, goto out_txq_add_pkt; } - if (!ieee80211_is_public_action((struct ieee80211_hdr *)buf, len)) + if (!ieee80211_is_public_action((struct ieee80211_hdr *)buf, len)) { + if (chan) + wilc_set_mac_chnl_num(vif, chan->hw_value); + else + wilc_set_mac_chnl_num(vif, vif->wilc->op_ch); + goto out_set_timeout; + } d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action); if (d->oui_type != WLAN_OUI_TYPE_WFA_P2P || @@ -1158,6 +1192,7 @@ void wilc_update_mgmt_frame_registrations(struct wiphy *wiphy, struct wilc_vif *vif = netdev_priv(wdev->netdev); u32 presp_bit = BIT(IEEE80211_STYPE_PROBE_REQ >> 4); u32 action_bit = BIT(IEEE80211_STYPE_ACTION >> 4); + u32 pauth_bit = BIT(IEEE80211_STYPE_AUTH >> 4); if (wl->initialized) { bool prev = vif->mgmt_reg_stypes & presp_bit; @@ -1171,10 +1206,26 @@ void wilc_update_mgmt_frame_registrations(struct wiphy *wiphy, if (now != prev) wilc_frame_register(vif, IEEE80211_STYPE_ACTION, now); + + prev = vif->mgmt_reg_stypes & pauth_bit; + now = upd->interface_stypes & pauth_bit; + if (now != prev) + wilc_frame_register(vif, IEEE80211_STYPE_AUTH, now); } vif->mgmt_reg_stypes = - upd->interface_stypes & (presp_bit | action_bit); + upd->interface_stypes & (presp_bit | action_bit | pauth_bit); +} + +static int external_auth(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_external_auth_params *auth) +{ + struct wilc_vif *vif = netdev_priv(dev); + + if (auth->status == WLAN_STATUS_SUCCESS) + wilc_set_external_auth_param(vif, auth); + + return 0; } static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, @@ -1590,6 +1641,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = { .change_bss = change_bss, .set_wiphy_params = set_wiphy_params, + .external_auth = external_auth, .set_pmksa = set_pmksa, .del_pmksa = del_pmksa, .flush_pmksa = flush_pmksa, @@ -1732,7 +1784,7 @@ struct wilc *wilc_create_wiphy(struct device *dev) BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_CLIENT); wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - + wiphy->features |= NL80211_FEATURE_SAE; set_wiphy_dev(wiphy, dev); wl->wiphy = wiphy; ret = wiphy_register(wiphy); diff --git a/drivers/net/wireless/microchip/wilc1000/fw.h b/drivers/net/wireless/microchip/wilc1000/fw.h index 237ca348d1f8..9449c5d0b472 100644 --- a/drivers/net/wireless/microchip/wilc1000/fw.h +++ b/drivers/net/wireless/microchip/wilc1000/fw.h @@ -110,4 +110,13 @@ struct wilc_join_bss_param { struct wilc_noa_opp_enable opp_en; }; } __packed; + +struct wilc_external_auth_param { + u8 action; + u8 bssid[ETH_ALEN]; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + u8 ssid_len; + __le32 key_mgmt_suites; + __le16 status; +} __packed; #endif diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index 573750356007..5d9d3aba737c 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -306,7 +306,10 @@ static int wilc_send_connect_wid(struct wilc_vif *vif) netdev_err(vif->ndev, "failed to send config packet\n"); goto error; } else { - hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; + if (conn_attr->auth_type == WILC_FW_AUTH_SAE) + hif_drv->hif_state = HOST_IF_EXTERNAL_AUTH; + else + hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; } return 0; @@ -665,7 +668,12 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work) goto free_msg; } - if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { + + if (hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH) { + cfg80211_external_auth_request(vif->ndev, &vif->auth, + GFP_KERNEL); + hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; + } else if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { host_int_parse_assoc_resp_info(vif, mac_info->status); } else if (mac_info->status == WILC_MAC_STATUS_DISCONNECTED) { if (hif_drv->hif_state == HOST_IF_CONNECTED) { @@ -710,7 +718,8 @@ int wilc_disconnect(struct wilc_vif *vif) } if (conn_info->conn_result) { - if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) + if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP || + hif_drv->hif_state == HOST_IF_EXTERNAL_AUTH) del_timer(&hif_drv->connect_timer); conn_info->conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, 0, @@ -986,6 +995,31 @@ void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled) pr_err("Failed to send wowlan trigger config packet\n"); } +int wilc_set_external_auth_param(struct wilc_vif *vif, + struct cfg80211_external_auth_params *auth) +{ + int ret; + struct wid wid; + struct wilc_external_auth_param *param; + + wid.id = WID_EXTERNAL_AUTH_PARAM; + wid.type = WID_BIN_DATA; + wid.size = sizeof(*param); + param = kzalloc(sizeof(*param), GFP_KERNEL); + if (!param) + return -EINVAL; + + wid.val = (u8 *)param; + param->action = auth->action; + ether_addr_copy(param->bssid, auth->bssid); + memcpy(param->ssid, auth->ssid.ssid, auth->ssid.ssid_len); + param->ssid_len = auth->ssid.ssid_len; + ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1); + + kfree(param); + return ret; +} + static void handle_scan_timer(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -1647,6 +1681,10 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX; break; + case IEEE80211_STYPE_AUTH: + reg_frame.reg_id = WILC_FW_AUTH_REQ_IDX; + break; + default: break; } diff --git a/drivers/net/wireless/microchip/wilc1000/hif.h b/drivers/net/wireless/microchip/wilc1000/hif.h index c9740457ed58..f1a0a1f042ca 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.h +++ b/drivers/net/wireless/microchip/wilc1000/hif.h @@ -47,6 +47,7 @@ enum host_if_state { HOST_IF_WAITING_CONN_RESP = 3, HOST_IF_CONNECTED = 4, HOST_IF_P2P_LISTEN = 5, + HOST_IF_EXTERNAL_AUTH = 6, HOST_IF_FORCE_32BIT = 0xFFFFFFFF }; @@ -202,6 +203,8 @@ int wilc_get_vif_idx(struct wilc_vif *vif); int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power); int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power); void wilc_set_wowlan_trigger(struct wilc_vif *vif, bool enabled); +int wilc_set_external_auth_param(struct wilc_vif *vif, + struct cfg80211_external_auth_params *param); void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length); void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length); void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length); diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 3c292e3464c2..fcc4e61592ee 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -835,15 +835,24 @@ void wilc_frmw_to_host(struct wilc *wilc, u8 *buff, u32 size, } } -void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) +void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size, bool is_auth) { int srcu_idx; struct wilc_vif *vif; srcu_idx = srcu_read_lock(&wilc->srcu); list_for_each_entry_rcu(vif, &wilc->vif_list, list) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buff; u16 type = le16_to_cpup((__le16 *)buff); u32 type_bit = BIT(type >> 4); + u32 auth_bit = BIT(IEEE80211_STYPE_AUTH >> 4); + + if ((vif->mgmt_reg_stypes & auth_bit && + ieee80211_is_auth(mgmt->frame_control)) && + vif->iftype == WILC_STATION_MODE && is_auth) { + wilc_wfi_mgmt_frame_rx(vif, buff, size); + break; + } if (vif->priv.p2p_listen_state && vif->mgmt_reg_stypes & type_bit) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h index 630b1e85e68f..a0d9e981500e 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.h +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h @@ -185,6 +185,7 @@ struct wilc_vif { struct wilc_priv priv; struct list_head list; struct cfg80211_bss *bss; + struct cfg80211_external_auth_params auth; }; struct wilc_tx_queue_status { @@ -278,7 +279,7 @@ struct wilc_wfi_mon_priv { void wilc_frmw_to_host(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void wilc_mac_indicate(struct wilc *wilc); void wilc_netdev_cleanup(struct wilc *wilc); -void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); +void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size, bool is_auth); void wilc_wlan_set_bssid(struct net_device *wilc_netdev, const u8 *bssid, u8 mode); struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 48441f0389ca..f3f504d12873 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -968,7 +968,8 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size) if (pkt_offset & IS_MANAGMEMENT) { buff_ptr += HOST_HDR_OFFSET; - wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len); + wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len, + pkt_offset & IS_MGMT_AUTH_PKT); } else { if (!is_cfg_packet) { wilc_frmw_to_host(wilc, buff_ptr, pkt_len, diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h index eb7978166d73..b45e72789a0e 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.h +++ b/drivers/net/wireless/microchip/wilc1000/wlan.h @@ -305,6 +305,7 @@ #define IS_MANAGMEMENT 0x100 #define IS_MANAGMEMENT_CALLBACK 0x080 #define IS_MGMT_STATUS_SUCCES 0x040 +#define IS_MGMT_AUTH_PKT 0x010 #define WILC_WID_TYPE GENMASK(15, 12) #define WILC_VMM_ENTRY_FULL_RETRY 1 @@ -423,6 +424,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc); netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size); +bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size); void host_wakeup_notify(struct wilc *wilc); void host_sleep_notify(struct wilc *wilc); void chip_allow_sleep(struct wilc *wilc); diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_if.h b/drivers/net/wireless/microchip/wilc1000/wlan_if.h index 6eb7eb4ac294..18f13b5643e8 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan_if.h +++ b/drivers/net/wireless/microchip/wilc1000/wlan_if.h @@ -85,7 +85,10 @@ enum authtype { WILC_FW_AUTH_OPEN_SYSTEM = 1, WILC_FW_AUTH_SHARED_KEY = 2, WILC_FW_AUTH_ANY = 3, - WILC_FW_AUTH_IEEE8021 = 5 + WILC_FW_AUTH_IEEE8021 = 5, + WILC_FW_AUTH_SAE = 7, + WILC_FW_AUTH_IEE8021X_SHA256 = 9, + WILC_FW_AUTH_OPEN_SYSTEM_SHA256 = 13 }; enum site_survey { @@ -176,7 +179,8 @@ enum { enum { WILC_FW_ACTION_FRM_IDX = 0, - WILC_FW_PROBE_REQ_IDX = 1 + WILC_FW_PROBE_REQ_IDX = 1, + WILC_FW_AUTH_REQ_IDX = 2 }; enum wid_type { @@ -789,7 +793,7 @@ enum { WID_ADD_BEACON = 0x408a, WID_SETUP_MULTICAST_FILTER = 0x408b, - + WID_EXTERNAL_AUTH_PARAM = 0x408d, /* Miscellaneous WIDs */ WID_ALL = 0x7FFE, WID_MAX = 0xFFFF