[PATCH v4 net-next 6/8] bpf: Clear skb->mono_delivery_time bit if needed after running tc-bpf@egress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The tc-bpf@egress reads and writes the skb->tstamp as delivery_time.
If tc-bpf@egress sets skb->tstamp to 0, skb->mono_delivery_time should
also be cleared.  It is done in cls_bpf.c and act_bpf.c after
running the tc-bpf@egress.

Signed-off-by: Martin KaFai Lau <kafai@xxxxxx>
---
 net/sched/act_bpf.c | 2 ++
 net/sched/cls_bpf.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 14c3bd0a5088..d89470976500 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -49,6 +49,8 @@ static int tcf_bpf_act(struct sk_buff *skb, const struct tc_action *act,
 	} else {
 		bpf_compute_data_pointers(skb);
 		filter_res = bpf_prog_run(filter, skb);
+		if (unlikely(skb->mono_delivery_time && !skb->tstamp))
+			skb->mono_delivery_time = 0;
 	}
 	if (skb_sk_is_prefetched(skb) && filter_res != TC_ACT_OK)
 		skb_orphan(skb);
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 036b2e1f74af..c251d1df1fa3 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -97,6 +97,8 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		} else {
 			bpf_compute_data_pointers(skb);
 			filter_res = bpf_prog_run(prog->filter, skb);
+			if (unlikely(skb->mono_delivery_time && !skb->tstamp))
+				skb->mono_delivery_time = 0;
 		}
 
 		if (prog->exts_integrated) {
-- 
2.30.2





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux