@@ -1786,8 +1786,11 @@ void hclgevf_mbx_task_schedule(struct hclgevf_dev *hdev)
1786
1786
static void hclgevf_task_schedule (struct hclgevf_dev * hdev )
1787
1787
{
1788
1788
if (!test_bit (HCLGEVF_STATE_DOWN , & hdev -> state ) &&
1789
- !test_and_set_bit (HCLGEVF_STATE_SERVICE_SCHED , & hdev -> state ))
1790
- schedule_work (& hdev -> service_task );
1789
+ !test_and_set_bit (HCLGEVF_STATE_SERVICE_SCHED , & hdev -> state )) {
1790
+ mod_delayed_work (system_wq , & hdev -> service_task ,
1791
+ round_jiffies_relative (HZ ));
1792
+ hdev -> stats_timer ++ ;
1793
+ }
1791
1794
}
1792
1795
1793
1796
static void hclgevf_deferred_task_schedule (struct hclgevf_dev * hdev )
@@ -1800,17 +1803,6 @@ static void hclgevf_deferred_task_schedule(struct hclgevf_dev *hdev)
1800
1803
hclgevf_reset_task_schedule (hdev );
1801
1804
}
1802
1805
1803
- static void hclgevf_service_timer (struct timer_list * t )
1804
- {
1805
- struct hclgevf_dev * hdev = from_timer (hdev , t , service_timer );
1806
-
1807
- mod_timer (& hdev -> service_timer , jiffies +
1808
- HCLGEVF_GENERAL_TASK_INTERVAL * HZ );
1809
-
1810
- hdev -> stats_timer ++ ;
1811
- hclgevf_task_schedule (hdev );
1812
- }
1813
-
1814
1806
static void hclgevf_reset_service_task (struct work_struct * work )
1815
1807
{
1816
1808
#define HCLGEVF_MAX_RESET_ATTEMPTS_CNT 3
@@ -1933,7 +1925,7 @@ static void hclgevf_service_task(struct work_struct *work)
1933
1925
struct hnae3_handle * handle ;
1934
1926
struct hclgevf_dev * hdev ;
1935
1927
1936
- hdev = container_of (work , struct hclgevf_dev , service_task );
1928
+ hdev = container_of (work , struct hclgevf_dev , service_task . work );
1937
1929
handle = & hdev -> nic ;
1938
1930
1939
1931
if (hdev -> stats_timer >= HCLGEVF_STATS_TIMER_INTERVAL ) {
@@ -1953,6 +1945,8 @@ static void hclgevf_service_task(struct work_struct *work)
1953
1945
hclgevf_deferred_task_schedule (hdev );
1954
1946
1955
1947
clear_bit (HCLGEVF_STATE_SERVICE_SCHED , & hdev -> state );
1948
+
1949
+ hclgevf_task_schedule (hdev );
1956
1950
}
1957
1951
1958
1952
static void hclgevf_clear_event_cause (struct hclgevf_dev * hdev , u32 regclr )
@@ -2194,10 +2188,10 @@ static void hclgevf_set_timer_task(struct hnae3_handle *handle, bool enable)
2194
2188
struct hclgevf_dev * hdev = hclgevf_ae_get_hdev (handle );
2195
2189
2196
2190
if (enable ) {
2197
- mod_timer ( & hdev -> service_timer , jiffies + HZ );
2191
+ hclgevf_task_schedule ( hdev );
2198
2192
} else {
2199
- del_timer_sync ( & hdev -> service_timer );
2200
- cancel_work_sync (& hdev -> service_task );
2193
+ set_bit ( HCLGEVF_STATE_DOWN , & hdev -> state );
2194
+ cancel_delayed_work_sync (& hdev -> service_task );
2201
2195
clear_bit (HCLGEVF_STATE_SERVICE_SCHED , & hdev -> state );
2202
2196
}
2203
2197
}
@@ -2279,10 +2273,7 @@ static void hclgevf_state_init(struct hclgevf_dev *hdev)
2279
2273
clear_bit (HCLGEVF_STATE_MBX_SERVICE_SCHED , & hdev -> state );
2280
2274
clear_bit (HCLGEVF_STATE_MBX_HANDLING , & hdev -> state );
2281
2275
2282
- /* setup tasks for service timer */
2283
- timer_setup (& hdev -> service_timer , hclgevf_service_timer , 0 );
2284
-
2285
- INIT_WORK (& hdev -> service_task , hclgevf_service_task );
2276
+ INIT_DELAYED_WORK (& hdev -> service_task , hclgevf_service_task );
2286
2277
clear_bit (HCLGEVF_STATE_SERVICE_SCHED , & hdev -> state );
2287
2278
2288
2279
INIT_WORK (& hdev -> rst_service_task , hclgevf_reset_service_task );
@@ -2302,10 +2293,8 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev)
2302
2293
del_timer_sync (& hdev -> keep_alive_timer );
2303
2294
if (hdev -> keep_alive_task .func )
2304
2295
cancel_work_sync (& hdev -> keep_alive_task );
2305
- if (hdev -> service_timer .function )
2306
- del_timer_sync (& hdev -> service_timer );
2307
- if (hdev -> service_task .func )
2308
- cancel_work_sync (& hdev -> service_task );
2296
+ if (hdev -> service_task .work .func )
2297
+ cancel_delayed_work_sync (& hdev -> service_task );
2309
2298
if (hdev -> mbx_service_task .func )
2310
2299
cancel_work_sync (& hdev -> mbx_service_task );
2311
2300
if (hdev -> rst_service_task .func )
0 commit comments