Date: Sun, 9 Jun 2013 20:45:03 +0900 From: YongHyeon PYUN <pyunyh@gmail.com> To: Alban Hertroys <haramrae@gmail.com> Cc: "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org> Subject: Re: fxp0 interface going up/down/up/down (dhclient related?) Message-ID: <20130609114503.GB1922@michelle.cdnetworks.com> In-Reply-To: <EBA9A2E3-3323-4069-9E58-ED4C431FDE4E@gmail.com> References: <EBA9A2E3-3323-4069-9E58-ED4C431FDE4E@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130609114503.GB1922>