[RFC,v3,0/6] Add helpers for stats and error frames
| Message ID | 20241029114622.2989827-1-dario.binacchi@amarulasolutions.com |
|---|---|
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRBFEWQO4QMGQE5LRDQSA@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com
[209.85.208.197])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5F5EB3F380
for <linux-amarula@patchwork.amarulasolutions.com>;
Tue, 29 Oct 2024 12:46:30 +0100 (CET)
Received: by mail-lj1-f197.google.com with SMTP id
38308e7fff4ca-2fb44181f04sf34307311fa.2
for <linux-amarula@patchwork.amarulasolutions.com>;
Tue, 29 Oct 2024 04:46:30 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1730202389; cv=pass;
d=google.com; s=arc-20240605;
b=Txn3hPlYWH1lDBKDeoWQvUMm+MhSuTu7GBiXKtXHVp14wOGa9o8c19CQWeaDE9INYX
LOdUMvFYf6+Uc7Cm5DzPOtUKPLtIJWdjYFdyZdK6RZ1p0VDMyosWUe9SKRp2/d7l1YQE
xLgCgjOmbV58ektdrIgEt9AEwllHHspYWhk4nxkODPAXl7JtEmOu2ia2o5PYPs7GZGXf
Li09qPrOm26Rez1i5RmQ7e55nngFwTgv1MoSmGXSFh/nr5m3GMlrXxs5BmX8f7QV1p66
d223HXEA/2hVf42DeQt03zoxefP0/ssZB2TC6JWFQbeJf6q5WbZ1WAOltpYIztCaY/nO
mG3w==
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=6RWPDyRMG6qFM0vfCFA56huwkH1zVwA8418TnxNopZo=;
fh=8i38OQwIlqGdujPyKtrrsxlt9QmkXZTtw3AsQoglsaQ=;
b=S7f1NoM3HRfTM8KO4t3zZumthjZ+6PsjrzyD4XpqLt7u24VE1ogrN++sMbwG22XZgG
FpSHVL34/Du/MnNdhBLga93L75/v3GvBzS0u2Q+ij9PVhDMlI/pUTI60U1OboSoHYAZ9
2wX7wI9Xtu2CgfMtFYJk94degxrmGaGpKuhdY0uNwGHpzVCk1osCQy0xrpq5amO0Rywn
aa2YpsFiA78fHtS2emmkvmeiFe8akMy3rBomwBxd4JHgtVZ8iXpokb5873/WTJM7B57Q
bk3SosahKKyb3HTd2iP4nNZSLUoxBiqLww59jUaaUpGxVXXV/yDyT8pj8FupRiRZ5+v8
55xg==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=f8q5poQU;
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=1730202389; x=1730807189;
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=6RWPDyRMG6qFM0vfCFA56huwkH1zVwA8418TnxNopZo=;
b=FlPUkF6Oa1JXCrAvpgidSLZal7FWkn5nVgJs+RuamhoFr9Z2PfkTdOCkYdUk6lr9Sn
HdNd95hRtT8csEpAfLnO6QwWvC5VyAy0WqsP+cpOHF7P5HQpsaQ4U3uZWAbibQTF04rB
PJz1XKIWnbtF2u4dpnrQSn9mZURkR/OpYZgRE=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1730202389; x=1730807189;
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=6RWPDyRMG6qFM0vfCFA56huwkH1zVwA8418TnxNopZo=;
b=NYM++giuvpD9rrFAmMFR7ntAWUnw5IAhCgik4bjv5frWkNTSQP83OMrUPIBtsdaXJX
OTTjedmiwEH+pEbrrDkZII4Te6S08ePHN0xFWvxfJ6tlwukJRoViUtRO6Ey0u93IJLh/
llptr6f45uS5y4H19AWJnN36YfQSMWM8ojGmAW2xbI1jyaJZ26xbsc8lBj1/8Ht80Eyc
hUFN8XIU902fW/+mRuFY3OxCKw3bM0C+eM0dFqGK3PMUhU8ll/nh2UPX+wvDhCFPqzUh
XQeDNyojtM4HeFX0QOJfzcSmD42c9hAtAF/d9g8b+FCxNDUKv+ZqVM8pnx2otHwYvGMm
ZBAw==
X-Forwarded-Encrypted: i=2;
AJvYcCUEvwQ/Ov3iEbpBmzMIO+5+bwEjZt6EDp/zrkUfmCMNBuiT+YkkaDIUfQk8ygLUu92/MZWNyqZqIC0lisS6@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0YyKM2XWY96of4axmUGcvPXPc5OeIRYVf/wntifLuJehHPagYstV
mWaDsA45TeL0ci+VcQHv3LNINUNyhY4E5AFS5BI6rzp5PI2C6KXSIrGL4GEfwHU5vw==
X-Google-Smtp-Source:
AGHT+IGLGNK7k+/FpCPIZJV9/+BuTW9XaQ5Z90c+7alDqrWsCQvtvjHeRM55nfk68XzMNjAZUzbY/A==
X-Received: by 2002:a05:651c:2204:b0:2fb:955e:5c17 with SMTP id
38308e7fff4ca-2fcbe089a94mr52269431fa.40.1730202389166;
Tue, 29 Oct 2024 04:46:29 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com
Received: by 2002:a2e:1f11:0:b0:2fa:c593:661b with SMTP id
38308e7fff4ca-2fca593d2b5ls10815061fa.2.-pod-prod-03-eu;
Tue, 29 Oct 2024 04:46:27 -0700 (PDT)
X-Received: by 2002:a2e:b88b:0:b0:2fb:57b7:5cd with SMTP id
38308e7fff4ca-2fcbdf6033dmr46095621fa.7.1730202387458;
Tue, 29 Oct 2024 04:46:27 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1730202387; cv=none;
d=google.com; s=arc-20240605;
b=YccF+2wSoRiN9iItZZXtavSYZvbb44gGicQArWnASuMeeamI/V7XLlp0/DtOnXRiwg
ilN3AYu1tboKh69DhbZkMX/mty+/6qCjKESwCpAjdf/gQR+4S/WPeFsbzHeUMriBINdz
BDisZgir2aUKfJ4BlOuXvVk7mNAFw2DUmeOInYAOpl+tm5sF6nZQ1U4zkUUdl60AJtLq
k1cyhxZIFcmCq50qf80hsRB7kxtBAvBdnocKQMZnq7q2hl4g9uLV3AtMck2aLJB/0RK/
9g0p7qBVH7DyvbUkXlmdey+DMwiuDIBAfq0izD2Xg0NaKTvbReykSNiuH0+eSMooxF2K
F+lg==
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=IxDkWg/vsTbegwMYodB782ex0h2qobbSL22Fla0Iv1A=;
fh=ZAl8Bo/rN3/jGn8WDQTHNeRziKJyomAJtNrz3n3ttBQ=;
b=Dn9DWZQSC8jDzqH6PngJ/HRjXYVKKdF8kTXkSPm9ftWqiHVMq+0bSdZK1GHqH8PLeb
MRgUzbhiQyKaBPvM4+gAMufrh4CZfLzBv+qzlWhr4hGAD+RJSyp6t3F5JCZguWtOu/6e
Iius8ma0Pxsv2JCnGL314xLt1jP+KFcpmf8NGlH7kxnrYt/t6WI7HhVIMcwtI7wFc5Hr
u0uaGZyRlEznVlJhH8dezt6r3HXx/Fu4OnDurj7VYAbp3WHNku0vgWWrIgi+/dWAF82Z
mcnJ6bgvzMhANIZiGDMltN8PL/XDbagzek5S4GohOseJ5FT7kAmr4tzQLI3e9qyXypvX
jIPw==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=f8q5poQU;
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
4fb4d7f45d1cf-5cbb630219fsor3085141a12.7.2024.10.29.04.46.27
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Tue, 29 Oct 2024 04:46:27 -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:a05:6402:268f:b0:5c9:b6dd:dace with SMTP id
4fb4d7f45d1cf-5cbbf891a41mr8436361a12.3.1730202386878;
Tue, 29 Oct 2024 04:46:26 -0700 (PDT)
Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.41.207])
by smtp.gmail.com with ESMTPSA id
4fb4d7f45d1cf-5cbb6297a09sm3869301a12.21.2024.10.29.04.46.24
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 29 Oct 2024 04:46:25 -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>,
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>,
Rahul Rameshbabu <rrameshbabu@nvidia.com>, Rob Herring <robh@kernel.org>,
Sabrina Dubroca <sd@queasysnail.net>,
Shannon Nelson <shannon.nelson@amd.com>,
=?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 v3 0/6] Add helpers for stats and error frames
Date: Tue, 29 Oct 2024 12:45:24 +0100
Message-ID: <20241029114622.2989827-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=f8q5poQU;
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>
|
Message
Dario Binacchi
Oct. 29, 2024, 11:45 a.m. UTC
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 v3:
- Drop double assignement of "priv" variable.
- Check "dev" parameter is not NULL.
- Drop the check of "cf" parameter not NULL
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 | 38 ++++++++++++++++++++++
include/uapi/linux/can/netlink.h | 6 ++++
4 files changed, 97 insertions(+), 21 deletions(-)