Skip to content

Commit

Permalink
net/mlx5: fix flow age event triggering
Browse files Browse the repository at this point in the history
[ upstream commit 447d4d7 ]

A FLOW_AGE event should be invoked when a new aged-out flow is detected
by the PMD after the last user get-aged query calling.
The PMD manages 2 flags for this information and check them in order to
decide if an event should be invoked:
MLX5_AGE_EVENT_NEW - a new aged-out flow was detected. after the last
check.
MLX5_AGE_TRIGGER - get-aged query was called after the last aged-out
flow.
The 2 flags were unset after the event invoking.

When the user calls get-aged query from the event callback, the TRIGGER
flag was set inside the user callback and unset directly after the
callback what may stop the event invoking forever.

Unset the TRIGGER flag before the event invoking in order to allow set
it by the user callback.

Fixes: f935ed4 ("net/mlx5: support flow hit action for aging")

Reported-by: David Bouyeure <david.bouyeure@fraudbuster.mobi>
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
michaelbaum1 authored and steevenlee committed Jun 8, 2021
1 parent 053299c commit cb6f747
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/mlx5/mlx5.c
Expand Up @@ -549,11 +549,13 @@ mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh)
age_info = &sh->port[i].age_info;
if (!MLX5_AGE_GET(age_info, MLX5_AGE_EVENT_NEW))
continue;
if (MLX5_AGE_GET(age_info, MLX5_AGE_TRIGGER))
MLX5_AGE_UNSET(age_info, MLX5_AGE_EVENT_NEW);
if (MLX5_AGE_GET(age_info, MLX5_AGE_TRIGGER)) {
MLX5_AGE_UNSET(age_info, MLX5_AGE_TRIGGER);
rte_eth_dev_callback_process
(&rte_eth_devices[sh->port[i].devx_ih_port_id],
RTE_ETH_EVENT_FLOW_AGED, NULL);
age_info->flags = 0;
}
}
}

Expand All @@ -562,7 +564,7 @@ mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh)
*
* @param[in] sh
* Pointer to mlx5_dev_ctx_shared object.
* @param[in] sh
* @param[in] config
* Pointer to user dev config.
*/
static void
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/mlx5/mlx5.h
Expand Up @@ -538,6 +538,8 @@ struct mlx5_aso_age_mng {
#define MLX5_AGE_TRIGGER 2
#define MLX5_AGE_SET(age_info, BIT) \
((age_info)->flags |= (1 << (BIT)))
#define MLX5_AGE_UNSET(age_info, BIT) \
((age_info)->flags &= ~(1 << (BIT)))
#define MLX5_AGE_GET(age_info, BIT) \
((age_info)->flags & (1 << (BIT)))
#define GET_PORT_AGE_INFO(priv) \
Expand Down

0 comments on commit cb6f747

Please sign in to comment.