diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2013-03-09 18:00:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-10 16:53:34 -0400 |
commit | e8f72ea4a1380eeca10a551bc8d678e7d4388d42 (patch) | |
tree | 617c08e472d8f361de5a4d2198f0321e73285e17 /include/net/ip6_tunnel.h | |
parent | 22c352195ee09dcce9f4f0e2d4cd5f382b90f0fb (diff) |
ipv6: introduce ip6tunnel_xmit() helper
Similar to iptunnel_xmit(), group these operations into a
helper function.
This by the way fixes the missing u64_stats_update_begin()
and u64_stats_update_end() for 32 bit arch.
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Pravin B Shelar <pshelar@nicira.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_tunnel.h')
-rw-r--r-- | include/net/ip6_tunnel.h | 20 |
1 files changed, 20 insertions, 0 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 |