From patchwork Sat Nov 16 18:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3639 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BA2843F033 for ; Sat, 16 Nov 2024 19:03:19 +0100 (CET) Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a9a2a81ab82sf249562966b.1 for ; Sat, 16 Nov 2024 10:03:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780199; cv=pass; d=google.com; s=arc-20240605; b=iY5/AardwezyQLvZaYMsZDna9bQ5XkQHO8ki+m8WI7SKVFMn49qi/dEHQp+0PfJvbD kTjo8Hktq4OuXDqv1WWeQOPJ0y8Oraq78Fp1Rp+mfWISKg7AwBkEkmpxNjLvAcLdlpta L8PoNz8UP74gMP+D86T9lpbvTiiSQH/nLz4RBm2E5OxhKNkab5UpT6du9FolDtf4vCH8 /2OLOcCRQR9RneMLkAiJwFdwFQF6PLjk1a3UjJSW31YUHqvx2DvqmVh0cU/ZAVoa6nKR Jm79+6ZGrBYyxZJwLWMOYlAIpyhdejjYsrYZK+wMfLrmFfV532FcvRvMY9/+IcJdSpqY WTxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; fh=Z3ZRqlZCGTsgcsGlia/lEoBOt8fivueidzTeNEiQwVI=; b=efyxTzoL/SGepx2jinnub6E3ArYSxBcSqR4mbPV35w190Zq7q/znrFwhkXyYlfYSKz SuoGuLIQf7waMl+MudxovVEBQ32Egishrqi0Gn6qaFkjhCfOoj6SMXGGxMkUe8vOm0rQ Yjds+x4BmXJBwOw1CBUM8MeIcThflWf+PXkmBD4+Crv3Irx5BCdU8AOYDfwPOkGPiMb8 BmjnxXa+k++xEw6ZWgrM1ck5zWxKKNGidMtyeRmjHeWwOzn1Vyvve7BxHZmfKg1PxTdJ noPEv1YF8wlySGTwZfDJBsIQKmgaNKNow9yUSfF7y37viYaZJaMPNbWo026ly0kVnijj Sidg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cXILc9M5; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1731780199; x=1732384999; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; b=H6zx8rwZNeUVHm+GjMFUAaukodkap+ObRz1kG3nyTT4SGwkIOhS0PvXwHw5uWwiy9E Mau5IFI+2Wr6bV160YhEMgco92dKaT0fQ1oxuBI8iEtQy4KKH7fmEn8Hqq9k4hQokocf 7o8Lo8Srn92Ta3+RwJGbhN26X7CEmY39Sok54= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780199; x=1732384999; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; b=rqnlbyW45KqQD8z43olkjyDpdL7xmnN+4H8kR82q5acrPL8D5npx6RjQb/xtfdKTXZ qPr/xJMFMYhd9FDjKAa/BAix3z01/5zoATX1CuZqEo/38XItPgmfToFPDoOs8Du+PyIL ttRVMIi5kwmF4q2mSrQlqk0aI/F2FLyCKfYKPp0WNHOUgxg8xAKzkaxwajN8mmroNRGa 4r29V1Y3oG6W59cIDjEHlhYcJdVbOnOJMmYGoG05vGmouEPxX3whYt76M5F0sc3cAlrW Xc+aAonajzCbQyiK9gY7cXDhDaxcj4pSN40BjEkZH7o0mh68pCj0QeUsiXzgeAsvBNT2 vd6w== X-Forwarded-Encrypted: i=2; AJvYcCV4y64iL0CAIxOlwKd9qnKzmBv3n+NJ+R30d1fVETlpUvSWtskYU+au2tUMdoeXCqltLfQ1kG86TMvHIoBM@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxU4rP7V8tSmIRelvLwxlt3L6oagjppipwKPXjNwj1MlSGQ9Cb3 5z9xDxDZWZ8JT+3qp6VxttWSVhpvrBvpLf3IwUAvi8zYRqfNXQvvgo/A4lYm8PgGqA== X-Google-Smtp-Source: AGHT+IEzd9pJeqnevZYWE9Ti5rp7PgqaPFPA84YN7r/UI1l8jKvHMEI9Km7lLF87/tSYI9GHbkXGiw== X-Received: by 2002:a17:907:3f07:b0:a9d:e01e:ffa9 with SMTP id a640c23a62f3a-aa483482118mr592898966b.33.1731780199147; Sat, 16 Nov 2024 10:03:19 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d316:0:b0:5cf:3cb:951e with SMTP id 4fb4d7f45d1cf-5cf75765148ls259211a12.0.-pod-prod-09-eu; Sat, 16 Nov 2024 10:03:17 -0800 (PST) X-Received: by 2002:a17:907:3e8c:b0:a9a:67a9:dc45 with SMTP id a640c23a62f3a-aa4833f67b0mr638326766b.3.1731780197372; Sat, 16 Nov 2024 10:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780197; cv=none; d=google.com; s=arc-20240605; b=MYmuTtYPKKDCcOxqvIALdHvc0JCdDaF/zmsXRMaNrIcyCzMQZvvAzsYbZ1zWRVZ3B0 Q+/M/gMuVX0moB+WFliBBZyZdcjv18HWKMwPMmw0jQIGQnlurG1KL5g/CWQKrFZlV+2Z QZjterZGjMy7VADXrrrrQGn6ZQmErkW5Ff+3Use5UZVwM5lQDbtMDoHQ7AmFnxw9WcrW dOv05Qf4wRekjh0FwIRdD3MAcfPLY/ajc7naRAU1XxcIttl6G4QBC+IRwfesxF19Tzif GaOhtp4llyc2VhvwNwrP0sIYZ6P2DaEkJxBNWF4+mG7jcrpsHY+8/T26TRBylqWx9NWX kV2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ZZp2LLELhHXaHE6P8yqyIkdBBd7fnVylmpcd4GsYhTg=; fh=d+srdeq2fO2UyUWqLmmI1L5Gnv6o+Yv6XGzq38UYMpI=; b=J+uVSlzOjOoP0UfB3NmuD15lhp8RXRU7ErMAHzoZNz4k3CwrOvODe+xKKca9Am8Bt7 lFU5RcKliqx87scxvo02xn8ZT+dOsGdJmt3eQkVe+DnxW5xNfpi3Rz5HnDOl4UfCxZt1 bk+3T4P5XHw3DBwXt8fYrdx9JsIDfyJzEEfq6+ZniCSKhGBVk0UXIlurtgonpcxMOITZ 56DNfoUBDq77hw9kj+z1VNGOKZvBELGhUBddLU4ExuMkZIOr7c6vA6waKRWY03T5kyit 0E6F/kFZ8m6YsQGympBvkUXJt903OZzb6xM58YBTrFg+HgX5zLZSBdMuWftN8JciiEIW a+9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cXILc9M5; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-aa20df505d1sor246492266b.5.2024.11.16.10.03.17 for (Google Transport Security); Sat, 16 Nov 2024 10:03:17 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:d24:b0:a9a:bbcd:e63 with SMTP id a640c23a62f3a-aa483421c58mr612801466b.14.1731780196892; Sat, 16 Nov 2024 10:03:16 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-54-94-193.retail.telecomitalia.it. [82.54.94.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20dc6d364sm329549066b.0.2024.11.16.10.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:16 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , Chen-Yu Tsai , "David S. Miller" , Eric Dumazet , Gerhard Bertelsmann , Jakub Kicinski , Jernej Skrabec , Marc Kleine-Budde , Maxime Ripard , Paolo Abeni , Samuel Holland , Vincent Mailhol , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-sunxi@lists.linux.dev, netdev@vger.kernel.org Subject: [PATCH 5/7] can: sun4i_can: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:34 +0100 Message-ID: <20241116180301.3935879-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241116180301.3935879-1-dario.binacchi@amarulasolutions.com> References: <20241116180301.3935879-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cXILc9M5; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The sun4i_can_err() function only incremented the receive error counter and never the transmit error counter, even if the STA_ERR_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the STA_ERR_DIR flag. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Signed-off-by: Dario Binacchi --- drivers/net/can/sun4i_can.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 360158c295d3..40939141749d 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -579,7 +579,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); priv->can.can_stats.bus_error++; - stats->rx_errors++; if (likely(skb)) { ecc = readl(priv->base + SUN4I_REG_STA_ADDR); @@ -602,8 +601,12 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) break; } /* error occurred during transmission? */ - if ((ecc & SUN4I_STA_ERR_DIR) == 0) + if ((ecc & SUN4I_STA_ERR_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } } } if (isrc & SUN4I_INT_ERR_PASSIVE) {