From patchwork Tue Oct 29 11:45:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3611 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 046753F380 for ; Tue, 29 Oct 2024 12:46:34 +0100 (CET) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c94862c3adsf3881463a12.3 for ; Tue, 29 Oct 2024 04:46:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730202393; cv=pass; d=google.com; s=arc-20240605; b=V+jWUboKExOkDtBEsgh6op3TXFmbACmxHYPlKXEbH+NrZk0nfppdSFGHYicVrRHRUs 5s3WzmjE3exRxdyHUGOa0FibFuPMnv0oLk+ZaEWrHRHrhGOqEn1AgYJtRP7hVaOgvs6H w4FaWAsTllmJB7J8ZMfAa5HOi0gnlzNvJFhANsUdmIDRcv3NZMZLdB8wehFehjuM5AbF CGqZr6TO/b8dQYH73a56aDGjMeoZYhf3C896CUtYveuASP0AZkpAStxNF5bEqp/mwA+K ev8nC33H7h7kPBRopLLCO2h1nEw0k5TvtvmANxOiWNcZFMDmzZvTUbK/weJ4zmqeIW9a czYA== 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=Qpl0mGtgJDii3xR5XaMhpYCW2lMoVPHTeu0luako5MU=; fh=jT4X1fJzmBtgIkeIMLKd7lpK5bG/uEmq2GMtE87/95U=; b=G/r+h/Amd4yw7EcYcvdNsG2he0LhbfoXw5ao6GWtworGs9msjTbXueCPsBM16UTN6C jr9RcG9DvBaxqnCpzFLco9W6W+jqtZMzdD4PxeoX1yGs+s3r1Yo7T+fCHoIXUEvyNGup uNeW44MNwn+Uwe2G+GIXyaJ/hOzjQdmhIJTngKPSldjYhwHQ4tDk902pQVMFQvb+EW9a erOc99SSHt5ZODBiBGfdgh4fsACt5+zSytIwrbD26Oux7mQc5oe74PehrF95y5WGRaM2 JS1pdqTPRoS1V3OaB4FwxC91ORr0DwOLoSdLnlpLnMP/n5HAJNNDXoY5F7VrrsNq06u/ K3RQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lWM6E6JK; 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=1730202393; x=1730807193; 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=Qpl0mGtgJDii3xR5XaMhpYCW2lMoVPHTeu0luako5MU=; b=iWYVKLovD/SVaitdRhnMWleowM9EoI05xh1lmTp7Sof9theDa+9O9woQ9lQA/L8Trh Ki4YGIpAZ7efpo+8Jw00RtonAJ0F6lZCtZUN2FRb81cGNvEgMvXC2wqvHWvZl9oe2Lr7 Dlas6Orsx5OmsVDjGdJC/Rq+4xdtHBVJoUaFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730202393; x=1730807193; 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=Qpl0mGtgJDii3xR5XaMhpYCW2lMoVPHTeu0luako5MU=; b=bD778f0tiUeu0ra96RpM1CT9XWf5HzcMbJ2Y3LItDGoKKvKyYKlP8hGThIfg81wkDK 7DGgcxl9ffoAA0xL/N0hynskg74Vv+q/ybgv1196+VW5MQrktbR5oa9cxlvaaIZP9HvN rQgC9GNnSBR6XsLKZO1LpL18vjcLJMLbLBfIk1eWPNd1WRlkAZ2Wt9IWZk99DuMLOWuo n59aBhkNftrgm/HiUctQu+B5j0BEhUJwWz5QELkGDaDxPTvHtYTt8hFtWEnG9TLS/kxz Juvj0IY5LErzdPr/tOVMC1OE8MNrxTTG9oN6m8hYjcmgAdSVpsU6KyVNFJuHjgE2qA4C sUyA== X-Forwarded-Encrypted: i=2; AJvYcCU2+w6Up+PLQUJmIScFNnQPvjmsKQ6vnB8uzTXALpylg/uXCs1MWLIPghLeowd/dlkwoc/G4P/Oq+hH6Red@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyhjqMtKEq0xyaXwBJNV3l9BtKhPfBSrPJ7NL98Fou5kVAvsbki O0milFWcM2POR7SuSCV7CX0RldCyXKpAWduoJ3ccHijQrLTMbT4H/Xts73UEGwiVaQ== X-Google-Smtp-Source: AGHT+IEslR9GSr4c2Sh0k+069SX0JI0jX0Iuc9llKzyrg/YSqd7zNDsvoGm0k2NZCQmeU2TjSjVjwg== X-Received: by 2002:a05:6402:1ed5:b0:5c9:709c:247f with SMTP id 4fb4d7f45d1cf-5cbbf87760amr11062702a12.2.1730202393321; Tue, 29 Oct 2024 04:46:33 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34ca:b0:5c8:9f3e:a9e1 with SMTP id 4fb4d7f45d1cf-5cb9987a697ls103333a12.0.-pod-prod-01-eu; Tue, 29 Oct 2024 04:46:32 -0700 (PDT) X-Received: by 2002:a05:6402:3514:b0:5c8:84a8:5185 with SMTP id 4fb4d7f45d1cf-5cbbf875e3cmr8778051a12.6.1730202391828; Tue, 29 Oct 2024 04:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730202391; cv=none; d=google.com; s=arc-20240605; b=dyy2kW+3aO6wS47nfoybBmC81V+rGvtKKwmma03u+vrdLLEKM2gbxygOCYCcCP1GqJ Ie+r0/cm0skHw/UhRwLAUkIglanpVHSXa5yWC9WdIdRt2S3CYd8UpUJjBs1ACMVSErjI izfBG6rPMt2vwtFubdejVZjuDy/6x3dbqT+VzpUyqFyu/OY5BRkJquOsInHvlEX6P4vK ++5bn1LPJXUzBqJxESrbIjn94iF32kgeROhQh2CkphpLsP5Z5bSW8SUCuReOREiB0jef WnnRUbG2Q78Cbdly2AKEJ9NB1Aj3Auj1np9voX6ObKkORYU0tvEUsu8wX4UT57e9ys9b pJLw== 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=rwyMMsHa5HEUfO6bt7mbb/5lMim+t5T1aF2qtApwxpM=; fh=wYuTwriQNE0msTxJ74bxqM5Abn0Z1otL2URT6XDvkCk=; b=IBfti1V/69DWxFYINNpODTmgHpW0DTA9P0zzom2Ju0UmWMQHt3vUolmZtd1jnq82KW fWlGwh9P5+BEb8eWzWbgKBoAx7Uh4KZfimllZGISpcpCZOAZFp25kuOYfucqVLxypONL dIOSjlfJkCNrD3q3PooGl0PYL/MZ2XFL3bUX3Tup3WFr1pn2ytAFv+SJzPBgvv+2xpKf xhbU63aMgo8MOPT1ZAcmrDMpjWimDkvhyJjNKEwxmxxWvMnIEA9x5yWLfzC7e9n9KSLO oJHPlwNU1dejNuPFP0RbmNCTJja4+zi3Qu4CuJK23/oeUNDOFN3E3X6Tl1jIrZhO0YDB pm9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lWM6E6JK; 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 4fb4d7f45d1cf-5cbb634bae9sor3130548a12.11.2024.10.29.04.46.31 for (Google Transport Security); Tue, 29 Oct 2024 04:46:31 -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:6402:5191:b0:5cb:78b8:7056 with SMTP id 4fb4d7f45d1cf-5cbbfa9b3fbmr7045227a12.33.1730202391375; Tue, 29 Oct 2024 04:46:31 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.41.207]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cbb6297a09sm3869301a12.21.2024.10.29.04.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 04:46:31 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Frank Li , Haibo Chen , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Rob Herring , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH v3 2/6] can: flexcan: use can_update_bus_error_stats() Date: Tue, 29 Oct 2024 12:45:26 +0100 Message-ID: <20241029114622.2989827-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029114622.2989827-1-dario.binacchi@amarulasolutions.com> References: <20241029114622.2989827-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=lWM6E6JK; 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 delegates the statistics update in case of bus error to the can_update_bus_error_stats(). Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/net/can/flexcan/flexcan-core.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c index ac1a860986df..790b8e162d73 100644 --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -819,7 +819,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; @@ -834,41 +833,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_timestamp(&priv->offload, skb, timestamp); if (err)