DPDK patches and discussions
 help / color / mirror / Atom feed
From: Slava Ovsiienko <viacheslavo@nvidia.com>
To: Maxime Leroy <maxime.leroy@6wind.com>,
	Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Olivier Matz <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Didier Pallard <didier.pallard@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/mlx5: fix Rx descriptor status returned value
Date: Fri, 13 Nov 2020 14:03:50 +0000	[thread overview]
Message-ID: <MWHPR12MB1501478E8818CA189BAB9A1CDFE60@MWHPR12MB1501.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20201112153911.15044-3-maxime.leroy@6wind.com>

Hi, Maxime

> -----Original Message-----
> From: Maxime Leroy <maxime.leroy@6wind.com>
> Sent: Thursday, November 12, 2020 17:39
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> Slava Ovsiienko <viacheslavo@nvidia.com>; Olivier Matz
> <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; Didier Pallard <didier.pallard@6wind.com>
> Subject: [PATCH v2 2/2] net/mlx5: fix Rx descriptor status returned value
> 
> From: Didier Pallard <didier.pallard@6wind.com>
> 
> One entry may contain several segments, so 'used' must be multiplied by
> number of segments per entry to properly reflect the queue usage.
> 
> Fixes: 8788fec1f269 ("net/mlx5: implement descriptor status API")
> Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index
> 2733dcd3..f390dd66 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -463,6 +463,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq)
>  	struct rxq_zip *zip = &rxq->zip;
>  	volatile struct mlx5_cqe *cqe;
>  	const unsigned int cqe_n = (1 << rxq->cqe_n);
> +	const unsigned int sges_n = (1 << rxq->sges_n);
>  	const unsigned int cqe_cnt = cqe_n - 1;
>  	unsigned int cq_ci, used;
> 
> @@ -488,7 +489,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq)
>  		used += n;
>  		cqe = &(*rxq->cqes)[cq_ci & cqe_cnt];
>  	}
> -	used = RTE_MIN(used, cqe_n);
> +	used = RTE_MIN(used * sges_n, cqe_n);

cqe_n reflects the number of the data descriptors in the RxQ, there might be convergency.
I suppose the clamping should be:
- for non-MPRQ rx_burst (regular and vectorized)  - (1 <<rxq->elts_n)
- for MPRQ (1 <<rxq->elts_n) * (1 << rxq->strd_n)

For non-MPRQ the rxq->strd_n is zero,  hence, it could look like:

used = RTE_MIN(used * sges_n, (1 <<rxq->elts_n) * (1 << rxq->strd_n));

With best regards,
Slava

      reply	other threads:[~2020-11-13 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 15:39 [dpdk-dev] [PATCH v2 0/2] net/mlx5: fixes for rx queue count calculation Maxime Leroy
2020-11-12 15:39 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix Rx " Maxime Leroy
2020-11-12 17:04   ` Slava Ovsiienko
2020-11-12 15:39 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: fix Rx descriptor status returned value Maxime Leroy
2020-11-13 14:03   ` Slava Ovsiienko [this message]

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=MWHPR12MB1501478E8818CA189BAB9A1CDFE60@MWHPR12MB1501.namprd12.prod.outlook.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=didier.pallard@6wind.com \
    --cc=matan@nvidia.com \
    --cc=maxime.leroy@6wind.com \
    --cc=olivier.matz@6wind.com \
    --cc=shahafs@nvidia.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 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).