From c0ea518ba58c9b72e0b09a74d9b46bf995539019 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sat, 9 Mar 2013 23:00:39 +0000 Subject: [PATCH] --- yaml --- r: 368175 b: refs/heads/master c: e8f72ea4a1380eeca10a551bc8d678e7d4388d42 h: refs/heads/master i: 368173: 230833cd26cb4727d0fec043490084da089cda35 368171: 4f2a22fb768c523b1c1dcca468bc39c2c7cf5816 368167: 4fb197646b7575359a19fe127e729e2c609bf9ef 368159: 789992898eb148d9bb204831a236d0d3546b2340 v: v3 --- [refs] | 2 +- trunk/include/net/ip6_tunnel.h | 20 ++++++++++++++++++++ trunk/net/ipv6/ip6_gre.c | 17 +---------------- trunk/net/ipv6/ip6_tunnel.c | 15 +-------------- 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/[refs] b/[refs] index 0eda930df615..6b98b9a393d6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22c352195ee09dcce9f4f0e2d4cd5f382b90f0fb +refs/heads/master: e8f72ea4a1380eeca10a551bc8d678e7d4388d42 diff --git a/trunk/include/net/ip6_tunnel.h b/trunk/include/net/ip6_tunnel.h index e03047f7090b..ebdef7f60862 100644 --- a/trunk/include/net/ip6_tunnel.h +++ b/trunk/include/net/ip6_tunnel.h @@ -68,4 +68,24 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, const struct in6_addr *raddr); +static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct net_device_stats *stats = &dev->stats; + int pkt_len, err; + + nf_reset(skb); + pkt_len = skb->len; + err = ip6_local_out(skb); + + if (net_xmit_eval(err) == 0) { + struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); + u64_stats_update_begin(&tstats->syncp); + tstats->tx_bytes += pkt_len; + tstats->tx_packets++; + u64_stats_update_end(&tstats->syncp); + } else { + stats->tx_errors++; + stats->tx_aborted_errors++; + } +} #endif diff --git a/trunk/net/ipv6/ip6_gre.c b/trunk/net/ipv6/ip6_gre.c index e4efffe2522e..6a6ba73ff265 100644 --- a/trunk/net/ipv6/ip6_gre.c +++ b/trunk/net/ipv6/ip6_gre.c @@ -667,7 +667,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, struct net_device_stats *stats = &tunnel->dev->stats; int err = -1; u8 proto; - int pkt_len; struct sk_buff *new_skb; if (dev->type == ARPHRD_ETHER) @@ -801,23 +800,9 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, } } - nf_reset(skb); - pkt_len = skb->len; - err = ip6_local_out(skb); - - if (net_xmit_eval(err) == 0) { - struct pcpu_tstats *tstats = this_cpu_ptr(tunnel->dev->tstats); - - tstats->tx_bytes += pkt_len; - tstats->tx_packets++; - } else { - stats->tx_errors++; - stats->tx_aborted_errors++; - } - + ip6tunnel_xmit(skb, dev); if (ndst) ip6_tnl_dst_store(tunnel, ndst); - return 0; tx_err_link_failure: stats->tx_carrier_errors++; diff --git a/trunk/net/ipv6/ip6_tunnel.c b/trunk/net/ipv6/ip6_tunnel.c index fff83cbc197f..bef3fedfdc56 100644 --- a/trunk/net/ipv6/ip6_tunnel.c +++ b/trunk/net/ipv6/ip6_tunnel.c @@ -955,7 +955,6 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, unsigned int max_headroom = sizeof(struct ipv6hdr); u8 proto; int err = -1; - int pkt_len; if (!fl6->flowi6_mark) dst = ip6_tnl_dst_check(t); @@ -1035,19 +1034,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ipv6h->nexthdr = proto; ipv6h->saddr = fl6->saddr; ipv6h->daddr = fl6->daddr; - nf_reset(skb); - pkt_len = skb->len; - err = ip6_local_out(skb); - - if (net_xmit_eval(err) == 0) { - struct pcpu_tstats *tstats = this_cpu_ptr(t->dev->tstats); - - tstats->tx_bytes += pkt_len; - tstats->tx_packets++; - } else { - stats->tx_errors++; - stats->tx_aborted_errors++; - } + ip6tunnel_xmit(skb, dev); if (ndst) ip6_tnl_dst_store(t, ndst); return 0;