blob: c5da8baa05d4a38434b7f024da02a12d50338fb0 [file] [log] [blame]
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +01001/*
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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15
16#ifndef __span_h__
17#define __span_h__
18
19#include <vnet/vnet.h>
20#include <vnet/ip/ip.h>
Eyal Bari001fd402017-07-16 09:34:53 +030021#include <vnet/l2/l2_output.h>
22
23typedef enum
24{
25 SPAN_FEAT_DEVICE,
26 SPAN_FEAT_L2,
27 SPAN_FEAT_N
28} span_feat_t;
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +010029
30typedef struct
31{
Eyal Bari001fd402017-07-16 09:34:53 +030032 clib_bitmap_t *mirror_ports;
33 u32 num_mirror_ports;
34} span_mirror_t;
35
36typedef struct
37{
38 span_mirror_t mirror_rxtx[SPAN_FEAT_N][VLIB_N_RX_TX];
Pavel Kotucek3a2a1c42016-12-06 10:10:10 +010039} span_interface_t;
40
41typedef struct
42{
Eyal Bari001fd402017-07-16 09:34:53 +030043 /* l2 feature Next nodes */
44 u32 l2_input_next[32];
45 u32 l2_output_next[32];
46
Pavel Kotucek3a2a1c42016-12-06 10:10:10 +010047 /* per-interface vector of span instances */
48 span_interface_t *interfaces;
49
50 /* biggest sw_if_index used so far */
51 u32 max_sw_if_index;
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +010052
53 /* convenience */
54 vlib_main_t *vlib_main;
55 vnet_main_t *vnet_main;
Filip Tehlar6f6663f2021-06-22 22:22:58 +000056
57 u16 msg_id_base;
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +010058} span_main_t;
59
Dave Wallace71612d62017-10-24 01:32:41 -040060extern span_main_t span_main;
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +010061
62typedef struct
63{
64 u32 src_sw_if_index; /* mirrored interface index */
65 u32 mirror_sw_if_index; /* output interface index */
66} span_trace_t;
67
68#endif /* __span_h__ */
69
70int
71span_add_delete_entry (vlib_main_t * vm, u32 src_sw_if_index,
Eyal Bari001fd402017-07-16 09:34:53 +030072 u32 dst_sw_if_index, u8 state, span_feat_t sf);
Pavel Kotucekf6e3dc42016-11-04 09:58:01 +010073/*
74 * fd.io coding-style-patch-verification: ON
75 *
76 * Local Variables:
77 * eval: (c-set-style "gnu")
78 * End:
79 */