Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/lagg fix coding style
details: https://anonhg.NetBSD.org/src/rev/4b81ff8cb291
branches: trunk
changeset: 364597:4b81ff8cb291
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Thu Mar 31 02:00:27 2022 +0000
description:
fix coding style
diffstat:
sys/net/lagg/if_lagg.c | 62 ++++++++++++++++----------------------------
sys/net/lagg/if_lagg_lacp.c | 27 ++++++-------------
sys/net/lagg/if_laggproto.h | 8 ++--
sys/net/lagg/if_laggvar.h | 4 +-
4 files changed, 38 insertions(+), 63 deletions(-)
diffs (truncated from 346 to 300 lines):
diff -r 931acfb00cdb -r 4b81ff8cb291 sys/net/lagg/if_lagg.c
--- a/sys/net/lagg/if_lagg.c Thu Mar 31 01:59:05 2022 +0000
+++ b/sys/net/lagg/if_lagg.c Thu Mar 31 02:00:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg.c,v 1.37 2022/03/31 01:57:13 yamaguchi Exp $ */
+/* $NetBSD: if_lagg.c,v 1.38 2022/03/31 02:00:27 yamaguchi Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk%openbsd.org@localhost>
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.37 2022/03/31 01:57:13 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.38 2022/03/31 02:00:27 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -283,9 +283,8 @@
#ifdef INET6
KERNEL_LOCK_UNLESS_NET_MPSAFE();
- if (in6_present) {
+ if (in6_present)
in6_ifdetach(ifp);
- }
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
#endif
}
@@ -761,9 +760,8 @@
/* set every port back to the original MTU */
ifr->ifr_mtu = ifp->if_mtu;
LAGG_PORTS_FOREACH(sc, lp) {
- if (lp->lp_ioctl != NULL) {
+ if (lp->lp_ioctl != NULL)
lagg_lp_ioctl(lp, cmd, (void *)ifr);
- }
}
}
LAGG_UNLOCK(sc);
@@ -907,17 +905,16 @@
} while(0)
eh = lagg_m_extract(m, 0, sizeof(*eh), &buf);
- if (eh == NULL) {
+ if (eh == NULL)
goto out;
- }
+
off = ETHER_HDR_LEN;
etype = ntohs(eh->ether_type);
if (etype == ETHERTYPE_VLAN) {
evl = lagg_m_extract(m, 0, sizeof(*evl), &buf);
- if (evl == NULL) {
+ if (evl == NULL)
goto out;
- }
vlantag = ntohs(evl->evl_tag);
etype = ntohs(evl->evl_proto);
@@ -937,9 +934,8 @@
switch (etype) {
case ETHERTYPE_IP:
ip = lagg_m_extract(m, off, sizeof(*ip), &buf);
- if (ip == NULL) {
+ if (ip == NULL)
goto out;
- }
if (sc->sc_hash_ipaddr) {
LAGG_HASH_ADD(&hash_src, ip->ip_src);
@@ -951,9 +947,8 @@
break;
case ETHERTYPE_IPV6:
ip6 = lagg_m_extract(m, off, sizeof(*ip6), &buf);
- if (ip6 == NULL) {
+ if (ip6 == NULL)
goto out;
- }
if (sc->sc_hash_ip6addr) {
LAGG_HASH_ADD(&hash_src, ip6->ip6_src);
@@ -972,9 +967,8 @@
switch (proto) {
case IPPROTO_TCP:
th = lagg_m_extract(m, off, sizeof(*th), &buf);
- if (th == NULL) {
+ if (th == NULL)
goto out;
- }
if (sc->sc_hash_tcp) {
LAGG_HASH_ADD(&hash_src, th->th_sport);
@@ -983,9 +977,8 @@
break;
case IPPROTO_UDP:
uh = lagg_m_extract(m, off, sizeof(*uh), &buf);
- if (uh == NULL) {
+ if (uh == NULL)
goto out;
- }
if (sc->sc_hash_udp) {
LAGG_HASH_ADD(&hash_src, uh->uh_sport);
@@ -1149,9 +1142,8 @@
}
if (pfil_run_hooks(ifp_port->if_pfil, &m,
- ifp_port, PFIL_IN) != 0) {
+ ifp_port, PFIL_IN) != 0)
goto out;
- }
m = lagg_proto_input(lp->lp_softc, lp, m);
if (m != NULL) {
@@ -2036,9 +2028,8 @@
ifr.ifr_mtu = sc->sc_if.if_mtu;
}
- if (sc->sc_if.if_mtu != (uint64_t)ifr.ifr_mtu) {
+ if (sc->sc_if.if_mtu != (uint64_t)ifr.ifr_mtu)
sc->sc_if.if_mtu = ifr.ifr_mtu;
- }
if (lp->lp_mtu != (uint64_t)ifr.ifr_mtu) {
if (lp->lp_ioctl == NULL) {
@@ -2072,9 +2063,8 @@
ifp_port = lp->lp_ifp;
KASSERT(IFNET_LOCKED(ifp_port));
- if (SIMPLEQ_EMPTY(&sc->sc_ports)) {
+ if (SIMPLEQ_EMPTY(&sc->sc_ports))
sc->sc_if.if_mtu = 0;
- }
if (ifp_port->if_mtu != lp->lp_mtu) {
memset(&ifr, 0, sizeof(ifr));
@@ -2198,9 +2188,8 @@
KASSERT(LAGG_LOCKED(sc));
- if (lagg_lladdr_equal(sc->sc_lladdr, sc->sc_lladdr_rand)) {
+ if (lagg_lladdr_equal(sc->sc_lladdr, sc->sc_lladdr_rand))
lagg_lladdr_cpy(sc->sc_lladdr, lp->lp_lladdr);
- }
}
static void
@@ -2305,9 +2294,8 @@
return EINVAL;
}
- if (sc->sc_nports > LAGG_MAX_PORTS) {
+ if (sc->sc_nports > LAGG_MAX_PORTS)
return ENOSPC;
- }
if (ifp_port->if_lagg != NULL) {
lp = (struct lagg_port *)ifp_port->if_lagg;
@@ -2364,13 +2352,12 @@
lagg_in6_ifdetach(ifp_port);
error = lagg_setup_mtu(sc, lp);
- if (error != 0) {
+ if (error != 0)
goto restore_ipv6lla;
- }
-
- if (lp->lp_iftype == IFT_ETHER) {
+
+ if (lp->lp_iftype == IFT_ETHER)
lagg_setup_lladdr(sc, lp);
- }
+
lagg_port_setsadl(lp, sc->sc_lladdr, iftype_changed);
IFNET_UNLOCK(ifp_port);
@@ -2419,9 +2406,8 @@
IFNET_LOCK(ifp_port);
lagg_teardown_mtu(sc, lp);
lagg_port_unsetsadl(lp);
- if (lp->lp_iftype == IFT_ETHER) {
+ if (lp->lp_iftype == IFT_ETHER)
lagg_teardown_lladdr(sc, lp);
- }
restore_ipv6lla:
KASSERT(IFNET_LOCKED(ifp_port));
lagg_in6_ifdetach(ifp_port);
@@ -2498,9 +2484,8 @@
ifp_port->if_ioctl = lp->lp_ioctl;
lagg_teardown_mtu(sc, lp);
- if (stopped) {
+ if (stopped)
if_init(ifp_port);
- }
IFNET_UNLOCK(ifp_port);
if (is_ifdetach == false) {
@@ -2719,9 +2704,8 @@
error = LAGG_PORT_IOCTL(lp, cmd, data);
ifflags ^= ifp->if_flags;
- if ((ifflags & (IFF_UP | IFF_RUNNING)) != 0) {
+ if ((ifflags & (IFF_UP | IFF_RUNNING)) != 0)
lagg_proto_linkstate(sc, lp);
- }
break;
default:
goto fallback;
diff -r 931acfb00cdb -r 4b81ff8cb291 sys/net/lagg/if_lagg_lacp.c
--- a/sys/net/lagg/if_lagg_lacp.c Thu Mar 31 01:59:05 2022 +0000
+++ b/sys/net/lagg/if_lagg_lacp.c Thu Mar 31 02:00:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg_lacp.c,v 1.16 2022/03/31 01:59:05 yamaguchi Exp $ */
+/* $NetBSD: if_lagg_lacp.c,v 1.17 2022/03/31 02:00:27 yamaguchi Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.16 2022/03/31 01:59:05 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.17 2022/03/31 02:00:27 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_lagg.h"
@@ -2105,9 +2105,8 @@
sc = lacpp->lp_laggport->lp_softc;
ifp = &sc->sc_if;
- if (lacpp->lp_mux_state == new_state) {
+ if (lacpp->lp_mux_state == new_state)
return -1;
- }
switch (new_state) {
case LACP_MUX_DETACHED:
@@ -2304,7 +2303,6 @@
struct lacp_aggregator_systemid *sid;
struct lacp_port *lacpp0;
char buf[LACP_SYSTEMIDSTR_LEN] __LACPDEBUGUSED;
- bool insert_after;
if (lacpp->lp_aggregator != NULL)
return;
@@ -2346,25 +2344,20 @@
lacpp->lp_aggregator = la;
lacpp->lp_selected = LACP_STANDBY;
- insert_after = false;
-
LIST_FOREACH(lacpp0, &la->la_ports, lp_entry_la) {
- if (lacp_port_priority_max(lacpp0, lacpp) == lacpp)
+ if (lacp_port_priority_max(lacpp0, lacpp) == lacpp) {
+ LIST_INSERT_BEFORE(lacpp0, lacpp, lp_entry_la);
break;
+ }
if (LIST_NEXT(lacpp0, lp_entry_la) == NULL) {
- insert_after = true;
+ LIST_INSERT_AFTER(lacpp0, lacpp, lp_entry_la);
break;
}
}
- if (lacpp0 == NULL) {
+ if (lacpp0 == NULL)
LIST_INSERT_HEAD(&la->la_ports, lacpp, lp_entry_la);
- } else if (insert_after) {
- LIST_INSERT_AFTER(lacpp0, lacpp, lp_entry_la);
- } else {
- LIST_INSERT_BEFORE(lacpp0, lacpp, lp_entry_la);
- }
lacp_selected_update(lsc, la);
}
@@ -2405,9 +2398,8 @@
TAILQ_REMOVE(&lsc->lsc_aggregators, la, la_q);
kmem_free(la, sizeof(*la));
- if (remove_actaggr) {
+ if (remove_actaggr)
lacp_select_active_aggregator(lsc);
- }
} else {
lacp_selected_update(lsc, la);
}
@@ -2590,7 +2582,6 @@
ntohs(mi_res->mi_rq_port),
ether_sprintf(mi_res->mi_rq_system),
ntohl(mi_res->mi_rq_xid));
-
}
}
diff -r 931acfb00cdb -r 4b81ff8cb291 sys/net/lagg/if_laggproto.h
--- a/sys/net/lagg/if_laggproto.h Thu Mar 31 01:59:05 2022 +0000
Home |
Main Index |
Thread Index |
Old Index