From owner-freebsd-arch@FreeBSD.ORG Tue Jun 13 04:53:05 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EB2816A41A for ; Tue, 13 Jun 2006 04:53:05 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id F350843D46 for ; Tue, 13 Jun 2006 04:53:04 +0000 (GMT) (envelope-from sam@errno.com) Received: from [10.0.0.248] (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id k5D4qb0x006268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Jun 2006 21:52:38 -0700 (PDT) (envelope-from sam@errno.com) Message-ID: <448E4495.4030200@errno.com> Date: Mon, 12 Jun 2006 21:52:37 -0700 From: Sam Leffler User-Agent: Thunderbird 1.5.0.2 (X11/20060508) MIME-Version: 1.0 To: Xin LI References: <1150166974.936.6.camel@spirit> In-Reply-To: <1150166974.936.6.camel@spirit> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org Subject: Re: Why do we do if_init for AF_INET even if the interface is running? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jun 2006 04:53:05 -0000 Xin LI wrote: > Hi, > > Is there any reason why we do if_init() for AF_INET regardless whether > the interface is already in IF_DRV_RUNNING? This seems to cause the > interface to reinitialize its link level state, which causes the network > to stop for a short while. > > The proposed patch is inspired from NetBSD net/if_ethersubr.c,v 1.86 > which says: > > "When setting an address on an interface, for address families which > do not require changing the link-level address, only (*if_init)() > if the interface is not already RUNNING." > > I think we may want this as well. > > Comments? > > Cheers, > > > ------------------------------------------------------------------------ > > Index: if_ethersubr.c > =================================================================== > RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v > retrieving revision 1.215 > diff -u -r1.215 if_ethersubr.c > --- if_ethersubr.c 3 Mar 2006 17:21:08 -0000 1.215 > +++ if_ethersubr.c 13 Jun 2006 01:55:31 -0000 > @@ -997,7 +997,8 @@ > switch (ifa->ifa_addr->sa_family) { > #ifdef INET > case AF_INET: > - ifp->if_init(ifp->if_softc); /* before arpwhohas */ > + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > + ifp->if_init(ifp->if_softc); /* before arpwhohas */ > arp_ifinit(ifp, ifa); > break; > #endif > @@ -1027,7 +1028,8 @@ > } > #endif > default: > - ifp->if_init(ifp->if_softc); > + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > + ifp->if_init(ifp->if_softc); > break; > } > break; Try it; you'll find various drivers blow up in their multicast code because they assume the init method is called. I tried to get this same change committed last year because it causes wireless drivers to blow chunks. I finally gave up and stuck a similar change in ieee80211_ioctl. Sam