Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: Set skb->mono_delivery_time and clear it after sch_handle_ingress()

The previous patches handled the delivery_time before sch_handle_ingress().

This patch can now set the skb->mono_delivery_time to flag the skb->tstamp
is used as the mono delivery_time (EDT) instead of the (rcv) timestamp
and also clear it with skb_clear_delivery_time() after
sch_handle_ingress(). This will make the bpf_redirect_*()
to keep the mono delivery_time and used by a qdisc (fq) of
the egress-ing interface.

A latter patch will postpone the skb_clear_delivery_time() until the
stack learns that the skb is being delivered locally and that will
make other kernel forwarding paths (ip[6]_forward) able to keep
the delivery_time also. Thus, like the previous patches on using
the skb->mono_delivery_time bit, calling skb_clear_delivery_time()
is not limited within the CONFIG_NET_INGRESS to avoid too many code
churns among this set.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Martin KaFai Lau and committed by
David S. Miller
d98d58a0 d93376f5

+8 -6
+1 -2
include/linux/skbuff.h
··· 3993 3993 bool mono) 3994 3994 { 3995 3995 skb->tstamp = kt; 3996 - /* Setting mono_delivery_time will be enabled later */ 3997 - skb->mono_delivery_time = 0; 3996 + skb->mono_delivery_time = kt && mono; 3998 3997 } 3999 3998 4000 3999 DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);
+6 -2
net/core/dev.c
··· 5220 5220 goto out; 5221 5221 } 5222 5222 5223 - if (skb_skip_tc_classify(skb)) 5223 + if (skb_skip_tc_classify(skb)) { 5224 + skb_clear_delivery_time(skb); 5224 5225 goto skip_classify; 5226 + } 5225 5227 5226 5228 if (pfmemalloc) 5227 5229 goto skip_taps; ··· 5252 5250 goto another_round; 5253 5251 if (!skb) 5254 5252 goto out; 5253 + skb_clear_delivery_time(skb); 5255 5254 5256 5255 nf_skip_egress(skb, false); 5257 5256 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) 5258 5257 goto out; 5259 - } 5258 + } else 5260 5259 #endif 5260 + skb_clear_delivery_time(skb); 5261 5261 skb_reset_redirect(skb); 5262 5262 skip_classify: 5263 5263 if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
+1 -2
net/ipv4/ip_output.c
··· 1728 1728 arg->csumoffset) = csum_fold(csum_add(nskb->csum, 1729 1729 arg->csum)); 1730 1730 nskb->ip_summed = CHECKSUM_NONE; 1731 - /* Setting mono_delivery_time will be enabled later */ 1732 - nskb->mono_delivery_time = 0; 1731 + nskb->mono_delivery_time = !!transmit_time; 1733 1732 ip_push_pending_frames(sk, &fl4); 1734 1733 } 1735 1734 out: