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 | 77 | if (tm->lastuse != now) |
| 78 | 78 | tm->lastuse = now; |
| 79 | + if (unlikely(!tm->firstuse)) | |
| 80 | + tm->firstuse = now; | |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | 83 | struct tc_action { |
| @@ -124,6 +124,7 @@ struct tcf_t { · 123 unmodified lines | ||
| 124 | 124 | __u64 install; |
| 125 | 125 | __u64 lastuse; |
| 126 | 126 | __u64 expires; |
| 127 | + __u64 firstuse; | |
| 127 | 128 | }; |
| 128 | 129 | |
| 129 | 130 | struct tc_cnt { |
| @@ -283,6 +283,7 @@ err2: · 282 unmodified lines | ||
| 283 | 283 | p->tcfc_index = index ? index : tcf_hash_new_index(tn); |
| 284 | 284 | p->tcfc_tm.install = jiffies; |
| 285 | 285 | p->tcfc_tm.lastuse = jiffies; |
| 286 | + p->tcfc_tm.firstuse = 0; | |
| 286 | 287 | if (est) { |
| 287 | 288 | err = gen_new_estimator(&p->tcfc_bstats, p->cpu_bstats, |
| 288 | 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 | 157 | tm.install = jiffies_to_clock_t(jiffies - prog->tcf_tm.install); |
| 158 | 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 | 160 | tm.expires = jiffies_to_clock_t(prog->tcf_tm.expires); |
| 160 | 161 | |
| 161 | 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 | 163 | t.install = jiffies_to_clock_t(jiffies - ci->tcf_tm.install); |
| 164 | 164 | t.lastuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.lastuse); |
| 165 | 165 | t.expires = jiffies_to_clock_t(ci->tcf_tm.expires); |
| 166 | + t.firstuse = jiffies_to_clock_t(jiffies - ci->tcf_tm.firstuse); | |
| 166 | 167 | if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t, |
| 167 | 168 | TCA_CONNMARK_PAD)) |
| 168 | 169 | goto nla_put_failure; |
| @@ -548,6 +548,7 @@ static int tcf_csum_dump(struct sk_buff *skb, · 547 unmodified lines | ||
| 548 | 548 | goto nla_put_failure; |
| 549 | 549 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 550 | 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 | 552 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 552 | 553 | if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD)) |
| 553 | 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 | 190 | #endif |
| 191 | 191 | t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); |
| 192 | 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 | 194 | t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); |
| 194 | 195 | if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD)) |
| 195 | 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 | 279 | goto nla_put_failure; |
| 280 | 280 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); |
| 281 | 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 | 283 | tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); |
| 283 | 284 | if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD)) |
| 284 | 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 | 220 | goto nla_put_failure; |
| 221 | 221 | t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); |
| 222 | 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 | 224 | t.expires = jiffies_to_clock_t(m->tcf_tm.expires); |
| 224 | 225 | if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD)) |
| 225 | 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 | 266 | goto nla_put_failure; |
| 267 | 267 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 268 | 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 | 270 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 270 | 271 | if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD)) |
| 271 | 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 | 202 | goto nla_put_failure; |
| 203 | 203 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
| 204 | 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 | 206 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
| 206 | 207 | if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD)) |
| 207 | 208 | goto nla_put_failure; |
| @@ -241,6 +241,7 @@ override: · 240 unmodified lines | ||
| 241 | 241 | tcf_hash_new_index(tn); |
| 242 | 242 | police->tcf_tm.install = jiffies; |
| 243 | 243 | police->tcf_tm.lastuse = jiffies; |
| 244 | + police->tcf_tm.firstuse = 0; | |
| 244 | 245 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); |
| 245 | 246 | spin_lock_bh(&hinfo->lock); |
| 246 | 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 | 349 | t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install); |
| 349 | 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 | 352 | t.expires = jiffies_to_clock_t(police->tcf_tm.expires); |
| 351 | 353 | if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD)) |
| 352 | 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 | 160 | goto nla_put_failure; |
| 161 | 161 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
| 162 | 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 | 164 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
| 164 | 165 | if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD)) |
| 165 | 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 | 170 | goto nla_put_failure; |
| 171 | 171 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
| 172 | 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 | 174 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
| 174 | 175 | if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD)) |
| 175 | 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 | 185 | t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install); |
| 186 | 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 | 188 | t.expires = jiffies_to_clock_t(v->tcf_tm.expires); |
| 188 | 189 | if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD)) |
| 189 | 190 | goto nla_put_failure; |