From owner-freebsd-stable@FreeBSD.ORG Sun Jun 9 11:45:15 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F49BB87 for ; Sun, 9 Jun 2013 11:45:15 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) by mx1.freebsd.org (Postfix) with ESMTP id DEA091358 for ; Sun, 9 Jun 2013 11:45:14 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id bi5so3677660pad.4 for ; Sun, 09 Jun 2013 04:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4OQYkLtZMdXITkS4JkI0Tusks1lIKR69D6zHpN8R7tY=; b=oFHYxhL0roWitTgCz+c9ZTO53clZXIcmLUYxBr0cDiqiFK09r0SaJ4tIe01WkxR73N LyC3RKvPJNfNmSNmdqnO+1R505C2TdEv47xabKyLs+PwHjJh3N35I51XIj05bEhcXD2g iTOqLesr8AwXlXB4rly3+UJnKjsVTPSSHUhisGn5pGshUtGDAG9bqR8uTtoMx2XhSAjE Ae/tTk+nF+Oor3c7Hr/50QZNbkod2jZMVzMliWXyaX4iWClNooSWH7cISud3SHdZjvqJ IQwrG8lQhdXlKv4hDRczM54b5kHT8AW8RH6/P0CknGveWdGwSbgYzghfuTzRSapy3qzO bBEg== X-Received: by 10.66.154.225 with SMTP id vr1mr10171341pab.85.1370778314662; Sun, 09 Jun 2013 04:45:14 -0700 (PDT) Received: from pyunyh@gmail.com (lpe4.p59-icn.cdngp.net. [114.111.62.249]) by mx.google.com with ESMTPSA id qp4sm6336753pbc.41.2013.06.09.04.45.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 09 Jun 2013 04:45:13 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Sun, 09 Jun 2013 20:45:03 +0900 From: YongHyeon PYUN Date: Sun, 9 Jun 2013 20:45:03 +0900 To: Alban Hertroys Subject: Re: fxp0 interface going up/down/up/down (dhclient related?) Message-ID: <20130609114503.GB1922@michelle.cdnetworks.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: "freebsd-stable@freebsd.org" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 11:45:15 -0000 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jun 09, 2013 at 12:21:37PM +0200, Alban Hertroys wrote: > I'm having an issue where my fxp0 interface keeps looping between DOWN/UP, with dhclient requesting a lease each time in between. I think it's caused by dhclient: > > solfertje # dhclient -d fxp0 > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > send_packet: Network is down > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > DHCPACK from 109.72.40.1 > bound to 141.105.10.89 -- renewal in 7200 seconds. > fxp0 link state up -> down > fxp0 link state down -> up > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > DHCPACK from 109.72.40.1 > bound to 141.105.10.89 -- renewal in 7200 seconds. > fxp0 link state up -> down > fxp0 link state down -> up > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > DHCPACK from 109.72.40.1 > bound to 141.105.10.89 -- renewal in 7200 seconds. > fxp0 link state up -> down > fxp0 link state down -> up > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > DHCPACK from 109.72.40.1 > bound to 141.105.10.89 -- renewal in 7200 seconds. > fxp0 link state up -> down > fxp0 link state down -> up > DHCPREQUEST on fxp0 to 255.255.255.255 port 67 > DHCPACK from 109.72.40.1 > bound to 141.105.10.89 -- renewal in 7200 seconds. > fxp0 link state up -> down > ^C > > In above test I turned off devd (/etc/rc.d/devd stop) and background dhclient (/etc/rc.d/dhclient stop fxp0), and I still go the above result. There's practically no time spent between up/down cycles, this just keeps going on and on. > fxp0 is the only interface that runs on DHCP. The others have static IP's. > Try attached patch and let me know whether it also works for you. --T4sUOijqQbZv57TR 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; --T4sUOijqQbZv57TR--