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 6A7C4A0C43; Mon, 18 Oct 2021 15:16:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CBCF40DF5; Mon, 18 Oct 2021 15:16:34 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2043.outbound.protection.outlook.com [40.107.94.43]) by mails.dpdk.org (Postfix) with ESMTP id E351040141; Mon, 18 Oct 2021 15:16:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Srqv9Cflk6JEkcrexzp9b5MFV4TiDCTMdw04aqqAJUPhW8ABtWYnHFypINcZ6JLu7P9NOlG3KCUt6fke5Bl2aXhn/K8aDFDGPvB06b8BrrFxfvojhf9oCyKObNqMqwXRAT2f5R+UUSxOyoR5IWqStSwq3YoMUdhiHCcSiuXf41DGGo3pqXO7nERc9U0Pc3aot0i0Wi5kPsagrLmu0K8LP8883e+YxEL9vO7ZW1WqNQui0XhCcnIhBydUrx97FYjENVCfKFmfH/vIpJEHuZblKyPKjTJDUEINBF6dWcveiPmnfjAG56MXSomSokOKFnQ4LYBVnrymGl+2pPoKOW6Lcw== 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=39OAftm5dZ8nnGFRhCTeSY1qaD0Xqt83lh4NG6IAosY=; b=CQbK/Pb8SO+9MW4C1zxQgwqe43CmCvPJpVtcJwEBg3CzE9Zt9I09rRlILF+ZkU0cbPU0fj2nXt5PjzGBybnTKZ/OrjI/9xTvrGAL8eAlf4/pzRNnZPC5TMVctE4aSLrLTVVEnexFkLz3wvoEx+CjTAlJyWu/yau1JORPK6CkOI9uUNf4ibGp9woHZQpkoFcMT7grgohw6sT4FeQWR/4KEWPsptS9QRZkudlw5PWLGpGAplwclROTHKQT6QKaQ/LSLWhQtG5YGRMbXf8u6d1j7k4B87f2IFydq9NtqrIAt+uPC38iJPhr4YDYMbzZMDbdhOk0yvAWjA3+626RlCvwyQ== 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=39OAftm5dZ8nnGFRhCTeSY1qaD0Xqt83lh4NG6IAosY=; b=TU3Zb3ELmk6ltQE8FCLXF/SptnwDoDUd26b0xw5pnSclFKpsOu5NkSdFS5V245CO8B9O8kLj1xNvQTAvQc5sjtv70FJvgapba1P5rz8/n+/tkddwtnzUu+Yk6rFM7f8/AvLB0YrJr5lMRiDNUGDrbZgxLW6vqpOup50vx7LNDYEli2x/nYWum6E0iUPqMKhF7gVgXA/Ro4SLKAsG+lru2tnfjN1xXbnoryEmseIK6ZmYvUOAmdGNhYJEhvH7nZiXmG/QqqfOtqXkIL7VcAuL7sOgS7XfnPGuuKBDonknDTcDRUhuF0fAGgbEnoHZ3nkzJaNhGUjdjqAQiq9uzdq7EA== Received: from DM3PR14CA0143.namprd14.prod.outlook.com (2603:10b6:0:53::27) by MN2PR12MB3549.namprd12.prod.outlook.com (2603:10b6:208:107::17) 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 13:16:30 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:0:53:cafe::6d) by DM3PR14CA0143.outlook.office365.com (2603:10b6:0:53::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14 via Frontend Transport; Mon, 18 Oct 2021 13:16:30 +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 DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) 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 13:16:29 +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 13:16:27 +0000 From: Bing Zhao To: , CC: , , Date: Mon, 18 Oct 2021 16:16:12 +0300 Message-ID: <20211018131612.145215-1-bingz@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: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df8a44ef-39d6-426b-6ed2-08d992397f84 X-MS-TrafficTypeDiagnostic: MN2PR12MB3549: 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: rZ0NCV4ZcPzh4lgxMLQTupqTCR/eEnB3KZMzXCuL+mrsd0AijadaQV4iaCuASO+YAaK72aDtyZJNby2NpPGAw0ay51fxXb8ul+uZzc/SCEi+pcaW8ZabGMHYBLdwodd7x4bk8yjcaYrvATYHH4nACi9YZ1+0XO5PqjGNv8lVaaDLbXZ90/mfnvjPxcc9H0HHqJJlAIMF14TU8VkBkYpYt76LNF7C7PPZeLhLO+U2T8iLpMC4bp8jzkvqMRfy8/+apZ5RxisXcM+ItKRLlz3S4Yv70v5458VzulpaoEcNOC89RMeXf+zD6Hw9k7hXFNaovDWEW8wMbzQ0YLyXmyDdDh6gBW0ckZbyxVf3Nm8WrZ/xjyWo84+3oKGreGiljmqp0WTIEltV76sHkGLcHtTXg9IIlnG06ha4qcJH+tUvlO/1OC6vQRil4GoLp6ZRpQj+Ge4QwJTG764jQecRa8CHwe1G810rPWgTh7brimzKzpJZkrB5eoEoxnQ2NMV5f1sPLbXZoDSFxEJGDgYQIw3zHenS8uPiAzrEDKMReEtCDJpD/eO6tCOOF45Cf9hHTteUVE6XnFy7j3OeO858ny08vaC+b2yhnOex7sdmkTLu9sN2kod1jfe8Q8Ut9L1HuR4ni8BMrdDFduke8aH5An3JuS+LmpC+ygb6B4u41iFBbi9nn8Ly2yZvxA1zkd0eK0hUpFiiv+AZmE4tVP8CCdtrMQ== 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)(46966006)(36840700001)(6636002)(450100002)(4326008)(316002)(508600001)(55016002)(36906005)(54906003)(6666004)(2906002)(110136005)(8676002)(2616005)(7636003)(1076003)(47076005)(82310400003)(7696005)(5660300002)(70586007)(336012)(16526019)(426003)(86362001)(8936002)(356005)(186003)(36860700001)(83380400001)(36756003)(26005)(6286002)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 13:16:29.6024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df8a44ef-39d6-426b-6ed2-08d992397f84 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: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3549 Subject: [dpdk-dev] [PATCH] 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 --- 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..828f290308 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