Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4631275pxj; Wed, 12 May 2021 09:37:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMe8Ce0569x/KS11dRCcegzc3aNYYfdiXHo6qnaKxQ2DsX8rLTFkWBrCzAbFcG4XW4/8Db X-Received: by 2002:a17:906:8285:: with SMTP id h5mr38073105ejx.456.1620837473748; Wed, 12 May 2021 09:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837473; cv=none; d=google.com; s=arc-20160816; b=HNtRn+IoSXUuRwqxmS7GhbVdkhjoSwzHAs2pBpd68s5K08UjQD15DQW2uurlvEpmeL 6ecCLyh9m2avjwNOpEFtmVaz/9VJbD8T2cJ0ZEnUPp5RGNE3NW/nt08Lo3iUkArNVI7q x0zwK0O9clkqxsh7VkFvnv7Uk3WD2+el7Wu+aHUj5Vsyqv6nsTnMJaRJXKzZXYwV5F2s gt7koYp+JXpL3GlyH4YBRp1gxQ0HeleTs/nduCEuO2ZdJeivzOwlxoYZjPrTPGKrCkgo 8OIurZS9GBuN6PhR13rICl01qhevm+mvkzhoCrdnMPGGnS8OwM+KmM7xrDyavJN2QWES hNqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U26H51uet3utA9HIKO1aPAuHwe4EGbGw1nG0q/0oiGI=; b=HrDtfZkiEM6bf1Qfn7luiBVEvwlNYFThpWHenqZmtUqBv8L7na/27VDazupqu62Uze Xz1MZ9I0J7MLTNTqm5P1n5GdHnzW5yyQysfrt3ZigjmxZKsd1MqOHb77HdixviQrBPEK Of+dCUJWx93AFibxKFW+8fi2MkM8CSLXi10C9vMatKJwoU8P0+cLiJJM+Gs35+VkDmlB 8HwlTm5ica5fWezh0UaTBc7LZlTMTn+p2ttDB7uoiArI+3yL8mBE4kkwhdpMvMStlmfq otJAWhA0XdYPvya+VQpAYG8+8VT/TJuDljZUkMdWv7L1LTk5EbttwD4/wcOh43iqU2+p qFAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VI0SMRSf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si353804ejx.527.2021.05.12.09.37.28; Wed, 12 May 2021 09:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VI0SMRSf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238898AbhELQhE (ORCPT + 99 others); Wed, 12 May 2021 12:37:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:42328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236404AbhELPpc (ORCPT ); Wed, 12 May 2021 11:45:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D6A3161960; Wed, 12 May 2021 15:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832999; bh=qjCLGl56/4hCZXnw235vd6NXQCHpnEWMJvpg5P2bAPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VI0SMRSfR1VD9nCd5jx10srDkqD+CAVf8VJsWpgI3KY/6HIX7qL8fGDkZiTM68rno ftYy3YtFsZmi+DNJN1wJU4ABjuByHE6Bydr9ttb2TpU8bbaewLw4Pkngkf6/e0Dcp/ /UfzwmG5TfyrcvgcqmY6p/gOY5SfXWrmJeTiM4E8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 481/530] net: renesas: ravb: Fix a stuck issue when a lot of frames are received Date: Wed, 12 May 2021 16:49:51 +0200 Message-Id: <20210512144835.568587130@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yoshihiro Shimoda [ Upstream commit 5718458b092bf6bf4482c5df32affba3c3259517 ] When a lot of frames were received in the short term, the driver caused a stuck of receiving until a new frame was received. For example, the following command from other device could cause this issue. $ sudo ping -f -l 1000 -c 1000 The previous code always cleared the interrupt flag of RX but checks the interrupt flags in ravb_poll(). So, ravb_poll() could not call ravb_rx() in the next time until a new RX frame was received if ravb_rx() returned true. To fix the issue, always calls ravb_rx() regardless the interrupt flags condition. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Signed-off-by: Yoshihiro Shimoda Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/renesas/ravb_main.c | 35 ++++++++---------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index bd30505fbc57..f96eed67e1a2 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -911,31 +911,20 @@ static int ravb_poll(struct napi_struct *napi, int budget) int q = napi - priv->napi; int mask = BIT(q); int quota = budget; - u32 ris0, tis; - for (;;) { - tis = ravb_read(ndev, TIS); - ris0 = ravb_read(ndev, RIS0); - if (!((ris0 & mask) || (tis & mask))) - break; + /* Processing RX Descriptor Ring */ + /* Clear RX interrupt */ + ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); + if (ravb_rx(ndev, "a, q)) + goto out; - /* Processing RX Descriptor Ring */ - if (ris0 & mask) { - /* Clear RX interrupt */ - ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); - if (ravb_rx(ndev, "a, q)) - goto out; - } - /* Processing TX Descriptor Ring */ - if (tis & mask) { - spin_lock_irqsave(&priv->lock, flags); - /* Clear TX interrupt */ - ravb_write(ndev, ~(mask | TIS_RESERVED), TIS); - ravb_tx_free(ndev, q, true); - netif_wake_subqueue(ndev, q); - spin_unlock_irqrestore(&priv->lock, flags); - } - } + /* Processing RX Descriptor Ring */ + spin_lock_irqsave(&priv->lock, flags); + /* Clear TX interrupt */ + ravb_write(ndev, ~(mask | TIS_RESERVED), TIS); + ravb_tx_free(ndev, q, true); + netif_wake_subqueue(ndev, q); + spin_unlock_irqrestore(&priv->lock, flags); napi_complete(napi); -- 2.30.2