Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53eb440f authored by Jamal Hadi Salim's avatar Jamal Hadi Salim Committed by David S. Miller
Browse files

net sched actions: introduce timestamp for firsttime use



Useful to know when the action was first used for accounting
(and debugging)

Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9c4a4e48
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ static inline void tcf_lastuse_update(struct tcf_t *tm)

	if (tm->lastuse != now)
		tm->lastuse = now;
	if (unlikely(!tm->firstuse))
		tm->firstuse = now;
}

struct tc_action {
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ struct tcf_t {
	__u64   install;
	__u64   lastuse;
	__u64   expires;
	__u64   firstuse;
};

struct tc_cnt {
+1 −0
Original line number Diff line number Diff line
@@ -283,6 +283,7 @@ int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
	p->tcfc_index = index ? index : tcf_hash_new_index(tn);
	p->tcfc_tm.install = jiffies;
	p->tcfc_tm.lastuse = jiffies;
	p->tcfc_tm.firstuse = 0;
	if (est) {
		err = gen_new_estimator(&p->tcfc_bstats, p->cpu_bstats,
					&p->tcfc_rate_est,
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ static int tcf_bpf_dump(struct sk_buff *skb, struct tc_action *act,

	tm.install = jiffies_to_clock_t(jiffies - prog->tcf_tm.install);
	tm.lastuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.lastuse);
	tm.firstuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.firstuse);
	tm.expires = jiffies_to_clock_t(prog->tcf_tm.expires);

	if (nla_put_64bit(skb, TCA_ACT_BPF_TM, sizeof(tm), &tm,
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a,
	t.install = jiffies_to_clock_t(jiffies - ci->tcf_tm.install);
	t.lastuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.lastuse);
	t.expires = jiffies_to_clock_t(ci->tcf_tm.expires);
	t.firstuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.firstuse);
	if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t,
			  TCA_CONNMARK_PAD))
		goto nla_put_failure;
Loading