On 02.03.2026 11:30:34, Marc Kleine-Budde wrote:
> > +static int virtio_can_open(struct net_device *ndev)
> > +{
> > + virtio_can_start(ndev);
> > +
> > + netif_start_queue(ndev);
> > +
> > + return 0;
> > +}
>
> Is open_candev() missing? The CAN framework requires drivers to call
> open_candev() in their ndo_open handler. open_candev() validates that
> bittiming has been configured (returns -EINVAL if bitrate is 0), checks
> CAN FD data bitrate requirements, and manages carrier state. Without this
> call, can the device be brought up without configuring bitrate? The driver
> does call close_candev() in virtio_can_close(), showing awareness of the
> CAN lifecycle. Every other CAN driver in the kernel calls open_candev() in
> its open function.This is true for physical CAN devices, so let's clarify things for virtio. As far as I can see, there's no interface to get/set the bit timing/bit rate from the guest, right? You can set bittiming.bitrate to CAN_BITRATE_UNKNOWN, remove the netif_carrier handling from virtio_can_start() and use open_candev(). regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
signature.asc
Description: PGP signature
