From patchwork Wed Jan 31 17:05:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2051071dyb; Wed, 31 Jan 2024 09:40:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiPJf2dK50F5VOcppojLyR62NJvuezIaROMFlvrlJcYuumQrDQRzL2F3kx79wpQH9cR6nM X-Received: by 2002:a05:6830:194:b0:6e1:3a8a:2bfd with SMTP id q20-20020a056830019400b006e13a8a2bfdmr2286943ota.41.1706722838139; Wed, 31 Jan 2024 09:40:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706722838; cv=pass; d=google.com; s=arc-20160816; b=cTz/rUiqlUI1SA0MJlKNIm/q7msHVTajqftfl7hOYUEZp1xo1APtUtIHvr17JOcD+S 8mD3aBW7RbMQSXzATI8VpKIUiMfQjJZqhrfTaqyOPhxIWfGXaCcjIrX6jFU70gAAH7AU dTOm6pwltKu81g1jDNHnbpjNldNaIUuRt+ZWxnjdWvlS12tH8BMFEUMMMGH5V+caQaV3 Ph9WyrfwZwbdWumnyvkjhxAqYCOKCzm3lZ/kZHi7Ulo4evZBFjmMOx+wfDpZl8RD15xM cbpU739WDdO94RvOk6lXgrDoPVuGQVRqH/H0chjRAmkVfqFt8psU7t8XJ5blf91fgC4k Uu/Q== 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=n/9orxaBsjBurGM1KlERWMW0UeB72CWDLR6d+4npC6s=; fh=YyZIDkBHNu6ovRgIzM9cNJ5VQJM0Fz//juTv22VcN2A=; b=yHpu4esR4AUbcSZRRMQR5IQk/dbxG4/4xzBPTEC/Q2FwURxw4x+U+Vb8c7mN2021wa jlR9m2iEbHIRYc9axnPBKVLS0lRukR83bitbPhpI0Dt8PCmYR2CwJKC9QTF3NsMwkqJN IOMGwt4KzMyis8z9uPuf4DvsKtMkQyGHWirQcMhQA93+kFUStHhr+2IsipQgOFEGxJm6 Qm/5aGOcHxo4S4VKurL316wuLRWCMQFpOVZ5R7LFHnOZRUEp2MXVK4tCeTefVgAUv8bL 4oJE4UHlQuT1BYc0pKN/5cOXjrGNzr+jFo+EknZUglC+1GH0jDJ+hn4UwX1lXUH3fMbi ++Dg==; 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-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWnhSJTYXCr+JmRRGM/NNXNkK4BLopgvlrTWNFjbNN+lcvhA+C5wYoz4UvUe+r3d7JVXAiAXM4snHyC2tPb359RSH7ruA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l2-20020a656802000000b005cd89d9fb14si3456122pgt.357.2024.01.31.09.40.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:40:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46867-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 02517B2D58C for ; Wed, 31 Jan 2024 17:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B186136666; Wed, 31 Jan 2024 17:06:11 +0000 (UTC) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CF3812C539; Wed, 31 Jan 2024 17:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720769; cv=none; b=RDjnVz2Wp9veKKl4VKxk2stvSAZZvTeUH0LZ4/T7GtsLw5Ac8aC7AsvW6yXYqVEnS/ka4dmwNwHT5bsadEBou4H7royPkzfk1AclZyHhsIK5OoX0kwKvVbZCHgMViIMp2spLfPnqlRRLfK4loOqynktoW/dFfNaIYsPmlmTs/9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720769; c=relaxed/simple; bh=jDaoRchUeMb3jhh/QTDuC4oc5ie9+ahUDA1P+pGYTO4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ev/IOwYXBWa8RCPTcDXaiHxVuQoTTuBka22JMTiHtAHCM+PEM5rKwK92tfoTY1xcpvFLMeLF4VFJD5BeQxq9STvxUrQCYX0ajLc8WSPvbaYLidRl9oHwmvl1waVxfYBEFD1jcUvZyTpe4DkhnUaM0Hjl/bTCpSdfWpUcZE8Dtt8= 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.171 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,231,1701097200"; d="scan'208";a="192404892" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:07 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A1E50403490C; Thu, 1 Feb 2024 02:06:03 +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: [PATCH net-next 5/8] net: ravb: Always update error counters Date: Wed, 31 Jan 2024 17:05:19 +0000 Message-Id: <20240131170523.30048-6-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-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: 1789628607086426329 X-GMAIL-MSGID: 1789628607086426329 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 9b0ed269e69b..a90e70b25875 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1354,6 +1354,15 @@ static int ravb_poll_gbeth(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; @@ -1370,14 +1379,6 @@ static int ravb_poll_gbeth(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; }