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

tunnel: eliminate recursion field

It seems recursion field from "struct ip_tunnel" is not anymore needed.
recursion prevention is done at the upper level (in dev_queue_xmit()),
since we use HARD_TX_LOCK protection for tunnels.

This avoids a cache line ping pong on "struct ip_tunnel" : This structure
should be now mostly read on xmit and receive paths.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent edf42a27
...@@ -12,7 +12,6 @@ struct ip_tunnel ...@@ -12,7 +12,6 @@ struct ip_tunnel
struct ip_tunnel *next; struct ip_tunnel *next;
struct net_device *dev; struct net_device *dev;
int recursion; /* Depth of hard_start_xmit recursion */
int err_count; /* Number of arrived ICMP errors */ int err_count; /* Number of arrived ICMP errors */
unsigned long err_time; /* Time when the last ICMP error arrived */ unsigned long err_time; /* Time when the last ICMP error arrived */
......
...@@ -66,10 +66,7 @@ ...@@ -66,10 +66,7 @@
solution, but it supposes maintaing new variable in ALL solution, but it supposes maintaing new variable in ALL
skb, even if no tunneling is used. skb, even if no tunneling is used.
Current solution: t->recursion lock breaks dead loops. It looks Current solution: HARD_TX_LOCK lock breaks dead loops.
like dev->tbusy flag, but I preferred new variable, because
the semantics is different. One day, when hard_start_xmit
will be multithreaded we will have to use skb->encapsulation.
...@@ -678,11 +675,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -678,11 +675,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
__be32 dst; __be32 dst;
int mtu; int mtu;
if (tunnel->recursion++) {
stats->collisions++;
goto tx_error;
}
if (dev->type == ARPHRD_ETHER) if (dev->type == ARPHRD_ETHER)
IPCB(skb)->flags = 0; IPCB(skb)->flags = 0;
...@@ -820,7 +812,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -820,7 +812,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
ip_rt_put(rt); ip_rt_put(rt);
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
if (skb->sk) if (skb->sk)
...@@ -888,7 +879,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -888,7 +879,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
nf_reset(skb); nf_reset(skb);
IPTUNNEL_XMIT(); IPTUNNEL_XMIT();
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
tx_error_icmp: tx_error_icmp:
...@@ -897,7 +887,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -897,7 +887,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
tx_error: tx_error:
stats->tx_errors++; stats->tx_errors++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -402,11 +402,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -402,11 +402,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
__be32 dst = tiph->daddr; __be32 dst = tiph->daddr;
int mtu; int mtu;
if (tunnel->recursion++) {
stats->collisions++;
goto tx_error;
}
if (skb->protocol != htons(ETH_P_IP)) if (skb->protocol != htons(ETH_P_IP))
goto tx_error; goto tx_error;
...@@ -485,7 +480,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -485,7 +480,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
ip_rt_put(rt); ip_rt_put(rt);
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
if (skb->sk) if (skb->sk)
...@@ -523,7 +517,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -523,7 +517,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
nf_reset(skb); nf_reset(skb);
IPTUNNEL_XMIT(); IPTUNNEL_XMIT();
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
tx_error_icmp: tx_error_icmp:
...@@ -531,7 +524,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -531,7 +524,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
tx_error: tx_error:
stats->tx_errors++; stats->tx_errors++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -1043,11 +1043,6 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1043,11 +1043,6 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
struct net_device_stats *stats = &t->dev->stats; struct net_device_stats *stats = &t->dev->stats;
int ret; int ret;
if (t->recursion++) {
stats->collisions++;
goto tx_err;
}
switch (skb->protocol) { switch (skb->protocol) {
case htons(ETH_P_IP): case htons(ETH_P_IP):
ret = ip4ip6_tnl_xmit(skb, dev); ret = ip4ip6_tnl_xmit(skb, dev);
...@@ -1062,14 +1057,12 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1062,14 +1057,12 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
if (ret < 0) if (ret < 0)
goto tx_err; goto tx_err;
t->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
tx_err: tx_err:
stats->tx_errors++; stats->tx_errors++;
stats->tx_dropped++; stats->tx_dropped++;
kfree_skb(skb); kfree_skb(skb);
t->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -626,11 +626,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -626,11 +626,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
struct in6_addr *addr6; struct in6_addr *addr6;
int addr_type; int addr_type;
if (tunnel->recursion++) {
stats->collisions++;
goto tx_error;
}
if (skb->protocol != htons(ETH_P_IPV6)) if (skb->protocol != htons(ETH_P_IPV6))
goto tx_error; goto tx_error;
...@@ -753,7 +748,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -753,7 +748,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
ip_rt_put(rt); ip_rt_put(rt);
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
if (skb->sk) if (skb->sk)
...@@ -794,7 +788,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -794,7 +788,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
nf_reset(skb); nf_reset(skb);
IPTUNNEL_XMIT(); IPTUNNEL_XMIT();
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
tx_error_icmp: tx_error_icmp:
...@@ -802,7 +795,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -802,7 +795,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
tx_error: tx_error:
stats->tx_errors++; stats->tx_errors++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
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