From nobody Wed Mar 29 16:32:39 2023 X-Original-To: dev-commits-src-main@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 4PmsXl68HSz42mPN; Wed, 29 Mar 2023 16:32:39 +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 4PmsXl5VJPz4Y8K; Wed, 29 Mar 2023 16:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680107559; 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=XW58yMpiE9cWNWLlvI1dYj39F7KybQAdZnltzNn8xsE=; b=E/ZnrICc3pJUvF9biMerzECyqZ1hWOELqr94EnaxiCRp9xDMGxoHSWKbc/JRutwWk9RqDY uPCyC9oGLvRBNkS3gtxEE55du9Udva2bbr2j7ZKsj77T8PAv6W0eLH+SCeX77Xl8nlE+SU u92RVTiMRaLTvjusvVZo9TgMB0duGqKQHOmrojI6Oy+pL9kzOyO9wzmleWQyEILYNHAVMN X6ILeAGZKMElopqeLB+5JI/xFJZY9fBUUd0idggVmL7j8zdrYE5MFTXncxnNIKSDpEkKPa y+HAeIS9fdN1cR4J/dMWp1JFglPEIhzvM2zGNMkSRymTK1O5bMBKAYW5Iuzy8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680107559; 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=XW58yMpiE9cWNWLlvI1dYj39F7KybQAdZnltzNn8xsE=; b=wOLbA3hbYGApvKJiu7LthUOXivdT2r+ABBavg70A0Ko5rg+6dQcmGk6oQYHL3sQFACfN1D fNMAY0Dn/ZQ5eUqXBlcWT5XSfDBwE5F5pmF/mHNPHWzNq9q3wiiG4nkpVjQm4wrMZcvYsC s0u3hYwgMdu3cHNePcd1k1wXGtgIo8nMewa90VRYKeCmUMtnRRQf5/UleI2KFTFl3nxewL +1A9OVSvLeIQIMMPEaZ0WUKz6pc7cB265kwL7T1IFkTHJS2M4CLvuLdDVikMydhuv3TIsc zZ+FVQO2xes9zjAWeItB2hN/J48lRByANdKIMGXv99gTXI7RHqnuV25kkUWtcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680107559; a=rsa-sha256; cv=none; b=htKDUEeOdyS7E7lnh4Sdh5GOJfE/qejpjxG/yyDZNJ7+yRXSPUc7t+cgyzExUH9MsZwN8k 4xnO0FwNst55KXZuyK2TU4nrsA7lSHehyGtFLGo7ei2ostpKfNHRbq6XVdouBOEN53GH8S MAk5hystuQLtCGsXl9mrt+KDSJ858mccLCQwSDFQFHHasynr+bTsonCAE30iVc9w3/rbvb AtkzuV9F6qrRO4MFr1M3xw3ky5y2uKqFa+gyFGQfrTNc9VCwJ+UUV8tEx98jn8oPHn6dwF S2In1wmT4pH9Q5H23iRO0k8Wcdiaqt0UInwJ6jmgknLyGLpAmwBrcZoO8LSyZA== 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 4PmsXl4VZTzcpw; Wed, 29 Mar 2023 16:32:39 +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 32TGWdhG006692; Wed, 29 Mar 2023 16:32:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32TGWdmJ006691; Wed, 29 Mar 2023 16:32:39 GMT (envelope-from git) Date: Wed, 29 Mar 2023 16:32:39 GMT Message-Id: <202303291632.32TGWdmJ006691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: dbe86dd5de18 - main - lagg(4): Refactor out some lagg protocol input routines into a default one List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbe86dd5de18fdf61e1300f6575e0f50785bf6b3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=dbe86dd5de18fdf61e1300f6575e0f50785bf6b3 commit dbe86dd5de18fdf61e1300f6575e0f50785bf6b3 Author: Zhenlei Huang AuthorDate: 2023-03-29 16:16:21 +0000 Commit: Zhenlei Huang CommitDate: 2023-03-29 16:22:13 +0000 lagg(4): Refactor out some lagg protocol input routines into a default one Those input routines are identical. Also inline two fast paths. No functional change intended. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39251 --- sys/net/if_lagg.c | 64 ++++++++++++++++++------------------------------------- 1 file changed, 21 insertions(+), 43 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 42c194233a89..7acfa524670c 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -171,8 +171,6 @@ static struct lagg_port *lagg_link_active(struct lagg_softc *, /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); static int lagg_rr_start(struct lagg_softc *, struct mbuf *); -static struct mbuf *lagg_rr_input(struct lagg_softc *, struct lagg_port *, - struct mbuf *); /* Active failover */ static int lagg_fail_start(struct lagg_softc *, struct mbuf *); @@ -185,14 +183,10 @@ static void lagg_lb_detach(struct lagg_softc *); static int lagg_lb_port_create(struct lagg_port *); static void lagg_lb_port_destroy(struct lagg_port *); static int lagg_lb_start(struct lagg_softc *, struct mbuf *); -static struct mbuf *lagg_lb_input(struct lagg_softc *, struct lagg_port *, - struct mbuf *); static int lagg_lb_porttable(struct lagg_softc *, struct lagg_port *); /* Broadcast */ static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); -static struct mbuf *lagg_bcast_input(struct lagg_softc *, struct lagg_port *, - struct mbuf *); /* 802.3ad LACP */ static void lagg_lacp_attach(struct lagg_softc *); @@ -202,6 +196,10 @@ static struct mbuf *lagg_lacp_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); static void lagg_lacp_lladdr(struct lagg_softc *); +/* Default input */ +static struct mbuf *lagg_default_input(struct lagg_softc *, struct lagg_port *, + struct mbuf *); + /* lagg protocol table */ static const struct lagg_proto { lagg_proto pr_num; @@ -226,7 +224,7 @@ static const struct lagg_proto { .pr_num = LAGG_PROTO_ROUNDROBIN, .pr_attach = lagg_rr_attach, .pr_start = lagg_rr_start, - .pr_input = lagg_rr_input, + .pr_input = lagg_default_input, }, { .pr_num = LAGG_PROTO_FAILOVER, @@ -238,7 +236,7 @@ static const struct lagg_proto { .pr_attach = lagg_lb_attach, .pr_detach = lagg_lb_detach, .pr_start = lagg_lb_start, - .pr_input = lagg_lb_input, + .pr_input = lagg_default_input, .pr_addport = lagg_lb_port_create, .pr_delport = lagg_lb_port_destroy, }, @@ -260,7 +258,7 @@ static const struct lagg_proto { { .pr_num = LAGG_PROTO_BROADCAST, .pr_start = lagg_bcast_start, - .pr_input = lagg_bcast_input, + .pr_input = lagg_default_input, }, }; @@ -387,14 +385,14 @@ lagg_proto_detach(struct lagg_softc *sc) lagg_protos[pr].pr_detach(sc); } -static int +static inline int lagg_proto_start(struct lagg_softc *sc, struct mbuf *m) { return (lagg_protos[sc->sc_proto].pr_start(sc, m)); } -static struct mbuf * +static inline struct mbuf * lagg_proto_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) { @@ -2427,17 +2425,6 @@ lagg_rr_start(struct lagg_softc *sc, struct mbuf *m) return (lagg_enqueue(lp->lp_ifp, m)); } -static struct mbuf * -lagg_rr_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) -{ - struct ifnet *ifp = sc->sc_ifp; - - /* Just pass in the packet to our lagg device */ - m->m_pkthdr.rcvif = ifp; - - return (m); -} - /* * Broadcast mode */ @@ -2485,16 +2472,6 @@ lagg_bcast_start(struct lagg_softc *sc, struct mbuf *m) return (ret); } -static struct mbuf* -lagg_bcast_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) -{ - struct ifnet *ifp = sc->sc_ifp; - - /* Just pass in the packet to our lagg device */ - m->m_pkthdr.rcvif = ifp; - return (m); -} - /* * Active failover */ @@ -2638,17 +2615,6 @@ lagg_lb_start(struct lagg_softc *sc, struct mbuf *m) return (lagg_enqueue(lp->lp_ifp, m)); } -static struct mbuf * -lagg_lb_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) -{ - struct ifnet *ifp = sc->sc_ifp; - - /* Just pass in the packet to our lagg device */ - m->m_pkthdr.rcvif = ifp; - - return (m); -} - /* * 802.3ad LACP */ @@ -2740,3 +2706,15 @@ lagg_lacp_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) m->m_pkthdr.rcvif = ifp; return (m); } + +/* Default input */ +static struct mbuf * +lagg_default_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) +{ + struct ifnet *ifp = sc->sc_ifp; + + /* Just pass in the packet to our lagg device */ + m->m_pkthdr.rcvif = ifp; + + return (m); +}