From patchwork Wed Oct 9 01:53:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Siyuan" X-Patchwork-Id: 20906 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1DF8824697 for ; Wed, 9 Oct 2013 01:53:20 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x20sf301997qcv.7 for ; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-language:content-type :content-transfer-encoding; bh=qX59Q05Bw9h8V+ui6L01qQp0ugbudxXdn0rFvTEbCo8=; b=i9rxgIyDWMGdzSpz38kUz+09NkQw2v2mJVttg8dX30krvQChE2qqKz7g0VMYMijFON TnB4MfohYSnAs5Mrl8cPVwIGiFOSXL9FI7fCkD31ulwy8mhP9AZM3zbdb1g6sBShLB7K gcH4RLo8xr705WPyuOjNs0mVTnzwf+m2sT5gTkEnpEFDBNgoK3hYIlWykXFPs4b2gvvH ZR+quOnQ+D6fPNKjApKX1fIYr+P/NbOg/Qf9OoNl3Jp/iQ4EGJLHh4jtVj37euTWiwVx GWA8FKANvh2rIR+ppaTefhz+3wT/Ek1Kb9IeokU4CzjqGOpFSfJXPjx0pT+R1qJH9e8/ y+1Q== X-Received: by 10.236.167.138 with SMTP id i10mr5447300yhl.9.1381283600480; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.170 with SMTP id z10ls459946qej.32.gmail; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) X-Received: by 10.221.27.73 with SMTP id rp9mr88601vcb.29.1381283600278; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ee8si10741540vdc.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 18:53:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so88347vcb.9 for ; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) X-Gm-Message-State: ALoCoQk1qGMgX9pddG8fT/KnvYW2Dq8lXXUqKCezE0+hOcq4O4PurjH50oy8wf0PrmXssxCgHCe3 X-Received: by 10.221.51.206 with SMTP id vj14mr3479823vcb.17.1381283600112; Tue, 08 Oct 2013 18:53:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp249393vcz; Tue, 8 Oct 2013 18:53:19 -0700 (PDT) X-Received: by 10.66.228.38 with SMTP id sf6mr6772707pac.21.1381283598603; Tue, 08 Oct 2013 18:53:18 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTP id 5si11201071pbf.61.1969.12.31.16.00.00; Tue, 08 Oct 2013 18:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of siyuan.fu@intel.com designates 192.55.52.93 as permitted sender) client-ip=192.55.52.93; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 08 Oct 2013 18:53:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,1059,1371106800"; d="scan'208";a="414030947" Received: from fmsmsx108.amr.corp.intel.com ([10.19.9.228]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2013 18:53:17 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX108.amr.corp.intel.com (10.19.9.228) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 8 Oct 2013 18:53:16 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 8 Oct 2013 18:53:16 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.12]) with mapi id 14.03.0123.003; Wed, 9 Oct 2013 09:53:15 +0800 From: "Fu, Siyuan" To: "Reece R. Pollack" CC: "patches@linaro.org" , "edk2-devel@lists.sourceforge.net" Subject: RE: [edk2] [PATCH 02/10] MdeModulePkg//ArpDxe: Retrieved SnpMode only after configuring Snp Thread-Topic: [edk2] [PATCH 02/10] MdeModulePkg//ArpDxe: Retrieved SnpMode only after configuring Snp Thread-Index: AQHOw5etCKITpRPPp0yOIO+9OusXPZnrmeIw Date: Wed, 9 Oct 2013 01:53:14 +0000 Message-ID: References: <1381174801-17221-1-git-send-email-reece.pollack@linaro.org> <1381174801-17221-3-git-send-email-reece.pollack@linaro.org> In-Reply-To: <1381174801-17221-3-git-send-email-reece.pollack@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: siyuan.fu@intel.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Language: en-US Hi, Pollack I don't agree with the opinion that the Snp.Mode can't be accessed before Snp->Initialize() is called. According to UEFI spec, all the fields in Snp.Mode structure must be discovered during driver initialization, per my understanding the words "driver initialization" mean the driver binding start function, not Snp->Initialize() interface. And in EDKII implementation, all these parameters in Snp.Mode are prepared by calling PXE_OPCODE_GET_INIT_INFO in SimpleNetworkDriverStart() function before SNP protocol is installed into the protocol database, so they are valid to use once SNP protocol is produced. Fu, Siyuan Best regards -----Original Message----- From: Reece R. Pollack [mailto:reece.pollack@linaro.org] Sent: Tuesday, October 08, 2013 3:40 AM To: edk2-devel@lists.sourceforge.net Cc: patches@linaro.org Subject: [edk2] [PATCH 02/10] MdeModulePkg//ArpDxe: Retrieved SnpMode only after configuring Snp From: Olivier Martin When Arp driver starts (with ArpDriverBindingStart()), its service will be created and the Mnp child configured (ArpService->Mnp->Configure() called in ArpCreateService()). It is only at this time the Snp protocol will be initialized (at the end of MnpStart()). So, a valid SnpMode could not be expected prior to ArpService->Mnp->Configure(). Signed-off-by: Olivier Martin --- MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c | 33 +++++++++++---------- 1 file changed, 17 insertions(+), 16 deletions(-) mode change 100644 => 100755 MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c } // + // Get the underlayer Snp mode data. Must do this after MNP + configuration else some parameters // (e.g. current address) may not + be set // Status = ArpService->Mnp->GetModeData (ArpService->Mnp, + NULL, &ArpService->SnpMode); if ((Status != EFI_NOT_STARTED) && + EFI_ERROR (Status)) { + goto ERROR_EXIT; + } + + if (ArpService->SnpMode.IfType != NET_IFTYPE_ETHERNET) { + // + // Only support the ethernet. + // + Status = EFI_UNSUPPORTED; + goto ERROR_EXIT; + } + + // // Create the event used in the RxToken. // Status = gBS->CreateEvent ( -- 1.7.10.4 ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c old mode 100644 new mode 100755 index 81ddd62..5cf717f --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c @@ -103,22 +103,6 @@ ArpCreateService ( } // - // Get the underlayer Snp mode data. - // - Status = ArpService->Mnp->GetModeData (ArpService->Mnp, NULL, &ArpService->SnpMode); - if ((Status != EFI_NOT_STARTED) && EFI_ERROR (Status)) { - goto ERROR_EXIT; - } - - if (ArpService->SnpMode.IfType != NET_IFTYPE_ETHERNET) { - // - // Only support the ethernet. - // - Status = EFI_UNSUPPORTED; - goto ERROR_EXIT; - } - - // // Set the Mnp config parameters. // ArpService->MnpConfigData.ReceivedQueueTimeoutValue = 0; @@ -141,6 +125,23 @@ ArpCreateService (