| Message ID | 20241116180301.3935879-8-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRB2V44O4QMGQEVXG5ZSY@amarulasolutions.com>
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 <linux-amarula@patchwork.amarulasolutions.com>;
Sat, 16 Nov 2024 19:03:23 +0100 (CET)
Received: by mail-ed1-f69.google.com with SMTP id
4fb4d7f45d1cf-5cfa533f626sf593099a12.2
for <linux-amarula@patchwork.amarulasolutions.com>;
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 <linux-amarula@amarulasolutions.com>
(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 <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Paolo Abeni <pabeni@redhat.com>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
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: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
Fix {rx,tx}_errors CAN statistics
|
|
Commit Message
Dario Binacchi
Nov. 16, 2024, 6:02 p.m. UTC
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 <dario.binacchi@amarulasolutions.com>
---
drivers/net/can/usb/f81604.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
-netdev ML Hello Dario, thanks for taking a look on the error statistics. As an example for my following remark I picked this patch. On 16.11.24 19:02, Dario Binacchi wrote: > 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 <dario.binacchi@amarulasolutions.com> > > --- > > 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) { The statistics are updated only if we successfully allocated a skbuff for the error message frame. > 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); Is this a good approach or should we always update the statistics independently of the potential failure of the skbuff allocation? Best regards, Oliver To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
On 18.11.2024 09:39:27, Oliver Hartkopp wrote: > -netdev ML > > Hello Dario, > > thanks for taking a look on the error statistics. > > As an example for my following remark I picked this patch. > > On 16.11.24 19:02, Dario Binacchi wrote: > > 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. "Increment" the receive/transmit error counter instead of "The patch increments". > > > > Fixes: 88da17436973 ("can: usb: f81604: add Fintek F81604 support") > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > > > --- > > > > 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) { > > The statistics are updated only if we successfully allocated a skbuff for > the error message frame. > > > 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); > > Is this a good approach or should we always update the statistics > independently of the potential failure of the skbuff allocation? Yes, we always want to update the statistics. If the error skb allocation fails due to OOM, we want at least accurate statistics. regards, Marc
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);