From nobody Sat Feb 7 07:11:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512457176649792.5940331614977; Mon, 4 Dec 2017 22:59:36 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2A9452035626A; Mon, 4 Dec 2017 22:55:05 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 CD02B20356253 for ; Mon, 4 Dec 2017 22:55:03 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2017 22:59:34 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.96]) by orsmga008.jf.intel.com with ESMTP; 04 Dec 2017 22:59:32 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,363,1508828400"; d="scan'208";a="157586" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Tue, 5 Dec 2017 14:59:20 +0800 Message-Id: <1512457162-9296-3-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1512457162-9296-1-git-send-email-jiaxin.wu@intel.com> References: <1512457162-9296-1-git-send-email-jiaxin.wu@intel.com> Subject: [edk2] [Patch 2/4] NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec. 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: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" According to UEFI spec: "Retry number if no response received after RetryInterval. If zero, use the parameter configured through Dns.Configure() interface." "Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. If zero, use the parameter configured through Dns.Configure() interface." For both DNS.HostNameToIp and DNS.GeneralLookUp, the value of RetryCount / RetryInterval need to be updated to comply with UEFI spec. Cc: Ye Ting Cc: Fu Siyuan Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/DnsDxe/DnsDriver.h | 4 +- NetworkPkg/DnsDxe/DnsImpl.c | 4 +- NetworkPkg/DnsDxe/DnsImpl.h | 5 +- NetworkPkg/DnsDxe/DnsProtocol.c | 102 ++++++++++++++++++++++++------------= ---- 4 files changed, 67 insertions(+), 48 deletions(-) diff --git a/NetworkPkg/DnsDxe/DnsDriver.h b/NetworkPkg/DnsDxe/DnsDriver.h index 6632bb2..49f6a1d 100644 --- a/NetworkPkg/DnsDxe/DnsDriver.h +++ b/NetworkPkg/DnsDxe/DnsDriver.h @@ -1,9 +1,9 @@ /** @file The header files of the driver binding and service binding protocol for Dn= sDxe driver. =20 -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at http://opensource.org/licenses/bsd-license.php =20 @@ -87,12 +87,10 @@ struct _DNS_INSTANCE { EFI_IP_ADDRESS SessionDnsServer; =20 NET_MAP Dns4TxTokens; NET_MAP Dns6TxTokens; =20 - UINT32 MaxRetry; - UDP_IO *UdpIo; }; =20 typedef struct { EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index ea3d27d..7c236a0 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1946,11 +1946,11 @@ DnsOnTimerRetransmit ( =20 // // Retransmit the packet if haven't reach the maxmium retry count, // otherwise exit the transfer. // - if (++Dns4TokenEntry->Token->RetryCount < Instance->MaxRetry) { + if (++Dns4TokenEntry->RetryCounting <=3D Dns4TokenEntry->Token->Re= tryCount) { DnsRetransmit (Instance, (NET_BUF *)ItemNetMap->Value); EntryNetMap =3D EntryNetMap->ForwardLink; } else { // // Maximum retries reached, clean the Token up. @@ -1990,11 +1990,11 @@ DnsOnTimerRetransmit ( =20 // // Retransmit the packet if haven't reach the maxmium retry count, // otherwise exit the transfer. // - if (++Dns6TokenEntry->Token->RetryCount < Instance->MaxRetry) { + if (++Dns6TokenEntry->RetryCounting <=3D Dns6TokenEntry->Token->Re= tryCount) { DnsRetransmit (Instance, (NET_BUF *) ItemNetMap->Value); EntryNetMap =3D EntryNetMap->ForwardLink; } else { // // Maximum retries reached, clean the Token up. diff --git a/NetworkPkg/DnsDxe/DnsImpl.h b/NetworkPkg/DnsDxe/DnsImpl.h index 5fa7f24..3c6296c 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.h +++ b/NetworkPkg/DnsDxe/DnsImpl.h @@ -1,9 +1,9 @@ /** @file DnsDxe support functions implementation. =20 -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at http://opensource.org/licenses/bsd-license.php =20 @@ -84,11 +84,10 @@ extern EFI_DNS6_PROTOCOL mDns6Protocol; #define DNS_STATE_UNCONFIGED 0 #define DNS_STATE_CONFIGED 1 #define DNS_STATE_DESTROY 2 =20 #define DNS_DEFAULT_TIMEOUT 2 -#define DNS_DEFAULT_RETRY 3 =20 #define DNS_TIME_TO_GETMAP 5 =20 #pragma pack(1) =20 @@ -113,18 +112,20 @@ typedef struct { LIST_ENTRY AllServerLink; EFI_IPv6_ADDRESS Dns6ServerIp; =20 } DNS6_SERVER_IP; =20 typedef struct { + UINT32 RetryCounting; UINT32 PacketToLive; CHAR16 *QueryHostName; EFI_IPv4_ADDRESS QueryIpAddress; BOOLEAN GeneralLookUp; EFI_DNS4_COMPLETION_TOKEN *Token; } DNS4_TOKEN_ENTRY; =20 typedef struct { + UINT32 RetryCounting; UINT32 PacketToLive; CHAR16 *QueryHostName; EFI_IPv6_ADDRESS QueryIpAddress; BOOLEAN GeneralLookUp; EFI_DNS6_COMPLETION_TOKEN *Token; diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtoco= l.c index 7435607..df737dc 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -221,12 +221,10 @@ Dns4Configure ( // if (!NetMapIsEmpty(&Instance->Dns4TxTokens)) { Dns4InstanceCancelToken(Instance, NULL); } =20 - Instance->MaxRetry =3D 0; - if (Instance->UdpIo !=3D NULL){ UdpIoCleanIo (Instance->UdpIo); } =20 if (Instance->Dns4CfgData.DnsServerList !=3D NULL) { @@ -375,28 +373,34 @@ Dns4HostNameToIp ( =20 Instance =3D DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This); =20 ConfigData =3D &(Instance->Dns4CfgData); =20 - Instance->MaxRetry =3D ConfigData->RetryCount; - =20 - Token->Status =3D EFI_NOT_READY; - Token->RetryCount =3D 0; - Token->RetryInterval =3D ConfigData->RetryInterval; - if (Instance->State !=3D DNS_STATE_CONFIGED) { Status =3D EFI_NOT_STARTED; goto ON_EXIT; } =20 + Token->Status =3D EFI_NOT_READY; + // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interfa= ce. // - if (Instance->MaxRetry =3D=3D 0) { - Instance->MaxRetry =3D DNS_DEFAULT_RETRY; + if (Token->RetryCount =3D=3D 0) { + Token->RetryCount =3D ConfigData->RetryCount; } =20 + // + // If zero, use the parameter configured through Dns.Configure() interfa= ce. + // + if (Token->RetryInterval =3D=3D 0) { + Token->RetryInterval =3D ConfigData->RetryInterval; + } + =20 + // + // Minimum interval of retry is 2 second. If the retry interval is less = than 2 second, then use the 2 second.=20 + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval =3D DNS_DEFAULT_TIMEOUT; } =20 // @@ -618,29 +622,35 @@ Dns4GeneralLookUp ( OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); =20 Instance =3D DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This); =20 ConfigData =3D &(Instance->Dns4CfgData); - =20 - Instance->MaxRetry =3D ConfigData->RetryCount; - =20 - Token->Status =3D EFI_NOT_READY; - Token->RetryCount =3D 0; - Token->RetryInterval =3D ConfigData->RetryInterval; =20 if (Instance->State !=3D DNS_STATE_CONFIGED) { Status =3D EFI_NOT_STARTED; goto ON_EXIT; } =20 + Token->Status =3D EFI_NOT_READY; + =20 + // + // If zero, use the parameter configured through Dns.Configure() interfa= ce. // - // Check the MaxRetry and RetryInterval values. + if (Token->RetryCount =3D=3D 0) { + Token->RetryCount =3D ConfigData->RetryCount; + } + =20 + // + // If zero, use the parameter configured through Dns.Configure() interfa= ce. // - if (Instance->MaxRetry =3D=3D 0) { - Instance->MaxRetry =3D DNS_DEFAULT_RETRY; + if (Token->RetryInterval =3D=3D 0) { + Token->RetryInterval =3D ConfigData->RetryInterval; } =20 + // + // Minimum interval of retry is 2 second. If the retry interval is less = than 2 second, then use the 2 second.=20 + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval =3D DNS_DEFAULT_TIMEOUT; } =20 // @@ -1050,12 +1060,10 @@ Dns6Configure ( // if (!NetMapIsEmpty(&Instance->Dns6TxTokens)) { Dns6InstanceCancelToken(Instance, NULL); } =20 - Instance->MaxRetry =3D 0; - if (Instance->UdpIo !=3D NULL){ UdpIoCleanIo (Instance->UdpIo); } =20 if (Instance->Dns6CfgData.DnsServerList !=3D NULL) { @@ -1201,32 +1209,38 @@ Dns6HostNameToIp ( OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); =20 Instance =3D DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This); =20 ConfigData =3D &(Instance->Dns6CfgData); - =20 - Instance->MaxRetry =3D ConfigData->RetryCount; - - Token->Status =3D EFI_NOT_READY; - Token->RetryCount =3D 0; - Token->RetryInterval =3D ConfigData->RetryInterval; =20 if (Instance->State !=3D DNS_STATE_CONFIGED) { Status =3D EFI_NOT_STARTED; goto ON_EXIT; } =20 + Token->Status =3D EFI_NOT_READY; + // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interfa= ce. // - if (Instance->MaxRetry =3D=3D 0) { - Instance->MaxRetry =3D DNS_DEFAULT_RETRY; + if (Token->RetryCount =3D=3D 0) { + Token->RetryCount =3D ConfigData->RetryCount; } =20 + // + // If zero, use the parameter configured through Dns.Configure() interfa= ce. + // + if (Token->RetryInterval =3D=3D 0) { + Token->RetryInterval =3D ConfigData->RetryInterval; + } + =20 + // + // Minimum interval of retry is 2 second. If the retry interval is less = than 2 second, then use the 2 second.=20 + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval =3D DNS_DEFAULT_TIMEOUT; - }=20 + } =20 // // Check cache // if (ConfigData->EnableDnsCache) { @@ -1449,29 +1463,35 @@ Dns6GeneralLookUp ( OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); =20 Instance =3D DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This); =20 ConfigData =3D &(Instance->Dns6CfgData); - =20 - Instance->MaxRetry =3D ConfigData->RetryCount; - =20 - Token->Status =3D EFI_NOT_READY; - Token->RetryCount =3D 0; - Token->RetryInterval =3D ConfigData->RetryInterval; =20 if (Instance->State !=3D DNS_STATE_CONFIGED) { Status =3D EFI_NOT_STARTED; goto ON_EXIT; } =20 + Token->Status =3D EFI_NOT_READY; + =20 // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interfa= ce. // - if (Instance->MaxRetry =3D=3D 0) { - Instance->MaxRetry =3D DNS_DEFAULT_RETRY; + if (Token->RetryCount =3D=3D 0) { + Token->RetryCount =3D ConfigData->RetryCount; + } + =20 + // + // If zero, use the parameter configured through Dns.Configure() interfa= ce. + // + if (Token->RetryInterval =3D=3D 0) { + Token->RetryInterval =3D ConfigData->RetryInterval; } =20 + // + // Minimum interval of retry is 2 second. If the retry interval is less = than 2 second, then use the 2 second.=20 + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval =3D DNS_DEFAULT_TIMEOUT; } =20 // --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel