@@ -3005,7 +3005,6 @@ int mlx5_ib_dev_res_srq_init(struct mlx5_ib_dev *dev)
3005
3005
static int mlx5_ib_dev_res_init (struct mlx5_ib_dev * dev )
3006
3006
{
3007
3007
struct mlx5_ib_resources * devr = & dev -> devr ;
3008
- int port ;
3009
3008
int ret ;
3010
3009
3011
3010
if (!MLX5_CAP_GEN (dev -> mdev , xrc ))
@@ -3021,10 +3020,6 @@ static int mlx5_ib_dev_res_init(struct mlx5_ib_dev *dev)
3021
3020
return ret ;
3022
3021
}
3023
3022
3024
- for (port = 0 ; port < ARRAY_SIZE (devr -> ports ); ++ port )
3025
- INIT_WORK (& devr -> ports [port ].pkey_change_work ,
3026
- pkey_change_handler );
3027
-
3028
3023
mutex_init (& devr -> cq_lock );
3029
3024
mutex_init (& devr -> srq_lock );
3030
3025
@@ -3034,16 +3029,6 @@ static int mlx5_ib_dev_res_init(struct mlx5_ib_dev *dev)
3034
3029
static void mlx5_ib_dev_res_cleanup (struct mlx5_ib_dev * dev )
3035
3030
{
3036
3031
struct mlx5_ib_resources * devr = & dev -> devr ;
3037
- int port ;
3038
-
3039
- /*
3040
- * Make sure no change P_Key work items are still executing.
3041
- *
3042
- * At this stage, the mlx5_ib_event should be unregistered
3043
- * and it ensures that no new works are added.
3044
- */
3045
- for (port = 0 ; port < ARRAY_SIZE (devr -> ports ); ++ port )
3046
- cancel_work_sync (& devr -> ports [port ].pkey_change_work );
3047
3032
3048
3033
/* After s0/s1 init, they are not unset during the device lifetime. */
3049
3034
if (devr -> s1 ) {
@@ -4480,6 +4465,13 @@ static void mlx5_ib_stage_delay_drop_cleanup(struct mlx5_ib_dev *dev)
4480
4465
4481
4466
static int mlx5_ib_stage_dev_notifier_init (struct mlx5_ib_dev * dev )
4482
4467
{
4468
+ struct mlx5_ib_resources * devr = & dev -> devr ;
4469
+ int port ;
4470
+
4471
+ for (port = 0 ; port < ARRAY_SIZE (devr -> ports ); ++ port )
4472
+ INIT_WORK (& devr -> ports [port ].pkey_change_work ,
4473
+ pkey_change_handler );
4474
+
4483
4475
dev -> mdev_events .notifier_call = mlx5_ib_event ;
4484
4476
mlx5_notifier_register (dev -> mdev , & dev -> mdev_events );
4485
4477
@@ -4490,8 +4482,14 @@ static int mlx5_ib_stage_dev_notifier_init(struct mlx5_ib_dev *dev)
4490
4482
4491
4483
static void mlx5_ib_stage_dev_notifier_cleanup (struct mlx5_ib_dev * dev )
4492
4484
{
4485
+ struct mlx5_ib_resources * devr = & dev -> devr ;
4486
+ int port ;
4487
+
4493
4488
mlx5r_macsec_event_unregister (dev );
4494
4489
mlx5_notifier_unregister (dev -> mdev , & dev -> mdev_events );
4490
+
4491
+ for (port = 0 ; port < ARRAY_SIZE (devr -> ports ); ++ port )
4492
+ cancel_work_sync (& devr -> ports [port ].pkey_change_work );
4495
4493
}
4496
4494
4497
4495
void mlx5_ib_data_direct_bind (struct mlx5_ib_dev * ibdev ,
@@ -4581,9 +4579,6 @@ static const struct mlx5_ib_profile pf_profile = {
4581
4579
STAGE_CREATE (MLX5_IB_STAGE_DEVICE_RESOURCES ,
4582
4580
mlx5_ib_dev_res_init ,
4583
4581
mlx5_ib_dev_res_cleanup ),
4584
- STAGE_CREATE (MLX5_IB_STAGE_DEVICE_NOTIFIER ,
4585
- mlx5_ib_stage_dev_notifier_init ,
4586
- mlx5_ib_stage_dev_notifier_cleanup ),
4587
4582
STAGE_CREATE (MLX5_IB_STAGE_ODP ,
4588
4583
mlx5_ib_odp_init_one ,
4589
4584
mlx5_ib_odp_cleanup_one ),
@@ -4608,6 +4603,9 @@ static const struct mlx5_ib_profile pf_profile = {
4608
4603
STAGE_CREATE (MLX5_IB_STAGE_IB_REG ,
4609
4604
mlx5_ib_stage_ib_reg_init ,
4610
4605
mlx5_ib_stage_ib_reg_cleanup ),
4606
+ STAGE_CREATE (MLX5_IB_STAGE_DEVICE_NOTIFIER ,
4607
+ mlx5_ib_stage_dev_notifier_init ,
4608
+ mlx5_ib_stage_dev_notifier_cleanup ),
4611
4609
STAGE_CREATE (MLX5_IB_STAGE_POST_IB_REG_UMR ,
4612
4610
mlx5_ib_stage_post_ib_reg_umr_init ,
4613
4611
NULL ),
@@ -4644,9 +4642,6 @@ const struct mlx5_ib_profile raw_eth_profile = {
4644
4642
STAGE_CREATE (MLX5_IB_STAGE_DEVICE_RESOURCES ,
4645
4643
mlx5_ib_dev_res_init ,
4646
4644
mlx5_ib_dev_res_cleanup ),
4647
- STAGE_CREATE (MLX5_IB_STAGE_DEVICE_NOTIFIER ,
4648
- mlx5_ib_stage_dev_notifier_init ,
4649
- mlx5_ib_stage_dev_notifier_cleanup ),
4650
4645
STAGE_CREATE (MLX5_IB_STAGE_COUNTERS ,
4651
4646
mlx5_ib_counters_init ,
4652
4647
mlx5_ib_counters_cleanup ),
@@ -4668,6 +4663,9 @@ const struct mlx5_ib_profile raw_eth_profile = {
4668
4663
STAGE_CREATE (MLX5_IB_STAGE_IB_REG ,
4669
4664
mlx5_ib_stage_ib_reg_init ,
4670
4665
mlx5_ib_stage_ib_reg_cleanup ),
4666
+ STAGE_CREATE (MLX5_IB_STAGE_DEVICE_NOTIFIER ,
4667
+ mlx5_ib_stage_dev_notifier_init ,
4668
+ mlx5_ib_stage_dev_notifier_cleanup ),
4671
4669
STAGE_CREATE (MLX5_IB_STAGE_POST_IB_REG_UMR ,
4672
4670
mlx5_ib_stage_post_ib_reg_umr_init ,
4673
4671
NULL ),
0 commit comments