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 82F3743275 for ; Fri, 3 Nov 2023 04:08:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FC7B40A6F; Fri, 3 Nov 2023 04:08:01 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 062C14021E; Fri, 3 Nov 2023 04:07:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lO0E5IExI+/B78t2wBTt2kgHdGyuZqdV2KMrRzn94gVna4HpIuDQQAGXlPgeWkTSfihbK8kEafCvwjCkmiFAtmumwo93qqUtvWNtoQiciyBdZhiAIp1Fm8hPUVPngAAzDMURDJdm1XKC8ydWd1wmCJgIUxnCzVCgTYB8cdqqqHj6Vku5r9s3FjvjlrSN89Gd36GikqO6IsWPv3nYE/DHAynJ4Jrxu5on1ueIXIjOQKobgDozJgnuBNZzVm95m8rOJYP/lITz1pcHvD6QarbjERlu2FRz1QWV6gmtCPij3tGCxrm1fCf39Fi08H2em+z9JyFOhM4MLJOFqNRISx/kXQ== 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=VSsrjNt+OSGHU/E8kC4hdaqX7Hoeju8MLAidaOrVpgY=; b=M0RBUpqr4Kwlrn6ZfioR4ZotjYpXPhDr68Jd5SjnE+DR6FwBz48y1OU6ZqUnAY4mb7Qwrj8w7VQ4+PIBEsMKUa72h7V/jW2XyF68ow9sTkYt7I0rTR3vKuUyOZx9ouaWzN2/KblA4RUBq9pXWj40lE3ggK9PdyAHIWayAiWeBt0GmPI563gY8E7sZSFC6Vva/zcifrYTDZy+eMbqLcm9lQQfdg/6l6Ku1vgt2Cl15wE3Sa8bpWjRkiV1ZhJvJN/aqS1gQJYHgmN5rLW3D3B06qp4MkxiCpEM9Y3Y+oZgKyGC4VvKE+vtzhlBCKLbVEakWL/rSk1KjcaXdgqFLMx9Kw== 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 (0) 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=VSsrjNt+OSGHU/E8kC4hdaqX7Hoeju8MLAidaOrVpgY=; b=SUZuEEaMiVgOWtmjcnuPyp4C0tP3WIZVHeHZQEyENvtDgZFqEE4G2dni9EtMqut0eRaP4Aj6nkKfmFhYoV9njkLjcWbPrW93WaLUKz0nRU8nLmifb59UunHwKPkEnqdDCRlR7Xg7c4yeKiFTFvtTphjaZI8KLjHkZs+JvdinqDI91yVRjShmQfNC7V7QxcAHcbVioHjW37HI7FDi0laeJd4KPGaPXv10Rzat2OTYodjJ1DS9lNxhT/lFgVlszWDiXq2cFNojKUqcY2MErmEeNVQaCs+uEF6H4YeNhAG+ccR/wJojAM1CkbcDQouYMmmNssT9WdC5U3ozrYfZ6d520A== Received: from DM6PR05CA0041.namprd05.prod.outlook.com (2603:10b6:5:335::10) by SA1PR12MB7368.namprd12.prod.outlook.com (2603:10b6:806:2b7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 03:07:57 +0000 Received: from DS2PEPF0000343B.namprd02.prod.outlook.com (2603:10b6:5:335:cafe::ba) by DM6PR05CA0041.outlook.office365.com (2603:10b6:5:335::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.10 via Frontend Transport; Fri, 3 Nov 2023 03:07:56 +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 DS2PEPF0000343B.mail.protection.outlook.com (10.167.18.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 03:07:56 +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.41; Thu, 2 Nov 2023 20:07:37 -0700 Received: from nvidia.com (10.126.230.35) 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.41; Thu, 2 Nov 2023 20:07:34 -0700 From: Rongwei Liu To: , , , , , CC: , , Raslan Darawsheh Subject: [21.11 PATCH v1] net/mlx5: fix matcher layout size calculation Date: Fri, 3 Nov 2023 05:07:21 +0200 Message-ID: <20231103030721.930738-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343B:EE_|SA1PR12MB7368:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cb65ec5-130a-42cb-5a82-08dbdc1a1422 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: 2Gg5PT+zwR7OVeu5wSeEq2vrtGc0jpC1MI1sgFhOpGDCuEeq5Urk8pL2pzWZZt2v4HfXZ5m+I1RAUUL/drq0UbBZ7K5Q/Z+rak95yEKMzKuJY05ZSWXZdQbLCdQe9ayn1vq4EsaUoBwUPbCe4mTnn1nOt5wSOHCY0hezgqvbpWo3mCJG9VZ23XSIXGbHfoshJjnmHvyKVddXSOFKxr1ezb12OCCvjY3x2QuFr5nbkHk07gJrO/ToZhC8wONb0gllBWof67ky4FHzX7AdNwB37RvZRggqpWlx9XDxXGV1mRvNIB1ecw3x7eBAF47f9sv/UKz+dapmBV5zrvMfOwRqYmZF6qhiIi3ekhEEgpA28IxlgXHNXIcnQlpPqsZPJziIUfDJP8pyF5Kh/lWitebkoPFg1E6aI5PI2VM1f2PtIEYpWNmbf5mR51CMC9Z33Nl9EVyISTNUJywwlOarvqET/NbWQri1gxdywHLG7gH+r2h4W+B67Neup2HzujmchBQk8gsN14BkFpPCWpK3mSpdYnbOZbbliYFhfm80mMDUtmXl3UD78FjMeLpcfycXIMry0ESHDfxFHozpCLouvHUBo+4RhQfklvnKg1Tk73DfegJNKqSHx+HUGhgen7lK8hXLY/3+nUl3eGxiuVEIjSUhNebNdoME85olEJ0Qh/jCdEIlXYq4yOw0xRh7Riet9hPcIjy8gNx+Zl3u1U8wNL+Bd99kKz640OBdsRy02fC3RdgjZWKkhgq/+KDzH5GQKFVG 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:(13230031)(4636009)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(451199024)(82310400011)(186009)(1800799009)(64100799003)(36840700001)(40470700004)(46966006)(107886003)(40460700003)(1076003)(2616005)(36860700001)(7696005)(83380400001)(47076005)(26005)(16526019)(6286002)(426003)(336012)(5660300002)(70586007)(82740400003)(7636003)(356005)(36756003)(70206006)(316002)(110136005)(54906003)(86362001)(40480700001)(6666004)(55016003)(8676002)(2906002)(8936002)(41300700001)(478600001)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 03:07:56.6550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cb65ec5-130a-42cb-5a82-08dbdc1a1422 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: DS2PEPF0000343B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7368 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Initially, the rdma-core library only supported misc0 to misc3 fields in matching resources, misc4 and misc5 fields were added to handle new features. The matcher layout, passing from DPDK to rdma-core, shouldn't exceed the size of the engaged library version capabilities. For now, there is no way to know what is the maximum capability of rdma-core, and DPDK should limit the matcher layout to misc3 if possible (no matching on fields misc4 and misc5 are requested by the application). The check if misc4 and misc5 features were requested was based on checking the values against zeroes. The matching mask should be checked instead. Fixes: 630a587bfb37 ("net/mlx5: support matching on VXLAN reserved field") Cc: rongweil@nvidia.com Cc: stable@dpdk.org Signed-off-by: Rongwei Liu Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2896bed5dc..535e0ea618 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14067,7 +14067,7 @@ flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, } dv->actions[n++] = priv->sh->default_miss_action; } - misc_mask = flow_dv_matcher_enable(dv->value.buf); + misc_mask = flow_dv_matcher_enable(dv_h->matcher->mask.buf); __flow_dv_adjust_buf_size(&dv->value.size, misc_mask); err = mlx5_flow_os_create_flow(dv_h->matcher->matcher_object, (void *)&dv->value, n, @@ -16236,7 +16236,7 @@ flow_dv_destroy_def_policy(struct rte_eth_dev *dev) static int __flow_dv_create_policy_flow(struct rte_eth_dev *dev, uint32_t color_reg_c_idx, - enum rte_color color, void *matcher_object, + enum rte_color color, struct mlx5_flow_dv_matcher *dv_matcher, int actions_n, void *actions, bool match_src_port, const struct rte_flow_item *item, void **rule, const struct rte_flow_attr *attr) @@ -16262,9 +16262,9 @@ __flow_dv_create_policy_flow(struct rte_eth_dev *dev, flow_dv_match_meta_reg(matcher.buf, value.buf, (enum modify_reg)color_reg_c_idx, rte_col_2_mlx5_col(color), UINT32_MAX); - misc_mask = flow_dv_matcher_enable(value.buf); + misc_mask = flow_dv_matcher_enable(dv_matcher->mask.buf); __flow_dv_adjust_buf_size(&value.size, misc_mask); - ret = mlx5_flow_os_create_flow(matcher_object, (void *)&value, + ret = mlx5_flow_os_create_flow(dv_matcher->matcher_object, (void *)&value, actions_n, actions, rule); if (ret) { DRV_LOG(ERR, "Failed to create meter policy%d flow.", color); @@ -16412,7 +16412,7 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, /* Create flow, matching color. */ if (__flow_dv_create_policy_flow(dev, color_reg_c_idx, (enum rte_color)i, - color_rule->matcher->matcher_object, + color_rule->matcher, acts[i].actions_n, acts[i].dv_actions, svport_match, NULL, &color_rule->rule, &attr)) { @@ -16872,7 +16872,7 @@ flow_dv_create_mtr_tbls(struct rte_eth_dev *dev, actions[i++] = priv->sh->dr_drop_action; flow_dv_match_meta_reg(matcher_para.buf, value.buf, (enum modify_reg)mtr_id_reg_c, 0, 0); - misc_mask = flow_dv_matcher_enable(value.buf); + misc_mask = flow_dv_matcher_enable(mtrmng->def_matcher[domain]->mask.buf); __flow_dv_adjust_buf_size(&value.size, misc_mask); ret = mlx5_flow_os_create_flow (mtrmng->def_matcher[domain]->matcher_object, @@ -16917,7 +16917,7 @@ flow_dv_create_mtr_tbls(struct rte_eth_dev *dev, fm->drop_cnt, NULL); actions[i++] = cnt->action; actions[i++] = priv->sh->dr_drop_action; - misc_mask = flow_dv_matcher_enable(value.buf); + misc_mask = flow_dv_matcher_enable(drop_matcher->mask.buf); __flow_dv_adjust_buf_size(&value.size, misc_mask); ret = mlx5_flow_os_create_flow(drop_matcher->matcher_object, (void *)&value, i, actions, @@ -17292,7 +17292,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, } if (__flow_dv_create_policy_flow(dev, color_reg_c_idx, (enum rte_color)i, - color_rule->matcher->matcher_object, + color_rule->matcher, acts.actions_n, acts.dv_actions, true, item, &color_rule->rule, &attr)) { @@ -18309,7 +18309,7 @@ flow_dv_discover_priorities(struct rte_eth_dev *dev, break; } /* Try to apply the flow to HW. */ - misc_mask = flow_dv_matcher_enable(flow.dv.value.buf); + misc_mask = flow_dv_matcher_enable(flow.handle->dvh.matcher->mask.buf); __flow_dv_adjust_buf_size(&flow.dv.value.size, misc_mask); err = mlx5_flow_os_create_flow (flow.handle->dvh.matcher->matcher_object, -- 2.27.0