From owner-freebsd-net@FreeBSD.ORG Mon Dec 9 16:31:18 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0E9D3A7; Mon, 9 Dec 2013 16:31:18 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92DDC18E8; Mon, 9 Dec 2013 16:31:18 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6C9A5B91E; Mon, 9 Dec 2013 11:31:17 -0500 (EST) From: John Baldwin To: "Justin T. Gibbs" , Roger Pau =?utf-8?q?Monn=C3=A9?= Subject: Re: Defaults for if_capenable and detecting user initiated changes Date: Fri, 6 Dec 2013 11:53:08 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <0E13D481-9D6D-4B52-A5AD-B671BF3A85AF@scsiguy.com> <201312031213.41677.jhb@freebsd.org> <526A243B-7B66-45BD-9B45-3BFB04F1E16D@scsiguy.com> In-Reply-To: <526A243B-7B66-45BD-9B45-3BFB04F1E16D@scsiguy.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201312061153.08202.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Dec 2013 11:31:17 -0500 (EST) Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 16:31:18 -0000 On Friday, December 06, 2013 11:25:48 am Justin T. Gibbs wrote: > On Dec 3, 2013, at 10:13 AM, John Baldwin wrote: >=20 > > On Wednesday, November 27, 2013 12:59:08 pm Justin T. Gibbs wrote: > >> Hi net, > >>=20 > >> I=E2=80=99m reviewing a patch from Roger Pau Monn=C3=A9 for the Xen ne= tfront driver. The=20 > > goal of the change is to avoid disturbing the user=E2=80=99s settings f= or the=20 > > interface just because the backend device has changed or the connection= to the=20 > > backend was reset. I=E2=80=99ve attached the latest version of the pat= ch. > >>=20 > >> The current patch leaves the interface settings alone if they can be=20 > > supported by the newly attached backend. What would be ideal is to ena= ble=20 > > capabilities that default to being enabled if they were not explicitly= =20 > > disabled by the user and can be supported by the new backend. Unfortun= ately,=20 > > I don=E2=80=99t think the if_capenable and if_capabilities fields are d= escriptive=20 > > enough to deal with an interface whose capabilities can change at runti= me. =20 > > Just as can be done with link speed, some of these settings need to all= ow an=20 > > =E2=80=9Cauto/default=E2=80=9D setting in addition to on or off. This = would allow the user to=20 > > explicitly disable a capability if needed, but generally allow the syst= em to=20 > > chose the most optimal settings when they are supported. Would this be= =20 > > difficult to add? > >=20 > > Couldn't you maintain this state in the Xen netfront driver's softc? > > You already get the ioctls that track changes to the capenable field, > > so you when a change explicitly disables a capability you can set that > > in a 'forced off' or 'forced on' field. Perhaps more of a 'forced' > > field that you just update by doing: > >=20 > > sc->capforced |=3D (oldcapenable ^ newcapenable) > >=20 > > However, it's not clear to me if you can get the underlying adapters > > initial capenable list. If so, I think capforced should be all you > > need to handle this (though it might be easier if you have separate > > forcedon and forcedoff fields). > >=20 > > --=20 > > John Baldwin >=20 > Certainly this could be done in the Xen driver. The reason I posted my q= uestion, however, was to ask whether this should be more generically=20 tracked by the if layer instead of handled by the underlying driver. Lots = of user interfaces support a =E2=80=9Crestore defaults=E2=80=9D capability = (e.g. for the=20 novice administrator who screws up, or as a step in writing a script/proced= ure that starts by getting to a known state), so I think this is=20 interesting for more than this particular Xen issue. Hmm. In terms of drivers where capenable can change at runtime, I think Xen's netfront is unique in that regard. However, it might be nice to know what the defaults are (basically, what the initial setting of if_capenable is). You could even just cache that when if_attach() is called without needing to change any drivers, just add a new ifnet field that if_attach() sets. =2D-=20 John Baldwin