Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2011 17:25:24 -0600
From:      Brooks Davis <brooks@freebsd.org>
To:        Ben Laurie <benl@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r227459 - in head/sys: dev/lmc net netgraph netinet
Message-ID:  <20111209232524.GD60242@lor.one-eyed-alien.net>
In-Reply-To: <CAG5KPzxfAoDMBC8qxBD78QuabiLQbuPtmJaUsDS-izcwte62tA@mail.gmail.com>
References:  <201111112257.pABMvqjl012442@svn.freebsd.org> <CAG5KPzxfAoDMBC8qxBD78QuabiLQbuPtmJaUsDS-izcwte62tA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--u65IjBhB3TIa72Vp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Nov 12, 2011 at 04:33:36PM -0800, Ben Laurie wrote:
> On Fri, Nov 11, 2011 at 2:57 PM, Brooks Davis <brooks@freebsd.org> wrote:
> > Author: brooks
> > Date: Fri Nov 11 22:57:52 2011
> > New Revision: 227459
> > URL: http://svn.freebsd.org/changeset/base/227459
> >
> > Log:
> > ?In r191367 the need for if_free_type() was removed and a new member
> > ?if_alloctype was used to store the origional interface type. ?Take
> > ?advantage of this change by removing all existing uses of if_free_type=
()
> > ?in favor of if_free().
>=20
> Just an observation: this change removes an annotation that could be
> useful for correctness checking. Do we care?

Oops, I meant to respond to this earlier.  I think in this case it's not
a significant loss because we're only losing this annotation in 7 of the
approximately 200 locations we free an interface.  A better overall
solution to this correctness issue would be a mechanism to assert that
assignments to ifp->if_alloctype only occur if_alloc() and that
similarly ifp->if_l2com isn't changed outside if_alloc/if_free().

-- Brooks

>=20
> >
> > ?MFC after: ? ?1 Month
> >
> > Modified:
> > ?head/sys/dev/lmc/if_lmc.c
> > ?head/sys/net/if_bridge.c
> > ?head/sys/net/if_lagg.c
> > ?head/sys/net/if_tap.c
> > ?head/sys/net/if_vlan.c
> > ?head/sys/netgraph/ng_fec.c
> > ?head/sys/netinet/ip_carp.c
> >
> > Modified: head/sys/dev/lmc/if_lmc.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -4945,7 +4945,9 @@ lmc_ifnet_detach(softc_t *sc)
> > ? /* Detach from the ifnet kernel interface. */
> > ? if_detach(sc->ifp);
> >
> > -# if (__FreeBSD_version >=3D 600000)
> > +# if (defined(__FreeBSD__) && __FreeBSD_version >=3D 800082)
> > + ?if_free(sc->ifp);
> > +# elif (defined(__FreeBSD__) && __FreeBSD_version >=3D 600000)
> > ? if_free_type(sc->ifp, NSPPP ? IFT_PPP : IFT_OTHER);
> > ?# endif
> > ? }
> >
> > Modified: head/sys/net/if_bridge.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/net/if_bridge.c ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/net/if_bridge.c ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -676,7 +676,7 @@ bridge_clone_destroy(struct ifnet *ifp)
> >
> > ? ? ? ?bstp_detach(&sc->sc_stp);
> > ? ? ? ?ether_ifdetach(ifp);
> > - ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? if_free(ifp);
> >
> > ? ? ? ?/* Tear down the routing table. */
> > ? ? ? ?bridge_rtable_fini(sc);
> >
> > Modified: head/sys/net/if_lagg.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -275,7 +275,7 @@ lagg_clone_create(struct if_clone *ifc,
> > ? ? ? ? ? ? ? ?if (lagg_protos[i].ti_proto =3D=3D LAGG_PROTO_DEFAULT) {
> > ? ? ? ? ? ? ? ? ? ? ? ?sc->sc_proto =3D lagg_protos[i].ti_proto;
> > ? ? ? ? ? ? ? ? ? ? ? ?if ((error =3D lagg_protos[i].ti_attach(sc)) !=
=3D 0) {
> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free(ifp);
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?free(sc, M_DEVBUF);
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return (error);
> > ? ? ? ? ? ? ? ? ? ? ? ?}
> > @@ -293,7 +293,6 @@ lagg_clone_create(struct if_clone *ifc,
> > ? ? ? ?ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
> >
> > ? ? ? ?if_initname(ifp, ifc->ifc_name, unit);
> > - ? ? ? ifp->if_type =3D IFT_ETHER;
> > ? ? ? ?ifp->if_softc =3D sc;
> > ? ? ? ?ifp->if_start =3D lagg_start;
> > ? ? ? ?ifp->if_init =3D lagg_init;
> > @@ -305,7 +304,7 @@ lagg_clone_create(struct if_clone *ifc,
> > ? ? ? ?IFQ_SET_READY(&ifp->if_snd);
> >
> > ? ? ? ?/*
> > - ? ? ? ?* Attach as an ordinary ethernet device, childs will be attach=
ed
> > + ? ? ? ?* Attach as an ordinary ethernet device, children will be atta=
ched
> > ? ? ? ? * as special device IFT_IEEE8023ADLAG.
> > ? ? ? ? */
> > ? ? ? ?ether_ifattach(ifp, eaddr);
> > @@ -352,7 +351,7 @@ lagg_clone_destroy(struct ifnet *ifp)
> >
> > ? ? ? ?ifmedia_removeall(&sc->sc_media);
> > ? ? ? ?ether_ifdetach(ifp);
> > - ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? if_free(ifp);
> >
> > ? ? ? ?mtx_lock(&lagg_list_mtx);
> > ? ? ? ?SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries);
> >
> > Modified: head/sys/net/if_tap.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -218,7 +218,7 @@ tap_destroy(struct tap_softc *tp)
> > ? ? ? ?knlist_destroy(&tp->tap_rsel.si_note);
> > ? ? ? ?destroy_dev(tp->tap_dev);
> > ? ? ? ?ether_ifdetach(ifp);
> > - ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? if_free(ifp);
> >
> > ? ? ? ?mtx_destroy(&tp->tap_mtx);
> > ? ? ? ?free(tp, M_TAP);
> >
> > Modified: head/sys/net/if_vlan.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -967,7 +967,7 @@ vlan_clone_create(struct if_clone *ifc,
> > ? ? ? ? ? ? ? ? ? ? ? ? */
> > ? ? ? ? ? ? ? ? ? ? ? ?ether_ifdetach(ifp);
> > ? ? ? ? ? ? ? ? ? ? ? ?vlan_unconfig(ifp);
> > - ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? ? ? ? ? ? ? ? ? if_free(ifp);
> > ? ? ? ? ? ? ? ? ? ? ? ?ifc_free_unit(ifc, unit);
> > ? ? ? ? ? ? ? ? ? ? ? ?free(ifv, M_VLAN);
> >
> > @@ -989,7 +989,7 @@ vlan_clone_destroy(struct if_clone *ifc,
> >
> > ? ? ? ?ether_ifdetach(ifp); ? ?/* first, remove it from system-wide lis=
ts */
> > ? ? ? ?vlan_unconfig(ifp); ? ? /* now it can be unconfigured and freed =
*/
> > - ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? if_free(ifp);
> > ? ? ? ?free(ifv, M_VLAN);
> > ? ? ? ?ifc_free_unit(ifc, unit);
> >
> >
> > Modified: head/sys/netgraph/ng_fec.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -1332,7 +1332,7 @@ ng_fec_shutdown(node_p node)
> > ? ? ? ?}
> >
> > ? ? ? ?ether_ifdetach(priv->ifp);
> > - ? ? ? if_free_type(priv->ifp, IFT_ETHER);
> > + ? ? ? if_free(priv->ifp);
> > ? ? ? ?ifmedia_removeall(&priv->ifmedia);
> > ? ? ? ?ng_fec_free_unit(priv->unit);
> > ? ? ? ?free(priv, M_NETGRAPH);
> >
> > Modified: head/sys/netinet/ip_carp.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/netinet/ip_carp.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745=
8)
> > +++ head/sys/netinet/ip_carp.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745=
9)
> > @@ -472,7 +472,7 @@ carp_clone_destroy(struct ifnet *ifp)
> > ? ? ? ?mtx_unlock(&carp_mtx);
> > ? ? ? ?bpfdetach(ifp);
> > ? ? ? ?if_detach(ifp);
> > - ? ? ? if_free_type(ifp, IFT_ETHER);
> > + ? ? ? if_free(ifp);
> > ?#ifdef INET
> > ? ? ? ?free(sc->sc_imo.imo_membership, M_CARP);
> > ?#endif
> >
>=20

--u65IjBhB3TIa72Vp
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iD8DBQFO4pjjXY6L6fI4GtQRAgRhAKDDJ9KWqyWecmxR0FDnV4eNBGtjIACgsyaz
+oWaHZHi/lAct3txgpia95Q=
=t61w
-----END PGP SIGNATURE-----

--u65IjBhB3TIa72Vp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111209232524.GD60242>