From patchwork Mon Oct 14 15:24:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3581 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 694643F382 for ; Mon, 14 Oct 2024 17:24:53 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-539fbf73a2fsf657525e87.2 for ; Mon, 14 Oct 2024 08:24:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728919493; cv=pass; d=google.com; s=arc-20240605; b=WBJHb+LnMv5rYGvCxu+OWCrnAlHASO+FUQX03MzMDjv/5+0g5AKp1jAXIvA2VBfRKX KPOsGmGoGWERj5mFwxGRo1OKnh1ZU53sd2RV7wLNh0TwLkj6AjMH/uO4/z0dNCrbt2xA gnap7LHqapEUclufySQCprjOLQErR32AaYqZltQVAguG5P8MtHZggbqhgaNgzy7KZ8PF QWQeN8POckFEgV4fY6404nJFvkzraZgGvgsDZTLsU8ygoV+5kAD/rhW/z7Xy5Vf2ORwm d1b4Hr4pZT2VHO+3jK2Y7mvDJVFrKN5iunbNLXcb6Wfo5MHC9e5AEW0XT60nJ1ykrULs 0a9w== 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=eN9vyGxA0TqceSuPI1f3wj1vkWMxPMHts14R34j/VLc=; fh=SADXYkRdPiO01inmuJS/tiEKF20CeyLrmExj7ekbSmM=; b=J16ES68W+TXqE5EK5dsLnOKUXTig7Tt0XTynYxNgRpoFRqhYG9FLSkP96M4p/DaOMg L5EXahEEtikaFQo0S343fviO8gEz5j67Ueuf3vY8C2r2nmSYtUx8fbXi613ptxE7EYt8 /R40FJNJJ6Mxwq3OlG4JPTMDHNtp/PzNQSa3AWx6CRakcu8cn5QuRJ+VSK2Fm6tZnYjb ifOjG8swy4TQJe0JnlsPDXF19csEC/7la1m3c+fW+EEAa9tAwo5IWXndYyZyUjpp9V5N HUXBwcV+jdjTsKzNQwG1EkyJ+N4UvXRFse02zq1VhZIRDSekG9ORjNgUs6x+UIwLpMGC fRbA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CS3XrMCM; 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=1728919493; x=1729524293; 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=eN9vyGxA0TqceSuPI1f3wj1vkWMxPMHts14R34j/VLc=; b=Wt81V6cgl01u2vxAMVUwdiOl8NzigT6xeIos7/1oUkOBWnyquu+Jcv0N3fHZEocQxp ZlrshBk8n77VVqabWConH2Ac0PQM+AGzvC/bAdCLl9zT4UZCeuO7YhLcXH1WZzsYpL38 ZoHWm3zaeIwfcNY/HRJX86XMW4YILObuJqf+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728919493; x=1729524293; 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=eN9vyGxA0TqceSuPI1f3wj1vkWMxPMHts14R34j/VLc=; b=vj6d0jg1WVjeXN0SlZHq7htgpXvNv6dfJXKzOdV8jbg7xlnjkkhAeXAkeyc+5GTNDv FYA2VcAaFZsoYl7vLzXm6PAOIzUR6oW6SmtSPfJ4GS2szJpu1s52KdAM7hrlRIlGzBep Wi+Ik6G6Qw6X3IkHBwtOYlWv45+56U1M2Ydru5F9OS35Noam7K/l8krG5+eBxRbww7eZ Ih2b+zRwmD7ATmvJLQ40klSqJ2DWL82bOSDk5Y1X5+SCvbbS569gTC9or5441DWsmCb7 DBcq7L0/KRoizE/jfgoTC+5bTHeuZODXpNNegJoVN4w7xUMnWxVRqLudCtpQHsowcY+4 P/NA== X-Forwarded-Encrypted: i=2; AJvYcCURsmSV+oOeJHQLjaNeXO0I0mkoBJkZt0DycYQHsmsHa/zjcidEB+3XFRRGnx/8lNxoT8zl4KGVWne1tYf5@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx71EnyiYa+7ICyqMFJAtL7BVT8XWCa+Bk+IIEstgXAMECzHzw3 xdtch9UkJMH+8y6ym910/Ua8OHfMlSqHoDQgNd4cvhg8wnFQ72MkPmVUasl0/4fvew== X-Google-Smtp-Source: AGHT+IGkvdDd3sronhs+S6eU/zbeWqHuNt8wuNorIY7SEZDgkbnW4fSnP/bChrxcCA9bHy8tP7TLiA== X-Received: by 2002:a05:6512:1598:b0:539:e385:a30c with SMTP id 2adb3069b0e04-539e54e835fmr3456152e87.14.1728919492519; Mon, 14 Oct 2024 08:24:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c28:b0:42c:cb89:ceb with SMTP id 5b1f17b1804b1-4311600894cls15686645e9.2.-pod-prod-04-eu; Mon, 14 Oct 2024 08:24:51 -0700 (PDT) X-Received: by 2002:adf:fa8d:0:b0:37d:501f:483f with SMTP id ffacd0b85a97d-37d5ff6d6afmr5571514f8f.44.1728919491004; Mon, 14 Oct 2024 08:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728919490; cv=none; d=google.com; s=arc-20240605; b=Y1eXSJdYBvtZ0s00OtqhJ8ivyosrdXC1Imf6mwj5UIdGFFSYfiCnqnYKZkazFUx6Oc mu8Ri9j4Y/amvlfHj7i8iQumdbjE+IwuNKqwiATjReCnYyPRfi2AQGxoWOO4gy4bXQdP KgD+H/9qZzsOLqp1Xr6z+d3Go7JYCFCCJ2hbxOnU/3CSQ+g9xuOCm58FMxs69Tc+hgpE TQGZ/iDSofpW/fQhsB4Ap+1f9PiadGsdyHOloTIkZYq9nas3hp5qWrAUifU7r+3IXfFT dJX8M91aPbKTXf7ZhnergN8Sg86sZAvuouyDJInq9/Q8hETCcaDPngirHkGPOuO7yLWP T+gg== 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=QiHw9EzZ4u2R61UsONsymQwt0FhsGds7xVoU4Q9fXYA=; fh=ZsOHiOhTaC3q28QUTzL7dNDygWBRJDC/s9gpaKZ18Lk=; b=FiFVe8VurXAaEtHKB5vUfJ3bleh/IY8oRgBTOH9ttvrfwMrAZgGVj8e7cwuFMy9ll0 FR+sTwuK238E11ngKm6NnSXBcqMpQG0HGGWPKssOdPsOMyG9Y3wjBPQX1nYfMk3pbmmg c4/0MSJP1zFNLrNeH8vZZ6+7+Zzr5WISIiIYRu4HGzj4J1NudYl/Ppga4yim6OthkfnK rUkcBTt0rW4bgirPyqK5MJVA9nCrunD25iARwFdwYNGIlx4WzlhEwyLi9nNvtevEKHdt UYsWpUHOrsDKxIhXvOLOEGxPSW9ahTZSe3kEHwJ75FdBpQSY+RU4tSWQzwVoSbUp9aBX kt8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CS3XrMCM; 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 ffacd0b85a97d-37d4b6cd79dsor1403289f8f.3.2024.10.14.08.24.50 for (Google Transport Security); Mon, 14 Oct 2024 08:24:50 -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:adf:a407:0:b0:37d:509e:8742 with SMTP id ffacd0b85a97d-37d5fe954c8mr5128907f8f.1.1728919490496; Mon, 14 Oct 2024 08:24:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 08:24:50 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , Carolina Jubran , "David S. Miller" , Eric Dumazet , Gal Pressman , Jakub Kicinski , Kory Maincent , Marc Kleine-Budde , Paolo Abeni , Sabrina Dubroca , Shannon Nelson , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 6/6] can: dev: update the error types stats (ack, CRC, form, ...) Date: Mon, 14 Oct 2024 17:24:21 +0200 Message-ID: <20241014152431.2045377-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014152431.2045377-1-dario.binacchi@amarulasolutions.com> References: <20241014152431.2045377-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=CS3XrMCM; 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: , The patch modifies can_update_bus_error_stats() by also updating the counters related to the types of CAN errors. Signed-off-by: Dario Binacchi --- 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 0a3b1aad405b..f035e68044b3 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -27,16 +27,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++;