Skip to content

Commit 0c1dd2a

Browse files
Eran Ben Elishadavem330
authored andcommitted
net: ipv6/gre: Add GRO support
Add GRO capability for IPv6 GRE tunnel and ip6erspan tap, via gro_cells infrastructure. Performance testing: 55% higher badwidth. Measuring bandwidth of 1 thread IPv4 TCP traffic over IPv6 GRE tunnel while GRO on the physical interface is disabled. CPU: Intel Xeon E312xx (Sandy Bridge) NIC: Mellanox Technologies MT27700 Family [ConnectX-4] Before (GRO not working in tunnel) : 2.47 Gbits/sec After (GRO working in tunnel) : 3.85 Gbits/sec Signed-off-by: Eran Ben Elisha <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> CC: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6f2f821 commit 0c1dd2a

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

net/ipv6/ip6_gre.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,7 @@ static void ip6gre_dev_free(struct net_device *dev)
13141314
{
13151315
struct ip6_tnl *t = netdev_priv(dev);
13161316

1317+
gro_cells_destroy(&t->gro_cells);
13171318
dst_cache_destroy(&t->dst_cache);
13181319
free_percpu(dev->tstats);
13191320
}
@@ -1381,11 +1382,12 @@ static int ip6gre_tunnel_init_common(struct net_device *dev)
13811382
return -ENOMEM;
13821383

13831384
ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1384-
if (ret) {
1385-
free_percpu(dev->tstats);
1386-
dev->tstats = NULL;
1387-
return ret;
1388-
}
1385+
if (ret)
1386+
goto cleanup_alloc_pcpu_stats;
1387+
1388+
ret = gro_cells_init(&tunnel->gro_cells, dev);
1389+
if (ret)
1390+
goto cleanup_dst_cache_init;
13891391

13901392
tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags);
13911393
tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen;
@@ -1405,6 +1407,13 @@ static int ip6gre_tunnel_init_common(struct net_device *dev)
14051407
ip6gre_tnl_init_features(dev);
14061408

14071409
return 0;
1410+
1411+
cleanup_dst_cache_init:
1412+
dst_cache_destroy(&tunnel->dst_cache);
1413+
cleanup_alloc_pcpu_stats:
1414+
free_percpu(dev->tstats);
1415+
dev->tstats = NULL;
1416+
return ret;
14081417
}
14091418

14101419
static int ip6gre_tunnel_init(struct net_device *dev)
@@ -1751,11 +1760,12 @@ static int ip6erspan_tap_init(struct net_device *dev)
17511760
return -ENOMEM;
17521761

17531762
ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1754-
if (ret) {
1755-
free_percpu(dev->tstats);
1756-
dev->tstats = NULL;
1757-
return ret;
1758-
}
1763+
if (ret)
1764+
goto cleanup_alloc_pcpu_stats;
1765+
1766+
ret = gro_cells_init(&tunnel->gro_cells, dev);
1767+
if (ret)
1768+
goto cleanup_dst_cache_init;
17591769

17601770
tunnel->tun_hlen = 8;
17611771
tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
@@ -1773,6 +1783,13 @@ static int ip6erspan_tap_init(struct net_device *dev)
17731783
ip6gre_tnl_link_config(tunnel, 1);
17741784

17751785
return 0;
1786+
1787+
cleanup_dst_cache_init:
1788+
dst_cache_destroy(&tunnel->dst_cache);
1789+
cleanup_alloc_pcpu_stats:
1790+
free_percpu(dev->tstats);
1791+
dev->tstats = NULL;
1792+
return ret;
17761793
}
17771794

17781795
static const struct net_device_ops ip6erspan_netdev_ops = {

0 commit comments

Comments
 (0)