From patchwork Tue Sep 14 02:06: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: 510906 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1109326jao; Mon, 13 Sep 2021 19:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+44z5baoywVpNjWAzpMzUlrREGgQJ9MVbfaYjziicgLtqUfgTpl6eGflcqS+grHBMMItD X-Received: by 2002:a50:d84c:: with SMTP id v12mr9909469edj.203.1631585220462; Mon, 13 Sep 2021 19:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631585220; cv=none; d=google.com; s=arc-20160816; b=iiy5PD1VPMSpayIls1MPEftzWG8wIMHszd5XqDG8dW+ty2kgNAjlbHXKv1Ppc8KKXW X/PwMftOsipG6LDWOgSeUnpCXAY8WLyc0fZJzL3l4t7HnqQ9n8fKdEnLt2/nwyHOwtVe PfF/Z65XA8UJsoifAIskOG948CFzX5DceXyRc4lHS3YVF1OuvR6JglmKJmTfCbp82KNL yuVd6Gcm+DuQ84Bnxfz5K25g7Z01ktj3TmIrtvDZTuwQjsQRqm/vGnMi4uK/Ktm9thuA oQVuxcW7b5PCIOJN5yhKPlSAPgbc3colDO71uef9BBsV5OFIBrJCTvaOXL8s7x9E/crS BCcA== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=OJbc88TRawxqjytNiL5zIgd7kYCAVXDS8q/cRSpwSHA=; b=whmi6WLFeo6vz8+h4wEpIJwc/GEh7gugTFtoy0PCSArYmPGKywgJTwp05w3akSYDnb HVxNdz9aBSeFQ18G/QnP3qmV4ZMyNntw/BcW6lGsJyn7gTrp2y9lvVu9Lstmuk4l2pb5 6LN0yjbSfXd2UZF8ECBzNIIBWw1O6+B/Hdmvspk3kv2SmJ6qL8h/fItKPKlGdbl/Kb7U KHmHJQPm4j+WjLojrtloqv5iMIDreawMAIBuNivMbQKZUfOf4J0CtgYJPGb5G42O2UN5 AIwPJRLh/cBN5ZO4Yb2qXBrl4M6LooOr7y4EzKmEq4CvHYXGTSQ0e7pz+E8a2LanjbM9 HEtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R2o7RFsL; 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 jr1si9545870ejb.574.2021.09.13.19.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 19:07:00 -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=R2o7RFsL; 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 6B4BE8340F; Tue, 14 Sep 2021 04:06:55 +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="R2o7RFsL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 191938341B; Tue, 14 Sep 2021 04:06:53 +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-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 9CA678340D for ; Tue, 14 Sep 2021 04:06: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-pj1-x1035.google.com with SMTP id mi6-20020a17090b4b4600b00199280a31cbso1122955pjb.0 for ; Mon, 13 Sep 2021 19:06: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:user-agent:mime-version :content-transfer-encoding; bh=OJbc88TRawxqjytNiL5zIgd7kYCAVXDS8q/cRSpwSHA=; b=R2o7RFsLoWGMxh+G3JlYXbWPGJQYVbIeqq7m8KTj/RXtaRY3qPcmLcvOutqW+Pe3Gt kBhrEPWjDhK0q+/bVV7DTbzD80eWGLIbQ5i1yXsC1S9sELCHghM4m5s6vw3c2tCD0q2B bJ+0I1A2W6QBvMsTP0AqhWc1ZOatJwLBDK4ROvQZaDTJAvySabo1qmgZ9Ggk/2iIwBhn wc2zhYhpqQpZdtJJsXc83GNSHQhLvyFaVqLROphoeX+TbPvBo8VskG2BCLKVGAbTLXKs ggzz0XMFc4s1TjyV7vbKQWB8H46MlDecLTMoieeK3Wpr1ltbPjX1dz75oGb21h6Gd47/ TPyA== 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:user-agent :mime-version:content-transfer-encoding; bh=OJbc88TRawxqjytNiL5zIgd7kYCAVXDS8q/cRSpwSHA=; b=zL/g5E0lKhBXsObGjkYTv9nsxuCWmIkLh/32uHmVg+1D9zm0ENEfHOzK+PSGXHjyrx wgRj7RFwj1ihwZ8g6n+NRUwOV+g+8Z+T9uSAMHQUTjjQQcBDNpNzEbO1TehlTHHAoZAC 7MOZ9yTIU3DYigm6aV2ysBHaZBKt3PKhufF0exfEERpV2U0wFavJosD1KwU+IIGwbCqx nSc2crlon1zIPtJtlcmGVsHahQh0rIYxqkkR3kS+O1LaZs1636GVCk3cOMJBDVVrgJ+N JAMP0c85M4wQwSyuwkl6zigGpGjKYI22s1RuQLiP12F8+680efXQ8Yas+SpeTnlmBYEr PtDg== X-Gm-Message-State: AOAM533YqLw9pvxOPstucQJ/2gc0gRZ73aL1g+RalMDBksVInGcxGGqc J8BmoIJPegkDWMkhjO8gPewN7g== X-Received: by 2002:a17:90a:b881:: with SMTP id o1mr2743923pjr.141.1631585207819; Mon, 13 Sep 2021 19:06:47 -0700 (PDT) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id u12sm9376903pgi.21.2021.09.13.19.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 19:06: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] efi_loader: Set EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT again in efi_net_receive() Date: Tue, 14 Sep 2021 11:06:44 +0900 Message-Id: <163158520452.224107.7330406153367961192.stgit@localhost> X-Mailer: git-send-email 2.25.1 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 From: Kazuhiko Sakamoto Since 'this->int_status' is cleared by efi_net_get_status(), if user does wait_for_event(wait_for_packet) and efi_net_get_status() loop and there are several received packets on the buffer, the second efi_net_get_status() does not return EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT even if the 'wait_for_packet' is ready. This happens on "efiboot selftest" with noisy network. (The network device can receive both of other packets and dhcp discover packet in a short time.) Set EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT again when we found any packet still on the receive buffer. Signed-off-by: Kazuhiko Sakamoto Signed-off-by: Masami Hiramatsu --- lib/efi_loader/efi_net.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 69276b275d..9ca1e0c354 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -640,10 +640,19 @@ static efi_status_t EFIAPI efi_net_receive *buffer_size = receive_lengths[rx_packet_idx]; rx_packet_idx = (rx_packet_idx + 1) % ETH_PACKETS_BATCH_RECV; rx_packet_num--; - if (rx_packet_num) + if (rx_packet_num) { + /* + * Since 'this->int_status' is cleared by efi_net_get_status(), + * if user does wait_for_event(wait_for_packet) and + * efi_net_get_status() again, EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT + * is not set even if 'wait_for_packet' is ready. + * Set EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT again here. + */ + this->int_status |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT; wait_for_packet->is_signaled = true; - else + } else { this->int_status &= ~EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT; + } out: return EFI_EXIT(ret); }