From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by dpdk.org (Postfix) with ESMTP id 706935A3E for ; Fri, 17 Jul 2015 12:43:15 +0200 (CEST) Received: by wibud3 with SMTP id ud3so36090459wib.1 for ; Fri, 17 Jul 2015 03:43:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=1V0htZf1xPk+rHoEVy4HkUVSCfjd1CiYVvsLeBqUn/Y=; b=Hy/Zs09vgGaB3KCxjeCsaiUpmAPiyBZfkomFcsSeS83UUtb4pB/TStEVhRgYWoziKU eq0o/eFv5vGkOgJocz6fj7GBjS1kMW4GcV8M41kZ1IPxEy4weFElUAx0m2z68yNU9Uyo ZBpoH92JUCpd1KohW6sLiHOD6FrpdoZTtAhEH9vm/tvd7yMA8jW2gRyMeQZgeukhAs4D S9vdMbiF8xp1aqqlzsV9/KbJlmS44iYZETcwFQu9dacgIibf04JaceL8qDWcaa9mYr5M vZH4obXhzH68Jk0enFMfdbXVdoVVcgbxwdSalHg8lcEYYW2MM0EEGr/7ZSbvuN7PRxdU v3Hw== X-Gm-Message-State: ALoCoQk3zjl2nGlgysiFEL6R+6VLhvuF92mTEBcLZa4cTmOcxSYjnzD1u5yYeov5g9RjfJmkSAaV X-Received: by 10.180.182.33 with SMTP id eb1mr15290415wic.8.1437129795280; Fri, 17 Jul 2015 03:43:15 -0700 (PDT) Received: from xps13.localnet (6wind.net2.nerim.net. [213.41.151.210]) by smtp.gmail.com with ESMTPSA id bm9sm7882227wib.10.2015.07.17.03.43.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2015 03:43:13 -0700 (PDT) From: Thomas Monjalon To: stephen@networkplumber.org Date: Fri, 17 Jul 2015 12:42:02 +0200 Message-ID: <2270958.zeR53oyNJH@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: References: <1435736930-26737-1-git-send-email-changchun.ouyang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue 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: Fri, 17 Jul 2015 10:43:15 -0000 Stephen, This patch is partially reverting yours: http://dpdk.org/browse/dpdk/commit/?id=d78deadae4dca240 A comment or a ack? 2015-07-07 02:32, Ouyang, Changchun: > > > -----Original Message----- > > From: Ouyang, Changchun > > Sent: Wednesday, July 1, 2015 3:49 PM > > To: dev@dpdk.org > > Cc: Cao, Waterman; Xu, Qian Q; Ouyang, Changchun > > Subject: [PATCH] virtio: fix the vq size issue > > > > This commit breaks virtio basic packets rx functionality: > > d78deadae4dca240e85054bf2d604a801676becc > > > > The QEMU use 256 as default vring size, also use this default value to > > calculate the virtio avail ring base address and used ring base address, and > > vhost in the backend use the ring base address to do packet IO. > > > > Virtio spec also says the queue size in PCI configuration is read-only, so virtio > > front end can't change it. just need use the read-only value to allocate space > > for vring and calculate the avail and used ring base address. Otherwise, the > > avail and used ring base address will be different between host and guest, > > accordingly, packet IO can't work normally. > > > > Signed-off-by: Changchun Ouyang > > --- > > drivers/net/virtio/virtio_ethdev.c | 14 +++----------- > > 1 file changed, 3 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/virtio/virtio_ethdev.c > > b/drivers/net/virtio/virtio_ethdev.c > > index fe5f9a1..d84de13 100644 > > --- a/drivers/net/virtio/virtio_ethdev.c > > +++ b/drivers/net/virtio/virtio_ethdev.c > > @@ -263,8 +263,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, > > */ > > vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM); > > PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size, > > nb_desc); > > - if (nb_desc == 0) > > - nb_desc = vq_size; > > if (vq_size == 0) { > > PMD_INIT_LOG(ERR, "%s: virtqueue does not exist", > > __func__); > > return -EINVAL; > > @@ -275,15 +273,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev > > *dev, > > return -EINVAL; > > } > > > > - if (nb_desc < vq_size) { > > - if (!rte_is_power_of_2(nb_desc)) { > > - PMD_INIT_LOG(ERR, > > - "nb_desc(%u) size is not powerof 2", > > - nb_desc); > > - return -EINVAL; > > - } > > - vq_size = nb_desc; > > - } > > + if (nb_desc != vq_size) > > + PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to > > vq size (%d), fall to vq size", > > + nb_desc, vq_size); > > > > if (queue_type == VTNET_RQ) { > > snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d", > > -- > > 1.8.4.2 > > Any more comments for this patch? > > Thanks > Changchun >