In the usb drivers, the echo skb is always released by the USB write complete callback. --- Stéphane From: Marc Kleine-Budde Sent: Tuesday, March 9, 2021 11:58 To: Oliver Hartkopp; Stéphane Grosjean; linux-can Mailing List Subject: Re: [PATCH 3/3] can/peak_usb: add support of ONE_SHOT mode On 3/9/21 11:53 AM, Oliver Hartkopp wrote: >> What happens if in one shot mode and the frame is not send? Who takes care of >> the echo skb? > > ONE-SHOT only means that the CAN controller would not retry the > transmission when e.g. loosing the arbitration or getting an error flag. > > The sja1000 does it this way, when the TX interrupt flag is set in the > interrupt register: > > if (isrc & IRQ_TI) { > /* transmission buffer released */ > if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT && > !(status & SR_TCS)) { > stats->tx_errors++; > can_free_echo_skb(dev, 0); > } else { > /* transmission complete */ > stats->tx_bytes += > priv->read_reg(priv, > SJA1000_FI) & 0xf; > stats->tx_packets++; > can_get_echo_skb(dev, 0, NULL); > } > netif_wake_queue(dev); > can_led_event(dev, CAN_LED_EVENT_TX); > } > > > Do we need to check this for the other drivers? Yes. 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 | -- PEAK-System Technik GmbH Sitz der Gesellschaft Darmstadt - HRB 9183 Geschaeftsfuehrung: Alexander Gach / Uwe Wilhelm Unsere Datenschutzerklaerung mit wichtigen Hinweisen zur Behandlung personenbezogener Daten finden Sie unter www.peak-system.com/Datenschutz.483.0.html