2022-12-02 02:06:34

by Frank Jungclaus

[permalink] [raw]
Subject: [PATCH v2 0/1] can: esd_usb: Some preparation for supporting esd CAN-USB/3

Being sucked into another higher prioritized project in the mid of
July, my work on preparations for adding support of the newly available
esd CAN-USB/3 to esd_usb.c came to a halt. Let's start again ...

Here is a attempt to resend a slightly overhauled and split
into two pieces version of my patch series from Fri, 8 Jul 2022.
Link to the patch series in July 2022:
https://lore.kernel.org/all/[email protected]/

* Changelog *

v1 -> v2:
* Added a "Fixes:" tag
* Removed an unrelated indentation
* Link to v1: https://lore.kernel.org/all/[email protected]/


Frank Jungclaus (1):
can: esd_usb: Allow REC and TEC to return to zero

drivers/net/can/usb/esd_usb.c | 6 ++++++
1 file changed, 6 insertions(+)


base-commit: 3755b56a9b8ff8f1a6a21a979cc215c220401278
--
2.25.1


2022-12-02 02:35:14

by Frank Jungclaus

[permalink] [raw]
Subject: [PATCH v2 1/1] can: esd_usb: Allow REC and TEC to return to zero

We don't get any further EVENT from an esd CAN USB device for changes
on REC or TEC while those counters converge to 0 (with ecc == 0).
So when handling the "Back to Error Active"-event force
txerr = rxerr = 0, otherwise the berr-counters might stay on
values like 95 forever ...

Also, to make life easier during the ongoing development a
netdev_dbg() has been introduced to allow dumping error events send by
an esd CAN USB device.

Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
Signed-off-by: Frank Jungclaus <[email protected]>
---
drivers/net/can/usb/esd_usb.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
index 1bcfad11b1e4..acfc439a325c 100644
--- a/drivers/net/can/usb/esd_usb.c
+++ b/drivers/net/can/usb/esd_usb.c
@@ -234,6 +234,10 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
u8 rxerr = msg->msg.rx.data[2];
u8 txerr = msg->msg.rx.data[3];

+ netdev_dbg(priv->netdev,
+ "CAN_ERR_EV_EXT: dlc=%#02x state=%02x ecc=%02x rec=%02x tec=%02x\n",
+ msg->msg.rx.dlc, state, ecc, rxerr, txerr);
+
skb = alloc_can_err_skb(priv->netdev, &cf);
if (skb == NULL) {
stats->rx_dropped++;
@@ -260,6 +264,8 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
break;
default:
priv->can.state = CAN_STATE_ERROR_ACTIVE;
+ txerr = 0;
+ rxerr = 0;
break;
}
} else {
--
2.25.1

2022-12-02 15:39:55

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] can: esd_usb: Allow REC and TEC to return to zero

On 30.11.2022 21:22:42, Frank Jungclaus wrote:
> We don't get any further EVENT from an esd CAN USB device for changes
> on REC or TEC while those counters converge to 0 (with ecc == 0).
> So when handling the "Back to Error Active"-event force
> txerr = rxerr = 0, otherwise the berr-counters might stay on
> values like 95 forever ...
>
> Also, to make life easier during the ongoing development a
> netdev_dbg() has been introduced to allow dumping error events send by
> an esd CAN USB device.
>
> Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
> Signed-off-by: Frank Jungclaus <[email protected]>

Added to linux-can. It will go into the net/master after v6.1.

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


Attachments:
(No filename) (985.00 B)
signature.asc (499.00 B)
Download all attachments