Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by msait...
details: https://anonhg.NetBSD.org/src/rev/5e704cb3d05c
branches: netbsd-8
changeset: 434724:5e704cb3d05c
user: martin <martin%NetBSD.org@localhost>
date: Thu Mar 08 14:37:58 2018 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #618):
sys/net/if_ethersubr.c: revision 1.245
sys/net/if_ethersubr.c: revision 1.247
Use macro(ETHER_LOCK() and ETHER_UNLOCK()). No functional change.
- Modify ether_ioctl() for readability. No functional change.
- KNF
diffstat:
sys/net/if_ethersubr.c | 63 ++++++++++++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 30 deletions(-)
diffs (180 lines):
diff -r 56600819cf7f -r 5e704cb3d05c sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Thu Mar 08 14:35:53 2018 +0000
+++ b/sys/net/if_ethersubr.c Thu Mar 08 14:37:58 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ethersubr.c,v 1.242.6.3 2018/01/09 19:23:04 snj Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.242.6.4 2018/03/08 14:37:58 martin Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.3 2018/01/09 19:23:04 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.4 2018/03/08 14:37:58 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -226,13 +226,13 @@
ifp = ifp->if_carpdev;
/* ac = (struct arpcom *)ifp; */
- if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
- (IFF_UP|IFF_RUNNING))
+ if ((ifp0->if_flags & (IFF_UP | IFF_RUNNING)) !=
+ (IFF_UP | IFF_RUNNING))
senderr(ENETDOWN);
}
#endif /* NCARP > 0 */
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
senderr(ENETDOWN);
switch (dst->sa_family) {
@@ -640,7 +640,7 @@
return;
}
#endif /* NCARP > 0 */
- if ((m->m_flags & (M_BCAST|M_MCAST|M_PROMISC)) == 0 &&
+ if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
(ifp->if_flags & IFF_PROMISC) != 0 &&
memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
ETHER_ADDR_LEN) != 0) {
@@ -1005,13 +1005,13 @@
vlan_ifdetach(ifp);
#endif
- mutex_enter(ec->ec_lock);
+ ETHER_LOCK(ec);
while ((enm = LIST_FIRST(&ec->ec_multiaddrs)) != NULL) {
LIST_REMOVE(enm, enm_list);
kmem_intr_free(enm, sizeof(*enm));
ec->ec_multicnt--;
}
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
mutex_destroy(ec->ec_lock);
@@ -1231,7 +1231,7 @@
if (enm == NULL)
return ENOBUFS;
- mutex_enter(ec->ec_lock);
+ ETHER_LOCK(ec);
error = ether_multiaddr(sa, addrlo, addrhi);
if (error != 0)
goto out;
@@ -1270,7 +1270,7 @@
error = ENETRESET;
enm = NULL;
out:
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
if (enm != NULL)
kmem_intr_free(enm, sizeof(*enm));
return error;
@@ -1287,7 +1287,7 @@
u_char addrhi[ETHER_ADDR_LEN];
int error;
- mutex_enter(ec->ec_lock);
+ ETHER_LOCK(ec);
error = ether_multiaddr(sa, addrlo, addrhi);
if (error != 0)
goto error;
@@ -1312,7 +1312,7 @@
*/
LIST_REMOVE(enm, enm_list);
ec->ec_multicnt--;
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
kmem_intr_free(enm, sizeof(*enm));
/*
@@ -1321,7 +1321,7 @@
*/
return ENETRESET;
error:
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
return error;
}
@@ -1351,8 +1351,8 @@
{
struct ifaddr *ifa = (struct ifaddr *)data;
if (ifa->ifa_addr->sa_family != AF_LINK
- && (ifp->if_flags & (IFF_UP|IFF_RUNNING)) !=
- (IFF_UP|IFF_RUNNING)) {
+ && (ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+ (IFF_UP | IFF_RUNNING)) {
ifp->if_flags |= IFF_UP;
if ((error = (*ifp->if_init)(ifp)) != 0)
return error;
@@ -1387,7 +1387,7 @@
case SIOCSIFFLAGS:
if ((error = ifioctl_common(ifp, cmd, data)) != 0)
return error;
- switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
+ switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
case IFF_RUNNING:
/*
* If interface is marked down and it is running,
@@ -1401,18 +1401,21 @@
* start it.
*/
return (*ifp->if_init)(ifp);
- case IFF_UP|IFF_RUNNING:
+ case IFF_UP | IFF_RUNNING:
error = 0;
- if (ec->ec_ifflags_cb == NULL ||
- (error = (*ec->ec_ifflags_cb)(ec)) == ENETRESET) {
- /*
- * Reset the interface to pick up
- * changes in any other flags that
- * affect the hardware state.
- */
- return (*ifp->if_init)(ifp);
- } else
- return error;
+ if (ec->ec_ifflags_cb != NULL) {
+ error = (*ec->ec_ifflags_cb)(ec);
+ if (error == ENETRESET) {
+ /*
+ * Reset the interface to pick up
+ * changes in any other flags that
+ * affect the hardware state.
+ */
+ return (*ifp->if_init)(ifp);
+ }
+ } else
+ error = (*ifp->if_init)(ifp);
+ return error;
case 0:
break;
}
@@ -1556,10 +1559,10 @@
multicnt = ec->ec_multicnt;
addrs = kmem_alloc(sizeof(*addrs) * multicnt, KM_SLEEP);
- mutex_enter(ec->ec_lock);
+ ETHER_LOCK(ec);
if (multicnt < ec->ec_multicnt) {
/* The number of multicast addresses have increased */
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
kmem_free(addrs, sizeof(*addrs) * multicnt);
goto retry;
}
@@ -1572,7 +1575,7 @@
memcpy(addr->enm_addrhi, enm->enm_addrhi, ETHER_ADDR_LEN);
i++;
}
- mutex_exit(ec->ec_lock);
+ ETHER_UNLOCK(ec);
error = 0;
written = 0;
Home |
Main Index |
Thread Index |
Old Index