From patchwork Fri Oct 11 16:23:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3566 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 570733F332 for ; Fri, 11 Oct 2024 18:23:47 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5c934295846sf1586105a12.1 for ; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663827; cv=pass; d=google.com; s=arc-20240605; b=LJKiSuA3Z+vfLGa3pZ+btKuXHyXSBGXn2aPD6pDnC9gAPb2fByYvJ4HVWHXYQFF91g CItuWOx/Iky3jc1dhvyrDGT609Psyh4a9FXvSJ6NWqJphbkfNgjx5YgJys68JzFdO3g6 ptXrUHLCf8jl3d4Mq66jq1crP3SIsZgb28ToF/7jUgzgE+Z8w0ppDS/h2T9mZ19UeTJY pkwV7xWMNWDwBohGHKUUJZxYSyjfSJ4oFE42EnZVn0InoWmRAG41H1GwIDLEaZuP/qlm 8IqFyfRhQFBGtmWjTQbxChQPsaol9QoiS2at60t5G/gmoxi4FJXE5cN4K0rlRt/i2K5M xQSA== 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=eHcixfgDs0PzmOQj2jmSse6ycU/j4yhgVhQtNY3gYcA=; fh=omSvidafdeU+aiIAVzsKuMweeU4e/kTnIRYX/mYCrQY=; b=hEtdgEg1qpUY5MrFY+XY+WgWmzWedL2n74+MIEKGUS42lB2U7IA3V+Ux8VYuW3nbbA jtDkqWo+D75oKkt68VtUVBYeiviTfb9j2znfVUh5vRJ1bxj5P7ue1pTeVIC6bvQ25QxY +NAUJbfFv6slUsZV5ao6Z0XwIRgDO/J6TLmBliw4o8bWswiw8OA44j/aY1njolbBReq4 4OK/+xwAA5uRUATD2Ok5lQQk1TyYe8qx2apJAnnk90p1+UhwDcA3Yg5IiT8zw8D5hHDJ LnYFIkDTD53iY7K5ZOsu/s15TTJqRcoAXYbVmIbgfDkCObkyIcW6se3GIw8sO5Dh+zT+ ffdA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X19hJhkY; 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=1728663827; x=1729268627; 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=eHcixfgDs0PzmOQj2jmSse6ycU/j4yhgVhQtNY3gYcA=; b=JbJ+78q2/0UIDPqzMYxaax4+f0cAfPFjB31g/i36oFBvH6iM2ti7w1o2aQSoYhjDz8 AnT19CwA1iRol0B/qMgFAU22SXfSFH2kuYFAxf9/H8BlA/+VMjW+kHE781k08agqEEyl NYCHVvK3G2QM5OuG/qnv6rnVTWeJIosODQGoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663827; x=1729268627; 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=eHcixfgDs0PzmOQj2jmSse6ycU/j4yhgVhQtNY3gYcA=; b=Bdlu0QyiJl4CxNXCe/am4tpk0TxFtT8qGoNzzXBJaWSdUfnHck+nv3b+5GLt1d3FMI ByJw7hbkiN6EJjpzNctMYFFehCC1LL8oAIig2z+nvYflyVnbCVyK/3T/1A7Kbvv8e0Pp WIy+1b4adMBmbwjpAhfxi6r4tslHM2PBVjbG9QrbM1+2C+A2eqguwm1DJFG+wbzH3sNs 4v6iLd3HzDF25JIbxxWjZ0/FuWTwMKLsUG/g9iF65MX2nMPhOiyynsT4Dk5p1hWSt2ia MDJpZuMnWOKmJz6NDGpYeE4hr4D+PMl/PiUhyRR+mZRM0GxJR0uZPAjY003RCPV6MnH4 lckw== X-Forwarded-Encrypted: i=2; AJvYcCWou4s58oiWM3DquQQapgtLCXhcDe2Ic+enorDph/cQNN6Ug+/kS++9pV2LUffl5fz3ZWaaGzBy8HUePnRS@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyRmljWvRQ4y70TtTwQh2AsB9J4RRXcljINLrkeDC/kNSSP/0Po t4gpTzEnWqdxRgIgQmpZ+iBnjNGn41xN8igmvAsXGH2PoJxaudAKqGx6Y3MMeJ6Q2Q== X-Google-Smtp-Source: AGHT+IG4Xl86E1N0jeJCogX3ZH4VD8AkQ43cvZloNLAI9tgk56CmGO0AYUbejUtbqXFw576EuuEnTQ== X-Received: by 2002:a05:6402:274b:b0:5c9:2a8c:8950 with SMTP id 4fb4d7f45d1cf-5c948cc83f6mr2090620a12.15.1728663826454; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2683:b0:5c4:6c19:f74f with SMTP id 4fb4d7f45d1cf-5c933d3ebeals415451a12.2.-pod-prod-04-eu; Fri, 11 Oct 2024 09:23:45 -0700 (PDT) X-Received: by 2002:a17:907:f78e:b0:a99:ccab:8a8 with SMTP id a640c23a62f3a-a99e3cfdeb6mr19060466b.39.1728663824619; Fri, 11 Oct 2024 09:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663824; cv=none; d=google.com; s=arc-20240605; b=DWv5uErlASMcMHMj8CEmh5yPBFwY4nUwf+jZDXPePr1x6u7xzNUM21AXquJx2RV6Sf w97O9YMpJIPxGhXoY5gBifHS1+WS7/7PsrAAOQ6ZrZct5iRPVfQ1zguS3ET5+N8sewOX VijoYgBzxDPiFFqOn3drMl6cn79PGminrw/4xkmHJtU0CPpB0Y/of9G13UWZclbW0C3p YeUktaTRwdhcslAt7CClzCVt3Db7JyY336LdkyESNcGOJZfEKUlSGlpf/jUTH2vuqx9X 3MjC1qH/ouvHKvGlxNkwUx8jAiG5vG0CvUz/NUy0Ci+ljtBScswYv46cCanvE5FtwGp+ VqBA== 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=SMNtp1bFBYMSj01ryYWUuajoWQ0fWID7a5OmlHE1F0U=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=O32sTyMSBOOY46NGpxtYzRH8i6yFxEWkUk2tRhEwaLCMn/EBxHPMV3JvfZqSg3aTpq tiitU89rj5ASSUaFZQlwqzbs/XQOBNDhv5D0njOXu1stTdXs+Kd4TVVZwq6HYdaq/w06 +p7nJ64OHOsdRuOuXFsEnbuOyFsn78Fqi8ryouN8kz3QZJIZa6tKV37WPticrfTdGLdm fs03DGSvJJJpmlDdJ7tVlNbBP9TfRbdyfhsKA2lMqUHi2IN2SfxKyGDxKfzmenKRl7wl ESl0PI4jZpKBvMz1RQW0aEAkUCQTSqLk004iZ+tM3IFtlKrgh+EMu4ivLp46LcEYDXZ8 Agbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X19hJhkY; 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-a99a808b9a1sor152575366b.12.2024.10.11.09.23.44 for (Google Transport Security); Fri, 11 Oct 2024 09:23:44 -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:e685:b0:a99:491d:20ee with SMTP id a640c23a62f3a-a99e3b5e571mr21408066b.19.1728663823886; Fri, 11 Oct 2024 09:23:43 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:43 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 1/6] can: dev: add generic function can_update_bus_error_stats() Date: Fri, 11 Oct 2024 18:23:36 +0200 Message-ID: <20241011162341.606443-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=X19hJhkY; 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: , Signed-off-by: Dario Binacchi Change-Id: I55e0d86725475fed08e00afaa494973632bba850 --- drivers/net/can/dev/dev.c | 30 ++++++++++++++++++++++++++++++ include/linux/can/dev.h | 1 + 2 files changed, 31 insertions(+) diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 3797d4de254d..c153015435fe 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -325,6 +325,36 @@ static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, return err; } +void can_update_bus_error_stats(struct net_device *dev, struct can_frame *cf) +{ + struct can_priv *priv = netdev_priv(dev); + bool rx_errors = false, tx_errors = false; + + if (!cf || !(cf->can_id & (CAN_ERR_PROT | CAN_ERR_BUSERROR))) + return; + + priv = netdev_priv(dev); + priv->can_stats.bus_error++; + + if ((cf->can_id & CAN_ERR_ACK) && (cf->data[3] == CAN_ERR_PROT_LOC_ACK)) + tx_errors = true; + else if (cf->data[2] & (CAN_ERR_PROT_BIT1 | CAN_ERR_PROT_BIT0)) + tx_errors = true; + + if (cf->data[2] & (CAN_ERR_PROT_FORM | CAN_ERR_PROT_STUFF)) + rx_errors = true; + else if ((cf->data[2] & CAN_ERR_PROT_BIT) && + (cf->data[3] == CAN_ERR_PROT_LOC_CRC_SEQ)) + rx_errors = true; + + if (rx_errors) + dev->stats.rx_errors++; + + if (tx_errors) + dev->stats.tx_errors++; +} +EXPORT_SYMBOL_GPL(can_update_bus_error_stats); + static void can_update_state_error_stats(struct net_device *dev, enum can_state new_state) { diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 73199facd5a4..374b6121ea3e 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -200,6 +200,7 @@ void can_bus_off(struct net_device *dev); void can_change_state(struct net_device *dev, struct can_frame *cf, enum can_state tx_state, enum can_state rx_state); +void can_update_bus_error_stats(struct net_device *dev, struct can_frame *cf); void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, unsigned int idx); From patchwork Fri Oct 11 16:23:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3567 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6F4D941386 for ; Fri, 11 Oct 2024 18:23:48 +0200 (CEST) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-539e03bfd4asf831821e87.1 for ; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663828; cv=pass; d=google.com; s=arc-20240605; b=eZZ7NkCuPWFFcHa487ibpDhRNP0ZRczVWUvJni31Z5FgLg+mR6SdnzONfRJO4LLikr tjqLIX0OAnmm9gsvYaCb82uVuET3g0EZXezBOsLvHcBha/yE1dq8Zqdmktzr2P1F8bGD i2EGWZWVZP4/9xvgGdwCwjLbgBjuacdKaR+x3h6lIYROkNwRNaQNc/+QCl3oXS1s+EIZ tVNpbeHy7ewDsKE0NOPsJ4W/pt6wsN9swsVJTyX1nekZqfdR/O+qjH/CWbHb6Udv/3Ek muH/QKWppRh3REaI0TC8roKstg6HL7JkWz51W2GNvl62WzHnv9ACBH5ungKmxQJhGzc8 0FWQ== 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=Ngk2e/VtOITkeO+47v2e3jDI5KspNE294ld7gRqxGk0=; fh=F8leb90HEB7Zx3rhjzMYXNrRgRPknbRyTaw+FTLcudw=; b=HNWtjh8hmUWoxcy9H+UT8RH+sORdaCor47wwkaPEVCJ+Z9AmBh+AoBi2EdoMWY6UJl OToTq8NxOREmF2H7ml3KthPQjNSeu44rFV0D8+EnFRKuc8fnBAWAyOaSgte+nzoaGgx8 YKmyEOLTsNYpSfKUYX0fEYcu0/CUz1eYWfzyJQq6rgtfGt03kqS41k2KFGh1dY+YW8UT 2tXIHX1s0A1R2hShg6ijqa3ErT1G4hOexQuTnzmXKT136fyjYpHq7badpG5CwYB5dxrh ebxT4IpDmSIxSduXMGu8wafAvZfZ6wdQWPZFVgDIc0AQkagfNhbdRDeXq0it6ARoTGhF 2f8g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="n/inYlnd"; 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=1728663828; x=1729268628; 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=Ngk2e/VtOITkeO+47v2e3jDI5KspNE294ld7gRqxGk0=; b=hVfXBqr3/HCtpNW77BH8US42Z9VcceYSTiH48FD73QkVhbsR9YswI6T2jvHfo0BJ3f IqGeEGxnmr8NFS7N9IWQ+CnfUpgAiN07ZAI2BGeeQO9NkcWqgSrezLzlaWqRsczBnhh7 nnhCe9EsLMvmsDiTwd5UhlB2Ab0/An4Yme/Io= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663828; x=1729268628; 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=Ngk2e/VtOITkeO+47v2e3jDI5KspNE294ld7gRqxGk0=; b=hRsdFgMo/jXl2SGL5J8JD0S24LYTFdkzW9RH8TP1WrvHyyJEEWIxHy3zm5FG9P+pwQ VIhnN+TORGRa3lx1Zb7+TCKwQKOZVG8DG36Va4bowH4PKKryz8IESNsg/1+nb10pTSMw 3ZFoSoAxMaroCIZWx7f1ZVsVGoMM9Qcmen5EdnD78nHQdxckYyD7WxTwPkZNqGUwA5rH agO6L+lBKaVl3B2xM2lipF7NpVmwkWLy05oOw9TC41JviDHuwSKkTeXktjLhDytDOMVp 3UzDkY76y304z9qR8Z4OAfFrQYfmLH5o4jg+sqMhLwlKnswvIGAi/XCCIGQmOoKa2poS sXtA== X-Forwarded-Encrypted: i=2; AJvYcCU0UdyqwzFLna0kEcs7ttCYWU7JQAbRqwRxlWMfS3Pm3TP0vfVZPRjJ0P9qDv6DKlPmCegP8ET2YVL0MVKD@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy3gOL0n2ADqWxUHmKGAGJu8LpPY7o4LpHhYcn70KukKzMb7Ari cjdC7XzbtsaOC0fJh1RF6IcV8GikEWcUB3onYlQcW9FqGbuNNi+VX+fp0wLt1Kidyg== X-Google-Smtp-Source: AGHT+IHweC/S4y2MkmTWKdh1cBcsx0PDpx1vYLkNLao4+yCsYZwE2H9Wqx1dBS5qg9XDlP7hjvjxXA== X-Received: by 2002:a05:6512:3b9c:b0:537:a7d8:2425 with SMTP id 2adb3069b0e04-539da599296mr1499189e87.60.1728663827324; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d0e:b0:536:53c2:bc36 with SMTP id 2adb3069b0e04-539c9bd81e0ls167503e87.1.-pod-prod-07-eu; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) X-Received: by 2002:a05:6512:3d8e:b0:52c:e17c:3741 with SMTP id 2adb3069b0e04-539da3b68bbmr2119617e87.5.1728663825616; Fri, 11 Oct 2024 09:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663825; cv=none; d=google.com; s=arc-20240605; b=RHP15476FOf/hMDju4BfoTMSQTKUFGNQf907EkcpPbN+3YMqYffawervQn9V21Kc5k yk+zPDcXU8e1u0nzB3m3KZaiQuuIrhIM5CNNYnydaKartQiSji4jwaacGvJeDibhGEkT s0jNfoi7BEseL3juTyAlJN78BFiwJlgxubUwusOSrjqPgIENJs+ljbqI9gokNB2oHBhs N8P6B/T6fxD2uqHyAKgvb3cu5vpM9prNCVaj7vTAxQSnIVv91JZ0CbJrQiPQKKX3KtQE JmppM85DH7A6MrtPr/U1eUIdxaTAKtmg3gkTxG799JrnTDZXxTSEZtOsozjWOPwgYcRE jLJQ== 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=BnAJ5yzfxpuQb3ROFH03KP/0bIS5fcE6s0IUJTXZdMA=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=YlfhICgO9Jb6NuUlU41+rc96FVXZu3SkYHSuxHn90KC+kr/5BOj+mNzc7AWFi2WIvd 61ng8G709A1JR/vTpFXELzG5iZ56gYpzsRcwEReFlrmPU1b3njSgh+OhxsDRT3RMxkmE Xps/I6j8yFxnzgAOH2lVvwwEu/m3E98Vutm7iX2cA78lVdhVGLMlSC0xSmgejrLgIcXY Y7cS5yqXEBCU2pKXfEFvnKlttb6Ydb1CltjJRxhvUxWLPtl0oMFGlhx+XCQ/4WsC7UoR 0gpQuE36pzwf6sITcOovRTHG0NAYL7XDScs8xgchbOCDe3PGsiBuXEV0ibMmKNGWQD+f N+aQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="n/inYlnd"; 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 2adb3069b0e04-539cb8da260sor1416378e87.29.2024.10.11.09.23.45 for (Google Transport Security); Fri, 11 Oct 2024 09:23:45 -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:6512:3408:b0:535:6992:f2c3 with SMTP id 2adb3069b0e04-539da5479b9mr2104416e87.41.1728663824837; Fri, 11 Oct 2024 09:23:44 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:44 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 2/6] can: flexcan: use can_update_bus_error_stats() Date: Fri, 11 Oct 2024 18:23:37 +0200 Message-ID: <20241011162341.606443-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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="n/inYlnd"; 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: , Signed-off-by: Dario Binacchi Change-Id: I897083c23f61d9b51c54f663dee9c2836aa07339 --- drivers/net/can/flexcan.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index d2625f79b033..a67b1a26200f 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -571,7 +571,6 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) struct flexcan_regs __iomem *regs = priv->regs; struct sk_buff *skb; struct can_frame *cf; - bool rx_errors = false, tx_errors = false; u32 timestamp; int err; @@ -586,41 +585,31 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { netdev_dbg(dev, "BIT1_ERR irq\n"); cf->data[2] |= CAN_ERR_PROT_BIT1; - tx_errors = true; } if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { netdev_dbg(dev, "BIT0_ERR irq\n"); cf->data[2] |= CAN_ERR_PROT_BIT0; - tx_errors = true; } if (reg_esr & FLEXCAN_ESR_ACK_ERR) { netdev_dbg(dev, "ACK_ERR irq\n"); cf->can_id |= CAN_ERR_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK; - tx_errors = true; } if (reg_esr & FLEXCAN_ESR_CRC_ERR) { netdev_dbg(dev, "CRC_ERR irq\n"); cf->data[2] |= CAN_ERR_PROT_BIT; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; - rx_errors = true; } if (reg_esr & FLEXCAN_ESR_FRM_ERR) { netdev_dbg(dev, "FRM_ERR irq\n"); cf->data[2] |= CAN_ERR_PROT_FORM; - rx_errors = true; } if (reg_esr & FLEXCAN_ESR_STF_ERR) { netdev_dbg(dev, "STF_ERR irq\n"); cf->data[2] |= CAN_ERR_PROT_STUFF; - rx_errors = true; } - priv->can.can_stats.bus_error++; - if (rx_errors) - dev->stats.rx_errors++; - if (tx_errors) - dev->stats.tx_errors++; + can_update_bus_error_stats(dev, cf); err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); if (err) From patchwork Fri Oct 11 16:23:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3568 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3C50C3F332 for ; Fri, 11 Oct 2024 18:23:49 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2fad1771626sf19497931fa.2 for ; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663828; cv=pass; d=google.com; s=arc-20240605; b=SeblKf9mjOy7IL6taHdGKjcYAp//+MMiOdxFVEoBVF/Hb3qlf0fo36phI+8Ujt8PBg e9BnFI/iibxFXV5nFW+4xgNZCE6v0yEvHAuk5FuX/u/c/sho5LFAqqFGV2ek0zB+7POH g5Ehg54h8BuRZ3xKXFe4hzsWbcpQDnwet1iTJcEKFc3WjJdHC5AlZcZZNHoAFzEAQRKL lyGnJIa7/oK847LMDoPWEa+1fpWPLZ7+yZMJNt/6t+8i6RmuL5LGOYV+FEA5vdpzQdvb v5hRjC64dRWbL6mHuMRrJnnQanllE69Yzz22VsQ2A9BbzdnzajM030coKY7KiCRE95Ax PX2g== 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; fh=16MRkmWIA1oqSoqVOSY7ZEEZd896U55xd+QGd9p5p7k=; b=IMD87aqQP1clnpqxx+lRxYCeO+jy4CHobhLCqxLmy5r1sSPBj3/AGwqRVgkDkT8LXv xII8rr3mTrI/S4zqJXqT3IftvLwJ9H/wFx27cDofZIgzVAgPloHbt893+xX6+1mFI5gc iH9vdw39IF9bWos7PKj6GkitV7XY5VvsYc/Yrvv49UvJR4WogbHhyXtGzYg/6HCS3mY/ fmdqIowxbnTup/1et99gKLVC2xe/fhW/LSD2IuqFlBjGz3F9jgkKm7QBUx69nr5uljdY qAGIUkBie6qpIxfbbh19W0IOd1z9BXDg+0c4E2AQ9xLquy7mXd/IYloREBCBCbYnjlbU SsyA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ULzAGHwG; 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=1728663828; x=1729268628; 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; b=Csfg0wVOljy9/lRTV7aOVxLVdtCjWK+0D7tdCANGCt0M0Yar+pgqR4tQMivp5Dhzqb /lStX5tgozCZalXbV+MeoGfA8ccVTlPn6Zk/YPZATUmGNbh53M86An6g6UyNNQyyF2GG pI4LV1KgxFFt+ffyFF2cv61lNQPZdYfKKiSr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663828; x=1729268628; 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; b=q2PpwhQflWi2U4sksFCcMAXvlzCU8wWGdlOKglKN9I6SbyCX7NiLS7VG0bTe2q4AfS /0roWSi9/r6rjgd06sxwEv1WcOr0omjrRQsVG4Cez+y3JArBKmHYkn7iNB0bjw2e11c+ oQF+Ru0T6hZRa4rtxHU+CVTMVw72tjGz2iYJZ569uKvN+C+GP05yTxEPr5LmtC+heFWz mPO9t/LZ3S2GKvsWT634aEoB78WTLqDKsSxzcw+ijr4Ttl3Oe98/cX9TB9ehkQX9DycT aoDOQ3Otar16Zol4rR/OU2BflK2uR8Jg2e1jFcttqv44pmS+vj8Hj2lk6A6kcONmMApj IZaA== X-Forwarded-Encrypted: i=2; AJvYcCURql4pthdKKiZBhLl82ePXltkz85kB0lsjpXYj/HPL8hwzMTHbbj8PlgQI/vbh5yoCZyuics+oMCG+ixY5@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxServV78EwPMc9uF0UJ6w6zPCBnywAimTZCz45osLCH1Se8pcv VleLBPhe1czh1x5kBwftHbpnlh6chtyv2lxztmWRRWk4n+VV7sDyUrpbMqem/ly8WA== X-Google-Smtp-Source: AGHT+IE/Wm4y9WaZbkAe6qinJ5MDOTb0EnYqU1Gt69fjuYnAhzQtFk1X7BaWv3vVFklm+y0w0kJfDQ== X-Received: by 2002:a05:651c:1546:b0:2ef:1b1f:4b4f with SMTP id 38308e7fff4ca-2fb3f2d1b1cmr707441fa.34.1728663828430; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4314:b0:5c4:651d:a532 with SMTP id 4fb4d7f45d1cf-5c9338a4c28ls131144a12.0.-pod-prod-06-eu; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) X-Received: by 2002:a17:907:7296:b0:a91:158f:6693 with SMTP id a640c23a62f3a-a99e39cfc56mr24333866b.9.1728663826755; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663826; cv=none; d=google.com; s=arc-20240605; b=cKuMkaWXVOoFeMqBPjADMRCj0eY/j6yLONO98J5eDQfciKzhhsYGjOn0c0JCa8cRl3 JwifT0nFXYXbRQUQiAD5nUOlu9acKClElXiGc0DgdXk8O6DgODEyf7co/Z7hXWscbC3y fBi9MDRp+aZTmrSt6u4wFFeGTG3XiN/oz/cerJ4lRDkhk90Ys18GJobXw/5IyNthBH+d QYqTlc7wtHapgTMHQNWpOlJI4HZatL6CTIzEueg3Pa08HvBXp8UB6R4UyttYX+EqNnbQ 3rIKuov9tCignqw6Wv+Vmd1as87s3C/AeWz+tQABaZwDxf+XX31C1B7DUt/ntf2GvFPY mjLg== 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=fWUGm4hFKdFTmtAVfL6AreAZCHr4wergqksaNPubSFY=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=Rq7MHuMgBB23edkgzdJf93hmHR/OqDUVSlwkbJcRtypHtm9E7/vJMGnUbnPuFQygZm a2vfXLggizq8ccKyuDP0gkfbQohjVa38GMoMSE7bBcOUkShnsVmJjOK5wzHb4iv3FFTF Uk4RSTZAyWRSiuYICLn+D96jNP++BZi0metwWp+PjLEew6CA+U+WTH0Y6LnwgroYtCgo 9GHETplHFI3LrkxRWd6m3J/Pz7OwuScdIu9I/Ik1v/aJMUcJ4QZCrQkxIgA0fm/hGbsE xadmukPMt6VDzOMK2KnZXyKKqYOz9E9B9ukpI/+a8nQusamsiQYH53gG1NOnPYktIs5/ wPJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ULzAGHwG; 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-a99a80e05a6sor155781766b.20.2024.10.11.09.23.46 for (Google Transport Security); Fri, 11 Oct 2024 09:23:46 -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:948c:b0:a99:4f40:3e82 with SMTP id a640c23a62f3a-a99e39cf797mr26854366b.7.1728663826162; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:45 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 3/6] can: dev: add helper macros to setup an error frame Date: Fri, 11 Oct 2024 18:23:38 +0200 Message-ID: <20241011162341.606443-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=ULzAGHwG; 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: , Signed-off-by: Dario Binacchi Change-Id: I27a5eebfb6ee74d2af3e8455d96af9dc317bca24 --- include/linux/can/dev.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 374b6121ea3e..018b9e942ed9 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -21,6 +21,29 @@ #include #include +#define CAN_FRAME_ERROR_INIT(cf) \ + cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR + +#define CAN_FRAME_SET_ERR_BIT0(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT0 + +#define CAN_FRAME_SET_ERR_BIT1(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT1 + +#define CAN_FRAME_SET_ERR_ACK(cf) \ + cf->can_id |= CAN_ERR_ACK; \ + cf->data[3] = CAN_ERR_PROT_LOC_ACK + +#define CAN_FRAME_SET_ERR_CRC(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT; \ + cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + +#define CAN_FRAME_SET_ERR_FORM(cf) \ + cf->data[2] |= CAN_ERR_PROT_FORM; + +#define CAN_FRAME_SET_ERR_STUFF(cf) \ + cf->data[2] |= CAN_ERR_PROT_STUFF; + /* * CAN mode */ From patchwork Fri Oct 11 16:23:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3569 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EC55641586 for ; Fri, 11 Oct 2024 18:23:49 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c9452d6344sf818144a12.3 for ; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663829; cv=pass; d=google.com; s=arc-20240605; b=dOkKedZswimWy2/OmpI/ku1i1DQw6qFLYAzWbzke3I38/GY4w+l3zpGNoaLUHF9LPm GXP7Tl5PJ8qej8GbbFMAoTHszO/Q31+NLYYtdSZ6U+IoqNRAuph3Vr1xxWk93SdI17Ab +Lq5xqGo2dncCihFj9vZjObcAjvKsbHldBKHcfRMivSsMNKV1tCO8YyMbeXKj3CRpjcm echu3GJXuSOly0/rgBbkG2O6yfVTVwimWkcKfj4uIulWxB9ZuuLIPQp+t+9SjE+QdegK DxrYwjDq4ZHWbfPQctKgu21XdbQQKyZTBrzGNkB9i2jL6hGB9ckXja013u5iveh9VeBP OXTw== 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; fh=0pNUiW1Yr7RzCm+ma9G7TV0Mb5S49+ciu3zWgTDbgxA=; b=HzGy2GF55KUEeUYUYSU4gi2VKVRECzcbd9VjwrKSvx9eNg8BdM0nAvisNqdWllsACp sKa/C2j6fUGBHdyc3DU5GOzezn1i5pmYCqIl5tDnJZLSCD1uRp7m/0jtsnc9WCEHK63i OIg67893CrAvzGRQoB64nV+6z2B7yHWSHqM+2Ru3mSwWWDfkcMl59Dl7zjXNary9kgZW SKJOatUw/4jyGLQhRyhJspZ9Hrhx5mcrqFb3e6Ujyi4CEnvUwSlttHQ9SG3tFOW4to6j ekShC/ZvsZpwbSjsIY8kBox4ko+FdJ48MzRwP91hAIiFrf+OUN/g1zhG6GmuFPQIpb/E msqA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hkAvJf2Y; 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=1728663829; x=1729268629; 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; b=EBuOi0VL+4FAM9T7hSJ0f2EEC3GkGmj30SWCOt1fDyyziHqWe92H0bhygjI48PeoNk HyFAKdzj5OrDTWjWc4VjbP4lvKf8TMb7pnSpcZg56v3FBshiskAskCEUpVHCIjDswdMz BZZ8AewVvy4zlscicJ63SeZPiRGLUCPX1Pqxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663829; x=1729268629; 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=QELHU5azoKNQ9OLC2aKk+4eR0Oc/KtCsMk7+UZ6Ugg0=; b=q6mYigyl61Pt5nZosKv0ogdduYsT+fWYnX/ADms/JbZkK4bssYxITiYTWWtcjZQk3p IxIU/ze8w0SFOD+0E5p9AfMnrWv0sU2/RSjUqx1tOIiNCQVcpJ9NvkrSHw4HFQvdPn7l 9BmNfuRXjo/2Aliikg2m+X7j6xDyReHNC5EZo3G84NQLjauhYcKiS85JqB8jt47h2hn4 u1p6yp9+tQW773l6XekB3tCLAeHWs7D2kWhzCETZMD5ZyVlaqLoza5EGYqHtLQyZUhnr 49dqjWDJjw95FRBohZHrd15f22r6NjZI7749T4pCOKDySAlnHV84okH8YpZ32tKcm0nB DVuA== X-Forwarded-Encrypted: i=2; AJvYcCXugYhuI9Ik4Hhu3rkzXCsEdQXlgkAmXqc0GAcRFU82mNmGxcBlQjxoRdzGz5+MBpKzqkopUR2Usqsepxkb@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxFLSi0JxaHAqh4sZi+iiI8gX3ObI/13fvInyIZJPQ5ghARc6h6 NaY3QgdgQ2WdY1LLFX+7W52VpTfzCnP540HAm92QEQXUWX4PJDUA8zJaw1gzpddDUw== X-Google-Smtp-Source: AGHT+IHg2o95vBnwwRHpnF/XUL1Axl2jPUxyuVK4z3wVo+Btj/K3mMg2vmQpitaq8SSFTFgmUPWqgg== X-Received: by 2002:a05:6402:5ce:b0:5c9:3f2:15fb with SMTP id 4fb4d7f45d1cf-5c948d4a129mr2392996a12.24.1728663829239; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2683:b0:5c4:6c19:f742 with SMTP id 4fb4d7f45d1cf-5c933d473cbls242842a12.2.-pod-prod-02-eu; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) X-Received: by 2002:a17:907:d2e8:b0:a8a:4e39:a462 with SMTP id a640c23a62f3a-a99b943bc4bmr267023366b.7.1728663827596; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663827; cv=none; d=google.com; s=arc-20240605; b=SFf6yIu/KC73Udx4HjjfEeNJDQrZwpLfsFFzVrD/Io96h43W/hxYPbppXA+wkYwYFK 7Wqobse6S4loSVbg0mxLdYdQmH/cOfJamvxDKgJ4ZQce+3cJNmTa35xJt8BvCaRln3PV PlMWIl7lxAvMU+kn9UXxIZCCmk84petuRdb64t84ZPHmK5aTwm1itzfI0+Lj9RRUpZEN osnfy2pNpw+Ah73j6KxpBp+cRazuQ+n7/cAfkxB3yU3wq3l7Co4F+I6X56P1aZtdpmFR vQSkAz3s8KTLWWbgrrtK5pFnj4DeqzcPq6cz3b+2LzYon68PxlrBiYfcbzhXlagaVIlI PvSA== 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=d6+BtLEOvVaPgyhiafPGcVcII/P+adzXivzmieD9IXo=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=ZMXhSgXpg3af6fcvJSIF4DFP1ltZMASCoh/bvUm5nNj+PH4sVfX6SmQGe8nM/qAFqd gJ6qUUw2m3UwB0tZmSsN3gTNaLbQQhwysUtHCIe8X/HsO3xMzVqbmGeRtTHUQcd6UZD+ CWXkh3CJcFty38NozwhthmoFnHPBz1RfCcEu2YoGK86UW/7NYYsOaKG9yBjCMSmQK0my AsuiM+ysToAO8vT3uBn40wmKiHg/UoffyWxpSfa531sWgm5jhgQq9PF7PjZ7cKy2APdz g6vgQ2X0caDoh0Ny6yGRMQgKvRDGBoW236Wf87wauGazdeaqZfhxfo8lcE6j5JbGXm6V LW8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hkAvJf2Y; 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-a99a80c01f6sor141826766b.16.2024.10.11.09.23.47 for (Google Transport Security); Fri, 11 Oct 2024 09:23:47 -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:906:c14c:b0:a99:53cf:26bc with SMTP id a640c23a62f3a-a99b96b0c3emr314189866b.44.1728663826967; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:46 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 4/6] can: flexcan: use helper macros to setup the error frame Date: Fri, 11 Oct 2024 18:23:39 +0200 Message-ID: <20241011162341.606443-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=hkAvJf2Y; 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: , Signed-off-by: Dario Binacchi Change-Id: I129dbe666df6e8ad6edf8ecf4fc3e5a08e8f6c13 --- drivers/net/can/flexcan.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index a67b1a26200f..416d60fe59e2 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -580,33 +580,31 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) if (unlikely(!skb)) return; - cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; + CAN_FRAME_ERROR_INIT(cf); if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { netdev_dbg(dev, "BIT1_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT1; + CAN_FRAME_SET_ERR_BIT1(cf); } if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { netdev_dbg(dev, "BIT0_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT0; + CAN_FRAME_SET_ERR_BIT0(cf); } if (reg_esr & FLEXCAN_ESR_ACK_ERR) { netdev_dbg(dev, "ACK_ERR irq\n"); - cf->can_id |= CAN_ERR_ACK; - cf->data[3] = CAN_ERR_PROT_LOC_ACK; + CAN_FRAME_SET_ERR_ACK(cf); } if (reg_esr & FLEXCAN_ESR_CRC_ERR) { netdev_dbg(dev, "CRC_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_BIT; - cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + CAN_FRAME_SET_ERR_CRC(cf); } if (reg_esr & FLEXCAN_ESR_FRM_ERR) { netdev_dbg(dev, "FRM_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_FORM; + CAN_FRAME_SET_ERR_FORM(cf); } if (reg_esr & FLEXCAN_ESR_STF_ERR) { netdev_dbg(dev, "STF_ERR irq\n"); - cf->data[2] |= CAN_ERR_PROT_STUFF; + CAN_FRAME_SET_ERR_STUFF(cf); } can_update_bus_error_stats(dev, cf); From patchwork Fri Oct 11 16:23:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3570 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2153641386 for ; Fri, 11 Oct 2024 18:23:51 +0200 (CEST) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-539947ac1e8sf2073832e87.2 for ; Fri, 11 Oct 2024 09:23:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663830; cv=pass; d=google.com; s=arc-20240605; b=ECRZ0/IysoYWv4mwo9wZ51VuKk7IynPYmjwlhnY+grnccYExEn0ztHIXZk6REJ4DhO PADmeYcmooLIblonN/1WGr12UD7XOFhSAERsJbeocHC41Vhoh8ywexeGEGffQqZqATeP bQp9tDRT+DcN0jgj+Cn38ZKBsg6yp5VfhttPuFBrE9m0r1xjbUZtiReLGVFZACPfEBD4 xXOwd8G9atKNtI5YgqykJWKny+cCel2CFft9rn47NDJ7VtnzX+lOPyh+lJW8bz5FTgLU P9xsFOHynCtxWm/4oZBWScF2ZEr/0sqiHOCUsFPht9RYS/3A0j9hHxNviuR3arZi3sjA hNpQ== 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=+OMevet+1q1xFGX7MZCP20wh16ju+OrdkWJwYaKTCek=; fh=NEd98cAdhU4U5w7Q97ogr1Y1boKCc54o7NQL9d13Qes=; b=cA1nKuhdx6vjUMOwGxQNtKhxmDD1p6jUYRQ+rhwG9JLxFfnER9DYTd72b8DXGrPmPc 2l9RWfC0foFrgAZFEuIAIR6lqm9jdOIEP6XKNHoacX+0rCRCoxX4p93VFhRcXuvCoEIP 72KXKCUB+3Gdvgr0CfDVCPVSo6dwbuEnIkXH9KRjCqZc7nNNfk3d2bIZIVVEnJA+eHOH Fh1uceiq9LbuOu/rg4bd/fhELrx3ibZ37eMLXAXlxQPQAU3Xtkqxo1W3PnK1r6NZDcZx LRrOrIb0W5QxqZonNhQwOeDgPy8eAO2AUllFVCAOtyUyMMaSoyucRMQMqbBtsLu6/VkH ctUw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UZlmTnb3; 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=1728663830; x=1729268630; 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=+OMevet+1q1xFGX7MZCP20wh16ju+OrdkWJwYaKTCek=; b=ZxLYoTPOlFjqWjF6ZjGgX1PBZbgzxaDUfLz43YEsHLb5agCO8+BBLwGO1D9dDCwYiA V/ICnxnDQNAp+FQHbOnU2KbDbP//G5ILdz1uSK71llgXj+ihg6kmV+SKNeVrufH5qLfu XhiNQotFSGnkz5al/Y16k5A9ol91IyQQbSmxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663830; x=1729268630; 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=+OMevet+1q1xFGX7MZCP20wh16ju+OrdkWJwYaKTCek=; b=O01qzkdUG25SEAUqj9Cut+OvzNGPwfV9mPMyaYGZUkRjRaDOFwR8Qe2kbe16EJ3wQt C3Vdhwtnd7E0NA0IEbSF4P3w6dusGKD12BYBs85GfHr13g19GKwxp/CY52U21znJMIHg LDvr73T92iGHqjUbLqg6VgdCvPMbfKhZXTf5/HAqqCenW2boqs4NXx7A58Yje9U7g85B AswgNZm7BhidNlK4IwtPh3E1ZPq4iGY+FMMf/n1btV1BK06fVNxBfiE6HNT74n6MCFaW 37ogg7jpeBbqrAuiP8JyguQ8NHuQygxY4h7V2frRtTltQumeXCDKsON14EghmdHut363 Gl9Q== X-Forwarded-Encrypted: i=2; AJvYcCXAfKofPDVGlDcoQD/d2theE14DO1v37WWPXtpv2hXlwAu4OKlAW1+uhQwpxDYeTJKqPmE7xKHTF2WDZePO@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyJjgbAK9kGKNBF3G6MPiLS4K6vRn2Uq0zQcTcjq4nyLE4GbWe3 BVOl7Naiq6wwGlbWzP1WAh337//XRUfrpUrQFILLeBP99eADJ1ZqEZl+dDCKuxPvdg== X-Google-Smtp-Source: AGHT+IGgwldytvMevJot+P+D+stGyc8rV1Qv3hZGCadoWQSeoSInu8UaDRj2yDEgzqpOhIsw4lZ/qA== X-Received: by 2002:a05:6512:3f22:b0:539:9155:e8dc with SMTP id 2adb3069b0e04-539da3b44cemr1709925e87.9.1728663830176; Fri, 11 Oct 2024 09:23:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:26d0:b0:5c9:1100:f7ef with SMTP id 4fb4d7f45d1cf-5c9338a4c32ls165942a12.0.-pod-prod-03-eu; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) X-Received: by 2002:a17:907:9495:b0:a99:d34b:111b with SMTP id a640c23a62f3a-a99d34b1220mr91644366b.31.1728663828491; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663828; cv=none; d=google.com; s=arc-20240605; b=bLeIP5ZHuPj+zMo+cNGYCn4Ovlisu6BNDCfPz9sOzpbIgL7mdJHwseqA7awbI3GT+8 E5oojgEnMMJWTxlKbzjPXeQGMLne41peZRjOk630DY51mQWv7xr5nOr+Pv1YtrT3bCvs wVL56mhMJoHnbsctPwBATF9DLnWDYXMvM4YzXfkmfBZ7fqlO3X6g11TCUGgnhS0DEX0y HxqQiq80Zp51s8CaWTaj+plzsEQ3m9Bils/qKsNpntIeefGTixDrs8+JnVxsWsYdhnV8 F1O0xEL1sIwd5KhB57j8DKo5Nbui71Y/LxhdaIeoELaNkteNky2pj2X8+ia58bAlawG8 24KQ== 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=J38YuAoviH5ds5J/QYBub52avByu8DC25bcrGE+5xEU=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=SBYN1fXVGES7Toy0DYxN5W+E9lYaudBOFAPia26JiQZyiKobCE0PV9q4ASFlyseYCU lXLFAbKZURQUMCxUKTxmIA8J8tdlzv/3//yRpcdXvjeDbKB30Xm4kzvo99Pz2L7gr1mU ijIYeOJNYowiI46x/uz85AnlUA6MYKbYb5xK+4jWv324iKyNYgP1s4BW+nP4BbnGN/5P 9/mwxnmiqbcCPB02fj7ZwwC9i5wRiRqPdXI+i49vIRqmvVVduighJN+JpXJOJ20eP4RG 47SFd4TTdh6fmr3YLohg4nzVIQ+rb+cYAnoRY8ThtygfncmAYRFc5UKL9j24TTq1uxeT zAPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UZlmTnb3; 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-a99a80c0705sor148954066b.15.2024.10.11.09.23.48 for (Google Transport Security); Fri, 11 Oct 2024 09:23:48 -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:f15e:b0:a99:48a8:5a1c with SMTP id a640c23a62f3a-a99b9604446mr286759066b.40.1728663827864; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:47 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 5/6] can: netlink: extend stats to the error types (ack, CRC, form, ...) Date: Fri, 11 Oct 2024 18:23:40 +0200 Message-ID: <20241011162341.606443-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=UZlmTnb3; 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: , Signed-off-by: Dario Binacchi Change-Id: Ia81c2ed814f8d06cde63352519e56981d3e43bba --- include/uapi/linux/can/netlink.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h index 9f56fad4785b..a694fd478efe 100644 --- a/include/uapi/linux/can/netlink.h +++ b/include/uapi/linux/can/netlink.h @@ -111,6 +111,11 @@ struct can_device_stats { __u32 bus_off; /* Changes to bus off state */ __u32 arbitration_lost; /* Arbitration lost errors */ __u32 restarts; /* CAN controller re-starts */ + __u32 bit_error; /* Bit error */ + __u32 stuff_error; /* Bit stuffing error */ + __u32 form_error; /* form error */ + __u32 ack_error; /* ack error */ + __u32 crc_error; /* CRC error */ }; /* From patchwork Fri Oct 11 16:23: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: 3571 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 50BCB3F332 for ; Fri, 11 Oct 2024 18:23:51 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c88bde66bdsf1393561a12.2 for ; Fri, 11 Oct 2024 09:23:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663831; cv=pass; d=google.com; s=arc-20240605; b=AVLrcXZLpHG14NzoKxkkWkFIHtwVjCOyEy7p2yzngV9X6ouuf9DyzWBP9Mxs1n4gih oyQzoIMVO3sQofy/uAQaArXdC4OtxwDIW1pTCmQWPpuKKsFFPReK2ALmZ6JG/SgvEuRB iuPeNI0zTUqca9hhUQJ90Fsj5TSQeFFT8YDI9BA7kT/Gm1Tzxjw9cezrojgWCIz8Ybmg IGXdketZOdh+u2NGqoLDnbeno6e3axVIcniR8YbXDs/57GUWy1yxXd9abD3mHF0OZ/tk Jm+qHhmskZMsc+uPl3t8PbgUrBkGo/HWh25IN8805WxwFzEUayUrHUq8C7JW5girBl3/ vSlg== 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=E6d/VO4Rs2Df8VdBp4MqMmCPdQ5RDL7MVibT7SlPOGI=; fh=hTiWRpiEoilYrLpsMb4rV8twyXgNJhwSJb73/MEK7ao=; b=MKm3T6BCEQwmDW8dvI//5wnc38HGL+EAkgByuOW2RuxivDC2IlwkFy0NipcKpfZoNu Kx8jv0Vpussp8d/AxaBdNrVi4C9VcxcG7dKENDMxzTLrQF9anOxSDxIpqvg/TAgsffob V9sUJu/Zr4DloEtiTP5bzMwlHwlUSAjsJoba7hKRIxnn7ATPlOgw4jyK9dgvw/plCsd2 1LlBjghBsxuhuQ0mV8iqZBVEM2sw6nhxQYGUTtGhvf32KxXA/G6oFIa0UnyhBnfLXptZ 3yGdKx9lM56hv7ZSZJIY2NxbxiNTB9FeIUVTx3lT9kKJZc8Vu9+Dvbx51b8b0+bN4aLO fu7Q==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X5eEQhrm; 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=1728663831; x=1729268631; 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=E6d/VO4Rs2Df8VdBp4MqMmCPdQ5RDL7MVibT7SlPOGI=; b=BB9/aZwyveWRM99EHUzdUe2nyx0G+XPIbbE/dNORbmSL4wITkk6u1CTO/+B+UBv4jL wkEJOSvsidmA6pJDCgXAglKqjlnq2KE2tWEgFlFSIeJABnxsXeDixxXib7YGByR6qqx0 qsHiSXS1rXdU02o7atJ6Jgg8oh01HF5TNGgmE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663831; x=1729268631; 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=E6d/VO4Rs2Df8VdBp4MqMmCPdQ5RDL7MVibT7SlPOGI=; b=Yjj3JhGLx6dsHUzvLb5dCSFHuBeRJKeJgW9wTWkY0uJPPKE2/mhWvBlHpdwP2B3mv2 gLUb4qbAfdl9wpvJ8On05wF4nV1/86SygTIzor3rHLx3S9yAGzklxUMnHR9wk89ASZSf xfRrCrw90m9fl5cphYRyxC33OI8MWLh1r8k6xzSXBCEwEJ2EJhDL1nnPGQrwHpZoKUI8 YQEwyVKeI+ONRl3AyvsmKX/gyRLx8maj5nVNT03JtCinhzNTaQjJK1ekP8Pyhwy/UOok XkvsXoLqppZwokJ0qgCFhr+hCNgiIvvjtsKgP4t2ZrXBgrrm+L+wrG0eaxhHkQoxsBTq I5rg== X-Forwarded-Encrypted: i=2; AJvYcCUYScIBDD1Q6wlrM+844f3UU9X8C4HS3YqYBQ7JngZ6u4A4v/M6x4NEhldtXOUAaTEkO0+UaZLoDgea/7UJ@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw2bIpC31Q6AOtVBmdYOpwBHuOGX+ni7oKG7fqW/CADr7ObdJ2Q o7ZnQ1p7vpD27l7YM9z87EtgZTxq7P/SGg0PLd0i6GnUO8hYzAtSyzocTBGA4z9W3g== X-Google-Smtp-Source: AGHT+IHBD/Ye4urcasfLYy+kqKp6Fxq49kOU/F6smJIAdrfbK6mgbVc1sbkxLk7w9cX82MThWGAolw== X-Received: by 2002:a05:6402:51d3:b0:5c8:7c58:6588 with SMTP id 4fb4d7f45d1cf-5c948d81828mr2082925a12.32.1728663830841; Fri, 11 Oct 2024 09:23:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5110:b0:5c8:acf3:12c2 with SMTP id 4fb4d7f45d1cf-5c933d44576ls143259a12.2.-pod-prod-07-eu; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) X-Received: by 2002:a17:907:7da1:b0:a99:3ac1:2997 with SMTP id a640c23a62f3a-a99b938c316mr257774566b.25.1728663829281; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663829; cv=none; d=google.com; s=arc-20240605; b=Z5aNKufAZmH4nuGrXuPAHmvsPEjJmHO6CIA7i++KcWVjsVrMmarvJQxc1G0J4fPE6X EYDi+n/0FvuCR2zRyOxGIEDuLcmCvGkMQ7mJt38UCMVuvaVXxC01A92EL27KPxeTZjfj twPjoVsNJKdYccQRXvcCHceKdYXyBQc1qqTqESJ0eCfsvg+5N/P8zAEFBZQpqJZ8A7eu EICitcDGOLOW7uGUu4J50D+PqfacDMFMC+ELq9gaty+62kAYqf9NYdLTlhoK9ztH3n93 8rkjAnqDRpGGEShZ6UZzbBzBdOxS3wlHaLXp2DBovTY3MUEBaB3ovqbJhLAtnOuhsfAJ dLBQ== 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=YaIoewJirun8bgzHpnzUUkxFY2bQgJzrr55n/vOKzyo=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=XhIOFSUlA51mqhf9/KkjSByrlYw/N/ZXXi2UDLHcJZWosVsi6/hmkr+nzQmeg5V96d FwSDb1WYoj/dp3FryEUs60IzxNzlyDAb2ZDB7MOkCSHxFYBPk+QKJYudwfRqUYDa/6e4 sQsfp8H55Adl/63yzlJJKJlVvqkDZRyl7bk0dLd4VFKbHe5k/sPWiFL+gHVvhXseMij0 KK99fPlnJirSBZyCtAtH27hJAj9TIpDIMBHRamXCO+mRIzsYRFWseKqqDsD0e38DH7qD 9VbsQ0MJJkYW6oba+JzPQCQsZVbf4Jwg70hiKHVVJI1+KVIFW1kY3QVT7nD8FL6QZ3Mj 4y+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X5eEQhrm; 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-a99a7f27db3sor132014166b.7.2024.10.11.09.23.49 for (Google Transport Security); Fri, 11 Oct 2024 09:23:49 -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:d01:b0:a8d:6648:813f with SMTP id a640c23a62f3a-a99b93239cemr266292266b.3.1728663828683; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:48 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 6/6] can: dev: update the error types stats (ack, CRC, form, ...) Date: Fri, 11 Oct 2024 18:23:41 +0200 Message-ID: <20241011162341.606443-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=X5eEQhrm; 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: , Signed-off-by: Dario Binacchi Change-Id: I8d8974ae8502086cf43ffeea70964f4fb34d3e6c --- 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 c153015435fe..ce5d8a68bcf4 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -336,16 +336,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++;