diff options
-rw-r--r-- | include/net/ip6_tunnel.h | 20 | ||||
-rw-r--r-- | net/ipv6/ip6_gre.c | 17 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 15 |
3 files changed, 22 insertions, 30 deletions
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index e03047f7090b..ebdef7f60862 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
@@ -68,4 +68,24 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); | |||
68 | __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, | 68 | __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, |
69 | const struct in6_addr *raddr); | 69 | const struct in6_addr *raddr); |
70 | 70 | ||
71 | static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | ||
72 | { | ||
73 | struct net_device_stats *stats = &dev->stats; | ||
74 | int pkt_len, err; | ||
75 | |||
76 | nf_reset(skb); | ||
77 | pkt_len = skb->len; | ||
78 | err = ip6_local_out(skb); | ||
79 | |||
80 | if (net_xmit_eval(err) == 0) { | ||
81 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
82 | u64_stats_update_begin(&tstats->syncp); | ||
83 | tstats->tx_bytes += pkt_len; | ||
84 | tstats->tx_packets++; | ||
85 | u64_stats_update_end(&tstats->syncp); | ||
86 | } else { | ||
87 | stats->tx_errors++; | ||
88 | stats->tx_aborted_errors++; | ||
89 | } | ||
90 | } | ||
71 | #endif | 91 | #endif |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index e4efffe2522e..6a6ba73ff265 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -667,7 +667,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, | |||
667 | struct net_device_stats *stats = &tunnel->dev->stats; | 667 | struct net_device_stats *stats = &tunnel->dev->stats; |
668 | int err = -1; | 668 | int err = -1; |
669 | u8 proto; | 669 | u8 proto; |
670 | int pkt_len; | ||
671 | struct sk_buff *new_skb; | 670 | struct sk_buff *new_skb; |
672 | 671 | ||
673 | if (dev->type == ARPHRD_ETHER) | 672 | if (dev->type == ARPHRD_ETHER) |
@@ -801,23 +800,9 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, | |||
801 | } | 800 | } |
802 | } | 801 | } |
803 | 802 | ||
804 | nf_reset(skb); | 803 | ip6tunnel_xmit(skb, dev); |
805 | pkt_len = skb->len; | ||
806 | err = ip6_local_out(skb); | ||
807 | |||
808 | if (net_xmit_eval(err) == 0) { | ||
809 | struct pcpu_tstats *tstats = this_cpu_ptr(tunnel->dev->tstats); | ||
810 | |||
811 | tstats->tx_bytes += pkt_len; | ||
812 | tstats->tx_packets++; | ||
813 | } else { | ||
814 | stats->tx_errors++; | ||
815 | stats->tx_aborted_errors++; | ||
816 | } | ||
817 | |||
818 | if (ndst) | 804 | if (ndst) |
819 | ip6_tnl_dst_store(tunnel, ndst); | 805 | ip6_tnl_dst_store(tunnel, ndst); |
820 | |||
821 | return 0; | 806 | return 0; |
822 | tx_err_link_failure: | 807 | tx_err_link_failure: |
823 | stats->tx_carrier_errors++; | 808 | stats->tx_carrier_errors++; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index fff83cbc197f..bef3fedfdc56 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -955,7 +955,6 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
955 | unsigned int max_headroom = sizeof(struct ipv6hdr); | 955 | unsigned int max_headroom = sizeof(struct ipv6hdr); |
956 | u8 proto; | 956 | u8 proto; |
957 | int err = -1; | 957 | int err = -1; |
958 | int pkt_len; | ||
959 | 958 | ||
960 | if (!fl6->flowi6_mark) | 959 | if (!fl6->flowi6_mark) |
961 | dst = ip6_tnl_dst_check(t); | 960 | dst = ip6_tnl_dst_check(t); |
@@ -1035,19 +1034,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
1035 | ipv6h->nexthdr = proto; | 1034 | ipv6h->nexthdr = proto; |
1036 | ipv6h->saddr = fl6->saddr; | 1035 | ipv6h->saddr = fl6->saddr; |
1037 | ipv6h->daddr = fl6->daddr; | 1036 | ipv6h->daddr = fl6->daddr; |
1038 | nf_reset(skb); | 1037 | ip6tunnel_xmit(skb, dev); |
1039 | pkt_len = skb->len; | ||
1040 | err = ip6_local_out(skb); | ||
1041 | |||
1042 | if (net_xmit_eval(err) == 0) { | ||
1043 | struct pcpu_tstats *tstats = this_cpu_ptr(t->dev->tstats); | ||
1044 | |||
1045 | tstats->tx_bytes += pkt_len; | ||
1046 | tstats->tx_packets++; | ||
1047 | } else { | ||
1048 | stats->tx_errors++; | ||
1049 | stats->tx_aborted_errors++; | ||
1050 | } | ||
1051 | if (ndst) | 1038 | if (ndst) |
1052 | ip6_tnl_dst_store(t, ndst); | 1039 | ip6_tnl_dst_store(t, ndst); |
1053 | return 0; | 1040 | return 0; |