netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/8] mlx5 misc fixes 2024-07-30
@ 2024-07-30  6:16 Tariq Toukan
  2024-07-30  6:16 ` [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback Tariq Toukan
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Tariq Toukan

Hi,

This patchset provides misc bug fixes from the team to the mlx5 core and
Eth drivers.

Series generated against:
commit 301927d2d2eb ("Merge tag 'for-net-2024-07-26' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth")

Thanks,
Tariq.

Chris Mi (1):
  net/mlx5e: Fix CT entry update leaks of modify header context

Mark Bloch (1):
  net/mlx5: Lag, don't use the hardcoded value of the first port

Moshe Shemesh (1):
  net/mlx5: Fix missing lock on sync reset reload

Rahul Rameshbabu (1):
  net/mlx5e: Require mlx5 tc classifier action support for IPsec prio
    capability

Shahar Shitrit (1):
  net/mlx5e: Add a check for the return value from
    mlx5_port_set_eth_ptys

Shay Drory (2):
  net/mlx5: Always drain health in shutdown callback
  net/mlx5: Fix error handling in irq_pool_request_irq

Yevgeny Kliteynik (1):
  net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule

 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c     |  1 +
 .../mellanox/mlx5/core/en_accel/ipsec_offload.c        |  7 ++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  7 ++++++-
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c     |  5 ++++-
 drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +++++++---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c      |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/main.c         |  2 +-
 .../net/ethernet/mellanox/mlx5/core/sf/dev/driver.c    |  1 +
 .../net/ethernet/mellanox/mlx5/core/steering/dr_rule.c |  2 +-
 9 files changed, 26 insertions(+), 11 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:33   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq Tariq Toukan
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Shay Drory,
	Moshe Shemesh, Tariq Toukan

From: Shay Drory <shayd@nvidia.com>

There is no point in recovery during device shutdown. if health
work started need to wait for it to avoid races and NULL pointer
access.

Hence, drain health WQ on shutdown callback.

Fixes: 1958fc2f0712 ("net/mlx5: SF, Add auxiliary device driver")
Fixes: d2aa060d40fa ("net/mlx5: Cancel health poll before sending panic teardown command")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c          | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 527da58c7953..5b7e6f4b5c7e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -2142,7 +2142,6 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
 	/* Panic tear down fw command will stop the PCI bus communication
 	 * with the HCA, so the health poll is no longer needed.
 	 */
-	mlx5_drain_health_wq(dev);
 	mlx5_stop_health_poll(dev, false);
 
 	ret = mlx5_cmd_fast_teardown_hca(dev);
@@ -2177,6 +2176,7 @@ static void shutdown(struct pci_dev *pdev)
 
 	mlx5_core_info(dev, "Shutdown was called\n");
 	set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state);
+	mlx5_drain_health_wq(dev);
 	err = mlx5_try_fast_unload(dev);
 	if (err)
 		mlx5_unload_one(dev, false);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
index b2986175d9af..b706f1486504 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
@@ -112,6 +112,7 @@ static void mlx5_sf_dev_shutdown(struct auxiliary_device *adev)
 	struct mlx5_core_dev *mdev = sf_dev->mdev;
 
 	set_bit(MLX5_BREAK_FW_WAIT, &mdev->intf_state);
+	mlx5_drain_health_wq(mdev);
 	mlx5_unload_one(mdev, false);
 }
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
  2024-07-30  6:16 ` [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:34   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule Tariq Toukan
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Shay Drory,
	Maher Sanalla, Tariq Toukan

From: Shay Drory <shayd@nvidia.com>

In case mlx5_irq_alloc fails, the previously allocated index remains
in the XArray, which could lead to inconsistencies.

Fix it by adding error handling that erases the allocated index
from the XArray if mlx5_irq_alloc returns an error.

Fixes: c36326d38d93 ("net/mlx5: Round-Robin EQs over IRQs")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
index f7b01b3f0cba..1477db7f5307 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
@@ -48,6 +48,7 @@ static struct mlx5_irq *
 irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc)
 {
 	struct irq_affinity_desc auto_desc = {};
+	struct mlx5_irq *irq;
 	u32 irq_index;
 	int err;
 
@@ -64,9 +65,12 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_de
 		else
 			cpu_get(pool, cpumask_first(&af_desc->mask));
 	}
-	return mlx5_irq_alloc(pool, irq_index,
-			      cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
-			      NULL);
+	irq = mlx5_irq_alloc(pool, irq_index,
+			     cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
+			     NULL);
+	if (IS_ERR(irq))
+		xa_erase(&pool->irqs, irq_index);
+	return irq;
 }
 
 /* Looking for the IRQ with the smallest refcount that fits req_mask.
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
  2024-07-30  6:16 ` [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback Tariq Toukan
  2024-07-30  6:16 ` [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:36   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port Tariq Toukan
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Yevgeny Kliteynik, Alex Vesker, Tariq Toukan

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

This patch reduces the size of hw_ste_arr_optimized array that is
allocated on stack from 640 bytes (5 match STEs + 5 action STES)
to 448 bytes (2 match STEs + 5 action STES).
This fixes the 'stack guard page was hit' issue, while still fitting
majority of the usecases (up to 2 match STEs).

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
index 042ca0349124..d1db04baa1fa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
@@ -7,7 +7,7 @@
 /* don't try to optimize STE allocation if the stack is too constaraining */
 #define DR_RULE_MAX_STES_OPTIMIZED 0
 #else
-#define DR_RULE_MAX_STES_OPTIMIZED 5
+#define DR_RULE_MAX_STES_OPTIMIZED 2
 #endif
 #define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (2 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:37   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload Tariq Toukan
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Mark Bloch,
	Tariq Toukan

From: Mark Bloch <mbloch@nvidia.com>

The cited commit didn't change the body of the loop as it should.
It shouldn't be using MLX5_LAG_P1.

Fixes: 7e978e7714d6 ("net/mlx5: Lag, use actual number of lag ports")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index d0871c46b8c5..cf8045b92689 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -1538,7 +1538,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
 		goto unlock;
 
 	for (i = 0; i < ldev->ports; i++) {
-		if (ldev->pf[MLX5_LAG_P1].netdev == slave) {
+		if (ldev->pf[i].netdev == slave) {
 			port = i;
 			break;
 		}
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (3 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:41   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability Tariq Toukan
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Moshe Shemesh, Maor Gottlieb, Tariq Toukan

From: Moshe Shemesh <moshe@nvidia.com>

On sync reset reload work, when remote host updates devlink on reload
actions performed on that host, it misses taking devlink lock before
calling devlink_remote_reload_actions_performed() which results in
triggering lock assert like the following:

WARNING: CPU: 4 PID: 1164 at net/devlink/core.c:261 devl_assert_locked+0x3e/0x50
…
 CPU: 4 PID: 1164 Comm: kworker/u96:6 Tainted: G S      W          6.10.0-rc2+ #116
 Hardware name: Supermicro SYS-2028TP-DECTR/X10DRT-PT, BIOS 2.0 12/18/2015
 Workqueue: mlx5_fw_reset_events mlx5_sync_reset_reload_work [mlx5_core]
 RIP: 0010:devl_assert_locked+0x3e/0x50
…
 Call Trace:
  <TASK>
  ? __warn+0xa4/0x210
  ? devl_assert_locked+0x3e/0x50
  ? report_bug+0x160/0x280
  ? handle_bug+0x3f/0x80
  ? exc_invalid_op+0x17/0x40
  ? asm_exc_invalid_op+0x1a/0x20
  ? devl_assert_locked+0x3e/0x50
  devlink_notify+0x88/0x2b0
  ? mlx5_attach_device+0x20c/0x230 [mlx5_core]
  ? __pfx_devlink_notify+0x10/0x10
  ? process_one_work+0x4b6/0xbb0
  process_one_work+0x4b6/0xbb0
[…]

Fixes: 84a433a40d0e ("net/mlx5: Lock mlx5 devlink reload callbacks")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
index 979c49ae6b5c..b43ca0b762c3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
@@ -207,6 +207,7 @@ int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev)
 static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unloaded)
 {
 	struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
+	struct devlink *devlink = priv_to_devlink(dev);
 
 	/* if this is the driver that initiated the fw reset, devlink completed the reload */
 	if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) {
@@ -218,9 +219,11 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unload
 			mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
 		else
 			mlx5_load_one(dev, true);
-		devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0,
+		devl_lock(devlink);
+		devlink_remote_reload_actions_performed(devlink, 0,
 							BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
 							BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
+		devl_unlock(devlink);
 	}
 }
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (4 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:45   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context Tariq Toukan
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Rahul Rameshbabu, Tariq Toukan

From: Rahul Rameshbabu <rrameshbabu@nvidia.com>

Require mlx5 classifier action support when creating IPSec chains in
offload path. MLX5_IPSEC_CAP_PRIO should only be set if CONFIG_MLX5_CLS_ACT
is enabled. If CONFIG_MLX5_CLS_ACT=n and MLX5_IPSEC_CAP_PRIO is set,
configuring IPsec offload will fail due to the mlxx5 ipsec chain rules
failing to be created due to lack of classifier action support.

Fixes: fa5aa2f89073 ("net/mlx5e: Use chains for IPsec policy priority offload")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
index 6e00afe4671b..797db853de36 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
@@ -51,9 +51,10 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev)
 		    MLX5_CAP_FLOWTABLE_NIC_RX(mdev, decap))
 			caps |= MLX5_IPSEC_CAP_PACKET_OFFLOAD;
 
-		if ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) &&
-		     MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) ||
-		    MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level))
+		if (IS_ENABLED(CONFIG_MLX5_CLS_ACT) &&
+		    ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) &&
+		      MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) ||
+		     MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level)))
 			caps |= MLX5_IPSEC_CAP_PRIO;
 
 		if (MLX5_CAP_FLOWTABLE_NIC_TX(mdev,
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (5 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:49   ` Wojciech Drewek
  2024-07-30  6:16 ` [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys Tariq Toukan
  2024-08-01  1:10 ` [PATCH net 0/8] mlx5 misc fixes 2024-07-30 patchwork-bot+netdevbpf
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Chris Mi,
	Tariq Toukan

From: Chris Mi <cmi@nvidia.com>

The cited commit allocates a new modify header to replace the old
one when updating CT entry. But if failed to allocate a new one, eg.
exceed the max number firmware can support, modify header will be
an error pointer that will trigger a panic when deallocating it. And
the old modify header point is copied to old attr. When the old
attr is freed, the old modify header is lost.

Fix it by restoring the old attr to attr when failed to allocate a
new modify header context. So when the CT entry is freed, the right
modify header context will be freed. And the panic of accessing
error pointer is also fixed.

Fixes: 94ceffb48eac ("net/mlx5e: Implement CT entry update")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 8cf8ba2622f2..71a168746ebe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -932,6 +932,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
 	mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, mh);
 	mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
 err_mod_hdr:
+	*attr = *old_attr;
 	kfree(old_attr);
 err_attr:
 	kvfree(spec);
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (6 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context Tariq Toukan
@ 2024-07-30  6:16 ` Tariq Toukan
  2024-07-30  9:50   ` Wojciech Drewek
  2024-08-01  1:10 ` [PATCH net 0/8] mlx5 misc fixes 2024-07-30 patchwork-bot+netdevbpf
  8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-07-30  6:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Shahar Shitrit, Carolina Jubran, Tariq Toukan

From: Shahar Shitrit <shshitrit@nvidia.com>

Since the documentation for mlx5_toggle_port_link states that it should
only be used after setting the port register, we add a check for the
return value from mlx5_port_set_eth_ptys to ensure the register was
successfully set before calling it.

Fixes: 667daedaecd1 ("net/mlx5e: Toggle link only after modifying port parameters")
Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 00d5661dc62e..36845872ae94 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1409,7 +1409,12 @@ static int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
 	if (!an_changes && link_modes == eproto.admin)
 		goto out;
 
-	mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext);
+	err = mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext);
+	if (err) {
+		netdev_err(priv->netdev, "%s: failed to set ptys reg: %d\n", __func__, err);
+		goto out;
+	}
+
 	mlx5_toggle_port_link(mdev);
 
 out:
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback
  2024-07-30  6:16 ` [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback Tariq Toukan
@ 2024-07-30  9:33   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:33 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Shay Drory,
	Moshe Shemesh



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Shay Drory <shayd@nvidia.com>
> 
> There is no point in recovery during device shutdown. if health
> work started need to wait for it to avoid races and NULL pointer
> access.
> 
> Hence, drain health WQ on shutdown callback.
> 
> Fixes: 1958fc2f0712 ("net/mlx5: SF, Add auxiliary device driver")
> Fixes: d2aa060d40fa ("net/mlx5: Cancel health poll before sending panic teardown command")
> Signed-off-by: Shay Drory <shayd@nvidia.com>
> Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/main.c          | 2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index 527da58c7953..5b7e6f4b5c7e 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -2142,7 +2142,6 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
>  	/* Panic tear down fw command will stop the PCI bus communication
>  	 * with the HCA, so the health poll is no longer needed.
>  	 */
> -	mlx5_drain_health_wq(dev);
>  	mlx5_stop_health_poll(dev, false);
>  
>  	ret = mlx5_cmd_fast_teardown_hca(dev);
> @@ -2177,6 +2176,7 @@ static void shutdown(struct pci_dev *pdev)
>  
>  	mlx5_core_info(dev, "Shutdown was called\n");
>  	set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state);
> +	mlx5_drain_health_wq(dev);
>  	err = mlx5_try_fast_unload(dev);
>  	if (err)
>  		mlx5_unload_one(dev, false);
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
> index b2986175d9af..b706f1486504 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c
> @@ -112,6 +112,7 @@ static void mlx5_sf_dev_shutdown(struct auxiliary_device *adev)
>  	struct mlx5_core_dev *mdev = sf_dev->mdev;
>  
>  	set_bit(MLX5_BREAK_FW_WAIT, &mdev->intf_state);
> +	mlx5_drain_health_wq(mdev);
>  	mlx5_unload_one(mdev, false);
>  }
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq
  2024-07-30  6:16 ` [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq Tariq Toukan
@ 2024-07-30  9:34   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:34 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Shay Drory,
	Maher Sanalla



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Shay Drory <shayd@nvidia.com>
> 
> In case mlx5_irq_alloc fails, the previously allocated index remains
> in the XArray, which could lead to inconsistencies.
> 
> Fix it by adding error handling that erases the allocated index
> from the XArray if mlx5_irq_alloc returns an error.
> 
> Fixes: c36326d38d93 ("net/mlx5: Round-Robin EQs over IRQs")
> Signed-off-by: Shay Drory <shayd@nvidia.com>
> Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> index f7b01b3f0cba..1477db7f5307 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> @@ -48,6 +48,7 @@ static struct mlx5_irq *
>  irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc)
>  {
>  	struct irq_affinity_desc auto_desc = {};
> +	struct mlx5_irq *irq;
>  	u32 irq_index;
>  	int err;
>  
> @@ -64,9 +65,12 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_de
>  		else
>  			cpu_get(pool, cpumask_first(&af_desc->mask));
>  	}
> -	return mlx5_irq_alloc(pool, irq_index,
> -			      cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
> -			      NULL);
> +	irq = mlx5_irq_alloc(pool, irq_index,
> +			     cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
> +			     NULL);
> +	if (IS_ERR(irq))
> +		xa_erase(&pool->irqs, irq_index);
> +	return irq;
>  }
>  
>  /* Looking for the IRQ with the smallest refcount that fits req_mask.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule
  2024-07-30  6:16 ` [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule Tariq Toukan
@ 2024-07-30  9:36   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:36 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Yevgeny Kliteynik, Alex Vesker



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Yevgeny Kliteynik <kliteyn@nvidia.com>
> 
> This patch reduces the size of hw_ste_arr_optimized array that is
> allocated on stack from 640 bytes (5 match STEs + 5 action STES)
> to 448 bytes (2 match STEs + 5 action STES).
> This fixes the 'stack guard page was hit' issue, while still fitting
> majority of the usecases (up to 2 match STEs).
> 
> Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
> Reviewed-by: Alex Vesker <valex@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
> index 042ca0349124..d1db04baa1fa 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
> @@ -7,7 +7,7 @@
>  /* don't try to optimize STE allocation if the stack is too constaraining */
>  #define DR_RULE_MAX_STES_OPTIMIZED 0
>  #else
> -#define DR_RULE_MAX_STES_OPTIMIZED 5
> +#define DR_RULE_MAX_STES_OPTIMIZED 2
>  #endif
>  #define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port
  2024-07-30  6:16 ` [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port Tariq Toukan
@ 2024-07-30  9:37   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:37 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Mark Bloch



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Mark Bloch <mbloch@nvidia.com>
> 
> The cited commit didn't change the body of the loop as it should.
> It shouldn't be using MLX5_LAG_P1.
> 
> Fixes: 7e978e7714d6 ("net/mlx5: Lag, use actual number of lag ports")
> Signed-off-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> index d0871c46b8c5..cf8045b92689 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> @@ -1538,7 +1538,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
>  		goto unlock;
>  
>  	for (i = 0; i < ldev->ports; i++) {
> -		if (ldev->pf[MLX5_LAG_P1].netdev == slave) {
> +		if (ldev->pf[i].netdev == slave) {
>  			port = i;
>  			break;
>  		}

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload
  2024-07-30  6:16 ` [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload Tariq Toukan
@ 2024-07-30  9:41   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:41 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Moshe Shemesh, Maor Gottlieb



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Moshe Shemesh <moshe@nvidia.com>
> 
> On sync reset reload work, when remote host updates devlink on reload
> actions performed on that host, it misses taking devlink lock before
> calling devlink_remote_reload_actions_performed() which results in
> triggering lock assert like the following:
> 
> WARNING: CPU: 4 PID: 1164 at net/devlink/core.c:261 devl_assert_locked+0x3e/0x50
> …
>  CPU: 4 PID: 1164 Comm: kworker/u96:6 Tainted: G S      W          6.10.0-rc2+ #116
>  Hardware name: Supermicro SYS-2028TP-DECTR/X10DRT-PT, BIOS 2.0 12/18/2015
>  Workqueue: mlx5_fw_reset_events mlx5_sync_reset_reload_work [mlx5_core]
>  RIP: 0010:devl_assert_locked+0x3e/0x50
> …
>  Call Trace:
>   <TASK>
>   ? __warn+0xa4/0x210
>   ? devl_assert_locked+0x3e/0x50
>   ? report_bug+0x160/0x280
>   ? handle_bug+0x3f/0x80
>   ? exc_invalid_op+0x17/0x40
>   ? asm_exc_invalid_op+0x1a/0x20
>   ? devl_assert_locked+0x3e/0x50
>   devlink_notify+0x88/0x2b0
>   ? mlx5_attach_device+0x20c/0x230 [mlx5_core]
>   ? __pfx_devlink_notify+0x10/0x10
>   ? process_one_work+0x4b6/0xbb0
>   process_one_work+0x4b6/0xbb0
> […]
> 
> Fixes: 84a433a40d0e ("net/mlx5: Lock mlx5 devlink reload callbacks")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
> index 979c49ae6b5c..b43ca0b762c3 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
> @@ -207,6 +207,7 @@ int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev)
>  static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unloaded)
>  {
>  	struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
> +	struct devlink *devlink = priv_to_devlink(dev);
>  
>  	/* if this is the driver that initiated the fw reset, devlink completed the reload */
>  	if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) {
> @@ -218,9 +219,11 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unload
>  			mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
>  		else
>  			mlx5_load_one(dev, true);
> -		devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0,
> +		devl_lock(devlink);
> +		devlink_remote_reload_actions_performed(devlink, 0,
>  							BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
>  							BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
> +		devl_unlock(devlink);
>  	}
>  }
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability
  2024-07-30  6:16 ` [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability Tariq Toukan
@ 2024-07-30  9:45   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:45 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Rahul Rameshbabu



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> 
> Require mlx5 classifier action support when creating IPSec chains in
> offload path. MLX5_IPSEC_CAP_PRIO should only be set if CONFIG_MLX5_CLS_ACT
> is enabled. If CONFIG_MLX5_CLS_ACT=n and MLX5_IPSEC_CAP_PRIO is set,
> configuring IPsec offload will fail due to the mlxx5 ipsec chain rules
> failing to be created due to lack of classifier action support.
> 
> Fixes: fa5aa2f89073 ("net/mlx5e: Use chains for IPsec policy priority offload")
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  .../ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c   | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
> index 6e00afe4671b..797db853de36 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
> @@ -51,9 +51,10 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev)
>  		    MLX5_CAP_FLOWTABLE_NIC_RX(mdev, decap))
>  			caps |= MLX5_IPSEC_CAP_PACKET_OFFLOAD;
>  
> -		if ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) &&
> -		     MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) ||
> -		    MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level))
> +		if (IS_ENABLED(CONFIG_MLX5_CLS_ACT) &&
> +		    ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) &&
> +		      MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) ||
> +		     MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level)))
>  			caps |= MLX5_IPSEC_CAP_PRIO;
>  
>  		if (MLX5_CAP_FLOWTABLE_NIC_TX(mdev,

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context
  2024-07-30  6:16 ` [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context Tariq Toukan
@ 2024-07-30  9:49   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:49 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky, Chris Mi



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Chris Mi <cmi@nvidia.com>
> 
> The cited commit allocates a new modify header to replace the old
> one when updating CT entry. But if failed to allocate a new one, eg.
> exceed the max number firmware can support, modify header will be
> an error pointer that will trigger a panic when deallocating it. And
> the old modify header point is copied to old attr. When the old
> attr is freed, the old modify header is lost.
> 
> Fix it by restoring the old attr to attr when failed to allocate a
> new modify header context. So when the CT entry is freed, the right
> modify header context will be freed. And the panic of accessing
> error pointer is also fixed.
> 
> Fixes: 94ceffb48eac ("net/mlx5e: Implement CT entry update")
> Signed-off-by: Chris Mi <cmi@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> index 8cf8ba2622f2..71a168746ebe 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> @@ -932,6 +932,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
>  	mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, mh);
>  	mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
>  err_mod_hdr:
> +	*attr = *old_attr;
>  	kfree(old_attr);
>  err_attr:
>  	kvfree(spec);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys
  2024-07-30  6:16 ` [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys Tariq Toukan
@ 2024-07-30  9:50   ` Wojciech Drewek
  0 siblings, 0 replies; 18+ messages in thread
From: Wojciech Drewek @ 2024-07-30  9:50 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet
  Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
	Shahar Shitrit, Carolina Jubran



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Shahar Shitrit <shshitrit@nvidia.com>
> 
> Since the documentation for mlx5_toggle_port_link states that it should
> only be used after setting the port register, we add a check for the
> return value from mlx5_port_set_eth_ptys to ensure the register was
> successfully set before calling it.
> 
> Fixes: 667daedaecd1 ("net/mlx5e: Toggle link only after modifying port parameters")
> Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
> Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> index 00d5661dc62e..36845872ae94 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> @@ -1409,7 +1409,12 @@ static int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
>  	if (!an_changes && link_modes == eproto.admin)
>  		goto out;
>  
> -	mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext);
> +	err = mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext);
> +	if (err) {
> +		netdev_err(priv->netdev, "%s: failed to set ptys reg: %d\n", __func__, err);
> +		goto out;
> +	}
> +
>  	mlx5_toggle_port_link(mdev);
>  
>  out:

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net 0/8] mlx5 misc fixes 2024-07-30
  2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
                   ` (7 preceding siblings ...)
  2024-07-30  6:16 ` [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys Tariq Toukan
@ 2024-08-01  1:10 ` patchwork-bot+netdevbpf
  8 siblings, 0 replies; 18+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-01  1:10 UTC (permalink / raw)
  To: Tariq Toukan; +Cc: davem, kuba, pabeni, edumazet, netdev, saeedm, gal, leonro

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 30 Jul 2024 09:16:29 +0300 you wrote:
> Hi,
> 
> This patchset provides misc bug fixes from the team to the mlx5 core and
> Eth drivers.
> 
> Series generated against:
> commit 301927d2d2eb ("Merge tag 'for-net-2024-07-26' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth")
> 
> [...]

Here is the summary with links:
  - [net,1/8] net/mlx5: Always drain health in shutdown callback
    https://git.kernel.org/netdev/net/c/1b75da22ed1e
  - [net,2/8] net/mlx5: Fix error handling in irq_pool_request_irq
    https://git.kernel.org/netdev/net/c/a4557b0b57c4
  - [net,3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule
    https://git.kernel.org/netdev/net/c/94a3ad6c0813
  - [net,4/8] net/mlx5: Lag, don't use the hardcoded value of the first port
    https://git.kernel.org/netdev/net/c/3fda84dc0903
  - [net,5/8] net/mlx5: Fix missing lock on sync reset reload
    https://git.kernel.org/netdev/net/c/572f9caa9e72
  - [net,6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability
    https://git.kernel.org/netdev/net/c/06827e27fdcd
  - [net,7/8] net/mlx5e: Fix CT entry update leaks of modify header context
    https://git.kernel.org/netdev/net/c/025f2b85a5e5
  - [net,8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys
    https://git.kernel.org/netdev/net/c/3f8e82a020a5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-08-01  1:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30  6:16 [PATCH net 0/8] mlx5 misc fixes 2024-07-30 Tariq Toukan
2024-07-30  6:16 ` [PATCH net 1/8] net/mlx5: Always drain health in shutdown callback Tariq Toukan
2024-07-30  9:33   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 2/8] net/mlx5: Fix error handling in irq_pool_request_irq Tariq Toukan
2024-07-30  9:34   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 3/8] net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule Tariq Toukan
2024-07-30  9:36   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 4/8] net/mlx5: Lag, don't use the hardcoded value of the first port Tariq Toukan
2024-07-30  9:37   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 5/8] net/mlx5: Fix missing lock on sync reset reload Tariq Toukan
2024-07-30  9:41   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 6/8] net/mlx5e: Require mlx5 tc classifier action support for IPsec prio capability Tariq Toukan
2024-07-30  9:45   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 7/8] net/mlx5e: Fix CT entry update leaks of modify header context Tariq Toukan
2024-07-30  9:49   ` Wojciech Drewek
2024-07-30  6:16 ` [PATCH net 8/8] net/mlx5e: Add a check for the return value from mlx5_port_set_eth_ptys Tariq Toukan
2024-07-30  9:50   ` Wojciech Drewek
2024-08-01  1:10 ` [PATCH net 0/8] mlx5 misc fixes 2024-07-30 patchwork-bot+netdevbpf

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).