Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165364442
D55198.id171573.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55198.id171573.diff
View Options
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -139,6 +139,7 @@
static void lagg_port2req(struct lagg_port *, struct lagg_reqport *);
static void lagg_if_updown(struct lagg_softc *, bool);
static void lagg_init(void *);
+static void lagg_init_locked(struct lagg_softc *);
static void lagg_stop(struct lagg_softc *);
static int lagg_ioctl(struct ifnet *, u_long, caddr_t);
#if defined(KERN_TLS) || defined(RATELIMIT)
@@ -1282,16 +1283,21 @@
lagg_init(void *xsc)
{
struct lagg_softc *sc = (struct lagg_softc *)xsc;
+
+ LAGG_XLOCK(sc);
+ lagg_init_locked(sc);
+ LAGG_XUNLOCK(sc);
+}
+
+static void
+lagg_init_locked(struct lagg_softc *sc)
+{
struct ifnet *ifp = sc->sc_ifp;
struct lagg_port *lp;
- LAGG_XLOCK(sc);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- LAGG_XUNLOCK(sc);
+ LAGG_XLOCK_ASSERT(sc);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
return;
- }
-
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
/*
* Update the port lladdrs if needed.
@@ -1313,8 +1319,7 @@
lagg_watchdog_infiniband(sc);
mtx_unlock(&sc->sc_mtx);
}
-
- LAGG_XUNLOCK(sc);
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
}
static void
@@ -1677,24 +1682,21 @@
lagg_setflags(lp, 1);
}
- if (!(ifp->if_flags & IFF_UP) &&
- (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
/*
* If interface is marked down and it is running,
* then stop and disable it.
*/
lagg_stop(sc);
- LAGG_XUNLOCK(sc);
- } else if ((ifp->if_flags & IFF_UP) &&
- !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+ else if ((ifp->if_flags & IFF_UP) != 0 &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
/*
* If interface is marked up and it is stopped, then
* start it.
*/
- LAGG_XUNLOCK(sc);
- (*ifp->if_init)(sc);
- } else
- LAGG_XUNLOCK(sc);
+ lagg_init_locked(sc);
+ LAGG_XUNLOCK(sc);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 8, 8:37 PM (19 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36255707
Default Alt Text
D55198.id171573.diff (1 KB)
Attached To
Mode
D55198: lagg: Avoid dropping locks when starting the interface
Attached
Detach File
Event Timeline
Log In to Comment