From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04055A0613 for ; Thu, 26 Sep 2019 07:59:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E031B2BEA; Thu, 26 Sep 2019 07:59:27 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D3D132BE6 for ; Thu, 26 Sep 2019 07:59:24 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 22:59:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,550,1559545200"; d="scan'208";a="201508992" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.73]) by orsmga002.jf.intel.com with ESMTP; 25 Sep 2019 22:59:22 -0700 Date: Thu, 26 Sep 2019 13:56:34 +0800 From: Tiwei Bie To: Marvin Liu Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, stephen@networkplumber.org, gavin.hu@arm.com, dev@dpdk.org Message-ID: <20190926055634.GA30399@___> References: <20190919163643.24130-2-yong.liu@intel.com> <20190925171329.63734-1-yong.liu@intel.com> <20190925171329.63734-11-yong.liu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190925171329.63734-11-yong.liu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v3 10/15] vhost: optimize enqueue function of packed ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Sep 26, 2019 at 01:13:24AM +0800, Marvin Liu wrote: > static __rte_noinline uint32_t > virtio_dev_rx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, > struct rte_mbuf **pkts, uint32_t count) > { > uint32_t pkt_idx = 0; > - uint16_t num_buffers; > - struct buf_vector buf_vec[BUF_VECTOR_MAX]; > - > - for (pkt_idx = 0; pkt_idx < count; pkt_idx++) { > - uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; > - uint16_t nr_vec = 0; > - uint16_t nr_descs = 0; > - > - if (unlikely(reserve_avail_buf_packed(dev, vq, > - pkt_len, buf_vec, &nr_vec, > - &num_buffers, &nr_descs) < 0)) { > - VHOST_LOG_DEBUG(VHOST_DATA, > - "(%d) failed to get enough desc from vring\n", > - dev->vid); > - vq->shadow_used_idx -= num_buffers; > - break; > + uint32_t remained = count; > + > + do { > + rte_prefetch0(&vq->desc_packed[vq->last_avail_idx & > + (vq->size - 1)]); You can't assume packed ring size is a power of 2.