From patchwork Thu Sep 16 08:53:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 512921 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1012182jao; Thu, 16 Sep 2021 01:59:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqk/g5ue6yrNsq/00XDq7BaB7cIG2eOWDcnAl76iI3DbgG6uRF33F/mGU5gB60RPluLabb X-Received: by 2002:a05:6402:28ad:: with SMTP id eg45mr5345270edb.226.1631782787576; Thu, 16 Sep 2021 01:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631782787; cv=none; d=google.com; s=arc-20160816; b=ruUn8rChN/Aph/23XPMoumZTQfu8dS+2KKkB50INJ4cvSx6I1ONhT1GX4/EtZVqVyq N8FHfVTI1LsgTzNdrpMLOJpVJ7yCvJmjCjiXI7EPH/t0jpt0L5Mq4QbzYIfppdIBICCF rFFrMaP6RyjfqCsXFLlglii3vDS1qLB843zZxVjU50AvdLBPyCTIzmBJdlUsQya7qRGs kDsQTpaza4Y4RfV7zP8CWxjnbkew4GyR41s8MQj2TEoZcLhGJcOS42C6vHZROBT/Yyhw wAFoYp5duylm9VgkpyKRGSUpXarCgWDDjDmRB0B/NsydzKf0Rl82YGy4ps4mZByjGC8B Vvjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=euH7taWnKS6EN6sF95vRGG08aDe82RNM2lP3B2ws+Vc=; b=UQA3+wWsE9TV5z+axy3kwM+T4deG0kdCe5jqk7HC5fMhuS7VmF5XPglQMFogqyZoEg Et1lEopJOFAm4gb7oOx9rYC4cdvabTAxqQzTMMx8kY7K6YV61RG7NAvo1sBr5WzfTqKT iFYvwiKQa5vqPs3UGfbnu3Z/UDpTrc2DsNJH+eQml0b95cO0r6rMxvSNGa0QiLrxqNG6 fHpAZtfk7JLdhTpWaxKbxdgg8dVXW3RkdZKd+b2hvhJkwmKnjRjZONzFUnE9LDlFTNll dV+roEeXebFOOFEyxPMYCMrmiWoODRF6liGjDBZ3zwoMP7IyeXdDiX8b72DnkNmnhTHT Lz3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kMyURmj+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l20si2710606ejn.131.2021.09.16.01.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kMyURmj+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6435483146; Thu, 16 Sep 2021 10:59:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kMyURmj+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E727B83116; Thu, 16 Sep 2021 10:59:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8147E831FE for ; Thu, 16 Sep 2021 10:53:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pf1-x42d.google.com with SMTP id q22so5346308pfu.0 for ; Thu, 16 Sep 2021 01:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=euH7taWnKS6EN6sF95vRGG08aDe82RNM2lP3B2ws+Vc=; b=kMyURmj+umFp8igm+SwvPyiCawq4YqkNeB5zNY615fZ1XT5xRBOqcFdeX7tqeBUId6 uxhw0cCh2NUsrOKzsWEfK7Yn3cJduvlwF0WUa/GOiuBnzuhi0yhaOytqVikPrfCrdcVi iiuC7OmLjQPPaNY2tSX4eTrvfpfCU7CTVoE7VQ96UKcBX1OoTlkeyhPvwJ01oEPUoXec uRuh84FdGOoAQJJWr2owSYPdWLV3/ubM9IOFIRVUbxJhldl1pTKkFfUv20oQrKI0P5id nrEFkwdZUZTDNV/N2aES1Uibeh2i3B4vpoCKTwUUfy9uKQ0Wmgo3mgmK82TiU0TOOOfb ZPYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=euH7taWnKS6EN6sF95vRGG08aDe82RNM2lP3B2ws+Vc=; b=tQKXIVELVOAgifyUf+9GW9Ti7d/8ercz79/9mq+63y49cXsgcJY+3RRfEw4BLI8O4i 50AZlOecMxORvFHcXvZjuQvVXSluLUKMk1cMmr4NsDtNPWGj/LFmZRxss5C2CMwTv8FI DewOH7CYV8BB/bD6FVYxTTvBNsRRMA/Ho2FnFaOKGiy21KzaGxrMKgoaVQRJxKdBZSVU C6i0EAIUpJpK5OA/JW5Ej9E6cjl9G7aweD9GT3hODIsQS3Hg0CtlwfrPdrd1LMrvSq1g CSV0XIhG0fy82lyviyRrVop19aQJwAdQNzEsUYPnPKz0i3dYLXLuYF6xMUUoULMVRUhK +qoA== X-Gm-Message-State: AOAM533RsyqyEIMiuCou6jcdZ0DyqgZv4QJIE+BLp4WhvDaaMCSzJyGM FFN27/pz5UlXE+5KyDMW110Ozg== X-Received: by 2002:a65:6389:: with SMTP id h9mr4000835pgv.83.1631782410719; Thu, 16 Sep 2021 01:53:30 -0700 (PDT) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id g3sm2089047pjm.22.2021.09.16.01.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:53:30 -0700 (PDT) From: Masami Hiramatsu To: Heinrich Schuchardt Cc: Kazuhiko Sakamoto , Masami Hiramatsu , Jassi Brar , Ilias Apalodimas , u-boot@lists.denx.de Subject: [PATCH 1/3] efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check Date: Thu, 16 Sep 2021 17:53:27 +0900 Message-Id: <163178240747.65790.12394686374882007857.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163178239865.65790.17211919979018423637.stgit@localhost> References: <163178239865.65790.17211919979018423637.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean According to the UEF specification v2.9, the main purpose of the EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() is for checking the link status via EFI_SIMPLE_NETWORK_MODE::MediaPresent. So this uses net->get_status() for checking the link status before running network test. Signed-off-by: Masami Hiramatsu --- lib/efi_selftest/efi_selftest_snp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c index 79f0467803..cb0db7eea2 100644 --- a/lib/efi_selftest/efi_selftest_snp.c +++ b/lib/efi_selftest/efi_selftest_snp.c @@ -309,6 +309,18 @@ static int execute(void) return EFI_ST_FAILURE; } + /* Check media connected */ + ret = net->get_status(net, NULL, NULL); + if (ret != EFI_SUCCESS) { + efi_st_error("Failed to get status"); + return EFI_ST_FAILURE; + } + if (net->mode && net->mode->media_present_supported && + !net->mode->media_present) { + efi_st_error("Network media is not connected"); + return EFI_ST_FAILURE; + } + /* * Send DHCP discover message */ From patchwork Thu Sep 16 08:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 512919 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1010041jao; Thu, 16 Sep 2021 01:55:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrGg4ihQfT4SltxQzBXnA7MjZyY/wHIu0y4p+hEh9hMqXqberQkdbCJ902DygiAwq8Yzjo X-Received: by 2002:a17:906:ece4:: with SMTP id qt4mr5170908ejb.250.1631782533640; Thu, 16 Sep 2021 01:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631782533; cv=none; d=google.com; s=arc-20160816; b=BHIbOSvTu39RPfqRh3feCNY6h7l2APldibbwGWqMonlLm2GmqFl8fwkVLLKDeMVUP4 Tp0UGKzxoLDT7WptZjfNFhTRDpLrIi5PS9mQlxLaNy8zuPK+pag0S2rHFDXng4xjsCwf uM5VZsZB2fKde5Mc6ostU4RUKVTTyqaZZj1g6UajAshskJG3B60Q7nbOOdsozlekVFHK qt792uhXbY3Mm7/gstrrMxQfr+9pV+KxPwzIfYAx9kle8NVtZUHCSlIyeGXjRmf8f0ro 1gs1sIejWEo+OYNk8jBhAVtsvAvB/vOZ2/AFEFwGjTIKhkXEHi5rfZ54fi+PV7oS/KrZ p6yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=z/P28taXTWuoZNLOu5MoRtO3G6G9hQYJRdgwPsybijU=; b=VIYu7rGjfion6lsSR2WSe2CX35o36flPcJ2Gh2aH4/kr1BnG7A4jwSCisWrnIZjtmN ss1lU6P16fdx2l4o1KfVqvHmYdjje/dRkrFobBEMWOP2FR9wlmHefDwuPo8UvJig4cUP tFcleJqlj39sFokWL2HXrzCBfegIJMPBQmtg8ZmytnhcUvy/f6D4KMqoBhM46ifkw5Er o0/Dmd2Tnk3V66q9WIodZOFP2hU1tFvyNSJDuJB00/7FxtbuYFt2Wc7PRQRNusE7TTeE QRAVkTiDyQuxCXS4MmeW+oZViKyc/cmNE5Ktz41xdViRWHmSJp69xqWJjEkPwkqOeCo5 rbuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yTo4MvaO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id hx14si2829418ejc.326.2021.09.16.01.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:55:33 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yTo4MvaO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7FCCA8319C; Thu, 16 Sep 2021 10:54:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yTo4MvaO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07C0783124; Thu, 16 Sep 2021 10:54:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F20C8831D5 for ; Thu, 16 Sep 2021 10:53:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pf1-x42a.google.com with SMTP id y8so5225318pfa.7 for ; Thu, 16 Sep 2021 01:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=z/P28taXTWuoZNLOu5MoRtO3G6G9hQYJRdgwPsybijU=; b=yTo4MvaOlCtqn/ZpfIqUzbUYebyuX7M/wMD3xDG8Ur/dAZiY0ksj3Yp1HVsN7WdiGa V8zuH9qZKKNSokIipM1Qt+7gdP4nDTOzlINRKG7JdaDdCciFYgw1HBJA6QxKwBpUXUB9 cFurZMqxODysuLQN6rCaDwuUHP68s3S6qwnOHlZgOmH3jbCEwXaSlWy6iRT/Y0xO/vXH p+HIjM3BVVBHXDmHgdTgjj6QnJRC9uYXSlpH+Vtbq+8AKqy+5mRH79jCk5Yr+EiOWENS gkRv+WSnfDTaxz9Wj2yd1QJDLpZU60oXwQKe0iZwGgrXW8JEanCmBNBZE4EEk8qIZb+v uVMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=z/P28taXTWuoZNLOu5MoRtO3G6G9hQYJRdgwPsybijU=; b=Vg6M/ZN+L53OdB3MIckDwdubp6lTOonduG0oGKhLqcbbRhZrxLoN2xWwvcloc1SE7s SnkR0nvAeQMKY7R2FNWKT5ujHzjc5Wt4RxIO9lwTUXJ5j1zexVFsG5TVywz/7sZ5DitX +utO6RO2lKpsJfFjhMjuS+fw504e+TFbgjcISnc+nTwMC9SyK9RgNQ1XLpxQ5Qbe6N4o Z6Tmfk7kWRtwzNckXtJ4oIkIMh3McGpxsumR4i6FlBp+1vg/OK5VF5ev889tPDGz8LoR T+39wRyrDbbOnJ5ft+JRyD3LMUCFUgULFVEsk20FWUzfG/nCnuHdY1xyWeVhqBpllQsk KPUg== X-Gm-Message-State: AOAM5317imQU2TrhsT+qBHmLoXd4rAs4Je5EFDZSon80cZWmtzZYIGk+ fxyH5im8I70Ycck0Yr38z6XwLQ== X-Received: by 2002:a62:5406:0:b0:441:c46a:ccb9 with SMTP id i6-20020a625406000000b00441c46accb9mr1672137pfb.52.1631782419199; Thu, 16 Sep 2021 01:53:39 -0700 (PDT) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id b13sm7122786pjk.35.2021.09.16.01.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:53:38 -0700 (PDT) From: Masami Hiramatsu To: Heinrich Schuchardt Cc: Kazuhiko Sakamoto , Masami Hiramatsu , Jassi Brar , Ilias Apalodimas , u-boot@lists.denx.de Subject: [PATCH 2/3] efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT Date: Thu, 16 Sep 2021 17:53:36 +0900 Message-Id: <163178241612.65790.3191991741031171590.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163178239865.65790.17211919979018423637.stgit@localhost> References: <163178239865.65790.17211919979018423637.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT in packet receiving loop. This depends on the implementation and not related to whether the packet can be received or not. Whether the received packets are available or not is ensured by wait_for_packet, and that is already done in the loop. Signed-off-by: Masami Hiramatsu --- lib/efi_selftest/efi_selftest_snp.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c index cb0db7eea2..c5366c872c 100644 --- a/lib/efi_selftest/efi_selftest_snp.c +++ b/lib/efi_selftest/efi_selftest_snp.c @@ -340,8 +340,6 @@ static int execute(void) events[0] = timer; events[1] = net->wait_for_packet; for (;;) { - u32 int_status; - /* * Wait for packet to be received or timer event. */ @@ -367,15 +365,6 @@ static int execute(void) * Receive packet */ buffer_size = sizeof(buffer); - ret = net->get_status(net, &int_status, NULL); - if (ret != EFI_SUCCESS) { - efi_st_error("Failed to get status"); - return EFI_ST_FAILURE; - } - if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) { - efi_st_error("RX interrupt not set"); - return EFI_ST_FAILURE; - } ret = net->receive(net, NULL, &buffer_size, &buffer, &srcaddr, &destaddr, NULL); if (ret != EFI_SUCCESS) { From patchwork Thu Sep 16 08:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 512918 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1009968jao; Thu, 16 Sep 2021 01:55:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3m6ORaW3+qMbcGRMZgwDFT0V0RpeoeQT92TYSkiOdKnvYmGh1NQhd5JG44tfmIMFYHrSt X-Received: by 2002:a05:6402:4cb:: with SMTP id n11mr5102983edw.292.1631782522722; Thu, 16 Sep 2021 01:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631782522; cv=none; d=google.com; s=arc-20160816; b=YM5dRdjfPUadzaPzlrvSOr2z7pPxS7K/V/zzt52XRcbRHSWmT4v65OWhBpNI14Pvhc HI6VI2LTHOOFnxh6u0etBhrx3lOgcuKwhT9vK7x1ahg9PStNT/pgvo4eYm5CDat/3ll+ lU70jcdtsXyiO2qrsACKApPOvS3bhh4SXYkKAzUoHzbI2XY7vIJ8KqvPPu+JKNGRVxho 0Lt8S0I3zYx0uoFPcEPzvC2ttCa++LuZvjKLWydHe/in9WckLLBg/QSFU8+3r4XEKlYC gjs/GdXQjDL9iUyZgHwLeL9hX2BjwrKAYayGsHG4/Z/uFcBtCnQNtb+6Px/W1dxCHE7j x+ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=1so1I0L4lqnwZllaOfYrjC9h6O8GDDBGq3FKcLGCwLs=; b=Irz+6D1qD2pPqn637Xlwnft6OwBoJn6y5KAIaSFx1zmg0CqJ2IAc4kVY7tBXu0hi0G P0riMRskfjQmbQJYaKSE/ImLv/4LXXgOZi2bmUehR2GURUF0f9CT9h9eZ8DySRzBydkF pDZfiLuozTIllgY4wcdYecAZnRjR3fkkX4vy5oui7OEAcnSVazOiysKmZ2yAPz2ONuJW 29Xz4jgAQTPfYxxUyvTxyY9sEFocoDw+yLqOL0Tn1bCUX6Y0/pD6Oyuy9IbirpGjePaJ 2c/rFZ1mewvV0ugqA8cvCvpoi8joKGgnR8fB0JNEjRqM7I8le6k8NJoRoakHxsCVT6x0 EgMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fWuEt+tg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id dp9si2593122ejc.163.2021.09.16.01.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fWuEt+tg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 715F383208; Thu, 16 Sep 2021 10:54:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="fWuEt+tg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E3BA82F4D; Thu, 16 Sep 2021 10:54:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3F32D82E03 for ; Thu, 16 Sep 2021 10:53:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pg1-x534.google.com with SMTP id g184so5502072pgc.6 for ; Thu, 16 Sep 2021 01:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=1so1I0L4lqnwZllaOfYrjC9h6O8GDDBGq3FKcLGCwLs=; b=fWuEt+tgsju4nx2FfPojyrvhojthwuHpkYmZhpd384COyi0xdiGcDhOWoo7rkkdAKo F3o/5ZSKEbc9X/pp7wGsSm6pqbBXDfCX99+dT6+Gijp7nJ4xx2DCrRODl7xN9QFxfziQ jrmv5lCkOl+X4c58SJ+G9e9V2mS3ZwwVfFeen7VQiKkOFm/XSPIPfj09GpOGfwKqdU6N mb0r3o0k1J+5R8MFt8lAyO58Sggg7mpndu3ZP7o8egdzBSL+EMwUuOCgNiqK9UF2HYkh otUI6wOXLaPWOjEXFO0cQYxxE2TGbtnbECpza6SEaGeKCHBen9SBi+YRTtl34hOrjQw+ zzSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=1so1I0L4lqnwZllaOfYrjC9h6O8GDDBGq3FKcLGCwLs=; b=mX/Qf0tcuMr1K298jAcNitJSSSXuDdZIy40mzEQxKk34yTpoNcK8ee7RZAcdT9Ggwc ydKwD7DcGTLIJPYfc6lORI6XQkv/+aFzUD4CpMB79TwJgAV1hvA+FgGvCu9ZMVgTb5cE rwkByc3PFkZYNxBv3GTVnfmVcpg5YrXqWCtqzRfbnZXge/lU+E1JI3d++L+Cwd9Jf9Bv X2u8WnTd/ue+IQZSYy7QA6sXmJlHOXeuFefs3tns95exawSvcbsZ+L6fuBiaVj558ZbM TLDwQggN4Fi8s6MCBoqSA5KCBMJ/w7r2oXZRsYG8zhhJxTH8TZ44WpLTkbIAQ1bkQ2I3 rK0Q== X-Gm-Message-State: AOAM533eFjsv1DNBKdn5aPW4XWPLOru7JAu8WHFpZV60pY3JmrHm4b7x n9JkUhowhUGSQxHrYO8aFOpRFw== X-Received: by 2002:a62:64d3:0:b0:43d:ba3:1e2c with SMTP id y202-20020a6264d3000000b0043d0ba31e2cmr3969677pfb.5.1631782427600; Thu, 16 Sep 2021 01:53:47 -0700 (PDT) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id d63sm7169317pjk.17.2021.09.16.01.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:53:47 -0700 (PDT) From: Masami Hiramatsu To: Heinrich Schuchardt Cc: Kazuhiko Sakamoto , Masami Hiramatsu , Jassi Brar , Ilias Apalodimas , u-boot@lists.denx.de Subject: [PATCH 3/3] efi_selftest: Recieve the packets until the receive buffer is empty Date: Thu, 16 Sep 2021 17:53:44 +0900 Message-Id: <163178242457.65790.16820317670072849950.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163178239865.65790.17211919979018423637.stgit@localhost> References: <163178239865.65790.17211919979018423637.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Repeatedly receive the packets until the receive buffer is empty. If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive() returns EFI_NOT_READY. We don't need to use the wait_for_event() every time. Signed-off-by: Masami Hiramatsu --- lib/efi_selftest/efi_selftest_snp.c | 67 +++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c index c5366c872c..818cbfcacd 100644 --- a/lib/efi_selftest/efi_selftest_snp.c +++ b/lib/efi_selftest/efi_selftest_snp.c @@ -362,39 +362,46 @@ static int execute(void) continue; } /* - * Receive packet + * Receive packets until buffer is empty */ - buffer_size = sizeof(buffer); - ret = net->receive(net, NULL, &buffer_size, &buffer, - &srcaddr, &destaddr, NULL); - if (ret != EFI_SUCCESS) { - efi_st_error("Failed to receive packet"); - return EFI_ST_FAILURE; + for (;;) { + buffer_size = sizeof(buffer); + ret = net->receive(net, NULL, &buffer_size, &buffer, + &srcaddr, &destaddr, NULL); + if (ret == EFI_NOT_READY) { + /* The received buffer is empty. */ + break; + } + + if (ret != EFI_SUCCESS) { + efi_st_error("Failed to receive packet"); + return EFI_ST_FAILURE; + } + /* + * Check the packet is meant for this system. + * Unfortunately QEMU ignores the broadcast flag. + * So we have to check for broadcasts too. + */ + if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) && + memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN)) + continue; + /* + * Check this is a DHCP reply + */ + if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) || + buffer.p.ip_udp.ip_hl_v != 0x45 || + buffer.p.ip_udp.ip_p != IPPROTO_UDP || + buffer.p.ip_udp.udp_src != ntohs(67) || + buffer.p.ip_udp.udp_dst != ntohs(68) || + buffer.p.dhcp_hdr.op != BOOTREPLY) + continue; + /* + * We successfully received a DHCP reply. + */ + goto received; } - /* - * Check the packet is meant for this system. - * Unfortunately QEMU ignores the broadcast flag. - * So we have to check for broadcasts too. - */ - if (memcmp(&destaddr, &net->mode->current_address, ARP_HLEN) && - memcmp(&destaddr, BROADCAST_MAC, ARP_HLEN)) - continue; - /* - * Check this is a DHCP reply - */ - if (buffer.p.eth_hdr.et_protlen != ntohs(PROT_IP) || - buffer.p.ip_udp.ip_hl_v != 0x45 || - buffer.p.ip_udp.ip_p != IPPROTO_UDP || - buffer.p.ip_udp.udp_src != ntohs(67) || - buffer.p.ip_udp.udp_dst != ntohs(68) || - buffer.p.dhcp_hdr.op != BOOTREPLY) - continue; - /* - * We successfully received a DHCP reply. - */ - break; } - +received: /* * Write a log message. */