[dpdk-dev] [PATCH v6 2/6] vhost: rewrite enqueue

Jianbo Liu jianbo.liu at linaro.org
Thu Sep 22 11:58:28 CEST 2016


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?

>         uint16_t avail_idx;
> -       uint32_t allocated = 0;
> -       uint32_t vec_idx = 0;
> -       uint16_t tries = 0;
....


More information about the dev mailing list