* [PATCH 0/7] Fix {rx,tx}_errors CAN statistics
@ 2024-11-16 18:02 Dario Binacchi
2024-11-16 18:02 ` [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics Dario Binacchi
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Akshay Bhat, Andrew Lunn,
Chandrasekar Ramakrishnan, Chen-Yu Tsai, David S. Miller,
Dong Aisheng, Eric Dumazet, Fengguang Wu, Gerhard Bertelsmann,
Jakub Kicinski, Jernej Skrabec, Ji-Ze Hong (Peter Hong),
Krzysztof Kozlowski, Marc Kleine-Budde, Marek Vasut,
Maxime Ripard, Oliver Hartkopp, Paolo Abeni, Samuel Holland,
Sebastian Haas, Uwe Kleine-König, Varka Bhadram,
Vincent Mailhol, Wolfgang Grandegger, linux-arm-kernel,
linux-can, linux-sunxi, netdev
This series extends the patch 4d6d26537940 ("can: c_can: fix {rx,tx}_errors statistics"),
already merged into the mainline, to other CAN devices that similarly do
not correctly increment the error counters for reception/transmission.
Dario Binacchi (7):
can: m_can: fix {rx,tx}_errors statistics
can: ifi_canfd: fix {rx,tx}_errors statistics
can: hi311x: fix {rx,tx}_errors statistics
can: sja1000: fix {rx,tx}_errors statistics
can: sun4i_can: fix {rx,tx}_errors statistics
can: ems_usb: fix {rx,tx}_errors statistics
can: f81604: fix {rx,tx}_errors statistics
drivers/net/can/ifi_canfd/ifi_canfd.c | 29 +++++++++++++++++++--------
drivers/net/can/m_can/m_can.c | 7 ++++++-
drivers/net/can/sja1000/sja1000.c | 7 +++++--
drivers/net/can/spi/hi311x.c | 17 ++++++++++------
drivers/net/can/sun4i_can.c | 7 +++++--
drivers/net/can/usb/ems_usb.c | 7 +++++--
drivers/net/can/usb/f81604.c | 7 +++++--
7 files changed, 58 insertions(+), 23 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 2/7] can: ifi_canfd: " Dario Binacchi
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, 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, netdev
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 <dario.binacchi@amarulasolutions.com>
---
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;
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/7] can: ifi_canfd: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
2024-11-16 18:02 ` [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 3/7] can: hi311x: " Dario Binacchi
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Marc Kleine-Budde, Marek Vasut,
Paolo Abeni, Uwe Kleine-König, Vincent Mailhol, linux-can,
netdev
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 <dario.binacchi@amarulasolutions.com>
---
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);
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/7] can: hi311x: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
2024-11-16 18:02 ` [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics Dario Binacchi
2024-11-16 18:02 ` [PATCH 2/7] can: ifi_canfd: " Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 4/7] can: sja1000: " Dario Binacchi
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, 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, netdev
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 <dario.binacchi@amarulasolutions.com>
---
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);
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/7] can: sja1000: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
` (2 preceding siblings ...)
2024-11-16 18:02 ` [PATCH 3/7] can: hi311x: " Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 5/7] can: sun4i_can: " Dario Binacchi
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Marc Kleine-Budde, Oliver Hartkopp,
Paolo Abeni, Vincent Mailhol, Wolfgang Grandegger, linux-can,
netdev
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 <dario.binacchi@amarulasolutions.com>
---
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 */
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/7] can: sun4i_can: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
` (3 preceding siblings ...)
2024-11-16 18:02 ` [PATCH 4/7] can: sja1000: " Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 6/7] can: ems_usb: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 7/7] can: f81604: " Dario Binacchi
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, 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,
linux-can, linux-sunxi, netdev
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 <dario.binacchi@amarulasolutions.com>
---
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) {
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/7] can: ems_usb: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
` (4 preceding siblings ...)
2024-11-16 18:02 ` [PATCH 5/7] can: sun4i_can: " Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
2024-11-16 18:02 ` [PATCH 7/7] can: f81604: " Dario Binacchi
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Marc Kleine-Budde, Paolo Abeni,
Sebastian Haas, Vincent Mailhol, Wolfgang Grandegger, linux-can,
netdev
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 <dario.binacchi@amarulasolutions.com>
---
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) {
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 7/7] can: f81604: fix {rx,tx}_errors statistics
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
` (5 preceding siblings ...)
2024-11-16 18:02 ` [PATCH 6/7] can: ems_usb: " Dario Binacchi
@ 2024-11-16 18:02 ` Dario Binacchi
6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2024-11-16 18:02 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, 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,
netdev
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) {
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);
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-16 18:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-16 18:02 [PATCH 0/7] Fix {rx,tx}_errors CAN statistics Dario Binacchi
2024-11-16 18:02 ` [PATCH 1/7] can: m_can: fix {rx,tx}_errors statistics Dario Binacchi
2024-11-16 18:02 ` [PATCH 2/7] can: ifi_canfd: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 3/7] can: hi311x: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 4/7] can: sja1000: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 5/7] can: sun4i_can: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 6/7] can: ems_usb: " Dario Binacchi
2024-11-16 18:02 ` [PATCH 7/7] can: f81604: " Dario Binacchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®