[v2,9/9] net/mlx5: allow age modes combination
Checks
Commit Message
ASO age action mode is not supported in group 0 while counter base age
action mode supports group 0.
Allow using the 2 modes of age action in parallel, so group 0 flows will
use counter base age actions and group > 0 flows will use ASO age
actions.
Currently, counter base age action doesn't support shared action API so
group 0 flows cannot share age actions.
Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Dekel Peled <dekelp@nvidia.com>
---
drivers/net/mlx5/mlx5.c | 1 +
drivers/net/mlx5/mlx5.h | 6 ++----
drivers/net/mlx5/mlx5_flow_dv.c | 43 ++++++++++++++++++++++-------------------
3 files changed, 26 insertions(+), 24 deletions(-)
@@ -438,6 +438,7 @@ static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =
age_info = &sh->port[i].age_info;
age_info->flags = 0;
TAILQ_INIT(&age_info->aged_counters);
+ LIST_INIT(&age_info->aged_aso);
rte_spinlock_init(&age_info->aged_sl);
MLX5_AGE_SET(age_info, MLX5_AGE_TRIGGER);
}
@@ -565,10 +565,8 @@ struct mlx5_aso_age_mng {
/* Aging information for per port. */
struct mlx5_age_info {
uint8_t flags; /* Indicate if is new event or need to be triggered. */
- union {
- struct mlx5_counters aged_counters; /* Aged counter list. */
- struct aso_age_list aged_aso; /* Aged ASO actions list. */
- };
+ struct mlx5_counters aged_counters; /* Aged counter list. */
+ struct aso_age_list aged_aso; /* Aged ASO actions list. */
rte_spinlock_t aged_sl; /* Aged flow list lock. */
};
@@ -5927,6 +5927,11 @@ struct mlx5_hlist_entry *
rw_act_num += MLX5_ACT_NUM_SET_TAG;
break;
case MLX5_RTE_FLOW_ACTION_TYPE_AGE:
+ if (!attr->group)
+ return rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ "Shared ASO age action is not supported for group 0");
action_flags |= MLX5_FLOW_ACTION_AGE;
++actions_n;
break;
@@ -9783,7 +9788,7 @@ struct mlx5_cache_entry *
action_flags |= MLX5_FLOW_ACTION_AGE;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
- if (priv->sh->flow_hit_aso_en) {
+ if (priv->sh->flow_hit_aso_en && attr->group) {
flow->age = flow_dv_translate_create_aso_age
(dev, action->conf);
if (!flow->age)
@@ -9791,7 +9796,7 @@ struct mlx5_cache_entry *
(error, rte_errno,
RTE_FLOW_ERROR_TYPE_ACTION,
NULL,
- "can't create age action");
+ "can't create ASO age action");
dev_flow->dv.actions[actions_n++] =
(flow_aso_age_get_by_idx
(dev, flow->age))->dr_action;
@@ -12406,26 +12411,24 @@ struct mlx5_cache_entry *
NULL, "empty context");
age_info = GET_PORT_AGE_INFO(priv);
rte_spinlock_lock(&age_info->aged_sl);
- if (priv->sh->flow_hit_aso_en)
- LIST_FOREACH(act, &age_info->aged_aso, next) {
- nb_flows++;
- if (nb_contexts) {
- context[nb_flows - 1] =
- act->age_params.context;
- if (!(--nb_contexts))
- break;
- }
+ LIST_FOREACH(act, &age_info->aged_aso, next) {
+ nb_flows++;
+ if (nb_contexts) {
+ context[nb_flows - 1] =
+ act->age_params.context;
+ if (!(--nb_contexts))
+ break;
}
- else
- TAILQ_FOREACH(counter, &age_info->aged_counters, next) {
- nb_flows++;
- if (nb_contexts) {
- age_param = MLX5_CNT_TO_AGE(counter);
- context[nb_flows - 1] = age_param->context;
- if (!(--nb_contexts))
- break;
- }
+ }
+ TAILQ_FOREACH(counter, &age_info->aged_counters, next) {
+ nb_flows++;
+ if (nb_contexts) {
+ age_param = MLX5_CNT_TO_AGE(counter);
+ context[nb_flows - 1] = age_param->context;
+ if (!(--nb_contexts))
+ break;
}
+ }
rte_spinlock_unlock(&age_info->aged_sl);
MLX5_AGE_SET(age_info, MLX5_AGE_TRIGGER);
return nb_flows;