From nobody Wed May 08 11:19:55 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VZCNW6D0Lz5Kt50; Wed, 08 May 2024 11:19:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VZCNW3Kddz49Kx; Wed, 8 May 2024 11:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715167195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v8cr11eYikXzFY63sz+4A/bgpQ+e4NCAOVcc9h9j5ac=; b=VCnGy8lK2iGs3yVV4fltWbKPuCRlhJyGiI1jwzcwwDZuiV11vpT3wbAiIiAvzKr5g+AyIA 0wWLOfY7JmGZMofFBmdvAztgIWg4ENrMDvL89PreAEEh87xFpFRQs/nnDAM5C32HUBsvzu u2rl17e7TA84V3V/UrliB0eV5xyODMKMld/eh3Op5QR3hGYcm6Q0+J6DmkE9cgLZkgqtzY A+aYhXlBVTZ38W1bZCBj9aF4AGthl83S0+V9W/YMXutIKeJoFB0vqNTkQ3z6WVHenNQssB 6WWMiNqJ1xkNdCgpJSL3wULCnJG+F1B01cdNpdzP+gK5qrvw27mQXtDQEPFC2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715167195; a=rsa-sha256; cv=none; b=eZZv3Za7El1+qOcEIX+Z2zGx7DpN/Tk8ElsAunektQl+dDKshWMWoO1yybeLPRHpFKYgWG FwbrDAG1aGYeMDl8JFqtIoXI7SGe2QvEC0DM71FNePqofS5SB70MKdFAXm/LQyOcAI/dIH poofSJMVzl1vOITSyr7gBB0Wdf/tl08fa7oC7kvWAfvy7kEOcJOHW8EKBKzvkxMU0jX7LW GksPkgNizttTpWkgURFcwz2k0GtKinAkQgA3tynC2G7lmCI2iab4gCzf8h0H0WzlcHqLmH Xa6hBQ3byxiRKKY+X0NANnHIs3Cv069V54QliBPJIoCux+JIpdQF6tSVJn3SzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715167195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v8cr11eYikXzFY63sz+4A/bgpQ+e4NCAOVcc9h9j5ac=; b=vCdti3MA7Dkax/C53RoNcVJzczznEuoRjZkNwWC+aOFkwglPAEHC4djyeYzLcQI7rPAjQo sCYMhvowrMuGpHmUtJNRqKVdAdh+RT/qQNuQfSuD/EDuE8VONJt+ERkLqL4wMhNgKVQsMV JCajk/FdSI910Wf1+ahtRwdy8e0j7pMpPukkwhbrZgfqbDpCb9dl/i9QtI5U5ADOMXLtsZ G/qS21wfmc0Cj30NZW5HCVYEH7n0XxaWBnVWMTo5ZqToKDl+v08NWPg5UMlGnEoSDNxovd YitkDg+MJJLVF5YvlLtuCcjoF9aw6jXA41ghGuHWI8wNTr8qYazl9AX2mvWL4g== 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 4VZCNW2ww0zMYJ; Wed, 8 May 2024 11:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 448BJtYv094551; Wed, 8 May 2024 11:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 448BJtiZ094548; Wed, 8 May 2024 11:19:55 GMT (envelope-from git) Date: Wed, 8 May 2024 11:19:55 GMT Message-Id: <202405081119.448BJtiZ094548@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5ee92cbd82d0 - main - carp: don't chain call vrrp_send_ad via carp_send_ad List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ee92cbd82d0afb65bc5feabf29d8417307d38ad Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5ee92cbd82d0afb65bc5feabf29d8417307d38ad commit 5ee92cbd82d0afb65bc5feabf29d8417307d38ad Author: Gleb Smirnoff AuthorDate: 2024-04-29 22:33:51 +0000 Commit: Kristof Provost CommitDate: 2024-05-08 11:19:04 +0000 carp: don't chain call vrrp_send_ad via carp_send_ad Provide inline send_ad_locked() that switches between protocol specific sending function. Rename carp_send_ad() to carp_callout() to avoid getting lost in all these multiple foo_send_ad. No functional change intended. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D45036 --- sys/netinet/ip_carp.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index cf7c8d03ca73..332e76b492fa 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -350,7 +350,6 @@ static void carp_setrun(struct carp_softc *, sa_family_t); static void carp_master_down(void *); static void carp_master_down_locked(struct carp_softc *, const char* reason); -static void carp_send_ad(void *); static void carp_send_ad_locked(struct carp_softc *); static void vrrp_send_ad_locked(struct carp_softc *); static void carp_addroute(struct carp_softc *); @@ -1087,6 +1086,19 @@ carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch) return (carp_tag(sc, m)); } +static inline void +send_ad_locked(struct carp_softc *sc) +{ + switch (sc->sc_version) { + case CARP_VERSION_CARP: + carp_send_ad_locked(sc); + break; + case CARP_VERSION_VRRPv3: + vrrp_send_ad_locked(sc); + break; + } +} + /* * To avoid LORs and possible recursions this function shouldn't * be called directly, but scheduled via taskqueue. @@ -1103,7 +1115,7 @@ carp_send_ad_all(void *ctx __unused, int pending __unused) if (sc->sc_state == MASTER) { CARP_LOCK(sc); CURVNET_SET(sc->sc_carpdev->if_vnet); - carp_send_ad_locked(sc); + send_ad_locked(sc); CURVNET_RESTORE(); CARP_UNLOCK(sc); } @@ -1113,7 +1125,7 @@ carp_send_ad_all(void *ctx __unused, int pending __unused) /* Send a periodic advertisement, executed in callout context. */ static void -carp_send_ad(void *v) +carp_callout(void *v) { struct carp_softc *sc = v; struct epoch_tracker et; @@ -1121,7 +1133,7 @@ carp_send_ad(void *v) NET_EPOCH_ENTER(et); CARP_LOCK_ASSERT(sc); CURVNET_SET(sc->sc_carpdev->if_vnet); - carp_send_ad_locked(sc); + send_ad_locked(sc); CURVNET_RESTORE(); CARP_UNLOCK(sc); NET_EPOCH_EXIT(et); @@ -1205,11 +1217,7 @@ carp_send_ad_locked(struct carp_softc *sc) NET_EPOCH_ASSERT(); CARP_LOCK_ASSERT(sc); - - if (sc->sc_version == CARP_VERSION_VRRPv3) { - vrrp_send_ad_locked(sc); - return; - } + MPASS(sc->sc_version == CARP_VERSION_CARP); advskew = DEMOTE_ADVSKEW(sc); tv.tv_sec = sc->sc_advbase; @@ -1339,7 +1347,7 @@ carp_send_ad_locked(struct carp_softc *sc) #endif /* INET6 */ resched: - callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), carp_send_ad, sc); + callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), carp_callout, sc); } static void @@ -1520,7 +1528,7 @@ vrrp_send_ad_locked(struct carp_softc *sc) resched: callout_reset(&sc->sc_ad_tmo, sc->sc_vrrp_adv_inter * hz / 100, - carp_send_ad, sc); + carp_callout, sc); } static void @@ -1760,7 +1768,7 @@ carp_master_down_locked(struct carp_softc *sc, const char *reason) switch (sc->sc_state) { case BACKUP: carp_set_state(sc, MASTER, reason); - carp_send_ad_locked(sc); + send_ad_locked(sc); #ifdef INET carp_send_arp(sc); #endif @@ -1852,11 +1860,11 @@ carp_setrun(struct carp_softc *sc, sa_family_t af) tv.tv_sec = sc->sc_advbase; tv.tv_usec = sc->sc_advskew * 1000000 / 256; callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), - carp_send_ad, sc); + carp_callout, sc); } else { callout_reset(&sc->sc_ad_tmo, sc->sc_vrrp_adv_inter * hz / 100, - carp_send_ad, sc); + carp_callout, sc); } break; }