mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-21 20:22:13 +08:00
net: Add skb_clear_tstamp() to keep the mono delivery_time
Right now, skb->tstamp is reset to 0 whenever the skb is forwarded. If skb->tstamp has the mono delivery_time, clearing it can hurt the performance when it finally transmits out to fq@phy-dev. The earlier patch added a skb->mono_delivery_time bit to flag the skb->tstamp carrying the mono delivery_time. This patch adds skb_clear_tstamp() helper which keeps the mono delivery_time and clears everything else. The delivery_time clearing will be postponed until the stack knows the skb will be delivered locally. It will be done in a latter patch. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a1ac9c8ace
commit
de79910151
@ -74,7 +74,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
|
|||||||
skb_tx_timestamp(skb);
|
skb_tx_timestamp(skb);
|
||||||
|
|
||||||
/* do not fool net_timestamp_check() with various clock bases */
|
/* do not fool net_timestamp_check() with various clock bases */
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
skb_orphan(skb);
|
skb_orphan(skb);
|
||||||
|
|
||||||
|
@ -3996,6 +3996,14 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
|
|||||||
skb->mono_delivery_time = 0;
|
skb->mono_delivery_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void skb_clear_tstamp(struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
if (skb->mono_delivery_time)
|
||||||
|
return;
|
||||||
|
|
||||||
|
skb->tstamp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline u8 skb_metadata_len(const struct sk_buff *skb)
|
static inline u8 skb_metadata_len(const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return skb_shinfo(skb)->meta_len;
|
return skb_shinfo(skb)->meta_len;
|
||||||
@ -4852,7 +4860,7 @@ static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress)
|
|||||||
#ifdef CONFIG_NET_REDIRECT
|
#ifdef CONFIG_NET_REDIRECT
|
||||||
skb->from_ingress = from_ingress;
|
skb->from_ingress = from_ingress;
|
||||||
if (skb->from_ingress)
|
if (skb->from_ingress)
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(br_dev_queue_push_xmit);
|
|||||||
|
|
||||||
int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
|
int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING,
|
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING,
|
||||||
net, sk, skb, NULL, skb->dev,
|
net, sk, skb, NULL, skb->dev,
|
||||||
br_dev_queue_push_xmit);
|
br_dev_queue_push_xmit);
|
||||||
|
@ -2107,7 +2107,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
dev_xmit_recursion_inc();
|
dev_xmit_recursion_inc();
|
||||||
ret = dev_queue_xmit(skb);
|
ret = dev_queue_xmit(skb);
|
||||||
@ -2176,7 +2176,7 @@ static int bpf_out_neigh_v6(struct net *net, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
|
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
|
||||||
skb = skb_expand_head(skb, hh_len);
|
skb = skb_expand_head(skb, hh_len);
|
||||||
@ -2274,7 +2274,7 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
|
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
|
||||||
skb = skb_expand_head(skb, hh_len);
|
skb = skb_expand_head(skb, hh_len);
|
||||||
|
@ -5381,7 +5381,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
|
|||||||
|
|
||||||
ipvs_reset(skb);
|
ipvs_reset(skb);
|
||||||
skb->mark = 0;
|
skb->mark = 0;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(skb_scrub_packet);
|
EXPORT_SYMBOL_GPL(skb_scrub_packet);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *s
|
|||||||
if (unlikely(opt->optlen))
|
if (unlikely(opt->optlen))
|
||||||
ip_forward_options(skb);
|
ip_forward_options(skb);
|
||||||
|
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
return dst_output(net, sk, skb);
|
return dst_output(net, sk, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ static inline int ip6_forward_finish(struct net *net, struct sock *sk,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
return dst_output(net, sk, skb);
|
return dst_output(net, sk, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb,
|
|||||||
nf_reset_ct(skb);
|
nf_reset_ct(skb);
|
||||||
skb_forward_csum(skb);
|
skb_forward_csum(skb);
|
||||||
if (skb->dev)
|
if (skb->dev)
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb,
|
|||||||
if (!local) {
|
if (!local) {
|
||||||
skb_forward_csum(skb);
|
skb_forward_csum(skb);
|
||||||
if (skb->dev)
|
if (skb->dev)
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
|
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
|
||||||
NULL, skb_dst(skb)->dev, dst_output);
|
NULL, skb_dst(skb)->dev, dst_output);
|
||||||
} else
|
} else
|
||||||
@ -674,7 +674,7 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb,
|
|||||||
ip_vs_drop_early_demux_sk(skb);
|
ip_vs_drop_early_demux_sk(skb);
|
||||||
skb_forward_csum(skb);
|
skb_forward_csum(skb);
|
||||||
if (skb->dev)
|
if (skb->dev)
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
|
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
|
||||||
NULL, skb_dst(skb)->dev, dst_output);
|
NULL, skb_dst(skb)->dev, dst_output);
|
||||||
} else
|
} else
|
||||||
|
@ -19,7 +19,7 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev)
|
|||||||
skb_push(skb, skb->mac_len);
|
skb_push(skb, skb->mac_len);
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
dev_queue_xmit(skb);
|
dev_queue_xmit(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
|
|||||||
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
|
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
|
||||||
|
|
||||||
ip_decrease_ttl(iph);
|
ip_decrease_ttl(iph);
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||||
@ -611,7 +611,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
|
|||||||
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
|
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
|
||||||
|
|
||||||
ip6h->hop_limit--;
|
ip6h->hop_limit--;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
|
|
||||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||||
|
@ -145,7 +145,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
neigh_xmit(neigh_table, dev, addr, skb);
|
neigh_xmit(neigh_table, dev, addr, skb);
|
||||||
out:
|
out:
|
||||||
regs->verdict.code = verdict;
|
regs->verdict.code = verdict;
|
||||||
|
@ -507,7 +507,7 @@ void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto)
|
|||||||
}
|
}
|
||||||
|
|
||||||
skb->dev = vport->dev;
|
skb->dev = vport->dev;
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
vport->ops->send(skb);
|
vport->ops->send(skb);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ static void xfrmi_dev_uninit(struct net_device *dev)
|
|||||||
|
|
||||||
static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet)
|
static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet)
|
||||||
{
|
{
|
||||||
skb->tstamp = 0;
|
skb_clear_tstamp(skb);
|
||||||
skb->pkt_type = PACKET_HOST;
|
skb->pkt_type = PACKET_HOST;
|
||||||
skb->skb_iif = 0;
|
skb->skb_iif = 0;
|
||||||
skb->ignore_df = 0;
|
skb->ignore_df = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user