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 373C2A0C45; Wed, 4 Aug 2021 09:27:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5F3B41224; Wed, 4 Aug 2021 09:27:45 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2079.outbound.protection.outlook.com [40.107.236.79]) by mails.dpdk.org (Postfix) with ESMTP id 9C0504121E; Wed, 4 Aug 2021 09:27:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ccctwJ9QSvNurP01QWqZl3hhMog4Svh9G7lHHTKaMlgXrlaJP57tQAu/CSphUhQNN/wMIZYClhB55OvYZbQ5heh4vgVUbeAWsqT3V18Re33aQ6P4BwbCvWMmAw3UOnAG/OLGx4HviU2Fib1E+XbE04r9Ws5aQE9ZwbcPUTJdJGl+l+bZPJ4aZ0azjO+kXr/80I7ASmsBR2oXCJC6OZp5wlFonk4rfgy4P61YYz4HETxFwkI02VN7nXFD8XARKNKOcdjVid7S408k/+IEu7EYJXlN4G6LjBF0rlNjRllX0i4ewiAKBpgiPQHQSFbq4JhIWEaCnDahYYudio4lA261sw== 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-SenderADCheck; bh=HvRzXxugb8xnPPt7dB6NkHpL3ibe4xL239B1CGuObWk=; b=ATS647twqXuR+zBYD2Q6RuGmgxh7hjbUgaZTpVS2MeegqHtHkOG9XFX0OYwNNKU85zj1Jh9ag5VfpyEYD3ju6jO7aFKMqtI96D5xon+b4GL5tJEW4wnIJCklW0qumlqT12zWNlbYMLGCbrmjCWFiUM8ofAahV5HXexcrQTt1OxMEYfI0TpEg/Cy4Q4xQpNvZivOS8BS0VmhQXqyMhlbW79WA9VxoaPWnql18sL03OoJa5YtTnqIgNyv5bADeCYODKCvgOZZxmHvpoW9pfAvZF+3/6u9AwRhFN9E1X4KsAGq0NT6GhWxGa8xvk5LmT9Mec/edvjaWuHDZRpDPSNHXKA== 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=none 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=HvRzXxugb8xnPPt7dB6NkHpL3ibe4xL239B1CGuObWk=; b=rZk4a5yQf3ZPB9cluy3BDI6eHRMUyfzsRjIWWlosXY9H0JeL5/J4lU+z+kPAyeEF03/gAa9JPOAHCDhkEB2lSJg3VxXOZko/ELdwmmSG8sRt3Od+/7jv8WT5Rc0zE/MFpDlF0RfcV74ycfoHUX3JhDNvDtzzJ3dwKY6hhKSU5ZLJyihonzmbx0Azm6CmaW/Psn948h3U6ka+DwJLoBhr8SzFZKJMlnEeY+NaNfEw3h3n6TtAbJG/7u76fkcKtdqwwJvE+uRVZu8yqOtL+zJiyIJBbMb02UKFPggl0n/hLIoP2vWGZopHytkX7JJ3Tl/VvwBemQjhvVRFiUCb+00C6g== Received: from BN9P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::8) by DM5PR12MB1658.namprd12.prod.outlook.com (2603:10b6:4:5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.20; Wed, 4 Aug 2021 07:27:42 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10c:cafe::6) by BN9P222CA0003.outlook.office365.com (2603:10b6:408:10c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Wed, 4 Aug 2021 07:27:42 +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 BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4394.16 via Frontend Transport; Wed, 4 Aug 2021 07:27:41 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 07:27:41 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 07:27:38 +0000 From: Shun Hao To: , , , "Shahaf Shuler" CC: , , , Date: Wed, 4 Aug 2021 10:26:47 +0300 Message-ID: <20210804072647.2077832-3-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20210804072647.2077832-1-shunh@nvidia.com> References: <20210804072647.2077832-1-shunh@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 DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29d30f22-dfc6-4e8d-7328-08d957195877 X-MS-TrafficTypeDiagnostic: DM5PR12MB1658: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: ZP3zf9Pui8suFq44tF6YZ+bHbS49JtZ+uowIIAHPXSY3xQg0fRE7hHTRLwE5lzufD3xf74nY5sowhovTAGHgmFewafgnspW8NArN+biIc2xxwnbfIUjlIln9E178SBQLIbNX0GtxPJl/1jImCrk8JOHk1poztjg/vZSKpS85VpjvF01+2/Q3Tz7PyNOJNabBlyfUerCbxqsVjVekdwNY4eTt+DwncyOaAxfvLQXDncPiZQe+ZcDSFRsbLemuDqIzfO6m1aBpcZhtWVwiNWqrtVJ5uAxAe0NdFD1+TQni6J1d66lj7cr64ZdR8PTmoAKe8v9UNr3RdRoh0LOjmPp/uH2T3R3QPzNi3nLqr60iEWR5WbDxIC+wSQC+Bed/hFAzRK2Kw8V98BnPb3BGGBaNZ70rrf4jmsRf3jUPpE4eGIpqXTFEOt7ufHD21kPH087MZm+xmSFhXa4zJTYeeuVzgCtueMgCnQY84kB9bna7WJ7WZNwKBbhju5g08H4Ri9hrclCSSFPv/DyLCIEM5VpR7NPb+4T/fokiFqYpzZw/7UUz3kgVa/+pvA4w5NMLpREv2FQ0mvyF+UR+9S7k79p8OfP5h3rRVE3a8cHnquNMyjL6Wmr0VjvlByHYn+W9veyWn4GBgt6odiUA2n+oDm7EQYZOSYp07+TmRNDHuG8YEtARHUABxzq3FhuqPOWKnnWO/FM/TG0Aqn/MII/20SU5fQ== 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)(136003)(396003)(376002)(346002)(39860400002)(36840700001)(46966006)(6636002)(186003)(26005)(36906005)(6286002)(8676002)(16526019)(36860700001)(86362001)(2616005)(316002)(336012)(110136005)(54906003)(83380400001)(55016002)(82310400003)(36756003)(7696005)(8936002)(356005)(47076005)(426003)(1076003)(5660300002)(4326008)(478600001)(70206006)(70586007)(82740400003)(2906002)(7636003)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2021 07:27:41.8008 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29d30f22-dfc6-4e8d-7328-08d957195877 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: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1658 Subject: [dpdk-dev] [PATCH v1 2/2] net/mlx5: fix domains detection in meter hierarchy 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" Meters in one hierarchy might support different domains. For example, one meter may support ingress only, but the root meter can support all the domains. If the later meter in the meter hierarchy wrongly doesn't inherit the first meter's domains, it will lead to invalid domain table access. Fix is when creating meter hierarchy, try to inherit the first meter domains in the meter hierarchy. Fixes: a3b7af90baba ("net/mlx5: validate meter action in policy") Cc: stable@dpdk.org Signed-off-by: Shun Hao Acked-by: Matan Azrad --- 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 f54440c6f5..31d857030f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -17527,6 +17527,7 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev, RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN, NULL, "Multiple fate actions not supported."); + *hierarchy_domain = 0; while (true) { fm = mlx5_flow_meter_find(priv, meter_id, NULL); if (!fm) @@ -17539,7 +17540,12 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev, "Non termination meter not supported in hierarchy."); policy = mlx5_flow_meter_policy_find(dev, fm->policy_id, NULL); MLX5_ASSERT(policy); - if (!policy->is_hierarchy) { + /** + * Only inherit the supported domains of the first meter in + * hierarchy. + * One meter supports at least one domain. + */ + if (!*hierarchy_domain) { if (policy->transfer) *hierarchy_domain |= MLX5_MTR_DOMAIN_TRANSFER_BIT; @@ -17548,6 +17554,8 @@ flow_dv_validate_policy_mtr_hierarchy(struct rte_eth_dev *dev, MLX5_MTR_DOMAIN_INGRESS_BIT; if (policy->egress) *hierarchy_domain |= MLX5_MTR_DOMAIN_EGRESS_BIT; + } + if (!policy->is_hierarchy) { *is_rss = policy->is_rss; break; } @@ -17825,11 +17833,11 @@ flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev, * so MARK action is only in ingress domain. */ domain_color[i] = MLX5_MTR_DOMAIN_INGRESS_BIT; - else if (action_flags[i] & - MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY) - domain_color[i] = hierarchy_domain; else domain_color[i] = def_domain; + if (action_flags[i] & + MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY) + domain_color[i] &= hierarchy_domain; /* * Non-termination actions only support NIC Tx domain. * The adjustion should be skipped when there is no -- 2.20.0