From owner-svn-src-all@freebsd.org Sat Apr 11 07:37:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6A882B1CC0; Sat, 11 Apr 2020 07:37:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zmtF5qKqz4HJN; Sat, 11 Apr 2020 07:37:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3046C8CC; Sat, 11 Apr 2020 07:37:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B7b9jd067991; Sat, 11 Apr 2020 07:37:09 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B7b8cS067986; Sat, 11 Apr 2020 07:37:08 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004110737.03B7b8cS067986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 11 Apr 2020 07:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359797 - in head/sys: net netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet netinet6 X-SVN-Commit-Revision: 359797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 07:37:10 -0000 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 #include #include -#ifdef RADIX_MPATH -#include -#endif #include #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 __FBSDID("$FreeBSD$"); +#include "opt_mpath.h" + #include #include #include @@ -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 #include #include -#ifdef RADIX_MPATH -#include -#endif #include #include @@ -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 __FBSDID("$FreeBSD$"); +#include "opt_mpath.h" + #include #include #include @@ -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);