DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: check Tx queue size overflow
Date: Wed, 1 May 2019 01:15:39 +0000	[thread overview]
Message-ID: <C6465571-B130-4798-A7DD-75D8630E8900@mellanox.com> (raw)
Message-ID: <20190501011539.6lrfvCzA9-izLaMcv6uiyKbm1rBOkxE_YH8S6Gtgryw@z> (raw)
In-Reply-To: <20190501010143.611-1-yskoh@mellanox.com>


> On Apr 30, 2019, at 6:01 PM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> If Tx packet inlining is enabled, rdma-core library should allocate large
> Tx WQ enough to support it. It is better for PMD to calculate the size of
> WQ based on the parameters and return error with appropriate message if it
> exceeds the device capability.
> 
> Cc:stable@dpdk.org

Shahaf,
There's a checkpatch warning. Please put a space after ':' if you merge it.

Thanks,
Yongseok

> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_txq.c | 35 +++++++++++++++++++++++++++++++----
> 1 file changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
> index 4d55fd413c..b281c45027 100644
> --- a/drivers/net/mlx5/mlx5_txq.c
> +++ b/drivers/net/mlx5/mlx5_txq.c
> @@ -679,6 +679,27 @@ mlx5_txq_ibv_verify(struct rte_eth_dev *dev)
> }
> 
> /**
> + * Calcuate the total number of WQEBB for Tx queue.
> + *
> + * Simplified version of calc_sq_size() in rdma-core.
> + *
> + * @param txq_ctrl
> + *   Pointer to Tx queue control structure.
> + *
> + * @return
> + *   The number of WQEBB.
> + */
> +static int
> +txq_calc_wqebb_cnt(struct mlx5_txq_ctrl *txq_ctrl)
> +{
> +	unsigned int wqe_size;
> +	const unsigned int desc = 1 << txq_ctrl->txq.elts_n;
> +
> +	wqe_size = MLX5_WQE_SIZE + txq_ctrl->max_inline_data;
> +	return rte_align32pow2(wqe_size * desc) / MLX5_WQE_SIZE;
> +}
> +
> +/**
>  * Set Tx queue parameters from device configuration.
>  *
>  * @param txq_ctrl
> @@ -824,10 +845,16 @@ mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
> 	tmpl->txq.port_id = dev->data->port_id;
> 	tmpl->txq.idx = idx;
> 	txq_set_params(tmpl);
> -	DRV_LOG(DEBUG, "port %u device_attr.max_qp_wr is %d",
> -		dev->data->port_id, priv->sh->device_attr.orig_attr.max_qp_wr);
> -	DRV_LOG(DEBUG, "port %u device_attr.max_sge is %d",
> -		dev->data->port_id, priv->sh->device_attr.orig_attr.max_sge);
> +	if (txq_calc_wqebb_cnt(tmpl) >
> +	    priv->sh->device_attr.orig_attr.max_qp_wr) {
> +		DRV_LOG(ERR,
> +			"port %u Tx WQEBB count (%d) exceeds the limit (%d),"
> +			" try smaller queue size",
> +			dev->data->port_id, txq_calc_wqebb_cnt(tmpl),
> +			priv->sh->device_attr.orig_attr.max_qp_wr);
> +		rte_errno = ENOMEM;
> +		goto error;
> +	}
> 	tmpl->txq.elts =
> 		(struct rte_mbuf *(*)[1 << tmpl->txq.elts_n])(tmpl + 1);
> 	rte_atomic32_inc(&tmpl->refcnt);
> -- 
> 2.11.0
> 


  parent reply	other threads:[~2019-05-01  1:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 19:04 [dpdk-dev] [PATCH] " Yongseok Koh
2019-04-30 19:04 ` Yongseok Koh
2019-04-30 20:46 ` Stephen Hemminger
2019-04-30 20:46   ` Stephen Hemminger
2019-05-01  0:43   ` Yongseok Koh
2019-05-01  0:43     ` Yongseok Koh
2019-05-01  0:56     ` Yongseok Koh
2019-05-01  0:56       ` Yongseok Koh
2019-05-01  1:01 ` [dpdk-dev] [PATCH v2] " Yongseok Koh
2019-05-01  1:01   ` Yongseok Koh
2019-05-01  1:15   ` Yongseok Koh [this message]
2019-05-01  1:15     ` Yongseok Koh
2019-05-01  6:10     ` Shahaf Shuler
2019-05-01  6:10       ` Shahaf Shuler

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=C6465571-B130-4798-A7DD-75D8630E8900@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    --cc=stephen@networkplumber.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 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).