[ovs-dev] 答复: 答复: [PATCH] netdev-dpdk: fix incorrect shinfo initialization

Yi Yang (杨燚)-云服务集团 yangyi01 at inspur.com
Tue Feb 2 01:27:49 UTC 2021


Thanks Ilya, net_tap PMD is handling tap device on host side, so it can leverage vnet header to do TSO/GSO, maybe net_pmd authors don't know how to do this, from source code, tap fd isn't enabled vnet header and TSO. 

-----邮件原件-----
发件人: Ilya Maximets [mailto:i.maximets at ovn.org] 
发送时间: 2021年2月2日 3:47
收件人: Yi Yang (杨燚)-云服务集团 <yangyi01 at inspur.com>; fbl at sysclose.org; i.maximets at ovn.org
抄送: yang_y_yi at 163.com; ovs-dev at openvswitch.org; olivier.matz at 6wind.com
主题: Re: 答复: [ovs-dev] [PATCH] netdev-dpdk: fix incorrect shinfo initialization

On 10/28/20 1:35 AM, Yi Yang (杨燚)-云服务集团 wrote:
> -----邮件原件-----
> 发件人: dev [mailto:ovs-dev-bounces at openvswitch.org] 代表 Flavio Leitner
> 发送时间: 2020年10月27日 21:08
> 收件人: Ilya Maximets <i.maximets at ovn.org>
> 抄送: yang_y_yi at 163.com; ovs-dev at openvswitch.org; olivier.matz at 6wind.com
> 主题: Re: [ovs-dev] [PATCH] netdev-dpdk: fix incorrect shinfo 
> initialization
> 
> On Tue, Oct 27, 2020 at 01:47:22PM +0100, Ilya Maximets wrote:
>> On 10/27/20 12:34 PM, Flavio Leitner wrote:
>>> On Wed, Oct 14, 2020 at 03:22:48PM +0800, yang_y_yi at 163.com wrote:
>>>> From: Yi Yang <yangyi01 at inspur.com>
>>>>
>>>> shinfo is used to store reference counter and free callback of an 
>>>> external buffer, but it is stored in mbuf if the mbuf has tailroom 
>>>> for it.
>>>>
>>>> This is wrong because the mbuf (and its data) can be freed before 
>>>> the external buffer, for example:
>>>>
>>>>   pkt2 = rte_pktmbuf_alloc(mp);
>>>>   rte_pktmbuf_attach(pkt2, pkt);
>>>>   rte_pktmbuf_free(pkt);
>>
>> How is that possible with OVS?  Right now OVS doesn't support 
>> multi-segement mbufs and will, likely, not support them in a near 
>> future because it requires changes all other the codebase.
>>
>> Is there any other scenario that could lead to issues with current 
>> OVS implementation?
> 
> This is copying packets. The shinfo is allocated in the mbuf of the first packet which could be deleted without any references to the external buffer still using it.
> 
> Fbl
> 
> [Yi Yang]  Yes, this is not related with multi-segment mbuf, dpdk interfaces to system interfaces communication will use it if the packet size is greater than mtu size, i.e. TSO case from veth/tap to dpdk/vhost and backward will use it, this is a wrong use of shinfo, the same fix (which is used by virtio/vhost driver)has been merged into dpdk branch.

Thanks.  Sorry for delay.
I added some of this information to the commit message and applied to master.  Backported down to 2.13.

I'm wondering, though, why net_tap PMD implements TSO in userspace and
doesn't offload this to kernel via virtio headers?   In many cases
actual segmentation is not necessary or could be done later by HW, so it makes sense to not waste cycles in userspace and let the kernel decide if it's needed or not.

Best regards, Ilya Maximets.


More information about the dev mailing list