Hi Marc, Thanks for this. I've had a look and tested it (candleLight_fw v2.0, `candump can0 -H`, unload) and all seems good. John. ------- Original Message ------- On Sunday, July 16th, 2023 at 21:33, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > > > During testing I noticed a crash if unloading/loading the gs_usb > driver during high CAN bus load. > > The current version of the candlelight firmware doesn't flush the > queues of the received CAN frames during the reset command. This leads > to a crash if hardware timestamps are enabled, it a URB from the > device is received before the cycle counter/time counter > infrastructure has been setup. > > First clean up then error handling in gs_can_open(). > > Then, fix the problem by converting the cycle counter/time counter > infrastructure from a per-channel to per-device and set it up before > submitting RX-URBs to the USB stack. > > Signed-off-by: Marc Kleine-Budde mkl@xxxxxxxxxxxxxx > > --- > Marc Kleine-Budde (2): > can: gs_usb: gs_can_open(): improve error handling > can: gs_usb: fix time stamp counter initialization > > drivers/net/can/usb/gs_usb.c | 130 ++++++++++++++++++++++++------------------- > 1 file changed, 74 insertions(+), 56 deletions(-) > --- > base-commit: 0dd1805fe498e0cf64f68e451a8baff7e64494ec > change-id: 20230712-gs_usb-fix-time-stamp-counter-4bd302c808af > > Best regards, > -- > Marc Kleine-Budde mkl@xxxxxxxxxxxxxx > >