34 #define foreach_mactime_error \ 35 _(DROP, "Dropped packets") \ 36 _(OK, "Permitted packets") 40 #define _(sym,str) MACTIME_ERROR_##sym, 47 #define _(sym,string) string, 67 s =
format (s,
"MACTIME: src mac %U device %s result %s\n",
79 u32 n_left_from, *from, *to_next;
85 u32 packets_ok = 0, packets_dropped = 0;
105 while (n_left_from > 0)
111 while (n_left_from > 0 && n_left_to_next > 0)
150 if (clib_bihash_search_8_8 (lut, &kv, &kv) < 0)
163 device_index0 = kv.
value;
200 if (now >= start0 && now <= end0)
242 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
260 to_next, n_left_to_next,
268 MACTIME_ERROR_DROP, packets_dropped);
270 MACTIME_ERROR_OK, packets_ok);
286 .vector_size =
sizeof (
u32),
315 .name =
"mactime-tx",
316 .vector_size =
sizeof (
u32),
vnet_config_main_t config_main
vlib_combined_counter_main_t drop_counters
static char * mactime_error_strings[]
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define MACTIME_DEVICE_FLAG_DYNAMIC_ALLOW
static u8 * format_mac_address(u8 *s, va_list *args)
clib_timebase_range_t * ranges
static f64 clib_timebase_now(clib_timebase_t *tb)
#define foreach_mactime_error
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
mactime_main_t mactime_main
vlib_combined_counter_main_t allow_counters
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
vlib_node_registration_t mactime_tx_node
(constructor) VLIB_REGISTER_NODE (mactime_tx_node)
u32 node_index
Node index.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static uword mactime_tx_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
#define clib_memcpy(a, b, c)
f64 clib_timebase_find_sunday_midnight(f64 start_time)
8 octet key, 8 octet key value pair
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define MACTIME_DEVICE_FLAG_STATIC_DROP
Always drop packets from this device.
mactime_device_t * devices
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u8 output_feature_arc_index
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
clib_bihash_8_8_t lookup_table
void mactime_send_create_entry_message(u8 *mac_address)
Create a lookup table entry for the indicated mac address.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
static u8 * format_mactime_trace(u8 *s, va_list *args)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword mactime_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_tx)
#define MACTIME_DEVICE_FLAG_STATIC_ALLOW
static uword mactime_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_node_registration_t mactime_node
(constructor) VLIB_REGISTER_NODE (mactime_node)
#define MACTIME_DEVICE_FLAG_DYNAMIC_DROP
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.