Author: melifaro Date: Sat Apr 11 07:37:08 2020 New Revision: 359797 URL: https://svnweb.freebsd.org/changeset/base/359797
Log: Remove per-AF radix_mpath initializtion functions. Split their functionality by moving random seed allocation to SYSINIT and calling (new) generic multipath function from standard IPv4/IPv5 RIB init handlers. Differential Revision: https://reviews.freebsd.org/D24356 Modified: head/sys/net/radix_mpath.c head/sys/net/route_var.h head/sys/netinet/in_proto.c head/sys/netinet/in_rmx.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/net/radix_mpath.c Sat Apr 11 07:37:08 2020 (r359797) @@ -290,38 +290,18 @@ rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_i RT_UNLOCK(ro->ro_rt); } -extern int in6_inithead(void **head, int off, u_int fibnum); -extern int in_inithead(void **head, int off, u_int fibnum); - -#ifdef INET -int -rn4_mpath_inithead(void **head, int off, u_int fibnum) +void +rt_mpath_init_rnh(struct rib_head *rnh) { - struct rib_head *rnh; - hashjitter = arc4random(); - if (in_inithead(head, off, fibnum) == 1) { - rnh = (struct rib_head *)*head; - rnh->rnh_multipath = 1; - return 1; - } else - return 0; + rnh->rnh_multipath = 1; } -#endif -#ifdef INET6 -int -rn6_mpath_inithead(void **head, int off, u_int fibnum) +static void +mpath_init(void) { - struct rib_head *rnh; hashjitter = arc4random(); - if (in6_inithead(head, off, fibnum) == 1) { - rnh = (struct rib_head *)*head; - rnh->rnh_multipath = 1; - return 1; - } else - return 0; } +SYSINIT(mpath_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, mpath_init, NULL); -#endif Modified: head/sys/net/route_var.h ============================================================================== --- head/sys/net/route_var.h Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/net/route_var.h Sat Apr 11 07:37:08 2020 (r359797) @@ -88,6 +88,7 @@ _Static_assert(__offsetof(struct route, ro_dst) == __o "ro_dst and " #_dst_new " are at different offset") struct rib_head *rt_tables_get_rnh(int fib, int family); +void rt_mpath_init_rnh(struct rib_head *rnh); /* rte<>nhop translation */ static inline uint16_t Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/netinet/in_proto.c Sat Apr 11 07:37:08 2020 (r359797) @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <net/if_var.h> #include <net/route.h> -#ifdef RADIX_MPATH -#include <net/radix_mpath.h> -#endif #include <net/vnet.h> #endif /* INET */ @@ -305,11 +302,7 @@ struct domain inetdomain = { .dom_name = "internet", .dom_protosw = inetsw, .dom_protoswNPROTOSW = &inetsw[nitems(inetsw)], -#ifdef RADIX_MPATH - .dom_rtattach = rn4_mpath_inithead, -#else .dom_rtattach = in_inithead, -#endif #ifdef VIMAGE .dom_rtdetach = in_detachhead, #endif Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/netinet/in_rmx.c Sat Apr 11 07:37:08 2020 (r359797) @@ -30,6 +30,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_mpath.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -125,6 +127,9 @@ in_inithead(void **head, int off, u_int fibnum) return (0); rh->rnh_addaddr = in_addroute; +#ifdef RADIX_MPATH + rt_mpath_init_rnh(rh); +#endif *head = (void *)rh; if (_in_rt_was_here == 0 ) { Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/netinet6/in6_proto.c Sat Apr 11 07:37:08 2020 (r359797) @@ -90,9 +90,6 @@ __FBSDID("$FreeBSD$"); #include <net/if_var.h> #include <net/radix.h> #include <net/route.h> -#ifdef RADIX_MPATH -#include <net/radix_mpath.h> -#endif #include <netinet/in.h> #include <netinet/in_systm.h> @@ -346,11 +343,7 @@ struct domain inet6domain = { .dom_name = "internet6", .dom_protosw = (struct protosw *)inet6sw, .dom_protoswNPROTOSW = (struct protosw *)&inet6sw[nitems(inet6sw)], -#ifdef RADIX_MPATH - .dom_rtattach = rn6_mpath_inithead, -#else .dom_rtattach = in6_inithead, -#endif #ifdef VIMAGE .dom_rtdetach = in6_detachhead, #endif Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Sat Apr 11 07:31:16 2020 (r359796) +++ head/sys/netinet6/in6_rmx.c Sat Apr 11 07:37:08 2020 (r359797) @@ -64,6 +64,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_mpath.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -167,6 +169,9 @@ in6_inithead(void **head, int off, u_int fibnum) return (0); rh->rnh_addaddr = in6_addroute; +#ifdef RADIX_MPATH + rt_mpath_init_rnh(rh); +#endif *head = (void *)rh; return (1); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"