aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2020-11-26 09:34:39 +0000
committerBeno�t Ganne <bganne@cisco.com>2020-11-26 13:18:29 +0000
commitfdf6b6f52460890305f231c041e060fbb232550b (patch)
tree07f5301bd4b7ce912a38f1b79fded3a1fdf5b804 /src/vnet
parentab4fbedf27ece4ea623d7c3b54cc54f0133ba1f7 (diff)
fib: Expressive type for walk return code. Honour code.
Type: improvement Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: I487e698555545fce85d02d55deaaf7bb0007e388
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/dpo/load_balance_map.c4
-rw-r--r--src/vnet/fib/fib_attached_export.c4
-rw-r--r--src/vnet/fib/fib_entry_cover.c15
-rw-r--r--src/vnet/fib/fib_entry_cover.h6
-rw-r--r--src/vnet/fib/fib_node.c4
-rw-r--r--src/vnet/fib/fib_node_list.c3
-rw-r--r--src/vnet/fib/fib_node_list.h4
-rw-r--r--src/vnet/mfib/mfib_entry_cover.c5
8 files changed, 21 insertions, 24 deletions
diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c
index c03acaf2d70..de5f30bc60a 100644
--- a/src/vnet/dpo/load_balance_map.c
+++ b/src/vnet/dpo/load_balance_map.c
@@ -491,7 +491,7 @@ load_balance_map_unlock (index_t lbmi)
}
}
-static int
+static walk_rc_t
load_balance_map_path_state_change_walk (fib_node_ptr_t *fptr,
void *ctx)
{
@@ -501,7 +501,7 @@ load_balance_map_path_state_change_walk (fib_node_ptr_t *fptr,
load_balance_map_fill(lbm);
- return (!0);
+ return (WALK_CONTINUE);
}
/**
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index 4a33b8897f5..5ea96fd0cf6 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -205,7 +205,7 @@ fib_entry_import_add (fib_ae_import_t *import,
/**
* Call back when walking a connected prefix's covered prefixes for import
*/
-static int
+static walk_rc_t
fib_entry_covered_walk_import (fib_entry_t *cover,
fib_node_index_t covered,
void *ctx)
@@ -214,7 +214,7 @@ fib_entry_covered_walk_import (fib_entry_t *cover,
fib_entry_import_add(import, covered);
- return (0);
+ return (WALK_CONTINUE);
}
/*
diff --git a/src/vnet/fib/fib_entry_cover.c b/src/vnet/fib/fib_entry_cover.c
index 153bd70a5bf..47bc5c30ce6 100644
--- a/src/vnet/fib/fib_entry_cover.c
+++ b/src/vnet/fib/fib_entry_cover.c
@@ -72,7 +72,7 @@ typedef struct fib_enty_cover_walk_ctx_t_ {
void *ctx;
} fib_enty_cover_walk_ctx_t;
-static int
+static walk_rc_t
fib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
void *args)
{
@@ -80,8 +80,7 @@ fib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
ctx->walk(ctx->cover, depend->fnp_index, ctx->ctx);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
@@ -107,7 +106,7 @@ fib_entry_cover_walk (fib_entry_t *cover,
&ctx);
}
-static int
+static walk_rc_t
fib_entry_cover_change_one (fib_entry_t *cover,
fib_node_index_t covered,
void *args)
@@ -144,8 +143,7 @@ fib_entry_cover_change_one (fib_entry_t *cover,
fib_entry_cover_changed(covered);
}
}
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
@@ -161,15 +159,14 @@ fib_entry_cover_change_notify (fib_node_index_t cover_index,
uword_to_pointer(covered, void*));
}
-static int
+static walk_rc_t
fib_entry_cover_update_one (fib_entry_t *cover,
fib_node_index_t covered,
void *args)
{
fib_entry_cover_updated(covered);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
diff --git a/src/vnet/fib/fib_entry_cover.h b/src/vnet/fib/fib_entry_cover.h
index 500d5b33244..499efdc31c6 100644
--- a/src/vnet/fib/fib_entry_cover.h
+++ b/src/vnet/fib/fib_entry_cover.h
@@ -21,9 +21,9 @@
/**
* callback function used when walking the covered entries
*/
-typedef int (*fib_entry_covered_walk_t)(fib_entry_t *cover,
- fib_node_index_t covered,
- void *ctx);
+typedef walk_rc_t (*fib_entry_covered_walk_t)(fib_entry_t *cover,
+ fib_node_index_t covered,
+ void *ctx);
extern u32 fib_entry_cover_track(fib_entry_t *cover,
fib_node_index_t covered);
diff --git a/src/vnet/fib/fib_node.c b/src/vnet/fib/fib_node.c
index 3e99007da64..1d3abd50a9d 100644
--- a/src/vnet/fib/fib_node.c
+++ b/src/vnet/fib/fib_node.c
@@ -161,7 +161,7 @@ fib_node_back_walk_one (fib_node_ptr_t *ptr,
return (fn_vfts[ptr->fnp_type].fnv_back_walk(node, ctx));
}
-static int
+static walk_rc_t
fib_node_ptr_format_one_child (fib_node_ptr_t *ptr,
void *arg)
{
@@ -169,7 +169,7 @@ fib_node_ptr_format_one_child (fib_node_ptr_t *ptr,
*s = fib_node_format(ptr, *s);
- return (1);
+ return (WALK_CONTINUE);
}
u8*
diff --git a/src/vnet/fib/fib_node_list.c b/src/vnet/fib/fib_node_list.c
index ceb951b466b..bcd9a09152d 100644
--- a/src/vnet/fib/fib_node_list.c
+++ b/src/vnet/fib/fib_node_list.c
@@ -372,7 +372,8 @@ fib_node_list_walk (fib_node_list_t list,
elt = fib_node_list_elt_get(sibling);
sibling = elt->fnle_next;
- fn(&elt->fnle_owner, args);
+ if (WALK_STOP == fn(&elt->fnle_owner, args))
+ break;
}
}
diff --git a/src/vnet/fib/fib_node_list.h b/src/vnet/fib/fib_node_list.h
index 9567b9669e8..76abec50543 100644
--- a/src/vnet/fib/fib_node_list.h
+++ b/src/vnet/fib/fib_node_list.h
@@ -52,8 +52,8 @@ extern u32 fib_node_list_get_size(fib_node_list_t head);
/**
* @brief Callback function invoked during a list walk
*/
-typedef int (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
- void *args);
+typedef walk_rc_t (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
+ void *args);
extern void fib_node_list_walk(fib_node_list_t head,
fib_node_list_walk_cb_t fn,
diff --git a/src/vnet/mfib/mfib_entry_cover.c b/src/vnet/mfib/mfib_entry_cover.c
index 6caeb1b6928..2f5fd6bad08 100644
--- a/src/vnet/mfib/mfib_entry_cover.c
+++ b/src/vnet/mfib/mfib_entry_cover.c
@@ -71,7 +71,7 @@ typedef struct mfib_enty_cover_walk_ctx_t_ {
void *ctx;
} mfib_enty_cover_walk_ctx_t;
-static int
+static walk_rc_t
mfib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
void *args)
{
@@ -79,8 +79,7 @@ mfib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
ctx->walk(ctx->cover, depend->fnp_index, ctx->ctx);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void