aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_tunnels.h
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2015-12-24 17:34:54 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-25 23:32:23 -0500
commit039f50629b7f860f36644ed1f34b27da9aa62f43 (patch)
treea5c6ba5107e86018462af57a3ea9a29e82bd8033 /include/net/ip_tunnels.h
parentd7d3e25f40e950bdcec6d94faf9346b7a7d6e4bb (diff)
ip_tunnel: Move stats update to iptunnel_xmit()
By moving stats update into iptunnel_xmit(), we can simplify iptunnel_xmit() usage. With this change there is no need to call another function (iptunnel_xmit_stats()) to update stats in tunnel xmit code path. 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.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 62a750a6a8f8..6db96ea0144f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -273,32 +273,34 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
273} 273}
274 274
275int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 275int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
276int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, 276void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
277 __be32 src, __be32 dst, u8 proto, 277 __be32 src, __be32 dst, u8 proto,
278 u8 tos, u8 ttl, __be16 df, bool xnet); 278 u8 tos, u8 ttl, __be16 df, bool xnet);
279struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, 279struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
280 gfp_t flags); 280 gfp_t flags);
281 281
282struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, 282struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
283 int gso_type_mask); 283 int gso_type_mask);
284 284
285static inline void iptunnel_xmit_stats(int err, 285static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
286 struct net_device_stats *err_stats,
287 struct pcpu_sw_netstats __percpu *stats)
288{ 286{
289 if (err > 0) { 287 if (pkt_len > 0) {
290 struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats); 288 struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
291 289
292 u64_stats_update_begin(&tstats->syncp); 290 u64_stats_update_begin(&tstats->syncp);
293 tstats->tx_bytes += err; 291 tstats->tx_bytes += pkt_len;
294 tstats->tx_packets++; 292 tstats->tx_packets++;
295 u64_stats_update_end(&tstats->syncp); 293 u64_stats_update_end(&tstats->syncp);
296 put_cpu_ptr(tstats); 294 put_cpu_ptr(tstats);
297 } else if (err < 0) {
298 err_stats->tx_errors++;
299 err_stats->tx_aborted_errors++;
300 } else { 295 } else {
301 err_stats->tx_dropped++; 296 struct net_device_stats *err_stats = &dev->stats;
297
298 if (pkt_len < 0) {
299 err_stats->tx_errors++;
300 err_stats->tx_aborted_errors++;
301 } else {
302 err_stats->tx_dropped++;
303 }
302 } 304 }
303} 305}
304 306