Skip to content

Commit 60769a5

Browse files
Eric Dumazetdavem330
authored andcommitted
ipv4: gre: add GRO capability
Add GRO capability to IPv4 GRE tunnels, using the gro_cells infrastructure. Tested using IPv4 and IPv6 TCP traffic inside this tunnel, and checking GRO is building large packets. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c9e6bc6 commit 60769a5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

include/net/ipip.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __NET_IPIP_H 1
33

44
#include <linux/if_tunnel.h>
5+
#include <net/gro_cells.h>
56
#include <net/ip.h>
67

78
/* Keep error state on tunnel for 30 sec */
@@ -36,6 +37,8 @@ struct ip_tunnel {
3637
#endif
3738
struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
3839
unsigned int prl_count; /* # of entries in PRL */
40+
41+
struct gro_cells gro_cells;
3942
};
4043

4144
struct ip_tunnel_prl_entry {

net/ipv4/ip_gre.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,7 @@ static int ipgre_rcv(struct sk_buff *skb)
740740
tstats->rx_bytes += skb->len;
741741
u64_stats_update_end(&tstats->syncp);
742742

743-
netif_rx(skb);
744-
743+
gro_cells_receive(&tunnel->gro_cells, skb);
745744
return 0;
746745
}
747746
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
@@ -1319,6 +1318,9 @@ static const struct net_device_ops ipgre_netdev_ops = {
13191318

13201319
static void ipgre_dev_free(struct net_device *dev)
13211320
{
1321+
struct ip_tunnel *tunnel = netdev_priv(dev);
1322+
1323+
gro_cells_destroy(&tunnel->gro_cells);
13221324
free_percpu(dev->tstats);
13231325
free_netdev(dev);
13241326
}
@@ -1350,6 +1352,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
13501352
{
13511353
struct ip_tunnel *tunnel;
13521354
struct iphdr *iph;
1355+
int err;
13531356

13541357
tunnel = netdev_priv(dev);
13551358
iph = &tunnel->parms.iph;
@@ -1376,6 +1379,12 @@ static int ipgre_tunnel_init(struct net_device *dev)
13761379
if (!dev->tstats)
13771380
return -ENOMEM;
13781381

1382+
err = gro_cells_init(&tunnel->gro_cells, dev);
1383+
if (err) {
1384+
free_percpu(dev->tstats);
1385+
return err;
1386+
}
1387+
13791388
return 0;
13801389
}
13811390

0 commit comments

Comments
 (0)