* [patch net] mlx5: register lag notifier for init network namespace only
@ 2020-02-25 9:25 Jiri Pirko
2020-02-25 18:41 ` David Miller
2020-02-27 0:50 ` David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Jiri Pirko @ 2020-02-25 9:25 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, ayal, saeedm, ranro, moshe
From: Jiri Pirko <jiri@mellanox.com>
The current code causes problems when the unregistering netdevice could
be different then the registering one.
Since the check in mlx5_lag_netdev_event() does not allow any other
network namespace anyway, fix this by registerting the lag notifier
per init network namespace only.
Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier registrations")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Aya Levin <ayal@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +--
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/lag.c | 11 +++--------
drivers/net/ethernet/mellanox/mlx5/core/lag.h | 1 -
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 2 +-
5 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 966983674663..21de4764d4c0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5147,7 +5147,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
static void mlx5e_nic_disable(struct mlx5e_priv *priv)
{
- struct net_device *netdev = priv->netdev;
struct mlx5_core_dev *mdev = priv->mdev;
#ifdef CONFIG_MLX5_CORE_EN_DCB
@@ -5168,7 +5167,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
mlx5e_monitor_counter_cleanup(priv);
mlx5e_disable_async_events(priv);
- mlx5_lag_remove(mdev, netdev);
+ mlx5_lag_remove(mdev);
}
int mlx5e_update_nic_rx(struct mlx5e_priv *priv)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 7b48ccacebe2..3e4362dec4db 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1870,7 +1870,7 @@ static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)
#endif
mlx5_notifier_unregister(mdev, &priv->events_nb);
cancel_work_sync(&rpriv->uplink_priv.reoffload_flows_work);
- mlx5_lag_remove(mdev, netdev);
+ mlx5_lag_remove(mdev);
}
static MLX5E_DEFINE_STATS_GRP(sw_rep, 0);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
index b91eabc09fbc..8e19f6ab8393 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
@@ -464,9 +464,6 @@ static int mlx5_lag_netdev_event(struct notifier_block *this,
struct mlx5_lag *ldev;
int changed = 0;
- if (!net_eq(dev_net(ndev), &init_net))
- return NOTIFY_DONE;
-
if ((event != NETDEV_CHANGEUPPER) && (event != NETDEV_CHANGELOWERSTATE))
return NOTIFY_DONE;
@@ -586,8 +583,7 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev)
if (!ldev->nb.notifier_call) {
ldev->nb.notifier_call = mlx5_lag_netdev_event;
- if (register_netdevice_notifier_dev_net(netdev, &ldev->nb,
- &ldev->nn)) {
+ if (register_netdevice_notifier_net(&init_net, &ldev->nb)) {
ldev->nb.notifier_call = NULL;
mlx5_core_err(dev, "Failed to register LAG netdev notifier\n");
}
@@ -600,7 +596,7 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev)
}
/* Must be called with intf_mutex held */
-void mlx5_lag_remove(struct mlx5_core_dev *dev, struct net_device *netdev)
+void mlx5_lag_remove(struct mlx5_core_dev *dev)
{
struct mlx5_lag *ldev;
int i;
@@ -620,8 +616,7 @@ void mlx5_lag_remove(struct mlx5_core_dev *dev, struct net_device *netdev)
if (i == MLX5_MAX_PORTS) {
if (ldev->nb.notifier_call)
- unregister_netdevice_notifier_dev_net(netdev, &ldev->nb,
- &ldev->nn);
+ unregister_netdevice_notifier_net(&init_net, &ldev->nb);
mlx5_lag_mp_cleanup(ldev);
cancel_delayed_work_sync(&ldev->bond_work);
mlx5_lag_dev_free(ldev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.h b/drivers/net/ethernet/mellanox/mlx5/core/lag.h
index 316ab09e2664..f1068aac6406 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.h
@@ -44,7 +44,6 @@ struct mlx5_lag {
struct workqueue_struct *wq;
struct delayed_work bond_work;
struct notifier_block nb;
- struct netdev_net_notifier nn;
struct lag_mp lag_mp;
};
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index fcce9e0fc82c..da67b28d6e23 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -157,7 +157,7 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam,
u8 feature_group, u8 access_reg_group);
void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev);
-void mlx5_lag_remove(struct mlx5_core_dev *dev, struct net_device *netdev);
+void mlx5_lag_remove(struct mlx5_core_dev *dev);
int mlx5_irq_table_init(struct mlx5_core_dev *dev);
void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev);
--
2.21.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch net] mlx5: register lag notifier for init network namespace only
2020-02-25 9:25 [patch net] mlx5: register lag notifier for init network namespace only Jiri Pirko
@ 2020-02-25 18:41 ` David Miller
2020-02-25 22:41 ` Saeed Mahameed
2020-02-27 0:50 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2020-02-25 18:41 UTC (permalink / raw)
To: jiri; +Cc: netdev, kuba, ayal, saeedm, ranro, moshe
From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 25 Feb 2020 10:25:46 +0100
> From: Jiri Pirko <jiri@mellanox.com>
>
> The current code causes problems when the unregistering netdevice could
> be different then the registering one.
>
> Since the check in mlx5_lag_netdev_event() does not allow any other
> network namespace anyway, fix this by registerting the lag notifier
> per init network namespace only.
>
> Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier registrations")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> Tested-by: Aya Levin <ayal@mellanox.com>
Saeed, should I apply this directly?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch net] mlx5: register lag notifier for init network namespace only
2020-02-25 18:41 ` David Miller
@ 2020-02-25 22:41 ` Saeed Mahameed
0 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2020-02-25 22:41 UTC (permalink / raw)
To: jiri, davem; +Cc: Aya Levin, Ran Rozenstein, netdev, kuba, Moshe Shemesh
On Tue, 2020-02-25 at 10:41 -0800, David Miller wrote:
> From: Jiri Pirko <jiri@resnulli.us>
> Date: Tue, 25 Feb 2020 10:25:46 +0100
>
> > From: Jiri Pirko <jiri@mellanox.com>
> >
> > The current code causes problems when the unregistering netdevice
> could
> > be different then the registering one.
> >
> > Since the check in mlx5_lag_netdev_event() does not allow any other
> > network namespace anyway, fix this by registerting the lag notifier
> > per init network namespace only.
> >
> > Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier
> registrations")
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > Tested-by: Aya Levin <ayal@mellanox.com>
>
> Saeed, should I apply this directly?
Yes Please. for net i don't have a huge amount of traffic, so it is ok
that patches go directly to net.
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Thanks,
Saeed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch net] mlx5: register lag notifier for init network namespace only
2020-02-25 9:25 [patch net] mlx5: register lag notifier for init network namespace only Jiri Pirko
2020-02-25 18:41 ` David Miller
@ 2020-02-27 0:50 ` David Miller
2020-02-27 0:52 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2020-02-27 0:50 UTC (permalink / raw)
To: jiri; +Cc: netdev, kuba, ayal, saeedm, ranro, moshe
From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 25 Feb 2020 10:25:46 +0100
> From: Jiri Pirko <jiri@mellanox.com>
>
> The current code causes problems when the unregistering netdevice could
> be different then the registering one.
>
> Since the check in mlx5_lag_netdev_event() does not allow any other
> network namespace anyway, fix this by registerting the lag notifier
> per init network namespace only.
>
> Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier registrations")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> Tested-by: Aya Levin <ayal@mellanox.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch net] mlx5: register lag notifier for init network namespace only
2020-02-27 0:50 ` David Miller
@ 2020-02-27 0:52 ` David Miller
2020-02-27 6:19 ` Jiri Pirko
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2020-02-27 0:52 UTC (permalink / raw)
To: jiri; +Cc: netdev, kuba, ayal, saeedm, ranro, moshe
From: David Miller <davem@davemloft.net>
Date: Wed, 26 Feb 2020 16:50:48 -0800 (PST)
> From: Jiri Pirko <jiri@resnulli.us>
> Date: Tue, 25 Feb 2020 10:25:46 +0100
>
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> The current code causes problems when the unregistering netdevice could
>> be different then the registering one.
>>
>> Since the check in mlx5_lag_netdev_event() does not allow any other
>> network namespace anyway, fix this by registerting the lag notifier
>> per init network namespace only.
>>
>> Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier registrations")
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> Tested-by: Aya Levin <ayal@mellanox.com>
>
> Applied, thank you.
Actually, you need to respin this and fix the following warning:
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c: In function ‘mlx5e_uplink_rep_disable’:
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:1864:21: warning: unused variable ‘netdev’ [-Wunused-variable]
struct net_device *netdev = priv->netdev;
^~~~~~
You can retain Saeed's ACK when you do this.
Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch net] mlx5: register lag notifier for init network namespace only
2020-02-27 0:52 ` David Miller
@ 2020-02-27 6:19 ` Jiri Pirko
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2020-02-27 6:19 UTC (permalink / raw)
To: David Miller; +Cc: netdev, kuba, ayal, saeedm, ranro, moshe
Thu, Feb 27, 2020 at 01:52:39AM CET, davem@davemloft.net wrote:
>From: David Miller <davem@davemloft.net>
>Date: Wed, 26 Feb 2020 16:50:48 -0800 (PST)
>
>> From: Jiri Pirko <jiri@resnulli.us>
>> Date: Tue, 25 Feb 2020 10:25:46 +0100
>>
>>> From: Jiri Pirko <jiri@mellanox.com>
>>>
>>> The current code causes problems when the unregistering netdevice could
>>> be different then the registering one.
>>>
>>> Since the check in mlx5_lag_netdev_event() does not allow any other
>>> network namespace anyway, fix this by registerting the lag notifier
>>> per init network namespace only.
>>>
>>> Fixes: d48834f9d4b4 ("mlx5: Use dev_net netdevice notifier registrations")
>>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>>> Tested-by: Aya Levin <ayal@mellanox.com>
>>
>> Applied, thank you.
>
>Actually, you need to respin this and fix the following warning:
>
>drivers/net/ethernet/mellanox/mlx5/core/en_rep.c: In function ‘mlx5e_uplink_rep_disable’:
>drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:1864:21: warning: unused variable ‘netdev’ [-Wunused-variable]
> struct net_device *netdev = priv->netdev;
> ^~~~~~
>
>You can retain Saeed's ACK when you do this.
Okay. Will do.
>
>Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-27 6:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 9:25 [patch net] mlx5: register lag notifier for init network namespace only Jiri Pirko
2020-02-25 18:41 ` David Miller
2020-02-25 22:41 ` Saeed Mahameed
2020-02-27 0:50 ` David Miller
2020-02-27 0:52 ` David Miller
2020-02-27 6:19 ` Jiri Pirko
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.