From patchwork Tue Feb 6 09:19:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 197278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1417549dyb; Tue, 6 Feb 2024 01:21:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFhfgS2/oPK4nv6hnKIVOUYrD/unpyDVp5T9zfdZGsS4y1EFJ/l4SdE4iHOI6YUcOWx580Z X-Received: by 2002:a05:6102:54a0:b0:46d:395f:6b98 with SMTP id bk32-20020a05610254a000b0046d395f6b98mr3016723vsb.0.1707211262877; Tue, 06 Feb 2024 01:21:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707211262; cv=pass; d=google.com; s=arc-20160816; b=GViDRajxQXpTWZYzYNluKet2VX6Cm3S/bk4YG7hMxtUX4SOKoPr8EfVagonxUYBme1 Mc1yQGqVMPbPM4iSK/glyQ7SsjoydQdQcDWcjjV2DA4xI3Kg8MF6Mkw48Q99HwCRpYVA XJPy0elDRe2jbHjDBtVlAiPgfSQLDIFbU0y1ojg/MvmZP9iOpHAOFEz6E8QumXjim9n2 3n6xV1nKPijMLZU2wP3HS4XfvKdkawvadmUotSwJOFdG9q2/WyA2iHqpG3CUQZrQ0y0i +FkBo8xLFGWgNlCPMdK/xKG2Z2C+rOa+dvdapF6XNCp9q6gn14y0vAoYvhkQNU3bPKXA vAbw== 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=Gs1PG8X+JZYt+xXf9T0OzhddmSSTyo7/fBly7HM0fHs=; b=AUxgk90RMoGxVfUQ+vuktUX6ovhdScRusdzjmuzcKTeedzaeY2Qej2o9LRUdpCT0fo fAJk7RVtoUzezlztvzk62xYJB/0va8CUCw1/B4wNjgLakFVIZixUr/N4Wqo/3b47a+P3 s5g2aeJC5dCXthN+TqOEshx6Eqp9Htl3EBd8qcgQ0BUBPW8l/vxieuhIhTIMO/MSI3dl zkruyb4FhmoEY03dw/Ok8+c1zsTF52RmxvkXdEGYs+209YtfXDROEl6RDyFrUa8jUM5S 7+mGN47gGA1zX+qHga5FeOUTRy6caRBbrjVq23YmlhJKYbzy3bojZ7moKlv4Q+bErr2G JqPQ==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCUYZG9UPdGd4YafmpcdJclaCULjAD9NNS6yv/y7UsrSfv+znUB/0ndFdQsiJArZyLurGV8qbRv3R+YVnU3L/ORm6dUXLg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e8-20020a0562141d0800b0068c469e8e89si2268623qvd.262.2024.02.06.01.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:21:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54573-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54573-ouuuleilei=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 A78D41C213C5 for ; Tue, 6 Feb 2024 09:21:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AEB712EBD0; Tue, 6 Feb 2024 09:19:39 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790140757137999867 X-GMAIL-MSGID: 1790140757137999867 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; }