From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C1D3E7CAF for ; Wed, 21 Mar 2018 10:00:23 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 02:00:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,339,1517904000"; d="scan'208";a="184677045" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164]) by orsmga004.jf.intel.com with ESMTP; 21 Mar 2018 02:00:21 -0700 Date: Wed, 21 Mar 2018 16:58:46 +0800 From: Tiwei Bie To: Jens Freimann Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com, mst@redhat.com Message-ID: <20180321085846.364wejdsng6lkbys@debian> References: <20180316152120.13199-1-jfreimann@redhat.com> <20180316152120.13199-14-jfreimann@redhat.com> <20180319110256.yaibpb37fybrohky@debian> <20180321084559.7v5rbf6d34ijad53@dhcp-192-241.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180321084559.7v5rbf6d34ijad53@dhcp-192-241.str.redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 13/17] vhost: packed queue enqueue path 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: , X-List-Received-Date: Wed, 21 Mar 2018 09:00:24 -0000 On Wed, Mar 21, 2018 at 09:45:59AM +0100, Jens Freimann wrote: > On Mon, Mar 19, 2018 at 07:02:56PM +0800, Tiwei Bie wrote: > > On Fri, Mar 16, 2018 at 04:21:16PM +0100, Jens Freimann wrote: > > [...] > > > +static inline uint32_t __attribute__((always_inline)) > > > +vhost_enqueue_burst_packed(struct virtio_net *dev, uint16_t queue_id, > > > + struct rte_mbuf **pkts, uint32_t count) > > > +{ > > > + struct vhost_virtqueue *vq; > > > + struct vring_desc_packed *descs; > > > + uint16_t idx; > > > + uint16_t mask; > > > + uint16_t i; > > > + > > > + vq = dev->virtqueue[queue_id]; > > > + > > > + rte_spinlock_lock(&vq->access_lock); > > > + > > > + if (unlikely(vq->enabled == 0)) { > > > + i = 0; > > > + goto out_access_unlock; > > > + } > > > + > > > + if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) > > > + vhost_user_iotlb_rd_lock(vq); > > > + > > > + descs = vq->desc_packed; > > > + mask = vq->size - 1; > > > > Queue size may not be a power of 2 in packed ring. > > yes, you are right. my patches don't support this yet, but I plan to > add it in the next version. Yeah, thanks. Otherwise, because this is vhost code, and the vq->size is set by virtio driver. So when above code works with a virtio driver which uses a ring size that's not a power of 2, such assumption will cause problems. Thanks > > Thanks for the review! > > regards, > Jens