diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-09-23 06:28:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-24 18:39:22 -0400 |
commit | a43912ab1925788765208da5cd664b6f8e011d08 (patch) | |
tree | 6f522dba1fd414b7da3999fa2da062d80a550874 /net/ipv4 | |
parent | edf42a27e8e242e543716663e54aa2b592ea070a (diff) |
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: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_gre.c | 13 | ||||
-rw-r--r-- | net/ipv4/ipip.c | 8 |
2 files changed, 1 insertions, 20 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index d9645c94a067..41ada9904d31 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -66,10 +66,7 @@ | |||
66 | solution, but it supposes maintaing new variable in ALL | 66 | solution, but it supposes maintaing new variable in ALL |
67 | skb, even if no tunneling is used. | 67 | skb, even if no tunneling is used. |
68 | 68 | ||
69 | Current solution: t->recursion lock breaks dead loops. It looks | 69 | Current solution: HARD_TX_LOCK lock breaks dead loops. |
70 | like dev->tbusy flag, but I preferred new variable, because | ||
71 | the semantics is different. One day, when hard_start_xmit | ||
72 | will be multithreaded we will have to use skb->encapsulation. | ||
73 | 70 | ||
74 | 71 | ||
75 | 72 | ||
@@ -678,11 +675,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
678 | __be32 dst; | 675 | __be32 dst; |
679 | int mtu; | 676 | int mtu; |
680 | 677 | ||
681 | if (tunnel->recursion++) { | ||
682 | stats->collisions++; | ||
683 | goto tx_error; | ||
684 | } | ||
685 | |||
686 | if (dev->type == ARPHRD_ETHER) | 678 | if (dev->type == ARPHRD_ETHER) |
687 | IPCB(skb)->flags = 0; | 679 | IPCB(skb)->flags = 0; |
688 | 680 | ||
@@ -820,7 +812,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
820 | ip_rt_put(rt); | 812 | ip_rt_put(rt); |
821 | stats->tx_dropped++; | 813 | stats->tx_dropped++; |
822 | dev_kfree_skb(skb); | 814 | dev_kfree_skb(skb); |
823 | tunnel->recursion--; | ||
824 | return NETDEV_TX_OK; | 815 | return NETDEV_TX_OK; |
825 | } | 816 | } |
826 | if (skb->sk) | 817 | if (skb->sk) |
@@ -888,7 +879,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
888 | nf_reset(skb); | 879 | nf_reset(skb); |
889 | 880 | ||
890 | IPTUNNEL_XMIT(); | 881 | IPTUNNEL_XMIT(); |
891 | tunnel->recursion--; | ||
892 | return NETDEV_TX_OK; | 882 | return NETDEV_TX_OK; |
893 | 883 | ||
894 | tx_error_icmp: | 884 | tx_error_icmp: |
@@ -897,7 +887,6 @@ tx_error_icmp: | |||
897 | tx_error: | 887 | tx_error: |
898 | stats->tx_errors++; | 888 | stats->tx_errors++; |
899 | dev_kfree_skb(skb); | 889 | dev_kfree_skb(skb); |
900 | tunnel->recursion--; | ||
901 | return NETDEV_TX_OK; | 890 | return NETDEV_TX_OK; |
902 | } | 891 | } |
903 | 892 | ||
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 62548cb0923c..08ccd344de7a 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -402,11 +402,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
402 | __be32 dst = tiph->daddr; | 402 | __be32 dst = tiph->daddr; |
403 | int mtu; | 403 | int mtu; |
404 | 404 | ||
405 | if (tunnel->recursion++) { | ||
406 | stats->collisions++; | ||
407 | goto tx_error; | ||
408 | } | ||
409 | |||
410 | if (skb->protocol != htons(ETH_P_IP)) | 405 | if (skb->protocol != htons(ETH_P_IP)) |
411 | goto tx_error; | 406 | goto tx_error; |
412 | 407 | ||
@@ -485,7 +480,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
485 | ip_rt_put(rt); | 480 | ip_rt_put(rt); |
486 | stats->tx_dropped++; | 481 | stats->tx_dropped++; |
487 | dev_kfree_skb(skb); | 482 | dev_kfree_skb(skb); |
488 | tunnel->recursion--; | ||
489 | return NETDEV_TX_OK; | 483 | return NETDEV_TX_OK; |
490 | } | 484 | } |
491 | if (skb->sk) | 485 | if (skb->sk) |
@@ -523,7 +517,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
523 | nf_reset(skb); | 517 | nf_reset(skb); |
524 | 518 | ||
525 | IPTUNNEL_XMIT(); | 519 | IPTUNNEL_XMIT(); |
526 | tunnel->recursion--; | ||
527 | return NETDEV_TX_OK; | 520 | return NETDEV_TX_OK; |
528 | 521 | ||
529 | tx_error_icmp: | 522 | tx_error_icmp: |
@@ -531,7 +524,6 @@ tx_error_icmp: | |||
531 | tx_error: | 524 | tx_error: |
532 | stats->tx_errors++; | 525 | stats->tx_errors++; |
533 | dev_kfree_skb(skb); | 526 | dev_kfree_skb(skb); |
534 | tunnel->recursion--; | ||
535 | return NETDEV_TX_OK; | 527 | return NETDEV_TX_OK; |
536 | } | 528 | } |
537 | 529 | ||