From patchwork Mon Oct 14 15:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3577 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 8D30E3F382 for ; Mon, 14 Oct 2024 17:24:48 +0200 (CEST) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-539e6837a36sf1248034e87.3 for ; Mon, 14 Oct 2024 08:24:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728919488; cv=pass; d=google.com; s=arc-20240605; b=Hiblzi9L1INA7t2NJTQ/W0qQsDS/JP8R1T+vwlyR/DwXgFgn53wnOhwcA/S3a1QTz4 MQ2tZhd9oAsIVdbws6HkPOxjYq71Gc45pj/oj15w/lOloRIqExW1+VQ2w8pFQ44OGa1Q mS6aRMRULH5IlvMKgnMblYzEbhPADfakSIQM4kvw99yKZeAYMONerNTMC+twLqCfS/xL bLRqrUmY7EtYMPFmr/IDOZFS6RflJH07MsP/V5E1CD2OVrhk8/g6Xduw/tPRGDmRaaZj hB2kVbsJ8EwEJ4by3xmbShfm2/8z1nhjqfpOKWmTFIA9MTwX18t0m1FChHpH8tsanFxU 7Otw== 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=wemhzEoE6hMHsXuu3Ea3VNnoNsT8OKq37yydWyW9j7M=; fh=rs8y5oGwQbS5mlB+YSHRizwzQGhAs2AqDWy9liunkqQ=; b=iOBb8Isab3aWpjGHd/P4v2iVBo3Yuv4ZXYjAI6Fdfi/BGBVZTPVAJqr55gvLtOlLUL QESLuTi5td+nLwthtE8N1tsgoYe3X4Widmdp6RMb+p5CHjA27DXraDmkc18h7mp2xzVd T7GPO816ZabJAz8RduPfs55Nt61lcJAFxrZjwgJdzT6Muy8s23C4cCwMGjJaH1GVHGW9 s6HNDyRbDcUzpYF+Svu8Nwks7/v3EY+PiNpoqQivkj3+KqJGFAaIRHcNquw4kENDSgTB XLbjF+xzkqwR7FOLV1kKuS7eJY4L+b6Q+1XD/NfpnHFlkQbf7wk8eJuRX8efNT2oZI9G zQOg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H8NOOJeY; 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=1728919488; x=1729524288; 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=wemhzEoE6hMHsXuu3Ea3VNnoNsT8OKq37yydWyW9j7M=; b=k9lF+TML2BjhJiL2LKs4fWlOMlmPbkS8sCO7D//6xcOEerBIGgddNSekedpm8x9KLK ohprL7V7G3hE25+5VQLHnMNuX+hYtwG3/YWy6ddUYqrbEWJOp1wmPPy75r8UEtl7w2mn Lg0WSaz4kXaGhxlUwxSS+7XnrRhLbHTadPRpw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728919488; x=1729524288; 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=wemhzEoE6hMHsXuu3Ea3VNnoNsT8OKq37yydWyW9j7M=; b=v1HtGxk2yxVebfzguVtgAahMIAOQcnBF/UQu+q9zSyaM4/hFpY27IBK/aH7BmZ7eIq AjA0C5N4plc/GXTSEyXp3dZqWQZ3dE9HhHfPcMGOpzyDs+s2XTlUkkWl45zBTfpkfSF8 CsH5dQfdgwNqReB1McDK9ukwqdI0eefyec5hvYNbDVY2WXWyJAhJuXtmC1FQIYghSV3O ZkL9E1ngUDCXUhMYtDVnG3dYGx/h2ITFbzSKVkh2HJUbfSIqnoX5jtS1wAaZ9mWGjkTt hPb4gWZbQ24LsnivzC8MhTISo52ZgKPEQqU0FVMkxxagBKH/1KZfq6mheJvvaBcMz7Qe EBUg== X-Forwarded-Encrypted: i=2; AJvYcCWCDSU0GnwITInFT8700/PYzAnhBZOVZ9Y15a9A2tNYMiLvI4sQ9O04wrwucsYokNVuTjs09TI+W7WLGoZL@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxlLmjxUn77L6nlphViog2RMX7VBEpoQEaMWfRR7pLzjpmNzin3 rGgdAaqUcZHSIwGDah3H+qdroNclq00QW5veQYJJN7zREv2tUEk7xG7vfKdMHv05MA== X-Google-Smtp-Source: AGHT+IGxRsoWb1W13xdpZ9Y3FEPnRIUeXxzLq61msZuwMCRQdhWXIc5JMs8y97CjD4izWwh9GnXrYA== X-Received: by 2002:a05:6512:401a:b0:536:54df:bff2 with SMTP id 2adb3069b0e04-539e574b7e4mr3276828e87.54.1728919487528; Mon, 14 Oct 2024 08:24:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:1111:b0:539:f863:bf7a with SMTP id 2adb3069b0e04-539f863c1b5ls152304e87.2.-pod-prod-04-eu; Mon, 14 Oct 2024 08:24:46 -0700 (PDT) X-Received: by 2002:a05:6512:3f12:b0:52e:9e70:d068 with SMTP id 2adb3069b0e04-539e54d8534mr3976392e87.4.1728919485797; Mon, 14 Oct 2024 08:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728919485; cv=none; d=google.com; s=arc-20240605; b=cbSmZAtBdkYwr39yRqOf8ji1yU2y/Yhv9lQbxjuefhviAfk8hAJHFfzSaTxgHQ6BP0 UezMuw9hZfcznbrXFgGyx3h2q7dpWsY/kGNs1exKwq/pxr9njdMZZOc5BN1MQs4z/J4l 266o/qVVXmkhA6u1EalKaLfBdnXKHdnfx9Vj1Q9Ef338BBK9yjgK/oOIoBjaR13uXt/D YdS7JdZfXgtyfVEd6HOG+ft2/r4thVqosrSyHPnyOU09US+kysoyVngMuAas+SY5c9xm wqo//CD1hkjjftb3OvJcAKxKHkoJp6ggwd/rRPfDpl1ktJV7lDhlYjCgbzzJtGbBW5e6 pnng== 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=Z1ubGjttmwYd5EYJYtdXhE3bw7ehS4yxQFLk9r6TH7o=; fh=CVOAsvEULqapV/yQZ7v+/Ldps/RaQrxdz0p6eiG3HKo=; b=jJdByyXYnrUHaox5eLCYawHGrLitMZfvoiKHF2k/ZIFIvILCVPrdy5HUdAKvneganN bbJaMW5ftrz9rRAsaCUTuuFEWxxJG7+Pxzpt1/VAmimNuZ8VitL1rMLbl/rQzslR7ESl Wn/xWYI2hT811GKtrgV3vid1IKnS/paHtI0jE7TcT748Jz5gCj4YFxl4axmxYI4Q31jj wo1vlwEJCqHXzzgCtBRNJBwFyR5optGvL1C65xLS+rTddohyEqzi1szLQi7cpnHyS1wB RW01Jkru/Wj9LDriQ0yjzwiDlvUmmg69DrTJfSX45FqlUQGpdgZzgAKU9uLcn7cXnQHY Mgrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H8NOOJeY; 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 5b1f17b1804b1-431184aa2cbsor24816155e9.4.2024.10.14.08.24.45 for (Google Transport Security); Mon, 14 Oct 2024 08:24: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:600c:3b8e:b0:426:6e86:f82 with SMTP id 5b1f17b1804b1-43125609939mr71666065e9.22.1728919485308; Mon, 14 Oct 2024 08:24:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 08:24:45 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , "David S. Miller" , Eric Dumazet , Frank Li , 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 2/6] can: flexcan: use can_update_bus_error_stats() Date: Mon, 14 Oct 2024 17:24:17 +0200 Message-ID: <20241014152431.2045377-3-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=H8NOOJeY; 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 --- 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)