reg: MAC address could not change on pre-boot environment and failed to PXE boot.


Sivaraman Nainar
 

Hello :

 

We are writing a application to program the MAC from UEFI shell and with the updated MAC address trying to do the PXE Boot which failed.

 

The application uses the Simple Network Protocols StationAddress() to update the MAC. After update the Current Address in the Mode of SimpleNetwork Interface updated to new MAC address. If we performed IfConfigl -l command the updated MAC not showing. Also in this environment PXE boot also got failed.

 

To bind the updated MAC, tried giving "reconnect -r" from UEFI shell after running test application and performed PXE boot. With On board Network controller (Intel I219), the MAC address updated in Snp->Mode->CurrentAddress is reverted back to older MAC address.  If reconnect not performed, the MAC Address changing but PXE Failed to boot.

 

Can someone comment if the method to update the MAC is correct or we missing something.

 

Thanks

Siva

-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.


Rabeda, Maciej
 

Hi Nainar,

 

  1. Snp->StationAddress() calls UNDI->StationAddress(). Is there a guarantee that the UNDI driver you are using will persist the configuration across driver reloads / platform reboots? If there is no such guarantee, you should not reconnect UNDI driver – else the setting is lost.
  2. Ipconfig interfaces with Ip4Config2 protocol to obtain MAC address to display.

Check “HwAddress” field in “EFI_IP4_CONFIG2_INTERFACE_INFO” structure.

It is initialized in the Ip4Dxe driver, in Ip4Config2InitIfInfo(). If you follow Ip4Config2InitIfInfo() upwards the stack, you will see that it gets called in Ip4Dxe DriverBinding->Start() function.

 

What I would suggest is to only reconnect SNP driver.

 

Thanks,

Maciej

 

From: Sivaraman Nainar <sivaramann@...>
Sent: Friday, March 24, 2023 5:22 AM
To: devel@edk2.groups.io; Maciej Rabeda <maciej.rabeda@...>; Rabeda, Maciej <maciej.rabeda@...>; Santhosh Kumar V <santhoshkumarv@...>; Raj V Akilan <rajva@...>
Subject: reg: MAC address could not change on pre-boot environment and failed to PXE boot.

 

Hello :

 

We are writing a application to program the MAC from UEFI shell and with the updated MAC address trying to do the PXE Boot which failed.

 

The application uses the Simple Network Protocols StationAddress() to update the MAC. After update the Current Address in the Mode of SimpleNetwork Interface updated to new MAC address. If we performed IfConfigl -l command the updated MAC not showing. Also in this environment PXE boot also got failed.

 

To bind the updated MAC, tried giving "reconnect -r" from UEFI shell after running test application and performed PXE boot. With On board Network controller (Intel I219), the MAC address updated in Snp->Mode->CurrentAddress is reverted back to older MAC address.  If reconnect not performed, the MAC Address changing but PXE Failed to boot.

 

Can someone comment if the method to update the MAC is correct or we missing something.

 

Thanks

Siva

-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.


Intel Technology Poland sp. z o.o.
ul. Słowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy Gdańsk Północ | VII Wydział Gospodarczy Krajowego Rejestru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakładowy 200.000 PLN.
Spółka oświadcza, że posiada status dużego przedsiębiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdziałaniu nadmiernym opóźnieniom w transakcjach handlowych.

Ta wiadomość wraz z załącznikami jest przeznaczona dla określonego adresata i może zawierać informacje poufne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiadomienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przeglądanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.


erichmcmill@...
 

Hi Sivaraman,

We did this recently in project mu, trying to find exactly the changes needed but I recall the following:

  1. Mac Address needs to be programmed before network stack fully loads (pretty sure I only got it working in DXE), possible to add changes from this PR and have an event callback to set mac address
    1. Event Add a named event that is signalled when Snp->Initialize() is executed. · microsoft/mu_basecore@7dc143d (github.com)
    2. DXE Driver code to handle the Mac programming when the SNP is installed Add MacEmulationDxe Support by Erich-McMillan · Pull Request #109 · microsoft/mu_plus (github.com)
      1. If you don't take this driver as is be very careful to copy the TPL levels from event handers not doing this will cause issues
  2. This change to reload the Snp info in ARP might be needed too ArpDriver: refetch Snp Mode data after running MnpConfigure · microsoft/mu_basecore@2b8ad03 (github.com)
Let me know if you have any issues/questions. Its been a while since I looked at this code.

-Erich


Sivaraman Nainar
 

Hello Erich / Maciej:

 

Thanks for your guidelines. With this approach able to program the MAC and PXE boot works.

 

Thank you

Siva

From: erichmcmill@...
Sent: Friday, March 24, 2023 10:06 AM
To: Sivaraman Nainar; devel@edk2.groups.io
Subject: [EXTERNAL] Re: [edk2-devel] reg: MAC address could not change on pre-boot environment and failed to PXE boot.

 

 

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

Hi Sivaraman,

We did this recently in project mu, trying to find exactly the changes needed but I recall the following:

  1. Mac Address needs to be programmed before network stack fully loads (pretty sure I only got it working in DXE), possible to add changes from this PR and have an event callback to set mac address
    1. Event Add a named event that is signalled when Snp->Initialize() is executed. · microsoft/mu_basecore@7dc143d (github.com)
    2. DXE Driver code to handle the Mac programming when the SNP is installed Add MacEmulationDxe Support by Erich-McMillan · Pull Request #109 · microsoft/mu_plus (github.com)
      1. If you don't take this driver as is be very careful to copy the TPL levels from event handers not doing this will cause issues
  1. This change to reload the Snp info in ARP might be needed too ArpDriver: refetch Snp Mode data after running MnpConfigure · microsoft/mu_basecore@2b8ad03 (github.com)

Let me know if you have any issues/questions. Its been a while since I looked at this code.

-Erich

 

-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.