socsvn commit: r304249 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Tue May 31 10:28:38 UTC 2016


Author: vincenzo
Date: Tue May 31 10:28:36 2016
New Revision: 304249
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304249

Log:
   freebsd: ptnet: move DRV_RUNNING check into inner functions

Modified:
  soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c

Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Tue May 31 10:28:17 2016	(r304248)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Tue May 31 10:28:36 2016	(r304249)
@@ -509,14 +509,10 @@
 			PTNET_CORE_LOCK(sc);
 			if (ifp->if_flags & IFF_UP) {
 				/* Network stack wants the iff to be up. */
-				if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-					ptnet_init_locked(sc);
-				}
+				ptnet_init_locked(sc);
 			} else {
 				/* Network stack wants the iff to be down. */
-				if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-					ptnet_stop(sc);
-				}
+				ptnet_stop(sc);
 			}
 			PTNET_CORE_UNLOCK(sc);
 
@@ -530,14 +526,26 @@
 static void
 ptnet_init_locked(struct ptnet_softc *sc)
 {
+	struct ifnet *ifp = sc->ifp;
+
 	device_printf(sc->dev, "%s\n", __func__);
+
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+		return; /* nothing to do */
+	}
 }
 
 /* To be called under core lock. */
 static void
 ptnet_stop(struct ptnet_softc *sc)
 {
+	struct ifnet *ifp = sc->ifp;
+
 	device_printf(sc->dev, "%s\n", __func__);
+
+	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		return; /* nothing to do */
+	}
 }
 
 static void


More information about the svn-soc-all mailing list