summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-14 09:21:02 -0700
committerNeale Ranns <nranns@cisco.com>2019-03-24 17:28:27 +0000
commit0d961549c08ccc6d25cf384fdc8a1c982384219e (patch)
tree0eb0f2694578512ec38b79b391a3a31d807f451d
parent50a392f5a0981fb442449864c479511c54145a29 (diff)
ADJ: more thorough link up check
Change-Id: I04dbfb914706b25fcc3bd6ee0d19cfdc810234ae Signed-off-by: Neale Ranns <nranns@cisco.com> (cherry picked from commit 3e2e1907d485ed321f99350dd46e6822db6ac4d4)
-rw-r--r--src/plugins/unittest/bier_test.c3
-rw-r--r--src/vnet/fib/fib_path.c10
-rw-r--r--src/vnet/interface_funcs.h19
3 files changed, 25 insertions, 7 deletions
diff --git a/src/plugins/unittest/bier_test.c b/src/plugins/unittest/bier_test.c
index d15ee595b64..087da6fbe09 100644
--- a/src/plugins/unittest/bier_test.c
+++ b/src/plugins/unittest/bier_test.c
@@ -127,6 +127,9 @@ bier_test_mk_intf (u32 ninterfaces)
&tm->hw_if_indicies[i],
/* flag change */ 0);
+ error = vnet_hw_interface_set_flags(vnet_get_main(),
+ tm->hw_if_indicies[i],
+ VNET_HW_INTERFACE_FLAG_LINK_UP);
BIER_TEST((NULL == error), "ADD interface %d", i);
tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index d4a701d417c..55013a992e3 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -686,8 +686,8 @@ fib_path_attached_next_hop_set (fib_path_t *path)
FIB_NODE_TYPE_PATH,
fib_path_get_index(path));
- if (!vnet_sw_interface_is_admin_up(vnet_get_main(),
- path->attached_next_hop.fp_interface) ||
+ if (!vnet_sw_interface_is_up(vnet_get_main(),
+ path->attached_next_hop.fp_interface) ||
!adj_is_up(path->fp_dpo.dpoi_index))
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
@@ -1083,7 +1083,7 @@ FIXME comment
uword if_is_up;
adj_index_t ai;
- if_is_up = vnet_sw_interface_is_admin_up(
+ if_is_up = vnet_sw_interface_is_up(
vnet_get_main(),
path->attached_next_hop.fp_interface);
@@ -1886,8 +1886,8 @@ fib_path_resolve (fib_node_index_t path_index)
/*
* path->attached.fp_interface
*/
- if (!vnet_sw_interface_is_admin_up(vnet_get_main(),
- path->attached.fp_interface))
+ if (!vnet_sw_interface_is_up(vnet_get_main(),
+ path->attached.fp_interface))
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
}
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index c4c66179bb5..e94cb9af422 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -306,8 +306,23 @@ vnet_sw_interface_get_mtu (vnet_main_t * vnm, u32 sw_if_index, vnet_mtu_t af)
always_inline uword
vnet_hw_interface_is_link_up (vnet_main_t * vnm, u32 hw_if_index)
{
- return (vnet_hw_interface_get_flags (vnm, hw_if_index) &
- VNET_HW_INTERFACE_FLAG_LINK_UP) != 0;
+ return ((vnet_hw_interface_get_flags (vnm, hw_if_index) &
+ VNET_HW_INTERFACE_FLAG_LINK_UP) != 0);
+}
+
+always_inline uword
+vnet_sw_interface_is_link_up (vnet_main_t * vnm, u32 sw_if_index)
+{
+ vnet_sw_interface_t *sw = vnet_get_sup_sw_interface (vnm, sw_if_index);
+
+ return (vnet_hw_interface_is_link_up (vnm, sw->hw_if_index));
+}
+
+always_inline uword
+vnet_sw_interface_is_up (vnet_main_t * vnm, u32 sw_if_index)
+{
+ return (vnet_sw_interface_is_admin_up (vnm, sw_if_index) &&
+ vnet_sw_interface_is_link_up (vnm, sw_if_index));
}
always_inline vlib_frame_t *