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 E7C10A0C47; Tue, 26 Oct 2021 11:26:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD22341C25; Tue, 26 Oct 2021 11:26:02 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2057.outbound.protection.outlook.com [40.107.100.57]) by mails.dpdk.org (Postfix) with ESMTP id 2D0E1407FF for ; Tue, 26 Oct 2021 11:26:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LEGk6xwyt0qgySrNVik1PECf1PObS++t0qjA3PVuiwTTlNFMqBF149xYMTulpwF74mC/unwP3glkdc/StZg6QfM+3HjfefULgnOUta0R5X9GnbP7iiF8zPDWeYD5OFf6mpjPa/wrk3nZEX9JATFIhbYl9oJV9JT4PS1rgK4VqUz5zZmmOkaNsgk69Zpx4B/FdWJxH7qTsRnUaycuwBaXT19D+pQjPRBJk9Fo7QHgN1NKxl3NHnsEl7CZaKAiGKCw1sJICei7L78ka9YrsvXjqpGJILek80W6nvHK+CkqGsNu668daPXMZcOucKrSU27bDBpSh3fUip9kKDHyszGosw== 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=e+UvUQfvOjkkjPMcAdS4PpK8OPUtrQXBN2ZhGzB6y0o=; b=nRgtS4vCVHJvIxp4PNEbnZpsWrVv5nHoAHwcral1yd544IXcEj1BiJuRdQRYr7lQGQrnxiz0Sh7vKTIVDjOm1QFT5I46N9EnMZohQbp/w+xUaLRzQcqxQcX69pCif6fkI0W91UNoor4iAGpCe7njm0/hQoMpWj62Hbc1lHgp6Ta/EHt0anA0LOYCQSajZEJeGH6IgnpuAr+vaUlfOro+MXHPlAzKertoaIp7xIRON0feJTssSeiITTVZwk/qomLt6JmyAvcJ6AHbg7uQAgfxng67A1vomPXcAobUoCPDH/PIZV6+mgkVJPIQgp66428VbhaWZbFTCQhM1BJdjVCp5w== 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=e+UvUQfvOjkkjPMcAdS4PpK8OPUtrQXBN2ZhGzB6y0o=; b=pCa2iOml31OVZC+AwYOAfXeYcwH7fkzsuF5jICvC47FmysKYoflRV2S0Vl1pOBYYNWm1MpmTI3hgS0LciOUMGIS0S6AxUDK7siZekyq0pSelm3UlHEW26oq+tqlD4DdSW5zkGN5oe+O0ecir+vuz18QxSWGcWkro4ACLlaUfjxZDchX35nO87xzQEdSikSrKseMeGk9JhsQnjY4YayMlHqWJB+GyMKwTtcVySR5hCZIL3GcUIBGu/txDZNY6rOrmHvomc3seryBGF2lSvqG+usWoKFPzrTIedhO/l6S4BP4bg3+KiFi2j/HkVGYTYIjWp0o0TL7W8ebm0NU3PrfiBg== Received: from DM6PR13CA0038.namprd13.prod.outlook.com (2603:10b6:5:134::15) by BYAPR12MB2965.namprd12.prod.outlook.com (2603:10b6:a03:ae::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13; Tue, 26 Oct 2021 09:25:59 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::62) by DM6PR13CA0038.outlook.office365.com (2603:10b6:5:134::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.11 via Frontend Transport; Tue, 26 Oct 2021 09:25:58 +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 DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Tue, 26 Oct 2021 09:25:58 +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, 26 Oct 2021 09:25:56 +0000 From: Gregory Etelson To: , CC: , , Viacheslav Ovsiienko Date: Tue, 26 Oct 2021 12:25:42 +0300 Message-ID: <20211026092543.13224-1-getelson@nvidia.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] 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: 131750c4-eb54-41b5-b8b8-08d998629ee2 X-MS-TrafficTypeDiagnostic: BYAPR12MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1T1b+kogw85T15Tzuaj7UmGBGzxDLfc6B0zL7mXxvyEWHRLuKz4HGXsNQOvKAG4djc0ughPWndh2oV0Mep/0zpzJrD9zza4VKWnU9ii8A264ubvZP6NmGGoUSuWJPHLnevsTvPRlPq2su/rCedTG5iRdhrR8OF4fpeI8tkOwNOqaWfKZqyz8Odt02YjxZ5p7Qy9ToNrK4QeO28rW87OFJvOqGMOlt9n0YLPlLzABtXNrjoOwGKb0u4oxbHYuKXLR233szwB/0wkxiQd0scA1mu56QvwMOFaslGm0/GMJ5u5EVxTpU+5TcDvTZEkH9uwyDT7973tLfSzNpgWH5EImVF6KJEvi05b9Q38zE1JsZawZK2y1MbDSVdOkn4IsYBLmgsrZbDb1+AGuFLV/a4nLBhdn5eIaxT2o3XXe6wG9D9L52cPyF1CcBa3IwqZ48UoJFxadxZ5FHFEDUrVqIjYg8Iic7XqMdvJ3m3QaqTI1qVgnewD9ZuZU/s/nIi3nbcrFbIpnwAIQ2Rjo9l1tBeXGaEYTC8dopPbiZgqE3gM6/hLV0+Uq+UZHjjPsDMdWQuW042tw2Id8+pS4B4MUL1q6hr81uwGxcTCNgSCU+6LV9+8FkUUdTo4c6SUDX1Jwn3COmNMqGR9zKj8TSjd5twvcFZnaBWW/ik2L3465WQQu7dr8GZx2bCNyyY7cmXZLo0puysjM11HYFHxyzc4rrnvukQ== 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)(7696005)(83380400001)(36860700001)(70206006)(47076005)(336012)(8676002)(2616005)(426003)(70586007)(508600001)(55016002)(86362001)(82310400003)(6286002)(8936002)(36906005)(2906002)(110136005)(16526019)(36756003)(4326008)(7636003)(1076003)(356005)(7049001)(186003)(316002)(5660300002)(6666004)(54906003)(107886003)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2021 09:25:58.8421 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 131750c4-eb54-41b5-b8b8-08d998629ee2 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: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2965 Subject: [dpdk-dev] [PATCH 1/2] net/mlx5: fix integrity matching for inner and outer headers 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" MLX5 PMD can match on integrity bits for inner and outer headers in a single flow. That means a single flow rule can reference both inner and outer integrity bits. That is implemented by adding 2 flow integrity items to a rule - one item for outer integrity bits and other for inner integrity bits. Integrity item `level` parameter specifies what part is being targeted. Current PMD treated integrity items for outer and inner headers as the same. The patch separates PMD verifications for inner and outer integrity items. Fixes: 79f8952783d0 ("net/mlx5: support integrity flow item") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 7 ++++--- drivers/net/mlx5/mlx5_flow_dv.c | 29 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 4a16f30fb7..41e24deec5 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -170,11 +170,12 @@ enum mlx5_feature_name { #define MLX5_FLOW_LAYER_GENEVE_OPT (UINT64_C(1) << 32) #define MLX5_FLOW_LAYER_GTP_PSC (UINT64_C(1) << 33) -/* INTEGRITY item bit */ -#define MLX5_FLOW_ITEM_INTEGRITY (UINT64_C(1) << 34) +/* INTEGRITY item bits */ +#define MLX5_FLOW_ITEM_OUTER_INTEGRITY (UINT64_C(1) << 34) +#define MLX5_FLOW_ITEM_INNER_INTEGRITY (UINT64_C(1) << 35) /* Conntrack item. */ -#define MLX5_FLOW_LAYER_ASO_CT (UINT64_C(1) << 35) +#define MLX5_FLOW_LAYER_ASO_CT (UINT64_C(1) << 36) /* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 9cba22ca2d..c27c2df5c4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -6679,6 +6679,7 @@ static int flow_dv_validate_item_integrity(struct rte_eth_dev *dev, const struct rte_flow_item *rule_items, const struct rte_flow_item *integrity_item, + uint64_t item_flags, uint64_t *last_item, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; @@ -6694,6 +6695,11 @@ flow_dv_validate_item_integrity(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ITEM, integrity_item, "packet integrity integrity_item not supported"); + if (!spec) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, + integrity_item, + "no spec for integrity item"); if (!mask) mask = &rte_flow_item_integrity_mask; if (!mlx5_validate_integrity_item(mask)) @@ -6703,6 +6709,11 @@ flow_dv_validate_item_integrity(struct rte_eth_dev *dev, "unsupported integrity filter"); tunnel_item = mlx5_flow_find_tunnel_item(rule_items); if (spec->level > 1) { + if (item_flags & MLX5_FLOW_ITEM_INNER_INTEGRITY) + return rte_flow_error_set + (error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, + NULL, "multiple inner integrity items not supported"); if (!tunnel_item) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, @@ -6711,6 +6722,11 @@ flow_dv_validate_item_integrity(struct rte_eth_dev *dev, item = tunnel_item; end_item = mlx5_find_end_item(tunnel_item); } else { + if (item_flags & MLX5_FLOW_ITEM_OUTER_INTEGRITY) + return rte_flow_error_set + (error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, + NULL, "multiple outer integrity items not supported"); end_item = tunnel_item ? tunnel_item : mlx5_find_end_item(integrity_item); } @@ -6730,6 +6746,8 @@ flow_dv_validate_item_integrity(struct rte_eth_dev *dev, integrity_item, "missing L4 protocol"); } + *last_item |= spec->level > 1 ? MLX5_FLOW_ITEM_INNER_INTEGRITY : + MLX5_FLOW_ITEM_OUTER_INTEGRITY; return 0; } @@ -7152,16 +7170,13 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item = MLX5_FLOW_LAYER_ECPRI; break; case RTE_FLOW_ITEM_TYPE_INTEGRITY: - if (item_flags & MLX5_FLOW_ITEM_INTEGRITY) - return rte_flow_error_set - (error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ITEM, - NULL, "multiple integrity items not supported"); ret = flow_dv_validate_item_integrity(dev, rule_items, - items, error); + items, + item_flags, + &last_item, + error); if (ret < 0) return ret; - last_item = MLX5_FLOW_ITEM_INTEGRITY; break; case RTE_FLOW_ITEM_TYPE_CONNTRACK: ret = flow_dv_validate_item_aso_ct(dev, items, -- 2.33.1