All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ouyang, Changchun" <changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Stephen Hemminger
	<stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
Cc: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: [PATCH 4/5] virtio: fix ring size negotiation
Date: Thu, 16 Apr 2015 06:26:02 +0000	[thread overview]
Message-ID: <F52918179C57134FAEC9EA62FA2F962511AC2143@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <CAOaVG15WOHD_cXN4gQDZKTBr_77y8poFbYdmnJ89cC1Z5+ibTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



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

No warning is needed, it just works.

I know it works, but the upper user don’t know the descriptor number is reduced.
I concern it is not so user-friendly here.


On Wed, Apr 15, 2015 at 8:39 PM, Ouyang, Changchun <changchun.ouyang@intel.com<mailto:changchun.ouyang@intel.com>> wrote:


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org<mailto:dev-bounces@dpdk.org>] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 15, 2015 11:20 PM
> To: dev@dpdk.org<mailto: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 <stephen@networkplumber.org<mailto:stephen@networkplumber.org>>
> ---
>  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


  parent reply	other threads:[~2015-04-16  6:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15 15:20 [PATCH 0/5] virtio driver fixes and cleanup Stephen Hemminger
     [not found] ` <1429111219-8789-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-15 15:20   ` [PATCH 1/5] virtio: remove useless new lines Stephen Hemminger
     [not found]     ` <1429111219-8789-2-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-16  3:41       ` Ouyang, Changchun
2015-04-15 15:20   ` [PATCH 2/5] virtio: don't enable/disable rx modes unless supported Stephen Hemminger
     [not found]     ` <1429111219-8789-3-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-16  3:41       ` Ouyang, Changchun
2015-04-15 15:20   ` [PATCH 3/5] virtio: don't set mac table unless negotiated Stephen Hemminger
     [not found]     ` <1429111219-8789-4-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-16  3:45       ` Ouyang, Changchun
2015-04-15 15:20   ` [PATCH 4/5] virtio: fix ring size negotiation Stephen Hemminger
     [not found]     ` <1429111219-8789-5-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-04-16  3:39       ` Ouyang, Changchun
     [not found]         ` <F52918179C57134FAEC9EA62FA2F962511AC1EAE-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-16  5:47           ` Stephen Hemminger
     [not found]             ` <CAOaVG15WOHD_cXN4gQDZKTBr_77y8poFbYdmnJ89cC1Z5+ibTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-16  6:26               ` Ouyang, Changchun [this message]
     [not found]                 ` <F52918179C57134FAEC9EA62FA2F962511AC2143-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-16  7:38                   ` Thomas Monjalon
2015-04-16 17:30                     ` Stephen Hemminger
2015-04-16 17:33                   ` Stephen Hemminger
2015-04-15 15:20   ` [PATCH 5/5] virtio: clarify feature bit handling Stephen Hemminger
2015-06-10  0:48     ` Stephen Hemminger
2015-06-11  5:56       ` Ouyang, Changchun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F52918179C57134FAEC9EA62FA2F962511AC2143@shsmsx102.ccr.corp.intel.com \
    --to=changchun.ouyang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.