* [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
@ 2016-05-17 23:38 Jamal Hadi Salim
2016-05-18 17:17 ` Cong Wang
0 siblings, 1 reply; 7+ messages in thread
From: Jamal Hadi Salim @ 2016-05-17 23:38 UTC (permalink / raw)
To: davem
Cc: netdev, xiyou.wangcong, daniel, nbd, baronchon, alexander.duyck,
herbert, eric.dumazet, jiri, alexei.starovoitov, Jamal Hadi Salim
From: Jamal Hadi Salim <jhs@mojatatu.com>
Useful to know when the action was first used for accounting
(and debugging)
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
include/net/act_api.h | 2 ++
include/uapi/linux/pkt_cls.h | 1 +
net/sched/act_api.c | 1 +
net/sched/act_bpf.c | 1 +
net/sched/act_connmark.c | 1 +
net/sched/act_csum.c | 1 +
net/sched/act_gact.c | 1 +
net/sched/act_ipt.c | 1 +
net/sched/act_mirred.c | 1 +
net/sched/act_nat.c | 1 +
net/sched/act_pedit.c | 1 +
net/sched/act_simple.c | 1 +
net/sched/act_skbedit.c | 1 +
net/sched/act_vlan.c | 1 +
14 files changed, 15 insertions(+)
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 3278a9d..e15e236 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -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 {
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index de07ae6..64a3054 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -124,6 +124,7 @@ struct tcf_t {
__u64 install;
__u64 lastuse;
__u64 expires;
+ __u64 firstuse;
};
struct tc_cnt {
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index b2a61ee..719bc2e 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -283,6 +283,7 @@ err2:
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,
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 014f9a6..f581e01 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -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,
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index e0e6c68..e3f64f2 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -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;
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 065f716..7725eafb 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -548,6 +548,7 @@ static int tcf_csum_dump(struct sk_buff *skb,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index e96e3a5..1f3baec 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -177,6 +177,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a,
#endif
t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 65bc135..43bf8ff 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -281,6 +281,7 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind,
goto nla_put_failure;
tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
+ tm.firstuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.firstuse);
tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index f718090..5b1423f 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -220,6 +220,7 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - m->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(m->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 9135aa8..9fbf780 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -266,6 +266,7 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 67a1726..fb89275 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -202,6 +202,7 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index bfdfc66..9d9892c 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -160,6 +160,7 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index d9d1f41..7d3216c 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -174,6 +174,7 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 68da2eb..4b1c2c0 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -185,6 +185,7 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a,
t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install);
t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse);
+ t.firstuse = jiffies_to_clock_t(jiffies - v->tcf_tm.firstuse);
t.expires = jiffies_to_clock_t(v->tcf_tm.expires);
if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD))
goto nla_put_failure;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-17 23:38 [net-next RFC 1/1] net sched actions: introduce timestamp for first time used Jamal Hadi Salim
@ 2016-05-18 17:17 ` Cong Wang
2016-05-19 11:54 ` Jamal Hadi Salim
0 siblings, 1 reply; 7+ messages in thread
From: Cong Wang @ 2016-05-18 17:17 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
nbd, baronchon, Alexander Duyck, Herbert Xu, Eric Dumazet,
Jiří Pírko, Alexei Starovoitov
On Tue, May 17, 2016 at 4:38 PM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
> index 014f9a6..f581e01 100644
> --- a/net/sched/act_bpf.c
> +++ b/net/sched/act_bpf.c
> @@ -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);
I think it is the time to add a wrapper for these tm.XX =
jiffies_to_clock_t(XXX).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-18 17:17 ` Cong Wang
@ 2016-05-19 11:54 ` Jamal Hadi Salim
2016-05-19 12:15 ` Jamal Hadi Salim
0 siblings, 1 reply; 7+ messages in thread
From: Jamal Hadi Salim @ 2016-05-19 11:54 UTC (permalink / raw)
To: Cong Wang
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
nbd, baronchon, Alexander Duyck, Herbert Xu, Eric Dumazet,
Jiří Pírko, Alexei Starovoitov
On 16-05-18 01:17 PM, Cong Wang wrote:
> On Tue, May 17, 2016 at 4:38 PM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
>> diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
>> index 014f9a6..f581e01 100644
>> --- a/net/sched/act_bpf.c
>> +++ b/net/sched/act_bpf.c
>> @@ -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);
>
>
> I think it is the time to add a wrapper for these tm.XX =
> jiffies_to_clock_t(XXX).
>
Agreed. Will send a patch.
Actually I will resend the firstuse as well without RFC tag
and the wrapper one as separate patch.
cheers,
jamal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-19 11:54 ` Jamal Hadi Salim
@ 2016-05-19 12:15 ` Jamal Hadi Salim
2016-05-19 16:38 ` Cong Wang
0 siblings, 1 reply; 7+ messages in thread
From: Jamal Hadi Salim @ 2016-05-19 12:15 UTC (permalink / raw)
To: Cong Wang
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
nbd, baronchon, Alexander Duyck, Herbert Xu, Eric Dumazet,
Jiří Pírko, Alexei Starovoitov
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
On 16-05-19 07:54 AM, Jamal Hadi Salim wrote:
> On 16-05-18 01:17 PM, Cong Wang wrote:
>> I think it is the time to add a wrapper for these tm.XX =
>> jiffies_to_clock_t(XXX).
>>
>
> Agreed. Will send a patch.
> Actually I will resend the firstuse as well without RFC tag
> and the wrapper one as separate patch.
>
Something like attached - compiles but untested.
I will test later and do formal submission.
cheers,
jamal
> cheers,
> jamal
[-- Attachment #2: patch-aggreg-tmdump --]
[-- Type: text/plain, Size: 9075 bytes --]
diff --git a/include/net/act_api.h b/include/net/act_api.h
index e15e236..12b2d8f 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -80,6 +80,14 @@ static inline void tcf_lastuse_update(struct tcf_t *tm)
tm->firstuse = now;
}
+static inline void tcf_tm_dump(struct tcf_t *stm, struct tcf_t *dtm)
+{
+ dtm->install = jiffies_to_clock_t(jiffies - stm->install);
+ dtm->lastuse = jiffies_to_clock_t(jiffies - stm->lastuse);
+ dtm->firstuse = jiffies_to_clock_t(jiffies - stm->firstuse);
+ dtm->expires = jiffies_to_clock_t(stm->expires);
+}
+
struct tc_action {
void *priv;
const struct tc_action_ops *ops;
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index f581e01..01f9706 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -154,11 +154,7 @@ static int tcf_bpf_dump(struct sk_buff *skb, struct tc_action *act,
if (ret)
goto nla_put_failure;
- 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);
-
+ tcf_tm_dump(&prog->tcf_tm, &tm);
if (nla_put_64bit(skb, TCA_ACT_BPF_TM, sizeof(tm), &tm,
TCA_ACT_BPF_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index e3f64f2..5145026 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -160,10 +160,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a,
if (nla_put(skb, TCA_CONNMARK_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
- 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);
+ tcf_tm_dump(&ci->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t,
TCA_CONNMARK_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 7725eafb..ef21d0b 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -546,10 +546,8 @@ static int tcf_csum_dump(struct sk_buff *skb,
if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
+
+ tcf_tm_dump(&p->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 1f3baec..47283f7 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -175,10 +175,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
}
#endif
- t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
+ tcf_tm_dump(&gact->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD))
goto nla_put_failure;
return skb->len;
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 5daeab6..4bc3386 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -553,9 +553,7 @@ static int tcf_ife_dump(struct sk_buff *skb, struct tc_action *a, int bind,
if (nla_put(skb, TCA_IFE_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - ife->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - ife->tcf_tm.lastuse);
- t.expires = jiffies_to_clock_t(ife->tcf_tm.expires);
+ tcf_tm_dump(&ife->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_IFE_TM, sizeof(t), &t, TCA_IFE_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 43bf8ff..6c9bece 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -279,12 +279,11 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind,
nla_put(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c) ||
nla_put_string(skb, TCA_IPT_TABLE, ipt->tcfi_tname))
goto nla_put_failure;
- tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
- tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
- tm.firstuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.firstuse);
- tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
+
+ tcf_tm_dump(&ipt->tcf_tm, &tm);
if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD))
goto nla_put_failure;
+
kfree(t);
return skb->len;
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 5b1423f..435df65 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -218,10 +218,8 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
if (nla_put(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - m->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(m->tcf_tm.expires);
+
+ tcf_tm_dump(&m->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_MIRRED_TM, sizeof(t), &t, TCA_MIRRED_PAD))
goto nla_put_failure;
return skb->len;
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 9fbf780..ca91f57 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -264,10 +264,8 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a,
if (nla_put(skb, TCA_NAT_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
+
+ tcf_tm_dump(&p->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_NAT_TM, sizeof(t), &t, TCA_NAT_PAD))
goto nla_put_failure;
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index fb89275..0f53814 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -200,12 +200,11 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
if (nla_put(skb, TCA_PEDIT_PARMS, s, opt))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - p->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
+
+ tcf_tm_dump(&p->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_PEDIT_TM, sizeof(t), &t, TCA_PEDIT_PAD))
goto nla_put_failure;
+
kfree(opt);
return skb->len;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 9d9892c..930647f 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -158,10 +158,8 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
if (nla_put(skb, TCA_DEF_PARMS, sizeof(opt), &opt) ||
nla_put_string(skb, TCA_DEF_DATA, d->tcfd_defdata))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
+
+ tcf_tm_dump(&d->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD))
goto nla_put_failure;
return skb->len;
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 7d3216c..3a1ee45 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -172,10 +172,8 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
nla_put(skb, TCA_SKBEDIT_MARK, sizeof(d->mark),
&d->mark))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - d->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
+
+ tcf_tm_dump(&d->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_SKBEDIT_TM, sizeof(t), &t, TCA_SKBEDIT_PAD))
goto nla_put_failure;
return skb->len;
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 4b1c2c0..d596a8b 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -183,10 +183,7 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a,
v->tcfv_push_proto)))
goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse);
- t.firstuse = jiffies_to_clock_t(jiffies - v->tcf_tm.firstuse);
- t.expires = jiffies_to_clock_t(v->tcf_tm.expires);
+ tcf_tm_dump(&v->tcf_tm, &t);
if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD))
goto nla_put_failure;
return skb->len;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-19 12:15 ` Jamal Hadi Salim
@ 2016-05-19 16:38 ` Cong Wang
2016-05-20 5:16 ` Cong Wang
0 siblings, 1 reply; 7+ messages in thread
From: Cong Wang @ 2016-05-19 16:38 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
Felix Fietkau, baronchon, Alexander Duyck, Herbert Xu,
Eric Dumazet, Jiří Pírko, Alexei Starovoitov
On Thu, May 19, 2016 at 5:15 AM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> On 16-05-19 07:54 AM, Jamal Hadi Salim wrote:
>>
>> On 16-05-18 01:17 PM, Cong Wang wrote:
>
>
>>> I think it is the time to add a wrapper for these tm.XX =
>>> jiffies_to_clock_t(XXX).
>>>
>>
>> Agreed. Will send a patch.
>> Actually I will resend the firstuse as well without RFC tag
>> and the wrapper one as separate patch.
>>
>
> Something like attached - compiles but untested.
> I will test later and do formal submission.
Looks good.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-19 16:38 ` Cong Wang
@ 2016-05-20 5:16 ` Cong Wang
2016-05-22 16:32 ` Jamal Hadi Salim
0 siblings, 1 reply; 7+ messages in thread
From: Cong Wang @ 2016-05-20 5:16 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
Felix Fietkau, baronchon, Alexander Duyck, Herbert Xu,
Eric Dumazet, Jiří Pírko, Alexei Starovoitov
On Thu, May 19, 2016 at 9:38 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Thu, May 19, 2016 at 5:15 AM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
>> On 16-05-19 07:54 AM, Jamal Hadi Salim wrote:
>>>
>>> On 16-05-18 01:17 PM, Cong Wang wrote:
>>
>>
>>>> I think it is the time to add a wrapper for these tm.XX =
>>>> jiffies_to_clock_t(XXX).
>>>>
>>>
>>> Agreed. Will send a patch.
>>> Actually I will resend the firstuse as well without RFC tag
>>> and the wrapper one as separate patch.
>>>
>>
>> Something like attached - compiles but untested.
>> I will test later and do formal submission.
>
> Looks good.
One nit: It is better if you can swap 'stm' with 'dtm',
it looks odd to put destination on the right side.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [net-next RFC 1/1] net sched actions: introduce timestamp for first time used
2016-05-20 5:16 ` Cong Wang
@ 2016-05-22 16:32 ` Jamal Hadi Salim
0 siblings, 0 replies; 7+ messages in thread
From: Jamal Hadi Salim @ 2016-05-22 16:32 UTC (permalink / raw)
To: Cong Wang
Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann,
Felix Fietkau, baronchon, Alexander Duyck, Herbert Xu,
Eric Dumazet, Jiří Pírko, Alexei Starovoitov
On 16-05-20 01:16 AM, Cong Wang wrote:
> One nit: It is better if you can swap 'stm' with 'dtm',
> it looks odd to put destination on the right side.
>
Will make the change for when net-next opens up.
cheers,
jamal
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-22 16:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 23:38 [net-next RFC 1/1] net sched actions: introduce timestamp for first time used Jamal Hadi Salim
2016-05-18 17:17 ` Cong Wang
2016-05-19 11:54 ` Jamal Hadi Salim
2016-05-19 12:15 ` Jamal Hadi Salim
2016-05-19 16:38 ` Cong Wang
2016-05-20 5:16 ` Cong Wang
2016-05-22 16:32 ` Jamal Hadi Salim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).