From patchwork Fri Nov 22 22:15:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3646 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BD7223F9F7 for ; Fri, 22 Nov 2024 23:16:57 +0100 (CET) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-539fb5677c9sf2581561e87.0 for ; Fri, 22 Nov 2024 14:16:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732313817; cv=pass; d=google.com; s=arc-20240605; b=YGr381LVfhedsM9pNv6wUVvV7qXKUD/sF+a9Rm6eHUSyegYPe/wDOLmuvjAksfuwsp z0Z3gS0tueolNJ8IfqoxLvOR0ICFXRHurR81KNKGP88IlxZE6o6klnr0arLBgbwmOvpO T30t9gpDKKlC67jra7zNkH89RAK/b1BqN9qxr8voLLiGf+le8weebhaTu8WPyI++gef4 I15S2Ujkk9a2IZWmNclCLfpzW9UgNL+QjT80oiOzQQz3kOQGzl5ACrgCAjJ77uvtKNFW oRKR+sMEgLHJUSBJ8s4WvRxh+aDujAuz1elGNMiH8VSQl4bqK9dOKEL6wjd2vb/DQVKO vq5g== 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=S5cjySeeXp/g7umK6Ypg1+k7AwBFNl9hLRurzmQ2UTk=; fh=lv96+i/vuK5vrH1H7eeXGqaSrSYlTWWajYZ6KBKhVtc=; b=QUu1cRtaZVUGxZ0sHsaeGPN/yGXSrKRGB7v4I+B4Nvpg+GL0NvpoR0enuPDW/xIho/ v4LVmlKu2sPEDLjXM2dOlHbtR6Qlii8F3rafQyjc9smulr6ClU6PIXNuoRQQzW60zavD 1VusZdy8cDdvYPSUJeQ3PgFnek88RZ5kyV36/E3U3YHY5y3fuJNVa1FzEExDzC+L1aC2 s5TCyiXJWJFSH7Bod2lv+0hGHw7eU7xvtvCr03jy/99LtCuJMcK5NjexfvubR4j9c7bq oNR6ZAYk2aeQ4U5ZKDVpalELphgvCexG7F2bO1PIfwMr0UK1gBL+d8RVacRKPd72NF3b fO7w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aYgdDnFj; 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=1732313817; x=1732918617; 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=S5cjySeeXp/g7umK6Ypg1+k7AwBFNl9hLRurzmQ2UTk=; b=TZfU/AiqgbF20HheXo+YCnrPx0rB3ZLqqhwtppCoRxB/eMtSaRM3JIDMu74Vc09aeS wHnv9TgR8oB4i2i8n5JmGR0+5cpciHmkUDy6XTCx6G+brZ69dxsgxNZw77kEFUPv2Bbo AViXQbU720FSFMYlCdBr8dOdjRI2xvK/dBIcc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313817; x=1732918617; 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=S5cjySeeXp/g7umK6Ypg1+k7AwBFNl9hLRurzmQ2UTk=; b=W+SR3FDb8AAddpqkjxx6O9+t3wxlW15aDd8bGHzzn0cKkIkwoQxzHrC2I7ND+OnBJW 1Tmvqm7JJRKQOGofvNmMFfOp+m7tAz1TMj8CZwl3PVWH99cfGv8nJ4eIfZ63MDliAkeQ xY/obSrQmyk937cJhLFuDxmSXBLL0+XDP3xaKJA784Jx2MQmsUjxDpJNZ6snfTvFQij/ xouuzEsQAybgj2oYv9zhOtCuXfLWHLJjgw6B9kS9Pgp2mowmZibWgooYhZmbv1A5BlbN wwwuChjIZir1oEIU2XGsoveweuC8hFprAagrvVDXtRDsSOp4jSvQy2p8PAUQxdkH53iH d8UA== X-Forwarded-Encrypted: i=2; AJvYcCUmRc3xyl+93H7X7cGpMh7l6jurMSVHEdxMJJkgR17Bgf/ovaHM/sRKb4+I9jMNdhC1Igj6k2vTE8MkCpZV@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YySoVfEWii/eTy0Bsrl3hE/YbTyw4ddfAZN0v28jLIBpLUJQQdX dMaR8z246OM4Ew53pWpZPSMIqwHymHSkJzsgLeELJ0rrWeXJwWn49O3EQtJ0ELxn7Q== X-Google-Smtp-Source: AGHT+IEoP5W8qdFS/Za5SCYHDkGy3OLJR6oQXrdaFjuMeMfqFn0KzHbg5qXPZqVlbRPIAZm+yx3NaA== X-Received: by 2002:a05:6512:282a:b0:53d:d6d1:3bd7 with SMTP id 2adb3069b0e04-53dd6d13bf9mr2088547e87.29.1732313816903; Fri, 22 Nov 2024 14:16:56 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:ea9:b0:53d:d9bc:254d with SMTP id 2adb3069b0e04-53dd9bc2640ls404970e87.2.-pod-prod-07-eu; Fri, 22 Nov 2024 14:16:55 -0800 (PST) X-Received: by 2002:a2e:9a04:0:b0:2f7:4c9d:7a83 with SMTP id 38308e7fff4ca-2ffa720495emr29622261fa.40.1732313814833; Fri, 22 Nov 2024 14:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732313814; cv=none; d=google.com; s=arc-20240605; b=awsXpNaCac0GlUs2wLPMRWcJ+RwelOwyJ+d5fCYozP4woO9w4R4t/fm/773FPrzi2m aHMntLeLcwaYiq7tAkyn9dRIUcLuKZ2yeM8tPfggV650c5SMs+6ifpS7p8S6Z5zM1S6q Me3rld60C3dozVANd335g/7EsStygtz+arcZWZYvXE5o1oe4ACIvmZkrNCxlZPvrQGZn 2KM7ydliLrUAdYLP2a7KH61EEatlPM75+nAb2qynw1JENqoK0LPQf4bxcvfvLuywNfGs pWHsodEJ7BDxGIRvj+p6JzbqXnu6SaRDeEH9S8GSX3uK1pvvmE4WYXLmKGbPfh9NagC+ UKTw== 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=KotHSsdWfu+c1NcMh6OyQCxQ2KHZlyrz53b2aXYhfLc=; fh=3VTzfWXoygc49tY11kQ9iQpDZ3jQQXZ2kbaJ+Hk+uYE=; b=McmGmPl6bUBRA7HZ7y2GhahzHH/IzXWhrwwgJZ+uubGnhkq8PDqgT4BukEAKJXlEf0 ZBRUfp0gW11ekAcRMIqWKY6IHuCN35f2/O6tRfXUYmXe2T6BV6vOGucKbv/Id3asYAr2 OJWLauogC9hA7GxLyl7Y2Zu1TrvvwSJ6kmJDAcv9pO021QKh+vF+d4aEJZxcd9mzbtaQ YPFf8nZnC2giGf/u7PB7eoo51aW+6TIU+GLCyVJ+n44RROMhRyt1LGPMcrwASGjjHP0F yS6BkLwJ/h5/AV5Z6jGiyXndIBVLJEc26myfuqv5Sors2tT17xIyuAyy5DfwfObBIyJV znjg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aYgdDnFj; 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 38308e7fff4ca-2ffa53645b6sor8805571fa.8.2024.11.22.14.16.54 for (Google Transport Security); Fri, 22 Nov 2024 14:16:54 -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-Gm-Gg: ASbGncuhQs8kQtCWHx0Jtd+Ga9nRC3PxLeZ0f7luxjeBiARpzTkWCzNFWnEIqfsaVSN pbY9OZ/YgAv5rTko09ywXCPr2shbBUsAcXrqEhzS0SrhmlIF2GSS9YW5SK5Xiig7TFYj0rswI9y Bh21hVJ1Ev3fIuFArleh0scFivYsNF87/BR/AJuiiLxsxB1xFcbthP3mg5ov4j7z2qtB1OXDSAW XaHGj+mpeOxVridX05PNHibVXHYEiJChMka+rjowx8KIN9NgJnhQFTBzqEUEZ55HlYKWdRS3Xqi XdWvP8ty8Tnchu2ZoyIO+0/LVzQP+LX5ZL+aUP5Lzsjs3sL1E9pZlDzQlhrKYLq6k0QE3XeYCav VNzdfZZXc/fhWz6+x X-Received: by 2002:a05:651c:150e:b0:2ff:9269:ac1a with SMTP id 38308e7fff4ca-2ffa6d214bdmr30427781fa.0.1732313814248; Fri, 22 Nov 2024 14:16:54 -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-aa50b52fcebsm148226466b.127.2024.11.22.14.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:16:53 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Akshay Bhat , Chandrasekar Ramakrishnan , Chen-Yu Tsai , "David S. Miller" , Dong Aisheng , Fengguang Wu , Gerhard Bertelsmann , Jernej Skrabec , "Ji-Ze Hong (Peter Hong)" , Krzysztof Kozlowski , Marc Kleine-Budde , Marek Vasut , Maxime Ripard , Oliver Hartkopp , Samuel Holland , Sebastian Haas , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Varka Bhadram , Vincent Mailhol , Wolfgang Grandegger , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 00/12] Fix {rx,tx}_errors CAN statistics Date: Fri, 22 Nov 2024 23:15:41 +0100 Message-ID: <20241122221650.633981-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=aYgdDnFj; 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: , This series extends the patch 4d6d26537940 ("can: c_can: fix {rx,tx}_errors statistics"), already merged into the mainline, to other CAN devices that similarly do not correctly increment the error counters for reception/transmission. Changes in v2: - Fix patches 7 through 12 to ensure that statistics are updated even if the allocation of skb fails. - Add five new patches (i. e. 1-5), created during the further analysis of the code while correcting patches from the v1 series (i. e. 7-12). Dario Binacchi (12): can: c_can: update statistics if skb allocation fails can: sun4i_can: call can_change_state() even if cf is NULL can: sun4i_can: continue to use likely() to check skb can: hi311x: fix txerr and rxerr reporting can: hi311x: update state error statistics if skb allocation fails can: m_can: fix {rx,tx}_errors statistics can: ifi_canfd: fix {rx,tx}_errors statistics can: hi311x: fix {rx,tx}_errors statistics can: sja1000: fix {rx,tx}_errors statistics can: sun4i_can: fix {rx,tx}_errors statistics can: ems_usb: fix {rx,tx}_errors statistics can: f81604: fix {rx,tx}_errors statistics drivers/net/can/c_can/c_can_main.c | 26 +++++++---- drivers/net/can/ifi_canfd/ifi_canfd.c | 58 ++++++++++++++++------- drivers/net/can/m_can/m_can.c | 33 +++++++++---- drivers/net/can/sja1000/sja1000.c | 67 ++++++++++++++++----------- drivers/net/can/spi/hi311x.c | 55 +++++++++++++--------- drivers/net/can/sun4i_can.c | 21 +++++---- drivers/net/can/usb/ems_usb.c | 58 +++++++++++++---------- drivers/net/can/usb/f81604.c | 10 ++-- 8 files changed, 205 insertions(+), 123 deletions(-)