ipip.h 1.8 KB

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