Re: adding if_dev member to struct ifnet

From: Harti Brandt (brandt_at_fokus.fraunhofer.de)
Date: 10/02/03

  • Next message: Harti Brandt: "Re: adding if_dev member to struct ifnet"
    Date: Thu, 2 Oct 2003 09:57:21 +0200 (CEST)
    To: Brooks Davis <brooks@one-eyed-alien.net>
    
    

    On Wed, 1 Oct 2003, Brooks Davis wrote:

    BD>On Wed, Oct 01, 2003 at 08:38:13PM +0200, Vincent Jardin wrote:
    BD>> > > messier BD>example is in the new ATM code where interfaces are looked up
    BD>> > > by name.
    BD>> > >
    BD>> > > Where is this?
    BD>> >
    BD>> > One example would be in sys/netatm/atm_if.c around line 1081.
    BD>>
    BD>> Do you mean pif_name and pif_unit ?
    BD>
    BD>Yes.
    BD>
    BD>> This code could be updated. It uses pif_unit and pif_name that could become
    BD>> pif_xname.
    BD>
    BD>I've done something like this in my perforce branch
    BD>(//depot/user/brooks/xname/...), but it isn't a real solution because
    BD>I plan to follow up by breaking the assumption that if_xname remains
    BD>constant for the life of the interface. If either if_dev or
    BD>if_d{name,unit} are added, you could use those as you do now.

    I think we need one of those to support SNMP semantics for interfaces.
    The SNMP RFC says, that the interface index to physical instance binding
    must be persistant even if the interface is renamed. This requires an
    identification for the interface that is tied to the hardware.

    BD>You might consider using if_index instead since that's both unchanged
    BD>over the life of the device and quick to check.

    The PIF has no ifnet and hence no if_index.

    harti

    BD>
    BD>> snprintf(nip->nif_xname, sizeof(nip->nif_xname), "%s%d",
    BD>> asr->asr_nif_pref, count);
    BD>> nip->nif_sel = count; /* we need to keep a selector to
    BD>> build the UNI ATM address */
    BD>>
    BD>> ifp->if_xname = nip->nif_xname;
    BD>
    BD>Actually, this needs to be a strlcpy. if_xname is stored in the ifnet,
    BD>not as a pointer, but that's a minor detail.
    BD>
    BD>-- Brooks
    BD>
    BD>

    -- 
    harti brandt,
    http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
    brandt@fokus.fraunhofer.de, harti@freebsd.org
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Harti Brandt: "Re: adding if_dev member to struct ifnet"

    Relevant Pages

    • Re: cvs commit: src/sys/net if_vlan.c
      ... refcounting at ifnet level. ... since mbufs point to ifnets it is almost impossible to ... interfaces become dead and be GC'd after a timeout in order to reduce the ... have the ifnet continue to be visible and occupy space in the interface ...
      (freebsd-net)
    • Re: cvs commit: src/sys/net if_vlan.c
      ... Detach the interface first, do vlan_unconfigthen. ... another thread could get a pointer to the ... refcounting at ifnet level. ...
      (freebsd-net)
    • Re: IGMP+WiFi panic on recent kernel - in igmp_fasttimo()
      ... In my case (creating a wlan ifnet and then destroying it on ... my wired interface, however it happens regularly on my wireless ... Configure VAP params for wlan0 card in rc.conf ...
      (freebsd-current)
    • Re: IGMP+WiFi panic on recent kernel - in igmp_fasttimo()
      ... In my case (creating a wlan ifnet and then destroying it on ... my wired interface, however it happens regularly on my wireless ... Configure VAP params for wlan0 card in rc.conf ...
      (freebsd-net)
    • Re: cvs commit: src/sys/net if_vlan.c
      ... I suppose that my change eliminated a concurrency problem in vlanand we began to feel the lack of refcounting at ifnet level. ... Mbufs may persist almost indefinitly in a socket receive buffer, well after the given receive interface has gone away. ... mbuf pointer issue, we can fix other types of ifnet references to be real, such as references from heavier weight administrative structures and operations, even if mbufs don't get them. ... An example of a "bad" implementation of dead would have the ifnet continue to be visible and occupy space in the interface name space, preventing tun0 from being immediately reallocated after it is destroyed. ...
      (freebsd-net)