From patchwork Sat Nov 16 18:02:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3637 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 347113F033 for ; Sat, 16 Nov 2024 19:03:15 +0100 (CET) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5cbad9b3ca2sf2083629a12.3 for ; Sat, 16 Nov 2024 10:03:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780195; cv=pass; d=google.com; s=arc-20240605; b=U5un6Vbt9Chyzy2OEJeH4NuUXGNfj4K3QRz/gqdwmkvrr5Ow/cykN1LtN8196EnUxp pMsQmpBL7IZGNKQoQowPQxLbx3c7racE9q0BdFiAa5/ACgEZMTluytIKf7TzYFl3hmnq ZkY41FAuloQFI3orkvXq0BOmuP+vaN5CIY22XVCMndfY7JEgAL4YH/IIdwJFZ3NjC7Vq nS8y0aGxM7tlnc0ClVSQ5IobuQ/6ndiDuh2NKYs3lp7m3D88eR0+GXcxV67FIsArQlii zQhOskLNaz3JphSXFRacneoQwifMjLFwPeavE/DX0V06XdQuMvsxlW9sUfuXLnPNay62 04uA== 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=oc0BEq1tDn0XraLjiJfKO8aSBDiXQKt9dT77e3Zn/sM=; fh=ZZDT2gEjm8wHA6N932XtMU/u756DlDvQ9P7ONCDev64=; b=bP6AMqHtBrHxJBditK2J8qjoEnBcFSHfc0yammRBLOPZIlPl8UIavwYUyypmsiwiOt FGVK4lSE5kxUgRDjykgx0qn49IE8s8IeyHiiWuN+Bb+qaFc8KVE2eQqkvc5PXKZ7gBVR DzDdjlQy3MlNOv0UjBI+JyVp+ogAkkVamnkQtqzM67Tz4wkxQ+6Ws4pxFclEsUqr2GYA hdpfUUpUnxsCyezJym+Swk9G7wG5xsd8znpad8mw9US+t+3G772kgD2vRWs+E/f2IsjY NCUoLxeJxzmGcTaKDN8pw91AbcAFdhRHIij55XJoEf9mHfzZqSGmPWfqU8DXqeXp4yQC LwMg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Kxnec7zn; 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=1731780195; x=1732384995; 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=oc0BEq1tDn0XraLjiJfKO8aSBDiXQKt9dT77e3Zn/sM=; b=M3X6xll8tgyZkrfpZW/MrDLRfiEilTpHLiIdwPvmjLq/OvhBbwJXmRRtaybNRF7eHd O/H7UyGSz9/GP0DTunFaltNiBcdpui9OVUu0m+0wnvQaRO83NNkUw5vHvs7uqKyrpr0c P9qJyQkhig1rjsY0KS/2PZnPtX9BksnsiyH30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780195; x=1732384995; 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=oc0BEq1tDn0XraLjiJfKO8aSBDiXQKt9dT77e3Zn/sM=; b=ljzmM5UFibh1hZLoTFiMFqLyl0QuxgFmTFkGuNu2HT9AkcsdsGbgYbSJAPl6ke9yZe /LTfd4dV/4HWoPXW2U4tgbTKIRaEEPJSaPjJ4lrT/ZrxewEbJUOgVTZpgByVBF2WWlpR C/xweuAsn+pUVLpFuBVFh949pBUKBT0mL1qlLPFPhyNVrooaqaxrqDShCD/2YTb8+HhJ vX7mrC89zR4XMRbgbJe9xTFXMJKsbvkATzdvkaKQAFELHw/jAQBXt1cLOslw9XCu5/Lk 8wKsih1Y5+Ho1eMLkkNCn2ESdY9N1Z2h4jvR+fH9/Y1jQ9wuQqlFqy9GqYw7J4Ot36lh HhYw== X-Forwarded-Encrypted: i=2; AJvYcCVOaShSgPpFxHv6QF+QQ/1IMPylljVN+5Lj/B27aMAtwlcOOQnYEHjSPVBD0tFXYO0QEEWxv8zDBS2bF/85@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yzm8tJatMoipgb9zAtW1BLR/tG20ohkDjj9s97wnfoi1206vhgN KcCZaq1MGe5qk+uyNQMzDCjgUxWiWpOa5heX9a6bku/BoscefnkEM+wvoHrQ1HH9Yw== X-Google-Smtp-Source: AGHT+IFAgQbTVlzk3Pk2pPOTKNa6lxdb+gz+Fd1GHaUhJoheXd7ZkmcALry+7/vZfY/POnfuAmBTGg== X-Received: by 2002:a05:6402:35d2:b0:5cf:924f:9981 with SMTP id 4fb4d7f45d1cf-5cf924fa1a2mr4542473a12.3.1731780194809; Sat, 16 Nov 2024 10:03:14 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:7d7:b0:5ce:cffa:ffd6 with SMTP id 4fb4d7f45d1cf-5cf7580a055ls272730a12.1.-pod-prod-08-eu; Sat, 16 Nov 2024 10:03:13 -0800 (PST) X-Received: by 2002:a17:907:844:b0:a9a:13dd:2734 with SMTP id a640c23a62f3a-aa483489f26mr694022866b.36.1731780193011; Sat, 16 Nov 2024 10:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780192; cv=none; d=google.com; s=arc-20240605; b=d2FUOh7osP4Qw8aLrhPpnLPvU6urSJ5+u0QKIFUlLkGiWx7tgEknlSiQhr+5jfT+nL HRY2BxrQNXRoAP6FF9hZDkiJ9HTOIGLsvWj/+Qm9R9C9ssS9gGCWaxeB+7f4JmVPupdo H0NCFJE48h7CMcqh2mt8k3iygIQ0NdYraK1DxotvhEuhtqaA+wJELoOeo043kADU7DkB YgGOi7CX8Xl6MY88RBXLGjm8uefETvMRiR2Hj2TUySWfqyu3kEG6PiSbNS4dWo9zbyRO G1Y5f9v8gLXcLryzOBqhW8I6/MBkJcRJu12oEXl2iKyiqtogst2h90YwhLVwWzhB5Dod sXmw== 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=u1KN5qU2y25n0Oin8u2W01ajVRL3l5JZUYgBLtna1CA=; fh=3A7bBjFXyCe//J91KmpBDjj/htvOA85yK7yfUMrsV0M=; b=IPdQTTVMxkDvLNMM5RUa1TOh6fXvkbHLXhRIq26Q0/WYWsJcuLzJvqv0XB/TpPC/Ka 5Jxlg/aVCw9IGpuVQ0+8PeOaWakBKRdP75V7YYvD0Zk1HFCrX6TNZ0RRwrrJWpNGQ75G P2SaQ77H386vHNAmSk3SNXToOI8N3DwrP9P5CtScIWEkEbM/PNq1qhh9m3aU/FencCD/ Uk93kjs+F8WswbOE+ZHuk06tz1vFaauAPRbWFxlZTGkZiX4x2WYxeVhvrJx+I7SGCuMJ fJbo0zspjgw7tECeFwJTTJ2huT3F5IymPiB3+nnJw46Ey2FbueHrmfLOWOMvedR2/WsF 3q9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Kxnec7zn; 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-aa20df62ebdsor233271566b.5.2024.11.16.10.03.12 for (Google Transport Security); Sat, 16 Nov 2024 10:03:12 -0800 (PST) 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:3689:b0:a9e:8612:eeca with SMTP id a640c23a62f3a-aa48352b54bmr627153166b.48.1731780192655; Sat, 16 Nov 2024 10:03:12 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-54-94-193.retail.telecomitalia.it. [82.54.94.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20dc6d364sm329549066b.0.2024.11.16.10.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:11 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Akshay Bhat , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Krzysztof Kozlowski , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 3/7] can: hi311x: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:32 +0100 Message-ID: <20241116180301.3935879-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241116180301.3935879-1-dario.binacchi@amarulasolutions.com> References: <20241116180301.3935879-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=Kxnec7zn; 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 hi3110_can_ist() function was incorrectly incrementing only the receive error counter, even in cases of bit or acknowledgment errors that occur during transmission. The patch fixes the issue by incrementing the appropriate counter based on the type of error. Fixes: 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver") Signed-off-by: Dario Binacchi --- drivers/net/can/spi/hi311x.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index 148d974ebb21..7a4d98037cd3 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -701,17 +701,22 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; priv->can.can_stats.bus_error++; - priv->net->stats.rx_errors++; - if (eflag & HI3110_ERR_BITERR) + if (eflag & HI3110_ERR_BITERR) { cf->data[2] |= CAN_ERR_PROT_BIT; - else if (eflag & HI3110_ERR_FRMERR) + priv->net->stats.tx_errors++; + } else if (eflag & HI3110_ERR_FRMERR) { cf->data[2] |= CAN_ERR_PROT_FORM; - else if (eflag & HI3110_ERR_STUFERR) + priv->net->stats.rx_errors++; + } else if (eflag & HI3110_ERR_STUFERR) { cf->data[2] |= CAN_ERR_PROT_STUFF; - else if (eflag & HI3110_ERR_CRCERR) + priv->net->stats.rx_errors++; + } else if (eflag & HI3110_ERR_CRCERR) { cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ; - else if (eflag & HI3110_ERR_ACKERR) + priv->net->stats.rx_errors++; + } else if (eflag & HI3110_ERR_ACKERR) { cf->data[3] |= CAN_ERR_PROT_LOC_ACK; + priv->net->stats.tx_errors++; + } cf->data[6] = hi3110_read(spi, HI3110_READ_TEC); cf->data[7] = hi3110_read(spi, HI3110_READ_REC);