From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5474C209589C8 for ; Wed, 2 Aug 2017 23:38:30 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2017 23:40:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,314,1498546800"; d="scan'208";a="132907518" Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.2]) by orsmga005.jf.intel.com with ESMTP; 02 Aug 2017 23:40:40 -0700 From: Fu Siyuan To: edk2-devel@lists.01.org Cc: Ye Ting , Wu Jiaxin Date: Thu, 3 Aug 2017 14:40:37 +0800 Message-Id: <20170803064037.13216-1-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 Subject: [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 06:38:30 -0000 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 Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- 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