From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1060AA04E7; Sun, 1 Nov 2020 19:01:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D984C2E1E; Sun, 1 Nov 2020 18:59:27 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 61D562BE1 for ; Sun, 1 Nov 2020 18:59:26 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@nvidia.com) with SMTP; 1 Nov 2020 19:59:20 +0200 Received: from nvidia.com (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0A1Hvxo0009671; Sun, 1 Nov 2020 19:59:20 +0200 From: Matan Azrad To: Viacheslav Ovsiienko Cc: dev@dpdk.org Date: Sun, 1 Nov 2020 17:57:52 +0000 Message-Id: <1604253472-213766-10-git-send-email-matan@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604253472-213766-1-git-send-email-matan@nvidia.com> References: <1604008681-414157-1-git-send-email-matan@nvidia.com> <1604253472-213766-1-git-send-email-matan@nvidia.com> Subject: [dpdk-dev] [PATCH v2 9/9] net/mlx5: allow age modes combination X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 4521dff..29d0832 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -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); } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index a156e5c..3b2b681 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -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. */ }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d60626c..d7641e9 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -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; -- 1.8.3.1