[edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.

Fu Siyuan posted 1 patch 7 years, 4 months ago
Failed in applying to current master (apply log)
NetworkPkg/IScsiDxe/IScsiConfig.c          | 8 ++++++--
NetworkPkg/IScsiDxe/IScsiConfigStrings.uni | 1 +
NetworkPkg/IScsiDxe/IScsiMisc.c            | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
[edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.
Posted by Fu Siyuan 7 years, 4 months ago
The last 3 bytes of ISID should be able to changed by setting the keyword with
a value with length 6 (only last 3 bytes) or 12 (full ISID) according to the
keyword definition in UEFI configuration namespace website.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c          | 8 ++++++--
 NetworkPkg/IScsiDxe/IScsiConfigStrings.uni | 1 +
 NetworkPkg/IScsiDxe/IScsiMisc.c            | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index a588403..4bc9b8f 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -205,11 +205,11 @@ IScsiParseIsIdFromString (
 
   IsIdStr = (CHAR16 *) String;
 
-  if (StrLen (IsIdStr) != 6) {
+  if (StrLen (IsIdStr) != 6 && StrLen (IsIdStr) != 12) {
     UnicodeSPrint (
       PortString,
       (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
-      L"Error! Input is incorrect, please input 6 hex numbers!\n"
+      L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex numbers!\n"
       );
 
     CreatePopUp (
@@ -222,6 +222,10 @@ IScsiParseIsIdFromString (
     return EFI_INVALID_PARAMETER;
   }
 
+  if (StrLen (IsIdStr) == 12) {
+    IsIdStr += 6;
+  }
+
   for (Index = 3; Index < 6; Index++) {
     CopyMem (TempStr, IsIdStr, sizeof (TempStr));
     TempStr[2] = L'\0';
diff --git a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
index 7952258..10583f8 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
+++ b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
@@ -99,3 +99,4 @@
                                         #language x-UEFI-ns "iSCSIDisplayAttemptList"
 #string STR_ISCSI_ATTEMPT_ORDER         #language en-US "New Attempt Order"
                                         #language x-UEFI-ns "iSCSIAttemptOrder"
+#string STR_ISCSI_ISID_HELP             #language en-US "The iSCSI ISID. Default value are derived from MAC address. Only last 3 bytes are configurable."
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 2c93590..e20fe91 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -952,7 +952,7 @@ IScsiCreateKeywords (
       CONFIGURATION_VARSTORE_ID,
       (UINT16) (ATTEMPT_ISID_VAR_OFFSET + sizeof (KEYWORD_STR) * (Index - 1)),
       StringToken,
-      StringToken,
+      STRING_TOKEN (STR_ISCSI_ISID_HELP),
       0,
       0,
       ISID_CONFIGURABLE_MIN_LEN,
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.
Posted by Ye, Ting 7 years, 4 months ago
Hi Siyuan,

I would suggest to add more info to below error message, such as below:

Error! Only last 3 bytes are configurable, please input 6  hex numbers for last 3 bytes only or 12 hex numbers for full SSID!

+      L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex numbers!\n"

Others are good to me.

Reviewed-by: Ye Ting <ting.ye@intel.com> 

Thanks,
Ting

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu Siyuan
Sent: Thursday, August 03, 2017 2:41 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.

The last 3 bytes of ISID should be able to changed by setting the keyword with a value with length 6 (only last 3 bytes) or 12 (full ISID) according to the keyword definition in UEFI configuration namespace website.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c          | 8 ++++++--
 NetworkPkg/IScsiDxe/IScsiConfigStrings.uni | 1 +
 NetworkPkg/IScsiDxe/IScsiMisc.c            | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index a588403..4bc9b8f 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -205,11 +205,11 @@ IScsiParseIsIdFromString (
 
   IsIdStr = (CHAR16 *) String;
 
-  if (StrLen (IsIdStr) != 6) {
+  if (StrLen (IsIdStr) != 6 && StrLen (IsIdStr) != 12) {
     UnicodeSPrint (
       PortString,
       (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
-      L"Error! Input is incorrect, please input 6 hex numbers!\n"
+      L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex numbers!\n"
       );
 
     CreatePopUp (
@@ -222,6 +222,10 @@ IScsiParseIsIdFromString (
     return EFI_INVALID_PARAMETER;
   }
 
+  if (StrLen (IsIdStr) == 12) {
+    IsIdStr += 6;
+  }
+
   for (Index = 3; Index < 6; Index++) {
     CopyMem (TempStr, IsIdStr, sizeof (TempStr));
     TempStr[2] = L'\0';
diff --git a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
index 7952258..10583f8 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
+++ b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
@@ -99,3 +99,4 @@
                                         #language x-UEFI-ns "iSCSIDisplayAttemptList"
 #string STR_ISCSI_ATTEMPT_ORDER         #language en-US "New Attempt Order"
                                         #language x-UEFI-ns "iSCSIAttemptOrder"
+#string STR_ISCSI_ISID_HELP             #language en-US "The iSCSI ISID. Default value are derived from MAC address. Only last 3 bytes are configurable."
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 2c93590..e20fe91 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -952,7 +952,7 @@ IScsiCreateKeywords (
       CONFIGURATION_VARSTORE_ID,
       (UINT16) (ATTEMPT_ISID_VAR_OFFSET + sizeof (KEYWORD_STR) * (Index - 1)),
       StringToken,
-      StringToken,
+      STRING_TOKEN (STR_ISCSI_ISID_HELP),
       0,
       0,
       ISID_CONFIGURABLE_MIN_LEN,
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.
Posted by Fu, Siyuan 7 years, 4 months ago
Ting, 

Thanks, I will update it when commit the patch.

Siyuan

-----Original Message-----
From: Ye, Ting 
Sent: Thursday, August 3, 2017 4:37 PM
To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: RE: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.

Hi Siyuan,

I would suggest to add more info to below error message, such as below:

Error! Only last 3 bytes are configurable, please input 6  hex numbers for last 3 bytes only or 12 hex numbers for full SSID!

+      L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex numbers!\n"

Others are good to me.

Reviewed-by: Ye Ting <ting.ye@intel.com> 

Thanks,
Ting

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu Siyuan
Sent: Thursday, August 03, 2017 2:41 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.

The last 3 bytes of ISID should be able to changed by setting the keyword with a value with length 6 (only last 3 bytes) or 12 (full ISID) according to the keyword definition in UEFI configuration namespace website.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c          | 8 ++++++--
 NetworkPkg/IScsiDxe/IScsiConfigStrings.uni | 1 +
 NetworkPkg/IScsiDxe/IScsiMisc.c            | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index a588403..4bc9b8f 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -205,11 +205,11 @@ IScsiParseIsIdFromString (
 
   IsIdStr = (CHAR16 *) String;
 
-  if (StrLen (IsIdStr) != 6) {
+  if (StrLen (IsIdStr) != 6 && StrLen (IsIdStr) != 12) {
     UnicodeSPrint (
       PortString,
       (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
-      L"Error! Input is incorrect, please input 6 hex numbers!\n"
+      L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex numbers!\n"
       );
 
     CreatePopUp (
@@ -222,6 +222,10 @@ IScsiParseIsIdFromString (
     return EFI_INVALID_PARAMETER;
   }
 
+  if (StrLen (IsIdStr) == 12) {
+    IsIdStr += 6;
+  }
+
   for (Index = 3; Index < 6; Index++) {
     CopyMem (TempStr, IsIdStr, sizeof (TempStr));
     TempStr[2] = L'\0';
diff --git a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
index 7952258..10583f8 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
+++ b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
@@ -99,3 +99,4 @@
                                         #language x-UEFI-ns "iSCSIDisplayAttemptList"
 #string STR_ISCSI_ATTEMPT_ORDER         #language en-US "New Attempt Order"
                                         #language x-UEFI-ns "iSCSIAttemptOrder"
+#string STR_ISCSI_ISID_HELP             #language en-US "The iSCSI ISID. Default value are derived from MAC address. Only last 3 bytes are configurable."
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 2c93590..e20fe91 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -952,7 +952,7 @@ IScsiCreateKeywords (
       CONFIGURATION_VARSTORE_ID,
       (UINT16) (ATTEMPT_ISID_VAR_OFFSET + sizeof (KEYWORD_STR) * (Index - 1)),
       StringToken,
-      StringToken,
+      STRING_TOKEN (STR_ISCSI_ISID_HELP),
       0,
       0,
       ISID_CONFIGURABLE_MIN_LEN,
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel