[virtio-dev] [PATCH] virtio-net: use mtu size as buffer length for big packets

Michael S. Tsirkin
Tue, 09 Aug 2022 09:22:13 -0000

On Tue, Aug 09, 2022 at 03:44:22PM +0800, Jason Wang
wrote:
> > @@ -3571,8 +3581,10 @@ static int virtnet_probe(struct virtio_device
> > *vdev)
> >       if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
> >           virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
> >           virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||
> > -         virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))
> > +         virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) {
> >               vi->big_packets = true;
> > +             vi->gso_is_supported = true;
> >
> > Please do the same for virtnet_clear_guest_offloads(), and
> > correspondingly virtnet_restore_guest_offloads() as well. Not sure why
> > virtnet_clear_guest_offloads() or the caller doesn't unset
big_packet on
> > successful return, seems like a bug to me.
>
> It is fine as long as
>
> 1) we don't implement ethtool API for changing guest offloads
> 2) big mode XDP is not enabled
>
> So that code works only for XDP but we forbid big packets in the case
> of XDP right now.
>
> Thanks

To put it another way, changing big_packets after probe requires a bunch
of work as current code assumes this flag never changes.
Adding a TODO to handle dynamic offload config is fine but
I don't think it should block this.

--
MST