aboutsummaryrefslogtreecommitdiff
path: root/datapath/tunnel.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-08-16 10:32:41 -0400
committerJesse Gross <jesse@nicira.com>2010-08-24 15:17:29 -0400
commit5214f5c4e95b843b47b047139764d6f4af524785 (patch)
tree0b95ffadf2b4a9168ccf8e6b11d26ec8d9b9a3a3 /datapath/tunnel.h
parent17dcd764543b3f31cfa795ddce4bbf56f0038cb0 (diff)
datapath: Add support for tunnel fragmentation.
Up until now it was assumed that encapsulated packets larger than the MTU would be fragmented by the IP stack. However, some tunneling protocols provide their own fragmentation mechanism. This adds the necessary support to the generic tunnel code to support fragmentation. Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/tunnel.h')
-rw-r--r--datapath/tunnel.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/datapath/tunnel.h b/datapath/tunnel.h
index 89e73bac..92963d76 100644
--- a/datapath/tunnel.h
+++ b/datapath/tunnel.h
@@ -13,8 +13,10 @@
#include "table.h"
#include "vport.h"
-/* The absolute minimum fragment size. Note that there are many other
- * definitions of the minimum MTU. */
+/*
+ * The absolute minimum fragment size. Note that there are many other
+ * definitions of the minimum MTU.
+ */
#define IP_MIN_MTU 68
/*
@@ -47,9 +49,24 @@ struct tnl_ops {
u32 tunnel_type;
u8 ipproto;
+ /*
+ * Returns the length of the tunnel header you will add in
+ * build_header() (i.e. excludes the IP header). Returns a negative
+ * error code if the configuration is invalid.
+ */
int (*hdr_len)(const struct tnl_port_config *);
- void (*build_header)(struct sk_buff *, const struct vport *,
- const struct tnl_mutable_config *);
+
+ /*
+ * Returns a linked list of SKBs with tunnel headers (multiple
+ * packets may be generated in the event of fragmentation). Space
+ * will have already been allocated at the start of the packet equal
+ * to sizeof(struct iphdr) + value returned by hdr_len(). The IP
+ * header will have already been constructed.
+ */
+ struct sk_buff *(*build_header)(struct sk_buff *,
+ const struct vport *,
+ const struct tnl_mutable_config *,
+ struct dst_entry *);
};
struct tnl_vport {
@@ -61,6 +78,8 @@ struct tnl_vport {
/* Protected by RCU. */
struct tnl_mutable_config *mutable;
+
+ atomic_t frag_id;
};
int tnl_init(void);