Jason Wang
2022-Sep-14 03:46 UTC
[Q] packet truncated after enabling ip_forward for virtio-net in guest
On Tue, Sep 13, 2022 at 11:43 PM Wei Yang <richard.weiyang at gmail.com> wrote:> > Hi, I am running a guest with vhost-net as backend. After I enable > ip_forward, the packet received is truncated. > > Host runs a 5.10 kernel, while guest kernel is v5.11 which doesn't > include this commit: > > virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LRO > > After applying this commit, the issue is gone. I guess the reason is > this device doesn't have NETIF_F_GRO_HW set,Note that form device POV, it should be VIRTIO_NET_F_GUEST_TSOX.> so > virtnet_set_guest_offloads is not called. > > I am wondering why packet is truncated without this fix. I follow > virtnet_set_guest_offloads and just see virtio_net_handle_ctrl in qemu > handles VIRTIO_NET_CTRL_GUEST_OFFLOADS. Since we use a tap dev, then I > follow tap_fd_set_offload to ioctl(fd, TUNSETOFFLOAD, offload). > > But I am lost here. tap_ioctl -> set_offload(). Since we use a normal > tap device instead of ipvtap/macvtap, update_features is empty. So I > don't get how the device's behavior is changed after set LRO. > > Do I follow the wrong path? Any suggestions on investigation?Note that if you are using tuntap, you should refert driver/net/tun.c instead of tap.c. Where it calls netdev_update_features() that will change the TX offloading. Thanks> > I'd appreciate it if someone could give a hint :-) >