From owner-dev-commits-src-main@freebsd.org Mon Jan 11 23:30:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B3AAC4E9AF3; Mon, 11 Jan 2021 23:30:42 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DF91Z4j7vz3L6h; Mon, 11 Jan 2021 23:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94763233CA; Mon, 11 Jan 2021 23:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10BNUg9j044668; Mon, 11 Jan 2021 23:30:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10BNUgPM044667; Mon, 11 Jan 2021 23:30:42 GMT (envelope-from git) Date: Mon, 11 Jan 2021 23:30:42 GMT Message-Id: <202101112330.10BNUgPM044667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2defbe9f0e01 - main - Use rn_match instead of doing indirect calls in fib_algo. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2defbe9f0e01381da0550e7ffbf4e75c723c9331 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 23:30:42 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2defbe9f0e01381da0550e7ffbf4e75c723c9331 commit 2defbe9f0e01381da0550e7ffbf4e75c723c9331 Author: Alexander V. Chernikov AuthorDate: 2021-01-11 23:11:55 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-11 23:30:35 +0000 Use rn_match instead of doing indirect calls in fib_algo. Relevant inet/inet6 code has the control over deciding what the RIB lookup function currently is. With that in mind, explicitly set it to the current value (rn_match) in the datapath lookups. This avoids cost on indirect call. Differential Revision: https://reviews.freebsd.org/D28066 --- sys/netinet/in_fib_algo.c | 4 ++-- sys/netinet6/in6_fib_algo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/in_fib_algo.c b/sys/netinet/in_fib_algo.c index 92592a6a286f..48e48da395fa 100644 --- a/sys/netinet/in_fib_algo.c +++ b/sys/netinet/in_fib_algo.c @@ -521,7 +521,7 @@ lradix4_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopei .sin_len = KEY_LEN_INET, .sin_addr = key.addr4, }; - ent = (struct radix4_addr_entry *)(rnh->rnh_matchaddr(&addr4, &rnh->rh)); + ent = (struct radix4_addr_entry *)(rn_match(&addr4, &rnh->rh)); if (ent != NULL) return (ent->nhop); return (NULL); @@ -680,7 +680,7 @@ radix4_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid nh = NULL; RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin4, &rh->head); + rn = rn_match((void *)&sin4, &rh->head); if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) nh = (RNTORT(rn))->rt_nhop; RIB_RUNLOCK(rh); diff --git a/sys/netinet6/in6_fib_algo.c b/sys/netinet6/in6_fib_algo.c index 4b0409143c95..c9df9387af37 100644 --- a/sys/netinet6/in6_fib_algo.c +++ b/sys/netinet6/in6_fib_algo.c @@ -106,7 +106,7 @@ lradix6_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopei }; if (IN6_IS_SCOPE_LINKLOCAL(key.addr6)) addr6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); - ent = (struct radix6_addr_entry *)(rnh->rnh_matchaddr(&addr6, &rnh->rh)); + ent = (struct radix6_addr_entry *)(rn_match(&addr6, &rnh->rh)); if (ent != NULL) return (ent->nhop); return (NULL); @@ -264,7 +264,7 @@ radix6_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid nh = NULL; RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); + rn = rn_match((void *)&sin6, &rh->head); if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) nh = (RNTORT(rn))->rt_nhop; RIB_RUNLOCK(rh);