ip: add support for buffer offload metadata in ip midchain
[vpp.git] / src / vnet / ip / ip_frag.h
index ef5eb4c..4ddd62b 100644 (file)
@@ -36,6 +36,7 @@
 #define IP_FRAG_H
 
 #include <vnet/vnet.h>
+#include <vnet/ip/ip.api_enum.h>
 
 #define IP_FRAG_FLAG_IP4_HEADER 0x01   //Encapsulating IPv4 header
 #define IP_FRAG_FLAG_IP6_HEADER 0x02   //Encapsulating IPv6 header
@@ -48,50 +49,29 @@ extern vlib_node_registration_t ip6_frag_node;
 
 typedef enum
 {
-  IP4_FRAG_NEXT_IP4_REWRITE,
-  IP4_FRAG_NEXT_IP4_LOOKUP,
-  IP4_FRAG_NEXT_IP6_LOOKUP,
-  IP4_FRAG_NEXT_ICMP_ERROR,
-  IP4_FRAG_NEXT_DROP,
-  IP4_FRAG_N_NEXT
-} ip4_frag_next_t;
+  IP_FRAG_NEXT_IP_REWRITE,
+  IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN,
+  IP_FRAG_NEXT_IP4_LOOKUP,
+  IP_FRAG_NEXT_IP6_LOOKUP,
+  IP_FRAG_NEXT_ICMP_ERROR,
+  IP_FRAG_NEXT_DROP,
+  IP_FRAG_N_NEXT
+} ip_frag_next_t;
 
-typedef enum
-{
-  IP6_FRAG_NEXT_IP4_LOOKUP,
-  IP6_FRAG_NEXT_IP6_LOOKUP,
-  IP6_FRAG_NEXT_IP6_REWRITE,
-  IP6_FRAG_NEXT_DROP,
-  IP6_FRAG_N_NEXT
-} ip6_frag_next_t;
+typedef vl_counter_ip_frag_enum_t ip_frag_error_t;
 
-#define foreach_ip_frag_error                          \
-  /* Must be first. */                                 \
- _(NONE, "packet fragmented")                          \
- _(SMALL_PACKET, "packet smaller than MTU")             \
- _(FRAGMENT_SENT, "number of sent fragments")           \
- _(CANT_FRAGMENT_HEADER, "can't fragment header")      \
- _(DONT_FRAGMENT_SET, "can't fragment this packet")    \
- _(MALFORMED, "malformed packet")                       \
- _(MEMORY, "could not allocate buffer")                 \
- _(UNKNOWN, "unknown error")
+void ip_frag_set_vnet_buffer (vlib_buffer_t * b, u16 mtu,
+                             u8 next_index, u8 flags);
 
-typedef enum
-{
-#define _(sym,str) IP_FRAG_ERROR_##sym,
-  foreach_ip_frag_error
-#undef _
-    IP_FRAG_N_ERROR,
-} ip_frag_error_t;
+extern ip_frag_error_t ip4_frag_do_fragment (vlib_main_t * vm,
+                                            u32 from_bi,
+                                            u16 mtu,
+                                            u16 encapsize, u32 ** buffer);
+extern ip_frag_error_t ip6_frag_do_fragment (vlib_main_t * vm,
+                                            u32 from_bi,
+                                            u16 mtu,
+                                            u16 encapsize, u32 ** buffer);
 
-void ip_frag_set_vnet_buffer (vlib_buffer_t * b, u16 offset, u16 mtu,
-                             u8 next_index, u8 flags);
-void
-ip4_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer,
-                     ip_frag_error_t * error);
-void
-ip6_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer,
-                     ip_frag_error_t * error);
 #endif /* ifndef IP_FRAG_H */
 
 /*