Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 1 | #ifndef __NET_IPIP_H |
| 2 | #define __NET_IPIP_H 1 |
| 3 | |
| 4 | #include <linux/if_tunnel.h> |
| 5 | #include <net/ip.h> |
| 6 | |
| 7 | #define IPTUNNEL_ERR_TIMEO (30*HZ) |
| 8 | |
| 9 | struct ip_tunnel_6rd_parm { |
| 10 | struct in6_addr prefix; |
| 11 | __be32 relay_prefix; |
| 12 | u16 prefixlen; |
| 13 | u16 relay_prefixlen; |
| 14 | }; |
| 15 | |
| 16 | struct ip_tunnel { |
| 17 | struct ip_tunnel __rcu *next; |
| 18 | struct net_device *dev; |
| 19 | |
| 20 | int err_count; |
| 21 | unsigned long err_time; |
| 22 | |
| 23 | |
| 24 | __u32 i_seqno; |
| 25 | __u32 o_seqno; |
| 26 | int hlen; |
| 27 | int mlink; |
| 28 | |
| 29 | struct ip_tunnel_parm parms; |
| 30 | |
| 31 | |
| 32 | #ifdef CONFIG_IPV6_SIT_6RD |
| 33 | struct ip_tunnel_6rd_parm ip6rd; |
| 34 | #endif |
| 35 | struct ip_tunnel_prl_entry __rcu *prl; |
| 36 | unsigned int prl_count; |
| 37 | }; |
| 38 | |
| 39 | struct ip_tunnel_prl_entry { |
| 40 | struct ip_tunnel_prl_entry __rcu *next; |
| 41 | __be32 addr; |
| 42 | u16 flags; |
| 43 | struct rcu_head rcu_head; |
| 44 | }; |
| 45 | |
| 46 | #define __IPTUNNEL_XMIT(stats1, stats2) do { \ |
| 47 | int err; \ |
| 48 | int pkt_len = skb->len - skb_transport_offset(skb); \ |
| 49 | \ |
| 50 | skb->ip_summed = CHECKSUM_NONE; \ |
| 51 | ip_select_ident(iph, &rt->dst, NULL); \ |
| 52 | \ |
| 53 | err = ip_local_out(skb); \ |
| 54 | if (likely(net_xmit_eval(err) == 0)) { \ |
| 55 | (stats1)->tx_bytes += pkt_len; \ |
| 56 | (stats1)->tx_packets++; \ |
| 57 | } else { \ |
| 58 | (stats2)->tx_errors++; \ |
| 59 | (stats2)->tx_aborted_errors++; \ |
| 60 | } \ |
| 61 | } while (0) |
| 62 | |
| 63 | #define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats) |
| 64 | |
| 65 | #endif |