All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX error counters
@ 2021-08-25 21:52 Stefan Mätje
  2021-08-25 21:52 ` [PATCH 1/1] can: usb: esd_usb2: Fix the interchange of the CAN RX and TX " Stefan Mätje
  2021-08-26  6:43 ` [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX " Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Mätje @ 2021-08-25 21:52 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde
  Cc: Wolfgang Grandegger, netdev, Stefan Mätje

In the driver for the esd CAN-USB/2 the CAN RX and TX error counters
were fetched interchanged from the ESD_EV_CAN_ERROR_EXT message and
therefore delivered wrong to the user.

To verify the now correct behavior call the candump tool to print CAN
error frames with extra infos (including CAN RX and TX error counters)
like "candump -e -x can4,0:0,#fffffffff".
Then send a CAN frame to the open (no other node) but terminated CAN
bus. The TX error counter must increase by 8 for each transmit attempt
until CAN_STATE_ERROR_PASSIVE is reached.

Stefan Mätje (1):
  can: usb: esd_usb2: Fix the interchange of the CAN RX and TX error
    counters.

 drivers/net/can/usb/esd_usb2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: cbe8cd7d83e251bff134a57ea4b6378db992ad82
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] can: usb: esd_usb2: Fix the interchange of the CAN RX and TX error counters.
  2021-08-25 21:52 [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX error counters Stefan Mätje
@ 2021-08-25 21:52 ` Stefan Mätje
  2021-08-26  6:43 ` [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX " Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Mätje @ 2021-08-25 21:52 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde
  Cc: Wolfgang Grandegger, netdev, Stefan Mätje

This patch fixes the interchanged fetch of the CAN RX and TX error counters
from the ESD_EV_CAN_ERROR_EXT message. The RX error counter is really in
struct rx_msg::data[2] and the TX error counter is in struct rx_msg::data[3].

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
---
 drivers/net/can/usb/esd_usb2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 7370981e9b34..c6068a251fbe 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -224,8 +224,8 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv,
 	if (id == ESD_EV_CAN_ERROR_EXT) {
 		u8 state = msg->msg.rx.data[0];
 		u8 ecc = msg->msg.rx.data[1];
-		u8 txerr = msg->msg.rx.data[2];
-		u8 rxerr = msg->msg.rx.data[3];
+		u8 rxerr = msg->msg.rx.data[2];
+		u8 txerr = msg->msg.rx.data[3];
 
 		skb = alloc_can_err_skb(priv->netdev, &cf);
 		if (skb == NULL) {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX error counters
  2021-08-25 21:52 [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX error counters Stefan Mätje
  2021-08-25 21:52 ` [PATCH 1/1] can: usb: esd_usb2: Fix the interchange of the CAN RX and TX " Stefan Mätje
@ 2021-08-26  6:43 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-08-26  6:43 UTC (permalink / raw)
  To: Stefan Mätje; +Cc: linux-can, Wolfgang Grandegger, netdev

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

On 25.08.2021 23:52:26, Stefan Mätje wrote:
> In the driver for the esd CAN-USB/2 the CAN RX and TX error counters
> were fetched interchanged from the ESD_EV_CAN_ERROR_EXT message and
> therefore delivered wrong to the user.
> 
> To verify the now correct behavior call the candump tool to print CAN
> error frames with extra infos (including CAN RX and TX error counters)
> like "candump -e -x can4,0:0,#fffffffff".
> Then send a CAN frame to the open (no other node) but terminated CAN
> bus. The TX error counter must increase by 8 for each transmit attempt
> until CAN_STATE_ERROR_PASSIVE is reached.
> 
> Stefan Mätje (1):
>   can: usb: esd_usb2: Fix the interchange of the CAN RX and TX error
>     counters.
> 
>  drivers/net/can/usb/esd_usb2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to linux-can/testing.

Thanks,
Marc

> base-commit: cbe8cd7d83e251bff134a57ea4b6378db992ad82

BTW: Thanks for including a base-commit. Your base is
linux-can-next-for-5.15-20210825, but this is a bug-fix patch. It should
be based on the latest can pull request, can/master or net/master
instead. It doesn't matter here, as the patch applies without problems.

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-26  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 21:52 [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX error counters Stefan Mätje
2021-08-25 21:52 ` [PATCH 1/1] can: usb: esd_usb2: Fix the interchange of the CAN RX and TX " Stefan Mätje
2021-08-26  6:43 ` [PATCH 0/1] can: usb: esd_usb2: Fix the interchange of CAN TX and RX " Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.