2 * Copyright (c) 2018 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 #ifndef __GBP_INTERFACE_H__
17 #define __GBP_INTERFACE_H__
19 #include <vnet/l2/l2_input.h>
20 #include <vnet/l2/l2_output.h>
21 #include <vnet/dpo/dpo.h>
24 #define foreach_gdb_l3_feature \
25 _(LEARN_IP4, "gbp-learn-ip4", "ip4-unicast") \
26 _(LEARN_IP6, "gbp-learn-ip6", "ip6-unicast")
28 typedef enum gbp_itf_l3_feat_pos_t_
30 #define _(s,v,a) GBP_ITF_L3_FEAT_POS_##s,
31 foreach_gdb_l3_feature
33 } gbp_itf_l3_feat_pos_t;
35 typedef enum gbp_itf_l3_feat_t_
38 #define _(s,v,a) GBP_ITF_L3_FEAT_##s = (1 << GBP_ITF_L3_FEAT_POS_##s),
39 foreach_gdb_l3_feature
43 #define GBP_ITF_L3_FEAT_LEARN (GBP_ITF_L3_FEAT_LEARN_IP4|GBP_ITF_L3_FEAT_LEARN_IP6)
45 typedef struct gbp_itf_hdl_t_
57 #define GBP_ITF_HDL_INIT {.gh_which = ~0}
58 const static gbp_itf_hdl_t GBP_ITF_HDL_INVALID = GBP_ITF_HDL_INIT;
60 extern void gbp_itf_hdl_reset (gbp_itf_hdl_t * gh);
61 extern bool gbp_itf_hdl_is_valid (gbp_itf_hdl_t gh);
63 typedef void (*gbp_itf_free_fn_t) (u32 sw_if_index);
65 extern gbp_itf_hdl_t gbp_itf_l2_add_and_lock (u32 sw_if_index, u32 bd_index);
66 extern gbp_itf_hdl_t gbp_itf_l3_add_and_lock (u32 sw_if_index, index_t gri);
67 extern gbp_itf_hdl_t gbp_itf_l2_add_and_lock_w_free (u32 sw_if_index,
69 gbp_itf_free_fn_t ff);
70 extern gbp_itf_hdl_t gbp_itf_l3_add_and_lock_w_free (u32 sw_if_index,
72 gbp_itf_free_fn_t ff);
74 extern void gbp_itf_unlock (gbp_itf_hdl_t * hdl);
75 extern void gbp_itf_lock (gbp_itf_hdl_t hdl);
76 extern gbp_itf_hdl_t gbp_itf_clone_and_lock (gbp_itf_hdl_t hdl);
77 extern u32 gbp_itf_get_sw_if_index (gbp_itf_hdl_t hdl);
79 extern void gbp_itf_l2_set_input_feature (gbp_itf_hdl_t hdl,
80 l2input_feat_masks_t feats);
81 extern void gbp_itf_l2_set_output_feature (gbp_itf_hdl_t hdl,
82 l2output_feat_masks_t feats);
84 extern void gbp_itf_l3_set_input_feature (gbp_itf_hdl_t hdl,
85 gbp_itf_l3_feat_t feats);
87 extern u8 *format_gbp_itf_hdl (u8 * s, va_list * args);
92 * fd.io coding-style-patch-verification: ON
95 * eval: (c-set-style "gnu")