Date: Sat, 17 Sep 2005 13:15:52 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: Bill Paul <wpaul@FreeBSD.org> Cc: cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, jhb@FreeBSD.org, "M. Warner Losh" <imp@bsdimp.com> Subject: Re: cvs commit: src/sys/dev/re if_re.c Message-ID: <20050917101552.GC22151@ip.net.ua> In-Reply-To: <20050916230608.AA96916A420@hub.freebsd.org> References: <20050916.151301.122028383.imp@bsdimp.com> <20050916230608.AA96916A420@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--uXxzq0nDebZQVNAZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Fri, Sep 16, 2005 at 11:06:08PM +0000, Bill Paul wrote: > If you insist on sticking to the "no twiddling IFF_UP from inside > the driver" rule, then I think the problem can be avoided by simply not > being lazy in foo_ioctl() and actually having explicit code in SIOCSIFFLA= GS > case that turns promisc mode on and off on an IFF_PROMISC transition, > and is careful not to do it unless IFF_RUNNING is set. It also > needs to handle IFF_UP separately from IFF_PROMISC. I think the > correct logic would look something like: >=20 > if (IFF_UP was toggled up) > foo_init(sc); > else if (IFF_UP was toggled down) > foo_stop(sc); >=20 > if (IFF_PROMISC was toggled up && ifp->if_flags & IFF_RUNNING) > foo_set_promisc(sc); > else if (IFF_PROMISC was toggled down && ifp->if_flags & IFF_RUNNING) > foo_clear_promisc(sc); >=20 How about prototyping the "lazy" SIOCSIFFLAGS handler as follows: if (IFF_UP has toggled up) foo_init(); /* foo_init takes care of IFF_PROMISC etc. */ else if (IFF_UP has toggled down) foo_stop(); else if (IFF_DRV_RUNNING) { if (something interesting has toggled) foo_init(); } Non-lazy handlers can specifially process IFF_PROMISC|IFF_ALLMULTI toggles. For comparison, the current "lazy" handler is as follows: if (IFF_UP) foo_init(); else if (!IFF_UP & IFF_DRV_RUNNING) foo_stop(); I.e., it doesn't remember the previous state. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --uXxzq0nDebZQVNAZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDK+zXqRfpzJluFF4RAolZAJ4y+0V9/QikPJBEuDECfo7TFuHxXQCfbLhK /Bn2nksCGiuLfm2uNuyzACU= =IevN -----END PGP SIGNATURE----- --uXxzq0nDebZQVNAZ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050917101552.GC22151>