From patchwork Tue Oct 29 08:44:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3604 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 9DEBF3F360 for ; Tue, 29 Oct 2024 09:46:47 +0100 (CET) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-539e0fa6f3dsf3749132e87.1 for ; Tue, 29 Oct 2024 01:46:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730191607; cv=pass; d=google.com; s=arc-20240605; b=bB8JQdtz1cT4yfeAL5L6DDAZuk/yzyLnXp43SNql5yI85x32YfaZCWSJwBBIIXPYtk 5HBpoR/4NfKX6De9mLabILnGzwbi4lBgqRN2LbJeIyxcbPrJghRbKLmXXVMEipUaGUoV mesHfAgT6N+UO0rm0h4JwWi5zTxG2djA7sM6cD9zb1oYkOVyYBr+/0qkefXhw+DGNUit XtZkGZ6FtvYHg5LY3vxtp6L28ALTBtDT5d1Ga5ERzKk8W3zrET/OPnPQlPhwHGIet+MC e1qC7PYqO7vBjKNmnXAB9xzFm7ih32wv2JtSC8TjQrYvcbLI+E6AV+h1G/Z58PAcYxqM DpFA== 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=l0QXdq+YW9fLZtQVSYBJzbWPIdKkNsXpxRRbWlVS+eU=; b=CSaWfoH9u8nOQJjSr7SVa8Oc+l5O3U9bOHhf0DWpkoUyvIlRXNzJr7kfNedyuM9PoH JwU0tXlAdoBCPZrB+aAehPJP430gzVFZu+LzxRyhjcONPi97YPcMaDVK/tVtxb1u0xEc h0yFZfpC2BDUyYoR+zZN3vP0d/4CRsywE2Var34m5ugj+vPJNwIOvfhGM+2uzfbivdMo KkcKRw3hWJrGt618WG503Kh3M+lpmQttPapNhPUDIeT/yaOYGcsKMuwYCWSA7mQa/k0I nEvnavwDQH2Yor01esYA4ezVez1KU69Vw3Po42osxKBsuc5mYf0cwdzUi5jLZIP3bi7A QUHw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mPo5Zzym; 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=1730191607; x=1730796407; 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=argENxYPhrRTA3ANDmR53Jc2NUM2y1C4LuBzPCzhx9Hf1zaw/GtY/sLjNzOUaTcExM byGYnCWm0YygxQvJ/Co2xuZ5DHS93x7oxwft02lw6TDKO81027FrW0zmWCcfoJy4XfyT 4dU2FOSNyPQ46jzpidAUqK42rW2uhs0bwKAmI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730191607; x=1730796407; 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=TTpZFkF5GLNBTPdShCdz4OZ2U6z+pPQ72ZkupYM4aUB+oj3NKm0QM1bTDRExLPejke JG0gbYWiMUimf+xlI8NlMIN1TgZLKJS6uGvSWhacgxz5dUzFub+WHLJIHEfw8tUr1Bur wksxdpghw0gBGY7vCWEO1y9GHOq+8Qyly1EySRyLLAZhS3jCnGPJongccHSMQKdh8478 Puv9LEp5GkHuVI2WvKXStZyFkvwBaGHLUN7vi0gahwZK1MajpuHwOj4ot05m41VcyC3p etqOz4xfYig0fS/vvMh9qVmMQ65nnfe/E8M6CslL/E0oHL6KRvMip1oLFvGt/5FacG7Z KeaQ== X-Forwarded-Encrypted: i=2; AJvYcCUPxgHmZJNOSvTt0OD7+/vcQ0BMlD9fkfYs4keyPq2Rzkqpf7R5PF/H1NShyHEUBur98c9xvzguD/0PYEPu@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzeNzebAKuwIMcs+u6iHYWDnDRhMBk9d0JB66OB6gPK4gR4VyrH DljEj3dx5RwoOiAvT5gnR1w/6ERZZbJKa9i9sPsFPcde6QPcyePQH3hystpzOtvFAQ== X-Google-Smtp-Source: AGHT+IFYVe/cTMBiP9qAY72oAh6f8GSQ6EtTMCfCi2nxn/MiVwryzoKJ9HQCIqFtXjczEaI65jdd7Q== X-Received: by 2002:a05:6512:31d3:b0:539:8fbd:5218 with SMTP id 2adb3069b0e04-53b34a3515fmr9349196e87.56.1730191606733; Tue, 29 Oct 2024 01:46:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:1111:b0:53a:99:8b36 with SMTP id 2adb3069b0e04-53b2147b7a5ls862515e87.2.-pod-prod-05-eu; Tue, 29 Oct 2024 01:46:45 -0700 (PDT) X-Received: by 2002:a05:6512:1149:b0:53a:64:6818 with SMTP id 2adb3069b0e04-53b3491e2e8mr9249423e87.47.1730191605016; Tue, 29 Oct 2024 01:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730191605; cv=none; d=google.com; s=arc-20240605; b=Aasm2BHAik6DY+0Q2SlJo3lqIj43pnUjQAs7z1qKSZrNB7bSuXM+ELuyfyJhUrvKhh PXM08+4DnLvWNkyX6L5ROccxZH+Ss4IIGL5tM8/++IdR59DFV9DNROUkmZVfNrdsehdp j+OUYNRae3JaZdKfDnUdOJQ10SwvgpQnliqsQ0sE1YvRIHOWX3YSLrUKSktDXm3LE+ZW NUpoytCALvF5hbWTxaELNQPT2O6PySNjMb7zTZz52xGeECwMXUszpN72uXB+74LyIkUG CRkOvdUn9djijK/aXtv4GTFPm/0sJMesDBhyoxdmsmZzT4Np3uCCnKsqjAPxWYsHo8px 4hnQ== 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=dHQIR6tcWkOVGkCzk8Kn2gtw7JyT+sGePYbjyt/VztE=; b=BA7H4VPlXuj/cFxCSF2q+LGWvDPZQR0PE/xAnrV/9g5LG8OVSu5uGVZwaCzURghYde E3nHqnDMRVP258462S5BpVptJeoFWbCPxTcC4TgxT2u3iZLndPyF3kjg1VLMkePTyBhL A2Mq2cK/LD3FfPxy2KhsjsTabdo7mJemjTw52Kzy4wPHa1+i+YnkyC0hsvsa+5pHmCVH TwrUqKc3PkDBHjKIWjbgs5uRLi1bhi6cjHQN23my6FIExveDmBW60Um1fge9SW9pbzAC lDGwLrzx+ucmWD4Nh1UAOXcC7S9GcT7GiigtmrI8einXEUJ63nZ5lfYb+dPlIn1MZV95 OrHg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mPo5Zzym; 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-53b2df6ee0asor3277006e87.0.2024.10.29.01.46.44 for (Google Transport Security); Tue, 29 Oct 2024 01:46: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:a05:6512:1252:b0:536:a4f1:d214 with SMTP id 2adb3069b0e04-53b348cc55cmr9003984e87.19.1730191604452; Tue, 29 Oct 2024 01:46:44 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-40-68-117.business.telecomitalia.it. [79.40.68.117]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dec7dacsm450134166b.9.2024.10.29.01.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 01:46:44 -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 , Haibo Chen , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Rob Herring , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH v2 2/6] can: flexcan: use can_update_bus_error_stats() Date: Tue, 29 Oct 2024 09:44:46 +0100 Message-ID: <20241029084525.2858224-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029084525.2858224-1-dario.binacchi@amarulasolutions.com> References: <20241029084525.2858224-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=mPo5Zzym; 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)