From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id 7C0CA7F1C for ; Thu, 16 Apr 2015 19:33:32 +0200 (CEST) Received: by pdbqd1 with SMTP id qd1so99240286pdb.2 for ; Thu, 16 Apr 2015 10:33:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=9I28UyvFxZv+Glqz6t31z8FafMg6mptVZLOrUDMfFn8=; b=aauxPEE0QkB4vnSPdC104nmS4Wyqt/dkf9nlN5QfVuObQTRKB/71HaDzz/SYvyu4kb TcBHIWuf185uryyhCSYykoO+ZJNc2NKgcp5VucWhp8eTOBvj1syEpzdTjCC0rqQmun6H WeM8oMwX3/Nc+A3i+TKIUj/CHMmai6d+BuF3184JkrnCY7GmkN4L2KsVkhxmTAy2EjAr wRQQNj31wSBHBWp263ffMMe5aK+QLagI2JqDoH/Ps14P8OGp6wMuTujhYbLTo+JZLAKp wso7m7dfgFrpQl03WAdLUerljvyz7YTjMwHvS+i1MRmWwGzp7vG9yZJrW4cYlLUs2XxQ fXTw== X-Gm-Message-State: ALoCoQlAdACDRsZt7pW1s/xl4GsSZitVQljsSbUQ2jfCCFD5Ka/3+DUa6eGF7MDoCz6oktmFCHG7 X-Received: by 10.69.12.227 with SMTP id et3mr1348779pbd.11.1429205611934; Thu, 16 Apr 2015 10:33:31 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id pd10sm7741473pdb.66.2015.04.16.10.33.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2015 10:33:31 -0700 (PDT) Date: Thu, 16 Apr 2015 10:33:36 -0700 From: Stephen Hemminger To: "Ouyang, Changchun" Message-ID: <20150416103336.1b11c7dd@urahara> In-Reply-To: References: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> <1429111219-8789-5-git-send-email-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 17:33:32 -0000 On Thu, 16 Apr 2015 06:26:02 +0000 "Ouyang, Changchun" wrote: >=20 >=20 > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Thursday, April 16, 2015 1:48 PM > To: Ouyang, Changchun > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 4/5] virtio: fix ring size negotiation >=20 > No warning is needed, it just works. >=20 > I know it works, but the upper user don=E2=80=99t know the descriptor num= ber is reduced. > I concern it is not so user-friendly here. >=20 >=20 > On Wed, Apr 15, 2015 at 8:39 PM, Ouyang, Changchun > wrote: >=20 >=20 > > -----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 shoul= d just >=20 > I suspect 'more' here should be 'less'? >=20 > > be initialized to the smaller value. > > > > Conversely, if the number of descriptors requested exceeds the virtio h= ost > > 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 =3D=3D 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 !=3D 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 =3D 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 =3D nb_desc; > Don't we need a warning when nb_desc > vq_size? No warning is needed. This will actually be a common case for many applications. =20 IMHO application should not have to worry about what type of network device it is running on and therefore would likely pass a reasonably large number of receive descriptors (say 512) and since the default KVM/QEMU ring size is 256, the receive queue would be limited by host not application. The whole idea of application passing number of receive descriptors to DPDK is bogus because each device driver has different timing, and may use different number of receive descriptors per packet.