aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorOle Trøan <otroan@employees.org>2018-02-15 22:02:01 +0000
committerOle Trøan <otroan@employees.org>2018-02-15 22:02:01 +0000
commit909c26bda66313b86168dda31003f76410c1d746 (patch)
tree116c02d48fe51239ffdbb719abbdf34d37928e73 /src/vnet
parenta44b015aa012d3b07ed873925d47c6d5955b7dd2 (diff)
Revert "Adj: VFTs for adjacency sub-blocks"
This reverts commit a44b015aa012d3b07ed873925d47c6d5955b7dd2. Change-Id: I2d76bc0844f58e5ddf3f3a4326b86076f46e3751 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/adj/adj.c4
-rw-r--r--src/vnet/adj/adj_bfd.c19
-rw-r--r--src/vnet/adj/adj_delegate.c66
-rw-r--r--src/vnet/adj/adj_delegate.h13
-rw-r--r--src/vnet/adj/adj_internal.h1
5 files changed, 29 insertions, 74 deletions
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c
index e1d7821fd39..d28d5195330 100644
--- a/src/vnet/adj/adj.c
+++ b/src/vnet/adj/adj.c
@@ -139,7 +139,7 @@ format_ip_adjacency (u8 * s, va_list * args)
s = format(s, "\n delegates:\n ");
FOR_EACH_ADJ_DELEGATE(adj, adt, aed,
{
- s = format(s, " %U\n", format_adj_delegate, aed);
+ s = format(s, " %U\n", format_adj_deletegate, aed);
});
s = format(s, "\n children:\n ");
@@ -162,8 +162,6 @@ adj_last_lock_gone (ip_adjacency_t *adj)
ASSERT(0 == fib_node_list_get_size(adj->ia_node.fn_children));
ADJ_DBG(adj, "last-lock-gone");
- adj_delegate_vft_lock_gone(adj);
-
vlib_worker_thread_barrier_sync (vm);
switch (adj->lookup_next_index)
diff --git a/src/vnet/adj/adj_bfd.c b/src/vnet/adj/adj_bfd.c
index 2d845ffcfd8..3d294c4646e 100644
--- a/src/vnet/adj/adj_bfd.c
+++ b/src/vnet/adj/adj_bfd.c
@@ -168,23 +168,6 @@ adj_bfd_notify (bfd_listen_event_e event,
adj_unlock(ai);
}
-/**
- * Print a delegate that represents BFD tracking
- */
-static u8 *
-adj_delegate_fmt_bfd (const adj_delegate_t *aed, u8 *s)
-{
- s = format(s, "BFD:[state:%d index:%d]",
- aed->ad_bfd_state,
- aed->ad_bfd_index);
-
- return (s);
-}
-
-const static adj_delegate_vft_t adj_delegate_vft = {
- .adv_format = adj_delegate_fmt_bfd,
-};
-
static clib_error_t *
adj_bfd_main_init (vlib_main_t * vm)
{
@@ -195,8 +178,6 @@ adj_bfd_main_init (vlib_main_t * vm)
bfd_register_listener(adj_bfd_notify);
- adj_delegate_register_type (ADJ_DELEGATE_BFD, &adj_delegate_vft);
-
return (error);
}
diff --git a/src/vnet/adj/adj_delegate.c b/src/vnet/adj/adj_delegate.c
index c65cc8be64e..701b36e2fd9 100644
--- a/src/vnet/adj/adj_delegate.c
+++ b/src/vnet/adj/adj_delegate.c
@@ -17,11 +17,6 @@
#include <vnet/adj/adj.h>
#include <vnet/adj/adj_internal.h>
-/*
- * The per-type vector of virtual function tables
- */
-static adj_delegate_vft_t *ad_vfts;
-
static adj_delegate_t *
adj_delegate_find_i (const ip_adjacency_t *adj,
adj_delegate_type_t type,
@@ -110,47 +105,40 @@ adj_delegate_find_or_add (ip_adjacency_t *adj,
return (adj_delegate_get(adj, adt));
}
-void adj_delegate_vft_lock_gone (ip_adjacency_t *adj)
-{
- adj_delegate_t *delegate;
- vec_foreach(delegate, adj->ia_delegates) {
- if (ad_vfts[delegate->ad_type].adv_last_lock)
- ad_vfts[delegate->ad_type].adv_last_lock(adj, delegate);
- }
-}
+/**
+ * typedef for printing a delegate
+ */
+typedef u8 * (*adj_delegate_format_t)(const adj_delegate_t *aed,
+ u8 *s);
-u8 *
-format_adj_delegate (u8 * s, va_list * args)
+/**
+ * Print a delegate that represents BFD tracking
+ */
+static u8 *
+adj_delegate_fmt_bfd (const adj_delegate_t *aed,
+ u8 *s)
{
- adj_delegate_t *aed;
+ s = format(s, "BFD:[state:%d index:%d]",
+ aed->ad_bfd_state,
+ aed->ad_bfd_index);
- aed = va_arg (*args, adj_delegate_t *);
- if (ad_vfts[aed->ad_type].adv_format)
- return ad_vfts[aed->ad_type].adv_format(aed, s);
- return format(s, "unknown delegate");
+ return (s);
}
/**
- * adj_delegate_register_type
- *
- * Register the function table for a given type
+ * A delegate type to formatter map
*/
+static adj_delegate_format_t aed_formatters[] =
+{
+ [ADJ_DELEGATE_BFD] = adj_delegate_fmt_bfd,
+};
-void
-adj_delegate_register_type (adj_delegate_type_t type,
- const adj_delegate_vft_t *vft)
+u8 *
+format_adj_deletegate (u8 * s, va_list * args)
{
- /*
- * assert that one only registration is made per-node type
- */
- if (vec_len(ad_vfts) > type)
- ASSERT(NULL == ad_vfts[type].adv_last_lock);
-
- /*
- * Assert that we are getting each of the required functions
- */
- ASSERT(NULL != vft->adv_last_lock);
-
- vec_validate(ad_vfts, type);
- ad_vfts[type] = *vft;
+ adj_delegate_t *aed;
+
+ aed = va_arg (*args, adj_delegate_t *);
+
+ return (aed_formatters[aed->ad_type](aed, s));
}
diff --git a/src/vnet/adj/adj_delegate.h b/src/vnet/adj/adj_delegate.h
index 9f7d8c64afc..176512039d6 100644
--- a/src/vnet/adj/adj_delegate.h
+++ b/src/vnet/adj/adj_delegate.h
@@ -91,16 +91,6 @@ typedef struct adj_delegate_t_
};
} adj_delegate_t;
-/**
- * An ADJ delegate virtual function table
- */
-typedef void (*adj_delegate_last_lock_gone_t)(ip_adjacency_t *adj, adj_delegate_t *aed);
-typedef u8 * (*adj_delegate_format_t)(const adj_delegate_t *aed, u8 *s);
-typedef struct adj_delegate_vft_t_ {
- adj_delegate_format_t adv_format;
- adj_delegate_last_lock_gone_t adv_last_lock;
-} adj_delegate_vft_t;
-
extern void adj_delegate_remove(ip_adjacency_t *adj,
adj_delegate_type_t type);
@@ -109,7 +99,6 @@ extern adj_delegate_t *adj_delegate_find_or_add(ip_adjacency_t *adj,
extern adj_delegate_t *adj_delegate_get(const ip_adjacency_t *adj,
adj_delegate_type_t type);
-extern u8 *format_adj_delegate(u8 * s, va_list * args);
-extern void adj_delegate_register_type(adj_delegate_type_t type, const adj_delegate_vft_t *vft);
+extern u8 *format_adj_deletegate(u8 * s, va_list * args);
#endif
diff --git a/src/vnet/adj/adj_internal.h b/src/vnet/adj/adj_internal.h
index 55afe55fa79..3b7ddb2f10c 100644
--- a/src/vnet/adj/adj_internal.h
+++ b/src/vnet/adj/adj_internal.h
@@ -126,6 +126,5 @@ extern void adj_mcast_remove(fib_protocol_t proto,
u32 sw_if_index);
extern u32 adj_dpo_get_urpf(const dpo_id_t *dpo);
-extern void adj_delegate_vft_lock_gone(ip_adjacency_t *adj);
#endif