On 6/1/2016 2:41 PM, Yuanhan Liu wrote:
> On Wed, Jun 01, 2016 at 06:24:18AM +0000, Xie, Huawei wrote:
>> On 5/3/2016 8:42 AM, Yuanhan Liu wrote:
>>> Both current kernel virtio driver and DPDK virtio driver use at least
>>> 2 desc buffer for Tx: the first for storing the header, and the others
>>> for storing the data.
>> Tx could prepend some space for virtio net header whenever possible, so
>> that it could use only one descriptor.
> In such case, it will work as well: it will goto the "else" code path
> then.

It works, but the problem is the statement.

>> Another thing is this doesn't reduce the check because you also add a check.
> Actually, yes, it does save check. Before this patch, we have:
>
>       while (not done yet) {
>              if (desc_is_drain)
>                      ...;
>
>              if (mbuf_is_full)
>                      ...;
>
>              COPY();
>       }
>
> Note that the "while" check will be done twice, therefore, it's 4
> checks in total. After this patch, it would be:
>
>       if (virtio_net_hdr_takes_one_desc)
>               ...
>
>       while (1) {
>               COPY();
>
>               if (desc_is_drain) {
>                       break if done;
>                       ...;
>               }
>
>               if (mbuf_is_full {
>                       /* small packets will bypass this check */
>                       ....;
>               }
>       }
>
> So, for small packets, it takes 2 checks only, which actually saves
> 2 checks.
>
>       --yliu
>

For small packets, we have three checks totally. It worth we use space
to save checks, so would ack this patch, but note that there is one
assumption that rte_memcpy API could handle zero length copy.



Reply via email to