From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5A2D4296B; Mon, 17 Apr 2023 11:26:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67AEB42B8C; Mon, 17 Apr 2023 11:26:16 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2053.outbound.protection.outlook.com [40.107.100.53]) by mails.dpdk.org (Postfix) with ESMTP id 20F3242B8C for ; Mon, 17 Apr 2023 11:26:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/Yz2WqpnPkaDTwXVp8/UvK+SGSOIUAMFNFWqfFQTbGh5i173Qv8l9ie+1nMLr53zy8yPp9wlM/FHcVauPQe/xgVWXGtZ3sI5vBsLFqw16vRxgI24UhnzpPW8Y3rBt0vKS20uCHhysC+6fFkU9pbSQ/U4BsGqMU5C+HG70TpAHMJOrTlmIj2CSvBy1mwvCxuLumfrrqQ7usY8j9oAtXZebeoCGlR9gAnElOVB+38kF2lnyHeBmiAMdq8mN8n/n/ck4K9aY19YtE7XOWoKe16CdjOs6k2WBDaYnTPIx+PmKm/k4wCx99XFAvvjUOXu6NeIeMB6KV7a0vylQQke2Gjeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZymQgiJiP5sLAUcBnvxVm6dv5sgmNnxsdXT+79X9EG4=; b=RJCbjqr5yJzhDfpVLWt4X+niuoMvRvHXl4VGKP2rYbu4IJILh/vQFxSyIvTaZpOmL+vKtzNbWir1NWsqPpKxMsR3n0rYQjp2L8qA797NYd0OndsKqg/nf20nDcHx0ZsBwgU7OmbXT9XMDIyhGfk3bCJsrGibun/NUsHS+Xz0i+gcxlUxG/e8uByUHtW1fL702HnVNiWTTgM+EEx2JKeCkEAVv8jLD7IqSwgotIztr5FpaWyJUmn8s2QT7WzO3Fjd5RY3nQGzk4dIh4EGoLEYxwcKzMvNUJLPudaEV6FTA9txwO9WFttNUyzBSAQ2vKlBZcddYbaFsIPpIUOSaIwbOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZymQgiJiP5sLAUcBnvxVm6dv5sgmNnxsdXT+79X9EG4=; b=ufNT+cWq6SH2uPbdMfbHb3xfsAmJSYB8uZ0ZkCeHwcfNblXA32Ktl9Gk6spn8ClCu8M62awKkHd3jzFrmfnFWLXMpTUYPUyRwc/sUk8q1ai/1xoh8+OGwMxqc0LXu5EaGt22hJLQHDL8W0DOIzWDvqKEK1Pfy5K3DexikgVe2EMansRnhUQ79t0R1RjcQIlaRkCpSUdVPVFpHPH5YQPn+T6AwzfRyJStyCw5hqTYIIZ9Snoti5tfY64yvAJwPJCtekqTASkUxAiglSP0mqHXZqbO9oX8kZ7t1L2lMb/YTER7UBDH/R4lbf3V8KVyk2aZkhu/zYfQacsPdVQfRz9xzg== Received: from MW4P220CA0008.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::13) by SA1PR12MB7149.namprd12.prod.outlook.com (2603:10b6:806:29c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.33; Mon, 17 Apr 2023 09:26:13 +0000 Received: from CO1NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::a0) by MW4P220CA0008.outlook.office365.com (2603:10b6:303:115::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 09:26:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT003.mail.protection.outlook.com (10.13.175.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 09:26:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 17 Apr 2023 02:26:02 -0700 Received: from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 17 Apr 2023 02:26:00 -0700 From: Rongwei Liu To: , , , , Subject: [PATCH v1 3/8] net/mlx5/hws: add no reparse support Date: Mon, 17 Apr 2023 12:25:35 +0300 Message-ID: <20230417092540.2617450-4-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230417092540.2617450-1-rongweil@nvidia.com> References: <20230417092540.2617450-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT003:EE_|SA1PR12MB7149:EE_ X-MS-Office365-Filtering-Correlation-Id: 94e08f1b-6234-49b4-7c39-08db3f25c98f X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wEOyMHliNo2NfZb22zNQO14t3f5OGxlF6l2UtGqfU/B45cfgTf8TKsRRPQ1BF44sX1Elxxp/ZJ+Y6TCYWQS1AIfkLmmVEn0/rTLkLB9YCzakOoSZ/h2WyW4hf3jePSbyVNm2Y4/IE4p1phpZ+yIAeqYvjS8JwlD/TfiXz2IDylncgfTXMBPyEhADyaWpgcBdL6JlUC7559RVGH3xEvvyPMLfiDR7V3J6vuSpnCcVxtxfRyt+EJgkfC2u/VE157Hg5WZmvYi2b2hv7wTmIBLbwlkDzmdnhhQ9ZX3FcpiR6CUT8nzGad6AE99Tz3NTOe/9uW5zN8J9BJXAUSI1TOCO4bbHf/q6s0/JGVey81xaznqrWST5AKX8NdQFW9hZvUXovcPx1t+B8nJau9r1dhY/uW43EjyZnDC12A4qpeFLA3BS6TsfyCnyiuYuE1wlgm1j9DoDLqmgAsyqh3H7u0pNwOUOSOw9ZBWnLx1l8faeAjFQGPxs7hxf2ee1wAIEfzvhBiQNshh3Ttxfo7mdcLisW5OQXHaWzHeMAJTN7rvHp1FPa84Pj3cn+8rcYrauoABt6OSGZUulRxwhD1eSQKODHo8Vxs5y5N/7ygJOn3b03gVDJPoJfieCfKTILNx+EE+MLfSwFd0v9OgKiep7CSGj2trFoV0BU9Nh+ACwWoMXwBbmJ0qZyaUcOCA+qLZIePTzQBauClOAtajAZrn4Vkw7SynGndNuSDzn53oqoP8DphrUxBg5bOOYGlBY8f5s67E9q0uO+URzAgn4NXZg+ii27g== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(36840700001)(40470700004)(46966006)(110136005)(36756003)(82740400003)(36860700001)(7636003)(356005)(34020700004)(86362001)(82310400005)(40460700003)(8936002)(6666004)(316002)(40480700001)(30864003)(478600001)(5660300002)(426003)(336012)(1076003)(7696005)(6286002)(16526019)(186003)(26005)(2906002)(8676002)(41300700001)(83380400001)(2616005)(55016003)(70206006)(47076005)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 09:26:12.9302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94e08f1b-6234-49b4-7c39-08db3f25c98f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7149 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Allocate two groups of RTC to control hardware reparsing when flow is updated. 1. Group 1 always reparse the traffic after packet is modified by any hardware module. This is the default behavior which is the same as before. 2. Group 2 doesn't perform any packets reparsing. This will help the complex flow rules. Signed-off-by: Rongwei Liu --- drivers/net/mlx5/hws/mlx5dr_cmd.c | 5 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 1 + drivers/net/mlx5/hws/mlx5dr_debug.c | 8 +-- drivers/net/mlx5/hws/mlx5dr_matcher.c | 80 +++++++++++++++++---------- drivers/net/mlx5/hws/mlx5dr_matcher.h | 12 ++-- drivers/net/mlx5/hws/mlx5dr_rule.c | 65 ++++++++++++++++------ 6 files changed, 117 insertions(+), 54 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index 0adcedd9c9..42bf1980db 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -283,7 +283,10 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx, MLX5_SET(rtc, attr, ste_table_base_id, rtc_attr->ste_base); MLX5_SET(rtc, attr, ste_table_offset, rtc_attr->ste_offset); MLX5_SET(rtc, attr, miss_flow_table_id, rtc_attr->miss_ft_id); - MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_ALWAYS); + if (rtc_attr->is_reparse) + MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_ALWAYS); + else + MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_NEVER); devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out)); if (!devx_obj->obj) { diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index 3f40c085be..b225171d4c 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -51,6 +51,7 @@ struct mlx5dr_cmd_rtc_create_attr { uint8_t match_definer_1; bool is_frst_jumbo; bool is_scnd_range; + uint8_t is_reparse; }; struct mlx5dr_cmd_alias_obj_create_attr { diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c index 6b32ac4ee6..b8049a173d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.c +++ b/drivers/net/mlx5/hws/mlx5dr_debug.c @@ -224,9 +224,9 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) } ret = fprintf(f, ",%d,%d,%d,%d", - matcher->match_ste.rtc_0 ? matcher->match_ste.rtc_0->id : 0, + matcher->match_ste.rtc_0_reparse ? matcher->match_ste.rtc_0_reparse->id : 0, ste_0 ? (int)ste_0->id : -1, - matcher->match_ste.rtc_1 ? matcher->match_ste.rtc_1->id : 0, + matcher->match_ste.rtc_1_reparse ? matcher->match_ste.rtc_1_reparse->id : 0, ste_1 ? (int)ste_1->id : -1); if (ret < 0) goto out_err; @@ -243,9 +243,9 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) } ret = fprintf(f, ",%d,%d,%d,%d,%d\n", - matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id : 0, + matcher->action_ste.rtc_0_reparse ? matcher->action_ste.rtc_0_reparse->id : 0, ste_0 ? (int)ste_0->id : -1, - matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id : 0, + matcher->action_ste.rtc_1_reparse ? matcher->action_ste.rtc_1_reparse->id : 0, ste_1 ? (int)ste_1->id : -1, is_shared && !is_root ? matcher->match_ste.aliased_rtc_0->id : 0); diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 1fe7ec1bc3..652d50f73a 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -101,7 +101,7 @@ static int mlx5dr_matcher_shared_create_alias_rtc(struct mlx5dr_matcher *matcher ctx->ibv_ctx, ctx->local_ibv_ctx, ctx->caps->shared_vhca_id, - matcher->match_ste.rtc_0->id, + matcher->match_ste.rtc_0_reparse->id, MLX5_GENERAL_OBJ_TYPE_RTC, &matcher->match_ste.aliased_rtc_0); if (ret) { @@ -156,7 +156,7 @@ static uint32_t mlx5dr_matcher_connect_get_rtc0(struct mlx5dr_matcher *matcher) { if (!matcher->match_ste.aliased_rtc_0) - return matcher->match_ste.rtc_0->id; + return matcher->match_ste.rtc_0_reparse->id; else return matcher->match_ste.aliased_rtc_0->id; } @@ -233,10 +233,10 @@ static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher) /* Connect to next */ if (next) { - if (next->match_ste.rtc_0) - ft_attr.rtc_id_0 = next->match_ste.rtc_0->id; - if (next->match_ste.rtc_1) - ft_attr.rtc_id_1 = next->match_ste.rtc_1->id; + if (next->match_ste.rtc_0_reparse) + ft_attr.rtc_id_0 = next->match_ste.rtc_0_reparse->id; + if (next->match_ste.rtc_1_reparse) + ft_attr.rtc_id_1 = next->match_ste.rtc_1_reparse->id; ret = mlx5dr_cmd_flow_table_modify(matcher->end_ft, &ft_attr); if (ret) { @@ -248,10 +248,10 @@ static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher) /* Connect to previous */ ft = prev ? prev->end_ft : tbl->ft; - if (matcher->match_ste.rtc_0) - ft_attr.rtc_id_0 = matcher->match_ste.rtc_0->id; - if (matcher->match_ste.rtc_1) - ft_attr.rtc_id_1 = matcher->match_ste.rtc_1->id; + if (matcher->match_ste.rtc_0_reparse) + ft_attr.rtc_id_0 = matcher->match_ste.rtc_0_reparse->id; + if (matcher->match_ste.rtc_1_reparse) + ft_attr.rtc_id_1 = matcher->match_ste.rtc_1_reparse->id; ret = mlx5dr_cmd_flow_table_modify(ft, &ft_attr); if (ret) { @@ -296,10 +296,10 @@ static int mlx5dr_matcher_disconnect(struct mlx5dr_matcher *matcher) if (next) { /* Connect previous end FT to next RTC if exists */ - if (next->match_ste.rtc_0) - ft_attr.rtc_id_0 = next->match_ste.rtc_0->id; - if (next->match_ste.rtc_1) - ft_attr.rtc_id_1 = next->match_ste.rtc_1->id; + if (next->match_ste.rtc_0_reparse) + ft_attr.rtc_id_0 = next->match_ste.rtc_0_reparse->id; + if (next->match_ste.rtc_1_reparse) + ft_attr.rtc_id_1 = next->match_ste.rtc_1_reparse->id; } else { /* Matcher is last, point prev end FT to default miss */ mlx5dr_cmd_set_attr_connect_miss_tbl(tbl->ctx, @@ -470,10 +470,11 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, struct mlx5dr_pool_chunk *ste; int ret; + rtc_attr.is_reparse = true; switch (rtc_type) { case DR_MATCHER_RTC_TYPE_MATCH: - rtc_0 = &matcher->match_ste.rtc_0; - rtc_1 = &matcher->match_ste.rtc_1; + rtc_0 = &matcher->match_ste.rtc_0_reparse; + rtc_1 = &matcher->match_ste.rtc_1_reparse; ste_pool = matcher->match_ste.pool; ste = &matcher->match_ste.ste; ste->order = attr->table.sz_col_log + attr->table.sz_row_log; @@ -537,8 +538,8 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, break; case DR_MATCHER_RTC_TYPE_STE_ARRAY: - rtc_0 = &matcher->action_ste.rtc_0; - rtc_1 = &matcher->action_ste.rtc_1; + rtc_0 = &matcher->action_ste.rtc_0_reparse; + rtc_1 = &matcher->action_ste.rtc_1_reparse; ste_pool = matcher->action_ste.pool; ste = &matcher->action_ste.ste; ste->order = rte_log2_u32(matcher->action_ste.max_stes) + @@ -558,6 +559,7 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, return rte_errno; } +rertc: devx_obj = mlx5dr_pool_chunk_get_base_devx_obj(ste_pool, ste); rtc_attr.pd = ctx->pd_num; @@ -574,8 +576,8 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, *rtc_0 = mlx5dr_cmd_rtc_create(ctx->ibv_ctx, &rtc_attr); if (!*rtc_0) { - DR_LOG(ERR, "Failed to create matcher RTC of type %s", - mlx5dr_matcher_rtc_type_to_str(rtc_type)); + DR_LOG(ERR, "Failed to create matcher RTC of type %s, reparse %u", + mlx5dr_matcher_rtc_type_to_str(rtc_type), rtc_attr.is_reparse); goto free_ste; } @@ -590,12 +592,25 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, *rtc_1 = mlx5dr_cmd_rtc_create(ctx->ibv_ctx, &rtc_attr); if (!*rtc_1) { - DR_LOG(ERR, "Failed to create peer matcher RTC of type %s", - mlx5dr_matcher_rtc_type_to_str(rtc_type)); + DR_LOG(ERR, "Failed to create peer matcher RTC of type %s, reparse %u", + mlx5dr_matcher_rtc_type_to_str(rtc_type), rtc_attr.is_reparse); goto destroy_rtc_0; } } + /* RTC is created in reparse then no_reparse order and fw wqe. */ + if (rtc_attr.is_reparse && !mlx5dr_matcher_req_fw_wqe(matcher)) { + rtc_attr.is_reparse = false; + if (rtc_type == DR_MATCHER_RTC_TYPE_MATCH) { + rtc_0 = &matcher->match_ste.rtc_0_no_reparse; + rtc_1 = &matcher->match_ste.rtc_1_no_reparse; + } else { + rtc_0 = &matcher->action_ste.rtc_0_no_reparse; + rtc_1 = &matcher->action_ste.rtc_1_no_reparse; + } + goto rertc; + } + return 0; destroy_rtc_0: @@ -609,21 +624,25 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, static void mlx5dr_matcher_destroy_rtc(struct mlx5dr_matcher *matcher, enum mlx5dr_matcher_rtc_type rtc_type) { + struct mlx5dr_devx_obj *rtc_0, *rtc_1, *rtc_2, *rtc_3; struct mlx5dr_table *tbl = matcher->tbl; - struct mlx5dr_devx_obj *rtc_0, *rtc_1; struct mlx5dr_pool_chunk *ste; struct mlx5dr_pool *ste_pool; switch (rtc_type) { case DR_MATCHER_RTC_TYPE_MATCH: - rtc_0 = matcher->match_ste.rtc_0; - rtc_1 = matcher->match_ste.rtc_1; + rtc_0 = matcher->match_ste.rtc_0_reparse; + rtc_1 = matcher->match_ste.rtc_1_reparse; + rtc_2 = matcher->match_ste.rtc_0_no_reparse; + rtc_3 = matcher->match_ste.rtc_1_no_reparse; ste_pool = matcher->match_ste.pool; ste = &matcher->match_ste.ste; break; case DR_MATCHER_RTC_TYPE_STE_ARRAY: - rtc_0 = matcher->action_ste.rtc_0; - rtc_1 = matcher->action_ste.rtc_1; + rtc_0 = matcher->action_ste.rtc_0_reparse; + rtc_1 = matcher->action_ste.rtc_1_reparse; + rtc_2 = matcher->action_ste.rtc_0_no_reparse; + rtc_3 = matcher->action_ste.rtc_1_no_reparse; ste_pool = matcher->action_ste.pool; ste = &matcher->action_ste.ste; break; @@ -631,10 +650,15 @@ static void mlx5dr_matcher_destroy_rtc(struct mlx5dr_matcher *matcher, return; } - if (tbl->type == MLX5DR_TABLE_TYPE_FDB) + if (tbl->type == MLX5DR_TABLE_TYPE_FDB) { mlx5dr_cmd_destroy_obj(rtc_1); + if (rtc_3) + mlx5dr_cmd_destroy_obj(rtc_3); + } mlx5dr_cmd_destroy_obj(rtc_0); + if (rtc_2) + mlx5dr_cmd_destroy_obj(rtc_2); if (rtc_type == DR_MATCHER_RTC_TYPE_MATCH) mlx5dr_pool_chunk_free(ste_pool, ste); } diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.h b/drivers/net/mlx5/hws/mlx5dr_matcher.h index 4759068ab4..02fd283cd1 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.h +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.h @@ -43,8 +43,10 @@ struct mlx5dr_match_template { struct mlx5dr_matcher_match_ste { struct mlx5dr_pool_chunk ste; - struct mlx5dr_devx_obj *rtc_0; - struct mlx5dr_devx_obj *rtc_1; + struct mlx5dr_devx_obj *rtc_0_reparse; + struct mlx5dr_devx_obj *rtc_1_reparse; + struct mlx5dr_devx_obj *rtc_0_no_reparse; + struct mlx5dr_devx_obj *rtc_1_no_reparse; struct mlx5dr_pool *pool; /* Currently not support FDB aliased */ struct mlx5dr_devx_obj *aliased_rtc_0; @@ -53,8 +55,10 @@ struct mlx5dr_matcher_match_ste { struct mlx5dr_matcher_action_ste { struct mlx5dr_pool_chunk ste; struct mlx5dr_pool_chunk stc; - struct mlx5dr_devx_obj *rtc_0; - struct mlx5dr_devx_obj *rtc_1; + struct mlx5dr_devx_obj *rtc_0_reparse; + struct mlx5dr_devx_obj *rtc_1_reparse; + struct mlx5dr_devx_obj *rtc_0_no_reparse; + struct mlx5dr_devx_obj *rtc_1_no_reparse; struct mlx5dr_pool *pool; uint8_t max_stes; }; diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index 2418ca0b26..70c6c08741 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -40,11 +40,35 @@ static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher, } } +static void mlxdr_rule_set_wqe_rtc_id(struct mlx5dr_send_ring_dep_wqe *wqe, + struct mlx5dr_matcher *matcher, + bool reparse, bool mirror) +{ + if (!mirror && !reparse) { + wqe->rtc_0 = matcher->match_ste.rtc_0_no_reparse->id; + wqe->retry_rtc_0 = matcher->col_matcher ? + matcher->col_matcher->match_ste.rtc_0_no_reparse->id : 0; + } else if (!mirror && reparse) { + wqe->rtc_0 = matcher->match_ste.rtc_0_reparse->id; + wqe->retry_rtc_0 = matcher->col_matcher ? + matcher->col_matcher->match_ste.rtc_0_reparse->id : 0; + } else if (mirror && reparse) { + wqe->rtc_1 = matcher->match_ste.rtc_1_reparse->id; + wqe->retry_rtc_1 = matcher->col_matcher ? + matcher->col_matcher->match_ste.rtc_1_reparse->id : 0; + } else if (mirror && !reparse) { + wqe->rtc_1 = matcher->match_ste.rtc_1_no_reparse->id; + wqe->retry_rtc_1 = matcher->col_matcher ? + matcher->col_matcher->match_ste.rtc_1_no_reparse->id : 0; + } +} + static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe, struct mlx5dr_rule *rule, const struct rte_flow_item *items, struct mlx5dr_match_template *mt, - void *user_data) + void *user_data, + bool reparse) { struct mlx5dr_matcher *matcher = rule->matcher; struct mlx5dr_table *tbl = matcher->tbl; @@ -56,9 +80,7 @@ static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe, switch (tbl->type) { case MLX5DR_TABLE_TYPE_NIC_RX: case MLX5DR_TABLE_TYPE_NIC_TX: - dep_wqe->rtc_0 = matcher->match_ste.rtc_0->id; - dep_wqe->retry_rtc_0 = matcher->col_matcher ? - matcher->col_matcher->match_ste.rtc_0->id : 0; + mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, false); dep_wqe->rtc_1 = 0; dep_wqe->retry_rtc_1 = 0; break; @@ -67,18 +89,14 @@ static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe, mlx5dr_rule_skip(matcher, mt, items, &skip_rx, &skip_tx); if (!skip_rx) { - dep_wqe->rtc_0 = matcher->match_ste.rtc_0->id; - dep_wqe->retry_rtc_0 = matcher->col_matcher ? - matcher->col_matcher->match_ste.rtc_0->id : 0; + mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, false); } else { dep_wqe->rtc_0 = 0; dep_wqe->retry_rtc_0 = 0; } if (!skip_tx) { - dep_wqe->rtc_1 = matcher->match_ste.rtc_1->id; - dep_wqe->retry_rtc_1 = matcher->col_matcher ? - matcher->col_matcher->match_ste.rtc_1->id : 0; + mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, true); } else { dep_wqe->rtc_1 = 0; dep_wqe->retry_rtc_1 = 0; @@ -265,8 +283,9 @@ static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule, } mlx5dr_rule_create_init(rule, &ste_attr, &apply); - mlx5dr_rule_init_dep_wqe(&match_wqe, rule, items, mt, attr->user_data); - mlx5dr_rule_init_dep_wqe(&range_wqe, rule, items, mt, attr->user_data); + /* FW WQE doesn't look on rtc reparse, use default REPARSE_ALWAYS. */ + mlx5dr_rule_init_dep_wqe(&match_wqe, rule, items, mt, attr->user_data, true); + mlx5dr_rule_init_dep_wqe(&range_wqe, rule, items, mt, attr->user_data, true); ste_attr.direct_index = 0; ste_attr.rtc_0 = match_wqe.rtc_0; @@ -348,6 +367,7 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule, struct mlx5dr_actions_apply_data apply; struct mlx5dr_send_engine *queue; uint8_t total_stes, action_stes; + bool matcher_reparse; int i, ret; /* Insert rule using FW WQE if cannot use GTA WQE */ @@ -368,7 +388,9 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule, * dep_wqe buffers (ctrl, data) are also reused for all STE writes. */ dep_wqe = mlx5dr_send_add_new_dep_wqe(queue); - mlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, mt, attr->user_data); + /* Jumbo matcher reparse is off. */ + matcher_reparse = !is_jumbo && (at->setters[1].flags & ASF_REPARSE); + mlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, mt, attr->user_data, matcher_reparse); ste_attr.wqe_ctrl = &dep_wqe->wqe_ctrl; ste_attr.wqe_data = &dep_wqe->wqe_data; @@ -389,9 +411,6 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule, mlx5dr_send_abort_new_dep_wqe(queue); return ret; } - /* Skip RX/TX based on the dep_wqe init */ - ste_attr.rtc_0 = dep_wqe->rtc_0 ? matcher->action_ste.rtc_0->id : 0; - ste_attr.rtc_1 = dep_wqe->rtc_1 ? matcher->action_ste.rtc_1->id : 0; /* Action STEs are written to a specific index last to first */ ste_attr.direct_index = rule->action_ste_idx + action_stes; apply.next_direct_idx = ste_attr.direct_index; @@ -400,7 +419,7 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule, } for (i = total_stes; i-- > 0;) { - mlx5dr_action_apply_setter(&apply, setter--, !i && is_jumbo); + mlx5dr_action_apply_setter(&apply, setter, !i && is_jumbo); if (i == 0) { /* Handle last match STE. @@ -431,9 +450,21 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule, ste_attr.direct_index = mlx5dr_matcher_is_insert_by_idx(matcher) ? attr->rule_idx : 0; } else { + if (setter->flags & ASF_REPARSE) { + ste_attr.rtc_0 = dep_wqe->rtc_0 ? + matcher->action_ste.rtc_0_reparse->id : 0; + ste_attr.rtc_1 = dep_wqe->rtc_1 ? + matcher->action_ste.rtc_1_reparse->id : 0; + } else { + ste_attr.rtc_0 = dep_wqe->rtc_0 ? + matcher->action_ste.rtc_0_no_reparse->id : 0; + ste_attr.rtc_1 = dep_wqe->rtc_1 ? + matcher->action_ste.rtc_1_no_reparse->id : 0; + } apply.next_direct_idx = --ste_attr.direct_index; } + setter--; mlx5dr_send_ste(queue, &ste_attr); } -- 2.27.0