Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2915716rdb; Tue, 6 Feb 2024 01:20:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0IULH0RyeG3vby5NB2sXJeyCacid7oBcFa61dWAaHtG9YGUpqKQ59c9/TZq3lYMSGFN/b X-Received: by 2002:a05:6214:519b:b0:68c:74cb:9932 with SMTP id kl27-20020a056214519b00b0068c74cb9932mr2103083qvb.11.1707211253466; Tue, 06 Feb 2024 01:20:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707211253; cv=pass; d=google.com; s=arc-20160816; b=ZkqVD57tcFG5kpROWNZL0wmbWiIvTpQ63lXgIdRgu45xUVSD6mXmTe16xjPlUAn/uQ wiSFnuX2aYOXXgMPhZ3VhOquKFEkeALdUXY4U8HYXVTkLLhQ4WcrwXk+GxOekPIiCndy kdtTJkxNH/tVwPz7RG2yD0YqlKoFx5nDR/BSvwydS+FzGPXuQ6VTYv9grqJNWJ9zKYhH yAQM/n6saiLifr3loOK7qEccLIHuxNwOElQRAf8XbNpKZTpWjN5eCzUytrupfw3JxMx8 KcBjq2iVU4n/HowBr+Rg/4hdMpg9NG+kS1i1c0x6XQhr9XtDOosQyoaI97PVVKt9d0uD KXeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=78VAFIsDFzWqE6vEPfSqMFOOKvHZMv2JRytuksoYfEk=; fh=n0nwKW/W6DA6CzdXIVbBOpR+SHaCGjmxktzqEuR5qi0=; b=PwlPK++CGKjRxDvoxaGceJ7xP5W4S+iHKSP+w/PaZssDcJqy67Iu0V3dRW5Wx3NOAc j3S2O2bRHUWD6tRs32E8gzhAKUt+7TPQbngoVtR0aAEpJ8jd4N5QTLudDUxPEnIR08Li ffyXjEcoR8DWffquCKpYvOS7PUxDEtSSbBx/0iefk54FxNZox2p2tStz8yASJClAtMX2 GLzuYs7RvWkqw+C2jSXQhVQ/7n4nRPGQNel0iYSyNAfDBNAN589igkV/ryMOrxlaxGiT HH6NJXkA/JZex4Ncoi8E4FyFolUlbTX5e0OaaiF5t/RcgptSLW/isvuq7pr8/NM3q9LC JKkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-54573-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCVUSZNtS0JzEfwg/CeDCW+fhbLVL6vSD2ckWYfCzAwoYZTZoXjqCJMeOsvsjXYzBbMEwu6Wj6VWONk2FfFI+y7LI4MoCUikW5DXN125Ww== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i18-20020a0cf952000000b0068cb501b052si559611qvo.138.2024.02.06.01.20.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:20:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54573-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-54573-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A4C81C20FB8 for ; Tue, 6 Feb 2024 09:20:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E62CA12EBC0; Tue, 6 Feb 2024 09:19:37 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36D5612D74F; Tue, 6 Feb 2024 09:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211177; cv=none; b=QK2ztsMcEznqP32UswGmd0KpDd9QLulY9ZYhhLOUJt4s59YZyl+6bYTAt5qlCydITHtGQI3a52mciV9XpaeyKbkMh2zHMIcgkXZhyNPBebuA4cXpLQztI93MgRyjMNCfCXpFiQu0jabfDtJ5lb+nMT7Menawpo78N04igl3YrRg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211177; c=relaxed/simple; bh=VWwAkeNIRheV+jEp3hBBLEU6AH3N4DBzBzaCBZMZS6M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O0ZprxTQ/ctNV5v817EFeOVpEQQN+TViw4X4CS8xxIzfybh/U6jaMmab2xh6zhNHlegOf6gzY/Y6VQWRoX5E17O84JMixJQUM1JNVTfe6NkQoN3e3E/1aEyGpytWieGKboXKkCzqlm3ZR8ll6PsEcEKFifAJY8YZ9tC4p43xRiM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,246,1701097200"; d="scan'208";a="196934640" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 06 Feb 2024 18:19:34 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.93.63]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 46C3D41B8EF7; Tue, 6 Feb 2024 18:19:31 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next v2 4/7] net: ravb: Always update error counters Date: Tue, 6 Feb 2024 09:19:06 +0000 Message-Id: <20240206091909.3191-5-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240206091909.3191-1-paul.barker.ct@bp.renesas.com> References: <20240206091909.3191-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The error statistics should be updated each time the poll function is called, even if the full RX work budget has been consumed. This prevents the counts from becoming stuck when RX bandwidth usage is high. This also ensures that error counters are not updated after we've re-enabled interrupts as that could result in a race condition. Also drop an unnecessary space. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 10f11141569f..2136600d60dd 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1358,6 +1358,15 @@ static int ravb_poll(struct napi_struct *napi, int budget) netif_wake_subqueue(ndev, q); spin_unlock_irqrestore(&priv->lock, flags); + /* Receive error message handling */ + priv->rx_over_errors = priv->stats[RAVB_BE].rx_over_errors; + if (info->nc_queues) + priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors; + if (priv->rx_over_errors != ndev->stats.rx_over_errors) + ndev->stats.rx_over_errors = priv->rx_over_errors; + if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) + ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; + if (work_done == budget) goto out; @@ -1374,14 +1383,6 @@ static int ravb_poll(struct napi_struct *napi, int budget) } spin_unlock_irqrestore(&priv->lock, flags); - /* Receive error message handling */ - priv->rx_over_errors = priv->stats[RAVB_BE].rx_over_errors; - if (info->nc_queues) - priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors; - if (priv->rx_over_errors != ndev->stats.rx_over_errors) - ndev->stats.rx_over_errors = priv->rx_over_errors; - if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) - ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; out: return work_done; } -- 2.39.2