| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
ok denis@, jmatthew@
|
|
|
|
|
|
| |
from here.
reported by anton and otto
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an ART node is linked to multiple route entries, in the MPATH case,
it is not safe to dereference ``an_dst''. This non-refcounted pointer
can be changed at any time by another CPU.
So get rid of the pointer and use the first destination of a route entry
when comparing sockaddrs.
This allows us so remove a pointer from 'struct art_node' and save 5Mb of
memory in an IPv4 fullfeed.
ok jmatthew@, claudio@, dlg@
|
|
|
|
| |
rectification.
|
|
|
|
|
| |
in the functions. This way it can be used for other trees as well.
OK mpi@ phessler@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.
most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.
the manpage and subr_pool.c bits i did myself.
ok tedu@ jmatthew@
@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);
|
|
|
|
|
|
| |
taking the kernel lock.
ok mpi@ dlg@
|
|
|
|
|
|
|
| |
function has been fixed.
Functions passed to rtable_walk() must return EAGAIN if they delete an
entry from the tree, no matter if it is a leaf or not.
|
|
|
|
|
|
|
|
|
| |
prevent an off-by-one when removing entries from the mpath list.
Fix a regression introduced by the refactoring needed to serialize
rtable_walk() with create/delete.
ok jca@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
art_walk now explicitly takes the same lock used to serialise change
made via rtable_insert and _delete, so it can safely adjust the
refcnts on tables while it recurses into them. they need to still
exist when returning out of the recursion.
it uses srps to access nodes and drops the lock before calling the
callback function. this is because some callbacks sleep (eg, copyout
in the sysctl code that dumps an rtable to userland), which you
shouldnt hold a lock accross. other callbacks attempt to modify
the rtable (eg, marking routes as down when then interface theyre
on goes down), which tries to take the lock again, which probably
wont work in the future.
ok jmatthew@ mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
art_lookup and art_match now return an active srp_ref, which the caller must
leave when it's done with the returned route (if any). This allows lookups
to be done without holding any locks.
The art_table and art_node garbage collectors are still responsible for
freeing items removed from the routing table, so they now use srp_finalize
to wait out any active references, and updates are done using srp_swap
operations.
ok dlg@ mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this will allow us to sleep in srp_finalize before freeing the
memory.
the defer is done by putting the tables and nodes on a list which
is serviced by a task. the task removes all the entries from the
list and pool_puts them.
the art_tables gc code uses at_parent as its list entry, and the
art_node gc code uses a union with the an_dst pointer. both at_parent
and an_dst are only used when theyre active as part of an art data
structure, and are not used in lookups. once the art is done with
them we can reuse these pointers safely.
ok mpi@
|
| |
|
|
|
|
|
|
|
|
| |
in the future a table may also be referenced by a cpu reading it
with srp as well as the art rtable, so try and make sure it is
always usable.
ok mpi@
|
|
|
|
| |
ok mpi@
|
|
|
|
| |
ok jmatthew@
|
|
|
|
| |
Reported by and ok jmatthew@
|
|
|
|
| |
offset of the address in the sockaddr to initialize the stride lengths.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
allocator for the 4K heap.
In this configuration a fullfeed BGP server for v4 and v6 consumes
10M more than with the radix tree.
This double the depth of the tree and makes the lookup slower. But
the ratio speed/memory can be adjusted in the future, for now we are
interested in a lock-free route lookup.
Tested by and ok benno@
|
|
|
|
|
|
| |
existing route rather than overwrite it.
ok mpi@
|
|
|
|
| |
While here initialize pools in art_init().
|
|
|
|
|
|
|
| |
With this change we no longer waste some precious Kb for unused
routing tables like the AF_MPLS one or those with rtableid != 0.
This will also simplify the SRP dance during lookups.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pool(9) to not waste most of the memory allocated.
This reduces the memory overhead of our ART routing table from 80M
to 70M compared to the existing radix-tree when loading ~550K IPv4
routes.
ART can now be used for huge tables without exhausting malloc(9)'s
limit.
claudio@ agrees with the direction, inputs from and ok dlg@
|
|
|
|
| |
Needed by the regression tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
turning rtable_get(9) MP-safe.
Use only one per-AF array, as suggested by claudio@, pointing to an
array of pointers to the routing table heads.
Routing tables are now allocated/initialized per-AF. This will let
us allocate routing table on-demand instead of always having an
AF_INET, AF_MPLS and AF_INET table as soon as a new rtableID is used.
This also get rid of the "void ***" madness.
ok dlg@, jmatthew@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The routing table is not an optional component of the network stack
and initializing it inside the "routing domain" requires some ugly
introspection in the domain interface.
This put the rtable* layer at the same level of the if* level. These
two subsystem are organized around the two global data structure used
in the network stack:
- the global &ifnet list, to be used in process context only, and
- the routing table which can be read in interrupt context.
This change makes the rtable_* layer domain-aware and extends the
"struct domain" such that INET, INET6 and MPLS can specify the length
of the binary key used in lookups. This allows us to keep, or move
towards, AF-free route and rtable layers.
While here stop the madness and pass the size of the maximum key length
in *byte* to rn_inithead0().
ok claudio@, mikeb@
|
|
|
|
|
|
|
|
|
|
| |
Keep route entry/BSD compatibility goos in the rtable layer. The way
addresses and masks (prefix-lengths) are encoded is really tied to the
radix-tree implementation.
Since we decided to no longer support non-contiguous masks, we could get
rid of some extra "sockaddr" allocations and reduce the memory grows
related to the use of a multibit-trie.
|
|
|
|
|
|
| |
his reference ART implementation from a BSD 4-clause to ISC.
Thanks a lot to him!
|
|
ART implementation.
ART (Allotment Routing Table) is a multibit-trie algorithm invented by
D. Knuth while reviewing Yoichi's SMART [0] (Smart Multi-Array Routing
Table) paper.
This implementation, unlike the one from the KAME project, supports
variable stride lengths which makes it easier to adapt the consumed
memory/speed trade-off. It also let you use a bigger first-level
table, what other algorithms such as POPTRIE [1] need to implement
separately.
Adaptation to the OpenBSD kernel has been done with two different data
structures. ART nodes and route entries are managed separately which
makes the algorithm implementation free of any MULTIPATH logic.
This implementation does not include Path Compression.
[0] http://www.hariguchi.org/art/smart.pdf
[1] http://conferences.sigcomm.org/sigcomm/2015/pdf/papers/p57.pdf
ok dlg@, reyk@
|