Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 1 | /* |
| 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 __BIER_BIFT_TABLE_H__ |
| 17 | #define __BIER_BIFT_TABLE_H__ |
| 18 | |
| 19 | #include <vnet/dpo/dpo.h> |
| 20 | #include <vnet/bier/bier_types.h> |
| 21 | #include <vnet/mpls/packet.h> |
| 22 | |
| 23 | /* |
| 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 |
| 27 | */ |
| 28 | #define BIER_BIFT_N_ENTRIES (1 << 20) |
| 29 | typedef struct bier_bfit_table_t_ |
| 30 | { |
| 31 | /** |
| 32 | * Forwarding information for each BIFT ID |
| 33 | */ |
| 34 | dpo_id_t bblt_dpos[BIER_BIFT_N_ENTRIES]; |
| 35 | |
| 36 | /** |
| 37 | * The number of entries in the table |
| 38 | */ |
| 39 | u32 bblt_n_entries; |
| 40 | } bier_bfit_table_t; |
| 41 | |
| 42 | |
| 43 | extern void bier_bift_table_entry_add(bier_bift_id_t id, |
| 44 | const dpo_id_t *dpo); |
| 45 | |
| 46 | extern void bier_bift_table_entry_remove(bier_bift_id_t id); |
| 47 | |
| 48 | /** |
| 49 | * Global BIFT table |
| 50 | */ |
| 51 | extern bier_bfit_table_t *bier_bift_table; |
| 52 | |
| 53 | static inline const dpo_id_t* |
| 54 | bier_bift_dp_lookup (bier_bift_id_t key_host_order) |
| 55 | { |
| 56 | return (&bier_bift_table->bblt_dpos[vnet_mpls_uc_get_label(key_host_order)]); |
| 57 | } |
| 58 | #endif |