/**\r
Convert the mac address into a hexadecimal encoded "-" seperated string.\r
\r
- @param[in] Mac The mac address.\r
- @param[in] Len Length in bytes of the mac address.\r
- @param[out] Str The storage to return the mac string.\r
+ @param[in] Mac The mac address.\r
+ @param[in] Len Length in bytes of the mac address.\r
+ @param[in] VlanId VLAN ID of the network device.\r
+ @param[out] Str The storage to return the mac string.\r
**/\r
VOID\r
IScsiMacAddrToStr (\r
IN EFI_MAC_ADDRESS *Mac,\r
IN UINT32 Len,\r
+ IN UINT16 VlanId,\r
OUT CHAR16 *Str\r
)\r
{\r
UINT32 Index;\r
+ CHAR16 *String;\r
\r
for (Index = 0; Index < Len; Index++) {\r
Str[3 * Index] = (CHAR16) IScsiHexString[(Mac->Addr[Index] >> 4) & 0x0F];\r
Str[3 * Index + 2] = L'-';\r
}\r
\r
- Str[3 * Index - 1] = L'\0';\r
+ String = &Str[3 * Index - 1] ;\r
+ if (VlanId != 0) {\r
+ String += UnicodeSPrint (String, 6 * sizeof (CHAR16), L"\\%04x", (UINTN) VlanId);\r
+ }\r
+\r
+ *String = L'\0';\r
}\r
\r
/**\r
EFI_STATUS Status;\r
ISCSI_SESSION *Session;\r
UINTN BufferSize;\r
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r
- EFI_SIMPLE_NETWORK_MODE *Mode;\r
- CHAR16 MacString[65];\r
+ EFI_MAC_ADDRESS MacAddress;\r
+ UINTN HwAddressSize;\r
+ UINT16 VlanId;\r
+ CHAR16 MacString[70];\r
\r
//\r
// get the iSCSI Initiator Name\r
return Status;\r
}\r
\r
- Status = gBS->HandleProtocol (\r
- Private->Controller,\r
- &gEfiSimpleNetworkProtocolGuid,\r
- (VOID **)&Snp\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- Mode = Snp->Mode;\r
-\r
//\r
// Get the mac string, it's the name of various variable\r
//\r
- IScsiMacAddrToStr (&Mode->PermanentAddress, Mode->HwAddressSize, MacString);\r
+ Status = NetLibGetMacAddress (Private->Controller, &MacAddress, &HwAddressSize);\r
+ ASSERT (Status == EFI_SUCCESS);\r
+ VlanId = NetLibGetVlanId (Private->Controller);\r
+ IScsiMacAddrToStr (&MacAddress, (UINT32) HwAddressSize, VlanId, MacString);\r
\r
//\r
// Get the normal configuration.\r