Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 May 2013 11:33:00 +0900
From:      YongHyeon PYUN <pyunyh@gmail.com>
To:        "Michael L. Squires" <mikes@siralan.org>
Cc:        jdc@koitsu.org, gjb@freebsd.org, freebsd-stable@freebsd.org, re@freebsd.org
Subject:   Re: Apparent fxp regression in FreeBSD 8.4-RC3
Message-ID:  <20130528023300.GA3077@michelle.cdnetworks.com>
In-Reply-To: <alpine.BSF.2.00.1305271258170.1096@familysquires.net>
References:  <20130524044919.GA41292@icarus.home.lan> <20130524054720.GA1496@michelle.cdnetworks.com> <20130524.162926.395058052118975996.hrs@allbsd.org> <20130524.163646.628115045676432731.hrs@allbsd.org> <20130526113841.GA1511@michelle.cdnetworks.com> <20130527043923.GA1480@michelle.cdnetworks.com> <alpine.BSF.2.00.1305271258170.1096@familysquires.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, May 27, 2013 at 01:02:14PM -0400, Michael L. Squires wrote:
> 
> On Mon, 27 May 2013, YongHyeon PYUN wrote:
> 
> >On Sun, May 26, 2013 at 08:38:41PM +0900, YongHyeon PYUN wrote:
> >>On Fri, May 24, 2013 at 04:36:46PM +0900, Hiroki Sato wrote:
> >>>Hiroki Sato <hrs@FreeBSD.org> wrote
> >>>  in <20130524.162926.395058052118975996.hrs@allbsd.org>:
> >>>
> >>>hr> YongHyeon PYUN <pyunyh@gmail.com> wrote
> >>>hr>   in <20130524054720.GA1496@michelle.cdnetworks.com>:
> >>>hr>
> >>>hr>  A workaround is specifying the following line in rc.conf:
> >>>hr>
> >>>hr>  ifconfig_fxp0="DHCP media 100baseTX mediaopt full-duplex"
> >>>
> 
> Sorry I've been offline, two trips last week.
> 
> I've installed 8.4-RELEASE on the NAT box with the fxp interface:
> 
> FreeBSD familysquires.net 8.4-RELEASE FreeBSD 8.4-RELEASE #54: Sun May 26 
> 22:56:19 EDT 2013     root@familysquires.net:/usr/obj/usr/src/sys/NEWGATE  
> i386
> 
> and am using the workaround given above which has stopped the fxp interface
> cycling on/off.
> 
> I'll have access to the other box on Wednesday and will try the other test.

Here is patch I'm testing and it seems to work with dhclient on
CURRENT.
Mike, could you try attached patch?

> 
> Mike Squires
> mikes@siralan.org

--EeQfGwPcQSOJBaQU
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="fxp.init.diff"

Index: sys/dev/fxp/if_fxp.c
===================================================================
--- sys/dev/fxp/if_fxp.c	(revision 251021)
+++ sys/dev/fxp/if_fxp.c	(working copy)
@@ -1075,7 +1075,8 @@ fxp_suspend(device_t dev)
 			pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
 			sc->flags |= FXP_FLAG_WOL;
 			/* Reconfigure hardware to accept magic frames. */
-			fxp_init_body(sc, 1);
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			fxp_init_body(sc, 0);
 		}
 		pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
 	}
@@ -2141,8 +2142,10 @@ fxp_tick(void *xsc)
 	 */
 	if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {
 		sc->rx_idle_secs = 0;
-		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			fxp_init_body(sc, 1);
+		}
 		return;
 	}
 	/*
@@ -2240,6 +2243,7 @@ fxp_watchdog(struct fxp_softc *sc)
 	device_printf(sc->dev, "device timeout\n");
 	sc->ifp->if_oerrors++;
 
+	sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	fxp_init_body(sc, 1);
 }
 
@@ -2274,6 +2278,10 @@ fxp_init_body(struct fxp_softc *sc, int setmedia)
 	int i, prm;
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
+
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
+
 	/*
 	 * Cancel any pending I/O
 	 */
@@ -2813,6 +2821,7 @@ fxp_miibus_statchg(device_t dev)
 	 */
 	if (sc->revision == FXP_REV_82557)
 		return;
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	fxp_init_body(sc, 0);
 }
 
@@ -2836,9 +2845,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr
 		if (ifp->if_flags & IFF_UP) {
 			if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) &&
 			    ((ifp->if_flags ^ sc->if_flags) &
-			    (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0)
+			    (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0) {
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				fxp_init_body(sc, 0);
-			else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+			} else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 				fxp_init_body(sc, 1);
 		} else {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
@@ -2851,8 +2861,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		FXP_LOCK(sc);
-		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			fxp_init_body(sc, 0);
+		}
 		FXP_UNLOCK(sc);
 		break;
 
@@ -2942,8 +2954,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr
 				    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);
 			reinit++;
 		}
-		if (reinit > 0 && ifp->if_flags & IFF_UP)
+		if (reinit > 0 && (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			fxp_init_body(sc, 0);
+		}
 		FXP_UNLOCK(sc);
 		VLAN_CAPABILITIES(ifp);
 		break;

--EeQfGwPcQSOJBaQU--



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