From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=a0fsF8dkEKAPKoFtkzlVcR/wnySJyQrtZJkRivx7QHI=; b=dG8BhHEDvRTBK9ZY0yZT0WX8tEnAygmDEIQUwY5OW3fXFPt7mAhIbomqzoZ/K4f6yj 1EhRzZEpJQSXwxSFnOZ0pe3Afvu8T81J5cZNb7o9m/iypXUwv+jHJhrlux2U9uAbgx6g XNmzjcL4nWRaaZh8/zRzHyyfVB7+dmq4FHuzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=a0fsF8dkEKAPKoFtkzlVcR/wnySJyQrtZJkRivx7QHI=; b=O5DNG8xz7qqPXGCTu2q24J8DR8ueYCrxp1EeuJC3wfN5KwDpC7+tRmUz5t56OCQ8mI i+pWSZfBqUqNtSUORCC9MbkGLSJI7szR0HaZEulIyVPf/TgRoPfJqDxFZmpVDyluUyKS 2K1AOVE61Ltu9IxZF7T0O846cNFBYYh1wsdXMwciYlxgilPIom2emQzDnMstX+V2WutN rqv6iiVxu2KcKOGr0NpKUkUxmc7sMwWwptHw68yNcKN4zYHk/H/aebOeh/RPtTnT4s6H 2KjO+ZB3O8aS3IPPGtaGf9RBv3xso6f+b4FO6jVX7DHykd8xvxcn4VquxczYRiMYKhRC cffg== X-Gm-Message-State: AE9vXwPIgLViPzjHa+3CN2zJWZtH3hPEKrr+4C6K8LzjrxFzCv1ELxn934ghoGz1Mf7EnEEPc8zQXXq4klLk3rvw X-Received: by 10.37.197.5 with SMTP id v5mr713054ybe.119.1474538308614; Thu, 22 Sep 2016 02:58:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.25.6 with HTTP; Thu, 22 Sep 2016 02:58:28 -0700 (PDT) In-Reply-To: <1474336817-22683-3-git-send-email-zhihong.wang@intel.com> 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> From: Jianbo Liu Date: Thu, 22 Sep 2016 17:58:28 +0800 Message-ID: To: Zhihong Wang Cc: dev@dpdk.org, Maxime Coquelin , Yuanhan Liu , Thomas Monjalon Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH v6 2/6] vhost: rewrite enqueue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 09:58:29 -0000 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; ....