From patchwork Sat Nov 16 18:02:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3638 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2636E3F033 for ; Sat, 16 Nov 2024 19:03:18 +0100 (CET) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5cbb635c3f3sf3272431a12.0 for ; Sat, 16 Nov 2024 10:03:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780198; cv=pass; d=google.com; s=arc-20240605; b=NqwXgT+okENuDaDAMf3kX4mhUNJpCyck4O4A6kddSs9+ImtqCmhLe1q0z6e+ZgOAGY OHEOMgQLzshOgnqzetixPrXhsVCNSNOR3/wRDEBIgRRbRb+jj3WZZTQAEYV0U9h6rxLK KmVOgmdrX3NV2fFbXcaXRmUH8rPhnI3d0sjWoIDQYme4qlmFcUIfQ4/BBjNa+01k7agU FQrr+7r2Elx63PaobLYYNIm0gDFCw9HJ3oRb4q3vqNpDvCwzLzSxWeMptY3eLVyvUPQk 8azkDWnbo0CMYM+rsXxNoaHScnaVdTTlPY7Rpyp5TpFYUrtCj27dRKpicP+AgSQwe0Dm Y+7A== 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; fh=pddfdvrZxjJPM1XbNBioaHgl3K/PlbN/hXLw2Ic/4Ls=; b=kcGMnjYcI4YR0TLgprw4xVgtG+/ADL6UqbT+WnvOw9Kgk21IiYU8LPHNetYFrwt0qA 5dC4YafmHerPQUYnxOI+VYzhVgdAIWL/Fdkc2F8dD035IYfLOZigc3Koaxg+HFs42oCm fw54mATKZOi1e/nqnhlI6InYFR2CtpaYpZaKtCq5NVNTLk4vWiG35mMzl6YtGvv522Ba aaJil/IQUe2qe11SNZF7W1TB+H7PZxPgX2DvnAkYVmAE39ti2r9pjnpDdbqcMkppOeio EoBT6wDiwmauPfDtDXS1lMZe+dDDnxfOMTOdRT4mo4scnuavtZ2MByRfFyYjbHb9K1d3 ykAw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JKBrPy2Y; 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=1731780198; x=1732384998; 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; b=G5SJp9L4Ya/bGWEkAKJXiOq7WikJsVvTXoYSNc3GxTOEUGZ2gZM3RLerVJn1m109U3 idGcRA4n3pJUKN9oJt7yADkGdSTcsHomol1vJeJqCK3vr3PdtEKg3idO2P5S9AZMlMXL GabDnK6KD1LNxletY88JcSdTs7HpChPldJC80= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780198; x=1732384998; 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; b=RtXgUt+FEOBVZnC+ZeBes+joWEJscDppGTmezs1cF6JEemnTD87Clw1bAqfc5+Koxs 78BC8pgLF2Wv44/9P/YMtkUXcgdD0EWYXYOceNprBtVzKysVRuzidGiMWdhSxpu/x3Cb RXQjn0F6BieIsq8a0H4i3BQkhCL1mRlG/vbCjGBx+ty0YyPoR2zy2vvOTen7CzCH1f9n ms8zAcef87cZ6chJ7f1tNQs5n5eYCXV6t1YHd4w4/xQaDLJ7m5oBzPwkIu4seCG5+Bwz /37CKIwovcYX3VDWRQ3ccK7ipprDTArUMe2ZUEo+AhNrIEspl43zjalvADKQRRiA4JjE DyUw== X-Forwarded-Encrypted: i=2; AJvYcCVmWYYt6Q8s9kM9xgrI1L7Q1QrwaJusZ2Zefh8R8eMASQufhAy3aQWTMzeuVnknFyQyasHdSkaJqRlCh++7@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxayxE+VTsOt7SJynPYui2J9jPw12sO8l9IU7I53dY3MX4D5wGF Fv3NxK7qNrrowXXe1Qc0Zx+IRu0+siMg5a9EHRkRYSNcKjnKy86s5Z4tGx42Te45VQ== X-Google-Smtp-Source: AGHT+IHQHzayMoBTwcxvYxRLjWEIkp6ZRE79YMpowjIN9Hfz4QzwBJ2mo5KXlEg2N2tp8heO0gW1fQ== X-Received: by 2002:a05:6402:1d51:b0:5cf:84c:b7bf with SMTP id 4fb4d7f45d1cf-5cf8e0201d6mr6565605a12.15.1731780197449; Sat, 16 Nov 2024 10:03:17 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cb58:0:b0:5cf:b908:ac9 with SMTP id 4fb4d7f45d1cf-5cfb9080b53ls105382a12.0.-pod-prod-00-eu; Sat, 16 Nov 2024 10:03:16 -0800 (PST) X-Received: by 2002:a17:907:7e97:b0:a9a:6c41:50a8 with SMTP id a640c23a62f3a-aa2076eb6f0mr1057646966b.17.1731780195631; Sat, 16 Nov 2024 10:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780195; cv=none; d=google.com; s=arc-20240605; b=LF24hRmnTYwfRTpAmyXAHMHB6QtdnPq1JI9gDiYknBFyw6eO/KjGgUun9oSmAvLyqQ ZInwoRT1+qZKUskua1N1ywqYbz08ZN1lzRtEtg+yf7VOfrKrRqB7Dh4Jrjxj1tyr9nX7 abJVn5C0b0OdlkBIOxH7GafGXDrcVViLcMcL/RDCG36Gl5BtaqX9/HrhoTvPhJ2ZY5LX WRB+07cNOAVXFerVxtoP7O4XmK9ann9c2BUPDPLa/KXhG3ZbVxR424YXajjxXDu6YLdO XgPC6CQyrij4p1GLXdh2NBEYUF4hasvL1mBj/1DvxP/8Ms4M0nlP7i+4w3fFYwIbDaXq ZhLQ== 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=IPi0av2xe0jC0J5HdvNkCxIcsg4iO3imVdR2/hegefY=; fh=kANvBLcOhPhiwV0mTAyK0Gohqy4zfT86FGYABDp4o0A=; b=ZfcccR+rG+nuO7MdyzL/J6Jka/VJIqEZYp0kFZAL8XKitkDWtDks/J40ZtwWNM1Bs3 JQmL4nuNNpmLhHPFfbVu6OZi6/RxdJeuKJw51u+eKKU26+jtKPZI1TbBpVJ9GJ3Hn+2A r0nkCimvy3UPhtUmJk/0CmSWbQGYdJWOsH28Fi6RzzXzKGmcsj3z2HFoNg5S3wChjzmy iLfMcQ4IsI0OJYwDur03DKqXVtglT3VILU8Yl7a4ap8U4MxNMzUg8QFjSjfP3ZMy1HiJ oc8BBoOPoAMHzXOD6419Zs3BzF399WZkPAa9Qtpj9F/dj5rIn3Z/MmLNTEofQXb11QHo JT7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JKBrPy2Y; 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-aa483a7ad04sor140369166b.9.2024.11.16.10.03.15 for (Google Transport Security); Sat, 16 Nov 2024 10:03:15 -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:9813:b0:a9e:c266:4e82 with SMTP id a640c23a62f3a-aa48185c694mr772769266b.6.1731780195092; Sat, 16 Nov 2024 10:03:15 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:14 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Oliver Hartkopp , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 4/7] can: sja1000: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:33 +0100 Message-ID: <20241116180301.3935879-5-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=JKBrPy2Y; 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 sja1000_err() function only incremented the receive error counter and never the transmit error counter, even if the ECC_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the ECC_DIR flag. Fixes: 429da1cc841b ("can: Driver for the SJA1000 CAN controller") Signed-off-by: Dario Binacchi --- drivers/net/can/sja1000/sja1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index ddb3247948ad..706ee8f6b7db 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -460,7 +460,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) if (isrc & IRQ_BEI) { /* bus error interrupt */ priv->can.can_stats.bus_error++; - stats->rx_errors++; ecc = priv->read_reg(priv, SJA1000_ECC); @@ -485,8 +484,12 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) cf->data[3] = ecc & ECC_SEG; /* Error occurred during transmission? */ - if ((ecc & ECC_DIR) == 0) + if ((ecc & ECC_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } } if (isrc & IRQ_EPI) { /* error passive interrupt */