net: use ktime_get_ns() and ktime_get_real_ns() helpers
authorEric Dumazet <edumazet@google.com>
Sat, 23 Aug 2014 01:32:09 +0000 (18:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Aug 2014 02:57:23 +0000 (19:57 -0700)
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>
include/net/codel.h
include/net/pkt_sched.h
net/core/secure_seq.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_standalone.c
net/sched/act_police.c
net/sched/sch_fq.c
net/sched/sch_htb.c
net/sched/sch_tbf.c

index fe0eab32ce76dd42845e8bc466c8bade5f429157..aeee28081245c9215f10badd611f58ba0124fcd0 100644 (file)
@@ -66,7 +66,7 @@ typedef s32 codel_tdiff_t;
 
 static inline codel_time_t codel_get_time(void)
 {
-       u64 ns = ktime_to_ns(ktime_get());
+       u64 ns = ktime_get_ns();
 
        return ns >> CODEL_SHIFT;
 }
index ec030cd7661693d3812035d350e242f9b271edc4..8bbe626e9ece3d927047fa59b8717301c65c6130 100644 (file)
@@ -50,7 +50,7 @@ typedef long  psched_tdiff_t;
 
 static inline psched_time_t psched_get_time(void)
 {
-       return PSCHED_NS2TICKS(ktime_to_ns(ktime_get()));
+       return PSCHED_NS2TICKS(ktime_get_ns());
 }
 
 static inline psched_tdiff_t
index ba71212f0251218c3c41599838e36aa8e169fea7..51dd3193a33ebb26ea3c008e752d1f2832f791d8 100644 (file)
@@ -35,7 +35,7 @@ static u32 seq_scale(u32 seq)
         *      overlaps less than one time per MSL (2 minutes).
         *      Choosing a clock of 64 ns period is OK. (period of 274 s)
         */
-       return seq + (ktime_to_ns(ktime_get_real()) >> 6);
+       return seq + (ktime_get_real_ns() >> 6);
 }
 #endif
 
@@ -135,7 +135,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
        md5_transform(hash, net_secret);
 
        seq = hash[0] | (((u64)hash[1]) << 32);
-       seq += ktime_to_ns(ktime_get_real());
+       seq += ktime_get_real_ns();
        seq &= (1ull << 48) - 1;
 
        return seq;
@@ -163,7 +163,7 @@ u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
        md5_transform(hash, secret);
 
        seq = hash[0] | (((u64)hash[1]) << 32);
-       seq += ktime_to_ns(ktime_get_real());
+       seq += ktime_get_real_ns();
        seq &= (1ull << 48) - 1;
 
        return seq;
index de88c4ab5146a168bc0866f3fdc07098b5ebe543..0b634e7f165208cf17aec37b0d141c51b7d69d7b 100644 (file)
@@ -358,7 +358,7 @@ bool nf_ct_delete(struct nf_conn *ct, u32 portid, int report)
 
        tstamp = nf_conn_tstamp_find(ct);
        if (tstamp && tstamp->stop == 0)
-               tstamp->stop = ktime_to_ns(ktime_get_real());
+               tstamp->stop = ktime_get_real_ns();
 
        if (nf_ct_is_dying(ct))
                goto delete;
index 355a5c4ef7635bb7aca1e1068ca269b891949550..1bd9ed9e62f642477e8a10d57cd73775cc1ebc14 100644 (file)
@@ -1737,7 +1737,7 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
        }
        tstamp = nf_conn_tstamp_find(ct);
        if (tstamp)
-               tstamp->start = ktime_to_ns(ktime_get_real());
+               tstamp->start = ktime_get_real_ns();
 
        err = nf_conntrack_hash_check_insert(ct);
        if (err < 0)
index f641751dba9dc467b4207716bdb0ac69208747f8..cf65a1e040dd8c8920dd8fc330c75c218ea7050b 100644 (file)
@@ -101,7 +101,7 @@ static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
 {
        struct ct_iter_state *st = seq->private;
 
-       st->time_now = ktime_to_ns(ktime_get_real());
+       st->time_now = ktime_get_real_ns();
        rcu_read_lock();
        return ct_get_idx(seq, *pos);
 }
index 0566e4606a4ac86710ebbc04a80c9ad1729849cd..f32bcb0949154c5992eeb93e3e6b8ff576812060 100644 (file)
@@ -231,7 +231,7 @@ override:
        if (ret != ACT_P_CREATED)
                return ret;
 
-       police->tcfp_t_c = ktime_to_ns(ktime_get());
+       police->tcfp_t_c = ktime_get_ns();
        police->tcf_index = parm->index ? parm->index :
                tcf_hash_new_index(hinfo);
        h = tcf_hash(police->tcf_index, POL_TAB_MASK);
@@ -279,7 +279,7 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
                        return police->tcfp_result;
                }
 
-               now = ktime_to_ns(ktime_get());
+               now = ktime_get_ns();
                toks = min_t(s64, now - police->tcfp_t_c,
                             police->tcfp_burst);
                if (police->peak_present) {
index ba32c2b005d0821788f656e8ae05d4d47a862351..e12f997e1b4ca9862f408f6751713c793d747606 100644 (file)
@@ -416,7 +416,7 @@ static void fq_check_throttled(struct fq_sched_data *q, u64 now)
 static struct sk_buff *fq_dequeue(struct Qdisc *sch)
 {
        struct fq_sched_data *q = qdisc_priv(sch);
-       u64 now = ktime_to_ns(ktime_get());
+       u64 now = ktime_get_ns();
        struct fq_flow_head *head;
        struct sk_buff *skb;
        struct fq_flow *f;
@@ -787,7 +787,7 @@ nla_put_failure:
 static int fq_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
 {
        struct fq_sched_data *q = qdisc_priv(sch);
-       u64 now = ktime_to_ns(ktime_get());
+       u64 now = ktime_get_ns();
        struct tc_fq_qd_stats st = {
                .gc_flows               = q->stat_gc_flows,
                .highprio_packets       = q->stat_internal_packets,
index 9f949abcacef1680dcdc15579c7fe56611f21852..aea942ce6008c542982ab503555b925733ede962 100644 (file)
@@ -895,7 +895,7 @@ ok:
 
        if (!sch->q.qlen)
                goto fin;
-       q->now = ktime_to_ns(ktime_get());
+       q->now = ktime_get_ns();
        start_at = jiffies;
 
        next_event = q->now + 5LLU * NSEC_PER_SEC;
@@ -1225,7 +1225,7 @@ static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl,
        parent->un.leaf.q = new_q ? new_q : &noop_qdisc;
        parent->tokens = parent->buffer;
        parent->ctokens = parent->cbuffer;
-       parent->t_c = ktime_to_ns(ktime_get());
+       parent->t_c = ktime_get_ns();
        parent->cmode = HTB_CAN_SEND;
 }
 
@@ -1455,7 +1455,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                cl->tokens = PSCHED_TICKS2NS(hopt->buffer);
                cl->ctokens = PSCHED_TICKS2NS(hopt->cbuffer);
                cl->mbuffer = 60ULL * NSEC_PER_SEC;     /* 1min */
-               cl->t_c = ktime_to_ns(ktime_get());
+               cl->t_c = ktime_get_ns();
                cl->cmode = HTB_CAN_SEND;
 
                /* attach to the hash list and parent's family */
index 18ff634337092d5f8e7cba8fe817542f1455738f..0c39b754083b2028438289ddd8a5a292a1cbf938 100644 (file)
@@ -239,7 +239,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc *sch)
                s64 ptoks = 0;
                unsigned int len = qdisc_pkt_len(skb);
 
-               now = ktime_to_ns(ktime_get());
+               now = ktime_get_ns();
                toks = min_t(s64, now - q->t_c, q->buffer);
 
                if (tbf_peak_present(q)) {
@@ -292,7 +292,7 @@ static void tbf_reset(struct Qdisc *sch)
 
        qdisc_reset(q->qdisc);
        sch->q.qlen = 0;
-       q->t_c = ktime_to_ns(ktime_get());
+       q->t_c = ktime_get_ns();
        q->tokens = q->buffer;
        q->ptokens = q->mtu;
        qdisc_watchdog_cancel(&q->watchdog);
@@ -431,7 +431,7 @@ static int tbf_init(struct Qdisc *sch, struct nlattr *opt)
        if (opt == NULL)
                return -EINVAL;
 
-       q->t_c = ktime_to_ns(ktime_get());
+       q->t_c = ktime_get_ns();
        qdisc_watchdog_init(&q->watchdog, sch);
        q->qdisc = &noop_qdisc;