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
This commit is contained in:
parent
2cafe2f90c
commit
4684d3cbcb
@ -290,38 +290,18 @@ rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum)
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
int
|
||||
rn6_mpath_inithead(void **head, int off, u_int fibnum)
|
||||
{
|
||||
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;
|
||||
rnh->rnh_multipath = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
mpath_init(void)
|
||||
{
|
||||
|
||||
hashjitter = arc4random();
|
||||
}
|
||||
SYSINIT(mpath_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, mpath_init, NULL);
|
||||
|
||||
|
@ -88,6 +88,7 @@ _Static_assert(__offsetof(struct route, ro_dst) == __offsetof(_ro_new, _dst_new)
|
||||
"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
|
||||
|
@ -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
|
||||
|
@ -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 ) {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user