svn commit: r227459 - in head/sys: dev/lmc net netgraph netinet

Brooks Davis brooks at freebsd.org
Fri Dec 9 23:26:38 UTC 2011


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 at 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().
> 
> 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

> 
> >
> > ?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
> > ==============================================================================
> > --- head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -4945,7 +4945,9 @@ lmc_ifnet_detach(softc_t *sc)
> > ? /* Detach from the ifnet kernel interface. */
> > ? if_detach(sc->ifp);
> >
> > -# if (__FreeBSD_version >= 600000)
> > +# if (defined(__FreeBSD__) && __FreeBSD_version >= 800082)
> > + ?if_free(sc->ifp);
> > +# elif (defined(__FreeBSD__) && __FreeBSD_version >= 600000)
> > ? if_free_type(sc->ifp, NSPPP ? IFT_PPP : IFT_OTHER);
> > ?# endif
> > ? }
> >
> > Modified: head/sys/net/if_bridge.c
> > ==============================================================================
> > --- head/sys/net/if_bridge.c ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/net/if_bridge.c ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -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
> > ==============================================================================
> > --- head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -275,7 +275,7 @@ lagg_clone_create(struct if_clone *ifc,
> > ? ? ? ? ? ? ? ?if (lagg_protos[i].ti_proto == LAGG_PROTO_DEFAULT) {
> > ? ? ? ? ? ? ? ? ? ? ? ?sc->sc_proto = lagg_protos[i].ti_proto;
> > ? ? ? ? ? ? ? ? ? ? ? ?if ((error = lagg_protos[i].ti_attach(sc)) != 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 = IFT_ETHER;
> > ? ? ? ?ifp->if_softc = sc;
> > ? ? ? ?ifp->if_start = lagg_start;
> > ? ? ? ?ifp->if_init = 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 attached
> > + ? ? ? ?* Attach as an ordinary ethernet device, children will be attached
> > ? ? ? ? * 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
> > ==============================================================================
> > --- head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -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
> > ==============================================================================
> > --- head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -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 lists */
> > ? ? ? ?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
> > ==============================================================================
> > --- head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -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
> > ==============================================================================
> > --- head/sys/netinet/ip_carp.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r227458)
> > +++ head/sys/netinet/ip_carp.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r227459)
> > @@ -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
> >
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20111209/b005f6e6/attachment.pgp


More information about the svn-src-head mailing list