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 D2903A09E9; Tue, 15 Dec 2020 08:50:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4815AC9F6; Tue, 15 Dec 2020 08:50:00 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0A5DBC9F0 for ; Tue, 15 Dec 2020 08:49:58 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 15 Dec 2020 09:49:52 +0200 Received: from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BF7nqhQ023341; Tue, 15 Dec 2020 09:49:52 +0200 From: Jiawei Wang To: viacheslavo@nvidia.com, matan@nvidia.com, orika@nvidia.com Cc: dev@dpdk.org, rasland@nvidia.com Date: Tue, 15 Dec 2020 09:49:50 +0200 Message-Id: <1608018591-97942-4-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1608018591-97942-1-git-send-email-jiaweiw@nvidia.com> References: <1608018591-97942-1-git-send-email-jiaweiw@nvidia.com> Subject: [dpdk-dev] [RFC 3/4] net/mlx5: extend the skip scale flag 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" The sampling feature introduces the scale flow group with factor, then the scaled table value can be used for the normal path table due to this table be created implicitly. But if the input group value already be scaled, for example the group value of sampling suffix flow, then use 'skip_scale" flag to skip the scale twice in the translation action. Consider the flow with jump action and this jump action could be created implicitly, PMD may only scale the original flow group value or scale the jump group value or both, so extend the 'skip_scale' flag to two bits: If bit0 of 'skip_scale' flag is set to 1, then skip the scale the original flow group; If bit1 of 'skip_scale' flag is set to 1, then skip the scale the jump flow group. Signed-off-by: Jiawei Wang --- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow.h | 21 ++++++++++++++++++--- drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 3bf4484..6095e03 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5108,7 +5108,7 @@ struct mlx5_hlist_entry * /* Suffix group level already be scaled with factor, set * skip_scale to 1 to avoid scale again in translation. */ - flow_split_info->skip_scale = 1; + flow_split_info->skip_scale = 1 << MLX5_SCALE_FLOW_GROUP_BIT; #endif } /* Add the suffix subflow. */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 0172ee5..96becd7 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -759,6 +759,9 @@ struct mlx5_flow_verbs_workspace { /**< Specifications & actions buffer of verbs flow. */ }; +#define MLX5_SCALE_FLOW_GROUP_BIT 0 +#define MLX5_SCALE_JUMP_FLOW_GROUP_BIT 1 + /** Maximal number of device sub-flows supported. */ #define MLX5_NUM_MAX_DEV_FLOWS 32 @@ -772,8 +775,20 @@ struct mlx5_flow { /**< Bit-fields of detected actions, see MLX5_FLOW_ACTION_*. */ bool external; /**< true if the flow is created external to PMD. */ uint8_t ingress:1; /**< 1 if the flow is ingress. */ - uint8_t skip_scale:1; - /**< 1 if skip the scale the table with factor. */ + uint8_t skip_scale:2; + /** + * Each Bit be set to 1 if Skip the scale the flow group with factor. + * If bit0 be set to 1, then skip the scale the original flow group; + * If bit1 be set to 1, then skip the scale the jump flow group if + * having jump action. + * 00: Enable scale in a flow, default value. + * 01: Skip scale the flow group with factor, enable scale the group + * of jump action. + * 10: Enable scale the group with factor, skip scale the group of + * jump action. + * 11: Skip scale the table with factor both for flow group and jump + * group. + */ union { #ifdef HAVE_IBV_FLOW_DV_SUPPORT struct mlx5_flow_dv_workspace dv; @@ -1240,7 +1255,7 @@ struct flow_grp_info { uint64_t fdb_def_rule:1; /* force standard group translation */ uint64_t std_tbl_fix:1; - uint64_t skip_scale:1; + uint64_t skip_scale:2; }; static inline bool diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4a8154f..109369e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9708,7 +9708,8 @@ struct mlx5_cache_entry * .external = !!dev_flow->external, .transfer = !!attr->transfer, .fdb_def_rule = !!priv->fdb_def_rule, - .skip_scale = !!dev_flow->skip_scale, + .skip_scale = dev_flow->skip_scale & + (1 << MLX5_SCALE_FLOW_GROUP_BIT), }; if (!wks) @@ -10066,7 +10067,11 @@ struct mlx5_cache_entry * jump_group = ((const struct rte_flow_action_jump *) action->conf)->group; grp_info.std_tbl_fix = 0; - grp_info.skip_scale = 0; + if (dev_flow->skip_scale & + (1 << MLX5_SCALE_JUMP_FLOW_GROUP_BIT)) + grp_info.skip_scale = 1; + else + grp_info.skip_scale = 0; ret = mlx5_flow_group_to_table(dev, tunnel, jump_group, &table, -- 1.8.3.1