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 AD605A00C5; Sun, 3 Jul 2022 10:09:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EBF641132; Sun, 3 Jul 2022 10:09:01 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by mails.dpdk.org (Postfix) with ESMTP id A22A540685; Sun, 3 Jul 2022 10:08:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KQHzIU66Mo1IyKDSSNJP8sm8bZeYK+rTUoS4OmY6op2t7RpuTa6YjdKQ4ipki4MGmgCYMXfdvgB425rLOU8MHZTwj9MRg7+QQRHW9vY/hPpevOgHMBaHHDIMHITXPO34mLrB2upx+VNnvZHSSLWU6G/vV08Y4aImi+hehar1XI3koQxEYD1RnRlVBf/mk+GMQ//vPf8pruqDjPJBhW16BLw148Lt4ZWLcXsSRYoKBltVD3iDspdxLUcH+TqFBq22dNpvUhaHGCS8C937PxxPTEmNvbjz3dK06SeR92ora6hA8YDxvOh/fzgt7oklwikc2leSG2AObe9DdzrdoNLqTg== 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=BcpbAQ6Bz8d1y10h6ETjHwcd1SCsuAKA+OEkULgKe8Q=; b=UCKzGv0n6xCTYrJPNK4zEMErOZZrCEAf8iKN2SvaAeMhgiGdKT670awONUF72waJzQSl2fDcmzrgX1uScUb59CcCmEMvY67THcPGTbeKUi3no0kgnsSTIpThpB/SI20qvLq6naVq/ykypul3exmOhOhRtbz8C21JlF0dyXyNTepGmsTKG4oPOdy2YZozD3iFa/po7JFWn7gouCIFItWzV47WjRWxHUVnYD0NEE8Ry3eat0P90cLildDdeZD8E8HuaXcvpoGkPkIADvoKIFRIPFDJ5ABz/mMRmpdlrnWj94EVrEsAKq9OtRCOdLonHf/165815Fzh7rMn/sp7Aw95PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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 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=BcpbAQ6Bz8d1y10h6ETjHwcd1SCsuAKA+OEkULgKe8Q=; b=HtSa6RhiltxQg0fF/TlKbL7utrwqnttPPuk6DlYYCrAu1bRDXxgDMJIHMhvdxlTde4+ZlDxYNYojXRXYCxcH2t3HP05gQwEa7WX3k9op8tDesnVnYvKs9jKk84MIyqhgF6xGq1mn5iXx3Rz6N2gCDohSVMEXY2IviVWsp5NH5hdy/9Iev2wpP21TisEHIUhWPZ9imFMCCb1NXelinTJ6h8BvQCB7gXVIrWfs2SKFE8VMoPVSp66qMsIvGJLYOBYpqwxiu2V/fyx578Yev5q0LRVFvPPwKYRcysBWx5t5LRsQkAnD0UQah2vlbRt/l6lW6MvnszgwNzpgVYqEZD1tBA== Received: from BN9PR03CA0420.namprd03.prod.outlook.com (2603:10b6:408:111::35) by DM6PR12MB3081.namprd12.prod.outlook.com (2603:10b6:5:38::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Sun, 3 Jul 2022 08:08:55 +0000 Received: from BN8NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::b5) by BN9PR03CA0420.outlook.office365.com (2603:10b6:408:111::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15 via Frontend Transport; Sun, 3 Jul 2022 08:08:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT003.mail.protection.outlook.com (10.13.177.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5395.14 via Frontend Transport; Sun, 3 Jul 2022 08:08:55 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 3 Jul 2022 08:08:54 +0000 Received: from nvidia.com (10.126.231.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.26; Sun, 3 Jul 2022 01:08:51 -0700 From: Gregory Etelson To: CC: , , , , Viacheslav Ovsiienko Subject: [PATCH v2] net/mlx5: reject negative integrity item configuration Date: Sun, 3 Jul 2022 11:08:31 +0300 Message-ID: <20220703080831.863-1-getelson@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220703080202.443-1-getelson@nvidia.com> References: <20220703080202.443-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.231.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-Office365-Filtering-Correlation-Id: 12ebb7aa-8eb5-4b11-e446-08da5ccb4639 X-MS-TrafficTypeDiagnostic: DM6PR12MB3081:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YowflOMFHHG1rTK63bOFlVTEuv5ouwwYfN43yNp/GCxaVRnzSifaW2JvuF0asUr7dSyrYkbpcRNO0G0nn3JoaOC1LvKu5qJbd5K7B1wDczmbYaeWWWGFYitgXU1/miaog8/RSkXi/wsrqvOfdehmgV0Gn85NdLteJTA0J7KMet32qXsk4vdOR/9tMWsFQSE+/e9ZP8ccxWxdYVtG3zpvT5hM/RlssnRx3xliEn+KjAxI5STK7gyQHrqpizRLbjYJJgoNAPrHlQPjDUoLEk2y9ybXSYcFJa0GbVWfbbyUfNS14xIm35RUHFMasO8CZ8u98bXIT4weTpl8N/ugVAiRWEw0UsA4Qm0PfBR255Ix03ZlNATcqzCLJCeHGUTD9KEyPgeVLdW33Broe74Fq2iTEUtgVqVcUgM0IJaAHP8aaTjFuomuGHEQVv4vwEzAJwkLTcoSNXP0znnl3QNV3ZC0PtnetFsNBIrdE5jl6QEAzuZZkec9YmWJhEryP3/2mpn8Hk4ruzrv3kHv/ex8H7iAFn3xfJN7EE5Kcqp7J/GSyiVBYTWPPMenA7lH5dSfIzoFPrYnWcgXcTq5t1zXJD3uw+vZMeda1eynLe9w2lfhpu56jdb/h06PYeNXpuhIWGOAoGe7EBiUYWOo82ovU15RuXF+7uT/E8CIikCxLbKJGDe+asZ3L3gx+i8hOfH0ltYto3qtYNt35Ek2cWDvSPKB45OQDwnh20gpBA6GCe5t4n68ZKTh0nrMMXKnqRUM5cb9H1VVVY0EjsD39Mk8v5FXJf+sVZsFuVGMbaKCoErG+EXOgpk7DgoZUYMsGDmtZi36GL+DeePknSjzrxb5N0lhqxg0bcoC0faKLdHetFNN59A= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(396003)(39860400002)(346002)(136003)(376002)(36840700001)(46966006)(40470700004)(82310400005)(356005)(36756003)(478600001)(36860700001)(40480700001)(55016003)(8676002)(4326008)(70586007)(316002)(54906003)(450100002)(70206006)(6916009)(82740400003)(81166007)(7696005)(6286002)(2906002)(2616005)(6666004)(86362001)(26005)(41300700001)(8936002)(107886003)(40460700003)(5660300002)(1076003)(83380400001)(16526019)(186003)(336012)(426003)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2022 08:08:55.0943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12ebb7aa-8eb5-4b11-e446-08da5ccb4639 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3081 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 Negative integrity item refers to condition when the item value mask is set, but value spec is cleared: ... integrity value mask l4_ok value spec 0 ... RTE library defines integrity bits `l3_ok` and `l4_ok` as accumulators for all hardware L3 and L4 integrity verifications respectfully. Hardware `l3_ok` and `l4_ok` integrity bits refer to L3 and L4 network headers only. Integrity bits `l3_ok` and `l4_ok` are not compatible between RTE library and hardware. PMD translations for RTE `l3_ok` are: IPv4: `l3_ok` and `l3_csum_ok` IPv6: `l3_ok` RTE `l4_ok` is translated into PMD `l4_ok` and `l4_csum_ok` bits. Positive IPv4 `l3_ok` flow item configuration is translated into a single matcher that AND corresponding hardware bits. Negative IPv4 `l3_ok` is translated into 2 hardware conditions where each condition probes a single integrity bit: RTE::l3_ok is 0 => MLX5::l3_ok is 0 OR MLX5:l3_csum_ok is 0 MLX5 hardware does not do OR condition in flow rule item. Negative IPv4 `l3_ok` must be translated into 2 flow rules. Similarly negative RTE `l4_ok` condition is also translated into 2 hardware rules. Current PMD roadmap does not allow implicit flow rule split. TODO: extend RTE integrity bits definition to allow match on each hardware integrity bit for accumulated integiry matches. Bugzilla ID: 948 cc: stable@dpdk.org Signed-off-by: Gregory Etelson Acked-by: Matan Azrad --- v2: fix typo in cc address --- doc/guides/nics/mlx5.rst | 5 +++-- drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 9f2832e284..99734157d0 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -479,14 +479,15 @@ Limitations - Integrity offload is enabled starting from **ConnectX-6 Dx**. - Verification bits provided by the hardware are ``l3_ok``, ``ipv4_csum_ok``, ``l4_ok``, ``l4_csum_ok``. - ``level`` value 0 references outer headers. + - Negative integrity item verification is not supported - Multiple integrity items not supported in a single flow rule. - Flow rule items supplied by application must explicitly specify network headers referred by integrity item. For example, if integrity item mask sets ``l4_ok`` or ``l4_csum_ok`` bits, reference to L4 network header, TCP or UDP, must be in the rule pattern as well:: flow create 0 ingress pattern integrity level is 0 value mask l3_ok value spec l3_ok / eth / ipv6 / end … - or - flow create 0 ingress pattern integrity level is 0 value mask l4_ok value spec 0 / eth / ipv4 proto is udp / end … + + flow create 0 ingress pattern integrity level is 0 value mask l4_ok value spec l4_ok / eth / ipv4 proto is udp / end … - Connection tracking: diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 09349a021b..bee9363515 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -6779,6 +6779,12 @@ flow_dv_validate_item_integrity(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ITEM, integrity_item, "unsupported integrity filter"); + if ((mask->l3_ok & !spec->l3_ok) || (mask->l4_ok & !spec->l4_ok) || + (mask->ipv4_csum_ok & !spec->ipv4_csum_ok) || + (mask->l4_csum_ok & !spec->l4_csum_ok)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + NULL, "negative integrity flow is not supported"); if (spec->level > 1) { if (pattern_flags & MLX5_FLOW_ITEM_INNER_INTEGRITY) return rte_flow_error_set -- 2.34.1