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 3C2E0A0C4C; Tue, 23 Nov 2021 17:05:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C188E40040; Tue, 23 Nov 2021 17:05:41 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id E26634003C; Tue, 23 Nov 2021 17:05:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZeM/dLHwfo0jgiNoulmOf6yB4gxpVhbVlGq4XZSWxqOGEUhrZZblf2IYaGdanGtChosLuXHGoiM0PYCnRsArXqa8ZVBqEewv9lcl/bXcZAX/cLPqOeAJBThYObsVs9eerm1a3HUQpK+DO9Js5RQHRhfOnVbpXXlSJynt0Finz0Lps6PGDdUkZuxObWR7ZP+7kVgcdf8pzVHh5Qx3NM7JMZgPoCf4bu/k8wPfFeXCWlkO+QN4nMsb+DqCRrDobKGJ9HO40kifJO6974NCPjRvdSOkwslHCT5lFn0KG4fZCcokEIfFbkhO/7MsTLwiXBhXJavym+C3D3k34KXEUe4m0g== 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=x+2OcFHW7eH9sJVVxeL+IoJpBpAe7XuXz4LeGnuRsL8=; b=Pt1v8PVK+4cpAtShfsHyW8l46FFbTDHp8ZqDGEQi7eKYv739Sue4jrk0pN3N5QKcoUP0ygUdZ1QvudUV0j/3UoGA74q9sBsBrbzWMh7y5VAhs2qP35ozL0WwsVbJCmmg9zFcb5emSWFVsCUNF/k/0QvesRdRu+y9pzr6uA0HP0+Tmq2qSnO/HUME7xpr6t/123FbazJ5qP/ags8qro7ya5l1MXHY/fBUzZJokYH2jyAtyTZZYJQgpB/aQvx3cmv11EWtoC3b+RTWRtt2x3DEuDYGczvDK8+y87OOZrNCgtBmtprHR9V+vZjri96z6OxowayQZqMKVYf/HYQmt/pk4w== 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=x+2OcFHW7eH9sJVVxeL+IoJpBpAe7XuXz4LeGnuRsL8=; b=XSn3tor2Zdevgf33+363Ft6BluHNZPQu0e2HOAOrutvb9au7o0SBPTxSJTGsGcQPO7GD6ekKyRs1wydp6Tl052qaFh+weFbwBvRZj4mYUZL1fIHuRbjkmi+8iFd0RkZctgpniocy4ig79FZtesaxr75hoA1dis7Fu2Zgvg9QZhpKlKaZnFP9Tk49cnCzd+pKMTa3dYKp/L4ACg+mXYPDMuEt6I1RvGGt7cCUC6BRaafCeMJ5SRpJAmIF/kKn+74ZC6sdRrqapLUfSNjrLTvU/MzhWwGqSJFvBGWbyBlUq8Vj+9BUxOMSOWmkBEbewOtW+hCzqrpTUSscCiUUH71uVQ== Received: from BN6PR13CA0053.namprd13.prod.outlook.com (2603:10b6:404:11::15) by CH0PR12MB5313.namprd12.prod.outlook.com (2603:10b6:610:d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.24; Tue, 23 Nov 2021 16:05:37 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:404:11:cafe::f3) by BN6PR13CA0053.outlook.office365.com (2603:10b6:404:11::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.13 via Frontend Transport; Tue, 23 Nov 2021 16:05:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Tue, 23 Nov 2021 16:05:36 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 23 Nov 2021 16:05:32 +0000 From: Bing Zhao To: , CC: , , , Li Zhang , Shun Hao Subject: [PATCH v2] net/mlx5: fix RSS validation for meter hierarchy Date: Tue, 23 Nov 2021 18:05:19 +0200 Message-ID: <20211123160519.79511-1-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211123160011.79219-1-bingz@nvidia.com> References: <20211123160011.79219-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a6a970f-17b5-421c-1754-08d9ae9b1645 X-MS-TrafficTypeDiagnostic: CH0PR12MB5313: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VVsNplKA5cGIxYhbQYYAIg9VEL0nuxJpshvB/ZH2YJx+64sQ6auk5LLAJCMsu9scDWNISzIIAmSMj3QzW1QZFc/jBOm3dPCOMn7BcSdZq6OewZo7AyUKnBkr5g7tu83jlNbf7EqqYkrkt/gTf0ZSStkKJRBngOZw1Tt0CwHMyEMykat42MEeRcuS86AOTPcU3fL2/c2wu9VetvPMXIvgkBrAeJLKK/89qlinpsH/vyNFPKHr4OniOrB3fy+6Tx2xzFOMqA5AecqLO46IA6ZBeGm4PIp/TFOb4LjOssEaxRrkWAqY0N9fHl/FYymCjK1JZh5P4hpaXUyhynzaBKWmFhZLC1bLY0vfd8c0npbp6j7++D/RIkCwrtx8tPTO/SRDNBWY7BbzrZtDNUymKwHN1cIk2s1DgRLWk9uCNrXA5QyBFg7/HILd79QAdrktVNaieYlnlwDLFpznfC6WIChlt8+p1XtQA2kqunim4LmYbPfhwQgyWBdKeYkuRlrNQ8bVjlxD9cs62FxPUcqypEMxCSnejQiITFUmtn13PS1iEPhmBeLQmOUXe1v5w+579gzMdLWQdn4ABR8NNC78YEgDbYRUcef+zj+TEho/1oloHGUUub6Sbvxb9ACdct0rZd4VEweH6cHoF3/6uwuZrkKx1wBj23W2+phwiwn/ehFze9CrZf6UilA22i5mb4IeaAV8 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)(508600001)(2906002)(110136005)(36906005)(356005)(54906003)(36860700001)(336012)(2616005)(83380400001)(1076003)(7636003)(4326008)(70206006)(426003)(5660300002)(16526019)(26005)(107886003)(36756003)(47076005)(8676002)(7696005)(186003)(8936002)(86362001)(450100002)(6636002)(55016003)(82310400004)(6286002)(316002)(70586007)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 16:05:36.4717 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a6a970f-17b5-421c-1754-08d9ae9b1645 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5313 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 In a meter hierarchy, all the meters are marked with having RSS if the final meter's termination action is RSS. When validating a flow rule with meter hierarchy, the RSS action should not be fetched from the current meter if it is not the final one. The fate action union is next meter ID instead of the pointer to the RSS action. By using the final meter in the hierarchy, the flow rule validation will succeed without any crash caused by the invalid RSS action pointer access. Fixes: 1ce19ab1f43b ("net/mlx5: fix RSS validation with meter policy") Cc: stable@dpdk.org Signed-off-by: Bing Zhao Reviewed-by: Li Zhang Reviewed-by: Shun Hao Acked-by: Matan Azrad --- v2: fix typo in the commit message --- drivers/net/mlx5/mlx5_flow_dv.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2f03e59f9c..f5356418fa 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5254,13 +5254,21 @@ mlx5_flow_validate_action_meter(struct rte_eth_dev *dev, "Flow and meter policy " "have different src port."); } else if (mtr_policy->is_rss) { - struct mlx5_meter_policy_action_container *acg = - &mtr_policy->act_cnt[RTE_COLOR_GREEN]; - struct mlx5_meter_policy_action_container *acy = - &mtr_policy->act_cnt[RTE_COLOR_YELLOW]; + struct mlx5_flow_meter_policy *fp; + struct mlx5_meter_policy_action_container *acg; + struct mlx5_meter_policy_action_container *acy; const struct rte_flow_action *rss_act; int ret; + fp = mlx5_flow_meter_hierarchy_get_final_policy(dev, + mtr_policy); + if (fp == NULL) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "Unable to get the final " + "policy in the hierarchy"); + acg = &fp->act_cnt[RTE_COLOR_GREEN]; + acy = &fp->act_cnt[RTE_COLOR_YELLOW]; MLX5_ASSERT(acg->fate_action == MLX5_FLOW_FATE_SHARED_RSS || acy->fate_action == -- 2.26.3