mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Static: Minor overhaul
The patch fixes several bugs introduced in previous changes, simplifies the protocol by handing routes uniformly, introduces asynchronous route processing to avoid issues with separate notifications for each next-hop in ECMP routes, and makes reconfiguration faster by avoiding quadratic complexity.
This commit is contained in:
committed by
Jan Moskyto Matejka
parent
5ffb62dd03
commit
7126cadf80
@@ -14,7 +14,7 @@
|
||||
#include "sysdep/config.h"
|
||||
|
||||
#define BUFFER(type) struct { type *data; uint used, size; }
|
||||
|
||||
#define BUFFER_TYPE(v) typeof(* (v).data)
|
||||
#define BUFFER_SIZE(v) ((v).size * sizeof(* (v).data))
|
||||
|
||||
#define BUFFER_INIT(v,pool,isize) \
|
||||
@@ -46,6 +46,9 @@
|
||||
|
||||
#define BUFFER_FLUSH(v) ({ (v).used = 0; })
|
||||
|
||||
#define BUFFER_WALK(v,n) \
|
||||
for (BUFFER_TYPE(v) *_n = (v).data, n; _n < ((v).data + (v).used) && (n = *_n, 1); _n++)
|
||||
|
||||
#define BUFFER_SHALLOW_COPY(dst, src) \
|
||||
({ \
|
||||
(dst).used = (src).used; \
|
||||
|
@@ -133,6 +133,25 @@ t_buffer_flush(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
t_buffer_walk(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
init_buffer();
|
||||
fill_expected_array();
|
||||
for (i = 0; i < MAX_NUM; i++)
|
||||
BUFFER_PUSH(buf) = expected[i];
|
||||
|
||||
i = 0;
|
||||
BUFFER_WALK(buf, v)
|
||||
bt_assert(v == expected[i++]);
|
||||
|
||||
bt_assert(i == MAX_NUM);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -142,6 +161,7 @@ main(int argc, char *argv[])
|
||||
bt_test_suite(t_buffer_pop, "Fill whole buffer (PUSH), a half of elements POP and PUSH new elements");
|
||||
bt_test_suite(t_buffer_resize, "Init a small buffer and try overfill");
|
||||
bt_test_suite(t_buffer_flush, "Fill and flush all elements");
|
||||
bt_test_suite(t_buffer_walk, "Fill and walk through buffer");
|
||||
|
||||
return bt_exit_value();
|
||||
}
|
||||
|
Reference in New Issue
Block a user