diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-06-17 20:49:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-19 21:07:41 -0400 |
commit | 0e6fbc5b6c6218987c93b8c7ca60cf786062899d (patch) | |
tree | 5b1241cdd4e43148cd09bc2f6b33d92990680909 /include/net/ip_tunnels.h | |
parent | 45f2e9976cb6fc3f1cc533fd53fe74da5a9dbce4 (diff) |
ip_tunnels: extend iptunnel_xmit()
Refactor various ip tunnels xmit functions and extend iptunnel_xmit()
so that there is more code sharing.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip_tunnels.h')
-rw-r--r-- | include/net/ip_tunnels.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 1be442f89406..b84f1ab09d78 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -155,23 +155,27 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb, | |||
155 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | 155 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) | 158 | int iptunnel_xmit(struct net *net, struct rtable *rt, |
159 | struct sk_buff *skb, | ||
160 | __be32 src, __be32 dst, __u8 proto, | ||
161 | __u8 tos, __u8 ttl, __be16 df); | ||
162 | |||
163 | static inline void iptunnel_xmit_stats(int err, | ||
164 | struct net_device_stats *err_stats, | ||
165 | struct pcpu_tstats __percpu *stats) | ||
159 | { | 166 | { |
160 | int err; | 167 | if (err > 0) { |
161 | int pkt_len = skb->len - skb_transport_offset(skb); | 168 | struct pcpu_tstats *tstats = this_cpu_ptr(stats); |
162 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
163 | 169 | ||
164 | nf_reset(skb); | ||
165 | |||
166 | err = ip_local_out(skb); | ||
167 | if (likely(net_xmit_eval(err) == 0)) { | ||
168 | u64_stats_update_begin(&tstats->syncp); | 170 | u64_stats_update_begin(&tstats->syncp); |
169 | tstats->tx_bytes += pkt_len; | 171 | tstats->tx_bytes += err; |
170 | tstats->tx_packets++; | 172 | tstats->tx_packets++; |
171 | u64_stats_update_end(&tstats->syncp); | 173 | u64_stats_update_end(&tstats->syncp); |
174 | } else if (err < 0) { | ||
175 | err_stats->tx_errors++; | ||
176 | err_stats->tx_aborted_errors++; | ||
172 | } else { | 177 | } else { |
173 | dev->stats.tx_errors++; | 178 | err_stats->tx_dropped++; |
174 | dev->stats.tx_aborted_errors++; | ||
175 | } | 179 | } |
176 | } | 180 | } |
177 | #endif /* __NET_IP_TUNNELS_H */ | 181 | #endif /* __NET_IP_TUNNELS_H */ |