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 AF076A0555; Thu, 20 Oct 2022 14:56:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B81B42D78; Thu, 20 Oct 2022 14:56:21 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) by mails.dpdk.org (Postfix) with ESMTP id 465DE42BF1; Thu, 20 Oct 2022 14:56:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eISD17CwkiWgBbZQxVlKk1yiog/HIMIKYskm3AmRxr3L2XTJaz86WoyoDg3tzZSUmAKGtmHK/PdMG+TqSI9ai3YGacpytbDoYW34uc+MmPWrgoSkff4+6awrRIpt8KkbOw/JlOMxJE3JVvXqtP3+Zf6o0cr3fNDpiGzpV7lobKvOiwQwkc32GrUhLjNqVDAgFHNRuyIiWG2vYV9Ujb2ETV8Ib+8OicL+RMeDEZXtpil50umwLCSYkDz3j9Ndf6j2eLPmMOMNm6Vlxw8Bgc6qn+KmmK4NX/SjLQmpc76zv9uC5kaOWfniS4qxwL+2YXt1vb4p85ihNnYFYp411Tw1Zw== 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=15rNxJZHZCSXcPl0VqOJJOUOmDeqTomH23TfbGmK7wM=; b=hH9hTt1KS4f3VE0vgXGZG3XIwxBtz2eTHdAHwGExGp04wi+K1DEd9BlABkZs/CUhQ4GmGIRseivLrnfz3d4Pn3NtuXab9wvUm+At4EKlNsGaFr9dRVc58rUyYLzfMhzalVIONRwLWbahzxryQ/rors61EZ49fmbnCsnyd6Ewa6555pYEuBeR3p7ozA1HMSgRcNF0X0HiG9RfVasBsElgnQrWpdr8x8SiVOXYOHPg3f8Kov2dMt6J/SZjWj9d4RivTPicTSSAVUF0oQ2IbjGRW12RyVN7QAOkBW2WLjpDLH16gPxAUqoDHuwQwNf9xwOBfTRYrv7IoH/FvP9leU3HCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject 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=15rNxJZHZCSXcPl0VqOJJOUOmDeqTomH23TfbGmK7wM=; b=mGPkI/BxfAb8flPRmhJMNJIR9STLDzq11jhWvcFg9eLW61+1qPpFM/GoTEMEPdaVhzqKUyIKBoWKw9eekQtD0lTUKFhw68XRyIUC2kRl34E7M2GLT0C53+GGPMmE0/A8EB8BvF8z3qF24ziTNoHfZZasWAxLQlOiYt/MIevVOILiouVQ3AWCAz0AkdawQsDlZQeE7ajwPmx/l1zdeUYD6eK4apqbemYqYQLsQX828VKH9J0gM/wJcHR5I1IKTQT8BVCJ0WveSXw9r7+k3xKbY64/w6Q7ItF+vES3ybOX+EI+b8JPNUMA8GbeXEiqzMzp8iunbWHyXGw0voML+gilmg== Received: from MW4P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::7) by DM4PR12MB6207.namprd12.prod.outlook.com (2603:10b6:8:a6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Thu, 20 Oct 2022 12:56:18 +0000 Received: from CO1NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::97) by MW4P222CA0002.outlook.office365.com (2603:10b6:303:114::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.35 via Frontend Transport; Thu, 20 Oct 2022 12:56:17 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT073.mail.protection.outlook.com (10.13.174.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Thu, 20 Oct 2022 12:56:17 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 20 Oct 2022 05:56:01 -0700 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.29; Thu, 20 Oct 2022 05:55:58 -0700 From: Jiawei Wang To: , , , , Lior Margalit CC: , Subject: [PATCH] net/mlx5: fix tunnel header with IPIP offload Date: Thu, 20 Oct 2022 15:55:34 +0300 Message-ID: <20221020125534.37363-1-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain 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-TrafficTypeDiagnostic: CO1NAM11FT073:EE_|DM4PR12MB6207:EE_ X-MS-Office365-Filtering-Correlation-Id: 4669e07f-9263-4461-c4a2-08dab29a7a7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w+/iIEnWRI7sXbH917eIagY1KYkfpnIc4sFXL4eLjpabeFQKNVTkgdyDx5P3ce+DP/nf8QpVILZSMGfcPfInalSPnWvaZaWtT1FR5vRD0/t1lSqml/UD4JHrHl7XGgpHaUI0DSRQJ0PRUi3YtRtOLd242GvNULq+jutOE2MiSE7BcGUk4Oj3cOUAzd9tkAhWplufGphGeAxDjWnHNXCHGZzZkWvOL+KH60dVsVDvRII9cGJRLdYYwDIjLY3VMczAIReLCNG0wJR0e9as/yra6Dh9aL8UV/EBVdggQ6jRl8+QHp/PAEC+p9cX9vJDsTFCYHKf/DXCGKcRi5ErVc0CnzNJ8M2rpyEiZ117J16Zuj+eitxVGG6GFO0zrtcMJ/oKfGMFGD+AxDwP4i0tlJ85vfv71oWcBjulqGAeIFDehPSl4zSVzz9RvBNM97Io+L5mvEzQN3rVXH1pr14SJsvran1G1QN+9OaE2oDHGV6cpSkG00FGgClqLc4xIBVqf4vjbyBFzlFl3CGrMjVbukcp0M8H1QwPxnv95xGI3L9PJAY9Sq2h8Oo/3WYzi+w5j54VIfj+wKMGcN8GvMrZeuC+Q+WP3usR3NSipf2efywVfuRsEhH4UzEuXn/g6YCdr5I8oEpmFWdFgUInwTvZvA0Fd5kH90S/BWfak5P1MUAznqmitykdQLu4atN8I6yEw7Paa85WzJNCMHDWPg8GxuTEsNZmcHNKKjYKGxMaANjAT1wkoIE9Y4NUZbpmh67+W6Ng6NbOCR3fdfr7Sc2+3tocFw== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(41300700001)(478600001)(40460700003)(186003)(336012)(26005)(16526019)(6286002)(1076003)(6666004)(2906002)(36756003)(4326008)(8936002)(82310400005)(86362001)(2616005)(5660300002)(47076005)(7696005)(450100002)(82740400003)(110136005)(6636002)(316002)(40480700001)(54906003)(36860700001)(55016003)(7636003)(8676002)(426003)(70206006)(83380400001)(70586007)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 12:56:17.4307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4669e07f-9263-4461-c4a2-08dab29a7a7e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6207 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 For the flows with multiple tunnel layers and containing tunnel decap and modify actions, for example: ... / vxlan / eth / ipv4 proto is 4 / end actions raw_decap / modify_field / ... (note: proto 4 means we have the IP-over-IP tunnel in VXLAN payload) We have added the multiple tunnel layers validation rejecting the flows like above mentioned one. The hardware supports the above match combination till the inner IP-over-IP header (not including the last one), both for IP-over-IPv4 and IP-over-IPv6, so we should not blindly reject. Also, for the modify actions following the decap we should set the layer attributes correctly. This patch reverts the below code changes to support the match, and adjusts the layers update in case of decap with outer tunnel header. Fixes: fa06906a48ee ("net/mlx5: fix IPIP multi-tunnel validation") Cc: stable@dpdk.org Signed-off-by: Jiawei Wang Acked-by: Slava Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 4 ++-- drivers/net/mlx5/mlx5_flow_dv.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 06b465de7a..7ebe67028d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2512,7 +2512,7 @@ mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item, RTE_FLOW_ERROR_TYPE_ITEM, item, "IPv4 cannot follow L2/VLAN layer " "which ether type is not IPv4"); - if (item_flags & MLX5_FLOW_LAYER_TUNNEL) { + if (item_flags & MLX5_FLOW_LAYER_IPIP) { if (mask && spec) next_proto = mask->hdr.next_proto_id & spec->hdr.next_proto_id; @@ -2620,7 +2620,7 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item, "which ether type is not IPv6"); if (mask && mask->hdr.proto == UINT8_MAX && spec) next_proto = spec->hdr.proto; - if (item_flags & MLX5_FLOW_LAYER_TUNNEL) { + if (item_flags & MLX5_FLOW_LAYER_IPIP) { if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4bdcb1815b..bf093ab981 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -109,6 +109,7 @@ flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, struct mlx5_flow *dev_flow, bool tunnel_decap) { uint64_t layers = dev_flow->handle->layers; + bool tunnel_match = false; /* * If layers is already initialized, it means this dev_flow is the @@ -145,8 +146,10 @@ flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, case RTE_FLOW_ITEM_TYPE_GENEVE: case RTE_FLOW_ITEM_TYPE_MPLS: case RTE_FLOW_ITEM_TYPE_GTP: - if (tunnel_decap) + if (tunnel_decap) { attr->attr = 0; + tunnel_match = true; + } break; case RTE_FLOW_ITEM_TYPE_IPV4: if (!attr->ipv6) @@ -160,7 +163,8 @@ flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, ((const struct rte_flow_item_ipv4 *) (item->mask))->hdr.next_proto_id; if ((next_protocol == IPPROTO_IPIP || - next_protocol == IPPROTO_IPV6) && tunnel_decap) + next_protocol == IPPROTO_IPV6) && tunnel_decap && + !tunnel_match) attr->attr = 0; break; case RTE_FLOW_ITEM_TYPE_IPV6: @@ -175,7 +179,8 @@ flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, ((const struct rte_flow_item_ipv6 *) (item->mask))->hdr.proto; if ((next_protocol == IPPROTO_IPIP || - next_protocol == IPPROTO_IPV6) && tunnel_decap) + next_protocol == IPPROTO_IPV6) && tunnel_decap && + !tunnel_match) attr->attr = 0; break; case RTE_FLOW_ITEM_TYPE_UDP: -- 2.18.1