X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Flinux-2.6%2Fcompat-2.6%2Finclude%2Fnet%2Fipip.h;h=7fa0b2826a6c9c4426934fb617912ba941fa3511;hb=410dd7bfda014a7c90bb5bd1de3274dd40ef6906;hp=604ece2dcff3204a0407b0222f1df88ed43717bb;hpb=02059c09d4d7bc4860db9aee7f4daae43b6eab68;p=sliver-openvswitch.git diff --git a/datapath/linux-2.6/compat-2.6/include/net/ipip.h b/datapath/linux-2.6/compat-2.6/include/net/ipip.h index 604ece2dc..7fa0b2826 100644 --- a/datapath/linux-2.6/compat-2.6/include/net/ipip.h +++ b/datapath/linux-2.6/compat-2.6/include/net/ipip.h @@ -3,6 +3,10 @@ #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) +#define HAVE_NETDEV_QUEUE_STATS +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) #include @@ -48,6 +52,16 @@ struct ip_tunnel_prl_entry spinlock_t lock; }; +#ifdef HAVE_NETDEV_QUEUE_STATS +#define UPDATE_TX_STATS() \ + txq->tx_bytes += pkt_len; \ + txq->tx_packets++; +#else +#define UPDATE_TX_STATS() \ + stats->tx_bytes += pkt_len; \ + stats->tx_packets++; +#endif + #define IPTUNNEL_XMIT() do { \ int err; \ int pkt_len = skb->len - skb_transport_offset(skb); \ @@ -56,9 +70,8 @@ struct ip_tunnel_prl_entry ip_select_ident(iph, &rt->u.dst, NULL); \ \ err = ip_local_out(skb); \ - if (net_xmit_eval(err) == 0) { \ - stats->tx_bytes += pkt_len; \ - stats->tx_packets++; \ + if (likely(net_xmit_eval(err) == 0)) { \ + UPDATE_TX_STATS(); \ } else { \ stats->tx_errors++; \ stats->tx_aborted_errors++; \