Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [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 __FIB_WALK_H__ |
| 17 | #define __FIB_WALK_H__ |
| 18 | |
| 19 | #include <vnet/fib/fib_node.h> |
| 20 | |
| 21 | /** |
| 22 | * @brief Walk priorities. |
| 23 | * Strict priorities. All walks a priority n are completed before n+1 is started. |
| 24 | * Increasing numerical value implies decreasing priority. |
| 25 | */ |
| 26 | typedef enum fib_walk_priority_t_ |
| 27 | { |
| 28 | FIB_WALK_PRIORITY_HIGH = 0, |
| 29 | FIB_WALK_PRIORITY_LOW = 1, |
| 30 | } fib_walk_priority_t; |
| 31 | |
Neale Ranns | 450cd30 | 2016-11-09 17:49:42 +0000 | [diff] [blame] | 32 | #define FIB_WALK_PRIORITY_NUM ((fib_walk_priority_t)(FIB_WALK_PRIORITY_LOW+1)) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 33 | |
| 34 | #define FIB_WALK_PRIORITIES { \ |
| 35 | [FIB_WALK_PRIORITY_HIGH] = "high", \ |
| 36 | [FIB_WALK_PRIORITY_LOW] = "low", \ |
| 37 | } |
| 38 | |
| 39 | #define FOR_EACH_FIB_WALK_PRIORITY(_prio) \ |
| 40 | for ((_prio) = FIB_WALK_PRIORITY_HIGH; \ |
| 41 | (_prio) < FIB_WALK_PRIORITY_NUM; \ |
| 42 | (_prio)++) |
| 43 | |
| 44 | extern void fib_walk_module_init(void); |
| 45 | |
| 46 | extern void fib_walk_async(fib_node_type_t parent_type, |
| 47 | fib_node_index_t parent_index, |
| 48 | fib_walk_priority_t prio, |
| 49 | fib_node_back_walk_ctx_t *ctx); |
| 50 | |
| 51 | extern void fib_walk_sync(fib_node_type_t parent_type, |
| 52 | fib_node_index_t parent_index, |
| 53 | fib_node_back_walk_ctx_t *ctx); |
| 54 | |
Christophe Fontaine | d3c008d | 2017-10-02 18:10:54 +0200 | [diff] [blame] | 55 | extern u8* format_fib_walk_priority(u8 *s, va_list *ap); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 56 | |
Neale Ranns | f12a83f | 2017-04-18 09:09:40 -0700 | [diff] [blame] | 57 | extern void fib_walk_process_enable(void); |
| 58 | extern void fib_walk_process_disable(void); |
| 59 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 60 | #endif |
| 61 | |