public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
@ 2023-11-14 14:28 Igor Kulchytskyy via groups.io
  2023-11-14 14:29 ` Chang, Abner via groups.io
  2023-11-14 17:26 ` Leif Lindholm
  0 siblings, 2 replies; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-14 14:28 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Abner Chang, Nickle Wang

Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
 2 files changed, 120 insertions(+), 49 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0f622e05a9..ae83cd3c97 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {
+    return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface);
   while (TRUE) {
-    if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize) == 0) {
+    if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface) == 0) &&
+        (VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
+         VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
+    {
       return ThisNetworkInterface;
     }

@@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {
+    return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface);
   while (TRUE) {
     if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +487,42 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+          01h is Ipv4
+          02h is Ipv6
+
+**/
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS                     Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA         *DeviceDescriptor;
+
+  Data             = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+    Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&mSmbios);
+    if (EFI_ERROR (Status)) {
+      return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+    }
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, &DeviceDescriptor, &Data); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+      (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+    return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +559,18 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, &DeviceDescriptor, &Data); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+    if ((Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4) &&
+        (Data->HostIpAddressFormat != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case
+    {
+      DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface requires Ipv6\n", __func__));
+      return EFI_UNSUPPORTED;
+    } else if ((Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) &&
+               (Data->HostIpAddressFormat != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case
+    {
+      DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface requires IPv4\n", __func__));
+      return EFI_UNSUPPORTED;
+    }
+
     //
     // Check if we can reach out Redfish service using this network interface.
     // Check with MAC address using Device Descriptor Data Device Type 04 and Type 05.
@@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  EFI_STATUS                                       Status;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterfaceIntn;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE           *ThisNetworkInterface;
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
@@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkInterface (

   ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface);
   while (TRUE) {
+    // If Get Subnet Info failed then skip this interface
+    Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, ImageHandle); // Get subnet info
+    if (EFI_ERROR (Status)) {
+      if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterfaceIntn->Entry)) {
+        break;
+      }
+
+      ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterfaceIntn->Entry);
+      continue;
+    }
+
     ThisNetworkInterface->IsIpv6 = FALSE;
     if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) {
       ThisNetworkInterface->IsIpv6 = TRUE;
     }

     CopyMem ((VOID *)&ThisNetworkInterface->MacAddress, &ThisNetworkInterfaceIntn->MacAddress, ThisNetworkInterfaceIntn->HwAddressSize);
-    NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, ImageHandle); // Get subnet info.
     if (!ThisNetworkInterface->IsIpv6) {
       IP4_COPY_ADDRESS (&ThisNetworkInterface->SubnetId.v4, &ThisNetworkInterfaceIntn->SubnetAddr.v4); // IPv4 subnet information.
     } else {
@@ -1230,7 +1300,12 @@ RedfishServiceAcquireService (

   if (TargetNetworkInterface != NULL) {
     TargetNetworkInterfaceInternal = GetTargetNetworkInterfaceInternal (TargetNetworkInterface);
-    NumNetworkInterfaces           = 1;
+    if (TargetNetworkInterfaceInternal == NULL) {
+      DEBUG ((DEBUG_ERROR, "%a:No network interface on platform.\n", __func__));
+      return EFI_UNSUPPORTED;
+    }
+
+    NumNetworkInterfaces = 1;
   } else {
     TargetNetworkInterfaceInternal = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface);
     NumNetworkInterfaces           = NumberOfNetworkInterface ();
@@ -1260,7 +1335,13 @@ RedfishServiceAcquireService (
       // Get subnet information in case subnet information is not set because
       // RedfishServiceGetNetworkInterfaces hasn't been called yet.
       //
-      NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInternal, ImageHandle);
+      Status1 = NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInternal, ImageHandle);
+      if (EFI_ERROR (Status1)) {
+        DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n", __func__));
+        FreePool (Instance);
+        continue;
+      }
+
       NewInstance = TRUE;
     }

@@ -1547,26 +1628,25 @@ TestForRequiredProtocols (
                     ControllerHandle,
                     EFI_OPEN_PROTOCOL_TEST_PROTOCOL
                     );
-    if (EFI_ERROR (Status)) {
-      return EFI_UNSUPPORTED;
-    }
-
-    Status = gBS->OpenProtocol (
-                    ControllerHandle,
-                    gRequiredProtocol[Index].DiscoveredProtocolGuid,
-                    (VOID **)&Id,
-                    This->DriverBindingHandle,
-                    ControllerHandle,
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                    );
     if (!EFI_ERROR (Status)) {
-      // Already installed
-      return EFI_UNSUPPORTED;
+      Status = gBS->OpenProtocol (
+                      ControllerHandle,
+                      gRequiredProtocol[Index].DiscoveredProtocolGuid,
+                      (VOID **)&Id,
+                      This->DriverBindingHandle,
+                      ControllerHandle,
+                      EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                      );
+      if (EFI_ERROR (Status)) {
+        if (Index == ListCount - 1) {
+          DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this controller handle: %p.\n", __func__, ControllerHandle));
+          return EFI_SUCCESS;
+        }
+      }
     }
   }

-  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on this controller handle: %p.\n", __func__, ControllerHandle));
-  return EFI_SUCCESS;
+  return EFI_UNSUPPORTED;
 }

 /**
@@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
   EFI_TPL                                          OldTpl;
   BOOLEAN                                          NewNetworkInterfaceInstalled;
+  UINT8                                            IpType;
+  UINTN                                            ListCount;

+  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
   NewNetworkInterfaceInstalled = FALSE;
   Index                        = 0;
-  do {
+
+  // Get IP Type to filter out unnecessary network protocol if possible
+  IpType = GetHiIpProtocolType ();
+
+  for (Index = 0; Index < ListCount; Index++) {
+    // Check IP Type and skip an unnecessary network protocol if does not match
+    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
+      continue;
+    }
+
     Status = gBS->OpenProtocol (
                     // Already in list?
                     ControllerHandle,
@@ -1615,11 +1707,6 @@ BuildupNetworkInterface (
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                     );
     if (!EFI_ERROR (Status)) {
-      Index++;
-      if (Index == (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
-        break;
-      }
-
       continue;
     }

@@ -1632,11 +1719,6 @@ BuildupNetworkInterface (
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                     );
     if (EFI_ERROR (Status)) {
-      Index++;
-      if (Index == (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
-        break;
-      }
-
       continue;
     }

@@ -1695,11 +1777,6 @@ BuildupNetworkInterface (
                     ProtocolDiscoverIdPtr
                     );
     if (EFI_ERROR (Status)) {
-      Index++;
-      if (Index == (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
-        break;
-      }
-
       continue;
     }

@@ -1756,25 +1833,13 @@ BuildupNetworkInterface (
           }
         } else {
           DEBUG ((DEBUG_MANAGEABILITY, "%a: Not REST EX, continue with next\n", __func__));
-          Index++;
-          if (Index == (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
-            break;
-          }
-
           continue;
         }
       }

       return Status;
-    } else {
-      Index++;
-      if (Index == (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
-        break;
-      }
-
-      continue;
     }
-  } while (Index < (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL)));
+  }

   return EFI_DEVICE_ERROR;
 }
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
index 01454acc1d..3093eea0d5 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
@@ -39,6 +39,12 @@
 #define REDFISH_DISCOVER_VERSION                    0x00010000
 #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY

+#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
+#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
+#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
+#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
+#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
+
 //
 // GUID definitions
 //
--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111197): https://edk2.groups.io/g/devel/message/111197
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 14:28 [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow Igor Kulchytskyy via groups.io
@ 2023-11-14 14:29 ` Chang, Abner via groups.io
  2023-11-14 17:26 ` Leif Lindholm
  1 sibling, 0 replies; 23+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-14 14:29 UTC (permalink / raw)
  To: Igor Kulchytskyy, devel@edk2.groups.io; +Cc: Nickle Wang

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Igor Kulchytskyy <igork@ami.com>
> Sent: Tuesday, November 14, 2023 10:28 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Nickle Wang
> <nicklew@nvidia.com>
> Subject: [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the
> Redfish Discover flow
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Filter out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> ++++++++++++++------
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>  2 files changed, 120 insertions(+), 49 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 0f622e05a9..ae83cd3c97 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
>  {
>    EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *ThisNetworkInterface;
>
> +  if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {
> +    return NULL;
> +  }
> +
>    ThisNetworkInterface =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> (&mEfiRedfishDiscoverNetworkInterface);
>    while (TRUE) {
> -    if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> >HwAddressSize) == 0) {
> +    if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface) == 0)
> &&
> +        (VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
> +         VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
> +    {
>        return ThisNetworkInterface;
>      }
>
> @@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
>  {
>    EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *ThisNetworkInterface;
>
> +  if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {
> +    return NULL;
> +  }
> +
>    ThisNetworkInterface =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> (&mEfiRedfishDiscoverNetworkInterface);
>    while (TRUE) {
>      if (ThisNetworkInterface->OpenDriverControllerHandle ==
> ControllerHandle) {
> @@ -476,6 +487,42 @@ CheckIsIpVersion6 (
>    return FALSE;
>  }
>
> +/**
> +  This function returns the  IP type supported by the Host Interface.
> +
> +  @retval 00h is Unknown
> +          01h is Ipv4
> +          02h is Ipv6
> +
> +**/
> +UINT8
> +GetHiIpProtocolType (
> +  VOID
> +  )
> +{
> +  EFI_STATUS                     Status;
> +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> +  REDFISH_INTERFACE_DATA         *DeviceDescriptor;
> +
> +  Data             = NULL;
> +  DeviceDescriptor = NULL;
> +  if (mSmbios == NULL) {
> +    Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID
> **)&mSmbios);
> +    if (EFI_ERROR (Status)) {
> +      return
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +    }
> +  }
> +
> +  Status = RedfishGetHostInterfaceProtocolData (mSmbios,
> &DeviceDescriptor, &Data); // Search for SMBIOS type 42h
> +  if (!EFI_ERROR (Status) && (Data != NULL) &&
> +      (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
> +  {
> +    return Data->HostIpAddressFormat;
> +  }
> +
> +  return
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +
>  /**
>    This function discover Redfish service through SMBIOS host interface.
>
> @@ -512,6 +559,18 @@ DiscoverRedfishHostInterface (
>
>    Status = RedfishGetHostInterfaceProtocolData (mSmbios,
> &DeviceDescriptor, &Data); // Search for SMBIOS type 42h
>    if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
> +    if ((Instance->NetworkInterface->NetworkProtocolType ==
> ProtocolTypeTcp4) &&
> +        (Data->HostIpAddressFormat !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case
> +    {
> +      DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host
> Interface requires Ipv6\n", __func__));
> +      return EFI_UNSUPPORTED;
> +    } else if ((Instance->NetworkInterface->NetworkProtocolType ==
> ProtocolTypeTcp6) &&
> +               (Data->HostIpAddressFormat !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case
> +    {
> +      DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host
> Interface requires IPv4\n", __func__));
> +      return EFI_UNSUPPORTED;
> +    }
> +
>      //
>      // Check if we can reach out Redfish service using this network interface.
>      // Check with MAC address using Device Descriptor Data Device Type 04
> and Type 05.
> @@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface (
>    OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> **NetworkIntfInstances
>    )
>  {
> +  EFI_STATUS                                       Status;
>    EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *ThisNetworkInterfaceIntn;
>    EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> *ThisNetworkInterface;
>    EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
> @@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkInterface (
>
>    ThisNetworkInterfaceIntn =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> (&mEfiRedfishDiscoverNetworkInterface);
>    while (TRUE) {
> +    // If Get Subnet Info failed then skip this interface
> +    Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn,
> ImageHandle); // Get subnet info
> +    if (EFI_ERROR (Status)) {
> +      if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface,
> &ThisNetworkInterfaceIntn->Entry)) {
> +        break;
> +      }
> +
> +      ThisNetworkInterfaceIntn =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode
> (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterfaceIntn->Entry);
> +      continue;
> +    }
> +
>      ThisNetworkInterface->IsIpv6 = FALSE;
>      if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) {
>        ThisNetworkInterface->IsIpv6 = TRUE;
>      }
>
>      CopyMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &ThisNetworkInterfaceIntn->MacAddress, ThisNetworkInterfaceIntn-
> >HwAddressSize);
> -    NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, ImageHandle);
> // Get subnet info.
>      if (!ThisNetworkInterface->IsIpv6) {
>        IP4_COPY_ADDRESS (&ThisNetworkInterface->SubnetId.v4,
> &ThisNetworkInterfaceIntn->SubnetAddr.v4); // IPv4 subnet information.
>      } else {
> @@ -1230,7 +1300,12 @@ RedfishServiceAcquireService (
>
>    if (TargetNetworkInterface != NULL) {
>      TargetNetworkInterfaceInternal = GetTargetNetworkInterfaceInternal
> (TargetNetworkInterface);
> -    NumNetworkInterfaces           = 1;
> +    if (TargetNetworkInterfaceInternal == NULL) {
> +      DEBUG ((DEBUG_ERROR, "%a:No network interface on platform.\n",
> __func__));
> +      return EFI_UNSUPPORTED;
> +    }
> +
> +    NumNetworkInterfaces = 1;
>    } else {
>      TargetNetworkInterfaceInternal =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> (&mEfiRedfishDiscoverNetworkInterface);
>      NumNetworkInterfaces           = NumberOfNetworkInterface ();
> @@ -1260,7 +1335,13 @@ RedfishServiceAcquireService (
>        // Get subnet information in case subnet information is not set because
>        // RedfishServiceGetNetworkInterfaces hasn't been called yet.
>        //
> -      NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInternal,
> ImageHandle);
> +      Status1 = NetworkInterfaceGetSubnetInfo
> (TargetNetworkInterfaceInternal, ImageHandle);
> +      if (EFI_ERROR (Status1)) {
> +        DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n",
> __func__));
> +        FreePool (Instance);
> +        continue;
> +      }
> +
>        NewInstance = TRUE;
>      }
>
> @@ -1547,26 +1628,25 @@ TestForRequiredProtocols (
>                      ControllerHandle,
>                      EFI_OPEN_PROTOCOL_TEST_PROTOCOL
>                      );
> -    if (EFI_ERROR (Status)) {
> -      return EFI_UNSUPPORTED;
> -    }
> -
> -    Status = gBS->OpenProtocol (
> -                    ControllerHandle,
> -                    gRequiredProtocol[Index].DiscoveredProtocolGuid,
> -                    (VOID **)&Id,
> -                    This->DriverBindingHandle,
> -                    ControllerHandle,
> -                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
> -                    );
>      if (!EFI_ERROR (Status)) {
> -      // Already installed
> -      return EFI_UNSUPPORTED;
> +      Status = gBS->OpenProtocol (
> +                      ControllerHandle,
> +                      gRequiredProtocol[Index].DiscoveredProtocolGuid,
> +                      (VOID **)&Id,
> +                      This->DriverBindingHandle,
> +                      ControllerHandle,
> +                      EFI_OPEN_PROTOCOL_GET_PROTOCOL
> +                      );
> +      if (EFI_ERROR (Status)) {
> +        if (Index == ListCount - 1) {
> +          DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this
> controller handle: %p.\n", __func__, ControllerHandle));
> +          return EFI_SUCCESS;
> +        }
> +      }
>      }
>    }
>
> -  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on
> this controller handle: %p.\n", __func__, ControllerHandle));
> -  return EFI_SUCCESS;
> +  return EFI_UNSUPPORTED;
>  }
>
>  /**
> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>    EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>    EFI_TPL                                          OldTpl;
>    BOOLEAN                                          NewNetworkInterfaceInstalled;
> +  UINT8                                            IpType;
> +  UINTN                                            ListCount;
>
> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>    NewNetworkInterfaceInstalled = FALSE;
>    Index                        = 0;
> -  do {
> +
> +  // Get IP Type to filter out unnecessary network protocol if possible
> +  IpType = GetHiIpProtocolType ();
> +
> +  for (Index = 0; Index < ListCount; Index++) {
> +    // Check IP Type and skip an unnecessary network protocol if does not
> match
> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> +      continue;
> +    }
> +
>      Status = gBS->OpenProtocol (
>                      // Already in list?
>                      ControllerHandle,
> @@ -1615,11 +1707,6 @@ BuildupNetworkInterface (
>                      EFI_OPEN_PROTOCOL_GET_PROTOCOL
>                      );
>      if (!EFI_ERROR (Status)) {
> -      Index++;
> -      if (Index == (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
> -        break;
> -      }
> -
>        continue;
>      }
>
> @@ -1632,11 +1719,6 @@ BuildupNetworkInterface (
>                      EFI_OPEN_PROTOCOL_GET_PROTOCOL
>                      );
>      if (EFI_ERROR (Status)) {
> -      Index++;
> -      if (Index == (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
> -        break;
> -      }
> -
>        continue;
>      }
>
> @@ -1695,11 +1777,6 @@ BuildupNetworkInterface (
>                      ProtocolDiscoverIdPtr
>                      );
>      if (EFI_ERROR (Status)) {
> -      Index++;
> -      if (Index == (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
> -        break;
> -      }
> -
>        continue;
>      }
>
> @@ -1756,25 +1833,13 @@ BuildupNetworkInterface (
>            }
>          } else {
>            DEBUG ((DEBUG_MANAGEABILITY, "%a: Not REST EX, continue with
> next\n", __func__));
> -          Index++;
> -          if (Index == (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
> -            break;
> -          }
> -
>            continue;
>          }
>        }
>
>        return Status;
> -    } else {
> -      Index++;
> -      if (Index == (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {
> -        break;
> -      }
> -
> -      continue;
>      }
> -  } while (Index < (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL)));
> +  }
>
>    return EFI_DEVICE_ERROR;
>  }
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index 01454acc1d..3093eea0d5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -39,6 +39,12 @@
>  #define REDFISH_DISCOVER_VERSION                    0x00010000
>  #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> >HwAddressSize))
> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp6))
> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp4))
> +#define IS_TCP4_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> +#define IS_TCP6_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> +
>  //
>  // GUID definitions
>  //
> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intended
> to be read only by the individual or entity to whom it is addressed or by their
> designee. If the reader of this message is not the intended recipient, you are
> on notice that any distribution of this message, in any form, is strictly
> prohibited. Please promptly notify the sender by reply e-mail or by telephone
> at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111199): https://edk2.groups.io/g/devel/message/111199
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 14:28 [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow Igor Kulchytskyy via groups.io
  2023-11-14 14:29 ` Chang, Abner via groups.io
@ 2023-11-14 17:26 ` Leif Lindholm
  2023-11-14 18:57   ` Igor Kulchytskyy via groups.io
  1 sibling, 1 reply; 23+ messages in thread
From: Leif Lindholm @ 2023-11-14 17:26 UTC (permalink / raw)
  To: devel, igork; +Cc: Abner Chang, Nickle Wang

On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> Filter out the network interfaces which are not supported by
> Redfish Host Interface.
> 
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> ---
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>   2 files changed, 120 insertions(+), 49 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 0f622e05a9..ae83cd3c97 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c


> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>     EFI_TPL                                          OldTpl;
>     BOOLEAN                                          NewNetworkInterfaceInstalled;
> +  UINT8                                            IpType;
> +  UINTN                                            ListCount;
> 
> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>     NewNetworkInterfaceInstalled = FALSE;
>     Index                        = 0;
> -  do {
> +
> +  // Get IP Type to filter out unnecessary network protocol if possible
> +  IpType = GetHiIpProtocolType ();
> +
> +  for (Index = 0; Index < ListCount; Index++) {
> +    // Check IP Type and skip an unnecessary network protocol if does not match
> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {

The logic of these macros is inverted compared to their names, though.

You want this test to read
   if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {

> +      continue;
> +    }
> +
>       Status = gBS->OpenProtocol (
>                       // Already in list?
>                       ControllerHandle,

> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index 01454acc1d..3093eea0d5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -39,6 +39,12 @@
>   #define REDFISH_DISCOVER_VERSION                    0x00010000
>   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
> 
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
> +#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> +#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))

And these macros to test for ==, not !=

Otherwise the code reads like it does the opposite of what it does.

(You could also keep the logic and call the macros IS_TCP#_MISMATCH, but 
that feels a bit convoluted.)

Regards,

Leif

> +
>   //
>   // GUID definitions
>   //
> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111212): https://edk2.groups.io/g/devel/message/111212
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 17:26 ` Leif Lindholm
@ 2023-11-14 18:57   ` Igor Kulchytskyy via groups.io
  2023-11-14 23:52     ` Mike Maslenkin
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-14 18:57 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io; +Cc: Abner Chang, Nickle Wang

Hi Leif,
Please see my comments below.
Thank you,
Igor


-----Original Message-----
From: Leif Lindholm <quic_llindhol@quicinc.com>
Sent: Tuesday, November 14, 2023 12:26 PM
To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> Filter out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> ---
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>   2 files changed, 120 insertions(+), 49 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 0f622e05a9..ae83cd3c97 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c


> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>     EFI_TPL                                          OldTpl;
>     BOOLEAN                                          NewNetworkInterfaceInstalled;
> +  UINT8                                            IpType;
> +  UINTN                                            ListCount;
>
> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>     NewNetworkInterfaceInstalled = FALSE;
>     Index                        = 0;
> -  do {
> +
> +  // Get IP Type to filter out unnecessary network protocol if possible
> +  IpType = GetHiIpProtocolType ();
> +
> +  for (Index = 0; Index < ListCount; Index++) {
> +    // Check IP Type and skip an unnecessary network protocol if does not match
> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {

The logic of these macros is inverted compared to their names, though.

You want this test to read
   if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {

> +      continue;
> +    }
> +
>       Status = gBS->OpenProtocol (
>                       // Already in list?
>                       ControllerHandle,

> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index 01454acc1d..3093eea0d5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -39,6 +39,12 @@
>   #define REDFISH_DISCOVER_VERSION                    0x00010000
>   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
> +#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> +#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))

And these macros to test for ==, not !=


Igor: First version tested "==", but we agreed that it may not work if we have a wrong value of IpType.

Otherwise the code reads like it does the opposite of what it does.

(You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
that feels a bit convoluted.)

Igor: I would prefer to go with IS_TCP#_MISMATCH names.

Regards,

Leif

> +
>   //
>   // GUID definitions
>   //
> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
>
>
> 
>
>

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111213): https://edk2.groups.io/g/devel/message/111213
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 18:57   ` Igor Kulchytskyy via groups.io
@ 2023-11-14 23:52     ` Mike Maslenkin
  2023-11-15  1:19       ` Chang, Abner via groups.io
  2023-11-15 12:01       ` Leif Lindholm
  0 siblings, 2 replies; 23+ messages in thread
From: Mike Maslenkin @ 2023-11-14 23:52 UTC (permalink / raw)
  To: devel, igork; +Cc: Leif Lindholm, Abner Chang, Nickle Wang

On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
<igork=ami.com@groups.io> wrote:
>
> Hi Leif,
> Please see my comments below.
> Thank you,
> Igor
>
>
> -----Original Message-----
> From: Leif Lindholm <quic_llindhol@quicinc.com>
> Sent: Tuesday, November 14, 2023 12:26 PM
> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
>
> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > Filter out the network interfaces which are not supported by
> > Redfish Host Interface.
> >
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > ---
> >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
> >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> >   2 files changed, 120 insertions(+), 49 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 0f622e05a9..ae83cd3c97 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>
>
> > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> >     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
> >     EFI_TPL                                          OldTpl;
> >     BOOLEAN                                          NewNetworkInterfaceInstalled;
> > +  UINT8                                            IpType;
> > +  UINTN                                            ListCount;
> >
> > +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> >     NewNetworkInterfaceInstalled = FALSE;
> >     Index                        = 0;
> > -  do {
> > +
> > +  // Get IP Type to filter out unnecessary network protocol if possible
> > +  IpType = GetHiIpProtocolType ();
> > +
> > +  for (Index = 0; Index < ListCount; Index++) {
> > +    // Check IP Type and skip an unnecessary network protocol if does not match
> > +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>
> The logic of these macros is inverted compared to their names, though.
>
> You want this test to read
>    if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>
> > +      continue;
> > +    }
> > +
> >       Status = gBS->OpenProtocol (
> >                       // Already in list?
> >                       ControllerHandle,
>
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > index 01454acc1d..3093eea0d5 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > @@ -39,6 +39,12 @@
> >   #define REDFISH_DISCOVER_VERSION                    0x00010000
> >   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
> >
> > +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
> > +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
> > +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
> > +#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > +#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
>
> And these macros to test for ==, not !=
>
>
> Igor: First version tested "==", but we agreed that it may not work if we have a wrong value of IpType.
>
> Otherwise the code reads like it does the opposite of what it does.
>
> (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
> that feels a bit convoluted.)
>
> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
>
> Regards,
>
> Leif

Sorry, could I add my 2 cents?

For me all newly added defines looks bad, just because those
implicitly use reference to a global variable
plus local variable state (i.e  current cycle index).

Could we rewrite code in a simple and straight forward manner, similar to:

if (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
  // The protocol type is not specified in SMBIOS table type 42h
  return EFI_UNSUPPORTED;
}

for (Index = 0; Index < ListCount; Index++) {
  if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
     (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
     continue;
  }
  if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
     (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
     continue;
  }
  <skip>

Regards,
Mike.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111220): https://edk2.groups.io/g/devel/message/111220
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 23:52     ` Mike Maslenkin
@ 2023-11-15  1:19       ` Chang, Abner via groups.io
  2023-11-15  1:21         ` Igor Kulchytskyy via groups.io
                           ` (2 more replies)
  2023-11-15 12:01       ` Leif Lindholm
  1 sibling, 3 replies; 23+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-15  1:19 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io, igork@ami.com
  Cc: Leif Lindholm, Nickle Wang

[AMD Official Use Only - General]

Hi Mike and Leif,
Thanks for your comments on this change. As we are rushing to get this change to be pulled in stable release 202312 this week, I will just merge this code to master branch and let the discussing keeps going.
I think there is no functionality difference base on your suggestions, but it's about the coding practice and readability.

Hi Igor,
Could you please resend the V6 after stable tag is released if Mike and Leif's comment is reasonable to you?

Thanks
Abner

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Wednesday, November 15, 2023 7:53 AM
> To: devel@edk2.groups.io; igork@ami.com
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> Optimize the Redfish Discover flow
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> <igork=ami.com@groups.io> wrote:
> >
> > Hi Leif,
> > Please see my comments below.
> > Thank you,
> > Igor
> >
> >
> > -----Original Message-----
> > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > Sent: Tuesday, November 14, 2023 12:26 PM
> > To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> <nicklew@nvidia.com>
> > Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
> >
> > On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > Filter out the network interfaces which are not supported by
> > > Redfish Host Interface.
> > >
> > > Cc: Abner Chang <abner.chang@amd.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > > ---
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> ++++++++++++++------
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> > >   2 files changed, 120 insertions(+), 49 deletions(-)
> > >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > index 0f622e05a9..ae83cd3c97 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >
> >
> > > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > >     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> *RestExInstance;
> > >     EFI_TPL                                          OldTpl;
> > >     BOOLEAN                                          NewNetworkInterfaceInstalled;
> > > +  UINT8                                            IpType;
> > > +  UINTN                                            ListCount;
> > >
> > > +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > >     NewNetworkInterfaceInstalled = FALSE;
> > >     Index                        = 0;
> > > -  do {
> > > +
> > > +  // Get IP Type to filter out unnecessary network protocol if possible
> > > +  IpType = GetHiIpProtocolType ();
> > > +
> > > +  for (Index = 0; Index < ListCount; Index++) {
> > > +    // Check IP Type and skip an unnecessary network protocol if does not
> match
> > > +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> >
> > The logic of these macros is inverted compared to their names, though.
> >
> > You want this test to read
> >    if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> >
> > > +      continue;
> > > +    }
> > > +
> > >       Status = gBS->OpenProtocol (
> > >                       // Already in list?
> > >                       ControllerHandle,
> >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > index 01454acc1d..3093eea0d5 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > @@ -39,6 +39,12 @@
> > >   #define REDFISH_DISCOVER_VERSION                    0x00010000
> > >   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
> > >
> > > +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> >HwAddressSize))
> > > +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp6))
> > > +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp4))
> > > +#define IS_TCP4_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > > +#define IS_TCP6_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> >
> > And these macros to test for ==, not !=
> >
> >
> > Igor: First version tested "==", but we agreed that it may not work if we have
> a wrong value of IpType.
> >
> > Otherwise the code reads like it does the opposite of what it does.
> >
> > (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
> > that feels a bit convoluted.)
> >
> > Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> >
> > Regards,
> >
> > Leif
>
> Sorry, could I add my 2 cents?
>
> For me all newly added defines looks bad, just because those
> implicitly use reference to a global variable
> plus local variable state (i.e  current cycle index).
>
> Could we rewrite code in a simple and straight forward manner, similar to:
>
> if (IpType ==
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>   // The protocol type is not specified in SMBIOS table type 42h
>   return EFI_UNSUPPORTED;
> }
>
> for (Index = 0; Index < ListCount; Index++) {
>   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>      (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>      continue;
>   }
>   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>      (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>      continue;
>   }
>   <skip>
>
> Regards,
> Mike.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111224): https://edk2.groups.io/g/devel/message/111224
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15  1:19       ` Chang, Abner via groups.io
@ 2023-11-15  1:21         ` Igor Kulchytskyy via groups.io
  2023-11-15  3:55         ` Chang, Abner via groups.io
  2023-11-15 10:55         ` Leif Lindholm
  2 siblings, 0 replies; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-15  1:21 UTC (permalink / raw)
  To: Chang, Abner, Mike Maslenkin, devel@edk2.groups.io
  Cc: Leif Lindholm, Nickle Wang

[-- Attachment #1: Type: text/plain, Size: 8544 bytes --]

Hi Abner,
I will address Leif's and Mike's comments after stable release.
Thank you,
Igor

Get Outlook for Android<https://aka.ms/AAb9ysg>

________________________________
From: Chang, Abner <Abner.Chang@amd.com>
Sent: Tuesday, November 14, 2023 8:19:41 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Igor Kulchytskyy <igork@ami.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Mike and Leif,
Thanks for your comments on this change. As we are rushing to get this change to be pulled in stable release 202312 this week, I will just merge this code to master branch and let the discussing keeps going.
I think there is no functionality difference base on your suggestions, but it's about the coding practice and readability.

Hi Igor,
Could you please resend the V6 after stable tag is released if Mike and Leif's comment is reasonable to you?

Thanks
Abner

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Wednesday, November 15, 2023 7:53 AM
> To: devel@edk2.groups.io; igork@ami.com
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> Optimize the Redfish Discover flow
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> <igork=ami.com@groups.io> wrote:
> >
> > Hi Leif,
> > Please see my comments below.
> > Thank you,
> > Igor
> >
> >
> > -----Original Message-----
> > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > Sent: Tuesday, November 14, 2023 12:26 PM
> > To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> <nicklew@nvidia.com>
> > Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
> >
> > On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > Filter out the network interfaces which are not supported by
> > > Redfish Host Interface.
> > >
> > > Cc: Abner Chang <abner.chang@amd.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > > ---
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> ++++++++++++++------
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> > >   2 files changed, 120 insertions(+), 49 deletions(-)
> > >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > index 0f622e05a9..ae83cd3c97 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >
> >
> > > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > >     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> *RestExInstance;
> > >     EFI_TPL                                          OldTpl;
> > >     BOOLEAN                                          NewNetworkInterfaceInstalled;
> > > +  UINT8                                            IpType;
> > > +  UINTN                                            ListCount;
> > >
> > > +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > >     NewNetworkInterfaceInstalled = FALSE;
> > >     Index                        = 0;
> > > -  do {
> > > +
> > > +  // Get IP Type to filter out unnecessary network protocol if possible
> > > +  IpType = GetHiIpProtocolType ();
> > > +
> > > +  for (Index = 0; Index < ListCount; Index++) {
> > > +    // Check IP Type and skip an unnecessary network protocol if does not
> match
> > > +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> >
> > The logic of these macros is inverted compared to their names, though.
> >
> > You want this test to read
> >    if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> >
> > > +      continue;
> > > +    }
> > > +
> > >       Status = gBS->OpenProtocol (
> > >                       // Already in list?
> > >                       ControllerHandle,
> >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > index 01454acc1d..3093eea0d5 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > @@ -39,6 +39,12 @@
> > >   #define REDFISH_DISCOVER_VERSION                    0x00010000
> > >   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
> > >
> > > +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> >HwAddressSize))
> > > +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp6))
> > > +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp4))
> > > +#define IS_TCP4_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > > +#define IS_TCP6_MATCH(IpType)
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> >
> > And these macros to test for ==, not !=
> >
> >
> > Igor: First version tested "==", but we agreed that it may not work if we have
> a wrong value of IpType.
> >
> > Otherwise the code reads like it does the opposite of what it does.
> >
> > (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
> > that feels a bit convoluted.)
> >
> > Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> >
> > Regards,
> >
> > Leif
>
> Sorry, could I add my 2 cents?
>
> For me all newly added defines looks bad, just because those
> implicitly use reference to a global variable
> plus local variable state (i.e  current cycle index).
>
> Could we rewrite code in a simple and straight forward manner, similar to:
>
> if (IpType ==
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>   // The protocol type is not specified in SMBIOS table type 42h
>   return EFI_UNSUPPORTED;
> }
>
> for (Index = 0; Index < ListCount; Index++) {
>   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>      (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>      continue;
>   }
>   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>      (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>      continue;
>   }
>   <skip>
>
> Regards,
> Mike.

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111225): https://edk2.groups.io/g/devel/message/111225
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 13416 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15  1:19       ` Chang, Abner via groups.io
  2023-11-15  1:21         ` Igor Kulchytskyy via groups.io
@ 2023-11-15  3:55         ` Chang, Abner via groups.io
  2023-11-15 10:59           ` edk2-stable202311 Code freeze process violation " Leif Lindholm
  2023-11-15 10:55         ` Leif Lindholm
  2 siblings, 1 reply; 23+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-15  3:55 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io, igork@ami.com
  Cc: Leif Lindholm, Nickle Wang

[AMD Official Use Only - General]

Just let you know I just merged this change. Igor can help to follow up the suggestions given by Leif and Mike.

Thanks
Abner

> -----Original Message-----
> From: Chang, Abner
> Sent: Wednesday, November 15, 2023 9:20 AM
> To: Mike Maslenkin <mike.maslenkin@gmail.com>; devel@edk2.groups.io;
> igork@ami.com
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
> <nicklew@nvidia.com>
> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> Optimize the Redfish Discover flow
>
> Hi Mike and Leif,
> Thanks for your comments on this change. As we are rushing to get this
> change to be pulled in stable release 202312 this week, I will just merge this
> code to master branch and let the discussing keeps going.
> I think there is no functionality difference base on your suggestions, but it's
> about the coding practice and readability.
>
> Hi Igor,
> Could you please resend the V6 after stable tag is released if Mike and Leif's
> comment is reasonable to you?
>
> Thanks
> Abner
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Sent: Wednesday, November 15, 2023 7:53 AM
> > To: devel@edk2.groups.io; igork@ami.com
> > Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> > <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> > Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> > Optimize the Redfish Discover flow
> >
> > Caution: This message originated from an External Source. Use proper
> caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> > <igork=ami.com@groups.io> wrote:
> > >
> > > Hi Leif,
> > > Please see my comments below.
> > > Thank you,
> > > Igor
> > >
> > >
> > > -----Original Message-----
> > > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > > Sent: Tuesday, November 14, 2023 12:26 PM
> > > To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > > Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> > <nicklew@nvidia.com>
> > > Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > RedfishDiscoverDxe: Optimize the Redfish Discover flow
> > >
> > >
> > > **CAUTION: The e-mail below is from an external source. Please exercise
> > caution before opening attachments, clicking links, or following guidance.**
> > >
> > > On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > > Filter out the network interfaces which are not supported by
> > > > Redfish Host Interface.
> > > >
> > > > Cc: Abner Chang <abner.chang@amd.com>
> > > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > > Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > > > ---
> > > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> > ++++++++++++++------
> > > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> > > >   2 files changed, 120 insertions(+), 49 deletions(-)
> > > >
> > > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > index 0f622e05a9..ae83cd3c97 100644
> > > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > >
> > >
> > > > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > > >     EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> > *RestExInstance;
> > > >     EFI_TPL                                          OldTpl;
> > > >     BOOLEAN                                          NewNetworkInterfaceInstalled;
> > > > +  UINT8                                            IpType;
> > > > +  UINTN                                            ListCount;
> > > >
> > > > +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> > (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > > >     NewNetworkInterfaceInstalled = FALSE;
> > > >     Index                        = 0;
> > > > -  do {
> > > > +
> > > > +  // Get IP Type to filter out unnecessary network protocol if possible
> > > > +  IpType = GetHiIpProtocolType ();
> > > > +
> > > > +  for (Index = 0; Index < ListCount; Index++) {
> > > > +    // Check IP Type and skip an unnecessary network protocol if does
> not
> > match
> > > > +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> > >
> > > The logic of these macros is inverted compared to their names, though.
> > >
> > > You want this test to read
> > >    if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> > >
> > > > +      continue;
> > > > +    }
> > > > +
> > > >       Status = gBS->OpenProtocol (
> > > >                       // Already in list?
> > > >                       ControllerHandle,
> > >
> > > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > index 01454acc1d..3093eea0d5 100644
> > > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > @@ -39,6 +39,12 @@
> > > >   #define REDFISH_DISCOVER_VERSION                    0x00010000
> > > >   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
> TPL_NOTIFY
> > > >
> > > > +#define MAC_COMPARE(ThisNetworkInterface,
> TargetNetworkInterface)
> > (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> > &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> > >HwAddressSize))
> > > > +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> > (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >NetworkProtocolType == ProtocolTypeTcp6))
> > > > +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> > (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >NetworkProtocolType == ProtocolTypeTcp4))
> > > > +#define IS_TCP4_MATCH(IpType)
> > ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> (IpType !=
> > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > > > +#define IS_TCP6_MATCH(IpType)
> > ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> (IpType !=
> > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> > >
> > > And these macros to test for ==, not !=
> > >
> > >
> > > Igor: First version tested "==", but we agreed that it may not work if we
> have
> > a wrong value of IpType.
> > >
> > > Otherwise the code reads like it does the opposite of what it does.
> > >
> > > (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
> > > that feels a bit convoluted.)
> > >
> > > Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> > >
> > > Regards,
> > >
> > > Leif
> >
> > Sorry, could I add my 2 cents?
> >
> > For me all newly added defines looks bad, just because those
> > implicitly use reference to a global variable
> > plus local variable state (i.e  current cycle index).
> >
> > Could we rewrite code in a simple and straight forward manner, similar to:
> >
> > if (IpType ==
> > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
> >   // The protocol type is not specified in SMBIOS table type 42h
> >   return EFI_UNSUPPORTED;
> > }
> >
> > for (Index = 0; Index < ListCount; Index++) {
> >   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> >      (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> >      continue;
> >   }
> >   if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> >      (IpType !=
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> >      continue;
> >   }
> >   <skip>
> >
> > Regards,
> > Mike.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111233): https://edk2.groups.io/g/devel/message/111233
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15  1:19       ` Chang, Abner via groups.io
  2023-11-15  1:21         ` Igor Kulchytskyy via groups.io
  2023-11-15  3:55         ` Chang, Abner via groups.io
@ 2023-11-15 10:55         ` Leif Lindholm
  2 siblings, 0 replies; 23+ messages in thread
From: Leif Lindholm @ 2023-11-15 10:55 UTC (permalink / raw)
  To: devel, abner.chang, Mike Maslenkin, igork@ami.com, Gao, Liming,
	Kinney, Michael D
  Cc: Nickle Wang

On 2023-11-15 01:19, Chang, Abner via groups.io wrote:
> [AMD Official Use Only - General]
> 
> Hi Mike and Leif,
> Thanks for your comments on this change. As we are rushing to get this change to be pulled in stable release 202312 this week, I will just merge this code to master branch and let the discussing keeps going.
> I think there is no functionality difference base on your suggestions, but it's about the coding practice and readability.

Readability is not optional.
If the fix is important enough, we need to delay the stable tag, not 
ignore the process.

/
     Leif

> 
> Hi Igor,
> Could you please resend the V6 after stable tag is released if Mike and Leif's comment is reasonable to you?
> 
> Thanks
> Abner
> 
>> -----Original Message-----
>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
>> Sent: Wednesday, November 15, 2023 7:53 AM
>> To: devel@edk2.groups.io; igork@ami.com
>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
>> Optimize the Redfish Discover flow
>>
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>>
>>
>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
>> <igork=ami.com@groups.io> wrote:
>>>
>>> Hi Leif,
>>> Please see my comments below.
>>> Thank you,
>>> Igor
>>>
>>>
>>> -----Original Message-----
>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
>>> Sent: Tuesday, November 14, 2023 12:26 PM
>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
>> <nicklew@nvidia.com>
>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
>>>
>>>
>>> **CAUTION: The e-mail below is from an external source. Please exercise
>> caution before opening attachments, clicking links, or following guidance.**
>>>
>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
>>>> Filter out the network interfaces which are not supported by
>>>> Redfish Host Interface.
>>>>
>>>> Cc: Abner Chang <abner.chang@amd.com>
>>>> Cc: Nickle Wang <nicklew@nvidia.com>
>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
>>>> ---
>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
>> ++++++++++++++------
>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
>>>>
>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>> index 0f622e05a9..ae83cd3c97 100644
>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>
>>>
>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
>> *RestExInstance;
>>>>      EFI_TPL                                          OldTpl;
>>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
>>>> +  UINT8                                            IpType;
>>>> +  UINTN                                            ListCount;
>>>>
>>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>>>>      NewNetworkInterfaceInstalled = FALSE;
>>>>      Index                        = 0;
>>>> -  do {
>>>> +
>>>> +  // Get IP Type to filter out unnecessary network protocol if possible
>>>> +  IpType = GetHiIpProtocolType ();
>>>> +
>>>> +  for (Index = 0; Index < ListCount; Index++) {
>>>> +    // Check IP Type and skip an unnecessary network protocol if does not
>> match
>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>>>
>>> The logic of these macros is inverted compared to their names, though.
>>>
>>> You want this test to read
>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>>>
>>>> +      continue;
>>>> +    }
>>>> +
>>>>        Status = gBS->OpenProtocol (
>>>>                        // Already in list?
>>>>                        ControllerHandle,
>>>
>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>> index 01454acc1d..3093eea0d5 100644
>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>> @@ -39,6 +39,12 @@
>>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
>>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>>>>
>>>> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
>>> HwAddressSize))
>>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
>>> NetworkProtocolType == ProtocolTypeTcp6))
>>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
>>> NetworkProtocolType == ProtocolTypeTcp4))
>>>> +#define IS_TCP4_MATCH(IpType)
>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType !=
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
>>>> +#define IS_TCP6_MATCH(IpType)
>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType !=
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
>>>
>>> And these macros to test for ==, not !=
>>>
>>>
>>> Igor: First version tested "==", but we agreed that it may not work if we have
>> a wrong value of IpType.
>>>
>>> Otherwise the code reads like it does the opposite of what it does.
>>>
>>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
>>> that feels a bit convoluted.)
>>>
>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
>>>
>>> Regards,
>>>
>>> Leif
>>
>> Sorry, could I add my 2 cents?
>>
>> For me all newly added defines looks bad, just because those
>> implicitly use reference to a global variable
>> plus local variable state (i.e  current cycle index).
>>
>> Could we rewrite code in a simple and straight forward manner, similar to:
>>
>> if (IpType ==
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>>    // The protocol type is not specified in SMBIOS table type 42h
>>    return EFI_UNSUPPORTED;
>> }
>>
>> for (Index = 0; Index < ListCount; Index++) {
>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>>       continue;
>>    }
>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>>       continue;
>>    }
>>    <skip>
>>
>> Regards,
>> Mike.
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111253): https://edk2.groups.io/g/devel/message/111253
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* edk2-stable202311 Code freeze process violation Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15  3:55         ` Chang, Abner via groups.io
@ 2023-11-15 10:59           ` Leif Lindholm
  2023-11-15 11:07             ` Chang, Abner via groups.io
  0 siblings, 1 reply; 23+ messages in thread
From: Leif Lindholm @ 2023-11-15 10:59 UTC (permalink / raw)
  To: devel, abner.chang, Mike Maslenkin, igork@ami.com, Gao, Liming,
	Kinney, Michael D
  Cc: Nickle Wang

On 2023-11-15 03:55, Chang, Abner via groups.io wrote:
> [AMD Official Use Only - General]
> 
> Just let you know I just merged this change. Igor can help to follow up the suggestions given by Leif and Mike.

I was under the impression merging was disabled for everyone except Mike 
and Liming during code freeze specifically to avoid this situation.
Apparently, that isn't working.

Regardless, this is a violation of the stable tag process.
Liming: can you please revert these commits?

Regards,

Leif

> Thanks
> Abner
> 
>> -----Original Message-----
>> From: Chang, Abner
>> Sent: Wednesday, November 15, 2023 9:20 AM
>> To: Mike Maslenkin <mike.maslenkin@gmail.com>; devel@edk2.groups.io;
>> igork@ami.com
>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
>> <nicklew@nvidia.com>
>> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
>> Optimize the Redfish Discover flow
>>
>> Hi Mike and Leif,
>> Thanks for your comments on this change. As we are rushing to get this
>> change to be pulled in stable release 202312 this week, I will just merge this
>> code to master branch and let the discussing keeps going.
>> I think there is no functionality difference base on your suggestions, but it's
>> about the coding practice and readability.
>>
>> Hi Igor,
>> Could you please resend the V6 after stable tag is released if Mike and Leif's
>> comment is reasonable to you?
>>
>> Thanks
>> Abner
>>
>>> -----Original Message-----
>>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
>>> Sent: Wednesday, November 15, 2023 7:53 AM
>>> To: devel@edk2.groups.io; igork@ami.com
>>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
>>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
>>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
>>> Optimize the Redfish Discover flow
>>>
>>> Caution: This message originated from an External Source. Use proper
>> caution
>>> when opening attachments, clicking links, or responding.
>>>
>>>
>>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
>>> <igork=ami.com@groups.io> wrote:
>>>>
>>>> Hi Leif,
>>>> Please see my comments below.
>>>> Thank you,
>>>> Igor
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
>>>> Sent: Tuesday, November 14, 2023 12:26 PM
>>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
>>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
>>> <nicklew@nvidia.com>
>>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
>>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
>>>>
>>>>
>>>> **CAUTION: The e-mail below is from an external source. Please exercise
>>> caution before opening attachments, clicking links, or following guidance.**
>>>>
>>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
>>>>> Filter out the network interfaces which are not supported by
>>>>> Redfish Host Interface.
>>>>>
>>>>> Cc: Abner Chang <abner.chang@amd.com>
>>>>> Cc: Nickle Wang <nicklew@nvidia.com>
>>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
>>>>> ---
>>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
>>> ++++++++++++++------
>>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
>>>>>
>>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>>> index 0f622e05a9..ae83cd3c97 100644
>>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>>>
>>>>
>>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
>>> *RestExInstance;
>>>>>      EFI_TPL                                          OldTpl;
>>>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
>>>>> +  UINT8                                            IpType;
>>>>> +  UINTN                                            ListCount;
>>>>>
>>>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
>>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>>>>>      NewNetworkInterfaceInstalled = FALSE;
>>>>>      Index                        = 0;
>>>>> -  do {
>>>>> +
>>>>> +  // Get IP Type to filter out unnecessary network protocol if possible
>>>>> +  IpType = GetHiIpProtocolType ();
>>>>> +
>>>>> +  for (Index = 0; Index < ListCount; Index++) {
>>>>> +    // Check IP Type and skip an unnecessary network protocol if does
>> not
>>> match
>>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>>>>
>>>> The logic of these macros is inverted compared to their names, though.
>>>>
>>>> You want this test to read
>>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>>>>
>>>>> +      continue;
>>>>> +    }
>>>>> +
>>>>>        Status = gBS->OpenProtocol (
>>>>>                        // Already in list?
>>>>>                        ControllerHandle,
>>>>
>>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>>> index 01454acc1d..3093eea0d5 100644
>>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>>>> @@ -39,6 +39,12 @@
>>>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
>>>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
>> TPL_NOTIFY
>>>>>
>>>>> +#define MAC_COMPARE(ThisNetworkInterface,
>> TargetNetworkInterface)
>>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
>>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
>>>> HwAddressSize))
>>>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
>>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
>>>> NetworkProtocolType == ProtocolTypeTcp6))
>>>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
>>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
>>>> NetworkProtocolType == ProtocolTypeTcp4))
>>>>> +#define IS_TCP4_MATCH(IpType)
>>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>> (IpType !=
>>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
>>>>> +#define IS_TCP6_MATCH(IpType)
>>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>> (IpType !=
>>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
>>>>
>>>> And these macros to test for ==, not !=
>>>>
>>>>
>>>> Igor: First version tested "==", but we agreed that it may not work if we
>> have
>>> a wrong value of IpType.
>>>>
>>>> Otherwise the code reads like it does the opposite of what it does.
>>>>
>>>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
>>>> that feels a bit convoluted.)
>>>>
>>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
>>>>
>>>> Regards,
>>>>
>>>> Leif
>>>
>>> Sorry, could I add my 2 cents?
>>>
>>> For me all newly added defines looks bad, just because those
>>> implicitly use reference to a global variable
>>> plus local variable state (i.e  current cycle index).
>>>
>>> Could we rewrite code in a simple and straight forward manner, similar to:
>>>
>>> if (IpType ==
>>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>>>    // The protocol type is not specified in SMBIOS table type 42h
>>>    return EFI_UNSUPPORTED;
>>> }
>>>
>>> for (Index = 0; Index < ListCount; Index++) {
>>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>>>       (IpType !=
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>>>       continue;
>>>    }
>>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>>>       (IpType !=
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>>>       continue;
>>>    }
>>>    <skip>
>>>
>>> Regards,
>>> Mike.
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111254): https://edk2.groups.io/g/devel/message/111254
Mute This Topic: https://groups.io/mt/102602698/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: edk2-stable202311 Code freeze process violation Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 10:59           ` edk2-stable202311 Code freeze process violation " Leif Lindholm
@ 2023-11-15 11:07             ` Chang, Abner via groups.io
  2023-11-15 11:54               ` Chang, Abner via groups.io
  0 siblings, 1 reply; 23+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-15 11:07 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io, Mike Maslenkin,
	igork@ami.com, Gao, Liming, Kinney, Michael D
  Cc: Nickle Wang

[AMD Official Use Only - General]

Hi Leif,
As we requested Liming to wait for this change last week, he accepted to wait for the PR. But you are right, suppose I shouldn't be allowed to merge the change during code freeze. Maybe only certain people have privilege to merge the code during code freeze. If I still can merge the code then the mechanism may be broken. I am fine if you would like to revert these commits.

Regards,
Abner

> -----Original Message-----
> From: Leif Lindholm <quic_llindhol@quicinc.com>
> Sent: Wednesday, November 15, 2023 6:59 PM
> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>; Mike
> Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> <gaoliming@byosoft.com.cn>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Subject: edk2-stable202311 Code freeze process violation Re: [edk2-devel]
> [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish
> Discover flow
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 2023-11-15 03:55, Chang, Abner via groups.io wrote:
> > [AMD Official Use Only - General]
> >
> > Just let you know I just merged this change. Igor can help to follow up the
> suggestions given by Leif and Mike.
>
> I was under the impression merging was disabled for everyone except Mike
> and Liming during code freeze specifically to avoid this situation.
> Apparently, that isn't working.
>
> Regardless, this is a violation of the stable tag process.
> Liming: can you please revert these commits?
>
> Regards,
>
> Leif
>
> > Thanks
> > Abner
> >
> >> -----Original Message-----
> >> From: Chang, Abner
> >> Sent: Wednesday, November 15, 2023 9:20 AM
> >> To: Mike Maslenkin <mike.maslenkin@gmail.com>; devel@edk2.groups.io;
> >> igork@ami.com
> >> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
> >> <nicklew@nvidia.com>
> >> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> >> Optimize the Redfish Discover flow
> >>
> >> Hi Mike and Leif,
> >> Thanks for your comments on this change. As we are rushing to get this
> >> change to be pulled in stable release 202312 this week, I will just merge this
> >> code to master branch and let the discussing keeps going.
> >> I think there is no functionality difference base on your suggestions, but it's
> >> about the coding practice and readability.
> >>
> >> Hi Igor,
> >> Could you please resend the V6 after stable tag is released if Mike and Leif's
> >> comment is reasonable to you?
> >>
> >> Thanks
> >> Abner
> >>
> >>> -----Original Message-----
> >>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> >>> Sent: Wednesday, November 15, 2023 7:53 AM
> >>> To: devel@edk2.groups.io; igork@ami.com
> >>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> >>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> >>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> >>> Optimize the Redfish Discover flow
> >>>
> >>> Caution: This message originated from an External Source. Use proper
> >> caution
> >>> when opening attachments, clicking links, or responding.
> >>>
> >>>
> >>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> >>> <igork=ami.com@groups.io> wrote:
> >>>>
> >>>> Hi Leif,
> >>>> Please see my comments below.
> >>>> Thank you,
> >>>> Igor
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
> >>>> Sent: Tuesday, November 14, 2023 12:26 PM
> >>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> >>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> >>> <nicklew@nvidia.com>
> >>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> >>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >>>>
> >>>>
> >>>> **CAUTION: The e-mail below is from an external source. Please exercise
> >>> caution before opening attachments, clicking links, or following
> guidance.**
> >>>>
> >>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> >>>>> Filter out the network interfaces which are not supported by
> >>>>> Redfish Host Interface.
> >>>>>
> >>>>> Cc: Abner Chang <abner.chang@amd.com>
> >>>>> Cc: Nickle Wang <nicklew@nvidia.com>
> >>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> >>>>> ---
> >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> >>> ++++++++++++++------
> >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> >>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
> >>>>>
> >>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >>>>> index 0f622e05a9..ae83cd3c97 100644
> >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >>>>
> >>>>
> >>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> >>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> >>> *RestExInstance;
> >>>>>      EFI_TPL                                          OldTpl;
> >>>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
> >>>>> +  UINT8                                            IpType;
> >>>>> +  UINTN                                            ListCount;
> >>>>>
> >>>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> >>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> >>>>>      NewNetworkInterfaceInstalled = FALSE;
> >>>>>      Index                        = 0;
> >>>>> -  do {
> >>>>> +
> >>>>> +  // Get IP Type to filter out unnecessary network protocol if possible
> >>>>> +  IpType = GetHiIpProtocolType ();
> >>>>> +
> >>>>> +  for (Index = 0; Index < ListCount; Index++) {
> >>>>> +    // Check IP Type and skip an unnecessary network protocol if does
> >> not
> >>> match
> >>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> >>>>
> >>>> The logic of these macros is inverted compared to their names, though.
> >>>>
> >>>> You want this test to read
> >>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> >>>>
> >>>>> +      continue;
> >>>>> +    }
> >>>>> +
> >>>>>        Status = gBS->OpenProtocol (
> >>>>>                        // Already in list?
> >>>>>                        ControllerHandle,
> >>>>
> >>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> >>>>> index 01454acc1d..3093eea0d5 100644
> >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> >>>>> @@ -39,6 +39,12 @@
> >>>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
> >>>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
> >> TPL_NOTIFY
> >>>>>
> >>>>> +#define MAC_COMPARE(ThisNetworkInterface,
> >> TargetNetworkInterface)
> >>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> >>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> >>>> HwAddressSize))
> >>>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> >>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >>>> NetworkProtocolType == ProtocolTypeTcp6))
> >>>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> >>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> >>>> NetworkProtocolType == ProtocolTypeTcp4))
> >>>>> +#define IS_TCP4_MATCH(IpType)
> >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> >> (IpType !=
> >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> >>>>> +#define IS_TCP6_MATCH(IpType)
> >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> >> (IpType !=
> >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> >>>>
> >>>> And these macros to test for ==, not !=
> >>>>
> >>>>
> >>>> Igor: First version tested "==", but we agreed that it may not work if we
> >> have
> >>> a wrong value of IpType.
> >>>>
> >>>> Otherwise the code reads like it does the opposite of what it does.
> >>>>
> >>>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH,
> but
> >>>> that feels a bit convoluted.)
> >>>>
> >>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> >>>>
> >>>> Regards,
> >>>>
> >>>> Leif
> >>>
> >>> Sorry, could I add my 2 cents?
> >>>
> >>> For me all newly added defines looks bad, just because those
> >>> implicitly use reference to a global variable
> >>> plus local variable state (i.e  current cycle index).
> >>>
> >>> Could we rewrite code in a simple and straight forward manner, similar to:
> >>>
> >>> if (IpType ==
> >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
> >>>    // The protocol type is not specified in SMBIOS table type 42h
> >>>    return EFI_UNSUPPORTED;
> >>> }
> >>>
> >>> for (Index = 0; Index < ListCount; Index++) {
> >>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> >>>       (IpType !=
> >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> >>>       continue;
> >>>    }
> >>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> >>>       (IpType !=
> >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> >>>       continue;
> >>>    }
> >>>    <skip>
> >>>
> >>> Regards,
> >>> Mike.
> >
> >
> > 
> >
> >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111255): https://edk2.groups.io/g/devel/message/111255
Mute This Topic: https://groups.io/mt/102602698/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: edk2-stable202311 Code freeze process violation Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 11:07             ` Chang, Abner via groups.io
@ 2023-11-15 11:54               ` Chang, Abner via groups.io
  2023-11-15 17:28                 ` Michael D Kinney
  0 siblings, 1 reply; 23+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-15 11:54 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io, Mike Maslenkin,
	igork@ami.com, Gao, Liming, Kinney, Michael D
  Cc: Nickle Wang

[AMD Official Use Only - General]

Ok, Liming as we are going to revert that two commits. Is that possible to wait for Igor sending out another patch to address Leif's comment? This may delay the stable release a little bit.
As without this patch, users may encounter the problem when sending request to Redfish service on the platform which have multiple NIC installed,

Let us know, thanks!
Abner

> -----Original Message-----
> From: Chang, Abner
> Sent: Wednesday, November 15, 2023 7:07 PM
> To: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Mike
> Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> <gaoliming@byosoft.com.cn>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Subject: RE: edk2-stable202311 Code freeze process violation Re: [edk2-
> devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish
> Discover flow
>
> Hi Leif,
> As we requested Liming to wait for this change last week, he accepted to wait
> for the PR. But you are right, suppose I shouldn't be allowed to merge the
> change during code freeze. Maybe only certain people have privilege to merge
> the code during code freeze. If I still can merge the code then the mechanism
> may be broken. I am fine if you would like to revert these commits.
>
> Regards,
> Abner
>
> > -----Original Message-----
> > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > Sent: Wednesday, November 15, 2023 6:59 PM
> > To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>; Mike
> > Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > <michael.d.kinney@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Subject: edk2-stable202311 Code freeze process violation Re: [edk2-devel]
> > [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish
> > Discover flow
> >
> > Caution: This message originated from an External Source. Use proper
> caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > On 2023-11-15 03:55, Chang, Abner via groups.io wrote:
> > > [AMD Official Use Only - General]
> > >
> > > Just let you know I just merged this change. Igor can help to follow up the
> > suggestions given by Leif and Mike.
> >
> > I was under the impression merging was disabled for everyone except Mike
> > and Liming during code freeze specifically to avoid this situation.
> > Apparently, that isn't working.
> >
> > Regardless, this is a violation of the stable tag process.
> > Liming: can you please revert these commits?
> >
> > Regards,
> >
> > Leif
> >
> > > Thanks
> > > Abner
> > >
> > >> -----Original Message-----
> > >> From: Chang, Abner
> > >> Sent: Wednesday, November 15, 2023 9:20 AM
> > >> To: Mike Maslenkin <mike.maslenkin@gmail.com>;
> devel@edk2.groups.io;
> > >> igork@ami.com
> > >> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
> > >> <nicklew@nvidia.com>
> > >> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> RedfishDiscoverDxe:
> > >> Optimize the Redfish Discover flow
> > >>
> > >> Hi Mike and Leif,
> > >> Thanks for your comments on this change. As we are rushing to get this
> > >> change to be pulled in stable release 202312 this week, I will just merge
> this
> > >> code to master branch and let the discussing keeps going.
> > >> I think there is no functionality difference base on your suggestions, but
> it's
> > >> about the coding practice and readability.
> > >>
> > >> Hi Igor,
> > >> Could you please resend the V6 after stable tag is released if Mike and
> Leif's
> > >> comment is reasonable to you?
> > >>
> > >> Thanks
> > >> Abner
> > >>
> > >>> -----Original Message-----
> > >>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > >>> Sent: Wednesday, November 15, 2023 7:53 AM
> > >>> To: devel@edk2.groups.io; igork@ami.com
> > >>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> > >>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> > >>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> RedfishDiscoverDxe:
> > >>> Optimize the Redfish Discover flow
> > >>>
> > >>> Caution: This message originated from an External Source. Use proper
> > >> caution
> > >>> when opening attachments, clicking links, or responding.
> > >>>
> > >>>
> > >>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> > >>> <igork=ami.com@groups.io> wrote:
> > >>>>
> > >>>> Hi Leif,
> > >>>> Please see my comments below.
> > >>>> Thank you,
> > >>>> Igor
> > >>>>
> > >>>>
> > >>>> -----Original Message-----
> > >>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
> > >>>> Sent: Tuesday, November 14, 2023 12:26 PM
> > >>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > >>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> > >>> <nicklew@nvidia.com>
> > >>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > >>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> > >>>>
> > >>>>
> > >>>> **CAUTION: The e-mail below is from an external source. Please
> exercise
> > >>> caution before opening attachments, clicking links, or following
> > guidance.**
> > >>>>
> > >>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > >>>>> Filter out the network interfaces which are not supported by
> > >>>>> Redfish Host Interface.
> > >>>>>
> > >>>>> Cc: Abner Chang <abner.chang@amd.com>
> > >>>>> Cc: Nickle Wang <nicklew@nvidia.com>
> > >>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > >>>>> ---
> > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163
> > >>> ++++++++++++++------
> > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> > >>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
> > >>>>>
> > >>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > >>>>> index 0f622e05a9..ae83cd3c97 100644
> > >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > >>>>
> > >>>>
> > >>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > >>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> > >>> *RestExInstance;
> > >>>>>      EFI_TPL                                          OldTpl;
> > >>>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
> > >>>>> +  UINT8                                            IpType;
> > >>>>> +  UINTN                                            ListCount;
> > >>>>>
> > >>>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof
> > >>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > >>>>>      NewNetworkInterfaceInstalled = FALSE;
> > >>>>>      Index                        = 0;
> > >>>>> -  do {
> > >>>>> +
> > >>>>> +  // Get IP Type to filter out unnecessary network protocol if possible
> > >>>>> +  IpType = GetHiIpProtocolType ();
> > >>>>> +
> > >>>>> +  for (Index = 0; Index < ListCount; Index++) {
> > >>>>> +    // Check IP Type and skip an unnecessary network protocol if does
> > >> not
> > >>> match
> > >>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> > >>>>
> > >>>> The logic of these macros is inverted compared to their names, though.
> > >>>>
> > >>>> You want this test to read
> > >>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> > >>>>
> > >>>>> +      continue;
> > >>>>> +    }
> > >>>>> +
> > >>>>>        Status = gBS->OpenProtocol (
> > >>>>>                        // Already in list?
> > >>>>>                        ControllerHandle,
> > >>>>
> > >>>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > >>>>> index 01454acc1d..3093eea0d5 100644
> > >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > >>>>> @@ -39,6 +39,12 @@
> > >>>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
> > >>>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
> > >> TPL_NOTIFY
> > >>>>>
> > >>>>> +#define MAC_COMPARE(ThisNetworkInterface,
> > >> TargetNetworkInterface)
> > >>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> > >>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> > >>>> HwAddressSize))
> > >>>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)
> > >>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >>>> NetworkProtocolType == ProtocolTypeTcp6))
> > >>>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)
> > >>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >>>> NetworkProtocolType == ProtocolTypeTcp4))
> > >>>>> +#define IS_TCP4_MATCH(IpType)
> > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> > >> (IpType !=
> > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > >>>>> +#define IS_TCP6_MATCH(IpType)
> > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> > >> (IpType !=
> > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> > >>>>
> > >>>> And these macros to test for ==, not !=
> > >>>>
> > >>>>
> > >>>> Igor: First version tested "==", but we agreed that it may not work if we
> > >> have
> > >>> a wrong value of IpType.
> > >>>>
> > >>>> Otherwise the code reads like it does the opposite of what it does.
> > >>>>
> > >>>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH,
> > but
> > >>>> that feels a bit convoluted.)
> > >>>>
> > >>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> > >>>>
> > >>>> Regards,
> > >>>>
> > >>>> Leif
> > >>>
> > >>> Sorry, could I add my 2 cents?
> > >>>
> > >>> For me all newly added defines looks bad, just because those
> > >>> implicitly use reference to a global variable
> > >>> plus local variable state (i.e  current cycle index).
> > >>>
> > >>> Could we rewrite code in a simple and straight forward manner, similar
> to:
> > >>>
> > >>> if (IpType ==
> > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN)
> {
> > >>>    // The protocol type is not specified in SMBIOS table type 42h
> > >>>    return EFI_UNSUPPORTED;
> > >>> }
> > >>>
> > >>> for (Index = 0; Index < ListCount; Index++) {
> > >>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
> > >>>       (IpType !=
> > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> > >>>       continue;
> > >>>    }
> > >>>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
> > >>>       (IpType !=
> > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> > >>>       continue;
> > >>>    }
> > >>>    <skip>
> > >>>
> > >>> Regards,
> > >>> Mike.
> > >
> > >
> > > 
> > >
> > >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111265): https://edk2.groups.io/g/devel/message/111265
Mute This Topic: https://groups.io/mt/102602698/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-14 23:52     ` Mike Maslenkin
  2023-11-15  1:19       ` Chang, Abner via groups.io
@ 2023-11-15 12:01       ` Leif Lindholm
  2023-11-15 13:51         ` Igor Kulchytskyy via groups.io
  1 sibling, 1 reply; 23+ messages in thread
From: Leif Lindholm @ 2023-11-15 12:01 UTC (permalink / raw)
  To: devel, mike.maslenkin, igork; +Cc: Abner Chang, Nickle Wang

On 2023-11-14 23:52, Mike Maslenkin wrote:
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> <igork=ami.com@groups.io> wrote:
>>
>> Hi Leif,
>> Please see my comments below.
>> Thank you,
>> Igor
>>
>>
>> -----Original Message-----
>> From: Leif Lindholm <quic_llindhol@quicinc.com>
>> Sent: Tuesday, November 14, 2023 12:26 PM
>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>>
>>
>> **CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
>>
>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
>>> Filter out the network interfaces which are not supported by
>>> Redfish Host Interface.
>>>
>>> Cc: Abner Chang <abner.chang@amd.com>
>>> Cc: Nickle Wang <nicklew@nvidia.com>
>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
>>> ---
>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>>>    2 files changed, 120 insertions(+), 49 deletions(-)
>>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> index 0f622e05a9..ae83cd3c97 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>
>>
>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>>>      EFI_TPL                                          OldTpl;
>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
>>> +  UINT8                                            IpType;
>>> +  UINTN                                            ListCount;
>>>
>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>>>      NewNetworkInterfaceInstalled = FALSE;
>>>      Index                        = 0;
>>> -  do {
>>> +
>>> +  // Get IP Type to filter out unnecessary network protocol if possible
>>> +  IpType = GetHiIpProtocolType ();
>>> +
>>> +  for (Index = 0; Index < ListCount; Index++) {
>>> +    // Check IP Type and skip an unnecessary network protocol if does not match
>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>>
>> The logic of these macros is inverted compared to their names, though.
>>
>> You want this test to read
>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>>
>>> +      continue;
>>> +    }
>>> +
>>>        Status = gBS->OpenProtocol (
>>>                        // Already in list?
>>>                        ControllerHandle,
>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> index 01454acc1d..3093eea0d5 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> @@ -39,6 +39,12 @@
>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>>>
>>> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
>>> +#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
>>> +#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
>>
>> And these macros to test for ==, not !=
>>
>>
>> Igor: First version tested "==", but we agreed that it may not work if we have a wrong value of IpType.
>>
>> Otherwise the code reads like it does the opposite of what it does.
>>
>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
>> that feels a bit convoluted.)
>>
>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
>>
>> Regards,
>>
>> Leif
> 
> Sorry, could I add my 2 cents?

Always!

> For me all newly added defines looks bad, just because those
> implicitly use reference to a global variable
> plus local variable state (i.e  current cycle index).

Fair. But the original test is basically line noise.
I will point out that gRequiredProtocol appears to be misnamed to start 
with. It's only used in this file, so ought to be mRequiredProtocol.
However, your point still stands.

> Could we rewrite code in a simple and straight forward manner, similar to:
> 
> if (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>    // The protocol type is not specified in SMBIOS table type 42h
>    return EFI_UNSUPPORTED;
> }

The test needs to be an allowlist, not a denylist of specific error 
cases. The input is the SMBIOS table, which could have been corrupted 
accidentally or intentionally.

But yes, rejecting the outright invalid options upfront is a big 
readability improvement.

> for (Index = 0; Index < ListCount; Index++) {
>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>       continue;
>    }
>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>       continue;
>    }
>    <skip>

This still looks somewhat like line noise.
We could stick it in a static helper function to get 
BuildupNetworkInterface () more human readable?

Regards,

Leif

> Regards,
> Mike.
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111267): https://edk2.groups.io/g/devel/message/111267
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 12:01       ` Leif Lindholm
@ 2023-11-15 13:51         ` Igor Kulchytskyy via groups.io
  2023-11-15 18:27           ` Mike Maslenkin
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-15 13:51 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io, mike.maslenkin@gmail.com
  Cc: Abner Chang, Nickle Wang

Hello Leif and Mike,
Let me try to explain the idea of the filtering IP.
That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
In that case there is no need to build network interface for the unused IP Type.
On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
So, later Redfish Discover driver can find the right one.
Based on this logic I'm going to prepare the patch v6.
Thank you,
Igor

-----Original Message-----
From: Leif Lindholm <quic_llindhol@quicinc.com>
Sent: Wednesday, November 15, 2023 7:02 AM
To: devel@edk2.groups.io; mike.maslenkin@gmail.com; Igor Kulchytskyy <igork@ami.com>
Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

On 2023-11-14 23:52, Mike Maslenkin wrote:
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> <igork=ami.com@groups.io> wrote:
>>
>> Hi Leif,
>> Please see my comments below.
>> Thank you,
>> Igor
>>
>>
>> -----Original Message-----
>> From: Leif Lindholm <quic_llindhol@quicinc.com>
>> Sent: Tuesday, November 14, 2023 12:26 PM
>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>>
>>
>> **CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
>>
>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
>>> Filter out the network interfaces which are not supported by
>>> Redfish Host Interface.
>>>
>>> Cc: Abner Chang <abner.chang@amd.com>
>>> Cc: Nickle Wang <nicklew@nvidia.com>
>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
>>> ---
>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      | 163 ++++++++++++++------
>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>>>    2 files changed, 120 insertions(+), 49 deletions(-)
>>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> index 0f622e05a9..ae83cd3c97 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>
>>
>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>>>      EFI_TPL                                          OldTpl;
>>>      BOOLEAN                                          NewNetworkInterfaceInstalled;
>>> +  UINT8                                            IpType;
>>> +  UINTN                                            ListCount;
>>>
>>> +  ListCount                    = (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>>>      NewNetworkInterfaceInstalled = FALSE;
>>>      Index                        = 0;
>>> -  do {
>>> +
>>> +  // Get IP Type to filter out unnecessary network protocol if possible
>>> +  IpType = GetHiIpProtocolType ();
>>> +
>>> +  for (Index = 0; Index < ListCount; Index++) {
>>> +    // Check IP Type and skip an unnecessary network protocol if does not match
>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>>
>> The logic of these macros is inverted compared to their names, though.
>>
>> You want this test to read
>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>>
>>> +      continue;
>>> +    }
>>> +
>>>        Status = gBS->OpenProtocol (
>>>                        // Already in list?
>>>                        ControllerHandle,
>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> index 01454acc1d..3093eea0d5 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> @@ -39,6 +39,12 @@
>>>    #define REDFISH_DISCOVER_VERSION                    0x00010000
>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>>>
>>> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize))
>>> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6))
>>> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
>>> +#define IS_TCP4_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
>>> +#define IS_TCP6_MATCH(IpType)                                      ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
>>
>> And these macros to test for ==, not !=
>>
>>
>> Igor: First version tested "==", but we agreed that it may not work if we have a wrong value of IpType.
>>
>> Otherwise the code reads like it does the opposite of what it does.
>>
>> (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
>> that feels a bit convoluted.)
>>
>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
>>
>> Regards,
>>
>> Leif
>
> Sorry, could I add my 2 cents?

Always!

> For me all newly added defines looks bad, just because those
> implicitly use reference to a global variable
> plus local variable state (i.e  current cycle index).

Fair. But the original test is basically line noise.
I will point out that gRequiredProtocol appears to be misnamed to start
with. It's only used in this file, so ought to be mRequiredProtocol.
However, your point still stands.

> Could we rewrite code in a simple and straight forward manner, similar to:
>
> if (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN) {
>    // The protocol type is not specified in SMBIOS table type 42h
>    return EFI_UNSUPPORTED;
> }

The test needs to be an allowlist, not a denylist of specific error
cases. The input is the SMBIOS table, which could have been corrupted
accidentally or intentionally.

But yes, rejecting the outright invalid options upfront is a big
readability improvement.

> for (Index = 0; Index < ListCount; Index++) {
>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) &&
>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>       continue;
>    }
>    if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) &&
>       (IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>       continue;
>    }
>    <skip>

This still looks somewhat like line noise.
We could stick it in a static helper function to get
BuildupNetworkInterface () more human readable?

Regards,

Leif

> Regards,
> Mike.
>
>
> 
>
>

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111277): https://edk2.groups.io/g/devel/message/111277
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: edk2-stable202311 Code freeze process violation Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 11:54               ` Chang, Abner via groups.io
@ 2023-11-15 17:28                 ` Michael D Kinney
  2023-11-16  0:55                   ` 回复: " gaoliming via groups.io
  0 siblings, 1 reply; 23+ messages in thread
From: Michael D Kinney @ 2023-11-15 17:28 UTC (permalink / raw)
  To: Chang, Abner, Leif Lindholm, devel@edk2.groups.io, Mike Maslenkin,
	igork@ami.com, Gao, Liming
  Cc: Nickle Wang, Kinney, Michael D

Hello,

Looks like the process for permissions needs to be adjusted during soft/hard freeze.

Liming reduced EDK II Maintainers team to "Triage" for edk2 repo.

But from this documentation lists Triage as allowing add/remove labels.

https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization

Looks like reducing to EDK II Maintainer team to "Read" is the right setting for soft/hard freeze.

Mike


> -----Original Message-----
> From: Chang, Abner <Abner.Chang@amd.com>
> Sent: Wednesday, November 15, 2023 3:55 AM
> To: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io;
> Mike Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> <gaoliming@byosoft.com.cn>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Subject: RE: edk2-stable202311 Code freeze process violation Re:
> [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize
> the Redfish Discover flow
> 
> [AMD Official Use Only - General]
> 
> Ok, Liming as we are going to revert that two commits. Is that
> possible to wait for Igor sending out another patch to address Leif's
> comment? This may delay the stable release a little bit.
> As without this patch, users may encounter the problem when sending
> request to Redfish service on the platform which have multiple NIC
> installed,
> 
> Let us know, thanks!
> Abner
> 
> > -----Original Message-----
> > From: Chang, Abner
> > Sent: Wednesday, November 15, 2023 7:07 PM
> > To: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io;
> Mike
> > Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > <michael.d.kinney@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Subject: RE: edk2-stable202311 Code freeze process violation Re:
> [edk2-
> > devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the
> Redfish
> > Discover flow
> >
> > Hi Leif,
> > As we requested Liming to wait for this change last week, he
> accepted to wait
> > for the PR. But you are right, suppose I shouldn't be allowed to
> merge the
> > change during code freeze. Maybe only certain people have privilege
> to merge
> > the code during code freeze. If I still can merge the code then the
> mechanism
> > may be broken. I am fine if you would like to revert these commits.
> >
> > Regards,
> > Abner
> >
> > > -----Original Message-----
> > > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > > Sent: Wednesday, November 15, 2023 6:59 PM
> > > To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>; Mike
> > > Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> > > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Subject: edk2-stable202311 Code freeze process violation Re:
> [edk2-devel]
> > > [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the
> Redfish
> > > Discover flow
> > >
> > > Caution: This message originated from an External Source. Use
> proper
> > caution
> > > when opening attachments, clicking links, or responding.
> > >
> > >
> > > On 2023-11-15 03:55, Chang, Abner via groups.io wrote:
> > > > [AMD Official Use Only - General]
> > > >
> > > > Just let you know I just merged this change. Igor can help to
> follow up the
> > > suggestions given by Leif and Mike.
> > >
> > > I was under the impression merging was disabled for everyone
> except Mike
> > > and Liming during code freeze specifically to avoid this
> situation.
> > > Apparently, that isn't working.
> > >
> > > Regardless, this is a violation of the stable tag process.
> > > Liming: can you please revert these commits?
> > >
> > > Regards,
> > >
> > > Leif
> > >
> > > > Thanks
> > > > Abner
> > > >
> > > >> -----Original Message-----
> > > >> From: Chang, Abner
> > > >> Sent: Wednesday, November 15, 2023 9:20 AM
> > > >> To: Mike Maslenkin <mike.maslenkin@gmail.com>;
> > devel@edk2.groups.io;
> > > >> igork@ami.com
> > > >> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
> > > >> <nicklew@nvidia.com>
> > > >> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > RedfishDiscoverDxe:
> > > >> Optimize the Redfish Discover flow
> > > >>
> > > >> Hi Mike and Leif,
> > > >> Thanks for your comments on this change. As we are rushing to
> get this
> > > >> change to be pulled in stable release 202312 this week, I will
> just merge
> > this
> > > >> code to master branch and let the discussing keeps going.
> > > >> I think there is no functionality difference base on your
> suggestions, but
> > it's
> > > >> about the coding practice and readability.
> > > >>
> > > >> Hi Igor,
> > > >> Could you please resend the V6 after stable tag is released if
> Mike and
> > Leif's
> > > >> comment is reasonable to you?
> > > >>
> > > >> Thanks
> > > >> Abner
> > > >>
> > > >>> -----Original Message-----
> > > >>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > >>> Sent: Wednesday, November 15, 2023 7:53 AM
> > > >>> To: devel@edk2.groups.io; igork@ami.com
> > > >>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> > > >>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> > > >>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > RedfishDiscoverDxe:
> > > >>> Optimize the Redfish Discover flow
> > > >>>
> > > >>> Caution: This message originated from an External Source. Use
> proper
> > > >> caution
> > > >>> when opening attachments, clicking links, or responding.
> > > >>>
> > > >>>
> > > >>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> > > >>> <igork=ami.com@groups.io> wrote:
> > > >>>>
> > > >>>> Hi Leif,
> > > >>>> Please see my comments below.
> > > >>>> Thank you,
> > > >>>> Igor
> > > >>>>
> > > >>>>
> > > >>>> -----Original Message-----
> > > >>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
> > > >>>> Sent: Tuesday, November 14, 2023 12:26 PM
> > > >>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > > >>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> > > >>> <nicklew@nvidia.com>
> > > >>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2]
> RedfishPkg:
> > > >>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> > > >>>>
> > > >>>>
> > > >>>> **CAUTION: The e-mail below is from an external source.
> Please
> > exercise
> > > >>> caution before opening attachments, clicking links, or
> following
> > > guidance.**
> > > >>>>
> > > >>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > >>>>> Filter out the network interfaces which are not supported by
> > > >>>>> Redfish Host Interface.
> > > >>>>>
> > > >>>>> Cc: Abner Chang <abner.chang@amd.com>
> > > >>>>> Cc: Nickle Wang <nicklew@nvidia.com>
> > > >>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > > >>>>> ---
> > > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c      |
> 163
> > > >>> ++++++++++++++------
> > > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |
> 6 +
> > > >>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
> > > >>>>>
> > > >>>>> diff --git
> a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > >>>>> index 0f622e05a9..ae83cd3c97 100644
> > > >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > >>>>
> > > >>>>
> > > >>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > > >>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> > > >>> *RestExInstance;
> > > >>>>>      EFI_TPL
> OldTpl;
> > > >>>>>      BOOLEAN
> NewNetworkInterfaceInstalled;
> > > >>>>> +  UINT8                                            IpType;
> > > >>>>> +  UINTN
> ListCount;
> > > >>>>>
> > > >>>>> +  ListCount                    = (sizeof
> (gRequiredProtocol) / sizeof
> > > >>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > > >>>>>      NewNetworkInterfaceInstalled = FALSE;
> > > >>>>>      Index                        = 0;
> > > >>>>> -  do {
> > > >>>>> +
> > > >>>>> +  // Get IP Type to filter out unnecessary network protocol
> if possible
> > > >>>>> +  IpType = GetHiIpProtocolType ();
> > > >>>>> +
> > > >>>>> +  for (Index = 0; Index < ListCount; Index++) {
> > > >>>>> +    // Check IP Type and skip an unnecessary network
> protocol if does
> > > >> not
> > > >>> match
> > > >>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> > > >>>>
> > > >>>> The logic of these macros is inverted compared to their
> names, though.
> > > >>>>
> > > >>>> You want this test to read
> > > >>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> > > >>>>
> > > >>>>> +      continue;
> > > >>>>> +    }
> > > >>>>> +
> > > >>>>>        Status = gBS->OpenProtocol (
> > > >>>>>                        // Already in list?
> > > >>>>>                        ControllerHandle,
> > > >>>>
> > > >>>>> diff --git
> a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > >>>>> index 01454acc1d..3093eea0d5 100644
> > > >>>>> ---
> a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > >>>>> +++
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > >>>>> @@ -39,6 +39,12 @@
> > > >>>>>    #define REDFISH_DISCOVER_VERSION
> 0x00010000
> > > >>>>>    #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
> > > >> TPL_NOTIFY
> > > >>>>>
> > > >>>>> +#define MAC_COMPARE(ThisNetworkInterface,
> > > >> TargetNetworkInterface)
> > > >>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> > > >>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> > > >>>> HwAddressSize))
> > > >>>>> +#define VALID_TCP6(TargetNetworkInterface,
> ThisNetworkInterface)
> > > >>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > > >>>> NetworkProtocolType == ProtocolTypeTcp6))
> > > >>>>> +#define VALID_TCP4(TargetNetworkInterface,
> ThisNetworkInterface)
> > > >>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > > >>>> NetworkProtocolType == ProtocolTypeTcp4))
> > > >>>>> +#define IS_TCP4_MATCH(IpType)
> > > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4)
> &&
> > > >> (IpType !=
> > > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > > >>>>> +#define IS_TCP6_MATCH(IpType)
> > > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6)
> &&
> > > >> (IpType !=
> > > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> > > >>>>
> > > >>>> And these macros to test for ==, not !=
> > > >>>>
> > > >>>>
> > > >>>> Igor: First version tested "==", but we agreed that it may
> not work if we
> > > >> have
> > > >>> a wrong value of IpType.
> > > >>>>
> > > >>>> Otherwise the code reads like it does the opposite of what it
> does.
> > > >>>>
> > > >>>> (You could also keep the logic and call the macros
> IS_TCP#_MISMATCH,
> > > but
> > > >>>> that feels a bit convoluted.)
> > > >>>>
> > > >>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> > > >>>>
> > > >>>> Regards,
> > > >>>>
> > > >>>> Leif
> > > >>>
> > > >>> Sorry, could I add my 2 cents?
> > > >>>
> > > >>> For me all newly added defines looks bad, just because those
> > > >>> implicitly use reference to a global variable
> > > >>> plus local variable state (i.e  current cycle index).
> > > >>>
> > > >>> Could we rewrite code in a simple and straight forward manner,
> similar
> > to:
> > > >>>
> > > >>> if (IpType ==
> > > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN)
> > {
> > > >>>    // The protocol type is not specified in SMBIOS table type
> 42h
> > > >>>    return EFI_UNSUPPORTED;
> > > >>> }
> > > >>>
> > > >>> for (Index = 0; Index < ListCount; Index++) {
> > > >>>    if ((gRequiredProtocol[Index].ProtocolType ==
> ProtocolTypeTcp4) &&
> > > >>>       (IpType !=
> > > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> > > >>>       continue;
> > > >>>    }
> > > >>>    if ((gRequiredProtocol[Index].ProtocolType ==
> ProtocolTypeTcp6) &&
> > > >>>       (IpType !=
> > > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> > > >>>       continue;
> > > >>>    }
> > > >>>    <skip>
> > > >>>
> > > >>> Regards,
> > > >>> Mike.
> > > >
> > > >
> > > > 
> > > >
> > > >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111283): https://edk2.groups.io/g/devel/message/111283
Mute This Topic: https://groups.io/mt/102602698/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 13:51         ` Igor Kulchytskyy via groups.io
@ 2023-11-15 18:27           ` Mike Maslenkin
  2023-11-15 18:36             ` Igor Kulchytskyy via groups.io
  2023-11-16 12:14             ` Leif Lindholm
  0 siblings, 2 replies; 23+ messages in thread
From: Mike Maslenkin @ 2023-11-15 18:27 UTC (permalink / raw)
  To: Igor Kulchytskyy
  Cc: Leif Lindholm, devel@edk2.groups.io, Abner Chang, Nickle Wang

On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
>
> Hello Leif and Mike,
> Let me try to explain the idea of the filtering IP.
> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
Hm. I've already composed a reply below, but then a returned to this
statement...

Is this a difference in condition between v3 and v5? I came to the
conclusion that at the place we are discussing
SMBIOS table 42h can be absent because
PlatformHostInterfaceInformationReady hasn't been called yet,
so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.


> And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
> In that case there is no need to build network interface for the unused IP Type.
> On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
> If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
> So, later Redfish Discover driver can find the right one.
> Based on this logic I'm going to prepare the patch v6.
> Thank you,
> Igor

Agree.. I was focused on edk2 implementation of
RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
where HostIpAddressFormat is specified (hardcoded). I guess
HostIpAddressFormat  as well as SMBIOS table 42h must be available
by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
call, while it might be not available at the moment
RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
condition from v3 looks correct to me.

My main concern was introduction of defines. Those don't look great.
Those are huge (it even doesn't fit into the screen) and misleading a
bit.
For example:
+#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
(CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
&TargetNetworkInterface->MacAddress,
ThisNetworkInterface->HwAddressSize))

The proposed variant is equal to #define MAC_COMPARE(A, B)
(CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
&TargetNetworkInterface->MacAddress,
ThisNetworkInterface->HwAddressSize)), i.e a bit useless.

I would expect it could be declared at least as:
#define MAC_COMPARE(This, Target)  CompareMem ((VOID
*)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
I.e define should really replace some arguments  also reducing the line length.

BTW: there is a place in ValidateTargetNetworkInterface() where
CompareMem  can be replaced with MAC_COMPARE too.

Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
edk2. But according to that one, please consider moving "== 0" check
to #define declaration.
But I do not think this macro is required at all, because there are 5
MAC compares left in this module. So, it just brings some
inconsistency.

Agreed that static helper function would be the best.

Leif, do you expect something like this?
STATIC
BOOLEAN
FilterInterface (
  IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
  IN UINT8 HostIpAddressFormat
  )
{
  // This is based on v5, but according to the comments above
  // v3 is correct as it allows
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN

  if (ProtocolType == ProtocolTypeTcp4) {
    return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
  } else if (ProtocolType == ProtocolTypeTcp6) {
    return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
  }
  return false;
}

and then::

// Get IP Type to filter out unnecessary network protocol if possible
IpType = GetHiIpProtocolType ();

for (Index = 0; Index < ListCount; Index++) {
  // Check IP Type and skip an unnecessary network protocol if does not match
 if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {
    continue;
  }

Regards,
Mike.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111286): https://edk2.groups.io/g/devel/message/111286
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 18:27           ` Mike Maslenkin
@ 2023-11-15 18:36             ` Igor Kulchytskyy via groups.io
  2023-11-15 19:25               ` Mike Maslenkin
  2023-11-16 12:14             ` Leif Lindholm
  1 sibling, 1 reply; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-15 18:36 UTC (permalink / raw)
  To: Mike Maslenkin
  Cc: Leif Lindholm, devel@edk2.groups.io, Abner Chang, Nickle Wang

Hi Mike,
My implementation of checking the IpType supposed to be like this:
/**
  Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.

  @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
  @param[in]  IpType               The Host IP Address Type from SMBIOS Type 42.
**/
STATIC
BOOLEAN
IsTcpTypeMatch (
  IN UINT32 NetworkProtocolType,
  IN UINT8 IpType
  )
{
  if ((NetworkProtocolType == ProtocolTypeTcp4) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
    return TRUE;
  }
  if ((NetworkProtocolType == ProtocolTypeTcp6) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
    return TRUE;
  }
  return FALSE;
}

And then in BuildupNetworkInterface function.

  // Get IP Type to filter out unnecessary network protocol if possible
  IpType = GetHiIpProtocolType ();

  for (Index = 0; Index < ListCount; Index++) {
    // Check IP Type and skip an unnecessary network protocol if does not match
    if (!IsTcpTypeMatch (mRequiredProtocol[Index].ProtocolType, IpType)) {
      continue;
    }

-----Original Message-----
From: Mike Maslenkin <mike.maslenkin@gmail.com>
Sent: Wednesday, November 15, 2023 1:27 PM
To: Igor Kulchytskyy <igork@ami.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
>
> Hello Leif and Mike,
> Let me try to explain the idea of the filtering IP.
> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
Hm. I've already composed a reply below, but then a returned to this
statement...

Is this a difference in condition between v3 and v5? I came to the
conclusion that at the place we are discussing
SMBIOS table 42h can be absent because
PlatformHostInterfaceInformationReady hasn't been called yet,
so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.


> And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
> In that case there is no need to build network interface for the unused IP Type.
> On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
> If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
> So, later Redfish Discover driver can find the right one.
> Based on this logic I'm going to prepare the patch v6.
> Thank you,
> Igor

Agree.. I was focused on edk2 implementation of
RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
where HostIpAddressFormat is specified (hardcoded). I guess
HostIpAddressFormat  as well as SMBIOS table 42h must be available
by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
call, while it might be not available at the moment
RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
condition from v3 looks correct to me.

My main concern was introduction of defines. Those don't look great.
Those are huge (it even doesn't fit into the screen) and misleading a
bit.
For example:
+#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
(CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
&TargetNetworkInterface->MacAddress,
ThisNetworkInterface->HwAddressSize))

The proposed variant is equal to #define MAC_COMPARE(A, B)
(CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
&TargetNetworkInterface->MacAddress,
ThisNetworkInterface->HwAddressSize)), i.e a bit useless.

I would expect it could be declared at least as:
#define MAC_COMPARE(This, Target)  CompareMem ((VOID
*)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
I.e define should really replace some arguments  also reducing the line length.

BTW: there is a place in ValidateTargetNetworkInterface() where
CompareMem  can be replaced with MAC_COMPARE too.

Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
edk2. But according to that one, please consider moving "== 0" check
to #define declaration.
But I do not think this macro is required at all, because there are 5
MAC compares left in this module. So, it just brings some
inconsistency.

Agreed that static helper function would be the best.

Leif, do you expect something like this?
STATIC
BOOLEAN
FilterInterface (
  IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
  IN UINT8 HostIpAddressFormat
  )
{
  // This is based on v5, but according to the comments above
  // v3 is correct as it allows
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN

  if (ProtocolType == ProtocolTypeTcp4) {
    return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
  } else if (ProtocolType == ProtocolTypeTcp6) {
    return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
  }
  return false;
}

and then::

// Get IP Type to filter out unnecessary network protocol if possible
IpType = GetHiIpProtocolType ();

for (Index = 0; Index < ListCount; Index++) {
  // Check IP Type and skip an unnecessary network protocol if does not match
 if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {
    continue;
  }

Regards,
Mike.
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111287): https://edk2.groups.io/g/devel/message/111287
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 18:36             ` Igor Kulchytskyy via groups.io
@ 2023-11-15 19:25               ` Mike Maslenkin
  2023-11-15 19:36                 ` Igor Kulchytskyy via groups.io
  0 siblings, 1 reply; 23+ messages in thread
From: Mike Maslenkin @ 2023-11-15 19:25 UTC (permalink / raw)
  To: Igor Kulchytskyy
  Cc: Leif Lindholm, devel@edk2.groups.io, Abner Chang, Nickle Wang

Hi Igor,

On Wed, Nov 15, 2023 at 9:37 PM Igor Kulchytskyy <igork@ami.com> wrote:
>
> Hi Mike,
> My implementation of checking the IpType supposed to be like this:
> /**
>   Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.
>
>   @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
>   @param[in]  IpType               The Host IP Address Type from SMBIOS Type 42.
> **/
> STATIC
> BOOLEAN
> IsTcpTypeMatch (
>   IN UINT32 NetworkProtocolType,

NetworkProtocolType has defined type -
NETWORK_INTERFACE_PROTOCOL_TYPE, why don't you use it.
Ah. I see it is declared as UINT32 in REDFISH_DISCOVER_REQUIRED_PROTOCOL... Ok.
It's not clear why, because it is internal structure.

>   IN UINT8 IpType
>   )
> {
>   if ((NetworkProtocolType == ProtocolTypeTcp4) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>     return TRUE;
>   }
>   if ((NetworkProtocolType == ProtocolTypeTcp6) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>     return TRUE;
>   }
>   return FALSE;
> }
>
> And then in BuildupNetworkInterface function.
>
>   // Get IP Type to filter out unnecessary network protocol if possible
>   IpType = GetHiIpProtocolType ();
>
>   for (Index = 0; Index < ListCount; Index++) {
>     // Check IP Type and skip an unnecessary network protocol if does not match
>     if (!IsTcpTypeMatch (mRequiredProtocol[Index].ProtocolType, IpType)) {
>       continue;
>     }

So, where is REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN handled now?

If IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
IsTcpTypeMatch() always returns FALSE,
so !IsTcpTypeMatch() gives TRUE and we skip this iteration.
Effectively this means
if (IpType  == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN ) {
  return EFI_DEVICE_ERROR
}
Just because there is nothing after this loop.
And this is not what we wanted, and recognized as my mistake previously.


>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Wednesday, November 15, 2023 1:27 PM
> To: Igor Kulchytskyy <igork@ami.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
> >
> > Hello Leif and Mike,
> > Let me try to explain the idea of the filtering IP.
> > That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
>
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>
>
> > And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
> > In that case there is no need to build network interface for the unused IP Type.
> > On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
> > If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
> > If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
> > So, later Redfish Discover driver can find the right one.
> > Based on this logic I'm going to prepare the patch v6.
> > Thank you,
> > Igor
>
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
>
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize))
>
> The proposed variant is equal to #define MAC_COMPARE(A, B)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
>
> I would expect it could be declared at least as:
> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
> I.e define should really replace some arguments  also reducing the line length.
>
> BTW: there is a place in ValidateTargetNetworkInterface() where
> CompareMem  can be replaced with MAC_COMPARE too.
>
> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
> edk2. But according to that one, please consider moving "== 0" check
> to #define declaration.
> But I do not think this macro is required at all, because there are 5
> MAC compares left in this module. So, it just brings some
> inconsistency.
>
> Agreed that static helper function would be the best.
>
> Leif, do you expect something like this?
> STATIC
> BOOLEAN
> FilterInterface (
>   IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>   IN UINT8 HostIpAddressFormat
>   )
> {
>   // This is based on v5, but according to the comments above
>   // v3 is correct as it allows
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
>
>   if (ProtocolType == ProtocolTypeTcp4) {
>     return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>   } else if (ProtocolType == ProtocolTypeTcp6) {
>     return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>   }
>   return false;
> }
>
> and then::
>
> // Get IP Type to filter out unnecessary network protocol if possible
> IpType = GetHiIpProtocolType ();
>
> for (Index = 0; Index < ListCount; Index++) {
>   // Check IP Type and skip an unnecessary network protocol if does not match
>  if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {
>     continue;
>   }
>
> Regards,
> Mike.
> -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111290): https://edk2.groups.io/g/devel/message/111290
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 19:25               ` Mike Maslenkin
@ 2023-11-15 19:36                 ` Igor Kulchytskyy via groups.io
  0 siblings, 0 replies; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-15 19:36 UTC (permalink / raw)
  To: Mike Maslenkin
  Cc: Leif Lindholm, devel@edk2.groups.io, Abner Chang, Nickle Wang



-----Original Message-----
From: Mike Maslenkin <mike.maslenkin@gmail.com>
Sent: Wednesday, November 15, 2023 2:26 PM
To: Igor Kulchytskyy <igork@ami.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

Hi Igor,

On Wed, Nov 15, 2023 at 9:37 PM Igor Kulchytskyy <igork@ami.com> wrote:
>
> Hi Mike,
> My implementation of checking the IpType supposed to be like this:
> /**
>   Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.
>
>   @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
>   @param[in]  IpType               The Host IP Address Type from SMBIOS Type 42.
> **/
> STATIC
> BOOLEAN
> IsTcpTypeMatch (
>   IN UINT32 NetworkProtocolType,

NetworkProtocolType has defined type -
NETWORK_INTERFACE_PROTOCOL_TYPE, why don't you use it.
Ah. I see it is declared as UINT32 in REDFISH_DISCOVER_REQUIRED_PROTOCOL... Ok.
It's not clear why, because it is internal structure.

>   IN UINT8 IpType
>   )
> {
>   if ((NetworkProtocolType == ProtocolTypeTcp4) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
>     return TRUE;
>   }
>   if ((NetworkProtocolType == ProtocolTypeTcp6) && (IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
>     return TRUE;
>   }
>   return FALSE;
> }
>
> And then in BuildupNetworkInterface function.
>
>   // Get IP Type to filter out unnecessary network protocol if possible
>   IpType = GetHiIpProtocolType ();
>
>   for (Index = 0; Index < ListCount; Index++) {
>     // Check IP Type and skip an unnecessary network protocol if does not match
>     if (!IsTcpTypeMatch (mRequiredProtocol[Index].ProtocolType, IpType)) {
>       continue;
>     }

So, where is REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN handled now?

If IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
IsTcpTypeMatch() always returns FALSE,
so !IsTcpTypeMatch() gives TRUE and we skip this iteration.
Effectively this means
if (IpType  == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN ) {
  return EFI_DEVICE_ERROR
}
Just because there is nothing after this loop.
And this is not what we wanted, and recognized as my mistake previously.

Igor:
Agree. We did recognize it as mistake. My fault.
Lets stick with your version and see what Leif say.


>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Wednesday, November 15, 2023 1:27 PM
> To: Igor Kulchytskyy <igork@ami.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
> >
> > Hello Leif and Mike,
> > Let me try to explain the idea of the filtering IP.
> > That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
>
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>
>
> > And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
> > In that case there is no need to build network interface for the unused IP Type.
> > On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
> > If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
> > If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
> > So, later Redfish Discover driver can find the right one.
> > Based on this logic I'm going to prepare the patch v6.
> > Thank you,
> > Igor
>
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
>
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize))
>
> The proposed variant is equal to #define MAC_COMPARE(A, B)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
>
> I would expect it could be declared at least as:
> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
> I.e define should really replace some arguments  also reducing the line length.
>
> BTW: there is a place in ValidateTargetNetworkInterface() where
> CompareMem  can be replaced with MAC_COMPARE too.
>
> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
> edk2. But according to that one, please consider moving "== 0" check
> to #define declaration.
> But I do not think this macro is required at all, because there are 5
> MAC compares left in this module. So, it just brings some
> inconsistency.
>
> Agreed that static helper function would be the best.
>
> Leif, do you expect something like this?
> STATIC
> BOOLEAN
> FilterInterface (
>   IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>   IN UINT8 HostIpAddressFormat
>   )
> {
>   // This is based on v5, but according to the comments above
>   // v3 is correct as it allows
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
>
>   if (ProtocolType == ProtocolTypeTcp4) {
>     return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>   } else if (ProtocolType == ProtocolTypeTcp6) {
>     return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>   }
>   return false;
> }
>
> and then::
>
> // Get IP Type to filter out unnecessary network protocol if possible
> IpType = GetHiIpProtocolType ();
>
> for (Index = 0; Index < ListCount; Index++) {
>   // Check IP Type and skip an unnecessary network protocol if does not match
>  if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {
>     continue;
>   }
>
> Regards,
> Mike.
> -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111291): https://edk2.groups.io/g/devel/message/111291
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* 回复: edk2-stable202311 Code freeze process violation Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 17:28                 ` Michael D Kinney
@ 2023-11-16  0:55                   ` gaoliming via groups.io
  0 siblings, 0 replies; 23+ messages in thread
From: gaoliming via groups.io @ 2023-11-16  0:55 UTC (permalink / raw)
  To: 'Kinney, Michael D', 'Chang, Abner',
	'Leif Lindholm', devel, 'Mike Maslenkin', igork
  Cc: 'Nickle Wang'

Mike:
  Yes. We should set Read access in code freeze phase.

Abner:
  In hard code freeze phase, the critical issue is still allowed to be merged after it got approval from Stewards. Can you resend the patch with edk2-stable202311 title to get maintainer review and Stewards approval? For the merged code, I agree Lefi to revert it first. 

Leif:
  This is my mistake. I should set the correct access in the code freeze phase. For this patch, I suggest Abner goes through the critical patch review process if this patch needs to catch this stable tag. 

Thanks
Liming
> -----邮件原件-----
> 发件人: Kinney, Michael D <michael.d.kinney@intel.com>
> 发送时间: 2023年11月16日 1:29
> 收件人: Chang, Abner <Abner.Chang@amd.com>; Leif Lindholm
> <quic_llindhol@quicinc.com>; devel@edk2.groups.io; Mike Maslenkin
> <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> <gaoliming@byosoft.com.cn>
> 抄送: Nickle Wang <nicklew@nvidia.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> 主题: RE: edk2-stable202311 Code freeze process violation Re: [edk2-devel]
> [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover
> flow
> 
> Hello,
> 
> Looks like the process for permissions needs to be adjusted during soft/hard
> freeze.
> 
> Liming reduced EDK II Maintainers team to "Triage" for edk2 repo.
> 
> But from this documentation lists Triage as allowing add/remove labels.
> 
> https://docs.github.com/en/organizations/managing-user-access-to-your-org
> anizations-repositories/managing-repository-roles/repository-roles-for-an-org
> anization
> 
> Looks like reducing to EDK II Maintainer team to "Read" is the right setting for
> soft/hard freeze.
> 
> Mike
> 
> 
> > -----Original Message-----
> > From: Chang, Abner <Abner.Chang@amd.com>
> > Sent: Wednesday, November 15, 2023 3:55 AM
> > To: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io;
> > Mike Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao,
> Liming
> > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > <michael.d.kinney@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Subject: RE: edk2-stable202311 Code freeze process violation Re:
> > [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize
> > the Redfish Discover flow
> >
> > [AMD Official Use Only - General]
> >
> > Ok, Liming as we are going to revert that two commits. Is that
> > possible to wait for Igor sending out another patch to address Leif's
> > comment? This may delay the stable release a little bit.
> > As without this patch, users may encounter the problem when sending
> > request to Redfish service on the platform which have multiple NIC
> > installed,
> >
> > Let us know, thanks!
> > Abner
> >
> > > -----Original Message-----
> > > From: Chang, Abner
> > > Sent: Wednesday, November 15, 2023 7:07 PM
> > > To: Leif Lindholm <quic_llindhol@quicinc.com>; devel@edk2.groups.io;
> > Mike
> > > Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> > > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Subject: RE: edk2-stable202311 Code freeze process violation Re:
> > [edk2-
> > > devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the
> > Redfish
> > > Discover flow
> > >
> > > Hi Leif,
> > > As we requested Liming to wait for this change last week, he
> > accepted to wait
> > > for the PR. But you are right, suppose I shouldn't be allowed to
> > merge the
> > > change during code freeze. Maybe only certain people have privilege
> > to merge
> > > the code during code freeze. If I still can merge the code then the
> > mechanism
> > > may be broken. I am fine if you would like to revert these commits.
> > >
> > > Regards,
> > > Abner
> > >
> > > > -----Original Message-----
> > > > From: Leif Lindholm <quic_llindhol@quicinc.com>
> > > > Sent: Wednesday, November 15, 2023 6:59 PM
> > > > To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>;
> Mike
> > > > Maslenkin <mike.maslenkin@gmail.com>; igork@ami.com; Gao, Liming
> > > > <gaoliming@byosoft.com.cn>; Kinney, Michael D
> > > > <michael.d.kinney@intel.com>
> > > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > > Subject: edk2-stable202311 Code freeze process violation Re:
> > [edk2-devel]
> > > > [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the
> > Redfish
> > > > Discover flow
> > > >
> > > > Caution: This message originated from an External Source. Use
> > proper
> > > caution
> > > > when opening attachments, clicking links, or responding.
> > > >
> > > >
> > > > On 2023-11-15 03:55, Chang, Abner via groups.io wrote:
> > > > > [AMD Official Use Only - General]
> > > > >
> > > > > Just let you know I just merged this change. Igor can help to
> > follow up the
> > > > suggestions given by Leif and Mike.
> > > >
> > > > I was under the impression merging was disabled for everyone
> > except Mike
> > > > and Liming during code freeze specifically to avoid this
> > situation.
> > > > Apparently, that isn't working.
> > > >
> > > > Regardless, this is a violation of the stable tag process.
> > > > Liming: can you please revert these commits?
> > > >
> > > > Regards,
> > > >
> > > > Leif
> > > >
> > > > > Thanks
> > > > > Abner
> > > > >
> > > > >> -----Original Message-----
> > > > >> From: Chang, Abner
> > > > >> Sent: Wednesday, November 15, 2023 9:20 AM
> > > > >> To: Mike Maslenkin <mike.maslenkin@gmail.com>;
> > > devel@edk2.groups.io;
> > > > >> igork@ami.com
> > > > >> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Nickle Wang
> > > > >> <nicklew@nvidia.com>
> > > > >> Subject: RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > > RedfishDiscoverDxe:
> > > > >> Optimize the Redfish Discover flow
> > > > >>
> > > > >> Hi Mike and Leif,
> > > > >> Thanks for your comments on this change. As we are rushing to
> > get this
> > > > >> change to be pulled in stable release 202312 this week, I will
> > just merge
> > > this
> > > > >> code to master branch and let the discussing keeps going.
> > > > >> I think there is no functionality difference base on your
> > suggestions, but
> > > it's
> > > > >> about the coding practice and readability.
> > > > >>
> > > > >> Hi Igor,
> > > > >> Could you please resend the V6 after stable tag is released if
> > Mike and
> > > Leif's
> > > > >> comment is reasonable to you?
> > > > >>
> > > > >> Thanks
> > > > >> Abner
> > > > >>
> > > > >>> -----Original Message-----
> > > > >>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > > >>> Sent: Wednesday, November 15, 2023 7:53 AM
> > > > >>> To: devel@edk2.groups.io; igork@ami.com
> > > > >>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>; Chang, Abner
> > > > >>> <Abner.Chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> > > > >>> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> > > RedfishDiscoverDxe:
> > > > >>> Optimize the Redfish Discover flow
> > > > >>>
> > > > >>> Caution: This message originated from an External Source. Use
> > proper
> > > > >> caution
> > > > >>> when opening attachments, clicking links, or responding.
> > > > >>>
> > > > >>>
> > > > >>> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
> > > > >>> <igork=ami.com@groups.io> wrote:
> > > > >>>>
> > > > >>>> Hi Leif,
> > > > >>>> Please see my comments below.
> > > > >>>> Thank you,
> > > > >>>> Igor
> > > > >>>>
> > > > >>>>
> > > > >>>> -----Original Message-----
> > > > >>>> From: Leif Lindholm <quic_llindhol@quicinc.com>
> > > > >>>> Sent: Tuesday, November 14, 2023 12:26 PM
> > > > >>>> To: devel@edk2.groups.io; Igor Kulchytskyy <igork@ami.com>
> > > > >>>> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang
> > > > >>> <nicklew@nvidia.com>
> > > > >>>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2]
> > RedfishPkg:
> > > > >>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> > > > >>>>
> > > > >>>>
> > > > >>>> **CAUTION: The e-mail below is from an external source.
> > Please
> > > exercise
> > > > >>> caution before opening attachments, clicking links, or
> > following
> > > > guidance.**
> > > > >>>>
> > > > >>>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > > >>>>> Filter out the network interfaces which are not supported by
> > > > >>>>> Redfish Host Interface.
> > > > >>>>>
> > > > >>>>> Cc: Abner Chang <abner.chang@amd.com>
> > > > >>>>> Cc: Nickle Wang <nicklew@nvidia.com>
> > > > >>>>> Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > > > >>>>> ---
> > > > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> |
> > 163
> > > > >>> ++++++++++++++------
> > > > >>>>>    RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |
> > 6 +
> > > > >>>>>    2 files changed, 120 insertions(+), 49 deletions(-)
> > > > >>>>>
> > > > >>>>> diff --git
> > a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > >>>>> index 0f622e05a9..ae83cd3c97 100644
> > > > >>>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > >>>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > > >>>>
> > > > >>>>
> > > > >>>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > > > >>>>>      EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> > > > >>> *RestExInstance;
> > > > >>>>>      EFI_TPL
> > OldTpl;
> > > > >>>>>      BOOLEAN
> > NewNetworkInterfaceInstalled;
> > > > >>>>> +  UINT8
> IpType;
> > > > >>>>> +  UINTN
> > ListCount;
> > > > >>>>>
> > > > >>>>> +  ListCount                    = (sizeof
> > (gRequiredProtocol) / sizeof
> > > > >>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > > > >>>>>      NewNetworkInterfaceInstalled = FALSE;
> > > > >>>>>      Index                        = 0;
> > > > >>>>> -  do {
> > > > >>>>> +
> > > > >>>>> +  // Get IP Type to filter out unnecessary network protocol
> > if possible
> > > > >>>>> +  IpType = GetHiIpProtocolType ();
> > > > >>>>> +
> > > > >>>>> +  for (Index = 0; Index < ListCount; Index++) {
> > > > >>>>> +    // Check IP Type and skip an unnecessary network
> > protocol if does
> > > > >> not
> > > > >>> match
> > > > >>>>> +    if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> > > > >>>>
> > > > >>>> The logic of these macros is inverted compared to their
> > names, though.
> > > > >>>>
> > > > >>>> You want this test to read
> > > > >>>>     if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> > > > >>>>
> > > > >>>>> +      continue;
> > > > >>>>> +    }
> > > > >>>>> +
> > > > >>>>>        Status = gBS->OpenProtocol (
> > > > >>>>>                        // Already in list?
> > > > >>>>>                        ControllerHandle,
> > > > >>>>
> > > > >>>>> diff --git
> > a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > >>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > >>>>> index 01454acc1d..3093eea0d5 100644
> > > > >>>>> ---
> > a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > >>>>> +++
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> > > > >>>>> @@ -39,6 +39,12 @@
> > > > >>>>>    #define REDFISH_DISCOVER_VERSION
> > 0x00010000
> > > > >>>>>    #define
> EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL
> > > > >> TPL_NOTIFY
> > > > >>>>>
> > > > >>>>> +#define MAC_COMPARE(ThisNetworkInterface,
> > > > >> TargetNetworkInterface)
> > > > >>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> > > > >>> &TargetNetworkInterface->MacAddress, ThisNetworkInterface-
> > > > >>>> HwAddressSize))
> > > > >>>>> +#define VALID_TCP6(TargetNetworkInterface,
> > ThisNetworkInterface)
> > > > >>> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > > > >>>> NetworkProtocolType == ProtocolTypeTcp6))
> > > > >>>>> +#define VALID_TCP4(TargetNetworkInterface,
> > ThisNetworkInterface)
> > > > >>> (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > > > >>>> NetworkProtocolType == ProtocolTypeTcp4))
> > > > >>>>> +#define IS_TCP4_MATCH(IpType)
> > > > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4)
> > &&
> > > > >> (IpType !=
> > > > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> > > > >>>>> +#define IS_TCP6_MATCH(IpType)
> > > > >>> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6)
> > &&
> > > > >> (IpType !=
> > > > >>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
> > > > >>>>
> > > > >>>> And these macros to test for ==, not !=
> > > > >>>>
> > > > >>>>
> > > > >>>> Igor: First version tested "==", but we agreed that it may
> > not work if we
> > > > >> have
> > > > >>> a wrong value of IpType.
> > > > >>>>
> > > > >>>> Otherwise the code reads like it does the opposite of what it
> > does.
> > > > >>>>
> > > > >>>> (You could also keep the logic and call the macros
> > IS_TCP#_MISMATCH,
> > > > but
> > > > >>>> that feels a bit convoluted.)
> > > > >>>>
> > > > >>>> Igor: I would prefer to go with IS_TCP#_MISMATCH names.
> > > > >>>>
> > > > >>>> Regards,
> > > > >>>>
> > > > >>>> Leif
> > > > >>>
> > > > >>> Sorry, could I add my 2 cents?
> > > > >>>
> > > > >>> For me all newly added defines looks bad, just because those
> > > > >>> implicitly use reference to a global variable
> > > > >>> plus local variable state (i.e  current cycle index).
> > > > >>>
> > > > >>> Could we rewrite code in a simple and straight forward manner,
> > similar
> > > to:
> > > > >>>
> > > > >>> if (IpType ==
> > > > >>>
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN)
> > > {
> > > > >>>    // The protocol type is not specified in SMBIOS table type
> > 42h
> > > > >>>    return EFI_UNSUPPORTED;
> > > > >>> }
> > > > >>>
> > > > >>> for (Index = 0; Index < ListCount; Index++) {
> > > > >>>    if ((gRequiredProtocol[Index].ProtocolType ==
> > ProtocolTypeTcp4) &&
> > > > >>>       (IpType !=
> > > > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> > > > >>>       continue;
> > > > >>>    }
> > > > >>>    if ((gRequiredProtocol[Index].ProtocolType ==
> > ProtocolTypeTcp6) &&
> > > > >>>       (IpType !=
> > > > >> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> > > > >>>       continue;
> > > > >>>    }
> > > > >>>    <skip>
> > > > >>>
> > > > >>> Regards,
> > > > >>> Mike.
> > > > >
> > > > >
> > > > > 
> > > > >
> > > > >





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111295): https://edk2.groups.io/g/devel/message/111295
Mute This Topic: https://groups.io/mt/102618505/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-15 18:27           ` Mike Maslenkin
  2023-11-15 18:36             ` Igor Kulchytskyy via groups.io
@ 2023-11-16 12:14             ` Leif Lindholm
  2023-11-16 12:23               ` Igor Kulchytskyy via groups.io
  1 sibling, 1 reply; 23+ messages in thread
From: Leif Lindholm @ 2023-11-16 12:14 UTC (permalink / raw)
  To: devel, mike.maslenkin, Igor Kulchytskyy; +Cc: Abner Chang, Nickle Wang

On 2023-11-15 18:27, Mike Maslenkin wrote:
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
>>
>> Hello Leif and Mike,
>> Let me try to explain the idea of the filtering IP.
>> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
> 
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
> 
> 
>> And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
>> In that case there is no need to build network interface for the unused IP Type.
>> On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
>> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
>> If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
>> So, later Redfish Discover driver can find the right one.
>> Based on this logic I'm going to prepare the patch v6.
>> Thank you,
>> Igor
> 
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
> 
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize))
> 
> The proposed variant is equal to #define MAC_COMPARE(A, B)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
> 
> I would expect it could be declared at least as:
> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
> I.e define should really replace some arguments  also reducing the line length.
> 
> BTW: there is a place in ValidateTargetNetworkInterface() where
> CompareMem  can be replaced with MAC_COMPARE too.
> 
> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
> edk2. But according to that one, please consider moving "== 0" check
> to #define declaration.
> But I do not think this macro is required at all, because there are 5
> MAC compares left in this module. So, it just brings some
> inconsistency.
> 
> Agreed that static helper function would be the best.
> 
> Leif, do you expect something like this?
> STATIC
> BOOLEAN
> FilterInterface (
>    IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>    IN UINT8 HostIpAddressFormat
>    )
> {
>    // This is based on v5, but according to the comments above
>    // v3 is correct as it allows
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
> 
>    if (ProtocolType == ProtocolTypeTcp4) {
>      return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>    } else if (ProtocolType == ProtocolTypeTcp6) {
>      return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>    }

Yes, this looks ideal.

>    return false;

Although this should be FALSE (upper-case).

> }
> 
> and then::
> 
> // Get IP Type to filter out unnecessary network protocol if possible
> IpType = GetHiIpProtocolType ();
> 
> for (Index = 0; Index < ListCount; Index++) {
>    // Check IP Type and skip an unnecessary network protocol if does not match
>   if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {

This gives us a big but still readable chunk here, and much neater tests 
in the helper than they *could* be either in place or in macros.

>      continue;
>    }

Ship it.

/
     Leif

> Regards,
> Mike.
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111314): https://edk2.groups.io/g/devel/message/111314
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-16 12:14             ` Leif Lindholm
@ 2023-11-16 12:23               ` Igor Kulchytskyy via groups.io
  2023-11-16 12:25                 ` Leif Lindholm
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Kulchytskyy via groups.io @ 2023-11-16 12:23 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io, mike.maslenkin@gmail.com
  Cc: Abner Chang, Nickle Wang

Hi Leif,
Already sent it yesterday.
Thank you,
Igor

-----Original Message-----
From: Leif Lindholm <quic_llindhol@quicinc.com>
Sent: Thursday, November 16, 2023 7:15 AM
To: devel@edk2.groups.io; mike.maslenkin@gmail.com; Igor Kulchytskyy <igork@ami.com>
Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

On 2023-11-15 18:27, Mike Maslenkin wrote:
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
>>
>> Hello Leif and Mike,
>> Let me try to explain the idea of the filtering IP.
>> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
>
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>
>
>> And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
>> In that case there is no need to build network interface for the unused IP Type.
>> On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
>> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
>> If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
>> So, later Redfish Discover driver can find the right one.
>> Based on this logic I'm going to prepare the patch v6.
>> Thank you,
>> Igor
>
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
>
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize))
>
> The proposed variant is equal to #define MAC_COMPARE(A, B)
> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
> &TargetNetworkInterface->MacAddress,
> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
>
> I would expect it could be declared at least as:
> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
> I.e define should really replace some arguments  also reducing the line length.
>
> BTW: there is a place in ValidateTargetNetworkInterface() where
> CompareMem  can be replaced with MAC_COMPARE too.
>
> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
> edk2. But according to that one, please consider moving "== 0" check
> to #define declaration.
> But I do not think this macro is required at all, because there are 5
> MAC compares left in this module. So, it just brings some
> inconsistency.
>
> Agreed that static helper function would be the best.
>
> Leif, do you expect something like this?
> STATIC
> BOOLEAN
> FilterInterface (
>    IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>    IN UINT8 HostIpAddressFormat
>    )
> {
>    // This is based on v5, but according to the comments above
>    // v3 is correct as it allows
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
>
>    if (ProtocolType == ProtocolTypeTcp4) {
>      return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>    } else if (ProtocolType == ProtocolTypeTcp6) {
>      return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>    }

Yes, this looks ideal.

>    return false;

Although this should be FALSE (upper-case).

> }
>
> and then::
>
> // Get IP Type to filter out unnecessary network protocol if possible
> IpType = GetHiIpProtocolType ();
>
> for (Index = 0; Index < ListCount; Index++) {
>    // Check IP Type and skip an unnecessary network protocol if does not match
>   if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {

This gives us a big but still readable chunk here, and much neater tests
in the helper than they *could* be either in place or in macros.

>      continue;
>    }

Ship it.

/
     Leif

> Regards,
> Mike.
>
>
> 
>
>

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111315): https://edk2.groups.io/g/devel/message/111315
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
  2023-11-16 12:23               ` Igor Kulchytskyy via groups.io
@ 2023-11-16 12:25                 ` Leif Lindholm
  0 siblings, 0 replies; 23+ messages in thread
From: Leif Lindholm @ 2023-11-16 12:25 UTC (permalink / raw)
  To: Igor Kulchytskyy, devel@edk2.groups.io, mike.maslenkin@gmail.com
  Cc: Abner Chang, Nickle Wang

Ah, I fell off cc.
Having a look now.

/
     Leif

On 2023-11-16 12:23, Igor Kulchytskyy wrote:
> Hi Leif,
> Already sent it yesterday.
> Thank you,
> Igor
> 
> -----Original Message-----
> From: Leif Lindholm <quic_llindhol@quicinc.com>
> Sent: Thursday, November 16, 2023 7:15 AM
> To: devel@edk2.groups.io; mike.maslenkin@gmail.com; Igor Kulchytskyy <igork@ami.com>
> Cc: Abner Chang <abner.chang@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
> 
> 
> **CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
> 
> On 2023-11-15 18:27, Mike Maslenkin wrote:
>> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy <igork@ami.com> wrote:
>>>
>>> Hello Leif and Mike,
>>> Let me try to explain the idea of the filtering IP.
>>> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in SMBIOS Type 42.
>> Hm. I've already composed a reply below, but then a returned to this
>> statement...
>>
>> Is this a difference in condition between v3 and v5? I came to the
>> conclusion that at the place we are discussing
>> SMBIOS table 42h can be absent because
>> PlatformHostInterfaceInformationReady hasn't been called yet,
>> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>>
>>
>>> And it just helping to reduce the work in case we know the exact type of IP, which supposed to be used in BIOS BMC communication.
>>> In that case there is no need to build network interface for the unused IP Type.
>>> On some systems IP address could be dynamic and we will not be able to know the version of IP from SMBIOS.
>>> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And return IP type UNKNOWN if it is not static.
>>> If we get an unknown IP type, we should not return from BuildupNetworkInterface function, but just proceed and build the network interface for all IPs.
>>> So, later Redfish Discover driver can find the right one.
>>> Based on this logic I'm going to prepare the patch v6.
>>> Thank you,
>>> Igor
>>
>> Agree.. I was focused on edk2 implementation of
>> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
>> where HostIpAddressFormat is specified (hardcoded). I guess
>> HostIpAddressFormat  as well as SMBIOS table 42h must be available
>> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
>> call, while it might be not available at the moment
>> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
>> condition from v3 looks correct to me.
>>
>> My main concern was introduction of defines. Those don't look great.
>> Those are huge (it even doesn't fit into the screen) and misleading a
>> bit.
>> For example:
>> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
>> &TargetNetworkInterface->MacAddress,
>> ThisNetworkInterface->HwAddressSize))
>>
>> The proposed variant is equal to #define MAC_COMPARE(A, B)
>> (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress,
>> &TargetNetworkInterface->MacAddress,
>> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
>>
>> I would expect it could be declared at least as:
>> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
>> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
>> I.e define should really replace some arguments  also reducing the line length.
>>
>> BTW: there is a place in ValidateTargetNetworkInterface() where
>> CompareMem  can be replaced with MAC_COMPARE too.
>>
>> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
>> edk2. But according to that one, please consider moving "== 0" check
>> to #define declaration.
>> But I do not think this macro is required at all, because there are 5
>> MAC compares left in this module. So, it just brings some
>> inconsistency.
>>
>> Agreed that static helper function would be the best.
>>
>> Leif, do you expect something like this?
>> STATIC
>> BOOLEAN
>> FilterInterface (
>>     IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>>     IN UINT8 HostIpAddressFormat
>>     )
>> {
>>     // This is based on v5, but according to the comments above
>>     // v3 is correct as it allows
>> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
>>
>>     if (ProtocolType == ProtocolTypeTcp4) {
>>       return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>>     } else if (ProtocolType == ProtocolTypeTcp6) {
>>       return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>>     }
> 
> Yes, this looks ideal.
> 
>>     return false;
> 
> Although this should be FALSE (upper-case).
> 
>> }
>>
>> and then::
>>
>> // Get IP Type to filter out unnecessary network protocol if possible
>> IpType = GetHiIpProtocolType ();
>>
>> for (Index = 0; Index < ListCount; Index++) {
>>     // Check IP Type and skip an unnecessary network protocol if does not match
>>    if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {
> 
> This gives us a big but still readable chunk here, and much neater tests
> in the helper than they *could* be either in place or in macros.
> 
>>       continue;
>>     }
> 
> Ship it.
> 
> /
>       Leif
> 
>> Regards,
>> Mike.
>>
>>
>> 
>>
>>
> 
> -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111316): https://edk2.groups.io/g/devel/message/111316
Mute This Topic: https://groups.io/mt/102584140/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-11-16 12:25 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 14:28 [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow Igor Kulchytskyy via groups.io
2023-11-14 14:29 ` Chang, Abner via groups.io
2023-11-14 17:26 ` Leif Lindholm
2023-11-14 18:57   ` Igor Kulchytskyy via groups.io
2023-11-14 23:52     ` Mike Maslenkin
2023-11-15  1:19       ` Chang, Abner via groups.io
2023-11-15  1:21         ` Igor Kulchytskyy via groups.io
2023-11-15  3:55         ` Chang, Abner via groups.io
2023-11-15 10:59           ` edk2-stable202311 Code freeze process violation " Leif Lindholm
2023-11-15 11:07             ` Chang, Abner via groups.io
2023-11-15 11:54               ` Chang, Abner via groups.io
2023-11-15 17:28                 ` Michael D Kinney
2023-11-16  0:55                   ` 回复: " gaoliming via groups.io
2023-11-15 10:55         ` Leif Lindholm
2023-11-15 12:01       ` Leif Lindholm
2023-11-15 13:51         ` Igor Kulchytskyy via groups.io
2023-11-15 18:27           ` Mike Maslenkin
2023-11-15 18:36             ` Igor Kulchytskyy via groups.io
2023-11-15 19:25               ` Mike Maslenkin
2023-11-15 19:36                 ` Igor Kulchytskyy via groups.io
2023-11-16 12:14             ` Leif Lindholm
2023-11-16 12:23               ` Igor Kulchytskyy via groups.io
2023-11-16 12:25                 ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox