From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.94729.1673319771853054546 for ; Mon, 09 Jan 2023 19:02:51 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bEBht1Uc; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673319771; x=1704855771; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=9ODzp9v9WXm7H2bMGBb1YOkdwfGAcFcgNKww0B8475s=; b=bEBht1UclDAzd/VUfRsZQfuxx0PvAYTtjC/6iKhKzNOPxzHaElm3O8H6 MzZqlbRYJrEMOJ6fXpfrXaHCF6BFgOYy1pKejRzCvSYYhAB32NS1ZOBW1 7KqqLQ5MV8s3RzSfti9V9SdhC0GadtM8VCAalMQl+NIb7w1/IGcZElI2m Y8J9BlzdyT3dZSDZbdEcLaHNlF8TFHnKXnNOe4XPDHzcp6PDUSZoh3wdt 3dySDlFfSTRfrC5+veeNvCE6jAlwg4Q8CosLqWacbTnDfBNotnx0soNOM L0IGSi2k++Hv40hR/aJL49GffCsUqfYa2gTsRqNDg8s+AJ67BoH3kK0XV Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="350266190" X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="350266190" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 19:02:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="658829005" X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="658829005" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 09 Jan 2023 19:02:51 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 9 Jan 2023 19:02:50 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 19:02:50 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 9 Jan 2023 19:02:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EZnW3pY/H3APbpa6dIVc5P/NGS1lOo0ZZ0Km4q8TQo74aEd+QO/r6CHtJhbQd+oCPkuXRaXh/2uQI6PtkytWMCHTqF7QXduahYI68TPHmFZwIg7ENOaf5aqBSsMtIAqy13pTeC0bAqj16Vp/DGq97VbODpJVnjCjd+iN1NzBArAMuPOpwOF6NSW2B4hpNHSD1qy9Zg/hhfXmKxmM9K+wemzWxoBjAOn1txos4NP6delb7dLjgncS85zTqHjjY1gfoufYOX2UpheRusRngrMz0sTDfYZtW0V+YiiVISW1E8vKJyZ9cSSW+2AjZbYWMYxpgo+OPdChpvewIGx94FlsZw== 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=Rs5latGOkyiKmQswhtTDx8Bp/bl1jQLPTpezi+oKl9Y=; b=jMJiATrfmnncmprB4dNibmyPWZJCgH7JUzmaOknG+ubCvs0R0dfalR/QKSdNDsRpSLu1k6tMG1gzAUVYGr4QN2RQyI63k79v4IQPMRrabSzGxa8Op4cdnXOXASy+LehPRy6Jc0ChHG+XE+zljdn3nglwEtlOJEeOPpEZf7ARpoEz8slO/4Nz7b9tT0dVmvqCR9+SO5HNYlxGozASYoFFEpDyQpnsqfwEZJ2jBj/QJPPHoklmVSQAJmphoM46pimFCbaclldH7K0V6Q91InhPkyJ0NSyln6m1ODs35bRQnecjUs2OerCt2CSD3g/uITIIVCjfkwAvxk924V9Xn6ohig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MN0PR11MB6158.namprd11.prod.outlook.com (2603:10b6:208:3ca::18) by MW4PR11MB6692.namprd11.prod.outlook.com (2603:10b6:303:20e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Tue, 10 Jan 2023 03:02:42 +0000 Received: from MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::e5d9:d16e:172b:aa01]) by MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::e5d9:d16e:172b:aa01%4]) with mapi id 15.20.5986.018; Tue, 10 Jan 2023 03:02:42 +0000 From: "Wu, Jiaxin" To: "Clark-williams, Zachary" , "devel@edk2.groups.io" CC: Zachary Clark-Williams , Maciej Rabeda , "Otcheretianski, Andrei" Subject: Re: [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Topic: [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Index: AQHZIjfGTttQcfgC30iCjjvlbt9rK66Ww3fA Date: Tue, 10 Jan 2023 03:02:42 +0000 Message-ID: References: <20230107013110.7349-1-zachary.clark-williams@intel.com> In-Reply-To: <20230107013110.7349-1-zachary.clark-williams@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6158:EE_|MW4PR11MB6692:EE_ x-ms-office365-filtering-correlation-id: 19af55db-852e-4539-891c-08daf2b72442 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lka76OOLHhoUVe9XHrTYEfWsCqH4JRymb+j5zeIetNqtzuX75sCG2qP6H76zgPsimKn1sbqVCaG4QcOelZp1/+lXt89zqSvtUPYKSYfesZJsx8g4H8+LSUzMIVZ0dz/TgnJobkWmG35vfRdzXyI+8hGTij9ZVp62mCvqGGMjWeOyCmo1alVhThjkqt/9/9hLbnAoMMaLRu1r4IeDIdpbeLxSjkB4bmpg6Dd4oQ8tbL/qke8cHZFov9qzWvg8mZjmfW5HlgzjtcCe5PgzogxjXCBNLVH9vFbv+4WgmtX1edOp57Vw0TX4CRwF9W1DPAmSMFNf9z6/O9tIdxG5yT8pQglRn8ZKlJvVI/PpogFHdF31OKaFv3Md/2gVQU2X0t70n79QcQeII4s0QwATTx3yj0bB61gYOBRkPJfJteTLe9+oj/QApGrCUS2MmmVo7ypMEO9TWMa8G/Caj3qVaNgBTCmKRK93rPuwGE1WmUivS6Upg4Q8de1WOJggRC6BaWM7O9b61Ku87KcP7YQ/hhXtWRva3WctJMayamNnxzXr6tv2Serq8Msa3PUFzZXuQDNck4QAWUs9BsTFTSG/Z2io7Wm5/a3SKpjgLtIkf00hXMn7GwA4xp/EqCxgiuacaQCuPDnd97fQLfWXDUCM9AcxYD7l77gjAdt5i5D6X55DFueLbk4Ec7QTCrgrnCB/XTcyrlOPOC+h9/L/mblEh0pGoyFPabTGzx5fx0ClaT3D8HlA9OEAO7k4FUCgPi/FbaBR/FsrFX+8Yk8QcT1GYefpBQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6158.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(6029001)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(8936002)(2906002)(5660300002)(52536014)(41300700001)(71200400001)(38070700005)(66446008)(4326008)(7696005)(76116006)(8676002)(64756008)(66556008)(316002)(19627235002)(66946007)(66476007)(30864003)(54906003)(110136005)(26005)(9686003)(122000001)(38100700002)(55016003)(86362001)(186003)(83380400001)(82960400001)(966005)(33656002)(478600001)(6506007)(53546011)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?igeXH9Iw1clDecsvKc4wOv2MwUtplpT6sl49Lq0KpifvktMsYhbUIpIzVK2y?= =?us-ascii?Q?9kX8FuBpfBEb44JM7iP4jgdWU4k0gaanYAK+M5SBjBVY4bVPCQ/UPg1scJdh?= =?us-ascii?Q?n/A8q9Ja+it8dm+l1T7n+rRZhXQz/05tJIy21RAQ/EpgZMnzGVRPUtdP9ftF?= =?us-ascii?Q?FOmjfAxHY6sJ8Jo2doa4MheG/XfvacyljldjPM/rxzTCDtMTydimN89QWWKD?= =?us-ascii?Q?RLh3xtqcE5bO44EWSGVOcEGsFtNiH2I89YQyfA/LldaawxbXsRK14cIFH/ec?= =?us-ascii?Q?tiABsGvzWkeN3/snArw/Dp9IKUZ/Aw3Zd5qwPptMh9CBWYB1bI/ELP096mDe?= =?us-ascii?Q?pmFqI2OHiG9+imcqmhNsWVPJlkcEXhK88Xaa5XzyI8iwT+e4TUCyoqWRK3fj?= =?us-ascii?Q?4JPJ8t+wp2vqnRQJhLzC00c7Q3Q4xWTIg/Zz4t/qMsN8222iE9lM38D6PtWf?= =?us-ascii?Q?AfVz0xQB8rdGsWMtKMqB4HhGEOb1jmuArqNowoTBBLb3KaI3X+4YMJbEx8sT?= =?us-ascii?Q?LHyXRo9ZypDrMaQ1G3REnuQkdIgloly/GWePsAG75f1ue5lIHek5L3bw3D1F?= =?us-ascii?Q?zfV1HEN9kS31Y7koQ09LjBJJq1Ivvj0Ccq+1knpjCJUPgWQ6p0AMC+MaPXxs?= =?us-ascii?Q?Y33biqKtWwxrBk/6qES+BMRTCGjc8LRQnYLr2IN0h1AtbV2hH8NXkErlQI7x?= =?us-ascii?Q?KU1QRPofBNiQcxdqDK2MEVqj4AlSmosxO1/Z8KYWyvL3Lh5DIIkbhirJ6DC+?= =?us-ascii?Q?aeHlhZU3ZP4d5fGsa4I0FphtTWcPZPc7NjnCpmTbTlXYItWpdGzlKuUhGrpT?= =?us-ascii?Q?Fi1e7tm6i8TV0PBZuVExk11e0orMWbeY264U7iIDSahU/m6XvNVoc67XQIu5?= =?us-ascii?Q?8B6Gh+U9rWHsssQx3Ba50SuUZs0yUb6uPiilOiOwdpmKvDBpNNg2IJBOWLPr?= =?us-ascii?Q?h0DJAErUex57NQaISAFFzdTbl0+E+yWmWC6ZKOkd5sNKOdstGp3s8/a4wR1v?= =?us-ascii?Q?a+efjOpUtn36hSxDiGhix2OAQ/Gt1eD6654p7NU3RkSYAvaWga+APnhgAgnX?= =?us-ascii?Q?X9wOQOY7HGAOSD+VYvn660PWxJ7Rozzzbp5e0pIE9/sKsRi1+YxMZO87G/rY?= =?us-ascii?Q?NWozQMrQhKS6gncTFJX1TM03aR+jvPtNjloNIylcFG38raH6q3cWjaTzN1of?= =?us-ascii?Q?vmeziRZufWGzcGORaGHcHwf2rpnbXOGMbE8wFcx2MIdKEKR0bJIoPjIB92Ft?= =?us-ascii?Q?4nGkVo5Zt7M2uIjBXiSLFUlIWPUYSLKTtjdw5REVO/iIxJoXN7GnrNvUk4Zm?= =?us-ascii?Q?zHJtUn4Av2I4vj7huq4i9PhRxKZfWGqvsOxjfExa9gUw1+S0nSJ5tvQIKwrt?= =?us-ascii?Q?A0MkMX7Z0dq7lrcZTpGMlvVzFgsvIydx9DfNJsihGAHlJT5WW0C2OgMRy70C?= =?us-ascii?Q?JOzaKWJU5j9CEdquUArKESYKdD6Jlv9Cq2RJRz/Bj3KaZhZAi5ur+l/RzNkG?= =?us-ascii?Q?iikBfiAhvPpOETWQampipWTdfLFCe6nqBPG72rHd9yXSVHO6LQKPyrEj2ItP?= =?us-ascii?Q?+tuG3Vex3Osws7dGvbY0QQ0ODeDgYisnNaLNAlUv?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6158.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19af55db-852e-4539-891c-08daf2b72442 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2023 03:02:42.6999 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xDELUzf6RCh06qjkv0BIfGMe9/hBx25KAgD7Z/Kbf2MCRv1IUphjyaeTAVSrlkri2tSLJ2cMY2PrZhGhOq3UEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6692 Return-Path: jiaxin.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable One comment as below, Others good to me.=20 Reviewed-by: Wu Jiaxin > + @param[in, out] WcmProfile WiFi Connection Manager profile > structure > + @param[in, out] MacAddress MAC address from AMT saved to NiC > MAC address > + > + @retval EFI_SUCCESS Stored WiFi profile converted and re= turned > succefully > + @retval EFI_UNSUPPORTED Profile protocol sharing not support= ed or > enabled > + @retval EFI_NOT_FOUND No profiles to returned > + @retval Others Error Occurred > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *WIFI_PROFILE_GET)( > + IN OUT WIFI_MGR_NETWORK_PROFILE *Profile, > + IN OUT EFI_80211_MAC_ADDRESS MacAddress > + ); Does it make sense remove the OUT declaring since this is just to get the c= orresponding MacAddress Profile? For OUT, we expect there will be changed w= hen return but here it's not. Thanks, Jiaxin=20 > -----Original Message----- > From: Clark-williams, Zachary > Sent: Saturday, January 7, 2023 9:31 AM > To: devel@edk2.groups.io > Cc: Zachary Clark-Williams ; Maciej Rabeda > ; Wu, Jiaxin ; > Otcheretianski, Andrei ; Clark-williams, > Zachary > Subject: [PATCH] NetworkPkg: Add WiFi profile sync protocol support >=20 > From: Zachary Clark-Williams >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3845 >=20 > Enables KVM and One Click Recovery WLAN capability with WiFi Profile > Sync feature and protocol. Adding WiFiProfileSyncProtocol, which > supports the profilesync driver operations for transferring WiFi profiles > from AMT to the Supplicant. WiFiConnectionManager will check for the > WifiProfileSyncProtocol and if found will operate on the premise of a > One Click Recovery, or KVM flow with a Wifi profile provided by AMT. >=20 > Cc: Maciej Rabeda > Cc: Wu Jiaxin > Cc: Andrei Otcheretianski >=20 > Signed-off-by: Zachary Clark-Williams > --- > .../Protocol/WiFiProfileSyncProtocol.h | 90 +++++++ > NetworkPkg/NetworkPkg.dec | 3 + > .../WifiConnectionManagerDxe.inf | 3 +- > .../WifiConnectionMgrConfigNVDataStruct.h | 2 +- > .../WifiConnectionMgrDriver.c | 125 ++++++---- > .../WifiConnectionMgrDxe.h | 4 +- > .../WifiConnectionMgrImpl.c | 219 +++++++++++++++--- > .../WifiConnectionMgrMisc.c | 13 ++ > 8 files changed, 386 insertions(+), 73 deletions(-) > create mode 100644 > NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h >=20 > diff --git a/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > b/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > new file mode 100644 > index 0000000000..90523e30fa > --- /dev/null > +++ b/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > @@ -0,0 +1,90 @@ > +/** @file > + WiFi profile sync protocol. Supports One Click Recovery or KVM OS > recovery > + boot flow over WiFi. This protocol will hold the WiFi profile provided= by > AMT > + in its original structure, then convert the profile when the > WifiConnectionManager > + is attempting a connection during a system recovery reboot, OCR or KVM= . > These > + converstion and operations are found in the WifiProfileSync driver and= in > + the link provided below. > + > + Pulbic links to speficiation document for KVM and One Click Recovery > feature. > + > https://software.intel.com/sites/manageability/AMT_Implementation_and_ > Reference_Guide/default.htm?turl=3DWordDocuments%2Foneclickrecovery.h > tm > + > + Copyright (c) 2022, Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef WIFI_PROFILE_SYNC_PROTOCOL_H_ > +#define WIFI_PROFILE_SYNC_PROTOCOL_H_ > + > +#include > + > +// > +// WiFi Profile Sync Protocol GUID variable. > +// > +extern EFI_GUID gEfiWiFiProfileSyncProtocolGuid; > + > +/** > + Used by the WiFi connection manager to get the WiFi profile that AMT > shared > + and was stored in WiFi profile protocol. Aligns the AMT WiFi profile d= ata to > + the WiFi connection manager profile structure fo connection use. > + > + @param[in, out] WcmProfile WiFi Connection Manager profile > structure > + @param[in, out] MacAddress MAC address from AMT saved to NiC > MAC address > + > + @retval EFI_SUCCESS Stored WiFi profile converted and re= turned > succefully > + @retval EFI_UNSUPPORTED Profile protocol sharing not support= ed or > enabled > + @retval EFI_NOT_FOUND No profiles to returned > + @retval Others Error Occurred > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *WIFI_PROFILE_GET)( > + IN OUT WIFI_MGR_NETWORK_PROFILE *Profile, > + IN OUT EFI_80211_MAC_ADDRESS MacAddress > + ); > + > +/** > + Saves the WiFi connection status recieved by the WiFiConnectionManager > when > + in a KVM OR One Click Recovery WLAN recovery flow. Input as > + EFI_80211_CONNECT_NETWORK_RESULT_CODE then converted and > stored as EFI_STATUS type. > + > + @param[in] ConnectionStatus WiFi connection attempt results > +**/ > +typedef > +VOID > +(EFIAPI *WIFI_SET_CONNECT_STATE)( > + IN EFI_80211_CONNECT_NETWORK_RESULT_CODE ConnectionStatus > + ); > + > +/** > + Retrieves the stored WiFi connection status when in either KVM OR One > Click > + Recovery WLAN recovery flow. > + > + @retval EFI_SUCCESS WiFi connection completed succesfull= y > + @retval Others Connection failure occurred > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *WIFI_GET_CONNECT_STATE)( > + VOID > + ); > + > +// > +// WiFi Profile Sync Protocol structure. > +// > +typedef struct { > + UINT32 Revision; > + WIFI_SET_CONNECT_STATE SetConnectState; > + WIFI_GET_CONNECT_STATE GetConnectState; > + WIFI_PROFILE_GET GetProfile; > +} EDKII_WIFI_PROFILE_SYNC_PROTOCOL; > + > +/** > + WiFi Profile Protocol revision number. > + > + Revision 1: Initial version > +**/ > +#define EDKII_WIFI_PROFILE_SYNC_PROTOCOL_REVISION 1 > + > +#endif // WIFI_PROFILE_SYNC_PROTOCOL_H_ > diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec > index 5e43ebf8c5..53fb34c4a0 100644 > --- a/NetworkPkg/NetworkPkg.dec > +++ b/NetworkPkg/NetworkPkg.dec > @@ -91,6 +91,9 @@ > ## Include/Protocol/HttpCallback.h > gEdkiiHttpCallbackProtocolGuid =3D {0x611114f1, 0xa37b, 0x4468, {0xa4= , 0x36, > 0x5b, 0xdd, 0xa1, 0x6a, 0xa2, 0x40}} >=20 > + ## Include/Protocol/WiFiProfileSyncProtocol.h > + gEfiWiFiProfileSyncProtocolGuid =3D {0x399a2b8a, 0xc267, 0x44aa, {0x9a= , > 0xb4, 0x30, 0x58, 0x8c, 0xd2, 0x2d, 0xcc}} > + > [PcdsFixedAtBuild] > ## The max attempt number will be created by iSCSI driver. > # @Prompt Max attempt number. > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > index 4394b6f4bb..7e36016cf8 100644 > --- > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > @@ -9,7 +9,7 @@ > # 2). WPA2 Personal Network > # 3). EAP Networks (EAP-TLS, EAP-TTLS/MSCHAPv2 and PEAPv0/MSCHAPv2) > # > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -71,6 +71,7 @@ > gEfiAdapterInformationProtocolGuid ## SOMETIMES_CONSUMES > gEfiSupplicantProtocolGuid ## SOMETIMES_CONSUMES > gEfiEapConfigurationProtocolGuid ## SOMETIMES_CONSUMES > + gEfiWiFiProfileSyncProtocolGuid ## SOMETIMES_CONSUMES >=20 > [Guids] > gWifiConfigGuid ## PRODUCES ## GUID > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDa > taStruct.h > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDa > taStruct.h > index b5518a74d8..dcc4bf7e27 100644 > --- > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDa > taStruct.h > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDa > taStruct.h > @@ -25,7 +25,7 @@ >=20 > #define PASSWORD_MIN_LEN 8 > #define PASSWORD_MAX_LEN 63 > -#define PASSWORD_STORAGE_SIZE 64 > +#define PASSWORD_STORAGE_SIZE 65 >=20 > #define EAP_IDENTITY_LEN 63 > #define EAP_IDENTITY_SIZE 64 > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > index 67a01ca058..0af55db599 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > @@ -1,7 +1,7 @@ > /** @file > The driver binding protocol for the WiFi Connection Manager. >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -39,6 +39,11 @@ EFI_GUID mWifiConfigNetworkListRefreshGuid =3D > WIFI_CONFIG_NETWORK_LIST_REFRESH_G > EFI_GUID mWifiConfigConnectFormRefreshGuid =3D > WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID; > EFI_GUID mWifiConfigMainFormRefreshGuid =3D > WIFI_CONFIG_MAIN_FORM_REFRESH_GUID; >=20 > +// > +// Wifi connection attempt counter for retries > +// > +extern UINT8 mWifiConnectionCount; > + > /** > Tests to see if this driver supports a given controller. If a child de= vice is > provided, > it further tests to see if this driver supports creating a handle for = the > specified child device. > @@ -167,8 +172,10 @@ WifiMgrDxeDriverBindingStart ( > EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp; > EFI_SUPPLICANT_PROTOCOL *Supplicant; > EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > - Nic =3D NULL; > + mWifiConnectionCount =3D 0; > + Nic =3D NULL; >=20 > // > // Open Protocols > @@ -236,47 +243,72 @@ WifiMgrDxeDriverBindingStart ( > InitializeListHead (&Nic->ProfileList); >=20 > // > - // Record the MAC address of the incoming NIC. > + // WiFi profile sync protocol installation check for OS recovery flow. > // > - Status =3D NetLibGetMacAddress ( > - ControllerHandle, > - (EFI_MAC_ADDRESS *)&Nic->MacAddress, > - &AddressSize > - ); > - if (EFI_ERROR (Status)) { > - goto ERROR2; > - } > - > - // > - // Create and start the timer for the status check > - // > - Status =3D gBS->CreateEvent ( > - EVT_NOTIFY_SIGNAL | EVT_TIMER, > - TPL_CALLBACK, > - WifiMgrOnTimerTick, > - Nic, > - &Nic->TickTimer > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFiProfileSyncProtocolGuid, > + NULL, > + (VOID **)&WiFiProfileSyncProtocol > ); > - if (EFI_ERROR (Status)) { > - goto ERROR2; > - } > + if (!EFI_ERROR (Status)) { > + Nic->ConnectPendingNetwork =3D (WIFI_MGR_NETWORK_PROFILE > *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE)); > + if (Nic->ConnectPendingNetwork =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto ERROR1; > + } >=20 > - Status =3D gBS->SetTimer (Nic->TickTimer, TimerPeriodic, > EFI_TIMER_PERIOD_MILLISECONDS (500)); > - if (EFI_ERROR (Status)) { > - goto ERROR3; > - } > + WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic= - > >MacAddress); > + if (Nic->ConnectPendingNetwork !=3D NULL) { > + Status =3D WifiMgrConnectToNetwork (Nic, Nic- > >ConnectPendingNetwork); > + if (!EFI_ERROR (Status)) { > + goto ERROR1; > + } > + WiFiProfileSyncProtocol->SetConnectState (Status); > + } > + } else { > + // > + // Record the MAC address of the incoming NIC. > + // > + Status =3D NetLibGetMacAddress ( > + ControllerHandle, > + (EFI_MAC_ADDRESS *)&Nic->MacAddress, > + &AddressSize > + ); > + if (EFI_ERROR (Status)) { > + goto ERROR2; > + } >=20 > - Nic->ConnectState =3D WifiMgrDisconnected; > - Nic->ScanState =3D WifiMgrScanFinished; > + // > + // Create and start the timer for the status check > + // > + Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_SIGNAL | EVT_TIMER, > + TPL_CALLBACK, > + WifiMgrOnTimerTick, > + Nic, > + &Nic->TickTimer > + ); > + if (EFI_ERROR (Status)) { > + goto ERROR2; > + } >=20 > - OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); > - InsertTailList (&mPrivate->NicList, &Nic->Link); > - Nic->NicIndex =3D mPrivate->NicCount++; > - if (mPrivate->CurrentNic =3D=3D NULL) { > - mPrivate->CurrentNic =3D Nic; > - } > + Status =3D gBS->SetTimer (Nic->TickTimer, TimerPeriodic, > EFI_TIMER_PERIOD_MILLISECONDS (500)); > + if (EFI_ERROR (Status)) { > + goto ERROR3; > + } >=20 > - gBS->RestoreTPL (OldTpl); > + Nic->ConnectState =3D WifiMgrDisconnected; > + Nic->ScanState =3D WifiMgrScanFinished; > + > + OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); > + InsertTailList (&mPrivate->NicList, &Nic->Link); > + Nic->NicIndex =3D mPrivate->NicCount++; > + if (mPrivate->CurrentNic =3D=3D NULL) { > + mPrivate->CurrentNic =3D Nic; > + } > + > + gBS->RestoreTPL (OldTpl); > + } >=20 > Status =3D gBS->InstallProtocolInterface ( > &ControllerHandle, > @@ -385,10 +417,11 @@ WifiMgrDxeDriverBindingStop ( > IN EFI_HANDLE *ChildHandleBuffer OPTIONAL > ) > { > - EFI_STATUS Status; > - EFI_TPL OldTpl; > - WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier; > - WIFI_MGR_DEVICE_DATA *Nic; > + EFI_STATUS Status; > + EFI_TPL OldTpl; > + WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier; > + WIFI_MGR_DEVICE_DATA *Nic; > + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > Status =3D gBS->OpenProtocol ( > ControllerHandle, > @@ -481,7 +514,15 @@ WifiMgrDxeDriverBindingStop ( > // > OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); >=20 > - RemoveEntryList (&Nic->Link); > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFiProfileSyncProtocolGuid, > + NULL, > + (VOID **)&WiFiProfileSyncProtocol > + ); > + if (EFI_ERROR (Status)) { > + RemoveEntryList (&Nic->Link); > + } > + > mPrivate->NicCount--; > if (mPrivate->CurrentNic =3D=3D Nic) { > mPrivate->CurrentNic =3D NULL; > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > index 7b2e41e155..047f85dbc2 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > @@ -47,6 +47,7 @@ > #include > #include > #include > +#include >=20 > // > // Produced Protocols > @@ -73,7 +74,8 @@ > // > #define WIFI_MGR_DXE_VERSION 0xb >=20 > -#define OUI_IEEE_80211I 0xAC0F00 > +#define OUI_IEEE_80211I 0xAC0F00 > +#define MAX_WIFI_CONNETION_ATTEMPTS 3 >=20 > typedef enum { > Ieee80211PairwiseCipherSuiteUseGroupCipherSuite =3D 0, > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > index 59bac48c42..7d471e7591 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > @@ -19,6 +19,8 @@ EFI_EAP_TYPE mEapSecondAuthMethod[] =3D { > EFI_EAP_TYPE_MSCHAPV2 > }; >=20 > +UINT8 mWifiConnectionCount =3D 0; > + > /** > The callback function for scan operation. This function updates networ= ks > according to the latest scan result, and trigger UI refresh. > @@ -424,18 +426,26 @@ WifiMgrConfigPassword ( > return EFI_NOT_FOUND; > } >=20 > - AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1) *= sizeof > (UINT8)); > + if (StrLen (Profile->Password) >=3D PASSWORD_STORAGE_SIZE) { > + ASSERT (EFI_INVALID_PARAMETER); > + return EFI_INVALID_PARAMETER; > + } > + > + AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1) * > sizeof (CHAR8)); > if (AsciiPassword =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPassword, > PASSWORD_STORAGE_SIZE); > - Status =3D Supplicant->SetData ( > - Supplicant, > - EfiSupplicant80211PskPassword, > - AsciiPassword, > - (StrLen (Profile->Password) + 1) * sizeof (UINT= 8) > - ); > + Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 > *)AsciiPassword, (StrLen (Profile->Password) + 1)); > + if (!EFI_ERROR (Status)) { > + Status =3D Supplicant->SetData ( > + Supplicant, > + EfiSupplicant80211PskPassword, > + AsciiPassword, > + (StrLen (Profile->Password) + 1) * sizeof (CH= AR8) > + ); > + } > + > ZeroMem (AsciiPassword, AsciiStrLen ((CHAR8 *)AsciiPassword) + 1); > FreePool (AsciiPassword); >=20 > @@ -465,19 +475,20 @@ WifiMgrConfigEap ( > IN WIFI_MGR_NETWORK_PROFILE *Profile > ) > { > - EFI_STATUS Status; > - EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > - EFI_EAP_TYPE EapAuthMethod; > - EFI_EAP_TYPE EapSecondAuthMethod; > - EFI_EAP_TYPE *AuthMethodList; > - CHAR8 *Identity; > - UINTN IdentitySize; > - CHAR16 *Password; > - UINTN PasswordSize; > - UINTN EncryptPasswordLen; > - CHAR8 *AsciiEncryptPassword; > - UINTN AuthMethodListSize; > - UINTN Index; > + EFI_STATUS Status; > + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; > + EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > + EFI_EAP_TYPE EapAuthMethod; > + EFI_EAP_TYPE EapSecondAuthMethod; > + EFI_EAP_TYPE *AuthMethodList; > + CHAR8 *Identity; > + UINTN IdentitySize; > + CHAR16 *Password; > + UINTN PasswordSize; > + UINTN EncryptPasswordLen; > + CHAR8 *AsciiEncryptPassword; > + UINTN AuthMethodListSize; > + UINTN Index; >=20 > if ((Nic =3D=3D NULL) || (Nic->EapConfig =3D=3D NULL) || (Profile =3D= =3D NULL)) { > return EFI_INVALID_PARAMETER; > @@ -567,7 +578,13 @@ WifiMgrConfigEap ( > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize)= ; > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NU= LL, > (VOID **)&WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + CopyMem (Identity, &Profile->EapIdentity, IdentitySize); > + } else { > + UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySiz= e); > + } > + > Status =3D EapConfig->SetData ( > EapConfig, > EFI_EAP_TYPE_IDENTITY, > @@ -892,6 +909,133 @@ WifiMgrPrepareConnection ( > return EFI_SUCCESS; > } >=20 > +/** > + Will reset NiC data, get profile from profile sync driver, and send fo= r > + another connection attempt.This function should not be called more tha= n > + 3 times. > + > + @param[in] WiFiProfileSyncProtocol The target network profile to > connect. > + > + @retval EFI_SUCCESS The operation is completed. > + @retval other Operation failure. > + > +**/ > +EFI_STATUS > +ConnectionRetry ( > + IN EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol > + ) > +{ > + EFI_STATUS Status; > + WIFI_MGR_DEVICE_DATA *Nic; > + EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp; > + EFI_SUPPLICANT_PROTOCOL *Supplicant; > + EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > + > + Nic =3D NULL; > + > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFi2ProtocolGuid, > + NULL, > + (VOID **)&Wmp > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiSupplicantProtocolGuid, > + NULL, > + (VOID **)&Supplicant > + ); > + if (EFI_ERROR (Status)) { > + Supplicant =3D NULL; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiEapConfigurationProtocolGuid, > + NULL, > + (VOID **)&EapConfig > + ); > + if (EFI_ERROR (Status)) { > + EapConfig =3D NULL; > + } > + > + // > + // Initialize Nic device data > + // > + Nic =3D AllocateZeroPool (sizeof (WIFI_MGR_DEVICE_DATA)); > + if (Nic =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + return Status; > + } > + > + Nic->Signature =3D WIFI_MGR_DEVICE_DATA_SIGNATURE; > + Nic->Private =3D mPrivate; > + Nic->Wmp =3D Wmp; > + Nic->Supplicant =3D Supplicant; > + Nic->EapConfig =3D EapConfig; > + Nic->UserSelectedProfile =3D NULL; > + Nic->OneTimeScanRequest =3D FALSE; > + > + if (Nic->Supplicant !=3D NULL) { > + Status =3D WifiMgrGetSupportedSuites (Nic); > + } > + > + if (!EFI_ERROR (Status)) { > + InitializeListHead (&Nic->ProfileList); > + > + Nic->ConnectPendingNetwork =3D (WIFI_MGR_NETWORK_PROFILE > *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE)); > + if (Nic->ConnectPendingNetwork =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to allocate > memory for ConnectPendingNetwork\n")); > + goto ERROR; > + } > + > + Status =3D WiFiProfileSyncProtocol->GetProfile (Nic- > >ConnectPendingNetwork, Nic->MacAddress); > + if (!EFI_ERROR (Status) && (Nic->ConnectPendingNetwork !=3D NULL)) { > + Status =3D WifiMgrConnectToNetwork (Nic, Nic- > >ConnectPendingNetwork); > + if (!EFI_ERROR (Status)) { > + return Status; > + } > + } else { > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get WiFi > profile with status %r\n", Status)); > + } > + } else { > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get > Supported suites with status %r\n", Status)); > + } > + > + if (Nic->ConnectPendingNetwork !=3D NULL) { > + if (Nic->ConnectPendingNetwork->Network.AKMSuite !=3D NULL) { > + FreePool (Nic->ConnectPendingNetwork->Network.AKMSuite); > + } > + > + if (Nic->ConnectPendingNetwork->Network.CipherSuite !=3D NULL) { > + FreePool (Nic->ConnectPendingNetwork->Network.CipherSuite); > + } > + > + FreePool (Nic->ConnectPendingNetwork); > + } > + > +ERROR: > + if (Nic->Supplicant !=3D NULL) { > + if (Nic->SupportedSuites.SupportedAKMSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedAKMSuites); > + } > + > + if (Nic->SupportedSuites.SupportedSwCipherSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedSwCipherSuites); > + } > + > + if (Nic->SupportedSuites.SupportedHwCipherSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedHwCipherSuites); > + } > + } > + > + FreePool (Nic); > + > + return Status; > +} > + > /** > The callback function for connect operation. >=20 > @@ -908,12 +1052,13 @@ WifiMgrOnConnectFinished ( > IN VOID *Context > ) > { > - EFI_STATUS Status; > - WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken; > - WIFI_MGR_NETWORK_PROFILE *ConnectedProfile; > - UINT8 SecurityType; > - UINT8 SSIdLen; > - CHAR8 *AsciiSSId; > + EFI_STATUS Status; > + WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken; > + WIFI_MGR_NETWORK_PROFILE *ConnectedProfile; > + UINT8 SecurityType; > + UINT8 SSIdLen; > + CHAR8 *AsciiSSId; > + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > ASSERT (Context !=3D NULL); >=20 > @@ -925,6 +1070,24 @@ WifiMgrOnConnectFinished ( > ASSERT (ConfigToken->Type =3D=3D TokenTypeConnectNetworkToken); >=20 > ASSERT (ConfigToken->Token.ConnectNetworkToken !=3D NULL); > + > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL= , > (VOID **)&WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + WiFiProfileSyncProtocol->SetConnectState (ConfigToken- > >Token.ConnectNetworkToken->ResultCode); > + if ((mWifiConnectionCount < MAX_WIFI_CONNETION_ATTEMPTS) && > + (ConfigToken->Token.ConnectNetworkToken->ResultCode !=3D > ConnectSuccess)) > + { > + mWifiConnectionCount++; > + gBS->CloseEvent (Event); > + Status =3D ConnectionRetry (WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + return; > + } > + > + WiFiProfileSyncProtocol->SetConnectState (Status); > + } > + } > + > if (ConfigToken->Token.ConnectNetworkToken->Status !=3D EFI_SUCCESS) { > if (ConfigToken->Nic->OneTimeConnectRequest) { > // > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > index 4ad5643c24..518572922f 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > @@ -672,10 +672,23 @@ WifiMgrCleanProfileSecrets ( > IN WIFI_MGR_NETWORK_PROFILE *Profile > ) > { > + EFI_STATUS Status; > + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; > + > ZeroMem (Profile->Password, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->EapPassword, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->PrivateKeyPassword, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); >=20 > + // > + // When EFI WiFi profile sync protocol is found the system is perform= ing a > recovery boot in secure > + // boot mode. The profile sync driver will manage the CA certificate,= client > certificate, and key > + // data, cleaning them at exit boot services. > + // > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL= , > (VOID **)&WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + return; > + } > + > if (Profile->CACertData !=3D NULL) { > ZeroMem (Profile->CACertData, Profile->CACertSize); > FreePool (Profile->CACertData); > -- > 2.37.3.windows.1