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;