linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/1] can: esd_usb: Some preparation for supporting esd CAN-USB/3
@ 2022-11-24 20:38 Frank Jungclaus
  2022-11-24 20:38 ` [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero Frank Jungclaus
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Jungclaus @ 2022-11-24 20:38 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde, Wolfgang Grandegger, Vincent Mailhol
  Cc: Stefan Mätje, netdev, linux-kernel, Frank Jungclaus

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/20220708181235.4104943-1-frank.jungclaus@esd.eu/


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

 drivers/net/can/usb/esd_usb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


base-commit: 3755b56a9b8ff8f1a6a21a979cc215c220401278
-- 
2.25.1


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

* [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero
  2022-11-24 20:38 [PATCH RESEND 0/1] can: esd_usb: Some preparation for supporting esd CAN-USB/3 Frank Jungclaus
@ 2022-11-24 20:38 ` Frank Jungclaus
  2022-11-25 15:56   ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Jungclaus @ 2022-11-24 20:38 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde, Wolfgang Grandegger, Vincent Mailhol
  Cc: Stefan Mätje, netdev, linux-kernel, Frank Jungclaus

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.

Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>
---
 drivers/net/can/usb/esd_usb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
index 1bcfad11b1e4..da24c649aadd 100644
--- a/drivers/net/can/usb/esd_usb.c
+++ b/drivers/net/can/usb/esd_usb.c
@@ -230,10 +230,14 @@ static void esd_usb_rx_event(struct esd_usb_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 ecc   = msg->msg.rx.data[1];
 		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


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

* Re: [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero
  2022-11-24 20:38 ` [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero Frank Jungclaus
@ 2022-11-25 15:56   ` Marc Kleine-Budde
  2022-11-29 17:15     ` Frank Jungclaus
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-11-25 15:56 UTC (permalink / raw)
  To: Frank Jungclaus
  Cc: linux-can, Wolfgang Grandegger, Vincent Mailhol,
	Stefan Mätje, netdev, linux-kernel

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

On 24.11.2022 21:38:06, 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.
> 
> Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>

Please add a Fixes tag.

https://elixir.bootlin.com/linux/v6.0/source/Documentation/process/handling-regressions.rst#L107

> ---
>  drivers/net/can/usb/esd_usb.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
> index 1bcfad11b1e4..da24c649aadd 100644
> --- a/drivers/net/can/usb/esd_usb.c
> +++ b/drivers/net/can/usb/esd_usb.c
> @@ -230,10 +230,14 @@ static void esd_usb_rx_event(struct esd_usb_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 ecc   = msg->msg.rx.data[1];

unrelated, please remove.

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

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

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

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

* Re: [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero
  2022-11-25 15:56   ` Marc Kleine-Budde
@ 2022-11-29 17:15     ` Frank Jungclaus
  2022-11-30 10:21       ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Jungclaus @ 2022-11-29 17:15 UTC (permalink / raw)
  To: mkl
  Cc: Stefan Mätje, linux-can, wg, netdev, linux-kernel, mailhol.vincent

Hello Marc,
thanks for commenting.

On Fri, 2022-11-25 at 16:56 +0100, Marc Kleine-Budde wrote:
> On 24.11.2022 21:38:06, 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.
> > 
> > Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>
> 
> Please add a Fixes tag.
> 
> https://elixir.bootlin.com/linux/v6.0/source/Documentation/process/handling-regressions.rst#L107
> 
From my point of view this is not a regression, it's a sort of
imperfection existing since the initial add of esd_usb(2).c to the
kernel. So should I add a "Fixes:" referring to the initial commit?
(Currently) I'm slow on the uptake ;)

> > ---
> >  drivers/net/can/usb/esd_usb.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
> > index 1bcfad11b1e4..da24c649aadd 100644
> > --- a/drivers/net/can/usb/esd_usb.c
> > +++ b/drivers/net/can/usb/esd_usb.c
> > @@ -230,10 +230,14 @@ static void esd_usb_rx_event(struct esd_usb_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 ecc   = msg->msg.rx.data[1];
> 
> unrelated, please remove.
> 
You're right, sorry, will be removed in v2 ...

> >  		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 {
> 
> regards,
> Marc
> 
Regards, Frank


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

* Re: [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero
  2022-11-29 17:15     ` Frank Jungclaus
@ 2022-11-30 10:21       ` Marc Kleine-Budde
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-11-30 10:21 UTC (permalink / raw)
  To: Frank Jungclaus
  Cc: Stefan Mätje, linux-can, wg, netdev, linux-kernel, mailhol.vincent

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

On 29.11.2022 17:15:56, Frank Jungclaus wrote:
> Hello Marc,
> thanks for commenting.
> 
> On Fri, 2022-11-25 at 16:56 +0100, Marc Kleine-Budde wrote:
> > On 24.11.2022 21:38:06, 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.
> > > 
> > > Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>
> > 
> > Please add a Fixes tag.
> > 
> > https://elixir.bootlin.com/linux/v6.0/source/Documentation/process/handling-regressions.rst#L107
> > 
> From my point of view this is not a regression, it's a sort of
> imperfection existing since the initial add of esd_usb(2).c to the
> kernel. So should I add a "Fixes:" referring to the initial commit?
> (Currently) I'm slow on the uptake ;)

Please add a fixes tag that refers to the code that this patch fixes.

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 |

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

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

end of thread, other threads:[~2022-11-30 10:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 20:38 [PATCH RESEND 0/1] can: esd_usb: Some preparation for supporting esd CAN-USB/3 Frank Jungclaus
2022-11-24 20:38 ` [PATCH RESEND 1/1] can: esd_usb: Allow REC and TEC to return to zero Frank Jungclaus
2022-11-25 15:56   ` Marc Kleine-Budde
2022-11-29 17:15     ` Frank Jungclaus
2022-11-30 10:21       ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).