Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: use ktime_get_ns() and ktime_get_real_ns() helpers

ktime_get_ns() replaces ktime_to_ns(ktime_get())

ktime_get_real_ns() replaces ktime_to_ns(ktime_get_real())

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
d2de875c 3f8a2b74

+18 -18
+1 -1
include/net/codel.h
··· 66 66 67 67 static inline codel_time_t codel_get_time(void) 68 68 { 69 - u64 ns = ktime_to_ns(ktime_get()); 69 + u64 ns = ktime_get_ns(); 70 70 71 71 return ns >> CODEL_SHIFT; 72 72 }
+1 -1
include/net/pkt_sched.h
··· 50 50 51 51 static inline psched_time_t psched_get_time(void) 52 52 { 53 - return PSCHED_NS2TICKS(ktime_to_ns(ktime_get())); 53 + return PSCHED_NS2TICKS(ktime_get_ns()); 54 54 } 55 55 56 56 static inline psched_tdiff_t
+3 -3
net/core/secure_seq.c
··· 35 35 * overlaps less than one time per MSL (2 minutes). 36 36 * Choosing a clock of 64 ns period is OK. (period of 274 s) 37 37 */ 38 - return seq + (ktime_to_ns(ktime_get_real()) >> 6); 38 + return seq + (ktime_get_real_ns() >> 6); 39 39 } 40 40 #endif 41 41 ··· 135 135 md5_transform(hash, net_secret); 136 136 137 137 seq = hash[0] | (((u64)hash[1]) << 32); 138 - seq += ktime_to_ns(ktime_get_real()); 138 + seq += ktime_get_real_ns(); 139 139 seq &= (1ull << 48) - 1; 140 140 141 141 return seq; ··· 163 163 md5_transform(hash, secret); 164 164 165 165 seq = hash[0] | (((u64)hash[1]) << 32); 166 - seq += ktime_to_ns(ktime_get_real()); 166 + seq += ktime_get_real_ns(); 167 167 seq &= (1ull << 48) - 1; 168 168 169 169 return seq;
+1 -1
net/netfilter/nf_conntrack_core.c
··· 358 358 359 359 tstamp = nf_conn_tstamp_find(ct); 360 360 if (tstamp && tstamp->stop == 0) 361 - tstamp->stop = ktime_to_ns(ktime_get_real()); 361 + tstamp->stop = ktime_get_real_ns(); 362 362 363 363 if (nf_ct_is_dying(ct)) 364 364 goto delete;
+1 -1
net/netfilter/nf_conntrack_netlink.c
··· 1737 1737 } 1738 1738 tstamp = nf_conn_tstamp_find(ct); 1739 1739 if (tstamp) 1740 - tstamp->start = ktime_to_ns(ktime_get_real()); 1740 + tstamp->start = ktime_get_real_ns(); 1741 1741 1742 1742 err = nf_conntrack_hash_check_insert(ct); 1743 1743 if (err < 0)
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 101 101 { 102 102 struct ct_iter_state *st = seq->private; 103 103 104 - st->time_now = ktime_to_ns(ktime_get_real()); 104 + st->time_now = ktime_get_real_ns(); 105 105 rcu_read_lock(); 106 106 return ct_get_idx(seq, *pos); 107 107 }
+2 -2
net/sched/act_police.c
··· 231 231 if (ret != ACT_P_CREATED) 232 232 return ret; 233 233 234 - police->tcfp_t_c = ktime_to_ns(ktime_get()); 234 + police->tcfp_t_c = ktime_get_ns(); 235 235 police->tcf_index = parm->index ? parm->index : 236 236 tcf_hash_new_index(hinfo); 237 237 h = tcf_hash(police->tcf_index, POL_TAB_MASK); ··· 279 279 return police->tcfp_result; 280 280 } 281 281 282 - now = ktime_to_ns(ktime_get()); 282 + now = ktime_get_ns(); 283 283 toks = min_t(s64, now - police->tcfp_t_c, 284 284 police->tcfp_burst); 285 285 if (police->peak_present) {
+2 -2
net/sched/sch_fq.c
··· 416 416 static struct sk_buff *fq_dequeue(struct Qdisc *sch) 417 417 { 418 418 struct fq_sched_data *q = qdisc_priv(sch); 419 - u64 now = ktime_to_ns(ktime_get()); 419 + u64 now = ktime_get_ns(); 420 420 struct fq_flow_head *head; 421 421 struct sk_buff *skb; 422 422 struct fq_flow *f; ··· 787 787 static int fq_dump_stats(struct Qdisc *sch, struct gnet_dump *d) 788 788 { 789 789 struct fq_sched_data *q = qdisc_priv(sch); 790 - u64 now = ktime_to_ns(ktime_get()); 790 + u64 now = ktime_get_ns(); 791 791 struct tc_fq_qd_stats st = { 792 792 .gc_flows = q->stat_gc_flows, 793 793 .highprio_packets = q->stat_internal_packets,
+3 -3
net/sched/sch_htb.c
··· 895 895 896 896 if (!sch->q.qlen) 897 897 goto fin; 898 - q->now = ktime_to_ns(ktime_get()); 898 + q->now = ktime_get_ns(); 899 899 start_at = jiffies; 900 900 901 901 next_event = q->now + 5LLU * NSEC_PER_SEC; ··· 1225 1225 parent->un.leaf.q = new_q ? new_q : &noop_qdisc; 1226 1226 parent->tokens = parent->buffer; 1227 1227 parent->ctokens = parent->cbuffer; 1228 - parent->t_c = ktime_to_ns(ktime_get()); 1228 + parent->t_c = ktime_get_ns(); 1229 1229 parent->cmode = HTB_CAN_SEND; 1230 1230 } 1231 1231 ··· 1455 1455 cl->tokens = PSCHED_TICKS2NS(hopt->buffer); 1456 1456 cl->ctokens = PSCHED_TICKS2NS(hopt->cbuffer); 1457 1457 cl->mbuffer = 60ULL * NSEC_PER_SEC; /* 1min */ 1458 - cl->t_c = ktime_to_ns(ktime_get()); 1458 + cl->t_c = ktime_get_ns(); 1459 1459 cl->cmode = HTB_CAN_SEND; 1460 1460 1461 1461 /* attach to the hash list and parent's family */
+3 -3
net/sched/sch_tbf.c
··· 239 239 s64 ptoks = 0; 240 240 unsigned int len = qdisc_pkt_len(skb); 241 241 242 - now = ktime_to_ns(ktime_get()); 242 + now = ktime_get_ns(); 243 243 toks = min_t(s64, now - q->t_c, q->buffer); 244 244 245 245 if (tbf_peak_present(q)) { ··· 292 292 293 293 qdisc_reset(q->qdisc); 294 294 sch->q.qlen = 0; 295 - q->t_c = ktime_to_ns(ktime_get()); 295 + q->t_c = ktime_get_ns(); 296 296 q->tokens = q->buffer; 297 297 q->ptokens = q->mtu; 298 298 qdisc_watchdog_cancel(&q->watchdog); ··· 431 431 if (opt == NULL) 432 432 return -EINVAL; 433 433 434 - q->t_c = ktime_to_ns(ktime_get()); 434 + q->t_c = ktime_get_ns(); 435 435 qdisc_watchdog_init(&q->watchdog, sch); 436 436 q->qdisc = &noop_qdisc; 437 437