From: Rongwei Liu <rongweil@nvidia.com>
To: <matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,
<thomas@monjalon.net>, Li Zhang <lizh@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH v1] net/mlx5: fix meter creation default state
Date: Mon, 7 Mar 2022 10:00:35 +0200 [thread overview]
Message-ID: <20220307080035.1140326-1-rongweil@nvidia.com> (raw)
Disable means there is no packet drop in the meter. Meter is
active always but programmed with another CIR/CBS value.
If the user wants to disable the meter in creation, PMD calls
the disable() API manually after meter initialized.
Fixes: 444320186393 ("net/mlx5: support meter creation with policy")
Cc: stable@dpdk.org
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_meter.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 06ab7c4a88..7b24948ab5 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -15,6 +15,10 @@
#include "mlx5.h"
#include "mlx5_flow.h"
+static int
+mlx5_flow_meter_disable(struct rte_eth_dev *dev,
+ uint32_t meter_id,
+ struct rte_mtr_error *error);
/**
* Create the meter action.
*
@@ -1288,7 +1292,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
}
/* Add to the flow meter list. */
fm->active_state = 1; /* Config meter starts as active. */
- fm->is_enable = 1;
+ fm->is_enable = params->meter_enable;
fm->shared = !!shared;
__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
@@ -1313,7 +1317,10 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
data.dword = mtr_idx;
if (mlx5_l3t_set_entry(priv->mtr_idx_tbl, meter_id, &data))
goto error;
+ } else if (!params->meter_enable && mlx5_flow_meter_disable(dev, meter_id, error)) {
+ goto error;
}
+ fm->active_state = params->meter_enable;
if (mtr_policy)
__atomic_add_fetch(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
return 0;
--
2.27.0
next reply other threads:[~2022-03-07 8:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 8:00 Rongwei Liu [this message]
2022-03-07 10:11 ` Matan Azrad
2022-03-07 20:56 ` Raslan Darawsheh
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=20220307080035.1140326-1-rongweil@nvidia.com \
--to=rongweil@nvidia.com \
--cc=dev@dpdk.org \
--cc=lizh@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@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).