aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_output.c
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2014-07-02 00:33:10 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 00:14:21 -0400
commitcb1ce2ef387b01686469487edd45994872d52d73 (patch)
tree4e905772c627b902b2f1aeaa752ae8b4a6b1b1fb /net/ipv6/ip6_output.c
parent19469a873bafd4e65daef3597db2bd724c1b03c9 (diff)
ipv6: Implement automatic flow label generation on transmit
Automatically generate flow labels for IPv6 packets on transmit. The flow label is computed based on skb_get_hash. The flow label will only automatically be set when it is zero otherwise (i.e. flow label manager hasn't set one). This supports the transmit side functionality of RFC 6438. Added an IPv6 sysctl auto_flowlabels to enable/disable this behavior system wide, and added IPV6_AUTOFLOWLABEL socket option to enable this functionality per socket. By default, auto flowlabels are disabled to avoid possible conflicts with flow label manager, however if this feature proves useful we may want to enable it by default. It should also be noted that FreeBSD has already implemented automatic flow labels (including the sysctl and socket option). In FreeBSD, automatic flow labels default to enabled. Performance impact: Running super_netperf with 200 flows for TCP_RR and UDP_RR for IPv6. Note that in UDP case, __skb_get_hash will be called for every packet with explains slight regression. In the TCP case the hash is saved in the socket so there is no regression. Automatic flow labels disabled: TCP_RR: 86.53% CPU utilization 127/195/322 90/95/99% latencies 1.40498e+06 tps UDP_RR: 90.70% CPU utilization 118/168/243 90/95/99% latencies 1.50309e+06 tps Automatic flow labels enabled: TCP_RR: 85.90% CPU utilization 128/199/337 90/95/99% latencies 1.40051e+06 UDP_RR 92.61% CPU utilization 115/164/236 90/95/99% latencies 1.4687e+06 Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r--net/ipv6/ip6_output.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cb9df0eb4023..fa83bdd4c3dd 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -205,7 +205,8 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
205 if (hlimit < 0) 205 if (hlimit < 0)
206 hlimit = ip6_dst_hoplimit(dst); 206 hlimit = ip6_dst_hoplimit(dst);
207 207
208 ip6_flow_hdr(hdr, tclass, fl6->flowlabel); 208 ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
209 np->autoflowlabel));
209 210
210 hdr->payload_len = htons(seg_len); 211 hdr->payload_len = htons(seg_len);
211 hdr->nexthdr = proto; 212 hdr->nexthdr = proto;
@@ -1569,7 +1570,9 @@ int ip6_push_pending_frames(struct sock *sk)
1569 skb_reset_network_header(skb); 1570 skb_reset_network_header(skb);
1570 hdr = ipv6_hdr(skb); 1571 hdr = ipv6_hdr(skb);
1571 1572
1572 ip6_flow_hdr(hdr, np->cork.tclass, fl6->flowlabel); 1573 ip6_flow_hdr(hdr, np->cork.tclass,
1574 ip6_make_flowlabel(net, skb, fl6->flowlabel,
1575 np->autoflowlabel));
1573 hdr->hop_limit = np->cork.hop_limit; 1576 hdr->hop_limit = np->cork.hop_limit;
1574 hdr->nexthdr = proto; 1577 hdr->nexthdr = proto;
1575 hdr->saddr = fl6->saddr; 1578 hdr->saddr = fl6->saddr;