DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <cristian.dumitrescu@intel.com>, <jerinjacobk@gmail.com>,
	<orika@nvidia.com>, <thomas@monjalon.net>,
	<ivan.malov@oktetlabs.ru>, <andrew.rybchenko@oktetlabs.ru>,
	<ferruh.yigit@xilinx.com>, <mohammad.abdul.awal@intel.com>,
	<qi.z.zhang@intel.com>, <jerinj@marvell.com>,
	<ajit.khaparde@broadcom.com>, <bruce.richardson@intel.com>
Subject: [PATCH 3/4] ethdev: add meter profile config calculation
Date: Wed, 18 May 2022 07:34:58 +0300	[thread overview]
Message-ID: <20220518043459.1281590-4-akozyrev@nvidia.com> (raw)
In-Reply-To: <20220518043459.1281590-1-akozyrev@nvidia.com>

Introduce a new Meter API to calculate PMD-specific profile
configuration values based on user-provided CIR, CBS and EBS.
That will allow fast Meter configuration in hardware without
the need to convert these values every time we use a profile.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 .../traffic_metering_and_policing.rst         |  2 ++
 doc/guides/rel_notes/release_22_07.rst        |  1 +
 lib/ethdev/rte_mtr.c                          | 12 ++++++++++
 lib/ethdev/rte_mtr.h                          | 24 +++++++++++++++++++
 lib/ethdev/rte_mtr_driver.h                   |  9 +++++++
 lib/ethdev/version.map                        |  3 +++
 6 files changed, 51 insertions(+)

diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst
index ceb5a96488..99c25f8937 100644
--- a/doc/guides/prog_guide/traffic_metering_and_policing.rst
+++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst
@@ -105,3 +105,5 @@ traffic meter and policing library.
    * Adding one (or multiple) actions of the type ``RTE_FLOW_ACTION_TYPE_METER``
      to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``)
      specified per color as show in :numref:`figure_rte_mtr_chaining`.
+#.  Traffic metering algorithm configuration may be converted to the PDM-specific
+   values using ``rte_mtr_meter_profile_calculate()`` API function for reuse.
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index ec83178d98..5f19223663 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -64,6 +64,7 @@ New Features
 
   * Added METER_COLOR item to match Color Marker set by a Meter.
   * Added ability to set Color Marker via modify_field Flow API.
+  * Added Meter API to calculate a profile configuration values.
 
 * **Updated Intel iavf driver.**
 
diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c
index e49fcf271c..e236cac09b 100644
--- a/lib/ethdev/rte_mtr.c
+++ b/lib/ethdev/rte_mtr.c
@@ -91,6 +91,18 @@ rte_mtr_meter_profile_delete(uint16_t port_id,
 		meter_profile_id, error);
 }
 
+/** MTR meter profile calculate */
+int
+rte_mtr_meter_profile_calculate(uint16_t port_id,
+	uint32_t meter_profile_id,
+	void *meter_profile_cfg,
+	struct rte_mtr_error *error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	return RTE_MTR_FUNC(port_id, meter_profile_calculate)(dev,
+		meter_profile_id, meter_profile_cfg, error);
+}
+
 /* MTR meter policy validate */
 int
 rte_mtr_meter_policy_validate(uint16_t port_id,
diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h
index 40df0888c8..d7b916b168 100644
--- a/lib/ethdev/rte_mtr.h
+++ b/lib/ethdev/rte_mtr.h
@@ -524,6 +524,30 @@ rte_mtr_meter_profile_delete(uint16_t port_id,
 	uint32_t meter_profile_id,
 	struct rte_mtr_error *error);
 
+/**
+ * Meter profile calculate
+ *
+ * Calculate CIR, CBS and EBS values for a given meter profile ID.
+ * Convert user-provided values to PMD-specific configuration.
+ *
+ * @param[in] port_id
+ *   The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ *   Meter profile ID. Needs to be the valid.
+ * @param[out] meter_profile_cfg
+ *   Meter profile configuration filled by PMD.
+ * @param[out] error
+ *   Error details. Filled in only on error, when not NULL.
+ * @return
+ *   0 on success, non-zero error code otherwise.
+ */
+__rte_experimental
+int
+rte_mtr_meter_profile_calculate(uint16_t port_id,
+	uint32_t meter_profile_id,
+	void *meter_profile_cfg,
+	struct rte_mtr_error *error);
+
 /**
  * Check whether a meter policy can be created on a given port.
  *
diff --git a/lib/ethdev/rte_mtr_driver.h b/lib/ethdev/rte_mtr_driver.h
index ee8c6ef7ad..f1982ff220 100644
--- a/lib/ethdev/rte_mtr_driver.h
+++ b/lib/ethdev/rte_mtr_driver.h
@@ -41,6 +41,12 @@ typedef int (*rte_mtr_meter_profile_delete_t)(struct rte_eth_dev *dev,
 	uint32_t meter_profile_id,
 	struct rte_mtr_error *error);
 
+/** @internal MTR meter profile calculate. */
+typedef int (*rte_mtr_meter_profile_calculate_t)(struct rte_eth_dev *dev,
+	uint32_t meter_profile_id,
+	void *meter_profile_cfg,
+	struct rte_mtr_error *error);
+
 /** @internal MTR meter policy validate. */
 typedef int (*rte_mtr_meter_policy_validate_t)(struct rte_eth_dev *dev,
 	struct rte_mtr_meter_policy_params *policy,
@@ -156,6 +162,9 @@ struct rte_mtr_ops {
 
 	/** MTR object meter policy update */
 	rte_mtr_meter_policy_update_t meter_policy_update;
+
+	/** MTR meter profile calculate */
+	rte_mtr_meter_profile_calculate_t meter_profile_calculate;
 };
 
 /**
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 20391ab29e..76024331cb 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -279,6 +279,9 @@ EXPERIMENTAL {
 	rte_flow_async_action_handle_create;
 	rte_flow_async_action_handle_destroy;
 	rte_flow_async_action_handle_update;
+
+	# added in 22.07
+	rte_mtr_meter_profile_calculate;
 };
 
 INTERNAL {
-- 
2.18.2


  parent reply	other threads:[~2022-05-18  4:35 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  2:46 [RFC] ethdev: datapath-focused meter actions Alexander Kozyrev
2022-04-08  8:21 ` Jerin Jacob
2022-04-26 13:43   ` Dumitrescu, Cristian
2022-04-26 13:45     ` Dumitrescu, Cristian
2022-05-02 19:12     ` Alexander Kozyrev
2022-05-02 20:02 ` [PATCH v2 0/3] " Alexander Kozyrev
2022-05-02 20:04 ` [RFC " Alexander Kozyrev
2022-05-02 20:04   ` [PATCH v2 1/3] ethdev: add meter color matching to Flow API Alexander Kozyrev
2022-05-02 20:04   ` [PATCH v2 2/3] ethdev: allow meter color modification Alexander Kozyrev
2022-05-02 20:04   ` [PATCH v2 3/3] ethdev: add extended meter action to Flow API Alexander Kozyrev
2022-05-18  4:34   ` [PATCH 0/4] ethdev: separate metering and marking from policing Alexander Kozyrev
2022-05-18  4:34     ` [PATCH 1/4] ethdev: add meter color flow matching item Alexander Kozyrev
2022-05-19 14:44       ` Dumitrescu, Cristian
2022-05-18  4:34     ` [PATCH 2/4] ethdev: allow meter color marker modification Alexander Kozyrev
2022-05-19 14:49       ` Dumitrescu, Cristian
2022-05-24 12:19         ` Alexander Kozyrev
2022-05-18  4:34     ` Alexander Kozyrev [this message]
2022-05-19 14:55       ` [PATCH 3/4] ethdev: add meter profile config calculation Dumitrescu, Cristian
2022-05-24 12:36         ` Alexander Kozyrev
2022-05-18  4:34     ` [PATCH 4/4] ethdev: add meter color mark flow action Alexander Kozyrev
2022-05-22 10:50     ` [PATCH v2 0/4] ethdev: separate metering and marking from policing Alexander Kozyrev
2022-05-22 10:50       ` [PATCH v2 1/4] ethdev: add meter color flow matching item Alexander Kozyrev
2022-05-26 12:16         ` Ori Kam
2022-05-22 10:51       ` [PATCH v2 2/4] ethdev: allow meter color marker modification Alexander Kozyrev
2022-05-26 12:21         ` Ori Kam
2022-05-22 10:51       ` [PATCH v2 3/4] ethdev: get meter profile/policy objects Alexander Kozyrev
2022-05-26 12:27         ` Ori Kam
2022-06-01  3:33           ` Alexander Kozyrev
2022-05-22 10:51       ` [PATCH v2 4/4] ethdev: add meter color mark flow action Alexander Kozyrev
2022-05-26 12:33         ` Ori Kam
2022-06-01  3:35           ` Alexander Kozyrev
2022-05-26 12:35       ` [PATCH v2 0/4] ethdev: separate metering and marking from policing Ori Kam
2022-05-26 13:21       ` Jerin Jacob
2022-05-26 13:22         ` Jerin Jacob
2022-06-01  3:19           ` Alexander Kozyrev
2022-06-01  3:44       ` [PATCH v3 0/7] " Alexander Kozyrev
2022-06-01  3:44         ` [PATCH v3 1/7] ethdev: add meter color flow matching item Alexander Kozyrev
2022-06-01  8:44           ` Ori Kam
2022-06-09 12:18           ` Andrew Rybchenko
2022-06-01  3:44         ` [PATCH v3 2/7] ethdev: allow meter color marker modification Alexander Kozyrev
2022-06-01  8:45           ` Ori Kam
2022-06-09 12:18           ` Andrew Rybchenko
2022-06-01  3:44         ` [PATCH v3 3/7] ethdev: get meter profile/policy objects Alexander Kozyrev
2022-06-01  8:51           ` Ori Kam
2022-06-09 12:18           ` Andrew Rybchenko
2022-06-01  3:44         ` [PATCH v3 4/7] ethdev: add meter color mark flow action Alexander Kozyrev
2022-06-01  8:55           ` Ori Kam
2022-06-09 12:19           ` Andrew Rybchenko
2022-06-01  3:44         ` [PATCH v3 5/7] app/testpmd: add meter color flow matching item Alexander Kozyrev
2022-06-01  8:59           ` Ori Kam
2022-06-01  3:44         ` [PATCH v3 6/7] app/testpmd: allow meter color marker modification Alexander Kozyrev
2022-06-01  8:59           ` Ori Kam
2022-06-01  3:44         ` [PATCH v3 7/7] app/testpmd: add meter color mark flow action Alexander Kozyrev
2022-06-01  9:01           ` Ori Kam
2022-06-08 11:41         ` [PATCH v3 0/7] ethdev: separate metering and marking from policing Dumitrescu, Cristian
2022-09-21  2:11         ` [PATCH v4 " Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 1/7] ethdev: add meter color flow matching item Alexander Kozyrev
2022-09-21 12:54             ` Ori Kam
2022-09-21  2:11           ` [PATCH v4 2/7] ethdev: allow meter color marker modification Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 3/7] ethdev: get meter profile/policy objects Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 4/7] ethdev: add meter color mark flow action Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 5/7] app/test-pmd: add meter color flow matching item Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 6/7] app/test-pmd: allow meter color marker modification Alexander Kozyrev
2022-09-21  2:11           ` [PATCH v4 7/7] app/testpmd: add meter color mark flow action Alexander Kozyrev
2022-09-26 14:57           ` [PATCH v5 0/7] ethdev: separate metering and marking from policing Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 1/7] ethdev: add meter color flow matching item Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 2/7] ethdev: allow meter color marker modification Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 3/7] ethdev: get meter profile/policy objects Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 4/7] ethdev: add meter color mark flow action Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 5/7] app/testpmd: add meter color flow matching item Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 6/7] app/testpmd: allow meter color marker modification Alexander Kozyrev
2022-09-26 14:57             ` [PATCH v5 7/7] app/testpmd: add meter color mark flow action Alexander Kozyrev
2022-09-27 11:56             ` [PATCH v5 0/7] ethdev: separate metering and marking from policing Dumitrescu, Cristian
2022-09-28  6:45               ` Ori Kam
2022-09-28 16:38                 ` Ajit Khaparde
2022-09-29  7:51                   ` Andrew Rybchenko

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=20220518043459.1281590-4-akozyrev@nvidia.com \
    --to=akozyrev@nvidia.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@xilinx.com \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=orika@nvidia.com \
    --cc=qi.z.zhang@intel.com \
    --cc=thomas@monjalon.net \
    /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).