|
|
d8f823 |
From eaef6191478050c3c5a4ef24955d741d1002261e Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Mon, 1 Jun 2020 15:40:27 -0400
|
|
|
d8f823 |
Subject: [PATCH 275/312] [netdrv] net/mlx5e: Fix devlink port register
|
|
|
d8f823 |
sequence
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200601154102.25980-5-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 315708
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1842258 04/39] net/mlx5e: Fix devlink port register sequence
|
|
|
d8f823 |
Bugzilla: 1842258 1790226
|
|
|
d8f823 |
RH-Acked-by: Honggang Li <honli@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1790226
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1842258
|
|
|
d8f823 |
Upstream: v5.7-rc1
|
|
|
d8f823 |
|
|
|
d8f823 |
commit 31e87b39ba9d47cf31f5a91dd3cc9680f5987d12
|
|
|
d8f823 |
Author: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
|
|
|
d8f823 |
Date: Wed Mar 4 13:33:50 2020 +0200
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5e: Fix devlink port register sequence
|
|
|
d8f823 |
|
|
|
d8f823 |
If udevd is configured to rename interfaces according to persistent
|
|
|
d8f823 |
naming rules and if a network interface has phys_port_name in sysfs,
|
|
|
d8f823 |
its contents will be appended to the interface name.
|
|
|
d8f823 |
However, register_netdev creates device in sysfs and if
|
|
|
d8f823 |
devlink_port_register is called after that, there is a timeframe in
|
|
|
d8f823 |
which udevd may read an empty phys_port_name value. The consequence is
|
|
|
d8f823 |
that the interface will lose this suffix and its name will not be
|
|
|
d8f823 |
really persistent.
|
|
|
d8f823 |
|
|
|
d8f823 |
The solution is to register the port before registering a netdev.
|
|
|
d8f823 |
|
|
|
d8f823 |
Fixes: c6acd629eec7 ("net/mlx5e: Add support for devlink-port in non-representors mode")
|
|
|
d8f823 |
Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
.../net/ethernet/mellanox/mlx5/core/en/devlink.c | 26 +++++++++-------------
|
|
|
d8f823 |
.../net/ethernet/mellanox/mlx5/core/en/devlink.h | 3 ++-
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 16 +++++++------
|
|
|
d8f823 |
3 files changed, 21 insertions(+), 24 deletions(-)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
|
|
|
d8f823 |
index e38495e4aa42..f8b2de4b04be 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
|
|
|
d8f823 |
@@ -3,20 +3,14 @@
|
|
|
d8f823 |
|
|
|
d8f823 |
#include "en/devlink.h"
|
|
|
d8f823 |
|
|
|
d8f823 |
-int mlx5e_devlink_port_register(struct net_device *netdev)
|
|
|
d8f823 |
+int mlx5e_devlink_port_register(struct mlx5e_priv *priv)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
- struct mlx5_core_dev *dev;
|
|
|
d8f823 |
- struct mlx5e_priv *priv;
|
|
|
d8f823 |
- struct devlink *devlink;
|
|
|
d8f823 |
- int err;
|
|
|
d8f823 |
+ struct devlink *devlink = priv_to_devlink(priv->mdev);
|
|
|
d8f823 |
|
|
|
d8f823 |
- priv = netdev_priv(netdev);
|
|
|
d8f823 |
- dev = priv->mdev;
|
|
|
d8f823 |
-
|
|
|
d8f823 |
- if (mlx5_core_is_pf(dev))
|
|
|
d8f823 |
+ if (mlx5_core_is_pf(priv->mdev))
|
|
|
d8f823 |
devlink_port_attrs_set(&priv->dl_port,
|
|
|
d8f823 |
DEVLINK_PORT_FLAVOUR_PHYSICAL,
|
|
|
d8f823 |
- PCI_FUNC(dev->pdev->devfn),
|
|
|
d8f823 |
+ PCI_FUNC(priv->mdev->pdev->devfn),
|
|
|
d8f823 |
false, 0,
|
|
|
d8f823 |
NULL, 0);
|
|
|
d8f823 |
else
|
|
|
d8f823 |
@@ -24,12 +18,12 @@ int mlx5e_devlink_port_register(struct net_device *netdev)
|
|
|
d8f823 |
DEVLINK_PORT_FLAVOUR_VIRTUAL,
|
|
|
d8f823 |
0, false, 0, NULL, 0);
|
|
|
d8f823 |
|
|
|
d8f823 |
- devlink = priv_to_devlink(dev);
|
|
|
d8f823 |
- err = devlink_port_register(devlink, &priv->dl_port, 1);
|
|
|
d8f823 |
- if (err)
|
|
|
d8f823 |
- return err;
|
|
|
d8f823 |
- devlink_port_type_eth_set(&priv->dl_port, netdev);
|
|
|
d8f823 |
- return 0;
|
|
|
d8f823 |
+ return devlink_port_register(devlink, &priv->dl_port, 1);
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+void mlx5e_devlink_port_type_eth_set(struct mlx5e_priv *priv)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ devlink_port_type_eth_set(&priv->dl_port, priv->netdev);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv)
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
|
|
|
d8f823 |
index 3e5393a0901f..83123a801adc 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
|
|
|
d8f823 |
@@ -7,8 +7,9 @@
|
|
|
d8f823 |
#include <net/devlink.h>
|
|
|
d8f823 |
#include "en.h"
|
|
|
d8f823 |
|
|
|
d8f823 |
-int mlx5e_devlink_port_register(struct net_device *dev);
|
|
|
d8f823 |
+int mlx5e_devlink_port_register(struct mlx5e_priv *priv);
|
|
|
d8f823 |
void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv);
|
|
|
d8f823 |
+void mlx5e_devlink_port_type_eth_set(struct mlx5e_priv *priv);
|
|
|
d8f823 |
struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev);
|
|
|
d8f823 |
|
|
|
d8f823 |
#endif
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
index 5e52f415ef35..7698167f6dab 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
@@ -5493,25 +5493,27 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
|
|
|
d8f823 |
goto err_destroy_netdev;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
- err = register_netdev(netdev);
|
|
|
d8f823 |
+ err = mlx5e_devlink_port_register(priv);
|
|
|
d8f823 |
if (err) {
|
|
|
d8f823 |
- mlx5_core_err(mdev, "register_netdev failed, %d\n", err);
|
|
|
d8f823 |
+ mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
|
|
|
d8f823 |
goto err_detach;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
- err = mlx5e_devlink_port_register(netdev);
|
|
|
d8f823 |
+ err = register_netdev(netdev);
|
|
|
d8f823 |
if (err) {
|
|
|
d8f823 |
- mlx5_core_err(mdev, "mlx5e_devlink_phy_port_register failed, %d\n", err);
|
|
|
d8f823 |
- goto err_unregister_netdev;
|
|
|
d8f823 |
+ mlx5_core_err(mdev, "register_netdev failed, %d\n", err);
|
|
|
d8f823 |
+ goto err_devlink_port_unregister;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
+ mlx5e_devlink_port_type_eth_set(priv);
|
|
|
d8f823 |
+
|
|
|
d8f823 |
#ifdef CONFIG_MLX5_CORE_EN_DCB
|
|
|
d8f823 |
mlx5e_dcbnl_init_app(priv);
|
|
|
d8f823 |
#endif
|
|
|
d8f823 |
return priv;
|
|
|
d8f823 |
|
|
|
d8f823 |
-err_unregister_netdev:
|
|
|
d8f823 |
- unregister_netdev(netdev);
|
|
|
d8f823 |
+err_devlink_port_unregister:
|
|
|
d8f823 |
+ mlx5e_devlink_port_unregister(priv);
|
|
|
d8f823 |
err_detach:
|
|
|
d8f823 |
mlx5e_detach(mdev, priv);
|
|
|
d8f823 |
err_destroy_netdev:
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|