From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by dpdk.org (Postfix) with ESMTP id 68A8FB6AB for ; Thu, 16 Apr 2015 07:47:40 +0200 (CEST) Received: by igbyr2 with SMTP id yr2so69333465igb.0 for ; Wed, 15 Apr 2015 22:47:40 -0700 (PDT) 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:date :message-id:subject:from:to:cc:content-type; bh=tMKDx/6qx/BuUbN9lGn5QkYayDqlCiQzPW4ilKJlEg4=; b=isnaK97WpRfCdtNlPvsjtwennUnhlcoCbpnHlSg0NSEgACcP83Wp339xj3uMO7v05N 67VRZ3ppL/KHd4dYXDsS3UrUZVfXLZ1E0WzTawJ+VuuVw0NnTUvvbaVJFikDOOmaWWP2 cSwmj/ixTB6nVaMPW68KOQwHhp+tEqTUHgaI+qGtNEsXCr9cDkws5sFW1P1XAGq8nVF5 Rf+aC9//txXge/LBDyemwlbC9lqAyGDJDsJjU0LotsfQ9/62vUjxROhyT4HFEPyFik8/ Yq3K1cXR8NDeL4q7znu0OXGA1BpfWHysVC1LptG3oC6bLQ6PF0ij5D2dryw5TR1FRLR+ 5+Ew== X-Gm-Message-State: ALoCoQl3J0UVW/SK8/zHN4pUuSw2geVaYVZnhrTGKTkHWA4hYkCLy1ZrsRdGxPeZ7C+MwGGA3Bb1 MIME-Version: 1.0 X-Received: by 10.107.19.2 with SMTP id b2mr41179412ioj.9.1429163259929; Wed, 15 Apr 2015 22:47:39 -0700 (PDT) Received: by 10.64.58.227 with HTTP; Wed, 15 Apr 2015 22:47:39 -0700 (PDT) In-Reply-To: References: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> <1429111219-8789-5-git-send-email-stephen@networkplumber.org> Date: Wed, 15 Apr 2015 22:47:39 -0700 Message-ID: From: Stephen Hemminger To: "Ouyang, Changchun" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 4/5] virtio: fix ring size negotiation 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, 16 Apr 2015 05:47:40 -0000 No warning is needed, it just works. On Wed, Apr 15, 2015 at 8:39 PM, Ouyang, Changchun < changchun.ouyang@intel.com> wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen > > Hemminger > > Sent: Wednesday, April 15, 2015 11:20 PM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH 4/5] virtio: fix ring size negotiation > > > > This fixes another of the issues with running virtio on non-KVM > > envirionments. For example, Google Compute Engine reports a ring size of > > 16K. > > > > If guest virtio requests more slots than available then the queue should > just > > I suspect 'more' here should be 'less'? > > > be initialized to the smaller value. > > > > Conversely, if the number of descriptors requested exceeds the virtio > host > > queue size, then just silently use the smaller host size. > > > > Signed-off-by: Stephen Hemminger > > --- > > lib/librte_pmd_virtio/virtio_ethdev.c | 18 +++++++++++++----- > > 1 file changed, 13 insertions(+), 5 deletions(-) > > > > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c > > b/lib/librte_pmd_virtio/virtio_ethdev.c > > index 3cb9c6a..db0232e 100644 > > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > > @@ -267,13 +267,21 @@ int virtio_dev_queue_setup(struct rte_eth_dev > > *dev, > > if (vq_size == 0) { > > PMD_INIT_LOG(ERR, "%s: virtqueue does not exist", > > __func__); > > return -EINVAL; > > - } else if (!rte_is_power_of_2(vq_size)) { > > + } > > + > > + if (!rte_is_power_of_2(vq_size)) { > > PMD_INIT_LOG(ERR, "%s: virtqueue size is not powerof 2", > > __func__); > > return -EINVAL; > > - } else 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); > > - nb_desc = vq_size; > > + } > > + > > + 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; > > Don't we need a warning when nb_desc > vq_size? > > > } > > > > if (queue_type == VTNET_RQ) { > > -- > > 2.1.4 > >