aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_tunnels.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip_tunnels.h')
-rw-r--r--include/net/ip_tunnels.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 09b1360e10bf..781b3cf86a2f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -42,6 +42,7 @@ struct ip_tunnel {
42 struct ip_tunnel __rcu *next; 42 struct ip_tunnel __rcu *next;
43 struct hlist_node hash_node; 43 struct hlist_node hash_node;
44 struct net_device *dev; 44 struct net_device *dev;
45 struct net *net; /* netns for packet i/o */
45 46
46 int err_count; /* Number of arrived ICMP errors */ 47 int err_count; /* Number of arrived ICMP errors */
47 unsigned long err_time; /* Time when the last ICMP error 48 unsigned long err_time; /* Time when the last ICMP error
@@ -73,6 +74,7 @@ struct ip_tunnel {
73#define TUNNEL_REC __cpu_to_be16(0x20) 74#define TUNNEL_REC __cpu_to_be16(0x20)
74#define TUNNEL_VERSION __cpu_to_be16(0x40) 75#define TUNNEL_VERSION __cpu_to_be16(0x40)
75#define TUNNEL_NO_KEY __cpu_to_be16(0x80) 76#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
77#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
76 78
77struct tnl_ptk_info { 79struct tnl_ptk_info {
78 __be16 flags; 80 __be16 flags;
@@ -92,6 +94,8 @@ struct ip_tunnel_net {
92 struct net_device *fb_tunnel_dev; 94 struct net_device *fb_tunnel_dev;
93}; 95};
94 96
97#ifdef CONFIG_INET
98
95int ip_tunnel_init(struct net_device *dev); 99int ip_tunnel_init(struct net_device *dev);
96void ip_tunnel_uninit(struct net_device *dev); 100void ip_tunnel_uninit(struct net_device *dev);
97void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 101void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
@@ -101,7 +105,7 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
101void ip_tunnel_delete_net(struct ip_tunnel_net *itn); 105void ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102 106
103void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, 107void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104 const struct iphdr *tnl_params); 108 const struct iphdr *tnl_params, const u8 protocol);
105int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); 109int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); 110int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107 111
@@ -155,23 +159,31 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
155 (skb_shinfo(skb)->gso_segs ?: 1) - 1); 159 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
156} 160}
157 161
158static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) 162int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
159{ 163int iptunnel_xmit(struct net *net, struct rtable *rt,
160 int err; 164 struct sk_buff *skb,
161 int pkt_len = skb->len - skb_transport_offset(skb); 165 __be32 src, __be32 dst, __u8 proto,
162 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); 166 __u8 tos, __u8 ttl, __be16 df);
163 167
164 nf_reset(skb); 168static inline void iptunnel_xmit_stats(int err,
169 struct net_device_stats *err_stats,
170 struct pcpu_tstats __percpu *stats)
171{
172 if (err > 0) {
173 struct pcpu_tstats *tstats = this_cpu_ptr(stats);
165 174
166 err = ip_local_out(skb);
167 if (likely(net_xmit_eval(err) == 0)) {
168 u64_stats_update_begin(&tstats->syncp); 175 u64_stats_update_begin(&tstats->syncp);
169 tstats->tx_bytes += pkt_len; 176 tstats->tx_bytes += err;
170 tstats->tx_packets++; 177 tstats->tx_packets++;
171 u64_stats_update_end(&tstats->syncp); 178 u64_stats_update_end(&tstats->syncp);
179 } else if (err < 0) {
180 err_stats->tx_errors++;
181 err_stats->tx_aborted_errors++;
172 } else { 182 } else {
173 dev->stats.tx_errors++; 183 err_stats->tx_dropped++;
174 dev->stats.tx_aborted_errors++;
175 } 184 }
176} 185}
186
187#endif /* CONFIG_INET */
188
177#endif /* __NET_IP_TUNNELS_H */ 189#endif /* __NET_IP_TUNNELS_H */