Skip to content

Commit

Permalink
Merge branch 'ipv6-sr-perf-improvements'
Browse files Browse the repository at this point in the history
David Lebrun says:

====================
Performances improvement for IPv6 Segment Routing

This patch series improves the performances of IPv6 SR by optimizing skb head
reallocation and extending the use of dst_cache. The overall performances improve
by 35%.

Before patch series (SRH encap):
Result: OK: 7348320(c7347271+d1048) usec, 5000000 (1000byte,0frags)
  680427pps 5443Mb/sec (5443416000bps) errors: 0

After patch series (SRH encap):
Result: OK: 4774543(c4774084+d459) usec, 5000000 (1000byte,0frags)
  1047220pps 8377Mb/sec (8377760000bps) errors: 0

Baseline for plain IPv6 forwarding:
Result: OK: 4244144(c4243722+d422) usec, 5000000 (1000byte,0frags)
  1178093pps 9424Mb/sec (9424744000bps) errors: 0
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 24, 2017
2 parents 3b1af93 + af4a220 commit f106d16
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions net/ipv6/seg6_iptunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh)
hdrlen = (osrh->hdrlen + 1) << 3;
tot_len = hdrlen + sizeof(*hdr);

err = pskb_expand_head(skb, tot_len, 0, GFP_ATOMIC);
err = skb_cow_head(skb, tot_len);
if (unlikely(err))
return err;

Expand Down Expand Up @@ -156,7 +156,7 @@ static int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh)

hdrlen = (osrh->hdrlen + 1) << 3;

err = pskb_expand_head(skb, hdrlen, 0, GFP_ATOMIC);
err = skb_cow_head(skb, hdrlen);
if (unlikely(err))
return err;

Expand Down Expand Up @@ -237,6 +237,9 @@ static int seg6_do_srh(struct sk_buff *skb)

static int seg6_input(struct sk_buff *skb)
{
struct dst_entry *orig_dst = skb_dst(skb);
struct dst_entry *dst = NULL;
struct seg6_lwt *slwt;
int err;

err = seg6_do_srh(skb);
Expand All @@ -245,8 +248,30 @@ static int seg6_input(struct sk_buff *skb)
return err;
}

slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate);

#ifdef CONFIG_DST_CACHE
preempt_disable();
dst = dst_cache_get(&slwt->cache);
preempt_enable();
#endif

skb_dst_drop(skb);
ip6_route_input(skb);

if (!dst) {
ip6_route_input(skb);
#ifdef CONFIG_DST_CACHE
dst = skb_dst(skb);
if (!dst->error) {
preempt_disable();
dst_cache_set_ip6(&slwt->cache, dst,
&ipv6_hdr(skb)->saddr);
preempt_enable();
}
#endif
} else {
skb_dst_set(skb, dst);
}

return dst_input(skb);
}
Expand Down

0 comments on commit f106d16

Please sign in to comment.