History

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.

Martin KaFai Lau committed 4 years ago

Commit d98d58a1 parent d93376f3 files · +8 −6Browse files

Unified · Split

3 files
  1. include/linux/skbuff.h +1 −2
  2. net/core/dev.c +6 −2
  3. net/ipv4/ip_output.c +1 −2
include/linux/skbuff.h+1−2
@@ -3993,8 +3993,7 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt, · 3992 unmodified lines
3993 bool mono)3993 bool mono)
3994{3994{
3995 skb->tstamp = kt;3995 skb->tstamp = kt;
3996 /* Setting mono_delivery_time will be enabled later */3996 skb->mono_delivery_time = kt && mono;
3997 skb->mono_delivery_time = 0;
3998}3997}
3999 3998
4000DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);3999DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);
net/core/dev.c+6−2
@@ -5220,8 +5220,10 @@ another_round: · 5219 unmodified lines
5220 goto out;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 goto skip_classify;5225 goto skip_classify;
5226 }
5225 5227
5226 if (pfmemalloc)5228 if (pfmemalloc)
5227 goto skip_taps;5229 goto skip_taps;
@@ -5250,12 +5252,14 @@ skip_taps: · 22 unmodified lines
5250 goto another_round;5252 goto another_round;
5251 if (!skb)5253 if (!skb)
5252 goto out;5254 goto out;
5255 skb_clear_delivery_time(skb);
5253 5256
5254 nf_skip_egress(skb, false);5257 nf_skip_egress(skb, false);
5255 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)5258 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)
5256 goto out;5259 goto out;
5257 }5260 } else
5258#endif5261#endif
5262 skb_clear_delivery_time(skb);
5259 skb_reset_redirect(skb);5263 skb_reset_redirect(skb);
5260skip_classify:5264skip_classify:
5261 if (pfmemalloc && !skb_pfmemalloc_protocol(skb))5265 if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
net/ipv4/ip_output.c+1−2
@@ -1728,8 +1728,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, · 1727 unmodified lines
1728 arg->csumoffset) = csum_fold(csum_add(nskb->csum,1728 arg->csumoffset) = csum_fold(csum_add(nskb->csum,
1729 arg->csum));1729 arg->csum));
1730 nskb->ip_summed = CHECKSUM_NONE;1730 nskb->ip_summed = CHECKSUM_NONE;
1731 /* Setting mono_delivery_time will be enabled later */1731 nskb->mono_delivery_time = !!transmit_time;
1732 nskb->mono_delivery_time = 0;
1733 ip_push_pending_frames(sk, &fl4);1732 ip_push_pending_frames(sk, &fl4);
1734 }1733 }
1735out:1734out:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t