All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29
@ 2020-04-29 22:54 Saeed Mahameed
  2020-04-29 22:54 ` [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure Saeed Mahameed
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

This series introduces some fixes to mlx5 driver.

Please pull and let me know if there is any problem.

For -stable v4.12
 ('net/mlx5: Fix forced completion access non initialized command entry')
 ('net/mlx5: Fix command entry leak in Internal Error State')

For -stable v5.4
 ('net/mlx5: DR, On creation set CQ's arm_db member to right value')
 ('net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow')

For -stable v5.6
 ('net/mlx5e: Fix q counters on uplink representors')

Thanks,
Saeed.

---
The following changes since commit 42c556fef92361bbc58be22f91b1c49db0963c34:

  mptcp: replace mptcp_disconnect with a stub (2020-04-29 12:39:49 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2020-04-29

for you to fetch changes up to e77ccbe791c7e51db388a6e5a4f9f5b2ca484acf:

  net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow (2020-04-29 15:11:03 -0700)

----------------------------------------------------------------
mlx5-fixes-2020-04-29

----------------------------------------------------------------
Erez Shitrit (1):
      net/mlx5: DR, On creation set CQ's arm_db member to right value

Moshe Shemesh (2):
      net/mlx5: Fix forced completion access non initialized command entry
      net/mlx5: Fix command entry leak in Internal Error State

Parav Pandit (3):
      net/mlx5: E-switch, Fix error unwinding flow for steering init failure
      net/mlx5: E-switch, Fix printing wrong error value
      net/mlx5: E-switch, Fix mutex init order

Roi Dayan (1):
      net/mlx5e: Fix q counters on uplink representors

Tariq Toukan (1):
      net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow

 drivers/net/ethernet/mellanox/mlx5/core/cmd.c          |  6 +++++-
 .../net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c |  7 ++++++-
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c       |  9 ++-------
 .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 18 +++++++++---------
 .../net/ethernet/mellanox/mlx5/core/steering/dr_send.c | 14 +++++++++++++-
 5 files changed, 35 insertions(+), 19 deletions(-)

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

* [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 2/8] net/mlx5: E-switch, Fix printing wrong error value Saeed Mahameed
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Roi Dayan, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Error unwinding is done incorrectly in the cited commit.
When steering init fails, there is no need to perform steering cleanup.
When vport error exists, error cleanup should be mirror of the setup
routine, i.e. to perform steering cleanup before metadata cleanup.

This avoids the call trace in accessing uninitialized objects which are
skipped during steering_init() due to failure in steering_init().

Call trace:
mlx5_cmd_modify_header_alloc:805:(pid 21128): too many modify header
actions 1, max supported 0
E-Switch: Failed to create restore mod header

BUG: kernel NULL pointer dereference, address: 00000000000000d0
[  677.263079]  mlx5_destroy_flow_group+0x13/0x80 [mlx5_core]
[  677.268921]  esw_offloads_steering_cleanup+0x51/0xf0 [mlx5_core]
[  677.275281]  esw_offloads_enable+0x1a5/0x800 [mlx5_core]
[  677.280949]  mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core]
[  677.287227]  mlx5_devlink_eswitch_mode_set+0x1af/0x320
[  677.293741]  devlink_nl_cmd_eswitch_set_doit+0x41/0xb0
[  677.299217]  genl_rcv_msg+0x1eb/0x430

Fixes: 7983a675ba65 ("net/mlx5: E-Switch, Enable chains only if regs loopback is enabled")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index b2e38e0cde97..94d6c91a8612 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2377,9 +2377,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 err_vports:
 	esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
 err_uplink:
-	esw_set_passing_vport_metadata(esw, false);
-err_steering_init:
 	esw_offloads_steering_cleanup(esw);
+err_steering_init:
+	esw_set_passing_vport_metadata(esw, false);
 err_vport_metadata:
 	mlx5_rdma_disable_roce(esw->dev);
 	mutex_destroy(&esw->offloads.termtbl_mutex);
-- 
2.25.4


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

* [net 2/8] net/mlx5: E-switch, Fix printing wrong error value
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
  2020-04-29 22:54 ` [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 3/8] net/mlx5: E-switch, Fix mutex init order Saeed Mahameed
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Roi Dayan, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

When mlx5_modify_header_alloc() fails, instead of printing the error
value returned, current error log prints 0.

Fix by printing correct error value returned by
mlx5_modify_header_alloc().

Fixes: 6724e66b90ee ("net/mlx5: E-Switch, Get reg_c1 value on miss")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 94d6c91a8612..8289af360e8d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1550,9 +1550,9 @@ static int esw_create_restore_table(struct mlx5_eswitch *esw)
 					   MLX5_FLOW_NAMESPACE_KERNEL, 1,
 					   modact);
 	if (IS_ERR(mod_hdr)) {
+		err = PTR_ERR(mod_hdr);
 		esw_warn(dev, "Failed to create restore mod header, err: %d\n",
 			 err);
-		err = PTR_ERR(mod_hdr);
 		goto err_mod_hdr;
 	}
 
-- 
2.25.4


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

* [net 3/8] net/mlx5: E-switch, Fix mutex init order
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
  2020-04-29 22:54 ` [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure Saeed Mahameed
  2020-04-29 22:54 ` [net 2/8] net/mlx5: E-switch, Fix printing wrong error value Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 4/8] net/mlx5: DR, On creation set CQ's arm_db member to right value Saeed Mahameed
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Parav Pandit, Roi Dayan, Eli Cohen, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

In cited patch mutex is initialized after its used.
Below call trace is observed.
Fix the order to initialize the mutex early enough.
Similarly follow mirror sequence during cleanup.

kernel: DEBUG_LOCKS_WARN_ON(lock->magic != lock)
kernel: WARNING: CPU: 5 PID: 45916 at kernel/locking/mutex.c:938
__mutex_lock+0x7d6/0x8a0
kernel: Call Trace:
kernel: ? esw_vport_tbl_get+0x3b/0x250 [mlx5_core]
kernel: ? mark_held_locks+0x55/0x70
kernel: ? __slab_free+0x274/0x400
kernel: ? lockdep_hardirqs_on+0x140/0x1d0
kernel: esw_vport_tbl_get+0x3b/0x250 [mlx5_core]
kernel: ? mlx5_esw_chains_create_fdb_prio+0xa57/0xc20 [mlx5_core]
kernel: mlx5_esw_vport_tbl_get+0x88/0xf0 [mlx5_core]
kernel: mlx5_esw_chains_create+0x2f3/0x3e0 [mlx5_core]
kernel: esw_create_offloads_fdb_tables+0x11d/0x580 [mlx5_core]
kernel: esw_offloads_enable+0x26d/0x540 [mlx5_core]
kernel: mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core]
kernel: mlx5_devlink_eswitch_mode_set+0x1af/0x320 [mlx5_core]
kernel: devlink_nl_cmd_eswitch_set_doit+0x41/0xb0

Fixes: 96e326878fa5 ("net/mlx5e: Eswitch, Use per vport tables for mirroring")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 8289af360e8d..5d9def18ae3a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2219,10 +2219,12 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
 		total_vports = num_vfs + MLX5_SPECIAL_VPORTS(esw->dev);
 
 	memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
+	mutex_init(&esw->fdb_table.offloads.vports.lock);
+	hash_init(esw->fdb_table.offloads.vports.table);
 
 	err = esw_create_uplink_offloads_acl_tables(esw);
 	if (err)
-		return err;
+		goto create_acl_err;
 
 	err = esw_create_offloads_table(esw, total_vports);
 	if (err)
@@ -2240,9 +2242,6 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
 	if (err)
 		goto create_fg_err;
 
-	mutex_init(&esw->fdb_table.offloads.vports.lock);
-	hash_init(esw->fdb_table.offloads.vports.table);
-
 	return 0;
 
 create_fg_err:
@@ -2253,18 +2252,19 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
 	esw_destroy_offloads_table(esw);
 create_offloads_err:
 	esw_destroy_uplink_offloads_acl_tables(esw);
-
+create_acl_err:
+	mutex_destroy(&esw->fdb_table.offloads.vports.lock);
 	return err;
 }
 
 static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw)
 {
-	mutex_destroy(&esw->fdb_table.offloads.vports.lock);
 	esw_destroy_vport_rx_group(esw);
 	esw_destroy_offloads_fdb_tables(esw);
 	esw_destroy_restore_table(esw);
 	esw_destroy_offloads_table(esw);
 	esw_destroy_uplink_offloads_acl_tables(esw);
+	mutex_destroy(&esw->fdb_table.offloads.vports.lock);
 }
 
 static void
-- 
2.25.4


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

* [net 4/8] net/mlx5: DR, On creation set CQ's arm_db member to right value
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2020-04-29 22:54 ` [net 3/8] net/mlx5: E-switch, Fix mutex init order Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 5/8] net/mlx5: Fix forced completion access non initialized command entry Saeed Mahameed
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Erez Shitrit, Tariq Toukan, Alex Vesker, Saeed Mahameed

From: Erez Shitrit <erezsh@mellanox.com>

In polling mode, set arm_db member to a value that will avoid CQ
event recovery by the HW.
Otherwise we might get event without completion function.
In addition,empty completion function to was added to protect from
unexpected events.

Fixes: 297cccebdc5a ("net/mlx5: DR, Expose an internal API to issue RDMA operations")
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/steering/dr_send.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
index c0ab9cf74929..18719acb7e54 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
@@ -695,6 +695,12 @@ static void dr_cq_event(struct mlx5_core_cq *mcq,
 	pr_info("CQ event %u on CQ #%u\n", event, mcq->cqn);
 }
 
+static void dr_cq_complete(struct mlx5_core_cq *mcq,
+			   struct mlx5_eqe *eqe)
+{
+	pr_err("CQ completion CQ: #%u\n", mcq->cqn);
+}
+
 static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
 				      struct mlx5_uars_page *uar,
 				      size_t ncqe)
@@ -756,6 +762,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
 	mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, pas);
 
 	cq->mcq.event = dr_cq_event;
+	cq->mcq.comp  = dr_cq_complete;
 
 	err = mlx5_core_create_cq(mdev, &cq->mcq, in, inlen, out, sizeof(out));
 	kvfree(in);
@@ -767,7 +774,12 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
 	cq->mcq.set_ci_db = cq->wq_ctrl.db.db;
 	cq->mcq.arm_db = cq->wq_ctrl.db.db + 1;
 	*cq->mcq.set_ci_db = 0;
-	*cq->mcq.arm_db = 0;
+
+	/* set no-zero value, in order to avoid the HW to run db-recovery on
+	 * CQ that used in polling mode.
+	 */
+	*cq->mcq.arm_db = cpu_to_be32(2 << 28);
+
 	cq->mcq.vector = 0;
 	cq->mcq.irqn = irqn;
 	cq->mcq.uar = uar;
-- 
2.25.4


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

* [net 5/8] net/mlx5: Fix forced completion access non initialized command entry
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2020-04-29 22:54 ` [net 4/8] net/mlx5: DR, On creation set CQ's arm_db member to right value Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 6/8] net/mlx5: Fix command entry leak in Internal Error State Saeed Mahameed
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Eran Ben Elisha, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

mlx5_cmd_flush() will trigger forced completions to all valid command
entries. Triggered by an asynch event such as fast teardown it can
happen at any stage of the command, including command initialization.
It will trigger forced completion and that can lead to completion on an
uninitialized command entry.

Setting MLX5_CMD_ENT_STATE_PENDING_COMP only after command entry is
initialized will ensure force completion is treated only if command
entry is initialized.

Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 34cba97f7bf4..d7470f8d355e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -888,7 +888,6 @@ static void cmd_work_handler(struct work_struct *work)
 	}
 
 	cmd->ent_arr[ent->idx] = ent;
-	set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
 	lay = get_inst(cmd, ent->idx);
 	ent->lay = lay;
 	memset(lay, 0, sizeof(*lay));
@@ -910,6 +909,7 @@ static void cmd_work_handler(struct work_struct *work)
 
 	if (ent->callback)
 		schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
+	set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
 
 	/* Skip sending command to fw if internal error */
 	if (pci_channel_offline(dev->pdev) ||
-- 
2.25.4


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

* [net 6/8] net/mlx5: Fix command entry leak in Internal Error State
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2020-04-29 22:54 ` [net 5/8] net/mlx5: Fix forced completion access non initialized command entry Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 7/8] net/mlx5e: Fix q counters on uplink representors Saeed Mahameed
  2020-04-29 22:54 ` [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow Saeed Mahameed
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Eran Ben Elisha, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Processing commands by cmd_work_handler() while already in Internal
Error State will result in entry leak, since the handler process force
completion without doorbell. Forced completion doesn't release the entry
and event completion will never arrive, so entry should be released.

Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index d7470f8d355e..cede5bdfd598 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -922,6 +922,10 @@ static void cmd_work_handler(struct work_struct *work)
 		MLX5_SET(mbox_out, ent->out, syndrome, drv_synd);
 
 		mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
+		/* no doorbell, no need to keep the entry */
+		free_ent(cmd, ent->idx);
+		if (ent->callback)
+			free_cmd(ent);
 		return;
 	}
 
-- 
2.25.4


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

* [net 7/8] net/mlx5e: Fix q counters on uplink representors
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2020-04-29 22:54 ` [net 6/8] net/mlx5: Fix command entry leak in Internal Error State Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-29 22:54 ` [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow Saeed Mahameed
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Vlad Buslov, Saeed Mahameed

From: Roi Dayan <roid@mellanox.com>

Need to allocate the q counters before init_rx which needs them
when creating the rq.

Fixes: 8520fa57a4e9 ("net/mlx5e: Create q counters on uplink representors")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 55457f268495..f372e94948fd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1773,19 +1773,14 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv)
 
 static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv)
 {
-	int err = mlx5e_init_rep_rx(priv);
-
-	if (err)
-		return err;
-
 	mlx5e_create_q_counters(priv);
-	return 0;
+	return mlx5e_init_rep_rx(priv);
 }
 
 static void mlx5e_cleanup_ul_rep_rx(struct mlx5e_priv *priv)
 {
-	mlx5e_destroy_q_counters(priv);
 	mlx5e_cleanup_rep_rx(priv);
+	mlx5e_destroy_q_counters(priv);
 }
 
 static int mlx5e_init_uplink_rep_tx(struct mlx5e_rep_priv *rpriv)
-- 
2.25.4


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

* [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow
  2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2020-04-29 22:54 ` [net 7/8] net/mlx5e: Fix q counters on uplink representors Saeed Mahameed
@ 2020-04-29 22:54 ` Saeed Mahameed
  2020-04-30  0:12   ` Jakub Kicinski
  7 siblings, 1 reply; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-29 22:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Boris Pismenny, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

SKBs of TLS records might have empty zero-sized frags.
Posting a DUMP WQE for such frag would result an error completion.
Add in-driver resiliency and skip such frags.

Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
index 52a56622034a..a04fa23e1a53 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
@@ -232,9 +232,14 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
 	remaining = info->sync_len;
 	while (remaining > 0) {
 		skb_frag_t *frag = &record->frags[i];
+		unsigned int fsz;
+
+		fsz = skb_frag_size(frag);
+		if (unlikely(!fsz))
+			continue;
 
 		get_page(skb_frag_page(frag));
-		remaining -= skb_frag_size(frag);
+		remaining -= fsz;
 		info->frags[i++] = *frag;
 	}
 	/* reduce the part which will be sent with the original SKB */
-- 
2.25.4


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

* Re: [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow
  2020-04-29 22:54 ` [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow Saeed Mahameed
@ 2020-04-30  0:12   ` Jakub Kicinski
  2020-04-30  8:22     ` Tariq Toukan
  0 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2020-04-30  0:12 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: David S. Miller, netdev, Tariq Toukan, Boris Pismenny

On Wed, 29 Apr 2020 15:54:49 -0700 Saeed Mahameed wrote:
> From: Tariq Toukan <tariqt@mellanox.com>
> 
> SKBs of TLS records might have empty zero-sized frags.

Why? Let's fix that instead of adding checks to drivers.

> Posting a DUMP WQE for such frag would result an error completion.
> Add in-driver resiliency and skip such frags.
> 
> Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")

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

* Re: [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow
  2020-04-30  0:12   ` Jakub Kicinski
@ 2020-04-30  8:22     ` Tariq Toukan
  2020-04-30 15:37       ` Saeed Mahameed
  0 siblings, 1 reply; 12+ messages in thread
From: Tariq Toukan @ 2020-04-30  8:22 UTC (permalink / raw)
  To: Jakub Kicinski, Saeed Mahameed
  Cc: David S. Miller, netdev, Tariq Toukan, Boris Pismenny



On 4/30/2020 3:12 AM, Jakub Kicinski wrote:
> On Wed, 29 Apr 2020 15:54:49 -0700 Saeed Mahameed wrote:
>> From: Tariq Toukan <tariqt@mellanox.com>
>>
>> SKBs of TLS records might have empty zero-sized frags.
> 
> Why? Let's fix that instead of adding checks to drivers.
> 

Hi Jakub,

The HW spec requires the DUMP size to be non-zero, this patch comes to 
guarantee this in driver.
In kernel stack, having zero-side fragments is for sure non-optimal 
practice, but still could be considered valid and tolerated.
I agree that we should find the source of this practice in stack and 
enhance it.

Thanks,
Tariq

>> Posting a DUMP WQE for such frag would result an error completion.
>> Add in-driver resiliency and skip such frags.
>>
>> Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")

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

* Re: [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow
  2020-04-30  8:22     ` Tariq Toukan
@ 2020-04-30 15:37       ` Saeed Mahameed
  0 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2020-04-30 15:37 UTC (permalink / raw)
  To: kuba, Tariq Toukan; +Cc: Boris Pismenny, davem, netdev

On Thu, 2020-04-30 at 11:22 +0300, Tariq Toukan wrote:
> 
> On 4/30/2020 3:12 AM, Jakub Kicinski wrote:
> > On Wed, 29 Apr 2020 15:54:49 -0700 Saeed Mahameed wrote:
> > > From: Tariq Toukan <tariqt@mellanox.com>
> > > 
> > > SKBs of TLS records might have empty zero-sized frags.
> > 
> > Why? Let's fix that instead of adding checks to drivers.
> > 
> 
> Hi Jakub,
> 
> The HW spec requires the DUMP size to be non-zero, this patch comes
> to 
> guarantee this in driver.
> In kernel stack, having zero-side fragments is for sure non-optimal 
> practice, but still could be considered valid and tolerated.
> I agree that we should find the source of this practice in stack and 
> enhance it.
> 

Ok then, let's find the source, i will drop this patch for now..
We should aim for less driver code duplication, if this is something
that can be guaranteed by the ktls stack.


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

end of thread, other threads:[~2020-04-30 15:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 22:54 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-29 Saeed Mahameed
2020-04-29 22:54 ` [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure Saeed Mahameed
2020-04-29 22:54 ` [net 2/8] net/mlx5: E-switch, Fix printing wrong error value Saeed Mahameed
2020-04-29 22:54 ` [net 3/8] net/mlx5: E-switch, Fix mutex init order Saeed Mahameed
2020-04-29 22:54 ` [net 4/8] net/mlx5: DR, On creation set CQ's arm_db member to right value Saeed Mahameed
2020-04-29 22:54 ` [net 5/8] net/mlx5: Fix forced completion access non initialized command entry Saeed Mahameed
2020-04-29 22:54 ` [net 6/8] net/mlx5: Fix command entry leak in Internal Error State Saeed Mahameed
2020-04-29 22:54 ` [net 7/8] net/mlx5e: Fix q counters on uplink representors Saeed Mahameed
2020-04-29 22:54 ` [net 8/8] net/mlx5e: kTLS, Add resiliency to zero-size record frags in TX resync flow Saeed Mahameed
2020-04-30  0:12   ` Jakub Kicinski
2020-04-30  8:22     ` Tariq Toukan
2020-04-30 15:37       ` Saeed Mahameed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.