Message ID | f4182a30b9358d572dffd724f46261db33fdce70.1610876143.git.dekelp@nvidia.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Raslan Darawsheh |
Headers | show |
Series | net/mlx5: fix flow split combined with counter | expand |
Context | Check | Description |
---|---|---|
ci/iol-testing | warning | Testing issues |
ci/iol-abi-testing | success | Testing PASS |
ci/iol-testing | warning | Testing issues |
ci/iol-abi-testing | success | Testing PASS |
ci/iol-mellanox-Performance | success | Performance Testing PASS |
ci/iol-mellanox-Performance | success | Performance Testing PASS |
ci/Intel-compilation | fail | Compilation issues |
ci/iol-mellanox-Functional | success | Functional Testing PASS |
ci/iol-mellanox-Functional | success | Functional Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-broadcom-Functional | success | Functional Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-broadcom-Functional | success | Functional Testing PASS |
ci/checkpatch | success | coding style OK |
From: Dekel Peled <dekelp@nvidia.com> > Currently, for a flow containing a count action, if flow is split to sub-flows, a > new counter will be created for each sub-flow. > However only the counter created for the last sub-flow will be queried on flow > query and cleared on flow removal. > > This behavior is wrong, causing a leak of resources. > Need to create just one counter per flow, and use it for all sub-flows. > > This patch adds the required check to make sure a counter is created just once > per flow, and used by all sub-flows. > > Fixes: fa2d01c87d2b ("net/mlx5: support flow aging") > Cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com>
Hi, > -----Original Message----- > From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled > Sent: Sunday, January 17, 2021 11:41 AM > To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler > <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com> > Cc: dev@dpdk.org; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/mlx5: fix flow split combined with counter > > Currently, for a flow containing a count action, if flow is split to > sub-flows, a new counter will be created for each sub-flow. > However only the counter created for the last sub-flow will be queried > on flow query and cleared on flow removal. > > This behavior is wrong, causing a leak of resources. > Need to create just one counter per flow, and use it for all sub-flows. > > This patch adds the required check to make sure a counter is > created just once per flow, and used by all sub-flows. > > Fixes: fa2d01c87d2b ("net/mlx5: support flow aging") > Cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@nvidia.com> > Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 11adc138f8..553f5e76bf 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10423,17 +10423,22 @@ flow_dv_translate(struct rte_eth_dev *dev, handle->dvh.modify_hdr->action; } if (action_flags & MLX5_FLOW_ACTION_COUNT) { - flow->counter = - flow_dv_translate_create_counter(dev, - dev_flow, count, age); - - if (!flow->counter) - return rte_flow_error_set + /* + * Create one count action, to be used + * by all sub-flows. + */ + if (!flow->counter) { + flow->counter = + flow_dv_translate_create_counter + (dev, dev_flow, count, + age); + if (!flow->counter) + return rte_flow_error_set (error, rte_errno, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, - "cannot create counter" - " object."); + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "cannot create counter" + " object."); + } dev_flow->dv.actions[actions_n] = (flow_dv_counter_get_by_idx(dev, flow->counter, NULL))->action;
Currently, for a flow containing a count action, if flow is split to sub-flows, a new counter will be created for each sub-flow. However only the counter created for the last sub-flow will be queried on flow query and cleared on flow removal. This behavior is wrong, causing a leak of resources. Need to create just one counter per flow, and use it for all sub-flows. This patch adds the required check to make sure a counter is created just once per flow, and used by all sub-flows. Fixes: fa2d01c87d2b ("net/mlx5: support flow aging") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@nvidia.com> --- drivers/net/mlx5/mlx5_flow_dv.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)