netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08
@ 2020-04-08 22:51 Saeed Mahameed
  2020-04-08 22:51 ` [net 1/8] net/mlx5: Fix frequent ioread PCI access during recovery Saeed Mahameed
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 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 v5.3
 ('net/mlx5: Fix frequent ioread PCI access during recovery')
 ('net/mlx5e: Add missing release firmware call')

For -stable v5.4
 ('net/mlx5e: Fix nest_level for vlan pop action')
 ('net/mlx5e: Fix pfnum in devlink port attribute')

Thanks,
Saeed.

---
The following changes since commit f691a25ce5e5e405156ad4091c8e660b2622b7ad:

  net/tls: fix const assignment warning (2020-04-08 14:34:02 -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-08

for you to fetch changes up to 9808dd0a2aeebcb72239a3b082159b0186d9ac3d:

  net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list (2020-04-08 15:46:54 -0700)

----------------------------------------------------------------
mlx5-fixes-2020-04-08

----------------------------------------------------------------
Dmytro Linkin (1):
      net/mlx5e: Fix nest_level for vlan pop action

Eli Cohen (1):
      net/mlx5: Fix condition for termination table cleanup

Eran Ben Elisha (1):
      net/mlx5e: Add missing release firmware call

Moshe Shemesh (1):
      net/mlx5: Fix frequent ioread PCI access during recovery

Parav Pandit (2):
      net/mlx5e: Fix pfnum in devlink port attribute
      net/mlx5e: Fix devlink port netdev unregistration sequence

Paul Blakey (1):
      net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list

Roi Dayan (1):
      net/mlx5e: Fix missing pedit action after ct clear action

 drivers/net/ethernet/mellanox/mlx5/core/devlink.c     |  5 ++++-
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c    | 19 +++++++------------
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c     |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c      |  9 +++++----
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c       |  8 +++++---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h     |  1 -
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c    | 12 +++---------
 drivers/net/ethernet/mellanox/mlx5/core/health.c      |  2 +-
 8 files changed, 26 insertions(+), 32 deletions(-)

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

* [net 1/8] net/mlx5: Fix frequent ioread PCI access during recovery
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 2/8] net/mlx5: Fix condition for termination table cleanup Saeed Mahameed
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Feras Daoud, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

High frequency of PCI ioread calls during recovery flow may cause the
following trace on powerpc:

[ 248.670288] EEH: 2100000 reads ignored for recovering device at
location=Slot1 driver=mlx5_core pci addr=0000:01:00.1
[ 248.670331] EEH: Might be infinite loop in mlx5_core driver
[ 248.670361] CPU: 2 PID: 35247 Comm: kworker/u192:11 Kdump: loaded
Tainted: G OE ------------ 4.14.0-115.14.1.el7a.ppc64le #1
[ 248.670425] Workqueue: mlx5_health0000:01:00.1 health_recover_work
[mlx5_core]
[ 248.670471] Call Trace:
[ 248.670492] [c00020391c11b960] [c000000000c217ac] dump_stack+0xb0/0xf4
(unreliable)
[ 248.670548] [c00020391c11b9a0] [c000000000045818]
eeh_check_failure+0x5c8/0x630
[ 248.670631] [c00020391c11ba50] [c00000000068fce4]
ioread32be+0x114/0x1c0
[ 248.670692] [c00020391c11bac0] [c00800000dd8b400]
mlx5_error_sw_reset+0x160/0x510 [mlx5_core]
[ 248.670752] [c00020391c11bb60] [c00800000dd75824]
mlx5_disable_device+0x34/0x1d0 [mlx5_core]
[ 248.670822] [c00020391c11bbe0] [c00800000dd8affc]
health_recover_work+0x11c/0x3c0 [mlx5_core]
[ 248.670891] [c00020391c11bc80] [c000000000164fcc]
process_one_work+0x1bc/0x5f0
[ 248.670955] [c00020391c11bd20] [c000000000167f8c]
worker_thread+0xac/0x6b0
[ 248.671015] [c00020391c11bdc0] [c000000000171618] kthread+0x168/0x1b0
[ 248.671067] [c00020391c11be30] [c00000000000b65c]
ret_from_kernel_thread+0x5c/0x80

Reduce the PCI ioread frequency during recovery by using msleep()
instead of cond_resched()

Fixes: 3e5b72ac2f29 ("net/mlx5: Issue SW reset on FW assert")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index fa1665caac46..f99e1752d4e5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -243,7 +243,7 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
 		if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
 			break;
 
-		cond_resched();
+		msleep(20);
 	} while (!time_after(jiffies, end));
 
 	if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {
-- 
2.25.1


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

* [net 2/8] net/mlx5: Fix condition for termination table cleanup
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
  2020-04-08 22:51 ` [net 1/8] net/mlx5: Fix frequent ioread PCI access during recovery Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 3/8] net/mlx5e: Add missing release firmware call Saeed Mahameed
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eli Cohen, Oz Shlomo, Saeed Mahameed

From: Eli Cohen <eli@mellanox.com>

When we destroy rules from slow path we need to avoid destroying
termination tables since termination tables are never created in slow
path. By doing so we avoid destroying the termination table created for the
slow path.

Fixes: d8a2034f152a ("net/mlx5: Don't use termination tables in slow path")
Signed-off-by: Eli Cohen <eli@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h    |  1 -
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c   | 12 +++---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index 39f42f985fbd..c1848b57f61c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -403,7 +403,6 @@ enum {
 	MLX5_ESW_ATTR_FLAG_VLAN_HANDLED  = BIT(0),
 	MLX5_ESW_ATTR_FLAG_SLOW_PATH     = BIT(1),
 	MLX5_ESW_ATTR_FLAG_NO_IN_PORT    = BIT(2),
-	MLX5_ESW_ATTR_FLAG_HAIRPIN	 = BIT(3),
 };
 
 struct mlx5_esw_flow_attr {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index f171eb2234b0..b2e38e0cde97 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -300,7 +300,6 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
 	bool split = !!(attr->split_count);
 	struct mlx5_flow_handle *rule;
 	struct mlx5_flow_table *fdb;
-	bool hairpin = false;
 	int j, i = 0;
 
 	if (esw->mode != MLX5_ESWITCH_OFFLOADS)
@@ -398,21 +397,16 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
 		goto err_esw_get;
 	}
 
-	if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) {
+	if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec))
 		rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr,
 						     &flow_act, dest, i);
-		hairpin = true;
-	} else {
+	else
 		rule = mlx5_add_flow_rules(fdb, spec, &flow_act, dest, i);
-	}
 	if (IS_ERR(rule))
 		goto err_add_rule;
 	else
 		atomic64_inc(&esw->offloads.num_flows);
 
-	if (hairpin)
-		attr->flags |= MLX5_ESW_ATTR_FLAG_HAIRPIN;
-
 	return rule;
 
 err_add_rule:
@@ -501,7 +495,7 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
 
 	mlx5_del_flow_rules(rule);
 
-	if (attr->flags & MLX5_ESW_ATTR_FLAG_HAIRPIN) {
+	if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)) {
 		/* unref the term table */
 		for (i = 0; i < MLX5_MAX_FLOW_FWD_VPORTS; i++) {
 			if (attr->dests[i].termtbl)
-- 
2.25.1


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

* [net 3/8] net/mlx5e: Add missing release firmware call
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
  2020-04-08 22:51 ` [net 1/8] net/mlx5: Fix frequent ioread PCI access during recovery Saeed Mahameed
  2020-04-08 22:51 ` [net 2/8] net/mlx5: Fix condition for termination table cleanup Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 4/8] net/mlx5e: Fix nest_level for vlan pop action Saeed Mahameed
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Aya Levin, Saeed Mahameed

From: Eran Ben Elisha <eranbe@mellanox.com>

Once driver finishes flashing the firmware image, it should release it.

Fixes: 9c8bca2637b8 ("mlx5: Move firmware flash implementation to devlink")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Aya Levin <ayal@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index bdeb291f6b67..e94f0c4d74a7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -23,7 +23,10 @@ static int mlx5_devlink_flash_update(struct devlink *devlink,
 	if (err)
 		return err;
 
-	return mlx5_firmware_flash(dev, fw, extack);
+	err = mlx5_firmware_flash(dev, fw, extack);
+	release_firmware(fw);
+
+	return err;
 }
 
 static u8 mlx5_fw_ver_major(u32 version)
-- 
2.25.1


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

* [net 4/8] net/mlx5e: Fix nest_level for vlan pop action
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2020-04-08 22:51 ` [net 3/8] net/mlx5e: Add missing release firmware call Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 5/8] net/mlx5e: Fix missing pedit action after ct clear action Saeed Mahameed
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Dmytro Linkin, Roi Dayan, Saeed Mahameed

From: Dmytro Linkin <dmitrolin@mellanox.com>

Current value of nest_level, assigned from net_device lower_level value,
does not reflect the actual number of vlan headers, needed to pop.
For ex., if we have untagged ingress traffic sended over vlan devices,
instead of one pop action, driver will perform two pop actions.
To fix that, calculate nest_level as difference between vlan device and
parent device lower_levels.

Fixes: f3b0a18bb6cb ("net: remove unnecessary variables and callback")
Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 438128dde187..e3fee837c7a3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -3558,12 +3558,13 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv,
 			       struct mlx5_esw_flow_attr *attr,
 			       u32 *action)
 {
-	int nest_level = attr->parse_attr->filter_dev->lower_level;
 	struct flow_action_entry vlan_act = {
 		.id = FLOW_ACTION_VLAN_POP,
 	};
-	int err = 0;
+	int nest_level, err = 0;
 
+	nest_level = attr->parse_attr->filter_dev->lower_level -
+						priv->netdev->lower_level;
 	while (nest_level--) {
 		err = parse_tc_vlan_action(priv, &vlan_act, attr, action);
 		if (err)
-- 
2.25.1


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

* [net 5/8] net/mlx5e: Fix missing pedit action after ct clear action
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2020-04-08 22:51 ` [net 4/8] net/mlx5e: Fix nest_level for vlan pop action Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 6/8] net/mlx5e: Fix pfnum in devlink port attribute Saeed Mahameed
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Paul Blakey, Saeed Mahameed

From: Roi Dayan <roid@mellanox.com>

With ct clear action we should not allocate the action in hw
and not release the mod_acts parsed in advance.
It will be done when handling the ct clear action.

Fixes: 1ef3018f5af3 ("net/mlx5e: CT: Support clear action")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index e3fee837c7a3..a574c588269a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1343,7 +1343,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
 	if (err)
 		return err;
 
-	if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
+	if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
+	    !(attr->ct_attr.ct_action & TCA_CT_ACT_CLEAR)) {
 		err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
 		dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts);
 		if (err)
-- 
2.25.1


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

* [net 6/8] net/mlx5e: Fix pfnum in devlink port attribute
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2020-04-08 22:51 ` [net 5/8] net/mlx5e: Fix missing pedit action after ct clear action Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 7/8] net/mlx5e: Fix devlink port netdev unregistration sequence Saeed Mahameed
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Jiri Pirko, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Cited patch missed to extract PCI pf number accurately for PF and VF
port flavour. It considered PCI device + function number.
Due to this, device having non zero device number shown large pfnum.

Hence, use only PCI function number; to avoid similar errors, derive
pfnum one time for all port flavours.

Fixes: f60f315d339e ("net/mlx5e: Register devlink ports for physical link, PCI PF, VFs")
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 2a0243e4af75..55457f268495 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -2050,29 +2050,30 @@ static int register_devlink_port(struct mlx5_core_dev *dev,
 	struct mlx5_eswitch_rep *rep = rpriv->rep;
 	struct netdev_phys_item_id ppid = {};
 	unsigned int dl_port_index = 0;
+	u16 pfnum;
 
 	if (!is_devlink_port_supported(dev, rpriv))
 		return 0;
 
 	mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid);
+	pfnum = PCI_FUNC(dev->pdev->devfn);
 
 	if (rep->vport == MLX5_VPORT_UPLINK) {
 		devlink_port_attrs_set(&rpriv->dl_port,
 				       DEVLINK_PORT_FLAVOUR_PHYSICAL,
-				       PCI_FUNC(dev->pdev->devfn), false, 0,
+				       pfnum, false, 0,
 				       &ppid.id[0], ppid.id_len);
 		dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
 	} else if (rep->vport == MLX5_VPORT_PF) {
 		devlink_port_attrs_pci_pf_set(&rpriv->dl_port,
 					      &ppid.id[0], ppid.id_len,
-					      dev->pdev->devfn);
+					      pfnum);
 		dl_port_index = rep->vport;
 	} else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch,
 					    rpriv->rep->vport)) {
 		devlink_port_attrs_pci_vf_set(&rpriv->dl_port,
 					      &ppid.id[0], ppid.id_len,
-					      dev->pdev->devfn,
-					      rep->vport - 1);
+					      pfnum, rep->vport - 1);
 		dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
 	}
 
-- 
2.25.1


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

* [net 7/8] net/mlx5e: Fix devlink port netdev unregistration sequence
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2020-04-08 22:51 ` [net 6/8] net/mlx5e: Fix pfnum in devlink port attribute Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-08 22:51 ` [net 8/8] net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list Saeed Mahameed
  2020-04-09 17:07 ` [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Jiri Pirko, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

In cited commit netdevice is registered after devlink port.

Unregistration flow should be mirror sequence of registration flow.
Hence, unregister netdevice before devlink port.

Fixes: 31e87b39ba9d ("net/mlx5e: Fix devlink port register sequence")
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index dd7f338425eb..f02150a97ac8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5526,8 +5526,8 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
 #ifdef CONFIG_MLX5_CORE_EN_DCB
 	mlx5e_dcbnl_delete_app(priv);
 #endif
-	mlx5e_devlink_port_unregister(priv);
 	unregister_netdev(priv->netdev);
+	mlx5e_devlink_port_unregister(priv);
 	mlx5e_detach(mdev, vpriv);
 	mlx5e_destroy_netdev(priv);
 }
-- 
2.25.1


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

* [net 8/8] net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2020-04-08 22:51 ` [net 7/8] net/mlx5e: Fix devlink port netdev unregistration sequence Saeed Mahameed
@ 2020-04-08 22:51 ` Saeed Mahameed
  2020-04-09 17:07 ` [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2020-04-08 22:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Paul Blakey, Oz Shlomo, Saeed Mahameed

From: Paul Blakey <paulb@mellanox.com>

Fixes CT entries list corruption.

After allowing parallel insertion/removals in upper nf flow table
layer, unprotected ct entries list can be corrupted by parallel add/del
on the same flow table.

CT entries list is only used while freeing a ct zone flow table to
go over all the ct entries offloaded on that zone/table, and flush
the table.

As rhashtable already provides an api to go over all the inserted entries,
fix the race by using the rhashtable iteration instead, and remove the list.

Fixes: 7da182a998d6 ("netfilter: flowtable: Use work entry per offload command")
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc_ct.c    | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

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 ad3e3a65d403..16416eaac39e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -67,11 +67,9 @@ struct mlx5_ct_ft {
 	struct nf_flowtable *nf_ft;
 	struct mlx5_tc_ct_priv *ct_priv;
 	struct rhashtable ct_entries_ht;
-	struct list_head ct_entries_list;
 };
 
 struct mlx5_ct_entry {
-	struct list_head list;
 	u16 zone;
 	struct rhash_head node;
 	struct flow_rule *flow_rule;
@@ -617,8 +615,6 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
 	if (err)
 		goto err_insert;
 
-	list_add(&entry->list, &ft->ct_entries_list);
-
 	return 0;
 
 err_insert:
@@ -646,7 +642,6 @@ mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft,
 	WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht,
 				       &entry->node,
 				       cts_ht_params));
-	list_del(&entry->list);
 	kfree(entry);
 
 	return 0;
@@ -818,7 +813,6 @@ mlx5_tc_ct_add_ft_cb(struct mlx5_tc_ct_priv *ct_priv, u16 zone,
 	ft->zone = zone;
 	ft->nf_ft = nf_ft;
 	ft->ct_priv = ct_priv;
-	INIT_LIST_HEAD(&ft->ct_entries_list);
 	refcount_set(&ft->refcount, 1);
 
 	err = rhashtable_init(&ft->ct_entries_ht, &cts_ht_params);
@@ -847,12 +841,12 @@ mlx5_tc_ct_add_ft_cb(struct mlx5_tc_ct_priv *ct_priv, u16 zone,
 }
 
 static void
-mlx5_tc_ct_flush_ft(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft)
+mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg)
 {
-	struct mlx5_ct_entry *entry;
+	struct mlx5_tc_ct_priv *ct_priv = arg;
+	struct mlx5_ct_entry *entry = ptr;
 
-	list_for_each_entry(entry, &ft->ct_entries_list, list)
-		mlx5_tc_ct_entry_del_rules(ft->ct_priv, entry);
+	mlx5_tc_ct_entry_del_rules(ct_priv, entry);
 }
 
 static void
@@ -863,9 +857,10 @@ mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft)
 
 	nf_flow_table_offload_del_cb(ft->nf_ft,
 				     mlx5_tc_ct_block_flow_offload, ft);
-	mlx5_tc_ct_flush_ft(ct_priv, ft);
 	rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params);
-	rhashtable_destroy(&ft->ct_entries_ht);
+	rhashtable_free_and_destroy(&ft->ct_entries_ht,
+				    mlx5_tc_ct_flush_ft_entry,
+				    ct_priv);
 	kfree(ft);
 }
 
-- 
2.25.1


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

* Re: [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08
  2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2020-04-08 22:51 ` [net 8/8] net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list Saeed Mahameed
@ 2020-04-09 17:07 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2020-04-09 17:07 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Wed,  8 Apr 2020 15:51:16 -0700

> This series introduces some fixes to mlx5 driver.
> 
> Please pull and let me know if there is any problem.

Pulled.

> For -stable v5.3
>  ('net/mlx5: Fix frequent ioread PCI access during recovery')
>  ('net/mlx5e: Add missing release firmware call')
> 
> For -stable v5.4
>  ('net/mlx5e: Fix nest_level for vlan pop action')
>  ('net/mlx5e: Fix pfnum in devlink port attribute')

Queued up.

Thanks.

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

end of thread, other threads:[~2020-04-09 17:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 22:51 [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 Saeed Mahameed
2020-04-08 22:51 ` [net 1/8] net/mlx5: Fix frequent ioread PCI access during recovery Saeed Mahameed
2020-04-08 22:51 ` [net 2/8] net/mlx5: Fix condition for termination table cleanup Saeed Mahameed
2020-04-08 22:51 ` [net 3/8] net/mlx5e: Add missing release firmware call Saeed Mahameed
2020-04-08 22:51 ` [net 4/8] net/mlx5e: Fix nest_level for vlan pop action Saeed Mahameed
2020-04-08 22:51 ` [net 5/8] net/mlx5e: Fix missing pedit action after ct clear action Saeed Mahameed
2020-04-08 22:51 ` [net 6/8] net/mlx5e: Fix pfnum in devlink port attribute Saeed Mahameed
2020-04-08 22:51 ` [net 7/8] net/mlx5e: Fix devlink port netdev unregistration sequence Saeed Mahameed
2020-04-08 22:51 ` [net 8/8] net/mlx5e: CT: Use rhashtable's ct entries instead of a separate list Saeed Mahameed
2020-04-09 17:07 ` [pull request][net 0/8] Mellanox, mlx5 fixes 2020-04-08 David Miller

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