Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/agr Add locking.
details: https://anonhg.NetBSD.org/src/rev/a4858ca067e3
branches: trunk
changeset: 358996:a4858ca067e3
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 25 03:54:57 2018 +0000
description:
Add locking.
diffstat:
sys/net/agr/if_agr.c | 6 ++++--
sys/net/agr/if_agrsubr.c | 14 +++++++++-----
2 files changed, 13 insertions(+), 7 deletions(-)
diffs (77 lines):
diff -r 8f153d324466 -r a4858ca067e3 sys/net/agr/if_agr.c
--- a/sys/net/agr/if_agr.c Thu Jan 25 03:54:21 2018 +0000
+++ b/sys/net/agr/if_agr.c Thu Jan 25 03:54:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_agr.c,v 1.45 2018/01/16 07:34:12 knakahara Exp $ */
+/* $NetBSD: if_agr.c,v 1.46 2018/01/25 03:54:57 christos Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.45 2018/01/16 07:34:12 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.46 2018/01/25 03:54:57 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -611,7 +611,9 @@
* of each port to that of the first port. No need for arps
* since there are no inet addresses assigned to the ports.
*/
+ IFNET_LOCK(ifp_port);
error = if_addr_init(ifp_port, ifp->if_dl, true);
+ IFNET_UNLOCK(ifp_port);
if (error) {
printf("%s: if_addr_init error %d\n", __func__, error);
diff -r 8f153d324466 -r a4858ca067e3 sys/net/agr/if_agrsubr.c
--- a/sys/net/agr/if_agrsubr.c Thu Jan 25 03:54:21 2018 +0000
+++ b/sys/net/agr/if_agrsubr.c Thu Jan 25 03:54:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_agrsubr.c,v 1.11 2017/12/06 04:37:00 ozaki-r Exp $ */
+/* $NetBSD: if_agrsubr.c,v 1.12 2018/01/25 03:54:57 christos Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_agrsubr.c,v 1.11 2017/12/06 04:37:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agrsubr.c,v 1.12 2018/01/25 03:54:57 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -294,7 +294,9 @@
*/
ec_port->ec_capenable |= ETHERCAP_VLAN_MTU;
if (p->if_flags & IFF_UP) {
+ IFNET_LOCK(p);
error = if_flags_set(p, p->if_flags);
+ IFNET_UNLOCK(p);
if (error) {
if (ec_port->ec_nvlans-- == 1)
ec_port->ec_capenable &=
@@ -321,15 +323,17 @@
/* Disable vlan support */
if ((*force_zero && ec_port->ec_nvlans > 0) ||
ec_port->ec_nvlans-- == 1) {
+ struct ifnet *p = port->port_ifp;
if (*force_zero)
ec_port->ec_nvlans = 0;
/*
* Disable Tx/Rx of VLAN-sized frames.
*/
ec_port->ec_capenable &= ~ETHERCAP_VLAN_MTU;
- if (port->port_ifp->if_flags & IFF_UP) {
- (void)if_flags_set(port->port_ifp,
- port->port_ifp->if_flags);
+ if (p->if_flags & IFF_UP) {
+ IFNET_LOCK(p);
+ (void)if_flags_set(p, p->if_flags);
+ IFNET_UNLOCK(p);
}
}
Home |
Main Index |
Thread Index |
Old Index