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.
Unified · Split
| @@ -3993,8 +3993,7 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt, · 3992 unmodified lines | ||
| 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); |
| @@ -5220,8 +5220,10 @@ another_round: · 5219 unmodified lines | ||
| 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; |
| @@ -5250,12 +5252,14 @@ skip_taps: · 22 unmodified lines | ||
| 5250 | 5252 | goto another_round; |
| 5251 | 5253 | if (!skb) |
| 5252 | 5254 | goto out; |
| 5255 | + skb_clear_delivery_time(skb); | |
| 5253 | 5256 | |
| 5254 | 5257 | nf_skip_egress(skb, false); |
| 5255 | 5258 | if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) |
| 5256 | 5259 | goto out; |
| 5257 | − } | |
| 5260 | + } else | |
| 5258 | 5261 | #endif |
| 5262 | + skb_clear_delivery_time(skb); | |
| 5259 | 5263 | skb_reset_redirect(skb); |
| 5260 | 5264 | skip_classify: |
| 5261 | 5265 | if (pfmemalloc && !skb_pfmemalloc_protocol(skb)) |
| @@ -1728,8 +1728,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, · 1727 unmodified lines | ||
| 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: |