2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/buffer.h>
17 #include <vlib/vlib.h>
18 #include <vnet/dpo/dpo.h>
20 #include <vnet/bier/bier_hdr_inlines.h>
22 typedef struct bier_drop_trace_t_
28 bier_drop_trace (vlib_main_t * vm,
29 vlib_node_runtime_t * node,
34 n_left = frame->n_vectors;
35 from = vlib_frame_vector_args (frame);
40 bier_drop_trace_t *t0;
44 b0 = vlib_get_buffer (vm, bi0);
46 if (b0->flags & VLIB_BUFFER_IS_TRACED)
48 t0 = vlib_add_trace (vm, node, b0, sizeof(*t0));
50 t0->dpi = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
58 bier_drop (vlib_main_t * vm,
59 vlib_node_runtime_t * node,
62 u32 *buffers = vlib_frame_vector_args (frame);
63 uword n_packets = frame->n_vectors;
65 if (node->flags & VLIB_NODE_FLAG_TRACE)
66 bier_drop_trace (vm, node, frame);
68 vlib_error_drop_buffers (vm, node, buffers,
72 0, // bier_input_node.index,
79 format_bier_drop_trace (u8 * s, va_list * args)
81 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
82 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
83 bier_drop_trace_t *t = va_arg (*args, bier_drop_trace_t *);
85 s = format (s, "dpo-idx %d", t->dpi);
90 VLIB_REGISTER_NODE (bier_drop_node, static) =
92 .function = bier_drop,
94 .vector_size = sizeof (u32),
95 .format_trace = format_bier_drop_trace,