On Mon, Mar 02, 2026 at 02:23:42PM +0100, Marc Kleine-Budde wrote:
> 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?
> 
AFAIU there is not such a interface.

> You can set bittiming.bitrate to CAN_BITRATE_UNKNOWN, remove the
> netif_carrier handling from virtio_can_start() and use open_candev().
> 
Will do. Thanks!

Matias


Reply via email to