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 #ifndef __BIER_BIFT_TABLE_H__
17 #define __BIER_BIFT_TABLE_H__
19 #include <vnet/dpo/dpo.h>
20 #include <vnet/bier/bier_types.h>
21 #include <vnet/mpls/packet.h>
24 * the lookup table used to get from a BFIT_ID to a load-balance.
25 * As per-draft draft-ietf-bier-mpls-encapsulation-10 this isthe
26 * use case for non-MPLS networks
28 #define BIER_BIFT_N_ENTRIES (1 << 20)
29 typedef struct bier_bfit_table_t_
32 * Forwarding information for each BIFT ID
34 dpo_id_t bblt_dpos[BIER_BIFT_N_ENTRIES];
37 * The number of entries in the table
43 extern void bier_bift_table_entry_add(bier_bift_id_t id,
46 extern void bier_bift_table_entry_remove(bier_bift_id_t id);
51 extern bier_bfit_table_t *bier_bift_table;
53 static inline const dpo_id_t*
54 bier_bift_dp_lookup (bier_bift_id_t key_host_order)
56 return (&bier_bift_table->bblt_dpos[vnet_mpls_uc_get_label(key_host_order)]);