Useful to know when the action was first used for accounting (and debugging)
Unified · Split
| @@ -76,6 +76,8 @@ static inline void tcf_lastuse_update(struct tcf_t *tm) · 75 unmodified lines | |||
| 76 | 76 | ||
| 77 | if (tm->lastuse != now) | 77 | if (tm->lastuse != now) |
| 78 | tm->lastuse = now; | 78 | tm->lastuse = now; |
| 79 | if (unlikely(!tm->firstuse)) | ||
| 80 | tm->firstuse = now; | ||
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | struct tc_action { | 83 | struct tc_action { |
| @@ -124,6 +124,7 @@ struct tcf_t { · 123 unmodified lines | |||
| 124 | __u64 install; | 124 | __u64 install; |
| 125 | __u64 lastuse; | 125 | __u64 lastuse; |
| 126 | __u64 expires; | 126 | __u64 expires; |
| 127 | __u64 firstuse; | ||
| 127 | }; | 128 | }; |
| 128 | 129 | ||
| 129 | struct tc_cnt { | 130 | struct tc_cnt { |
| @@ -283,6 +283,7 @@ err2: · 282 unmodified lines | |||
| 283 | p->tcfc_index = index ? index : tcf_hash_new_index(tn); | 283 | p->tcfc_index = index ? index : tcf_hash_new_index(tn); |
| 284 | p->tcfc_tm.install = jiffies; | 284 | p->tcfc_tm.install = jiffies; |
| 285 | p->tcfc_tm.lastuse = jiffies; | 285 | p->tcfc_tm.lastuse = jiffies; |
| 286 | p->tcfc_tm.firstuse = 0; | ||
| 286 | if (est) { | 287 | if (est) { |
| 287 | err = gen_new_estimator(&p->tcfc_bstats, p->cpu_bstats, | 288 | err = gen_new_estimator(&p->tcfc_bstats, p->cpu_bstats, |
| 288 | &p->tcfc_rate_est, | 289 | &p->tcfc_rate_est, |
| @@ -156,6 +156,7 @@ static int tcf_bpf_dump(struct sk_buff *skb, struct tc_action *act, · 155 unmodified lines | |||
| 156 | 156 | ||
| 157 | tm.install = jiffies_to_clock_t(jiffies - prog->tcf_tm.install); | 157 | tm.install = jiffies_to_clock_t(jiffies - prog->tcf_tm.install); |
| 158 | tm.lastuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.lastuse); | 158 | tm.lastuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.lastuse); |
| 159 | tm.firstuse = jiffies_to_clock_t(jiffies - prog->tcf_tm.firstuse); | ||
| 159 | tm.expires = jiffies_to_clock_t(prog->tcf_tm.expires); | 160 | tm.expires = jiffies_to_clock_t(prog->tcf_tm.expires); |
| 160 | 161 | ||
| 161 | if (nla_put_64bit(skb, TCA_ACT_BPF_TM, sizeof(tm), &tm, | 162 | if (nla_put_64bit(skb, TCA_ACT_BPF_TM, sizeof(tm), &tm, |
| @@ -163,6 +163,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, · 162 unmodified lines | |||
| 163 | t.install = jiffies_to_clock_t(jiffies - ci->tcf_tm.install); | 163 | t.install = jiffies_to_clock_t(jiffies - ci->tcf_tm.install); |
| 164 | t.lastuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.lastuse); | 164 | t.lastuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.lastuse); |
| 165 | t.expires = jiffies_to_clock_t(ci->tcf_tm.expires); | 165 | t.expires = jiffies_to_clock_t(ci->tcf_tm.expires); |
| 166 | t.firstuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.firstuse); | ||
| 166 | if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t, | 167 | if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t, |
| 167 | TCA_CONNMARK_PAD)) | 168 | TCA_CONNMARK_PAD)) |
| 168 | goto nla_put_failure; | 169 | goto nla_put_failure; |
| @@ -548,6 +548,7 @@ static int tcf_csum_dump(struct sk_buff *skb, · 547 unmodified lines | |||
| 548 | goto nla_put_failure; | 548 | goto nla_put_failure; |
| 549 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 549 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 550 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 550 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
| 551 | t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse); | ||
| 551 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 552 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 552 | if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD)) | 553 | if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD)) |
| 553 | goto nla_put_failure; | 554 | goto nla_put_failure; |
| @@ -190,6 +190,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int · 189 unmodified lines | |||
| 190 | #endif | 190 | #endif |
| 191 | t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); | 191 | t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); |
| 192 | t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); | 192 | t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); |
| 193 | t.firstuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.firstuse); | ||
| 193 | t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); | 194 | t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); |
| 194 | if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD)) | 195 | if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD)) |
| 195 | goto nla_put_failure; | 196 | goto nla_put_failure; |
| @@ -279,6 +279,7 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int · 278 unmodified lines | |||
| 279 | goto nla_put_failure; | 279 | goto nla_put_failure; |
| 280 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); | 280 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); |
| 281 | tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); | 281 | tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); |
| 282 | tm.firstuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.firstuse); | ||
| 282 | tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); | 283 | tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); |
| 283 | if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD)) | 284 | if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD)) |
| 284 | goto nla_put_failure; | 285 | goto nla_put_failure; |
| @@ -220,6 +220,7 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, i · 219 unmodified lines | |||
| 220 | goto nla_put_failure; | 220 | goto nla_put_failure; |
| 221 | t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); | 221 | t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); |
| 222 | t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse); | 222 | t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse); |
| 223 | t.firstuse = jiffies_to_clock_t(jiffies - m->tcf_tm.firstuse); | ||
| 223 | t.expires = jiffies_to_clock_t(m->tcf_tm.expires); | 224 | t.expires = jiffies_to_clock_t(m->tcf_tm.expires); |
| 224 | if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD)) | 225 | if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD)) |
| 225 | goto nla_put_failure; | 226 | goto nla_put_failure; |
| @@ -266,6 +266,7 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a, · 265 unmodified lines | |||
| 266 | goto nla_put_failure; | 266 | goto nla_put_failure; |
| 267 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 267 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 268 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 268 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
| 269 | t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse); | ||
| 269 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 270 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 270 | if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD)) | 271 | if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD)) |
| 271 | goto nla_put_failure; | 272 | goto nla_put_failure; |
| @@ -202,6 +202,7 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, · 201 unmodified lines | |||
| 202 | goto nla_put_failure; | 202 | goto nla_put_failure; |
| 203 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 203 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 204 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 204 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
| 205 | t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse); | ||
| 205 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 206 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 206 | if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD)) | 207 | if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD)) |
| 207 | goto nla_put_failure; | 208 | goto nla_put_failure; |
| @@ -241,6 +241,7 @@ override: · 240 unmodified lines | |||
| 241 | tcf_hash_new_index(tn); | 241 | tcf_hash_new_index(tn); |
| 242 | police->tcf_tm.install = jiffies; | 242 | police->tcf_tm.install = jiffies; |
| 243 | police->tcf_tm.lastuse = jiffies; | 243 | police->tcf_tm.lastuse = jiffies; |
| 244 | police->tcf_tm.firstuse = 0; | ||
| 244 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); | 245 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); |
| 245 | spin_lock_bh(&hinfo->lock); | 246 | spin_lock_bh(&hinfo->lock); |
| 246 | hlist_add_head(&police->tcf_head, &hinfo->htab[h]); | 247 | 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 | |||
| 347 | 348 | ||
| 348 | t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install); | 349 | t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install); |
| 349 | t.lastuse = jiffies_to_clock_t(jiffies - police->tcf_tm.lastuse); | 350 | t.lastuse = jiffies_to_clock_t(jiffies - police->tcf_tm.lastuse); |
| 351 | t.firstuse = jiffies_to_clock_t(jiffies - police->tcf_tm.firstuse); | ||
| 350 | t.expires = jiffies_to_clock_t(police->tcf_tm.expires); | 352 | t.expires = jiffies_to_clock_t(police->tcf_tm.expires); |
| 351 | if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD)) | 353 | if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD)) |
| 352 | goto nla_put_failure; | 354 | goto nla_put_failure; |
| @@ -160,6 +160,7 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, · 159 unmodified lines | |||
| 160 | goto nla_put_failure; | 160 | goto nla_put_failure; |
| 161 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 161 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
| 162 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 162 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
| 163 | t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse); | ||
| 163 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 164 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
| 164 | if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD)) | 165 | if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD)) |
| 165 | goto nla_put_failure; | 166 | goto nla_put_failure; |
| @@ -170,6 +170,7 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a, · 169 unmodified lines | |||
| 170 | goto nla_put_failure; | 170 | goto nla_put_failure; |
| 171 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 171 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
| 172 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 172 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
| 173 | t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse); | ||
| 173 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 174 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
| 174 | if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD)) | 175 | if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD)) |
| 175 | goto nla_put_failure; | 176 | goto nla_put_failure; |
| @@ -184,6 +184,7 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, · 183 unmodified lines | |||
| 184 | 184 | ||
| 185 | t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install); | 185 | t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install); |
| 186 | t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse); | 186 | t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse); |
| 187 | t.firstuse = jiffies_to_clock_t(jiffies - v->tcf_tm.firstuse); | ||
| 187 | t.expires = jiffies_to_clock_t(v->tcf_tm.expires); | 188 | t.expires = jiffies_to_clock_t(v->tcf_tm.expires); |
| 188 | if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD)) | 189 | if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD)) |
| 189 | goto nla_put_failure; | 190 | goto nla_put_failure; |