> -----Original Message----- > From: Jianbo Liu [mailto:jianbo.liu at linaro.org] > Sent: Thursday, September 22, 2016 5:58 PM > To: Wang, Zhihong <zhihong.wang at intel.com> > Cc: dev at dpdk.org; Maxime Coquelin <maxime.coquelin at redhat.com>; > Yuanhan Liu <yuanhan.liu at linux.intel.com>; Thomas Monjalon > <thomas.monjalon at 6wind.com> > Subject: Re: [dpdk-dev] [PATCH v6 2/6] vhost: rewrite enqueue > > On 20 September 2016 at 10:00, Zhihong Wang <zhihong.wang at intel.com> > wrote: > > This patch implements the vhost logic from scratch into a single function > > to improve maintainability. This is the baseline version of the new code, > > more optimization will be added in the following patches in this patch set. > > > > In the existing code there're 2 callbacks for vhost enqueue: > > > > * virtio_dev_merge_rx for mrg_rxbuf turned on cases. > > > > * virtio_dev_rx for mrg_rxbuf turned off cases. > > > > Having 2 callback paths increases maintenance effort. Also, the > performance > > of the existing code is not optimal, especially when the mrg_rxbuf feature > > turned on. > > > > Signed-off-by: Zhihong Wang <zhihong.wang at intel.com> > > --- > > Changes in v6: > ..... > > > -/* > > - * Returns -1 on fail, 0 on success > > - */ > > -static inline int > > -reserve_avail_buf_mergeable(struct vhost_virtqueue *vq, uint32_t size, > > - uint16_t *end, struct buf_vector *buf_vec) > > +uint16_t > > +rte_vhost_enqueue_burst(int vid, uint16_t queue_id, > > + struct rte_mbuf **pkts, uint16_t count) > > { > > - uint16_t cur_idx; > > + struct vhost_virtqueue *vq; > > + struct virtio_net *dev; > > + uint32_t is_mrg_rxbuf = 0; > > + uint32_t pkt_idx = 0; > > + uint32_t pkt_left = count; > > Is pkt_left really needed?
It's a matter of coding style since there's no underlying difference. I prefer this way personally. > > > uint16_t avail_idx; > > - uint32_t allocated = 0; > > - uint32_t vec_idx = 0; > > - uint16_t tries = 0; > ....