From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jianbo Liu Subject: Re: [PATCH v6 2/6] vhost: rewrite enqueue Date: Thu, 22 Sep 2016 17:58:28 +0800 Message-ID: References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <1474336817-22683-1-git-send-email-zhihong.wang@intel.com> <1474336817-22683-3-git-send-email-zhihong.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: dev@dpdk.org, Maxime Coquelin , Yuanhan Liu , Thomas Monjalon To: Zhihong Wang Return-path: Received: from mail-yb0-f182.google.com (mail-yb0-f182.google.com [209.85.213.182]) by dpdk.org (Postfix) with ESMTP id 30BAD2B9E for ; Thu, 22 Sep 2016 11:58:29 +0200 (CEST) Received: by mail-yb0-f182.google.com with SMTP id 2so46131933ybv.0 for ; Thu, 22 Sep 2016 02:58:29 -0700 (PDT) In-Reply-To: <1474336817-22683-3-git-send-email-zhihong.wang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 20 September 2016 at 10:00, Zhihong Wang 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 > --- > 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; ....