| Message ID | 20241029084525.2858224-1-dario.binacchi@amarulasolutions.com | 
|---|---|
| Headers | show Return-Path: 
 <linux-amarula+bncBCQ4XFG47UFRBTWBQK4QMGQEIMFMROI@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com
 [209.85.208.71])
	by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3AA6B3F360
	for <linux-amarula@patchwork.amarulasolutions.com>;
 Tue, 29 Oct 2024 09:46:07 +0100 (CET)
Received: by mail-ed1-f71.google.com with SMTP id
 4fb4d7f45d1cf-5c9338a16cdsf6914429a12.0
        for <linux-amarula@patchwork.amarulasolutions.com>;
 Tue, 29 Oct 2024 01:46:07 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1730191567; cv=pass;
        d=google.com; s=arc-20240605;
        b=bvaRPuBGYEx/8m8kHMWTx85D103Gjsgbxr5tgEGDDs7sl7mTx47Q/cGMd77rBPTIHW
         Q1sP6qvmUMdz8qKmq5b3s6+cWAEuV3PtgvDAWxtpm+n4A1cR/ob6rOotSrqnehpWmQWK
         q8p8cckEkhOQDIlwhnNESF/7oIg6rq7PaWeX9uxAcPB1uixcvodRh0yE5C9kcWvNuI5A
         zkQTogPYIXKUrITfhrUr6Ao2VhqLSNvHGWiY5awCM64lxUuhucrJ6bRs8lx2AxEAXb6I
         0su3DHSE4KEvY+zwpvCp2yPovJ4R4Hj7CwnvFCIH8t0YrjR3I+/DMB5UE1j+2KjE1uFQ
         T0DQ==
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:message-id:date:subject:cc:to
         :from:dkim-signature;
        bh=M3AZj1IEV9uIlKVaVSVADgaR8iyY2N0P99iFWEPesnY=;
        fh=UNfZucA5na53AAQLhE2wb33UiMUfJQ80Lr5z9NuJXhA=;
        b=Z1gGhKg3H6/RpO8OtK7OdI0OLxxoQtM2Ln3Rp6PcSGuzPghOSku45mDd1nfSMKgPRQ
         0h2SBrgHgdCuGi3+IP2IZ2S374iytEUFeC5cELggkFA4LYBXQcdAygbOVzUnXhv2hV4H
         mbDoAKL2X+tV+gVV2I3do14MYOgZJk5DIEZQuu7NH0Wqw4eR1XgPzBLFxLzndq+kHNV4
         3Uu/GQJSWwD/IPi89zhA4eWEp7k0OW5vvu8VdAfkhZH9GcC9PWle3wb3PGj/T+UGYLGV
         tlDMivliRLyptP6kmydTW/K8fb0Kyi7bKFL1179kxIjgIbkRomP2KMBOXm9lQ1umiJXB
         5Lvw==;
        darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@amarulasolutions.com header.s=google
 header.b=YrkUtrWj;
       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=1730191567; x=1730796367;
 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:message-id:date:subject:cc:to:from
         :from:to:cc:subject:date:message-id:reply-to;
        bh=M3AZj1IEV9uIlKVaVSVADgaR8iyY2N0P99iFWEPesnY=;
        b=b+VmW33E4t6XUphjtVw2NyUZN4eOxe1O1g0GgHaBV5OO1GGHEO4u+lUDAz6fxLYo1v
         rRyvRvvjVbJdeXglc8L4Z+nTYDGsmAIlUWyv2lEGsanwvdeLOdwD/NtKPKtlS/sapVRc
         zyi/EkS4GOOq9fySOhyGwH5GkjBuNqzIE1Jf8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1730191567; x=1730796367;
        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
         :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state
         :from:to:cc:subject:date:message-id:reply-to;
        bh=M3AZj1IEV9uIlKVaVSVADgaR8iyY2N0P99iFWEPesnY=;
        b=D4vaeodivlgr7RMIQ9jA/KD0hJ1zfceFn77cnpSI/h4fkW5ry69CqKgJxM4+3w1oIp
         4OvLE/ZVegDh/mveQRqkA08SRAA8/JzWyYa4MIYv1w73qvCYt2fzvYAbMWSnVoQVSE0C
         PEpFVAmUO6TOYrv/VG2WIDSjPYwBotBMY1LedxeIs56qg1MIl7qCtQs7msKBwMtyJDZR
         HSpmIb2gL6e4I6gfA/u7L8Cp51BMK5A2J8dnS2Fi59vcu9+MfW2THJyNv7wHD7/+9yvJ
         8L9gF5Gubm0W3fcn0wWSOpRGu4js+XPN7JZgPIAMBcxwD/0vRLXnvHE5EojjUUjw114K
         FIfg==
X-Forwarded-Encrypted: i=2;
 AJvYcCVmqg9W7X+7fR1UwK/KT4eoYZYkzYe6z0jVdBlE/flvGUc3fVFJgzbePGz1f7ph0hDXC28Nk3g5Dwhtbh+n@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0YxHT5UzbFuB5iqOyPKz+pPCYlzl5FO8NsALorjTU40rGWOvl536
	FK+2Tb48iS0HBifZ+trb9wrvNeo2p66w8r8yE9NsfDUy8DBZCdlhxJ+7R051CESZRA==
X-Google-Smtp-Source: 
 AGHT+IH0LJChd0kCQES/ErkF5EGLG2xQyLYjYn3SxbpaSlxWSQNiTbJ/vCaGd+JaDrM+SJLj704kkg==
X-Received: by 2002:a05:6402:3712:b0:5c9:9bab:7c59 with SMTP id
 4fb4d7f45d1cf-5cd230dd6bemr1236720a12.6.1730191566544;
        Tue, 29 Oct 2024 01:46:06 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com
Received: by 2002:a05:6402:4304:b0:5c9:5b3:ee81 with SMTP id
 4fb4d7f45d1cf-5cb99a0a2f8ls73122a12.2.-pod-prod-00-eu; Tue, 29 Oct 2024
 01:46:05 -0700 (PDT)
X-Received: by 2002:a17:907:930d:b0:a9a:762a:d71 with SMTP id
 a640c23a62f3a-a9e2acdf85bmr137279066b.4.1730191564858;
        Tue, 29 Oct 2024 01:46:04 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1730191564; cv=none;
        d=google.com; s=arc-20240605;
        b=OfpCZly69feC3Y+sKWrIuqNlyVCskiORlRtnqih5jvwghMzmi//jLBF2qZVLb/DEJv
         GF41W5WLQBL27GNR0EgD5oqEBl/j6aPmwW1O2DCf8kppgzqyE5SSoRRd9a2OA8RXDZPL
         9cEwxHtg6ZvFfM8Hc59qgANHFR1V/x/3Hy0wqsLIY29TNH4omMIEZkcrEQ2W89WtK1vp
         BZKUlHJZ+949sW7trfdGW6+sRSBldZmv6O2RsoXKasR3E73DngvZUiowVhAAkr4LsgT0
         eOu88DKpMQdIE1051G4RIhjVSAegM0bObO85f7aAZLn7ROy3QzpLzLaJcjMIU5mpumEu
         U2qQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:dkim-signature;
        bh=FgWCepazzfo33UdtIIMN3k0wsxQsDr435va3n4Xr8tQ=;
        fh=cDdIF8D4EYVSuvpI0/52imGY328yne/aJFwmriDlhUs=;
        b=iHznetsq/Xp9QouaEOJKRbM3wtY1G3R+Cpo1GCas0R2CAg9yThPkI4XINLwnwpqBBe
         Z3D7bpepawmwread4aj/V/4JkvcTLQEgQK8wNmteOJwWaII9cMdde1TTrVyXl5/Ix8dz
         WeT1yo7Obd+UcWbEHlRCof2k/fuZC6OPOrJDumVhf5TChgPKFoQLy7yu1jyjmnOoQmZC
         6694fNiBhATPFeap2EO3et6MoeQfp8PLw5rqcmiOpTmsMaWUQUC1EZsgN106sZa2veYw
         1YejS2b8EFFynKdFAsvL6JCsBeEzDanE+4WmZUbplcPPvhilDmNQqqGJXaUkoYphvCB1
         2jLg==;
        dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@amarulasolutions.com header.s=google
 header.b=YrkUtrWj;
       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-a9af8afe275sor419057966b.10.2024.10.29.01.46.04
        for <linux-amarula@amarulasolutions.com>
        (Google Transport Security);
        Tue, 29 Oct 2024 01:46:04 -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:1b98:b0:a9a:8263:d2c7 with SMTP id
 a640c23a62f3a-a9e2b347278mr87267966b.7.1730191564353;
        Tue, 29 Oct 2024 01:46:04 -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.45.39
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 29 Oct 2024 01:46:04 -0700 (PDT)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
 Dario Binacchi <dario.binacchi@amarulasolutions.com>,
 Alexandra Winter <wintera@linux.ibm.com>,
 Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>,
 Eric Dumazet <edumazet@google.com>, Frank Li <Frank.Li@nxp.com>,
 Gal Pressman <gal@nvidia.com>, Haibo Chen <haibo.chen@nxp.com>,
 Han Xu <han.xu@nxp.com>, Jakub Kicinski <kuba@kernel.org>,
 Kory Maincent <kory.maincent@bootlin.com>,
 Marc Kleine-Budde <mkl@pengutronix.de>, Paolo Abeni <pabeni@redhat.com>,
 Rob Herring <robh@kernel.org>, Sabrina Dubroca <sd@queasysnail.net>,
 Shannon Nelson <shannon.nelson@amd.com>, Simon Horman <horms@kernel.org>,
	=?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@baylibre.com>,
 Vincent Mailhol <mailhol.vincent@wanadoo.fr>, linux-can@vger.kernel.org,
 netdev@vger.kernel.org
Subject: [RFC PATCH v2 0/6] can: dev: add generic function
 can_update_bus_error_stats()
Date: Tue, 29 Oct 2024 09:44:44 +0100
Message-ID: <20241029084525.2858224-1-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
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=YrkUtrWj;
       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: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post: 
 <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
 <mailto:linux-amarula@amarulasolutions.com>
List-Help: 
 <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
 <mailto:linux-amarula+help@amarulasolutions.com>
List-Archive: 
 <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe: 
 <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> | 
| Series | 
 | 
| Related | show 
 | 
This series originates from some tests I ran on a CAN communication for one of my clients that reports sporadic errors. After enabling BERR reporting, I was surprised that the command: ip -details -statistics link show can0 did not display the occurrence of different types of errors, but only the generic ones for reception and transmission. In trying to export this information, I felt that the code related to managing statistics and handling CAN errors (CRC, STUF, BIT, ACK, and FORM) was quite duplicated in the implementation of various drivers, and there wasn't a generic function like in the case of state changes (i. e. can_change_state). This led to the idea of adding can_update_bus_error_stats() and the helpers for setting up the CAN error frame. Regarding patch 5/6 ("can: netlink: extend stats to the error types (ack, CRC, form, ..."), I ran ./scripts/check-uapi.sh which found "error - 1/934 UAPI headers compatible with x86 appear _not_ to be backwards compatible." I included it in the series because I am currently interested in understanding whether the idea behind each of the submitted patches makes sense, and I can adjust them later if the response is positive, following your suggestions. Changes in v2: - Replace macros with static inline functions - Update the commit message - Replace the macros with static inline funcions calls. - Update the commit message Dario Binacchi (6): can: dev: add generic function can_update_bus_error_stats() can: flexcan: use can_update_bus_error_stats() can: dev: add helpers to setup an error frame can: flexcan: use helpers to setup the error frame can: netlink: extend stats to the error types (ack, CRC, form, ...) can: dev: update the error types stats (ack, CRC, form, ...) drivers/net/can/dev/dev.c | 45 ++++++++++++++++++++++++ drivers/net/can/flexcan/flexcan-core.c | 29 +++++----------- include/linux/can/dev.h | 47 ++++++++++++++++++++++++++ include/uapi/linux/can/netlink.h | 6 ++++ 4 files changed, 106 insertions(+), 21 deletions(-)