Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2016 10:28:37 GMT
From:      vincenzo@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r304249 - soc2016/vincenzo/head/sys/dev/netmap
Message-ID:  <201605311028.u4VASb9p075614@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605311028.u4VASb9p075614>