diff mbox series

net/mlx5: fix restore info in non-tunnel traffic.

Message ID 20201118182359.4883-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers show
Series net/mlx5: fix restore info in non-tunnel traffic. | expand

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-testing warning Testing issues
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson Nov. 18, 2020, 6:23 p.m. UTC
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 <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Raslan Darawsheh Nov. 19, 2020, 10:53 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Wednesday, November 18, 2020 8:24 PM
> To: Gregory Etelson <getelson@nvidia.com>
> Cc: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>
> Subject: [PATCH] net/mlx5: fix restore info in non-tunnel traffic.
> 
> 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 <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
diff mbox series

Patch

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 = PKT_RX_FDIR | PKT_RX_FDIR_ID;
 
+	if (!is_tunnel_offload_active(dev)) {
+		info->flags = 0;
+		return 0;
+	}
+
 	if ((ol_flags & mask) != mask)
 		goto err;
 	tble = tunnel_mark_decode(dev, m->hash.fdir.hi);