History

net sched actions: introduce timestamp for firsttime use

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

Jamal Hadi Salim committed 10 years ago

Commit 53eb4401 parent 9c4a4e415 files · +17 −0Browse files

Unified · Split

15 files
  1. include/net/act_api.h +2 −0
  2. include/uapi/linux/pkt_cls.h +1 −0
  3. net/sched/act_api.c +1 −0
  4. net/sched/act_bpf.c +1 −0
  5. net/sched/act_connmark.c +1 −0
  6. net/sched/act_csum.c +1 −0
  7. net/sched/act_gact.c +1 −0
  8. net/sched/act_ipt.c +1 −0
  9. net/sched/act_mirred.c +1 −0
  10. net/sched/act_nat.c +1 −0
  11. net/sched/act_pedit.c +1 −0
  12. net/sched/act_police.c +2 −0
  13. net/sched/act_simple.c +1 −0
  14. net/sched/act_skbedit.c +1 −0
  15. net/sched/act_vlan.c +1 −0
include/net/act_api.h+2−0
@@ -76,6 +76,8 @@ static inline void tcf_lastuse_update(struct tcf_t *tm) · 75 unmodified lines
7676
7777 if (tm->lastuse != now)
7878 tm->lastuse = now;
79+ if (unlikely(!tm->firstuse))
80+ tm->firstuse = now;
7981 }
8082
8183 struct tc_action {
include/uapi/linux/pkt_cls.h+1−0
@@ -124,6 +124,7 @@ struct tcf_t { · 123 unmodified lines
124124 __u64 install;
125125 __u64 lastuse;
126126 __u64 expires;
127+ __u64 firstuse;
127128 };
128129
129130 struct tc_cnt {
net/sched/act_api.c+1−0
@@ -283,6 +283,7 @@ err2: · 282 unmodified lines
283283 p->tcfc_index = index ? index : tcf_hash_new_index(tn);
284284 p->tcfc_tm.install = jiffies;
285285 p->tcfc_tm.lastuse = jiffies;
286+ p->tcfc_tm.firstuse = 0;
286287 if (est) {
287288 err = gen_new_estimator(&p->tcfc_bstats, p->cpu_bstats,
288289 &p->tcfc_rate_est,
net/sched/act_bpf.c+1−0
@@ -156,6 +156,7 @@ static int tcf_bpf_dump(struct sk_buff *skb, struct tc_action *act, · 155 unmodified lines
156156
157157 tm.install = jiffies_to_clock_t(jiffies - prog->tcf_tm.install);
158158 tm.lastuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.lastuse);
159+ tm.firstuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.firstuse);
159160 tm.expires = jiffies_to_clock_t(prog->tcf_tm.expires);
160161
161162 if (nla_put_64bit(skb, TCA_ACT_BPF_TM, sizeof(tm), &tm,
net/sched/act_connmark.c+1−0
@@ -163,6 +163,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, · 162 unmodified lines
163163 t.install = jiffies_to_clock_t(jiffies - ci->tcf_tm.install);
164164 t.lastuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.lastuse);
165165 t.expires = jiffies_to_clock_t(ci->tcf_tm.expires);
166+ t.firstuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.firstuse);
166167 if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t,
167168 TCA_CONNMARK_PAD))
168169 goto nla_put_failure;
net/sched/act_csum.c+1−0
@@ -548,6 +548,7 @@ static int tcf_csum_dump(struct sk_buff *skb, · 547 unmodified lines
548548 goto nla_put_failure;
549549 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
550550 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
551+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
551552 t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
552553 if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD))
553554 goto nla_put_failure;
net/sched/act_gact.c+1−0
@@ -190,6 +190,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int · 189 unmodified lines
190190 #endif
191191 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
192192 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
193+ t.firstuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.firstuse);
193194 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
194195 if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD))
195196 goto nla_put_failure;
net/sched/act_ipt.c+1−0
@@ -279,6 +279,7 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int · 278 unmodified lines
279279 goto nla_put_failure;
280280 tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
281281 tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
282+ tm.firstuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.firstuse);
282283 tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
283284 if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD))
284285 goto nla_put_failure;
net/sched/act_mirred.c+1−0
@@ -220,6 +220,7 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, i · 219 unmodified lines
220220 goto nla_put_failure;
221221 t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install);
222222 t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
223+ t.firstuse = jiffies_to_clock_t(jiffies - m->tcf_tm.firstuse);
223224 t.expires = jiffies_to_clock_t(m->tcf_tm.expires);
224225 if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD))
225226 goto nla_put_failure;
net/sched/act_nat.c+1−0
@@ -266,6 +266,7 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a, · 265 unmodified lines
266266 goto nla_put_failure;
267267 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
268268 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
269+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
269270 t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
270271 if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD))
271272 goto nla_put_failure;
net/sched/act_pedit.c+1−0
@@ -202,6 +202,7 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, · 201 unmodified lines
202202 goto nla_put_failure;
203203 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
204204 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
205+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
205206 t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
206207 if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD))
207208 goto nla_put_failure;
net/sched/act_police.c+2−0
@@ -241,6 +241,7 @@ override: · 240 unmodified lines
241241 tcf_hash_new_index(tn);
242242 police->tcf_tm.install = jiffies;
243243 police->tcf_tm.lastuse = jiffies;
244+ police->tcf_tm.firstuse = 0;
244245 h = tcf_hash(police->tcf_index, POL_TAB_MASK);
245246 spin_lock_bh(&hinfo->lock);
246247 hlist_add_head(&police->tcf_head, &hinfo->htab[h]);
@@ -347,6 +348,7 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) · 100 unmodified lines
347348
348349 t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install);
349350 t.lastuse = jiffies_to_clock_t(jiffies - police->tcf_tm.lastuse);
351+ t.firstuse = jiffies_to_clock_t(jiffies - police->tcf_tm.firstuse);
350352 t.expires = jiffies_to_clock_t(police->tcf_tm.expires);
351353 if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD))
352354 goto nla_put_failure;
net/sched/act_simple.c+1−0
@@ -160,6 +160,7 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, · 159 unmodified lines
160160 goto nla_put_failure;
161161 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
162162 t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
163+ t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
163164 t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
164165 if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD))
165166 goto nla_put_failure;
net/sched/act_skbedit.c+1−0
@@ -170,6 +170,7 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a, · 169 unmodified lines
170170 goto nla_put_failure;
171171 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
172172 t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
173+ t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
173174 t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
174175 if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD))
175176 goto nla_put_failure;
net/sched/act_vlan.c+1−0
@@ -184,6 +184,7 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, · 183 unmodified lines
184184
185185 t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install);
186186 t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse);
187+ t.firstuse = jiffies_to_clock_t(jiffies - v->tcf_tm.firstuse);
187188 t.expires = jiffies_to_clock_t(v->tcf_tm.expires);
188189 if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD))
189190 goto nla_put_failure;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t