@@ -2513,8 +2513,12 @@ static void hclge_task_schedule(struct hclge_dev *hdev)
2513
2513
{
2514
2514
if (!test_bit (HCLGE_STATE_DOWN , & hdev -> state ) &&
2515
2515
!test_bit (HCLGE_STATE_REMOVING , & hdev -> state ) &&
2516
- !test_and_set_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state ))
2517
- (void )schedule_work (& hdev -> service_task );
2516
+ !test_and_set_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state )) {
2517
+ hdev -> hw_stats .stats_timer ++ ;
2518
+ hdev -> fd_arfs_expire_timer ++ ;
2519
+ mod_delayed_work (system_wq , & hdev -> service_task ,
2520
+ round_jiffies_relative (HZ ));
2521
+ }
2518
2522
}
2519
2523
2520
2524
static int hclge_get_mac_link_status (struct hclge_dev * hdev )
@@ -2729,25 +2733,6 @@ static int hclge_get_status(struct hnae3_handle *handle)
2729
2733
return hdev -> hw .mac .link ;
2730
2734
}
2731
2735
2732
- static void hclge_service_timer (struct timer_list * t )
2733
- {
2734
- struct hclge_dev * hdev = from_timer (hdev , t , service_timer );
2735
-
2736
- mod_timer (& hdev -> service_timer , jiffies + HZ );
2737
- hdev -> hw_stats .stats_timer ++ ;
2738
- hdev -> fd_arfs_expire_timer ++ ;
2739
- hclge_task_schedule (hdev );
2740
- }
2741
-
2742
- static void hclge_service_complete (struct hclge_dev * hdev )
2743
- {
2744
- WARN_ON (!test_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state ));
2745
-
2746
- /* Flush memory before next watchdog */
2747
- smp_mb__before_atomic ();
2748
- clear_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state );
2749
- }
2750
-
2751
2736
static u32 hclge_check_event_cause (struct hclge_dev * hdev , u32 * clearval )
2752
2737
{
2753
2738
u32 rst_src_reg , cmdq_src_reg , msix_src_reg ;
@@ -3594,7 +3579,9 @@ static void hclge_update_vport_alive(struct hclge_dev *hdev)
3594
3579
static void hclge_service_task (struct work_struct * work )
3595
3580
{
3596
3581
struct hclge_dev * hdev =
3597
- container_of (work , struct hclge_dev , service_task );
3582
+ container_of (work , struct hclge_dev , service_task .work );
3583
+
3584
+ clear_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state );
3598
3585
3599
3586
if (hdev -> hw_stats .stats_timer >= HCLGE_STATS_TIMER_INTERVAL ) {
3600
3587
hclge_update_stats_for_all (hdev );
@@ -3609,7 +3596,8 @@ static void hclge_service_task(struct work_struct *work)
3609
3596
hclge_rfs_filter_expire (hdev );
3610
3597
hdev -> fd_arfs_expire_timer = 0 ;
3611
3598
}
3612
- hclge_service_complete (hdev );
3599
+
3600
+ hclge_task_schedule (hdev );
3613
3601
}
3614
3602
3615
3603
struct hclge_vport * hclge_get_vport (struct hnae3_handle * handle )
@@ -6148,10 +6136,13 @@ static void hclge_set_timer_task(struct hnae3_handle *handle, bool enable)
6148
6136
struct hclge_dev * hdev = vport -> back ;
6149
6137
6150
6138
if (enable ) {
6151
- mod_timer ( & hdev -> service_timer , jiffies + HZ );
6139
+ hclge_task_schedule ( hdev );
6152
6140
} else {
6153
- del_timer_sync (& hdev -> service_timer );
6154
- cancel_work_sync (& hdev -> service_task );
6141
+ /* Set the DOWN flag here to disable the service to be
6142
+ * scheduled again
6143
+ */
6144
+ set_bit (HCLGE_STATE_DOWN , & hdev -> state );
6145
+ cancel_delayed_work_sync (& hdev -> service_task );
6155
6146
clear_bit (HCLGE_STATE_SERVICE_SCHED , & hdev -> state );
6156
6147
}
6157
6148
}
@@ -8590,12 +8581,10 @@ static void hclge_state_uninit(struct hclge_dev *hdev)
8590
8581
set_bit (HCLGE_STATE_DOWN , & hdev -> state );
8591
8582
set_bit (HCLGE_STATE_REMOVING , & hdev -> state );
8592
8583
8593
- if (hdev -> service_timer .function )
8594
- del_timer_sync (& hdev -> service_timer );
8595
8584
if (hdev -> reset_timer .function )
8596
8585
del_timer_sync (& hdev -> reset_timer );
8597
- if (hdev -> service_task .func )
8598
- cancel_work_sync (& hdev -> service_task );
8586
+ if (hdev -> service_task .work . func )
8587
+ cancel_delayed_work_sync (& hdev -> service_task );
8599
8588
if (hdev -> rst_service_task .func )
8600
8589
cancel_work_sync (& hdev -> rst_service_task );
8601
8590
if (hdev -> mbx_service_task .func )
@@ -8800,9 +8789,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
8800
8789
8801
8790
hclge_dcb_ops_set (hdev );
8802
8791
8803
- timer_setup (& hdev -> service_timer , hclge_service_timer , 0 );
8804
8792
timer_setup (& hdev -> reset_timer , hclge_reset_timer , 0 );
8805
- INIT_WORK (& hdev -> service_task , hclge_service_task );
8793
+ INIT_DELAYED_WORK (& hdev -> service_task , hclge_service_task );
8806
8794
INIT_WORK (& hdev -> rst_service_task , hclge_reset_service_task );
8807
8795
INIT_WORK (& hdev -> mbx_service_task , hclge_mailbox_service_task );
8808
8796
0 commit comments