Skip to content

Commit 918ee49

Browse files
Frank Jungclausmarckleinebudde
authored andcommitted
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: 96d8e90 ("can: Add driver for esd CAN-USB/2 device") Signed-off-by: Frank Jungclaus <[email protected]> Link: https://lore.kernel.org/all/[email protected] Cc: [email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent f4a4d12 commit 918ee49

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/can/usb/esd_usb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
234234
u8 rxerr = msg->msg.rx.data[2];
235235
u8 txerr = msg->msg.rx.data[3];
236236

237+
netdev_dbg(priv->netdev,
238+
"CAN_ERR_EV_EXT: dlc=%#02x state=%02x ecc=%02x rec=%02x tec=%02x\n",
239+
msg->msg.rx.dlc, state, ecc, rxerr, txerr);
240+
237241
skb = alloc_can_err_skb(priv->netdev, &cf);
238242
if (skb == NULL) {
239243
stats->rx_dropped++;
@@ -260,6 +264,8 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
260264
break;
261265
default:
262266
priv->can.state = CAN_STATE_ERROR_ACTIVE;
267+
txerr = 0;
268+
rxerr = 0;
263269
break;
264270
}
265271
} else {

0 commit comments

Comments
 (0)