|
35 | 35 | #include <linux/mlx5/driver.h>
|
36 | 36 | #include <linux/mlx5/eswitch.h>
|
37 | 37 | #include <linux/mlx5/vport.h>
|
| 38 | +#include "lib/mlx5.h" |
38 | 39 | #include "lib/devcom.h"
|
39 | 40 | #include "mlx5_core.h"
|
40 | 41 | #include "eswitch.h"
|
@@ -231,9 +232,13 @@ static void mlx5_do_bond_work(struct work_struct *work);
|
231 | 232 | static void mlx5_ldev_free(struct kref *ref)
|
232 | 233 | {
|
233 | 234 | struct mlx5_lag *ldev = container_of(ref, struct mlx5_lag, ref);
|
| 235 | + struct net *net; |
| 236 | + |
| 237 | + if (ldev->nb.notifier_call) { |
| 238 | + net = read_pnet(&ldev->net); |
| 239 | + unregister_netdevice_notifier_net(net, &ldev->nb); |
| 240 | + } |
234 | 241 |
|
235 |
| - if (ldev->nb.notifier_call) |
236 |
| - unregister_netdevice_notifier_net(&init_net, &ldev->nb); |
237 | 242 | mlx5_lag_mp_cleanup(ldev);
|
238 | 243 | cancel_delayed_work_sync(&ldev->bond_work);
|
239 | 244 | destroy_workqueue(ldev->wq);
|
@@ -271,7 +276,8 @@ static struct mlx5_lag *mlx5_lag_dev_alloc(struct mlx5_core_dev *dev)
|
271 | 276 | INIT_DELAYED_WORK(&ldev->bond_work, mlx5_do_bond_work);
|
272 | 277 |
|
273 | 278 | ldev->nb.notifier_call = mlx5_lag_netdev_event;
|
274 |
| - if (register_netdevice_notifier_net(&init_net, &ldev->nb)) { |
| 279 | + write_pnet(&ldev->net, mlx5_core_net(dev)); |
| 280 | + if (register_netdevice_notifier_net(read_pnet(&ldev->net), &ldev->nb)) { |
275 | 281 | ldev->nb.notifier_call = NULL;
|
276 | 282 | mlx5_core_err(dev, "Failed to register LAG netdev notifier\n");
|
277 | 283 | }
|
@@ -1413,6 +1419,8 @@ static int mlx5_lag_register_hca_devcom_comp(struct mlx5_core_dev *dev)
|
1413 | 1419 | {
|
1414 | 1420 | struct mlx5_devcom_match_attr attr = {
|
1415 | 1421 | .key.val = mlx5_query_nic_system_image_guid(dev),
|
| 1422 | + .flags = MLX5_DEVCOM_MATCH_FLAGS_NS, |
| 1423 | + .net = mlx5_core_net(dev), |
1416 | 1424 | };
|
1417 | 1425 |
|
1418 | 1426 | /* This component is use to sync adding core_dev to lag_dev and to sync
|
|
0 commit comments