#include <stdbool.h>
#include <vnet/ip/ip.h>
+/* Punting reason flags bitfield
+ * (position, length, value, name, string)
+ */
+#define foreach_vnet_punt_reason_flag \
+ _ (0, 1, 0, IP4_PACKET, "ip4-packet") \
+ _ (0, 1, 1, IP6_PACKET, "ip6-packet")
+
+typedef enum vnet_punt_reason_flag_t_
+{
+#define _(pos, len, value, name, str) \
+ VNET_PUNT_REASON_F_##name = ((value) << (pos)),
+ foreach_vnet_punt_reason_flag
+#undef _
+} __clib_packed vnet_punt_reason_flag_t;
+
+enum vnet_punt_reason_flag_mask_t_
+{
+#define _(pos, len, value, name, str) \
+ VNET_PUNT_REASON_F_MASK_##name = (((1 << (len)) - 1) << (pos)),
+ foreach_vnet_punt_reason_flag
+#undef _
+};
+
+/* predicates associated with vlib_punt_reason_flag_t*/
+#define _(pos, len, value, name, str) \
+ static_always_inline int vnet_punt_reason_flag_is_##name ( \
+ vnet_punt_reason_flag_t f) \
+ { \
+ return (f & VNET_PUNT_REASON_F_MASK_##name) == VNET_PUNT_REASON_F_##name; \
+ }
+foreach_vnet_punt_reason_flag
+#undef _
+
#define foreach_punt_type \
_(L4, "l4") \
_(EXCEPTION, "exception") \
_(IP_PROTO, "ip-proto")
-typedef enum punt_type_t_
-{
+ typedef enum punt_type_t_ {
#define _(v, s) PUNT_TYPE_##v,
- foreach_punt_type
+ foreach_punt_type
#undef _
-} punt_type_t;
+ } punt_type_t;
typedef struct punt_l4_t_
{
void *clients_by_ip_proto;
} punt_client_db_t;
+typedef struct punt_thread_data_t_
+{
+ struct iovec *iovecs;
+} punt_thread_data_t;
+
typedef struct
{
int socket_fd;
vlib_node_t *interface_output_node;
u32 *ready_fds;
u32 *rx_buffers;
+ punt_thread_data_t *thread_data;
vlib_punt_hdl_t hdl;
+ u16 msg_id_base;
} punt_main_t;
extern punt_main_t punt_main;
extern void punt_client_walk (punt_type_t pt,
punt_client_walk_cb_t cb, void *ctx);
+extern u8 *format_vnet_punt_reason_flags (u8 *s, va_list *args);
+
/*
* inlines for the data-plane
*/
extern vlib_node_registration_t udp6_punt_node;
extern vlib_node_registration_t udp4_punt_socket_node;
extern vlib_node_registration_t udp6_punt_socket_node;
+extern vlib_node_registration_t icmp6_punt_socket_node;
extern vlib_node_registration_t ip4_proto_punt_socket_node;
extern vlib_node_registration_t ip6_proto_punt_socket_node;
extern vlib_node_registration_t punt_socket_rx_node;