Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Oct 2003 20:38:13 +0200
From:      Vincent Jardin <vjardin@wanadoo.fr>
To:        Brooks Davis <brooks@one-eyed-alien.net>, Harti Brandt <brandt@fokus.fraunhofer.de>
Cc:        arch@freebsd.org
Subject:   Re: adding if_dev member to struct ifnet
Message-ID:  <200310012038.14062.vjardin@wanadoo.fr>
In-Reply-To: <20031001164036.GA1263@Odin.AC.HMC.Edu>
References:  <20030930174815.GC31908@Odin.AC.HMC.Edu> <20031001093334.S113@beagle.fokus.fraunhofer.de> <20031001164036.GA1263@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
> > messier BD>example is in the new ATM code where interfaces are looked=
 up
> > by name.
> >
> > Where is this?
>
> One example would be in sys/netatm/atm_if.c around line 1081.

Do you mean pif_name and pif_unit ?

This code could be updated. It uses pif_unit and pif_name that could beco=
me=20
pif_xname.

     for (pip =3D atm_interface_head; pip; pip =3D pip->pif_next) {
             if (strcmp(pip->pif_xname, n) =3D=3D 0)
                     break;
     }

instead of
     for (pip =3D atm_interface_head; pip; pip =3D pip->pif_next) {
             if ((pip->pif_unit =3D=3D unit) && (strcmp(pip->pif_name, n)=
 =3D=3D 0))
                     break;
     }

Moreover, a PIF (Physical IF) is not an ifnet. It is the ATM device. The =
ATM=20
PVC are the NIF (Network IF -> ifnet). They are many NIF (PVC) over a sin=
gle=20
PIF (ATM device).

With the ATM stack, the main issue is related to AIOCS_SET_NIF. It sets t=
he=20
ifp's if_name to the NIF's nif_name and the ifp's if_unit to a regular=20
counter.

In fact we could change the following code
                    strcpy ( nip->nif_name, asr->asr_nif_pref );
                    nip->nif_sel =3D count;

                    ifp->if_name =3D nip->nif_name;
                    ifp->if_unit =3D count;

   to

                    snprintf(nip->nif_xname, sizeof(nip->nif_xname), "%s%=
d",
                       asr->asr_nif_pref, count);
                    nip->nif_sel =3D count; /* we need to keep a selector=
 to=20
build the UNI ATM address  */

                    ifp->if_xname =3D nip->nif_xname;
#if 0
                    ifp->if_unit =3D count; /* it is not required anymore=
 */
#endif

Regards,
  Vincent




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