[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220914154434.fng4ifuk73b5m2gt@master>
Date: Wed, 14 Sep 2022 15:44:34 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Wei Yang <richard.weiyang@...il.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
netdev <netdev@...r.kernel.org>,
virtualization <virtualization@...ts.linux-foundation.org>
Subject: Re: [Q] packet truncated after enabling ip_forward for virtio-net in
guest
On Wed, Sep 14, 2022 at 11:46:56AM +0800, Jason Wang wrote:
>On Tue, Sep 13, 2022 at 11:43 PM Wei Yang <richard.weiyang@...il.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).
>>
Thanks Jason
So virtnet_set_guest_offloads() in guest would be handled by
virtio_net_handle_ctrl in qemu. This understanding is correct.
>> 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.
netdev_update_features(struct net_device *dev)
__netdev_update_features(dev);
dev->netdev_ops->ndo_fix_features();
dev->netdev_ops->ndo_set_features();
netdev_features_change(dev);
If my understanding is correct, this netdev_ops is tun_netdev_ops. While this
one doesn't have ndo_set_features.
I see the log "Features changed: xxx" in dmesg, but I still don't get how the
behavior changes.
>
>Thanks
>
>>
>> I'd appreciate it if someone could give a hint :-)
>>
--
Wei Yang
Help you, Help me
Powered by blists - more mailing lists