From: Matan Azrad Date: Sun, 1 Nov 2020 17:57:52 +0000 (+0000) Subject: net/mlx5: allow age modes combination X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f9bc5274a6f9c0010c486e0cbd0f69df7c7e1305;p=dpdk.git net/mlx5: allow age modes combination 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 Acked-by: Dekel Peled --- diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 9e51916a90..43344391df 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -438,6 +438,7 @@ mlx5_flow_aging_init(struct mlx5_dev_ctx_shared *sh) 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); } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b7a9c45997..63d263384b 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -566,10 +566,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. */ }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d60626c91e..d7641e9b00 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5927,6 +5927,11 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, 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 @@ flow_dv_translate(struct rte_eth_dev *dev, 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 @@ flow_dv_translate(struct rte_eth_dev *dev, (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 @@ flow_get_aged_flows(struct rte_eth_dev *dev, 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;