Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Leon Romanovsky <leonro@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>, Alex Vesker <valex@nvidia.com>,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 02/12] net/mlx5: DR, Add fail on error check on decap
Date: Mon,  9 Aug 2021 20:59:13 -0700	[thread overview]
Message-ID: <20210810035923.345745-3-saeed@kernel.org> (raw)
In-Reply-To: <20210810035923.345745-1-saeed@kernel.org>

From: Alex Vesker <valex@nvidia.com>

While processing encapsulated packet on RX, one of the fields that is
checked is the inner packet length. If the length as specified in the header
doesn't match the actual inner packet length, the packet is invalid
and should be dropped. However, such packet caused the NIC to hang.

This patch turns on a 'fail_on_error' HW bit which allows HW to drop
such an invalid packet while processing RX packet and trying to decap it.

Fixes: ad17dc8cf910 ("net/mlx5: DR, Move STEv0 action apply logic")
Signed-off-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
index f1950e4968da..e4dd4eed5aee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
@@ -352,6 +352,7 @@ static void dr_ste_v0_set_rx_decap(u8 *hw_ste_p)
 {
 	MLX5_SET(ste_rx_steering_mult, hw_ste_p, tunneling_action,
 		 DR_STE_TUNL_ACTION_DECAP);
+	MLX5_SET(ste_rx_steering_mult, hw_ste_p, fail_on_error, 1);
 }
 
 static void dr_ste_v0_set_rx_pop_vlan(u8 *hw_ste_p)
@@ -365,6 +366,7 @@ static void dr_ste_v0_set_rx_decap_l3(u8 *hw_ste_p, bool vlan)
 	MLX5_SET(ste_rx_steering_mult, hw_ste_p, tunneling_action,
 		 DR_STE_TUNL_ACTION_L3_DECAP);
 	MLX5_SET(ste_modify_packet, hw_ste_p, action_description, vlan ? 1 : 0);
+	MLX5_SET(ste_rx_steering_mult, hw_ste_p, fail_on_error, 1);
 }
 
 static void dr_ste_v0_set_rewrite_actions(u8 *hw_ste_p, u16 num_of_actions,
-- 
2.31.1


  parent reply	other threads:[~2021-08-10  3:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  3:59 [pull request][net 00/12] mlx5 fixes 2021-08-09 Saeed Mahameed
2021-08-10  3:59 ` [net 01/12] net/mlx5: Don't skip subfunction cleanup in case of error in module init Saeed Mahameed
2021-08-10  8:53   ` patchwork-bot+netdevbpf
2021-08-10  3:59 ` Saeed Mahameed [this message]
2021-08-10  3:59 ` [net 03/12] net/mlx5e: Avoid creating tunnel headers for local route Saeed Mahameed
2021-08-10  3:59 ` [net 04/12] net/mlx5: Bridge, fix ageing time Saeed Mahameed
2021-08-10  3:59 ` [net 05/12] net/mlx5e: Destroy page pool after XDP SQ to fix use-after-free Saeed Mahameed
2021-08-10  3:59 ` [net 06/12] net/mlx5: Block switchdev mode while devlink traps are active Saeed Mahameed
2021-08-10  3:59 ` [net 07/12] net/mlx5: Fix order of functions in mlx5_irq_detach_nb() Saeed Mahameed
2021-08-10  3:59 ` [net 08/12] net/mlx5: Set all field of mlx5_irq before inserting it to the xarray Saeed Mahameed
2021-08-10  3:59 ` [net 09/12] net/mlx5: Destroy pool->mutex Saeed Mahameed
2021-08-10  3:59 ` [net 10/12] net/mlx5e: TC, Fix error handling memory leak Saeed Mahameed
2021-08-10  3:59 ` [net 11/12] net/mlx5: Synchronize correct IRQ when destroying CQ Saeed Mahameed
2021-08-10  3:59 ` [net 12/12] net/mlx5: Fix return value from tracer initialization Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210810035923.345745-3-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=valex@nvidia.com \
    --subject='Re: [net 02/12] net/mlx5: DR, Add fail on error check on decap' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).