From patchwork Tue Oct 29 08:44:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3608 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6661F3F380 for ; Tue, 29 Oct 2024 09:47:59 +0100 (CET) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a99fd71e777sf441305466b.2 for ; Tue, 29 Oct 2024 01:47:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730191679; cv=pass; d=google.com; s=arc-20240605; b=Go4rrN5PIsbi+c3sf53JMpckIsswWhvuSdgRL2f/fUQ1HqijdUyANJHvEIMzXIo1iK omXOAFQDhcgQfFFYUeaWAHg65cRxhnoJHJJgvFJXS8mc3Z8b0ADtDRe8PEiYkYj8en1q H3/bUvqmqoM5PLvqSId4Ql+fze6hiZ/6UWh2Ekbfm3I/c6eCQrPybh4P4R+G+3aVK/5q 7chT1K0bWs+SuFK5rvaW1S1k+Y09N5GULFt9d8o8lPHIVZYzKxOFoh4TMvmLiwb+WTdB x67kCfzxB7rMY+ky1On8sdMu4XPGpN+bm5jy+JpXsVk/5jQmeYjm1M4+7RDUy4iMK9y+ +nMw== 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=7gBW5K3Qg5wxB4bdKujCe36PeFs/WYuct8dXQ2iu1Rg=; fh=2x6IpNuUWhIeAatJFQNi2y1MltAwB/Q9b7qdReUgW18=; b=EJYExzIBubhv6Jb9XFms18uyf0/My5+sx0kKFAzCZC+KRxowH6uPoKyRRF9+I9dDMh ukRy+JfInRVpcPEUt6ffwGRR1bGXdw4pJU4F29UMW7bNxYllzSkh2SGsIPM+ZLPYSkn6 vFBGeWPNEN7DBMM2okSC1Pl8WwRHq0tQ9KigpRo99HYzjGnLAcQBPnAJtiTS4fdyuzUE d2qptT9lQo/N7JfhmKhxk1Di2tLjUfspGm9pZH7XcgflRpYe/0IydQRt0JPJzGyTESVc uACZ+1Eux++d2d2FH2flrFjdiJYmG3i0yOdzIHDzVV5+KkdPlEZsEMZwJ+yEh6GuH+mR h1Ng==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J69aS4wM; 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=1730191679; x=1730796479; 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=7gBW5K3Qg5wxB4bdKujCe36PeFs/WYuct8dXQ2iu1Rg=; b=ZquhNY9q1qXOSPn/NCK23jAMmrT3VVPxjlD5G4SqMoBaDZS8Hubsm5SEs94543ywin xK6gPFv4cPko3RBKOLSyh3fGEwnp1VgiTjqIWcqOtFnUZLu+fFHJI7cLZhySIJhE9e0Y RpPiiFdiDpfwM02QhftyAVILRzt67mS0RxHGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730191679; x=1730796479; 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=7gBW5K3Qg5wxB4bdKujCe36PeFs/WYuct8dXQ2iu1Rg=; b=mF1/LAQ944YJON3rEM+PW14lMhpICRblUnpNuXrlVaxcjxzA9V94ON0cT/+LNhG/He 39RMJsgoaXY+WQbGud0bOcEtQT3HcsWDKvlFyZOGx97zEN+6sv2v0DbnFsot1HyjBSY1 +acz+vTS3VXfF1bMbHLZmUv24y0PWNhvJsgQ7M7WhoSfrDcf7gvzXp3kIBsoMe12PSAu cBpIMLTheuO8H7LzaiRO6to3diEC/WxlXbU2o7vg02AllrJq6SbgBYI1XB3UV6kP5BNG qluMgcRpZwOS2eGXRUsGtemAL70T0CS8Llll57W/sIipwRs6d3R0mkLVCdqk6aVNGugH kduA== X-Forwarded-Encrypted: i=2; AJvYcCXtRX2vNyloxrj5IPzwMPhaXECNyJilPtWV34uDnE6iyfcvNoo4K2Zlp0mvHBB2yrlG0frstDu/LSkdTnmF@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw9+GWLGlChLsXxXTrF1jklSR6nwaaQMewi0JVzQfZhtxxP9ZyR +PmDjOi7jwVJBu5vzoMqq7GMc1gJs9H/Mm8dx4JsAlMdwUEzPKgZXeQs8SrugsYwRg== X-Google-Smtp-Source: AGHT+IGJrrDrdXFQDVF03hGLRIuFRr6MfuJcG3Zpa1WC0L0cv8oB5gvpDUkSufO9dE1QQdSETzZXYg== X-Received: by 2002:a17:907:e92:b0:a99:f861:ebd with SMTP id a640c23a62f3a-a9de5d94315mr1046166666b.14.1730191678362; Tue, 29 Oct 2024 01:47:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:510d:b0:5c4:6c19:f742 with SMTP id 4fb4d7f45d1cf-5cbf05e44bbls487678a12.2.-pod-prod-02-eu; Tue, 29 Oct 2024 01:47:57 -0700 (PDT) X-Received: by 2002:a17:907:608a:b0:a9a:4120:c107 with SMTP id a640c23a62f3a-a9de61e8deamr835060466b.60.1730191676748; Tue, 29 Oct 2024 01:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730191676; cv=none; d=google.com; s=arc-20240605; b=YfGt2uOZqbThI5hk4EkC9kBkyvsDtkA2qE/3+Pug8eBPYRgQiQBXtxqBHznQ7egahV Edfias0t9e4JVq5//cVeNPNHzr9yBLeocUdfwtUM3EGBl6qMwa2GscQgcIcQk6/QIMcA 2NPwMoVQcMISk8lmTTHRQ+maM1y/WnFbq5IztYtPQc4/0d7xMtyp45F8pBzF0tzQLcsY Ow+6LD6JRsr30bVPUXelpPXLuGSswDOeCbwh/7RrGWTth+P1eJgEYnmsmqrXIqvyLDU3 o2POiCtyB/2H+fh18F+bgljeXpOaRXvV09Yqztl+5UOFFgygVv5hZI1PkIV7dybzoIhX hqmw== 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=0pG46qvNdim+YSCFTrvSFA2E8sjhumHv8Kb1b4NjRqM=; fh=PjxMd3bFjy42ndOBsdK2kW7LKvq95NBfuaPfvxNPOj4=; b=LWthVSRapfNNUgzl2BzoRYlk/8xcy4BbE/YmeGH0OfMsCnluSCtAh39CTNyXCHdS8G zEs5TWctCs6AdF1mt7Zx/tnmiawr2+RSFnAWezOV77qmIo88qrHdihZMZNf1f+sBpH2w S4dqDl4WNLGReS/9RnBCLNX3LukfLVhmlLWuhVV7pEXgm24EBvoNakxsbYc8WmEFDqLq K/TKglCH+JVC5IZmzYlrP/j2ouaoKinKLyrBt4cHDVNKf5QBHGFkghQ3xMrPU1pw/w7o HR4J8RpsTA5WpSMw3qyAn8LfC3lBDAt0txzQQNpJlOD4wV+fsTcr/gVnxleYyUSKBEJo 1eYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J69aS4wM; 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-a9b27b81343sor352034866b.19.2024.10.29.01.47.56 for (Google Transport Security); Tue, 29 Oct 2024 01:47:56 -0700 (PDT) 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:7d87:b0:a99:fba0:e135 with SMTP id a640c23a62f3a-a9de619ee32mr1052955866b.46.1730191676268; Tue, 29 Oct 2024 01:47:56 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-40-68-117.business.telecomitalia.it. [79.40.68.117]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dec7dacsm450134166b.9.2024.10.29.01.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 01:47:56 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandra Winter , Andrew Lunn , "David S. Miller" , Eric Dumazet , Gal Pressman , Jakub Kicinski , Kory Maincent , Marc Kleine-Budde , Paolo Abeni , Shannon Nelson , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH v2 6/6] can: dev: update the error types stats (ack, CRC, form, ...) Date: Tue, 29 Oct 2024 09:44:50 +0100 Message-ID: <20241029084525.2858224-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029084525.2858224-1-dario.binacchi@amarulasolutions.com> References: <20241029084525.2858224-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=J69aS4wM; 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 patch modifies can_update_bus_error_stats() by also updating the counters related to the types of CAN errors. Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/net/can/dev/dev.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 0a3b1aad405b..f035e68044b3 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -27,16 +27,31 @@ void can_update_bus_error_stats(struct net_device *dev, struct can_frame *cf) priv = netdev_priv(dev); priv->can_stats.bus_error++; - if ((cf->can_id & CAN_ERR_ACK) && cf->data[3] == CAN_ERR_PROT_LOC_ACK) + if ((cf->can_id & CAN_ERR_ACK) && cf->data[3] == CAN_ERR_PROT_LOC_ACK) { + priv->can_stats.ack_error++; tx_errors = true; - else if (cf->data[2] & (CAN_ERR_PROT_BIT1 | CAN_ERR_PROT_BIT0)) + } + + if (cf->data[2] & (CAN_ERR_PROT_BIT1 | CAN_ERR_PROT_BIT0)) { + priv->can_stats.bit_error++; tx_errors = true; + } - if (cf->data[2] & (CAN_ERR_PROT_FORM | CAN_ERR_PROT_STUFF)) + if (cf->data[2] & CAN_ERR_PROT_FORM) { + priv->can_stats.form_error++; rx_errors = true; - else if ((cf->data[2] & CAN_ERR_PROT_BIT) && - (cf->data[3] == CAN_ERR_PROT_LOC_CRC_SEQ)) + } + + if (cf->data[2] & CAN_ERR_PROT_STUFF) { + priv->can_stats.stuff_error++; rx_errors = true; + } + + if ((cf->data[2] & CAN_ERR_PROT_BIT) && + cf->data[3] == CAN_ERR_PROT_LOC_CRC_SEQ) { + priv->can_stats.crc_error++; + rx_errors = true; + } if (rx_errors) dev->stats.rx_errors++;