gre: Unify IPTUNNEL_XMIT across kernel versions.
[openvswitch] / datapath / linux-2.6 / compat-2.6 / include / net / ipip.h
1 #ifndef __NET_IPIP_WRAPPER_H
2 #define __NET_IPIP_WRAPPER_H 1
3
4 #include <linux/version.h>
5
6 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
7
8 #include <linux/if_tunnel.h>
9 #include <net/ip.h>
10
11 /* Keep error state on tunnel for 30 sec */
12 #define IPTUNNEL_ERR_TIMEO      (30*HZ)
13
14 struct ip_tunnel
15 {
16         struct ip_tunnel        *next;
17         struct net_device       *dev;
18 #ifndef HAVE_NETDEV_STATS
19         struct net_device_stats stat;
20 #endif
21
22         int                     err_count;      /* Number of arrived ICMP errors */
23         unsigned long           err_time;       /* Time when the last ICMP error arrived */
24
25         /* These four fields used only by GRE */
26         __u32                   i_seqno;        /* The last seen seqno  */
27         __u32                   o_seqno;        /* The last output seqno */
28         int                     hlen;           /* Precalculated GRE header length */
29         int                     mlink;
30
31         struct ip_tunnel_parm   parms;
32
33         struct ip_tunnel_prl_entry      *prl;           /* potential router list */
34         unsigned int                    prl_count;      /* # of entries in PRL */
35 };
36
37 /* ISATAP: default interval between RS in secondy */
38 #define IPTUNNEL_RS_DEFAULT_DELAY       (900)
39
40 struct ip_tunnel_prl_entry
41 {
42         struct ip_tunnel_prl_entry      *next;
43         __be32                          addr;
44         u16                             flags;
45         unsigned long                   rs_delay;
46         struct timer_list               rs_timer;
47         struct ip_tunnel                *tunnel;
48         spinlock_t                      lock;
49 };
50
51 #define IPTUNNEL_XMIT() do {                                            \
52         int err;                                                        \
53         int pkt_len = skb->len - skb_transport_offset(skb);             \
54                                                                         \
55         skb->ip_summed = CHECKSUM_NONE;                                 \
56         ip_select_ident(iph, &rt->u.dst, NULL);                         \
57                                                                         \
58         err = ip_local_out(skb);                                        \
59         if (net_xmit_eval(err) == 0) {                                  \
60                 stats->tx_bytes += pkt_len;                             \
61                 stats->tx_packets++;                                    \
62         } else {                                                        \
63                 stats->tx_errors++;                                     \
64                 stats->tx_aborted_errors++;                             \
65         }                                                               \
66 } while (0)
67
68 #else
69 #include_next <net/ipip.h>
70 #endif /* kernel < 2.6.32 */
71
72 #endif /* net/ipip.h wrapper */