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 2FE4FA0C43; Mon, 18 Oct 2021 16:43:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1839040DF5; Mon, 18 Oct 2021 16:43:28 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2085.outbound.protection.outlook.com [40.107.244.85]) by mails.dpdk.org (Postfix) with ESMTP id AA6B940142; Mon, 18 Oct 2021 16:43:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QfRVqd9eKVVXosYqdIIxJzcQeZrb3NtHdQNrqyiA+36JWQ62kkw5OiIxB0WmMyeoo1hUmymnYf/3cxH9btN8PTrvcouSqlQn8tB/1LrwSRqvyRNXs0ATkGWNMGIhzfsD1JXpdwnVHcYbpwEXnMZgRNuZz2cZm5wB1uTaTzAsVxAubzWtGB8XV1sDyMDZGrsUE+pLSHB/BO/bXZJ/jrCyeC8sVfUzjsJqK9hOMzv1oYXPt+DJZOc2J363hUE+aPukgizlw6muR3YHCOsvjAOzZRV0SkzVAuAe+nydi7KwdOsGqOAcrlWJTQbzTGAoH4+Dj1v5/S9tsWDPcbM3hglTCw== 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=zvcUgVht2O0jYHSbHTq/AGaxlfsKGdSim6Ku+PGjaEc=; b=BiAFqfeKT+hfKf9vPlSyuZUpI6upEzOwDNOeg7Eb4QAAxl/DqEa4rZhfgGl6Jl8VAb65BoLuXFBt/4KP5gnXXVWQ0prYpU0GChgTztT9H0EjonlGqmJkZKZZ2q8OyKRq3gdn3hxGasZDEjEhYLwPAXXg9F7B/bNEJHcgutT9GK1FC7E8SUeqm9jrAFCG9cc/C7Nmaf/KNs1EfPGcqRGP33Jf88OiqfzPX+3VZww2Wh+HAqj4GAggNL0xXBQuRd3m01U/mH15I7fUCqRmnng/dUZedxJXximYBimyKbgRIuYy/6GYrcbtHMA1BM1N7VBSnv2ObPN9nclFABi2+auRsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=zvcUgVht2O0jYHSbHTq/AGaxlfsKGdSim6Ku+PGjaEc=; b=Qf0UsL9FF6PnSt+CwZQY4J8EkYo0DA0v2osvKR68ZWVWUZjCzyUmnmjgHt46S6UAO0Kzd4aylSSoQUTYuXykIhLVOOo5CeVrr3d6M87Qnq5DcnPkD0NwhsjFv34NKDo/BAPaKWzwS2G/fXVE2xV+QgvoFlNPNOWZGzPFLHvVYhrVVCrBiWAZ/6JOd9+0/5jxJtEk71HrqqhUk41bYe9qbXQ861AesYQ2oR2f8jsaAoUXeMyegDvIP6nYwWEtbAIqqK7rAUjav/5hfX6oJ3gxp/wsCFeOxuMfrFhhvpvSeCLJPGa2MkF3HBIpctCOsOkObJ6KFFZmi+fCQRFEB3E9Ow== Received: from MW4PR04CA0332.namprd04.prod.outlook.com (2603:10b6:303:8a::7) by BYAPR12MB3543.namprd12.prod.outlook.com (2603:10b6:a03:130::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Mon, 18 Oct 2021 14:43:24 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::c6) by MW4PR04CA0332.outlook.office365.com (2603:10b6:303:8a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Mon, 18 Oct 2021 14:43:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 14:43:23 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 18 Oct 2021 14:43:21 +0000 From: Bing Zhao To: , CC: , , Date: Mon, 18 Oct 2021 17:43:07 +0300 Message-ID: <20211018144307.148246-1-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211018131612.145215-1-bingz@nvidia.com> References: <20211018131612.145215-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df2b72d7-f30d-47c6-3254-08d99245a384 X-MS-TrafficTypeDiagnostic: BYAPR12MB3543: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gK8z19xIHVi3+SIDJy53SKNW9vDFlLvWEbebnE6O9UrZVaeXqgqbIpaSWhFqRKw092G9GLGctXZVfqwqi0x1S8N/6byhhDbabkRvQ5TbA8iX9Vjk8l3avdsZc2G305Vzv6+T8BvV/vbr8YkNa6rOkpNeWgtHscf6FgVByGY6KSlPRAe88Jk8mqAcHsjKx1OLB5MgMzpzV2MsxYwQW2ARn/R/X2X7ncoFWbBO2/YB3U0Xtp1q+VcYCYVoAbkGqnrmzU4w20EJdIB1aL86rDbNmXqPcBYlYhDlB0Z4EC6erQu4PN1ipG8eCJLrHXCjT7pk/Y9rGktUQk8L5oQJsL2uFTO5pZeGWQBNpEpli3e+hHnMrG9hXHBW8ZW+sr/WRBf0HPYGULPYCwRExu1VTnu1qKKQu+Rb7tp4n9o3qyCo8Kj7M9Dl0Enj0FbPCe7G6BXzdHSbRTisr6GASkDWM2H70vsyySrJPaQVQWCHEVpAXZzmWq+4mX1I6VqmwAg6fVuqMhaKV9uoctkbrf9ENLJvrNCA1xL8gGhgcWdyX58JNqsuRUAJMwJWwWKIYN0Ec/Do56qsJO8d42yF85Pxmp+CXyFaF4LILVkuhLWPdPYhfHb2LPPG/DzEwuawyEtMSxkoxLlMexJ0pHEkIiCydEShlpxuVBXYhY740QQfGcjJiiS2jECxNnzSOO2EVnNTzszSzs7WbU1V+ClAOr3LVbk+/w== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(186003)(70206006)(6666004)(70586007)(86362001)(54906003)(7636003)(1076003)(5660300002)(36860700001)(450100002)(2906002)(16526019)(4326008)(8936002)(2616005)(6286002)(7696005)(316002)(336012)(36906005)(508600001)(8676002)(26005)(110136005)(426003)(6636002)(36756003)(47076005)(83380400001)(55016002)(82310400003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 14:43:23.8607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df2b72d7-f30d-47c6-3254-08d99245a384 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3543 Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy 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 Sender: "dev" After yellow color actions in the metering policy were supported, the RSS could be used for both green and yellow colors and only the queues attribute could be different. When specifying the attributes of a RSS, some fields can be ignored and some default values will be used in PMD. For example, there is a default RSS key in the PMD and it will be used to create the TIR if nothing is provided by the application. The default value cases were missed in the current implementation and it would cause some false positives or crashes. The comparison function should be adjusted to take all cases into consideration when RSS is used for both green and yellow colors. Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation") Cc: stable@dpdk.org Signed-off-by: Bing Zhao --- v2: remove unnecessary parenthesis --- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 609ab43fb6..94b70bd10a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -17412,12 +17412,22 @@ static inline int flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1, const struct rte_flow_action_rss *r2) { - if (!r1 || !r2) + if (r1 == NULL || r2 == NULL) return 0; - if (r1->func != r2->func || r1->level != r2->level || - r1->types != r2->types || r1->key_len != r2->key_len || - memcmp(r1->key, r2->key, r1->key_len)) + if (!(r1->level <= 1 && r2->level <= 1) && + !(r1->level > 1 && r2->level > 1)) return 1; + if (r1->types != r2->types && + !((r1->types == 0 || r1->types == ETH_RSS_IP) && + (r2->types == 0 || r2->types == ETH_RSS_IP))) + return 1; + if (r1->key || r2->key) { + const void *key1 = r1->key ? r1->key : rss_hash_default_key; + const void *key2 = r2->key ? r2->key : rss_hash_default_key; + + if (memcmp(key1, key2, MLX5_RSS_HASH_KEY_LEN)) + return 1; + } return 0; } -- 2.27.0