Commit d98d58a0 authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by David S. Miller

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: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d93376f5
...@@ -3993,8 +3993,7 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt, ...@@ -3993,8 +3993,7 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
bool mono) bool mono)
{ {
skb->tstamp = kt; skb->tstamp = kt;
/* Setting mono_delivery_time will be enabled later */ skb->mono_delivery_time = kt && mono;
skb->mono_delivery_time = 0;
} }
DECLARE_STATIC_KEY_FALSE(netstamp_needed_key); DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);
......
...@@ -5220,8 +5220,10 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc, ...@@ -5220,8 +5220,10 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
goto out; goto out;
} }
if (skb_skip_tc_classify(skb)) if (skb_skip_tc_classify(skb)) {
skb_clear_delivery_time(skb);
goto skip_classify; goto skip_classify;
}
if (pfmemalloc) if (pfmemalloc)
goto skip_taps; goto skip_taps;
...@@ -5250,12 +5252,14 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc, ...@@ -5250,12 +5252,14 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
goto another_round; goto another_round;
if (!skb) if (!skb)
goto out; goto out;
skb_clear_delivery_time(skb);
nf_skip_egress(skb, false); nf_skip_egress(skb, false);
if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)
goto out; goto out;
} } else
#endif #endif
skb_clear_delivery_time(skb);
skb_reset_redirect(skb); skb_reset_redirect(skb);
skip_classify: skip_classify:
if (pfmemalloc && !skb_pfmemalloc_protocol(skb)) if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
......
...@@ -1728,8 +1728,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, ...@@ -1728,8 +1728,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
arg->csumoffset) = csum_fold(csum_add(nskb->csum, arg->csumoffset) = csum_fold(csum_add(nskb->csum,
arg->csum)); arg->csum));
nskb->ip_summed = CHECKSUM_NONE; nskb->ip_summed = CHECKSUM_NONE;
/* Setting mono_delivery_time will be enabled later */ nskb->mono_delivery_time = !!transmit_time;
nskb->mono_delivery_time = 0;
ip_push_pending_frames(sk, &fl4); ip_push_pending_frames(sk, &fl4);
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment