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
39933993 bool mono)
39943994 {
39953995 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;
39983997 }
39993998
40003999 DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);
net/core/dev.c+6−2
@@ -5220,8 +5220,10 @@ another_round: · 5219 unmodified lines
52205220 goto out;
52215221 }
52225222
5223− if (skb_skip_tc_classify(skb))
5223+ if (skb_skip_tc_classify(skb)) {
5224+ skb_clear_delivery_time(skb);
52245225 goto skip_classify;
5226+ }
52255227
52265228 if (pfmemalloc)
52275229 goto skip_taps;
@@ -5250,12 +5252,14 @@ skip_taps: · 22 unmodified lines
52505252 goto another_round;
52515253 if (!skb)
52525254 goto out;
5255+ skb_clear_delivery_time(skb);
52535256
52545257 nf_skip_egress(skb, false);
52555258 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)
52565259 goto out;
5257− }
5260+ } else
52585261 #endif
5262+ skb_clear_delivery_time(skb);
52595263 skb_reset_redirect(skb);
52605264 skip_classify:
52615265 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
17281728 arg->csumoffset) = csum_fold(csum_add(nskb->csum,
17291729 arg->csum));
17301730 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;
17331732 ip_push_pending_frames(sk, &fl4);
17341733 }
17351734 out:

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