@@ -117,7 +117,7 @@ static in_cache_entry *in_cache_add_entry(__be32 dst_ip,
117117
118118 memcpy (entry -> MPS_ctrl_ATM_addr , client -> mps_ctrl_addr , ATM_ESA_LEN );
119119 entry -> ctrl_info .in_dst_ip = dst_ip ;
120- do_gettimeofday ( & ( entry -> tv ) );
120+ entry -> time = ktime_get_seconds ( );
121121 entry -> retry_time = client -> parameters .mpc_p4 ;
122122 entry -> count = 1 ;
123123 entry -> entry_state = INGRESS_INVALID ;
@@ -148,7 +148,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)
148148 if (qos != NULL )
149149 msg .qos = qos -> qos ;
150150 msg_to_mpoad (& msg , mpc );
151- do_gettimeofday ( & ( entry -> reply_wait ) );
151+ entry -> reply_wait = ktime_get_seconds ( );
152152 entry -> entry_state = INGRESS_RESOLVING ;
153153 }
154154 if (entry -> shortcut != NULL )
@@ -171,7 +171,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)
171171 if (qos != NULL )
172172 msg .qos = qos -> qos ;
173173 msg_to_mpoad (& msg , mpc );
174- do_gettimeofday ( & ( entry -> reply_wait ) );
174+ entry -> reply_wait = ktime_get_seconds ( );
175175 }
176176
177177 return CLOSED ;
@@ -227,17 +227,16 @@ static void in_cache_remove_entry(in_cache_entry *entry,
227227static void clear_count_and_expired (struct mpoa_client * client )
228228{
229229 in_cache_entry * entry , * next_entry ;
230- struct timeval now ;
230+ time64_t now ;
231231
232- do_gettimeofday ( & now );
232+ now = ktime_get_seconds ( );
233233
234234 write_lock_bh (& client -> ingress_lock );
235235 entry = client -> in_cache ;
236236 while (entry != NULL ) {
237237 entry -> count = 0 ;
238238 next_entry = entry -> next ;
239- if ((now .tv_sec - entry -> tv .tv_sec )
240- > entry -> ctrl_info .holding_time ) {
239+ if ((now - entry -> time ) > entry -> ctrl_info .holding_time ) {
241240 dprintk ("holding time expired, ip = %pI4\n" ,
242241 & entry -> ctrl_info .in_dst_ip );
243242 client -> in_ops -> remove_entry (entry , client );
@@ -253,43 +252,43 @@ static void check_resolving_entries(struct mpoa_client *client)
253252
254253 struct atm_mpoa_qos * qos ;
255254 in_cache_entry * entry ;
256- struct timeval now ;
255+ time64_t now ;
257256 struct k_message msg ;
258257
259- do_gettimeofday ( & now );
258+ now = ktime_get_seconds ( );
260259
261260 read_lock_bh (& client -> ingress_lock );
262261 entry = client -> in_cache ;
263262 while (entry != NULL ) {
264263 if (entry -> entry_state == INGRESS_RESOLVING ) {
265- if ((now .tv_sec - entry -> hold_down .tv_sec ) <
266- client -> parameters .mpc_p6 ) {
264+
265+ if ((now - entry -> hold_down )
266+ < client -> parameters .mpc_p6 ) {
267267 entry = entry -> next ; /* Entry in hold down */
268268 continue ;
269269 }
270- if ((now .tv_sec - entry -> reply_wait .tv_sec ) >
271- entry -> retry_time ) {
270+ if ((now - entry -> reply_wait ) > entry -> retry_time ) {
272271 entry -> retry_time = MPC_C1 * (entry -> retry_time );
273272 /*
274273 * Retry time maximum exceeded,
275274 * put entry in hold down.
276275 */
277276 if (entry -> retry_time > client -> parameters .mpc_p5 ) {
278- do_gettimeofday ( & ( entry -> hold_down ) );
277+ entry -> hold_down = ktime_get_seconds ( );
279278 entry -> retry_time = client -> parameters .mpc_p4 ;
280279 entry = entry -> next ;
281280 continue ;
282281 }
283282 /* Ask daemon to send a resolution request. */
284- memset (& ( entry -> hold_down ) , 0 , sizeof (struct timeval ));
283+ memset (& entry -> hold_down , 0 , sizeof (time64_t ));
285284 msg .type = SND_MPOA_RES_RTRY ;
286285 memcpy (msg .MPS_ctrl , client -> mps_ctrl_addr , ATM_ESA_LEN );
287286 msg .content .in_info = entry -> ctrl_info ;
288287 qos = atm_mpoa_search_qos (entry -> ctrl_info .in_dst_ip );
289288 if (qos != NULL )
290289 msg .qos = qos -> qos ;
291290 msg_to_mpoad (& msg , client );
292- do_gettimeofday ( & ( entry -> reply_wait ) );
291+ entry -> reply_wait = ktime_get_seconds ( );
293292 }
294293 }
295294 entry = entry -> next ;
@@ -300,18 +299,18 @@ static void check_resolving_entries(struct mpoa_client *client)
300299/* Call this every MPC-p5 seconds. */
301300static void refresh_entries (struct mpoa_client * client )
302301{
303- struct timeval now ;
302+ time64_t now ;
304303 struct in_cache_entry * entry = client -> in_cache ;
305304
306305 ddprintk ("refresh_entries\n" );
307- do_gettimeofday ( & now );
306+ now = ktime_get_seconds ( );
308307
309308 read_lock_bh (& client -> ingress_lock );
310309 while (entry != NULL ) {
311310 if (entry -> entry_state == INGRESS_RESOLVED ) {
312311 if (!(entry -> refresh_time ))
313312 entry -> refresh_time = (2 * (entry -> ctrl_info .holding_time ))/3 ;
314- if ((now . tv_sec - entry -> reply_wait . tv_sec ) >
313+ if ((now - entry -> reply_wait ) >
315314 entry -> refresh_time ) {
316315 dprintk ("refreshing an entry.\n" );
317316 entry -> entry_state = INGRESS_REFRESHING ;
@@ -480,7 +479,7 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg,
480479
481480 memcpy (entry -> MPS_ctrl_ATM_addr , client -> mps_ctrl_addr , ATM_ESA_LEN );
482481 entry -> ctrl_info = msg -> content .eg_info ;
483- do_gettimeofday ( & ( entry -> tv ) );
482+ entry -> time = ktime_get_seconds ( );
484483 entry -> entry_state = EGRESS_RESOLVED ;
485484 dprintk ("new_eg_cache_entry cache_id %u\n" ,
486485 ntohl (entry -> ctrl_info .cache_id ));
@@ -495,25 +494,24 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg,
495494
496495static void update_eg_cache_entry (eg_cache_entry * entry , uint16_t holding_time )
497496{
498- do_gettimeofday ( & ( entry -> tv ) );
497+ entry -> time = ktime_get_seconds ( );
499498 entry -> entry_state = EGRESS_RESOLVED ;
500499 entry -> ctrl_info .holding_time = holding_time ;
501500}
502501
503502static void clear_expired (struct mpoa_client * client )
504503{
505504 eg_cache_entry * entry , * next_entry ;
506- struct timeval now ;
505+ time64_t now ;
507506 struct k_message msg ;
508507
509- do_gettimeofday ( & now );
508+ now = ktime_get_seconds ( );
510509
511510 write_lock_irq (& client -> egress_lock );
512511 entry = client -> eg_cache ;
513512 while (entry != NULL ) {
514513 next_entry = entry -> next ;
515- if ((now .tv_sec - entry -> tv .tv_sec )
516- > entry -> ctrl_info .holding_time ) {
514+ if ((now - entry -> time ) > entry -> ctrl_info .holding_time ) {
517515 msg .type = SND_EGRESS_PURGE ;
518516 msg .content .eg_info = entry -> ctrl_info ;
519517 dprintk ("egress_cache: holding time expired, cache_id = %u.\n" ,
0 commit comments