ethdev: add pre-defined meter policy API
authorLi Zhang <lizh@nvidia.com>
Tue, 20 Apr 2021 14:04:49 +0000 (17:04 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 21 Apr 2021 10:22:17 +0000 (12:22 +0200)
commit5f0d54f372f069275a998057cc5e5ef24b543251
tree00969a1a4b0ce931378985a79a055ff2eed2419d
parentfa1d598844a73765cf26676ce3d219589ba57114
ethdev: add pre-defined meter policy API

Currently, the flow meter policy does not support multiple actions
per color; also the allowed action types per color are very limited.
In addition, the policy cannot be pre-defined.

Due to the growing in flow actions offload abilities there is a potential
for the user to use variety of actions per color differently.
This new meter policy API comes to allow this potential in the most ethdev
common way using rte_flow action definition.
A list of rte_flow actions will be provided by the user per color
in order to create a meter policy.
In addition, the API forces to pre-define the policy before
the meters creation in order to allow sharing of single policy
with multiple meters efficiently.

meter_policy_id is added into struct rte_mtr_params.
So that it can get the policy during the meters creation.

Allow coloring the packet using a new rte_flow_action_color
as could be done by the old policy API.

Add two common policy template as macros in the head file.

The next API function were added:
- rte_mtr_meter_policy_add
- rte_mtr_meter_policy_delete
- rte_mtr_meter_policy_update
- rte_mtr_meter_policy_validate
The next struct was changed:
- rte_mtr_params
- rte_mtr_capabilities
The next API was deleted:
- rte_mtr_policer_actions_update

To support this API the following app were changed:
app/test-flow-perf: clean meter policer
app/testpmd: clean meter policer

To support this API the following drivers were changed:
net/softnic: support meter policy API
1. Cleans meter rte_mtr_policer_action.
2. Supports policy API to get color action as policer action did.
   The color action will be mapped into rte_table_action_policer.

net/mlx5: clean meter creation management
Cleans and breaks part of the current meter management
in order to allow better design with policy API.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
22 files changed:
app/test-flow-perf/main.c
app/test-pmd/cmdline.c
app/test-pmd/cmdline_mtr.c
app/test-pmd/cmdline_mtr.h
doc/guides/prog_guide/rte_flow.rst
doc/guides/prog_guide/traffic_metering_and_policing.rst
doc/guides/rel_notes/release_21_05.rst
doc/guides/testpmd_app_ug/testpmd_funcs.rst
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/mlx5_flow.c
drivers/net/mlx5/mlx5_flow.h
drivers/net/mlx5/mlx5_flow_aso.c
drivers/net/mlx5/mlx5_flow_dv.c
drivers/net/mlx5/mlx5_flow_meter.c
drivers/net/softnic/rte_eth_softnic_flow.c
drivers/net/softnic/rte_eth_softnic_internals.h
drivers/net/softnic/rte_eth_softnic_meter.c
lib/ethdev/rte_flow.h
lib/ethdev/rte_mtr.c
lib/ethdev/rte_mtr.h
lib/ethdev/rte_mtr_driver.h
lib/ethdev/version.map