DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shun Hao <shunh@nvidia.com>
To: <shunh@nvidia.com>, <orika@nvidia.com>, <viacheslavo@nvidia.com>,
	<matan@nvidia.com>, <shahafs@nvidia.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>, <rasland@nvidia.com>,
	<roniba@nvidia.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix meter flow id
Date: Wed, 12 May 2021 13:20:59 +0300	[thread overview]
Message-ID: <20210512102100.23870-1-shunh@nvidia.com> (raw)

When getting meter flow_id bits, there's an issue that not handling
correctly if flow_id is 0.

This fix this issue that when flow_id is 0, treat it as 1 bit.

Fixes: 83306d6c46 ("net/mlx5: fix meter statistics")
Cc: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 32634c9af7..edfac0d99f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -4794,8 +4794,8 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
 					RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 					"Failed to allocate meter flow id.");
 		flow_id = tag_id - 1;
-		flow_id_bits = MLX5_REG_BITS - __builtin_clz(flow_id);
-		flow_id_bits = flow_id_bits ? flow_id_bits : 1;
+		flow_id_bits = (!flow_id) ? 1 :
+				(MLX5_REG_BITS - __builtin_clz(flow_id));
 		if ((flow_id_bits + priv->sh->mtrmng->max_mtr_bits) >
 		    mtr_reg_bits) {
 			mlx5_ipool_free(fm->flow_ipool, tag_id);
-- 
2.20.0


             reply	other threads:[~2021-05-12 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 10:20 Shun Hao [this message]
2021-05-12 11:52 ` Matan Azrad
2021-05-12 12:50   ` Thomas Monjalon

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=20210512102100.23870-1-shunh@nvidia.com \
    --to=shunh@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=roniba@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@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).