All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, dev@dpdk.org,
	erezsc@mellanox.com, amira@mellanox.com, olgas@mellanox.com
Subject: Re: [PATCH 2/2] net/mlx5: add Rx and Tx tuning parameters
Date: Mon, 30 Apr 2018 09:07:59 +0200	[thread overview]
Message-ID: <20180430070759.w5lnkunmcpvaluau@laranjeiro-vm.dev.6wind.com> (raw)
In-Reply-To: <20180429180308.85361-2-shahafs@mellanox.com>

On Sun, Apr 29, 2018 at 09:03:08PM +0300, Shahaf Shuler wrote:
> A new ethdev API was exposed by
> commit 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")
> 
> Enabling the PMD to provide default parameters in case no strict request
> from application in order to improve the out of the box experience.
> 
> While the current API lacks the means for the PMD to provide the best
> possible value, providing the best default the PMD can guess.
> The values are based on Mellanox performance report and depends on the
> underlying NIC capabilities.
> 
> Cc: erezsc@mellanox.com
> Cc: amira@mellanox.com
> Cc: olgas@mellanox.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 51 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index 588d4ba627..78354922b0 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -417,6 +417,56 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
>  }
>  
>  /**
> + * Sets default tuning parameters.
> + *
> + * @param dev
> + *   Pointer to Ethernet device.
> + * @param[out] info
> + *   Info structure output buffer.
> + */
> +static void
> +mlx5_set_default_params(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
> +{
> +	struct priv *priv = dev->data->dev_private;
> +
> +	if (priv->link_speed_capa & ETH_LINK_SPEED_100G) {
> +		if (dev->data->nb_rx_queues <= 2 &&
> +		    dev->data->nb_tx_queues <= 2) {
> +			/* Minimum CPU utilization. */
> +			info->default_rxportconf.ring_size = 256;
> +			info->default_txportconf.ring_size = 256;
> +			/* Don't care as queue num is set. */
> +			info->default_rxportconf.nb_queues = 0;
> +			info->default_txportconf.nb_queues = 0;
> +		} else {
> +			/* Max Throughput. */
> +			info->default_rxportconf.ring_size = 2048;
> +			info->default_txportconf.ring_size = 2048;
> +			info->default_rxportconf.nb_queues = 16;
> +			info->default_txportconf.nb_queues = 16;
> +		}
> +	} else {
> +		if (dev->data->nb_rx_queues <= 2 &&
> +		    dev->data->nb_tx_queues <= 2) {
> +			/* Minimum CPU utilization. */
> +			info->default_rxportconf.ring_size = 256;
> +			info->default_txportconf.ring_size = 256;
> +			/* Don't care as queue num is set. */
> +			info->default_rxportconf.nb_queues = 0;
> +			info->default_txportconf.nb_queues = 0;
> +		} else {
> +			/* Max Throughput. */
> +			info->default_rxportconf.ring_size = 4096;
> +			info->default_txportconf.ring_size = 4096;
> +			info->default_rxportconf.nb_queues = 8;
> +			info->default_txportconf.nb_queues = 8;
> +		}
> +	}
> +	info->default_rxportconf.burst_size = 64;
> +	info->default_txportconf.burst_size = 64;

This can be fully re-written to simplify and ease the maintenance,
default values i.e. "Minimum CPU utilization" are duplicated, this can
be used as default values and just tweak in case the amount of queues
are different from 2 according to the link speed. 

> +}
> +
> +/**
>   * DPDK callback to get information about the device.
>   *
>   * @param dev
> @@ -458,6 +508,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
>  	info->hash_key_size = rss_hash_default_key_len;
>  	info->speed_capa = priv->link_speed_capa;
>  	info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK;
> +	mlx5_set_default_params(dev, info);
>  }
>  
>  /**
> -- 
> 2.12.0

Thanks,

-- 
Nélio Laranjeiro
6WIND

  reply	other threads:[~2018-04-30  7:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 18:03 [PATCH 1/2] net/mlx5: fix ethtool link setting call order Shahaf Shuler
2018-04-29 18:03 ` [PATCH 2/2] net/mlx5: add Rx and Tx tuning parameters Shahaf Shuler
2018-04-30  7:07   ` Nélio Laranjeiro [this message]
2018-04-30  7:08 ` [PATCH 1/2] net/mlx5: fix ethtool link setting call order Nélio Laranjeiro
2018-05-01  9:58 ` [PATCH v2 " Shahaf Shuler
2018-05-03  5:51   ` Shahaf Shuler
2018-05-01  9:58 ` [PATCH v2 2/2] net/mlx5: add Rx and Tx tuning parameters Shahaf Shuler
2018-05-02  6:40   ` Nélio Laranjeiro

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=20180430070759.w5lnkunmcpvaluau@laranjeiro-vm.dev.6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=amira@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=erezsc@mellanox.com \
    --cc=olgas@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=yskoh@mellanox.com \
    /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.