From patchwork Mon Mar 13 22:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13173420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CE4BC61DA4 for ; Mon, 13 Mar 2023 22:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xoz99WKX3pMcCpU81b1QdGI9FJEbAAO9nQo11uOGBDs=; b=4cFOIqxrwtnY89 N4l+L9UIiqMv6nSCJcHqVJezdj4vEW9IqzJerlaP9U1CDaixd8Ny2SXlESLXcVFB3dTkPPmZa288V YEJNdOmk47KDc3/LZcFE6B6gO/gLjQ/DLJL0O+n6wBEx+wA/IAn3zlPXf5siAZd8C5cBXg4qBAQmH Nj8FHmgL7G3JfYjsXBk8fka4uNOED/rZxXVmiqANohXx0wc2Ma7a40qtXTWNF0GvYdwk5F05kBF9Q Ud/i1cZxNPzMeKbSVDKVSdsl3x6uLZJXBESkDOLmPBBcqlD4g80APcgqzr2mIHbQ2PS0pjMValQ3O 5jTYTVl2QYQryLZfhKyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbqts-0086xg-W0; Mon, 13 Mar 2023 22:44:17 +0000 Received: from post.baikalelectronics.com ([213.79.110.86]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbqsb-0086Fp-6A for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 22:42:58 +0000 Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 0F365E0EBA; Tue, 14 Mar 2023 01:42:52 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=Dpl6MaxqP5WEy7Vh+oFSb0logDrpNZX6Oxq0pbGHndo=; b=j/VKpA/0OYyW ITllD/sgEyyJK3bhHohE8LZrDLjdh6jn/vhc+xSN595HWpgUaWghtGMd9G+PrEGW oX9Gk4Cj1zY8o2KfuD6Vlmv1c7wCr6IHdyw2gUEv4mfXQw4jOHnAm5YuuGqF8F7w CEJflcO/In1kXsWIDFU+Pwrd6MWqu+E= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id F351DE0E6A; Tue, 14 Mar 2023 01:42:51 +0300 (MSK) Received: from localhost (10.8.30.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 14 Mar 2023 01:42:51 +0300 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , Andrew Lunn , Heiner Kallweit CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Christian Marangi , Biao Huang , Yang Yingliang , , , , , Jose Abreu Subject: [PATCH net 08/13] net: stmmac: Fix Rx IC bit setting procedure for Rx-mitigation Date: Tue, 14 Mar 2023 01:42:32 +0300 Message-ID: <20230313224237.28757-9-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313224237.28757-1-Sergey.Semin@baikalelectronics.ru> References: <20230313224237.28757-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-Originating-IP: [10.8.30.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_154257_429981_3D6DA279 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The WDT-less Rx-traffic mitigation is simple: enable the Rx-descriptor Completion interrupt only when a particular number of descriptors handled by the NIC. Alas it's broken now because the data variable rx_count_frames is always set to zero due to commit 6fa9d691b91a ("net: stmmac: Prevent divide-by-zero") (++rx_count_frames + rx_coal_frames > rx_coal_frames always if no overflow happens). So Rx IC will be enabled for each descriptor as soon as rx_coal_frames is non-zero or there is no Rx WDT available, which basically disables the Rx-mitigation in the framework of the number of received frames part. Fix that by discarding the statement: rx_q->rx_count_frames += priv->rx_coal_frames. Fixes: 6fa9d691b91a ("net: stmmac: Prevent divide-by-zero") Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 229f827d7572..32aa7953d296 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4627,7 +4627,6 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) stmmac_refill_desc3(priv, rx_q, p); rx_q->rx_count_frames++; - rx_q->rx_count_frames += priv->rx_coal_frames[queue]; if (rx_q->rx_count_frames > priv->rx_coal_frames[queue]) rx_q->rx_count_frames = 0; @@ -4967,7 +4966,6 @@ static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget) stmmac_refill_desc3(priv, rx_q, rx_desc); rx_q->rx_count_frames++; - rx_q->rx_count_frames += priv->rx_coal_frames[queue]; if (rx_q->rx_count_frames > priv->rx_coal_frames[queue]) rx_q->rx_count_frames = 0;