public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Eric Jin <eric.jin@intel.com>
To: edk2-devel@lists.01.org
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	Jiaxin Wu <jiaxin.wu@intel.com>
Subject: [PATCH] uefi-sct/SctPkg:Enhance the SimpleNetwork Test
Date: Sun, 14 Oct 2018 10:06:49 +0800	[thread overview]
Message-ID: <20181014020649.1612-1-eric.jin@intel.com> (raw)

Add the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit in the Enable parameter
Add one checkpoint to MCastFilterCount is zero

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
 .../SimpleNetwork/BlackBoxTest/Guid.c         |  4 +-
 .../SimpleNetwork/BlackBoxTest/Guid.h         |  7 +-
 .../SimpleNetworkBBTestConformance.c          | 66 +++++++++++++------
 .../SimpleNetwork/BlackBoxTest/Guid.c         |  4 +-
 .../SimpleNetwork/BlackBoxTest/Guid.h         |  7 +-
 .../SimpleNetworkBBTestConformance.c          | 66 +++++++++++++------
 6 files changed, 110 insertions(+), 44 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
index 6ea6c4cb..72343236 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   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/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
index 281d893a..bf909d1c 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -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/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index ccbbad08..b65d7d3b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -581,11 +581,12 @@ BBTestReceiveFilterConformanceTest (
 {
   EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
   EFI_STATUS                            Status;
-  EFI_STATUS                            StatusBuf[5];
-  EFI_TEST_ASSERTION                    AssertionType[5];
+  EFI_STATUS                            StatusBuf[6];
+  EFI_TEST_ASSERTION                    AssertionType[6];
   EFI_SIMPLE_NETWORK_PROTOCOL           *SnpInterface;
   EFI_SIMPLE_NETWORK_STATE              State1, State2;
-
+  EFI_MAC_ADDRESS                       MAC;
+  
   //
   // Get the Standard Library Interface
   //
@@ -673,23 +674,37 @@ BBTestReceiveFilterConformanceTest (
   //
   //  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;
-  }
+  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;    
 
-  //
-  //  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;
-  } else {
-    AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
-  }
+    StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
+    if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+      AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
+    }
 
+    StatusBuf[5] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
+    if (StatusBuf[5] == EFI_INVALID_PARAMETER) {
+      AssertionType[5] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+    StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
+    if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
+      AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+  }
  
   StandardLib->RecordAssertion (
                  StandardLib,
@@ -728,7 +743,7 @@ BBTestReceiveFilterConformanceTest (
                  StandardLib,
                  AssertionType[3],
                  gSimpleNetworkBBTestConformanceAssertionGuid009,
-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt.",
+                 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__,
@@ -746,6 +761,17 @@ BBTestReceiveFilterConformanceTest (
                  StatusBuf[4]
                  );
 
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType[5],
+                 gSimpleNetworkBBTestConformanceAssertionGuid043,
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.",
+                 L"%a:%d:Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 StatusBuf[5]
+                 );
+
   //
   // Restore SNP State
   //
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 6ea6c4cb..72343236 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.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   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 27728964..1a6b8880 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
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -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/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index ccbbad08..b65d7d3b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -581,11 +581,12 @@ BBTestReceiveFilterConformanceTest (
 {
   EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
   EFI_STATUS                            Status;
-  EFI_STATUS                            StatusBuf[5];
-  EFI_TEST_ASSERTION                    AssertionType[5];
+  EFI_STATUS                            StatusBuf[6];
+  EFI_TEST_ASSERTION                    AssertionType[6];
   EFI_SIMPLE_NETWORK_PROTOCOL           *SnpInterface;
   EFI_SIMPLE_NETWORK_STATE              State1, State2;
-
+  EFI_MAC_ADDRESS                       MAC;
+  
   //
   // Get the Standard Library Interface
   //
@@ -673,23 +674,37 @@ BBTestReceiveFilterConformanceTest (
   //
   //  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;
-  }
+  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;    
 
-  //
-  //  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;
-  } else {
-    AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
-  }
+    StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
+    if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+      AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
+    }
 
+    StatusBuf[5] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
+    if (StatusBuf[5] == EFI_INVALID_PARAMETER) {
+      AssertionType[5] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+    StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
+    if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
+      AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+  }
  
   StandardLib->RecordAssertion (
                  StandardLib,
@@ -728,7 +743,7 @@ BBTestReceiveFilterConformanceTest (
                  StandardLib,
                  AssertionType[3],
                  gSimpleNetworkBBTestConformanceAssertionGuid009,
-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt.",
+                 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__,
@@ -746,6 +761,17 @@ BBTestReceiveFilterConformanceTest (
                  StatusBuf[4]
                  );
 
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType[5],
+                 gSimpleNetworkBBTestConformanceAssertionGuid043,
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.",
+                 L"%a:%d:Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 StatusBuf[5]
+                 );
+
   //
   // Restore SNP State
   //
-- 
2.18.0.windows.1



             reply	other threads:[~2018-10-14  2:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14  2:06 Eric Jin [this message]
2018-10-15  2:30 ` [PATCH] uefi-sct/SctPkg:Enhance the SimpleNetwork Test Supreeth Venkatesh
2018-10-15 13:09   ` Supreeth Venkatesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181014020649.1612-1-eric.jin@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox