[dpdk-dev] [RFC] vhost: Add indirect descriptors support to the TX path

Maxime Coquelin maxime.coquelin at redhat.com
Fri Aug 5 14:18:42 CEST 2016



On 08/03/2016 04:03 PM, Yuanhan Liu wrote:
> On Tue, Jul 12, 2016 at 04:32:12PM +0200, Maxime Coquelin wrote:
>> Indirect descriptors are usually supported by virtio-net devices,
>> allowing to dispatch a large number of large requests.
>>
>> When the virtio device sends a packet using indirect descriptors,
>> only one slot is used in the ring, even for large packets.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
>> ---
>> I have a two questions regarding the implementation of this feature:
>>
>> 1. Should I add a check to ensure the indirect feature is supported
>> (i.e. the negociation succeeded) when having an indirect desc?
>>
>> 2. Should I check in copy_desc_to_mbuf() that we don't have a nested
>> indirect descriptor?
>>
>> Both these sanity checks are recommended from the virtio spec, but
>> since it is to be done in the hot path, it may introduce some
>> performance penalties.
>>
>> Note that the first check is not done in the Kernel vhost driver, whereas
>> the second one is.
>
> I think we could firstly follow the Linux kernel implementation.
OK, I can do that in the v2.
>
>> +		if (vq->desc[desc_indexes[i]].flags & VRING_DESC_F_INDIRECT) {
>> +			desc = (struct vring_desc *)gpa_to_vva(dev,
>> +					vq->desc[desc_indexes[i]].addr);
>> +			rte_prefetch0(desc);
>> +			size = vq->desc[desc_indexes[i]].len / sizeof(*desc);
>> +			idx = 0;
>> +		} else {
>> +			desc = vq->desc;
>> +			size = vq->size;
>> +			idx = desc_indexes[i];
>
> Why not fetching the desc here and feeding it to copy_desc_to_mbuf(),
> instead of using "desc" and "idx" combination and fetching it inside
> that function?
Because the desc we pass to copy_desc_to_mbuf() is the descriptor that 
will be used as the base later to get the next descriptors.

In case of indirect descriptors, the first descriptor of the chain is 
always the first element of the descriptors array, which is not the case 
for direct descriptors.

>
> Overall, this patch looks good to me. As stated in IRC, It'd be great
> if you could offer some performance data.
Sure.
I lacked time this week, and next week will be likely the same.
But I agree we need the perf data before it gets merged.

> Thanks for the work, and apologize for the late review!
Not a problem, you review is appreciated.

Thanks,
Maxime


More information about the dev mailing list