[dpdk-dev] [PATCH v2 2/7] vhost: refactor virtio_dev_rx

2016-03-08 Thread Yuanhan Liu
On Mon, Mar 07, 2016 at 03:34:53AM +, Xie, Huawei wrote: > On 2/18/2016 9:48 PM, Yuanhan Liu wrote: > > + while (1) { > > + /* done with current mbuf, fetch next */ > > + if (mbuf_avail == 0) { > > + m = m->next; > > + if (m == NULL) > >

[dpdk-dev] [PATCH v2 2/7] vhost: refactor virtio_dev_rx

2016-03-07 Thread Xie, Huawei
On 2/18/2016 9:48 PM, Yuanhan Liu wrote: > + while (1) { > + /* done with current mbuf, fetch next */ > + if (mbuf_avail == 0) { > + m = m->next; > + if (m == NULL) > + break; > + > +

[dpdk-dev] [PATCH v2 2/7] vhost: refactor virtio_dev_rx

2016-02-18 Thread Yuanhan Liu
This is a simple refactor, as there isn't any twisted logic in old code. Here I just broke the code and introduced two helper functions, reserve_avail_buf() and copy_mbuf_to_desc() to make the code more readable. Also, it saves nearly 1K bytes of binary code size. Signed-off-by: Yuanhan Liu ---