Hej,
here is a second batch of patches which must also be seen as
preparation for adding support of the newly available esd CAN-USB/3 to
esd_usb.c.
Frank Jungclaus (6):
can: esd_usb: Allow REC and TEC to return to zero
can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (1)
can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (2)
can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (3)
can: esd_usb: Improved support for CAN_CTRLMODE_BERR_REPORTING
can/esd_usb: Improved decoding for ESD_EV_CAN_ERROR_EXT messages
drivers/net/can/usb/esd_usb.c | 87 +++++++++++++++++++++++++++--------
1 file changed, 67 insertions(+), 20 deletions(-)
base-commit: 0ebd5529d2ddab76a46681991d350b82c62ef13e
--
2.25.1
Always report CAN_ERR_PROT | CAN_ERR_BUSERROR if ESD_EV_CAN_ERROR_EXT
and ecc != 0. Before we missed those EVENTs when state was unequal to
priv->old_state
Signed-off-by: Frank Jungclaus <[email protected]>
---
drivers/net/can/usb/esd_usb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
index 0b907bc54b70..e14f08d30b0b 100644
--- a/drivers/net/can/usb/esd_usb.c
+++ b/drivers/net/can/usb/esd_usb.c
@@ -274,12 +274,15 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
rxerr = 0;
break;
}
- } else {
+ }
+
+ if (ecc) {
priv->can.can_stats.bus_error++;
stats->rx_errors++;
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
+ /* Store error in CAN protocol (type) in data[2] */
switch (ecc & SJA1000_ECC_MASK) {
case SJA1000_ECC_BIT:
cf->data[2] |= CAN_ERR_PROT_BIT;
--
2.25.1