From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 052C4A04DD; Wed, 18 Nov 2020 19:24:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A53405937; Wed, 18 Nov 2020 19:24:18 +0100 (CET) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by dpdk.org (Postfix) with ESMTP id 4DE9B592C for ; Wed, 18 Nov 2020 19:24:17 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 18 Nov 2020 10:24:05 -0800 Received: from nvidia.com (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 18 Nov 2020 18:24:13 +0000 From: Gregory Etelson To: CC: , , , "Viacheslav Ovsiienko" , Shahaf Shuler Date: Wed, 18 Nov 2020 20:23:59 +0200 Message-ID: <20201118182359.4883-1-getelson@nvidia.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1605723845; bh=7t3298xmUlGk7lnnxFs+U3gxHTb2EZaK63uUib0Lj8U=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; b=Lxd2YDVqTSBZ1s9OpcSQuoULOzlu50RZdHmG+p9wTcCuDmR7J43XZtoOfzEMJ7Y52 rKZwjzyR+IU8w7ywIuo/5ww5OZNdTde9koWhCKnfiM1JEah56Lmk3EoqiGAXfi4HiQ WCZlq8kC7+YnXj6fICeHe5yjzf/pXVbchBzguF809+SpJJC4W91JfahNmd/RSp3+22 hp93R3VKi99qLKdgCVm2f7qvqc5prIfTIqJpLQMAZqAngwczwR6ainYKBCZLh9hLG/ 0E5aGyIK7XpmYaRx8uejUlDS3xpJtgDfv5rOtCC6M9+WarPwGDQBfy0jy+1Zq78nfx tR+QUrgzIoWRw== Subject: [dpdk-dev] [PATCH] net/mlx5: fix restore info in non-tunnel traffic. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Tunnel offload API provides applications with ability to restore packet outer headers after partial offload. Exact feature execution depends on hardware abilities and PMD implementation. Hardware that is supported by MLX5 PMD places a mark on a packet after partial offload. PMD decodes that mark and provides application with required information. Application can call the restore API for packets that are part of offloaded tunnel and not. It's up to a PMD to provide correct information. Current MLX5 tunnel offload implementation does not allow applications to use flow MARK actions. It is restricted to tunnel offload use only. This fault was triggered by application that did not activate tunnel offload and called the restore API with a marked packet. The PMD tried to decode the mark value and crashed. The patch decodes mark value only if tunnel offload is active. Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index f650ac0f1a..601008d9b2 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7819,6 +7819,11 @@ mlx5_flow_tunnel_get_restore_info(struct rte_eth_dev= *dev, const struct mlx5_flow_tbl_data_entry *tble; const uint64_t mask =3D PKT_RX_FDIR | PKT_RX_FDIR_ID; =20 + if (!is_tunnel_offload_active(dev)) { + info->flags =3D 0; + return 0; + } + if ((ol_flags & mask) !=3D mask) goto err; tble =3D tunnel_mark_decode(dev, m->hash.fdir.hi); --=20 2.29.2