@@ -161,6 +161,8 @@ static int hns3_nic_init_irq(struct hns3_nic_priv *priv)
161
161
return ret ;
162
162
}
163
163
164
+ disable_irq (tqp_vectors -> vector_irq );
165
+
164
166
irq_set_affinity_hint (tqp_vectors -> vector_irq ,
165
167
& tqp_vectors -> affinity_mask );
166
168
@@ -179,6 +181,7 @@ static void hns3_mask_vector_irq(struct hns3_enet_tqp_vector *tqp_vector,
179
181
static void hns3_vector_enable (struct hns3_enet_tqp_vector * tqp_vector )
180
182
{
181
183
napi_enable (& tqp_vector -> napi );
184
+ enable_irq (tqp_vector -> vector_irq );
182
185
183
186
/* enable vector */
184
187
hns3_mask_vector_irq (tqp_vector , 1 );
@@ -378,18 +381,6 @@ static int hns3_nic_net_up(struct net_device *netdev)
378
381
if (ret )
379
382
return ret ;
380
383
381
- /* the device can work without cpu rmap, only aRFS needs it */
382
- ret = hns3_set_rx_cpu_rmap (netdev );
383
- if (ret )
384
- netdev_warn (netdev , "set rx cpu rmap fail, ret=%d!\n" , ret );
385
-
386
- /* get irq resource for all vectors */
387
- ret = hns3_nic_init_irq (priv );
388
- if (ret ) {
389
- netdev_err (netdev , "init irq failed! ret=%d\n" , ret );
390
- goto free_rmap ;
391
- }
392
-
393
384
clear_bit (HNS3_NIC_STATE_DOWN , & priv -> state );
394
385
395
386
/* enable the vectors */
@@ -402,22 +393,15 @@ static int hns3_nic_net_up(struct net_device *netdev)
402
393
403
394
/* start the ae_dev */
404
395
ret = h -> ae_algo -> ops -> start ? h -> ae_algo -> ops -> start (h ) : 0 ;
405
- if (ret )
406
- goto out_start_err ;
407
-
408
- return 0 ;
409
-
410
- out_start_err :
411
- set_bit (HNS3_NIC_STATE_DOWN , & priv -> state );
412
- while (j -- )
413
- hns3_tqp_disable (h -> kinfo .tqp [j ]);
396
+ if (ret ) {
397
+ set_bit (HNS3_NIC_STATE_DOWN , & priv -> state );
398
+ while (j -- )
399
+ hns3_tqp_disable (h -> kinfo .tqp [j ]);
414
400
415
- for (j = i - 1 ; j >= 0 ; j -- )
416
- hns3_vector_disable (& priv -> tqp_vector [j ]);
401
+ for (j = i - 1 ; j >= 0 ; j -- )
402
+ hns3_vector_disable (& priv -> tqp_vector [j ]);
403
+ }
417
404
418
- hns3_nic_uninit_irq (priv );
419
- free_rmap :
420
- hns3_free_rx_cpu_rmap (netdev );
421
405
return ret ;
422
406
}
423
407
@@ -514,11 +498,6 @@ static void hns3_nic_net_down(struct net_device *netdev)
514
498
if (ops -> stop )
515
499
ops -> stop (priv -> ae_handle );
516
500
517
- hns3_free_rx_cpu_rmap (netdev );
518
-
519
- /* free irq resources */
520
- hns3_nic_uninit_irq (priv );
521
-
522
501
/* delay ring buffer clearing to hns3_reset_notify_uninit_enet
523
502
* during reset process, because driver may not be able
524
503
* to disable the ring through firmware when downing the netdev.
@@ -3642,19 +3621,13 @@ static void hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv)
3642
3621
3643
3622
hns3_free_vector_ring_chain (tqp_vector , & vector_ring_chain );
3644
3623
3645
- if (tqp_vector -> irq_init_flag == HNS3_VECTOR_INITED ) {
3646
- irq_set_affinity_hint (tqp_vector -> vector_irq , NULL );
3647
- free_irq (tqp_vector -> vector_irq , tqp_vector );
3648
- tqp_vector -> irq_init_flag = HNS3_VECTOR_NOT_INITED ;
3649
- }
3650
-
3651
3624
hns3_clear_ring_group (& tqp_vector -> rx_group );
3652
3625
hns3_clear_ring_group (& tqp_vector -> tx_group );
3653
3626
netif_napi_del (& priv -> tqp_vector [i ].napi );
3654
3627
}
3655
3628
}
3656
3629
3657
- static int hns3_nic_dealloc_vector_data (struct hns3_nic_priv * priv )
3630
+ static void hns3_nic_dealloc_vector_data (struct hns3_nic_priv * priv )
3658
3631
{
3659
3632
struct hnae3_handle * h = priv -> ae_handle ;
3660
3633
struct pci_dev * pdev = h -> pdev ;
@@ -3666,11 +3639,10 @@ static int hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv)
3666
3639
tqp_vector = & priv -> tqp_vector [i ];
3667
3640
ret = h -> ae_algo -> ops -> put_vector (h , tqp_vector -> vector_irq );
3668
3641
if (ret )
3669
- return ret ;
3642
+ return ;
3670
3643
}
3671
3644
3672
3645
devm_kfree (& pdev -> dev , priv -> tqp_vector );
3673
- return 0 ;
3674
3646
}
3675
3647
3676
3648
static void hns3_ring_get_cfg (struct hnae3_queue * q , struct hns3_nic_priv * priv ,
@@ -4069,6 +4041,18 @@ static int hns3_client_init(struct hnae3_handle *handle)
4069
4041
goto out_reg_netdev_fail ;
4070
4042
}
4071
4043
4044
+ /* the device can work without cpu rmap, only aRFS needs it */
4045
+ ret = hns3_set_rx_cpu_rmap (netdev );
4046
+ if (ret )
4047
+ dev_warn (priv -> dev , "set rx cpu rmap fail, ret=%d\n" , ret );
4048
+
4049
+ ret = hns3_nic_init_irq (priv );
4050
+ if (ret ) {
4051
+ dev_err (priv -> dev , "init irq failed! ret=%d\n" , ret );
4052
+ hns3_free_rx_cpu_rmap (netdev );
4053
+ goto out_init_irq_fail ;
4054
+ }
4055
+
4072
4056
ret = hns3_client_start (handle );
4073
4057
if (ret ) {
4074
4058
dev_err (priv -> dev , "hns3_client_start fail! ret=%d\n" , ret );
@@ -4090,6 +4074,9 @@ static int hns3_client_init(struct hnae3_handle *handle)
4090
4074
return ret ;
4091
4075
4092
4076
out_client_start :
4077
+ hns3_free_rx_cpu_rmap (netdev );
4078
+ hns3_nic_uninit_irq (priv );
4079
+ out_init_irq_fail :
4093
4080
unregister_netdev (netdev );
4094
4081
out_reg_netdev_fail :
4095
4082
hns3_uninit_phy (netdev );
@@ -4127,15 +4114,17 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
4127
4114
goto out_netdev_free ;
4128
4115
}
4129
4116
4117
+ hns3_free_rx_cpu_rmap (netdev );
4118
+
4119
+ hns3_nic_uninit_irq (priv );
4120
+
4130
4121
hns3_del_all_fd_rules (netdev , true);
4131
4122
4132
4123
hns3_clear_all_ring (handle , true);
4133
4124
4134
4125
hns3_nic_uninit_vector_data (priv );
4135
4126
4136
- ret = hns3_nic_dealloc_vector_data (priv );
4137
- if (ret )
4138
- netdev_err (netdev , "dealloc vector error\n" );
4127
+ hns3_nic_dealloc_vector_data (priv );
4139
4128
4140
4129
ret = hns3_uninit_all_ring (priv );
4141
4130
if (ret )
@@ -4462,17 +4451,32 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle)
4462
4451
if (ret )
4463
4452
goto err_uninit_vector ;
4464
4453
4454
+ /* the device can work without cpu rmap, only aRFS needs it */
4455
+ ret = hns3_set_rx_cpu_rmap (netdev );
4456
+ if (ret )
4457
+ dev_warn (priv -> dev , "set rx cpu rmap fail, ret=%d\n" , ret );
4458
+
4459
+ ret = hns3_nic_init_irq (priv );
4460
+ if (ret ) {
4461
+ dev_err (priv -> dev , "init irq failed! ret=%d\n" , ret );
4462
+ hns3_free_rx_cpu_rmap (netdev );
4463
+ goto err_init_irq_fail ;
4464
+ }
4465
+
4465
4466
ret = hns3_client_start (handle );
4466
4467
if (ret ) {
4467
4468
dev_err (priv -> dev , "hns3_client_start fail! ret=%d\n" , ret );
4468
- goto err_uninit_ring ;
4469
+ goto err_client_start_fail ;
4469
4470
}
4470
4471
4471
4472
set_bit (HNS3_NIC_STATE_INITED , & priv -> state );
4472
4473
4473
4474
return ret ;
4474
4475
4475
- err_uninit_ring :
4476
+ err_client_start_fail :
4477
+ hns3_free_rx_cpu_rmap (netdev );
4478
+ hns3_nic_uninit_irq (priv );
4479
+ err_init_irq_fail :
4476
4480
hns3_uninit_all_ring (priv );
4477
4481
err_uninit_vector :
4478
4482
hns3_nic_uninit_vector_data (priv );
@@ -4522,16 +4526,16 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
4522
4526
return 0 ;
4523
4527
}
4524
4528
4529
+ hns3_free_rx_cpu_rmap (netdev );
4530
+ hns3_nic_uninit_irq (priv );
4525
4531
hns3_clear_all_ring (handle , true);
4526
4532
hns3_reset_tx_queue (priv -> ae_handle );
4527
4533
4528
4534
hns3_nic_uninit_vector_data (priv );
4529
4535
4530
4536
hns3_store_coal (priv );
4531
4537
4532
- ret = hns3_nic_dealloc_vector_data (priv );
4533
- if (ret )
4534
- netdev_err (netdev , "dealloc vector error\n" );
4538
+ hns3_nic_dealloc_vector_data (priv );
4535
4539
4536
4540
ret = hns3_uninit_all_ring (priv );
4537
4541
if (ret )
0 commit comments