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++;