DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] net/mlx5: fix meter creation default state
@ 2022-03-07  8:00 Rongwei Liu
  2022-03-07 10:11 ` Matan Azrad
  2022-03-07 20:56 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Rongwei Liu @ 2022-03-07  8:00 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Li Zhang; +Cc: dev, rasland, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] net/mlx5: fix meter creation default state
  2022-03-07  8:00 [PATCH v1] net/mlx5: fix meter creation default state Rongwei Liu
@ 2022-03-07 10:11 ` Matan Azrad
  2022-03-07 20:56 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2022-03-07 10:11 UTC (permalink / raw)
  To: Rongwei Liu, Slava Ovsiienko, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Li Zhang
  Cc: dev, Raslan Darawsheh, stable



From: Rongwei Liu
> 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>
Acked-by: Matan Azrad <matan@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] net/mlx5: fix meter creation default state
  2022-03-07  8:00 [PATCH v1] net/mlx5: fix meter creation default state Rongwei Liu
  2022-03-07 10:11 ` Matan Azrad
@ 2022-03-07 20:56 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2022-03-07 20:56 UTC (permalink / raw)
  To: Rongwei Liu, Matan Azrad, Slava Ovsiienko, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Li Zhang
  Cc: dev, stable

Hi,

> -----Original Message-----
> From: Rongwei Liu <rongweil@nvidia.com>
> Sent: Monday, March 7, 2022 10:01 AM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Li Zhang
> <lizh@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v1] net/mlx5: fix meter creation default state
> 
> 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>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-07 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07  8:00 [PATCH v1] net/mlx5: fix meter creation default state Rongwei Liu
2022-03-07 10:11 ` Matan Azrad
2022-03-07 20:56 ` Raslan Darawsheh

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).