DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Chenbo Xia <chenbo.xia@intel.com>
Cc: dev@dpdk.org, Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Subject: Re: [dpdk-dev] [PATCH] net/virtio: report max/min/align desc limits in dev info get
Date: Mon, 13 Sep 2021 21:52:06 +0200	[thread overview]
Message-ID: <b18c7f0b-e622-8e1f-4232-535af48a56b0@redhat.com> (raw)
In-Reply-To: <20210820124812.3522838-1-andrew.rybchenko@oktetlabs.ru>



On 8/20/21 2:48 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
> 
> Report max/min/align descriptors limits in device info get callback.
> Before calling the callback, rte_eth_dev_info_get() provides
> default values of nb_min as zero and nb_max as UINT16_MAX that are
> not correct for the driver, so one can't rely on them.
> 
> Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index e58085a2c9..601c03e079 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -33,6 +33,7 @@
>  #include "virtio_logs.h"
>  #include "virtqueue.h"
>  #include "virtio_rxtx.h"
> +#include "virtio_rxtx_simple.h"
>  #include "virtio_user/virtio_user_dev.h"
>  
>  static int  virtio_dev_configure(struct rte_eth_dev *dev);
> @@ -2536,6 +2537,30 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>  	if ((host_features & tso_mask) == tso_mask)
>  		dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO;
>  
> +	if (host_features & (1ULL << VIRTIO_F_RING_PACKED)) {
> +		/*
> +		 * According to 2.7 Packed Virtqueues,
> +		 * 2.7.10.1 Structure Size and Alignment:
> +		 * The Queue Size value does not have to be a power of 2.
> +		 */
> +		dev_info->rx_desc_lim.nb_max = UINT16_MAX;
> +	} else {
> +		/*
> +		 * According to 2.6 Split Virtqueues:
> +		 * Queue Size value is always a power of 2. The maximum Queue
> +		 * Size value is 32768.
> +		 */
> +		dev_info->rx_desc_lim.nb_max = 32768;
> +	}
> +	/*
> +	 * Actual minimum is not the same for virtqueues of different kinds,
> +	 * but to avoid tangling the code with separate branches, rely on
> +	 * default thresholds since desc number must be at least of their size.
> +	 */
> +	dev_info->rx_desc_lim.nb_min = RTE_MAX(DEFAULT_RX_FREE_THRESH,
> +					       RTE_VIRTIO_VPMD_RX_REARM_THRESH);
> +	dev_info->rx_desc_lim.nb_align = 1;
> +

It makes sense, but shouldn't we do the same for dev_info->tx_desc_lim?

>  	return 0;
>  }
>  
> 


  reply	other threads:[~2021-09-13 19:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 12:48 Andrew Rybchenko
2021-09-13 19:52 ` Maxime Coquelin [this message]
2021-09-14  6:43   ` Andrew Rybchenko
2021-09-14  7:29     ` Maxime Coquelin
2021-09-14  9:45 ` Maxime Coquelin
2021-09-14 11:26 ` Maxime Coquelin

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=b18c7f0b-e622-8e1f-4232-535af48a56b0@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=ivan.ilchenko@oktetlabs.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).