From patchwork Sat Nov 16 18:02:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3640 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C9EAE3F033 for ; Sat, 16 Nov 2024 19:03:21 +0100 (CET) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43159c07193sf7049785e9.0 for ; Sat, 16 Nov 2024 10:03:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780201; cv=pass; d=google.com; s=arc-20240605; b=OJSFl1H8HMizJfJM4qu5HMBBjNZ6PgH/1b59+0bOrNubm7+rgALntrtTsog+Hb6Yeb Fqu8uYBOs7LrvuRzHGvfuzuWPbAC643zlue3SxVs9YG0a+/FUw+ZaO83MEHSQ6FjGygt w3tNp6nQoqcO9LEyZ0W53pj0DtBRJV6vMCKlF0B4KEAcEa3eklnAcoknuqHACLWSovJT Zm6hHOk/XXPNFiGT+H4oIrq/M6QtkbWT2KuKW6ILsCedJAuxwHN20yEioswCuJyeJUd7 XUg8gdFOE3Ih5nzXajR5C3bmkNtWrv88pMBY4cW8D2TWKUc9nYoyagNniG3Cq8wUH+ko fBrw== 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; fh=UFdzE1rDu22FUY+RgjwObJQMwofv2XTV3eUGH4S0sfE=; b=ODq9znqNUtJbCauXqxrN2tMwn06AHv0GpWAU9LFhgv7gbT3omV09Z+NyFURncBuEvn Nlw6TKGoNOkfJX1cdpuM/1Gt4uuSRsaPXimYHZzeuQ8SjcIcU5PsYaDRf03Mx8YWrjK0 /4JHIsjfW1pI+Ot7NWsrFuIjr3N9HKVdu4eKO/LW2cLTc9KA7NGECaUnpc+X+qB0n6oi x2b2d7nRQaG7mDzRS8gC6i8e2I2FxR5wV1usPIfmX0CCpmLyOV5aJVRSYZkqrjVBEDJc 7mQB7Z4GwXSmNVNFoaGwyaYVJKnKkxjArSdcQT6SckOu/4d7QLfl33hk4oCvUObqmyLL 3Uyg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Jl+rvbPu; 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=1731780201; x=1732385001; 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; b=GCygEtaB+zpjPuN4q2d/fCFs9KzcTJJNzu4BTbQRyG3JohxpplhXjqXYrCzkTN1UDj LsTdeMnZ7K9sBkxWCG8Yy5g+8GPv7IkhiKMerYV4AynuIoFmx3CSrQMlgicTlwW8GT4c +D4NmdExdeNxTj16cQeZHr5/WLX0PdE1yT+DA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780201; x=1732385001; 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; b=TlKXoFB/XdOSKvp7R3YI6FnFqt0kFUjrQJQw694HXtFh7aJvbA5yjPyBM5JWCJvMX8 Hn3TCJfx2g4zRBPfOyxa4M4yVk2zATTE2BAAVgrbu0tHN2i3EnnNLeWjCM638eCeq6Bi GF86j+IMXN58prICX4zqvPcd2scB4opDFSq6gZaV4DvOnGIHfqxy5JTSY5loOvUrPmIe 38ApmNWGYmkNDDNAErWei6XSaUULlitVp9y2rxRHd9Cpsg+tyuyHnmweiDZroUljNPT0 KISp6oAG1GlQdZGmrbuW7xKsdfuXyN7UVDu7fuUFfZ8CjYTwxMrXgYHgvXjV5/rT/Kjt qc3Q== X-Forwarded-Encrypted: i=2; AJvYcCVE8QE2M9UWYCvMdpzJ4tiUx84A40Rw412MgnzKw8fTPP/lz2fIBd4MyfkbEJBXx0a/CsoOPXOIuAQHvAlT@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzeObbOiGABhdcWJdX59drRz9eLVncVxM90k4/J7wpYSYVw0FHV bkWUmDkG0rZ3wKEqRUJSDZimsmoLKiboM8+KPIF8LLkQfRT1/c2d5ApeJEzC+2H5NA== X-Google-Smtp-Source: AGHT+IHGj7wt46BKLVbDcCuWaqv76jmsxNxU/1z6ERwBlR3hoyVEqeNXBOOTtBWjLD0ghhdONf2I0g== X-Received: by 2002:a05:600c:1387:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-432df742662mr72868785e9.11.1731780201439; Sat, 16 Nov 2024 10:03:21 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:920:b0:42c:af5b:fac1 with SMTP id 5b1f17b1804b1-432e63b05d9ls4590375e9.1.-pod-prod-05-eu; Sat, 16 Nov 2024 10:03:19 -0800 (PST) X-Received: by 2002:a05:600c:1387:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-432df742662mr72867985e9.11.1731780199583; Sat, 16 Nov 2024 10:03:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780199; cv=none; d=google.com; s=arc-20240605; b=FZxX4CUTp1dqjLbiz1SJ/fygWOV+wQlO9w3JLzfi0NQF9Th9V7xhF6nsMfu67hIjC8 EQCCR9VkzCrdFW2n+Pwo1atNrOHv6MD0FLWemX3u36jzLR+IyUcgcMYD/UFWYGZ4Rt1p 2rY60MdZQ+DnQJwy5dnf2xJjEacEGl33AUEg5T1SHEBRHYYRcOoEWYgZGV1SAn9XicAp GWhM31rKBNzoGQKvGLWkZKjWKYkS3jhGwWD1+e6VIAtV8IBee80fzre90XAqMl2J5KrJ 8exJOr3OBXov+VAyJze4amP3d7pCKHM6tZx7hzNrK3eV8WdDI5tlFkIrDCeroQv22kUt 99rg== 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=qzqc0qf43o4g73YzOl/3Mk2ZcRlSoSU0wYKvIRYgWeY=; fh=Z/aPx72MnXtRnF1pcJoIDur87m1wHY7fyT5F5R4AXG8=; b=Eq060YjG/QHUr/1z1QNXyaGwdXwUpGGSyvvZ98veW9vdeJUt5pOUIWNvqa0EoU3jW5 AriasM79JN/A3JK8wZhYuTVjf6XmOskOMIhAocENenTEC3GO3r01V7EHyTUPMRCqFa7p a306dMatIn2DvQcTigzGh8Y/TxO8lz2AzrUTwbsv2/Bwb9ZpCuNDtGqhmViSANJ4TsWJ I1txLEoKC0q8qz8HgcQgaimRXm+hFJdUcN7oy0qKyS0vD+JVUU2OZfTWwjvhxEJYl/zY gLu0Gw4lHr159RH9PydPaIwm3kXvLEqSXh+50al0A8vPZy27mctnQviOLQwpzcTiOpuk jJYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Jl+rvbPu; 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 5b1f17b1804b1-432db20da83sor31233215e9.7.2024.11.16.10.03.19 for (Google Transport Security); Sat, 16 Nov 2024 10:03:19 -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:a05:6000:4213:b0:37d:5042:c8de with SMTP id ffacd0b85a97d-38225a45297mr6503959f8f.22.1731780199189; Sat, 16 Nov 2024 10:03:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:18 -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 , Paolo Abeni , Sebastian Haas , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 6/7] can: ems_usb: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:35 +0100 Message-ID: <20241116180301.3935879-7-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=Jl+rvbPu; 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 ems_usb_rx_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: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Signed-off-by: Dario Binacchi --- drivers/net/can/usb/ems_usb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 050c0b49938a..98a70a2fe189 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -361,7 +361,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) /* bus error interrupt */ dev->can.can_stats.bus_error++; - stats->rx_errors++; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; @@ -381,8 +380,12 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) } /* Error occurred during transmission? */ - if ((ecc & SJA1000_ECC_DIR) == 0) + if ((ecc & SJA1000_ECC_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } if (dev->can.state == CAN_STATE_ERROR_WARNING || dev->can.state == CAN_STATE_ERROR_PASSIVE) {