From patchwork Sat Nov 16 18:02:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3635 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CAA7140F50 for ; Sat, 16 Nov 2024 19:03:12 +0100 (CET) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5cbb635c3f3sf3272394a12.0 for ; Sat, 16 Nov 2024 10:03:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780192; cv=pass; d=google.com; s=arc-20240605; b=UevdVBLhz69eV/K7e5s1IZU+mN8sKLJkAK6Uj+F2rBojYAxPidvaGh68IZaxttAekT TGmXR+nuPZutt7Jn4VwqGDK8oHqFqbTxFBnXm7s9kWFlxfOEuhE5Q53PIU/B9rM9/8tL ASVaPLlFzJdqobwZtAwqcZ+3910K8eqVBBCuBXO0+7FEavXBDwrxFyYYumfPxgi7/Wqw m8IopU0dBgcNoF6qEFkjrd4f9WIKI6TqeXMuv7Hi68rYJE7Pr+kXIlMIgR4ksqfzfM10 bd7p1ZmB9q+0zWjnfKHVnL/mMHumIYm+qPdMw2hNSchIX+CgX8NiLyJv8VTr5VFiVKEX 0uuA== 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=sSnjqTjrMReE9dNke9X4llcG9gdxCj8rFbKZGQCHg40=; fh=sIzXHoPHDwPhJagWNPKf7Erfy4MI7oDRtdW2NHENb6E=; b=L2N345MNVk00hcEHGxyX5ccwAz2yO8X2mV63m+N1UkBYXBhSWGwHxsM/22UK8Ew6Wo ha9cSOEr9vFaV+f2fWSAhIw1a/bWxEaZFKwJjy/+pRJklueAEbYWBWBa7tf8im2DJWhJ rJtvmn84Lerj33/Ze8xFTazw+S/uCkO2QPP6uYcaBOaI8V/bh7nCdKNbifZRziHdYERW xrR0xeTZcf/+MghQH6BGrOIwhD+wgEluG3UqnIkwoltfH7tFyWRd5KQpxUdKk4/7jyNS dAckBHIilnP3L5O9+4bBLuzBKcYR4SiTXsKLWpivaBSDs2hA7yaNeWAXlQgh4m/UFWfH lrdA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GrQdhfDh; 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=1731780192; x=1732384992; 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=sSnjqTjrMReE9dNke9X4llcG9gdxCj8rFbKZGQCHg40=; b=JVXnWTmWO80NBjItE8gnv+Qnz+FBpxwb2L+xIqBIo1GDrmmF7aNP9of4pjB3hpnWox 86Oy0g0DFfYm9vhlh8zLejokmAprs0vzc3qN/wk/zAYrezsCPx6Lgha4H95Ovgv3Auhh IUwtw9qu7ywHiQCcqFbsTrHQaa84tZJrlwOFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780192; x=1732384992; 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=sSnjqTjrMReE9dNke9X4llcG9gdxCj8rFbKZGQCHg40=; b=pz0i7s9ALHL6n9ziK6RXgEn3cofNX8QEjMb74gGOVLaEg+UhSAUDY1Y4tStCI44py+ rTzzV4EeMz+EqwpljdazVZVNrcix5I5un0zqFU56HQmpBiW4D3t2T0ugfoDREFJgd4Cx Z80kL/fnGEm74h5hZruYfh8LEqd26coTeCd7+oX9lHYYnGWLi9myhC5WkP1YXiSLspsb fKJDgZTi72ZugCQ/c4pUuo9yFg8Vs1t0+IhShJHMs4nFjDL1CkX6mYRca1sTahWQwYaU vCSgEkHPo58rLVWgyGK7xSlrgPqxAliXku5GR4ZJhkYGBzhuwPSuxJOU3253Mbk5Jwlx qZ3w== X-Forwarded-Encrypted: i=2; AJvYcCXYUsVmkuWi2649qWF4lXybowquMnNtjT1b8Q4ZaWmvILDnpLblt3lWdZTyNiJ1mlkg0lPL4dDa0iGlYp8S@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwTe7VG4zDErosTqWhsN9ytWFYVorfiaOEt/7K9KvlU0Yf91t03 G3gcnDEUhoKgO/xn7YjHuCfkrxwv6DCdYr4uobFTNRdzAl/LK1p0GJrqp+cVuE4rog== X-Google-Smtp-Source: AGHT+IG9wSJCJdOR0PiHN2b0TdfmWABvMUolHgUTQKSSA0VXfEfk8dHZ/u/L0pH5EkMNGmltIq0BIw== X-Received: by 2002:a05:6402:3223:b0:5cf:af26:3da9 with SMTP id 4fb4d7f45d1cf-5cfaf263f30mr1729924a12.12.1731780190967; Sat, 16 Nov 2024 10:03:10 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c713:0:b0:5ce:c9e0:aece with SMTP id 4fb4d7f45d1cf-5cf75811ccdls936309a12.1.-pod-prod-00-eu; Sat, 16 Nov 2024 10:03:09 -0800 (PST) X-Received: by 2002:a17:907:1ca2:b0:a9a:cea7:1294 with SMTP id a640c23a62f3a-aa2077daa13mr925029166b.21.1731780188693; Sat, 16 Nov 2024 10:03:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780188; cv=none; d=google.com; s=arc-20240605; b=Lki4nfOEcXltWgoKSBRPw2dOclQk4E4NZ4KUPs/9TAC5C0CNObnEdFy5Jbe/AVsq3i GK8JUtEuk32uaCJinEtHqm7anTBSk4v+Zmk45h7zJArdR+xYqKIT4E2bnLdNzC4iBnqh DiUwJ+K4SVnvsEOW5rkTqqmQck2qonRUYazhHko2ASz8DSk1w08w8yUdnGSXmQrN176y unjyMn6E8l7jgQCNpcYJKAr88Z1oed8sfLNoOvrIwvTKeJYUzFk1c9zvxdZqV0K/4PNN +ixsZljteWWIHu866/vLOkW8N1U6R8mlcUFauMn910sOX+ecxBo0pfyMXzu5fAMnE1N9 gLQA== 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=CGnFcahEd0eVvjCCPAmskcKVoLg3YmWfRrAxcNnhTVM=; fh=KeReC3nnD346ijkxCEzJhs5I81j2Y6xGUTEgMvmTwfY=; b=Bw1sRsmRY6nooReqIZU0D5XVrHSju64YibETTG900eDq0m3Yb63zRYx4zYxNwh5kVl KmH3z3zs7xdYfrp/kWA7j4dBRGYxU3upzK86b7YQORLrXzafAaskW10ZnWC5sW91rFIe 9zPsQjMVsGBUcDUXKtuO2farffknAm7GukU2Le1OzbOZnuFnYKk5FA62R91ud62+/uAa 4swyc4c4rJr6vVNmHOXCW6QDdOeBD6b+8K5kCy2xxarjOOoSYY7Ihtj/W0bepmr/wpR3 3VLyJCINGMHSdP40DAmBdHSmDcX46BaTUuhycdrmjoBEaEC36m2R/6En6vrSePLyBThd 5F4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GrQdhfDh; 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-aa483a7860asor153129766b.7.2024.11.16.10.03.08 for (Google Transport Security); Sat, 16 Nov 2024 10:03:08 -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:1c9d:b0:a9e:670f:9485 with SMTP id a640c23a62f3a-aa481a5cecfmr569044566b.30.1731780188249; Sat, 16 Nov 2024 10:03:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:07 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , Chandrasekar Ramakrishnan , "David S. Miller" , Dong Aisheng , Eric Dumazet , Fengguang Wu , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Varka Bhadram , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:30 +0100 Message-ID: <20241116180301.3935879-2-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=GrQdhfDh; 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 m_can_handle_lec_err() 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: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support") Signed-off-by: Dario Binacchi --- drivers/net/can/m_can/m_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 16e9e7d7527d..337ccfae34fd 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -695,7 +695,6 @@ static int m_can_handle_lec_err(struct net_device *dev, u32 timestamp = 0; cdev->can.can_stats.bus_error++; - stats->rx_errors++; /* propagate the error condition to the CAN stack */ skb = alloc_can_err_skb(dev, &cf); @@ -711,26 +710,32 @@ static int m_can_handle_lec_err(struct net_device *dev, case LEC_STUFF_ERROR: netdev_dbg(dev, "stuff error\n"); cf->data[2] |= CAN_ERR_PROT_STUFF; + stats->rx_errors++; break; case LEC_FORM_ERROR: netdev_dbg(dev, "form error\n"); cf->data[2] |= CAN_ERR_PROT_FORM; + stats->rx_errors++; break; case LEC_ACK_ERROR: netdev_dbg(dev, "ack error\n"); cf->data[3] = CAN_ERR_PROT_LOC_ACK; + stats->tx_errors++; break; case LEC_BIT1_ERROR: netdev_dbg(dev, "bit1 error\n"); cf->data[2] |= CAN_ERR_PROT_BIT1; + stats->tx_errors++; break; case LEC_BIT0_ERROR: netdev_dbg(dev, "bit0 error\n"); cf->data[2] |= CAN_ERR_PROT_BIT0; + stats->tx_errors++; break; case LEC_CRC_ERROR: netdev_dbg(dev, "CRC error\n"); cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + stats->rx_errors++; break; default: break; From patchwork Sat Nov 16 18:02:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3636 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1C45140FA3 for ; Sat, 16 Nov 2024 19:03:13 +0100 (CET) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5cf735604aesf1540034a12.0 for ; Sat, 16 Nov 2024 10:03:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780193; cv=pass; d=google.com; s=arc-20240605; b=b6OoAy1F4ANfd+WaEGVUHGbLw0u0uFOmrokG/Jm+QxQGxjPesoqVpGOkBad0duFjey N3Ha3hgFYz1m14imHVbBB6I6DRfg5iJKzfIk/ur5scWnpD73QXDw/ryZbs8088va8Da0 64XyOapdubkxE+sQpLwgdhMNTTz2ci5KQ6fl4r9IQ86F4AZ9KvvCaZElxJ3ROBdDdKRZ I82EtL7sdHFXzRnyA+8n681LMbGMp8NGOoS5qxNEQvjRXveGjHTcBSb4BddVgfzpa7zY SG3D/BtqTpJUBqeCL05nBLZv4kU6ICX5nS0hzo6UxtKO3LBR2VZHhV/xpUckfqugmY8i eXsQ== 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=dc+f1SJ7198p4E0wz+dkc9acxmP3Wcxase1OKYtnABI=; fh=B3VPgiaRUBpcfNEfmRv1Sef/bU7Ic5RNuzxPvOmUYIs=; b=A0wh2XqnWds7E3Ab+m+NoUMSKZCKAeCKjOvxq6R/v3x5rq80dCMaAWwb/yv5Y8ptds tG4kcHjhxzyS5MMbZTFpMp8DOaLmxUvUo/R/5a+shzeSJqX1mznwGhDdF0oQqZOtBEna wxrhKFWaridTNOArPN18d9LD5oXqCe32lLlUfS+De4ua9rNMM2MmXUKV2YBplKsjulEj FDMjgwZ1glAMK9bc2XfI/6fIn38iBpDTP2E6/kPPkIDL+rA/M3iaAUZw/Q51xb+gfdYD ul/k97tZsTg6nl8GIDCvVCKGeE6evvkt0jWvx7CKACGg2aoxxClspFyFdzPRkkZbcIx0 3MsQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RCqShqNH; 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=1731780193; x=1732384993; 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=dc+f1SJ7198p4E0wz+dkc9acxmP3Wcxase1OKYtnABI=; b=GnAW2Jp7cXu/GnDxBob95YT7CBWPiQLoO0fxH4ObUCfZUn9haFP8K1BEZChTwRPgE9 xd4wcXxIxrxlmTqhPq+4Tgu9jFmVwa7idUTVKtAZrDUeT08G1eND8/W78mceHmnXqaxs ozEU7YCjcIzibmO+JZwFd/daN/7mYZNjWZ/oE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780193; x=1732384993; 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=dc+f1SJ7198p4E0wz+dkc9acxmP3Wcxase1OKYtnABI=; b=g/nRJGPxPfeLq7s3Svo1cf3j2fzNbuxpG6fdFi9aWBtUk6dxDzO3zmhpsgsNoT2fn9 J0Mv/RG33BqwPB12KJaqhBPAviRlA0kWaWLEdYrWXiOgWuXJHcU0vvfrxjeqGWBnv8de 7E22/nFWFMayh0soAezvTE6c9rNc8hCD9dthMhm+fkku7ZtzVq34GGxSxfcKvpsZeLZ/ tAvjYrkGMn75Jb2rKBdCgDKCfH4MJ6Cy3IDAO8aT/0TG3KEFkh4odJ1sqsAr8KiofT4N qfATCuVCmbJMJ2unCH3fm7JSe6LQg7VCtojY9Lr2ZtxOcUFBGTvOqX70UKqiMEzJ9S/+ AjFw== X-Forwarded-Encrypted: i=2; AJvYcCVUzJHHHw7akmlZbsanOKdWCquF5damMd0CgkNEFKg1faf3RmtXJQpFbSmwqRRVK5IPsbu23STSR16eaR0N@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyBcxJYZQUa4bS9yRvGPB6uWAk2CNzwNg1MK9QCG8NST9w6fC2c nxTYftchVHNg86OlNGCXY5+wyAzs8SMciHJ2HiNwCkN2d322EZ7oXtlfZZozKH1nRQ== X-Google-Smtp-Source: AGHT+IFb0/aB9/PnfVhoWajPhn1W8zpxXdvfuCMKVkK3Fj2BkEIZhcLKtFfy9TWCKjEMbga6/ti8PQ== X-Received: by 2002:a05:6402:234d:b0:5cf:ac34:380a with SMTP id 4fb4d7f45d1cf-5cfac34390amr1126488a12.29.1731780192391; Sat, 16 Nov 2024 10:03:12 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a50:d513:0:b0:5cf:9005:8b8 with SMTP id 4fb4d7f45d1cf-5cf900509d9ls32917a12.1.-pod-prod-03-eu; Sat, 16 Nov 2024 10:03:10 -0800 (PST) X-Received: by 2002:a17:906:da84:b0:a9a:14fc:9868 with SMTP id a640c23a62f3a-aa4833ec172mr726855466b.4.1731780190592; Sat, 16 Nov 2024 10:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780190; cv=none; d=google.com; s=arc-20240605; b=QieXoBbnXypDOn7sUwjGMUbAi+5lhsS29F1mUwQUVFCo1WtwrZWk4wz3taPm83bjnh /1UlAf+WuGFt2GVNvx3hixnFkvTA2nDrMUjE7AdI3cjllEgFKf2wQYjQJCrvF6++G9Lo fKIzRele81++UVO5P1275EW2C+OlfoOH+83Q3bi7E5i5qcpQh7oilZ9/qXsfEapywVkO OOxQhuhSwaz3bSx56dBB/O8ywJ2h1AneZ5+5CUwniPOFUyCJLvby/zaoLS/WagJ+cA/s nATNe3oV70WfQrZ9rfPeWheLZmUvCw9OVdVnPKaX84iiIInal2focShdkEEIEo3iQFPU WLNA== 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=MKS1He5MRcB9KzHlUh7sCjUXRUA/E/nSRL0TriRLZjg=; fh=9BOm0FE2iq547O5K8zQAxVLs9TFErhB6P11DltiAR34=; b=SgRmKV8Mc+XtWx7v6d9FakI4crj8Jb0TcuTiR7i/xOAwftH2I0LqzebAxKymUAWtnP gAYgsW4Svk7CFWuAohEDVfRco2KxXcn/NoYOq6wAeUb7u6nA4dpFCq3aNdoQYezxWpCV BvbY1mNEfzidry2VB37mH+Kq+NEv5uBbPT3GxZhpaQ4VAVJru7520UGYAVBslmXm95lm vp5TmN1Uo9eiCvCpj5KOMIjuX71ihDox/2viCVE9wKXiQ3QETwZf9jM/O59mjonjQnaB 4TfDi6E1zWtNJwB9X6NNlbE0l61CNzcwAWw8m+9z4QmHZ4bUV0HpvBeDSU+VIjfKVKJm hwkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RCqShqNH; 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-aa20dfeaf70sor245012866b.14.2024.11.16.10.03.10 for (Google Transport Security); Sat, 16 Nov 2024 10:03:10 -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:906:d542:b0:a99:f887:ec1d with SMTP id a640c23a62f3a-aa48354c913mr613773866b.49.1731780189884; Sat, 16 Nov 2024 10:03:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:09 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Marek Vasut , Paolo Abeni , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 2/7] can: ifi_canfd: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:31 +0100 Message-ID: <20241116180301.3935879-3-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=RCqShqNH; 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 ifi_canfd_handle_lec_err() 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: 5bbd655a8bd0 ("can: ifi: Add more detailed error reporting") Signed-off-by: Dario Binacchi --- drivers/net/can/ifi_canfd/ifi_canfd.c | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c index d32b10900d2f..3944821303fc 100644 --- a/drivers/net/can/ifi_canfd/ifi_canfd.c +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c @@ -390,7 +390,6 @@ static int ifi_canfd_handle_lec_err(struct net_device *ndev) return 0; priv->can.can_stats.bus_error++; - stats->rx_errors++; /* Propagate the error condition to the CAN stack. */ skb = alloc_can_err_skb(ndev, &cf); @@ -400,26 +399,40 @@ static int ifi_canfd_handle_lec_err(struct net_device *ndev) /* Read the error counter register and check for new errors. */ cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; - if (errctr & IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST) { cf->data[2] |= CAN_ERR_PROT_OVERLOAD; + stats->rx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST) { cf->data[3] = CAN_ERR_PROT_LOC_ACK; + stats->tx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST) { cf->data[2] |= CAN_ERR_PROT_BIT0; + stats->tx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_BIT1_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_BIT1_ERROR_FIRST) { cf->data[2] |= CAN_ERR_PROT_BIT1; + stats->tx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_STUFF_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_STUFF_ERROR_FIRST) { cf->data[2] |= CAN_ERR_PROT_STUFF; + stats->rx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_CRC_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_CRC_ERROR_FIRST) { cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + stats->rx_errors++; + } - if (errctr & IFI_CANFD_ERROR_CTR_FORM_ERROR_FIRST) + if (errctr & IFI_CANFD_ERROR_CTR_FORM_ERROR_FIRST) { cf->data[2] |= CAN_ERR_PROT_FORM; + stats->rx_errors++; + } /* Reset the error counter, ack the IRQ and re-enable the counter. */ writel(IFI_CANFD_ERROR_CTR_ER_RESET, priv->base + IFI_CANFD_ERROR_CTR); 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); From patchwork Sat Nov 16 18:02:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3638 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2636E3F033 for ; Sat, 16 Nov 2024 19:03:18 +0100 (CET) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5cbb635c3f3sf3272431a12.0 for ; Sat, 16 Nov 2024 10:03:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780198; cv=pass; d=google.com; s=arc-20240605; b=NqwXgT+okENuDaDAMf3kX4mhUNJpCyck4O4A6kddSs9+ImtqCmhLe1q0z6e+ZgOAGY OHEOMgQLzshOgnqzetixPrXhsVCNSNOR3/wRDEBIgRRbRb+jj3WZZTQAEYV0U9h6rxLK KmVOgmdrX3NV2fFbXcaXRmUH8rPhnI3d0sjWoIDQYme4qlmFcUIfQ4/BBjNa+01k7agU FQrr+7r2Elx63PaobLYYNIm0gDFCw9HJ3oRb4q3vqNpDvCwzLzSxWeMptY3eLVyvUPQk 8azkDWnbo0CMYM+rsXxNoaHScnaVdTTlPY7Rpyp5TpFYUrtCj27dRKpicP+AgSQwe0Dm Y+7A== 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; fh=pddfdvrZxjJPM1XbNBioaHgl3K/PlbN/hXLw2Ic/4Ls=; b=kcGMnjYcI4YR0TLgprw4xVgtG+/ADL6UqbT+WnvOw9Kgk21IiYU8LPHNetYFrwt0qA 5dC4YafmHerPQUYnxOI+VYzhVgdAIWL/Fdkc2F8dD035IYfLOZigc3Koaxg+HFs42oCm fw54mATKZOi1e/nqnhlI6InYFR2CtpaYpZaKtCq5NVNTLk4vWiG35mMzl6YtGvv522Ba aaJil/IQUe2qe11SNZF7W1TB+H7PZxPgX2DvnAkYVmAE39ti2r9pjnpDdbqcMkppOeio EoBT6wDiwmauPfDtDXS1lMZe+dDDnxfOMTOdRT4mo4scnuavtZ2MByRfFyYjbHb9K1d3 ykAw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JKBrPy2Y; 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=1731780198; x=1732384998; 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; b=G5SJp9L4Ya/bGWEkAKJXiOq7WikJsVvTXoYSNc3GxTOEUGZ2gZM3RLerVJn1m109U3 idGcRA4n3pJUKN9oJt7yADkGdSTcsHomol1vJeJqCK3vr3PdtEKg3idO2P5S9AZMlMXL GabDnK6KD1LNxletY88JcSdTs7HpChPldJC80= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780198; x=1732384998; 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=jBiwzOqvTn3Yn+QAYqzbFb59tK0DW34tuLaePDLjGY0=; b=RtXgUt+FEOBVZnC+ZeBes+joWEJscDppGTmezs1cF6JEemnTD87Clw1bAqfc5+Koxs 78BC8pgLF2Wv44/9P/YMtkUXcgdD0EWYXYOceNprBtVzKysVRuzidGiMWdhSxpu/x3Cb RXQjn0F6BieIsq8a0H4i3BQkhCL1mRlG/vbCjGBx+ty0YyPoR2zy2vvOTen7CzCH1f9n ms8zAcef87cZ6chJ7f1tNQs5n5eYCXV6t1YHd4w4/xQaDLJ7m5oBzPwkIu4seCG5+Bwz /37CKIwovcYX3VDWRQ3ccK7ipprDTArUMe2ZUEo+AhNrIEspl43zjalvADKQRRiA4JjE DyUw== X-Forwarded-Encrypted: i=2; AJvYcCVmWYYt6Q8s9kM9xgrI1L7Q1QrwaJusZ2Zefh8R8eMASQufhAy3aQWTMzeuVnknFyQyasHdSkaJqRlCh++7@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxayxE+VTsOt7SJynPYui2J9jPw12sO8l9IU7I53dY3MX4D5wGF Fv3NxK7qNrrowXXe1Qc0Zx+IRu0+siMg5a9EHRkRYSNcKjnKy86s5Z4tGx42Te45VQ== X-Google-Smtp-Source: AGHT+IHQHzayMoBTwcxvYxRLjWEIkp6ZRE79YMpowjIN9Hfz4QzwBJ2mo5KXlEg2N2tp8heO0gW1fQ== X-Received: by 2002:a05:6402:1d51:b0:5cf:84c:b7bf with SMTP id 4fb4d7f45d1cf-5cf8e0201d6mr6565605a12.15.1731780197449; Sat, 16 Nov 2024 10:03:17 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cb58:0:b0:5cf:b908:ac9 with SMTP id 4fb4d7f45d1cf-5cfb9080b53ls105382a12.0.-pod-prod-00-eu; Sat, 16 Nov 2024 10:03:16 -0800 (PST) X-Received: by 2002:a17:907:7e97:b0:a9a:6c41:50a8 with SMTP id a640c23a62f3a-aa2076eb6f0mr1057646966b.17.1731780195631; Sat, 16 Nov 2024 10:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780195; cv=none; d=google.com; s=arc-20240605; b=LF24hRmnTYwfRTpAmyXAHMHB6QtdnPq1JI9gDiYknBFyw6eO/KjGgUun9oSmAvLyqQ ZInwoRT1+qZKUskua1N1ywqYbz08ZN1lzRtEtg+yf7VOfrKrRqB7Dh4Jrjxj1tyr9nX7 abJVn5C0b0OdlkBIOxH7GafGXDrcVViLcMcL/RDCG36Gl5BtaqX9/HrhoTvPhJ2ZY5LX WRB+07cNOAVXFerVxtoP7O4XmK9ann9c2BUPDPLa/KXhG3ZbVxR424YXajjxXDu6YLdO XgPC6CQyrij4p1GLXdh2NBEYUF4hasvL1mBj/1DvxP/8Ms4M0nlP7i+4w3fFYwIbDaXq ZhLQ== 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=IPi0av2xe0jC0J5HdvNkCxIcsg4iO3imVdR2/hegefY=; fh=kANvBLcOhPhiwV0mTAyK0Gohqy4zfT86FGYABDp4o0A=; b=ZfcccR+rG+nuO7MdyzL/J6Jka/VJIqEZYp0kFZAL8XKitkDWtDks/J40ZtwWNM1Bs3 JQmL4nuNNpmLhHPFfbVu6OZi6/RxdJeuKJw51u+eKKU26+jtKPZI1TbBpVJ9GJ3Hn+2A r0nkCimvy3UPhtUmJk/0CmSWbQGYdJWOsH28Fi6RzzXzKGmcsj3z2HFoNg5S3wChjzmy iLfMcQ4IsI0OJYwDur03DKqXVtglT3VILU8Yl7a4ap8U4MxNMzUg8QFjSjfP3ZMy1HiJ oc8BBoOPoAMHzXOD6419Zs3BzF399WZkPAa9Qtpj9F/dj5rIn3Z/MmLNTEofQXb11QHo JT7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JKBrPy2Y; 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-aa483a7ad04sor140369166b.9.2024.11.16.10.03.15 for (Google Transport Security); Sat, 16 Nov 2024 10:03:15 -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:9813:b0:a9e:c266:4e82 with SMTP id a640c23a62f3a-aa48185c694mr772769266b.6.1731780195092; Sat, 16 Nov 2024 10:03:15 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:14 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Oliver Hartkopp , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 4/7] can: sja1000: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:33 +0100 Message-ID: <20241116180301.3935879-5-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=JKBrPy2Y; 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 sja1000_err() function only incremented the receive error counter and never the transmit error counter, even if the ECC_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the ECC_DIR flag. Fixes: 429da1cc841b ("can: Driver for the SJA1000 CAN controller") Signed-off-by: Dario Binacchi --- drivers/net/can/sja1000/sja1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index ddb3247948ad..706ee8f6b7db 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -460,7 +460,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) if (isrc & IRQ_BEI) { /* bus error interrupt */ priv->can.can_stats.bus_error++; - stats->rx_errors++; ecc = priv->read_reg(priv, SJA1000_ECC); @@ -485,8 +484,12 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) cf->data[3] = ecc & ECC_SEG; /* Error occurred during transmission? */ - if ((ecc & ECC_DIR) == 0) + if ((ecc & ECC_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } } if (isrc & IRQ_EPI) { /* error passive interrupt */ From patchwork Sat Nov 16 18:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3639 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BA2843F033 for ; Sat, 16 Nov 2024 19:03:19 +0100 (CET) Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a9a2a81ab82sf249562966b.1 for ; Sat, 16 Nov 2024 10:03:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780199; cv=pass; d=google.com; s=arc-20240605; b=iY5/AardwezyQLvZaYMsZDna9bQ5XkQHO8ki+m8WI7SKVFMn49qi/dEHQp+0PfJvbD kTjo8Hktq4OuXDqv1WWeQOPJ0y8Oraq78Fp1Rp+mfWISKg7AwBkEkmpxNjLvAcLdlpta L8PoNz8UP74gMP+D86T9lpbvTiiSQH/nLz4RBm2E5OxhKNkab5UpT6du9FolDtf4vCH8 /2OLOcCRQR9RneMLkAiJwFdwFQF6PLjk1a3UjJSW31YUHqvx2DvqmVh0cU/ZAVoa6nKR Jm79+6ZGrBYyxZJwLWMOYlAIpyhdejjYsrYZK+wMfLrmFfV532FcvRvMY9/+IcJdSpqY WTxQ== 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=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; fh=Z3ZRqlZCGTsgcsGlia/lEoBOt8fivueidzTeNEiQwVI=; b=efyxTzoL/SGepx2jinnub6E3ArYSxBcSqR4mbPV35w190Zq7q/znrFwhkXyYlfYSKz SuoGuLIQf7waMl+MudxovVEBQ32Egishrqi0Gn6qaFkjhCfOoj6SMXGGxMkUe8vOm0rQ Yjds+x4BmXJBwOw1CBUM8MeIcThflWf+PXkmBD4+Crv3Irx5BCdU8AOYDfwPOkGPiMb8 BmjnxXa+k++xEw6ZWgrM1ck5zWxKKNGidMtyeRmjHeWwOzn1Vyvve7BxHZmfKg1PxTdJ noPEv1YF8wlySGTwZfDJBsIQKmgaNKNow9yUSfF7y37viYaZJaMPNbWo026ly0kVnijj Sidg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cXILc9M5; 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=1731780199; x=1732384999; 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=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; b=H6zx8rwZNeUVHm+GjMFUAaukodkap+ObRz1kG3nyTT4SGwkIOhS0PvXwHw5uWwiy9E Mau5IFI+2Wr6bV160YhEMgco92dKaT0fQ1oxuBI8iEtQy4KKH7fmEn8Hqq9k4hQokocf 7o8Lo8Srn92Ta3+RwJGbhN26X7CEmY39Sok54= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780199; x=1732384999; 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=C0qFVtFle5fxE6QMcRAVEaEFNUqeqTd47nCnm+bwbmw=; b=rqnlbyW45KqQD8z43olkjyDpdL7xmnN+4H8kR82q5acrPL8D5npx6RjQb/xtfdKTXZ qPr/xJMFMYhd9FDjKAa/BAix3z01/5zoATX1CuZqEo/38XItPgmfToFPDoOs8Du+PyIL ttRVMIi5kwmF4q2mSrQlqk0aI/F2FLyCKfYKPp0WNHOUgxg8xAKzkaxwajN8mmroNRGa 4r29V1Y3oG6W59cIDjEHlhYcJdVbOnOJMmYGoG05vGmouEPxX3whYt76M5F0sc3cAlrW Xc+aAonajzCbQyiK9gY7cXDhDaxcj4pSN40BjEkZH7o0mh68pCj0QeUsiXzgeAsvBNT2 vd6w== X-Forwarded-Encrypted: i=2; AJvYcCV4y64iL0CAIxOlwKd9qnKzmBv3n+NJ+R30d1fVETlpUvSWtskYU+au2tUMdoeXCqltLfQ1kG86TMvHIoBM@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxU4rP7V8tSmIRelvLwxlt3L6oagjppipwKPXjNwj1MlSGQ9Cb3 5z9xDxDZWZ8JT+3qp6VxttWSVhpvrBvpLf3IwUAvi8zYRqfNXQvvgo/A4lYm8PgGqA== X-Google-Smtp-Source: AGHT+IEzd9pJeqnevZYWE9Ti5rp7PgqaPFPA84YN7r/UI1l8jKvHMEI9Km7lLF87/tSYI9GHbkXGiw== X-Received: by 2002:a17:907:3f07:b0:a9d:e01e:ffa9 with SMTP id a640c23a62f3a-aa483482118mr592898966b.33.1731780199147; Sat, 16 Nov 2024 10:03:19 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d316:0:b0:5cf:3cb:951e with SMTP id 4fb4d7f45d1cf-5cf75765148ls259211a12.0.-pod-prod-09-eu; Sat, 16 Nov 2024 10:03:17 -0800 (PST) X-Received: by 2002:a17:907:3e8c:b0:a9a:67a9:dc45 with SMTP id a640c23a62f3a-aa4833f67b0mr638326766b.3.1731780197372; Sat, 16 Nov 2024 10:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780197; cv=none; d=google.com; s=arc-20240605; b=MYmuTtYPKKDCcOxqvIALdHvc0JCdDaF/zmsXRMaNrIcyCzMQZvvAzsYbZ1zWRVZ3B0 Q+/M/gMuVX0moB+WFliBBZyZdcjv18HWKMwPMmw0jQIGQnlurG1KL5g/CWQKrFZlV+2Z QZjterZGjMy7VADXrrrrQGn6ZQmErkW5Ff+3Use5UZVwM5lQDbtMDoHQ7AmFnxw9WcrW dOv05Qf4wRekjh0FwIRdD3MAcfPLY/ajc7naRAU1XxcIttl6G4QBC+IRwfesxF19Tzif GaOhtp4llyc2VhvwNwrP0sIYZ6P2DaEkJxBNWF4+mG7jcrpsHY+8/T26TRBylqWx9NWX kV2A== 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=ZZp2LLELhHXaHE6P8yqyIkdBBd7fnVylmpcd4GsYhTg=; fh=d+srdeq2fO2UyUWqLmmI1L5Gnv6o+Yv6XGzq38UYMpI=; b=J+uVSlzOjOoP0UfB3NmuD15lhp8RXRU7ErMAHzoZNz4k3CwrOvODe+xKKca9Am8Bt7 lFU5RcKliqx87scxvo02xn8ZT+dOsGdJmt3eQkVe+DnxW5xNfpi3Rz5HnDOl4UfCxZt1 bk+3T4P5XHw3DBwXt8fYrdx9JsIDfyJzEEfq6+ZniCSKhGBVk0UXIlurtgonpcxMOITZ 56DNfoUBDq77hw9kj+z1VNGOKZvBELGhUBddLU4ExuMkZIOr7c6vA6waKRWY03T5kyit 0E6F/kFZ8m6YsQGympBvkUXJt903OZzb6xM58YBTrFg+HgX5zLZSBdMuWftN8JciiEIW a+9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cXILc9M5; 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-aa20df505d1sor246492266b.5.2024.11.16.10.03.17 for (Google Transport Security); Sat, 16 Nov 2024 10:03:17 -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:d24:b0:a9a:bbcd:e63 with SMTP id a640c23a62f3a-aa483421c58mr612801466b.14.1731780196892; Sat, 16 Nov 2024 10:03:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:16 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , Chen-Yu Tsai , "David S. Miller" , Eric Dumazet , Gerhard Bertelsmann , Jakub Kicinski , Jernej Skrabec , Marc Kleine-Budde , Maxime Ripard , Paolo Abeni , Samuel Holland , Vincent Mailhol , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-sunxi@lists.linux.dev, netdev@vger.kernel.org Subject: [PATCH 5/7] can: sun4i_can: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:34 +0100 Message-ID: <20241116180301.3935879-6-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=cXILc9M5; 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 sun4i_can_err() function only incremented the receive error counter and never the transmit error counter, even if the STA_ERR_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the STA_ERR_DIR flag. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Signed-off-by: Dario Binacchi --- drivers/net/can/sun4i_can.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 360158c295d3..40939141749d 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -579,7 +579,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); priv->can.can_stats.bus_error++; - stats->rx_errors++; if (likely(skb)) { ecc = readl(priv->base + SUN4I_REG_STA_ADDR); @@ -602,8 +601,12 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) break; } /* error occurred during transmission? */ - if ((ecc & SUN4I_STA_ERR_DIR) == 0) + if ((ecc & SUN4I_STA_ERR_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } } } if (isrc & SUN4I_INT_ERR_PASSIVE) { From patchwork Sat Nov 16 18:02:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3640 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C9EAE3F033 for ; Sat, 16 Nov 2024 19:03:21 +0100 (CET) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43159c07193sf7049785e9.0 for ; Sat, 16 Nov 2024 10:03:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780201; cv=pass; d=google.com; s=arc-20240605; b=OJSFl1H8HMizJfJM4qu5HMBBjNZ6PgH/1b59+0bOrNubm7+rgALntrtTsog+Hb6Yeb Fqu8uYBOs7LrvuRzHGvfuzuWPbAC643zlue3SxVs9YG0a+/FUw+ZaO83MEHSQ6FjGygt w3tNp6nQoqcO9LEyZ0W53pj0DtBRJV6vMCKlF0B4KEAcEa3eklnAcoknuqHACLWSovJT Zm6hHOk/XXPNFiGT+H4oIrq/M6QtkbWT2KuKW6ILsCedJAuxwHN20yEioswCuJyeJUd7 XUg8gdFOE3Ih5nzXajR5C3bmkNtWrv88pMBY4cW8D2TWKUc9nYoyagNniG3Cq8wUH+ko fBrw== 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; fh=UFdzE1rDu22FUY+RgjwObJQMwofv2XTV3eUGH4S0sfE=; b=ODq9znqNUtJbCauXqxrN2tMwn06AHv0GpWAU9LFhgv7gbT3omV09Z+NyFURncBuEvn Nlw6TKGoNOkfJX1cdpuM/1Gt4uuSRsaPXimYHZzeuQ8SjcIcU5PsYaDRf03Mx8YWrjK0 /4JHIsjfW1pI+Ot7NWsrFuIjr3N9HKVdu4eKO/LW2cLTc9KA7NGECaUnpc+X+qB0n6oi x2b2d7nRQaG7mDzRS8gC6i8e2I2FxR5wV1usPIfmX0CCpmLyOV5aJVRSYZkqrjVBEDJc 7mQB7Z4GwXSmNVNFoaGwyaYVJKnKkxjArSdcQT6SckOu/4d7QLfl33hk4oCvUObqmyLL 3Uyg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Jl+rvbPu; 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=1731780201; x=1732385001; 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; b=GCygEtaB+zpjPuN4q2d/fCFs9KzcTJJNzu4BTbQRyG3JohxpplhXjqXYrCzkTN1UDj LsTdeMnZ7K9sBkxWCG8Yy5g+8GPv7IkhiKMerYV4AynuIoFmx3CSrQMlgicTlwW8GT4c +D4NmdExdeNxTj16cQeZHr5/WLX0PdE1yT+DA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780201; x=1732385001; 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=PJWCW531Sa67/2Ala2kMEex2O7dv/WNuw6QDkjCBPgo=; b=TlKXoFB/XdOSKvp7R3YI6FnFqt0kFUjrQJQw694HXtFh7aJvbA5yjPyBM5JWCJvMX8 Hn3TCJfx2g4zRBPfOyxa4M4yVk2zATTE2BAAVgrbu0tHN2i3EnnNLeWjCM638eCeq6Bi GF86j+IMXN58prICX4zqvPcd2scB4opDFSq6gZaV4DvOnGIHfqxy5JTSY5loOvUrPmIe 38ApmNWGYmkNDDNAErWei6XSaUULlitVp9y2rxRHd9Cpsg+tyuyHnmweiDZroUljNPT0 KISp6oAG1GlQdZGmrbuW7xKsdfuXyN7UVDu7fuUFfZ8CjYTwxMrXgYHgvXjV5/rT/Kjt qc3Q== X-Forwarded-Encrypted: i=2; AJvYcCVE8QE2M9UWYCvMdpzJ4tiUx84A40Rw412MgnzKw8fTPP/lz2fIBd4MyfkbEJBXx0a/CsoOPXOIuAQHvAlT@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzeObbOiGABhdcWJdX59drRz9eLVncVxM90k4/J7wpYSYVw0FHV bkWUmDkG0rZ3wKEqRUJSDZimsmoLKiboM8+KPIF8LLkQfRT1/c2d5ApeJEzC+2H5NA== X-Google-Smtp-Source: AGHT+IHGj7wt46BKLVbDcCuWaqv76jmsxNxU/1z6ERwBlR3hoyVEqeNXBOOTtBWjLD0ghhdONf2I0g== X-Received: by 2002:a05:600c:1387:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-432df742662mr72868785e9.11.1731780201439; Sat, 16 Nov 2024 10:03:21 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:920:b0:42c:af5b:fac1 with SMTP id 5b1f17b1804b1-432e63b05d9ls4590375e9.1.-pod-prod-05-eu; Sat, 16 Nov 2024 10:03:19 -0800 (PST) X-Received: by 2002:a05:600c:1387:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-432df742662mr72867985e9.11.1731780199583; Sat, 16 Nov 2024 10:03:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780199; cv=none; d=google.com; s=arc-20240605; b=FZxX4CUTp1dqjLbiz1SJ/fygWOV+wQlO9w3JLzfi0NQF9Th9V7xhF6nsMfu67hIjC8 EQCCR9VkzCrdFW2n+Pwo1atNrOHv6MD0FLWemX3u36jzLR+IyUcgcMYD/UFWYGZ4Rt1p 2rY60MdZQ+DnQJwy5dnf2xJjEacEGl33AUEg5T1SHEBRHYYRcOoEWYgZGV1SAn9XicAp GWhM31rKBNzoGQKvGLWkZKjWKYkS3jhGwWD1+e6VIAtV8IBee80fzre90XAqMl2J5KrJ 8exJOr3OBXov+VAyJze4amP3d7pCKHM6tZx7hzNrK3eV8WdDI5tlFkIrDCeroQv22kUt 99rg== 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=qzqc0qf43o4g73YzOl/3Mk2ZcRlSoSU0wYKvIRYgWeY=; fh=Z/aPx72MnXtRnF1pcJoIDur87m1wHY7fyT5F5R4AXG8=; b=Eq060YjG/QHUr/1z1QNXyaGwdXwUpGGSyvvZ98veW9vdeJUt5pOUIWNvqa0EoU3jW5 AriasM79JN/A3JK8wZhYuTVjf6XmOskOMIhAocENenTEC3GO3r01V7EHyTUPMRCqFa7p a306dMatIn2DvQcTigzGh8Y/TxO8lz2AzrUTwbsv2/Bwb9ZpCuNDtGqhmViSANJ4TsWJ I1txLEoKC0q8qz8HgcQgaimRXm+hFJdUcN7oy0qKyS0vD+JVUU2OZfTWwjvhxEJYl/zY gLu0Gw4lHr159RH9PydPaIwm3kXvLEqSXh+50al0A8vPZy27mctnQviOLQwpzcTiOpuk jJYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Jl+rvbPu; 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-432db20da83sor31233215e9.7.2024.11.16.10.03.19 for (Google Transport Security); Sat, 16 Nov 2024 10:03:19 -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:a05:6000:4213:b0:37d:5042:c8de with SMTP id ffacd0b85a97d-38225a45297mr6503959f8f.22.1731780199189; Sat, 16 Nov 2024 10:03:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:18 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Sebastian Haas , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 6/7] can: ems_usb: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:35 +0100 Message-ID: <20241116180301.3935879-7-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=Jl+rvbPu; 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 ems_usb_rx_err() function only incremented the receive error counter and never the transmit error counter, even if the ECC_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the ECC_DIR flag. Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Signed-off-by: Dario Binacchi --- drivers/net/can/usb/ems_usb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 050c0b49938a..98a70a2fe189 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -361,7 +361,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) /* bus error interrupt */ dev->can.can_stats.bus_error++; - stats->rx_errors++; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; @@ -381,8 +380,12 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) } /* Error occurred during transmission? */ - if ((ecc & SJA1000_ECC_DIR) == 0) + if ((ecc & SJA1000_ECC_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } if (dev->can.state == CAN_STATE_ERROR_WARNING || dev->can.state == CAN_STATE_ERROR_PASSIVE) { From patchwork Sat Nov 16 18:02:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3641 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4CDDD3F033 for ; Sat, 16 Nov 2024 19:03:23 +0100 (CET) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5cfa533f626sf593099a12.2 for ; Sat, 16 Nov 2024 10:03:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731780203; cv=pass; d=google.com; s=arc-20240605; b=Y5Ip99+1bKauw7BkMShZilmKaRiaMrlN3Hxbx9SX/uklN8iQhqo9KaVaXJo3LCbAzV /moqspbHT6eUuK1AJnkEG5uUFzSFy+DaNguRlAxa/g1pYtJIkG7/kBRfDkXGtOW2Lw1R QBXiQHuUXp6756nbsDa83VntMk2EXwqR7J8lk0PJnz06SllYajFUVEYykGvWQR+6pO8x 7gZO1zLy+JXjWvi9psKnkUlO0QKx27XL7yc067ztYNl4SHQJShBU1vV2vR8DKmWm7mnU bst64qNy+KG/g+rftG5ZxNDi7QeQ8VTdI4tg8bpEd13KdW1dQRJgrHJAa7+BudpDDJBe mAZg== 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=3PDT+h2vU9CPehJMfVP2/d1IBacl/XtU/34ySCVNr3w=; fh=Yzb5hnQGIgUqXSuggIOULONeTG7QqbPr6NNSJsTdrng=; b=ZBj9BHSsCmeJTqQL0pSP217G99AsV0wGGPqZkRUU2en9QO6UEKZGL/Y3SO8/DZO8v0 yqK4Z6XtTl7m6HqTf7MJE5opLfRAbogqNYT0ORnR3z2/eyir86zvI4vBklGpTzMpSz+0 tbAm4vGDIQ/dcIl659YkkClyDRxtQn8EHLIXKuvx0HdO6oAizLgWAb6NH9V0h4fZd24W mFWXeo2+uCT5dJ4owQZkUcgEVY76bdbebUvMUS0hCy1h6hFA7ZkJq1YqXEOj/0w8BA1C MABgCWAhOvUlXPTWRGwjuUfftkoOnEfljQhneb/UJ7+4MGDHgv5XFffQQMMt9oirWk+I VASg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WAms4Ngj; 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=1731780203; x=1732385003; 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=3PDT+h2vU9CPehJMfVP2/d1IBacl/XtU/34ySCVNr3w=; b=pPUp3uZI7rUQ+fUSEFLqHMdOgttGZDGog0aAgkvZ04isTm7fsHegX1GKoLpZt8V/0a hplRQqwtfjJ3L/hcDUmhDnEBWGSoI83vF6iOQhqXyj1XRnGWQwZAIehaNboeD73IdyGr xWRIHXqbDIz8lcAM4ZSqjleAlNzpDO9I9/f0U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731780203; x=1732385003; 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=3PDT+h2vU9CPehJMfVP2/d1IBacl/XtU/34ySCVNr3w=; b=g7gib41wG3sqHs+WTcTyfQQMBnu0jmyRQnwFkoeq+xCosoy1G+Fpf7xqzcJKH6gfZI 81WQtuZcZWt55K3guBuDVS/UjjkIG5DmALihc2Bu/W2FMVeqD5Q2Xob480hYI6XtODwO JSvGRa38roTKAgkP/rG4F2NFK0PBBN+oEC4OqVUesIcuevvZwhOxezD1PPZAV7Dxo4jk y8oioIEsFuLdv3s8IO4adM7N8FsiVNKddqz87HDiOtJ5rI7MJSsxZ1f7rQ414OYxagNL gngJmk/HMQONhUSeHhjZ/MBsy9niQEhWlRwH0Qfeasl7Iwu2ZIMCE9BonPzuUFA1pUam CNSA== X-Forwarded-Encrypted: i=2; AJvYcCVRPy+hF0RRMCYERCsJu7D0RChYthsEMtOVEZJJdrn0fjW0ZrYf3bIojRVdeyX6vC/mgZuCGtXaOms4QEBg@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx9BHx0BzLfM56lReqnaAVnUB27rf90tZWYj2NV/8ZwvqZC1VZ0 5Qblukwa8TO1hB975q6rX+mILIWLJU4XPW3FXMvd5Rf+uvffygGCh+wAdKlqs7q95w== X-Google-Smtp-Source: AGHT+IFxPwm2QI3w+NzU6tBLVQ9A1d5KU62HpAlvX8IHrIbyTchnWtyMav2xl4ojf/xXQLDnP/OO7g== X-Received: by 2002:a05:6402:350f:b0:5cf:3d11:c76b with SMTP id 4fb4d7f45d1cf-5cf8f94835bmr4923084a12.0.1731780203004; Sat, 16 Nov 2024 10:03:23 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc94:0:b0:5cf:6355:d71f with SMTP id 4fb4d7f45d1cf-5cf8f55c802ls46923a12.0.-pod-prod-03-eu; Sat, 16 Nov 2024 10:03:21 -0800 (PST) X-Received: by 2002:a17:906:da83:b0:a9a:f0e:cd4 with SMTP id a640c23a62f3a-aa48354d190mr572758266b.55.1731780201080; Sat, 16 Nov 2024 10:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731780201; cv=none; d=google.com; s=arc-20240605; b=D/UPmTxCkGfXJVLzgWbmR2B50hZ8aU2xw0lm17sQp0Tt6PO1RUllAMsbZzwIV3rOGZ T3fILzlZmACMunEft9Z7I8YRwdqeyf0tuZYJAHyqcvnN3uXIJxoZB/fl+VRrLz+AJ10a CvkwrZTuFPNq8Zy6HUWDuIOnSGbduyWDyum1GRknYFhVoBzd81Ba1gxjREK1sknF5IzV 80FJdkkE00PuLjB4SKIdNVf9B4KglrV3fjClJKEiyCF+M6cCbHpMVgoL78SeKJzkImDT SXCW+nJEouHXcOgc+9yqDZsHXpdWbC0xn3B3byppNcR4MdarEYuH1QphfjD5AOvfaDNd /r3A== 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=2C7d9rxCEuHbUF9PXUs12JGZsS1zAdEa4j4i3gKpHM4=; fh=ATTI89TGSVvXDnphaMzTikK7bND3I1EG9akEASY7Kqw=; b=NaTVDSOHyQjnLfHaqCv9Is+nViVhCBBWp0SQIjgTp6RABfYKd2m9BEz8oZD9NJS1uR kEoh5AuFF5eZqno3+PdA6bje/xhwG2lHOBW5DzfNVsL58SZnMnb3qBT/KY5eo3JSyQWf Js1VEDnOphUtfE88KVwvfar21+fCwc4FwMlJynpFlRVDDCXTN8GIg4qE0d4vl/bEDM/g baQSthcmHAREPjoUUFuyynDdcsKEUPxJ4xrjCaXVbtCx/Kt1YhuJC0Fs+OfwHyx77qbp yYatSILDRcwGSG4zz3Ih3jl+7v7FZP3WaEZOuRAFLqx2czzmDkyKDn4ZcSlcCY+/dWwD 6pnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WAms4Ngj; 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-aa20e03a45dsor257050566b.17.2024.11.16.10.03.21 for (Google Transport Security); Sat, 16 Nov 2024 10:03:21 -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:906:5ad2:b0:a9f:508:592a with SMTP id a640c23a62f3a-aa4a28a3bd6mr104955266b.46.1731780200732; Sat, 16 Nov 2024 10:03:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2024 10:03:20 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Ji-Ze Hong (Peter Hong)" , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 7/7] can: f81604: fix {rx,tx}_errors statistics Date: Sat, 16 Nov 2024 19:02:36 +0100 Message-ID: <20241116180301.3935879-8-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=WAms4Ngj; 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 f81604_handle_can_bus_errors() function only incremented the receive error counter and never the transmit error counter, even if the ECC_DIR flag reported that an error had occurred during transmission. The patch increments the receive/transmit error counter based on the value of the ECC_DIR flag. Fixes: 88da17436973 ("can: usb: f81604: add Fintek F81604 support") Signed-off-by: Dario Binacchi --- drivers/net/can/usb/f81604.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/f81604.c b/drivers/net/can/usb/f81604.c index bc0c8903fe77..8463e00517c9 100644 --- a/drivers/net/can/usb/f81604.c +++ b/drivers/net/can/usb/f81604.c @@ -526,7 +526,6 @@ static void f81604_handle_can_bus_errors(struct f81604_port_priv *priv, netdev_dbg(netdev, "bus error interrupt\n"); priv->can.can_stats.bus_error++; - stats->rx_errors++; if (skb) { cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; @@ -550,8 +549,12 @@ static void f81604_handle_can_bus_errors(struct f81604_port_priv *priv, cf->data[3] = data->ecc & F81604_SJA1000_ECC_SEG; /* Error occurred during transmission? */ - if ((data->ecc & F81604_SJA1000_ECC_DIR) == 0) + if ((data->ecc & F81604_SJA1000_ECC_DIR) == 0) { cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; + } } set_bit(F81604_CLEAR_ECC, &priv->clear_flags);