Commit 60769a5d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c9e6bc64
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __NET_IPIP_H 1 #define __NET_IPIP_H 1
#include <linux/if_tunnel.h> #include <linux/if_tunnel.h>
#include <net/gro_cells.h>
#include <net/ip.h> #include <net/ip.h>
/* Keep error state on tunnel for 30 sec */ /* Keep error state on tunnel for 30 sec */
...@@ -36,6 +37,8 @@ struct ip_tunnel { ...@@ -36,6 +37,8 @@ struct ip_tunnel {
#endif #endif
struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
unsigned int prl_count; /* # of entries in PRL */ unsigned int prl_count; /* # of entries in PRL */
struct gro_cells gro_cells;
}; };
struct ip_tunnel_prl_entry { struct ip_tunnel_prl_entry {
......
...@@ -740,8 +740,7 @@ static int ipgre_rcv(struct sk_buff *skb) ...@@ -740,8 +740,7 @@ static int ipgre_rcv(struct sk_buff *skb)
tstats->rx_bytes += skb->len; tstats->rx_bytes += skb->len;
u64_stats_update_end(&tstats->syncp); u64_stats_update_end(&tstats->syncp);
netif_rx(skb); gro_cells_receive(&tunnel->gro_cells, skb);
return 0; return 0;
} }
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
...@@ -1319,6 +1318,9 @@ static const struct net_device_ops ipgre_netdev_ops = { ...@@ -1319,6 +1318,9 @@ static const struct net_device_ops ipgre_netdev_ops = {
static void ipgre_dev_free(struct net_device *dev) static void ipgre_dev_free(struct net_device *dev)
{ {
struct ip_tunnel *tunnel = netdev_priv(dev);
gro_cells_destroy(&tunnel->gro_cells);
free_percpu(dev->tstats); free_percpu(dev->tstats);
free_netdev(dev); free_netdev(dev);
} }
...@@ -1350,6 +1352,7 @@ static int ipgre_tunnel_init(struct net_device *dev) ...@@ -1350,6 +1352,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel; struct ip_tunnel *tunnel;
struct iphdr *iph; struct iphdr *iph;
int err;
tunnel = netdev_priv(dev); tunnel = netdev_priv(dev);
iph = &tunnel->parms.iph; iph = &tunnel->parms.iph;
...@@ -1376,6 +1379,12 @@ static int ipgre_tunnel_init(struct net_device *dev) ...@@ -1376,6 +1379,12 @@ static int ipgre_tunnel_init(struct net_device *dev)
if (!dev->tstats) if (!dev->tstats)
return -ENOMEM; return -ENOMEM;
err = gro_cells_init(&tunnel->gro_cells, dev);
if (err) {
free_percpu(dev->tstats);
return err;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment