diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-03-30 13:30:19 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-03-30 16:08:20 +0000 |
| commit | 81dbacbb7d71a53eef99ce73f7e589a165c3e1d6 (patch) | |
| tree | 6a70964b100aa6d7990932c006f7dff691bacbd4 | |
| parent | a223d6c489c7ea9a384f3d2bbda1b05b00d4502d (diff) | |
net/route: Add an eventhandler for rt_numfibs changes
The multicast routing code will start implementing per-FIB routing
tables. As a part of this, it needs to be notified when the number of
FIBs changes, so that it can expand its tables.
Add an eventhandler for this purpose.
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D55239
| -rw-r--r-- | sys/net/route.h | 6 | ||||
| -rw-r--r-- | sys/net/route/route_tables.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index 49bb7abd9726..34df3297d6d4 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -32,6 +32,9 @@ #ifndef _NET_ROUTE_H_ #define _NET_ROUTE_H_ +#ifdef _KERNEL +#include <sys/_eventhandler.h> +#endif #include <net/vnet.h> /* @@ -124,6 +127,9 @@ VNET_DECLARE(u_int, rt_add_addr_allfibs); /* Announce interfaces to all fibs */ #define V_fib_hash_outbound VNET(fib_hash_outbound) VNET_DECLARE(u_int, fib_hash_outbound); +typedef void (*rtnumfibs_change_t)(void *, uint32_t); +EVENTHANDLER_DECLARE(rtnumfibs_change, rtnumfibs_change_t); + /* Outbound flowid generation rules */ #ifdef RSS #define fib4_calc_packet_hash xps_proto_software_hash_v4 diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index 749ef063e125..571f1db9c40d 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -33,10 +33,10 @@ * Which is the new name for an in kernel routing (next hop) table. * ***********************************************************************/ -#include <sys/cdefs.h> #include "opt_route.h" #include <sys/param.h> +#include <sys/eventhandler.h> #include <sys/socket.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -268,6 +268,8 @@ grow_rtables(uint32_t num_tables) old_rt_tables = V_rt_tables; V_rt_tables = new_rt_tables; + EVENTHANDLER_INVOKE(rtnumfibs_change, num_tables); + /* Wait till all cpus see new pointers */ atomic_thread_fence_rel(); NET_EPOCH_WAIT(); |
