Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __NET_IPIP_H |
2 | #define __NET_IPIP_H 1 | |
3 | ||
4 | #include <linux/if_tunnel.h> | |
60769a5d | 5 | #include <net/gro_cells.h> |
c439cb2e | 6 | #include <net/ip.h> |
1da177e4 LT |
7 | |
8 | /* Keep error state on tunnel for 30 sec */ | |
9 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | |
10 | ||
fa857afc | 11 | /* 6rd prefix/relay information */ |
fd2c3ef7 | 12 | struct ip_tunnel_6rd_parm { |
fa857afc YH |
13 | struct in6_addr prefix; |
14 | __be32 relay_prefix; | |
15 | u16 prefixlen; | |
16 | u16 relay_prefixlen; | |
17 | }; | |
18 | ||
fd2c3ef7 | 19 | struct ip_tunnel { |
6f0bcf15 | 20 | struct ip_tunnel __rcu *next; |
1da177e4 | 21 | struct net_device *dev; |
1da177e4 | 22 | |
1da177e4 LT |
23 | int err_count; /* Number of arrived ICMP errors */ |
24 | unsigned long err_time; /* Time when the last ICMP error arrived */ | |
25 | ||
26 | /* These four fields used only by GRE */ | |
27 | __u32 i_seqno; /* The last seen seqno */ | |
28 | __u32 o_seqno; /* The last output seqno */ | |
29 | int hlen; /* Precalculated GRE header length */ | |
30 | int mlink; | |
31 | ||
32 | struct ip_tunnel_parm parms; | |
300aaeea | 33 | |
fa857afc YH |
34 | /* for SIT */ |
35 | #ifdef CONFIG_IPV6_SIT_6RD | |
36 | struct ip_tunnel_6rd_parm ip6rd; | |
37 | #endif | |
b33eab08 | 38 | struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ |
300aaeea | 39 | unsigned int prl_count; /* # of entries in PRL */ |
60769a5d ED |
40 | |
41 | struct gro_cells gro_cells; | |
fadf6bf0 TF |
42 | }; |
43 | ||
fd2c3ef7 | 44 | struct ip_tunnel_prl_entry { |
b33eab08 | 45 | struct ip_tunnel_prl_entry __rcu *next; |
300aaeea YH |
46 | __be32 addr; |
47 | u16 flags; | |
ef9a9d11 | 48 | struct rcu_head rcu_head; |
1da177e4 LT |
49 | }; |
50 | ||
290b895e | 51 | #define __IPTUNNEL_XMIT(stats1, stats2) do { \ |
1da177e4 | 52 | int err; \ |
64194c31 | 53 | int pkt_len = skb->len - skb_transport_offset(skb); \ |
1da177e4 LT |
54 | \ |
55 | skb->ip_summed = CHECKSUM_NONE; \ | |
d8d1f30b | 56 | ip_select_ident(iph, &rt->dst, NULL); \ |
1da177e4 | 57 | \ |
c439cb2e | 58 | err = ip_local_out(skb); \ |
0bfbedb1 | 59 | if (likely(net_xmit_eval(err) == 0)) { \ |
87b6d218 | 60 | u64_stats_update_begin(&(stats1)->syncp); \ |
290b895e ED |
61 | (stats1)->tx_bytes += pkt_len; \ |
62 | (stats1)->tx_packets++; \ | |
87b6d218 | 63 | u64_stats_update_end(&(stats1)->syncp); \ |
1da177e4 | 64 | } else { \ |
290b895e ED |
65 | (stats2)->tx_errors++; \ |
66 | (stats2)->tx_aborted_errors++; \ | |
1da177e4 LT |
67 | } \ |
68 | } while (0) | |
69 | ||
290b895e ED |
70 | #define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats) |
71 | ||
1da177e4 | 72 | #endif |