From patchwork Mon Oct 14 15:24:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3575 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 389783F382 for ; Mon, 14 Oct 2024 17:24:46 +0200 (CEST) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43129d9f21bsf11471815e9.3 for ; Mon, 14 Oct 2024 08:24:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728919486; cv=pass; d=google.com; s=arc-20240605; b=c6AB43DHEHBayNo9UZ9Rys+dw1w2/OrR53cgL0TUdn8zgPNj8u0Iic2Rp4BG+W5CQe i2reDNkVEFLzV4GGGTYp2quFaGQUKmQO2KEDzUr6O98yUERSeDSUGFeIA4JesWcgZXdf fHGR86Xi6MrW9O4G6pvr2Zx4tEl2v61AfVyBkgiSaY1VmrYHBKPrMB1hCt6qpgGPIQKl Ke+IbzkEzbEgAb4BbG7Zt6fXIOgeG8iXeqtaCFkRKwtWWjkAPXxk843rdaJnvss+fMVm WtqevElUoKWuAfzsKuV0HwkiEBz+h+3hXIfXQ9mNA34K09LT0OG1ncsiW/OMr9TWUgyk dYhg== 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=yZqH3hYrMz1CUWcaRDz2tBQxtpM/7oY47URXpeLK5L4=; fh=9RgSulVfVAMtVAezZORisBx4ABB+WvOOvEX0yv933XI=; b=VMMvL0tY/hZ+yC8BRcQ3IZHf8IHMixC6IJIdQWAntiqsUNMePUtiCt3uWp395Mg64w hw3z1/tTDlPpXiHOy8nes6rLHJjd3qupBYoD4eW7v9X7biY6ko0RS/IFABekcjXzBTIb JPWZeA6L0afvuZFlGnyb76DMNbrly0jgNwnCHsvOUAbIaBdGw//rgTx82bQ9Awk0goDf onsgPmRTj2AIrRfKhwHoBC9TLqMPqV9re3mkahtbvuQKIsHEk3OGd7aOvNE6oZnYCksw hPv2f2AiNNvUR+kVdZleXFcPeAH855nLEM7TOEfLhkjBD298Utd57/9xSsWjObjuToXG PNSA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YBG4TWJi; 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=1728919486; x=1729524286; 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=yZqH3hYrMz1CUWcaRDz2tBQxtpM/7oY47URXpeLK5L4=; b=qxVyVIHIZef7BEPZ5RS2U3wE/JzVnbMe9hInMkXlSbwLfJpv+Va7h7DM0k4DxpmcAZ F+I5kRq8ILi+2RVhsCCBRu9ZV8XxnpeES3S2Q3bA36QQTpUuZjpNJqYfwPB2ESqGa5Nm 8T8C0zORonC+Eq1420+x/Rg/WxEt2M2tllRcY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728919486; x=1729524286; 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=yZqH3hYrMz1CUWcaRDz2tBQxtpM/7oY47URXpeLK5L4=; b=ss63TyIQITFnPPMvKyX64Ks0z6yC9kmm94TlA9qSyVConwZvZMrFBS37kTbc/sZphR TSN4oOZy9ngp2emsZ7L++LISbXJ+nX2aalHpZAd7dWWo78l3DiBRrPxASl+EOjpuJWfK h/DB7X/Dz9Da+ihyma+8z2LdpVzg0HlzZDjZF9E16NjTbkk6R6ep5v7LXtVMkmFcpv1Z 1r8+pQGx3E+WzDOKPH8Go4XGeZGflpXS/QRQSYh+CbTH2Uf0FMuWclsIUHwLTXOHq2aH E/EkL/0ctoOh7gnyK/AlgvMZZ+BdlIaZvEP9Cog7OFKRzuDAjueMlDV3wAmK+823QW4q zM2A== X-Forwarded-Encrypted: i=2; AJvYcCV+Dbvs5bMXUPIlxztCyOPhlaFLn+DMfvtsHhUqUCpP9lEpa4TAxN2Yv/TmoelBGnsk7ed+gaeRvjfW5Axl@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxQfCioz6dTFQ2pXl4Ap7OFwYEBCi/fMbpdSTPmynNGpKBbesTI cDMlNmb31kWnFKeYQ8x7GICORqBuly51uz/5CZGj3eTwYh6aP9HERtgLS/A5TNeasQ== X-Google-Smtp-Source: AGHT+IE6TuykkxhPsjcAEKUGl6JcOAJNkxktkkdWrVZROk0iOtVlzIUBgJh5dkx4x0OhIl4jpup98A== X-Received: by 2002:a05:600c:46c9:b0:42c:b3e5:f68c with SMTP id 5b1f17b1804b1-4311dea44a9mr89531065e9.4.1728919485299; Mon, 14 Oct 2024 08:24:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b8a:b0:430:5356:ac93 with SMTP id 5b1f17b1804b1-43115efb007ls1612555e9.0.-pod-prod-03-eu; Mon, 14 Oct 2024 08:24:43 -0700 (PDT) X-Received: by 2002:a05:600c:6a10:b0:42c:b4f1:f2ad with SMTP id 5b1f17b1804b1-4311df5640emr98682945e9.33.1728919482955; Mon, 14 Oct 2024 08:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728919482; cv=none; d=google.com; s=arc-20240605; b=hk4sM2uXtryZzUgEpMV4Z2YQOYB6k/tIngsPAmnvEJmWgyvtz/26jV2WZ+L0YmiEBA 8utAXcIEHbyk/y8GPGq7IabXKceW9yqP2AZTsDKhaET/g7xBXL5I2oN5dS5XbkDEnMG9 WdZDeKulX5F8pSy+QX2pR7tdpcd6RaITlYazVj44hpyckhkNShaXQX+8xGArcwL5y0Gt 3OGixs/Nw4u4VAY5KKGW1Lv8lX838jFRNLZj4DSKYrY94NKJKwJn/bCnipWNov0jbvIr MK/qHMBHOu6LzprbLNKxdotP/0milCHkLXNppq9DQkhtD6+PYzC09MC74HwbziznFY8F cibg== 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=D33ySCQEEZZa2JOT2vpA/ZgBa7niJV3Ivx6AjZCV87Q=; fh=EOgCKeDwL4YA2s3akJyAn5QFKtCwGKu3YygbGh2dSTI=; b=YtmwW5TdnqArbHGqmH/ykk+5Ywd+6GBboLIUQUW2QQeBMygJGoyg8wvmvCdsIP9l0Z VCtFA6aUtFl95XGjM45J9QDO98acgQyOjkSMGgS2igjBmIuCk1bvhqy9k01KlHeamuC7 QIDo1SA6DHDXK50DLHP1Ad/ch1g9Ihd0342bKJjDUyy2e9M6UbXRTf0f43CYhV1hCJtl 1APbF9OVC+WVRjRAdpPAdkOz3n7efDdvRuGloBVnBvYCWUx2E736wXOz6+wSTmzVIh8J cKZadaMqYhrSAO5012QS/ieVz9Lsp2nMX/ConowsfSpMkLES9V2iDjAUqfiFbYM1FewD zGJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YBG4TWJi; 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-431184923a3sor29221165e9.5.2024.10.14.08.24.42 for (Google Transport Security); Mon, 14 Oct 2024 08:24:42 -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:600c:1ca6:b0:42c:bd27:4c12 with SMTP id 5b1f17b1804b1-4311ded1fedmr101405435e9.10.1728919482368; Mon, 14 Oct 2024 08:24:42 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.133]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b6bd1b7sm11629911f8f.37.2024.10.14.08.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 08:24:42 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , Alexandra Winter , Carolina Jubran , "David S. Miller" , Eric Dumazet , Frank Li , Gal Pressman , Haibo Chen , Han Xu , Jakub Kicinski , Kory Maincent , Marc Kleine-Budde , Paolo Abeni , Rob Herring , Sabrina Dubroca , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 0/6] This series originates from some tests I ran on a CAN communication for Date: Mon, 14 Oct 2024 17:24:15 +0200 Message-ID: <20241014152431.2045377-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=YBG4TWJi; 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: , 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. Dario Binacchi (6): can: dev: add generic function can_update_bus_error_stats() can: flexcan: use can_update_bus_error_stats() can: dev: add helper macros to setup an error frame can: flexcan: use helper macros 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 | 28 ++++++++++++++++ include/uapi/linux/can/netlink.h | 6 ++++ 4 files changed, 87 insertions(+), 21 deletions(-)