From nobody Fri Mar 24 09:57:10 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 4Pjd0k6Xzwz41M9C; Fri, 24 Mar 2023 09:57:10 +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 4Pjd0k5szTz3mdJ; Fri, 24 Mar 2023 09:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679651830; 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=0Ii7bewP1f1Jmpde7XcvNLGzHd2sPOA2stHMWfW7DeI=; b=KDJuaLtoAtesBtNv3nGdJkuv54/h6De7J5gRyAIvFwNWgsq0n+F05kePPvcy2zeUSndBwP QQO82jw29iz3nPJ4OQ3e/liluDFPRX2VCATeznTVpTBkPPdMkneiRFDedBpnsjZmf15udB tD2fWkodtqNrjfLLEmpkAmk4/tvKZp3LCT4iRCO0axGt83KVShKTyElwSnW9GPYKvO4mWV aihcMr4td7zji89RJlEE9Cp+K3+twgDIyREqw4mYpM/hqqOWDOT75ifWgHgK7sYMvqtlf1 keRZaIxf2cYQwgqa2m8xRR9q3nAMRJdxM4nnCCpaQmMoVSiGyd0prTvMnHs8NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679651830; 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=0Ii7bewP1f1Jmpde7XcvNLGzHd2sPOA2stHMWfW7DeI=; b=M3ZYMAlWTk4YlVAB4bSnow32UfzLggmSNhTSLMKQ+2+NrnBi+4ZA9RsKef4mKcFW2Q/xVx 0lKW+PWTUF9Bn2/JqCEacYxuWZcMzSMOMF5LCSOqe/3dee/ANV/xIl+re6UrhuvQV9HGbd v7C+TuflLPYexs4QILu9WZxVD7nw+ifIgSA/N7k/5O7qH3SuXy7A/wtUFXNlTO46Vu2lrH 2vbr2kLd+cryD9akoGxo9VbfZsZ/imROJEVEtMAbB+VGiH85KOWLK5/9XslBG5UJdkUumJ /iOUUkZ0G3ZlqKlx/cShmyuXWarCm6URyaMjwFQjAvx6dN2U06/XWaIoRPoxTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679651830; a=rsa-sha256; cv=none; b=MTYousIHw8feysowCK7Hp+dsgf4MNADBNSjUTd6VpyEkZDomnCH+VYUFPaLOApsOm0Q8pV fiKkIqK01LT2+/F0a7HfTICPt50FIq2ujZ0qFaDcvX/Is8kKBkEcrm2pgpF3G4IZYSfqGP 6cDCiaJMI5FIJxBBTTG0BY5u8hq8EA1GQILL2TVRAtPPt6vuXtUoBFkhmkgV0gSdaanQ4f RmI6Jx4gdR+dCidlBMfiwIBkuHKtZyN4K/R78IKWLfoG36hG6vOfbX9F1WXKNIkhfXtW0p rBrrFgv9htENvIn9DeEJbycxFRaP+sga+FcyZv9qn//LFzjJsEG/Ro2CwZVong== 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 4Pjd0k4tRHz1Ccv; Fri, 24 Mar 2023 09:57:10 +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 32O9vARS001538; Fri, 24 Mar 2023 09:57:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32O9vAx5001537; Fri, 24 Mar 2023 09:57:10 GMT (envelope-from git) Date: Fri, 24 Mar 2023 09:57:10 GMT Message-Id: <202303240957.32O9vAx5001537@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: dcd7f0bd02f4 - main - lagg: Various style fixes 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: dcd7f0bd02f407952de42d96e1c2c01ee3460702 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd7f0bd02f407952de42d96e1c2c01ee3460702 commit dcd7f0bd02f407952de42d96e1c2c01ee3460702 Author: Zhenlei Huang AuthorDate: 2023-03-24 09:55:15 +0000 Commit: Zhenlei Huang CommitDate: 2023-03-24 09:55:15 +0000 lagg: Various style fixes MFC after: 1 week --- sys/net/if_lagg.c | 45 ++++++++++++++++++++++----------------------- sys/net/if_lagg.h | 2 +- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index a50cd995c6eb..27ebed8e135a 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -150,15 +150,15 @@ static int lagg_snd_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); static void lagg_snd_tag_free(struct m_snd_tag *); static struct m_snd_tag *lagg_next_snd_tag(struct m_snd_tag *); -static void lagg_ratelimit_query(struct ifnet *, +static void lagg_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); #endif static int lagg_setmulti(struct lagg_port *); static int lagg_clrmulti(struct lagg_port *); -static void lagg_setcaps(struct lagg_port *, int cap, int cap2); -static int lagg_setflag(struct lagg_port *, int, int, +static void lagg_setcaps(struct lagg_port *, int cap, int cap2); +static int lagg_setflag(struct lagg_port *, int, int, int (*func)(struct ifnet *, int)); -static int lagg_setflags(struct lagg_port *, int status); +static int lagg_setflags(struct lagg_port *, int status); static uint64_t lagg_get_counter(struct ifnet *ifp, ift_counter cnt); static int lagg_transmit_ethernet(struct ifnet *, struct mbuf *); static int lagg_transmit_infiniband(struct ifnet *, struct mbuf *); @@ -166,7 +166,7 @@ static void lagg_qflush(struct ifnet *); static int lagg_media_change(struct ifnet *); static void lagg_media_status(struct ifnet *, struct ifmediareq *); static struct lagg_port *lagg_link_active(struct lagg_softc *, - struct lagg_port *); + struct lagg_port *); /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); @@ -190,7 +190,7 @@ static struct mbuf *lagg_lb_input(struct lagg_softc *, struct lagg_port *, static int lagg_lb_porttable(struct lagg_softc *, struct lagg_port *); /* Broadcast */ -static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); +static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_bcast_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); @@ -477,7 +477,7 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - if (ifp->if_softc != arg) /* Not our event */ + if (ifp->if_softc != arg) /* Not our event */ return; LAGG_XLOCK(sc); @@ -496,7 +496,7 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - if (ifp->if_softc != arg) /* Not our event */ + if (ifp->if_softc != arg) /* Not our event */ return; LAGG_XLOCK(sc); @@ -535,7 +535,7 @@ lagg_clone_create(struct if_clone *ifc, char *name, size_t len, if_type = IFT_ETHER; } - sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK|M_ZERO); + sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK | M_ZERO); ifp = sc->sc_ifp = if_alloc(if_type); if (ifp == NULL) { free(sc, M_LAGG); @@ -554,7 +554,7 @@ lagg_clone_create(struct if_clone *ifc, char *name, size_t len, sc->flowid_shift = V_def_flowid_shift; /* Hash all layers by default */ - sc->sc_flags = MBUF_HASHFLAG_L2|MBUF_HASHFLAG_L3|MBUF_HASHFLAG_L4; + sc->sc_flags = MBUF_HASHFLAG_L2 | MBUF_HASHFLAG_L3 | MBUF_HASHFLAG_L4; lagg_proto_attach(sc, LAGG_PROTO_DEFAULT); @@ -803,7 +803,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) ifr.ifr_mtu = oldmtu; } - lp = malloc(sizeof(struct lagg_port), M_LAGG, M_WAITOK|M_ZERO); + lp = malloc(sizeof(struct lagg_port), M_LAGG, M_WAITOK | M_ZERO); lp->lp_softc = sc; /* Check if port is a stacked lagg */ @@ -873,7 +873,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) CK_SLIST_FOREACH(tlp, &sc->sc_ports, lp_entries) { if (tlp->lp_ifp->if_index < ifp->if_index && ( CK_SLIST_NEXT(tlp, lp_entries) == NULL || - ((struct lagg_port*)CK_SLIST_NEXT(tlp, lp_entries))->lp_ifp->if_index > + ((struct lagg_port*)CK_SLIST_NEXT(tlp, lp_entries))->lp_ifp->if_index > ifp->if_index)) break; } @@ -1088,15 +1088,15 @@ fallback: } /* - * Requests counter @cnt data. + * Requests counter @cnt data. * * Counter value is calculated the following way: - * 1) for each port, sum difference between current and "initial" measurements. + * 1) for each port, sum difference between current and "initial" measurements. * 2) add lagg logical interface counters. * 3) add data from detached_counters array. * * We also do the following things on ports attach/detach: - * 1) On port attach we store all counters it has into port_counter array. + * 1) On port attach we store all counters it has into port_counter array. * 2) On port detach we add the different between "initial" and * current counters data to detached_counters array. */ @@ -1475,7 +1475,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* Invalid combination of options specified. */ error = EINVAL; LAGG_XUNLOCK(sc); - break; /* Return from SIOCSLAGGOPTS. */ + break; /* Return from SIOCSLAGGOPTS. */ } /* @@ -1524,15 +1524,15 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); - LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) - lp->lp_state |= LACP_STATE_TIMEOUT; + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state |= LACP_STATE_TIMEOUT; LACP_UNLOCK(lsc); lsc->lsc_fast_timeout = 1; break; case -LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); - LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) - lp->lp_state &= ~LACP_STATE_TIMEOUT; + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state &= ~LACP_STATE_TIMEOUT; LACP_UNLOCK(lsc); lsc->lsc_fast_timeout = 0; break; @@ -1999,8 +1999,7 @@ lagg_setmulti(struct lagg_port *lp) IF_ADDR_WUNLOCK(scifp); return (ENOMEM); } - bcopy(ifma->ifma_addr, &mc->mc_addr, - ifma->ifma_addr->sa_len); + bcopy(ifma->ifma_addr, &mc->mc_addr, ifma->ifma_addr->sa_len); mc->mc_addr.sdl_index = ifp->if_index; mc->mc_ifma = NULL; SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries); @@ -2532,7 +2531,7 @@ lagg_fail_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) * If tmp_tp is null, we've received a packet when all * our links are down. Weird, but process it anyways. */ - if ((tmp_tp == NULL || tmp_tp == lp)) { + if (tmp_tp == NULL || tmp_tp == lp) { m->m_pkthdr.rcvif = ifp; return (m); } diff --git a/sys/net/if_lagg.h b/sys/net/if_lagg.h index 9fc6e3862712..721c5083bbd6 100644 --- a/sys/net/if_lagg.h +++ b/sys/net/if_lagg.h @@ -223,7 +223,7 @@ struct lagg_lb { struct lagg_mc { struct sockaddr_dl mc_addr; - struct ifmultiaddr *mc_ifma; + struct ifmultiaddr *mc_ifma; SLIST_ENTRY(lagg_mc) mc_entries; };