From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 9687A211B6C35 for ; Thu, 17 Jan 2019 13:02:46 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 411ABEBD; Thu, 17 Jan 2019 13:02:46 -0800 (PST) Received: from supven01-ThinkStation-P720.austin.arm.com (supven01-ThinkStation-P720.austin.arm.com [10.118.28.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 109CF3F819; Thu, 17 Jan 2019 13:02:46 -0800 (PST) Message-ID: <5443ac9a000642b14e8a77b24d1116f86e853919.camel@arm.com> From: Supreeth Venkatesh To: Eric Jin , edk2-devel@lists.01.org Date: Thu, 17 Jan 2019 15:02:45 -0600 In-Reply-To: <20181127055731.103656-1-eric.jin@intel.com> References: <20181127055731.103656-1-eric.jin@intel.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Subject: Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct Enable parameter in ReceiveFilters test X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 21:02:46 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Tue, 2018-11-27 at 13:57 +0800, Eric Jin wrote: > The patch is applied to the IHV part. > > Fix bug - set EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit > in Enable parameter to make sure Multicast is enabled. > Add one checkpoint when MCastFilterCount is zero > > Cc: Supreeth Venkatesh > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Jin Acked-by: Supreeth Venkatesh > --- > .../IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c | 4 +- > .../IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h | 5 + > .../BlackBoxTest/SimpleNetworkBBTestConformance.c | 198 > ++++++++++++--------- > 3 files changed, 118 insertions(+), 89 deletions(-) > > diff --git a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .c b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .c > index 6ea6c4c..7234323 100644 > --- a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .c > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .c > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2016 Unified EFI, Inc.
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights > reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights > reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of > the BSD License > @@ -112,6 +112,8 @@ EFI_GUID > gSimpleNetworkBBTestConformanceAssertionGuid041 = > EFI_TEST_SIMPLENETWOR > > EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042 = > EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_042_GUID; > > +EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043 = > EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID; > + > EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid001 = > EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID; > > EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid002 = > EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_002_GUID; > diff --git a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .h b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .h > index 190787c..3efea81 100644 > --- a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .h > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid > .h > @@ -235,6 +235,11 @@ extern EFI_GUID > gSimpleNetworkBBTestConformanceAssertionGuid041; > > extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042; > > +#define EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID \ > +{ 0x8cec0b86, 0x7773, 0x4d3c, { 0x84, 0x13, 0x26, 0x37, 0xfb, 0xd0, > 0x8e, 0x1b } } > + > +extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043; > + > #define EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID \ > { 0xf58651fe, 0x0538, 0x4407, { 0x88, 0xe0, 0x88, 0xb8, 0xda, 0x18, > 0x38, 0x3a } } > > diff --git a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp > leNetworkBBTestConformance.c b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp > leNetworkBBTestConformance.c > index ccbbad0..03a0d04 100644 > --- a/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp > leNetworkBBTestConformance.c > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp > leNetworkBBTestConformance.c > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2016 Unified EFI, Inc.
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights > reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights > reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of > the BSD License > @@ -581,10 +581,9 @@ BBTestReceiveFilterConformanceTest ( > { > EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; > EFI_STATUS Status; > - EFI_STATUS StatusBuf[5]; > - EFI_TEST_ASSERTION AssertionType[5]; > + EFI_TEST_ASSERTION AssertionType; > EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; > - EFI_SIMPLE_NETWORK_STATE State1, State2; > + EFI_MAC_ADDRESS MAC; > > // > // Get the Standard Library Interface > @@ -608,16 +607,14 @@ BBTestReceiveFilterConformanceTest ( > // Check whether the state of network interface is > EfiSimpleNetworkStopped. > // If not, change the state to EfiSimpleNetworkStopped. > // > - State1 = SnpInterface->Mode->State; > - if (State1 == EfiSimpleNetworkInitialized) { > + if (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) { > Status = SnpInterface->Shutdown (SnpInterface); > if (EFI_ERROR(Status)) { > return Status; > } > } > > - State2 = SnpInterface->Mode->State; > - if (State2 == EfiSimpleNetworkStarted) { > + if (SnpInterface->Mode->State == EfiSimpleNetworkStarted) { > Status = SnpInterface->Stop (SnpInterface); > if (EFI_ERROR(Status)) { > return Status; > @@ -628,13 +625,24 @@ BBTestReceiveFilterConformanceTest ( > // Assertion Point 5.6.2.1 > // Call ReceiveFilters() function if network interface not start. > // > - StatusBuf[0] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, > FALSE, 0, NULL); > - if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode- > >State == EfiSimpleNetworkStopped)) { > - AssertionType[0] = EFI_TEST_ASSERTION_PASSED; > + Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, > 0, NULL); > + if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == > EfiSimpleNetworkStopped)) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > } else { > - AssertionType[0] = EFI_TEST_ASSERTION_FAILED; > + AssertionType = EFI_TEST_ASSERTION_FAILED; > } > > + StandardLib->RecordAssertion ( > + StandardLib, > + AssertionType, > + gSimpleNetworkBBTestConformanceAssertionGuid006, > + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() when network interface not start.", > + L"%a:%d:Status - %r", > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > // > // Assertion Point 5.6.2.2 > // Call ReceiveFilters() function if network interface not > initialized. > @@ -644,13 +652,24 @@ BBTestReceiveFilterConformanceTest ( > return Status; > } > > - StatusBuf[1] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, > FALSE, 0, NULL); > - if (StatusBuf[1] == EFI_DEVICE_ERROR) { > - AssertionType[1] = EFI_TEST_ASSERTION_PASSED; > + Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, > 0, NULL); > + if (Status == EFI_DEVICE_ERROR) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > } else { > - AssertionType[1] = EFI_TEST_ASSERTION_FAILED; > + AssertionType = EFI_TEST_ASSERTION_FAILED; > } > - > + > + StandardLib->RecordAssertion ( > + StandardLib, > + AssertionType, > + gSimpleNetworkBBTestConformanceAssertionGuid007, > + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() when network interface not initialized.", > + L"%a:%d:Status - %r", > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > // > // Assertion Point 5.6.2.3 > // Call ReceiveFilters() function with invalid parameters. > @@ -663,93 +682,96 @@ BBTestReceiveFilterConformanceTest ( > // > // Call ReceiveFilters with invalide Enable > // > - StatusBuf[2] = SnpInterface->ReceiveFilters (SnpInterface, > ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL); > - if (StatusBuf[2] == EFI_INVALID_PARAMETER) { > - AssertionType[2] = EFI_TEST_ASSERTION_PASSED; > - } else { > - AssertionType[2] = EFI_TEST_ASSERTION_FAILED; > - } > - > - // > - // Call ReceiveFilters with invalide MCastFilterCnt > - // > - StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, > FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, NULL); > - if (StatusBuf[3] == EFI_INVALID_PARAMETER) { > - AssertionType[3] = EFI_TEST_ASSERTION_PASSED; > - } else { > - AssertionType[3] = EFI_TEST_ASSERTION_FAILED; > - } > - > - // > - // Call ReceiveFilters with MCastFilterCnt not match MCastFilter > - // > - StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, > FALSE, 1, NULL); > - if (StatusBuf[4] == EFI_INVALID_PARAMETER) { > - AssertionType[4] = EFI_TEST_ASSERTION_PASSED; > + Status = SnpInterface->ReceiveFilters (SnpInterface, > ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL); > + if (Status == EFI_INVALID_PARAMETER) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > } else { > - AssertionType[4] = EFI_TEST_ASSERTION_FAILED; > + AssertionType = EFI_TEST_ASSERTION_FAILED; > } > > - > - StandardLib->RecordAssertion ( > - StandardLib, > - AssertionType[0], > - gSimpleNetworkBBTestConformanceAssertionGuid006, > - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() when network interface not start.", > - L"%a:%d:Status - %r", > - __FILE__, > - (UINTN)__LINE__, > - StatusBuf[0] > - ); > - > - StandardLib->RecordAssertion ( > - StandardLib, > - AssertionType[1], > - gSimpleNetworkBBTestConformanceAssertionGuid007, > - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() when network interface not initialized.", > - L"%a:%d:Status - %r", > - __FILE__, > - (UINTN)__LINE__, > - StatusBuf[1] > - ); > - > StandardLib->RecordAssertion ( > StandardLib, > - AssertionType[2], > + AssertionType, > gSimpleNetworkBBTestConformanceAssertionGuid008, > L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with invalid Enable.", > L"%a:%d:Status - %r", > __FILE__, > (UINTN)__LINE__, > - StatusBuf[2] > + Status > ); > > - StandardLib->RecordAssertion ( > - StandardLib, > - AssertionType[3], > - gSimpleNetworkBBTestConformanceAssertionGuid009, > - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with invalid MCastFilterCnt.", > - L"%a:%d:Status - %r", > - __FILE__, > - (UINTN)__LINE__, > - StatusBuf[3] > - ); > + // > + // Call ReceiveFilters with invalide MCastFilterCnt > + // > + if ((SnpInterface->Mode->ReceiveFilterMask & > EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) { > + SctSetMem (&MAC, sizeof (MAC), 0x00); > + MAC.Addr[0] = 0x01; > + MAC.Addr[1] = 0x00; > + MAC.Addr[2] = 0x5e; > + MAC.Addr[3] = 0x00; > + MAC.Addr[4] = 0x00; > + MAC.Addr[5] = 0x02; MAC is Hardcoded. Why? Need Clarification. > + > + Status = SnpInterface->ReceiveFilters (SnpInterface, > EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode- > >MaxMCastFilterCount + 1, &MAC); > + if (Status == EFI_INVALID_PARAMETER) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > + } else { > + AssertionType = EFI_TEST_ASSERTION_FAILED; > + } > > - StandardLib->RecordAssertion ( > - StandardLib, > - AssertionType[4], > - gSimpleNetworkBBTestConformanceAssertionGuid010, > - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", > - L"%a:%d:Status - %r", > - __FILE__, > - (UINTN)__LINE__, > - StatusBuf[4] > - ); > + StandardLib->RecordAssertion ( > + StandardLib, > + AssertionType, > + gSimpleNetworkBBTestConformanceAssertionGuid009, > + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with invalid MCastFilterCnt is greater than > Snp->Mode->MaxMCastFilterCount.", > + L"%a:%d:Status - %r", > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > + Status = SnpInterface->ReceiveFilters (SnpInterface, > EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC); > + if (Status == EFI_INVALID_PARAMETER) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > + } else { > + AssertionType = EFI_TEST_ASSERTION_FAILED; > + } > + > + StandardLib->RecordAssertion ( > + StandardLib, > + AssertionType, > + gSimpleNetworkBBTestConformanceAssertionGuid043, > + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.", > + L"%a:%d:Status - %r", > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > + Status = SnpInterface->ReceiveFilters (SnpInterface, > EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL); > + if (Status == EFI_INVALID_PARAMETER) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > + } else { > + AssertionType = EFI_TEST_ASSERTION_FAILED; > + } > + > + StandardLib->RecordAssertion ( > + StandardLib, > + AssertionType, > + gSimpleNetworkBBTestConformanceAssertionGuid010, > + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - > Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", > + L"%a:%d:Status - %r", > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > + } > > // > // Restore SNP State > // > - if (State1 == EfiSimpleNetworkStopped) { > + if (SnpInterface->Mode->State == EfiSimpleNetworkStopped) { > Status = SnpInterface->Shutdown (SnpInterface); > if (EFI_ERROR(Status)) { > return Status; > @@ -760,7 +782,7 @@ BBTestReceiveFilterConformanceTest ( > return Status; > } > } > - > + > return EFI_SUCCESS; > } >