From 88fc83eb716bf07f4634de6de5b569f795a56418 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 5 Apr 2017 08:11:14 -0700 Subject: BFD-FIB interactions - single-hop BFD: attach a delegate to the appropriate adjacency - multi-hop BFD [not supported yet]: attach a delegate to the FIB entry. adjacency/fib_entry state tracks the BFD session state. when the state is down the object does not contribute forwarding hence and hence dependent objects will not use it. For example, if a route is ECMP via two adjacencies and one of them is BFD down, then only the other is used to forward (i.e. we don't drop half the traffic). Change-Id: I0ef53e20e73b067001a132cd0a3045408811a822 Signed-off-by: Neale Ranns --- src/vnet/fib/fib_entry_delegate.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/vnet/fib/fib_entry_delegate.h') diff --git a/src/vnet/fib/fib_entry_delegate.h b/src/vnet/fib/fib_entry_delegate.h index d9183c5f181..333d357c120 100644 --- a/src/vnet/fib/fib_entry_delegate.h +++ b/src/vnet/fib/fib_entry_delegate.h @@ -42,6 +42,10 @@ typedef enum fib_entry_delegate_type_t_ { * to their respective cover */ FIB_ENTRY_DELEGATE_COVERED, + /** + * BFD session state + */ + FIB_ENTRY_DELEGATE_BFD, /** * Attached import/export functionality */ @@ -61,6 +65,28 @@ typedef enum fib_entry_delegate_type_t_ { } \ } \ } +#define FOR_EACH_DELEGATE(_entry, _fdt, _fed, _body) \ +{ \ + for (_fdt = FIB_ENTRY_DELEGATE_CHAIN_UNICAST_IP4; \ + _fdt <= FIB_ENTRY_DELEGATE_ATTACHED_EXPORT; \ + _fdt++) \ + { \ + _fed = fib_entry_delegate_get(_entry, _fdt); \ + if (NULL != _fed) { \ + _body; \ + } \ + } \ +} + +/** + * Distillation of the BFD session states into a go/no-go for using + * the associated tracked FIB entry + */ +typedef enum fib_bfd_state_t_ +{ + FIB_BFD_STATE_UP, + FIB_BFD_STATE_DOWN, +} fib_bfd_state_t; /** * A Delagate is a means to implmenet the Delagation design pattern; the extension of an @@ -103,6 +129,11 @@ typedef struct fib_entry_delegate_t_ * For the cover tracking. The node list; */ fib_node_list_t fd_list; + + /** + * BFD state + */ + fib_bfd_state_t fd_bfd_state; }; } fib_entry_delegate_t; @@ -122,4 +153,6 @@ extern fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type( extern fib_entry_delegate_type_t fib_entry_chain_type_to_delegate_type( fib_forward_chain_type_t type); +extern u8 *format_fib_entry_deletegate(u8 * s, va_list * args); + #endif -- cgit 1.2.3-korg